Browse Source

医学规则测试

zhaops 4 years ago
parent
commit
726f793925

+ 106 - 7
cdssman-service/src/main/java/com/diagbot/facade/ResultStaticKnowledgeFacade.java

@@ -81,6 +81,8 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
     private TransfusionConfigFacade transfusionConfigFacade;
     @Autowired
     private DictionaryFacade dictionaryFacade;
+    @Autowired
+    private RunningInfoFacade runningInfoFacade;
 
     @Autowired
     private LisNameRepository lisNameRepository;
@@ -104,6 +106,10 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
      */
     @Transactional
     public Boolean lisTest(MultipartFile file, StaticKnowledgeTestVO testVO) {
+        RunningInfoVO runningInfoVO = new RunningInfoVO();
+        runningInfoVO.setCaseId(testVO.getCaseId());
+        runningInfoVO.setHospitalId(testVO.getHospitalId());
+
         List<ResultStaticKnowledge> saveList = Lists.newLinkedList();
         //从Excel读取数据
         List<LisConfig> lisConfigList = ExcelUtils.importExcel(file, 0, 1, LisConfig.class);
@@ -121,6 +127,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                         || StringUtil.isNotBlank(i.getUniqueName()))
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(lisConfigList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
         }
         //数据预处理
@@ -147,6 +156,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
 
         if (ListUtil.isNotEmpty(emptyNumList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
                     + emptyNumList.stream().collect(Collectors.joining("、"))
                     + "。测试取消,请修改后再试。\n");
@@ -158,6 +170,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                 .distinct()
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(lisConfigList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
         }
 
@@ -170,14 +185,23 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.LisPack.getKey());
         RespDTO<List<String>> respLisPackDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respLisPackDTO, "标准术语校验失败");
+        if (RespDTOUtil.respIsNG(respLisPackDTO)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准术语校验失败");
+        }
         List<String> lisPackNames = respLisPackDTO.data;
         conceptVO.setType(ConceptTypeEnum.Lis.getKey());
         RespDTO<List<String>> respLisDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respLisDTO, "标准术语校验失败");
+        if (RespDTOUtil.respIsNG(respLisDTO)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准术语校验失败");
+        }
         List<String> lisNames = respLisDTO.data;
 
-
         // 已存在数据
         Map<String, Map<String, Map<String, List<Long>>>> hisConfigMap = lisConfigFacade.getConfigMap(Long.valueOf(hospitalId), null, null);
         Map<String, Map<String, Map<String, List<Long>>>> uniqueConfigMap = lisConfigFacade.getUniqueConfigMap(hospitalId, null, null);
@@ -273,6 +297,10 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
      */
     @Transactional
     public Boolean pacsTest(MultipartFile file, StaticKnowledgeTestVO testVO) {
+        RunningInfoVO runningInfoVO = new RunningInfoVO();
+        runningInfoVO.setCaseId(testVO.getCaseId());
+        runningInfoVO.setHospitalId(testVO.getHospitalId());
+
         List<ResultStaticKnowledge> saveList = Lists.newLinkedList();
         //从Excel读取数据
         List<PacsConfig> pacsConfigList = ExcelUtils.importExcel(file, 0, 1, PacsConfig.class);
@@ -289,6 +317,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                         || StringUtil.isNotBlank(i.getUniqueName()))
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(pacsConfigList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
         }
         List<String> emptyNumList = Lists.newLinkedList();
