Quellcode durchsuchen

上级医师查房记录

chengyao vor 4 Jahren
Ursprung
Commit
24f9dcc059

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

@@ -38,7 +38,7 @@ public class ThreeLevelWardAI extends ModelAI {
     /**
      *
      */
-    public static List<String> medicalTextType = Arrays.asList("CourseRecord_cx", "CourseRecordLast_cx", "CourseRecordSRR","Taizhou_ThreeLevelWard_Record");
+    public static List<String> medicalTextType = Arrays.asList("CourseRecord_cx", "CourseRecordLast_cx", "CourseRecordSRR","Taizhou_medical_order");
     public static String entityRelationObject = "entity_relation_object";
     public static String outputs = "outputs";
     public static String content = "content";

+ 88 - 10
structure-center/src/main/java/com/lantone/structure/ai/process/EntityProcessThreeLevelWard.java

@@ -35,20 +35,98 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
 
     public ThreeLevelWardLabel extractEntityLate(JSONObject aiOut) {
         ThreeLevelWardLabel threeLevelWardLabel = new ThreeLevelWardLabel();
-        //医嘱信息
-        StringBuffer sb = new StringBuffer();
-        int doctorAdvice = 0;
-        List<Lemma> doctorAdviceRecord = null;
         try {
-            doctorAdviceRecord = createEntityTree(aiOut, EntityEnum.DOCTORADVICE_RECORD.toString());
-            for (Lemma lemma : doctorAdviceRecord) {
-                doctorAdvice++;
-                if(doctorAdviceRecord.size()>1){
-                    sb.append(doctorAdvice+lemma.getText()+" ");
+
+            //医嘱信息
+            StringBuffer sb = 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()) {
+                    for (Lemma relationLemmaRec : lemma.getRelationLemmas()) {
+                        if (relationLemmaRec.getProperty().equals(EntityEnum.STOPNOW.toString())) {
+                            drugNames = relationLemmaRec.getText()+text;
+                            sb.append(drugNames+"、");
+                        }
+                        if (relationLemmaRec.getProperty().equals(EntityEnum.CONTINUE.toString())) {
+                            drugNames = relationLemmaRec.getText()+text;
+                            sb.append(drugNames+"、");
+                        }
+                    }
+                }else{
+                    sb.append(text+"、");
+                }
+            }
+            //实验室检查
+            String 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+"、");
+                        }
+                        if (relationLemmaRec.getProperty().equals(EntityEnum.OTHERREPATE.toString())) {
+                            laboratorys = relationLemmaRec.getText()+text;
+                            sb.append(laboratorys+"、");
+                        }
+                    }
                 }else{
-                    sb.append(lemma.getText());
+                    sb.append(text+" ");
                 }
             }
