|
@@ -3,6 +3,7 @@ package com.lantone.qc.trans.beilun.util;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.jsoup.Jsoup;
|
|
import org.jsoup.Jsoup;
|
|
import org.jsoup.nodes.Document;
|
|
import org.jsoup.nodes.Document;
|
|
|
|
|
|
@@ -15,75 +16,80 @@ import java.util.stream.Collectors;
|
|
* @author: rengb
|
|
* @author: rengb
|
|
* @time: 2020/9/12 13:53
|
|
* @time: 2020/9/12 13:53
|
|
*/
|
|
*/
|
|
|
|
+@Slf4j
|
|
public class BeiLunConsultationHtmlAnalysis implements BeiLunHtmlAnalysis {
|
|
public class BeiLunConsultationHtmlAnalysis implements BeiLunHtmlAnalysis {
|
|
|
|
|
|
private String modeId = "31";
|
|
private String modeId = "31";
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Map<String, String> analysis(String... args) {
|
|
public Map<String, String> analysis(String... args) {
|
|
- List<String> titles = Lists.newArrayList("姓名", "性别", "出生日期", "科别", "病区", "床号", "住院号",
|
|
|
|
- "会诊类型", "被邀医院", "被邀科室", "申请时间", "患者病情及诊疗经过、申请会诊的理由及目的", "申请会诊科别",
|
|
|
|
- "被邀会诊科别", "申请会诊医师", "会诊意见", "会诊时间", "科主任", "会诊到达时间", "查体", "会诊建议",
|
|
|
|
- "会诊诊断", "会诊科室", "会诊医师", "外院会诊医师所在医疗机构名称", "会诊医师所在医疗机构名称");
|
|
|
|
- String html = args[0];
|
|
|
|
- String recTitle = args[1];
|
|
|
|
- String recTypeId = args[2];
|
|
|
|
-
|
|
|
|
Map<String, String> structureMap = Maps.newLinkedHashMap();
|
|
Map<String, String> structureMap = Maps.newLinkedHashMap();
|
|
- String htmlContent = null;
|
|
|
|
- if ("外院专家会诊申请单".equals(recTitle)) {
|
|
|
|
- htmlContent = CommonAnalysisUtil.html2String(html);
|
|
|
|
- if (StringUtil.isNotBlank(htmlContent)) {
|
|
|
|
- htmlContent = htmlContent.replaceAll("[ ]", " ");
|
|
|
|
- CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
|
|
|
|
- }
|
|
|
|
- } else if ("协定方会诊".equals(recTitle)) {
|
|
|
|
- htmlContent = CommonAnalysisUtil.html2String(html);
|
|
|
|
- if (StringUtil.isNotBlank(htmlContent)) {
|
|
|
|
- htmlContent = htmlContent.replaceAll("[ ]", " ");
|
|
|
|
- CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
|
|
|
|
- }
|
|
|
|
- if (StringUtil.isNotBlank(structureMap.get("会诊时间"))) {
|
|
|
|
- String[] strArr = structureMap.get("会诊时间").split(" ");
|
|
|
|
- structureMap.put("会诊意见", strArr[strArr.length - 1]);
|
|
|
|
- structureMap.put("会诊时间", strArr[0]);
|
|
|
|
- }
|
|
|
|
- } else if ("MDT会诊申请表".equals(recTitle) || "新-MDT会诊三合一".equals(recTitle)) {
|
|
|
|
- titles = Lists.newArrayList("姓名", "性别", "出生日期", "联系电话",
|
|
|
|
- "申请科室", "入院/首诊时间", "住院号", "病情概述(含主诉、病史、诊断、诊治过程等)", "拟申请MDT时间、地点",
|
|
|
|
- "拟请MDT参加科室", "MDT目的", "申请人签名", "申请递交时间", "科主任签字", "专家诊治建议", "专家科室", "签名",
|
|
|
|
- "填写时间", "主持科室小结(MDT的最终诊治决议)", "科主任(主持人)签名", "记录人(主管医师)签字", "日期");
|
|
|
|
- htmlContent = CommonAnalysisUtil.html2String(html);
|
|
|
|
- if (StringUtil.isNotBlank(htmlContent)) {
|
|
|
|
- htmlContent = htmlContent.replaceAll("[ ]", " ").replace("住院/门诊号", "");
|
|
|
|
- StringBuffer sbf = new StringBuffer();
|
|
|
|
- List<String> distinctText = Lists.newArrayList(htmlContent.split(" ")).stream().distinct().collect(Collectors.toList());
|
|
|
|
- for (String text : distinctText) {
|
|
|
|
- sbf.append(text).append(" ");
|
|
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ List<String> titles = Lists.newArrayList("姓名", "性别", "出生日期", "科别", "病区", "床号", "住院号",
|
|
|
|
+ "会诊类型", "被邀医院", "被邀科室", "申请时间", "患者病情及诊疗经过、申请会诊的理由及目的", "申请会诊科别",
|
|
|
|
+ "被邀会诊科别", "申请会诊医师", "会诊意见", "会诊时间", "科主任", "会诊到达时间", "查体", "会诊建议",
|
|
|
|
+ "会诊诊断", "会诊科室", "会诊医师", "外院会诊医师所在医疗机构名称", "会诊医师所在医疗机构名称");
|
|
|
|
+ String html = args[0];
|
|
|
|
+ String recTitle = args[1];
|
|
|
|
+ String recTypeId = args[2];
|
|
|
|
+ String htmlContent = null;
|
|
|
|
+ if ("外院专家会诊申请单".equals(recTitle)) {
|
|
|
|
+ htmlContent = CommonAnalysisUtil.html2String(html);
|
|
|
|
+ if (StringUtil.isNotBlank(htmlContent)) {
|
|
|
|
+ htmlContent = htmlContent.replaceAll("[ ]", " ");
|
|
|
|
+ CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
|
|
}
|
|
}
|
|
- CommonAnalysisUtil.html2StructureMapNoColon(titles, sbf.toString(), structureMap);
|
|
|
|
- }
|
|
|
|
- if (StringUtil.isNotBlank(structureMap.get("主持科室小结(MDT的最终诊治决议)"))) {
|
|
|
|
- String[] valueArray = structureMap.get("主持科室小结(MDT的最终诊治决议)").split(" ");
|
|
|
|
- structureMap.put("主持科室小结(MDT的最终诊治决议)", valueArray[1]);
|
|
|
|
- String v = valueArray[2];
|
|
|
|
- String[] vArr = v.split(":");
|
|
|
|
- if (vArr.length > 1) {
|
|
|
|
- structureMap.put(vArr[0], vArr[1]);
|
|
|
|
|
|
+ } else if ("协定方会诊".equals(recTitle)) {
|
|
|
|
+ htmlContent = CommonAnalysisUtil.html2String(html);
|
|
|
|
+ if (StringUtil.isNotBlank(htmlContent)) {
|
|
|
|
+ htmlContent = htmlContent.replaceAll("[ ]", " ");
|
|
|
|
+ CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotBlank(structureMap.get("会诊时间"))) {
|
|
|
|
+ String[] strArr = structureMap.get("会诊时间").split(" ");
|
|
|
|
+ structureMap.put("会诊意见", strArr[strArr.length - 1]);
|
|
|
|
+ structureMap.put("会诊时间", strArr[0]);
|
|
|
|
+ }
|
|
|
|
+ } else if ("MDT会诊申请表".equals(recTitle) || "新-MDT会诊三合一".equals(recTitle)) {
|
|
|
|
+ titles = Lists.newArrayList("姓名", "性别", "出生日期", "联系电话",
|
|
|
|
+ "申请科室", "入院/首诊时间", "住院号", "病情概述(含主诉、病史、诊断、诊治过程等)", "拟申请MDT时间、地点",
|
|
|
|
+ "拟请MDT参加科室", "MDT目的", "申请人签名", "申请递交时间", "科主任签字", "专家诊治建议", "专家科室", "签名",
|
|
|
|
+ "填写时间", "主持科室小结(MDT的最终诊治决议)", "科主任(主持人)签名", "记录人(主管医师)签字", "日期");
|
|
|
|
+ htmlContent = CommonAnalysisUtil.html2String(html);
|
|
|
|
+ if (StringUtil.isNotBlank(htmlContent)) {
|
|
|
|
+ htmlContent = htmlContent.replaceAll("[ ]", " ").replace("住院/门诊号", "");
|
|
|
|
+ StringBuffer sbf = new StringBuffer();
|
|
|
|
+ List<String> distinctText = Lists.newArrayList(htmlContent.split(" ")).stream().distinct().collect(Collectors.toList());
|
|
|
|
+ for (String text : distinctText) {
|
|
|
|
+ sbf.append(text).append(" ");
|
|
|
|
+ }
|
|
|
|
+ CommonAnalysisUtil.html2StructureMapNoColon(titles, sbf.toString(), structureMap);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotBlank(structureMap.get("主持科室小结(MDT的最终诊治决议)"))) {
|
|
|
|
+ String[] valueArray = structureMap.get("主持科室小结(MDT的最终诊治决议)").split(" ");
|
|
|
|
+ structureMap.put("主持科室小结(MDT的最终诊治决议)", valueArray[1]);
|
|
|
|
+ String v = valueArray[2];
|
|
|
|
+ String[] vArr = v.split(":");
|
|
|
|
+ if (vArr.length > 1) {
|
|
|
|
+ structureMap.put(vArr[0], vArr[1]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ Document doc = Jsoup.parse(html);
|
|
|
|
+ htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
|
|
|
|
+ //htmlContent = CommonAnalysisUtil.html2String(html);
|
|
|
|
+ if (StringUtil.isNotBlank(htmlContent)) {
|
|
|
|
+ htmlContent = htmlContent.replaceAll("[ ]", " ");
|
|
|
|
+ CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- Document doc = Jsoup.parse(html);
|
|
|
|
- htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), true);
|
|
|
|
- //htmlContent = CommonAnalysisUtil.html2String(html);
|
|
|
|
- if (StringUtil.isNotBlank(htmlContent)) {
|
|
|
|
- htmlContent = htmlContent.replaceAll("[ ]", " ");
|
|
|
|
- CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
|
|
|
|
- }
|
|
|
|
|
|
+ CommonAnalysisUtil.extractDateByTitle(structureMap, "会诊到达时间");
|
|
|
|
+ CommonAnalysisUtil.processType(structureMap, "会诊类型");
|
|
|
|
+ BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error(e.getMessage(), e);
|
|
}
|
|
}
|
|
- CommonAnalysisUtil.extractDateByTitle(structureMap, "会诊到达时间");
|
|
|
|
- CommonAnalysisUtil.processType(structureMap, "会诊类型");
|
|
|
|
- BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
|
|
|
|
return structureMap;
|
|
return structureMap;
|
|
}
|
|
}
|
|
|
|
|