Browse Source

厦门查房需求跟进

wangsy 3 years ago
parent
commit
3417469261

+ 16 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/xiamen/threelevelward/THR0127.java

@@ -5,6 +5,7 @@ import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
 import com.lantone.qc.pub.model.doc.MedicalRecordInfoDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationDoc;
@@ -28,6 +29,13 @@ import java.util.Map;
 public class THR0127 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        String directorDoctor = "";
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
+        if (firstPageRecordDoc != null && firstPageRecordDoc.getStructureMap() != null) {
+            Map<String, String> structureMap = firstPageRecordDoc.getStructureMap();
+            directorDoctor = structureMap.get("主任医师");
+        }
+
         MedicalRecordInfoDoc medicalRecordInfoDoc = inputInfo.getMedicalRecordInfoDoc();
         if (medicalRecordInfoDoc != null && medicalRecordInfoDoc.getStructureMap() != null) {
             //入院日期
@@ -107,6 +115,9 @@ public class THR0127 extends QCCatalogue {
                     status.set("0");
                     return;
                 }
+
+                int headDepartmentNum = 0;
+                int archiaterNum = 0;
                 List<String> resultInfos = new ArrayList<>();
                 for (int j = 0; j < roundRecordEveryWeek.size(); j++) {
                     int directorNum = CatalogueUtil.appearNumber(roundRecordEveryWeek.get(j).split(","), Content.director);
@@ -115,7 +126,11 @@ public class THR0127 extends QCCatalogue {
                     int threeDoctorNum = CatalogueUtil.appearNumber(roundRecordEveryWeek.get(j).split(","), "多学科联合");
                     //北仑内分泌科(主任携主任代主治)
                     int endocrinologyTitleNum = endocrinologyTitleNum(roundRecordEveryWeek.get(j).split(","));
-                    if (directorNum + dept_doctorNum + threeDoctorNum + endocrinologyTitleNum < 1) {
+                    //厦门根据病案首页主任比对title(2022/2/11)
+                    if (StringUtil.isNotBlank(directorDoctor)) {
+                        archiaterNum = CatalogueUtil.appearNumber(roundRecordEveryWeek.get(j).split(","), directorDoctor);
+                    }
+                    if (directorNum + dept_doctorNum + threeDoctorNum + endocrinologyTitleNum + headDepartmentNum + archiaterNum < 1) {
                         //每周无2次主任医师查房记录/科主任查房记录
                         status.set("-1");
                         resultInfos.add(lastWardDateRangeList.get(j));

+ 32 - 20
kernel/src/main/java/com/lantone/qc/kernel/catalogue/xiamen/threelevelward/THR0128.java

@@ -8,6 +8,7 @@ import com.lantone.qc.pub.Content;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
 import com.lantone.qc.pub.model.doc.MedicalRecordInfoDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationDoc;
@@ -36,6 +37,13 @@ public class THR0128 extends QCCatalogue {
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
+        String behospitalDoctor = "";
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
+        if (firstPageRecordDoc != null && firstPageRecordDoc.getStructureMap() != null) {
+            Map<String, String> structureMap = firstPageRecordDoc.getStructureMap();
+            behospitalDoctor = structureMap.get("主治医师");
+        }
+
         MedicalRecordInfoDoc medicalRecordInfoDoc = inputInfo.getMedicalRecordInfoDoc();
         if (medicalRecordInfoDoc != null && medicalRecordInfoDoc.getStructureMap() != null) {
             //入院日期
@@ -172,18 +180,23 @@ public class THR0128 extends QCCatalogue {
                     status.set("0");
                     return;
                 }
+                int visitingStaffNum = 0;
                 boolean firstRecordAttendExist = findfirstRecordAttend(inputInfo);
                 List<String> resultInfos = new ArrayList<>();
                 for (int j = 0; j < roundRecordEveryWeek.size(); j++) {
                     int indicationsNum = CatalogueUtil.appearNumber(roundRecordEveryWeek.get(j).split(","), Content.attend);
                     //多学科联合,三级医师查房算一次主治查房
                     int threeDoctorNum = CatalogueUtil.appearNumber(roundRecordEveryWeek.get(j).split(","), "多学科联合");
-                    //厦门(科主任+主任)
-                    int endocrinologyTitleNum = endocrinologyTitleNum(roundRecordEveryWeek.get(j).split(","));
+//                    //厦门(科主任+主任)
+//                    int endocrinologyTitleNum = endocrinologyTitleNum(roundRecordEveryWeek.get(j).split(","));
+                    if (StringUtil.isNotBlank(behospitalDoctor)) {
+                        visitingStaffNum = CatalogueUtil.appearNumber(roundRecordEveryWeek.get(j).split(","), behospitalDoctor);
+                    }
+
                     if (j == 0 && firstRecordAttendExist) { //如果首程中医师签名为主治医师,第一周查房记录也要加上
                         indicationsNum += 1;
                     }
-                    if (indicationsNum + threeDoctorNum + endocrinologyTitleNum < 2) {
+                    if (indicationsNum + threeDoctorNum + visitingStaffNum < 2) {
                         //每周无3次主治医师查房记录
                         status.set("-1");
                         resultInfos.add(lastWardDateRangeList.get(j));
@@ -197,23 +210,22 @@ public class THR0128 extends QCCatalogue {
         }
     }
 
-    /**
-     * 厦门特殊需求
-     *
-     * @param srcText
-     * @return
-     */
-    private int endocrinologyTitleNum(String[] srcText) {
-        int count = 0;
-        for (String title : srcText) {
-            String regex = ".*主任.*主任.*";
-            if (title.matches(regex)) {
-                count++;
-            }
-        }
-        return count;
-    }
-
+//    /**
+//     * 厦门特殊需求
+//     *
+//     * @param srcText
+//     * @return
+//     */
+//    private int endocrinologyTitleNum(String[] srcText) {
+//        int count = 0;
+//        for (String title : srcText) {
+//            String regex = ".*主任.*主任.*";
+//            if (title.matches(regex)) {
+//                count++;
+//            }
+//        }
+//        return count;
+//    }
     private Date getLastRecordDate(List<ThreeLevelWardDoc> allDoctorWradDocs) {
         ThreeLevelWardDoc threeLevelWardDoc = allDoctorWradDocs.get(allDoctorWradDocs.size() - 1);
         Map<String, String> lastWardDocStructureMap = threeLevelWardDoc.getStructureMap();

+ 12 - 0
trans/src/main/java/com/lantone/qc/trans/comsis/ModelDocGenerate.java

@@ -476,6 +476,18 @@ public class ModelDocGenerate {
         return adlGradeDoc;
     }
 
+    /**
+     * 有创操作
+     *
+     * @param structureMap
+     * @return
+     */
+    public static InvasiveOperationDoc invasiveOperationDocGen(Map<String, String> structureMap) {
+        InvasiveOperationDoc invasiveOperationDoc = new InvasiveOperationDoc();
+        invasiveOperationDoc.setStructureMap(structureMap);
+        return invasiveOperationDoc;
+    }
+
     /**
      * 拼接结构化数据
      **/

+ 16 - 0
trans/src/main/java/com/lantone/qc/trans/xiamen/XiamenDocTrans.java

@@ -111,6 +111,7 @@ public class XiamenDocTrans extends DocTrans {
                 if (i.getTitle().equals("查房记录")) {
                     XiamenThreeLevelWardDocTrans threeLevelWardDocTrans = new XiamenThreeLevelWardDocTrans();
                     threeLevelWardDocTrans.setOperationDocs(inputInfo.getOperationDocs());
+                    threeLevelWardDocTrans.setInputInfo(inputInfo);
                     inputInfo.setThreeLevelWardDocs(threeLevelWardDocTrans.extract(i));
                 }
                 if (i.getTitle().equals("住院病历信息")) {
@@ -125,6 +126,10 @@ public class XiamenDocTrans extends DocTrans {
                     XiamenOutDepDocTrans outDepDocTrans = new XiamenOutDepDocTrans();
                     inputInfo.setBeHospitalizedDoc(outDepDocTrans.extract(i));
                 }
+                if (i.getTitle().equals("有创操作")) {
+                    XiamenInvasiveOperationDocTrans invasiveOperationDocTrans = new XiamenInvasiveOperationDocTrans();
+                    inputInfo.setInvasiveOperationDocs(invasiveOperationDocTrans.extract(i));
+                }
             }
         }
         pageDataHandle(inputInfo);
@@ -331,6 +336,17 @@ public class XiamenDocTrans extends DocTrans {
                                 .collect(Collectors.toList())
                 );
             }
+
+            if (ListUtil.isNotEmpty(inputInfo.getInvasiveOperationDocs())) {
+                inputInfo.getPageData().put(
+                        "有创操作",
+                        inputInfo.getInvasiveOperationDocs()
+                                .stream()
+                                .map(i -> i.getPageData())
+                                .sorted((map1, map2) -> -OrdinaryAssistant.pageDataTimeSort(map1, map2, "记录时间", "yyyy/MM/dd HH:mm:ss"))
+                                .collect(Collectors.toList())
+                );
+            }
         }
     }
 }

+ 72 - 0
trans/src/main/java/com/lantone/qc/trans/xiamen/XiamenInvasiveOperationDocTrans.java

@@ -0,0 +1,72 @@
+package com.lantone.qc.trans.xiamen;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.lantone.qc.pub.model.doc.InvasiveOperationDoc;
+import com.lantone.qc.pub.model.doc.StagesSummaryDoc;
+import com.lantone.qc.pub.model.vo.MedrecVo;
+import com.lantone.qc.pub.util.FastJsonUtils;
+import com.lantone.qc.pub.util.StringUtil;
+import com.lantone.qc.trans.ModelDocTrans;
+import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysis;
+import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysisUtil;
+import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
+import com.lantone.qc.trans.comsis.ModelDocGenerate;
+import com.lantone.qc.trans.comsis.OrdinaryAssistant;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @Description: 有创操作文档生成
+ * @author: rengb
+ * @time: 2022/2/10 19:41
+ */
+@Slf4j
+public class XiamenInvasiveOperationDocTrans extends ModelDocTrans {
+
+    @Override
+    public List<InvasiveOperationDoc> extract(MedrecVo medrecVo) {
+        List<InvasiveOperationDoc> retList = Lists.newArrayList();
+        List<Map<String, Object>> contentMaps = (List) medrecVo.getContent().get("content");
+        contentMaps.forEach(contentMap -> {
+            try {
+                InvasiveOperationDoc invasiveOperationDoc = getInvasiveOperationDoc(contentMap);
+                if (invasiveOperationDoc != null) {
+                    retList.add(invasiveOperationDoc);
+                }
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+            }
+        });
+        return retList;
+    }
+
+    private InvasiveOperationDoc getInvasiveOperationDoc(Map<String, Object> contentMap) {
+        String content = contentMap.get("xmlText").toString();
+        Map<String, String> structureMap = null;
+        if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
+            structureMap = (Map) FastJsonUtils.getJsonToMap(content);
+            structureMap = OrdinaryAssistant.mapKeyContrast(structureMap, keyContrasts, "59");
+        }
+        if (MapUtils.isNotEmpty(structureMap)) {
+            InvasiveOperationDoc invasiveOperationDoc = ModelDocGenerate.invasiveOperationDocGen(structureMap);
+            invasiveOperationDoc.setPageData((Map) structureMap);
+            return invasiveOperationDoc;
+        } else {
+            return null;
+        }
+    }
+
+    private List<String> keyContrasts = Lists.newArrayList(
+            "病历标题=标题",
+            "病情记录=病历内容"
+    );
+}

+ 40 - 17
trans/src/main/java/com/lantone/qc/trans/xiamen/XiamenThreeLevelWardDocTrans.java

@@ -1,8 +1,11 @@
 package com.lantone.qc.trans.xiamen;
 
 import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.lantone.qc.dbanaly.util.KernelConstants;
 import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
 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;
@@ -20,10 +23,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @Description: 查房记录文档生成
@@ -35,15 +35,26 @@ import java.util.Map;
 public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
 
     private List<OperationDoc> operationDocs;
+    private InputInfo inputInfo;
 
     @Override
     public List<ThreeLevelWardDoc> extract(MedrecVo medrecVo) {
+
+        Map<String, String> PhysicianTitleMap = Maps.newHashMap();
+        //病案首页
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
+        if (firstPageRecordDoc != null && firstPageRecordDoc.getStructureMap() != null) {
+            Map<String, String> structureMap = firstPageRecordDoc.getStructureMap();
+            PhysicianTitleMap.put("主任医师", structureMap.get("主任医师"));
+            PhysicianTitleMap.put("主治医师", structureMap.get("主治医师"));
+        }
+
         List<ThreeLevelWardDoc> retList = Lists.newArrayList();
         ThreeLevelWardDoc threeLevelWardDoc = new ThreeLevelWardDoc();
         List<Map<String, Object>> contentMaps = (List) medrecVo.getContent().get("content");
         contentMaps.forEach(contentMap -> {
             try {
-                classifyThreeLevelWardDoc(threeLevelWardDoc, contentMap);
+                classifyThreeLevelWardDoc(threeLevelWardDoc, contentMap, PhysicianTitleMap);
             } catch (Exception e) {
                 log.error(e.getMessage(), e);
             }
@@ -83,7 +94,7 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
                 for (ThreeLevelWardDoc t : allDoctorWradDocs) {
                     Map<String, String> structureMap = t.getStructureMap();
                     String title = structureMap.get("查房标题");
-                    if (!title.contains("科主任") &&(title.contains("副主任") || title.contains("主任"))) {
+                    if (!title.contains("科主任") && (title.contains("副主任") || title.contains("主任"))) {
 //                        structureMap.put("查房标题", title.replace("副主任", "主治").replace("主任", "主治"));
                         AttendingDoctorWardDoc attendingDoctorWardDoc = null;
                         attendingDoctorWardDoc = new AttendingDoctorWardDoc();
@@ -105,7 +116,7 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
                     Map<String, String> structureMap = t.getStructureMap();
                     String title = structureMap.get("查房标题");
 //                    structureMap.put("查房标题", title.replace("副主任", "主治"));
-                    if(title.contains("副主任")){
+                    if (title.contains("副主任")) {
                         AttendingDoctorWardDoc attendingDoctorWardDoc = null;
                         attendingDoctorWardDoc = new AttendingDoctorWardDoc();
                         attendingDoctorWardDoc.setStructureMap(structureMap);
@@ -119,7 +130,7 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
         }
     }
 
-    private void classifyThreeLevelWardDoc(ThreeLevelWardDoc threeLevelWardDoc, Map<String, Object> contentMap) {
+    private void classifyThreeLevelWardDoc(ThreeLevelWardDoc threeLevelWardDoc, Map<String, Object> contentMap, Map<String, String> PhysicianTitleMap) {
         String content = contentMap.get("xmlText").toString();
         Map<String, String> structureMap = null;
         if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
@@ -166,12 +177,12 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
         threeLevelWardDoc.addAllDoctorWradDoc(allDoctorWradDoc);
 
         //主任医师查房
-        DirectorDoctorWardDoc directorDoctorWardDoc = findDirectorDoctorWardDoc(structureMap);
+        DirectorDoctorWardDoc directorDoctorWardDoc = findDirectorDoctorWardDoc(structureMap, PhysicianTitleMap);
         if (directorDoctorWardDoc != null) {
-            threeLevelWardDoc.addDirectorDoctorWardDoc(findDirectorDoctorWardDoc(structureMap));
+            threeLevelWardDoc.addDirectorDoctorWardDoc(directorDoctorWardDoc);
         }
         //主治医师查房
-        AttendingDoctorWardDoc attendingDoctorWardDoc = findAttendingDoctorWardDoc(structureMap);
+        AttendingDoctorWardDoc attendingDoctorWardDoc = findAttendingDoctorWardDoc(structureMap, PhysicianTitleMap);
         if (attendingDoctorWardDoc != null) {
             threeLevelWardDoc.addAttendingDoctorWardDoc(attendingDoctorWardDoc);
         }
@@ -190,12 +201,16 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
      *
      * @param structureMap
      */
-    private DirectorDoctorWardDoc findDirectorDoctorWardDoc(Map<String, String> structureMap) {
+    private DirectorDoctorWardDoc findDirectorDoctorWardDoc(Map<String, String> structureMap, Map<String, String> PhysicianTitleMap) {
         String title = structureMap.get("查房标题");
         String content = structureMap.get("病情记录");
         String writTitle = structureMap.get("文书标题");
         String recordDateStr = structureMap.get("查房日期");
         Date recordDate = StringUtil.parseDateTime(recordDateStr);
+        String directorDoctor = "";
+        if (PhysicianTitleMap != null && PhysicianTitleMap.size() > 0) {
+            directorDoctor = PhysicianTitleMap.get("主任医师");
+        }
         //标题有代字
         DirectorDoctorWardDoc directorDoctorWardDoc = null;
         if (StringUtil.isNotBlank(title)) {
@@ -207,7 +222,8 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
                 title = title.replace("一助", doctorTitle);
             }
             if ((StringUtils.isNotEmpty(subTitle(title)) && subTitle(title).contains("主任")) || findDirector(content)
-                    || title.contains("多学科联合") || endocrinologyTitle(title)) {
+                    || title.contains("多学科联合") || endocrinologyTitle(title)
+                    || (StringUtil.isNotEmpty(directorDoctor) && title.contains(directorDoctor))) {
                 directorDoctorWardDoc = new DirectorDoctorWardDoc();
                 directorDoctorWardDoc.setStructureMap(structureMap);
                 directorDoctorWardDoc.setPageData((Map) structureMap);
@@ -223,7 +239,8 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
                 writTitle = writTitle.replace("一助", doctorTitle);
             }
             if ((StringUtils.isNotEmpty(subTitle(writTitle)) && subTitle(writTitle).contains("主任")) || findDirector(content)
-                    || writTitle.contains("多学科联合") || endocrinologyTitle(writTitle)) {
+                    || writTitle.contains("多学科联合") || endocrinologyTitle(writTitle)
+                    || (StringUtil.isNotEmpty(directorDoctor) && writTitle.contains(directorDoctor))) {
                 directorDoctorWardDoc = new DirectorDoctorWardDoc();
                 directorDoctorWardDoc.setStructureMap(structureMap);
                 directorDoctorWardDoc.setPageData((Map) structureMap);
@@ -237,12 +254,16 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
      *
      * @param structureMap
      */
-    private AttendingDoctorWardDoc findAttendingDoctorWardDoc(Map<String, String> structureMap) {
+    private AttendingDoctorWardDoc findAttendingDoctorWardDoc(Map<String, String> structureMap, Map<String, String> PhysicianTitleMap) {
         String title = structureMap.get("查房标题");
         String writTitle = structureMap.get("文书标题");
         String content = structureMap.get("病情记录");
         String recordDateStr = structureMap.get("查房日期");
         Date recordDate = StringUtil.parseDateTime(recordDateStr);
+        String behospitalDoctor = "";
+        if (PhysicianTitleMap != null && PhysicianTitleMap.size() > 0) {
+            behospitalDoctor = PhysicianTitleMap.get("主治医师");
+        }
         AttendingDoctorWardDoc attendingDoctorWardDoc = null;
         //标题有代字
         if (StringUtil.isNotBlank(title)) {
@@ -254,7 +275,8 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
                 title = title.replace("一助", doctorTitle);
             }
             if ((StringUtils.isNotEmpty(subTitle(title)) && subTitle(title).contains("主治"))
-                    || findAttend(content) || title.contains("多学科联合") || endocrinologyTitle(title)) {
+                    || findAttend(content) || title.contains("多学科联合") || endocrinologyTitle(title)
+                    || (StringUtil.isNotEmpty(behospitalDoctor) && title.contains(behospitalDoctor))) {
                 attendingDoctorWardDoc = new AttendingDoctorWardDoc();
                 attendingDoctorWardDoc.setStructureMap(structureMap);
                 attendingDoctorWardDoc.setPageData((Map) structureMap);
@@ -271,7 +293,8 @@ public class XiamenThreeLevelWardDocTrans extends ModelDocTrans {
                 writTitle = writTitle.replace("一助", doctorTitle);
             }
             if ((StringUtils.isNotEmpty(subTitle(writTitle)) && subTitle(writTitle).contains("主治"))
-                    || findAttend(content) || writTitle.contains("多学科联合") || endocrinologyTitle(writTitle)) {
+                    || findAttend(content) || writTitle.contains("多学科联合") || endocrinologyTitle(writTitle)
+                    || (StringUtil.isNotEmpty(behospitalDoctor) && writTitle.contains(behospitalDoctor))) {
                 attendingDoctorWardDoc = new AttendingDoctorWardDoc();
                 attendingDoctorWardDoc.setStructureMap(structureMap);
                 attendingDoctorWardDoc.setPageData((Map) structureMap);