|
@@ -1,6 +1,7 @@
|
|
|
package com.rf.psychological.scale.resultBusiness.scaleResult;
|
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.rf.psychological.dao.dto.scale.NewResultDto;
|
|
@@ -143,14 +144,17 @@ public class NEWCOMMONScale extends BaseScale {
|
|
|
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(),
|
|
|
+
|
|
|
+ String suggest = randomSuggestion(tempTotalScore.getImprovementSuggestions());
|
|
|
+ newResultDtos.add(new NewResultDto("总分", df.format(score), tempTotalScore.getSymptom(), suggest,
|
|
|
tempTotalScore.getFlag(), tempTotalScore.getReference(), tempTotalScore.getNameExplain(), tempTotalScore.getSuggestion(), tempTotalScore.getIsTotalScoreExplain()));
|
|
|
+
|
|
|
resultMap0.put("总分解释", tempTotalScore.getSymptom());
|
|
|
- resultMap0.put("总分说明", tempTotalScore.getImprovementSuggestions());
|
|
|
+ resultMap0.put("总分说明", suggest);
|
|
|
resultMap0.put("总分解读", tempTotalScore.getNameExplain());
|
|
|
resultMap0.put("总分建议", tempTotalScore.getSuggestion());
|
|
|
resultJson.put("总分解释", tempTotalScore.getSymptom());
|
|
|
- resultJson.put("总分说明", tempTotalScore.getImprovementSuggestions());
|
|
|
+ resultJson.put("总分说明", suggest);
|
|
|
resultJson.put("总分解读", tempTotalScore.getNameExplain());
|
|
|
resultJson.put("总分建议", tempTotalScore.getSuggestion());
|
|
|
break;
|
|
@@ -170,14 +174,16 @@ public class NEWCOMMONScale extends BaseScale {
|
|
|
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(),
|
|
|
+ String suggest = randomSuggestion(tempTotalScore.getImprovementSuggestions());
|
|
|
+ newResultDtos.add(new NewResultDto("总分", df.format(score), tempTotalScore.getSymptom(), suggest,
|
|
|
tempTotalScore.getFlag(), tempTotalScore.getReference(), tempTotalScore.getNameExplain(), tempTotalScore.getSuggestion(), tempTotalScore.getIsTotalScoreExplain()));
|
|
|
+
|
|
|
resultMap0.put("总分解释", tempTotalScore.getSymptom());
|
|
|
- resultMap0.put("总分说明", tempTotalScore.getImprovementSuggestions());
|
|
|
+ resultMap0.put("总分说明", suggest);
|
|
|
resultMap0.put("总分解读", tempTotalScore.getNameExplain());
|
|
|
resultMap0.put("总分建议", tempTotalScore.getSuggestion());
|
|
|
resultJson.put("总分解释", tempTotalScore.getSymptom());
|
|
|
- resultJson.put("总分说明", tempTotalScore.getImprovementSuggestions());
|
|
|
+ resultJson.put("总分说明", suggest);
|
|
|
resultJson.put("总分解读", tempTotalScore.getNameExplain());
|
|
|
resultJson.put("总分建议", tempTotalScore.getSuggestion());
|
|
|
break;
|
|
@@ -389,16 +395,28 @@ public class NEWCOMMONScale extends BaseScale {
|
|
|
|
|
|
private static void putDimResult(Map<String, String> resultMap0, JSONObject resultJson, String dimensionName, NewResultDto newResultDto1, ScaleMarksEntity scaleMarksEntity) {
|
|
|
//resultMap0.put(dimensionName + "常模参考值", scaleMarksEntity.getReference());
|
|
|
+ String suggest = randomSuggestion(scaleMarksEntity.getImprovementSuggestions());
|
|
|
resultMap0.put(dimensionName + "解释", scaleMarksEntity.getSymptom());
|
|
|
resultJson.put(dimensionName + "解释", scaleMarksEntity.getSymptom());
|
|
|
resultMap0.put(dimensionName + "解读", scaleMarksEntity.getNameExplain());
|
|
|
resultJson.put(dimensionName + "解读", scaleMarksEntity.getNameExplain());
|
|
|
- resultMap0.put(dimensionName + "说明", scaleMarksEntity.getImprovementSuggestions());
|
|
|
- resultJson.put(dimensionName + "说明", scaleMarksEntity.getImprovementSuggestions());
|
|
|
+ resultMap0.put(dimensionName + "说明", suggest);
|
|
|
+ resultJson.put(dimensionName + "说明", suggest);
|
|
|
resultMap0.put(dimensionName + "建议", scaleMarksEntity.getSuggestion());
|
|
|
resultJson.put(dimensionName + "建议", scaleMarksEntity.getSuggestion());
|
|
|
BeanUtils.copyProperties(scaleMarksEntity, newResultDto1);
|
|
|
}
|
|
|
|
|
|
+ private static String randomSuggestion(String suggestion){
|
|
|
+ List<String> list = Arrays.asList(suggestion.split(";"));
|
|
|
+ if (list.size()>1){
|
|
|
+ int size = list.size();
|
|
|
+ int num = RandomUtil.randomInt(0,size-1);
|
|
|
+ String text = list.get(num).substring(list.get(num).indexOf("."));
|
|
|
+ return text;
|
|
|
+ }else {
|
|
|
+ return suggestion;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|