|
@@ -7,6 +7,8 @@ import com.lantone.qc.kernel.structure.ai.model.Lemma;
|
|
|
import com.lantone.qc.kernel.util.DiagEnhancer;
|
|
|
import com.lantone.qc.pub.model.entity.*;
|
|
|
import com.lantone.qc.pub.model.label.FamilyLabel;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -15,6 +17,7 @@ import java.util.List;
|
|
|
* 家族史标签处理
|
|
|
*/
|
|
|
public class EntityProcessFamily extends EntityProcess {
|
|
|
+ private Logger logger = LoggerFactory.getLogger(EntityProcessFamily.class);
|
|
|
|
|
|
public FamilyLabel extractEntity(JSONObject aiOut) {
|
|
|
FamilyLabel familyLabel = new FamilyLabel();
|
|
@@ -26,33 +29,42 @@ public class EntityProcessFamily extends EntityProcess {
|
|
|
public List<Family> loadFamilies(JSONObject aiOut) {
|
|
|
//家属情况
|
|
|
List<Family> families = new ArrayList<>();
|
|
|
- //读取家属所有本体及关联信息
|
|
|
- List<Lemma> familyLemmas = createEntityTree(aiOut, EntityEnum.RELATIVES.toString());
|
|
|
- for (Lemma lemma : familyLemmas) {
|
|
|
- Family family = new Family();
|
|
|
- family.setName(lemma.getText());
|
|
|
- if (lemma.isHaveChildren()) {
|
|
|
- for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
|
- if (relationLemma.getProperty().equals(EntityEnum.DEAD.toString())) {
|
|
|
- family.setDead(addDeadLemma(relationLemma));
|
|
|
- } else if (relationLemma.getProperty().equals(EntityEnum.INFECTIOUS_KEYWORD.toString())) {
|
|
|
- family.setDiagInfectious(addInfectious(relationLemma));
|
|
|
- } else if (relationLemma.getProperty().equals(EntityEnum.GENETIC_DISEASE_KEYWORD.toString())) {
|
|
|
- family.setGeneticDiseaseKeyword(addGeneticDisease(relationLemma));
|
|
|
- } else if (relationLemma.getProperty().equals(EntityEnum.HEALTH.toString())) {
|
|
|
- family.setHealthCondition(addHealthCondition(relationLemma));
|
|
|
- } else if (relationLemma.getProperty().equals(EntityEnum.DIEASE.toString())) {
|
|
|
- family.addDiag(addDiags(relationLemma));
|
|
|
+ try {
|
|
|
+ //读取家属所有本体及关联信息
|
|
|
+ List<Lemma> familyLemmas = createEntityTree(aiOut, EntityEnum.RELATIVES.toString());
|
|
|
+ for (Lemma lemma : familyLemmas) {
|
|
|
+ Family family = new Family();
|
|
|
+ family.setName(lemma.getText());
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
|
+ if (relationLemma.getProperty().equals(EntityEnum.DEAD.toString())) {
|
|
|
+ if (family.getDead() == null) {
|
|
|
+ family.setDead(addDeadLemma(relationLemma));
|
|
|
+ }
|
|
|
+ } else if (relationLemma.getProperty().equals(EntityEnum.INFECTIOUS_KEYWORD.toString())) {
|
|
|
+ family.setDiagInfectious(addInfectious(relationLemma));
|
|
|
+ } else if (relationLemma.getProperty().equals(EntityEnum.GENETIC_DISEASE_KEYWORD.toString())) {
|
|
|
+ family.setGeneticDiseaseKeyword(addGeneticDisease(relationLemma));
|
|
|
+ } else if (relationLemma.getProperty().equals(EntityEnum.HEALTH.toString())) {
|
|
|
+ family.setHealthCondition(addHealthCondition(relationLemma));
|
|
|
+ } else if (relationLemma.getProperty().equals(EntityEnum.DIEASE.toString())) {
|
|
|
+ family.addDiag(addDiags(relationLemma));
|
|
|
+ } else if (relationLemma.getProperty().equals(EntityEnum.TUMOUR.toString())) {
|
|
|
+ family.setTumour(findT(lemma, new Tumour(), EntityEnum.TUMOUR.toString()));//肿瘤病史
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ families.add(family);
|
|
|
}
|
|
|
- families.add(family);
|
|
|
- }
|
|
|
- List<Lemma> similarDiseaseLemmas = createEntityTree(aiOut, EntityEnum.SIMILAR_DISEASE_KEYWORD.toString());
|
|
|
- for (Lemma relationLemma : similarDiseaseLemmas) {
|
|
|
- Family family = new Family();
|
|
|
- family.setSimilarDiag(addSimilarDiag(relationLemma));
|
|
|
- families.add(family);
|
|
|
+ List<Lemma> similarDiseaseLemmas = createEntityTree(aiOut, EntityEnum.SIMILAR_DISEASE_KEYWORD.toString());
|
|
|
+ for (Lemma relationLemma : similarDiseaseLemmas) {
|
|
|
+ Family family = new Family();
|
|
|
+ family.setSimilarDiag(addSimilarDiag(relationLemma));
|
|
|
+ families.add(family);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ logger.error(e.getMessage(), e);
|
|
|
}
|
|
|
return families;
|
|
|
}
|
|
@@ -67,7 +79,6 @@ public class EntityProcessFamily extends EntityProcess {
|
|
|
Dead dead = new Dead();
|
|
|
dead.setName(deadLemma.getText());
|
|
|
if (deadLemma.isHaveChildren()) {
|
|
|
- dead.setDesc(deadLemma.getRelationLemmas().get(0).getText());
|
|
|
for (Lemma lemma : deadLemma.getRelationLemmas()) {
|
|
|
if (lemma.getProperty().equals(EntityEnum.DEAD_REASON.toString())) {
|
|
|
DeadReason deadReason = new DeadReason();
|