CREATE TABLE yb_inpatient_un_settle (
	ID BIGSERIAL PRIMARY KEY,
	mdtrt_id VARCHAR ( 50 ) NOT NULL,
	setl_id VARCHAR ( 50 ) NOT NULL,
	psn_no VARCHAR ( 50 ) NOT NULL,
	clr_optins VARCHAR ( 50 ),
	setl_time TIMESTAMP,
	medfee_sumamt NUMERIC ( 20, 2 ),
	fulamt_ownpay_amt NUMERIC ( 20, 2 ),
	overlmt_selfpay NUMERIC ( 20, 2 ),
	preselfpay_amt NUMERIC ( 20, 2 ),
	inscp_scp_amt NUMERIC ( 20, 2 ),
	act_pay_dedc NUMERIC ( 20, 2 ),
	hifp_pay NUMERIC ( 20, 2 ),
	pool_prop_selfpay NUMERIC ( 5, 4 ),
	cvlserv_pay NUMERIC ( 20, 2 ),
	hifes_pay NUMERIC ( 20, 2 ),
	hifmi_pay NUMERIC ( 20, 2 ),
	hifob_pay NUMERIC ( 20, 2 ),
	maf_pay NUMERIC ( 20, 2 ),
	oth_pay NUMERIC ( 20, 2 ),
	fund_pay_sumamt NUMERIC ( 20, 2 ),
	psn_part_amt NUMERIC ( 20, 2 ),
	acct_pay NUMERIC ( 20, 2 ),
	psn_cash_pay NUMERIC ( 20, 2 ),
	hosp_part_amt NUMERIC ( 20, 2 ),
	balc NUMERIC ( 20, 2 ),
	acct_mulaid_pay NUMERIC ( 20, 2 ),
	medins_setl_id VARCHAR ( 50 ),
	hifdm_pay NUMERIC ( 20, 2 ),
	psn_insu_rlts_id VARCHAR ( 50 ),
	insu_admdvs VARCHAR ( 20 ),
	begndate DATE,
	enddate DATE,
	mdtrt_cert_no VARCHAR ( 100 ),
	setl_type VARCHAR ( 20 ),
	crt_dedc NUMERIC ( 20, 2 ),
	invono VARCHAR ( 50 ),
	input_param TEXT,
	output_result TEXT,
	"tenant_id" INT8 NOT NULL,
	"delete_flag" CHAR ( 1 ) COLLATE "pg_catalog"."default" NOT NULL DEFAULT 0,
	"create_by" VARCHAR COLLATE "pg_catalog"."default" NOT NULL DEFAULT '' :: CHARACTER VARYING,
	"create_time" TIMESTAMPTZ ( 6 ) NOT NULL,
	"update_by" VARCHAR COLLATE "pg_catalog"."default",
	"update_time" TIMESTAMPTZ ( 6 ) 
);
COMMENT ON TABLE yb_inpatient_un_settle IS '住院未结算信息表';
-- 添加字段注释
COMMENT ON COLUMN yb_inpatient_un_settle.ID IS '主键ID';
COMMENT ON COLUMN yb_inpatient_un_settle.mdtrt_id IS '就诊ID';
COMMENT ON COLUMN yb_inpatient_un_settle.setl_id IS '结算ID';
COMMENT ON COLUMN yb_inpatient_un_settle.psn_no IS '人员编号';
COMMENT ON COLUMN yb_inpatient_un_settle.clr_optins IS '清算经办机构';
COMMENT ON COLUMN yb_inpatient_un_settle.setl_time IS '结算时间（格式：yyyy-MM-dd HH:mm:ss）';
COMMENT ON COLUMN yb_inpatient_un_settle.medfee_sumamt IS '医疗费总额';
COMMENT ON COLUMN yb_inpatient_un_settle.fulamt_ownpay_amt IS '全自费金额';
COMMENT ON COLUMN yb_inpatient_un_settle.overlmt_selfpay IS '超限价自费费用';
COMMENT ON COLUMN yb_inpatient_un_settle.preselfpay_amt IS '先行自付金额';
COMMENT ON COLUMN yb_inpatient_un_settle.inscp_scp_amt IS '符合政策范围金额';
COMMENT ON COLUMN yb_inpatient_un_settle.act_pay_dedc IS '实际支付起付线';
COMMENT ON COLUMN yb_inpatient_un_settle.hifp_pay IS '基本医疗保险统筹基金支出';
COMMENT ON COLUMN yb_inpatient_un_settle.pool_prop_selfpay IS '基本医疗保险统筹基金支付比例';
COMMENT ON COLUMN yb_inpatient_un_settle.cvlserv_pay IS '公务员医疗补助资金支出';
COMMENT ON COLUMN yb_inpatient_un_settle.hifes_pay IS '企业补充医疗保险基金支出';
COMMENT ON COLUMN yb_inpatient_un_settle.hifmi_pay IS '居民大病保险资金支出';
COMMENT ON COLUMN yb_inpatient_un_settle.hifob_pay IS '职工大额医疗费用补助基金支出';
COMMENT ON COLUMN yb_inpatient_un_settle.maf_pay IS '医疗救助基金支出';
COMMENT ON COLUMN yb_inpatient_un_settle.oth_pay IS '其他支出';
COMMENT ON COLUMN yb_inpatient_un_settle.fund_pay_sumamt IS '基金支付总额';
COMMENT ON COLUMN yb_inpatient_un_settle.psn_part_amt IS '个人负担总金额';
COMMENT ON COLUMN yb_inpatient_un_settle.acct_pay IS '个人账户支出';
COMMENT ON COLUMN yb_inpatient_un_settle.psn_cash_pay IS '个人现金支出';
COMMENT ON COLUMN yb_inpatient_un_settle.hosp_part_amt IS '医院负担金额';
COMMENT ON COLUMN yb_inpatient_un_settle.balc IS '余额';
COMMENT ON COLUMN yb_inpatient_un_settle.acct_mulaid_pay IS '个人账户共济支付金额';
COMMENT ON COLUMN yb_inpatient_un_settle.medins_setl_id IS '医药机构结算ID（存放发送方报文ID）';
COMMENT ON COLUMN yb_inpatient_un_settle.hifdm_pay IS '伤残人员医疗保障基金支出';
COMMENT ON COLUMN yb_inpatient_un_settle.psn_insu_rlts_id IS '人员参保关系ID';
COMMENT ON COLUMN yb_inpatient_un_settle.insu_admdvs IS '参保机构行政区划';
COMMENT ON COLUMN yb_inpatient_un_settle.begndate IS '开始日期';
COMMENT ON COLUMN yb_inpatient_un_settle.enddate IS '结算日期';
COMMENT ON COLUMN yb_inpatient_un_settle.mdtrt_cert_no IS '就诊凭证编号';
COMMENT ON COLUMN yb_inpatient_un_settle.setl_type IS '结算类别';
COMMENT ON COLUMN yb_inpatient_un_settle.crt_dedc IS '本次起付线';
COMMENT ON COLUMN yb_inpatient_un_settle.invono IS '发票号';
COMMENT ON COLUMN yb_inpatient_un_settle.input_param IS '输入参数';
COMMENT ON COLUMN yb_inpatient_un_settle.output_result IS '输出结果';







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