CREATE SEQUENCE wor_aut_supply_request_id_seq;

-- ----------------------------
-- Table structure for wor_aut_supply_request
-- ----------------------------
DROP TABLE IF EXISTS "wor_aut_supply_request";
CREATE TABLE "wor_aut_supply_request" (
  "id" int8 NOT NULL DEFAULT nextval('wor_aut_supply_request_id_seq'::regclass),
  "type_enum" int4 DEFAULT 1,
  "status_enum" int4 DEFAULT 0,
  "intent_enum" int4,
  "category_enum" int4,
  "priority_enum" int4 DEFAULT 0,
  "summary_id" int8,
  "deliver_id" int8,
  "patient_id" int8,
  "item_table" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "item_quantity" numeric(20,6),
  "item_id" int8,
  "unit_code" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "detail_json" varchar(20000) COLLATE "pg_catalog"."default" DEFAULT '{}'::character varying,
  "occurrence_time" timestamptz(6),
  "practitioner_id" int8,
  "supplier_id" int8,
  "reason" varchar(2000) COLLATE "pg_catalog"."default",
  "source_type_enum" int4 DEFAULT 0,
  "source_location_id" int8,
  "source_location_store_id" int8,
  "purpose_type_enum" int4 DEFAULT 0,
  "purpose_location_id" int8,
  "purpose_location_store_id" int8,
  "approver_id" int8,
  "approval_time" timestamptz(6),
  "applicant_id" int8,
  "apply_time" timestamptz(6),
  "tenant_id" int8,
  "delete_flag" char(1) COLLATE "pg_catalog"."default" 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),
  "lot_number" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "trace_no" varchar(50000) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "start_time" timestamptz(6),
  "end_time" timestamptz(6),
  "invoice_no" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "price" numeric(20,6),
  "total_price" numeric(20,6),
  "bus_no" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "remake" varchar(2000) COLLATE "pg_catalog"."default",
  "reason_code" varchar(255) COLLATE "pg_catalog"."default",
  "original_bus_no" varchar(255) COLLATE "pg_catalog"."default" DEFAULT ''::character varying,
  "total_quantity" numeric(20,6),
  "retail_price" numeric(20,6),
  "total_retail_price" numeric(20,6),
  "trace_no_unit_code" varchar(255) COLLATE "pg_catalog"."default",
  "packaging_condition_enum" int4,
  "acceptance_result_enum" int4,
  "batch_inventory" numeric(20,6),
  "specification_inventory" numeric(20,6)
)
;
COMMENT ON COLUMN "wor_aut_supply_request"."id" IS 'ID';
COMMENT ON COLUMN "wor_aut_supply_request"."type_enum" IS '类型';
COMMENT ON COLUMN "wor_aut_supply_request"."status_enum" IS '状态';
COMMENT ON COLUMN "wor_aut_supply_request"."intent_enum" IS '意图';
COMMENT ON COLUMN "wor_aut_supply_request"."category_enum" IS '分类';
COMMENT ON COLUMN "wor_aut_supply_request"."priority_enum" IS '优先权';
COMMENT ON COLUMN "wor_aut_supply_request"."summary_id" IS '汇总编号';
COMMENT ON COLUMN "wor_aut_supply_request"."deliver_id" IS '交付';
COMMENT ON COLUMN "wor_aut_supply_request"."patient_id" IS '患者id';
COMMENT ON COLUMN "wor_aut_supply_request"."item_table" IS '项目';
COMMENT ON COLUMN "wor_aut_supply_request"."item_quantity" IS '数量';
COMMENT ON COLUMN "wor_aut_supply_request"."item_id" IS '物品编码';
COMMENT ON COLUMN "wor_aut_supply_request"."unit_code" IS '物品计量单位';
COMMENT ON COLUMN "wor_aut_supply_request"."detail_json" IS '请求细节';
COMMENT ON COLUMN "wor_aut_supply_request"."occurrence_time" IS '期望时间';
COMMENT ON COLUMN "wor_aut_supply_request"."practitioner_id" IS '供应人';
COMMENT ON COLUMN "wor_aut_supply_request"."supplier_id" IS '供应商';
COMMENT ON COLUMN "wor_aut_supply_request"."reason" IS '理由';
COMMENT ON COLUMN "wor_aut_supply_request"."source_type_enum" IS '源仓库类型';
COMMENT ON COLUMN "wor_aut_supply_request"."source_location_id" IS '源仓库';
COMMENT ON COLUMN "wor_aut_supply_request"."source_location_store_id" IS '源仓位';
COMMENT ON COLUMN "wor_aut_supply_request"."purpose_type_enum" IS '目的类型';
COMMENT ON COLUMN "wor_aut_supply_request"."purpose_location_id" IS '目的仓库';
COMMENT ON COLUMN "wor_aut_supply_request"."purpose_location_store_id" IS '目的仓位';
COMMENT ON COLUMN "wor_aut_supply_request"."approver_id" IS '审批人';
COMMENT ON COLUMN "wor_aut_supply_request"."approval_time" IS '审批时间';
COMMENT ON COLUMN "wor_aut_supply_request"."applicant_id" IS '申请人';
COMMENT ON COLUMN "wor_aut_supply_request"."apply_time" IS '申请时间';
COMMENT ON COLUMN "wor_aut_supply_request"."tenant_id" IS '租户ID';
COMMENT ON COLUMN "wor_aut_supply_request"."delete_flag" IS '删除状态';
COMMENT ON COLUMN "wor_aut_supply_request"."create_by" IS '创建人';
COMMENT ON COLUMN "wor_aut_supply_request"."create_time" IS '创建时间';
COMMENT ON COLUMN "wor_aut_supply_request"."update_by" IS '更新人';
COMMENT ON COLUMN "wor_aut_supply_request"."update_time" IS '更新时间';
COMMENT ON COLUMN "wor_aut_supply_request"."lot_number" IS '产品批号';
COMMENT ON COLUMN "wor_aut_supply_request"."trace_no" IS '追溯码';
COMMENT ON COLUMN "wor_aut_supply_request"."start_time" IS '开始时间';
COMMENT ON COLUMN "wor_aut_supply_request"."end_time" IS '结束时间';
COMMENT ON COLUMN "wor_aut_supply_request"."invoice_no" IS '发票码';
COMMENT ON COLUMN "wor_aut_supply_request"."price" IS '单价';
COMMENT ON COLUMN "wor_aut_supply_request"."total_price" IS '总价';
COMMENT ON COLUMN "wor_aut_supply_request"."bus_no" IS '单据号';
COMMENT ON COLUMN "wor_aut_supply_request"."remake" IS '备注';
COMMENT ON COLUMN "wor_aut_supply_request"."reason_code" IS '理由种类';
COMMENT ON COLUMN "wor_aut_supply_request"."original_bus_no" IS '原始单据号';
COMMENT ON COLUMN "wor_aut_supply_request"."total_quantity" IS '盘点实盘数量';
COMMENT ON COLUMN "wor_aut_supply_request"."retail_price" IS '零售价';
COMMENT ON COLUMN "wor_aut_supply_request"."total_retail_price" IS '零售总价';
COMMENT ON COLUMN "wor_aut_supply_request"."trace_no_unit_code" IS '追溯码单位';
COMMENT ON COLUMN "wor_aut_supply_request"."packaging_condition_enum" IS '包装情况';
COMMENT ON COLUMN "wor_aut_supply_request"."acceptance_result_enum" IS '验收结果';
COMMENT ON COLUMN "wor_aut_supply_request"."batch_inventory" IS '批次库存';
COMMENT ON COLUMN "wor_aut_supply_request"."specification_inventory" IS '规格库存';
COMMENT ON TABLE "wor_aut_supply_request" IS '供应申请管理';

-- ----------------------------
-- Primary Key structure for table wor_aut_supply_request
-- ----------------------------
ALTER TABLE "wor_aut_supply_request" ADD CONSTRAINT "wor_aut_supply_request_pkey" PRIMARY KEY ("id");






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