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


CREATE TABLE "tmp_orders_group_package_detail" (
  "id" int8 NOT NULL DEFAULT nextval('tmp_orders_group_package_detail_id_seq'::regclass),
  "group_package_id" int8 NOT NULL,
  "order_definition_id" int8 NOT NULL,
  "order_definition_table" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "quantity" numeric(20, 6) DEFAULT 1,
  "unit_code" varchar(255) 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 "tmp_orders_group_package_detail_pkey" PRIMARY KEY ("id")
)
;

ALTER TABLE "tmp_orders_group_package_detail" 
  OWNER TO "postgres";

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

COMMENT ON COLUMN "tmp_orders_group_package_detail"."group_package_id" IS '组合套餐id';

COMMENT ON COLUMN "tmp_orders_group_package_detail"."order_definition_id" IS '医嘱定义id';

COMMENT ON COLUMN "tmp_orders_group_package_detail"."order_definition_table" IS '医嘱定义表名';

COMMENT ON COLUMN "tmp_orders_group_package_detail"."quantity" IS '数量';

COMMENT ON COLUMN "tmp_orders_group_package_detail"."unit_code" IS '单位编码';

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

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

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

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

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

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

COMMENT ON TABLE "tmp_orders_group_package_detail" IS '医嘱组合套餐明细';	

-- 插入添加临时订单分组包详情表的迁移记录
INSERT INTO __MigrationsHistory (MigrationId, ProductVersion)
VALUES ('202509081022add_table_tmp_orders_group_package_detail', '1.0.0');
