Просмотр исходного кода

普通病程录问题由mrqc端修改

wangsy 4 лет назад
Родитель
Сommit
af22338a8e

+ 71 - 83
trans/src/main/java/com/lantone/qc/trans/beilun/BeiLunThreeLevelWardDocTrans.java

@@ -34,7 +34,6 @@ import java.util.*;
 public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
 
     private List<OperationDoc> operationDocs;
-    private List<String> containList = Arrays.asList("查房", "主任", "主治", "主刀", "日常病程", "病程记录", "术后第");
 
     @Override
     public List<ThreeLevelWardDoc> extract(MedrecVo medrecVo) {
@@ -53,89 +52,78 @@ public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
     }
 
     private void classifyThreeLevelWardDoc(ThreeLevelWardDoc threeLevelWardDoc, Map<String, Object> contentMap) {
-        if (contentMap.get("recTitle") != null && StringUtil.isNotBlank(contentMap.get("recTitle").toString())) {
-            boolean flag = false;
-            for (String word : containList) {
-                if (contentMap.get("recTitle").toString().contains(word)) {
-                    flag = true;
-                    break;
-                }
+        String content = contentMap.get("xmlText").toString();
+        Map<String, String> structureMap = null;
+        if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
+            structureMap = (Map) FastJsonUtils.getJsonToMap(content);
+        } else {
+            String recTitle = contentMap.get("recTitle").toString();
+            String recTypeId = contentMap.get("recTypeId").toString();
+            BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunThreeLevelWardHtmlAnalysis();
+            Map<String, String> sourceMap = beiLunHtmlAnalysis.analysis(content, recTitle, recTypeId);
+            if (MapUtils.isNotEmpty(sourceMap)) {
+                structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
+                structureMap.put("记录编号", contentMap.get("recId").toString());
+                structureMap.put("病历号", contentMap.get("behospitalCode") == null ? null : contentMap.get("behospitalCode").toString());
             }
-            if (flag) {
-                String content = contentMap.get("xmlText").toString();
-                Map<String, String> structureMap = null;
-                if (contentMap.get("isParsed") != null && "1".equals(contentMap.get("isParsed").toString())) {
-                    structureMap = (Map) FastJsonUtils.getJsonToMap(content);
-                } else {
-                    String recTitle = contentMap.get("recTitle").toString();
-                    String recTypeId = contentMap.get("recTypeId").toString();
-                    BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunThreeLevelWardHtmlAnalysis();
-                    Map<String, String> sourceMap = beiLunHtmlAnalysis.analysis(content, recTitle, recTypeId);
-                    if (MapUtils.isNotEmpty(sourceMap)) {
-                        structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
-                        structureMap.put("记录编号", contentMap.get("recId").toString());
-                        structureMap.put("病历号", contentMap.get("behospitalCode") == null ? null : contentMap.get("behospitalCode").toString());
-                    }
-                }
-                if (MapUtils.isEmpty(structureMap)) {
-                    return;
-                }
-
-                if (structureMap.containsKey("病情记录")) {
-                    structureMap.put("病情记录", structureMap.get("病情记录").replace(" ", ""));
-                }
-                //structureMap.put("查房日期", structureMap.get("记录时间"));
+        }
+        if (MapUtils.isEmpty(structureMap)) {
+            return;
+        }
 
-                /*Map<String, String> cutWordMap = Maps.newHashMap();
-                String text = CxXmlUtil.getXmlText(content);
-                if (StringUtil.isNotBlank(text)) {
-                    if (StringUtil.isBlank(structureMap.get("病情记录"))) {
-                        structureMap.put("病情记录", text);
+        if (structureMap.containsKey("病情记录")) {
+            structureMap.put("病情记录", structureMap.get("病情记录").replace(" ", ""));
+        }
+        //structureMap.put("查房日期", structureMap.get("记录时间"));
+        /*Map<String, String> cutWordMap = Maps.newHashMap();
+        String text = CxXmlUtil.getXmlText(content);
+        if (StringUtil.isNotBlank(text)) {
+            if (StringUtil.isBlank(structureMap.get("病情记录"))) {
+                structureMap.put("病情记录", text);
+            }
+            cutWordMap = Preproc.getCutWordMap(true, sourceTitles, text);
+            if (StringUtil.isBlank(structureMap.get("记录医师"))) {
+                Pattern p = Pattern.compile("^[^\\u4e00-\\u9fa5]+$");//分词结果如果不包含中文为日期,则不覆盖
+                if (StringUtil.isNotEmpty(cutWordMap.get("医师签名"))) {
+                    Matcher m = p.matcher(cutWordMap.get("医师签名"));
+                    if (!m.matches()) {
+                        structureMap.put("记录医师", cutWordMap.get("医师签名"));
                     }
-                    cutWordMap = Preproc.getCutWordMap(true, sourceTitles, text);
-                    if (StringUtil.isBlank(structureMap.get("记录医师"))) {
-                        Pattern p = Pattern.compile("^[^\\u4e00-\\u9fa5]+$");//分词结果如果不包含中文为日期,则不覆盖
-                        if (StringUtil.isNotEmpty(cutWordMap.get("医师签名"))) {
-                            Matcher m = p.matcher(cutWordMap.get("医师签名"));
-                            if (!m.matches()) {
-                                structureMap.put("记录医师", cutWordMap.get("医师签名"));
-                            }
-                        }
-                        if (StringUtil.isNotEmpty(cutWordMap.get("记录医生"))) {
-                            Matcher m = p.matcher(cutWordMap.get("记录医生"));
-                            if (!m.matches()) {
-                                structureMap.put("记录医师", cutWordMap.get("记录医生"));
-                            }
-                        }
+                }
+                if (StringUtil.isNotEmpty(cutWordMap.get("记录医生"))) {
+                    Matcher m = p.matcher(cutWordMap.get("记录医生"));
+                    if (!m.matches()) {
+                        structureMap.put("记录医师", cutWordMap.get("记录医生"));
                     }
                 }
-                 */
+            }
+        }
+         */
 
-                //总的查房记录 汇总
-                ThreeLevelWardDoc allDoctorWradDoc = new ThreeLevelWardDoc();
-                allDoctorWradDoc.setStructureMap(structureMap);
-                allDoctorWradDoc.setPageData((Map) structureMap);
-                threeLevelWardDoc.addAllDoctorWradDoc(allDoctorWradDoc);
+        //总的查房记录 汇总
+        ThreeLevelWardDoc allDoctorWradDoc = new ThreeLevelWardDoc();
+        allDoctorWradDoc.setStructureMap(structureMap);
+        allDoctorWradDoc.setPageData((Map) structureMap);
+        threeLevelWardDoc.addAllDoctorWradDoc(allDoctorWradDoc);
 
-                //主任医师查房
-                DirectorDoctorWardDoc directorDoctorWardDoc = findDirectorDoctorWardDoc(structureMap);
-                if (directorDoctorWardDoc != null) {
-                    threeLevelWardDoc.addDirectorDoctorWardDoc(findDirectorDoctorWardDoc(structureMap));
-                }
-                //主治医师查房
-                AttendingDoctorWardDoc attendingDoctorWardDoc = findAttendingDoctorWardDoc(structureMap);
-                if (attendingDoctorWardDoc != null) {
-                    threeLevelWardDoc.addAttendingDoctorWardDoc(attendingDoctorWardDoc);
-                }
-                //普通医师查房
-                if (directorDoctorWardDoc == null && attendingDoctorWardDoc == null) {
-                    GeneralDoctorWardDoc generalDoctorWardDoc = new GeneralDoctorWardDoc();
-                    generalDoctorWardDoc.setStructureMap(structureMap);
-                    generalDoctorWardDoc.setPageData((Map) structureMap);
-                    threeLevelWardDoc.addGeneralDoctorWardDoc(generalDoctorWardDoc);
-                }
-            }
+        //主任医师查房
+        DirectorDoctorWardDoc directorDoctorWardDoc = findDirectorDoctorWardDoc(structureMap);
+        if (directorDoctorWardDoc != null) {
+            threeLevelWardDoc.addDirectorDoctorWardDoc(findDirectorDoctorWardDoc(structureMap));
+        }
+        //主治医师查房
+        AttendingDoctorWardDoc attendingDoctorWardDoc = findAttendingDoctorWardDoc(structureMap);
+        if (attendingDoctorWardDoc != null) {
+            threeLevelWardDoc.addAttendingDoctorWardDoc(attendingDoctorWardDoc);
         }
