-- 诊单跟踪备注表（按天一条，多次追加更新；只存文字，不含附件）

CREATE TABLE IF NOT EXISTS `zyt_tracking_note` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `diagnosis_id` int(11) unsigned NOT NULL COMMENT '诊单ID (tcm_diagnosis.id)',
  `admin_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '记录人ID (system_admin.id)',
  `note_date` date NOT NULL COMMENT '记录日期',
  `content` text DEFAULT NULL COMMENT '跟踪备注文字（多次追加以换行分隔，带 [HH:MM] 前缀）',
  `create_time` int(10) unsigned NOT NULL DEFAULT 0,
  `update_time` int(10) unsigned NOT NULL DEFAULT 0,
  `delete_time` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_diagnosis_date` (`diagnosis_id`, `note_date`),
  KEY `idx_admin` (`admin_id`),
  KEY `idx_diagnosis_date` (`diagnosis_id`, `note_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='诊单跟踪备注';
