-- 添加测试医生数据

-- 1. 添加医生管理员到 zyt_admin 表
INSERT INTO `zyt_admin` (`name`, `account`, `avatar`, `mobile`, `email`, `disable`, `create_time`, `update_time`) VALUES
('张医生', 'doctor1', '/uploads/avatar/doctor1.jpg', '13800138000', 'doctor1@example.com', 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
('李医生', 'doctor2', '/uploads/avatar/doctor2.jpg', '13800138001', 'doctor2@example.com', 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
('王医生', 'doctor3', '/uploads/avatar/doctor3.jpg', '13800138002', 'doctor3@example.com', 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
('陈医生', 'doctor4', '/uploads/avatar/doctor4.jpg', '13800138003', 'doctor4@example.com', 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());

-- 2. 为医生分配医生角色（role_id = 1）
-- 假设上面插入的医生 ID 分别为 2, 3, 4, 5
INSERT INTO `zyt_admin_role` (`admin_id`, `role_id`) VALUES
(2, 1),
(3, 1),
(4, 1),
(5, 1);

-- 3. 验证医生数据
-- 查询所有医生
SELECT a.id, a.name, a.account, a.avatar, a.mobile, a.email
FROM `zyt_admin` a
INNER JOIN `zyt_admin_role` ar ON a.id = ar.admin_id
WHERE ar.role_id = 1 AND a.disable = 0;

-- 4. 添加医生排班数据（可选）
-- 假设医生 ID 为 2, 3, 4, 5
INSERT INTO `la_doctor_roster` (`doctor_id`, `date`, `period`, `status`, `quota`, `max_patients`, `create_time`, `update_time`) VALUES
-- 医生 2 的排班
(2, '2024-03-11', 'morning', 1, 20, 30, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(2, '2024-03-11', 'afternoon', 1, 20, 30, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(2, '2024-03-12', 'morning', 1, 20, 30, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),

-- 医生 3 的排班
(3, '2024-03-11', 'morning', 1, 20, 30, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(3, '2024-03-12', 'afternoon', 1, 20, 30, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),

-- 医生 4 的排班
(4, '2024-03-11', 'morning', 1, 20, 30, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(4, '2024-03-13', 'morning', 1, 20, 30, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),

-- 医生 5 的排班
(5, '2024-03-11', 'afternoon', 1, 20, 30, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(5, '2024-03-12', 'morning', 1, 20, 30, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());

-- 5. 验证排班数据
SELECT * FROM `la_doctor_roster` WHERE doctor_id IN (2, 3, 4, 5);
