فهرست منبع

台州查房记录trans添加处理主刀医师对应职称
出院记录无执业医师签名 添加根据空格切割医师姓名

hujing 5 سال پیش
والد
کامیت
8adf53ab6f

+ 9 - 5
kernel/src/main/java/com/lantone/qc/kernel/catalogue/leavehospital/LEA0508.java

@@ -1,8 +1,8 @@
 package com.lantone.qc.kernel.catalogue.leavehospital;
 
-import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.dbanaly.util.KernelConstants;
 import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.LeaveHospitalDoc;
@@ -34,16 +34,20 @@ public class LEA0508 extends QCCatalogue {
             status.set("0");
             return;
         }
+
         SpecialStorageUtil specialStorageUtil = SpringContextUtil.getBean("specialStorageUtil");
         Map<String, Object> surgeon = specialStorageUtil.getJsonStringValue(KernelConstants.HOSPITAL_DOCTOR_MAP);
         if (surgeon == null) {
             status.set("0");
             return;
         }
-        Map<String, String> doctor = (Map) surgeon.get(doctorName);
-        String occup = doctor.get("occup");
-        if (StringUtils.isNotEmpty(occup) && "1".equals(occup)) {
-            status.set("0");
+        for (String doctorNameSplit : doctorName.split("\\s+")) {
+            Map<String, String> doctor = (Map) surgeon.get(doctorNameSplit);
+            String occup = doctor.get("occup");
+            if (StringUtils.isNotEmpty(occup) && "1".equals(occup)) {
+                status.set("0");
+                return;
+            }
         }
     }
 }

+ 1 - 0
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouOperationDocTrans.java

