|
@@ -6,9 +6,12 @@ import com.diagbot.model.ai.model.Lemma;
|
|
|
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 java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author kwz
|
|
@@ -17,37 +20,51 @@ import java.util.List;
|
|
|
*/
|
|
|
public class EntityProcessPacsNew extends EntityProcess {
|
|
|
|
|
|
- public void extractEntity(JSONObject aiOut, PacsNew pacsNew) {
|
|
|
+ public void extractEntity(JSONObject aiOut, PacsLabel pacsLabel) {
|
|
|
//辅检描述情况
|
|
|
- List<Pacs> pacses = new ArrayList<>();
|
|
|
- List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_DESCRIPT.toString());
|
|
|
- for (Lemma lemma : pacsLemmas) {
|
|
|
- Pacs pacs = new Pacs();
|
|
|
- pacs.setName(lemma.getText());
|
|
|
- pacs.setStandName(lemma.getText());
|
|
|
+ List<Lemma> pacsAll = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
|
|
|
+
|
|
|
+ Map<String, PacsNew> map = new HashMap<>();
|
|
|
+ for (Lemma lemma : pacsAll) {
|
|
|
+ PacsNew pacs = new PacsNew();
|
|
|
if (lemma.isHaveChildren()) {
|
|
|
- List<BodyPart> bodyPartList = new ArrayList<>();
|
|
|
+ List<Pacs> descList = new ArrayList<>();
|
|
|
+ List<Pacs> disList = new ArrayList<>();
|
|
|
for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
|
- if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) {
|
|
|
- bodyPartList.add(addBodyPart(relationLemma));
|
|
|
+ if (relationLemma.getProperty().equals(EntityEnum.AUXILIARY_DESCRIPT.toString())) {
|
|
|
+ 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);
|
|
|
+ // }
|
|
|
+ descList.add(desc);
|
|
|
+ } else if (relationLemma.getProperty().equals(EntityEnum.DIEASE.toString())) {
|
|
|
+ // 辅检诊断信息
|
|
|
+ Pacs dis = new Pacs();
|
|
|
+ dis.setName(relationLemma.getText());
|
|
|
+ dis.setStandName(relationLemma.getText());
|
|
|
+ disList.add(dis);
|
|
|
}
|
|
|
}
|
|
|
- pacs.setBodyPartList(bodyPartList);
|
|
|
+ pacs.setPacsResults(descList);
|
|
|
+ pacs.setDisease(disList);
|
|
|
}
|
|
|
- pacses.add(pacs);
|
|
|
+ map.put(lemma.getText(), pacs);
|
|
|
}
|
|
|
- pacsNew.setPacsResults(pacses);
|
|
|
-
|
|
|
- // 辅检诊断信息
|
|
|
- List<Pacs> pacsDisList = new ArrayList<>();
|
|
|
- List<Lemma> disLemmas = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
|
|
|
- for (Lemma lemma : disLemmas) {
|
|
|
- Pacs pacs = new Pacs();
|
|
|
- pacs.setName(lemma.getText());
|
|
|
- pacs.setStandName(lemma.getText());
|
|
|
- pacsDisList.add(pacs);
|
|
|
+ List<PacsNew> pacsNewList = pacsLabel.getPacsNewList();
|
|
|
+ for (PacsNew p : pacsNewList) {
|
|
|
+ if (map.get(p.getName()) != null) {
|
|
|
+ p.setPacsResults(map.get(p.getName()).getPacsResults());
|
|
|
+ p.setDisease(map.get(p.getName()).getDisease());
|
|
|
+ }
|
|
|
}
|
|
|
- pacsNew.setDisease(pacsDisList);
|
|
|
}
|
|
|
|
|
|
/**
|