|
@@ -54,108 +54,7 @@ public class ScaleResultController extends BaseController {
|
|
|
String fileName = userName+ Constant.SPLIT_CHAR+userBirthday+Constant.SPLIT_CHAR+userSex+Constant.SPLIT_CHAR+testTime;
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("data");
|
|
|
List<Map<String,String>> resultMapList = null;
|
|
|
- //艾森克
|
|
|
- if(Constant.QUEST_TYPE_ASK.equals(type)){
|
|
|
- int scoreE=0;
|
|
|
- int scoreN=0;
|
|
|
- int scoreP=0;
|
|
|
- int scoreL=0;
|
|
|
- for(int i=0;i<jsonArray.size();i++){
|
|
|
- JSONObject jsonObject1 = jsonArray.getJSONObject(i);
|
|
|
- if(jsonObject1.getString("scale").equals(Constant.SCALE_TYPE_E)&&jsonObject1.getString("checkItems").equals(Constant.YES)){
|
|
|
- scoreE +=1;
|
|
|
- }else if(jsonObject1.getString("scale").equals(Constant.SCALE_TYPE_N)&&jsonObject1.getString("checkItems").equals(Constant.YES)){
|
|
|
- scoreN +=1;
|
|
|
- }else if(jsonObject1.getString("scale").equals(Constant.SCALE_TYPE_P)&&jsonObject1.getString("checkItems").equals(Constant.YES)){
|
|
|
- scoreP +=1;
|
|
|
- }else if(jsonObject1.getString("scale").equals(Constant.SCALE_TYPE_L)&&jsonObject1.getString("checkItems").equals(Constant.YES)){
|
|
|
- scoreL +=1;
|
|
|
- }
|
|
|
- }
|
|
|
- //答题结果列表
|
|
|
- List<ASKEntity> dataList= jsonArray.toJavaList(ASKEntity.class);
|
|
|
- //得分列表
|
|
|
- Map<String,String> resultMap = new LinkedHashMap<>();
|
|
|
- resultMap.put("分量E得分",String.valueOf(scoreE));
|
|
|
- resultMap.put("分量N得分",String.valueOf(scoreN));
|
|
|
- resultMap.put("分量P得分",String.valueOf(scoreP));
|
|
|
- resultMap.put("分量L得分",String.valueOf(scoreL));
|
|
|
- System.out.println("分量E得分:"+scoreE+";分量N得分:"+scoreN+";分量P得分:"+scoreP+";分量L得分:"+scoreL);
|
|
|
- fileName = fileName+"-"+Constant.SHEET_NAME_ASK+".xlsx";
|
|
|
- resultMapList = new ArrayList<>();
|
|
|
- resultMapList.add(resultMap);
|
|
|
-// 导出文件
|
|
|
- ExcelUtil.createExcelFile(ASKEntity.class,dataList,resultMapList,new ExcelClass().contentExcel(Constant.QUEST_TYPE_ASK),fileName,Constant.SHEET_NAME_ASK);
|
|
|
- //匹兹堡睡眠质量指数
|
|
|
- }else if(Constant.QUEST_TYPE_PSQI.equals(type)){
|
|
|
- //睡眠质量
|
|
|
- int scoreQuality = checkQuality(jsonArray);
|
|
|
- //入睡时间
|
|
|
- int scoreTime = checkTime(jsonArray);
|
|
|
- //睡眠时间
|
|
|
- int scoreHour = checkHour(jsonArray);
|
|
|
- //睡眠效率
|
|
|
- int scoreEfficiency = checkEfficiency(jsonArray);
|
|
|
- //睡眠障碍
|
|
|
- int scoreObstruct = checkObstruct(jsonArray);
|
|
|
- //催眠药物
|
|
|
- int scoreMedicine = checkMedicine(jsonArray);
|
|
|
- //日间功能障碍
|
|
|
- int scoreDay = checkDay(jsonArray);
|
|
|
- System.out.println("A睡眠质量:"+scoreQuality+";B入睡时间:"+scoreTime+";C睡眠时间:"+scoreHour+";D睡眠效率:"+scoreEfficiency+";E失眠障碍:"+scoreObstruct+";F催眠药物:"+scoreMedicine+";日间工程障碍:"+scoreDay);
|
|
|
- int score = scoreQuality+scoreTime+scoreHour+scoreEfficiency+scoreObstruct+scoreMedicine+scoreDay;
|
|
|
- System.out.println("PSQI总分:"+score);
|
|
|
- Map<String,String> resultMap = new LinkedHashMap<>();
|
|
|
- resultMap.put("A睡眠质量",String.valueOf(scoreQuality));
|
|
|
- resultMap.put("B入睡时间",String.valueOf(scoreTime));
|
|
|
- resultMap.put("C睡眠时间",String.valueOf(scoreHour));
|
|
|
- resultMap.put("D睡眠效率",String.valueOf(scoreEfficiency));
|
|
|
- resultMap.put("E失眠障碍",String.valueOf(scoreObstruct));
|
|
|
- resultMap.put("F催眠药物",String.valueOf(scoreMedicine));
|
|
|
- resultMap.put("日间工程障碍",String.valueOf(scoreDay));
|
|
|
- resultMap.put("PSQI总分",String.valueOf(score));
|
|
|
- fileName = fileName+"-"+Constant.SHEET_NAME_PSQI+".xlsx";
|
|
|
- List<PSQIEntity> dataList = jsonArray.toJavaList(PSQIEntity.class);
|
|
|
- resultMapList = new ArrayList<>();
|
|
|
- resultMapList.add(resultMap);
|
|
|
- ExcelUtil.createExcelFile(PSQIEntity.class,dataList,resultMapList,new ExcelClass().contentExcel(Constant.QUEST_TYPE_PSQI),fileName,Constant.SHEET_NAME_PSQI);
|
|
|
- //心境状态
|
|
|
- }else if(Constant.QUEST_TYPE_POMS.equals(type)){
|
|
|
- int [] scores= {0,0,0,0,0,0,0,0};
|
|
|
- for (int i=0;i<jsonArray.size();i++) {
|
|
|
- JSONObject jsonObject1= jsonArray.getJSONObject(i);
|
|
|
- int model = jsonObject1.getIntValue("type");
|
|
|
- String checked = jsonObject1.getString("checked");
|
|
|
- if(checked.equals("几乎没有")){
|
|
|
-
|
|
|
- }else if (checked.equals("有点")){
|
|
|
- scores[model-1] +=1;
|
|
|
- }else if (checked.equals("适中")){
|
|
|
- scores[model-1] +=2;
|
|
|
- }else if (checked.equals("相当多")){
|
|
|
- scores[model-1] +=3;
|
|
|
- }else if (checked.equals("⾮常多")){
|
|
|
- scores[model-1] +=4;
|
|
|
- }
|
|
|
- }
|
|
|
- //TMD(情绪纷乱的总分)=5个消极的情绪得分之和减去两个积极情绪(精⼒,⾃尊感)得分之和+100
|
|
|
- scores[7]=scores[0]+scores[1]+scores[2]+scores[3]+scores[5]-scores[4]-scores[6]+100;
|
|
|
- System.out.println("POMS得分:"+scores.toString());
|
|
|
- fileName = fileName+"-"+Constant.SHEET_NAME_POMS+".xlsx";
|
|
|
- Map<String,String> resultMap = new LinkedHashMap<>();
|
|
|
- resultMap.put("紧张",String.valueOf(scores[0]));
|
|
|
- resultMap.put("愤怒",String.valueOf(scores[1]));
|
|
|
- resultMap.put("疲劳",String.valueOf(scores[2]));
|
|
|
- resultMap.put("抑郁",String.valueOf(scores[3]));
|
|
|
- resultMap.put("精力",String.valueOf(scores[4]));
|
|
|
- resultMap.put("慌乱",String.valueOf(scores[5]));
|
|
|
- resultMap.put("自我情绪相关",String.valueOf(scores[6]));
|
|
|
- resultMap.put("总分",String.valueOf(scores[7]));
|
|
|
- resultMapList = new ArrayList<>();
|
|
|
- resultMapList.add(resultMap);
|
|
|
- ExcelUtil.createExcelFile(POMSEntity.class,jsonArray.toJavaList(POMSEntity.class),resultMapList,new ExcelClass().contentExcel(Constant.QUEST_TYPE_POMS),fileName,Constant.SHEET_NAME_POMS);
|
|
|
- //症状自评
|
|
|
- }else if (Constant.QUEST_TYPE_SCL.equals(type)){
|
|
|
+ if (Constant.QUEST_TYPE_SCL.equals(type)){
|
|
|
int [] scores = {0,0,0,0,0,0,0,0,0,0};
|
|
|
for (int i=0;i<jsonArray.size();i++){
|
|
|
JSONObject jsonObject1 = jsonArray.getJSONObject(i);
|
|
@@ -208,91 +107,6 @@ public class ScaleResultController extends BaseController {
|
|
|
resultMapList.add(resultMap);
|
|
|
ExcelUtil.createExcelFile(AviationEntity.class,jsonArray.toJavaList(AviationEntity.class),resultMapList,new ExcelClass().contentExcel(Constant.QUEST_TYPE_AVAI),fileName,Constant.SHEET_NAME_AVAI);
|
|
|
//社会支持评定量表
|
|
|
- }else if (Constant.QUEST_TYPE_SUPP.equals(type)){
|
|
|
- //总分
|
|
|
- int sumScore = 0;
|
|
|
- //主管得分
|
|
|
- int chargeScore = 0;
|
|
|
- //客观得分
|
|
|
- int impersonalityScore = 0;
|
|
|
- //利用度
|
|
|
- int utilizationScore = 0;
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- JSONObject jsonObject1 = jsonArray.getJSONObject(i);
|
|
|
- String checked = jsonObject1.getString("checked");
|
|
|
- if(i==0||(i>=2&&i<=5)||(i==8)){
|
|
|
- if(checked.contains("(1)")){
|
|
|
- sumScore += 1 ;
|
|
|
- chargeScore +=1;
|
|
|
- }else if(checked.contains("(2)")){
|
|
|
- sumScore += 2 ;
|
|
|
- chargeScore += 2;
|
|
|
- }else if(checked.contains("(3)")){
|
|
|
- sumScore += 3 ;
|
|
|
- chargeScore+= 3;
|
|
|
- }else if(checked.contains("(4)")){
|
|
|
- sumScore += 4 ;
|
|
|
- chargeScore+=4;
|
|
|
- }
|
|
|
- }else if(i==1){
|
|
|
- if(checked.contains("(1)")){
|
|
|
- impersonalityScore +=1;
|
|
|
- sumScore += 1 ;
|
|
|
- }else if(checked.contains("(2)")){
|
|
|
- impersonalityScore+=2;
|
|
|
- sumScore += 2 ;
|
|
|
- }else if(checked.contains("(3)")){
|
|
|
- impersonalityScore+=3;
|
|
|
- sumScore += 3 ;
|
|
|
- }else if(checked.contains("(4)")){
|
|
|
- impersonalityScore+=4;
|
|
|
- sumScore += 4 ;
|
|
|
- }
|
|
|
- }else if(i==6||i==7){
|
|
|
- if(checked.equals("无任何来源")){
|
|
|
-
|
|
|
- }else {
|
|
|
- String [] strings= checked.replace("[","").replace("]","").split(",");
|
|
|
- int length = strings.length;
|
|
|
- sumScore += length;
|
|
|
- impersonalityScore +=length;
|
|
|
- }
|
|
|
-
|
|
|
- }else if(i==9||i==10){
|
|
|
- if(checked.contains("(1)")){
|
|
|
-
|
|
|
- }else if(checked.contains("(2)")){
|
|
|
- impersonalityScore += checked.split(";").length;
|
|
|
- sumScore += checked.split(";").length;;
|
|
|
- }
|
|
|
- }else {
|
|
|
- if(checked.contains("(1)")){
|
|
|
- utilizationScore +=1;
|
|
|
- sumScore += 1 ;
|
|
|
- }else if(checked.contains("(2)")){
|
|
|
- utilizationScore+=2;
|
|
|
- sumScore += 2 ;
|
|
|
- }else if(checked.contains("(3)")){
|
|
|
- utilizationScore+=3;
|
|
|
- sumScore += 3 ;
|
|
|
- }else if(checked.contains("(4)")){
|
|
|
- utilizationScore+=4;
|
|
|
- sumScore += 4 ;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- System.out.println("总分:"+sumScore+";客观得分:"+impersonalityScore+";主观得分:"+chargeScore+";支持的利用度:"+utilizationScore);
|
|
|
- fileName=fileName+"-"+Constant.SHEET_NAME_SUPP+".xlsx";
|
|
|
- Map<String,String> resultMap = new LinkedHashMap<>();
|
|
|
- resultMap.put("客观得分",String.valueOf(impersonalityScore));
|
|
|
- resultMap.put("主观得分",String.valueOf(chargeScore));
|
|
|
- resultMap.put("支持的利用度",String.valueOf(utilizationScore));
|
|
|
- resultMap.put("总分",String.valueOf(sumScore));
|
|
|
- resultMapList = new ArrayList<>();
|
|
|
- resultMapList.add(resultMap);
|
|
|
- ExcelUtil.createExcelFile(SupportEntity.class,jsonArray.toJavaList(SupportEntity.class),resultMapList,new ExcelClass().contentExcel(Constant.QUEST_TYPE_SUPP),fileName,Constant.SHEET_NAME_SUPP);
|
|
|
- //抑郁焦虑压力表
|
|
|
}else if (Constant.QUEST_TYPE_DEPR.equals(type)){
|
|
|
//压力的分 焦虑得分 抑郁得分
|
|
|
int [] score = {0,0,0};
|
|
@@ -317,114 +131,7 @@ public class ScaleResultController extends BaseController {
|
|
|
resultMapList = new ArrayList<>();
|
|
|
resultMapList.add(resultMap);
|
|
|
ExcelUtil.createExcelFile(DepressEntity.class,jsonArray.toJavaList(DepressEntity.class),resultMapList,new ExcelClass().contentExcel(Constant.QUEST_TYPE_DEPR),fileName,Constant.SHEET_NAME_DEPR);
|
|
|
- //正性负性情绪量表
|
|
|
- }else if (Constant.QUEST_TYPE_MOOD.equals(type)){
|
|
|
- //反向情绪 正向情绪
|
|
|
- int [] score = {0,0};
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- JSONObject jsonObject1 = jsonArray.getJSONObject(i);
|
|
|
- int model = jsonObject1.getIntValue("type");
|
|
|
- String checked = jsonObject1.getString("checked");
|
|
|
- if(checked.equals("几乎没有")){
|
|
|
- score[model] += 1;
|
|
|
- }else if(checked.equals("比较少")){
|
|
|
- score[model] += 2;
|
|
|
- }else if(checked.equals("中等程度")){
|
|
|
- score[model] += 3;
|
|
|
- }else if(checked.equals("比较多")){
|
|
|
- score[model] += 4;
|
|
|
- }else if(checked.equals("及其多")){
|
|
|
- score[model] += 5;
|
|
|
- }
|
|
|
- }
|
|
|
- System.out.println("负向情绪得分:"+score[0]+";正向情绪得分:"+score[1]);
|
|
|
- fileName=fileName+"-"+Constant.SHEET_NAME_MOOD+".xlsx";
|
|
|
- Map<String,String> resultMap = new LinkedHashMap<>();
|
|
|
- resultMap.put("负向情绪得分",String.valueOf(score[0]));
|
|
|
- resultMap.put("正向情绪得分",String.valueOf(score[1]));
|
|
|
- resultMapList = new ArrayList<>();
|
|
|
- resultMapList.add(resultMap);
|
|
|
- ExcelUtil.createExcelFile(MoodEntity.class,jsonArray.toJavaList(MoodEntity.class),resultMapList,new ExcelClass().contentExcel(Constant.QUEST_TYPE_MOOD),fileName,Constant.SHEET_NAME_MOOD);
|
|
|
- //状态-特质焦虑量表
|
|
|
- }else if (Constant.QUEST_TYPE_STATUS.equals(type)){
|
|
|
- //状态焦虑
|
|
|
- int [] statusScore = {0,0};
|
|
|
- for (int i = 0; i < 20; i++) {
|
|
|
- JSONObject jsonObject1 = jsonArray.getJSONObject(i);
|
|
|
- String checked = jsonObject1.getString("checked");
|
|
|
- String model = jsonObject1.getString("type");
|
|
|
- if(model.equals("0")){
|
|
|
- if(checked.equals("完全没有")){
|
|
|
- statusScore[0]+=4;
|
|
|
- }else if (checked.equals("有些")){
|
|
|
- statusScore[0]+=3;
|
|
|
- }else if (checked.equals("经常")){
|
|
|
- statusScore[0]+=2;
|
|
|
- }else if (checked.equals("非常明显")){
|
|
|
- statusScore[0]+=1;
|
|
|
- }
|
|
|
- }else {
|
|
|
- if(checked.equals("完全没有")){
|
|
|
- statusScore[1]+=1;
|
|
|
- }else if (checked.equals("有些")){
|
|
|
- statusScore[1]+=2;
|
|
|
- }else if (checked.equals("经常")){
|
|
|
- statusScore[1]+=3;
|
|
|
- }else if (checked.equals("非常明显")){
|
|
|
- statusScore[1]+=4;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- //状态焦虑
|
|
|
- int [] particularityScore = {0,0};
|
|
|
- for (int i = 20; i < jsonArray.size(); i++) {
|
|
|
- JSONObject jsonObject1 = jsonArray.getJSONObject(i);
|
|
|
- String checked = jsonObject1.getString("checked");
|
|
|
- String model = jsonObject1.getString("type");
|
|
|
- if(model.equals("0")){
|
|
|
- if(checked.equals("完全没有")){
|
|
|
- particularityScore[0]+=4;
|
|
|
- }else if (checked.equals("有些")){
|
|
|
- particularityScore[0]+=3;
|
|
|
- }else if (checked.equals("经常")){
|
|
|
- particularityScore[0]+=2;
|
|
|
- }else if (checked.equals("非常明显")){
|
|
|
- particularityScore[0]+=1;
|
|
|
- }
|
|
|
- }else {
|
|
|
- if(checked.equals("完全没有")){
|
|
|
- particularityScore[1]+=1;
|
|
|
- }else if (checked.equals("有些")){
|
|
|
- particularityScore[1]+=2;
|
|
|
- }else if (checked.equals("经常")){
|
|
|
- particularityScore[1]+=3;
|
|
|
- }else if (checked.equals("非常明显")){
|
|
|
- particularityScore[1]+=4;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- System.out.println("状态焦虑:反向得分"+statusScore[0]+";正向得分:"+statusScore[1]);
|
|
|
- System.out.println("特质焦虑:反向得分"+particularityScore[0]+";正向得分:"+particularityScore[1]);
|
|
|
- fileName = fileName+"-"+Constant.SHEET_NAME_STATUS+".xlsx";
|
|
|
- Map<String,String> resultMap = new LinkedHashMap<>();
|
|
|
- resultMap.put("状态焦虑",String.valueOf(statusScore[0]+statusScore[1]));
|
|
|
- resultMap.put("特质焦虑",String.valueOf(particularityScore[0]+particularityScore[1]));
|
|
|
- resultMapList = new ArrayList<>();
|
|
|
- resultMapList.add(resultMap);
|
|
|
- ExcelUtil.createExcelFile(StatusEntity.class,jsonArray.toJavaList(StatusEntity.class),resultMapList,new ExcelClass().contentExcel(Constant.QUEST_TYPE_STATUS),fileName,Constant.SHEET_NAME_MOOD);
|
|
|
- }else if(Constant.QUEST_TYPE_LIFE.equals(type)){
|
|
|
- int score = 0;
|
|
|
- List<LifeEntity> dataList = jsonArray.toJavaList(LifeEntity.class);
|
|
|
- for (LifeEntity lifeEntity:dataList) {
|
|
|
- score = score + lifeEntity.getScore()*Integer.parseInt(lifeEntity.getChecked());
|
|
|
- }
|
|
|
- Map<String,String> resultMap = new LinkedHashMap<>();
|
|
|
- resultMap.put("总分",String.valueOf(score));
|
|
|
- fileName = fileName+"-"+Constant.SHEET_NAME_LIFE+".xlsx";
|
|
|
- resultMapList = new ArrayList<>();
|
|
|
- resultMapList.add(resultMap);
|
|
|
- ExcelUtil.createExcelFile(LifeEntity.class,dataList,resultMapList,new ExcelClass().contentExcel(Constant.QUEST_TYPE_LIFE),fileName,Constant.SHEET_NAME_LIFE);
|
|
|
}else if (Constant.QUEST_TYPE_CATTELL.equals(type)){
|
|
|
List<CattellEntity>dataList = jsonArray.toJavaList(CattellEntity.class);
|
|
|
Map<String,String> resultMap = new LinkedHashMap<>();
|