Quellcode durchsuchen

批量处理从HIS同步过来的协定方权限(使用HIS科室)

guowei vor 2 Jahren
Ursprung
Commit
e1a96486da
1 geänderte Dateien mit 35 neuen und 1 gelöschten Zeilen
  1. 35 1
      cbkj_web_api/src/main/resources/sqlRecord/pre_api_v5.15.1.sql

+ 35 - 1
cbkj_web_api/src/main/resources/sqlRecord/pre_api_v5.15.1.sql

@@ -1,2 +1,36 @@
 #2022-03-01 guowei 新增参数:开方时不可搜索类名疾病(95修订带.的疾病)
-insert into `t_sys_param` (`PAR_ID`, `APP_ID`, `INS_CODE`, `DEPT_ID`, `PAR_CODE`, `PAR_NAME`, `PAR_VALUES`, `PAR_DES`, `CREATE_DATE`, `CREATE_USER`, `CREATE_USERNAME`, `UPDATE_DATE`, `UPDATE_USER`, `UPDATE_USERNAME`, `DEL_DATE`, `DEL_USER`, `DEL_USERNAME`, `IS_DEL`, `SEQN`, `PAR_CLASSIFY`, `PAR_NUMBER`) values('4f621b14c4684f26bf732c7acbe75a2d','000000','000000','000000','DIS_FILTER_CATEGORY','开方时不可搜索类名疾病(95修订带.的疾病)','1','0可以搜索 1不可以搜索','2022-03-01 10:23:50','70810c874405453b99c6c2cf72296fe5','管理员',NULL,NULL,NULL,NULL,NULL,NULL,'0','-1','智能开方','A072');
+insert into `t_sys_param` (`PAR_ID`, `APP_ID`, `INS_CODE`, `DEPT_ID`, `PAR_CODE`, `PAR_NAME`, `PAR_VALUES`, `PAR_DES`, `CREATE_DATE`, `CREATE_USER`, `CREATE_USERNAME`, `UPDATE_DATE`, `UPDATE_USER`, `UPDATE_USERNAME`, `DEL_DATE`, `DEL_USER`, `DEL_USERNAME`, `IS_DEL`, `SEQN`, `PAR_CLASSIFY`, `PAR_NUMBER`) values('4f621b14c4684f26bf732c7acbe75a2d','000000','000000','000000','DIS_FILTER_CATEGORY','开方时不可搜索类名疾病(95修订带.的疾病)','1','0可以搜索 1不可以搜索','2022-03-01 10:23:50','70810c874405453b99c6c2cf72296fe5','管理员',NULL,NULL,NULL,NULL,NULL,NULL,'0','-1','智能开方','A072');
+
+
+#2022-03-03 guowei 批量处理从HIS同步过来的协定方权限(使用HIS科室)
+DELIMITER $$
+CREATE
+    /*[DEFINER = { user | CURRENT_USER }]*/
+    PROCEDURE `batch_personal_rule_auth_his`()
+BEGIN
+    INSERT INTO `t_personal_rule_auth` (`rule_id`, `dept_id`, `dept_check_all`, `user_id`, `pers_pre_id`)
+    SELECT * FROM (
+                      SELECT p.IS_SHARE, p.`DEPT_ID` DEPT_ID, 0 AS dept_check_all, i.id, p.PERS_PRE_ID
+                      FROM t_personal_prescription p
+                               JOIN sys_admin_info i ON i.id = p.PRE_OWNER
+                      WHERE p.is_del = '0' AND p.IS_SHARE = '0' AND p.`DEPT_ID` IS NOT NULL
+                      UNION ALL
+                      SELECT p.IS_SHARE, d.DEP_ORIGIN_ID DEPT_ID, 1 AS dept_check_all, i.id, p.PERS_PRE_ID
+                      FROM t_personal_prescription p
+                               JOIN sys_department d ON d.`DEP_ORIGIN_ID` = p.`DEPT_ID`
+                               JOIN sys_admin_practice e ON e.dep_id = d.`DEP_ORIGIN_ID`
+                               JOIN sys_admin_info i ON i.`id` = e.`admin_id`
+                      WHERE p.is_del = '0' AND p.IS_SHARE = '1'
+                      UNION ALL
+                      SELECT p.IS_SHARE, d.DEP_ORIGIN_ID DEPT_ID, 1 AS dept_check_all, i.id, p.PERS_PRE_ID
+                      FROM t_personal_prescription p
+                               JOIN sys_institution s ON s.`INS_CODE` = p.`INS_CODE`
+                               JOIN sys_department d ON d.`INS_CODE` = s.`INS_CODE`
+                               JOIN sys_admin_practice e ON e.dep_id = d.`DEP_ORIGIN_ID`
+                               JOIN sys_admin_info i ON i.`ID` = e.`admin_id`
+                      WHERE p.is_del = '0' AND p.IS_SHARE = '2'
+                  ) s
+    WHERE NOT EXISTS (SELECT 1 FROM t_personal_rule_auth a WHERE a.`rule_id` = s.`IS_SHARE` AND a.`dept_id` = s.`DEPT_ID`
+                                                             AND a.`user_id` = s.`id` AND a.`pers_pre_id` = s.`PERS_PRE_ID`);
+END$$
+DELIMITER ;