Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

rengb 5 gadi atpakaļ
vecāks
revīzija
c5924efe06

+ 25 - 16
trans/src/main/java/com/lantone/qc/trans/changx/ChangxBeHospitalizedDocTrans.java

@@ -1,5 +1,6 @@
 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;
@@ -34,25 +35,33 @@ public class ChangxBeHospitalizedDocTrans extends ModelDocTrans {
         int index3 = content.indexOf("辅助检查");
         content = content.substring(0, index3) + "\n" + content.substring(index3);
 
-        Map<String, String> structureMap =
-                Preproc.extract_doc_pub(
-                        false,
-                        ListUtil.isEmpty(medrecVo.getLabel()) ? ModelStandardKeys.beHospitalized : medrecVo.getLabel(),
-                        content
-                );
-
-        Map<String, Object> pageData = Maps.newHashMap();
-        structureMap.keySet().forEach(i -> {
-            pageData.put(i, structureMap.get(i));
+        List<String> targetTitles = Lists.newArrayList();
+        List<String> sourceTitles = ListUtil.isEmpty(medrecVo.getLabel()) ? ModelStandardKeys.beHospitalized : 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);
         });
 
-        structureMap.put("体格检查", structureMap.get("体格检查(一)"));
-        structureMap.put("专科体格检查", structureMap.get("体格检查(二)"));
-        structureMap.remove("体格检查(一)");
-        structureMap.remove("体格检查(二)");
+        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));
+        }
+
+        targetMap.put("体格检查", targetMap.get("体格检查(一)"));
+        targetMap.put("专科体格检查", targetMap.get("体格检查(二)"));
+        targetMap.remove("体格检查(一)");
+        targetMap.remove("体格检查(二)");
 
-        BeHospitalizedDoc beHospitalizedDoc = ModelDocGenerate.beHospitalizedDocGen(structureMap);
-        beHospitalizedDoc.setPageData(pageData);
+        BeHospitalizedDoc beHospitalizedDoc = ModelDocGenerate.beHospitalizedDocGen(targetMap);
+        beHospitalizedDoc.setPageData((Map) sourceMap);
 
         return beHospitalizedDoc;
     }