|
@@ -7,9 +7,11 @@ import com.diagbot.model.entity.BodyPart;
|
|
|
import com.diagbot.model.entity.Pacs;
|
|
|
import com.diagbot.model.entity.PacsNew;
|
|
|
import com.diagbot.model.label.PacsLabel;
|
|
|
+import com.diagbot.util.ListUtil;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -21,6 +23,23 @@ import java.util.Map;
|
|
|
public class EntityProcessPacsNew extends EntityProcess {
|
|
|
|
|
|
public void extractEntity(JSONObject aiOut, PacsLabel pacsLabel) {
|
|
|
+ // 获取描述和部位的关系
|
|
|
+ Map<String, List<BodyPart>> bodyMap = new LinkedHashMap<>();
|
|
|
+ List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_DESCRIPT.toString());
|
|
|
+ for (Lemma lemma : pacsLemmas) {
|
|
|
+ List<BodyPart> bodyPartList = new ArrayList<>();
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
|
+ if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) {
|
|
|
+ BodyPart bodyPart = new BodyPart();
|
|
|
+ bodyPart.setName(relationLemma.getText());
|
|
|
+ bodyPartList.add(bodyPart);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bodyMap.put(lemma.getText(), bodyPartList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//辅检描述情况
|
|
|
List<Lemma> pacsAll = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
|
|
|
|
|
@@ -35,15 +54,9 @@ public class EntityProcessPacsNew extends EntityProcess {
|
|
|
Pacs desc = new Pacs();
|
|
|
desc.setName(relationLemma.getText());
|
|
|
desc.setStandName(relationLemma.getText());
|
|
|
- // if (lemma.isHaveChildren()) {
|
|
|
- // List<BodyPart> bodyPartList = new ArrayList<>();
|
|
|
- // for (Lemma relationLemmaSon : lemma.getRelationLemmas()) {
|
|
|
- // if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) {
|
|
|
- // bodyPartList.add(addBodyPart(relationLemmaSon));
|
|
|
- // }
|
|
|
- // }
|
|
|
- // desc.setBodyPartList(bodyPartList);
|
|
|
- // }
|
|
|
+ if (ListUtil.isNotEmpty(bodyMap.get(relationLemma.getText()))) {
|
|
|
+ desc.setBodyPartList(bodyMap.get(relationLemma.getText()));
|
|
|
+ }
|
|
|
descList.add(desc);
|
|
|
} else if (relationLemma.getProperty().equals(EntityEnum.DIEASE.toString())) {
|
|
|
// 辅检诊断信息
|