@@ -149,6 +149,7 @@ public class TaiZhouOperationDocTrans extends ModelDocTrans {
     private List<String> operationRecord_keyContrasts = Lists.newArrayList(
             "结束时间=手术结束时间",
             "开始时间=手术开始时间",
+            "手术医师=主刀医师",
             "本人姓名=姓名"
     );
 

+ 117 - 12
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouThreeLevelWardDocTrans.java

@@ -1,8 +1,13 @@
 package com.lantone.qc.trans.taizhou;
 
 import com.google.common.collect.Lists;
+import com.lantone.qc.dbanaly.facade.taizhou.TzXmlUtil;
 import com.lantone.qc.dbanaly.lt.facade.ModelHospitalFacade;
+import com.lantone.qc.dbanaly.util.KernelConstants;
+import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.doc.operation.OperationDoc;
+import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
 import com.lantone.qc.pub.model.doc.ward.AttendingDoctorWardDoc;
 import com.lantone.qc.pub.model.doc.ward.DirectorDoctorWardDoc;
 import com.lantone.qc.pub.model.doc.ward.GeneralDoctorWardDoc;
@@ -11,9 +16,11 @@ import com.lantone.qc.pub.util.SpringContextUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.ModelDocTrans;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
-import com.lantone.qc.dbanaly.facade.taizhou.TzXmlUtil;
+import lombok.Setter;
 import org.apache.commons.lang3.StringUtils;
 
+import java.util.Calendar;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -22,9 +29,11 @@ import java.util.Map;
  * @author: rengb
  * @time: 2020/3/17 13:27
  */
+@Setter
 public class TaiZhouThreeLevelWardDocTrans extends ModelDocTrans {
 
     private List<String> recTitles;
+    private List<OperationDoc> operationDocs;
 
     @Override
     public List<ThreeLevelWardDoc> extract(MedrecVo medrecVo) {
@@ -97,13 +106,22 @@ public class TaiZhouThreeLevelWardDocTrans extends ModelDocTrans {
      */
     private DirectorDoctorWardDoc findDirectorDoctorWardDoc(Map<String, String> structureMap) {
         String title = structureMap.get("查房标题");
-        title = subTitle(title);    //标题有代字
-
+        String recordDateStr = structureMap.get("查房日期");
+        Date recordDate = StringUtil.parseDateTime(recordDateStr);
         DirectorDoctorWardDoc directorDoctorWardDoc = null;
-        if (StringUtils.isNotEmpty(title) && title.contains("主任")) {
-            directorDoctorWardDoc = new DirectorDoctorWardDoc();
-            directorDoctorWardDoc.setStructureMap(structureMap);
-            directorDoctorWardDoc.setPageData((Map) structureMap);
+        if (StringUtils.isNotEmpty(title)) {
+            if (title.contains("主刀")) {
+                String doctorTitle = getDoctorTitle(operationDocs, recordDate, "主刀医师");
+                title = title.replace("主刀", doctorTitle);
+            } else if (title.contains("一助")) {
+                String doctorTitle = getDoctorTitle(operationDocs, recordDate, "一助");
+                title = title.replace("一助", doctorTitle);
+            }
+            if (StringUtils.isNotEmpty(subTitle(title)) && subTitle(title).contains("主任")) {    //标题有代字)
+                directorDoctorWardDoc = new DirectorDoctorWardDoc();
+                directorDoctorWardDoc.setStructureMap(structureMap);
+                directorDoctorWardDoc.setPageData((Map) structureMap);
+            }
         }
         return directorDoctorWardDoc;
     }
@@ -115,12 +133,22 @@ public class TaiZhouThreeLevelWardDocTrans extends ModelDocTrans {
      */
     private AttendingDoctorWardDoc findAttendingDoctorWardDoc(Map<String, String> structureMap) {
         String title = structureMap.get("查房标题");
-        title = subTitle(title);    //标题有代字
+        String recordDateStr = structureMap.get("查房日期");
+        Date recordDate = StringUtil.parseDateTime(recordDateStr);
         AttendingDoctorWardDoc attendingDoctorWardDoc = null;
-        if (StringUtils.isNotEmpty(title) && title.contains("主治")) {
-            attendingDoctorWardDoc = new AttendingDoctorWardDoc();
-            attendingDoctorWardDoc.setStructureMap(structureMap);
-            attendingDoctorWardDoc.setPageData((Map) structureMap);
+        if (StringUtils.isNotEmpty(title)) {
+            if (title.contains("主刀")) {
+                String doctorTitle = getDoctorTitle(operationDocs, recordDate, "主刀医师");
+                title = title.replace("主刀", doctorTitle);
+            } else if (title.contains("助手")) {
+                String doctorTitle = getDoctorTitle(operationDocs, recordDate, "助手");
+                title = title.replace("助手", doctorTitle);
+            }
+            if (StringUtils.isNotEmpty(subTitle(title)) && subTitle(title).contains("主治")) {    //标题有代字)
+                attendingDoctorWardDoc = new AttendingDoctorWardDoc();
+                attendingDoctorWardDoc.setStructureMap(structureMap);
+                attendingDoctorWardDoc.setPageData((Map) structureMap);
+            }
         }
         return attendingDoctorWardDoc;
     }
@@ -140,4 +168,81 @@ public class TaiZhouThreeLevelWardDocTrans extends ModelDocTrans {
         return srcText;
     }
 
+    /**
+     * 获取主刀医师/一助职称(取距离查房记录时间最近的一次手术记录)
+     *
+     * @param operationDocs
+     * @return
+     */
+    public static String getDoctorTitle(List<OperationDoc> operationDocs, Date recordDate, String findTitle) {
+        String title = "";
+        SpecialStorageUtil specialStorageUtil = SpringContextUtil.getBean("specialStorageUtil");
+        Map<String, Object> surgeon = specialStorageUtil.getJsonStringValue(KernelConstants.HOSPITAL_DOCTOR_MAP);
+        if (surgeon == null) {
+            return title;
+        }
+        /* 用于存放手术结束时间距离查房时间最近的一次时间差 */
+        long timeDiff = 0L;
+        for (OperationDoc operationDoc : operationDocs) {
+            OperationRecordDoc operationRecordDoc = operationDoc.getOperationRecordDoc();
+            if (operationRecordDoc == null) {
+                continue;
+            }
+            Map<String, String> structureMap = operationRecordDoc.getStructureMap();
+            String chiefSurgeon = structureMap.get(findTitle);
+            String operatorEndDateStr = structureMap.get("手术结束时间");
+
+            if (StringUtil.isBlank(chiefSurgeon) || StringUtil.isBlank(operatorEndDateStr)) {
+                continue;
+            }
+            Map<String, String> doctor = (Map) surgeon.get(chiefSurgeon);
+            if (doctor != null) {
+                String professor = doctor.get("professor");
+                Date operatorEndDate = StringUtil.parseDateTime(operatorEndDateStr);
+                if (operatorEndDate != null) {
+                    long timeDifference = timeDifference(operatorEndDate, recordDate);
+                    if (timeDifference == 0) {
+                        continue;
+                    }
+                    if (timeDiff == 0 || timeDiff > timeDifference) {
+                        /* 取距离此次主刀医师查房最近的一次手术时间 */
+                        timeDiff = timeDifference;
+                        title = professor;
+                    }
+                }
+            }
+        }
+        return title;
+    }
+
+    public static long timeDifference(Date firstDate, Date secondDate) {
+        long timeDifference = 0L;
+        if (firstDate == null || secondDate == null) {
+            return timeDifference;
+        }
+        boolean flag = false;
+        if (firstDate.before(secondDate)) {
+            flag = true;
+        }
+        Calendar calendarS = Calendar.getInstance();
+        Calendar calendarE = Calendar.getInstance();
+        long timeS, timeE;
+        try {
+            calendarS.setTime(firstDate);
+            calendarE.setTime(secondDate);
+
+            timeS = calendarS.getTimeInMillis();
+            timeE = calendarE.getTimeInMillis();
+
+            if (flag) {
+                timeDifference = (timeE - timeS) / (1000 * 60);
+            } else {
+                timeDifference = (timeS - timeE) / (1000 * 60);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return timeDifference;
+    }
+
 }

+ 1 - 0
trans/src/main/java/com/lantone/qc/trans/taizhou/TaizhouDocTrans.java

@@ -105,6 +105,7 @@ public class TaizhouDocTrans extends DocTrans {
                     break;
                 case "查房记录":
                     TaiZhouThreeLevelWardDocTrans threeLevelWardDocTrans = new TaiZhouThreeLevelWardDocTrans();
+                    threeLevelWardDocTrans.setOperationDocs(inputInfo.getOperationDocs());
                     inputInfo.setThreeLevelWardDocs(threeLevelWardDocTrans.extract(i));
                     break;
                 case "输血后效果评价":