|
@@ -1,15 +1,10 @@
|
|
|
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.pub.util.FastJsonUtils;
|
|
|
import com.lantone.qc.pub.util.StringUtil;
|
|
|
-import com.lantone.qc.trans.comsis.ModuleMappingUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.io.FileUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -17,15 +12,10 @@ import org.springframework.boot.ApplicationArguments;
|
|
|
import org.springframework.boot.ApplicationRunner;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.io.File;
|
|
|
-import java.io.InputStream;
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Comparator;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
|
|
|
/**
|
|
|
* @ClassName : CacheUtil
|
|
@@ -51,7 +41,6 @@ public class CacheUtil implements ApplicationRunner {
|
|
|
continue;
|
|
|
}
|
|
|
redisUtil.getHospitalCache().put(i, Maps.newHashMap());
|
|
|
- this.loadModuleMappingInfo(i);//加载页面模板映射信息
|
|
|
this.putConceptDiagPropertyMap(i);//疾病相关信息放入缓存 包括疾病是否是慢病、传染病、常见症状、同义词
|
|
|
this.putHospitalDiagMap(i);//医院疾病信息
|
|
|
this.putHospitalDiagHuaZMap(i);//医院华卓映射
|
|
@@ -62,46 +51,6 @@ public class CacheUtil implements ApplicationRunner {
|
|
|
log.info("缓存加载完成!");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 加载页面模板映射信息
|
|
|
- *
|
|
|
- * @param hospitalId
|
|
|
- */
|
|
|
- private void loadModuleMappingInfo(String hospitalId) {
|
|
|
- List<String> xmlDataTypeHospitalIds = Lists.newArrayList("1", "3");
|
|
|
- try {
|
|
|
- InputStream stream = getClass().getClassLoader().getResourceAsStream("cache/" + hospitalId + "/module_mapping.json");
|
|
|
- File targetFile = new File("cache/" + hospitalId + "/module_mapping.json");
|
|
|
- FileUtils.copyInputStreamToFile(stream, targetFile);
|
|
|
- String mappingMsg = FileUtils.readFileToString(targetFile);
|
|
|
- // logger.error("模板数据:"+mappingMsg);
|
|
|
-
|
|
|
- // 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();
|
|
|
-
|
|
|
- for (Map.Entry<String, Long> entry : mapKeysModuleInfoIdMap.entrySet()) {
|
|
|
- List<String> list = Arrays.asList(entry.getKey().split(","));
|
|
|
- list.sort(new Comparator<String>() {
|
|
|
- @Override
|
|
|
- public int compare(String arg0, String arg1) {
|
|
|
- return arg0.compareTo(arg1);//这是顺序
|
|
|
- }
|
|
|
- });
|
|
|
- xmlDataTypeModuleInfo.put(Sets.newLinkedHashSet(list), entry.getValue() + "");
|
|
|
- }
|
|
|
- // mapKeysModuleInfoIdMap.keySet().forEach(mapKeys -> {
|
|
|
- // xmlDataTypeModuleInfo.put(Sets.newLinkedHashSet(Arrays.asList(mapKeys.split(","))), mapKeysModuleInfoIdMap.get(mapKeys) + "");
|
|
|
- // });
|
|
|
- ModuleMappingUtil.xmlDataTypeModuleInfo.put(hospitalId, xmlDataTypeModuleInfo);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage(), e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 疾病相关信息放入缓存
|
|
|
* 包括疾病是否是慢病、传染病、常见症状、同义词
|