Jelajahi Sumber

入院记录crf调整

chengyao 4 tahun lalu
induk
melakukan
89710c659f

+ 24 - 10
structure-center/src/main/java/com/lantone/structure/ai/process/EntityProcessEZaAll.java

@@ -94,9 +94,6 @@ public class EntityProcessEZaAll extends EntityProcess {
                             diags.add(diagSec);
                         }
                     }
-                }else{
-                    diagFir.setName(text);
-                    diags.add(diagFir);
                 }
             }
 
@@ -121,6 +118,8 @@ public class EntityProcessEZaAll extends EntityProcess {
 
             //过敏史-药物过敏原表现为使用后皮疹
             //否定 NEGATIVE  过敏 ALLERGY 食物过敏原 FOOD_ALLERGY 药物过敏原 DRUG_ALLERGY
+            Set<String> allergieSet = new HashSet<>();
+            Set<String> allergieRetSet = new HashSet<>();
             List<Lemma> allergieList = createEntityTree(aiOut, EntityEnum.NEGATIVE.toString());
             for (Lemma lemma : allergieList) {
                 Allergy allergyFir = new Allergy();
@@ -143,6 +142,7 @@ public class EntityProcessEZaAll extends EntityProcess {
                                     relationLemmaRe.getProperty().equals(EntityEnum.DRUG_ALLERGY.toString())||
                                     relationLemmaRe.getProperty().equals(EntityEnum.UNKNOWN.toString())) {
                                     String secText = text+relationLemmaRe.getText()+flagText;
+                                    allergieSet.add(relationLemmaRe.getText()+flagText);
                                     if(ListUtil.isEmpty(relationLemmaRe.getRelationLemmas())){
                                         allergyThr.setName(secText);
                                         allergies.add(allergyThr);
@@ -172,23 +172,24 @@ public class EntityProcessEZaAll extends EntityProcess {
                 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);
+                    if(null == relationLemma.getRelationLemmas() || relationLemma.getRelationLemmas().size()==0){
+                        if(!allergieSet.contains(secText)){
+                            allergieRetSet.add(secText);
+                        }
                     }
                         for (Lemma relationLemmaRec : relationLemma.getRelationLemmas()) {
-                            Allergy allergyFor = new Allergy();
+                         //   Allergy allergyFor = new Allergy();
                             //过敏表现
                             if (relationLemmaRec.getProperty().equals(EntityEnum.ALLERGY_SYMPTOM.toString())) {
                                 String thrText = secText+relationLemmaRec.getText();
-                                allergyFor.setName(thrText);
-                                allergies.add(allergyFor);
+                                if(!allergieSet.contains(thrText)){
+                                    allergieRetSet.add(thrText);
+                                }
                             }
                         }
 
@@ -198,6 +199,19 @@ public class EntityProcessEZaAll extends EntityProcess {
             allergyFir.setName(text);
             allergies.add(allergyFir);
         }
+
+                if(null != allergieRetSet && allergieRetSet.size()>0){
+                    for (String allergySecs : allergieRetSet) {
+                        Allergy allergySec = new Allergy();
+                        allergySec.setName(allergySecs);
+                        String flagName = allergies.get(allergies.size() - 1).getName();
+                        if(flagName.contains(allergySecs)){
+                            continue;
+                        }else {
+                            allergies.add(allergySec) ;
+                        }
+                    }
+                }
 }
 
             //手术史