-- 日常记录分享邀请码（仅当天有效，用于家属查看脱敏战报）

CREATE TABLE IF NOT EXISTS `zyt_tcm_daily_share_invite` (
    `id` int unsigned NOT NULL AUTO_INCREMENT,
    `invite_code` varchar(16) NOT NULL COMMENT '邀请码',
    `diagnosis_id` int unsigned NOT NULL COMMENT '诊单ID',
    `user_id` int unsigned NOT NULL DEFAULT 0 COMMENT '分享人小程序用户ID',
    `invite_date` date NOT NULL COMMENT '有效日期，仅当天可查看',
    `create_time` int unsigned NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_invite_code` (`invite_code`),
    KEY `idx_diagnosis_date` (`diagnosis_id`, `invite_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='日常记录分享邀请码';
