|
@@ -399,20 +399,41 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
List<MappingConfigWrapper> standardList = Lists.newLinkedList();
|
|
|
List<MappingConfigWrapper> synonymsList = Lists.newLinkedList();
|
|
|
List<MappingConfigWrapper> codeList = Lists.newLinkedList();
|
|
|
+ List<MappingConfigWrapper> historyList = Lists.newLinkedList();
|
|
|
+ List<MappingConfigWrapper> drugList = Lists.newLinkedList();
|
|
|
+
|
|
|
+ //去除空行
|
|
|
+ /*originList = originList.stream()
|
|
|
+ .filter(MappingConfigWrapper::nonNull)
|
|
|
+ .collect(Collectors.toList());*/
|
|
|
|
|
|
//数据完整性校验
|
|
|
+ List<Integer> emptyNumList = Lists.newLinkedList();
|
|
|
+ Integer rowId = 1;
|
|
|
for (MappingConfigWrapper item : originList) {
|
|
|
+ ++rowId;
|
|
|
//过滤医院术语名称为空的条目
|
|
|
- if (StringUtil.isNotBlank(item.getHisName())) {
|
|
|
- item.setHisName(item.getHisName().trim());
|
|
|
+ if (type.equals(ConceptTypeEnum.LisPack.getKey())) {
|
|
|
+ if (StringUtil.isBlank(item.getHisName())
|
|
|
+ && StringUtil.isBlank(item.getHisDetailName())) {
|
|
|
+ continue;
|
|
|
+ } else if (StringUtil.isBlank(item.getHisName())
|
|
|
+ && StringUtil.isNotBlank(item.getHisDetailName())) {
|
|
|
+ emptyNumList.add(rowId);
|
|
|
+ }
|
|
|
} else {
|
|
|
- continue;
|
|
|
+ if (StringUtil.isNotBlank(item.getHisName())) {
|
|
|
+ item.setHisName(item.getHisName().trim());
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
if (StringUtil.isNotBlank(item.getHisDetailName())) {
|
|
|
item.setHisDetailName(item.getHisDetailName().trim());
|
|
|
} else {
|
|
|
item.setHisDetailName("");
|
|
|
}
|
|
|
+
|
|
|
if (StringUtil.isNotBlank(item.getHisCode())) {
|
|
|
item.setHisCode(item.getHisCode().trim());
|
|
|
} else {
|
|
@@ -422,6 +443,14 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
dataList.add(item);
|
|
|
}
|
|
|
|
|
|
+ //医院术语名称不允许为空
|
|
|
+ if (ListUtil.isNotEmpty(emptyNumList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行医院术语名称为空:"
|
|
|
+ + emptyNumList.stream().map(Object::toString)
|
|
|
+ .collect(Collectors.joining("、"))
|
|
|
+ + "。预匹配取消,请修改后再试。\n");
|
|
|
+ }
|
|
|
+
|
|
|
if (ListUtil.isEmpty(dataList)) {
|
|
|
return retList;
|
|
|
}
|
|
@@ -613,7 +642,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
|
|
|
for (MappingConfigWrapper item : codeList) {
|
|
|
if (item.getIsMatch() != null && item.getIsMatch().equals(1)) {
|
|
|
- retList.add(item);
|
|
|
+ historyList.add(item);
|
|
|
continue;
|
|
|
}
|
|
|
if (configMap.containsKey(item.getHisName())) {
|
|
@@ -621,7 +650,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
if (subMap != null && subMap.size() > 0) {
|
|
|
Map<String, List<String>> thirdMap = subMap.get(item.getHisDetailName());
|
|
|
if (thirdMap == null || thirdMap.size() == 0) {
|
|
|
- retList.add(item);
|
|
|
+ historyList.add(item);
|
|
|
continue;
|
|
|
}
|
|
|
for (Map.Entry<String, List<String>> thirdEntry : thirdMap.entrySet()) {
|
|
@@ -633,28 +662,82 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
if (type.equals(ConceptTypeEnum.Drug.getKey())) {
|
|
|
List<String> forms = thirdEntry.getValue();
|
|
|
if (ListUtil.isEmpty(forms)) {
|
|
|
- retList.add(historyItem);
|
|
|
+ historyList.add(historyItem);
|
|
|
} else {
|
|
|
for (String form : forms) {
|
|
|
MappingConfigWrapper formItem = new MappingConfigWrapper();
|
|
|
BeanUtil.copyProperties(historyItem, formItem);
|
|
|
formItem.setForm(form);
|
|
|
- retList.add(formItem);
|
|
|
+ historyList.add(formItem);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- retList.add(historyItem);
|
|
|
+ historyList.add(historyItem);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- retList.add(item);
|
|
|
+ historyList.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ historyList = BeanUtil.listCopyTo(codeList, MappingConfigWrapper.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ //药品关联标准词、同义词匹配数据增加历史数据剂型
|
|
|
+ if (type.equals(ConceptTypeEnum.Drug.getKey())) {
|
|
|
+ List<String> hisDrugNames = historyList.stream()
|
|
|
+ .filter(i -> i.getIsMatch() != null
|
|
|
+ && i.getIsMatch().equals(1)
|
|
|
+ && i.getSource() != null
|
|
|
+ && (i.getSource().equals(MatchSourceEnum.StandWord.getKey())
|
|
|
+ || i.getSource().equals(MatchSourceEnum.SynonymsWord.getKey())))
|
|
|
+ .map(MappingConfigWrapper::getHisName)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(hisDrugNames)) {
|
|
|
+ Map<String, Map<String, Map<String, List<String>>>> configMap = groupByHisNameWithName(hisDrugNames, type, null);
|
|
|
+ for (MappingConfigWrapper item : historyList) {
|
|
|
+ if (item.getIsMatch() != null && item.getIsMatch().equals(1)
|
|
|
+ && item.getSource() != null
|
|
|
+ && (item.getSource().equals(MatchSourceEnum.StandWord.getKey())
|
|
|
+ || item.getSource().equals(MatchSourceEnum.SynonymsWord.getKey()))) {
|
|
|
+ if (configMap.containsKey(item.getHisName())) {
|
|
|
+ Map<String, Map<String, List<String>>> subMap = configMap.get(item.getHisName());
|
|
|
+ if (subMap != null && subMap.size() > 0) {
|
|
|
+ Map<String, List<String>> thirdMap = subMap.get(item.getHisDetailName());
|
|
|
+ if (thirdMap == null || thirdMap.size() == 0) {
|
|
|
+ drugList.add(item);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<String> forms = thirdMap.get(item.getUniqueName());
|
|
|
+ if (ListUtil.isEmpty(forms)) {
|
|
|
+ drugList.add(item);
|
|
|
+ } else {
|
|
|
+ for (String form : forms) {
|
|
|
+ MappingConfigWrapper formItem = new MappingConfigWrapper();
|
|
|
+ BeanUtil.copyProperties(item, formItem);
|
|
|
+ formItem.setForm(form);
|
|
|
+ drugList.add(formItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ drugList.add(item);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ drugList.add(item);
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ drugList = BeanUtil.listCopyTo(historyList, MappingConfigWrapper.class);
|
|
|
}
|
|
|
} else {
|
|
|
- retList = BeanUtil.listCopyTo(codeList, MappingConfigWrapper.class);
|
|
|
+ drugList = BeanUtil.listCopyTo(historyList, MappingConfigWrapper.class);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ retList = BeanUtil.listCopyTo(drugList, MappingConfigWrapper.class);
|
|
|
for (MappingConfigWrapper item : retList) {
|
|
|
if (item.getIsMatch() == null) {
|
|
|
item.setIsMatch(0);
|