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


CREATE TABLE "public"."doc_order_process" (
  "id" int8 NOT NULL DEFAULT nextval('doc_order_process_id_seq'::regclass),
  "name" varchar(100) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "encounter_id" int8 NOT NULL,
  "request_id" int8 NOT NULL,
  "request_table_name" varchar(100) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "original_organization_id" int8 DEFAULT NULL,
  "target_organization_id" int8 DEFAULT NULL,
  "original_location_id" int8 DEFAULT NULL,
  "target_location_id" int8 DEFAULT NULL,
  "out_way_code" varchar(100) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "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),
  CONSTRAINT "doc_order_process_pkey" PRIMARY KEY ("id")
)
;

ALTER TABLE "public"."doc_order_process" 
  OWNER TO "postgres";

COMMENT ON COLUMN "public"."doc_order_process"."id" IS 'ID';

COMMENT ON COLUMN "public"."doc_order_process"."name" IS '名称';

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

COMMENT ON COLUMN "public"."doc_order_process"."request_id" IS '请求id';

COMMENT ON COLUMN "public"."doc_order_process"."request_table_name" IS '请求表名';

COMMENT ON COLUMN "public"."doc_order_process"."original_organization_id" IS '原科室';

COMMENT ON COLUMN "public"."doc_order_process"."target_organization_id" IS '目标科室';

COMMENT ON COLUMN "public"."doc_order_process"."original_location_id" IS '原病区';

COMMENT ON COLUMN "public"."doc_order_process"."target_location_id" IS '目标病区';

COMMENT ON COLUMN "public"."doc_order_process"."out_way_code" IS '出院方式';

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

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

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

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

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

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

COMMENT ON TABLE "public"."doc_order_process" IS '医嘱过程表';	



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