|
@@ -25,21 +25,6 @@ public class PSQIScale extends BaseScale{
|
|
|
}
|
|
|
|
|
|
public JSONObject scaleCalculate() throws Exception {
|
|
|
-
|
|
|
- // 自定义路径使用
|
|
|
- /*ScaleUtil.getScaleDll("PSQISCALE.dll");
|
|
|
- System.out.println("JSONArray:"+jsonArray);
|
|
|
- System.out.println("resultJson:"+resultJson);
|
|
|
- XScale xScale = new XScale(jsonArray,resultJson);
|
|
|
- String result = xScale.PSQIScale(jsonArray.toString(), resultJson.toString());
|
|
|
- //System.out.println("dllresult:"+result);
|
|
|
- //解决排序问题
|
|
|
- LinkedHashMap<String, Object> jsonMap = JSON.parseObject(result,LinkedHashMap.class, Feature.OrderedField);
|
|
|
- JSONObject jsonObject = new JSONObject(true);
|
|
|
- jsonObject.putAll(jsonMap);
|
|
|
- System.out.println("jsonObject:"+jsonObject);
|
|
|
- return jsonObject;*/
|
|
|
-
|
|
|
//睡眠质量
|
|
|
int scoreQuality = checkQuality(jsonArray);
|
|
|
//入睡时间
|
|
@@ -271,22 +256,22 @@ public class PSQIScale extends BaseScale{
|
|
|
for(int i=4;i<14;i++){
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
String checkItems = jsonObject.getString("checkItems").trim();
|
|
|
- if(checkItems.equals("<1次/周")){
|
|
|
+ if(checkItems.equals("很少出现")){
|
|
|
score += 1;
|
|
|
- }else if(checkItems.equals("1-2次/周")){
|
|
|
+ }else if(checkItems.equals("有那么一两次")){
|
|
|
score += 2;
|
|
|
- }else if(checkItems.equals("≥3次/周")){
|
|
|
+ }else if(checkItems.equals("太多次了,根本记不清")){
|
|
|
score += 3;
|
|
|
}
|
|
|
}
|
|
|
for(int i=15;i<17;i++){
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
String checkItems = jsonObject.getString("checkItems").trim();
|
|
|
- if(checkItems.equals("<1次/周")){
|
|
|
+ if(checkItems.equals("很少出现")){
|
|
|
score += 1;
|
|
|
- }else if(checkItems.equals("1-2次/周")){
|
|
|
+ }else if(checkItems.equals("有那么一两次")){
|
|
|
score += 2;
|
|
|
- }else if(checkItems.equals("≥3次/周")){
|
|
|
+ }else if(checkItems.equals("太多次了,根本记不清")){
|
|
|
score += 3;
|
|
|
}
|
|
|
}
|
|
@@ -302,11 +287,11 @@ public class PSQIScale extends BaseScale{
|
|
|
int scoreQuality = 0 ;
|
|
|
JSONObject jsonObject1 = jsonArray.getJSONObject(14);
|
|
|
String checkItems = jsonObject1.getString("checkItems");
|
|
|
- if(checkItems.equals("较好")){
|
|
|
+ if(checkItems.equals("有一点点好")){
|
|
|
scoreQuality +=1;
|
|
|
- }else if(checkItems.equals("较差")){
|
|
|
+ }else if(checkItems.equals("有一点点不好")){
|
|
|
scoreQuality +=2;
|
|
|
- }else if(checkItems.equals("很差")){
|
|
|
+ }else if(checkItems.equals("很不好")){
|
|
|
scoreQuality +=3;
|
|
|
}
|
|
|
return scoreQuality;
|
|
@@ -321,11 +306,11 @@ public class PSQIScale extends BaseScale{
|
|
|
int scoreQuality = 0 ;
|
|
|
JSONObject jsonObject1 = jsonArray.getJSONObject(17);
|
|
|
String checkItems = jsonObject1.getString("checkItems");
|
|
|
- if(checkItems.equals("偶尔有")){
|
|
|
+ if(checkItems.equals("偶尔有一次")){
|
|
|
scoreQuality +=1;
|
|
|
}else if(checkItems.equals("有时有")){
|
|
|
scoreQuality +=2;
|
|
|
- }else if(checkItems.equals("经常有")){
|
|
|
+ }else if(checkItems.equals("总是这样")){
|
|
|
scoreQuality +=3;
|
|
|
}
|
|
|
return scoreQuality;
|
|
@@ -349,11 +334,11 @@ public class PSQIScale extends BaseScale{
|
|
|
}
|
|
|
jsonObject1=jsonArray.getJSONObject(4);
|
|
|
String checkItems = jsonObject1.getString("checkItems").trim();
|
|
|
- if(checkItems.equals("<1次/周")){
|
|
|
+ if(checkItems.equals("很少出现")){
|
|
|
scoreTime5a = 1;
|
|
|
- }else if(checkItems.equals("1-2次/周")){
|
|
|
+ }else if(checkItems.equals("有那么一两次")){
|
|
|
scoreTime5a = 2;
|
|
|
- }else if(checkItems.equals("≥3次/周")){
|
|
|
+ }else if(checkItems.equals("太多次了,根本记不清")){
|
|
|
scoreTime5a=3;
|
|
|
}
|
|
|
int scoreTemp = scoreTime2+scoreTime5a;
|
|
@@ -416,11 +401,11 @@ public class PSQIScale extends BaseScale{
|
|
|
for(int i=5;i<14;i++){
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
String checkItems = jsonObject.getString("checkItems").trim();
|
|
|
- if(checkItems.equals("<1次/周")){
|
|
|
+ if(checkItems.equals("很少出现")){
|
|
|
scoreTemp += 1;
|
|
|
- }else if(checkItems.equals("1-2次/周")){
|
|
|
+ }else if(checkItems.equals("有那么一两次")){
|
|
|
scoreTemp += 2;
|
|
|
- }else if(checkItems.equals("≥3次/周")){
|
|
|
+ }else if(checkItems.equals("太多次了,根本记不清")){
|
|
|
scoreTemp += 3;
|
|
|
}
|
|
|
if(scoreTemp==0){
|
|
@@ -441,11 +426,11 @@ public class PSQIScale extends BaseScale{
|
|
|
int scoreMedicine = 0 ;
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(15);
|
|
|
String checkItems = jsonObject.getString("checkItems").trim();
|
|
|
- if(checkItems.equals("<1次/周")){
|
|
|
+ if(checkItems.equals("很少出现")){
|
|
|
scoreMedicine = 1;
|
|
|
- }else if(checkItems.equals("1-2次/周")){
|
|
|
+ }else if(checkItems.equals("有那么一两次")){
|
|
|
scoreMedicine = 2;
|
|
|
- }else if(checkItems.equals("≥3次/周")){
|
|
|
+ }else if(checkItems.equals("太多次了,根本记不清")){
|
|
|
scoreMedicine = 3;
|
|
|
}
|
|
|
return scoreMedicine;
|
|
@@ -456,23 +441,23 @@ public class PSQIScale extends BaseScale{
|
|
|
int scoreDay=0;
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(16);
|
|
|
String checkItems = jsonObject.getString("checkItems").trim();
|
|
|
- if(checkItems.equals("<1次/周")){
|
|
|
+ if(checkItems.equals("很少出现")){
|
|
|
scoreDay += 1;
|
|
|
- }else if(checkItems.equals("1-2次/周")){
|
|
|
+ }else if(checkItems.equals("有那么一两次")){
|
|
|
scoreDay += 2;
|
|
|
- }else if(checkItems.equals("≥3次/周")){
|
|
|
+ }else if(checkItems.equals("太多次了,根本记不清")){
|
|
|
scoreDay += 3;
|
|
|
}
|
|
|
|
|
|
jsonObject = jsonArray.getJSONObject(17);
|
|
|
checkItems = jsonObject.getString("checkItems").trim();
|
|
|
- if(checkItems.equals("没有")){
|
|
|
+ if(checkItems.equals("压根没有")){
|
|
|
scoreDay += 0;
|
|
|
- }else if(checkItems.equals("偶尔有")){
|
|
|
+ }else if(checkItems.equals("偶尔有一次")){
|
|
|
scoreDay += 1;
|
|
|
}else if(checkItems.equals("有时有")){
|
|
|
scoreDay += 2;
|
|
|
- }else if(checkItems.equals("经常有")){
|
|
|
+ }else if(checkItems.equals("总是这样")){
|
|
|
scoreDay += 3;
|
|
|
}
|
|
|
if(scoreDay == 0){
|