# 二诊只读病例详情接口权限注册（T1+T2 - 2026-05-05）
# 挂在「中医诊单」(perms=tcm.diagnosis/lists) 菜单下
#   tcm.diagnosis/readonlyDetail  二诊只读病例详情接口

SET @diag_menu_id := (SELECT id FROM zyt_system_menu WHERE perms = 'tcm.diagnosis/lists' 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
    @diag_menu_id, 'A', '只读病例', '', 70,
    'tcm.diagnosis/readonlyDetail', '', '',
    '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
FROM DUAL
WHERE @diag_menu_id IS NOT NULL
  AND NOT EXISTS (SELECT 1 FROM zyt_system_menu WHERE perms = 'tcm.diagnosis/readonlyDetail');
