소스 검색

长兴入院记录对接修改

rengb 5 년 전
부모
커밋
8c328cba91

+ 104 - 37
trans/src/main/java/com/lantone/qc/trans/changx/ChangxBeHospitalizedDocTrans.java

@@ -1,10 +1,12 @@
 package com.lantone.qc.trans.changx;
 
+import com.google.common.collect.Lists;
 import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.vo.MedrecVo;
 import com.lantone.qc.trans.ModelDocTrans;
 import com.lantone.qc.trans.changx.util.CxXmlUtil;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
+import com.lantone.qc.trans.comsis.OrdinaryAssistant;
 
 import java.util.List;
 import java.util.Map;
@@ -19,45 +21,110 @@ public class ChangxBeHospitalizedDocTrans extends ModelDocTrans {
     @Override
     public BeHospitalizedDoc extract(MedrecVo medrecVo) {
         String content = ((List<String>) medrecVo.getContent().get("content")).get(0);
-        /*
-        int index1 = content.indexOf("初步诊断") + 5;
-        int index2 = content.indexOf("\n", index1) - 1;
-        if (index1 < index2) {
-            content = content.substring(0, index1)
-                    + StringUtil.specialCharComma(content.substring(index1, index2))
-                    + content.substring(index2);
-        }
-
-        int index3 = content.indexOf("辅助检查");
-        content = content.substring(0, index3) + "\n" + content.substring(index3);
-
-        List<String> targetTitles = Lists.newArrayList();
-        List<String> sourceTitles = ListUtil.isEmpty(medrecVo.getLabel()) ? TextTypeStandardKeys.beHospitalized : medrecVo.getLabel();
-        sourceTitles.forEach(sourceTitle -> {
-            String targetTitle = "";
-            for (int index = 0; index < sourceTitle.length(); index++) {
-                if (index == sourceTitle.length() - 1) {
-                    targetTitle += sourceTitle.substring(index, index + 1);
-                } else {
-                    targetTitle += sourceTitle.substring(index, index + 1) + "[\\s\\p{Zs}]*";
-                }
-            }
-            targetTitles.add(targetTitle);
-        });
-
-        Map<String, String> sourceMap = Preproc.extract_doc_pub(false, targetTitles, content);
-        Map<String, String> targetMap = MapUtil.copyMap((Map) sourceMap);
-        targetMap.put("体格检查", targetMap.get("体格检查(一)"));
-        targetMap.put("专科体格检查", targetMap.get("体格检查(二)"));
-        targetMap.remove("体格检查(一)");
-        targetMap.remove("体格检查(二)");
-         */
-        Map<String, String> structureMap = CxXmlUtil.beHospitalizedXmlToMap(content);
-
+        Map<String, String> sourceMap = CxXmlUtil.firstLevelNodeValue("//DocObjContent", content);
+        String tgjc = sourceMap.get("一般情况") + "。"
+                + sourceMap.get("皮肤情况") + "。"
+                + sourceMap.get("淋巴") + "。"
+                + sourceMap.get("头部检查") + "。"
+                + sourceMap.get("颈部") + "。"
+                + sourceMap.get("胸部检查") + "。"
+                + sourceMap.get("肺部检查") + "。"
+                + sourceMap.get("心脏检查") + "。"
+                + sourceMap.get("血管") + "。"
+                + sourceMap.get("腹部检查") + "。"
+                + sourceMap.get("外生殖器") + "。"
+                + sourceMap.get("直肠肛门") + "。"
+                + sourceMap.get("四肢脊柱检查") + "。"
+                + sourceMap.get("神经系统检查") + "。"
+                + sourceMap.get("其他说明") + "。";
+        sourceMap.put("体格检查(二)", tgjc);
+        Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
         BeHospitalizedDoc beHospitalizedDoc = ModelDocGenerate.beHospitalizedDocGen(structureMap);
-        beHospitalizedDoc.setPageData((Map) structureMap);
-
+        beHospitalizedDoc.setPageData((Map) sourceMap);
         return beHospitalizedDoc;
     }
 
+    private List<String> keyContrasts = Lists.newArrayList(
+            "姓名++++患者姓名=姓名",
+            "性别=",
+            "病区++++病区名称=",
+            "床号=",
+            "病案号++++住院号=",
+            "病人姓名++++患者姓名=",
+            "职业=",
+            "工作单位++++工作单位地址=",
+            "年龄=",
+            "出生地++++出生地(住院)=出生地",
+            "出生日期=",
+            "户口地址=",
+            "婚姻状况++++婚姻=婚姻",
+            "联系电话=电话",
+            "民族=",
+            "入院日期=",
+            "供史者++++病史叙述者=病史陈述者",
+            "记录日期=",
+            "主诉=",
+            "现病史=",
+            "既往史=",
+            "目前使用的药物=",
+            "成瘾药物=",
+            "个人史=",
+            "月经史=",
+            "婚育史:=婚育史",
+            "家族史=",
+            "辅助检查=",
+            "体重指数++++体重指数(BMI)=",
+            "++++复选框=",
+            "营养风险评分=",
+            "请营养科会诊=",
+            "ADL评分分级=",
+            "康复科会诊++++康复科会诊1=",
+            "康复科会诊++++康复科会诊2=",
+            "++++心理评估1=",
+            "++++心理评估2=",
+            "++++心理卫生科会诊1=",
+            "++++心理卫生科会诊2=",
+            "Caprini评估++++=",
+            "出血风险=",
+            "初步诊断=",
+            "需求评估=",
+            "预期目标=",
+            "诊疗计划=",
+            "治疗监测计划=",
+            "签名++++=",
+            "签名时间=",
+            "补充诊断=",
+            "修正诊断=",
+            "签名时间++++补充诊断签名时间=",
+            "签名时间++++修正签名时间=",
+            "一般情况=",
+            "皮肤情况=",
+            "淋巴=",
+            "头部检查=",
+            "颈部=",
+            "胸部检查=",
+            "肺部检查=",
+            "心脏检查=",
+            "血管=",
+            "腹部检查=",
+            "外生殖器++++外生殖器文本框=",
+            "直肠肛门=",
+            "四肢脊柱检查=",
+            "神经系统检查=",
+            "其他说明=",
+            "体格检查=",
+            "体格检查(二)=专科体格检查",
+            "++++复选框10=",
+            "小计++++=",
+            "++++复选框11=",
+            "其他风险因素=",
+            "++++复选框8=",
+            "类型++++VTE类型=",
+            "++++复选框9=",
+            "++++无需VTE预防=",
+            "其他++++抗凝药物禁忌其他=",
+            "++++物理预防复选框=",
+            "其他++++物理预防其他="
+    );
+
 }

