zhoutg 4 éve
szülő
commit
683e8f778f

+ 1 - 0
src/main/java/com/diagbot/aggregate/PushNewAggregate.java

@@ -90,6 +90,7 @@ public class PushNewAggregate {
         Map<String, List<PushBaseDTO>> dis = new LinkedHashMap<>();
         pushDTO.setDis(dis);
         long start = System.currentTimeMillis();
+        // pushNewVO.setWordCrfDTO(wordCrfDTO);
         try {
             PushNewDTO pushNewDTO = pushNewServiceClient.pushNew(pushNewVO);
             if (pushNewDTO == null || (pushNewDTO != null && pushNewDTO.getStatus().equals(-1))) {

+ 20 - 46
src/main/java/com/diagbot/config/CacheDeleteInit.java

@@ -30,55 +30,29 @@ public class CacheDeleteInit implements CommandLineRunner {
     @Override
     public void run(String... args) {
         // 服务启动清除redis缓存
-//        cacheFacade.clear();
-//        log.info("CDSS-CORE服务启动清除redis缓存成功!");
-//
-//        cacheFacade.loadDrugTypeCache();
-//        log.info("CDSS-CORE服务启动加载药品类型对应关系缓存成功!");
-//
-//        cacheFacade.getDiseaseCorrespondCache();
-//        log.info("CDSS-CORE服务启动加载疾病对应ICD10缓存成功!");
-//
-//        cacheFacade.getdiseaseFilterCache();
-//        log.info("CDSS-CORE服务启动加载疾病过滤缓存成功!");
-//
-//         cacheFacade.loadAllRuleCache();
-//         log.info("CDSS-CORE服务启动加载医学知识库中的所有规则缓存成功!");
-//
-//        cacheFacade.loadAllBaseDiagnoseCache();
-//        log.info("CDSS-CORE服务启动加载诊断依据缓存成功!");
-//
-//        cacheFacade.loadHostipalPush();
-//        log.info("CDSS-CORE服务启动加载医院大数据推送类型成功!");
+        cacheFacade.clear();
+        log.info("CDSS-CORE服务启动清除redis缓存成功!");
 
-        conceptInfoFacade.loadCustomDictionary();
-        log.info("CDSS-CORE服务启动加载NLP分词字典成功!");
+        cacheFacade.loadDrugTypeCache();
+        log.info("CDSS-CORE服务启动加载药品类型对应关系缓存成功!");
+
+        cacheFacade.getDiseaseCorrespondCache();
+        log.info("CDSS-CORE服务启动加载疾病对应ICD10缓存成功!");
+
+        cacheFacade.getdiseaseFilterCache();
+        log.info("CDSS-CORE服务启动加载疾病过滤缓存成功!");
 
-//        cacheFacade.getDiseaseCorrespondCache();
-//        log.info("CDSS-CORE服务启动加载疾病对应ICD10缓存成功!");
-//
-//        cacheFacade.getdiseaseFilterCache();
-//        log.info("CDSS-CORE服务启动加载疾病过滤缓存成功!");
+        cacheFacade.loadAllRuleCache();
+        log.info("CDSS-CORE服务启动加载医学知识库中的所有规则缓存成功!");
 
-        //无用的缓存
-        //
-        //        cacheFacade.getSymptomCache();
-        //        log.info("CDSS-CORE服务启动加载图谱症状缓存成功!");
-        //
-        //        cacheFacade.getVitalCache();
-        //        log.info("CDSS-CORE服务启动加载图谱体征缓存成功!");
-        //
-        //        cacheFacade.getSymptomFeatureCache();
-        //        log.info("CDSS-CORE服务启动加载症状特征缓存成功!");
-        //
-        //        cacheFacade.getSymptomMainCache();
-        //        log.info("CDSS-CORE服务启动加载典型症状缓存成功!");
-        //
-        //        cacheFacade.loadDiseaseTypeCache();
-        //        log.info("CDSS-CORE服务启动加载疾病属性(性别、年龄、发病率)缓存成功!");
-        //
-        //        cacheFacade.getSymptomNumCache();
-        //        log.info("CDSS-CORE服务启动加载疾病对应的症状个数缓存成功!");
+        cacheFacade.loadAllBaseDiagnoseCache();
+        log.info("CDSS-CORE服务启动加载诊断依据缓存成功!");
+
+        cacheFacade.loadHostipalPush();
+        log.info("CDSS-CORE服务启动加载医院大数据推送类型成功!");
+
+        conceptInfoFacade.loadCustomDictionary();
+        log.info("CDSS-CORE服务启动加载NLP分词字典成功!");
 
         log.info("CDSS-CORE初始化完成!");
     }

+ 314 - 43
src/main/java/com/diagbot/facade/CommonFacade.java

@@ -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);
     }
 

+ 20 - 47
src/main/java/com/diagbot/facade/IndicationFacade.java

@@ -6,15 +6,12 @@ import com.diagbot.dto.WordCrfDTO;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.util.CoreUtil;
-import com.diagbot.util.ListUtil;
 import com.diagbot.util.ParamUtil;
 import com.diagbot.vo.IndicationPushVO;
-import com.diagbot.vo.StandConvert;
 import io.github.lvyahui8.spring.facade.DataFacade;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -40,16 +37,14 @@ public class IndicationFacade {
     @Autowired
     KlRegularConfigFacade klRegularConfigFacade;
 
-    private static final Map<String, List<String>> methodMap;
-
-    static {
-        methodMap = new HashMap<>();
-        methodMap.put("1", Arrays.asList("crf", "stand"));
-        methodMap.put("2", Arrays.asList("crf", "stand"));
-        methodMap.put("3", Arrays.asList("crf", "stand"));
-        methodMap.put("4", Arrays.asList("crf", "stand"));
-    }
-
+    // private static final Map<String, List<String>> methodMap;
+    // static {
+    //     methodMap = new HashMap<>();
+    //     methodMap.put("1", Arrays.asList("crf", "stand"));
+    //     methodMap.put("2", Arrays.asList("crf", "stand"));
+    //     methodMap.put("3", Arrays.asList("crf", "stand"));
+    //     methodMap.put("4", Arrays.asList("crf", "stand"));
+    // }
 
     /**
      * 提示总入口
@@ -64,36 +59,16 @@ public class IndicationFacade {
         List<String> ruleTypeList = Arrays.asList(indicationPushVO.getRuleType().split(","));
         indicationPushVO.setRuleTypeList(ruleTypeList);
 
-        List<String> methodList = new ArrayList<>();
-        for (String ruleType : ruleTypeList) {
-            if (ListUtil.isNotEmpty(methodMap.get(ruleType))) {
-                List<String> methods = methodMap.get(ruleType);
-                for (String method : methods) {
-                    if (!methodList.contains(method)) {
-                        methodList.add(method);
-                    }
-                }
-            }
-        }
-
-        WordCrfDTO wordCrfDTO = new WordCrfDTO();
-        long l1 = System.currentTimeMillis();
+        long start = System.currentTimeMillis();
+        // CRF模型处理
+        WordCrfDTO wordCrfDTO = commonFacade.crf_process(indicationPushVO, false);
+        CoreUtil.getDebugStr(start, "模型处理耗时", debug);
 
-        // 模型处理数据
-        long crfStart = System.currentTimeMillis();
-        if (methodList.contains("crf")) {
-            wordCrfDTO = commonFacade.crf_process(indicationPushVO);
-        }
-        CoreUtil.getDebugStr(crfStart, "模型处理耗时", debug);
-
-        // 标准词转换
+        // 同义词转换
         long standStart = System.currentTimeMillis();
-        if (methodList.contains("stand")) {
-            StandConvert standConvert = commonFacade.dataTypeGet(wordCrfDTO);
-            Map<String, Map<String, String>> standConvertMap = neoFacade.standConvertCrf(standConvert);
-            commonFacade.dataTypeSet(wordCrfDTO, standConvertMap);
-        }
+        commonFacade.wordStandConvert(wordCrfDTO);
         CoreUtil.getDebugStr(standStart, "标准词转换耗时", debug);
+
         //正则匹配开始
         wordCrfDTO = klRegularConfigFacade.getRegularConfigs(wordCrfDTO, indicationPushVO);
         //正则匹配结束
@@ -114,7 +89,7 @@ public class IndicationFacade {
         }
 
         // 输入调试信息
-        CoreUtil.getDebugStr(l1, "本次调用总计耗时", res.getDebug());
+        CoreUtil.getDebugStr(start, "本次调用总计耗时", res.getDebug());
         CoreUtil.getDebugObject("数据", res.getDebug(), wordCrfDTO);
         return res;
     }
@@ -126,12 +101,10 @@ public class IndicationFacade {
      * @return
      */
     public WordCrfDTO getWordCrfDTO(IndicationPushVO indicationPushVO) {
-        // 模型处理数据
-        WordCrfDTO wordCrfDTO = commonFacade.crf_process(indicationPushVO);
-
-        StandConvert standConvert = commonFacade.dataTypeGet(wordCrfDTO);
-        Map<String, Map<String, String>> standConvertMap = neoFacade.standConvertCrf(standConvert);
-        commonFacade.dataTypeSet(wordCrfDTO, standConvertMap);
+        // CRF模型处理
+        WordCrfDTO wordCrfDTO = commonFacade.crf_process(indicationPushVO, true);
+        // 同义词转换
+        commonFacade.wordStandConvert(wordCrfDTO);
         return wordCrfDTO;
     }
 }

+ 57 - 1
src/main/java/com/diagbot/facade/NLPFacade.java

@@ -1,8 +1,14 @@
 package com.diagbot.facade;
 
+import com.google.common.collect.Lists;
 import com.hankcs.hanlp.HanLP;
+import com.hankcs.hanlp.seg.common.Term;
 import org.springframework.stereotype.Component;
 
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @Description:
  * @author: gaodm
@@ -14,4 +20,54 @@ public class NLPFacade {
     public String segment(String text) {
         return HanLP.segment(text).toString();
     }
-}
+
+    /**
+     * 返回所有结果
+     *
+     * @param text
+     * @return
+     */
+    public Map<String, List<String>> getMap(String text) {
+        Map<String, List<String>> map = new LinkedHashMap<>();
+        List<Term> termList = HanLP.segment(text);
+        for (Term term : termList) {
+            String word = term.word;
+            String type = term.nature.toString();
+            List<String> splitTypeList = Lists.newArrayList(type.split(","));
+            for (String t : splitTypeList) {
+                if (map.get(t) != null) {
+                    map.get(t).add(word);
+                } else {
+                    List<String> wordList = Lists.newArrayList();
+                    wordList.add(word);
+                    map.put(t, wordList);
+                }
+            }
+        }
+        return map;
+    }
+
+    /**
+     * 根据指定指定返回结果
+     *
+     * @param text
+     * @param filterType
+     * @return
+     */
+    public List<String> getByType(String text, String filterType) {
+        List<String> res = Lists.newArrayList();
+        List<Term> termList = HanLP.segment(text);
+        for (Term term : termList) {
+            String word = term.word;
+            String type = term.nature.toString();
+            List<String> splitTypeList = Lists.newArrayList(type.split(","));
+            for (String splitType : splitTypeList) {
+                if (filterType.equals(splitType)) {
+                    res.add(word);
+                }
+            }
+        }
+        return res;
+    }
+
+}

+ 0 - 216
src/main/java/com/diagbot/facade/NeoFacade.java

@@ -9,17 +9,12 @@ import com.diagbot.dto.DrugTypeCacheDTO;
 import com.diagbot.dto.DrugTypeDTO;
 import com.diagbot.dto.NeoPushDTO;
 import com.diagbot.dto.RuleDTO;
-import com.diagbot.dto.StandConvertCrfBatchDTO;
-import com.diagbot.dto.StandConvertCrfDTO;
 import com.diagbot.entity.KlDiseaseCorresponding;
 import com.diagbot.entity.SymptomFeature;
 import com.diagbot.entity.TranHospitalFilter;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.PushRelationTypeEnum;
 import com.diagbot.enums.RedisEnum;
-import com.diagbot.enums.StandConvertEnum;
-import com.diagbot.exception.CommonErrorCode;
-import com.diagbot.exception.CommonException;
 import com.diagbot.model.entity.PD;
 import com.diagbot.service.KlDiseaseCorrespondingService;
 import com.diagbot.service.SymptomFeatureService;
@@ -30,8 +25,6 @@ import com.diagbot.util.RedisUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.vo.DiseaseItemVO;
 import com.diagbot.vo.NeoPushVO;
-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.PresentPushVo;
@@ -41,11 +34,9 @@ import com.google.common.collect.Maps;
 import org.apache.commons.collections.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Component;
 
-import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -72,8 +63,6 @@ public class NeoFacade {
     @Autowired
     @Qualifier("redisTemplateForSimilar")
     RedisTemplate redisTemplate;
-    @Value("${StandConvert.rate}")
-    String standConvertRate;
     @Autowired
     SymptomFeatureService symptomFeatureService;
     @Autowired
@@ -485,211 +474,6 @@ public class NeoFacade {
         }
     }
 
-
-    /**
-     * 标准词转换
-     * 类型,疾病: 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;
-    }
-
-    /**
-     * 入参数据处理
-     *
-     * @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);
-    }
-
-
-    /**
-     * 获取标准词转换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);
-    }
-
     public void allRuleCache() {
         List<RuleDTO> ruleDTOList = klRuleFacade.getAllRule();
         if (ListUtil.isNotEmpty(ruleDTOList)) {

+ 5 - 10
src/main/java/com/diagbot/facade/PushFacade.java

@@ -21,7 +21,6 @@ import com.diagbot.util.StringUtil;
 import com.diagbot.vo.PushNewVO;
 import com.diagbot.vo.PushPlanVO;
 import com.diagbot.vo.PushVO;
-import com.diagbot.vo.StandConvert;
 import com.google.common.collect.Lists;
 import io.github.lvyahui8.spring.facade.DataFacade;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -128,16 +127,14 @@ public class PushFacade {
         Map<String, Object> debug = new LinkedHashMap<>();
         debug.put("大数据推送地址", pushUrl);
 
-        // 模型处理数据
+        // CRF模型处理
         long start = System.currentTimeMillis();
-        WordCrfDTO wordCrfDTO = commonFacade.crf_process(pushVo);
+        WordCrfDTO wordCrfDTO = commonFacade.crf_process(pushVo, false);
         CoreUtil.getDebugStr(start, "模型处理耗时", debug);
 
-        // 标准词转换
+        // 同义词转换
         long standStart = System.currentTimeMillis();
-        StandConvert standConvert = commonFacade.dataTypeGet(wordCrfDTO);
-        Map<String, Map<String, String>> standConvertMap = neoFacade.standConvertCrf(standConvert);
-        commonFacade.dataTypeSet(wordCrfDTO, standConvertMap);
+        commonFacade.wordStandConvert(wordCrfDTO);
         CoreUtil.getDebugStr(standStart, "标准词转换耗时", debug);
         ParamUtil.dealLis(wordCrfDTO.getLis());
 
@@ -287,9 +284,7 @@ public class PushFacade {
             wordCrfDTO.setOperationName(pushPlanVO.getOperationName());
             // 标准词转换
             long standStart = System.currentTimeMillis();
-            StandConvert standConvert = commonFacade.dataTypeGet(wordCrfDTO);
-            Map<String, Map<String, String>> standConvertMap = neoFacade.standConvertCrf(standConvert);
-            commonFacade.dataTypeSet(wordCrfDTO, standConvertMap);
+            commonFacade.wordStandConvert(wordCrfDTO);
             CoreUtil.getDebugStr(standStart, "标准词转换耗时", debug);
             // 推送随访计划
             long pushStart = System.currentTimeMillis();

+ 2 - 1
src/main/java/com/diagbot/vo/PushNewVO.java

@@ -9,10 +9,11 @@ import lombok.Data;
  */
 @Data
 public class PushNewVO {
-    private String hospitalType = "0"; // 医院类型, 0:全科,1:妇幼,2:精神
+    private String hospitalType = "0";
     private Double age; // 年龄
     private Integer sex; // 性别
     private String chief; // 主诉
     private String present; // 现病史
     private Integer num = 10; // 疾病个数
+    // private WordCrfDTO wordCrfDTO = new WordCrfDTO();
 }

+ 2 - 2
src/main/java/com/diagbot/web/CrfController.java

@@ -29,8 +29,8 @@ public class CrfController {
     IndicationFacade indicationFacade;
 
     @ApiOperation(value = "CRF转换[zhoutg]", notes = "ruleType(1:危急值提醒,2:开单合理项,3:高危药品、手术,4:其他提醒)")
-    @PostMapping("/indication")
-    public RespDTO<WordCrfDTO> indication(@Valid @RequestBody IndicationPushVO indicationPushVO) {
+    @PostMapping("/getWordCrfDTO")
+    public RespDTO<WordCrfDTO> getWordCrfDTO(@Valid @RequestBody IndicationPushVO indicationPushVO) {
         WordCrfDTO wordCrfDTO = indicationFacade.getWordCrfDTO(indicationPushVO);
         return RespDTO.onSuc(wordCrfDTO);
     }

+ 10 - 2
src/main/java/com/diagbot/web/NLPController.java

@@ -3,7 +3,6 @@ package com.diagbot.web;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.NLPFacade;
-import com.hankcs.hanlp.seg.common.Term;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -11,7 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.List;
+import java.util.Map;
 
 /**
  * @Description:
@@ -33,4 +32,13 @@ public class NLPController {
     public RespDTO<String> segment(String text){
         return RespDTO.onSuc(nlpFacade.segment(text));
     }
+
+    @ApiOperation(value = "NLP分词放入组[by:zhoutg]",
+            notes = "")
+    @PostMapping("/getMap")
+    @SysLogger("getMap")
+    public RespDTO<Map> getMap(String text){
+        return RespDTO.onSuc(nlpFacade.getMap(text));
+    }
+
 }

+ 1 - 1
src/main/java/com/diagbot/web/TestController.java

@@ -185,7 +185,7 @@ public class TestController {
 
     @ApiOperation(value = "crf解析测试[zhoutg]", notes = "content:文本内容\n" +
             "modelType:模型类型,主诉、现病史:chief_present,既往史:PastFamily_cx,查体:Present_cx,个人史:PersonalHistory_cx,诊断:Diagnoses_cx")
-    @PostMapping("/testCrf")
+    @PostMapping("/A_testCrf")
     public RespDTO<Object> testCrf(@RequestBody TestCrfVO testCrfVO) {
         return RespDTO.onSuc(testFacade.testCrf(testCrfVO));
     }

+ 11 - 11
src/main/resources/mapper/ConceptInfoMapper.xml

@@ -74,19 +74,19 @@
 
     <select id="getAllWord" resultType="com.diagbot.dto.CustomDictionaryDTO">
         SELECT
-            t1.`name` AS `name`,
-            CONCAT_WS(" ", t1.type_id, (1200 - t1.type_id)) AS type
+            a. NAME,
+            GROUP_CONCAT(a.type_id) type
         FROM
-            `kl_library_info` t1,
-            kl_concept t2
+            kl_library_info a,
+            kl_concept b
         WHERE
-            t1.concept_id = t2.id
-        AND t1.is_deleted = "N"
-        AND t2.is_deleted = "N"
-        AND t2.`status` = 1
-        AND t1.type_id IN (103, 122, 126, 129)
-        ORDER BY
-            t1.type_id;
+            a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND a.id = b.lib_id
+        AND b.`status` = 1
+        AND a.type_id IN (103, 122, 126, 129)
+        GROUP BY
+            a.`name`
     </select>
 
 </mapper>