CREATE TABLE yb_inpatient_pre_settle (
	ID BIGSERIAL PRIMARY KEY,
	psn_no VARCHAR ( 50 ) NOT NULL,
	mdtrt_cert_type VARCHAR ( 20 ),
	mdtrt_cert_no VARCHAR ( 100 ),
	medfee_sumamt NUMERIC ( 20, 2 ),
	psn_setlway VARCHAR ( 20 ),
	mdtrt_id VARCHAR ( 50 ) NOT NULL,
	acct_used_flag CHAR ( 1 ),
	insutype VARCHAR ( 20 ),
	insuplc_admdvs VARCHAR ( 20 ),
	mdtrtarea_admvs VARCHAR ( 20 ),
	invono VARCHAR ( 50 ),
	mid_setl_flag CHAR ( 1 ),
	fulamt_ownpay_amt NUMERIC ( 20, 2 ),
	overlmt_selfpay NUMERIC ( 20, 2 ),
	preselfpay_amt NUMERIC ( 20, 2 ),
	inscp_scp_amt NUMERIC ( 20, 2 ),
	dscg_time DATE,
	psn_name VARCHAR ( 100 ),
	psn_cert_type VARCHAR ( 20 ),
	certno VARCHAR ( 50 ),
	gend CHAR ( 1 ),
	naty VARCHAR ( 20 ),
	brdy DATE,
	age NUMERIC ( 5, 1 ),
	psn_type VARCHAR ( 20 ),
	cvlserv_flag CHAR ( 1 ),
	setl_time TIMESTAMP,
	med_type VARCHAR ( 20 ),
	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 ),
	clr_optins VARCHAR ( 50 ),
	clr_way VARCHAR ( 20 ),
	clr_type VARCHAR ( 20 ),
	hifdm_pay NUMERIC ( 20, 2 ),
	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_pre_settle IS '住院预结算信息表';
