|
@@ -3,13 +3,17 @@ package com.lantone.qc.trans.beilun.util;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.lantone.qc.trans.comsis.CommonAnalysisUtil;
|
|
|
+import com.lantone.qc.trans.comsis.OrdinaryAssistant;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jsoup.Jsoup;
|
|
|
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解析
|
|
@@ -40,10 +44,14 @@ public class BeiLunInvasiveOperationHtmlAnalysis implements BeiLunHtmlAnalysis {
|
|
|
Document doc = Jsoup.parse(html);
|
|
|
String htmlContent = BeiLunHtmlAnalysisUtil.blockDivToStr(doc.selectFirst("body").child(0), false);
|
|
|
CommonAnalysisUtil.html2StructureMap(titles, htmlContent, structureMap);
|
|
|
- String cases = getKeyCut(structureMap.get("术后注意事项"));
|
|
|
+ if (MapUtils.isNotEmpty(structureMap)) {
|
|
|
+ structureMap = OrdinaryAssistant.mapKeyContrast(structureMap, keyContrasts);
|
|
|
+ }
|
|
|
+ String cases = getKeyCut(structureMap.get("术后注意"));
|
|
|
if(StringUtils.isNotBlank(cases)){
|
|
|
- structureMap.put("术后注意事项",cases);
|
|
|
+ structureMap.put("术后注意",cases);
|
|
|
}
|
|
|
+ structureMap = preSolve(htmlContent, structureMap);
|
|
|
BeiLunHtmlAnalysisUtil.insertModuleId(modeId, recTypeId, structureMap);
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|
|
@@ -51,6 +59,31 @@ public class BeiLunInvasiveOperationHtmlAnalysis implements BeiLunHtmlAnalysis {
|
|
|
return structureMap;
|
|
|
}
|
|
|
|
|
|
+ private List<String> keyContrasts = Lists.newArrayList(
|
|
|
+ "操作简要经过(包括术中有无并发症及具体描述和处理)=操作步骤",
|
|
|
+ "术后注意事项=术后注意"
|
|
|
+ );
|
|
|
+
|
|
|
+ Map<String, String>preSolve(String content,Map<String, String>structureMap){
|
|
|
+ String rex = "[\\s\\S]*[(?=无)|(?=有)][^,;,;。]{0,3}(?=不适)[\\s\\S]*";
|
|
|
+ Pattern p = Pattern.compile(rex);
|
|
|
+ Matcher m = p.matcher(content);
|
|
|
+ String result = "";
|
|
|
+ while (m.find()) {
|
|
|
+ result = m.group().trim();
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(result)){
|
|
|
+ structureMap.put("有无记录不良反应","true");
|
|
|
+ }else{
|
|
|
+ structureMap.put("有无记录不良反应","false");
|
|
|
+ }
|
|
|
+ if(structureMap.containsKey("术后注意") && structureMap.get("术后注意").matches(rex)){
|
|
|
+ structureMap.put("有无记录不良反应","false");
|
|
|
+}
|
|
|
+
|
|
|
+ return structureMap;
|
|
|
+ };
|
|
|
+
|
|
|
String getKeyCut(String key){
|
|
|
if(StringUtils.isBlank(key)){
|
|
|
return key;
|