DROP TABLE IF EXISTS "fin_payment_rec_static";

CREATE TABLE fin_payment_rec_static (
    id serial8 PRIMARY KEY,
    reconciliation_id bigint,
    count_by integer DEFAULT 2,
    type_code varchar(32),
    type_name varchar(32),
    amount decimal,
    charge_item_ids varchar,
    tenant_id bigint,
    delete_flag char(1) DEFAULT '0',
    create_by varchar(32),
    create_time timestamptz,
    update_by varchar(32),
    update_time timestamptz
);

-- 注释信息
COMMENT ON TABLE fin_payment_rec_static IS '付款记录统计表';
COMMENT ON COLUMN fin_payment_rec_static.id IS 'ID';
COMMENT ON COLUMN fin_payment_rec_static.reconciliation_id IS '付款id';
COMMENT ON COLUMN fin_payment_rec_static.count_by IS '统计方式：1-字典fin_type_code；2-医保十四项med_chrgitm_type';
COMMENT ON COLUMN fin_payment_rec_static.type_code IS '编码（字典码）：1时用财富分类字典，2时用医保分类的字典';
COMMENT ON COLUMN fin_payment_rec_static.type_name IS '编码名称（字典名称）';
COMMENT ON COLUMN fin_payment_rec_static.amount IS '金额';
COMMENT ON COLUMN fin_payment_rec_static.charge_item_ids IS '关联收费项Id';
COMMENT ON COLUMN fin_payment_rec_static.tenant_id IS '租户ID';
COMMENT ON COLUMN fin_payment_rec_static.delete_flag IS '删除状态';
COMMENT ON COLUMN fin_payment_rec_static.create_by IS '创建人';
COMMENT ON COLUMN fin_payment_rec_static.create_time IS '创建时间';
COMMENT ON COLUMN fin_payment_rec_static.update_by IS '更新人';
COMMENT ON COLUMN fin_payment_rec_static.update_time IS '更新时间';



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