|
@@ -8,9 +8,12 @@ import com.lantone.structure.model.doc.DutyShiftSystemDoc;
|
|
|
import com.lantone.structure.util.MapUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
+import java.io.*;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.CopyOnWriteArraySet;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description:交接班记录
|
|
@@ -36,13 +39,14 @@ public class DutyShiftSystemTran extends TargetTran {
|
|
|
private Map<String, String> cutWord(String text) {
|
|
|
Map<String, String> sourceMap = Maps.newHashMap();
|
|
|
List<String> titles = CommonAnalysisUtil.sortTitles(
|
|
|
- Lists.newArrayList("入院日期","交班日期","接班日期","主 诉","入院情况","入院诊断","诊治经过","目前诊断", "治疗情况", "诊疗计划","交班注意事项"),
|
|
|
+ Lists.newArrayList("入院日期","交班日期","接班日期","主 诉","入院情况","入院诊断","诊治经过","目前诊断", "治疗情况", "查体","诊疗计划","交班注意事项"),
|
|
|
text
|
|
|
);
|
|
|
CommonAnalysisUtil.cutByTitles(text, titles, 0, sourceMap);
|
|
|
- if(sourceMap.containsKey("入院诊断") ||sourceMap.containsKey("目前诊断")){
|
|
|
+ if(sourceMap.containsKey("入院诊断") ||sourceMap.containsKey("目前诊断") ||sourceMap.containsKey("查体")){
|
|
|
sourceMap.remove("入院诊断");
|
|
|
sourceMap.remove("目前诊断");
|
|
|
+ sourceMap.remove("查体");
|
|
|
}
|
|
|
return sourceMap;
|
|
|
}
|
|
@@ -60,8 +64,88 @@ public class DutyShiftSystemTran extends TargetTran {
|
|
|
);
|
|
|
|
|
|
public void dutyShiftSystemContrast ( List<DutyShiftSystemDoc> dutyShiftSystemDocs,Map<String, String> retMap) {
|
|
|
+ Set<String> sourceList = StreamSovle();
|
|
|
+ Set<String> targetSet = new CopyOnWriteArraySet<>();
|
|
|
+ List<String> sortList = new ArrayList<>();
|
|
|
String text = dutyShiftSystemDocs.get(0).getText();
|
|
|
String fir = text;
|
|
|
+ if(StringUtil.isNotEmpty(retMap.get("治疗情况"))){
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ String cureCondition= retMap.get("治疗情况");
|
|
|
+ if(cureCondition.contains("查体:")){
|
|
|
+ cureCondition = cureCondition.substring(0,cureCondition.lastIndexOf("查体:"));
|
|
|
+ }
|
|
|
+ cureCondition = cureCondition .replace("。",",").replace(":",",");
|
|
|
+
|
|
|
+ String[] split = cureCondition.split(",");
|
|
|
+ for (String str : split) {
|
|
|
+ if(str.contains("、")){
|
|
|
+ String[] splits = str.split("、");
|
|
|
+ Boolean flag = false;
|
|
|
+ for (int i = 0; i < splits.length; i++) {
|
|
|
+ if(i == 0 && splits[0].contains("无")){
|
|
|
+ flag = true;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(flag && !splits[i].contains("无")){
|
|
|
+ cureCondition = cureCondition.replace(splits[i],"无"+splits[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //标准关系语句
|
|
|
+ String keep = cureCondition;
|
|
|
+ sourceList.parallelStream().filter(obj->keep.contains(obj) && StringUtil.isNotEmpty(obj)).map(obj->targetSet.add(obj)).collect(Collectors.toList());
|
|
|
+ Set<String> deleteSet = new HashSet<>();
|
|
|
+ String[] splitStr = keep.split(",");
|
|
|
+ for (String str : splitStr) {
|
|
|
+ String flagStr = "无";
|
|
|
+ if(!str.contains("无") && str.contains("不")){
|
|
|
+ flagStr = "不";
|
|
|
+ }
|
|
|
+ for (String strFir : targetSet) {
|
|
|
+ if(str.contains(flagStr) && str.contains(strFir) && ! strFir.contains(flagStr)){
|
|
|
+ //命中不准的关键词删除
|
|
|
+ deleteSet.add(strFir);
|
|
|
+ }
|
|
|
+ //按照顺序返回关键词
|
|
|
+ if(str.contains(strFir)){
|
|
|
+ sortList.add(strFir);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //包含关系的关键词也进行删除
|
|
|
+ for (String strFir : targetSet) {
|
|
|
+ for (String strSec : targetSet) {
|
|
|
+ if(!strFir.equals(strSec) && strFir.contains(strSec)){
|
|
|
+ deleteSet.add(strSec);
|
|
|
+ }
|
|
|
+ if(targetSet.size()>1 && "无".equals(strFir)){
|
|
|
+ deleteSet.add("无");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //List去重
|
|
|
+ List<String> tempList = new ArrayList<String>();
|
|
|
+ Iterator it = sortList.iterator();
|
|
|
+ while(it.hasNext()) {
|
|
|
+ String obj = it.next().toString();
|
|
|
+ if(!tempList.contains(obj)) {
|
|
|
+ tempList.add(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String str : deleteSet) {
|
|
|
+ tempList.remove(str);
|
|
|
+ }
|
|
|
+ for (String str : tempList) {
|
|
|
+ sb.append(str+" ");
|
|
|
+ }
|
|
|
+ if(StringUtil.isNotEmpty(sb.toString())){
|
|
|
+ retMap.put("治疗情况",sb.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(StringUtil.isNotEmpty(retMap.get("诊疗计划"))){
|
|
|
String subStr = text.substring(text.indexOf("诊疗计划:")+"诊疗计划:".length());
|
|
|
String planRet = retMap.get("诊疗计划");
|
|
@@ -92,6 +176,31 @@ public class DutyShiftSystemTran extends TargetTran {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public Set<String> StreamSovle() {
|
|
|
+ Set<String> sourceList = new HashSet<>();
|
|
|
+ try {
|
|
|
+ InputStream is = this.getClass().getResourceAsStream("/交接班记录目前情况.txt");
|
|
|
+ InputStreamReader in = new InputStreamReader(is);
|
|
|
+ BufferedReader bIn = new BufferedReader(in);
|
|
|
+ String line = null;
|
|
|
+ while ((line = bIn.readLine()) != null) {
|
|
|
+ line = line+"\n";
|
|
|
+ if(StringUtil.isNotEmpty(line) && StringUtil.isNotEmpty(line.trim())){
|
|
|
+ sourceList.add(line.trim());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ in.close();
|
|
|
+ bIn.close();
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return sourceList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public static void mapKeyContrastCommon(Map sourceMap, List<String> keyContrasts, Map<String, String> retMap) {
|
|
|
Map<String, String> sourceMap_ = MapUtil.copyMap(sourceMap);
|
|
|
String[] arry = null;
|