|
@@ -3,6 +3,7 @@ package com.diagbot.facade;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.diagbot.client.CdssCoreClient;
|
|
|
+import com.diagbot.dto.DictionaryInfoDTO;
|
|
|
import com.diagbot.dto.ExportCommonStaticTestDTO;
|
|
|
import com.diagbot.dto.ExportCommonTestDTO;
|
|
|
import com.diagbot.dto.ExportLisStaticTestDTO;
|
|
@@ -18,13 +19,16 @@ import com.diagbot.entity.ResultStaticInfo;
|
|
|
import com.diagbot.entity.ResultStaticKnowledge;
|
|
|
import com.diagbot.entity.TransfusionConfig;
|
|
|
import com.diagbot.entity.node.LisName;
|
|
|
+import com.diagbot.entity.node.PacsSubName;
|
|
|
import com.diagbot.entity.relationship.LisNameLisSet;
|
|
|
+import com.diagbot.entity.relationship.PacsNamePacsSubName;
|
|
|
import com.diagbot.enums.ConceptTypeEnum;
|
|
|
import com.diagbot.enums.GraphLabelEnum;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.repository.LisNameRepository;
|
|
|
+import com.diagbot.repository.PacsSubNameRepository;
|
|
|
import com.diagbot.service.ResultStaticInfoService;
|
|
|
import com.diagbot.service.ResultStaticKnowledgeService;
|
|
|
import com.diagbot.service.impl.ResultStaticKnowledgeServiceImpl;
|
|
@@ -74,9 +78,14 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
|
|
|
private OperationConfigFacade operationConfigFacade;
|
|
|
@Autowired
|
|
|
private TransfusionConfigFacade transfusionConfigFacade;
|
|
|
+ @Autowired
|
|
|
+ private DictionaryFacade dictionaryFacade;
|
|
|
|
|
|
@Autowired
|
|
|
private LisNameRepository lisNameRepository;
|
|
|
+ @Autowired
|
|
|
+ private PacsSubNameRepository pacsSubNameRepository;
|
|
|
+
|
|
|
@Autowired
|
|
|
@Qualifier("resultStaticKnowledgeServiceImpl")
|
|
|
private ResultStaticKnowledgeService resultStaticKnowledgeService;
|
|
@@ -249,7 +258,7 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
|
|
|
List<String> lisPacks = lisNameLisSetSet.stream().map(i -> i.getLisSet()).collect(Collectors.toList())
|
|
|
.stream().map(i -> i.getName()).sorted().collect(Collectors.toList());
|
|
|
for (String lisPack : lisPacks) {
|
|
|
- if (lisPackNames.contains(lisPack)) {
|
|
|
+ if (lisPackStaticNames.contains(lisPack)) {
|
|
|
isExist = true;
|
|
|
result.setMessage(result.getMessage() + "取上级(" + lisPack + ")静态知识;");
|
|
|
break;
|
|
@@ -273,6 +282,558 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 辅检静态知识测试
|
|
|
+ *
|
|
|
+ * @param file
|
|
|
+ * @param testVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean pacsTest(MultipartFile file, StaticKnowledgeTestVO testVO) {
|
|
|
+ List<ResultStaticKnowledge> saveList = Lists.newLinkedList();
|
|
|
+ //从Excel读取数据
|
|
|
+ List<PacsConfig> pacsConfigList = ExcelUtils.importExcel(file, 0, 1, PacsConfig.class);
|
|
|
+
|
|
|
+ Long hospitalId = testVO.getHospitalId();
|
|
|
+ Date now = DateUtil.now();
|
|
|
+
|
|
|
+ //1、数据完整性校验
|
|
|
+ //2、去除前后空格
|
|
|
+ //过滤空数据,保留重复数据,方便计行
|
|
|
+ pacsConfigList = pacsConfigList.stream()
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getHisName())
|
|
|
+ || StringUtil.isNotBlank(i.getUniqueCode())
|
|
|
+ || StringUtil.isNotBlank(i.getUniqueName()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(pacsConfigList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
|
|
|
+ }
|
|
|
+ List<String> emptyNumList = Lists.newLinkedList();
|
|
|
+ for (int i = 0; i < pacsConfigList.size(); i++) {
|
|
|
+ if (StringUtil.isBlank(pacsConfigList.get(i).getHisName())
|
|
|
+ || StringUtil.isBlank(pacsConfigList.get(i).getUniqueName())) {
|
|
|
+ emptyNumList.add(String.valueOf(i + 2));
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(pacsConfigList.get(i).getHisName())) {
|
|
|
+ pacsConfigList.get(i).setHisName(pacsConfigList.get(i).getHisName().trim());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(pacsConfigList.get(i).getUniqueName())) {
|
|
|
+ pacsConfigList.get(i).setUniqueName(pacsConfigList.get(i).getUniqueName().trim());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(pacsConfigList.get(i).getUniqueCode())) {
|
|
|
+ pacsConfigList.get(i).setUniqueCode(pacsConfigList.get(i).getUniqueCode().trim());
|
|
|
+ } else {
|
|
|
+ pacsConfigList.get(i).setUniqueCode(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(emptyNumList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
|
|
|
+ + emptyNumList.stream().collect(Collectors.joining("、"))
|
|
|
+ + "。测试取消,请修改后再试。\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ //重复数据过滤
|
|
|
+ pacsConfigList = pacsConfigList
|
|
|
+ .stream()
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(pacsConfigList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ //标准术语校验
|
|
|
+ List<String> uniqueNames = pacsConfigList.stream()
|
|
|
+ .map(i -> i.getUniqueName())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ ConceptVO conceptVO = new ConceptVO();
|
|
|
+ conceptVO.setNames(uniqueNames);
|
|
|
+ conceptVO.setType(ConceptTypeEnum.Pacs.getKey());
|
|
|
+ RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
+ RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
|
|
|
+ List<String> names = respDTO.data;
|
|
|
+
|
|
|
+ // 已存在数据
|
|
|
+ Map<String, Map<String, List<Long>>> hisConfigMap = pacsConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
|
|
|
+
|
|
|
+ //静态知识
|
|
|
+ List<ConceptInfo> infoList = conceptInfoFacade.getAllConceptInfo();
|
|
|
+ if (ListUtil.isEmpty(infoList)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ List<String> pacsStaticNames = infoList.stream()
|
|
|
+ .filter(i -> i.getType().equals(GraphLabelEnum.PacsName.getName()))
|
|
|
+ .map(i -> i.getName())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<String> subPacsPackStaticNames = infoList.stream()
|
|
|
+ .filter(i -> i.getType().equals(GraphLabelEnum.PacsSubName.getName()))
|
|
|
+ .map(i -> i.getName())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (PacsConfig config : pacsConfigList) {
|
|
|
+ ResultStaticKnowledge result = new ResultStaticKnowledge();
|
|
|
+ result.setGmtCreate(now);
|
|
|
+ result.setGmtModified(now);
|
|
|
+ result.setMessage("");
|
|
|
+ result.setHisName(config.getHisName());
|
|
|
+ result.setName(config.getUniqueName());
|
|
|
+
|
|
|
+ //映射关系是否已存在
|
|
|
+ if (hisConfigMap.containsKey(result.getHisName())
|
|
|
+ && hisConfigMap.get(result.getHisName()).keySet().contains(result.getName())) {
|
|
|
+ if (names.contains(result.getName())) {
|
|
|
+ result.setHasStandName(1);
|
|
|
+ } else {
|
|
|
+ result.setHasStandName(0);
|
|
|
+ result.setMessage("标准术语不存在;");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setHasStandName(0);
|
|
|
+ result.setMessage(result.getMessage() + "映射关系不存在;");
|
|
|
+ }
|
|
|
+
|
|
|
+ //静态知识是否存在
|
|
|
+ if (pacsStaticNames.contains(result.getName())
|
|
|
+ || subPacsPackStaticNames.contains(result.getName())) {
|
|
|
+ result.setHasStaticKnowledge(1);
|
|
|
+ } else {
|
|
|
+ //查找上级静态知识是否存在
|
|
|
+ List<PacsSubName> pacsSubNameList = pacsSubNameRepository.findByNameIs(result.getName());
|
|
|
+ if (ListUtil.isEmpty(pacsSubNameList)) {
|
|
|
+ result.setHasStaticKnowledge(0);
|
|
|
+ result.setMessage(result.getMessage() + "缺少静态知识;");
|
|
|
+ } else {
|
|
|
+ pacsSubNameList.forEach(pacsSubName -> {
|
|
|
+ Boolean isExist = false;
|
|
|
+ Set<PacsNamePacsSubName> pacsNamePacsSubNameSet = pacsSubName.getPacsNamePacsSubNames();
|
|
|
+ if (pacsNamePacsSubNameSet != null && pacsNamePacsSubNameSet.size() > 0) {
|
|
|
+ List<String> pacsNames = pacsNamePacsSubNameSet.stream().map(i -> i.getPacsName()).collect(Collectors.toList())
|
|
|
+ .stream().map(i -> i.getName()).sorted().collect(Collectors.toList());
|
|
|
+ for (String pacsName : pacsNames) {
|
|
|
+ if (pacsStaticNames.contains(pacsName)) {
|
|
|
+ isExist = true;
|
|
|
+ result.setMessage(result.getMessage() + "取上级(" + pacsName + ")静态知识;");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isExist) {
|
|
|
+ result.setHasStaticKnowledge(1);
|
|
|
+ } else {
|
|
|
+ result.setHasStaticKnowledge(0);
|
|
|
+ result.setMessage(result.getMessage() + "缺少静态知识;");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ saveList.add(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存
|
|
|
+ saveResult(saveList, testVO);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 药品静态知识测试
|
|
|
+ *
|
|
|
+ * @param file
|
|
|
+ * @param testVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean drugTest(MultipartFile file, StaticKnowledgeTestVO testVO) {
|
|
|
+ List<ResultStaticKnowledge> saveList = Lists.newLinkedList();
|
|
|
+ //从Excel读取数据
|
|
|
+ List<DrugConfig> drugConfigList = ExcelUtils.importExcel(file, 1, 1, DrugConfig.class);
|
|
|
+
|
|
|
+ Long hospitalId = testVO.getHospitalId();
|
|
|
+ Date now = DateUtil.now();
|
|
|
+
|
|
|
+ //1、数据完整性校验
|
|
|
+ //2、去除前后空格
|
|
|
+ //过滤空数据,保留重复数据,方便计行
|
|
|
+ drugConfigList = drugConfigList.stream()
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getHisName())
|
|
|
+ || StringUtil.isNotBlank(i.getForm())
|
|
|
+ || StringUtil.isNotBlank(i.getUniqueCode())
|
|
|
+ || StringUtil.isNotBlank(i.getUniqueName()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(drugConfigList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
|
|
|
+ }
|
|
|
+ List<String> emptyNumList = Lists.newLinkedList();
|
|
|
+ //药品剂型
|
|
|
+ List<DictionaryInfoDTO> dicTypeMappingList = dictionaryFacade.getListByGroupType(9);
|
|
|
+ List<String> formList = dicTypeMappingList.stream()
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getName()))
|
|
|
+ .map(i -> i.getName())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<String> formErrNumList = Lists.newLinkedList();
|
|
|
+ for (int i = 0; i < drugConfigList.size(); i++) {
|
|
|
+ if (StringUtil.isBlank(drugConfigList.get(i).getHisName())
|
|
|
+ || StringUtil.isBlank(drugConfigList.get(i).getUniqueName())) {
|
|
|
+ emptyNumList.add(String.valueOf(i + 3));
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(drugConfigList.get(i).getHisName())) {
|
|
|
+ drugConfigList.get(i).setHisName(drugConfigList.get(i).getHisName().trim());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(drugConfigList.get(i).getUniqueName())) {
|
|
|
+ drugConfigList.get(i).setUniqueName(drugConfigList.get(i).getUniqueName().trim());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(drugConfigList.get(i).getForm())) {
|
|
|
+ if (!formList.contains(drugConfigList.get(i).getForm())) {
|
|
|
+ formErrNumList.add(String.valueOf(i + 3));
|
|
|
+ } else {
|
|
|
+ drugConfigList.get(i).setForm(drugConfigList.get(i).getForm().trim());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(drugConfigList.get(i).getUniqueCode())) {
|
|
|
+ drugConfigList.get(i).setUniqueCode(drugConfigList.get(i).getUniqueCode().trim());
|
|
|
+ } else {
|
|
|
+ drugConfigList.get(i).setUniqueCode(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(emptyNumList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
|
|
|
+ + emptyNumList.stream().collect(Collectors.joining("、"))
|
|
|
+ + "。测试取消,请修改后再试。\n");
|
|
|
+ }
|
|
|
+ if (ListUtil.isNotEmpty(formErrNumList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)药品剂型与数据库药品剂型不匹配:"
|
|
|
+ + formErrNumList.stream().collect(Collectors.joining("、"))
|
|
|
+ + "。测试取消,请修改后再试。\n");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //重复数据过滤
|
|
|
+ drugConfigList = drugConfigList
|
|
|
+ .stream()
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(drugConfigList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> uniqueNames = drugConfigList
|
|
|
+ .stream()
|
|
|
+ .map(i -> i.getUniqueName())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ //标准术语校验
|
|
|
+ ConceptVO conceptVO = new ConceptVO();
|
|
|
+ conceptVO.setNames(uniqueNames);
|
|
|
+ conceptVO.setType(ConceptTypeEnum.Drug.getKey());
|
|
|
+ RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
+ RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
|
|
|
+ List<String> names = respDTO.data;
|
|
|
+
|
|
|
+ // 已存在数据
|
|
|
+ Map<String, Map<String, Map<String, List<Long>>>> hisConfigMap = drugConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
|
|
|
+
|
|
|
+ //静态知识
|
|
|
+ List<ConceptInfo> infoList = conceptInfoFacade.getAllConceptInfo();
|
|
|
+ if (ListUtil.isEmpty(infoList)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ List<String> drugStaticNames = infoList.stream()
|
|
|
+ .filter(i -> i.getType().equals(GraphLabelEnum.Medicine.getName()))
|
|
|
+ .map(i -> i.getName())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (DrugConfig config : drugConfigList) {
|
|
|
+ ResultStaticKnowledge result = new ResultStaticKnowledge();
|
|
|
+ result.setGmtCreate(now);
|
|
|
+ result.setGmtModified(now);
|
|
|
+ result.setMessage("");
|
|
|
+ result.setHisName(config.getHisName());
|
|
|
+ result.setName(config.getUniqueName());
|
|
|
+
|
|
|
+ //映射关系是否已存在
|
|
|
+ if (hisConfigMap.containsKey(result.getHisName()) &&
|
|
|
+ hisConfigMap.get(result.getHisName()).containsKey(config.getForm())
|
|
|
+ && hisConfigMap.get(result.getHisName()).get(config.getForm()).keySet().contains(result.getName())) {
|
|
|
+ if (names.contains(result.getName())) {
|
|
|
+ result.setHasStandName(1);
|
|
|
+ } else {
|
|
|
+ result.setHasStandName(0);
|
|
|
+ result.setMessage("标准术语不存在;");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setHasStandName(0);
|
|
|
+ result.setMessage(result.getMessage() + "映射关系不存在;");
|
|
|
+ }
|
|
|
+
|
|
|
+ //静态知识是否存在
|
|
|
+ if (drugStaticNames.contains(result.getName())) {
|
|
|
+ result.setHasStaticKnowledge(1);
|
|
|
+ } else {
|
|
|
+ result.setHasStaticKnowledge(0);
|
|
|
+ result.setMessage(result.getMessage() + "缺少静态知识;");
|
|
|
+ }
|
|
|
+ saveList.add(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存
|
|
|
+ saveResult(saveList, testVO);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 诊断静态知识测试
|
|
|
+ *
|
|
|
+ * @param file
|
|
|
+ * @param testVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean diseaseTest(MultipartFile file, StaticKnowledgeTestVO testVO) {
|
|
|
+ List<ResultStaticKnowledge> saveList = Lists.newLinkedList();
|
|
|
+ //从Excel读取数据
|
|
|
+ List<DiseaseConfig> diseaseConfigList = ExcelUtils.importExcel(file, 0, 1, DiseaseConfig.class);
|
|
|
+
|
|
|
+ Long hospitalId = testVO.getHospitalId();
|
|
|
+ Date now = DateUtil.now();
|
|
|
+
|
|
|
+ //1、数据完整性校验
|
|
|
+ //2、去除前后空格
|
|
|
+ //过滤空数据,保留重复数据,方便计行
|
|
|
+ diseaseConfigList = diseaseConfigList.stream()
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getHisName())
|
|
|
+ || StringUtil.isNotBlank(i.getIcdCode())
|
|
|
+ || StringUtil.isNotBlank(i.getUniqueName()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(diseaseConfigList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
|
|
|
+ }
|
|
|
+ List<String> emptyNumList = Lists.newLinkedList();
|
|
|
+ for (int i = 0; i < diseaseConfigList.size(); i++) {
|
|
|
+ if (StringUtil.isBlank(diseaseConfigList.get(i).getHisName())
|
|
|
+ || StringUtil.isBlank(diseaseConfigList.get(i).getUniqueName())) {
|
|
|
+ emptyNumList.add(String.valueOf(i + 2));
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(diseaseConfigList.get(i).getHisName())) {
|
|
|
+ diseaseConfigList.get(i).setHisName(diseaseConfigList.get(i).getHisName().trim());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(diseaseConfigList.get(i).getUniqueName())) {
|
|
|
+ diseaseConfigList.get(i).setUniqueName(diseaseConfigList.get(i).getUniqueName().trim());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(diseaseConfigList.get(i).getIcdCode())) {
|
|
|
+ diseaseConfigList.get(i).setIcdCode(diseaseConfigList.get(i).getIcdCode().trim());
|
|
|
+ } else {
|
|
|
+ diseaseConfigList.get(i).setIcdCode(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(emptyNumList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
|
|
|
+ + emptyNumList.stream().collect(Collectors.joining("、"))
|
|
|
+ + "。测试取消,请修改后再试。\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ //重复数据过滤
|
|
|
+ diseaseConfigList = diseaseConfigList
|
|
|
+ .stream()
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(diseaseConfigList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ //标准术语校验
|
|
|
+ List<String> uniqueNames = diseaseConfigList.stream()
|
|
|
+ .map(i -> i.getUniqueName())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ ConceptVO conceptVO = new ConceptVO();
|
|
|
+ conceptVO.setNames(uniqueNames);
|
|
|
+ conceptVO.setType(ConceptTypeEnum.Disease.getKey());
|
|
|
+ RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
+ RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
|
|
|
+ List<String> names = respDTO.data;
|
|
|
+
|
|
|
+ // 已存在数据
|
|
|
+ Map<String, Map<String, List<Long>>> hisConfigMap = diseaseConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
|
|
|
+
|
|
|
+ //静态知识
|
|
|
+ List<ConceptInfo> infoList = conceptInfoFacade.getAllConceptInfo();
|
|
|
+ if (ListUtil.isEmpty(infoList)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ List<String> diseaseStaticNames = infoList.stream()
|
|
|
+ .filter(i -> i.getType().equals(GraphLabelEnum.YiBaoDiseaseName.getName()))
|
|
|
+ .map(i -> i.getName())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (DiseaseConfig config : diseaseConfigList) {
|
|
|
+ ResultStaticKnowledge result = new ResultStaticKnowledge();
|
|
|
+ result.setGmtCreate(now);
|
|
|
+ result.setGmtModified(now);
|
|
|
+ result.setMessage("");
|
|
|
+ result.setHisName(config.getHisName());
|
|
|
+ result.setName(config.getUniqueName());
|
|
|
+
|
|
|
+ //映射关系是否已存在
|
|
|
+ if (hisConfigMap.containsKey(result.getHisName())
|
|
|
+ && hisConfigMap.get(result.getHisName()).keySet().contains(result.getName())) {
|
|
|
+ if (names.contains(result.getName())) {
|
|
|
+ result.setHasStandName(1);
|
|
|
+ } else {
|
|
|
+ result.setHasStandName(0);
|
|
|
+ result.setMessage("标准术语不存在;");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setHasStandName(0);
|
|
|
+ result.setMessage(result.getMessage() + "映射关系不存在;");
|
|
|
+ }
|
|
|
+
|
|
|
+ //静态知识是否存在
|
|
|
+ if (diseaseStaticNames.contains(result.getName())) {
|
|
|
+ result.setHasStaticKnowledge(1);
|
|
|
+ } else {
|
|
|
+ result.setHasStaticKnowledge(0);
|
|
|
+ result.setMessage(result.getMessage() + "缺少静态知识;");
|
|
|
+ }
|
|
|
+ saveList.add(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存
|
|
|
+ saveResult(saveList, testVO);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 手术/操作静态知识测试
|
|
|
+ *
|
|
|
+ * @param file
|
|
|
+ * @param testVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean operationTest(MultipartFile file, StaticKnowledgeTestVO testVO) {
|
|
|
+ List<ResultStaticKnowledge> saveList = Lists.newLinkedList();
|
|
|
+ //从Excel读取数据
|
|
|
+ List<OperationConfig> operationConfigList = ExcelUtils.importExcel(file, 0, 1, OperationConfig.class);
|
|
|
+
|
|
|
+ Long hospitalId = testVO.getHospitalId();
|
|
|
+ Date now = DateUtil.now();
|
|
|
+
|
|
|
+ //1、数据完整性校验
|
|
|
+ //2、去除前后空格
|
|
|
+ //过滤空数据,保留重复数据,方便计行
|
|
|
+ operationConfigList = operationConfigList.stream()
|
|
|
+ .filter(i -> StringUtil.isNotBlank(i.getHisName())
|
|
|
+ || StringUtil.isNotBlank(i.getUniqueCode())
|
|
|
+ || StringUtil.isNotBlank(i.getUniqueName()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(operationConfigList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
|
|
|
+ }
|
|
|
+ List<String> emptyNumList = Lists.newLinkedList();
|
|
|
+ for (int i = 0; i < operationConfigList.size(); i++) {
|
|
|
+ if (StringUtil.isBlank(operationConfigList.get(i).getHisName())
|
|
|
+ || StringUtil.isBlank(operationConfigList.get(i).getUniqueName())) {
|
|
|
+ emptyNumList.add(String.valueOf(i + 2));
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(operationConfigList.get(i).getHisName())) {
|
|
|
+ operationConfigList.get(i).setHisName(operationConfigList.get(i).getHisName().trim());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(operationConfigList.get(i).getUniqueName())) {
|
|
|
+ operationConfigList.get(i).setUniqueName(operationConfigList.get(i).getUniqueName().trim());
|
|
|
+ }
|
|
|
+ if (StringUtil.isNotBlank(operationConfigList.get(i).getUniqueCode())) {
|
|
|
+ operationConfigList.get(i).setUniqueCode(operationConfigList.get(i).getUniqueCode().trim());
|
|
|
+ } else {
|
|
|
+ operationConfigList.get(i).setUniqueCode(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ListUtil.isNotEmpty(emptyNumList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
|
|
|
+ + emptyNumList.stream().collect(Collectors.joining("、"))
|
|
|
+ + "。测试取消,请修改后再试。\n");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //重复数据过滤
|
|
|
+ operationConfigList = operationConfigList
|
|
|
+ .stream()
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(operationConfigList)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //标准术语校验
|
|
|
+ List<String> uniqueNames = operationConfigList.stream()
|
|
|
+ .map(i -> i.getUniqueName())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ ConceptVO conceptVO = new ConceptVO();
|
|
|
+ conceptVO.setNames(uniqueNames);
|
|
|
+ conceptVO.setType(ConceptTypeEnum.Opeartion.getKey());
|
|
|
+ RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
|
|
|
+ RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
|
|
|
+ List<String> names = respDTO.data;
|
|
|
+
|
|
|
+
|
|
|
+ // 已存在数据
|
|
|
+ Map<String, Map<String, List<Long>>> hisConfigMap = operationConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
|
|
|
+
|
|
|
+ //静态知识
|
|
|
+ List<ConceptInfo> infoList = conceptInfoFacade.getAllConceptInfo();
|
|
|
+ if (ListUtil.isEmpty(infoList)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ List<String> diseaseStaticNames = infoList.stream()
|
|
|
+ .filter(i -> i.getType().equals(GraphLabelEnum.YiBaoOperationName.getName()))
|
|
|
+ .map(i -> i.getName())
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (OperationConfig config : operationConfigList) {
|
|
|
+ ResultStaticKnowledge result = new ResultStaticKnowledge();
|
|
|
+ result.setGmtCreate(now);
|
|
|
+ result.setGmtModified(now);
|
|
|
+ result.setMessage("");
|
|
|
+ result.setHisName(config.getHisName());
|
|
|
+ result.setName(config.getUniqueName());
|
|
|
+
|
|
|
+ //映射关系是否已存在
|
|
|
+ if (hisConfigMap.containsKey(result.getHisName())
|
|
|
+ && hisConfigMap.get(result.getHisName()).keySet().contains(result.getName())) {
|
|
|
+ if (names.contains(result.getName())) {
|
|
|
+ result.setHasStandName(1);
|
|
|
+ } else {
|
|
|
+ result.setHasStandName(0);
|
|
|
+ result.setMessage("标准术语不存在;");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.setHasStandName(0);
|
|
|
+ result.setMessage(result.getMessage() + "映射关系不存在;");
|
|
|
+ }
|
|
|
+
|
|
|
+ //静态知识是否存在
|
|
|
+ if (diseaseStaticNames.contains(result.getName())) {
|
|
|
+ result.setHasStaticKnowledge(1);
|
|
|
+ } else {
|
|
|
+ result.setHasStaticKnowledge(0);
|
|
|
+ result.setMessage(result.getMessage() + "缺少静态知识;");
|
|
|
+ }
|
|
|
+ saveList.add(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ //保存
|
|
|
+ saveResult(saveList, testVO);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 保存静态知识测试结果
|
|
|
*
|