Browse Source

优化代码

louhr 5 years ago
parent
commit
ff1ff86dd1

+ 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(),searchData);
+        lisApplication.lisConvertToInputs(searchData.getLisArr(),searchData);
 
         Response<ResponseData> response = new Response();
         //一些基本信息预处理 如年龄 性别

+ 29 - 28
rule/src/main/java/org/diagbot/rule/lis/LisApplication.java

@@ -22,36 +22,37 @@ public class LisApplication {
 
     public void lisConvertToInputs(List<PreResult> preResultList, SearchData searchData) {
         if (preResultList != null) {
-            for (PreResult result : preResultList) {
-                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();
+            return;
+        }
+        String covertValue = "";
+        for (PreResult result : preResultList) {
+            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();
+                }
 
-                    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);
-                    }
+                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);
                 }
             }
         }