# 诊单跟踪备注接口权限注册（2026-05-05）
# 挂在「中医诊单」(perms=tcm.diagnosis/lists) 菜单下
#   tcm.diagnosis/addTrackingNote  新增跟踪备注
#   tcm.diagnosis/trackingNotes    拉取跟踪备注列表

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', '新增跟踪备注', '', 80,
    'tcm.diagnosis/addTrackingNote', '', '',
    '', '', 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/addTrackingNote');

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', '跟踪备注列表', '', 81,
    'tcm.diagnosis/trackingNotes', '', '',
    '', '', 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/trackingNotes');
