chengyao пре 4 година
родитељ
комит
94a53e7b7e

+ 63 - 90
structure-center/src/main/java/com/lantone/structure/ai/process/EntityProcessEZaAll.java

@@ -102,28 +102,15 @@ public class EntityProcessEZaAll extends EntityProcess {
 
             //肯定
             List<Lemma>  diaList = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
+            if(ListUtil.isEmpty(diaList)){
+                diaList = createEntityTree(aiOut, EntityEnum.INJURY.toString());
+            }
             for (Lemma lemma : diaList) {
                     if(!diagSet.contains(lemma.getText())){
                         diagRetSet.add(lemma.getText());
                     }
             }
-            if(null != diagRetSet){
-                for (String str : diagRetSet) {
-                    Diag diagSec = new Diag();
-                    diagSec.setName(str);
-                    diags.add(diagSec);
-                }
-            }
-
-            List<Lemma>  diaListss = createEntityTree(aiOut, EntityEnum.INJURY.toString());
-            for (Lemma lemma : diaListss) {
-                for (String str : diagSet) {
-                    if(!lemma.getText().contains(str)){
-                        diagRetSet.add(lemma.getText());
-                    }
-                }
-            }
-            if(null != diagRetSet){
+            if(null != diagRetSet && diagRetSet.size()>0){
                 for (String str : diagRetSet) {
                     Diag diagSec = new Diag();
                     diagSec.setName(str);
@@ -132,7 +119,6 @@ public class EntityProcessEZaAll extends EntityProcess {
             }
 
 
-
             //过敏史-药物过敏原表现为使用后皮疹
             //否定 NEGATIVE  过敏 ALLERGY 食物过敏原 FOOD_ALLERGY 药物过敏原 DRUG_ALLERGY
             List<Lemma> allergieList = createEntityTree(aiOut, EntityEnum.NEGATIVE.toString());
@@ -144,26 +130,29 @@ public class EntityProcessEZaAll extends EntityProcess {
                         Allergy allergySec= new Allergy();
                         //过敏
                         if (relationLemma.getProperty().equals(EntityEnum.ALLERGY.toString())) {
-                            text = text +relationLemma.getText();
-                                allergySec.setName(text);
-                                allergies.add(allergySec);
+                            String flagText = relationLemma.getText();
+                            String firText = text +relationLemma.getText();
+                                if(ListUtil.isEmpty(relationLemma.getRelationLemmas())){
+                                    allergySec.setName(firText);
+                                    allergies.add(allergySec);
+                                }
                             for (Lemma relationLemmaRe : relationLemma.getRelationLemmas()) {
-                                allergies.remove(0);
                                 Allergy allergyThr= new Allergy();
                                 //食物过敏原 - 药物过敏原-情况不详
                                 if (relationLemmaRe.getProperty().equals(EntityEnum.FOOD_ALLERGY.toString()) ||
                                     relationLemmaRe.getProperty().equals(EntityEnum.DRUG_ALLERGY.toString())||
                                     relationLemmaRe.getProperty().equals(EntityEnum.UNKNOWN.toString())) {
-                                    text = text+relationLemmaRe.getText();
-                                        allergyThr.setName(text);
+                                    String secText = text+relationLemmaRe.getText()+flagText;
+                                    if(ListUtil.isEmpty(relationLemmaRe.getRelationLemmas())){
+                                        allergyThr.setName(secText);
                                         allergies.add(allergyThr);
+                                    }
                                     for (Lemma relationLemmaRec : relationLemmaRe.getRelationLemmas()) {
-                                        allergies.remove(0);
                                         Allergy allergyFor = new Allergy();
                                         //过敏表现
                                         if (relationLemmaRec.getProperty().equals(EntityEnum.ALLERGY_SYMPTOM.toString())) {
-                                            text = text+relationLemmaRec.getText();
-                                            allergyFor.setName(text);
+                                            String thrText = secText+relationLemmaRec.getText();
+                                            allergyFor.setName(thrText);
                                             allergies.add(allergyFor);
                                         }
                                     }
@@ -176,43 +165,43 @@ public class EntityProcessEZaAll extends EntityProcess {
                     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( ListUtil.isEmpty( relationLemmaRe.getRelationLemmas())){
-                                    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);
-                                    }
-                                }
+            //确定
+            List<Lemma> allergieLists = createEntityTree(aiOut, EntityEnum.ALLERGY.toString());
+            for (Lemma lemma : allergieLists) {
+                Allergy allergyFir = new Allergy();
+                String text = lemma.getText();
+                if (lemma.isHaveChildren()) {
+                    for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                        Allergy allergySec= new Allergy();
+                //食物过敏原 - 药物过敏原-情况不详
+                if (relationLemma.getProperty().equals(EntityEnum.FOOD_ALLERGY.toString()) ||
+                        relationLemma.getProperty().equals(EntityEnum.DRUG_ALLERGY.toString())||
+                        relationLemma.getProperty().equals(EntityEnum.UNKNOWN.toString())) {
+                    String secText = relationLemma.getText()+text;
+                    if(ListUtil.isEmpty(relationLemma.getRelationLemmas())){
+                        allergySec.setName(secText);
+                        allergies.add(allergySec);
+                    }
+                        for (Lemma relationLemmaRec : relationLemma.getRelationLemmas()) {
+                            Allergy allergyFor = new Allergy();
+                            //过敏表现
+                            if (relationLemmaRec.getProperty().equals(EntityEnum.ALLERGY_SYMPTOM.toString())) {
+                                String thrText = secText+relationLemmaRec.getText();
+                                allergyFor.setName(thrText);
+                                allergies.add(allergyFor);
                             }
                         }
-                    }else{
-                        allergyFir.setName(text);
-                        allergies.add(allergyFir);
-                    }
+
                 }
-            }*/
+            }
+        }else{
+            allergyFir.setName(text);
+            allergies.add(allergyFir);
+        }
+}
 
             //手术史
-            //否定 NEGATIVE  时间 TIME 手术名称 OPERATION 药物过敏原 DRUG_ALLERGY
+            //否定 NEGATIVE  时间 TIME 手术名称 OPERATION
             List<Lemma> operationList = createEntityTree(aiOut, EntityEnum.NEGATIVE.toString());
             for (Lemma lemma : operationList) {
                 Operation operationFir = new Operation();
@@ -267,43 +256,27 @@ public class EntityProcessEZaAll extends EntityProcess {
 
             //手术名称
             List<Lemma> operationsList = createEntityTree(aiOut, EntityEnum.OPERATION.toString());
-            if(ListUtil.isEmpty(operationList) && ListUtil.isNotEmpty(operationsList)) {
-            }
                 for (Lemma lemma : operationsList) {
                     Operation operationFir = new Operation();
                     String text = lemma.getText();
-                    if (!lemma.isHaveChildren()) {
-                        operationFir.setName(text);
-                        operations.add(operationFir);
-                    }
-            }
-
-            if(ListUtil.isEmpty(operationList)) {
-                operationList = createEntityTree(aiOut, EntityEnum.OPERATION_KEYWORD.toString());
-            }
-            for (Lemma lemma : operationList) {
-                Operation operationFir = new Operation();
-                String text = lemma.getText();
-                if (lemma.isHaveChildren()) {
                     if (lemma.isHaveChildren()) {
                         for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
                             Operation operationSec = new Operation();
-                            //手术名称
-                            if (relationLemmaRec.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
-                                text = relationLemmaRec.getText()+text;
-                                operationSec.setName(text);
+                            //手术史
+                            if (relationLemmaRec.getProperty().equals(EntityEnum.TIME.toString())) {
+                               String firText =text+relationLemmaRec.getText()+"病史";
+                                operationSec.setName(firText);
                                 operations.add(operationSec);
-                             }
-                        }
-                     }
-                }else{
-                    operationFir.setName(text);
-                    operations.add(operationFir);
+                            }
+                        }}else{
+                        operationFir.setName(text);
+                        operations.add(operationFir);
                     }
-                  }
-            //传染病史
+                }
+
+            //传染病史-正向处理
           //  否定 NEGATIVE 传染病史 INFECTIOUS_KEYWORD
-            List<Lemma> diagInfectiouList = createEntityTree(aiOut, EntityEnum.NEGATIVE.toString());
+            List<Lemma> diagInfectiouList = createEntityTree(aiOut, EntityEnum.INFECTIOUS_KEYWORD.toString());
             for (Lemma lemma : diagInfectiouList) {
                 DiagInfectious diagInfectiousFir = new DiagInfectious();
                 String text = lemma.getText();
@@ -311,9 +284,9 @@ public class EntityProcessEZaAll extends EntityProcess {
                     for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
                         DiagInfectious diagInfectiousSec = new DiagInfectious();
                         //传染病史
-                        if (relationLemmaRec.getProperty().equals(EntityEnum.INFECTIOUS_KEYWORD.toString())) {
-                            text = text+relationLemmaRec.getText();
-                            diagInfectiousSec.setName(text);
+                        if (relationLemmaRec.getProperty().equals(EntityEnum.NEGATIVE.toString())) {
+                            String FirText = relationLemmaRec.getText()+text;
+                            diagInfectiousSec.setName(FirText);
                             diagInfectiouses.add(diagInfectiousSec);
                         }
                     }

+ 17 - 1
structure-center/src/main/java/com/lantone/structure/facade/tran/BeHospitalizedTran.java

@@ -117,6 +117,22 @@ public class BeHospitalizedTran extends TargetTran {
                     retMap.remove("年龄");
                 }
             }
+
+            //病史陈述者
+            if(StringUtil.isNotEmpty(retMap.get("病史陈述者"))){
+                String casePerson = retMap.get("病史陈述者");
+                if(casePerson.contains("本人")){
+                    String name = retMap.get("姓名");
+                    if(StringUtil.isNotEmpty(name)){
+                        retMap.put("病史陈述者",name);
+                    }
+                    if(StringUtil.isEmpty(name) && StringUtil.isNotEmpty(retMap.get("姓    名"))){
+                        name = retMap.get("姓    名");
+                        retMap.put("病史陈述者",name);
+                    }
+                }
+            }
+
             //出生地
             parseBirthAddress(retMap);
 
@@ -341,7 +357,7 @@ public class BeHospitalizedTran extends TargetTran {
                             fir = fir.substring(0,fir.lastIndexOf(date));
                         }
                     }
-                    if(StringUtil.isNotEmpty(fir.trim())&& fir.contains("/") && fir.contains("年")){
+                    if(StringUtil.isNotEmpty(fir.trim())&& fir.contains("/")){
                         fir= fir.substring(0,fir.lastIndexOf("/"));
                     }
                     if(StringUtil.isNotEmpty(fir.trim()) && fir.contains("医师签名")){