ソースを参照

模板数据修改

rengb 5 年 前
コミット
864ae844c8

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

@@ -5,6 +5,7 @@ import com.lantone.qc.kernel.client.CRFServiceClient;
 import com.lantone.qc.kernel.client.SimilarityServiceClient;
 import com.lantone.qc.kernel.structure.ai.AIAnalyze;
 import com.lantone.qc.kernel.util.CatalogueUtil;
+import com.lantone.qc.kernel.util.ModuleMappingUtil;
 import com.lantone.qc.kernel.util.RedisUtil;
 import com.lantone.qc.pub.exception.AIException;
 import com.lantone.qc.pub.exception.CatalogueException;
@@ -35,6 +36,9 @@ public class QCAnalysis {
     @Autowired
     private RedisUtil redisUtil;
 
+    @Autowired
+    private ModuleMappingUtil moduleMappingUtil;
+
     public OutputInfo anlysis(QueryVo queryVo) throws AIException, CatalogueException, Exception {
         OutputInfo outputInfo = new OutputInfo();
         InputInfo inputInfo = TransDispatch.trans(queryVo);
@@ -51,6 +55,7 @@ public class QCAnalysis {
             }
             CatalogueUtil.qcCatalogueMap.get(entry.getKey()).execute(inputInfo, outputInfo);
         }
+        moduleMappingUtil.moduleIdInsert(inputInfo.getPageData());
         outputInfo.setPageData(inputInfo.getPageData());
         Map<String, Map<String, String>> result = outputInfo.getResult();
         Map<String, Map<String, String>> resultNew = Maps.newHashMap();

+ 34 - 1
kernel/src/main/java/com/lantone/qc/kernel/util/CacheUtil.java

@@ -1,9 +1,13 @@
 package com.lantone.qc.kernel.util;
 
 
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
 import com.lantone.qc.nlp.participle.cfg.Configuration;
 import com.lantone.qc.nlp.participle.cfg.DefaultConfig;
-import com.lantone.qc.security.util.EncrypDES;
+import com.lantone.qc.pub.util.FastJsonUtils;
+import com.lantone.qc.pub.util.FileUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -12,11 +16,14 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.ApplicationArguments;
 import org.springframework.boot.ApplicationRunner;
 import org.springframework.stereotype.Component;
+import org.springframework.util.ResourceUtils;
 
+import java.io.FileNotFoundException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * @ClassName : CacheUtil
@@ -29,12 +36,15 @@ public class CacheUtil implements ApplicationRunner {
     Logger logger = LoggerFactory.getLogger(DefaultConfig.class);
     @Autowired
     private RedisUtil redisUtil;
+    @Autowired
+    private ModuleMappingUtil moduleMappingUtil;
 
     @Value("${qc.hospital_id}")
     private String hospitalId;
 
     public void run(ApplicationArguments var1) {
         try {
+            this.loadModuleMappingInfo();//加载页面模板映射信息
             this.putConceptDiagPropertyMap();//疾病相关信息放入缓存 包括疾病是否是慢病、传染病、常见症状、同义词
             this.putHospitalDiagMap();//医院疾病信息
             this.putHospitalDiagHuaZMap();//医院华卓映射
@@ -46,6 +56,27 @@ public class CacheUtil implements ApplicationRunner {
         }
     }
 
+    /**
+     * 加载页面模板映射信息
+     */
+    private void loadModuleMappingInfo() {
+        List<String> xmlDataTypeHospitalIds = Lists.newArrayList("1", "3");
+        try {
+            String path = ResourceUtils.getURL("classpath:").getPath() + "cache/" + hospitalId + "/module_mapping.json";
+            String mappingMsg = FileUtil.fileRead(path);
+            if (xmlDataTypeHospitalIds.contains(hospitalId)) {
+                Map<String, Long> mapKeysModuleInfoIdMap = (Map) FastJsonUtils.getJsonToMap(mappingMsg);
+                Map<Set<String>, String> xmlDataTypeModuleInfo = Maps.newHashMap();
+                mapKeysModuleInfoIdMap.keySet().forEach(mapKeys -> {
+                    xmlDataTypeModuleInfo.put(Sets.newHashSet(mapKeys.split(",")), mapKeysModuleInfoIdMap.get(mapKeys) + "");
+                });
+                moduleMappingUtil.setXmlDataTypeModuleInfo(xmlDataTypeModuleInfo);
+            }
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        }
+    }
+
     /**
      * 疾病相关信息放入缓存
      * 包括疾病是否是慢病、传染病、常见症状、同义词
@@ -81,6 +112,7 @@ public class CacheUtil implements ApplicationRunner {
 
     /**
      * 医院医生信息
+     *
      * @throws Exception
      */
     public void putHospitalDoctorInfoMap() throws Exception {
@@ -149,6 +181,7 @@ public class CacheUtil implements ApplicationRunner {
         }
         redisUtil.setJsonStringValue(KernelConstants.LANTONE_DIAG_HUAZ_MAP, hospitalDiagMap);
     }
+
     /**
      * 症状需要部位描述词典放入redis缓存
      */

+ 60 - 0
kernel/src/main/java/com/lantone/qc/kernel/util/ModuleMappingUtil.java

@@ -0,0 +1,60 @@
+package com.lantone.qc.kernel.util;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.lantone.qc.pub.util.ListUtil;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.commons.collections.MapUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @Description: 页面模板映射工具类
+ * @author: rengb
+ * @time: 2020/4/30 10:03
+ */
+@Component
+@Getter
+@Setter
+public class ModuleMappingUtil {
+    @Value("${qc.hospital_id}")
+    private String hospitalId;
+    private List<String> xmlDataTypeHospitalIds = Lists.newArrayList("1", "3");
+    private Map<Set<String>, String> xmlDataTypeModuleInfo = Maps.newHashMap();
+
+    public void moduleIdInsert(Map<String, Object> pageData) {
+        if (xmlDataTypeHospitalIds.contains(hospitalId)) {
+            xmlDataTypeModuleIdInsert(pageData);
+        }
+    }
+
+    private void xmlDataTypeModuleIdInsert(Map<String, Object> pageData) {
+        if (MapUtils.isEmpty(pageData)) {
+            return;
+        }
+        pageData.keySet().forEach(pageDataKey -> {
+            Object object = pageData.get(pageDataKey);
+            if (object instanceof List) {
+                List<Map<String, String>> sourceMaps = (List) object;
+                if (ListUtil.isNotEmpty(sourceMaps)) {
+                    sourceMaps.forEach(sourceMap -> {
+                        if (MapUtils.isNotEmpty(sourceMap)) {
+                            sourceMap.put("mode_id", xmlDataTypeModuleInfo.get(sourceMap.keySet()));
+                        }
+                    });
+                }
+            } else if (object instanceof Map) {
+                Map<String, String> sourceMap = (Map) object;
+                if (MapUtils.isNotEmpty(sourceMap)) {
+                    sourceMap.put("mode_id", xmlDataTypeModuleInfo.get(sourceMap.keySet()));
+                }
+            }
+        });
+    }
+
+}

ファイルの差分が大きいため隠しています
+ 1 - 0
kernel/src/main/resources/cache/3/module_mapping.json


+ 0 - 1
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouBeHospitalizedDocTrans.java

@@ -46,7 +46,6 @@ public class TaiZhouBeHospitalizedDocTrans extends ModelDocTrans {
         }
 
         BeHospitalizedDoc beHospitalizedDoc = beHospitalizedDocGen(structureMap); // 不走共用
-        sourceMap.put("mode_id","11");
         beHospitalizedDoc.setPageData((Map)sourceMap);
         return beHospitalizedDoc;
     }

+ 0 - 1
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouThreeLevelWardDocTrans.java

@@ -56,7 +56,6 @@ public class TaiZhouThreeLevelWardDocTrans extends ModelDocTrans {
         //总的查房记录 汇总
         ThreeLevelWardDoc allDoctorWradDoc = new ThreeLevelWardDoc();
         allDoctorWradDoc.setStructureMap(structureMap);
-        sourceMap.put("mode_id","17");
         allDoctorWradDoc.setPageData((Map)sourceMap);
         result.addAllDoctorWradDoc(allDoctorWradDoc);
 

+ 0 - 1
trans/src/main/java/com/lantone/qc/trans/taizhou/TaizhouDocTrans.java

@@ -201,7 +201,6 @@ public class TaizhouDocTrans extends DocTrans {
         }
         if (ListUtil.isNotEmpty(inputInfo.getThreeLevelWardDocs())) {
             List<Map<String, Object>> pageDatas = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs().stream().map(i -> i.getPageData()).collect(Collectors.toList());
-            pageDatas.get(pageDatas.size()-1).put("mode_id","18");
             inputInfo.getPageData().put("查房记录", pageDatas);
         }
         if (ListUtil.isNotEmpty(inputInfo.getPathologyShipDocs())) {