Prechádzať zdrojové kódy

1、主诉有慢病复诊,只返回这个慢病复诊标识
2、主诉无复诊,只返回症状

louhr 6 rokov pred
rodič
commit
79835e36c6

+ 9 - 7
nlp-web/src/main/java/org/diagbot/nlp/controller/FeatureController.java

@@ -91,20 +91,22 @@ public class FeatureController extends BaseController<Feature, FeatureWrapper, L
                     featureList.add(map);
                 }
                 if (NlpUtil.isFeature(properties[i], new NegativeEnum[]{NegativeEnum.DISEASE})) {
-                    Map<String, String> map = new HashMap<>();
-                    map.put("conceptId", conceptIds[i]);
-                    map.put("name", lexeme.getText());
-                    map.put("libType", NegativeEnum.DISEASE.toString());
-                    map.put("chronicLabel", "0");
-
                     if ("慢病".equals(classifies.get(lexeme.getText()))) {
+                        Map<String, String> map = new HashMap<>();
+                        map.put("conceptId", conceptIds[i]);
+                        map.put("name", lexeme.getText());
+                        map.put("libType", NegativeEnum.DISEASE.toString());
+                        map.put("chronicLabel", "0");
                         for (Lexeme l : lexemes) {
                             if (NlpUtil.isFeature(l.getProperty(), new NegativeEnum[]{NegativeEnum.RETURN_VISIT})) {
                                 map.put("chronicLabel", "1");
+                                featureList = new ArrayList<>();
+                                featureList.add(map);
+                                response.setData(featureList);
+                                return response;
                             }
                         }
                     }
-                    featureList.add(map);
                 }
             }
         }