33 lines
2.1 KiB
SQL
33 lines
2.1 KiB
SQL
-- 保留原复诊率算法;新增独立「继承复诊接诊率」页面。
|
|
-- 幂等执行;新增页面和接口分别继承原页面对应权限,执行后需清理 AdminAuthCache。
|
|
SET @revisit_parent_id := (SELECT pid FROM zyt_system_menu WHERE perms = 'stats.revisitRate/overview' AND type = 'C' LIMIT 1);
|
|
|
|
INSERT INTO zyt_system_menu
|
|
(pid, type, name, icon, sort, perms, paths, component, selected, params, is_cache, is_show, is_disable, create_time, update_time)
|
|
SELECT @revisit_parent_id, 'C', '继承复诊接诊率', '', 12, 'stats.revisitInheritRate/overview',
|
|
'/stats/revisit_inherit_rate', '/stats/revisit_inherit_rate/index', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
|
|
FROM DUAL
|
|
WHERE @revisit_parent_id IS NOT NULL
|
|
AND NOT EXISTS (SELECT 1 FROM zyt_system_menu WHERE perms = 'stats.revisitInheritRate/overview');
|
|
|
|
SET @inherit_rate_id := (SELECT id FROM zyt_system_menu WHERE perms = 'stats.revisitInheritRate/overview' AND type = 'C' LIMIT 1);
|
|
|
|
INSERT INTO zyt_system_menu
|
|
(pid, type, name, icon, sort, perms, paths, component, selected, params, is_cache, is_show, is_disable, create_time, update_time)
|
|
SELECT @inherit_rate_id, 'A', p.name, '', p.sort, p.perms, '', '', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
|
|
FROM (
|
|
SELECT '继承统计-部门医助选项' AS name, 1 AS sort, 'stats.revisitInheritRate/deptOptions' AS perms
|
|
UNION ALL SELECT '继承统计-患者明细', 2, 'stats.revisitInheritRate/assignLines'
|
|
UNION ALL SELECT '继承统计-订单明细', 3, 'stats.revisitInheritRate/visitOrderLines'
|
|
) p
|
|
WHERE @inherit_rate_id IS NOT NULL
|
|
AND NOT EXISTS (SELECT 1 FROM zyt_system_menu m WHERE m.perms = p.perms);
|
|
|
|
INSERT IGNORE INTO zyt_system_role_menu (role_id, menu_id)
|
|
SELECT DISTINCT rm.role_id, target.id
|
|
FROM zyt_system_role_menu rm
|
|
INNER JOIN zyt_system_menu original ON original.id = rm.menu_id
|
|
INNER JOIN zyt_system_menu target ON target.perms = REPLACE(original.perms, 'stats.revisitRate/', 'stats.revisitInheritRate/')
|
|
WHERE original.perms IN ('stats.revisitRate/overview', 'stats.revisitRate/deptOptions',
|
|
'stats.revisitRate/assignLines', 'stats.revisitRate/visitOrderLines');
|