-- 添加字段注释
COMMENT ON COLUMN yb_inpatient_pre_settle.ID IS '主键ID';
COMMENT ON COLUMN yb_inpatient_pre_settle.psn_no IS '人员编号';
COMMENT ON COLUMN yb_inpatient_pre_settle.mdtrt_cert_type IS '就诊凭证类型';
COMMENT ON COLUMN yb_inpatient_pre_settle.mdtrt_cert_no IS '就诊凭证编号';
COMMENT ON COLUMN yb_inpatient_pre_settle.medfee_sumamt IS '医疗费总额';
COMMENT ON COLUMN yb_inpatient_pre_settle.psn_setlway IS '个人结算方式';
COMMENT ON COLUMN yb_inpatient_pre_settle.mdtrt_id IS '就诊ID';
COMMENT ON COLUMN yb_inpatient_pre_settle.acct_used_flag IS '个人账户使用标志';
COMMENT ON COLUMN yb_inpatient_pre_settle.insutype IS '险种类型';
COMMENT ON COLUMN yb_inpatient_pre_settle.insuplc_admdvs IS '参保地医保区划';
COMMENT ON COLUMN yb_inpatient_pre_settle.mdtrtarea_admvs IS '就医地医保区划';
COMMENT ON COLUMN yb_inpatient_pre_settle.invono IS '发票号';
COMMENT ON COLUMN yb_inpatient_pre_settle.mid_setl_flag IS '中途结算标志';
COMMENT ON COLUMN yb_inpatient_pre_settle.fulamt_ownpay_amt IS '全自费金额';
COMMENT ON COLUMN yb_inpatient_pre_settle.overlmt_selfpay IS '超限价金额';
COMMENT ON COLUMN yb_inpatient_pre_settle.preselfpay_amt IS '先行自付金额';
COMMENT ON COLUMN yb_inpatient_pre_settle.inscp_scp_amt IS '符合政策范围金额';
COMMENT ON COLUMN yb_inpatient_pre_settle.dscg_time IS '出院时间（格式：yyyy-MM-dd）';
COMMENT ON COLUMN yb_inpatient_pre_settle.psn_name IS '人员姓名';
COMMENT ON COLUMN yb_inpatient_pre_settle.psn_cert_type IS '人员证件类型';
COMMENT ON COLUMN yb_inpatient_pre_settle.certno IS '证件号码';
COMMENT ON COLUMN yb_inpatient_pre_settle.gend IS '性别';
COMMENT ON COLUMN yb_inpatient_pre_settle.naty IS '民族';
COMMENT ON COLUMN yb_inpatient_pre_settle.brdy IS '出生日期（格式：yyyy-MM-dd）';
COMMENT ON COLUMN yb_inpatient_pre_settle.age IS '年龄';
COMMENT ON COLUMN yb_inpatient_pre_settle.psn_type IS '人员类别';
COMMENT ON COLUMN yb_inpatient_pre_settle.cvlserv_flag IS '公务员标志';
COMMENT ON COLUMN yb_inpatient_pre_settle.setl_time IS '结算时间（格式：yyyy-MM-dd HH:mm:ss）';
COMMENT ON COLUMN yb_inpatient_pre_settle.med_type IS '医疗类别';
COMMENT ON COLUMN yb_inpatient_pre_settle.act_pay_dedc IS '实际支付起付线';
COMMENT ON COLUMN yb_inpatient_pre_settle.hifp_pay IS '基本医疗保险统筹基金支出';
COMMENT ON COLUMN yb_inpatient_pre_settle.pool_prop_selfpay IS '基本医疗保险统筹基金支付比例';
COMMENT ON COLUMN yb_inpatient_pre_settle.cvlserv_pay IS '公务员医疗补助资金支出';
COMMENT ON COLUMN yb_inpatient_pre_settle.hifes_pay IS '企业补充医疗保险基金支出';
COMMENT ON COLUMN yb_inpatient_pre_settle.hifmi_pay IS '居民大病保险资金支出';
COMMENT ON COLUMN yb_inpatient_pre_settle.hifob_pay IS '职工大额医疗费用补助基金支出';
COMMENT ON COLUMN yb_inpatient_pre_settle.maf_pay IS '医疗救助基金支出';
COMMENT ON COLUMN yb_inpatient_pre_settle.oth_pay IS '其他支出';
COMMENT ON COLUMN yb_inpatient_pre_settle.fund_pay_sumamt IS '基金支付总额';
COMMENT ON COLUMN yb_inpatient_pre_settle.psn_part_amt IS '个人负担总金额';
COMMENT ON COLUMN yb_inpatient_pre_settle.acct_pay IS '个人账户支出';
COMMENT ON COLUMN yb_inpatient_pre_settle.psn_cash_pay IS '个人现金支出';
COMMENT ON COLUMN yb_inpatient_pre_settle.hosp_part_amt IS '医院负担金额';
COMMENT ON COLUMN yb_inpatient_pre_settle.balc IS '余额';
COMMENT ON COLUMN yb_inpatient_pre_settle.acct_mulaid_pay IS '个人账户共济支付金额';
COMMENT ON COLUMN yb_inpatient_pre_settle.medins_setl_id IS '医药机构结算ID（存放发送方报文ID）';
COMMENT ON COLUMN yb_inpatient_pre_settle.clr_optins IS '清算经办机构';
COMMENT ON COLUMN yb_inpatient_pre_settle.clr_way IS '清算方式';
COMMENT ON COLUMN yb_inpatient_pre_settle.clr_type IS '清算类别';
COMMENT ON COLUMN yb_inpatient_pre_settle.hifdm_pay IS '伤残人员医疗保障基金支出（1.5.4新增）';
COMMENT ON COLUMN yb_inpatient_pre_settle.input_param IS '输入参数';
COMMENT ON COLUMN yb_inpatient_pre_settle.output_result IS '输出结果';







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