Преглед на файлове

病危通知书对接添加

rengb преди 5 години
родител
ревизия
11ed7128be
променени са 1 файла, в които са добавени 47 реда и са изтрити 12 реда
  1. 47 12
      trans/src/main/java/com/lantone/qc/trans/changx/ChangxCriticallyIllNoticeDocTrans.java

+ 47 - 12
trans/src/main/java/com/lantone/qc/trans/changx/ChangxCriticallyIllNoticeDocTrans.java

@@ -2,9 +2,7 @@ package com.lantone.qc.trans.changx;
 
 import com.google.common.collect.Lists;
 import com.lantone.qc.pub.model.doc.CriticallyIllNoticeDoc;
-import com.lantone.qc.pub.model.keys.ModelStandardKeys;
 import com.lantone.qc.pub.model.vo.MedrecVo;
-import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.trans.ModelDocTrans;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
 import com.lantone.qc.trans.comsis.Preproc;
@@ -24,18 +22,55 @@ public class ChangxCriticallyIllNoticeDocTrans extends ModelDocTrans {
         List<CriticallyIllNoticeDoc> retList = Lists.newArrayList();
         List<String> contents = (List) medrecVo.getContent().get("content");
         contents.forEach(content -> {
-            Map<String, String> structureMap =
-                    Preproc.extract_doc_pub(
-                            false,
-                            ListUtil.isEmpty(medrecVo.getLabel()) ? ModelStandardKeys.criticallyIllNotice : medrecVo.getLabel(),
-                            content
-                    );
-
-            CriticallyIllNoticeDoc criticallyIllNoticeDoc = ModelDocGenerate.criticallyIllNoticeDocGen(structureMap);
-            criticallyIllNoticeDoc.setText(content);
-            retList.add(criticallyIllNoticeDoc);
+            retList.add(getCriticallyIllNoticeDoc(content));
         });
         return retList;
     }
 
+    private CriticallyIllNoticeDoc getCriticallyIllNoticeDoc(String content) {
+        Map<String, String> pageData = Preproc.extract_doc_pub(true, pageDataTitles, content);
+        pageData.put("病程记录内容",
+                pageData.get("病程记录内容")
+                        .replace(pageData.get("病程记录时间"), "")
+                        .replace(pageData.get("病程记录名称"), "")
+        );
+
+        List<String> targetTitles = Lists.newArrayList();
+        sourceTitles.forEach(sourceTitle -> {
+            String targetTitle = "";
+            for (int index = 0; index < sourceTitle.length(); index++) {
+                if (index == sourceTitle.length() - 1) {
+                    targetTitle += sourceTitle.substring(index, index + 1);
+                } else {
+                    targetTitle += sourceTitle.substring(index, index + 1) + "[\\s\\p{Zs}]*";
+                }
+            }
+            targetTitles.add(targetTitle);
+        });
+
+        Map<String, String> sourceMap = Preproc.extract_doc_pub(true, targetTitles, content);
+        sourceMap.put("记录时间", sourceMap.get("病程记录时间"));
+
+        CriticallyIllNoticeDoc criticallyIllNoticeDoc = ModelDocGenerate.criticallyIllNoticeDocGen(sourceMap);
+        criticallyIllNoticeDoc.setText(content);
+        criticallyIllNoticeDoc.setPageData((Map) pageData);
+
+        return criticallyIllNoticeDoc;
+    }
+
+    private List<String> pageDataTitles = Lists.newArrayList(
+            "病程记录时间",
+            "病程记录名称",
+            "病程记录内容",
+            "记录医师"
+    );
+
+    private List<String> sourceTitles = Lists.newArrayList(
+            "病程记录时间",
+            "病程记录名称",
+            "病程记录内容",
+            "记录时间",
+            "记录医师"
+    );
+
 }