Browse Source

慢病——肾功能不全计算公式结果文本修改

hujing 5 years atrás
parent
commit
6112f7f7db
1 changed files with 19 additions and 16 deletions
  1. 19 16
      graph-web/src/main/java/org/diagbot/graphWeb/work/ScaleCalculate.java

+ 19 - 16
graph-web/src/main/java/org/diagbot/graphWeb/work/ScaleCalculate.java

@@ -2,6 +2,7 @@ package org.diagbot.graphWeb.work;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
 
 import java.text.DecimalFormat;
 import java.util.ArrayList;
@@ -154,6 +155,8 @@ public class ScaleCalculate {
     public Map<String, Object> scaleCalcMethod(JSONObject jsonObject) throws Exception {
         Map<String, Object> scaleCalcResult = new HashMap<>();
         Map<String, Object> data = (Map<String, Object>) jsonObject.get("data");
+        JSONObject valueResult = new JSONObject();
+        JSONObject nameResult = new JSONObject();
         int type = (int) data.get("type");
         if (type == 2) {
             Map<String, Object> content = (Map<String, Object>) data.get("content");
@@ -167,7 +170,7 @@ public class ScaleCalculate {
                 for (int i = 0; i < mapList.size(); i++) {
                     Map<String, Object> detailSub = mapList.get(i);
                     if ("年龄".equals(detailSub.get("name"))) {
-                        if ("".equals(detailSub.get("value"))) {
+                        if (StringUtils.isEmpty(detailSub.get("value").toString())) {
                             //如果拿到的年龄为空,
                             break;
                         } else {
@@ -212,27 +215,27 @@ public class ScaleCalculate {
                     }
                 }
                 double eGFR3 = 141 * Math.pow((scr / k), a) * Math.pow(0.993, age) * denger;
-                String unit = "ml/min•1.73m2";
-                String text = null;
-                if (eGFR3 <= 0) {
-                    text = "指标值缺少";
-                } else if (eGFR3 > 0 && eGFR3 < 15) {
-                    text = "肾功能衰竭";
-                } else if (eGFR3 >= 15 && eGFR3 <= 29) {
-                    text = "重度下降";
+                String unit = "min•1.73㎡";
+                String text = "";
+                if (eGFR3 > 0 && eGFR3 <= 29) {
+                    text = "重度肾功能不全";
                 } else if (eGFR3 > 29 && eGFR3 < 60) {
-                    text = "中度下降";
+                    text = "中度肾功能不全";
                 } else if (eGFR3 >= 60 && eGFR3 <= 89) {
-                    text = "轻度下降";
+                    text = "轻度肾功能不全";
                 } else if (eGFR3 > 89) {
-                    text = "正常或肾损伤代偿期";
+                    text = "肾功能正常";
                 }
-                JSONObject valueResult = new JSONObject();
-                JSONObject nameResult = new JSONObject();
+
                 valueResult.put("name", "GFR值");
-                valueResult.put("text", new DecimalFormat("0.00").format(eGFR3) + " " + unit);
                 nameResult.put("name", "评估结论");
-                nameResult.put("text", text);
+                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);
+                }
                 //                scaleCalcResult.put("text", text);
                 //                scaleCalcResult.put("unit", unit);
                 //                scaleCalcResult.put("value", new DecimalFormat("#.00").format(eGFR3));