|
@@ -158,92 +158,100 @@ public class ScaleCalculate {
|
|
JSONObject valueResult = new JSONObject();
|
|
JSONObject valueResult = new JSONObject();
|
|
JSONObject nameResult = new JSONObject();
|
|
JSONObject nameResult = new JSONObject();
|
|
int type = (int) data.get("type");
|
|
int type = (int) data.get("type");
|
|
- if (type == 2) {
|
|
|
|
- Map<String, Object> content = (Map<String, Object>) data.get("content");
|
|
|
|
- List<Map<String, Object>> mapList = (List<Map<String, Object>>) content.get("details");
|
|
|
|
- if ("肾小球滤过率".equals(content.get("name"))) {
|
|
|
|
- int age = 0;
|
|
|
|
- double scr = 0.00;
|
|
|
|
- float k = 0.0f;
|
|
|
|
- double a = 0.00;
|
|
|
|
- double denger = 0.00;
|
|
|
|
- for (int i = 0; i < mapList.size(); i++) {
|
|
|
|
- Map<String, Object> detailSub = mapList.get(i);
|
|
|
|
- if ("年龄".equals(detailSub.get("name"))) {
|
|
|
|
- if (StringUtils.isEmpty(detailSub.get("value").toString())) {
|
|
|
|
- break;
|
|
|
|
- } else {
|
|
|
|
- age = Integer.valueOf(detailSub.get("value").toString());
|
|
|
|
- }
|
|
|
|
- } else if ("血肌酐".equals(detailSub.get("name"))) {
|
|
|
|
- if ("".equals(detailSub.get("value"))) {
|
|
|
|
- break;
|
|
|
|
- } else {
|
|
|
|
- if ("umol/L".equals(detailSub.get("uint"))) {
|
|
|
|
- scr = Double.valueOf(detailSub.get("value").toString()) / 88.41;
|
|
|
|
- } else if ("mg/dL".equals(detailSub.get("uint"))) {
|
|
|
|
- scr = Double.valueOf(detailSub.get("value").toString());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else if ("性别".equals(detailSub.get("name"))) {
|
|
|
|
- List<Map<String, Object>> genderDetails = (List<Map<String, Object>>) detailSub.get("details");
|
|
|
|
- for (int j = 0; j < genderDetails.size(); j++) {
|
|
|
|
- Map<String, Object> genderDetail = genderDetails.get(j);
|
|
|
|
- //返回的数据结构性别暂时是写死(默认女性)
|
|
|
|
- if ((int) genderDetail.get("state") == 1) {
|
|
|
|
- if ("男".equals(genderDetail.get("detailName"))) {
|
|
|
|
- k = 0.9f;
|
|
|
|
- denger = Double.valueOf(genderDetail.get("value").toString());
|
|
|
|
- if (scr <= 0.90) {
|
|
|
|
- a = -0.411;
|
|
|
|
- } else {
|
|
|
|
- a = -1.209;
|
|
|
|
- }
|
|
|
|
- } else if ("女".equals(genderDetail.get("detailName"))) {
|
|
|
|
- k = 0.7f;
|
|
|
|
- denger = Double.valueOf(genderDetail.get("value").toString());
|
|
|
|
- if (scr <= 0.70) {
|
|
|
|
- a = -0.329;
|
|
|
|
- } else {
|
|
|
|
- a = -1.209;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if (type != 2) {
|
|
|
|
+ return scaleCalcResult;
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> content = (Map<String, Object>) data.get("content");
|
|
|
|
+ List<Map<String, Object>> mapList = (List<Map<String, Object>>) content.get("details");
|
|
|
|
+ if (!"肾小球滤过率".equals(content.get("name"))) {
|
|
|
|
+ return scaleCalcResult;
|
|
|
|
+ }
|
|
|
|
+ int age = 0;
|
|
|
|
+ double scr = 0d;
|
|
|
|
+ float k = 0f;
|
|
|
|
+ double a = 0d;
|
|
|
|
+ double denger = 0d;
|
|
|
|
+ int sex = 0; //1:男性 2:女性
|
|
|
|
+ for (int i = 0; i < mapList.size(); i++) {
|
|
|
|
+ Map<String, Object> detailSub = mapList.get(i);
|
|
|
|
+ if ("年龄".equals(detailSub.get("name"))) {
|
|
|
|
+ if (StringUtils.isEmpty(detailSub.get("value").toString())) {
|
|
|
|
+ break;
|
|
|
|
+ } else {
|
|
|
|
+ age = Integer.valueOf(detailSub.get("value").toString());
|
|
}
|
|
}
|
|
- double eGFR3 = 141 * Math.pow((scr / k), a) * Math.pow(0.993, age) * denger;
|
|
|
|
- String unit = "min•1.73㎡";
|
|
|
|
- String text = "";
|
|
|
|
- if (eGFR3 > 0 && eGFR3 <= 29) {
|
|
|
|
- text = "重度肾功能不全";
|
|
|
|
- } else if (eGFR3 > 29 && eGFR3 < 60) {
|
|
|
|
- text = "中度肾功能不全";
|
|
|
|
- } else if (eGFR3 >= 60 && eGFR3 <= 89) {
|
|
|
|
- text = "轻度肾功能不全";
|
|
|
|
- } else if (eGFR3 > 89) {
|
|
|
|
- text = "肾功能正常";
|
|
|
|
|
|
+ } else if ("血肌酐".equals(detailSub.get("name"))) {
|
|
|
|
+ if ("".equals(detailSub.get("value"))) {
|
|
|
|
+ break;
|
|
|
|
+ } else {
|
|
|
|
+ if ("umol/L".equals(detailSub.get("uint"))) {
|
|
|
|
+ scr = Double.parseDouble(detailSub.get("value").toString()) / 88.41;
|
|
|
|
+ } else if ("mg/dL".equals(detailSub.get("uint"))) {
|
|
|
|
+ scr = Double.parseDouble(detailSub.get("value").toString());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- valueResult.put("name", "GFR值");
|
|
|
|
- nameResult.put("name", "评估结论");
|
|
|
|
- if (eGFR3 <= 0 || Double.POSITIVE_INFINITY == eGFR3){
|
|
|
|
- valueResult.put("text", "");
|
|
|
|
- nameResult.put("text", "");
|
|
|
|
- } else {
|
|
|
|
- valueResult.put("text", new DecimalFormat("0.00").format(eGFR3) + " " + unit);
|
|
|
|
- nameResult.put("text", text);
|
|
|
|
|
|
+ } else if ("性别".equals(detailSub.get("name"))) {
|
|
|
|
+ List<Map<String, Object>> genderDetails = (List<Map<String, Object>>) detailSub.get("details");
|
|
|
|
+ for (int j = 0; j < genderDetails.size(); j++) {
|
|
|
|
+ Map<String, Object> genderDetail = genderDetails.get(j);
|
|
|
|
+ //返回的数据结构性别暂时是写死(默认女性)
|
|
|
|
+ if ((int) genderDetail.get("state") == 1) {
|
|
|
|
+ if ("男".equals(genderDetail.get("detailName"))) {
|
|
|
|
+ k = 0.9f;
|
|
|
|
+ denger = Double.parseDouble(genderDetail.get("value").toString());
|
|
|
|
+ sex = 1;
|
|
|
|
+
|
|
|
|
+ } else if ("女".equals(genderDetail.get("detailName"))) {
|
|
|
|
+ k = 0.7f;
|
|
|
|
+ denger = Double.parseDouble(genderDetail.get("value").toString());
|
|
|
|
+ sex = 2;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- // scaleCalcResult.put("text", text);
|
|
|
|
- // scaleCalcResult.put("unit", unit);
|
|
|
|
- // scaleCalcResult.put("value", new DecimalFormat("#.00").format(eGFR3));
|
|
|
|
- JSONArray result = new JSONArray();
|
|
|
|
- result.add(valueResult);
|
|
|
|
- result.add(nameResult);
|
|
|
|
- scaleCalcResult.put("result", result);
|
|
|
|
- System.out.println("text:" + text + "\tunit:" + unit + "\tvalue:" + eGFR3);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (sex == 1){
|
|
|
|
+ if (scr <= 0.90) {
|
|
|
|
+ a = -0.411;
|
|
|
|
+ } else {
|
|
|
|
+ a = -1.209;
|
|
|
|
+ }
|
|
|
|
+ } else if (sex == 2){
|
|
|
|
+ if (scr <= 0.70) {
|
|
|
|
+ a = -0.329;
|
|
|
|
+ } else {
|
|
|
|
+ a = -1.209;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ double eGFR3 = 141 * Math.pow((scr / k), a) * Math.pow(0.993, age) * denger;
|
|
|
|
+ String unit = "min•1.73㎡";
|
|
|
|
+ String text = "";
|
|
|
|
+ if (eGFR3 > 0 && eGFR3 <= 29) {
|
|
|
|
+ text = "重度肾功能不全";
|
|
|
|
+ } else if (eGFR3 > 29 && eGFR3 < 60) {
|
|
|
|
+ text = "中度肾功能不全";
|
|
|
|
+ } else if (eGFR3 >= 60 && eGFR3 <= 89) {
|
|
|
|
+ text = "轻度肾功能不全";
|
|
|
|
+ } else if (eGFR3 > 89) {
|
|
|
|
+ text = "肾功能正常";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ valueResult.put("name", "GFR值");
|
|
|
|
+ nameResult.put("name", "评估结论");
|
|
|
|
+ if (eGFR3 <= 0 || Double.POSITIVE_INFINITY == eGFR3) {
|
|
|
|
+ valueResult.put("text", "");
|
|
|
|
+ nameResult.put("text", "");
|
|
|
|
+ } else {
|
|
|
|
+ valueResult.put("text", new DecimalFormat("0.00").format(eGFR3) + " " + unit);
|
|
|
|
+ nameResult.put("text", text);
|
|
|
|
+ }
|
|
|
|
+ JSONArray result = new JSONArray();
|
|
|
|
+ result.add(valueResult);
|
|
|
|
+ result.add(nameResult);
|
|
|
|
+ scaleCalcResult.put("result", result);
|
|
return scaleCalcResult;
|
|
return scaleCalcResult;
|
|
}
|
|
}
|
|
}
|
|
}
|