|
@@ -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;
|
|
|
+ }
|
|
|
+}
|