|
@@ -36,113 +36,261 @@ public class EntityProcessEZaAll extends EntityProcess {
|
|
|
//输血史-
|
|
|
List<Lemma> bloods = createEntityTree(aiOut, EntityEnum.BLOOD_TRANSFUSION.toString());
|
|
|
for (Lemma lemma : bloods) {
|
|
|
- BloodTransfusion bloodTransfusion = new BloodTransfusion();
|
|
|
+ BloodTransfusion bloodTransfusionFir = new BloodTransfusion();
|
|
|
String text = lemma.getText();
|
|
|
- if(ListUtil.isNotEmpty(lemma.getRelationLemmas())){
|
|
|
- List<Lemma> relationLemmas = lemma.getRelationLemmas();
|
|
|
- if(relationLemmas.size()==1){
|
|
|
- String property = relationLemmas.get(0).getProperty();
|
|
|
- text= property+text;
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
|
|
|
+ BloodTransfusion bloodTransfusionSec = new BloodTransfusion();
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
|
|
|
+ text = relationLemmaRec.getText()+text;
|
|
|
+ bloodTransfusionSec.setName(text);
|
|
|
+ bloodTransfusions.add(bloodTransfusionSec);
|
|
|
+ }
|
|
|
}
|
|
|
+ }else{
|
|
|
+ bloodTransfusionFir.setName(text);
|
|
|
+ bloodTransfusions.add(bloodTransfusionFir);
|
|
|
}
|
|
|
- bloodTransfusion.setName(text);
|
|
|
- bloodTransfusions.add(bloodTransfusion);
|
|
|
}
|
|
|
//预防接种史-
|
|
|
List<Lemma> vaccinateList = createEntityTree(aiOut, EntityEnum.VACCINATION.toString());
|
|
|
for (Lemma lemma : vaccinateList) {
|
|
|
- Vaccinate vaccinate = new Vaccinate();
|
|
|
+ Vaccinate vaccinateFir = new Vaccinate();
|
|
|
String text = lemma.getText();
|
|
|
- if(ListUtil.isNotEmpty(lemma.getRelationLemmas())){
|
|
|
- List<Lemma> relationLemmas = lemma.getRelationLemmas();
|
|
|
- if(relationLemmas.size()==1){
|
|
|
- String property = relationLemmas.get(0).getProperty();
|
|
|
- text= property+text;
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
|
|
|
+ Vaccinate vaccinateSec = new Vaccinate();
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
|
|
|
+ text = relationLemmaRec.getText()+text;
|
|
|
+ vaccinateSec.setName(text);
|
|
|
+ vaccinates.add(vaccinateSec);
|
|
|
+ }
|
|
|
}
|
|
|
+ }else{
|
|
|
+ vaccinateFir.setName(text);
|
|
|
+ vaccinates.add(vaccinateFir);
|
|
|
}
|
|
|
- vaccinate.setName(text);
|
|
|
- vaccinates.add(vaccinate);
|
|
|
}
|
|
|
|
|
|
|
|
|
//疾病史
|
|
|
- List<Lemma> diagList = createEntityTree(aiOut, EntityEnum.DISEASE_KEYWORD.toString());
|
|
|
+ List<Lemma> diagList = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
|
|
|
for (Lemma lemma : diagList) {
|
|
|
- Diag diag = new Diag();
|
|
|
+ Diag diagFir = new Diag();
|
|
|
String text = lemma.getText();
|
|
|
- if(ListUtil.isNotEmpty(lemma.getRelationLemmas())){
|
|
|
- List<Lemma> relationLemmas = lemma.getRelationLemmas();
|
|
|
- if(relationLemmas.size()==1){
|
|
|
- String property = relationLemmas.get(0).getProperty();
|
|
|
- text= property+text;
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
|
|
|
+ Diag diagSec = new Diag();
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
|
|
|
+ text = relationLemmaRec.getText()+text;
|
|
|
+ diagSec.setName(text);
|
|
|
+ diags.add(diagSec);
|
|
|
+ }
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.TIME.toString())) {
|
|
|
+ text = relationLemmaRec.getText()+text;
|
|
|
+ diagSec.setName(text);
|
|
|
+ diags.add(diagSec);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+ }else{
|
|
|
+ diagFir.setName(text);
|
|
|
+ diags.add(diagFir);
|
|
|
}
|
|
|
- diag.setName(text);
|
|
|
- diags.add(diag);
|
|
|
}
|
|
|
+
|
|
|
//外伤史-
|
|
|
List<Lemma> woundList = createEntityTree(aiOut, EntityEnum.INJURY.toString());
|
|
|
for (Lemma lemma : woundList) {
|
|
|
- Diag diag = new Diag();
|
|
|
+ Diag diagFir = new Diag();
|
|
|
String text = lemma.getText();
|
|
|
- if(ListUtil.isNotEmpty(lemma.getRelationLemmas())){
|
|
|
- List<Lemma> relationLemmas = lemma.getRelationLemmas();
|
|
|
- if(relationLemmas.size()==1){
|
|
|
- String property = relationLemmas.get(0).getProperty();
|
|
|
- text= property+text;
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
|
|
|
+ Diag diagSec = new Diag();
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
|
|
|
+ text = relationLemmaRec.getText()+text;
|
|
|
+ diagSec.setName(text);
|
|
|
+ diags.add(diagSec);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+ }else{
|
|
|
+ diagFir.setName(text);
|
|
|
+ diags.add(diagFir);
|
|
|
}
|
|
|
- diag.setName(text);
|
|
|
- diags.add(diag);
|
|
|
}
|
|
|
|
|
|
//过敏史-药物过敏原表现为使用后皮疹
|
|
|
+ //过敏表现
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
List<Lemma> allergieList = createEntityTree(aiOut, EntityEnum.ALLERGY_SYMPTOM.toString());
|
|
|
for (Lemma lemma : allergieList) {
|
|
|
- Allergy allergy = new Allergy();
|
|
|
+ Allergy allergyFir = new Allergy();
|
|
|
String text = lemma.getText();
|
|
|
- if(ListUtil.isNotEmpty(lemma.getRelationLemmas())){
|
|
|
- List<Lemma> relationLemmas = lemma.getRelationLemmas();
|
|
|
- if(relationLemmas.size()==1){
|
|
|
- String property = relationLemmas.get(0).getProperty();
|
|
|
- System.out.println("property = " + property);
|
|
|
- text= property+text;
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemma : lemma.getRelationLemmas()) {
|
|
|
+ Allergy allergySec= new Allergy();
|
|
|
+ //药物过敏原-食物过敏原
|
|
|
+ if (relationLemma.getProperty().equals(EntityEnum.DRUG_ALLERGY.toString())|| relationLemma.getProperty().equals(EntityEnum.FOOD_ALLERGY.toString()) ) {
|
|
|
+ String secText = relationLemma.getText();
|
|
|
+ if( relationLemma.getRelationLemmas() == null){
|
|
|
+ allergySec.setName(text);
|
|
|
+ allergies.add(allergySec);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ for (Lemma relationLemmaRe : relationLemma.getRelationLemmas()) {
|
|
|
+ Allergy allergyThr= new Allergy();
|
|
|
+ //过敏
|
|
|
+ if (relationLemmaRe.getProperty().equals(EntityEnum.ALLERGY.toString())) {
|
|
|
+ text = secText+relationLemmaRe.getText()+text;
|
|
|
+ for (Lemma relationLemmaRec : relationLemmaRe.getRelationLemmas()) {
|
|
|
+ Allergy allergy = new Allergy();
|
|
|
+ //否定
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
|
|
|
+ text = relationLemmaRec.getText()+text;
|
|
|
+ allergyThr.setName(text);
|
|
|
+ allergies.add(allergyThr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ allergyFir.setName(text);
|
|
|
+ allergies.add(allergyFir);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ListUtil.isEmpty(allergieList)){
|
|
|
+ //情况不详
|
|
|
+ allergieList = createEntityTree(aiOut, EntityEnum.UNKNOWN.toString());
|
|
|
+ for (Lemma lemma : allergieList) {
|
|
|
+ Allergy allergyFir = new Allergy();
|
|
|
+ String text = lemma.getText();
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRe : lemma.getRelationLemmas()) {
|
|
|
+ Allergy allergySec = new Allergy();
|
|
|
+ //过敏
|
|
|
+ if (relationLemmaRe.getProperty().equals(EntityEnum.ALLERGY.toString())) {
|
|
|
+ text = relationLemmaRe.getText()+text;
|
|
|
+ if( relationLemmaRe.getRelationLemmas() == null){
|
|
|
+ allergySec.setName(text);
|
|
|
+ allergies.add(allergySec);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ for (Lemma relationLemmaRec : relationLemmaRe.getRelationLemmas()) {
|
|
|
+ Allergy allergyThr = new Allergy();
|
|
|
+ //否定
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
|
|
|
+ text = relationLemmaRec.getText()+text;
|
|
|
+ allergyThr.setName(text);
|
|
|
+ allergies.add(allergyThr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ allergyFir.setName(text);
|
|
|
+ allergies.add(allergyFir);
|
|
|
}
|
|
|
}
|
|
|
- allergy.setName(text);
|
|
|
- allergies.add(allergy);
|
|
|
}
|
|
|
|
|
|
//手术史
|
|
|
- List<Lemma> operationList = createEntityTree(aiOut, EntityEnum.OPERATION.toString());
|
|
|
+ //时间
|
|
|
+ List<Lemma> operationList = createEntityTree(aiOut, EntityEnum.TIME.toString());
|
|
|
+ if(ListUtil.isEmpty(operationList)){
|
|
|
+ operationList = createEntityTree(aiOut, EntityEnum.UNKNOWN.toString());
|
|
|
+ }
|
|
|
for (Lemma lemma : operationList) {
|
|
|
- Operation operation = new Operation();
|
|
|
+ Operation operationFir = new Operation();
|
|
|
String text = lemma.getText();
|
|
|
- if(ListUtil.isNotEmpty(lemma.getRelationLemmas())){
|
|
|
- List<Lemma> relationLemmas = lemma.getRelationLemmas();
|
|
|
- if(relationLemmas.size()==1){
|
|
|
- String property = relationLemmas.get(0).getProperty();
|
|
|
- text= property+text;
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
|
|
|
+ Operation operationSec = new Operation();
|
|
|
+ //手术史
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.OPERATION_KEYWORD.toString())) {
|
|
|
+ text = text+relationLemmaRec.getText();
|
|
|
+ if( relationLemmaRec.getRelationLemmas() == null){
|
|
|
+ operationSec.setName(text);
|
|
|
+ operations.add(operationSec);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ for (Lemma relationLemmaThr : relationLemmaRec.getRelationLemmas()) {
|
|
|
+ Operation operationThr = new Operation();
|
|
|
+ //否定
|
|
|
+ if (relationLemmaThr.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
|
|
|
+ text = relationLemmaThr.getText()+text;
|
|
|
+ operationThr.setName(text);
|
|
|
+ operations.add(operationThr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ }else{
|
|
|
+ operationFir.setName(text);
|
|
|
+ operations.add(operationFir);
|
|
|
}
|
|
|
- operation.setName(text);
|
|
|
- operations.add(operation);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ListUtil.isEmpty(operationList)){
|
|
|
+ //手术结果
|
|
|
+ operationList = createEntityTree(aiOut, EntityEnum.OPERATION_RESULT.toString());
|
|
|
+ //情况不详
|
|
|
+ if(ListUtil.isEmpty(operationList)){
|
|
|
+ operationList = createEntityTree(aiOut, EntityEnum.UNKNOWN.toString());
|
|
|
+ }
|
|
|
+ for (Lemma lemma : operationList) {
|
|
|
+ Operation operationFir = new Operation();
|
|
|
+ String text = lemma.getText();
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
|
|
|
+ Operation operationSec = new Operation();
|
|
|
+ //手术名称
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.OPERATION.toString())) {
|
|
|
+ text = relationLemmaRec.getText()+text;
|
|
|
+ if( relationLemmaRec.getRelationLemmas() == null){
|
|
|
+ operationSec.setName(text);
|
|
|
+ operations.add(operationSec);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ for (Lemma relationLemmaThr : relationLemmaRec.getRelationLemmas()) {
|
|
|
+ Operation operation = new Operation();
|
|
|
+ //时间
|
|
|
+ if (relationLemmaThr.getProperty().equals(EntityEnum.TIME.toString())) {
|
|
|
+ text = relationLemmaThr.getText()+text;
|
|
|
+ operation.setName(text);
|
|
|
+ operations.add(operation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ operationFir.setName(text);
|
|
|
+ operations.add(operationFir);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//传染病史
|
|
|
List<Lemma> diagInfectiouList = createEntityTree(aiOut, EntityEnum.INFECTIOUS_KEYWORD.toString());
|
|
|
for (Lemma lemma : diagInfectiouList) {
|
|
|
- DiagInfectious diagInfectious = new DiagInfectious();
|
|
|
+ DiagInfectious diagInfectiousFir = new DiagInfectious();
|
|
|
String text = lemma.getText();
|
|
|
- if(ListUtil.isNotEmpty(lemma.getRelationLemmas())){
|
|
|
- List<Lemma> relationLemmas = lemma.getRelationLemmas();
|
|
|
- if(relationLemmas.size()==1){
|
|
|
- String property = relationLemmas.get(0).getProperty();
|
|
|
- text= property+text;
|
|
|
+ if (lemma.isHaveChildren()) {
|
|
|
+ for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
|
|
|
+ DiagInfectious diagInfectiousSec = new DiagInfectious();
|
|
|
+ if (relationLemmaRec.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
|
|
|
+ text = relationLemmaRec.getText()+text;
|
|
|
+ diagInfectiousSec.setName(text);
|
|
|
+ diagInfectiouses.add(diagInfectiousSec);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+ } else{
|
|
|
+ diagInfectiousFir.setName(text);
|
|
|
+ diagInfectiouses.add(diagInfectiousFir);
|
|
|
}
|
|
|
- diagInfectious.setName(text);
|
|
|
- diagInfectiouses.add(diagInfectious);
|
|
|
}
|
|
|
pastLabel.setBloodTransfusions(bloodTransfusions);
|
|
|
pastLabel.setVaccinates(vaccinates);
|