-- adm_doctor_schedule definition

-- Drop table

-- DROP TABLE adm_doctor_schedule;

CREATE TABLE adm_doctor_schedule (
    id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
    weekday VARCHAR(50) NULL,
    time_period VARCHAR(50) NULL,
    doctor VARCHAR(100) NULL,
    clinic VARCHAR(100) NULL,
    start_time TIME NULL,
    end_time TIME NULL,
    limit_number INTEGER NULL,
    call_sign_record VARCHAR(500) NOT NULL DEFAULT '',
    register_item VARCHAR(200) NULL,
    register_fee INTEGER NULL,
    diagnosis_item VARCHAR(200) NULL,
    diagnosis_fee INTEGER NULL,
    is_online BOOLEAN NULL,
    is_stopped BOOLEAN NULL,
    stop_reason VARCHAR(500) NULL,
    dept_id INTEGER NULL,
    create_time TIMESTAMPTZ(6) NULL,
    update_time TIMESTAMPTZ(6) NULL
);

COMMENT ON TABLE adm_doctor_schedule IS '医生排班表';

-- Column comments

COMMENT ON COLUMN adm_doctor_schedule.id IS '主键ID（GENERATED ALWAYS）';
COMMENT ON COLUMN adm_doctor_schedule.weekday IS '星期';
COMMENT ON COLUMN adm_doctor_schedule.time_period IS '时段（上午/下午）';
COMMENT ON COLUMN adm_doctor_schedule.doctor IS '医生姓名';
COMMENT ON COLUMN adm_doctor_schedule.clinic IS '诊室';
COMMENT ON COLUMN adm_doctor_schedule.start_time IS '开始时间';
COMMENT ON COLUMN adm_doctor_schedule.end_time IS '结束时间';
COMMENT ON COLUMN adm_doctor_schedule.limit_number IS '限号数量';
COMMENT ON COLUMN adm_doctor_schedule.call_sign_record IS '号源记录';
COMMENT ON COLUMN adm_doctor_schedule.register_item IS '挂号项目';
COMMENT ON COLUMN adm_doctor_schedule.register_fee IS '挂号费';
COMMENT ON COLUMN adm_doctor_schedule.diagnosis_item IS '诊查项目';
COMMENT ON COLUMN adm_doctor_schedule.diagnosis_fee IS '诊疗费';
COMMENT ON COLUMN adm_doctor_schedule.is_online IS '是否线上挂号';
COMMENT ON COLUMN adm_doctor_schedule.is_stopped IS '是否停诊';
COMMENT ON COLUMN adm_doctor_schedule.stop_reason IS '停诊原因';
COMMENT ON COLUMN adm_doctor_schedule.dept_id IS '关联科室ID';
COMMENT ON COLUMN adm_doctor_schedule.create_time IS '创建时间';
COMMENT ON COLUMN adm_doctor_schedule.update_time IS '更新时间';

-- 插入迁移记录
INSERT INTO __MigrationsHistory (MigrationId, ProductVersion)
VALUES ('202512251200 add_table adm_doctor_schedule', '1.0.0');


