浏览代码

1、术语关联

zhaops 4 年之前
父节点
当前提交
0c7d0f1fc7

+ 9 - 0
src/main/java/com/diagbot/client/CdssCoreClient.java

@@ -67,6 +67,15 @@ public interface CdssCoreClient {
     @PostMapping("/retrieval/staticKnowledgeIndex")
     RespDTO<List<StaticKnowledgeIndexDTO>> staticKnowledgeIndex(@RequestBody @Valid StaticKnowledgeIndexVO staticKnowledgeIndexVO);
 
+    /**
+     * 术语关联医学术语检索
+     *
+     * @param filterVO
+     * @return
+     */
+    @PostMapping("/retrieval/filter")
+    RespDTO<List<IndexBatchDTO>> filter(@Valid @RequestBody FilterVO filterVO);
+
     /**
      * 更新是否有静态知识状态
      *

+ 12 - 0
src/main/java/com/diagbot/client/hystrix/CdssCoreHystrix.java

@@ -83,6 +83,18 @@ public class CdssCoreHystrix implements CdssCoreClient {
         return null;
     }
 
+    /**
+     * 术语关联医学术语检索
+     *
+     * @param filterVO
+     * @return
+     */
+    @Override
+    public RespDTO<List<IndexBatchDTO>> filter(@Valid @RequestBody FilterVO filterVO) {
+        log.error("【hystrix】调用{}异常", "filter");
+        return null;
+    }
+
     /**
      * 更新是否有静态知识状态
      *

+ 30 - 0
src/main/java/com/diagbot/entity/DiseaseConfig.java

@@ -80,6 +80,18 @@ public class DiseaseConfig implements Serializable {
     @Excel(name = "ICD-10编码", width = 40, orderNum = "2", isImportField = "true")
     private String icdCode;
 
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配", width = 20, orderNum = "4", replace = {"未匹配_0,已匹配_1,_null"},isImportField = "true")
+    private Integer isMatch;
+
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源", width = 20, orderNum = "5", replace = {"标准词_1,同义词_2,编码_3,历史数据_4,相似词_5,数据迁移_99,_null"},isImportField = "true")
+    private Integer source;
+
     public Long getId() {
         return id;
     }
@@ -160,6 +172,22 @@ public class DiseaseConfig implements Serializable {
         this.icdCode = icdCode;
     }
 
+    public Integer getIsMatch() {
+        return isMatch;
+    }
+
+    public void setIsMatch(Integer isMatch) {
+        this.isMatch = isMatch;
+    }
+
+    public Integer getSource() {
+        return source;
+    }
+
+    public void setSource(Integer source) {
+        this.source = source;
+    }
+
     @Override
     public String toString() {
         return "DiseaseConfig{" +
@@ -173,6 +201,8 @@ public class DiseaseConfig implements Serializable {
                 ", hisName=" + hisName +
                 ", uniqueName=" + uniqueName +
                 ", icdCode=" + icdCode +
+                ", isMatch=" + isMatch +
+                ", source=" + source +
                 "}";
     }
 

+ 29 - 0
src/main/java/com/diagbot/entity/DrugConfig.java

@@ -91,6 +91,19 @@ public class DrugConfig implements Serializable {
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String form;
 
+
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配", width = 20, orderNum = "4", replace = { "未匹配_0", "已匹配_1", "_null" })
+    private Integer isMatch;
+
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源", width = 20, orderNum = "5", replace = { "标准词_1", "同义词_2", "编码_3", "历史数据_4", "相似词_5", "数据迁移_99", "_null" })
+    private Integer source;
+
     public Long getId() {
         return id;
     }
@@ -179,6 +192,22 @@ public class DrugConfig implements Serializable {
         this.form = form;
     }
 
+    public Integer getIsMatch() {
+        return isMatch;
+    }
+
+    public void setIsMatch(Integer isMatch) {
+        this.isMatch = isMatch;
+    }
+
+    public Integer getSource() {
+        return source;
+    }
+
+    public void setSource(Integer source) {
+        this.source = source;
+    }
+
     @Override
     public String toString() {
         return "DrugConfig{" +

+ 4 - 0
src/main/java/com/diagbot/entity/MappingConfig.java

@@ -1,6 +1,8 @@
 package com.diagbot.entity;
 
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 
@@ -74,6 +76,7 @@ public class MappingConfig implements Serializable {
     /**
      * 医院术语细项名称(检验细项)
      */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String hisDetailName;
 
     /**
@@ -84,6 +87,7 @@ public class MappingConfig implements Serializable {
     /**
      * 药品剂型id
      */
+    @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Long formConceptId;
 
     /**

+ 28 - 0
src/main/java/com/diagbot/entity/PacsConfig.java

@@ -80,6 +80,18 @@ public class PacsConfig implements Serializable {
     //@Excel(name = "对应项编码", width = 40, orderNum = "2")
     private String uniqueCode;
 
+    /**
+     * 是否匹配(0-未匹配、1-已匹配)
+     */
+    @Excel(name = "是否匹配", width = 20, orderNum = "4", replace = {"未匹配_0","已匹配_1","_null"})
+    private Integer isMatch;
+
+    /**
+     * 数据来源(1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移)
+     */
+    @Excel(name = "数据来源", width = 20, orderNum = "5", replace = {"标准词_1","同义词_2","编码_3","历史数据_4","相似词_5","数据迁移_99","_null"})
+    private Integer source;
+
     public Long getId() {
         return id;
     }
@@ -160,6 +172,22 @@ public class PacsConfig implements Serializable {
         this.uniqueCode = uniqueCode;
     }
 
+    public Integer getIsMatch() {
+        return isMatch;
+    }
+
+    public void setIsMatch(Integer isMatch) {
+        this.isMatch = isMatch;
+    }
+
+    public Integer getSource() {
+        return source;
+    }
+
+    public void setSource(Integer source) {
+        this.source = source;
+    }
+
     @Override
     public String toString() {
         return "PacsConfig{" +

+ 168 - 54
src/main/java/com/diagbot/facade/MappingConfigFacade.java

@@ -32,6 +32,7 @@ import com.diagbot.util.RespDTOUtil;
 import com.diagbot.util.StringUtil;
 import com.diagbot.util.SysUserUtils;
 import com.diagbot.vo.ConceptVO;
+import com.diagbot.vo.FilterVO;
 import com.diagbot.vo.MappingConfigPageVO;
 import com.google.common.collect.Lists;
 import org.apache.ibatis.annotations.Param;
@@ -65,14 +66,40 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
      * @return
      */
     @Override
-    public IPage<MappingConfig> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO) {
+    public IPage<MappingConfigWrapper> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO) {
         if (mappingConfigPageVO.getHospitalId() == null) {
             mappingConfigPageVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
         }
 
+        FilterVO filterVO = new FilterVO();
+        RespDTO<List<IndexBatchDTO>> respDTO = null;
+
         //todo 标准词转conceptId
+        if (StringUtil.isNotBlank(mappingConfigPageVO.getUniqueName())) {
+            filterVO.setInputStr(mappingConfigPageVO.getUniqueName());
+            respDTO = cdssCoreClient.filter(filterVO);
+            if (RespDTOUtil.respIsOK(respDTO) && ListUtil.isNotEmpty(respDTO.data)) {
+                mappingConfigPageVO.setConceptIds(respDTO.data
+                        .stream()
+                        .map(IndexBatchDTO::getId)
+                        .distinct()
+                        .collect(Collectors.toList()));
+            }
+        }
 
         //todo 药品剂型转 conceptId
+        if (StringUtil.isNotBlank(mappingConfigPageVO.getForm())) {
+            filterVO.setInputStr(mappingConfigPageVO.getForm());
+            respDTO = cdssCoreClient.filter(filterVO);
+            if (RespDTOUtil.respIsOK(respDTO) && ListUtil.isNotEmpty(respDTO.data)) {
+                mappingConfigPageVO.setFormConceptIds(respDTO.data
+                        .stream()
+                        .filter(i -> i.getType().equals(ConceptTypeEnum.Form.getKey()))
+                        .map(IndexBatchDTO::getId)
+                        .distinct()
+                        .collect(Collectors.toList()));
+            }
+        }
 
         //todo 多条匹配
         if (mappingConfigPageVO.getIsMatch() != null && mappingConfigPageVO.getIsMatch().equals(2)) {
@@ -80,9 +107,30 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
             mappingConfigPageVO.setIsMultiple(1);
         }
 
-        IPage<MappingConfig> page = super.getPage(mappingConfigPageVO);
+        IPage<MappingConfigWrapper> page = super.getPage(mappingConfigPageVO);
 
         //todo conceptId转标准词
+        List<MappingConfigWrapper> records = page.getRecords();
+        ConceptVO conceptVO = new ConceptVO();
+        List<Long> ids = Lists.newArrayList();
+        ids.addAll(records.stream().map(MappingConfigWrapper::getConceptId).collect(Collectors.toList()));
+        ids.addAll(records.stream().filter(i -> i.getFormConceptId() != null)
+                .map(MappingConfigWrapper::getFormConceptId).collect(Collectors.toList()));
+        conceptVO.setIds(ids);
+        RespDTO<List<IndexBatchDTO>> resultRespDTO = cdssCoreClient.getConceptNames(conceptVO);
+        if (RespDTOUtil.respIsOK(resultRespDTO) && ListUtil.isNotEmpty(resultRespDTO.data)) {
+            Map<Long, String> conceptMap
+                    = resultRespDTO.data.stream().collect(Collectors.toMap(IndexBatchDTO::getId, IndexBatchDTO::getName));
+            for (MappingConfigWrapper record : records) {
+                if (conceptMap.containsKey(record.getConceptId())) {
+                    record.setUniqueName(conceptMap.get(record.getConceptId()));
+                }
+                if (record.getFormConceptId() != null && conceptMap.containsKey(record.getFormConceptId())) {
+                    record.setForm(conceptMap.get(record.getFormConceptId()));
+                }
+            }
+            page.setRecords(records);
+        }
 
         return page;
     }
@@ -210,7 +258,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                 originList = BeanUtil.listCopyTo(diseaseConfigList, MappingConfigWrapper.class);
                 break;
             case 5:
-                List<DrugConfig> drugConfigList = ExcelUtils.importExcel(file, 0, 1, DrugConfig.class);
+                List<DrugConfig> drugConfigList = ExcelUtils.importExcel(file, 1, 1, DrugConfig.class);
                 originList = BeanUtil.listCopyTo(drugConfigList, MappingConfigWrapper.class);
                 break;
             case 6:
@@ -259,6 +307,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
      */
     public List<MappingConfigWrapper> dataProcess(List<MappingConfigWrapper> originList, Integer type) {
         List<MappingConfigWrapper> retList = Lists.newLinkedList();
+        List<MappingConfigWrapper> dataList = Lists.newLinkedList();
         List<MappingConfigWrapper> standardList = Lists.newLinkedList();
         List<MappingConfigWrapper> synonymsList = Lists.newLinkedList();
         List<MappingConfigWrapper> codeList = Lists.newLinkedList();
@@ -266,6 +315,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
 
         //数据完整性校验
         for (MappingConfigWrapper item : originList) {
+            //过滤医院术语名称为空的条目
             if (StringUtil.isNotBlank(item.getHisName())) {
                 item.setHisName(item.getHisName().trim());
             } else {
@@ -278,20 +328,20 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                 item.setHisCode(item.getHisCode().trim());
             }
             item.setUniqueName("");
-            standardList.add(item);
+            dataList.add(item);
         }
 
-        if (ListUtil.isEmpty(standardList)) {
+        if (ListUtil.isEmpty(dataList)) {
             return retList;
         }
 
         //标准词匹配
-        List<String> nameList = standardList.stream()
+        List<String> nameList = dataList.stream()
                 .filter(i -> StringUtil.isBlank(i.getHisDetailName()))
                 .map(MappingConfigWrapper::getHisName)
                 .distinct()
                 .collect(Collectors.toList());
-        List<String> subNameList = standardList.stream()
+        List<String> subNameList = dataList.stream()
                 .filter(i -> StringUtil.isNotBlank(i.getHisDetailName()))
                 .map(MappingConfigWrapper::getHisDetailName)
                 .distinct()
@@ -307,44 +357,51 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
         conceptVO.setNames(subNameList);
         RespDTO<List<IndexBatchDTO>> subRespDTO = cdssCoreClient.getConceptNames(conceptVO);
         RespDTOUtil.respNGDealCover(subRespDTO, "标准术语校验失败");
-        Map<String, IndexBatchDTO> nameMap = new HashMap<>();
-        Map<String, IndexBatchDTO> subNameMap = new HashMap<>();
+        Map<String, List<IndexBatchDTO>> nameMap = new HashMap<>();
+        Map<String, List<IndexBatchDTO>> subNameMap = new HashMap<>();
         if (ListUtil.isNotEmpty(respDTO.data)) {
-            nameMap = respDTO.data.stream().collect(Collectors.toMap(IndexBatchDTO::getName, v -> v));
+            nameMap = respDTO.data.stream().collect(Collectors.groupingBy(IndexBatchDTO::getName));
         }
         if (ListUtil.isNotEmpty(subRespDTO.data)) {
-            subNameMap = subRespDTO.data.stream().collect(Collectors.toMap(IndexBatchDTO::getName, v -> v));
+            subNameMap = subRespDTO.data.stream().collect(Collectors.groupingBy(IndexBatchDTO::getName));
         }
-        for (MappingConfigWrapper item : standardList) {
-            IndexBatchDTO index = null;
+        for (MappingConfigWrapper item : dataList) {
+            List<IndexBatchDTO> indexList = Lists.newArrayList();
             if (type.equals(ConceptTypeEnum.LisPack.getKey()) && StringUtil.isNotBlank(item.getHisDetailName())) {
                 if (subNameMap.containsKey(item.getHisDetailName())) {
-                    index = subNameMap.get(item.getHisDetailName());
+                    indexList = subNameMap.get(item.getHisDetailName());
                 }
             } else {
                 if (nameMap.containsKey(item.getHisName())) {
-                    index = nameMap.get(item.getHisName());
+                    indexList = nameMap.get(item.getHisName());
                 }
             }
 
-            if (index == null) {
+            if (ListUtil.isEmpty(indexList)) {
+                standardList.add(item);
                 continue;
             }
-            item.setUniqueName(index.getName());
-            item.setConceptId(index.getId());
-            item.setCode(index.getCode());
-            item.setIsMatch(1);
-            item.setSource(MatchSourceEnum.StandWord.getKey());
+            //标准词默认取第一个
+            MappingConfigWrapper standardItem = new MappingConfigWrapper();
+            BeanUtil.copyProperties(item, standardItem);
+            standardItem.setUniqueName(indexList.get(0).getName());
+            standardItem.setConceptId(indexList.get(0).getId());
+            standardItem.setCode(indexList.get(0).getCode());
+            standardItem.setIsMatch(1);
+            standardItem.setSource(MatchSourceEnum.StandWord.getKey());
+            standardList.add(standardItem);
         }
 
         //同义词匹配
         List<String> synonymsNameList = standardList.stream()
-                .filter(i -> i.getConceptId() == null && StringUtil.isBlank(i.getHisDetailName()))
+                .filter(i -> (i.getIsMatch() == null || i.getIsMatch().equals(0))
+                        && StringUtil.isBlank(i.getHisDetailName()))
                 .map(MappingConfigWrapper::getHisName)
                 .distinct()
                 .collect(Collectors.toList());
         List<String> synonymsSubNameList = standardList.stream()
-                .filter(i -> i.getConceptId() == null && StringUtil.isNotBlank(i.getHisDetailName()))
+                .filter(i -> (i.getIsMatch() == null || i.getIsMatch().equals(0))
+                        && StringUtil.isNotBlank(i.getHisDetailName()))
                 .map(MappingConfigWrapper::getHisDetailName)
                 .distinct()
                 .collect(Collectors.toList());
@@ -380,6 +437,12 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                     indexList = synonymsNameMap.get(item.getHisName());
                 }
             }
+
+            if (ListUtil.isEmpty(indexList)) {
+                synonymsList.add(item);
+                continue;
+            }
+
             for (IndexBatchDTO index : indexList) {
                 MappingConfigWrapper synonymsItem = new MappingConfigWrapper();
                 BeanUtils.copyProperties(item, synonymsItem);
@@ -398,7 +461,8 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                 || type.equals(ConceptTypeEnum.Tcmdisease.getKey())
                 || type.equals(ConceptTypeEnum.Tcmsyndrome.getKey())) {
             List<String> codes = synonymsList.stream()
-                    .filter(i -> StringUtil.isNotBlank(i.getCode()))
+                    .filter(i -> (i.getIsMatch() == null || i.getIsMatch().equals(0))
+                            && StringUtil.isNotBlank(i.getCode()))
                     .map(MappingConfigWrapper::getCode)
                     .distinct()
                     .collect(Collectors.toList());
@@ -437,32 +501,48 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                     }
                 }
             }
+        } else {
+            codeList = BeanUtil.listCopyTo(synonymsList, MappingConfigWrapper.class);
         }
 
         //todo 历史匹配
         List<String> hisNames = codeList.stream()
