浏览代码

修改肾小球计算公式接口

hujing 6 年之前
父节点
当前提交
e82b7bed91

+ 68 - 73
graph-web/src/main/java/org/diagbot/graphWeb/work/GraphCalculate.java

@@ -401,89 +401,84 @@ public class GraphCalculate {
     public Map<String, Object> scaleCalcMethod(MedicalIndicationDetail medicalIndicationDetail) throws Exception {
         Map<String, Object> scaleCalcResult = new HashMap<>();
         Integer type = medicalIndicationDetail.getType();
-        if (type == 1) {
-            //                    case 1:
-            //                        Set<String> inputs = searchData.getInputs().keySet();
-            //                        String[] input = inputs.toArray(new String[inputs.size()]);
-            //                        Map<String, Object> stringObjectMap = neo4jAPI.scaleScoreCalc(input, searchData.getScaleName());
-            //                        scaleCalcResultList.add(stringObjectMap);
-            //                        break;
-        } else if (type == 2) {
+        if (type == 2) {
             JSONObject content = medicalIndicationDetail.getContent();
             JSONArray contentDetails = content.getJSONArray("details");
-            int age = 0;
-            double scr = 0.00;
-            float k = 0.0f;
-            double a = 0.00;
-            double denger = 0.00;
-            for (int i = 0; i < contentDetails.size(); i++) {
-                JSONObject detailSub = contentDetails.getJSONObject(i);
-                if ("年龄".equals(detailSub.getString("name"))) {
-                    if ("".equals(detailSub.getString("value"))) {
-                        //如果拿到的年龄为空,
-                        break;
-                    } else {
-                        age = Integer.parseInt(detailSub.getString("value"));
-                    }
-                } else if ("血肌酐".equals(detailSub.getString("name"))) {
-                    if ("".equals(detailSub.getString("value"))) {
-                        //如果给的value是空,给的2.2621是假数据
-                        break;
-                    } else {
-                        if ("umol/L".equals(detailSub.getString("value"))) {
-                            scr = Double.valueOf(detailSub.getString("value")) / 88.41;
+            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 < contentDetails.size(); i++) {
+                    JSONObject detailSub = contentDetails.getJSONObject(i);
+                    if ("年龄".equals(detailSub.getString("name"))) {
+                        if ("".equals(detailSub.getString("value"))) {
+                            //如果拿到的年龄为空,
+                            break;
                         } else {
-                            scr = Double.valueOf(detailSub.getString("value"));
+                            age = Integer.parseInt(detailSub.getString("value"));
                         }
-                    }
-                } else if ("性别".equals(detailSub.getString("name"))) {
-                    JSONArray genderDetails = detailSub.getJSONArray("details");
-                    for (int j = 0; j < genderDetails.size(); j++) {
-                        JSONObject genderDetail = genderDetails.getJSONObject(j);
-                        //返回的数据结构性别暂时是写死(默认女性)
-                        if (genderDetail.getInteger("state") == 1) {
-                            if ("男".equals(genderDetail.getString("detailName"))) {
-                                k = 0.9f;
-                                denger = Double.parseDouble(genderDetail.getString("value"));
-                                if (scr <= 0.90) {
-                                    a = -0.411;
-                                } else {
-                                    a = -1.209;
-                                }
-                            } else if ("女".equals(genderDetail.getString("detailName"))) {
-                                k = 0.7f;
-                                denger = Double.parseDouble(genderDetail.getString("value"));
-                                if (scr <= 0.70) {
-                                    a = -0.329;
-                                } else {
-                                    a = -1.209;
+                    } else if ("血肌酐".equals(detailSub.getString("name"))) {
+                        if ("".equals(detailSub.getString("value"))) {
+                            //如果给的value是空,给的2.2621是假数据
+                            break;
+                        } else {
+                            if ("umol/L".equals(detailSub.getString("value"))) {
+                                scr = Double.valueOf(detailSub.getString("value")) / 88.41;
+                            } else {
+                                scr = Double.valueOf(detailSub.getString("value"));
+                            }
+                        }
+                    } else if ("性别".equals(detailSub.getString("name"))) {
+                        JSONArray genderDetails = detailSub.getJSONArray("details");
+                        for (int j = 0; j < genderDetails.size(); j++) {
+                            JSONObject genderDetail = genderDetails.getJSONObject(j);
+                            //返回的数据结构性别暂时是写死(默认女性)
+                            if (genderDetail.getInteger("state") == 1) {
+                                if ("男".equals(genderDetail.getString("detailName"))) {
+                                    k = 0.9f;
+                                    denger = Double.parseDouble(genderDetail.getString("value"));
+                                    if (scr <= 0.90) {
+                                        a = -0.411;
+                                    } else {
+                                        a = -1.209;
+                                    }
+                                } else if ("女".equals(genderDetail.getString("detailName"))) {
+                                    k = 0.7f;
+                                    denger = Double.parseDouble(genderDetail.getString("value"));
+                                    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 = "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 = "重度下降";
-            } else if (eGFR3 > 30 && eGFR3 <= 59) {
-                text = "中度下降";
-            } else if (eGFR3 > 60 && eGFR3 <= 89) {
-                text = "轻度下降";
-            } else if (eGFR3 >= 90) {
-                text = "正常或肾损伤代偿期";
-            }
+                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 = "重度下降";
+                } else if (eGFR3 > 30 && eGFR3 <= 59) {
+                    text = "中度下降";
+                } else if (eGFR3 > 60 && eGFR3 <= 89) {
+                    text = "轻度下降";
+                } else if (eGFR3 >= 90) {
+                    text = "正常或肾损伤代偿期";
+                }
 
-            scaleCalcResult.put("text", text);
-            scaleCalcResult.put("unit", unit);
-            scaleCalcResult.put("value", eGFR3);
-            System.out.println("text:" + text + "\tunit:" + unit + "\tvalue:" + eGFR3);
+                scaleCalcResult.put("text", text);
+                scaleCalcResult.put("unit", unit);
+                scaleCalcResult.put("value", eGFR3);
+                System.out.println("text:" + text + "\tunit:" + unit + "\tvalue:" + eGFR3);
+            }
         }
 
 

+ 13 - 6
push-web/src/main/java/org/diagbot/push/controller/GraphController.java

@@ -32,12 +32,15 @@ public class GraphController extends BaseController {
     {
         listView = "/pages/graph/list.html";
     }
-    @RequestMapping({"/index"})
+
+    @RequestMapping({ "/index" })
     public String index() {
         return listView;
     }
+
     /**
      * 推送诊断,治疗
+     *
      * @param request
      * @param searchData
      * @return
@@ -55,6 +58,7 @@ public class GraphController extends BaseController {
 
     /**
      * 推送警惕
+     *
      * @param request
      * @param searchData
      * @return
@@ -70,6 +74,7 @@ public class GraphController extends BaseController {
 
     /**
      * 推送化验,辅检
+     *
      * @param request
      * @param searchData
      * @return
@@ -98,8 +103,7 @@ public class GraphController extends BaseController {
 
     @RequestMapping(value = "/scaleCalc", method = RequestMethod.POST)
     @ResponseBody
-    public List<Map<String, Object>> scaleCalc(HttpServletRequest request, @RequestBody SearchData searchData) throws Exception {
-        List<Map<String, Object>> mapList = new ArrayList<>();
+    public Map<String, Object> scaleCalc(HttpServletRequest request, @RequestBody SearchData searchData) throws Exception {
         Map<String, Object> maps = null;
         GraphCalculate graphCalculate = new GraphCalculate();
         ResponseData responseData = graphCalculate.calculate(request, searchData);
@@ -107,11 +111,14 @@ public class GraphController extends BaseController {
         for (MedicalIndication medicalIndication : medicalIndications) {
             List<MedicalIndicationDetail> details = medicalIndication.getDetails();
             for (MedicalIndicationDetail medicalIndicationDetail : details) {
-                maps = graphCalculate.scaleCalcMethod(medicalIndicationDetail);
-                mapList.add(maps);
+                if (medicalIndicationDetail.getType() == 2) {
+                    if ("肾小球滤过率".equals(medicalIndicationDetail.getContent().get("name"))) {
+                        maps = graphCalculate.scaleCalcMethod(medicalIndicationDetail);
+                    }
+                }
             }
         }
-        return mapList;
+        return maps;
     }
 
 }