Selaa lähdekoodia

北仑查房记录修改html解析

huj 4 vuotta sitten
vanhempi
commit
e4deafba2b

+ 2 - 1
trans/src/main/java/com/lantone/qc/trans/beilun/util/BeiLunThreeLevelWardHtmlAnalysis.java

@@ -23,7 +23,8 @@ public class BeiLunThreeLevelWardHtmlAnalysis implements BeiLunHtmlAnalysis {
         String html = args[0];
         String recTypeId = args[2];
         Map<String, String> structureMap = Maps.newLinkedHashMap();
-        String htmlText = CommonAnalysisUtil.html2String(html);
+        Document doc = Jsoup.parse(html);
+        String htmlText = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
         CommonAnalysisUtil.extractWardInfo(htmlText, structureMap);
         BeiLunHtmlAnalysisUtil.insertModuleId(recTypeId, structureMap);
         //找不到模板id,用默认标准模板

+ 9 - 2
trans/src/main/java/com/lantone/qc/trans/beilun/util/CommonAnalysisUtil.java

@@ -325,7 +325,7 @@ public class CommonAnalysisUtil {
      */
     public static void extractWardInfo(String htmlText, Map<String, String> structureMap) {
         if (StringUtil.isNotBlank(htmlText)) {
-            htmlText = htmlText.replaceAll("[   ]", " ");
+            htmlText = htmlText.replaceAll("[   ]", " ").replace("第1页", "");
             String date = extractDate(htmlText);
             if (date != null) {
                 structureMap.put("病历日期", date);
@@ -341,7 +341,14 @@ public class CommonAnalysisUtil {
             for (String text : titleContent) {
                 sb.append(text).append(" ");
             }
-            structureMap.put("病历内容", sb.toString());
+            String content = sb.toString();
+            if (content.contains("<img")) {
+                String[] contentDoctor = content.split("<img");
+                structureMap.put("病历内容", contentDoctor[0]);
+                structureMap.put("记录医生", "<img" + contentDoctor[1]);
+            } else {
+                structureMap.put("病历内容", content);
+            }
         }
     }
 }