|
@@ -23,10 +23,23 @@ import com.diagbot.entity.ScaleConfig;
|
|
|
import com.diagbot.entity.TcmdiseaseConfig;
|
|
|
import com.diagbot.entity.TcmsyndromeConfig;
|
|
|
import com.diagbot.entity.TransfusionConfig;
|
|
|
+import com.diagbot.entity.wrapper.AnesthesiaConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.DeptConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.DiseaseConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.DrugConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.LisConfigWrapper;
|
|
|
import com.diagbot.entity.wrapper.MappingConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.NurseConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.OperationConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.PacsConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.ScaleConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.TcmdiseaseConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.TcmsyndromeConfigWrapper;
|
|
|
+import com.diagbot.entity.wrapper.TransfusionConfigWrapper;
|
|
|
import com.diagbot.enums.ConceptTypeEnum;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.enums.MatchSourceEnum;
|
|
|
+import com.diagbot.enums.StatusEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.MappingConfigService;
|
|
@@ -58,6 +71,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Collection;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
@@ -97,17 +111,24 @@ 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;
|
|
|
|
|
|
- //todo 标准词转conceptId
|
|
|
+ //标准词转conceptId
|
|
|
List<Long> conceptIds = Lists.newLinkedList();
|
|
|
+ Map<Long, IndexBatchDTO> conceptMap = new HashMap<>();
|
|
|
if (StringUtil.isNotBlank(mappingConfigPageVO.getUniqueName())) {
|
|
|
filterVO.setInputStr(mappingConfigPageVO.getUniqueName());
|
|
|
+ filterVO.setStatus(mappingConfigPageVO.getStatus());
|
|
|
respDTO = cdssCoreClient.filter(filterVO);
|
|
|
if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
if (ListUtil.isNotEmpty(respDTO.data)) {
|
|
|
+ conceptMap = respDTO.data.stream().collect(Collectors.toMap(IndexBatchDTO::getId, v -> v));
|
|
|
conceptIds.addAll(respDTO.data
|
|
|
.stream()
|
|
|
.map(IndexBatchDTO::getId)
|
|
@@ -120,13 +141,16 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
}
|
|
|
mappingConfigPageVO.setConceptIds(conceptIds);
|
|
|
|
|
|
- //todo 药品剂型转 conceptId
|
|
|
+ //药品剂型转 conceptId
|
|
|
List<Long> formConceptIds = Lists.newLinkedList();
|
|
|
+ Map<Long, IndexBatchDTO> formMap = new HashMap<>();
|
|
|
if (StringUtil.isNotBlank(mappingConfigPageVO.getForm())) {
|
|
|
filterVO.setInputStr(mappingConfigPageVO.getForm());
|
|
|
+ filterVO.setStatus(mappingConfigPageVO.getStatus());
|
|
|
respDTO = cdssCoreClient.filter(filterVO);
|
|
|
if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
if (ListUtil.isNotEmpty(respDTO.data)) {
|
|
|
+ formMap = respDTO.data.stream().collect(Collectors.toMap(IndexBatchDTO::getId, v -> v));
|
|
|
formConceptIds.addAll(respDTO.data
|
|
|
.stream()
|
|
|
.filter(i -> i.getType().equals(ConceptTypeEnum.Form.getKey()))
|
|
@@ -140,17 +164,16 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
}
|
|
|
mappingConfigPageVO.setFormConceptIds(formConceptIds);
|
|
|
|
|
|
- //todo 多条匹配
|
|
|
+ //多条匹配
|
|
|
if (mappingConfigPageVO.getIsMatch() != null && mappingConfigPageVO.getIsMatch().equals(2)) {
|
|
|
mappingConfigPageVO.setIsMatch(null);
|
|
|
mappingConfigPageVO.setIsMultiple(1);
|
|
|
}
|
|
|
|
|
|
IPage<MappingConfigWrapper> page = super.getPage(mappingConfigPageVO);
|
|
|
-
|
|
|
- //todo conceptId转标准词
|
|
|
List<MappingConfigWrapper> records = page.getRecords();
|
|
|
- records = addNames(records);
|
|
|
+
|
|
|
+ records = addNames(records, null);
|
|
|
page.setRecords(records);
|
|
|
|
|
|
return page;
|
|
@@ -163,69 +186,130 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
* @param response
|
|
|
* @param type
|
|
|
* @param extFileName
|
|
|
+ * @param mode 1:模板导出、2:关联关系
|
|
|
*/
|
|
|
- public void exportExcel(HttpServletResponse response, List<?> list, Integer type, String extFileName) {
|
|
|
+ public void exportExcel(HttpServletResponse response, List<?> list, Integer type, String extFileName, Integer mode) {
|
|
|
String fileName = extFileName + ".xls";
|
|
|
switch (type) {
|
|
|
case 1:
|
|
|
fileName = "检验" + fileName;
|
|
|
- List<LisConfig> lisConfigList = BeanUtil.listCopyTo(list, LisConfig.class);
|
|
|
- ExcelUtils.exportExcel(lisConfigList, null, "sheet1", LisConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<LisConfig> lisConfigList = BeanUtil.listCopyTo(list, LisConfig.class);
|
|
|
+ ExcelUtils.exportExcel(lisConfigList, null, "sheet1", LisConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<LisConfigWrapper> lisConfigList = BeanUtil.listCopyTo(list, LisConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(lisConfigList, null, "sheet1", LisConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 3:
|
|
|
fileName = "检查" + fileName;
|
|
|
- List<PacsConfig> pacsConfigList = BeanUtil.listCopyTo(list, PacsConfig.class);
|
|
|
- ExcelUtils.exportExcel(pacsConfigList, null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<PacsConfig> pacsConfigList = BeanUtil.listCopyTo(list, PacsConfig.class);
|
|
|
+ ExcelUtils.exportExcel(pacsConfigList, null, "sheet1", PacsConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<PacsConfigWrapper> pacsConfigWrapperList = BeanUtil.listCopyTo(list, PacsConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(pacsConfigWrapperList, null, "sheet1", PacsConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 4:
|
|
|
fileName = "诊断" + fileName;
|
|
|
- List<DiseaseConfig> diseaseConfigList = BeanUtil.listCopyTo(list, DiseaseConfig.class);
|
|
|
- ExcelUtils.exportExcel(diseaseConfigList, null, "sheet1", DiseaseConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<DiseaseConfig> diseaseConfigList = BeanUtil.listCopyTo(list, DiseaseConfig.class);
|
|
|
+ ExcelUtils.exportExcel(diseaseConfigList, null, "sheet1", DiseaseConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<DiseaseConfigWrapper> diseaseConfigList = BeanUtil.listCopyTo(list, DiseaseConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(diseaseConfigList, null, "sheet1", DiseaseConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 5:
|
|
|
fileName = "药品" + fileName;
|
|
|
- List<DrugConfig> drugConfigList = BeanUtil.listCopyTo(list, DrugConfig.class);
|
|
|
- ExcelUtils.exportExcel(drugConfigList, getForm(), "sheet1", DrugConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<DrugConfig> drugConfigList = BeanUtil.listCopyTo(list, DrugConfig.class);
|
|
|
+ ExcelUtils.exportExcel(drugConfigList, getForm(), "sheet1", DrugConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<DrugConfigWrapper> drugConfigList = BeanUtil.listCopyTo(list, DrugConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(drugConfigList, getForm(), "sheet1", DrugConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 6:
|
|
|
fileName = "手术和操作" + fileName;
|
|
|
- List<OperationConfig> operationConfigList = BeanUtil.listCopyTo(list, OperationConfig.class);
|
|
|
- ExcelUtils.exportExcel(operationConfigList, null, "sheet1", OperationConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<OperationConfig> operationConfigList = BeanUtil.listCopyTo(list, OperationConfig.class);
|
|
|
+ ExcelUtils.exportExcel(operationConfigList, null, "sheet1", OperationConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<OperationConfigWrapper> operationConfigList = BeanUtil.listCopyTo(list, OperationConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(operationConfigList, null, "sheet1", OperationConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 7:
|
|
|
fileName = "科室" + fileName;
|
|
|
- List<DeptConfig> deptConfigList = BeanUtil.listCopyTo(list, DeptConfig.class);
|
|
|
- ExcelUtils.exportExcel(deptConfigList, null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<DeptConfig> deptConfigList = BeanUtil.listCopyTo(list, DeptConfig.class);
|
|
|
+ ExcelUtils.exportExcel(deptConfigList, null, "sheet1", DeptConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<DeptConfigWrapper> deptConfigList = BeanUtil.listCopyTo(list, DeptConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(deptConfigList, null, "sheet1", DeptConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 8:
|
|
|
fileName = "输血" + fileName;
|
|
|
- List<TransfusionConfig> transfusionConfigList = BeanUtil.listCopyTo(list, TransfusionConfig.class);
|
|
|
- ExcelUtils.exportExcel(transfusionConfigList, null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<TransfusionConfig> transfusionConfigList = BeanUtil.listCopyTo(list, TransfusionConfig.class);
|
|
|
+ ExcelUtils.exportExcel(transfusionConfigList, null, "sheet1", TransfusionConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<TransfusionConfigWrapper> transfusionConfigList = BeanUtil.listCopyTo(list, TransfusionConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(transfusionConfigList, null, "sheet1", TransfusionConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 10:
|
|
|
fileName = "量表" + fileName;
|
|
|
- List<ScaleConfig> scaleConfigList = BeanUtil.listCopyTo(list, ScaleConfig.class);
|
|
|
- ExcelUtils.exportExcel(scaleConfigList, null, "sheet1", ScaleConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<ScaleConfig> scaleConfigList = BeanUtil.listCopyTo(list, ScaleConfig.class);
|
|
|
+ ExcelUtils.exportExcel(scaleConfigList, null, "sheet1", ScaleConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<ScaleConfigWrapper> scaleConfigList = BeanUtil.listCopyTo(list, ScaleConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(scaleConfigList, null, "sheet1", ScaleConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 11:
|
|
|
fileName = "护理" + fileName;
|
|
|
- List<NurseConfig> nurseConfigList = BeanUtil.listCopyTo(list, NurseConfig.class);
|
|
|
- ExcelUtils.exportExcel(nurseConfigList, null, "sheet1", NurseConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<NurseConfig> nurseConfigList = BeanUtil.listCopyTo(list, NurseConfig.class);
|
|
|
+ ExcelUtils.exportExcel(nurseConfigList, null, "sheet1", NurseConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<NurseConfigWrapper> nurseConfigList = BeanUtil.listCopyTo(list, NurseConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(nurseConfigList, null, "sheet1", NurseConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 12:
|
|
|
fileName = "中医疾病" + fileName;
|
|
|
- List<TcmdiseaseConfig> tcmdiseaseConfigList = BeanUtil.listCopyTo(list, TcmdiseaseConfig.class);
|
|
|
- ExcelUtils.exportExcel(tcmdiseaseConfigList, null, "sheet1", TcmdiseaseConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<TcmdiseaseConfig> tcmdiseaseConfigList = BeanUtil.listCopyTo(list, TcmdiseaseConfig.class);
|
|
|
+ ExcelUtils.exportExcel(tcmdiseaseConfigList, null, "sheet1", TcmdiseaseConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<TcmdiseaseConfigWrapper> tcmdiseaseConfigList = BeanUtil.listCopyTo(list, TcmdiseaseConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(tcmdiseaseConfigList, null, "sheet1", TcmdiseaseConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 13:
|
|
|
fileName = "中医证候" + fileName;
|
|
|
- List<TcmsyndromeConfig> tcmsyndromeConfigList = BeanUtil.listCopyTo(list, TcmsyndromeConfig.class);
|
|
|
- ExcelUtils.exportExcel(tcmsyndromeConfigList, null, "sheet1", TcmsyndromeConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<TcmsyndromeConfig> tcmsyndromeConfigList = BeanUtil.listCopyTo(list, TcmsyndromeConfig.class);
|
|
|
+ ExcelUtils.exportExcel(tcmsyndromeConfigList, null, "sheet1", TcmsyndromeConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<TcmsyndromeConfigWrapper> tcmsyndromeConfigList = BeanUtil.listCopyTo(list, TcmsyndromeConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(tcmsyndromeConfigList, null, "sheet1", TcmsyndromeConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
case 14:
|
|
|
fileName = "麻醉" + fileName;
|
|
|
- List<AnesthesiaConfig> anesthesiaConfigList = BeanUtil.listCopyTo(list, AnesthesiaConfig.class);
|
|
|
- ExcelUtils.exportExcel(anesthesiaConfigList, null, "sheet1", AnesthesiaConfig.class, fileName, response, 12.8f);
|
|
|
+ if (mode.equals(1)) {
|
|
|
+ List<AnesthesiaConfig> anesthesiaConfigList = BeanUtil.listCopyTo(list, AnesthesiaConfig.class);
|
|
|
+ ExcelUtils.exportExcel(anesthesiaConfigList, null, "sheet1", AnesthesiaConfig.class, fileName, response, 12.8f);
|
|
|
+ } else if (mode.equals(2)) {
|
|
|
+ List<AnesthesiaConfigWrapper> anesthesiaConfigList = BeanUtil.listCopyTo(list, AnesthesiaConfigWrapper.class);
|
|
|
+ ExcelUtils.exportExcel(anesthesiaConfigList, null, "sheet1", AnesthesiaConfigWrapper.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -261,7 +345,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
* @param response
|
|
|
*/
|
|
|
public void exportExcelModule(HttpServletResponse response, MappingConfigVO mappingConfigVO) {
|
|
|
- exportExcel(response, new ArrayList<>(), mappingConfigVO.getType(), "导入模板");
|
|
|
+ exportExcel(response, new ArrayList<>(), mappingConfigVO.getType(), "导入模板", 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -280,7 +364,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
|
|
|
IPage<MappingConfigWrapper> page = this.getPage(mappingConfigPageVO);
|
|
|
|
|
|
- exportExcel(response, page.getRecords(), mappingConfigPageVO.getType(), "映射");
|
|
|
+ exportExcel(response, page.getRecords(), mappingConfigPageVO.getType(), "映射", 2);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -397,7 +481,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
public void precDataMatch(MultipartFile file, Integer type, HttpServletResponse response) {
|
|
|
List<MappingConfigWrapper> originList = readImportData(file, type, 1);
|
|
|
List<MappingConfigWrapper> retList = precDataProcess(originList, type);
|
|
|
- exportExcel(response, retList, type, "关联数据(预匹配)");
|
|
|
+ exportExcel(response, retList, type, "关联数据(预匹配)", 1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -555,7 +639,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
|
|
|
//药品关联标准词、同义词匹配数据增加历史数据剂型
|
|
|
if (type.equals(ConceptTypeEnum.Drug.getKey())) {
|
|
|
- dataList = addDrugForm(dataList, type);
|
|
|
+ dataList = addDrugForm(dataList, type, StatusEnum.Enable.getKey());
|
|
|
}
|
|
|
|
|
|
retList = BeanUtil.listCopyTo(dataList, MappingConfigWrapper.class);
|
|
@@ -566,7 +650,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
}
|
|
|
|
|
|
//添加编码
|
|
|
- retList = addCodes(retList, type);
|
|
|
+ retList = addCodes(retList, type, StatusEnum.Enable.getKey());
|
|
|
retList = retList.stream().distinct().collect(Collectors.toList());
|
|
|
return retList;
|
|
|
}
|
|
@@ -788,7 +872,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 历史数据匹配
|
|
|
+ * 历史数据匹配(预匹配)
|
|
|
*
|
|
|
* @param list
|
|
|
* @param type
|
|
@@ -805,7 +889,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
.distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
if (ListUtil.isNotEmpty(hisNames)) {
|
|
|
- Map<String, Map<String, Map<String, List<String>>>> configMap = groupByHisNameWithName(hisNames, type, null);
|
|
|
+ Map<String, Map<String, Map<String, List<String>>>> configMap = groupByHisNameWithName(hisNames, type, null, StatusEnum.Enable.getKey());
|
|
|
|
|
|
for (MappingConfigWrapper item : list) {
|
|
|
if (item.getIsMatch() != null && item.getIsMatch().equals(1)) {
|
|
@@ -855,11 +939,12 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
|
|
|
/**
|
|
|
* 国药准字匹配(药品)
|
|
|
+ *
|
|
|
* @param list
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<MappingConfigWrapper> matchWithApproval(List<MappingConfigWrapper> list,Integer type) {
|
|
|
+ public List<MappingConfigWrapper> matchWithApproval(List<MappingConfigWrapper> list, Integer type) {
|
|
|
List<MappingConfigWrapper> retList = Lists.newLinkedList();
|
|
|
if (ListUtil.isEmpty(list) || null == type) {
|
|
|
return list;
|
|
@@ -876,8 +961,8 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
String regex = "[a-zA-Z]+\\d{8}";
|
|
|
Pattern pattern = Pattern.compile(regex);
|
|
|
|
|
|
- Map<String, IndexBatchDTO> approvalMap = new HashMap<>();
|
|
|
- approvalMap = indexBatchDTOList.stream().collect(Collectors.toMap(IndexBatchDTO::getApproval, v -> v));
|
|
|
+ Map<String, List<IndexBatchDTO>> approvalMap = new HashMap<>();
|
|
|
+ approvalMap = indexBatchDTOList.stream().collect(Collectors.groupingBy(IndexBatchDTO::getApproval));
|
|
|
/*for (IndexBatchDTO indexDTO : indexBatchDTOList) {
|
|
|
Matcher matcher = pattern.matcher(indexDTO.getApproval());
|
|
|
if (matcher.find()) {
|
|
@@ -897,19 +982,22 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
approval = matcher.group();
|
|
|
}*/
|
|
|
if (StringUtils.isNotBlank(item.getApproval()) && approvalMap.containsKey(item.getApproval())) {
|
|
|
- IndexBatchDTO indexBatchDTO = approvalMap.get(item.getApproval());
|
|
|
- item.setUniqueName(indexBatchDTO.getName());
|
|
|
- item.setConceptId(indexBatchDTO.getId());
|
|
|
- if (indexBatchDTO.getFormConceptId() != null) {
|
|
|
- item.setForm(indexBatchDTO.getForm());
|
|
|
- item.setFormConceptId(indexBatchDTO.getFormConceptId());
|
|
|
+ List<IndexBatchDTO> dtoList = approvalMap.get(item.getApproval());
|
|
|
+ for (IndexBatchDTO indexBatchDTO : dtoList) {
|
|
|
+ item.setUniqueName(indexBatchDTO.getName());
|
|
|
+ item.setConceptId(indexBatchDTO.getId());
|
|
|
+ if (indexBatchDTO.getFormConceptId() != null) {
|
|
|
+ item.setForm(indexBatchDTO.getForm());
|
|
|
+ item.setFormConceptId(indexBatchDTO.getFormConceptId());
|
|
|
+ }
|
|
|
+ item.setSource(MatchSourceEnum.Approval.getKey());
|
|
|
+ item.setIsMatch(1);
|
|
|
+ retList.add(item);
|
|
|
}
|
|
|
- item.setSource(MatchSourceEnum.Approval.getKey());
|
|
|
- item.setIsMatch(1);
|
|
|
} else {
|
|
|
item.setIsMatch(0);
|
|
|
+ retList.add(item);
|
|
|
}
|
|
|
- retList.add(item);
|
|
|
}
|
|
|
return retList;
|
|
|
}
|
|
@@ -919,9 +1007,10 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
*
|
|
|
* @param list
|
|
|
* @param type
|
|
|
+ * @param status 标准术语启用禁用标志
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<MappingConfigWrapper> addDrugForm(List<MappingConfigWrapper> list, Integer type) {
|
|
|
+ public List<MappingConfigWrapper> addDrugForm(List<MappingConfigWrapper> list, Integer type, Integer status) {
|
|
|
List<MappingConfigWrapper> retList = Lists.newLinkedList();
|
|
|
if (ListUtil.isEmpty(list) || null == type) {
|
|
|
return list;
|
|
@@ -946,7 +1035,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);
|
|
|
+ Map<String, Map<String, Map<String, List<String>>>> configMap = groupByHisNameWithName(hisDrugNames, type, null, status);
|
|
|
for (MappingConfigWrapper item : list) {
|
|
|
if (item.getIsMatch() != null && item.getIsMatch().equals(1)
|
|
|
&& item.getSource() != null
|
|
@@ -1047,6 +1136,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
|
|
|
/**
|
|
|
* 导入数据校验
|
|
|
+ *
|
|
|
* @param originList
|
|
|
* @param hospitalId
|
|
|
* @param type
|
|
@@ -1304,18 +1394,22 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
|
|
|
// 验证数据是否已存在,已存在的先删除
|
|
|
// 没id的删除重新插入,有id的更新
|
|
|
+ List<MappingConfigWrapper> db_matchList = Lists.newLinkedList();
|
|
|
+ List<MappingConfigWrapper> db_unMatchList = Lists.newLinkedList();
|
|
|
+ Map<String, List<MappingConfigWrapper>> db_matchMap = new HashMap<>();
|
|
|
+ Map<String, List<MappingConfigWrapper>> db_unMatchMap = new HashMap<>();
|
|
|
synchronized (this) {
|
|
|
List<Long> deleteIds = Lists.newLinkedList();
|
|
|
- List<MappingConfig> existList = this.list(new QueryWrapper<MappingConfig>()
|
|
|
+ List<MappingConfig> dbList = this.list(new QueryWrapper<MappingConfig>()
|
|
|
.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("hospital_id", hospitalId)
|
|
|
.eq("type", type)
|
|
|
.in("his_name", hisNames));
|
|
|
|
|
|
- if (ListUtil.isNotEmpty(existList)) {
|
|
|
- List<MappingConfigWrapper> existWrapperList = BeanUtil.listCopyTo(existList, MappingConfigWrapper.class);
|
|
|
- existWrapperList = addNames(existWrapperList);
|
|
|
- for (MappingConfigWrapper item : existWrapperList) {
|
|
|
+ if (ListUtil.isNotEmpty(dbList)) {
|
|
|
+ List<MappingConfigWrapper> dbWrapperList = BeanUtil.listCopyTo(dbList, MappingConfigWrapper.class);
|
|
|
+ dbWrapperList = addNames(dbWrapperList, StatusEnum.Enable.getKey());
|
|
|
+ for (MappingConfigWrapper item : dbWrapperList) {
|
|
|
if (StringUtil.isBlank(item.getHisDetailName())) {
|
|
|
item.setHisDetailName("");
|
|
|
}
|
|
@@ -1330,16 +1424,12 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<MappingConfigWrapper> db_matchList
|
|
|
- = existWrapperList.stream().filter(i -> i.getIsMatch().equals(1)).collect(Collectors.toList());
|
|
|
- Map<String, List<MappingConfigWrapper>> db_matchMap
|
|
|
- = db_matchList.stream().collect(Collectors.groupingBy(i -> i.getHisName() + "_"
|
|
|
+ db_matchList = dbWrapperList.stream().filter(i -> i.getIsMatch().equals(1)).collect(Collectors.toList());
|
|
|
+ db_matchMap = db_matchList.stream().collect(Collectors.groupingBy(i -> i.getHisName() + "_"
|
|
|
+ i.getHisCode() + "_"
|
|
|
+ i.getHisDetailName()));
|
|
|
- List<MappingConfigWrapper> db_unMatchList
|
|
|
- = existWrapperList.stream().filter(i -> i.getIsMatch().equals(0)).collect(Collectors.toList());
|
|
|
- Map<String, List<MappingConfigWrapper>> db_unMatchMap
|
|
|
- = db_unMatchList.stream().collect(Collectors.groupingBy(i -> i.getHisName() + "_"
|
|
|
+ db_unMatchList = dbWrapperList.stream().filter(i -> i.getIsMatch().equals(0)).collect(Collectors.toList());
|
|
|
+ db_unMatchMap = db_unMatchList.stream().collect(Collectors.groupingBy(i -> i.getHisName() + "_"
|
|
|
+ i.getHisCode() + "_"
|
|
|
+ i.getHisDetailName()));
|
|
|
|
|
@@ -1395,7 +1485,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
|
|
|
Map<String, List<Long>> packMap = new HashMap<>();
|
|
|
- respDTO.data.stream()
|
|
|
+ packMap = respDTO.data.stream()
|
|
|
.collect(Collectors.groupingBy(IndexBatchDTO::getName,
|
|
|
Collectors.mapping(IndexBatchDTO::getId, Collectors.toList())));
|
|
|
|
|
@@ -1492,20 +1582,30 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
.distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
+ List<MappingConfig> saveList = Lists.newLinkedList();
|
|
|
for (MappingConfigWrapper item : tempList) {
|
|
|
+ //检查标准术语校验后未匹配的数据是否有对应已匹配的数据,有则删除未匹配数据
|
|
|
+ if (item.getIsMatch().equals(0)) {
|
|
|
+ String key = item.getHisName() + "_" + item.getHisCode() + "_" + item.getHisDetailName();
|
|
|
+ if (db_matchMap.containsKey(key)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
item.setHospitalId(hospitalId);
|
|
|
item.setType(type);
|
|
|
item.setCreator(userId);
|
|
|
item.setGmtCreate(now);
|
|
|
item.setModifier(userId);
|
|
|
item.setGmtModified(now);
|
|
|
+ MappingConfig saveItem = new MappingConfig();
|
|
|
+ BeanUtils.copyProperties(item, saveItem);
|
|
|
+ saveList.add(saveItem);
|
|
|
}
|
|
|
|
|
|
//删除已存在映射关系
|
|
|
IdListVO idListVO = new IdListVO();
|
|
|
idListVO.setIds(deleteIds);
|
|
|
deleteRecords(idListVO);
|
|
|
- List<MappingConfig> saveList = BeanUtil.listCopyTo(tempList, MappingConfig.class);
|
|
|
saveList = saveList.stream().distinct().collect(Collectors.toList());
|
|
|
if (ListUtil.isNotEmpty(saveList)) {
|
|
|
mappingConfigService.saveOrUpdateBatch(saveList);
|
|
@@ -1557,7 +1657,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
BeanUtils.copyProperties(item, itemWrapper);
|
|
|
List<MappingConfigWrapper> retList = Lists.newArrayList();
|
|
|
retList.add(itemWrapper);
|
|
|
- retList = addNames(retList);
|
|
|
+ retList = addNames(retList, null);
|
|
|
|
|
|
return retList.get(0);
|
|
|
}
|
|
@@ -1595,7 +1695,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
|
|
|
retList = BeanUtil.listCopyTo(list, MappingConfigWrapper.class);
|
|
|
|
|
|
- retList = addNames(retList);
|
|
|
+ retList = addNames(retList, null);
|
|
|
return retList;
|
|
|
}
|
|
|
|
|
@@ -1717,6 +1817,30 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
&& !mappingConfig.getId().equals(oldRecord.getId())) {
|
|
|
throw new CommonException(CommonErrorCode.IS_EXISTS, "该条关联已存在,无法保存");
|
|
|
}
|
|
|
+ //标准术语校验
|
|
|
+ ConceptVO conceptVO = new ConceptVO();
|
|
|
+ conceptVO.setSource(-1);
|
|
|
+ conceptVO.setStatus(StatusEnum.Enable.getKey());
|
|
|
+ conceptVO.setIds(Arrays.asList(new Long[] { mappingConfig.getConceptId() }));
|
|
|
+ List<Long> conceptIds = Lists.newLinkedList();
|
|
|
+ conceptIds.add(mappingConfig.getConceptId());
|
|
|
+ if (mappingConfig.getFormConceptId() != null) {
|
|
|
+ conceptIds.add(mappingConfig.getFormConceptId());
|
|
|
+ }
|
|
|
+
|
|
|
+ RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
+ if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
+ Map<Long, IndexBatchDTO> dtoMap = respDTO.data.stream().collect(Collectors.toMap(IndexBatchDTO::getId, v -> v));
|
|
|
+ if (!dtoMap.containsKey(mappingConfig.getConceptId())) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "标准术语校验失败");
|
|
|
+ }
|
|
|
+ if (mappingConfig.getFormConceptId() != null && (!dtoMap.containsKey(mappingConfig.getFormConceptId()))) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "剂型校验失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "标准术语校验失败");
|
|
|
+ }
|
|
|
+
|
|
|
//新增数据
|
|
|
if (mappingConfig.getId() == null) {
|
|
|
mappingConfig.setCreator(userId);
|
|
@@ -1817,9 +1941,10 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
* @param hisNames
|
|
|
* @param type
|
|
|
* @param hospitalId
|
|
|
+ * @param status 标准术语启用禁用标志
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Map<String, Map<String, List<String>>>> groupByHisNameWithName(List<String> hisNames, Integer type, Long hospitalId) {
|
|
|
+ public Map<String, Map<String, Map<String, List<String>>>> groupByHisNameWithName(List<String> hisNames, Integer type, Long hospitalId, Integer status) {
|
|
|
Map<String, Map<String, Map<String, List<String>>>> retMap = new HashMap<>();
|
|
|
Map<String, Map<String, Map<Long, List<Long>>>> idMap = groupByHisNameWithId(hisNames, type, hospitalId);
|
|
|
|
|
@@ -1847,6 +1972,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
conceptVO.setSource(-1);
|
|
|
conceptVO.setType(type);
|
|
|
conceptVO.setIds(ids);
|
|
|
+ conceptVO.setStatus(status);
|
|
|
RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
|
|
|
List<IndexBatchDTO> indexList = respDTO.data;
|
|
@@ -1891,7 +2017,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
* @param hospitalId
|
|
|
* @return uniqueName, form, hisName, hisDetailName
|
|
|
*/
|
|
|
- public Map<String, Map<String, Map<String, List<String>>>> groupByUniqueNameWithName(List<String> uniqueNames, Integer type, Long hospitalId) {
|
|
|
+ public Map<String, Map<String, Map<String, List<String>>>> groupByUniqueNameWithName(List<String> uniqueNames, Integer type, Long hospitalId, Integer status) {
|
|
|
Map<String, Map<String, Map<String, List<String>>>> retMap = new HashMap<>();
|
|
|
|
|
|
List<Long> conceptIds = Lists.newArrayList();
|
|
@@ -1938,7 +2064,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
}
|
|
|
|
|
|
List<MappingConfigWrapper> wrapperList = BeanUtil.listCopyTo(list, MappingConfigWrapper.class);
|
|
|
- wrapperList = addNames(wrapperList);
|
|
|
+ wrapperList = addNames(wrapperList, status);
|
|
|
wrapperList.forEach(item -> {
|
|
|
if (StringUtil.isBlank(item.getForm())) {
|
|
|
item.setForm("");
|
|
@@ -1973,7 +2099,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<MappingConfigWrapper> addNames(List<MappingConfigWrapper> list) {
|
|
|
+ public List<MappingConfigWrapper> addNames(List<MappingConfigWrapper> list, Integer status) {
|
|
|
if (ListUtil.isEmpty(list)) {
|
|
|
return list;
|
|
|
}
|
|
@@ -1991,6 +2117,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
ConceptVO conceptVO = new ConceptVO();
|
|
|
conceptVO.setSource(-1);
|
|
|
conceptVO.setIds(ids);
|
|
|
+ conceptVO.setStatus(status);
|
|
|
RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
Map<Long, IndexBatchDTO> conceptMap
|
|
@@ -1999,9 +2126,11 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
if (record.getConceptId() != null && conceptMap.containsKey(record.getConceptId())) {
|
|
|
record.setUniqueName(conceptMap.get(record.getConceptId()).getName());
|
|
|
record.setCode(conceptMap.get(record.getConceptId()).getCode());
|
|
|
+ record.setStatus(conceptMap.get(record.getConceptId()).getStatus());
|
|
|
}
|
|
|
if (record.getFormConceptId() != null && conceptMap.containsKey(record.getFormConceptId())) {
|
|
|
record.setForm(conceptMap.get(record.getFormConceptId()).getName());
|
|
|
+ record.setFormStatus(conceptMap.get(record.getFormConceptId()).getStatus());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2015,7 +2144,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
* @param list
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<MappingConfigWrapper> addCodes(List<MappingConfigWrapper> list, Integer type) {
|
|
|
+ public List<MappingConfigWrapper> addCodes(List<MappingConfigWrapper> list, Integer type, Integer status) {
|
|
|
List<MappingConfigWrapper> retList = Lists.newLinkedList();
|
|
|
if (ListUtil.isEmpty(list)) {
|
|
|
return list;
|
|
@@ -2037,6 +2166,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
|
|
|
conceptVO.setSource(MatchSourceEnum.StandWord.getKey());
|
|
|
conceptVO.setType(type);
|
|
|
conceptVO.setNames(names);
|
|
|
+ conceptVO.setStatus(status);
|
|
|
RespDTO<List<IndexBatchDTO>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
if (RespDTOUtil.respIsOK(respDTO)) {
|
|
|
Map<String, List<String>> conceptMap
|