-- 消费者处方列表：修正处方笺姓名 / 手机号（接口 tcm.prescription/patchPatient）
-- 执行前确认表前缀为 zyt_；若已有相同 perms 则跳过。

SET @cf_rx_menu_id := (
    SELECT id FROM zyt_system_menu
    WHERE type = 'C'
      AND (
          component = 'consumer/prescription/index'
          OR component LIKE '%consumer/prescription/index%'
      )
    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
    @cf_rx_menu_id, 'A', '修正处方患者姓名手机', '', 53,
    'tcm.prescription/patchPatient', '', '',
    '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
FROM DUAL
WHERE @cf_rx_menu_id IS NOT NULL
  AND NOT EXISTS (SELECT 1 FROM zyt_system_menu WHERE perms = 'tcm.prescription/patchPatient');
