|
@@ -3,9 +3,14 @@ package com.lantone.qc.kernel.structure.ai.process;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.lantone.qc.kernel.structure.ai.model.CrfOut;
|
|
import com.lantone.qc.kernel.structure.ai.model.CrfOut;
|
|
import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
|
|
import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
|
|
|
|
+import com.lantone.qc.kernel.structure.ai.model.Lemma;
|
|
import com.lantone.qc.pub.model.entity.BodyPart;
|
|
import com.lantone.qc.pub.model.entity.BodyPart;
|
|
|
|
+import com.lantone.qc.pub.model.entity.Clinical;
|
|
|
|
+import com.lantone.qc.pub.model.entity.OuterCourtyard;
|
|
import com.lantone.qc.pub.model.entity.Pacs;
|
|
import com.lantone.qc.pub.model.entity.Pacs;
|
|
import com.lantone.qc.pub.model.entity.PacsValue;
|
|
import com.lantone.qc.pub.model.entity.PacsValue;
|
|
|
|
+import com.lantone.qc.pub.model.label.MenstrualLabel;
|
|
|
|
+import com.lantone.qc.pub.model.label.PacsLabel;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -13,35 +18,72 @@ import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
public class EntityProcessPacs extends EntityProcess {
|
|
public class EntityProcessPacs extends EntityProcess {
|
|
- public List<Pacs> extractEntity(JSONObject outputs) {
|
|
|
|
|
|
+
|
|
|
|
+ public List<Pacs> extractEntity(JSONObject aiOut) {
|
|
|
|
+ //辅检情况
|
|
List<Pacs> pacses = new ArrayList<>();
|
|
List<Pacs> pacses = new ArrayList<>();
|
|
- Pacs pacs = null;
|
|
|
|
- List<Map<String, String>> pacsEntityList = processJson(outputs, EntityEnum.AUXILIARY_EXAMINATION.toString());
|
|
|
|
- for (Map<String, String> pacsEntityMap : pacsEntityList) {
|
|
|
|
- if (StringUtils.isEmpty(pacsEntityMap.get(EntityEnum.AUXILIARY_EXAMINATION.toString()))) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- pacs = new Pacs();
|
|
|
|
- for (String key : pacsEntityMap.keySet()) {
|
|
|
|
- String entity = StringUtils.isEmpty(pacsEntityMap.get(key)) ? "" : pacsEntityMap.get(key);
|
|
|
|
- switch (EntityEnum.parseOfValue(key)) {
|
|
|
|
- case AUXILIARY_EXAMINATION:
|
|
|
|
- pacs.setName(entity);
|
|
|
|
- break;
|
|
|
|
- case AUXILIARY_DESCRIPT:
|
|
|
|
- PacsValue pacsValue = new PacsValue();
|
|
|
|
- pacsValue.setName(entity);
|
|
|
|
- pacs.setPacsValues(pacsValue);
|
|
|
|
- break;
|
|
|
|
- case BODY:
|
|
|
|
- BodyPart bodyPart = new BodyPart();
|
|
|
|
- bodyPart.setName(entity);
|
|
|
|
- pacs.setBodyPart(bodyPart);
|
|
|
|
- break;
|
|
|
|
|
|
+ List<Lemma> pacsLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
|
|
|
|
+ for (Lemma lemma : pacsLemmas) {
|
|
|
|
+ Pacs pacs = new Pacs();
|
|
|
|
+ pacs.setName(lemma.getText());
|
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
|
+ 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));
|
|
|
|
+ } else if (relationLemma.getProperty().equals(EntityEnum.OUTERCOURTYARD.toString())) {
|
|
|
|
+ pacs.setOuterCourtyard(addOuterCourtyard(relationLemma));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
pacses.add(pacs);
|
|
pacses.add(pacs);
|
|
}
|
|
}
|
|
return pacses;
|
|
return pacses;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加辅助检查描述
|
|
|
|
+ *
|
|
|
|
+ * @param relationLemma
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private PacsValue addPacsValue(Lemma relationLemma) {
|
|
|
|
+ PacsValue pacsValue = new PacsValue();
|
|
|
|
+ pacsValue.setName(relationLemma.getText());
|
|
|
|
+ return pacsValue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加身体部位
|
|
|
|
+ *
|
|
|
|
+ * @param relationLemma
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private BodyPart addBodyPart(Lemma relationLemma) {
|
|
|
|
+ BodyPart bodyPart = new BodyPart();
|
|
|
|
+ bodyPart.setName(relationLemma.getText());
|
|
|
|
+ return bodyPart;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加外院
|
|
|
|
+ *
|
|
|
|
+ * @param relationLemma
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private OuterCourtyard addOuterCourtyard(Lemma relationLemma) {
|
|
|
|
+ OuterCourtyard outerCourtyard = new OuterCourtyard();
|
|
|
|
+ outerCourtyard.setName(relationLemma.getText());
|
|
|
|
+ if (relationLemma.isHaveChildren()) {
|
|
|
|
+ outerCourtyard.setPd(findTime(relationLemma));
|
|
|
|
+ for (Lemma lemma : relationLemma.getRelationLemmas()) {
|
|
|
|
+ if (lemma.getProperty().equals(EntityEnum.AUXILIARY_DESCRIPT.toString())) {
|
|
|
|
+ outerCourtyard.setPacsValue(addPacsValue(lemma));
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return outerCourtyard;
|
|
|
|
+ }
|
|
}
|
|
}
|