ソースを参照

术前小结/术前讨论

chengyao 4 年 前
コミット
e6d40d933e

+ 22 - 10
structure-center/src/main/java/com/lantone/structure/ai/OperationAI.java

@@ -20,10 +20,7 @@ import com.lantone.structure.model.label.OperationRecordLabel;
 import com.lantone.common.util.StringUtil;
 import com.lantone.structure.model.label.PreoperativeDiscussionLabel;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @ClassName : OperationAI
@@ -35,7 +32,7 @@ public class OperationAI extends ModelAI {
     /**
      *
      */
-    public static List<String> medicalTextType = Arrays.asList("CourseAfterOperation_cx", "CourseRecordSRR","Taizhou_pDiscussion_record");
+    public static List<String> medicalTextType = Arrays.asList("CourseAfterOperation_cx", "CourseRecordSRR","Taizhou_before_surgery");
     public static String entityRelationObject = "entity_relation_object";
     public static String outputs = "outputs";
     public static String content = "content";
@@ -50,14 +47,22 @@ public class OperationAI extends ModelAI {
                 PreoperativeDiscussionDoc preoperativeDiscussionDoc = operationDocs.get(i).getPreoperativeDiscussionDoc();
                 Map<String, String> structureMap = preoperativeDiscussionDoc.getStructureMap();
                 String text = preoperativeDiscussionDoc.getText();
-                String opName = structureMap.get("拟实施手术及操作名称");
+                //部位
+                String opName = "拟实施手术及操作名称:"+structureMap.get("拟实施手术及操作名称");
                 StringBuffer sb = new StringBuffer();
-                putContent(crfContent, medicalTextType.get(2),opName,Content.opName);
+                putContent(crfContent, medicalTextType.get(2),opName,Content.surgicalSite);
+                //手术禁忌 = 手术指征 || 术前准备
+                //手术禁忌 = 诊断依据 || 术前准备 || "药物、食物过敏史
                 String opFlag = structureMap.get("手术指征");
                 if(StringUtil.isNotEmpty(opFlag)){
                     sb.append("手术指征:"+opFlag+"\n");
                 }
 
+                String preCase = structureMap.get("术前准备");
+                if(StringUtil.isNotEmpty(preCase)){
+                    sb.append("术前准备:"+preCase+"\n");
+                }
+
                 String simCase = structureMap.get("诊断依据");
                 if(StringUtil.isNotEmpty(simCase)){
                     sb.append("简要病情:"+simCase+"\n");
@@ -97,8 +102,15 @@ public class OperationAI extends ModelAI {
             if (midData.get(Content.preoperativeDiscussion) == null) {
                 continue;
             }
-            putPreoperativeDiscussionCrfData(midData.getJSONObject(Content.preoperativeDiscussion),inputInfo);
-            putPreoperativeDiscussionCrfData(midData.getJSONObject(Content.opName),inputInfo);
+            if (midData.get(Content.surgicalSite) == null) {
+                continue;
+            }
+            putPreoperativeDiscussionCrfData(midData.getJSONObject(Content.preoperativeDiscussion),inputInfo,Content.preoperativeDiscussion);
+            PreoperativeDiscussionLabel preoperativeDiscussionLabel = inputInfo.getOperationDocs().get(0).getPreoperativeDiscussionDoc().getPreoperativeDiscussionLabel();
+            putPreoperativeDiscussionCrfData(midData.getJSONObject(Content.surgicalSite),inputInfo,Content.surgicalSite);
+            PreoperativeDiscussionLabel preoperativeDiscussionLabelRe = inputInfo.getOperationDocs().get(0).getPreoperativeDiscussionDoc().getPreoperativeDiscussionLabel();
+            preoperativeDiscussionLabel.setOpBottomName(preoperativeDiscussionLabelRe.getOpBottomName());
+            inputInfo.getOperationDocs().get(0).getPreoperativeDiscussionDoc().setPreoperativeDiscussionLabel(preoperativeDiscussionLabel);
         }
 
         for (int i = 0; i < operationDocs.size(); i++) {
@@ -160,7 +172,7 @@ public class OperationAI extends ModelAI {
      *
      * @param jsonObject
      */
-    public void putPreoperativeDiscussionCrfData(JSONObject jsonObject,InputInfo inputInfo) {
+    public void putPreoperativeDiscussionCrfData(JSONObject jsonObject,InputInfo inputInfo,String name) {
         if (jsonObject == null) {
             return;
         }

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

@@ -41,7 +41,7 @@ public enum EntityEnum {
     CORD_AROUND_BODY("脐带绕身"), UTERINE_WALL_SUTURE("子宫壁缝合情况"), UC_AGENT("宫缩剂名称"), UC_CONSUMPTION("宫缩剂用量"), UC_USAGE_WARD_ROUND("宫缩剂用法"),
     UTERINE_CAVITY_ABNORMITY("宫腔探查异常情况描述"), UTERINE_CAVITY_DISPOSE("宫腔探查处理情况"), PUERPERA_CONDITION("手术时产妇情况"), HEMORRHAGE("术中出血"),
     FLUID_INFUSION("补液"),BLOOD_PRESSURE("血压情况"), NEWBORN("新生儿"), APGAR_SCORE("Apgar评分"), SCORE("分数"), CAPUT_SUCCEDANEUM("产瘤"),
-    CAPUT_SUCCEDANEUM_PART("产瘤部位"), OPE_DRUG("手术用药名称"), OPE_CONSUMPTION("手术用药量"), OPE_USAGE_WARD_ROUND("手术用药方法"), TRANSFUSION("输血成分"), DOCTORADVICE_RECORD("医嘱内容"), ASSESSMENTPLAN("诊疗计划"),ALLERGYRECORD("过敏史"),OPCONTRAINDICATION("手术禁忌症"),OPBOTTOMNAME("拟实施手术及操作名称");
+    CAPUT_SUCCEDANEUM_PART("产瘤部位"), OPE_DRUG("手术用药名称"), OPE_CONSUMPTION("手术用药量"), OPE_USAGE_WARD_ROUND("手术用药方法"), TRANSFUSION("输血成分"), DOCTORADVICE_RECORD("医嘱内容"), ASSESSMENTPLAN("诊疗计划"),ALLERGYRECORD("过敏史"),OPCONTRAINDICATION("手术禁忌"),OPBOTTOMNAME("手术目标部位");
 
 
 

+ 5 - 2
structure-center/src/main/java/com/lantone/structure/facade/StructureFacade.java

@@ -44,9 +44,9 @@ public class StructureFacade {
             case "出院小结":
                 targetTran = new LeaveHospitalTran();
                 break;
-         /*   case "术前小结":
+            case "术前小结":
                 targetTran = new PreoperativeDiscussionTran();
-                break;*/
+                break;
             case "转科记录":
                 targetTran = new TransferRecordTran();
                 break;
@@ -92,6 +92,9 @@ public class StructureFacade {
 //            case "一般手术记录":
 //                targetTran = new OperationRecordDocTran();
 //                break;
+            case "术前讨论":
+                targetTran = new PreoperativeDiscussionTran();
+                break;
             default:
                 break;
         }

+ 121 - 16
structure-center/src/main/java/com/lantone/structure/facade/tran/PreoperativeDiscussionTran.java

@@ -13,7 +13,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
- * @Description:术前小结
+ * @Description:术前小结、术前讨论
  * @author: cy
  * @time: 2021/2/26 14:52
  */
@@ -29,9 +29,16 @@ public class PreoperativeDiscussionTran extends TargetTran {
         operationDoc.setPreoperativeDiscussionDoc(preoperativeDiscussionDoc);
         operationDocs.add(operationDoc);
         inputInfo.setOperationDocs(operationDocs);
-    Map<String, String> structureMap = cutWord(text);
+        Map<String, String> structureMap = new HashMap<String, String>();
         Map<String, String> retMap = new HashMap<String, String>();
-        pDContrast(inputInfo.getOperationDocs(), structureMap);
+        Boolean falg = false;
+        if(text.split("\n")[0].contains("讨论记录")){
+            structureMap = cutWordRe(text);
+            falg = true;
+        }else{
+            structureMap = cutWord(text);
+        }
+        pDContrast(falg,inputInfo.getOperationDocs(), structureMap);
         mapKeyContrastCommon(structureMap,stagesContrasts,retMap);
         preoperativeDiscussionDoc.setStructureMap(retMap);
         aiProcess();
@@ -43,13 +50,11 @@ public class PreoperativeDiscussionTran extends TargetTran {
         Map<String, String> sourceMap = Maps.newHashMap();
         List<String> titles = CommonAnalysisUtil.sortTitles(
                 Lists.newArrayList("简要病情","药物、食物过敏史","月经史","一般情况","入院后辅助检查","术前诊断","手术指征","手术禁忌",
-                        "拟实施手术名称","手术方式","术前准备","防范措施","手术审批医师","医师签名"),
+                        "拟实施手术名称","手术方式","拟实施麻醉方式","术前准备","防范措施","手术审批医师","医师签名"),
                 text
         );
         CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
-        if(sourceMap.containsKey("手术方式") || sourceMap.containsKey("术前诊断")  || sourceMap.containsKey("月经史")
-                || sourceMap.containsKey("一般情况")){
-            sourceMap.remove("手术方式");
+        if( sourceMap.containsKey("术前诊断") || sourceMap.containsKey("月经史")|| sourceMap.containsKey("一般情况")){
             sourceMap.remove("术前诊断");
             sourceMap.remove("月经史");
             sourceMap.remove("一般情况");
@@ -57,6 +62,21 @@ public class PreoperativeDiscussionTran extends TargetTran {
         return sourceMap;
     }
 
+    private Map<String, String> cutWordRe(String text) {
+        Map<String, String> sourceMap = Maps.newHashMap();
+        List<String> titleReplace = CommonAnalysisUtil.sortTitles(
+                Lists.newArrayList("讨论主持人","参加人员","术前诊断","讨论摘要","主持人总结"),
+                text
+        );
+        CommonAnalysisUtil.cutByTitles(text, titleReplace, 0, sourceMap);
+        if(sourceMap.containsKey("讨论主持人")|| sourceMap.containsKey("术前诊断")){
+            sourceMap.remove("讨论主持人");
+            sourceMap.remove("术前诊断");
+        }
+        return sourceMap;
+    }
+
+
 
     private List<String> stagesContrasts = Lists.newArrayList(
             "手术指征=手术指征",
@@ -64,11 +84,14 @@ public class PreoperativeDiscussionTran extends TargetTran {
             "手术禁忌=手术禁忌症",
             "拟实施手术名称=拟实施手术及操作名称",
             "防范措施=注意事项",
-            "防范措施=手术要点"
+            "防范措施=手术要点",
+            "主持人总结=讨论结论",
+            "讨论摘要=讨论意见"
     );
 
-    public void pDContrast(List<OperationDoc> operationDocs,Map<String, String> retMap) {
+    public void pDContrast(Boolean flag,List<OperationDoc> operationDocs,Map<String, String> retMap) {
         String text = operationDocs.get(0).getPreoperativeDiscussionDoc().getText();
+        if(flag == false){
         //小结日期时间
         String sumdDate = extractDate(text);
         if(StringUtil.isNotEmpty(sumdDate)){
@@ -113,10 +136,19 @@ public class PreoperativeDiscussionTran extends TargetTran {
 
         //手术指征
         if(text.contains("手术指征:")) {
+            StringBuffer sb = new StringBuffer();
             String opration = text.substring(text.indexOf("手术指征:") + 5);
-            String s = opration.split("\n")[0];
-            if(!retMap.get("手术指征").equals(s)){
-                retMap.put("手术指征",s);
+            if(text.contains("拟实施手术名称")){
+                   opration = opration.substring(0,opration.indexOf("拟实施手术名称"));
+            }
+            String[] split = opration.split("\n");
+            for (int i = 0; i < split.length; i++) {
+                if(  split[i].contains(".")){
+                    sb.append(split[i]);
+                }
+            }
+            if(StringUtil.isNotEmpty(sb.toString())){
+                retMap.put("手术指征",sb.toString());
             }
         }
 
@@ -128,7 +160,10 @@ public class PreoperativeDiscussionTran extends TargetTran {
         }
 
         //手术审批医师
-        String oprationDoc =  text.substring(text.indexOf("手术审批医师:" )+ 7).trim();
+        String oprationDoc = "";
+        if(text.contains("手术审批医师:")){
+             oprationDoc =  text.substring(text.indexOf("手术审批医师:" )+ 7).trim();
+        }
         if(StringUtil.isEmpty(retMap.get("手术审批医师"))) {
             String oprationSign = "";
             if(oprationDoc.contains("医师签名")){
@@ -177,12 +212,82 @@ public class PreoperativeDiscussionTran extends TargetTran {
                 retMap.remove("医师签名");
             }
         }
-
-          String sub = text.substring(text.lastIndexOf("手术审批医师:"));
-          String date = extractDate(sub);
+        String date = "";
+        if(text.contains("手术审批医师:")){
+            String sub = text.substring(text.lastIndexOf("手术审批医师:"));
+             date = extractDate(sub);
+        }
         if(StringUtil.isNotEmpty(date)){
             retMap.put("签名日期时间",date);
         }
+
+            StringBuffer sbx = new StringBuffer();
+            if(StringUtil.isNotEmpty(retMap.get("拟实施手术名称"))){
+                String plan = retMap.get("拟实施手术名称");
+                sbx.append("拟实施手术名称:"+plan+" ");
+            }
+            if(StringUtil.isNotEmpty(retMap.get("手术方式"))){
+                String plan = retMap.get("手术方式");
+                sbx.append("手术方式:"+plan+" ");
+            }
+            if(StringUtil.isNotEmpty(retMap.get("拟实施麻醉方式"))){
+                String plan = retMap.get("拟实施麻醉方式");
+                sbx.append("拟实施麻醉方式:"+plan+" ");
+            }
+            if(StringUtil.isNotEmpty(sbx.toString())){
+                retMap.put("手术方案",sbx.toString());
+            }
+        }
+
+//        ===========================术前讨论===================================
+
+/*
+        if(text.contains("\n")){
+            String[] split = text.split("\n");
+            for (int i = 0; i < split.length-1; i++) {
+                if(i == 0 && split[i].contains("讨论记录")){
+                   flag = true;
+
+                   break;
+                    }
+                }
+            }
+*/
+
+        //参加人员
+        if(flag){
+            if(StringUtil.isNotEmpty(retMap.get("参加人员"))){
+                String fir = text.substring(text.indexOf("参加人员:")+5, text.lastIndexOf("汇报病史"));
+                String[] split = fir.split("\n");
+                StringBuffer sb = new StringBuffer();
+                for (int i = 0; i < split.length-1; i++) {
+                    sb.append(split[i]).append("  ");
+                }
+                retMap.put("参加人员",sb.toString());
+            }
+            if(StringUtil.isNotEmpty(retMap.get("主持人总结"))){
+                String dirSum = retMap.get("主持人总结");
+                String date = extractDate(dirSum);
+                String signName = "";
+                if(dirSum.contains("记录者(签名)")){
+                    signName = dirSum.substring(dirSum.lastIndexOf("记录者(签名)")+"记录者(签名)".length());
+                }
+                if (StringUtil.isNotEmpty(date)) {
+                    signName = signName.substring(0, signName.lastIndexOf(date));
+                    retMap.put("签名日期时间",date);
+                }
+                if (StringUtil.isNotEmpty(signName) && StringUtil.isNotEmpty(signName.trim())) {
+                    retMap.put("医师签名",signName);
+                }
+                if(dirSum.contains("主持人(签名)")){
+                    dirSum = dirSum.substring(0, dirSum.lastIndexOf("主持人(签名)"));
+                }
+                retMap.put("主持人总结",dirSum);
+            }
+        }
+        retMap.remove("手术方式");
+        retMap.remove("拟实施麻醉方式");
+
     }
 
     public static void mapKeyContrastCommon(Map sourceMap, List<String> keyContrasts, Map<String, String> retMap) {

+ 2 - 2
structure-center/src/main/java/com/lantone/structure/model/Content.java

@@ -250,8 +250,8 @@ public class Content {
     public static final String stayLength = "住院天数";//出院小结用
 
     public static final String timestamp = "timestamp";
-    public static final String  preoperativeDiscussion = "术前小结";
-    public static final String  opName = "拟实施手术及操作名称";
+    public static final String  preoperativeDiscussion = "过敏、禁忌症";
+    public static final String  surgicalSite = "手术目标部位";
     public static final String bloodRecord = "输血记录";
     public static final String stagesSummary = "阶段小结";
     public static final String rescue = "抢救记录";