Jelajahi Sumber

Merge remote-tracking branch 'origin/push-dev-filter' into push-debug

louhr 6 tahun lalu
induk
melakukan
18e9f8b3c9

+ 8 - 5
bigdata-web/src/main/java/org/diagbot/bigdata/work/ResultDataProxy.java

@@ -33,9 +33,10 @@ public class ResultDataProxy {
 //        Map<String, String> resultMappingVitalMap = ApplicationCacheUtil.getDoc_result_mapping_vital_map();
         Map<String, String> resultMappingDiagMap = ApplicationCacheUtil.getDoc_result_mapping_diag_map();
         Map<String, Map<String, ResultMappingFilter>> resultMappingFilterMap = ApplicationCacheUtil.getDoc_result_mapping_filter_map();
+        Map<String, Map<String, String>> synonymMap = ApplicationCacheUtil.getStandard_info_synonym_map();
         for (Map.Entry<String, Float> entry : featuresOrderList) {
             //过滤特征数据, 过滤低于阈值的数据
-            if (!resultFilter(request, searchData, featureType, entry.getKey(), entry.getValue())) {
+            if (!resultFilter(request, searchData, featureType, entry.getKey(), entry.getValue(), synonymMap)) {
                 continue;
             }
             //性别年龄过滤
@@ -85,11 +86,16 @@ public class ResultDataProxy {
         return featureList;
     }
 
-    public boolean resultFilter(HttpServletRequest request, BigDataSearchData searchData, String featureType, String result, float threshold) {
+    public boolean resultFilter(HttpServletRequest request, BigDataSearchData searchData, String featureType, String result, float threshold, Map<String, Map<String, String>> synonymMap) {
         //过滤录入条件中已有的特征信息
         if (searchData.getGraphInputs().get(result) != null && FeatureType.parse(featureType) != FeatureType.DIAG) {
             return false;
         }
+        if (FeatureType.parse(featureType) == FeatureType.SYMPTOM) {
+            if (searchData.getGraphInputs().get(synonymMap.get(Constants.word_property_symptom).get(result))!= null) {
+                return false;
+            }
+        }
         //
 //        if (searchData.getFilters().get(result) != null) {
 //            return false;
@@ -133,9 +139,6 @@ public class ResultDataProxy {
         for (Map.Entry<String, Float> entry : map.entrySet()) {
             synonym = convertMap.get(entry.getKey());
             if (synonym != null) {
-                if (isFilter && synonym.equals("阴道出血")) {
-                    System.out.println(entry.getKey() + "-->" + entry.getValue());
-                }
                 if (result.get(synonym) == null) {
                     result.put(synonym, entry.getValue());
                 } else {

+ 27 - 3
common-push/src/main/java/org/diagbot/common/push/filter/ClassifyDiag.java

@@ -116,11 +116,12 @@ public class ClassifyDiag {
          * 这里处理一下可能诊断剔除的功能
          * 如果图谱推出的诊断和可能诊断有层级关系,就把对应的可能诊断剔除
          */
+        Set<String> queSet =null;
         List<String> newBIgDiagList = this.removeKeng(queDiagList, bigDiagList);
         System.out.println("图谱归一前数据 :"+queDiagList);
         if(queDiagList != null && queDiagList.size()>0){
             //图谱归一 ,图谱sign =0,大数据sign = 1
-            Set<String> queSet = this.diagProcess(queDiagList,0);
+            queSet = this.diagProcess(queDiagList,0);
             System.out.println("图谱归一后的数据    :"+queSet);
             if(queSet != null && queSet.size()>0){
                 for (String queDis:queSet) {
@@ -144,6 +145,15 @@ public class ClassifyDiag {
         if(newBIgDiagList!= null && newBIgDiagList.size()>0){
             //大数据的可能诊断归一和排序
             List<FeatureRate> featureRates = this.sortFeatureList(newBIgDiagList, updateFeatures);
+            //把可能诊断中和图谱相同的诊断去除
+            if(featureRates != null && featureRates.size()>0 && queSet !=null){
+                for (FeatureRate f:featureRates) {
+                    if(queSet.contains(f.getFeatureName())){
+                        featureRates.remove(f);
+                        continue;
+                    }
+                }
+            }
             finalDiagList.addAll(featureRates);
         }
 
@@ -393,12 +403,26 @@ public class ClassifyDiag {
                     //如果能找到就把相关联的rate加起来
                     testCollect.add(queDis);
 
-                    String s = diagClassifyCache.get(queDis);
+                    String s = null;
+                    s= diagClassifyCache.get(queDis);
                     if(s != null){
                         testCollect.add(s);
+                        s = diagClassifyCache.get(s);
+                        if(s != null){
+                            testCollect.add(s);
+                        }
                     }
-                    List<Object> key = this.getKey(diagClassifyCache, queDis);
+                    List<Object> key =null;
+                    key = this.getKey(diagClassifyCache, queDis);
                     testCollect.addAll(key);
+                    if(key != null && key.size()>0){
+                        for (Object o:key) {
+                            key = this.getKey(diagClassifyCache,o.toString());
+                            if(key!= null){
+                                testCollect.addAll(key);
+                            }
+                        }
+                    }
                     Double count = 0.0;
                     for (String dis:diss) {
                         if(testCollect.indexOf(dis) >= 0){

+ 1 - 1
nlp/src/main/java/org/diagbot/nlp/feature/FeatureAnalyze.java

@@ -90,7 +90,7 @@ public class FeatureAnalyze {
                         l.setConcept(l.getConcept() + "," + NlpCache.standard_info_synonym_map.get(props[i]).get(l.getText()));
                     }
                     //如果是症状或体征,进行标准术语转换
-                    if (props[i].equals(Constants.feature_type_symptom) || props[i].equals(Constants.word_property_vital_result)) {
+                    if (props[i].equals(Constants.feature_type_symptom)) {
                         l.setText(NlpCache.standard_info_synonym_map.get(props[i]).get(l.getText()));
                     }
                 }