Browse Source

æ¸ht 测评得分

master
6 years ago
parent
commit
8214c5f83a
  1. 4
      ht/src/main/java/com/ccsens/ht/service/PatientReportService.java
  2. 19
      ht/src/main/java/com/ccsens/ht/service/QuestionService.java

4
ht/src/main/java/com/ccsens/ht/service/PatientReportService.java

@ -162,9 +162,9 @@ public class PatientReportService implements IPatientReportService {
List<HtDoctor> doctors = htDoctorMapper.selectByExample(doctorExample);
log.info("当前用户是否为医生:{}", CollectionUtil.isNotEmpty(doctors));
if (query.getPatientId() != null) {
reportExample.createCriteria().andPatientIdEqualTo(query.getPatientId());
reportExample.createCriteria().andPatientIdEqualTo(query.getPatientId()).andInitialImpressionIsNotNull().andInitialImpressionNotEqualTo("");
} else if (CollectionUtil.isNotEmpty(doctors)) {
reportExample.createCriteria().andDoctorIdEqualTo(doctors.get(0).getId());
reportExample.createCriteria().andDoctorIdEqualTo(doctors.get(0).getId()).andInitialImpressionIsNotNull().andInitialImpressionNotEqualTo("");
} else {
log.info("既无病人信息,有无医生信息,不允许查询");
throw new BaseException(CodeEnum.PARAM_ERROR);

19
ht/src/main/java/com/ccsens/ht/service/QuestionService.java

@ -198,18 +198,20 @@ public class QuestionService implements IQuestionService {
List<HtPatientScore> scores = getHtPatientScores(score, question, report, ruleList, nameOption, idOption);
if (!CollectionUtils.isEmpty(ruleList)) {
HtQuestionScoringRule rule = ruleList.get(0);
if (rule.getType() == null || rule.getType().byteValue() == Constant.Ht.Rule.SMALL) {
int currentNum = getCurrentNum(scores);
JSONArray ruleDetails = JSON.parseArray(rule.getDetail());
AtomicInteger patientScore = new AtomicInteger();
for (int i = 0; i < ruleDetails.size() - 1; i++) {
JSONObject small = (JSONObject)ruleDetails.get(i);
JSONObject next = (JSONObject)ruleDetails.get(i+1);
if (i == 0 && scores.size() <= small.getIntValue(Constant.Ht.Rule.SMALL_NUM)) {
if (i == 0 && currentNum <= small.getIntValue(Constant.Ht.Rule.SMALL_NUM)) {
patientScore.set(small.getIntValue(Constant.Ht.Rule.SMALL_SCORE));
break;
}
if (scores.size() > small.getIntValue(Constant.Ht.Rule.SMALL_NUM) && scores.size() <= next.getIntValue(Constant.Ht.Rule.SMALL_NUM)) {
if (currentNum > small.getIntValue(Constant.Ht.Rule.SMALL_NUM) && currentNum <= next.getIntValue(Constant.Ht.Rule.SMALL_NUM)) {
patientScore.set(next.getIntValue(Constant.Ht.Rule.SMALL_SCORE));
}
}
@ -244,6 +246,19 @@ public class QuestionService implements IQuestionService {
return CodeEnum.SUCCESS;
}
/**
* 查询试题正确个数
* @param scores
* @return
*/
private int getCurrentNum(List<HtPatientScore> scores) {
if (CollectionUtil.isEmpty(scores)) {
return 0;
}
// 分数>0, 算1道题
return scores.stream().mapToInt(score -> score.getScore() > 0 ? 1 : 0).sum();
}
private void optionUniq(QuestionDto.Score score) {
List<Long> ids = new ArrayList<>();
Iterator<QuestionDto.Option> iterator = score.getOptions().iterator();

Loading…
Cancel
Save