|
@@ -0,0 +1,54 @@
|
|
|
|
+package com.lantone.qc.trans.beilun.util;
|
|
|
|
+
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
|
+import com.google.common.collect.Maps;
|
|
|
|
+import com.lantone.qc.pub.util.FileUtil;
|
|
|
|
+import org.jsoup.Jsoup;
|
|
|
|
+import org.jsoup.nodes.Element;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @Description:
|
|
|
|
+ * @author: rengb
|
|
|
|
+ * @time: 2020/9/28 20:22
|
|
|
|
+ */
|
|
|
|
+public class TransferOutHtmlAnalysis implements BeiLunHtmlAnalysis {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, String> analysis(String... args) {
|
|
|
|
+ Map<String, String> map = Maps.newLinkedHashMap();
|
|
|
|
+ String html = args[0];
|
|
|
|
+ String recTitle = args[1];
|
|
|
|
+ String recTypeId = args[2];
|
|
|
|
+ Element bigDivElement = Jsoup.parse(html).selectFirst("body").child(0);
|
|
|
|
+ analysisGeneral(bigDivElement, map);
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void analysisGeneral(Element bigDivElement, Map<String, String> map) {
|
|
|
|
+ if (bigDivElement.selectFirst("hr") != null) {
|
|
|
|
+ bigDivElement.selectFirst("hr").previousElementSiblings().remove();
|
|
|
|
+ }
|
|
|
|
+ String text = BeiLunHtmlAnalysisUtil.blockDivToStr(bigDivElement, true);
|
|
|
|
+ CommonAnalysisUtil.extractWardInfo(text, map);
|
|
|
|
+ String bqjlText = "病情记录" + map.get("病情记录");
|
|
|
|
+ List<String> titles = Lists.newArrayList(
|
|
|
|
+ "病情记录"
|
|
|
|
+ );
|
|
|
|
+ titles = CommonAnalysisUtil.sortTitlesNoColon(titles, bqjlText);
|
|
|
|
+ CommonAnalysisUtil.cutByTitlesNoColon(bqjlText, titles, 0, map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ String html = FileUtil.fileRead("C:/Users/Administrator/Desktop/宁波/分类/消化内科/红细胞输注病程记录/106000157270.odt.html");
|
|
|
|
+ String recTitle = "术后首程-";
|
|
|
|
+ TransferOutHtmlAnalysis test = new TransferOutHtmlAnalysis();
|
|
|
|
+ Map<String, String> map = test.analysis(html, recTitle, "");
|
|
|
|
+ map.keySet().forEach(key -> {
|
|
|
|
+ System.out.println(key + "-----" + map.get(key).replaceAll("\n", ""));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|