瀏覽代碼

1、修改三级查房结构,拆分为主治医师查房、主任医师查房、普通医师查房

louhr 5 年之前
父節點
當前提交
97ffcb4d36

+ 56 - 3
public/src/main/java/com/lantone/qc/pub/model/doc/ThreeLevelWardDoc.java

@@ -4,11 +4,11 @@ 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;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
 import lombok.Getter;
 import lombok.Setter;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 
 /**
  * @ClassName : ThreeLevelWardDoc
@@ -19,10 +19,63 @@ import java.util.List;
 @Getter
 @Setter
 public class ThreeLevelWardDoc extends ModelDoc {
+    private List<ThreeLevelWardLabel> threeLevelWardLabel = new ArrayList<>();
     //主任医师查房
     private List<DirectorDoctorWardDoc> directorDoctorWardDocs = new ArrayList<>();
     //主治医师查房
     private List<AttendingDoctorWardDoc> attendingDoctorWardDocs = new ArrayList<>();
     //普通医师查房
-    private List<GeneralDoctorWardDoc> generalDoctorWardDoc = new ArrayList<>();
+    private List<GeneralDoctorWardDoc> generalDoctorWardDocs = new ArrayList<>();
+
+    public void addDirectorDoctorWardDoc(DirectorDoctorWardDoc directorDoctorWardDoc) {
+        Map<Date, DirectorDoctorWardDoc> dateRecord = new TreeMap<>(new Comparator<Date>() {
+            @Override
+            public int compare(Date o1, Date o2) {
+                // 升序排列
+                return o1.compareTo(o2);
+            }
+        });//按时间key排序,存放抢救记录、查房记录\
+        dateRecord.put(StringUtil.parseDateTime(directorDoctorWardDoc.getStructureMap().get("查房日期")), directorDoctorWardDoc);
+        directorDoctorWardDocs.stream().forEach(
+             doc ->  dateRecord.put(StringUtil.parseDateTime(doc.getStructureMap().get("查房日期")), doc)
+        );
+
+        List<DirectorDoctorWardDoc> docs = new ArrayList<>(dateRecord.values());
+        directorDoctorWardDocs = docs;
+    }
+
+    public void addAttendingDoctorWardDoc(AttendingDoctorWardDoc attendingDoctorWardDoc) {
+        Map<Date, AttendingDoctorWardDoc> dateRecord = new TreeMap<>(new Comparator<Date>() {
+            @Override
+            public int compare(Date o1, Date o2) {
+                // 升序排列
+                return o1.compareTo(o2);
+            }
+        });//按时间key排序,存放抢救记录、查房记录\
+        dateRecord.put(StringUtil.parseDateTime(attendingDoctorWardDoc.getStructureMap().get("查房日期")), attendingDoctorWardDoc);
+        attendingDoctorWardDocs.stream().forEach(
+                doc ->  dateRecord.put(StringUtil.parseDateTime(doc.getStructureMap().get("查房日期")), doc)
+        );
+
+        List<AttendingDoctorWardDoc> docs = new ArrayList<>(dateRecord.values());
+        attendingDoctorWardDocs = docs;
+    }
+
+    public void addGeneralDoctorWardDoc(GeneralDoctorWardDoc generalDoctorWardDoc) {
+        Map<Date, GeneralDoctorWardDoc> dateRecord = new TreeMap<>(new Comparator<Date>() {
+            @Override
+            public int compare(Date o1, Date o2) {
+                // 升序排列
+                return o1.compareTo(o2);
+            }
+        });//按时间key排序,存放抢救记录、查房记录\
+        dateRecord.put(StringUtil.parseDateTime(generalDoctorWardDoc.getStructureMap().get("查房日期")), generalDoctorWardDoc);
+        generalDoctorWardDocs.stream().forEach(
+                doc ->  dateRecord.put(StringUtil.parseDateTime(doc.getStructureMap().get("查房日期")), doc)
+        );
+
+        List<GeneralDoctorWardDoc> docs = new ArrayList<>(dateRecord.values());
+        generalDoctorWardDocs = docs;
+
+    }
 }

+ 5 - 0
public/src/main/java/com/lantone/qc/pub/model/doc/ward/AttendingDoctorWardDoc.java

@@ -1,6 +1,10 @@
 package com.lantone.qc.pub.model.doc.ward;
 
 import com.lantone.qc.pub.model.doc.ModelDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @ClassName : AttendingDoctorWardDoc
@@ -9,4 +13,5 @@ import com.lantone.qc.pub.model.doc.ModelDoc;
  * @Date: 2020-04-17 09:55
  */
 public class AttendingDoctorWardDoc extends ModelDoc {
+    private List<ThreeLevelWardLabel> threeLevelWardLabel = new ArrayList<>();
 }

