|
@@ -410,9 +410,13 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
}
|
|
|
if (StringUtil.isNotBlank(item.getHisDetailName())) {
|
|
|
item.setHisDetailName(item.getHisDetailName().trim());
|
|
|
+ } else {
|
|
|
+ item.setHisDetailName("");
|
|
|
}
|
|
|
if (StringUtil.isNotBlank(item.getHisCode())) {
|
|
|
item.setHisCode(item.getHisCode().trim());
|
|
|
+ } else {
|
|
|
+ item.setHisCode("");
|
|
|
}
|
|
|
item.setUniqueName("");
|
|
|
dataList.add(item);
|
|
@@ -604,19 +608,24 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
for (MappingConfigWrapper item : codeList) {
|
|
|
if (item.getIsMatch() != null && item.getIsMatch().equals(1)) {
|
|
|
retList.add(item);
|
|
|
+ continue;
|
|
|
}
|
|
|
if (configMap.containsKey(item.getHisName())) {
|
|
|
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()) {
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ Map<String, List<String>> thirdMap = subMap.get(item.getHisDetailName());
|
|
|
+ if (thirdMap == null || thirdMap.size() == 0) {
|
|
|
+ retList.add(item);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (Map.Entry<String, List<String>> thirdEntry : thirdMap.entrySet()) {
|
|
|
MappingConfigWrapper historyItem = new MappingConfigWrapper();
|
|
|
BeanUtils.copyProperties(item, historyItem);
|
|
|
- historyItem.setHisDetailName(subEntry.getKey());
|
|
|
- historyItem.setUniqueName(name);
|
|
|
+ historyItem.setUniqueName(thirdEntry.getKey());
|
|
|
historyItem.setIsMatch(1);
|
|
|
historyItem.setSource(MatchSourceEnum.History.getKey());
|
|
|
if (type.equals(ConceptTypeEnum.Drug.getKey())) {
|
|
|
- List<String> forms = subEntry.getValue().get(name);
|
|
|
+ List<String> forms = thirdEntry.getValue();
|
|
|
if (ListUtil.isEmpty(forms)) {
|
|
|
retList.add(historyItem);
|
|
|
} else {
|
|
@@ -632,6 +641,8 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ retList.add(item);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -643,6 +654,9 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
item.setIsMatch(0);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //添加编码
|
|
|
+ retList = addCodes(retList, type);
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
@@ -786,7 +800,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
.eq("type", type)
|
|
|
.in("his_name", hisNames));
|
|
|
|
|
|
- if (ListUtil.isEmpty(existList)) {
|
|
|
+ if (ListUtil.isNotEmpty(existList)) {
|
|
|
List<MappingConfigWrapper> existWrapperList = BeanUtil.listCopyTo(existList, MappingConfigWrapper.class);
|
|
|
existWrapperList = addNames(existWrapperList);
|
|
|
for (MappingConfigWrapper item : existWrapperList) {
|
|
@@ -915,7 +929,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
}
|
|
|
|
|
|
//剂型校验
|
|
|
- if (type.equals(ConceptTypeEnum.Drug)) {
|
|
|
+ if (type.equals(ConceptTypeEnum.Drug.getKey())) {
|
|
|
conceptVO.setType(ConceptTypeEnum.Form.getKey());
|
|
|
conceptVO.setNames(tempList.stream()
|
|
|
.filter(i -> StringUtil.isNotBlank(i.getForm()))
|
|
@@ -1006,7 +1020,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);
|
|
|
}
|
|
@@ -1040,7 +1054,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
|
|
|
retList = BeanUtil.listCopyTo(list, MappingConfigWrapper.class);
|
|
|
|
|
|
- addNames(retList);
|
|
|
+ retList = addNames(retList);
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
@@ -1151,7 +1165,8 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
.eq("hospital_id", mappingConfig.getHospitalId())
|
|
|
.eq("type", mappingConfig.getType())
|
|
|
.eq("his_name", mappingConfig.getHisName())
|
|
|
- .eq("concept_id", null);
|
|
|
+ .isNull("concept_id")
|
|
|
+ .eq("is_match", 0);
|
|
|
if (StringUtil.isBlank(mappingConfig.getHisDetailName())) {
|
|
|
qwUnMaptch.and(i -> i.isNull("his_detail_name")
|
|
|
.or()
|
|
@@ -1196,8 +1211,12 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
if (StringUtil.isBlank(item.getHisDetailName())) {
|
|
|
item.setHisDetailName("");
|
|
|
}
|
|
|
+ item.setId(null);
|
|
|
+ item.setHospitalId(null);
|
|
|
}
|
|
|
|
|
|
+ list = list.stream().distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
Map<String, List<MappingConfig>> hisMap = list.stream()
|
|
|
.filter(i -> StringUtil.isNotBlank(i.getHisName()))
|
|
|
.collect(Collectors.groupingBy(MappingConfig::getHisName));
|
|
@@ -1206,8 +1225,11 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
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()))));
|
|
|
+ subMap.put(subEntry.getKey(),
|
|
|
+ subEntry.getValue()
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.groupingBy(MappingConfig::getConceptId,
|
|
|
+ Collectors.mapping(MappingConfig::getFormConceptId, Collectors.toList()))));
|
|
|
}
|
|
|
retMap.put(entry.getKey(), subMap);
|
|
|
}
|
|
@@ -1254,40 +1276,28 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
|
|
|
List<IndexBatchDTO> indexList = respDTO.data;
|
|
|
if (ListUtil.isNotEmpty(indexList)) {
|
|
|
- Map<Long, List<IndexBatchDTO>> indexMap
|
|
|
- = indexList.stream().collect(Collectors.groupingBy(IndexBatchDTO::getId));
|
|
|
+ Map<Long, String> idNameMap
|
|
|
+ = indexList.stream().collect(Collectors.toMap(IndexBatchDTO::getId, IndexBatchDTO::getName));
|
|
|
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()) {
|
|
|
- if (indexMap.containsKey(conceptId)) {
|
|
|
- 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 {
|
|
|
- if (indexMap.containsKey(formConceptId)) {
|
|
|
- forms.addAll(indexMap.get(formConceptId).stream().map(IndexBatchDTO::getName).collect(Collectors.toList()));
|
|
|
+ for (Map.Entry<Long, List<Long>> thirdEntry : subEntry.getValue().entrySet()) {
|
|
|
+ List<Long> formConceptIds = thirdEntry.getValue();
|
|
|
+ List<String> forms = Lists.newArrayList();
|
|
|
+ if (ListUtil.isNotEmpty(formConceptIds)) {
|
|
|
+ for (Long formConceptId : formConceptIds) {
|
|
|
+ if (formConceptId == null) {
|
|
|
+ forms.add("");
|
|
|
+ } else {
|
|
|
+ forms.add(idNameMap.get(formConceptId));
|
|
|
+ }
|
|
|
}
|
|
|
+ forms = forms.stream().distinct().collect(Collectors.toList());
|
|
|
+ thirdMap.put(idNameMap.get(thirdEntry.getKey()), forms);
|
|
|
}
|
|
|
}
|
|
|
- forms = forms.stream().distinct().collect(Collectors.toList());
|
|
|
- if (ListUtil.isNotEmpty(uniqueNames)) {
|
|
|
- for (String uniqueName : uniqueNames) {
|
|
|
- thirdMap.put(uniqueName, forms);
|
|
|
- }
|
|
|
- subMap.put(subEntry.getKey(), thirdMap);
|
|
|
- }
|
|
|
+ subMap.put(subEntry.getKey(), thirdMap);
|
|
|
}
|
|
|
if (subMap != null && subMap.size() > 0) {
|
|
|
retMap.put(entry.getKey(), subMap);
|
|
@@ -1424,6 +1434,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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 医院术语检索
|
|
|
*
|