|
@@ -3,13 +3,18 @@ package com.diagbot.facade;
|
|
|
import com.diagbot.biz.push.entity.Item;
|
|
|
import com.diagbot.biz.push.entity.Lis;
|
|
|
import com.diagbot.client.CRFServiceClient;
|
|
|
+import com.diagbot.client.StandConvertServiceClient;
|
|
|
import com.diagbot.dto.BillMsg;
|
|
|
import com.diagbot.dto.RuleDTO;
|
|
|
import com.diagbot.dto.RuleExtDTO;
|
|
|
+import com.diagbot.dto.StandConvertCrfBatchDTO;
|
|
|
+import com.diagbot.dto.StandConvertCrfDTO;
|
|
|
import com.diagbot.dto.WordCrfDTO;
|
|
|
import com.diagbot.enums.LexiconEnum;
|
|
|
import com.diagbot.enums.RedisEnum;
|
|
|
import com.diagbot.enums.StandConvertEnum;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.model.ai.AIAnalyze;
|
|
|
import com.diagbot.model.entity.BodyPart;
|
|
|
import com.diagbot.model.entity.Clinical;
|
|
@@ -28,11 +33,13 @@ import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.CoreUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.RedisUtil;
|
|
|
+import com.diagbot.util.ReflectUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import com.diagbot.vo.NeoPushVO;
|
|
|
import com.diagbot.vo.RuleVO;
|
|
|
import com.diagbot.vo.SearchData;
|
|
|
import com.diagbot.vo.StandConvert;
|
|
|
+import com.diagbot.vo.StandConvertCrfVO;
|
|
|
import com.diagbot.vo.neoPushEntity.ChiefPushVo;
|
|
|
import com.diagbot.vo.neoPushEntity.Diag;
|
|
|
import com.diagbot.vo.neoPushEntity.DiagVo;
|
|
@@ -45,8 +52,9 @@ import com.google.common.collect.Lists;
|
|
|
import org.apache.commons.beanutils.BeanUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.LinkedHashMap;
|
|
@@ -73,23 +81,35 @@ public class CommonFacade {
|
|
|
CommonRule commonRule;
|
|
|
@Autowired
|
|
|
RedisUtil redisUtil;
|
|
|
+ @Autowired
|
|
|
+ NLPFacade nlpFacade;
|
|
|
+ @Autowired
|
|
|
+ StandConvertServiceClient standConvertServiceClient;
|
|
|
+ @Value("${StandConvert.rate}")
|
|
|
+ String standConvertRate;
|
|
|
|
|
|
- //组装好的label
|
|
|
- public WordCrfDTO crf_process(SearchData searchData) {
|
|
|
+ /**
|
|
|
+ * 组装好label
|
|
|
+ *
|
|
|
+ * @param searchData
|
|
|
+ * @param participleFlag
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public WordCrfDTO crf_process(SearchData searchData, Boolean participleFlag) {
|
|
|
AIAnalyze aiAnalyze = new AIAnalyze(crfServiceClient);
|
|
|
// 合并既往史:既往史+传染病史+手术外伤史+过敏史+接种史
|
|
|
String unionPasts = searchData.getPasts();
|
|
|
if (StringUtil.isNotBlank(searchData.getInfectious())) { // 传染病史
|
|
|
- unionPasts = unionPasts + "。" + searchData.getInfectious();
|
|
|
+ unionPasts = unionPasts + "。" + searchData.getInfectious();
|
|
|
}
|
|
|
if (StringUtil.isNotBlank(searchData.getSurgical())) { // 手术外伤史
|
|
|
- unionPasts = unionPasts + "。" + searchData.getSurgical();
|
|
|
+ unionPasts = unionPasts + "。" + searchData.getSurgical();
|
|
|
}
|
|
|
if (StringUtil.isNotBlank(searchData.getAllergy())) { // 过敏史
|
|
|
- unionPasts = unionPasts + "。" + searchData.getAllergy();
|
|
|
+ unionPasts = unionPasts + "。" + searchData.getAllergy();
|
|
|
}
|
|
|
if (StringUtil.isNotBlank(searchData.getVaccination())) { // 接种史
|
|
|
- unionPasts = unionPasts + "。" + searchData.getVaccination();
|
|
|
+ unionPasts = unionPasts + "。" + searchData.getVaccination();
|
|
|
}
|
|
|
searchData.setPasts(unionPasts);
|
|
|
|
|
@@ -174,34 +194,77 @@ public class CommonFacade {
|
|
|
// 现病史中体征内容放入体征标签
|
|
|
processPresentVital(wordCrfDTO);
|
|
|
|
|
|
- // TODO 加入分词
|
|
|
+ // 加入分词
|
|
|
+ if (participleFlag) {
|
|
|
+ participle(wordCrfDTO);
|
|
|
+ }
|
|
|
return wordCrfDTO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 分词
|
|
|
+ *
|
|
|
* @param wordCrfDTO
|
|
|
*/
|
|
|
public void participle(WordCrfDTO wordCrfDTO) {
|
|
|
- List<Clinical> res = Lists.newArrayList();
|
|
|
- List<Clinical> clinicals = wordCrfDTO.getChiefLabel().getClinicals();
|
|
|
- if (ListUtil.isNotEmpty(clinicals))
|
|
|
- for (Clinical clinical : clinicals) {
|
|
|
- // TODO 调用接口
|
|
|
- List<String> list = Lists.newArrayList("症状1","症状2");
|
|
|
- if (ListUtil.isNotEmpty(list)) {
|
|
|
- for (String s : list) {
|
|
|
- Clinical clinicalNew = new Clinical();
|
|
|
- BeanUtil.copyProperties(clinical, clinicalNew);
|
|
|
- clinicalNew.setName(s);
|
|
|
- clinicalNew.setStandName(s);
|
|
|
- res.add(clinicalNew);
|
|
|
+ // 主诉症状分词
|
|
|
+ participleByType(wordCrfDTO.getChiefLabel().getClinicals(), String.valueOf(LexiconEnum.Symptom.getKey()));
|
|
|
+ // 现病史症状分词
|
|
|
+ participleByType(wordCrfDTO.getPresentLabel().getClinicals(), String.valueOf(LexiconEnum.Symptom.getKey()));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据类型分词,通用方法
|
|
|
+ *
|
|
|
+ * @param tList
|
|
|
+ * @param type
|
|
|
+ * @param <T>
|
|
|
+ */
|
|
|
+ public <T> void participleByType(List<T> tList, String type) {
|
|
|
+ List<T> participleList = Lists.newArrayList();
|
|
|
+ if (ListUtil.isNotEmpty(tList)) {
|
|
|
+ for (T t : tList) {
|
|
|
+ String val = ReflectUtil.getProperty(t, "name");
|
|
|
+ List<String> list = nlpFacade.getByType(val, type);
|
|
|
+ if (ListUtil.isNotEmpty(list)) {
|
|
|
+ for (String s : list) {
|
|
|
+ if (!s.equals(val)) { // 去除自身
|
|
|
+ try {
|
|
|
+ T tNew = (T) tList.get(0).getClass().newInstance(); // 泛型不能直接创建对象
|
|
|
+ BeanUtil.copyProperties(t, tNew);
|
|
|
+ CoreUtil.setFieldValue(tNew, "name", s);
|
|
|
+ CoreUtil.setFieldValue(tNew, "standName", s);
|
|
|
+ participleList.add(tNew);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ if (ListUtil.isNotEmpty(participleList)) {
|
|
|
+ tList.addAll(participleList);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //返回给图谱的词,这些词需要转换成标准词
|
|
|
+ /**
|
|
|
+ * 同义词转换
|
|
|
+ *
|
|
|
+ * @param wordCrfDTO
|
|
|
+ */
|
|
|
+ public void wordStandConvert(WordCrfDTO wordCrfDTO) {
|
|
|
+ StandConvert standConvert = dataTypeGet(wordCrfDTO);
|
|
|
+ Map<String, Map<String, String>> standConvertMap = standConvertCrf(standConvert);
|
|
|
+ dataTypeSet(wordCrfDTO, standConvertMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取所有需要转标准词的词
|
|
|
+ *
|
|
|
+ * @param wordCrfDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public StandConvert dataTypeGet(WordCrfDTO wordCrfDTO) {
|
|
|
StandConvert standConvert = new StandConvert();
|
|
|
|
|
@@ -302,7 +365,12 @@ public class CommonFacade {
|
|
|
return standConvert;
|
|
|
}
|
|
|
|
|
|
- //把图谱返回的标准词set到label中
|
|
|
+ /**
|
|
|
+ * 标准词set到label中
|
|
|
+ *
|
|
|
+ * @param wordCrfDTO
|
|
|
+ * @param map
|
|
|
+ */
|
|
|
public void dataTypeSet(WordCrfDTO wordCrfDTO, Map<String, Map<String, String>> map) {
|
|
|
ChiefLabel chiefLabel = wordCrfDTO.getChiefLabel();
|
|
|
PresentLabel presentLabel = wordCrfDTO.getPresentLabel();
|
|
@@ -346,22 +414,22 @@ public class CommonFacade {
|
|
|
// 6、结构化药品
|
|
|
CoreUtil.setPropertyList(wordCrfDTO.getDrug(), "name", "uniqueName", map.get(StandConvertEnum.drug.toString()));
|
|
|
|
|
|
-// // 【化验回填】
|
|
|
-// // 1、普通化验
|
|
|
-// CoreUtil.setPropertyList(lis, "detailName", "uniqueName", map.get(StandConvertEnum.lis.toString()));
|
|
|
-// // 2、开单化验——取套餐
|
|
|
-// CoreUtil.setPropertyList(wordCrfDTO.getLisOrder(), "name", "uniqueName", map.get(StandConvertEnum.lis.toString()));
|
|
|
-//
|
|
|
-// // 【辅助项目回填】
|
|
|
-// // 1、模型解析辅检项目
|
|
|
-// CoreUtil.setPropertyList(pacsList, "name", "uniqueName", map.get(StandConvertEnum.pacs.toString()));
|
|
|
-// // 2、结构化辅检项目
|
|
|
-// CoreUtil.setPropertyList(wordCrfDTO.getPacs(), "name", "uniqueName", map.get(StandConvertEnum.pacs.toString()));
|
|
|
-// // 3、开单辅检项目
|
|
|
-// CoreUtil.setPropertyList(wordCrfDTO.getPacsOrder(), "name", "uniqueName", map.get(StandConvertEnum.pacs.toString()));
|
|
|
-
|
|
|
- CoreUtil.setUninameFromDetail(wordCrfDTO.getLis(),"detailName");
|
|
|
- CoreUtil.setUninameFromDetail(wordCrfDTO.getLisOrder(),"name");
|
|
|
+ // // 【化验回填】
|
|
|
+ // // 1、普通化验
|
|
|
+ // CoreUtil.setPropertyList(lis, "detailName", "uniqueName", map.get(StandConvertEnum.lis.toString()));
|
|
|
+ // // 2、开单化验——取套餐
|
|
|
+ // CoreUtil.setPropertyList(wordCrfDTO.getLisOrder(), "name", "uniqueName", map.get(StandConvertEnum.lis.toString()));
|
|
|
+ //
|
|
|
+ // // 【辅助项目回填】
|
|
|
+ // // 1、模型解析辅检项目
|
|
|
+ // CoreUtil.setPropertyList(pacsList, "name", "uniqueName", map.get(StandConvertEnum.pacs.toString()));
|
|
|
+ // // 2、结构化辅检项目
|
|
|
+ // CoreUtil.setPropertyList(wordCrfDTO.getPacs(), "name", "uniqueName", map.get(StandConvertEnum.pacs.toString()));
|
|
|
+ // // 3、开单辅检项目
|
|
|
+ // CoreUtil.setPropertyList(wordCrfDTO.getPacsOrder(), "name", "uniqueName", map.get(StandConvertEnum.pacs.toString()));
|
|
|
+
|
|
|
+ CoreUtil.setUninameFromDetail(wordCrfDTO.getLis(), "detailName");
|
|
|
+ CoreUtil.setUninameFromDetail(wordCrfDTO.getLisOrder(), "name");
|
|
|
|
|
|
pacsGetAndSet(wordCrfDTO);
|
|
|
|
|
@@ -388,6 +456,209 @@ public class CommonFacade {
|
|
|
CoreUtil.setPropertyList(wordCrfDTO.getTransfusionOrder(), "name", "uniqueName", map.get(StandConvertEnum.transfusion.toString()));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 标准词转换
|
|
|
+ * 类型,疾病: disease,症状: symptom,手术和操作:operation,药品: drug,实验室检查:lis,辅助检查:pacs, 辅助检查:vital"
|
|
|
+ *
|
|
|
+ * @param standConvert
|
|
|
+ * @return Map<String,Map<String,String>> -->Map<类型, Map<原始词, 标准词>>
|
|
|
+ */
|
|
|
+ public Map<String, Map<String, String>> standConvertCrf(StandConvert standConvert) {
|
|
|
+ Map<String, Map<String, String>> map = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ List<StandConvertCrfVO> standConvertCrfVOList = new ArrayList<>();
|
|
|
+ List<String> clinicalConList = getConvertList(standConvert.getClinicalList(), StandConvertEnum.symptom.toString(), standConvertCrfVOList);
|
|
|
+ // List<String> operationConList = getConvertList(standConvert.getOperationList(), StandConvertEnum.operation.toString(), standConvertCrfVOList);
|
|
|
+ List<String> drugConList = getConvertList(standConvert.getDrugList(), StandConvertEnum.drug.toString(), standConvertCrfVOList);
|
|
|
+ List<String> vitallConList = getConvertList(standConvert.getVitalList(), StandConvertEnum.vital.toString(), standConvertCrfVOList);
|
|
|
+ List<String> diseaseConList = getConvertList(standConvert.getDiaglList(), StandConvertEnum.disease.toString(), standConvertCrfVOList);
|
|
|
+ // List<String> pacsConList = getConvertList(standConvert.getPacsList(), StandConvertEnum.pacs.toString(), standConvertCrfVOList);
|
|
|
+ // List<String> lisConList = getConvertList(standConvert.getLisList(), StandConvertEnum.lis.toString(), standConvertCrfVOList);
|
|
|
+ List<String> transfusionConList = getConvertList(standConvert.getTransfusionList(), StandConvertEnum.transfusion.toString(), standConvertCrfVOList);
|
|
|
+
|
|
|
+ StandConvertCrfBatchDTO standConvertCrfBatchDTO = new StandConvertCrfBatchDTO();
|
|
|
+ if (!(ListUtil.isEmpty(clinicalConList)
|
|
|
+ // && ListUtil.isEmpty(operationConList)
|
|
|
+ && ListUtil.isEmpty(drugConList)
|
|
|
+ && ListUtil.isEmpty(vitallConList)
|
|
|
+ && ListUtil.isEmpty(diseaseConList)
|
|
|
+ // && ListUtil.isEmpty(pacsConList)
|
|
|
+ // && ListUtil.isEmpty(lisConList)
|
|
|
+ && ListUtil.isEmpty(transfusionConList))) {
|
|
|
+ try {
|
|
|
+ standConvertCrfBatchDTO = standConvertServiceClient.similarityBatch(standConvertCrfVOList);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准词转换【服务器】挂了!" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Map<String, StandConvertCrfDTO>> crfMap = standConvertCrfBatchDTO.getData();
|
|
|
+ getConvertMap(crfMap, StandConvertEnum.symptom.toString(), clinicalConList, standConvert.getClinicalList(), map);
|
|
|
+ // getConvertMap(crfMap, StandConvertEnum.operation.toString(), operationConList, standConvert.getOperationList(), map);
|
|
|
+ getConvertMap(crfMap, StandConvertEnum.drug.toString(), drugConList, standConvert.getDrugList(), map);
|
|
|
+ getConvertMap(crfMap, StandConvertEnum.vital.toString(), vitallConList, standConvert.getVitalList(), map);
|
|
|
+ getConvertMap(crfMap, StandConvertEnum.disease.toString(), diseaseConList, standConvert.getDiaglList(), map);
|
|
|
+ // getConvertMap(crfMap, StandConvertEnum.pacs.toString(), pacsConList, standConvert.getPacsList(), map);
|
|
|
+ // getConvertMap(crfMap, StandConvertEnum.lis.toString(), lisConList, standConvert.getLisList(), map);
|
|
|
+ getConvertMap(crfMap, StandConvertEnum.transfusion.toString(), transfusionConList, standConvert.getTransfusionList(), map);
|
|
|
+
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取标准词转换map结果,并更新redis
|
|
|
+ *
|
|
|
+ * @param crfDTO
|
|
|
+ * @param type
|
|
|
+ * @param convertList
|
|
|
+ * @param map
|
|
|
+ */
|
|
|
+ public void getConvertMapDisease(Map<String, Map<String, StandConvertCrfDTO>> crfDTO, String type, List<String> convertList,
|
|
|
+ List<String> originList, Map<String, Map<String, String>> map) {
|
|
|
+ Map<String, String> typeMap = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(convertList)) {
|
|
|
+ Map<String, StandConvertCrfDTO> crfMap = crfDTO.get(type);
|
|
|
+ for (String s : convertList) {
|
|
|
+ boolean convertFlag = false;
|
|
|
+ String lastS = s;
|
|
|
+ if (StringUtil.isBlank(s)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (crfMap != null) {
|
|
|
+ StandConvertCrfDTO standConvertCrfDTO = crfMap.get(s);
|
|
|
+ if (standConvertCrfDTO != null) {
|
|
|
+ List<Map<String, String>> list = standConvertCrfDTO.getStandard_words();
|
|
|
+ if (ListUtil.isEmpty(list)) {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, "");
|
|
|
+ } else {
|
|
|
+ String rateStr = standConvertCrfDTO.getStandard_words().get(0).get("rate");
|
|
|
+ if (StringUtil.isBlank(rateStr)) {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, "");
|
|
|
+ } else {
|
|
|
+ BigDecimal rate = new BigDecimal(rateStr);
|
|
|
+ int flag = rate.compareTo(new BigDecimal(standConvertRate));
|
|
|
+ if (flag < 0) {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, "");
|
|
|
+ } else {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
|
|
|
+ lastS = standConvertCrfDTO.getStandard_words().get(0).get("standard_word");
|
|
|
+ convertFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, "");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, "");
|
|
|
+ }
|
|
|
+ if (convertFlag) {
|
|
|
+ typeMap.put(s, lastS);
|
|
|
+ } else {
|
|
|
+ typeMap.put(s, "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 将所有的词放入typeMap中
|
|
|
+ for (String s : originList) {
|
|
|
+ if (!typeMap.containsKey(s)) {
|
|
|
+ String value = redisUtil.get(type + "Conv:" + s);
|
|
|
+ typeMap.put(s, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put(type, typeMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 入参数据处理
|
|
|
+ *
|
|
|
+ * @param wordList
|
|
|
+ * @param type
|
|
|
+ * @param standConvertCrfVOList
|
|
|
+ */
|
|
|
+ public List<String> getConvertList(List<String> wordList, String type, List<StandConvertCrfVO> standConvertCrfVOList) {
|
|
|
+ List<String> convertList = new ArrayList<>();
|
|
|
+ if (ListUtil.isEmpty(wordList)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(wordList)) {
|
|
|
+ for (String s : wordList) {
|
|
|
+ String value = redisUtil.get(type + "Conv:" + s);
|
|
|
+ if (value == null) {
|
|
|
+ StandConvertCrfVO standConvertCrfVO = new StandConvertCrfVO();
|
|
|
+ standConvertCrfVO.setWord_type(type);
|
|
|
+ standConvertCrfVO.setWord(s);
|
|
|
+ standConvertCrfVOList.add(standConvertCrfVO);
|
|
|
+ if (!convertList.contains(s)) {
|
|
|
+ convertList.add(s);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return convertList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取标准词转换map结果,并更新redis
|
|
|
+ *
|
|
|
+ * @param crfDTO
|
|
|
+ * @param type
|
|
|
+ * @param convertList
|
|
|
+ * @param map
|
|
|
+ */
|
|
|
+ public void getConvertMap(Map<String, Map<String, StandConvertCrfDTO>> crfDTO, String type, List<String> convertList,
|
|
|
+ List<String> originList, Map<String, Map<String, String>> map) {
|
|
|
+ Map<String, String> typeMap = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(convertList)) {
|
|
|
+ Map<String, StandConvertCrfDTO> crfMap = crfDTO.get(type);
|
|
|
+ for (String s : convertList) {
|
|
|
+ String lastS = s;
|
|
|
+ if (StringUtil.isBlank(s)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (crfMap != null) {
|
|
|
+ StandConvertCrfDTO standConvertCrfDTO = crfMap.get(s);
|
|
|
+ if (standConvertCrfDTO != null) {
|
|
|
+ List<Map<String, String>> list = standConvertCrfDTO.getStandard_words();
|
|
|
+ if (ListUtil.isEmpty(list)) {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, s);
|
|
|
+ } else {
|
|
|
+ String rateStr = standConvertCrfDTO.getStandard_words().get(0).get("rate");
|
|
|
+ if (StringUtil.isBlank(rateStr)) {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, s);
|
|
|
+ } else {
|
|
|
+ BigDecimal rate = new BigDecimal(rateStr);
|
|
|
+ int flag = rate.compareTo(new BigDecimal(standConvertRate));
|
|
|
+ if (flag < 0) {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, s);
|
|
|
+ } else {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, standConvertCrfDTO.getStandard_words().get(0).get("standard_word"));
|
|
|
+ lastS = standConvertCrfDTO.getStandard_words().get(0).get("standard_word");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, s);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ redisUtil.updateValue(type + "Conv:" + s, s);
|
|
|
+ }
|
|
|
+ typeMap.put(s, lastS);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 将所有的词放入typeMap中
|
|
|
+ for (String s : originList) {
|
|
|
+ if (!typeMap.containsKey(s)) {
|
|
|
+ String value = redisUtil.get(type + "Conv:" + s);
|
|
|
+ typeMap.put(s, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put(type, typeMap);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 手术映射(关闭同义词转换)
|
|
|
*
|
|
@@ -469,14 +740,14 @@ public class CommonFacade {
|
|
|
/**
|
|
|
* 替换映射内容
|
|
|
*
|
|
|
- * @param obj 对象
|
|
|
+ * @param obj 对象
|
|
|
* @param listProperty 获取List属性名
|
|
|
- * @param objProperty 对象属性名
|
|
|
- * @param configMap 映射Map
|
|
|
+ * @param objProperty 对象属性名
|
|
|
+ * @param configMap 映射Map
|
|
|
*/
|
|
|
public <T> void setListProperty(Object obj, String listProperty, String objProperty, Map<String, Map<String, Long>> configMap) {
|
|
|
Object tList = CoreUtil.getFieldValue(obj, listProperty);
|
|
|
- List<T> newList = convertStandName((List)tList, configMap, objProperty);
|
|
|
+ List<T> newList = convertStandName((List) tList, configMap, objProperty);
|
|
|
CoreUtil.setFieldValue(obj, listProperty, newList);
|
|
|
}
|
|
|
|