|
@@ -5,80 +5,71 @@ import com.diagbot.biz.push.entity.Item;
|
|
import com.diagbot.model.ai.model.EntityEnum;
|
|
import com.diagbot.model.ai.model.EntityEnum;
|
|
import com.diagbot.model.ai.model.Lemma;
|
|
import com.diagbot.model.ai.model.Lemma;
|
|
import com.diagbot.model.entity.BodyPart;
|
|
import com.diagbot.model.entity.BodyPart;
|
|
|
|
+import com.diagbot.model.entity.Modification;
|
|
import com.diagbot.model.entity.Pacs;
|
|
import com.diagbot.model.entity.Pacs;
|
|
import com.diagbot.model.label.PacsLabel;
|
|
import com.diagbot.model.label.PacsLabel;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.diagbot.util.ListUtil;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
-import java.util.LinkedHashMap;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.Map;
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
public class EntityProcessPacs extends EntityProcess {
|
|
public class EntityProcessPacs extends EntityProcess {
|
|
|
|
|
|
public void extractEntity(JSONObject aiOut, PacsLabel pacsLabel) {
|
|
public void extractEntity(JSONObject aiOut, PacsLabel pacsLabel) {
|
|
- // 获取描述和部位的关系
|
|
|
|
- Map<String, List<BodyPart>> bodyMap = new LinkedHashMap<>();
|
|
|
|
|
|
+ // 获取描述和部位、修饰的关系
|
|
|
|
+ List<Pacs> pacsResults = new ArrayList<>(); // 辅检提取的描述信息
|
|
List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_DESCRIPT.toString());
|
|
List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_DESCRIPT.toString());
|
|
for (Lemma lemma : pacsLemmas) {
|
|
for (Lemma lemma : pacsLemmas) {
|
|
|
|
+ Pacs pacs = new Pacs();
|
|
List<BodyPart> bodyPartList = new ArrayList<>();
|
|
List<BodyPart> bodyPartList = new ArrayList<>();
|
|
|
|
+ List<Modification> modificationList = new ArrayList<>();
|
|
if (lemma.isHaveChildren()) {
|
|
if (lemma.isHaveChildren()) {
|
|
for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
- if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) {
|
|
|
|
|
|
+ if (relationLemma.getProperty().equals(EntityEnum.BODY.toString())) { // 部位
|
|
BodyPart bodyPart = new BodyPart();
|
|
BodyPart bodyPart = new BodyPart();
|
|
bodyPart.setName(relationLemma.getText());
|
|
bodyPart.setName(relationLemma.getText());
|
|
bodyPart.setStandName(relationLemma.getText());
|
|
bodyPart.setStandName(relationLemma.getText());
|
|
bodyPartList.add(bodyPart);
|
|
bodyPartList.add(bodyPart);
|
|
|
|
+ } else if (EntityEnum.MODIFICATION.toString().equals(relationLemma.getProperty())) { // 修饰
|
|
|
|
+ Modification modification = new Modification();
|
|
|
|
+ modification.setName(relationLemma.getText());
|
|
|
|
+ modification.setStandName(relationLemma.getText());
|
|
|
|
+ modificationList.add(modification);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- bodyMap.put(lemma.getText(), bodyPartList);
|
|
|
|
}
|
|
}
|
|
|
|
+ pacs.setBodyPartList(bodyPartList);
|
|
|
|
+ pacs.setModification(modificationList);
|
|
|
|
+ pacs.setName(lemma.getText());
|
|
|
|
+ pacs.setStandName(lemma.getText());
|
|
|
|
+ pacsResults.add(pacs);
|
|
}
|
|
}
|
|
|
|
+ pacsLabel.setPacsResults(pacsResults);
|
|
|
|
|
|
- //辅助检查
|
|
|
|
|
|
+ // 辅检项目
|
|
List<Lemma> pacsAll = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
|
|
List<Lemma> pacsAll = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
|
|
- List<Pacs> disList = new ArrayList<>();
|
|
|
|
- for (Lemma lemma : pacsAll) {
|
|
|
|
- if (lemma.isHaveChildren()) {
|
|
|
|
- for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
|
|
- if (relationLemma.getProperty().equals(EntityEnum.DIEASE.toString())) {
|
|
|
|
- // 辅检诊断信息
|
|
|
|
- Pacs dis = new Pacs();
|
|
|
|
- dis.setName(relationLemma.getText());
|
|
|
|
- dis.setStandName(relationLemma.getText());
|
|
|
|
- disList.add(dis);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //所有项目
|
|
|
|
List<Item> collect = Lists.newArrayList();
|
|
List<Item> collect = Lists.newArrayList();
|
|
- if(ListUtil.isNotEmpty(pacsAll)){
|
|
|
|
- collect = pacsAll.stream().map(x -> {
|
|
|
|
|
|
+ if(ListUtil.isNotEmpty(pacsAll)) {
|
|
|
|
+ collect = pacsAll.stream().map(x -> {
|
|
Item item = new Item();
|
|
Item item = new Item();
|
|
item.setName(x.getText());
|
|
item.setName(x.getText());
|
|
item.setUniqueName(x.getText());
|
|
item.setUniqueName(x.getText());
|
|
return item;
|
|
return item;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
}
|
|
}
|
|
- //描述和部位的关系
|
|
|
|
- List<Pacs> pacsResults = Lists.newArrayList();
|
|
|
|
- if(bodyMap != null && bodyMap.size() > 0){
|
|
|
|
- bodyMap.forEach((x,y) -> {
|
|
|
|
- Pacs pacs = new Pacs();
|
|
|
|
- pacs.setName(x);
|
|
|
|
- pacs.setStandName(x);
|
|
|
|
- pacs.setBodyPartList(y);
|
|
|
|
- pacsResults.add(pacs);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- pacsLabel.setDisease(disList);
|
|
|
|
pacsLabel.setItem(collect);
|
|
pacsLabel.setItem(collect);
|
|
- pacsLabel.setPacsResults(pacsResults);
|
|
|
|
|
|
|
|
|
|
+ // 辅检诊断
|
|
|
|
+ List<Lemma> pacsDisease = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
|
|
|
|
+ List<Pacs> disList = new ArrayList<>();
|
|
|
|
+ for (Lemma lemma : pacsDisease) {
|
|
|
|
+ Pacs dis = new Pacs();
|
|
|
|
+ dis.setName(lemma.getText());
|
|
|
|
+ dis.setStandName(lemma.getText());
|
|
|
|
+ disList.add(dis);
|
|
|
|
+ }
|
|
|
|
+ pacsLabel.setDisease(disList);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|