-                .filter(i -> i.getIsMatch() == null)
+                .filter(i -> i.getIsMatch() == null || i.getIsMatch().equals(0))
                 .map(MappingConfigWrapper::getHisName)
                 .distinct()
                 .collect(Collectors.toList());
         if (ListUtil.isNotEmpty(hisNames)) {
-            Map<String, Map<String, List<String>>> configMap = groupByHisNameWithName(hisNames, type, null);
+            Map<String, Map<String, Map<String, List<String>>>> configMap = groupByHisNameWithName(hisNames, type, null);
 
             for (MappingConfigWrapper item : codeList) {
                 if (item.getIsMatch() != null && item.getIsMatch().equals(1)) {
                     retList.add(item);
                 }
                 if (configMap.containsKey(item.getHisName())) {
-                    Map<String, List<String>> subMap = configMap.get(item.getHisName());
-                    for (Map.Entry<String, List<String>> subEntry : subMap.entrySet()) {
-                        for (String name : subEntry.getValue()) {
+                    Map<String, Map<String, List<String>>> subMap = configMap.get(item.getHisName());
+                    for (Map.Entry<String, Map<String, List<String>>> subEntry : subMap.entrySet()) {
+                        for (String name : subEntry.getValue().keySet()) {
                             MappingConfigWrapper historyItem = new MappingConfigWrapper();
                             BeanUtils.copyProperties(item, historyItem);
                             historyItem.setHisDetailName(subEntry.getKey());
                             historyItem.setUniqueName(name);
                             historyItem.setIsMatch(1);
                             historyItem.setSource(MatchSourceEnum.History.getKey());
-                            retList.add(historyItem);
+                            if (type.equals(ConceptTypeEnum.Drug.getKey())) {
+                                List<String> forms = subEntry.getValue().get(name);
+                                if (ListUtil.isEmpty(forms)) {
+                                    retList.add(historyItem);
+                                } else {
+                                    for (String form : forms) {
+                                        MappingConfigWrapper formItem = new MappingConfigWrapper();
+                                        BeanUtil.copyProperties(historyItem, formItem);
+                                        formItem.setForm(form);
+                                        retList.add(formItem);
+                                    }
+                                }
+                            } else {
+                                retList.add(historyItem);
+                            }
                         }
                     }
                 }
@@ -470,7 +550,6 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
         } else {
             retList = BeanUtil.listCopyTo(codeList, MappingConfigWrapper.class);
         }
-
         return retList;
     }
 
@@ -481,10 +560,11 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
      * @param type
      * @return
      */
-    public Map<String, Map<String, List<Long>>> groupByHisNameWithId(List<String> hisNames, Integer type, Long hospitalId) {
-        Map<String, Map<String, List<Long>>> retMap = new HashMap<>();
+    public Map<String, Map<String, Map<Long, List<Long>>>> groupByHisNameWithId(List<String> hisNames, Integer type, Long hospitalId) {
+        Map<String, Map<String, Map<Long, List<Long>>>> retMap = new HashMap<>();
         QueryWrapper<MappingConfig> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                .eq("is_match", 1)
                 .eq("type", type);
         if (hospitalId != null) {
             queryWrapper.eq("hospital_id", hospitalId);
@@ -506,14 +586,15 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
 
         Map<String, List<MappingConfig>> hisMap = list.stream().collect(Collectors.groupingBy(MappingConfig::getHisName));
         for (Map.Entry<String, List<MappingConfig>> entry : hisMap.entrySet()) {
-            retMap.put(entry.getKey(), entry.getValue().stream().collect(Collectors.toMap(MappingConfig::getHisDetailName,
-                    v -> {
-                        List<Long> ids = Lists.newArrayList();
-                        ids.add(v.getConceptId());
-                        return ids;
-                    })));
+            Map<String, Map<Long, List<Long>>> subMap = new HashMap<>();
+            Map<String, List<MappingConfig>> detailMap = entry.getValue().stream()
+                    .collect(Collectors.groupingBy(MappingConfig::getHisDetailName));
+            for (Map.Entry<String, List<MappingConfig>> subEntry : detailMap.entrySet()) {
+                subMap.put(subEntry.getKey(), subEntry.getValue().stream().collect(Collectors.groupingBy(MappingConfig::getConceptId,
+                        Collectors.mapping(MappingConfig::getFormConceptId, Collectors.toList()))));
+            }
+            retMap.put(entry.getKey(), subMap);
         }
-
         return retMap;
     }
 
@@ -525,16 +606,30 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
      * @param hospitalId
      * @return
      */
-    public Map<String, Map<String, List<String>>> groupByHisNameWithName(List<String> hisNames, Integer type, Long hospitalId) {
-        Map<String, Map<String, List<String>>> retMap = new HashMap<>();
-        Map<String, Map<String, List<Long>>> idMap = groupByHisNameWithId(hisNames, type, hospitalId);
-
-        List<Long> ids = idMap.values().stream()
+    public Map<String, Map<String, Map<String, List<String>>>> groupByHisNameWithName(List<String> hisNames, Integer type, Long hospitalId) {
+        Map<String, Map<String, Map<String, List<String>>>> retMap = new HashMap<>();
+        Map<String, Map<String, Map<Long, List<Long>>>> idMap = groupByHisNameWithId(hisNames, type, hospitalId);
+
+        //conceptIds
+        List<Long> ids = idMap.values()
+                .stream()
+                .flatMap(i -> i.values().stream())
                 .map(i -> i.keySet())
                 .flatMap(Collection::stream)
-                .map(Long::valueOf)
+                .filter(i -> i != null)
                 .distinct()
                 .collect(Collectors.toList());
+
+        //formConceptId
+        ids.addAll(idMap.values()
+                .stream()
+                .flatMap(i -> i.values().stream())
+                .flatMap(i -> i.values().stream())
+                .flatMap(Collection::stream)
+                .filter(i -> i != null)
+                .distinct()
+                .collect(Collectors.toList()));
+
         ConceptVO conceptVO = new ConceptVO();
         conceptVO.setSource(-1);
         conceptVO.setType(type);
@@ -545,14 +640,33 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
         if (ListUtil.isNotEmpty(indexList)) {
             Map<Long, List<IndexBatchDTO>> indexMap
                     = indexList.stream().collect(Collectors.groupingBy(IndexBatchDTO::getId));
-            for (Map.Entry<String, Map<String, List<Long>>> entry : idMap.entrySet()) {
-                Map<String, List<String>> subMap = new HashMap<>();
-                for (Map.Entry<String, List<Long>> subEntry : entry.getValue().entrySet()) {
-                    List<String> nameList = Lists.newArrayList();
-                    subEntry.getValue().forEach(id -> {
-                        nameList.addAll(indexMap.get(id).stream().map(IndexBatchDTO::getName).collect(Collectors.toList()));
-                    });
-                    subMap.put(subEntry.getKey(), nameList);
+            for (Map.Entry<String, Map<String, Map<Long, List<Long>>>> entry : idMap.entrySet()) {
+                Map<String, Map<String, List<String>>> subMap = new HashMap<>();
+                for (Map.Entry<String, Map<Long, List<Long>>> subEntry : entry.getValue().entrySet()) {
+                    Map<String, List<String>> thirdMap = new HashMap<>();
+                    List<String> uniqueNames = Lists.newArrayList();
+                    List<String> forms = Lists.newArrayList();
+                    for (Long conceptId : subEntry.getValue().keySet()) {
+                        uniqueNames.addAll(indexMap.get(conceptId).stream().map(IndexBatchDTO::getName).collect(Collectors.toList()));
+                    }
+                    List<Long> formConceptIds = subEntry.getValue().values()
+                            .stream()
+                            .flatMap(Collection::stream)
+                            .distinct()
+                            .collect(Collectors.toList());
+                    for (Long formConceptId : formConceptIds) {
+                        if (formConceptId == null) {
+                            forms.add("");
+                        } else {
+                            forms.addAll(indexMap.get(formConceptId).stream().map(IndexBatchDTO::getName).collect(Collectors.toList()));
+                        }
+                    }
+                    forms = forms.stream().distinct().collect(Collectors.toList());
+                    for (String uniqueName : uniqueNames) {
+                        thirdMap.put(uniqueName, forms);
+                    }
+
+                    subMap.put(subEntry.getKey(), thirdMap);
                 }
                 retMap.put(entry.getKey(), subMap);
             }

+ 2 - 1
src/main/java/com/diagbot/mapper/MappingConfigMapper.java

@@ -3,6 +3,7 @@ package com.diagbot.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.entity.MappingConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
 import com.diagbot.vo.MappingConfigPageVO;
 import org.apache.ibatis.annotations.Param;
 
@@ -21,5 +22,5 @@ public interface MappingConfigMapper extends BaseMapper<MappingConfig> {
      * @param mappingConfigPageVO
      * @return
      */
-    IPage<MappingConfig> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO);
+    IPage<MappingConfigWrapper> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO);
 }

+ 2 - 1
src/main/java/com/diagbot/service/MappingConfigService.java

@@ -3,6 +3,7 @@ package com.diagbot.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.diagbot.entity.MappingConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
 import com.diagbot.vo.MappingConfigPageVO;
 import org.apache.ibatis.annotations.Param;
 
@@ -21,5 +22,5 @@ public interface MappingConfigService extends IService<MappingConfig> {
      * @param mappingConfigPageVO
      * @return
      */
-    IPage<MappingConfig> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO);
+    IPage<MappingConfigWrapper> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO);
 }

+ 2 - 1
src/main/java/com/diagbot/service/impl/MappingConfigServiceImpl.java

@@ -3,6 +3,7 @@ package com.diagbot.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.entity.MappingConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
 import com.diagbot.mapper.MappingConfigMapper;
 import com.diagbot.service.MappingConfigService;
 import com.diagbot.vo.MappingConfigPageVO;
@@ -26,7 +27,7 @@ public class MappingConfigServiceImpl extends ServiceImpl<MappingConfigMapper, M
      * @return
      */
     @Override
-    public IPage<MappingConfig> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO) {
+    public IPage<MappingConfigWrapper> getPage(@Param("mappingConfigPageVO") MappingConfigPageVO mappingConfigPageVO) {
         return baseMapper.getPage(mappingConfigPageVO);
     }
 }

+ 18 - 0
src/main/java/com/diagbot/vo/FilterVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2021/6/16 14:02
+ */
+@Getter
+@Setter
+public class FilterVO {
+    @NotBlank(message = "请输入检索内容")
+    private String inputStr;
+}

+ 3 - 4
src/main/java/com/diagbot/web/MappingConfigController.java

@@ -3,12 +3,11 @@ package com.diagbot.web;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.RespDTO;
-import com.diagbot.entity.MappingConfig;
+import com.diagbot.entity.wrapper.MappingConfigWrapper;
 import com.diagbot.facade.MappingConfigFacade;
 import com.diagbot.vo.MappingConfigPageVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -42,8 +41,8 @@ public class MappingConfigController {
     @ApiOperation(value = "分页查询[by:zhaops]", notes = "")
     @PostMapping("/getPage")
     @SysLogger("getPage")
-    public RespDTO<MappingConfig> getPage(@RequestBody @Valid MappingConfigPageVO mappingConfigPageVO) {
-        IPage<MappingConfig> data = mappingConfigFacade.getPage(mappingConfigPageVO);
+    public RespDTO<MappingConfigWrapper> getPage(@RequestBody @Valid MappingConfigPageVO mappingConfigPageVO) {
+        IPage<MappingConfigWrapper> data = mappingConfigFacade.getPage(mappingConfigPageVO);
         return RespDTO.onSuc(data);
     }
 

+ 1 - 1
src/main/resources/mapper/MappingConfigMapper.xml

@@ -23,7 +23,7 @@
     </resultMap>
 
     <!-- 分页查询 -->
-    <select id="getPage" resultType="com.diagbot.entity.MappingConfig">
+    <select id="getPage" resultType="com.diagbot.entity.wrapper.MappingConfigWrapper">
         select t1.*
         from
         (select a.*