|
@@ -28,14 +28,13 @@ public class XyLeaveHospitalHtmlAnalysis implements XyHtmlAnalysis {
|
|
Map<String, String> structureMap = Maps.newLinkedHashMap();
|
|
Map<String, String> structureMap = Maps.newLinkedHashMap();
|
|
try {
|
|
try {
|
|
List<String> titles = Lists.newArrayList("入院日期", "出院日期", "住院天数", "入院诊断",
|
|
List<String> titles = Lists.newArrayList("入院日期", "出院日期", "住院天数", "入院诊断",
|
|
- "辅助资料", "住院经过", "出院时情况","出院情况",
|
|
|
|
|
|
+ "入院时体查", "辅助资料", "住院经过", "出院时情况",
|
|
"出院诊断", "出院医嘱", "医师签名", "上级医师签名", "医师", "上级医师");
|
|
"出院诊断", "出院医嘱", "医师签名", "上级医师签名", "医师", "上级医师");
|
|
String html = args[0];
|
|
String html = args[0];
|
|
String recTitle = args[1];
|
|
String recTitle = args[1];
|
|
String recTypeId = args[2];
|
|
String recTypeId = args[2];
|
|
Document doc = Jsoup.parse(html);
|
|
Document doc = Jsoup.parse(html);
|
|
-
|
|
|
|
- String htmlContent = doc.text();
|
|
|
|
|
|
+ String htmlContent = XyHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body"), true).replace(" ", ":");
|
|
htmlContent = htmlContent.replace(" ", "")
|
|
htmlContent = htmlContent.replace(" ", "")
|
|
.replace(" ", " ")
|
|
.replace(" ", " ")
|
|
.replace("8220", "“")
|
|
.replace("8220", "“")
|
|
@@ -59,56 +58,25 @@ public class XyLeaveHospitalHtmlAnalysis implements XyHtmlAnalysis {
|
|
.replace("出院医嘱", "出院医嘱:");
|
|
.replace("出院医嘱", "出院医嘱:");
|
|
|
|
|
|
if (StringUtil.isNotBlank(htmlContent)) {
|
|
if (StringUtil.isNotBlank(htmlContent)) {
|
|
-// titles = CommonAnalysisUtil.sortTitles(titles, htmlContent);
|
|
|
|
List<String> sortTitles = XyCommonAnalysisUtil.sortTitles(titles, htmlContent);
|
|
List<String> sortTitles = XyCommonAnalysisUtil.sortTitles(titles, htmlContent);
|
|
- XyCommonAnalysisUtil.cutByTitles(htmlContent, titles, 0, structureMap);
|
|
|
|
- }
|
|
|
|
- if (StringUtils.isNotEmpty(structureMap.get("入院日期"))){
|
|
|
|
- structureMap.put("入院日期",structureMap.get("入院日期").replace(","," ").replace(","," "));
|
|
|
|
- }
|
|
|
|
- if (StringUtils.isNotEmpty(structureMap.get("出院日期"))){
|
|
|
|
- structureMap.put("出院日期",structureMap.get("出院日期").replace(","," ").replace(","," "));
|
|
|
|
|
|
+ XyCommonAnalysisUtil.cutByTitles(htmlContent, sortTitles, 0, structureMap);
|
|
}
|
|
}
|
|
- //处理主诉和入院诊断被切割到住院天数的情况情况
|
|
|
|
- if (StringUtils.isNotEmpty(structureMap.get("住院天数"))) {
|
|
|
|
- String diagString = structureMap.get("住院天数");
|
|
|
|
- if(diagString.contains("入院诊断")) {
|
|
|
|
- structureMap.put("住院天数", diagString.substring(0, diagString.indexOf("入院诊断")));
|
|
|
|
- if ((diagString.indexOf("入院诊断")+4) < diagString.length()) {
|
|
|
|
- structureMap.put("入院诊断", diagString.substring(diagString.lastIndexOf("入院诊断") + 4, diagString.length()));
|
|
|
|
- }else {
|
|
|
|
- structureMap.put("入院诊断", diagString.substring(diagString.lastIndexOf("入院诊断"), diagString.length()));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(structureMap.get("入院日期"))) {
|
|
|
|
+ String dateString = structureMap.get("入院日期");
|
|
|
|
+ if (dateString.contains("出院日期")) {
|
|
|
|
+ Integer index = dateString.indexOf("出院日期");
|
|
|
|
+ structureMap.put("入院日期", dateString.substring(0, index));
|
|
|
|
+ structureMap.put("出院日期", dateString.substring(index, dateString.length()));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- //处理主诉被切割到入院诊断的情况
|
|
|
|
if (StringUtils.isNotEmpty(structureMap.get("入院诊断"))) {
|
|
if (StringUtils.isNotEmpty(structureMap.get("入院诊断"))) {
|
|
String diagString = structureMap.get("入院诊断");
|
|
String diagString = structureMap.get("入院诊断");
|
|
if (diagString.contains("。")) {
|
|
if (diagString.contains("。")) {
|
|
Integer index = diagString.indexOf("。");
|
|
Integer index = diagString.indexOf("。");
|
|
structureMap.put("入院诊断", diagString.substring(0, index));
|
|
structureMap.put("入院诊断", diagString.substring(0, index));
|
|
- if(diagString.contains("因") && diagString.contains("入院")) {
|
|
|
|
- if(diagString.indexOf("入院")>(diagString.lastIndexOf("因") + 1)) {
|
|
|
|
- structureMap.put("主诉", diagString.substring(diagString.lastIndexOf("因") + 1, diagString.indexOf("入院")));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- structureMap.put("基本信息",diagString.substring(index, diagString.length()));
|
|
|
|
|
|
+ structureMap.put("基本信息", diagString.substring(index, diagString.length()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //解决出院诊断中包含出院医嘱的情况
|
|
|
|
- if (StringUtils.isNotEmpty(structureMap.get("出院诊断"))&&structureMap.get("出院诊断").contains("出院医嘱")){
|
|
|
|
- String[] strings=structureMap.get("出院诊断").split("出院医嘱");
|
|
|
|
- structureMap.put("出院诊断",strings[0]);
|
|
|
|
- structureMap.put("出院医嘱",strings[1]);
|
|
|
|
- }
|
|
|
|
- //解决出院时情况包含出院诊断的情况
|
|
|
|
- if (StringUtils.isNotEmpty(structureMap.get("出院时情况"))&&structureMap.get("出院时情况").contains("出院诊断")){
|
|
|
|
- String[] strings=structureMap.get("出院时情况").split("出院诊断");
|
|
|
|
- structureMap.put("出院时情况",strings[0]);
|
|
|
|
- structureMap.put("出院诊断",strings[1]);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
XyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
|
|
XyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(e.getMessage(), e);
|
|
log.error(e.getMessage(), e);
|