|
@@ -5,6 +5,7 @@ import com.google.common.collect.Maps;
|
|
|
import com.lantone.qc.pub.Content;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
|
|
|
+import com.lantone.qc.trans.xszyy.util.comsis.XszyyCommonAnalysisUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -13,6 +14,8 @@ import org.jsoup.nodes.Document;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* @Description: 手术知情同意书html解析
|
|
@@ -26,99 +29,60 @@ public class BeiLunOperationInformedHtmlAnalysis implements BeiLunHtmlAnalysis {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, String> analysis(String... args) {
|
|
|
- Map<String, String> structureMap = Maps.newLinkedHashMap();
|
|
|
+ Map<String, String> map = Maps.newLinkedHashMap();
|
|
|
try {
|
|
|
- List<String> titles = Lists.newArrayList(
|
|
|
- "术种使用的植入性材料或高值耗材及风险",
|
|
|
- "医师陈述",
|
|
|
- "患方签名",
|
|
|
- "签字时间",
|
|
|
- "签名时间");
|
|
|
String html = args[0];
|
|
|
String recTitle = args[1];
|
|
|
String recTypeId = args[2];
|
|
|
Document doc = Jsoup.parse(html);
|
|
|
- String htmlContent = XszyyHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
|
|
|
+ List<String> titles = Lists.newArrayList("患者姓名","病区","床号","住院号",
|
|
|
+ "术前诊断","拟施手术名称","术前准备及防范措施","医疗替代方案(不同治疗方案及手术方式)",
|
|
|
+ "拒绝手术可能发生的后果","患者自身存在的高危因素","手术中可能出现的意外和风险","手术后可能出现的意外和并发症",
|
|
|
+ "除上述情况外,本次手术还可能导致下列并发症","患方意见",
|
|
|
+ "患者/法定监护人/被授权人签字","主刀医师签字","审批医师签字"
|
|
|
+ );
|
|
|
+ String htmlContent = XszyyCommonAnalysisUtil.html2String(doc.toString());
|
|
|
if (StringUtil.isNotBlank(htmlContent)) {
|
|
|
- htmlContent = htmlContent.replaceAll("[ ]", " ");
|
|
|
- CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
|
|
|
- }
|
|
|
- CommonAnalysisUtil.extractDateByTitle(structureMap, "记录时间");
|
|
|
- for (String ignoreContrast : ignoreContrasts) {
|
|
|
- if(structureMap.containsKey( ignoreContrast)){
|
|
|
- structureMap.remove(ignoreContrast);
|
|
|
+ //无冒号版本
|
|
|
+ XszyyCommonAnalysisUtil.html2StructureMapNoColon(titles,htmlContent,map);
|
|
|
+ //住院号包含标题
|
|
|
+ if(map.containsKey("住院号")){
|
|
|
+ Pattern pattern = Pattern.compile("[0-9]{1,}");
|
|
|
+ Matcher matcher = pattern.matcher(map.get("住院号"));
|
|
|
+ if (matcher.find()) {
|
|
|
+ map.put("住院号",matcher.group(0));
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- resultHandle(structureMap);
|
|
|
- parseMethod(structureMap);
|
|
|
- XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
- }
|
|
|
- return structureMap;
|
|
|
- }
|
|
|
- private List<String> ignoreContrasts = Lists.newArrayList(
|
|
|
- "医师陈述",
|
|
|
- "患方签名",
|
|
|
- "签字时间",
|
|
|
- "签名时间"
|
|
|
- );
|
|
|
-
|
|
|
- private void parseMethod(Map<String, String> result) {
|
|
|
- if (result.containsKey("术种使用的植入性材料或高值耗材及风险") && StringUtils.isNotEmpty(result.get("术种使用的植入性材料或高值耗材及风险"))) {
|
|
|
- Boolean flag= true;
|
|
|
- String str = result.get("术种使用的植入性材料或高值耗材及风险");
|
|
|
- if(str.contains("\uF0FE无") && str.contains("\uF06F有")){
|
|
|
- result.put("术种使用的植入性材料或高值耗材及风险","false");
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- if(str.contains("\uF06F无") && str.contains("\uF0FE有")){
|
|
|
- /* str = str.split("\uF0FE有")[1];
|
|
|
- str = str.replace(",",",").replace("。",",").replace(" ",",");
|
|
|
- str = str.split(",")[0];
|
|
|
- result.put("植入性材料",str);*/
|
|
|
- result.put("术种使用的植入性材料或高值耗材及风险","true");
|
|
|
- Boolean modelFlag = false;
|
|
|
- for (String model : Content.MODELIST) {
|
|
|
- if(str.contains(model)){
|
|
|
- modelFlag = true;
|
|
|
- break;
|
|
|
+ //患者/法定监护人/被授权人签字存在日期
|
|
|
+ if(map.containsKey("患者/法定监护人/被授权人签字")&&map.get("患者/法定监护人/被授权人签字").contains("日期")){
|
|
|
+ String targetText = map.get("患者/法定监护人/被授权人签字");
|
|
|
+ map.put("患者/法定监护人/被授权人签字",targetText.substring(0,targetText.indexOf("日期")));
|
|
|
+ if(XszyyCommonAnalysisUtil.extractDate(targetText)!=null){
|
|
|
+ map.put("患方签名时间",XszyyCommonAnalysisUtil.extractDate(targetText));
|
|
|
}
|
|
|
}
|
|
|
- Boolean numFlag = false;
|
|
|
- for (String number : Content.NUMBERLIST) {
|
|
|
- if(str.contains(number)){
|
|
|
- numFlag = true;
|
|
|
- break;
|
|
|
+ //主刀医师签字存在日期
|
|
|
+ if(map.containsKey("主刀医师签字")&&map.get("主刀医师签字").contains("日期")){
|
|
|
+ String targetText = map.get("主刀医师签字");
|
|
|
+ map.put("主刀医师签字",targetText.substring(0,targetText.indexOf("日期")));
|
|
|
+ if(XszyyCommonAnalysisUtil.extractDate(targetText)!=null){
|
|
|
+ map.put("主刀医师签字日期",XszyyCommonAnalysisUtil.extractDate(targetText));
|
|
|
}
|
|
|
}
|
|
|
- if(modelFlag && numFlag){
|
|
|
- result.put("型号和数量符合要求","true");
|
|
|
+ //审批医师签字存在日期
|
|
|
+ if(map.containsKey("审批医师签字")&&map.get("审批医师签字").contains("日期")){
|
|
|
+ String targetText = map.get("审批医师签字");
|
|
|
+ map.put("审批医师签字",targetText.substring(0,targetText.indexOf("日期")));
|
|
|
+ if(XszyyCommonAnalysisUtil.extractDate(targetText)!=null){
|
|
|
+ map.put("审批医师签字日期",XszyyCommonAnalysisUtil.extractDate(targetText));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- if(flag){
|
|
|
- result.put("术种使用的植入性材料或高值耗材及风险","");
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
- private void resultHandle(Map<String, String> result) {
|
|
|
- if (MapUtils.isEmpty(result)) {
|
|
|
- return;
|
|
|
+ XszyyHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, map);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
}
|
|
|
- result.forEach((key, value) -> {
|
|
|
- if (StringUtil.isNotBlank(value)) {
|
|
|
- value = StringUtil.trim(value);
|
|
|
- if (value.endsWith(";") || value.endsWith(";")) {
|
|
|
- value = value.substring(0, value.length() - 1);
|
|
|
- }
|
|
|
- result.put(key, value);
|
|
|
- }
|
|
|
- });
|
|
|
+ return map;
|
|
|
}
|
|
|
}
|