Bläddra i källkod

首次病程录修改

rengb 5 år sedan
förälder
incheckning
f6f2a00f13

+ 35 - 8
trans/src/main/java/com/lantone/qc/trans/changx/ChangxFirstCourseRecordDocTrans.java

@@ -1,5 +1,7 @@
 package com.lantone.qc.trans.changx;
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.lantone.qc.pub.model.doc.FirstCourseRecordDoc;
 import com.lantone.qc.pub.model.keys.ModelStandardKeys;
 import com.lantone.qc.pub.model.vo.MedrecVo;
@@ -21,15 +23,40 @@ public class ChangxFirstCourseRecordDocTrans extends ModelDocTrans {
     @Override
     public FirstCourseRecordDoc extract(MedrecVo medrecVo) {
         String content = ((List<String>) medrecVo.getContent().get("content")).get(0);
-        Map<String, String> structureMap =
-                Preproc.extract_doc_pub(
-                        false,
-                        ListUtil.isEmpty(medrecVo.getLabel()) ? ModelStandardKeys.firstCourseRecord : medrecVo.getLabel(),
-                        content
-                );
-
-        FirstCourseRecordDoc firstCourseRecordDoc = ModelDocGenerate.firstCourseRecordDocGen(structureMap);
+
+        List<String> targetTitles = Lists.newArrayList();
+        List<String> sourceTitles = ListUtil.isEmpty(medrecVo.getLabel()) ? ModelStandardKeys.firstCourseRecord : medrecVo.getLabel();
+        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]*";
+                }
+            }
+            targetTitles.add(targetTitle);
+        });
+
+        Map<String, String> sourceMap = Preproc.extract_doc_pub(false, targetTitles, content);
+        Map<String, String> targetMap = Maps.newHashMap();
+        for (String key : sourceMap.keySet()) {
+            if (key.equals("病程记录时间")) {
+                targetMap.put("记录时间", sourceMap.get(key));
+            } else {
+                targetMap.put(key.replaceAll("[一二三四五六七八九十][、.]|\\s", ""), sourceMap.get(key));
+            }
+        }
+
+        sourceMap.put("病程记录内容",
+                sourceMap.get("病程记录内容")
+                        .replace(sourceMap.get("病程记录时间"), "")
+                        .replace(sourceMap.get("病程记录名称"), "")
+        );
+
+        FirstCourseRecordDoc firstCourseRecordDoc = ModelDocGenerate.firstCourseRecordDocGen(targetMap);
         firstCourseRecordDoc.setText(content);
+        firstCourseRecordDoc.setPageData((Map) sourceMap);
 
         return firstCourseRecordDoc;
     }