+        //普通医师查房
+        if (directorDoctorWardDoc == null && attendingDoctorWardDoc == null) {
+            GeneralDoctorWardDoc generalDoctorWardDoc = new GeneralDoctorWardDoc();
+            generalDoctorWardDoc.setStructureMap(structureMap);
+            generalDoctorWardDoc.setPageData((Map) structureMap);
+            threeLevelWardDoc.addGeneralDoctorWardDoc(generalDoctorWardDoc);
+        }
+
     }
 
     /**
@@ -160,7 +148,7 @@ public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
                 title = title.replace("一助", doctorTitle);
             }
             if ((StringUtils.isNotEmpty(subTitle(title)) && subTitle(title).contains("主任")) || findDirector(content)
-                    || title.contains("三级医师查房")) {
+                    || title.contains("三级")) {
                 directorDoctorWardDoc = new DirectorDoctorWardDoc();
                 directorDoctorWardDoc.setStructureMap(structureMap);
                 directorDoctorWardDoc.setPageData((Map) structureMap);
@@ -176,7 +164,7 @@ public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
                 writTitle = writTitle.replace("一助", doctorTitle);
             }
             if ((StringUtils.isNotEmpty(subTitle(writTitle)) && subTitle(writTitle).contains("主任")) || findDirector(content)
-                    || writTitle.contains("三级医师查房")) {
+                    || writTitle.contains("三级")) {
                 directorDoctorWardDoc = new DirectorDoctorWardDoc();
                 directorDoctorWardDoc.setStructureMap(structureMap);
                 directorDoctorWardDoc.setPageData((Map) structureMap);
@@ -207,7 +195,7 @@ public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
                 title = title.replace("一助", doctorTitle);
             }
             if ((StringUtils.isNotEmpty(subTitle(title)) && subTitle(title).contains("主治"))
-                    || findAttend(content) || title.contains("三级医师查房")) {
+                    || findAttend(content) || title.contains("三级")) {
                 attendingDoctorWardDoc = new AttendingDoctorWardDoc();
                 attendingDoctorWardDoc.setStructureMap(structureMap);
                 attendingDoctorWardDoc.setPageData((Map) structureMap);
@@ -224,7 +212,7 @@ public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
                 writTitle = writTitle.replace("一助", doctorTitle);
             }
             if ((StringUtils.isNotEmpty(subTitle(writTitle)) && subTitle(writTitle).contains("主治"))
-                    || findAttend(content) || writTitle.contains("三级医师查房")) {
+                    || findAttend(content) || writTitle.contains("三级")) {
                 attendingDoctorWardDoc = new AttendingDoctorWardDoc();
                 attendingDoctorWardDoc.setStructureMap(structureMap);
                 attendingDoctorWardDoc.setPageData((Map) structureMap);
@@ -299,10 +287,10 @@ public class BeiLunThreeLevelWardDocTrans extends ModelDocTrans {
             Map<String, String> structureMap = operationRecordDoc.getStructureMap();
             String chiefSurgeon = structureMap.get(findTitle);
             String operatorEndDateStr = structureMap.get("手术结束时间");
-            if(StringUtil.isBlank(chiefSurgeon)){
+            if (StringUtil.isBlank(chiefSurgeon)) {
                 chiefSurgeon = structureMap.get("手术者及助手名称");
-                if(StringUtil.isNotBlank(chiefSurgeon) && chiefSurgeon.contains("、")){
-                    chiefSurgeon = chiefSurgeon.split("、")[0].replace("主刀:","");
+                if (StringUtil.isNotBlank(chiefSurgeon) && chiefSurgeon.contains("、")) {
+                    chiefSurgeon = chiefSurgeon.split("、")[0].replace("主刀:", "");
                 }
             }
             if (StringUtil.isBlank(chiefSurgeon) || StringUtil.isBlank(operatorEndDateStr)) {

+ 0 - 111
trans/src/main/java/com/lantone/qc/trans/beilun/BeilunDocTrans.java

@@ -1,7 +1,5 @@
 package com.lantone.qc.trans.beilun;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.TypeReference;
 import com.google.common.collect.Lists;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.vo.MedrecVo;
@@ -27,27 +25,6 @@ public class BeilunDocTrans extends DocTrans {
     @Override
     protected InputInfo extract(QueryVo queryVo) {
         InputInfo inputInfo = new InputInfo();
-
-        List<MedrecVo> medrecVoList = new ArrayList<>();
-        for (MedrecVo i : queryVo.getMedrec()) {
-            if (i.getTitle() != null && i.getTitle().equals("查房记录")) {
-                List<Map<String, Object>> contentMaps = (List) i.getContent().get("content");
-                contentMaps.forEach(contentMap -> {
-                    try {
-                        threeLevelWardAnalyse(queryVo, medrecVoList, contentMap);
-                    } catch (Exception e) {
-                        log.error(e.getMessage(), e);
-                    }
-                });
-            }
-        }
-
-        if (medrecVoList.size() > 0 && medrecVoList != null) {
-            for (MedrecVo i : medrecVoList) {
-                queryVo.getMedrec().add(i);
-            }
-        }
-
         for (MedrecVo i : queryVo.getMedrec()) {
             if (i.getTitle() != null) {
                 if (i.getTitle().equals("会诊")) {
@@ -283,92 +260,4 @@ public class BeilunDocTrans extends DocTrans {
             }
         }
     }
-
-    private void threeLevelWardAnalyse(QueryVo queryVo, List<MedrecVo> medrecVoList, Map<String, Object> contentMap) {
-        String recTitle = contentMap.get("recTitle").toString();
-        if (StringUtil.isNotBlank(recTitle)) {
-            if (recTitle.contains("会诊记录")) {
-                consultationAnalyseMap(queryVo, medrecVoList, contentMap, "会诊记录", "会诊");
-            }
-            if (recTitle.contains("输血制品病程") || recTitle.contains("输血记录") || recTitle.contains("输血病程记录")) {
-                commonAnalyseList(queryVo, medrecVoList, contentMap, "输血/血制品病程记录");
-            }
-            if (recTitle.contains("输血") && (recTitle.contains("评价") || recTitle.contains("评估"))) {
-                commonAnalyseList(queryVo, medrecVoList, contentMap, "输血后效果评价");
-            }
-            if (recTitle.contains("术后首次") && recTitle.contains("病程")) {
-                consultationAnalyseMap(queryVo, medrecVoList, contentMap, "术后首次病程及谈话记录", "手术");
-            }
-            if (recTitle.contains("危急值") && recTitle.contains("记录")) {
-                commonAnalyseList(queryVo, medrecVoList, contentMap, "危急值记录");
-            }
-        }
-    }
-
-    //(List)
-    private void commonAnalyseList(QueryVo queryVo, List<MedrecVo> medrecVoList, Map<String, Object> contentMap, String recTitle) {
-        boolean flag = true;
-        List<Map<String, Object>> specialContent = new ArrayList<>();
-        Map<String, Object> keyContent = new LinkedHashMap<>();
-        for (MedrecVo i : queryVo.getMedrec()) {
-            if (recTitle.contains(i.getTitle())) {
-                flag = false;
-                keyContent = i.getContent();
-                try {
-                    specialContent = JSON.parseObject(JSON.toJSONString(keyContent.get("content")), new TypeReference<List<Map<String, Object>>>() {
-                    });
-                    specialContent.add(contentMap);
-                    keyContent.put("content", specialContent);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        if (flag) {
-            MedrecVo medrecVo = new MedrecVo();
-            medrecVo.setTitle(recTitle);
-            specialContent.add(contentMap);
-            keyContent.put("content", specialContent);
-            medrecVo.setContent(keyContent);
-            medrecVo.setLabel(null);
-            medrecVoList.add(medrecVo);
-        }
-    }
-
-    //(Map)
-    private void consultationAnalyseMap(QueryVo queryVo, List<MedrecVo> medrecVoList, Map<String, Object> contentMap, String recTitle, String title) {
-        boolean flag = true;
-        Map<String, List<Map<String, Object>>> specialContent = new LinkedHashMap<>();
-        List<Map<String, Object>> recordContentDTOS = new ArrayList<>();
-        Map<String, Object> keyContent = new LinkedHashMap<>();
-        for (MedrecVo i : queryVo.getMedrec()) {
-            if (recTitle.contains(i.getTitle())) {
-                flag = false;
-                recordContentDTOS.add(contentMap);
-                keyContent = i.getContent();
-                try {
-                    specialContent = JSON.parseObject(JSON.toJSONString(keyContent.get("content")), new TypeReference<Map<String, List<Map<String, Object>>>>() {
-                    });
-                    if (specialContent.containsKey(recTitle)) {
-                        specialContent.get(recTitle).add(contentMap);
-                    } else {
-                        specialContent.put(recTitle, recordContentDTOS);
-                    }
-                    keyContent.put("content", specialContent);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-        if (flag) {
-            MedrecVo medrecVo = new MedrecVo();
-            medrecVo.setTitle(title);
-            recordContentDTOS.add(contentMap);
-            specialContent.put(recTitle, recordContentDTOS);
-            keyContent.put("content", specialContent);
-            medrecVo.setContent(keyContent);
-            medrecVo.setLabel(null);
-            medrecVoList.add(medrecVo);
-        }
-    }
 }