|
|
@ -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(); |
|
|
|