-- adm_change_price_record definition

-- Drop table

-- DROP TABLE adm_change_price_record;

CREATE TABLE adm_change_price_record ( id bigserial NOT NULL, location_id int8 NULL, applicant_id int8 NULL, item_category_enum int4 NULL, item_id int8 NULL, origin_buying_price numeric(20, 6) NULL, origin_retail_price numeric(20, 6) NULL, approver_id int8 NULL, approval_time timestamptz(6) NULL, tenant_id int8 NULL, delete_flag bpchar(1) DEFAULT '0' NULL, create_by varchar(32) DEFAULT ''::character varying NOT NULL, create_time timestamptz(6) NOT NULL, update_by varchar NULL, update_time timestamptz(6) NULL, item_quantity numeric(20, 6) NULL, difference_retail_price numeric(20, 6) NULL, bus_no varchar(255) DEFAULT ''::character varying NULL, description varchar(255) NULL, applicant_time timestamptz NULL, item_table varchar(50) DEFAULT ''::character varying NULL, new_buying_price numeric(20, 6) NULL, new_retail_price numeric(20, 6) NULL, unit_code varchar(255) DEFAULT ''::character varying NULL, status_enum int4 DEFAULT 0 NULL, lot_number varchar(255) DEFAULT ''::character varying NULL, reason varchar(2000) NULL, difference_buying_price numeric(20, 6) NULL, CONSTRAINT adm_change_price_record_pkey PRIMARY KEY (id));
COMMENT ON TABLE adm_change_price_record IS '修改价格记录表';

-- Column comments

COMMENT ON COLUMN adm_change_price_record.id IS '本表id';
COMMENT ON COLUMN adm_change_price_record.location_id IS '批次号';
COMMENT ON COLUMN adm_change_price_record.applicant_id IS '改价申请人id';
COMMENT ON COLUMN adm_change_price_record.item_category_enum IS '目标枚举 药品、耗材、诊疗、挂号';
COMMENT ON COLUMN adm_change_price_record.item_id IS '药品ID、耗材ID、诊疗ID、挂号ID';
COMMENT ON COLUMN adm_change_price_record.origin_buying_price IS '原进货价';
COMMENT ON COLUMN adm_change_price_record.origin_retail_price IS '原新价格';
COMMENT ON COLUMN adm_change_price_record.approver_id IS '审批人ID';
COMMENT ON COLUMN adm_change_price_record.approval_time IS '审批时间';
COMMENT ON COLUMN adm_change_price_record.tenant_id IS '租户ID';
COMMENT ON COLUMN adm_change_price_record.delete_flag IS '删除标识 默认 0 未删除';
COMMENT ON COLUMN adm_change_price_record.item_quantity IS '当前品库存量';
COMMENT ON COLUMN adm_change_price_record.difference_retail_price IS '零售价盈负差';
COMMENT ON COLUMN adm_change_price_record.bus_no IS '当前业务批次号';
COMMENT ON COLUMN adm_change_price_record.description IS '改价原因';
COMMENT ON COLUMN adm_change_price_record.applicant_time IS '改价申请时间';
COMMENT ON COLUMN adm_change_price_record.item_table IS '业务表名药品、耗材、诊疗、挂号';
COMMENT ON COLUMN adm_change_price_record.new_buying_price IS '新进货价';
COMMENT ON COLUMN adm_change_price_record.new_retail_price IS '新零售价';
COMMENT ON COLUMN adm_change_price_record.unit_code IS '物品计量单位';
COMMENT ON COLUMN adm_change_price_record.status_enum IS '审批状态';
COMMENT ON COLUMN adm_change_price_record.lot_number IS '批次号';
COMMENT ON COLUMN adm_change_price_record.reason IS '条件理由';
COMMENT ON COLUMN adm_change_price_record.difference_buying_price IS '进货价盈负差';
   -- 插入为tmp_activity_device表添加列的迁移记录
INSERT INTO __MigrationsHistory (MigrationId, ProductVersion)
VALUES ('202511051215 add_table adm_change_price_record', '1.0.0');