@@ -311,6 +342,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
 
         if (ListUtil.isNotEmpty(emptyNumList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
                     + emptyNumList.stream().collect(Collectors.joining("、"))
                     + "。测试取消,请修改后再试。\n");
@@ -323,6 +357,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                 .collect(Collectors.toList());
 
         if (ListUtil.isEmpty(pacsConfigList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
         }
 
@@ -335,7 +372,12 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Pacs.getKey());
         RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        if (RespDTOUtil.respIsNG(respDTO)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准术语校验失败");
+        }
         List<String> names = respDTO.data;
 
         // 已存在数据
@@ -430,6 +472,10 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
      */
     @Transactional
     public Boolean drugTest(MultipartFile file, StaticKnowledgeTestVO testVO) {
+        RunningInfoVO runningInfoVO = new RunningInfoVO();
+        runningInfoVO.setCaseId(testVO.getCaseId());
+        runningInfoVO.setHospitalId(testVO.getHospitalId());
+
         List<ResultStaticKnowledge> saveList = Lists.newLinkedList();
         //从Excel读取数据
         List<DrugConfig> drugConfigList = ExcelUtils.importExcel(file, 1, 1, DrugConfig.class);
@@ -447,6 +493,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                         || StringUtil.isNotBlank(i.getUniqueName()))
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(drugConfigList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
         }
         List<String> emptyNumList = Lists.newLinkedList();
@@ -484,11 +533,17 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
 
         if (ListUtil.isNotEmpty(emptyNumList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
                     + emptyNumList.stream().collect(Collectors.joining("、"))
                     + "。测试取消,请修改后再试。\n");
         }
         if (ListUtil.isNotEmpty(formErrNumList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)药品剂型与数据库药品剂型不匹配:"
                     + formErrNumList.stream().collect(Collectors.joining("、"))
                     + "。测试取消,请修改后再试。\n");
@@ -501,6 +556,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                 .distinct()
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(drugConfigList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
         }
 
@@ -514,7 +572,12 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Drug.getKey());
         RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        if (RespDTOUtil.respIsNG(respDTO)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "标准术语校验失败");
+        }
         List<String> names = respDTO.data;
 
         // 已存在数据
@@ -578,6 +641,10 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
      */
     @Transactional
     public Boolean diseaseTest(MultipartFile file, StaticKnowledgeTestVO testVO) {
+        RunningInfoVO runningInfoVO = new RunningInfoVO();
+        runningInfoVO.setCaseId(testVO.getCaseId());
+        runningInfoVO.setHospitalId(testVO.getHospitalId());
+
         List<ResultStaticKnowledge> saveList = Lists.newLinkedList();
         //从Excel读取数据
         List<DiseaseConfig> diseaseConfigList = ExcelUtils.importExcel(file, 0, 1, DiseaseConfig.class);
@@ -594,6 +661,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                         || StringUtil.isNotBlank(i.getUniqueName()))
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(diseaseConfigList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
         }
         List<String> emptyNumList = Lists.newLinkedList();
@@ -616,6 +686,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
 
         if (ListUtil.isNotEmpty(emptyNumList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
                     + emptyNumList.stream().collect(Collectors.joining("、"))
                     + "。测试取消,请修改后再试。\n");
@@ -627,6 +700,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                 .distinct()
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(diseaseConfigList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
         }
 
@@ -639,7 +715,12 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Disease.getKey());
         RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        if (RespDTOUtil.respIsNG(respDTO)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
+            RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        }
         List<String> names = respDTO.data;
 
         // 已存在数据
@@ -702,6 +783,10 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
      */
     @Transactional
     public Boolean operationTest(MultipartFile file, StaticKnowledgeTestVO testVO) {
+        RunningInfoVO runningInfoVO = new RunningInfoVO();
+        runningInfoVO.setCaseId(testVO.getCaseId());
+        runningInfoVO.setHospitalId(testVO.getHospitalId());
+
         List<ResultStaticKnowledge> saveList = Lists.newLinkedList();
         //从Excel读取数据
         List<OperationConfig> operationConfigList = ExcelUtils.importExcel(file, 0, 1, OperationConfig.class);
@@ -718,6 +803,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                         || StringUtil.isNotBlank(i.getUniqueName()))
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(operationConfigList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
         }
         List<String> emptyNumList = Lists.newLinkedList();
@@ -740,6 +828,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         }
 
         if (ListUtil.isNotEmpty(emptyNumList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "以下行数(不计入空行)存在不完整数据:"
                     + emptyNumList.stream().collect(Collectors.joining("、"))
                     + "。测试取消,请修改后再试。\n");
@@ -752,6 +843,9 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
                 .distinct()
                 .collect(Collectors.toList());
         if (ListUtil.isEmpty(operationConfigList)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,测试数据不能为空");
         }
 
@@ -765,7 +859,12 @@ public class ResultStaticKnowledgeFacade extends ResultStaticKnowledgeServiceImp
         conceptVO.setNames(uniqueNames);
         conceptVO.setType(ConceptTypeEnum.Opeartion.getKey());
         RespDTO<List<String>> respDTO = cdssCoreClient.getConceptNames(conceptVO);
-        RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        if (RespDTOUtil.respIsNG(respDTO)) {
+            //终止运行
+            runningInfoVO.setStatus(0);
+            runningInfoFacade.updateStatus(runningInfoVO);
+            RespDTOUtil.respNGDealCover(respDTO, "标准术语校验失败");
+        }
         List<String> names = respDTO.data;