Jelajahi Sumber

术语映射预匹配

zhaops 4 tahun lalu
induk
melakukan
56b129ee6d
1 mengubah file dengan 56 tambahan dan 2 penghapusan
  1. 56 2
      src/main/java/com/diagbot/facade/MappingConfigFacade.java

+ 56 - 2
src/main/java/com/diagbot/facade/MappingConfigFacade.java

@@ -646,6 +646,9 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                 item.setIsMatch(0);
             }
         }
+
+        //添加编码
+        retList = addCodes(retList, type);
         return retList;
     }
 
@@ -1009,7 +1012,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
         BeanUtils.copyProperties(item, itemWrapper);
         List<MappingConfigWrapper> retList = Lists.newArrayList();
         retList.add(itemWrapper);
-        addNames(retList);
+        retList = addNames(retList);
 
         return retList.get(0);
     }
@@ -1043,7 +1046,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
 
         retList = BeanUtil.listCopyTo(list, MappingConfigWrapper.class);
 
-        addNames(retList);
+        retList = addNames(retList);
         return retList;
     }
 
@@ -1427,6 +1430,57 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
     }
 
 
+    /**
+     * 返回结果添加编码
+     *
+     * @param list
+     * @return
+     */
+    public List<MappingConfigWrapper> addCodes(List<MappingConfigWrapper> list, Integer type) {
+        List<MappingConfigWrapper> retList = Lists.newLinkedList();
+        if (ListUtil.isEmpty(list)) {
+            return list;
+        }
+
+        if (!(type.equals(ConceptTypeEnum.Operation.getKey())
+                || type.equals(ConceptTypeEnum.Disease.getKey())
+                || type.equals(ConceptTypeEnum.Tcmdisease.getKey())
+                || type.equals(ConceptTypeEnum.Tcmsyndrome.getKey()))) {
+            return list;
+        }
+
+        List<String> names = list.stream()
+                .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
+                .map(MappingConfigWrapper::getUniqueName)
+                .collect(Collectors.toList());
+
+        ConceptVO conceptVO = new ConceptVO();
+        conceptVO.setSource(MatchSourceEnum.StandWord.getKey());
+        conceptVO.setType(type);
+        conceptVO.setNames(names);
+        RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
+        if (RespDTOUtil.respIsOK(respDTO)) {
+            Map<String, List<String>> conceptMap
+                    = respDTO.data.stream().collect(Collectors.groupingBy(IndexBatchDTO::getName,
+                    Collectors.mapping(IndexBatchDTO::getCode, Collectors.toList())));
+            for (MappingConfigWrapper record : list) {
+                if (StringUtil.isNotBlank(record.getUniqueName())
+                        && conceptMap.containsKey(record.getUniqueName())) {
+                    for (String code : conceptMap.get(record.getUniqueName())) {
+                        MappingConfigWrapper tempRecord = new MappingConfigWrapper();
+                        BeanUtils.copyProperties(record, tempRecord);
+                        tempRecord.setCode(code);
+                        retList.add(tempRecord);
+                    }
+                } else {
+                    retList.add(record);
+                }
+            }
+        }
+        return retList;
+    }
+
+
     /**
      * 医院术语检索
      *