+ 16 - 91
trans/src/main/java/com/lantone/qc/trans/changx/util/CxXmlUtil.java

@@ -1,7 +1,6 @@
 package com.lantone.qc.trans.changx.util;
 
 import com.google.common.collect.Maps;
-import com.lantone.qc.pub.util.FileUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.dom4j.Document;
 import org.dom4j.DocumentHelper;
@@ -17,111 +16,37 @@ import java.util.Map;
  */
 public class CxXmlUtil {
 
-    public static String cutXml(String xml) {
-        try {
-            Document doc = DocumentHelper.parseText(xml);
-            return doc.getRootElement().element("DocObjContent").asXML();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    public static Map<String, String> beHospitalizedXmlToMap(String xml) {
+    public static Map<String, String> firstLevelNodeValue(String nodePath, String content) {
         Map<String, String> retMap = Maps.newLinkedHashMap();
         try {
-            String helpTip, contentText;
+            String helpTip, controlName, contentText, key;
             Element contentTextElement;
-            Document doc = DocumentHelper.parseText(xml);
-            Element rootElement = doc.getRootElement();
-
-            List<Element> sectionElements = rootElement.elements("Section");
-            Map<String, String> sectionMap = Maps.newHashMap();
-            for (Element sectionElement : sectionElements) {
-                helpTip = sectionElement.attributeValue("HelpTip");
-                if (StringUtil.isBlank(helpTip)) {
+            Document doc = DocumentHelper.parseText(content);
+            Element rootElement = (Element) doc.selectNodes(nodePath).get(0);
+            List<Element> sonElements = rootElement.elements();
+            for (Element sonElement : sonElements) {
+                helpTip = sonElement.attributeValue("HelpTip");
+                controlName = sonElement.attributeValue("ControlName");
+                if (StringUtil.isBlank(helpTip) && StringUtil.isBlank(controlName)) {
                     continue;
                 }
-                contentTextElement = sectionElement.element("Content_Text");
-                if (contentTextElement == null) {
-                    contentText = sectionElement.getStringValue().trim();
+                if (StringUtil.equals(helpTip, controlName)) {
+                    key = helpTip;
                 } else {
-                    contentText = contentTextElement.getTextTrim();
+                    key = (StringUtil.isBlank(helpTip) ? "" : helpTip) + "++++" + (StringUtil.isBlank(controlName) ? "" : controlName);
                 }
-                sectionMap.put(helpTip, contentText);
-            }
-
-            List<Element> newCtrlElements = rootElement.elements("NewCtrl");
-            Map<String, String> newCtrlMap = Maps.newHashMap();
-            for (Element newCtrlElement : newCtrlElements) {
-                helpTip = newCtrlElement.attributeValue("HelpTip");
-                if (StringUtil.isBlank(helpTip)) {
-                    continue;
-                }
-                contentTextElement = newCtrlElement.element("Content_Text");
+                contentTextElement = sonElement.element("Content_Text");
                 if (contentTextElement == null) {
-                    contentText = newCtrlElement.getStringValue().trim();
+                    contentText = sonElement.getStringValue().trim();
                 } else {
                     contentText = contentTextElement.getTextTrim();
                 }
-                newCtrlMap.put(helpTip, contentText);
+                retMap.put(StringUtil.removeBlank(key), contentText);
             }
-
-            retMap.put("姓名", newCtrlMap.get("姓名"));
-            retMap.put("性别", newCtrlMap.get("性别"));
-            retMap.put("年龄", newCtrlMap.get("年龄"));
-            retMap.put("民族", newCtrlMap.get("民族"));
-            retMap.put("职业", newCtrlMap.get("职业"));
-            retMap.put("出生地", newCtrlMap.get("出生地"));
-            retMap.put("婚姻", newCtrlMap.get("婚姻状况"));
-            retMap.put("联系地址", "");
-            retMap.put("病史陈述者", newCtrlMap.get("供史者"));
-            retMap.put("出生日期", newCtrlMap.get("出生日期"));
-            retMap.put("户口地址", newCtrlMap.get("户口地址"));
-            retMap.put("电话", newCtrlMap.get("联系电话"));
-            retMap.put("入院日期", newCtrlMap.get("入院日期"));
-            retMap.put("记录日期", newCtrlMap.get("记录日期"));
-            retMap.put("辅助检查", newCtrlMap.get("辅助检查"));
-            retMap.put("初步诊断", newCtrlMap.get("初步诊断"));
-            retMap.put("修正诊断", newCtrlMap.get("修正诊断"));
-            retMap.put("补充诊断", newCtrlMap.get("补充诊断"));
-            retMap.put("主诉", newCtrlMap.get("主诉"));
-            retMap.put("现病史", newCtrlMap.get("现病史"));
-
-            retMap.put("既往史", sectionMap.get("既往史"));
-            retMap.put("个人史", sectionMap.get("个人史"));
-            retMap.put("婚育史", sectionMap.get("婚育史:"));
-            retMap.put("月经史", sectionMap.get("月经史"));
-            retMap.put("家族史", sectionMap.get("家族史"));
-            retMap.put("专科体格检查", sectionMap.get("体格检查"));
-
-            String tgjc = sectionMap.get("一般情况") + "。"
-                    + sectionMap.get("皮肤情况") + "。"
-                    + newCtrlMap.get("淋巴") + "。"
-                    + sectionMap.get("头部检查") + "。"
-                    + sectionMap.get("颈部") + "。"
-                    + sectionMap.get("胸部检查") + "。"
-                    + sectionMap.get("肺部检查") + "。"
-                    + sectionMap.get("心脏检查") + "。"
-                    + newCtrlMap.get("血管") + "。"
-                    + sectionMap.get("腹部检查") + "。"
-                    + newCtrlMap.get("外生殖器") + "。"
-                    + newCtrlMap.get("直肠肛门") + "。"
-                    + sectionMap.get("四肢脊柱检查") + "。"
-                    + sectionMap.get("神经系统检查") + "。"
-                    + newCtrlMap.get("其他说明") + "。";
-            retMap.put("体格检查", tgjc);
         } catch (Exception e) {
+            e.printStackTrace();
         }
         return retMap;
     }
 
-    public static void main(String[] args) {
-        String msg = FileUtil.fileRead("C:\\Users\\RGB\\Desktop\\调试\\入院记录.txt");
-        Map<String, String> map = beHospitalizedXmlToMap(msg);
-        map.keySet().forEach(key -> {
-            System.out.println(key + "---" + map.get(key));
-        });
-    }
-
 }