Bläddra i källkod

修改lis数值转换代码

hujing 5 år sedan
förälder
incheckning
cb43afe026

+ 1 - 1
push-web/src/main/java/org/diagbot/push/controller/AlgorithmController.java

@@ -132,7 +132,7 @@ public class AlgorithmController extends BaseController {
             Pretreatment pretreatment = new PretreatmentLis();
             searchData.setLisArr(pretreatment.analyze(searchData.getLis()));
         }
-        lisApplication.lisConvert(searchData.getLisArr());
+        lisApplication.lisConvert(searchData.getLisArr(),searchData);
 
         Response<ResponseData> response = new Response();
         //一些基本信息预处理 如年龄 性别

+ 33 - 14
rule/src/main/java/org/diagbot/rule/lis/LisApplication.java

@@ -1,10 +1,14 @@
 package org.diagbot.rule.lis;
 
+import org.diagbot.common.push.bean.SearchData;
 import org.diagbot.nlp.rule.module.PreResult;
+import org.diagbot.nlp.util.Constants;
 import org.springframework.util.StringUtils;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description:
@@ -16,26 +20,41 @@ public class LisApplication {
     private static String down = "降低";
     private static String normal = "正常";
 
-    public List<PreResult> lisConvert(List<PreResult> preResultList) {
+    public void lisConvert(List<PreResult> preResultList, SearchData searchData) {
         if (preResultList != null) {
             for (PreResult result : preResultList) {
-                if (isNumber(result.getValue())) {
-                    if (!StringUtils.isEmpty(result.getMaxValue()) && !StringUtils.isEmpty(result.getMinValue())
-                            && isNormal(result.getValue(), result.getMaxValue(), result.getMinValue())) {
-                        result.setOtherValue(result.getUniqueName() + normal);
-                    } else if (!StringUtils.isEmpty(result.getMaxValue())
-                            && compareMax(result.getValue(), result.getMaxValue())) {
-                        result.setOtherValue(result.getUniqueName() + up);
-                    } else if (!StringUtils.isEmpty(result.getMinValue())
-                            && compareMin(result.getValue(), result.getMinValue())) {
-                        result.setOtherValue(result.getUniqueName() + down);
+                String covertValue = "";
+                if (!StringUtils.isEmpty(result.getUniqueName())) {
+                    //value是数值类型则进行转换
+                    if (!StringUtils.isEmpty(result.getValue()) && isNumber(result.getValue())) {
+                        if (!StringUtils.isEmpty(result.getMaxValue()) && !StringUtils.isEmpty(result.getMinValue())
+                                && isNormal(result.getValue(), result.getMaxValue(), result.getMinValue())) {
+                            covertValue = result.getUniqueName() + normal;
+                        } else if (!StringUtils.isEmpty(result.getMaxValue())
+                                && compareMax(result.getValue(), result.getMaxValue())) {
+                            covertValue = result.getUniqueName() + up;
+                        } else if (!StringUtils.isEmpty(result.getMinValue())
+                                && compareMin(result.getValue(), result.getMinValue())) {
+                            covertValue = result.getUniqueName() + down;
+                        }
+                    } else if (!StringUtils.isEmpty(result.getOtherValue())){
+                        //otherValue是文本类型则直接与UniqueName拼接
+                        covertValue = result.getUniqueName() + result.getOtherValue();
                     }
-                } else {
-                    result.setOtherValue(result.getValue());
+                }
+
+                Map<String, String> map = new HashMap<>();
+                map.put("featureType", Constants.feature_type_lis);
+                map.put("featureName", covertValue);
+                map.put("property", Constants.word_property_LIS_Result);
+                map.put("concept", covertValue);
+                //全是有
+                map.put("negative", Constants.default_negative);
+                if (searchData.getInputs().get(map.get("featureName")) == null) {
+                    searchData.getInputs().put(map.get("featureName"), map);
                 }
             }
         }
-        return preResultList;
     }