Browse Source

入院记录对接修改

rengb 5 years ago
parent
commit
94818e4205

+ 3 - 7
trans/src/main/java/com/lantone/qc/trans/changx/ChangxBeHospitalizedDocTrans.java

@@ -1,11 +1,11 @@
 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.BeHospitalizedDoc;
 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.pub.util.MapUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.ModelDocTrans;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
@@ -43,18 +43,14 @@ public class ChangxBeHospitalizedDocTrans extends ModelDocTrans {
                 if (index == sourceTitle.length() - 1) {
                     targetTitle += sourceTitle.substring(index, index + 1);
                 } else {
-                    targetTitle += sourceTitle.substring(index, index + 1) + "[\\s]*";
+                    targetTitle += sourceTitle.substring(index, index + 1) + "[\\s\\p{Zs}]*";
                 }
             }
             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()) {
-            targetMap.put(key.replaceAll("\\s", ""), sourceMap.get(key));
-        }
-
+        Map<String, String> targetMap = MapUtil.copyMap((Map) sourceMap);
         targetMap.put("体格检查", targetMap.get("体格检查(一)"));
         targetMap.put("专科体格检查", targetMap.get("体格检查(二)"));
         targetMap.remove("体格检查(一)");

+ 11 - 9
trans/src/main/java/com/lantone/qc/trans/changx/ChangxFirstCourseRecordDocTrans.java

@@ -32,31 +32,33 @@ public class ChangxFirstCourseRecordDocTrans extends ModelDocTrans {
                 if (index == sourceTitle.length() - 1) {
                     targetTitle += sourceTitle.substring(index, index + 1);
                 } else {
-                    targetTitle += sourceTitle.substring(index, index + 1) + "[\\s]*";
+                    targetTitle += sourceTitle.substring(index, index + 1) + "[\\s\\p{Zs}]*";
                 }
             }
             targetTitles.add(targetTitle);
         });
 
         Map<String, String> sourceMap = Preproc.extract_doc_pub(false, targetTitles, content);
+        sourceMap.put("病程记录内容",
+                sourceMap.get("病程记录内容")
+                        .replace(sourceMap.get("病程记录时间"), "")
+                        .replace(sourceMap.get("病程记录名称"), "")
+        );
+
         Map<String, String> targetMap = Maps.newHashMap();
+        Map<String, Object> pageData = Maps.newHashMap();
         for (String key : sourceMap.keySet()) {
             if (key.equals("病程记录时间")) {
                 targetMap.put("记录时间", sourceMap.get(key));
             } else {
-                targetMap.put(key.replaceAll("[一二三四五六七八九十][、.]|\\s", ""), sourceMap.get(key));
+                targetMap.put(key.replaceAll("[一二三四五六七八九十][、.]", ""), sourceMap.get(key));
             }
+            pageData.put(key.replaceAll("[一二三四五六七八九十][、.]", ""), 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);
+        firstCourseRecordDoc.setPageData(pageData);
 
         return firstCourseRecordDoc;
     }

+ 8 - 2
trans/src/main/java/com/lantone/qc/trans/comsis/Preproc.java

@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
 import com.lantone.qc.pub.model.keys.ModelStandardKeys;
 import com.lantone.qc.pub.util.FileUtil;
 import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
 
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -43,11 +44,16 @@ public class Preproc {
         Map<String, String> sections = new HashMap<>();
         Map<String, Integer> sorted = new HashMap<>();
 
+        String key_ = null;
         for (String key : title) {
             Pattern pattern = Pattern.compile(key);
             Matcher matcher=pattern.matcher(line);
             while(matcher.find()){
                 key = matcher.group(0);
+                key_ = key.replaceAll("\\s\\p{Zs}","");
+            }
+            if (StringUtil.isBlank(key)){
+                continue;
             }
 
             pos = 0;
@@ -57,7 +63,7 @@ public class Preproc {
                 if (isProgress) {
                     pos += key.length();
                     if (null == sorted.get(key)) {
-                        sorted.put(key, pos);
+                        sorted.put(key_, pos);
                     }
                 } else {
                     pos_newln = line.substring(0, pos).lastIndexOf(newline);
@@ -66,7 +72,7 @@ public class Preproc {
 
                     if (ln_pos == -1 || line.substring(ln_pos + tab.length(), pos).trim().length() == 0) {
                         pos += key.length();
-                        sorted.put(key, pos);
+                        sorted.put(key_, pos);
                     } else {
                         pos += 1;
                     }