+ 5 - 0
public/src/main/java/com/lantone/qc/pub/model/doc/ward/DirectorDoctorWardDoc.java

@@ -1,6 +1,10 @@
 package com.lantone.qc.pub.model.doc.ward;
 
 import com.lantone.qc.pub.model.doc.ModelDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @ClassName : DirectorDoctorWardDoc
@@ -9,4 +13,5 @@ import com.lantone.qc.pub.model.doc.ModelDoc;
  * @Date: 2020-04-17 09:53
  */
 public class DirectorDoctorWardDoc extends ModelDoc {
+    private List<ThreeLevelWardLabel> threeLevelWardLabel = new ArrayList<>();
 }

+ 5 - 0
public/src/main/java/com/lantone/qc/pub/model/doc/ward/GeneralDoctorWardDoc.java

@@ -1,6 +1,10 @@
 package com.lantone.qc.pub.model.doc.ward;
 
 import com.lantone.qc.pub.model.doc.ModelDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @ClassName : GeneralDoctorWardDoc
@@ -9,4 +13,5 @@ import com.lantone.qc.pub.model.doc.ModelDoc;
  * @Date: 2020-04-17 09:57
  */
 public class GeneralDoctorWardDoc extends ModelDoc {
+    private List<ThreeLevelWardLabel> threeLevelWardLabel = new ArrayList<>();
 }

+ 93 - 9
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouThreeLevelWardDocTrans.java

@@ -2,10 +2,16 @@ package com.lantone.qc.trans.taizhou;
 
 import com.google.common.collect.Lists;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+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;
 import com.lantone.qc.pub.model.vo.MedrecVo;
+import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.ModelDocTrans;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
 import com.lantone.qc.trans.taizhou.util.TzXmlUtil;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.lang3.StringUtils;
 
 import java.util.List;
 import java.util.Map;
