|
@@ -8,9 +8,15 @@ import org.diagbot.nlp.dao.model.Info;
|
|
|
import org.diagbot.nlp.dao.model.wrapper.FeatureWrapper;
|
|
|
import org.diagbot.nlp.feature.FeatureAnalyze;
|
|
|
import org.diagbot.nlp.feature.FeatureType;
|
|
|
+import org.diagbot.nlp.participle.ParticipleUtil;
|
|
|
+import org.diagbot.nlp.participle.word.Lexeme;
|
|
|
+import org.diagbot.nlp.participle.word.LexemePath;
|
|
|
import org.diagbot.nlp.service.FeatureService;
|
|
|
import org.diagbot.nlp.service.InfoService;
|
|
|
import org.diagbot.nlp.util.Constants;
|
|
|
+import org.diagbot.nlp.util.NegativeEnum;
|
|
|
+import org.diagbot.nlp.util.NlpCache;
|
|
|
+import org.diagbot.nlp.util.NlpUtil;
|
|
|
import org.diagbot.pub.api.Response;
|
|
|
import org.diagbot.pub.jdbc.MysqlJdbc;
|
|
|
import org.diagbot.pub.web.BaseController;
|
|
@@ -62,15 +68,42 @@ public class FeatureController extends BaseController<Feature, FeatureWrapper, L
|
|
|
@ResponseBody
|
|
|
public Response findSymptomFeature(HttpServletRequest request, String text) throws Exception {
|
|
|
Response response = new Response();
|
|
|
- //获取入参中的特征信息
|
|
|
- FeatureAnalyze fa = new FeatureAnalyze();
|
|
|
- List<Map<String, Object>> symptomsList_symptom = fa.start(text, FeatureType.SYMPTOM);
|
|
|
- List<Map<String, Object>> symptomsList_diag = fa.start(text, FeatureType.DIAG);
|
|
|
-
|
|
|
- List<Map<String, Object>> symptomsList = new ArrayList<>();
|
|
|
- symptomsList.addAll(symptomsList_symptom);
|
|
|
- symptomsList.addAll(symptomsList_diag);
|
|
|
- response.setData(symptomsList);
|
|
|
+
|
|
|
+ Map<String, String> classifies = NlpCache.getStandard_info_classify_map();
|
|
|
+ LexemePath<Lexeme> lexemes = ParticipleUtil.participle(text);
|
|
|
+
|
|
|
+ String[] properties = null;
|
|
|
+ String[] conceptIds = null;
|
|
|
+ List<Map<String, String>> featureList = new ArrayList<>();
|
|
|
+ for (Lexeme lexeme : lexemes) {
|
|
|
+ properties = lexeme.getProperty().split(",");
|
|
|
+ conceptIds = lexeme.getConcept().split(",");
|
|
|
+ for (int i = 0; i < properties.length; i++) {
|
|
|
+ if (NlpUtil.isFeature(properties[i], new NegativeEnum[]{NegativeEnum.SYMPTOM})) {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("conceptId", conceptIds[i]);
|
|
|
+ map.put("name", lexeme.getText());
|
|
|
+ map.put("libType", NegativeEnum.SYMPTOM.toString());
|
|
|
+ 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());
|
|
|
+
|
|
|
+ if ("慢病".equals(classifies.get(lexeme.getText()))) {
|
|
|
+ for (Lexeme l : lexemes) {
|
|
|
+ if (NlpUtil.isFeature(l.getProperty(), new NegativeEnum[]{NegativeEnum.RETURN_VISIT})) {
|
|
|
+ map.put("chronicLabel", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ featureList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ response.setData(featureList);
|
|
|
return response;
|
|
|
}
|
|
|
|