|
@@ -2,16 +2,20 @@ package com.diagbot.model.ai.process;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.diagbot.model.ai.model.EntityEnum;
|
|
|
+import com.diagbot.model.ai.model.Lemma;
|
|
|
import com.diagbot.model.entity.*;
|
|
|
+import com.diagbot.model.label.VitalLabel;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
public class EntityProcessVital extends EntityProcess {
|
|
|
- public List<Vital> extractEntity(JSONObject outputs) {
|
|
|
+ public VitalLabel extractEntity(JSONObject outputs) {
|
|
|
+ VitalLabel vitalLabel = new VitalLabel();
|
|
|
List<Vital> vitals = new ArrayList<>();
|
|
|
Vital vital =null;
|
|
|
List<Map<String, String>> vitalEntityList = processJson(outputs, EntityEnum.SIGN.toString());
|
|
@@ -59,6 +63,49 @@ public class EntityProcessVital extends EntityProcess {
|
|
|
}
|
|
|
vitals.add(vital);
|
|
|
}
|
|
|
- return vitals;
|
|
|
+ vitalLabel.setVitals(vitals);
|
|
|
+ try{
|
|
|
+ //临床表现
|
|
|
+ List<Lemma> clinicLemmas = createEntityTree(outputs, EntityEnum.CLINICAL_FEATURE.toString());
|
|
|
+ for (Lemma lemma : clinicLemmas) {
|
|
|
+ Clinical clinical = new Clinical();
|
|
|
+ clinical.setName(lemma.getText());
|
|
|
+ clinical.setStandName(lemma.getText());
|
|
|
+
|
|
|
+ List<PD> timestamp = new LinkedList<>();
|
|
|
+ for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
|
+ if (relationLemma.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
|
|
|
+ clinical.setNegative(findNegative(lemma));
|
|
|
+ }
|
|
|
+ clinical.setModification(findT(lemma, new Modification(), EntityEnum.MODIFICATION.toString()));//修饰
|
|
|
+ clinical.setBodyPart(findT(lemma, new BodyPart(), EntityEnum.BODY.toString()));//部位
|
|
|
+ clinical.setTrend(findT(lemma, new Trend(), EntityEnum.TREND.toString()));//趋势
|
|
|
+ clinical.setCause(findT(lemma, new Cause(), EntityEnum.CAUSE.toString()));//诱因
|
|
|
+ clinical.setProperty(findT(lemma, new Property(), EntityEnum.PROPERTY.toString()));//性质
|
|
|
+ clinical.setDegree(findT(lemma, new Degree(), EntityEnum.DEGREE.toString()));//程度
|
|
|
+ clinical.setAggravate(findT(lemma, new Aggravate(), EntityEnum.AGGRAVATE.toString()));//加重因素
|
|
|
+ clinical.setRelief(findT(lemma, new Relief(), EntityEnum.RELIEF.toString()));//缓解因素
|
|
|
+ if (relationLemma.getProperty().equals(EntityEnum.TIME.toString())) {
|
|
|
+ String[] time_split = relationLemma.getText().split(",");
|
|
|
+ for (String time : time_split) {
|
|
|
+ PD pd = new PD();
|
|
|
+ String[] val_unit = new String[2];
|
|
|
+ if (time.trim().length() > 0) {
|
|
|
+ val_unit = extract_digit(time);
|
|
|
+ }
|
|
|
+ pd.setValue(val_unit[0]);
|
|
|
+ pd.setUnit(val_unit[1]);
|
|
|
+ pd.setName(time);
|
|
|
+ timestamp.add(pd);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ clinical.setTimestamp(timestamp);
|
|
|
+ vitalLabel.add(vitalLabel.getClinicals(), clinical);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return vitalLabel;
|
|
|
}
|
|
|
}
|