浏览代码

交接班记录日常情况字段二次解析兼容短文本 病危通知书:病情概括及主要抢救措施

chengyao 4 年之前
父节点
当前提交
76e8f9a8aa

+ 1 - 1
structure-center/src/main/java/com/lantone/structure/facade/tran/CriticallyIllNoticeDocTran.java

@@ -77,7 +77,7 @@ public class CriticallyIllNoticeDocTran extends TargetTran {
                 sb.append(key + ":" + sourceMap.get(key)).append("\r\n");
             }
         }
-        sourceMap.put("病情概及主要抢救措施", sb.toString());
+        sourceMap.put("病情概及主要抢救措施", sb.toString());
     }
 
     private List<String> keyContrasts = Lists.newArrayList(

+ 63 - 49
structure-center/src/main/java/com/lantone/structure/facade/tran/DutyShiftSystemTran.java

@@ -65,18 +65,26 @@ public class DutyShiftSystemTran extends TargetTran {
 
     public void dutyShiftSystemContrast ( List<DutyShiftSystemDoc> dutyShiftSystemDocs,Map<String, String> retMap) {
         Set<String> sourceList = StreamSovle();
-            Set<String> targetSet = new CopyOnWriteArraySet<>();
+        Set<String> targetSet = new CopyOnWriteArraySet<>();
         List<String> sortList = new ArrayList<>();
+        Set<String> deleteSet = new HashSet<>();
         String text = dutyShiftSystemDocs.get(0).getText();
         String fir = text;
+        String cureCondition = "";
+        //治疗情况
+        StringBuilder sb = new StringBuilder();
         if(StringUtil.isNotEmpty(retMap.get("治疗情况"))){
-            StringBuilder sb = new StringBuilder();
-            String cureCondition= retMap.get("治疗情况");
+             cureCondition= retMap.get("治疗情况");
             if(cureCondition.contains("查体:")){
                 cureCondition = cureCondition.substring(0,cureCondition.lastIndexOf("查体:"));
             }
-            cureCondition = cureCondition .replace("。",",").replace(":",",");
-
+        }else{
+            //兼容短文档
+            cureCondition = text;
+        }
+        cureCondition = cureCondition .replace("。",",").replace(":",",");
+        //转换为标准关系语句  无发热、头痛-> 无发热、无头痛
+        if(cureCondition.contains(",")){
             String[] split = cureCondition.split(",");
             for (String str : split) {
                 if(str.contains("、")){
@@ -93,58 +101,64 @@ public class DutyShiftSystemTran extends TargetTran {
                     }
                 }
             }
-            //标准关系语句
-          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);
-                    }
-                }
+        }
+
+        //标准关系语句
+        String keep = cureCondition;
+        sourceList.parallelStream().filter(obj->keep.contains(obj) && StringUtil.isNotEmpty(obj)).map(obj->targetSet.add(obj)).collect(Collectors.toList());
+        String[] splitStr = {keep};
+        if(keep.contains(",")){
+            splitStr = keep.split(",");
+        }
+
+        for (String str : splitStr) {
+            String flagStr = "无";
+            if(!str.contains("无") && str.contains("不")){
+                flagStr = "不";
             }
-            //包含关系的关键词也进行删除
             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("无");
-                    }
+                if(str.contains(flagStr) && str.contains(strFir) && ! strFir.contains(flagStr)){
+                    //命中不准的关键词删除
+                    deleteSet.add(strFir);
                 }
-            }
-
-            //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);
+                //按照顺序返回关键词
+                if(str.contains(strFir)){
+                    sortList.add(strFir);
                 }
             }
-            for (String str : deleteSet) {
-                tempList.remove(str);
-            }
-            for (String str : tempList) {
-                sb.append(str+" ");
+        }
+        //包含关系的关键词也进行删除
+        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("无");
+                }
             }
-            if(StringUtil.isNotEmpty(sb.toString())){
-                retMap.put("治疗情况",sb.toString());
+        }
+
+        //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());