@@ -21,28 +27,106 @@ public class TaiZhouThreeLevelWardDocTrans extends ModelDocTrans {
     public List<ThreeLevelWardDoc> extract(MedrecVo medrecVo) {
         List<ThreeLevelWardDoc> retList = Lists.newArrayList();
         List<String> contents = (List) medrecVo.getContent().get("content");
+
+        ThreeLevelWardDoc result = new ThreeLevelWardDoc();
         contents.forEach(content -> {
-            retList.add(getThreeLevelWardDoc(content));
+            classifyThreeLevelWardDoc(result, content);
         });
+        retList.add(result);
         return retList;
     }
 
-    private ThreeLevelWardDoc getThreeLevelWardDoc(String content) {
+    private void classifyThreeLevelWardDoc(ThreeLevelWardDoc result, String content) {
         Map<String, String> sourceMap = TzXmlUtil.getXmlToMapForTZWithReplace(content); // xml原始数据给华卓
         Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
 
-        ThreeLevelWardDoc threeLevelWardDoc = new ThreeLevelWardDoc();
-        threeLevelWardDoc.setStructureMap(structureMap);
-        threeLevelWardDoc.setPageData((Map)sourceMap);
-        return threeLevelWardDoc;
+        if (StringUtils.isEmpty(structureMap.get("查房日期"))) {
+            return;
+        }
+
+        //不能简单的标准转化,如果有查房标题,优先使用
+        if (StringUtils.isEmpty(structureMap.get("查房标题")) && StringUtils.isNotEmpty(structureMap.get("查房备注"))) {
+            structureMap.put("查房标题", structureMap.get("查房备注"));
+        }
+        if (StringUtils.isEmpty(structureMap.get("查房标题")) && StringUtils.isNotEmpty(structureMap.get("上级查房医生职称"))) {
+            structureMap.put("查房标题", structureMap.get("上级查房医生职称"));
+        }
+        //主任医师查房
+        DirectorDoctorWardDoc directorDoctorWardDoc = findDirectorDoctorWardDoc(sourceMap, structureMap);
+        if (directorDoctorWardDoc != null) {
+            result.addDirectorDoctorWardDoc(findDirectorDoctorWardDoc(sourceMap, structureMap));
+        }
+        //主治医师查房
+        AttendingDoctorWardDoc attendingDoctorWardDoc = findAttendingDoctorWardDoc(sourceMap, structureMap);
+        if (attendingDoctorWardDoc != null) {
+            result.addAttendingDoctorWardDoc(attendingDoctorWardDoc);
+        }
+        //普通医师查房
+        if (directorDoctorWardDoc == null && attendingDoctorWardDoc == null) {
+            GeneralDoctorWardDoc generalDoctorWardDoc = new GeneralDoctorWardDoc();
+            generalDoctorWardDoc.setStructureMap(structureMap);
+            generalDoctorWardDoc.setPageData((Map)sourceMap);
+            result.addGeneralDoctorWardDoc(generalDoctorWardDoc);
+        }
+    }
+
+    /**
+     * 主任医师查房
+     * @param sourceMap
+     * @param structureMap
+     */
+    private DirectorDoctorWardDoc findDirectorDoctorWardDoc(Map<String, String> sourceMap, Map<String, String> structureMap) {
+        String title = structureMap.get("查房标题");
+        title = subTitle(title);    //标题有代字
+
+        DirectorDoctorWardDoc directorDoctorWardDoc = null;
+        if (StringUtils.isNotEmpty(title) && title.contains("主任") ) {
+            directorDoctorWardDoc = new DirectorDoctorWardDoc();
+            directorDoctorWardDoc.setStructureMap(structureMap);
+            directorDoctorWardDoc.setPageData((Map)sourceMap);
+        }
+        return directorDoctorWardDoc;
+    }
+
+    /**
+     * 主治医师查房
+     * @param sourceMap
+     * @param structureMap
+     */
+    private AttendingDoctorWardDoc findAttendingDoctorWardDoc(Map<String, String> sourceMap, Map<String, String> structureMap) {
+        String title = structureMap.get("查房标题");
+        title = subTitle(title);    //标题有代字
+        AttendingDoctorWardDoc attendingDoctorWardDoc = null;
+        if (StringUtils.isNotEmpty(title) && title.contains("主治")) {
+            attendingDoctorWardDoc = new AttendingDoctorWardDoc();
+            attendingDoctorWardDoc.setStructureMap(structureMap);
+            attendingDoctorWardDoc.setPageData((Map)sourceMap);
+        }
+        return attendingDoctorWardDoc;
+    }
+
+    /**
+     * 普通医师查房
+     * @param threeLevelWardDoc
+     */
+    private GeneralDoctorWardDoc findGeneralDoctorWardDoc(ThreeLevelWardDoc threeLevelWardDoc) {
+        GeneralDoctorWardDoc generalDoctorWardDoc = new GeneralDoctorWardDoc();
+        generalDoctorWardDoc.setStructureMap(threeLevelWardDoc.getStructureMap());
+        generalDoctorWardDoc.setText(threeLevelWardDoc.getText());
+        generalDoctorWardDoc.setPageData(threeLevelWardDoc.getPageData());
+        return generalDoctorWardDoc;
     }
 
     private List<String> keyContrasts = Lists.newArrayList(
-            "查房类别=查房标题",
-            "查房记录=病情记录",
-            "事件日期=查房日期",
             "事件日期=记录时间",
             "医生=记录医师"
     );
 
+    public static String subTitle(String srcText) {
+        if (StringUtil.isNotBlank(srcText) && srcText.contains("代")) {
+            srcText = srcText.substring(srcText.indexOf("代") + 1);
+        }
+        return srcText;
+    }
+
 }