|
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.rf.psychological.base.rest.BaseController;
|
|
|
import com.rf.psychological.dao.dto.InstitutionRecordingUsersDTO;
|
|
|
+import com.rf.psychological.dao.dto.scale.NewResultDto;
|
|
|
import com.rf.psychological.enums.UserRole;
|
|
|
import com.rf.psychological.file.excel.ExcelClass;
|
|
|
import com.rf.psychological.dao.model.*;
|
|
@@ -272,6 +273,28 @@ public class WebScaleResultController extends BaseController {
|
|
|
dbJson.put("newTableContext", "");
|
|
|
} else {
|
|
|
newResultJson = (Map<String, Object>) resultJson.get("newResultJson");
|
|
|
+ List<NewResultDto> newResultDtos = (List<NewResultDto>) newResultJson.get("result");
|
|
|
+ for (int y = 1; y < newResultDtos.size(); y++) {
|
|
|
+ List<ScaleMarksEntity> scaleMarksEntityList = this.scaleMarksService.getScaleMarksByFlagAndName(flag,newResultDtos.get(y).getName());
|
|
|
+ if(scaleMarksEntityList != null && scaleMarksEntityList.size() > 0 ){
|
|
|
+ //取最大值最小值
|
|
|
+ double minScore = Double.parseDouble(scaleMarksEntityList.get(0).getScoreStart());
|
|
|
+ double maxScore = Double.parseDouble(scaleMarksEntityList.get(0).getScoreEnd());
|
|
|
+ for (int i = 1; i < scaleMarksEntityList.size(); i++) {
|
|
|
+ if(Double.parseDouble(scaleMarksEntityList.get(i).getScoreStart()) < minScore){
|
|
|
+ minScore = Double.parseDouble(scaleMarksEntityList.get(i).getScoreStart());
|
|
|
+ }
|
|
|
+ if(Double.parseDouble(scaleMarksEntityList.get(i).getScoreEnd()) > maxScore){
|
|
|
+ maxScore = Double.parseDouble(scaleMarksEntityList.get(i).getScoreEnd());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ newResultDtos.get(y).setMinScore(String.valueOf(minScore));
|
|
|
+ newResultDtos.get(y).setMaxScore(String.valueOf(maxScore));
|
|
|
+ DecimalFormat df = new DecimalFormat("######0.00");
|
|
|
+ String percent = Double.parseDouble(df.format((Double.parseDouble(newResultDtos.get(y).getScore())-minScore)/(maxScore-minScore)*100)) + "%";
|
|
|
+ newResultDtos.get(y).setPercent(percent);
|
|
|
+ }
|
|
|
+ }
|
|
|
dbJson.put("version", 2.0);
|
|
|
dbJson.put("newTableContext", newResultJson);
|
|
|
versionFlag = true;
|