-- 医生预约表 CREATE TABLE IF NOT EXISTS `zyt_doctor_appointment` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID', `patient_id` int(11) NOT NULL COMMENT '患者ID', `doctor_id` int(11) NOT NULL COMMENT '医生ID', `assistant_id` int(11) NOT NULL DEFAULT 0 COMMENT '创建该预约的后台用户(admin id,多为医助)', `roster_id` int(11) NOT NULL COMMENT '排班ID', `appointment_date` date NOT NULL COMMENT '预约日期', `period` enum('morning','afternoon') NOT NULL COMMENT '时段:morning=上午,afternoon=下午', `appointment_time` time NOT NULL COMMENT '预约时间', `appointment_type` varchar(20) DEFAULT 'video' COMMENT '预约类型:video=视频问诊,text=图文问诊,phone=电话问诊', `status` tinyint(1) DEFAULT '1' COMMENT '状态:1=已预约,2=已取消,3=已完成', `remark` varchar(500) DEFAULT NULL COMMENT '备注', `channel_source` varchar(64) NOT NULL DEFAULT '' COMMENT '渠道来源(字典channels)', `channel_source_detail` varchar(128) NOT NULL DEFAULT '' COMMENT '渠道补充说明(如自媒体账号等)', `create_time` int(10) unsigned DEFAULT NULL COMMENT '创建时间', `update_time` int(10) unsigned DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`id`), KEY `idx_doctor_date_time_status` (`doctor_id`,`appointment_date`,`appointment_time`,`status`) USING BTREE, KEY `idx_patient` (`patient_id`) USING BTREE, KEY `idx_doctor_date` (`doctor_id`,`appointment_date`) USING BTREE, KEY `idx_roster` (`roster_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医生预约表';