Browse Source

量表计分规则提交

zsy 1 year ago
parent
commit
2a7d04ea26

+ 2 - 2
src/main/java/com/rf/kjb/chat/rest/ChatController.java

@@ -283,9 +283,9 @@ public class ChatController extends BaseController {
             questionEntity.setQuestion(questionEntity.getQuestion().replace("days",String.valueOf(diff)));
         }
         //替换评测结果
-        if (questionEntity.getQuestion().contains("SDSEvaluationResult")){
+        if (questionEntity.getQuestion().contains("EvaluationResult")){
             IntelligentDialogueEntity intelligentDialogueEntity = this.intelligentDialogueService.findByIdentifierByLabelByNumByQuestionNo(identifier,label,num,"1");
-            questionEntity.setQuestion(questionEntity.getQuestion().replace("SDSEvaluationResult",intelligentDialogueEntity.getContent()));
+            questionEntity.setQuestion(questionEntity.getQuestion().replace("EvaluationResult",intelligentDialogueEntity.getContent()));
         }
         //替换治疗成绩
         if (questionEntity.getQuestion().contains("therapeuticAchievement")){

+ 119 - 38
src/main/java/com/rf/kjb/scale/scaleResult/POMSScaleNEW.java

@@ -2,13 +2,16 @@ package com.rf.kjb.scale.scaleResult;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.rf.kjb.scale.dao.dto.NewResultDto;
 import com.rf.kjb.scale.dao.model.*;
+import com.rf.kjb.scale.util.ScaleConstant;
 
+import java.math.BigDecimal;
 import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.rf.kjb.scale.scaleResult.NEWCOMMONScaleNEW.commonComputeDimensionScore;
 
 /**
  * @author zsy
@@ -21,60 +24,138 @@ public class POMSScaleNEW extends BaseScale {
         super(jsonArray, resultJson);
     }
 
-    public  JSONObject scaleCalculate() throws Exception {
+    public JSONObject scaleCalculate() throws Exception {
 
         //总分
         double score = 0;
+        DecimalFormat df = new DecimalFormat("######0.00");
+
         Map<String, String> resultMap0 = new LinkedHashMap<>();
-        List<Map<String,String>> resultMapList = new ArrayList<>();
+        List<Map<String, String>> resultMapList = new ArrayList<>();
+        //新版本数据格式
+        Map<String, Object> newResult = new LinkedHashMap<>();
 
         //获取答案列表
         List<AnswerEntity> answerEntities = (List<AnswerEntity>) resultJson.get("answerEntities");
-        //获取题目和答案列表
-        List<ScaleEntry> scaleEntities = (List<ScaleEntry>) resultJson.get("scaleEntities");
         //获取评分规则列表
         List<ScaleMarksEntity> scaleMarksEntities = (List<ScaleMarksEntity>) resultJson.get("scaleMarksEntities");
         //获取维度信息列表
         List<DimensionEntity> dimensionEntities = (List<DimensionEntity>) resultJson.get("dimensionEntities");
-        if (dimensionEntities.size() > 0){
-            //计算每个维度得分
-            double[] dimensionScore = new double[dimensionEntities.size()];
-            for (int i = 0; i < jsonArray.size(); i++) {
-                JSONObject jsonObject1 = jsonArray.getJSONObject(i);
-                for (int y = 0; y < dimensionEntities.size(); y++) {
-                    //for (DimensionEntity dimensionEntity:dimensionEntities){
-                    DimensionEntity dimensionEntity = dimensionEntities.get(y);
-                    String questionNos = dimensionEntity.getQuestionNo();
-                    String[] questionNo = questionNos.split(";");
-                    for (String question:questionNo){
-                        if (question.equals(jsonObject1.getString("questionNo"))){
-                            for (AnswerEntity answerEntity:answerEntities){
-                                if (answerEntity.getQuestionNo().equals(question) && answerEntity.getName().equals(jsonObject1.getString("checkItems"))){
-                                    dimensionScore[y] += Double.valueOf(answerEntity.getScore());
-                                }
+        //计算每个维度得分dimensionEntities
+        double[] dimensionScore = new double[dimensionEntities.size()];
+        Map<String,Double> dimensionScoreMap = new HashMap<>();
+        //jsonArray:用户自己选择的题目选项
+        for (int i = 0; i < jsonArray.size(); i++) {
+            JSONObject jsonObject1 = jsonArray.getJSONObject(i);
+            //计算维度分数
+            for (int y = 0; y < dimensionEntities.size(); y++) {
+                //获取维度信息
+                DimensionEntity dimensionEntity = dimensionEntities.get(y);
+                //获取该维度下有哪些选项
+                String questionNos = dimensionEntity.getQuestionNo();
+                //删除空白字符后得到进行划分得到选择题号
+                String[] questionNo = questionNos.replaceAll("\\s", "").split(";");
+                //计算每道题的得分
+                for (String question : questionNo) {
+                    if (question.equals(jsonObject1.getString("questionNo"))) {
+                        //获取所有答案中本道题目的答案list数组
+                        List<AnswerEntity> nowQuestionAnswerList = answerEntities.stream().filter(answerEntity -> answerEntity.getQuestionNo().equals(question)).collect(Collectors.toList());
+                        //本题目的正确答案与自己的选项进行对比,正确的话相应分数进行相加
+                        for (AnswerEntity answerEntity : nowQuestionAnswerList) {
+                            if (answerEntity.getName().replaceAll("\\s", "").equals(jsonObject1.getString("checkItems").replaceAll("\\s", ""))) {
+                                dimensionScoreMap.put(dimensionEntity.getId(),dimensionScoreMap.get(dimensionEntity.getId())==null?Double.parseDouble(answerEntity.getScore()):(dimensionScoreMap.get(dimensionEntity.getId()) +Double.parseDouble(answerEntity.getScore())));
+                                dimensionScore[y] += Double.parseDouble(answerEntity.getScore());
+                                break;
                             }
-                            break;
                         }
                     }
                 }
             }
-
-            score = dimensionScore[0]+dimensionScore[1]+dimensionScore[2]+dimensionScore[3]+dimensionScore[5]-dimensionScore[4]-dimensionScore[6]+100;
-            resultMap0.put("TMD(情绪纷乱的总分)", String.valueOf(score));
-            resultJson.put("TMD(情绪纷乱的总分)", String.valueOf(score));
-            for (int y = 0; y < dimensionEntities.size(); y++) {
-                DimensionEntity dimensionEntity = dimensionEntities.get(y);
-                DecimalFormat df = new DecimalFormat("######0.00");
-                resultMap0.put(dimensionEntity.getName() + "得分", String.valueOf(Double.parseDouble(df.format(dimensionScore[y]))));
-                resultJson.put(dimensionEntity.getName() + "得分", String.valueOf(Double.parseDouble(df.format(dimensionScore[y]))));
+            resultJson.put("dimensionScoreMap",dimensionScoreMap);
+        }
+        //计算总分
+        score = dimensionScore[0] + dimensionScore[1] + dimensionScore[2] + dimensionScore[3] + dimensionScore[5] - dimensionScore[4] - dimensionScore[6] + 100;
+        //将量表总维度根据维度名称进行分组
+        Map<String, List<ScaleMarksEntity>> scaleMarksMap = scaleMarksEntities.stream().collect(Collectors.groupingBy(ScaleMarksEntity::getName));
+        //返回值以及存数据库格式
+        List<NewResultDto> newResultDtos = new ArrayList<>();
+        resultMap0.put("总分", df.format(score));
+        resultJson.put("总分", df.format(score));
+        BigDecimal scoreDecimal = new BigDecimal(df.format(score));
+        //如果没有总分这一栏,需要手动赋值返回
+        List<ScaleMarksEntity> totalScore = scaleMarksMap.get("总分");
+        List<ScaleMarksEntity> totalScores = scaleMarksMap.get("无");
+        if (totalScore == null) {
+            if (totalScores == null){
+                newResultDtos.add(new NewResultDto("总分", df.format(score), "无", "无",
+                        "无", "无", "无", "无", "是"));
+            }else {
+                for (ScaleMarksEntity tempTotalScore : totalScores) {
+                    BigDecimal scoreStart = new BigDecimal(tempTotalScore.getScoreStart());
+                    BigDecimal scoreEnd = new BigDecimal(tempTotalScore.getScoreEnd());
+                    if (scoreDecimal.compareTo(scoreEnd) <= 0 && scoreDecimal.compareTo(scoreStart) >= 0) {
+                        newResultDtos.add(new NewResultDto("总分", df.format(score), tempTotalScore.getSymptom(), tempTotalScore.getImprovementSuggestions(),
+                                tempTotalScore.getFlag(), tempTotalScore.getReference(), tempTotalScore.getNameExplain(), tempTotalScore.getSuggestion(), tempTotalScore.getIsTotalScoreExplain()));
+                        resultMap0.put("总分症状", tempTotalScore.getSymptom());
+                        resultMap0.put("总分指导语", tempTotalScore.getImprovementSuggestions());
+                        resultMap0.put("总分因子解释", tempTotalScore.getNameExplain());
+                        resultMap0.put("总分建议", tempTotalScore.getSuggestion());
+                        resultJson.put("总分症状", tempTotalScore.getSymptom());
+                        resultJson.put("总分指导语", tempTotalScore.getImprovementSuggestions());
+                        resultJson.put("总分因子解释", tempTotalScore.getNameExplain());
+                        resultJson.put("总分建议", tempTotalScore.getSuggestion());
+                    }
+                }
+            }
+        } else {
+            for (ScaleMarksEntity tempTotalScore : totalScore) {
+                BigDecimal scoreStart = new BigDecimal(tempTotalScore.getScoreStart());
+                BigDecimal scoreEnd = new BigDecimal(tempTotalScore.getScoreEnd());
+                if (scoreDecimal.compareTo(scoreEnd) <= 0 && scoreDecimal.compareTo(scoreStart) >= 0) {
+                    newResultDtos.add(new NewResultDto("总分", df.format(score), tempTotalScore.getSymptom(), tempTotalScore.getImprovementSuggestions(),
+                            tempTotalScore.getFlag(), tempTotalScore.getReference(), tempTotalScore.getNameExplain(), tempTotalScore.getSuggestion(), tempTotalScore.getIsTotalScoreExplain()));
+                    resultMap0.put("总分症状", tempTotalScore.getSymptom());
+                    resultMap0.put("总分指导语", tempTotalScore.getImprovementSuggestions());
+                    resultMap0.put("总分因子解释", tempTotalScore.getNameExplain());
+                    resultMap0.put("总分建议", tempTotalScore.getSuggestion());
+                    resultJson.put("总分症状", tempTotalScore.getSymptom());
+                    resultJson.put("总分指导语", tempTotalScore.getImprovementSuggestions());
+                    resultJson.put("总分因子解释", tempTotalScore.getNameExplain());
+                    resultJson.put("总分建议", tempTotalScore.getSuggestion());
+                }
             }
-            resultMapList.add(resultMap0);
         }
 
+
+        JSONObject iconInfo = new JSONObject();
+        //雷达图需要的维度以及最大值
+        List<Map<String, Object>> indicator = new LinkedList<>();
+        //雷达图所需要的常模参考值
+        LinkedList<String> reference = new LinkedList<>();
+        //雷达图需要的分数
+        LinkedList<String> scoreList = new LinkedList<>();
+        //计算维度所在评分区间
+        commonComputeDimensionScore(df, resultMap0, resultJson, dimensionEntities, dimensionScore, scaleMarksMap, newResultDtos, indicator, reference, scoreList);
+        //需要图表展示的
+        iconInfo.put("indicator", indicator);
+        //判断是否有常模参考值,即reference的内容如果全为0,则不进行返回
+        if (!reference.stream().allMatch("0"::equals)) {
+            iconInfo.put("reference", reference);
+        }
+        iconInfo.put("scoreList", scoreList);
+        if (indicator.size() == 0 && reference.size() == 0) {
+            newResult.put("iconInfo", "");
+        } else {
+            newResult.put("iconInfo", iconInfo);
+        }
+        newResult.put("result", newResultDtos);
+        resultMapList.add(resultMap0);
+
+
         JSONObject returnJson = new JSONObject(true);
-        returnJson.put("resultMapList",resultMapList);
-        //returnJson.put("scaleName",resultJson.getString("scaleName"));
-        returnJson.put("resultJson",resultJson);
+        returnJson.put("resultMapList", resultMapList);
+        returnJson.put("resultJson", resultJson);
+        returnJson.put(ScaleConstant.ResultEnum.RESULT_NEW_FIELD.getKeyword(), newResult);
 
         return returnJson;
     }

+ 274 - 1
src/main/java/com/rf/kjb/scale/scaleResult/SCL90ScaleNEW.java

@@ -25,7 +25,7 @@ public class SCL90ScaleNEW extends BaseScale {
         super(jsonArray, resultJson);
     }
 
-    public JSONObject scaleCalculate() throws Exception {
+    /*public JSONObject scaleCalculate() throws Exception {
 
         //总分
         double score = 0;
@@ -203,6 +203,279 @@ public class SCL90ScaleNEW extends BaseScale {
         returnJson.put("resultJson", resultJson);
         returnJson.put("newResultJson", newResult);
 
+        return returnJson;
+    }*/
+    public JSONObject scaleCalculate() throws Exception {
+
+        //总分
+        double score = 0;
+        //总均分
+        double GPA = 0;
+        //阳性项目数
+        int positive = 0;
+        //阳性项目总分
+        int positiveScore = 0;
+
+        DecimalFormat df = new DecimalFormat("######0.00");
+
+        Map<String, String> resultMap0 = new LinkedHashMap<>();
+        //老版本数据格式
+        Map<String, Object> newResult = new LinkedHashMap<>();
+        List<Map<String, String>> resultMapList = new ArrayList<>();
+
+
+        //获取答案列表
+        List<AnswerEntity> answerEntities = (List<AnswerEntity>) resultJson.get("answerEntities");
+        //获取评分规则列表
+        List<ScaleMarksEntity> scaleMarksEntities = (List<ScaleMarksEntity>) resultJson.get("scaleMarksEntities");
+        //获取维度信息列表
+        List<DimensionEntity> dimensionEntities = (List<DimensionEntity>) resultJson.get("dimensionEntities");
+        //计算每个维度得分dimensionEntities
+        double[] dimensionScore = new double[dimensionEntities.size()];
+        Map<String,Double> dimensionScoreMap = new HashMap<>();
+        //jsonArray:用户自己选择的题目选项
+        for (int i = 0; i < jsonArray.size(); i++) {
+            JSONObject jsonObject1 = jsonArray.getJSONObject(i);
+            for (int y = 0; y < dimensionEntities.size(); y++) {
+                //获取维度信息
+                DimensionEntity dimensionEntity = dimensionEntities.get(y);
+                //获取该维度下有哪些选项
+                String questionNos = dimensionEntity.getQuestionNo();
+                //得到选择题号
+                String[] questionNo = questionNos.split(";");
+                //计算每道题的得分
+                for (String question : questionNo) {
+                    if (question.equals(jsonObject1.getString("questionNo"))) {
+                        //获取所有答案中本道题目的答案list数组
+                        List<AnswerEntity> nowQuestionAnswerList = answerEntities.stream().filter(answerEntity -> answerEntity.getQuestionNo().equals(question)).collect(Collectors.toList());
+                        //本题目的正确答案与自己的选项进行对比,正确的话相应分数进行相加
+                        for (AnswerEntity answerEntity : nowQuestionAnswerList) {
+                            if (answerEntity.getName().equals(jsonObject1.getString("checkItems"))) {
+                                dimensionScore[y] += Double.parseDouble(answerEntity.getScore());
+                                dimensionScoreMap.put(dimensionEntity.getId(),dimensionScoreMap.get(dimensionEntity.getId())==null?Double.parseDouble(answerEntity.getScore()):(dimensionScoreMap.get(dimensionEntity.getId()) +Double.parseDouble(answerEntity.getScore())));
+                                //如果用户选择的当前题目的的分数大于2分,即为阳性项目分,并进行处理
+                                if (Integer.parseInt(answerEntity.getScore()) >= 2) {
+                                    positive += 1;
+                                    positiveScore += Integer.parseInt(answerEntity.getScore());
+                                }
+                                //计算总分
+                                score += Integer.parseInt(answerEntity.getScore());
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        //判断维度分是否为求平均值
+        boolean totalMark = true;
+        if(dimensionEntities.size() > 0) {
+            for (int y = 0; y < dimensionEntities.size(); y++) {
+                String[] questionNo = dimensionEntities.get(y).getQuestionNo().split(";");
+                for (ScaleMarksEntity scaleMarksEntity : scaleMarksEntities){
+                    //判断总分是否需要处理
+                    if (totalMark){
+                        if (scaleMarksEntity.getName().equals("总分") || scaleMarksEntity.getName().equals("无")){
+                            if (scaleMarksEntity.getScoringType().equals(Constant.DEFAULT_VALUE_ONE)){
+                                score = Double.parseDouble(df.format(score / jsonArray.size()));
+                                totalMark = false;
+                            }else if (scaleMarksEntity.getScoringType().equals(Constant.QUESTION_TYPE_TWO)){
+                                score = Math.round(score / jsonArray.size());
+                                totalMark = false;
+                            }
+                        }
+                    }
+                    //判断维度分是否需要处理
+                    if (scaleMarksEntity.getName().equals(dimensionEntities.get(y).getName())){
+                        if (scaleMarksEntity.getScoringType().equals(Constant.DEFAULT_VALUE_ONE)){
+                            dimensionScore[y] = Double.parseDouble(df.format(dimensionScore[y] / questionNo.length));
+                            dimensionScoreMap.put(dimensionEntities.get(y).getId(),dimensionScore[y]);
+                            break;
+                        }else if (scaleMarksEntity.getScoringType().equals(Constant.QUESTION_TYPE_TWO)){
+                            dimensionScore[y] = Math.round(dimensionScore[y] / questionNo.length);
+                            dimensionScoreMap.put(dimensionEntities.get(y).getId(),dimensionScore[y]);
+                            break;
+                        }
+
+                    }
+                }
+            }
+        }
+
+        if(dimensionScoreMap.size()>0){
+            resultJson.put("dimensionScoreMap",dimensionScoreMap);
+        }
+        //将量表总维度根据维度名称进行分组
+        Map<String, List<ScaleMarksEntity>> scaleMarksMap = scaleMarksEntities.stream().collect(Collectors.groupingBy(ScaleMarksEntity::getName));
+        //返回值以及存数据库格式
+        List<NewResultDto> newResultDtos = new ArrayList<>();
+
+        resultMap0.put("总分", String.valueOf(score));
+        resultJson.put("总分", String.valueOf(score));
+
+        /*GPA = Double.parseDouble(df.format(score / 90));
+        resultMap0.put("总均分", String.valueOf(GPA));
+        resultJson.put("总均分", String.valueOf(GPA));*/
+
+        List<ScaleMarksEntity> totalScore = scaleMarksMap.get("总分");
+        ScaleMarksEntity tempTotalScore = totalScore.get(0);
+        newResultDtos.add(new NewResultDto("总分", String.valueOf(score), tempTotalScore.getSymptom(), tempTotalScore.getImprovementSuggestions(),
+                tempTotalScore.getFlag(), tempTotalScore.getReference(), tempTotalScore.getNameExplain(), tempTotalScore.getSuggestion(), tempTotalScore.getIsTotalScoreExplain()));
+
+        /*List<ScaleMarksEntity> gpaScale = scaleMarksMap.get("总均分");
+        for (ScaleMarksEntity scaleMarksEntity : gpaScale) {
+            if (GPA <= Double.parseDouble(df.format(Double.parseDouble(scaleMarksEntity.getScoreEnd()))) && GPA >= Double.parseDouble(df.format(Double.parseDouble(scaleMarksEntity.getScoreStart())))) {
+                resultMap0.put("总均分常模参考值", scaleMarksEntity.getReference());
+                resultMap0.put("总均分症状", scaleMarksEntity.getSymptom());
+                resultJson.put("总均分症状", scaleMarksEntity.getSymptom());
+                resultMap0.put("总均分因子解释", scaleMarksEntity.getNameExplain());
+                resultMap0.put("总均分指导语", scaleMarksEntity.getImprovementSuggestions());
+                resultMap0.put("总均分建议", scaleMarksEntity.getSuggestion());
+
+                NewResultDto newResultDto = new NewResultDto();
+                BeanUtils.copyProperties(scaleMarksEntity, newResultDto);
+                newResultDto.setScore(String.valueOf(GPA));
+                newResultDtos.add(newResultDto);
+            }
+        }*/
+
+        resultMap0.put("阳性项目数", String.valueOf(positive));
+        resultJson.put("阳性项目数", String.valueOf(positive));
+        List<ScaleMarksEntity> tempPositive = scaleMarksMap.get("阳性项目数");
+        ScaleMarksEntity scaleMarksEntity1 = tempPositive.get(0);
+        NewResultDto newResultDto = new NewResultDto();
+        BeanUtils.copyProperties(scaleMarksEntity1, newResultDto);
+        newResultDto.setScore(String.valueOf(positive));
+        newResultDtos.add(newResultDto);
+
+        resultMap0.put("阴性项目数", String.valueOf(90 - positive));
+        resultJson.put("阴性项目数", String.valueOf(90 - positive));
+        List<ScaleMarksEntity> tempPositive1 = scaleMarksMap.get("阴性项目数");
+        NewResultDto newResultDto2 = new NewResultDto();
+        BeanUtils.copyProperties(tempPositive1.get(0), newResultDto2);
+        newResultDto2.setScore(String.valueOf(90 - positive));
+        newResultDtos.add(newResultDto2);
+
+        /*NewResultDto newResultDto3 = new NewResultDto();
+        if (positive == 0) {
+            resultMap0.put("阳性症状均分", "0");
+            resultJson.put("阳性症状均分", "0");
+            newResultDto3.setScore("0");
+        } else {
+            resultMap0.put("阳性症状均分", String.valueOf(Double.parseDouble(df.format(positiveScore / positive))));
+            resultJson.put("阳性症状均分", String.valueOf(Double.parseDouble(df.format(positiveScore / positive))));
+            newResultDto3.setScore(String.valueOf(Double.parseDouble(df.format(positiveScore / positive))));
+        }
+        List<ScaleMarksEntity> tempPositive2 = scaleMarksMap.get("阳性项目均分");
+        BeanUtils.copyProperties(tempPositive2.get(0), newResultDto3);
+        newResultDtos.add(newResultDto3);*/
+
+        JSONObject iconInfo = new JSONObject();
+        //雷达图需要的维度以及最大值
+        List<Map<String, Object>> indicator = new LinkedList<>();
+        //雷达图所需要的常模参考值
+        LinkedList<String> reference = new LinkedList<>();
+        Map<String ,Double> dimensionOrg =  new HashMap<>();
+        //雷达图需要的分数
+        LinkedList<String> scoreList = new LinkedList<>();
+        for (int y = 0; y < dimensionEntities.size(); y++) {
+            Map<String, Object> indicatorMap = new HashMap<>();
+            DimensionEntity dimensionEntity = dimensionEntities.get(y);
+            NewResultDto newResultDto1 = new NewResultDto();
+            String questionNos = dimensionEntity.getQuestionNo();
+            String[] questionNo = questionNos.split(";");
+            double resultScore = Double.parseDouble(df.format(dimensionScore[y] / questionNo.length));
+            dimensionOrg.put(dimensionEntity.getId(),dimensionScore[y]);
+            //存放该维度总分
+            resultMap0.put(dimensionEntity.getName()+"得分", String.valueOf(dimensionScore[y]));
+            resultJson.put(dimensionEntity.getName()+"得分", String.valueOf(dimensionScore[y]));
+            newResultDto1.setScore(String.valueOf(dimensionScore[y]));
+            newResultDtos.add(newResultDto1);
+            //获取当前维度的评分规则
+            List<ScaleMarksEntity> scaleMarksEntities1 = scaleMarksMap.get(dimensionEntity.getName());
+            //循环遍历判断得分在哪个区间
+            for (ScaleMarksEntity scaleMarksEntity : scaleMarksEntities1) {
+                if (dimensionScore[y] <= Double.parseDouble(df.format(Double.parseDouble(scaleMarksEntity.getScoreEnd()))) && dimensionScore[y] >= Double.parseDouble(df.format(Double.parseDouble(scaleMarksEntity.getScoreStart())))) {
+                    putDimResult(resultMap0, resultJson, dimensionEntity.getName(), newResultDto1, scaleMarksEntity);
+                    //需要进行图表展示的维度放入map
+                    if ("1".equals(dimensionEntity.getIsIconFlag())) {
+                        indicatorMap.put("text", dimensionEntity.getName());
+                        indicatorMap.put("max", scaleMarksEntity.getScoreEnd());
+                        indicator.add(indicatorMap);
+                        if ("无".equals(scaleMarksEntity.getReference()) || "无".equals(scaleMarksEntity.getStandardDeviation())) {
+                            //常模参考值设为0
+                            reference.add("0");
+                        } else {
+                            reference.add(scaleMarksEntity.getReference());
+                        }
+                        scoreList.add(String.valueOf(dimensionScore[y]));
+                    }
+                }
+            }
+        }
+        //需要图表展示的
+        iconInfo.put("indicator", indicator);
+        iconInfo.put("reference", reference);
+        iconInfo.put("scoreList", scoreList);
+        newResult.put("iconInfo", iconInfo);
+        newResult.put("result", newResultDtos);
+        resultMapList.add(resultMap0);
+
+        JSONObject returnJson = new JSONObject(true);
+        returnJson.put("resultMapList", resultMapList);
+        returnJson.put("scaleName", Constant.SHEET_NAME_SCL_90);
+        returnJson.put("resultJson", resultJson);
+        returnJson.put("newResultJson", newResult);
+        //List<WarnEntity> warnEntityList = new ArrayList<>();
+       /* //  预警信息
+        dimensionOrg.forEach((key, value) -> {
+            //预警维度
+            DimensionOrgEntity byInstitutionNoAndDimensionId = dimensionOrgService.findByInstitutionNoAndDimensionId(institutionNo, key);
+            if (byInstitutionNoAndDimensionId != null) {
+                double currentScore = dimensionOrg.get(key);// 得分
+                switch (byInstitutionNoAndDimensionId.getLogic()) {
+                    case "lt":
+                        if (currentScore < Double.parseDouble(byInstitutionNoAndDimensionId.getThreshold())) {
+                            //添加预警信息
+                            warnEntityList.add(createWarnEntry(Constant.QUEST_FLAG_SCL_90, institutionNo, userId, key, currentScore));
+                        }
+                        break;
+                    case "le":
+                        if (currentScore <= Double.parseDouble(byInstitutionNoAndDimensionId.getThreshold())) {
+                            //添加预警信息
+                            warnEntityList.add(createWarnEntry(Constant.QUEST_FLAG_SCL_90, institutionNo, userId, key, currentScore));
+                        }
+                        break;
+                    case "eq":
+                        if (currentScore == Double.parseDouble(byInstitutionNoAndDimensionId.getThreshold())) {
+                            //添加预警信息
+                            warnEntityList.add(createWarnEntry(Constant.QUEST_FLAG_SCL_90, institutionNo, userId, key, currentScore));
+                        }
+                        break;
+                    case "ne":
+                        if (currentScore != Double.parseDouble(byInstitutionNoAndDimensionId.getThreshold())) {
+                            //添加预警信息
+                            warnEntityList.add(createWarnEntry(Constant.QUEST_FLAG_SCL_90, institutionNo, userId, key, currentScore));
+                        }
+                        break;
+                    case "ge":
+                        if (currentScore >= Double.parseDouble(byInstitutionNoAndDimensionId.getThreshold())) {
+                            //添加预警信息
+                            warnEntityList.add(createWarnEntry(Constant.QUEST_FLAG_SCL_90, institutionNo, userId, key, currentScore));
+                        }
+                        break;
+                    case "gt":
+                        if (currentScore > Double.parseDouble(byInstitutionNoAndDimensionId.getThreshold())) {
+                            //添加预警信息
+                            warnEntityList.add(createWarnEntry(Constant.QUEST_FLAG_SCL_90, institutionNo, userId, key, currentScore));
+                        }
+                        break;
+                }
+
+            }
+        });*/
+        resultJson.put("warnEntityList",null);
         return returnJson;
     }
 

+ 10 - 0
src/main/java/com/rf/kjb/utils/Constant.java

@@ -36,4 +36,14 @@ public class Constant {
     public static final String SPECIAL_SCALE_FLAG_SRSS = "20210910163158";
     /** 抑郁-焦虑-压力量表简版(DASS-21) **/
     public static final String SPECIAL_SCALE_FLAG_DASS_21 = "20220805135201";
+
+    /**
+     * 部分字段默认值
+     */
+    public static final String DEFAULT_VALUE_ONE ="1";
+
+    /**
+     * 问题类型 2 填空
+     */
+    public static final String QUESTION_TYPE_TWO ="2";
 }