|
@@ -4,29 +4,44 @@ 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 org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
public class EntityProcessPacs extends EntityProcess {
|
|
|
|
|
|
- public List<Pacs> extractEntity(JSONObject aiOut) {
|
|
|
+ public List<Pacs> extractEntity(JSONObject aiOut, Map<String, String> name_uniqueName) {
|
|
|
//辅检情况
|
|
|
List<Pacs> pacses = new ArrayList<>();
|
|
|
List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
|
|
|
for (Lemma lemma : pacsLemmas) {
|
|
|
Pacs pacs = new Pacs();
|
|
|
+ if(StringUtils.isBlank(lemma.getText().trim())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
pacs.setName(lemma.getText());
|
|
|
+ if(name_uniqueName.containsKey(lemma.getText())){
|
|
|
+ pacs.setStandName(lemma.getText());
|
|
|
+ }
|
|
|
if (lemma.isHaveChildren()) {
|
|
|
+ List<BodyPart> bodyPartList = new ArrayList<>();
|
|
|
+ List<Diag> diseaseList = new ArrayList<>();
|
|
|
for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
|
if (relationLemma.getProperty().equals(EntityEnum.AUXILIARY_DESCRIPT.toString())) {
|
|
|
pacs.setPacsValues(addPacsValue(relationLemma));
|
|
|
} else if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) {
|
|
|
- pacs.setBodyPart(addBodyPart(relationLemma));
|
|
|
+ bodyPartList.add(addBodyPart(relationLemma));
|
|
|
+// pacs.setBodyPart(addBodyPart(relationLemma));
|
|
|
+ } else if(relationLemma.getProperty().equals(EntityEnum.DIEASE.toString())){
|
|
|
+ diseaseList.add(addDiag(relationLemma));
|
|
|
} else if (relationLemma.getProperty().equals(EntityEnum.OUTERCOURTYARD.toString())) {
|
|
|
pacs.setOuterCourtyard(addOuterCourtyard(relationLemma));
|
|
|
}
|
|
|
}
|
|
|
+ pacs.setBodyPartList(bodyPartList);
|
|
|
+ pacs.setDisease(diseaseList);
|
|
|
}
|
|
|
pacses.add(pacs);
|
|
|
}
|
|
@@ -51,6 +66,7 @@ public class EntityProcessPacs extends EntityProcess {
|
|
|
private PacsValue addPacsValue(Lemma relationLemma) {
|
|
|
PacsValue pacsValue = new PacsValue();
|
|
|
pacsValue.setName(relationLemma.getText());
|
|
|
+ pacsValue.setStandName(relationLemma.getText());
|
|
|
return pacsValue;
|
|
|
}
|
|
|
|
|
@@ -63,6 +79,14 @@ public class EntityProcessPacs extends EntityProcess {
|
|
|
private BodyPart addBodyPart(Lemma relationLemma) {
|
|
|
BodyPart bodyPart = new BodyPart();
|
|
|
bodyPart.setName(relationLemma.getText());
|
|
|
+ bodyPart.setStandName(relationLemma.getText());
|
|
|
+ return bodyPart;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Diag addDiag(Lemma relationLemma) {
|
|
|
+ Diag bodyPart = new Diag();
|
|
|
+ bodyPart.setName(relationLemma.getText());
|
|
|
+ bodyPart.setStandName(relationLemma.getText());
|
|
|
return bodyPart;
|
|
|
}
|
|
|
|