ALTER TABLE public.cli_procedure RENAME COLUMN base_service_req_id TO request_id;
ALTER TABLE public.cli_procedure ALTER COLUMN request_id SET NOT NULL;
COMMENT ON COLUMN public.cli_procedure.request_id IS '医嘱id';
ALTER TABLE public.cli_procedure RENAME COLUMN base_med_req_id TO request_table;
ALTER TABLE public.cli_procedure ALTER COLUMN request_table TYPE varchar(255) USING request_table::varchar(255);
ALTER TABLE public.cli_procedure ALTER COLUMN request_table SET NOT NULL;
COMMENT ON COLUMN public.cli_procedure.request_table IS '医嘱所在表';
ALTER TABLE public.cli_procedure ADD encounter_id int8 NOT NULL;
COMMENT ON COLUMN public.cli_procedure.encounter_id IS '就诊id';
ALTER TABLE public.cli_procedure ADD org_id int8 NOT NULL;
COMMENT ON COLUMN public.cli_procedure.org_id IS '发放科室';

COMMENT ON TABLE public.cli_procedure IS '手术与医嘱管理';
COMMENT ON TABLE public.cli_procedure_performer IS '手术与医嘱执行人管理';



-- 向迁移历史表插入记录
INSERT INTO __MigrationsHistory (MigrationId, ProductVersion)
VALUES ('202508111427 cli_procedure', '1.0.0');