 -- 创建序列
	CREATE SEQUENCE doc_request_form_id_seq
		START WITH 1
		INCREMENT BY 1
		NO MINVALUE
		NO MAXVALUE
		CACHE 1;


CREATE TABLE "doc_request_form" (
  "id" int8 NOT NULL DEFAULT nextval('doc_request_form_id_seq'::regclass),
  "prescription_no" varchar(50) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "name" varchar(200) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "encounter_id" int8 NOT NULL,
  "requester_id" int8 NOT NULL,
  "desc_json" text COLLATE "pg_catalog"."default",
  "tenant_id" int8 NOT NULL,
  "delete_flag" char(1) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 0,
  "create_by" varchar(32) COLLATE "pg_catalog"."default" NOT NULL DEFAULT ''::character varying,
  "create_time" timestamptz(6) NOT NULL,
  "update_by" varchar(32) COLLATE "pg_catalog"."default",
  "update_time" timestamptz(6),
  "type_code" varchar(255) COLLATE "pg_catalog"."default",
  CONSTRAINT "doc_request_form_pkey" PRIMARY KEY ("id")
)
;

ALTER TABLE "doc_request_form"
  OWNER TO "postgres";

COMMENT ON COLUMN "doc_request_form"."id" IS 'ID';

COMMENT ON COLUMN "doc_request_form"."prescription_no" IS '处方号';

COMMENT ON COLUMN "doc_request_form"."name" IS '名称';

COMMENT ON COLUMN "doc_request_form"."encounter_id" IS '就诊id';

COMMENT ON COLUMN "doc_request_form"."requester_id" IS '申请人';

COMMENT ON COLUMN "doc_request_form"."desc_json" IS '描述内容';

COMMENT ON COLUMN "doc_request_form"."tenant_id" IS '租户ID';

COMMENT ON COLUMN "doc_request_form"."delete_flag" IS '删除状态';

COMMENT ON COLUMN "doc_request_form"."create_by" IS '创建人';

COMMENT ON COLUMN "doc_request_form"."create_time" IS '创建时间';

COMMENT ON COLUMN "doc_request_form"."update_by" IS '更新人';

COMMENT ON COLUMN "doc_request_form"."update_time" IS '更新时间';

COMMENT ON COLUMN "doc_request_form"."type_code" IS '类型编码';

COMMENT ON TABLE "doc_request_form" IS '申请单管理表';




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