浏览代码

根据SearchData里年龄、性别、肌酐值(lis)计算GFR,并用GFR结果对应文本走规则处理

hujing 5 年之前
父节点
当前提交
af5c95ed55

+ 80 - 0
common-push/src/main/java/org/diagbot/common/push/filter/rule/CalcFormula.java

@@ -0,0 +1,80 @@
+package org.diagbot.common.push.filter.rule;
+
+import org.diagbot.common.push.bean.SearchData;
+import org.diagbot.nlp.rule.module.PreResult;
+
+import java.util.List;
+
+/**
+ * @Description: 需要走规则的计算公式
+ * @Author: HUJING
+ * @Date: 2019/12/31 14:10
+ */
+public class CalcFormula {
+    public String gfrCalcMethod(SearchData searchData) {
+        String text = "";
+        List<PreResult> lis = searchData.getLis();
+        String crValue = "";
+        String units = "";
+        boolean hasCr = false;
+        for (PreResult preResult : lis) {
+            if ("化验--肾功能测定--肌酐(Cr)".equals(preResult.getUniqueName())) {
+                crValue = preResult.getValue();
+                units = preResult.getUnits();
+                hasCr = true;
+                break;
+            }
+        }
+        if (!hasCr) {
+            return text;
+        }
+
+        int age = searchData.getAge();
+        double scr = 0d;
+        float k = 0f;
+        double a = 0d;
+        double denger = 0d;
+
+        if ("umol/L".equals(units)) {
+            scr = Double.parseDouble(crValue) / 88.41;
+        } else if ("mg/dL".equals(units)) {
+            scr = Double.parseDouble(crValue);
+        }
+
+        String sex = searchData.getSex();
+        if ("1".equals(sex) || "M".equals(sex)) {
+            k = 0.9f;
+            denger = 1d;
+            if (scr <= 0.90) {
+                a = -0.411;
+            } else {
+                a = -1.209;
+            }
+        } else if ("2".equals(sex) || "F".equals(sex)) {
+            k = 0.7f;
+            denger = 1.018;
+            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;
+
+        if (eGFR3 <= 0 || Double.POSITIVE_INFINITY == eGFR3) {
+            return 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 = "肾功能正常";
+        }
+        return text;
+    }
+}

+ 12 - 0
common-push/src/main/java/org/diagbot/common/push/filter/rule/PretreatmentRule.java

@@ -182,6 +182,18 @@ public class PretreatmentRule {
 //                System.out.println("id:" + rule.getId() + "; pub_name: " + rule.getPub_name());
 //            }
 //        }
+        if (searchData.getLis() != null && searchData.getLis().size() > 0) {
+            //计算GFR值
+            CalcFormula calcFormula = new CalcFormula();
+            String gfrResult = calcFormula.gfrCalcMethod(searchData);
+            if (!StringUtils.isEmpty(gfrResult)) {
+                PreResult preResult = new PreResult();
+                preResult.setValue(gfrResult);
+                preResult.setUniqueName("检查--");
+                searchData.getPacs().add(preResult);
+                searchData.setPacsString(add2PreResultList(searchData.getPacs(), searchData.getPacsString(), "pacs", searchData));
+            }
+        }
     }
 
     private String add2PreResultList(Pretreatment pretreatment, String content, String inputType, SearchData searchData) throws java.io.IOException {