浏览代码

默认方案配置删除和停用优化

wangfeng 3 年之前
父节点
当前提交
e3a588799c

+ 8 - 6
cdssman-service/src/main/java/com/diagbot/facade/PlanDefaultFacade.java

@@ -2,6 +2,7 @@ package com.diagbot.facade;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.PlanDetailDTO;
 import com.diagbot.dto.PlanInfoDefaultDTO;
 import com.diagbot.entity.Plan;
@@ -19,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -35,16 +35,18 @@ public class PlanDefaultFacade {
     PlanDetailFacade planDetailFacade;
     @Autowired
     PlanFacade planFacade;
+    @Autowired
+    DictionaryFacade dictionaryFacade;
 
     public Boolean addDefaultPlans(PlanDefaultVO planDefaultVO) {
         boolean res = false;
         Date now = DateUtil.now();
-        List<String> planCode = Arrays.asList("plan_default", "patientia", "info", "chief", "symptom", "other", "vital"
+        List<DictionaryInfoDTO> listByGroupType = dictionaryFacade.getListByGroupType(60);
+        List<String> planCode = listByGroupType.stream().map(ac -> ac.getVal()).collect(Collectors.toList());
+       /* List<String> planCode = Arrays.asList("plan_default", "patientia", "info", "chief", "symptom", "other", "vital"
                 , "lis", "pacs", "diag", "doc_advice", "reference_lis", "reference_pacs", "order_rational",
-                "medical_advice", "medical_record");
-/*        if(ListUtil.isEmpty(planCode)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "方案编码不能为空!");
-        }*/
+                "medical_advice", "medical_record");*/
+
         //先删除医院默认的方案,
         if (planDefaultVO.getHospitalId() == -1) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "朗通医院不能一键添加!");

+ 3 - 0
cdssman-service/src/main/java/com/diagbot/facade/PlanDetailFacade.java

@@ -135,6 +135,9 @@ public class PlanDetailFacade extends PlanDetailServiceImpl {
 
     public boolean cancelPlanDetail(PlanDetailCancelVO planDetailCancelVO) {
         boolean res = false;
+        if (planDetailCancelVO.getHospitalId() == -1) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "朗通医院默认方案不能被删除!");
+        }
         // 1.先判断数据是否存在有效
         UpdateWrapper<PlanDetail> planDetailNew = new UpdateWrapper<>();
         planDetailNew

+ 17 - 2
cdssman-service/src/main/java/com/diagbot/facade/PlanFacade.java

@@ -3,6 +3,7 @@ package com.diagbot.facade;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.dto.DictionaryInfoDTO;
 import com.diagbot.dto.PlanDetailDTO;
 import com.diagbot.dto.PlanInfoDefaultDTO;
 import com.diagbot.dto.PlanInfoPagesDTO;
@@ -33,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -51,7 +53,8 @@ public class PlanFacade extends PlanServiceImpl {
     PlanDetailFacade planDetailFacade;
     @Autowired
     private HospitalInfoFacade hospitalInfoFacade;
-
+    @Autowired
+    DictionaryFacade dictionaryFacade;
 
     /**
      * @param hospitalPlanSaveVO
@@ -195,6 +198,13 @@ public class PlanFacade extends PlanServiceImpl {
         boolean res = false;
         // 1.先判断数据是否存在有效
         Plan plan = checkPlan(hospitalPlanCancelVO.getPlanId());
+        List<DictionaryInfoDTO> listByGroupType = dictionaryFacade.getListByGroupType(60);
+        String val = listByGroupType.get(0).getVal();
+        String[] valStr = val.split(",");
+        List<String> planCode = Arrays.asList(valStr);
+        if(planCode.contains(plan.getPlanCode())){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "默认方案编码不能被删除!");
+        }
         if (plan.getPlanStatus() == 1) {
             throw new CommonException(CommonErrorCode.FAIL, "该方案启用中,不能删除!");
         }
@@ -214,7 +224,12 @@ public class PlanFacade extends PlanServiceImpl {
     }
 
     public boolean revStopPlan(PlanRevStopVO planRevStopVO) {
-        checkPlan(planRevStopVO.getId());
+        Plan plan = checkPlan(planRevStopVO.getId());
+        List<DictionaryInfoDTO> listByGroupType = dictionaryFacade.getListByGroupType(60);
+        List<String> planCode = listByGroupType.stream().map(ac -> ac.getVal()).collect(Collectors.toList());
+        if(planCode.contains(plan.getPlanCode())){
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "默认方案编码不能被停用!");
+        }
         UpdateWrapper<Plan> planNew = new UpdateWrapper<>();
         planNew
                 .eq("id", planRevStopVO.getId())

+ 23 - 0
docs/042.20211011默认方案初始化脚本/cdss_init.sql

@@ -385,3 +385,26 @@ INSERT INTO `cdss`.`tran_plan_detail` (`id`, `is_deleted`, `gmt_create`, `gmt_mo
 INSERT INTO `cdss`.`tran_plan_detail` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `plan_id`, `parent_id`, `name`, `code`, `status`, `number`, `order_no`, `value`, `remark`) VALUES ('-3', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '4', '-1', '医学知识', 'medical', '1', NULL, '3', NULL, NULL);
 INSERT INTO `cdss`.`tran_plan_detail` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `plan_id`, `parent_id`, `name`, `code`, `status`, `number`, `order_no`, `value`, `remark`) VALUES ('-2', 'Y', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '4', '-1', '病历质控', 'qc', '1', NULL, '2', NULL, NULL);
 INSERT INTO `cdss`.`tran_plan_detail` (`id`, `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `hospital_id`, `plan_id`, `parent_id`, `name`, `code`, `status`, `number`, `order_no`, `value`, `remark`) VALUES ('1', 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '-1', '4', '-1', '辅助信息', 'auxiliary', '1', NULL, '1', NULL, NULL);
+
+DELETE
+FROM
+  `cdss`.`sys_dictionary_info`
+WHERE group_type = 60 ;
+
+
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '默认方案', 'plan_default', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '输入位置-基本信息', 'info', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '输入位置-主诉', 'chief', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '输入位置-现病史', 'symptom', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '输入位置-其他史', 'other', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ('N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '输入位置-体格检查', 'vital', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '输入位置-化验', 'lis', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '输入位置-辅检', 'pacs', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '输入位置-诊断', 'diag', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '输入位置-医嘱', 'doc_advice', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '非空且非输入状态', 'patientia', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '病历推送', 'medical_record', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '医嘱推送', 'medical_advice', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '开单合理性', 'order_rational', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '检查报告多测量值', 'reference_pacs', '1', '0', '电子方案配置');
+INSERT INTO `cdss`.`sys_dictionary_info` (  `is_deleted`, `gmt_create`, `gmt_modified`, `creator`, `modifier`, `group_type`, `name`, `val`, `return_type`, `order_no`, `remark`) VALUES ( 'N', '1970-01-01 12:00:00', '1970-01-01 12:00:00', '0', '0', '60', '检验报告多测量值', 'reference_lis', '1', '0', NULL);