|
@@ -111,10 +111,6 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
if (mappingConfigPageVO.getHospitalId() == null) {
|
|
|
mappingConfigPageVO.setHospitalId(Long.valueOf(SysUserUtils.getCurrentHospitalID()));
|
|
|
}
|
|
|
- //查询启用禁用全部状态
|
|
|
- /*if (mappingConfigPageVO.getStatus() != null && mappingConfigPageVO.getStatus().equals(0)) {
|
|
|
- mappingConfigPageVO.setStatus(null);
|
|
|
- }*/
|
|
|
|
|
|
FilterVO filterVO = new FilterVO();
|
|
|
RespDTO<List<IndexBatchDTO>> respDTO = null;
|
|
@@ -164,6 +160,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
}
|
|
|
mappingConfigPageVO.setFormConceptIds(formConceptIds);
|
|
|
|
|
|
+ //启用禁用过滤
|
|
|
List<MappingConfig> list = this.list(new QueryWrapper<MappingConfig>()
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("type", mappingConfigPageVO.getType())
|
|
@@ -184,25 +181,31 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
conceptVO.setIds(dbConceptIds);
|
|
|
conceptVO.setStatus(mappingConfigPageVO.getStatus());
|
|
|
RespDTO<List<IndexBatchDTO>> conceptRespDTO = null;
|
|
|
- if (ListUtil.isNotEmpty(dbConceptIds)
|
|
|
- && mappingConfigPageVO.getStatus() != null) {
|
|
|
+ if (ListUtil.isEmpty(conceptIds)
|
|
|
+ && mappingConfigPageVO.getStatus() != null
|
|
|
+ && ListUtil.isNotEmpty(dbConceptIds)) {
|
|
|
conceptRespDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
- if (ListUtil.isEmpty(conceptIds)
|
|
|
- && RespDTOUtil.respIsOK(conceptRespDTO)) {
|
|
|
+ if (RespDTOUtil.respIsOK(conceptRespDTO)) {
|
|
|
conceptIds = conceptRespDTO.data.stream().map(IndexBatchDTO::getId).collect(Collectors.toList());
|
|
|
mappingConfigPageVO.setConceptIds(conceptIds);
|
|
|
+ } else {
|
|
|
+ //没有启用禁用记录时返回空而不是全量
|
|
|
+ mappingConfigPageVO.setConceptIds(Arrays.asList(new Long[] { -1L }));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (ListUtil.isNotEmpty(dbFormConceptIds)
|
|
|
- && mappingConfigPageVO.getFormStatus() != null) {
|
|
|
+ if (ListUtil.isEmpty(formConceptIds)
|
|
|
+ && mappingConfigPageVO.getFormStatus() != null
|
|
|
+ && ListUtil.isNotEmpty(dbFormConceptIds)) {
|
|
|
conceptVO.setIds(dbFormConceptIds);
|
|
|
conceptVO.setStatus(mappingConfigPageVO.getFormStatus());
|
|
|
conceptRespDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
- if (ListUtil.isEmpty(formConceptIds)
|
|
|
- && RespDTOUtil.respIsOK(conceptRespDTO)) {
|
|
|
+ if (RespDTOUtil.respIsOK(conceptRespDTO)) {
|
|
|
formConceptIds = conceptRespDTO.data.stream().map(IndexBatchDTO::getId).collect(Collectors.toList());
|
|
|
mappingConfigPageVO.setFormConceptIds(formConceptIds);
|
|
|
+ } else {
|
|
|
+ //没有启用禁用记录时返回空而不是全量
|
|
|
+ mappingConfigPageVO.setFormConceptIds(Arrays.asList(new Long[] { -1L }));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -681,9 +684,9 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
dataList = matchWithCode(dataList, type);
|
|
|
}
|
|
|
|
|
|
- //药品关联标准词、同义词匹配数据增加历史数据剂型
|
|
|
+ //药品关联国药准字、标准词、同义词匹配数据增加历史数据剂型
|
|
|
if (type.equals(ConceptTypeEnum.Drug.getKey())) {
|
|
|
- dataList = addDrugForm(dataList, type, StatusEnum.Enable.getKey());
|
|
|
+ dataList = addDrugForm(dataList, type);
|
|
|
}
|
|
|
|
|
|
retList = BeanUtil.listCopyTo(dataList, MappingConfigWrapper.class);
|
|
@@ -695,6 +698,10 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
|
|
|
//添加编码
|
|
|
retList = addCodes(retList, type, StatusEnum.Enable.getKey());
|
|
|
+
|
|
|
+ //校验标准词启用禁用状态
|
|
|
+ retList = checkStatus(retList, type);
|
|
|
+
|
|
|
retList = retList.stream().distinct().collect(Collectors.toList());
|
|
|
return retList;
|
|
|
}
|
|
@@ -1053,10 +1060,9 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
*
|
|
|
* @param list
|
|
|
* @param type
|
|
|
- * @param status 标准术语启用禁用标志
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<MappingConfigWrapper> addDrugForm(List<MappingConfigWrapper> list, Integer type, Integer status) {
|
|
|
+ public List<MappingConfigWrapper> addDrugForm(List<MappingConfigWrapper> list, Integer type) {
|
|
|
List<MappingConfigWrapper> retList = Lists.newLinkedList();
|
|
|
if (ListUtil.isEmpty(list) || null == type) {
|
|
|
return list;
|
|
@@ -1081,7 +1087,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
.distinct()
|
|
|
.collect(Collectors.toList()));
|
|
|
if (ListUtil.isNotEmpty(hisDrugNames)) {
|
|
|
- Map<String, Map<String, Map<String, List<String>>>> configMap = groupByHisNameWithName(hisDrugNames, type, null, status);
|
|
|
+ Map<String, Map<String, Map<String, List<String>>>> configMap = groupByHisNameWithName(hisDrugNames, type, null, null);
|
|
|
for (MappingConfigWrapper item : list) {
|
|
|
if (item.getIsMatch() != null && item.getIsMatch().equals(1)
|
|
|
&& item.getSource() != null
|
|
@@ -1127,9 +1133,86 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
} else {
|
|
|
retList = BeanUtil.listCopyTo(list, MappingConfigWrapper.class);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 启用禁用校验
|
|
|
+ *
|
|
|
+ * @param list
|
|
|
+ * @param type
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<MappingConfigWrapper> checkStatus(List<MappingConfigWrapper> list, Integer type) {
|
|
|
+
|
|
|
+ //校验标准词是否启用
|
|
|
+ ConceptVO conceptVO = new ConceptVO();
|
|
|
+ conceptVO.setSource(MatchSourceEnum.StandWord.getKey());
|
|
|
+ List<String> uniqueNames = list.stream()
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getUniqueName()))
|
|
|
+ .map(MappingConfigWrapper::getUniqueName)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ conceptVO.setType(type);
|
|
|
+ conceptVO.setStatus(StatusEnum.Enable.getKey());
|
|
|
+ RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
+ if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
+ Map<String, IndexBatchDTO> dtoMap = respDTO.data.stream().collect(Collectors.toMap(IndexBatchDTO::getName, v -> v));
|
|
|
+ for (MappingConfigWrapper item : list) {
|
|
|
+ if (StringUtil.isNotBlank(item.getUniqueName())) {
|
|
|
+ if (dtoMap.containsKey(item.getUniqueName())) {
|
|
|
+ item.setConceptId(dtoMap.get(item.getUniqueName()).getId());
|
|
|
+ item.setStatus(StatusEnum.Enable.getKey());
|
|
|
+ } else {
|
|
|
+ item.setUniqueName("");
|
|
|
+ item.setConceptId(null);
|
|
|
+ item.setStatus(StatusEnum.Disable.getKey());
|
|
|
+ item.setIsMatch(0);
|
|
|
+ item.setRemark("术语校验失败;");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //校验剂型是否启用
|
|
|
+ if (type.equals(ConceptTypeEnum.Drug.getKey())) {
|
|
|
+ List<String> forms = list.stream()
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getForm()))
|
|
|
+ .map(MappingConfigWrapper::getForm)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ conceptVO.setType(ConceptTypeEnum.Form.getKey());
|
|
|
+ conceptVO.setNames(forms);
|
|
|
+ conceptVO.setStatus(StatusEnum.Enable.getKey());
|
|
|
+ respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
+ if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
+ Map<String, IndexBatchDTO> dtoMap = respDTO.data.stream().collect(Collectors.toMap(IndexBatchDTO::getName, v -> v));
|
|
|
+ for (MappingConfigWrapper item : list) {
|
|
|
+ if (item.getIsMatch() != null && item.getIsMatch().equals(0)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(item.getForm())) {
|
|
|
+ if (dtoMap.containsKey(item.getForm())) {
|
|
|
+ item.setFormConceptId(dtoMap.get(item.getForm()).getId());
|
|
|
+ item.setFormStatus(StatusEnum.Enable.getKey());
|
|
|
+ } else {
|
|
|
+ item.setForm("");
|
|
|
+ item.setFormConceptId(null);
|
|
|
+ item.setFormStatus(StatusEnum.Disable.getKey());
|
|
|
+ item.setRemark(item.getRemark() + "剂型校验失败;");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 数据导入
|
|
|
*
|