瀏覽代碼

1、限制特征提取数量修改为最多7个
2、现病史、既往史、其他史、检验检查独立分开提取特征

louhr 6 年之前
父節點
當前提交
79327d1ad8

+ 19 - 9
bigdata-web/src/main/java/org/diagbot/bigdata/work/ParamsDataProxy.java

@@ -66,8 +66,8 @@ public class ParamsDataProxy {
             }
         }
         //所有信息参与推送
-        searchData.setSymptom(searchData.getSymptom() + searchData.getVital()
-                + searchData.getLis() + searchData.getPacs() + searchData.getPast() + searchData.getOther() + searchData.getIndications());
+//        searchData.setSymptom(searchData.getSymptom() + searchData.getVital()
+//                + searchData.getLis() + searchData.getPacs() + searchData.getPast() + searchData.getOther() + searchData.getIndications());
         searchData.setSymptom(searchData.getSymptom().trim());
         //一次推送多个类别信息
         String[] featureTypes = searchData.getFeatureType().split(",");
@@ -83,14 +83,23 @@ public class ParamsDataProxy {
         FeatureAnalyze fa = new FeatureAnalyze();
 
         if (!StringUtils.isEmpty(searchData.getSymptom())) {
-            //特征(不含化验 辅检)
+            //提取现病史
             List<Map<String, Object>> featuresList = fa.start(searchData.getSymptom(), FeatureType.FEATURE);
             paramFeatureInit(searchData, featuresList);
+            //提取体征
+            featuresList = fa.start(searchData.getVital(), FeatureType.FEATURE);
+            paramFeatureInit(searchData, featuresList);
+            //提取既往史
+            featuresList = fa.start(searchData.getPast(), FeatureType.FEATURE);
+            paramFeatureInit(searchData, featuresList);
+            //提取其他史等
+            featuresList = fa.start(searchData.getOther() + searchData.getIndications(), FeatureType.FEATURE);
+            paramFeatureInit(searchData, featuresList);
 
-            featuresList = fa.start(searchData.getSymptom(), FeatureType.PACS);
+            featuresList = fa.start(searchData.getPacs(), FeatureType.PACS);
             paramFeatureInit(searchData, featuresList);
 
-            featuresList = fa.start(searchData.getSymptom(), FeatureType.LIS);
+            featuresList = fa.start(searchData.getLis(), FeatureType.LIS);
             paramFeatureInit(searchData, featuresList);
 
             // 清洗特征词,去除词性不匹配的词
@@ -227,7 +236,6 @@ public class ParamsDataProxy {
      */
     private void paramFeatureInit(SearchData searchData, List<Map<String, Object>> featuresList) throws Exception {
         if (featuresList != null && featuresList.size() > 0) {
-            //            BeanUtils.setProperty(searchData, property_list, featuresList);
             Map<String, Object> featureMap = null;
             for (int i = 0; i < featuresList.size(); i++) {
                 featureMap = featuresList.get(i);
@@ -237,13 +245,15 @@ public class ParamsDataProxy {
                 }
                 map.put("featureType", String.valueOf(featureMap.get("feature_type")));
                 map.put("featureName", String.valueOf(featureMap.get("feature_name")));
+                map.put("property", String.valueOf(featureMap.get("property")));
+                map.put("concept", String.valueOf(featureMap.get("concept")));
                 if (Constants.default_negative.equals(featureMap.get("negative"))) {
-                    searchData.getInputs().put(map.get("feature_name"), map);
+                    if (searchData.getInputs().get(map.get("feature_name")) == null) {
+                        searchData.getInputs().put(map.get("feature_name"), map);
+                    }
                 } else {
                     searchData.getFilters().put(map.get("feature_name"), map);
                 }
-                map.put("property", String.valueOf(featureMap.get("property")));
-                map.put("concept", String.valueOf(featureMap.get("concept")));
             }
         }
     }

+ 2 - 5
nlp/src/main/java/org/diagbot/nlp/feature/extract/CaseToken.java

@@ -100,10 +100,7 @@ public abstract class CaseToken {
             }
         }
         if (!hasFeature) {
-//            if (sn > 1000) {
-//                System.out.println("111111..." + lexeme.getText());
-//            }
-//            if (sn <= 5) {
+            if (sn <= 6) {
                 Map<String, Object> fMap = new HashMap<>(10);
                 fMap.put("feature_name", lexeme.getText());
                 fMap.put("feature_type", featureType);
@@ -112,7 +109,7 @@ public abstract class CaseToken {
                 fMap.put("property", lexeme.getProperty());
                 fMap.put("concept", lexeme.getConcept());
                 featuresList.add(fMap);
-//            }
+            }
         }
     }
 }

+ 25 - 1
push-web/src/main/resources/static/pages/algorithm/list.html

@@ -92,9 +92,17 @@
         <form role="form">
             <div class="box-body">
                 <div class="form-group">
-                    <label for="symptom_id">症状</label>&nbsp;
+                    <label for="symptom_id">现病史</label>&nbsp;
                     <input type="text" id="symptom_id" placeholder="" size="150">&nbsp;&nbsp;&nbsp;&nbsp;
                 </div>
+                <div class="form-group">
+                    <label for="other_id">体征信息</label>&nbsp;
+                    <input type="text" id="vital_id" placeholder="" size="150">&nbsp;&nbsp;&nbsp;&nbsp;
+                </div>
+                <div class="form-group">
+                    <label for="other_id">既往史</label>&nbsp;
+                    <input type="text" id="past_id" placeholder="" size="150">&nbsp;&nbsp;&nbsp;&nbsp;
+                </div>
                 <div class="form-group">
                     <label for="other_id">其他史</label>&nbsp;
                     <input type="text" id="other_id" placeholder="" size="150">&nbsp;&nbsp;&nbsp;&nbsp;
@@ -398,6 +406,8 @@
                     d.resourceType = resourceType;
                     d.algorithmClassifyValue =  algorithmClassify;
                     var symptom = $("#symptom_id").val();
+                    var vital = $("#vital_id").val();
+                    var past = $("#past_id").val();
                     var other = $("#other_id").val();
                     var lis = $("#lis_id").val();
                     var pacs = $("#pacs_id").val();
@@ -412,6 +422,12 @@
                     if (symptom != null && symptom != undefined) {
                         d.symptom = symptom;
                     }
+                    if (vital != null && vital != undefined) {
+                        d.vital = vital;
+                    }
+                    if (past != null && past != undefined) {
+                        d.past = past;
+                    }
                     if (other != null && other != undefined) {
                         d.other = other;
                     }
@@ -500,6 +516,8 @@
                     d.resourceType = resourceType;
                     d.algorithmClassifyValue =  algorithmClassify;
                     var symptom = $("#symptom_id").val();
+                    var vital = $("#vital_id").val();
+                    var past = $("#past_id").val();
                     var other = $("#other_id").val();
                     var lis = $("#lis_id").val();
                     var pacs = $("#pacs_id").val();
@@ -514,6 +532,12 @@
                     if (symptom != null && symptom != undefined) {
                         d.symptom = symptom;
                     }
+                    if (vital != null && vital != undefined) {
+                        d.vital = vital;
+                    }
+                    if (past != null && past != undefined) {
+                        d.past = past;
+                    }
                     if (other != null && other != undefined) {
                         d.other = other;
                     }