rengb преди 4 години
родител
ревизия
83e8ef5c16

+ 2 - 1
dbanaly/pom.xml

@@ -127,7 +127,8 @@
             <resource>
                 <directory>src/main/resources</directory>
                 <includes>
-                    <include>*.yml</include>
+                    <include>**/*.yml</include>
+                    <include>**/*.xml</include>
                 </includes>
             </resource>
         </resources>

+ 14 - 3
dbanaly/src/main/java/com/lantone/qc/dbanaly/facade/comsis/ModuleHelper.java

@@ -53,16 +53,19 @@ public class ModuleHelper {
     public boolean loadModuleInfo() {
         try {
             List<String> xmlDataTypeHospitalIds = Lists.newArrayList("1", "2", "3");
+            List<String> htmlDataTypeHospitalIds = Lists.newArrayList("4");
             for (String hospitalId : hospitalIds.split(",")) {
-                if (!xmlDataTypeHospitalIds.contains(hospitalId)) {
-                    continue;
+                if (xmlDataTypeHospitalIds.contains(hospitalId)) {
+                    loadModuleInfoByHospitalId(hospitalId);
+                } else if (htmlDataTypeHospitalIds.contains(hospitalId)) {
+                    loadHtmlModuleInfoByHospitalId(hospitalId);
                 }
-                loadModuleInfoByHospitalId(hospitalId);
             }
             return true;
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             ModuleMappingUtil.xmlDataTypeModuleInfo.clear();
+            ModuleMappingUtil.htmlDataTypeModuleInfo.clear();
             return false;
         }
     }
@@ -113,4 +116,12 @@ public class ModuleHelper {
         ModuleMappingUtil.xmlDataTypeModuleInfo.put(hospitalId, result);
     }
 
+    private void loadHtmlModuleInfoByHospitalId(String hospitalId) {
+        List<String> list = moduleInfoService.getBaseMapper().getAnameModidMap(Long.parseLong(hospitalId));
+        list.forEach(i -> {
+            String[] arry = i.split("=");
+            ModuleMappingUtil.htmlDataTypeModuleInfo.put(arry[0], arry[1]);
+        });
+    }
+
 }

+ 5 - 1
dbanaly/src/main/java/com/lantone/qc/dbanaly/lt/mapper/ModuleInfoMapper.java

@@ -1,7 +1,9 @@
 package com.lantone.qc.dbanaly.lt.mapper;
 
-import com.lantone.qc.dbanaly.lt.entity.ModuleInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.lantone.qc.dbanaly.lt.entity.ModuleInfo;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ModuleInfoMapper extends BaseMapper<ModuleInfo> {
 
+    List<String> getAnameModidMap(Long hospitalId);
+
 }

+ 5 - 0
dbanaly/src/main/java/com/lantone/qc/dbanaly/util/ModuleMappingUtil.java

@@ -19,6 +19,7 @@ import java.util.Set;
 public class ModuleMappingUtil {
 
     public static final Map<String, Map<Set<String>, String>> xmlDataTypeModuleInfo = Maps.newHashMap();
+    public static final Map<String, String> htmlDataTypeModuleInfo = Maps.newHashMap();
 
     public static String getXmlDataTypeModuleId(Map<String, String> sourceMap) {
         SpecialStorageUtil specialStorageUtil = SpringContextUtil.getBean("specialStorageUtil");
@@ -38,4 +39,8 @@ public class ModuleMappingUtil {
         return xmlDataTypeModuleInfo.get(specialStorageUtil.getHospitalIdThreadLocal().get()).get(set);
     }
 
+    public static String getHtmlDataTypeModuleId(String recTitle) {
+        return htmlDataTypeModuleInfo.get(recTitle);
+    }
+
 }

+ 5 - 0
dbanaly/src/main/java/com/lantone/qc/dbanaly/util/SpecialStorageUtil.java

@@ -1,6 +1,7 @@
 package com.lantone.qc.dbanaly.util;
 
 import com.google.common.collect.Maps;
+import com.lantone.qc.pub.model.vo.BehospitalInfoVO;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
@@ -15,6 +16,7 @@ import java.util.Map;
 public final class SpecialStorageUtil {
     private final Map<String, Map<String, Object>> hospitalCache = Maps.newHashMap();
     private final ThreadLocal<String> hospitalIdThreadLocal = new ThreadLocal<>();
+    private final ThreadLocal<BehospitalInfoVO> behospitalInfoThreadLocal = new ThreadLocal<>();
 
     public <T> T getJsonStringValue(String key) {
         return getValByHospitalId(hospitalIdThreadLocal.get(), key);
@@ -54,4 +56,7 @@ public final class SpecialStorageUtil {
         return hospitalCache;
     }
 
+    public ThreadLocal<BehospitalInfoVO> getBehospitalInfoThreadLocal() {
+        return behospitalInfoThreadLocal;
+    }
 }

+ 10 - 0
dbanaly/src/main/resources/mapper/lt/ModuleInfoMapper.xml

@@ -2,4 +2,14 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.lantone.qc.dbanaly.lt.mapper.ModuleInfoMapper">
 
+    <select id="getAnameModidMap" parameterType="long" resultType="string">
+        SELECT
+        concat(IFNULL(c.map_type,''),'-',c.rec_type,'=',a.id)
+        from qc_module_info a join med_module_mapping b on a.id=b.module_id
+        join med_record_analyze c on b.record_id=c.id
+        where a.hospital_id=#{hospitalId} and a.is_deleted='N'
+        and b.hospital_id=#{hospitalId} and b.is_deleted='N'
+        and c.hospital_id=#{hospitalId} and c.is_deleted='N'
+    </select>
+
 </mapper>

+ 1 - 0
kernel/src/main/java/com/lantone/qc/kernel/analysis/QCAnalysis.java

@@ -36,6 +36,7 @@ public class QCAnalysis {
 
     public OutputInfo anlysis(QueryVo queryVo) throws AIException, CatalogueException, Exception {
         specialStorageUtil.getHospitalIdThreadLocal().set(queryVo.getHospitalId());
+        specialStorageUtil.getBehospitalInfoThreadLocal().set(queryVo.getBehospitalInfo());
         OutputInfo outputInfo = new OutputInfo();
         long t1 = System.currentTimeMillis();
         InputInfo inputInfo = TransDispatch.trans(queryVo);

+ 1 - 0
kernel/src/main/resources/bootstrap.yml

@@ -21,6 +21,7 @@ logging:          # 日志
   config: classpath:logback-spring.xml
 
 mybatis-plus:
+  mapper-locations: classpath:/mapper/lt/*Mapper.xml
   type-aliases-package: com.lantone.qc.dbanaly.lt.entity
   configuration:
     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

+ 6 - 100
trans/src/main/java/com/lantone/qc/trans/beilun/BeiLunBeHospitalizedDocTrans.java

@@ -1,13 +1,11 @@
 package com.lantone.qc.trans.beilun;
 
 import com.google.common.collect.Lists;
-import com.lantone.qc.dbanaly.facade.changx.CxXmlUtil;
 import com.lantone.qc.pub.model.doc.BeHospitalizedDoc;
 import com.lantone.qc.pub.model.vo.MedrecVo;
-import com.lantone.qc.pub.util.StringUtil;
 import com.lantone.qc.trans.ModelDocTrans;
+import com.lantone.qc.trans.beilun.util.BeiLunBeHospitalizedHtmlAnalysis;
 import com.lantone.qc.trans.beilun.util.BeiLunHtmlAnalysis;
-import com.lantone.qc.trans.beilun.util.BeiLunLeaveHospitalHtmlAnalysis;
 import com.lantone.qc.trans.comsis.ModelDocGenerate;
 import com.lantone.qc.trans.comsis.OrdinaryAssistant;
 
@@ -25,110 +23,18 @@ public class BeiLunBeHospitalizedDocTrans extends ModelDocTrans {
     public BeHospitalizedDoc extract(MedrecVo medrecVo) {
         Map<String, Object> contentMap = ((List<Map>) medrecVo.getContent().get("content")).get(0);
         String content = contentMap.get("xmlText").toString();
-        Map<String, String> sourceMap = CxXmlUtil.firstLevelNodeValue(content);
-        String sex = "男";
-        for (String key : sourceMap.keySet()) {
-            if (key.indexOf("性别") > -1) {
-                if (sourceMap.get(key).indexOf("男") > -1 || sourceMap.get(key).indexOf("女") > -1) {
-                    sex = StringUtil.removeBlank(sourceMap.get(key));
-                }
-            }
-        }
-        sourceMap.put(sex, "");
-        sourceMap.put("mode_id=" + contentMap.get("modeId").toString(), "");
-        sourceMap.put("rec_title=" + contentMap.get("recTitle").toString(), "");
+        String recTitle = contentMap.get("recTitle").toString();
+        BeiLunHtmlAnalysis beiLunHtmlAnalysis = new BeiLunBeHospitalizedHtmlAnalysis();
+        Map<String, String> sourceMap = beiLunHtmlAnalysis.analysis(content, recTitle);
         Map<String, String> structureMap = OrdinaryAssistant.mapKeyContrast(sourceMap, keyContrasts);
-        String specialCheck = structureMap.get("专科检查");
-        if (StringUtil.isNotBlank(specialCheck)) {
-            structureMap.put("专科体格检查", specialCheck);
-        } else {
-            String tgjc = concatSpecialCheck(sourceMap);
-            if (StringUtil.isNotBlank(tgjc)) {
-                structureMap.put("专科体格检查", tgjc);
-            }
-        }
-        String marital = structureMap.get("婚育史");
-        String marry = structureMap.get("婚姻");
-        if (StringUtil.isBlank(marital) && StringUtil.isNotBlank(marry)) {
-            structureMap.put("婚育史", marry);
-        }
+
         BeHospitalizedDoc beHospitalizedDoc = ModelDocGenerate.beHospitalizedDocGen(structureMap);
-        beHospitalizedDoc.setText(content);
         beHospitalizedDoc.setPageData((Map) structureMap);
         return beHospitalizedDoc;
     }
 
-
-    private String concatSpecialCheck(Map<String, String> sourceMap) {
-        return concatString(sourceMap.get("一般情况")) +
-                concatString(sourceMap.get("皮肤情况")) +
-                concatString(sourceMap.get("淋巴")) +
-                concatString(sourceMap.get("头部检查")) +
-                concatString(sourceMap.get("颈部")) +
-                concatString(sourceMap.get("胸部检查")) +
-                concatString(sourceMap.get("肺部检查")) +
-                concatString(sourceMap.get("心脏检查")) +
-                concatString(sourceMap.get("血管")) +
-                concatString(sourceMap.get("腹部检查")) +
-                concatString(sourceMap.get("外生殖器")) +
-                concatString(sourceMap.get("直肠肛门")) +
-                concatString(sourceMap.get("四肢脊柱检查")) +
-                concatString(sourceMap.get("神经系统检查")) +
-                concatString(sourceMap.get("其他说明"));
-    }
-
     private List<String> keyContrasts = Lists.newArrayList(
-            "姓名++++患者姓名=姓名",
-            "出生地++++出生地(住院)=出生地",
-            "工作单位++++工作单位地址=工作单位",
-            "婚姻状况++++婚姻=婚姻",
-            "诊疗经过++++入院诊治经过=诊疗经过",
-            "联系电话=电话",
-            "供史者++++病史叙述者=病史陈述者",
-            "++++病史叙述者=病史陈述者",
-            "供史者++++供史者新=病史陈述者",
-            "供史者=病史陈述者",
-            "病史叙述者=病史陈述者",
-            "病史提供者++++病史叙述者=病史陈述者",
-            "婚育史:=婚育史",
-            "外生殖器++++外生殖器文本框=",
-            //            "户口地址=联系地址",
-            "家庭住址++++现住址=现住址",
-            "产次++++产=产次",
-            "家长姓名++++家长=家长姓名",
-            "职业++++首页职业新=职业",
-            "签名时间++++修正签名时间=修正签名时间",
-            "修正诊断++++初步诊断=修正诊断",
-            "与患者关系=关系",
-//            "出生日期=出生时间",
-            "入院情况=入院病情",
-            "++++药物过敏史=药物过敏史",
-            "++++浮肿少尿史=浮肿少尿史",
-            "++++出血史=出血史",
-            "++++多饮多尿史=多饮多尿史",
-            "++++传染病史=传染病史",
-            "++++尿频尿痛史=尿频尿痛史",
-            "++++外伤手术史=外伤手术史",
-            "++++咳嗽气喘史=咳嗽气喘史",
-            "++++抽搐史=抽搐史",
-            "++++重大疾病史和治疗史=重大疾病史和治疗史",
-            "++++腹痛腹泻史=腹痛腹泻史",
-            "++++过敏史=过敏史",
-            "++++输血史=输血史",
-            "++++胸闷心悸史=胸闷心悸史",
-            "实验室检查++++辅助检查=辅助检查",
-            "签名++++=医师签名",
-            "兄弟姐妹健康状况++++兄弟姐妹=兄弟姐妹健康状况",
-            "++++(外)祖父母=外祖父母",
-            "出生时间=出生日期"
-    );
 
-    private String concatString(String item) {
-        if (StringUtil.isBlank(item)) {
-            return "";
-        } else {
-            return item + "。";
-        }
-    }
+    );
 
 }

+ 1 - 0
trans/src/main/java/com/lantone/qc/trans/beilun/util/BeiLunBeHospitalizedHtmlAnalysis.java

@@ -75,6 +75,7 @@ public class BeiLunBeHospitalizedHtmlAnalysis implements BeiLunHtmlAnalysis {
                 .replace("补充专科情况", "补充专科情况:")
                 .trim();
         CommonAnalysisUtil.cutByTitles(yuText, Lists.newArrayList("专科检查", "辅助检查"), 0, map);
+        BeiLunHtmlAnalysisUtil.insertModuleId(recTitle, map);
         return map;
     }
 

+ 16 - 0
trans/src/main/java/com/lantone/qc/trans/beilun/util/BeiLunHtmlAnalysisUtil.java

@@ -1,6 +1,10 @@
 package com.lantone.qc.trans.beilun.util;
 
 import com.google.common.collect.Lists;
+import com.lantone.qc.dbanaly.util.ModuleMappingUtil;
+import com.lantone.qc.dbanaly.util.SpecialStorageUtil;
+import com.lantone.qc.pub.model.vo.BehospitalInfoVO;
+import com.lantone.qc.pub.util.SpringContextUtil;
 import com.lantone.qc.pub.util.StringUtil;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
@@ -15,6 +19,8 @@ import java.util.Map;
  */
 public class BeiLunHtmlAnalysisUtil {
 
+    private static final List<String> excludeDepts = Lists.newArrayList("产科住院", "妇科住院", "儿科");
+
     /**
      * table样式:key和value在同一个td中,以冒号分开;保留换行
      *
@@ -138,4 +144,14 @@ public class BeiLunHtmlAnalysisUtil {
         return sbf.toString().replaceAll(" ", " ");
     }
 
+    public static void insertModuleId(String recTitle, Map<String, String> map) {
+        SpecialStorageUtil specialStorageUtil = SpringContextUtil.getBean("specialStorageUtil");
+        BehospitalInfoVO behospitalInfo = specialStorageUtil.getBehospitalInfoThreadLocal().get();
+        String deptName = behospitalInfo.getBehDeptName();
+        if (!excludeDepts.contains(deptName)) {
+            deptName = "";
+        }
+        map.put("mode_id", ModuleMappingUtil.getHtmlDataTypeModuleId(deptName + "-" + recTitle));
+    }
+
 }

+ 0 - 6
trans/src/main/java/com/lantone/qc/trans/comsis/OrdinaryAssistant.java

@@ -1,7 +1,6 @@
 package com.lantone.qc.trans.comsis;
 
 import com.google.common.collect.Maps;
-import com.lantone.qc.dbanaly.util.ModuleMappingUtil;
 import com.lantone.qc.pub.util.DateUtil;
 import com.lantone.qc.pub.util.MapUtil;
 import com.lantone.qc.pub.util.StringUtil;
@@ -21,11 +20,6 @@ public class OrdinaryAssistant {
 
     public static Map<String, String> mapKeyContrast(Map<String, String> sourceMap, List<String> keyContrasts) {
         Map<String, String> retMap = Maps.newHashMap();
-        String modeId = ModuleMappingUtil.getXmlDataTypeModuleId(sourceMap);
-        if (StringUtil.isNotBlank(modeId)) {
-            retMap.put("mode_id", modeId);
-            sourceMap.put("mode_id", modeId);
-        }
         Map<String, String> sourceMap_ = MapUtil.copyMap((Map) sourceMap);
         String[] arry = null;
         String sourceKey = null, targetKey;