+            //辅助检查
+            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+"、");
+                        }
+                        if (relationLemmaRec.getProperty().equals(EntityEnum.OTHERREPATE.toString())) {
+                            auxoiliarys = relationLemmaRec.getText()+text;
+                            sb.append(auxoiliarys+"、");
+                        }
+                    }
+                }else{
+                    sb.append(text+" ");
+                }
+            }
+            str = sb.toString();
+            if(str.endsWith("、")){
+                sb.deleteCharAt(str.length()-1);
+            }
+            //手术名称
+            List<Lemma> operation = createEntityTree(aiOut, EntityEnum.OPERATION.toString());
+            if(ListUtil.isNotEmpty(operation)){
+                sb.append("  手术名称:");
+            }
+            for (Lemma lemma : operation) {
+                String text = lemma.getText();
+                sb.append(text+" ");
+            }
             threeLevelWardLabel.setDoctorAdviceRecord(sb.toString());
         } catch (Exception e) {
             e.printStackTrace();

+ 4 - 4
structure-center/src/main/java/com/lantone/structure/facade/tran/DailyCourseRecordTran.java

@@ -62,12 +62,12 @@ public class DailyCourseRecordTran extends TargetTran {
             if(StringUtil.isNotEmpty(retMap.get("医师签名")) && ret.contains(retMap.get("医师签名"))){
                 ret = ret.substring(0, ret.lastIndexOf(retMap.get("医师签名")));
             }
-            String falg  = "/";
+            String flag  = "/";
             if(ret.endsWith("//")){
-                falg = "//";
+                flag = "//";
             }
-            if(ret.endsWith(falg)){
-                ret =  ret.substring(0,ret.lastIndexOf(falg));
+            if(ret.endsWith(flag)){
+                ret =  ret.substring(0,ret.lastIndexOf(flag));
             }
             if(StringUtil.isNotEmpty(ret)){
                 retMap.put("住院病程",ret);

+ 60 - 13
structure-center/src/main/java/com/lantone/structure/facade/tran/ThreeLevelWardTran.java

@@ -7,9 +7,7 @@ import com.lantone.structure.facade.tran.util.CommonAnalysisUtil;
 import com.lantone.structure.model.doc.ThreeLevelWardDoc;
 import com.lantone.structure.model.label.ThreeLevelWardLabel;
 import lombok.extern.slf4j.Slf4j;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -39,14 +37,18 @@ public class ThreeLevelWardTran extends TargetTran {
     private Map<String, String> cutWord(String text) {
         Map<String, String> sourceMap = Maps.newHashMap();
         List<String> titles = CommonAnalysisUtil.sortTitles(
-                Lists.newArrayList("鉴别诊断","诊疗计划","补充诊断","注意事项"),
+                Lists.newArrayList("鉴别诊断","诊疗计划","诊断考虑","补充诊断","Caprini评分为","注意事项"),
                 text
         );
         CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
-        if(sourceMap.containsKey("鉴别诊断") || sourceMap.containsKey("补充诊断")|| sourceMap.containsKey("注意事项")){
+
+        if(sourceMap.containsKey("鉴别诊断") || sourceMap.containsKey("补充诊断")|| sourceMap.containsKey("注意事项")
+                || sourceMap.containsKey("Caprini评分为")   || sourceMap.containsKey("诊断考虑")){
             sourceMap.remove("鉴别诊断");
             sourceMap.remove("补充诊断");
             sourceMap.remove("注意事项");
+            sourceMap.remove("Caprini评分为");
+            sourceMap.remove("诊断考虑");
         }
         return sourceMap;
     }
@@ -54,34 +56,79 @@ public class ThreeLevelWardTran extends TargetTran {
 
     public void wardRecordContrast( List<ThreeLevelWardDoc> wardRecordDoc,Map<String, String> retMap) {
         String text = wardRecordDoc.get(0).getText();
+        String fir = text;
         //查房日期时间
         String sumdDate = extractDate(text);
         if(StringUtil.isNotEmpty(sumdDate)){
             retMap.put("查房日期时间",sumdDate);
         }
-        if(text.contains("鉴别诊断")){
-            String logo = text.split("\n")[1];
-            String fir = text.substring(text.indexOf(logo) + logo.length(),text.lastIndexOf("鉴别诊断"));
-            if(StringUtil.isNotEmpty(fir)){
-                retMap.put("查房记录",fir);
+
+        String signName= parseString(text);
+        if(StringUtil.isNotEmpty(signName) && StringUtil.isNotEmpty(signName.trim()) && signName.length()<15){
+            retMap.put("记录人签名",signName);
+        }
+
+        String[] split = text.split("\n");
+        String logo = split[1];
+        fir = text.substring(text.indexOf(logo) + logo.length());
+        if( StringUtil.isNotEmpty(signName.trim()) && signName.length()<15){
+             fir = text.substring(text.indexOf(logo) + logo.length(),text.lastIndexOf(signName));
+            String flag  = "/";
+            if(fir.endsWith("//")){
+                flag = "//";
             }
+            fir = fir.substring(0,fir.lastIndexOf(flag));
+
+        }
+
+        if(StringUtil.isNotEmpty(fir)){
+            retMap.put("查房记录",fir);
         }
 
         if(StringUtil.isNotEmpty(retMap.get("诊疗计划"))){
             String plan = retMap.get("诊疗计划");
-               String Data = parseString(plan);
-               retMap.put("诊疗计划",Data);
+            if(StringUtil.isNotEmpty( retMap.get("记录人签名")) && StringUtil.isNotEmpty( retMap.get("记录人签名").trim())){
+                String name = retMap.get("记录人签名").trim();
+                plan = plan.substring(0,plan.lastIndexOf(name));
+            }
+            if(plan.contains("诊断考虑:")){
+                plan = plan.substring(0,plan.lastIndexOf("诊断考虑:"));
+            }
+            if(plan.contains("VTE风险评估")){
+                plan = plan.substring(0,plan.lastIndexOf("。")+"。".length());
+            }
+            String flag  = "/";
+            if(fir.endsWith("//")){
+                flag = "//";
+            }
+            if(plan.endsWith(flag)){
+                plan = plan.substring(0,plan.lastIndexOf(flag));
+            }
+            if(plan.endsWith(",")){
+                plan = plan.substring(0,plan.lastIndexOf(","));
+            }
+               retMap.put("诊疗计划",plan);
            }
         }
 
+    // 取/后
     public static String parseString(String text){
         if(text.contains("/")){
-            text = text.substring(0,text.lastIndexOf("/"));
+            text = text.substring(text.lastIndexOf("/")+1);
             text= parseString(text);
         }
         return text;
     }
 
+    // 取/前
+    public static String parseStr(String text){
+        if(text.contains("/")){
+            text = text.substring(0,text.lastIndexOf("/"));
+            text= parseStr(text);
+        }
+        return text;
+    }
+
     /**
      * 抽取文本中的第一个时间
      *