浏览代码

上级医师crf调整

chengyao 4 年之前
父节点
当前提交
95e4899a32

+ 4 - 3
structure-center/src/main/java/com/lantone/structure/ai/ThreeLevelWardAI.java

@@ -49,9 +49,10 @@ public class ThreeLevelWardAI extends ModelAI {
         //  "============恩泽医嘱crf单独处理================="
         if (ListUtil.isNotEmpty(threeLevelWardDocs) && StringUtil.isNotEmpty(threeLevelWardDocs.get(0).getText())) {
             String text = threeLevelWardDocs.get(0).getText();
-            if (StringUtil.isNotEmpty(text)){
-            putContent(crfContent, medicalTextType.get(3), text, Content.wardRecord);
-
+            Map<String, String> maps = threeLevelWardDocs.get(0).getStructureMap();
+            if(StringUtil.isNotEmpty(maps.get("诊疗计划")) && StringUtil.isNotEmpty(maps.get("诊疗计划").trim())){
+                String plan = maps.get("诊疗计划");
+                putContent(crfContent, medicalTextType.get(3), plan, Content.wardRecord);
             JSONObject midData = loadAI(crfContent, crfServiceClient);//crf返回数据
             for (int i = 0; i < threeLevelWardDocs.size(); i++) {
                 if (midData.get(Content.wardRecord) == null) {

+ 110 - 24
structure-center/src/main/java/com/lantone/structure/ai/process/EntityDailyCourseRecord.java

@@ -20,15 +20,13 @@ public class EntityDailyCourseRecord extends EntityProcess {
     public DailyCourseRecordLabel extractEntity(JSONObject aiOut) {
         DailyCourseRecordLabel dailyCourseRecordLabel= new DailyCourseRecordLabel();
         try {
-
             //医嘱信息
             StringBuffer sb = new StringBuffer();
+            StringBuffer xb = new StringBuffer();
+            StringBuffer bb = new StringBuffer();
             String drugNames = "",laboratorys,auxoiliarys;
             //药品
             List<Lemma> drugName = createEntityTree(aiOut, EntityEnum.DRUG_NAME.toString());
-            if(ListUtil.isNotEmpty(drugName)){
-                sb.append("药品:");
-            }
             for (Lemma lemma : drugName) {
                 String text = lemma.getText();
                 if (lemma.isHaveChildren()) {
@@ -46,62 +44,153 @@ public class EntityDailyCourseRecord extends EntityProcess {
                     sb.append(text+"、");
                 }
             }
-            //实验室检查
+            Boolean sbxflag = false;
             String str = sb.toString();
-           if(str.endsWith("、")){
+            StringBuffer sbx = new StringBuffer();
+            StringBuffer sbxx = new StringBuffer();
+            if(str.contains("、")){
+                String[] split = str.split("、");
+                if(split.length>1){
+                    for (int i = 0; i < split.length; i++) {
+                        if(!(split[i].contains(EntityEnum.STOPNOW.toString()) || split[i].contains(EntityEnum.CONTINUE.toString()))){
+                            sbx.append(split[i]+"、");
+                        }else{
+                            sbxx.append(split[i]+"、");
+                        }
+                    }
+                }
+            }else{
+                sbxflag = true;
+            }
+            sb = new StringBuffer();
+            if(ListUtil.isNotEmpty(drugName)){
+                sb.append("药品:");
+            }
+            if(!sbxflag){
+                if(sbx.toString().endsWith("、")){
+                    sbx.deleteCharAt(sbx.toString().length()-1);
+                    sbx.append(";");
+                }
+                sb.append(sbx.toString());
+                sb.append(sbxx.toString());
+            }else{
+                sb.append(str);
+            }
+
+            str = sb.toString();
+            if(str.endsWith("、")){
                 sb.deleteCharAt(str.length()-1);
-           }
-            List<Lemma> laboratory = createEntityTree(aiOut, EntityEnum.LABORATORY.toString());
-            if(ListUtil.isNotEmpty(laboratory)){
-                sb.append("  实验室检查:");
             }
+            //实验室检查
+            List<Lemma> laboratory = createEntityTree(aiOut, EntityEnum.LABORATORY.toString());
             for (Lemma lemma : laboratory) {
                 String text = lemma.getText();
                 if (lemma.isHaveChildren()) {
                     for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
                         if (relationLemmaRec.getProperty().equals(EntityEnum.REPATE.toString())) {
                             laboratorys = relationLemmaRec.getText()+text;
-                            sb.append(laboratorys+"、");
+                            xb.append(laboratorys+"、");
                         }
                         if (relationLemmaRec.getProperty().equals(EntityEnum.OTHERREPATE.toString())) {
                             laboratorys = relationLemmaRec.getText()+text;
-                            sb.append(laboratorys+"、");
+                            xb.append(laboratorys+"、");
                         }
                     }
                 }else{
-                    sb.append(text+" ");
+                    xb.append(text+" ");
                 }
             }
-            //辅助检查
-             str = sb.toString();
+            String xtr = xb.toString();
+            StringBuffer xbx = new StringBuffer();
+            StringBuffer xbxx = new StringBuffer();
+            Boolean xbxflag = false;
+            if(xtr.contains("、")){
+                String[] split = xtr.split("、");
+                if(split.length>1){
+                    for (int i = 0; i < split.length; i++) {
+                        if(!(split[i].contains(EntityEnum.STOPNOW.toString()) || split[i].contains(EntityEnum.CONTINUE.toString()))){
+                            xbx.append(split[i]+"、");
+                        }else{
+                            xbxx.append(split[i]+"、");
+                        }
+                    }
+                }
+            }else{
+                xbxflag = true;
+            }
+            if(ListUtil.isNotEmpty(laboratory)){
+                sb.append("  实验室检查:");
+            }
+            if(!xbxflag){
+                if(xbx.toString().endsWith("、")){
+                    xbx.deleteCharAt(xbx.toString().length()-1);
+                    xbx.append(";");
+                }
+                sb.append(xbx.toString());
+                sb.append(xbxx.toString());
+            }else{
+                sb.append(xtr);
+            }
+
+            str = sb.toString();
             if(str.endsWith("、")){
                 sb.deleteCharAt(str.length()-1);
             }
+            //辅助检查
             List<Lemma> auxoiliary = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
-            if(ListUtil.isNotEmpty(auxoiliary)){
-                sb.append("  辅助检查:");
-            }
             for (Lemma lemma : auxoiliary) {
                 String text = lemma.getText();
                 if (lemma.isHaveChildren()) {
                     for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
                         if (relationLemmaRec.getProperty().equals(EntityEnum.REPATE.toString())) {
                             auxoiliarys = relationLemmaRec.getText()+text;
-                            sb.append(auxoiliarys+"、");
+                            bb.append(auxoiliarys+"、");
                         }
                         if (relationLemmaRec.getProperty().equals(EntityEnum.OTHERREPATE.toString())) {
                             auxoiliarys = relationLemmaRec.getText()+text;
-                            sb.append(auxoiliarys+"、");
+                            bb.append(auxoiliarys+"、");
                         }
                     }
                 }else{
-                    sb.append(text+" ");
+                    bb.append(text+" ");
                 }
             }
+            Boolean bbxflag = false;
+            String btr = bb.toString();
+            StringBuffer bbx = new StringBuffer();
+            StringBuffer bbxx = new StringBuffer();
+            if(btr.contains("、")){
+                String[] split = xtr.split("、");
+                if(split.length>1){
+                    for (int i = 0; i < split.length; i++) {
+                        if(!(split[i].contains(EntityEnum.STOPNOW.toString()) || split[i].contains(EntityEnum.CONTINUE.toString()))){
+                            bbx.append(split[i]+"、");
+                        }else{
+                            bbxx.append(split[i]+"、");
+                        }
+                    }
+                }
+            }else{
+                bbxflag = true;
+            }
+            if(ListUtil.isNotEmpty(auxoiliary)){
+                sb.append("  辅助检查:");
+            }
+            if(!bbxflag){
+                if(bbx.toString().endsWith("、")){
+                    bbx.deleteCharAt(bbx.toString().length()-1);
+                    bbx.append(";");
+                }
+                sb.append(bbx.toString());
+                sb.append(bbxx.toString());
+            }else{
+                sb.append(btr);
+            }
             str = sb.toString();
             if(str.endsWith("、")){
                 sb.deleteCharAt(str.length()-1);
             }
+
             //手术名称
             List<Lemma> operation = createEntityTree(aiOut, EntityEnum.OPERATION.toString());
             if(ListUtil.isNotEmpty(operation)){
@@ -120,9 +209,6 @@ public class EntityDailyCourseRecord extends EntityProcess {
            // List<Lemma> repate = createEntityTree(aiOut, EntityEnum.REPATE.toString());
             //其他复查
            // List<Lemma> otherRepate = createEntityTree(aiOut, EntityEnum.OTHERREPATE.toString());
-
-
-
         }catch (Exception e) {
             e.printStackTrace();
             logger.error(e.getMessage(), e);

+ 107 - 18
structure-center/src/main/java/com/lantone/structure/ai/process/EntityProcessThreeLevelWard.java

@@ -36,15 +36,13 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
     public ThreeLevelWardLabel extractEntityLate(JSONObject aiOut) {
         ThreeLevelWardLabel threeLevelWardLabel = new ThreeLevelWardLabel();
         try {
-
             //医嘱信息
             StringBuffer sb = new StringBuffer();
+            StringBuffer xb = new StringBuffer();
+            StringBuffer bb = new StringBuffer();
             String drugNames = "",laboratorys,auxoiliarys;
             //药品
             List<Lemma> drugName = createEntityTree(aiOut, EntityEnum.DRUG_NAME.toString());
-            if(ListUtil.isNotEmpty(drugName)){
-                sb.append("药品:");
-            }
             for (Lemma lemma : drugName) {
                 String text = lemma.getText();
                 if (lemma.isHaveChildren()) {
@@ -62,62 +60,153 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
                     sb.append(text+"、");
                 }
             }
-            //实验室检查
+            Boolean sbxflag = false;
             String str = sb.toString();
+            StringBuffer sbx = new StringBuffer();
+            StringBuffer sbxx = new StringBuffer();
+            if(str.contains("、")){
+                String[] split = str.split("、");
+                if(split.length>1){
+                    for (int i = 0; i < split.length; i++) {
+                        if(!(split[i].contains(EntityEnum.STOPNOW.toString()) || split[i].contains(EntityEnum.CONTINUE.toString()))){
+                            sbx.append(split[i]+"、");
+                        }else{
+                            sbxx.append(split[i]+"、");
+                        }
+                    }
+                }
+            }else{
+                sbxflag = true;
+            }
+            sb = new StringBuffer();
+            if(ListUtil.isNotEmpty(drugName)){
+                sb.append("药品:");
+            }
+            if(!sbxflag){
+                if(sbx.toString().endsWith("、")){
+                    sbx.deleteCharAt(sbx.toString().length()-1);
+                    sbx.append(";");
+                }
+                sb.append(sbx.toString());
+                sb.append(sbxx.toString());
+            }else{
+                sb.append(str);
+            }
+
+            str = sb.toString();
             if(str.endsWith("、")){
                 sb.deleteCharAt(str.length()-1);
             }
+            //实验室检查
             List<Lemma> laboratory = createEntityTree(aiOut, EntityEnum.LABORATORY.toString());
-            if(ListUtil.isNotEmpty(laboratory)){
-                sb.append("  实验室检查:");
-            }
             for (Lemma lemma : laboratory) {
                 String text = lemma.getText();
                 if (lemma.isHaveChildren()) {
                     for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
                         if (relationLemmaRec.getProperty().equals(EntityEnum.REPATE.toString())) {
                             laboratorys = relationLemmaRec.getText()+text;
-                            sb.append(laboratorys+"、");
+                            xb.append(laboratorys+"、");
                         }
                         if (relationLemmaRec.getProperty().equals(EntityEnum.OTHERREPATE.toString())) {
                             laboratorys = relationLemmaRec.getText()+text;
-                            sb.append(laboratorys+"、");
+                            xb.append(laboratorys+"、");
                         }
                     }
                 }else{
-                    sb.append(text+" ");
+                    xb.append(text+" ");
                 }
             }
-            //辅助检查
+            String xtr = xb.toString();
+            StringBuffer xbx = new StringBuffer();
+            StringBuffer xbxx = new StringBuffer();
+            Boolean xbxflag = false;
+            if(xtr.contains("、")){
+                String[] split = xtr.split("、");
+                if(split.length>1){
+                    for (int i = 0; i < split.length; i++) {
+                        if(!(split[i].contains(EntityEnum.STOPNOW.toString()) || split[i].contains(EntityEnum.CONTINUE.toString()))){
+                            xbx.append(split[i]+"、");
+                        }else{
+                            xbxx.append(split[i]+"、");
+                        }
+                    }
+                }
+            }else{
+                xbxflag = true;
+            }
+            if(ListUtil.isNotEmpty(laboratory)){
+                sb.append("  实验室检查:");
+            }
+            if(!xbxflag){
+                if(xbx.toString().endsWith("、")){
+                    xbx.deleteCharAt(xbx.toString().length()-1);
+                    xbx.append(";");
+                }
+                sb.append(xbx.toString());
+                sb.append(xbxx.toString());
+            }else{
+                sb.append(xtr);
+            }
+
             str = sb.toString();
             if(str.endsWith("、")){
                 sb.deleteCharAt(str.length()-1);
             }
+            //辅助检查
             List<Lemma> auxoiliary = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
-            if(ListUtil.isNotEmpty(auxoiliary)){
-                sb.append("  辅助检查:");
-            }
             for (Lemma lemma : auxoiliary) {
                 String text = lemma.getText();
                 if (lemma.isHaveChildren()) {
                     for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
                         if (relationLemmaRec.getProperty().equals(EntityEnum.REPATE.toString())) {
                             auxoiliarys = relationLemmaRec.getText()+text;
-                            sb.append(auxoiliarys+"、");
+                            bb.append(auxoiliarys+"、");
                         }
                         if (relationLemmaRec.getProperty().equals(EntityEnum.OTHERREPATE.toString())) {
                             auxoiliarys = relationLemmaRec.getText()+text;
-                            sb.append(auxoiliarys+"、");
+                            bb.append(auxoiliarys+"、");
                         }
                     }
                 }else{
-                    sb.append(text+" ");
+                    bb.append(text+" ");
+                }
+            }
+            Boolean bbxflag = false;
+            String btr = bb.toString();
+            StringBuffer bbx = new StringBuffer();
+            StringBuffer bbxx = new StringBuffer();
+            if(btr.contains("、")){
+                String[] split = xtr.split("、");
+                if(split.length>1){
+                    for (int i = 0; i < split.length; i++) {
+                        if(!(split[i].contains(EntityEnum.STOPNOW.toString()) || split[i].contains(EntityEnum.CONTINUE.toString()))){
+                            bbx.append(split[i]+"、");
+                        }else{
+                            bbxx.append(split[i]+"、");
+                        }
+                    }
                 }
+            }else{
+                bbxflag = true;
+            }
+            if(ListUtil.isNotEmpty(auxoiliary)){
+                sb.append("  辅助检查:");
+            }
+            if(!bbxflag){
+                if(bbx.toString().endsWith("、")){
+                    bbx.deleteCharAt(bbx.toString().length()-1);
+                    bbx.append(";");
+                }
+                sb.append(bbx.toString());
+                sb.append(bbxx.toString());
+            }else{
+                sb.append(btr);
             }
             str = sb.toString();
             if(str.endsWith("、")){
                 sb.deleteCharAt(str.length()-1);
             }
+
             //手术名称
             List<Lemma> operation = createEntityTree(aiOut, EntityEnum.OPERATION.toString());
             if(ListUtil.isNotEmpty(operation)){

+ 5 - 0
structure-center/src/main/java/com/lantone/structure/facade/tran/ThreeLevelWardTran.java

@@ -29,6 +29,8 @@ public class ThreeLevelWardTran extends TargetTran {
         Map<String, String> structureMap = cutWord(text);
         wardRecordContrast(inputInfo.getThreeLevelWardDocs(), structureMap);
         wardRecordDoc.setStructureMap(structureMap);
+        wardRecordDocList.add(wardRecordDoc);
+        inputInfo.setThreeLevelWardDocs(wardRecordDocList);
         aiProcess();
         lastSovle(inputInfo.getThreeLevelWardDocs(),structureMap);
         return structureMap;
@@ -92,6 +94,9 @@ public class ThreeLevelWardTran extends TargetTran {
                 if(plan.contains(name)){
                 plan = plan.substring(0,plan.lastIndexOf(name));
                 }
+                if(plan.endsWith("今予")){
+                    plan = plan.substring(0,plan.lastIndexOf("今予"));
+                }
             }
             if(plan.contains("诊断考虑:")){
                 plan = plan.substring(0,plan.lastIndexOf("诊断考虑:"));