CREATE TABLE yb_inpatient_info_recorde (
	ID BIGSERIAL PRIMARY KEY,
	mdtrt_id VARCHAR ( 50 ) NOT NULL,
	psn_no VARCHAR ( 50 ) NOT NULL,
	coner_name VARCHAR ( 100 ),
	tel VARCHAR ( 30 ),
	begntime TIMESTAMP,
	endtime TIMESTAMP,
	mdtrt_cert_type VARCHAR ( 20 ),
	med_type VARCHAR ( 20 ),
	ipt_otp_no VARCHAR ( 50 ),
	medrcdno VARCHAR ( 50 ),
	atddr_no VARCHAR ( 50 ),
	chfpdr_name VARCHAR ( 100 ),
	adm_diag_dscr TEXT,
	adm_dept_codg VARCHAR ( 50 ),
	adm_dept_name VARCHAR ( 100 ),
	adm_bed VARCHAR ( 20 ),
	dscg_maindiag_code VARCHAR ( 20 ),
	dscg_maindiag_name VARCHAR ( 200 ),
	main_cond_dscr TEXT,
	dise_codg VARCHAR ( 50 ),
	dise_name VARCHAR ( 200 ),
	oprn_oprt_code VARCHAR ( 50 ),
	oprn_oprt_name VARCHAR ( 200 ),
	fpsc_no VARCHAR ( 50 ),
	matn_type VARCHAR ( 20 ),
	birctrl_type VARCHAR ( 20 ),
	latechb_flag CHAR ( 1 ),
	esso_val INTEGER,
	fetts INTEGER,
	fetus_cnt INTEGER,
	pret_flag CHAR ( 1 ),
	birctrl_matn_date DATE,
	dise_type_code VARCHAR ( 20 ),
	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_info_recorde IS '住院信息更新记录表';
-- 添加字段注释
COMMENT ON COLUMN yb_inpatient_info_recorde.ID IS '主键ID';
COMMENT ON COLUMN yb_inpatient_info_recorde.mdtrt_id IS '就诊ID';
COMMENT ON COLUMN yb_inpatient_info_recorde.psn_no IS '人员编号';
COMMENT ON COLUMN yb_inpatient_info_recorde.coner_name IS '联系人姓名';
COMMENT ON COLUMN yb_inpatient_info_recorde.tel IS '联系电话';
COMMENT ON COLUMN yb_inpatient_info_recorde.begntime IS '开始时间（格式：yyyy-MM-dd HH:mm:ss）';
COMMENT ON COLUMN yb_inpatient_info_recorde.endtime IS '结束时间（格式：yyyy-MM-dd HH:mm:ss）';
COMMENT ON COLUMN yb_inpatient_info_recorde.mdtrt_cert_type IS '就诊凭证类型';
COMMENT ON COLUMN yb_inpatient_info_recorde.med_type IS '医疗类别';
COMMENT ON COLUMN yb_inpatient_info_recorde.ipt_otp_no IS '住院/门诊号';
COMMENT ON COLUMN yb_inpatient_info_recorde.medrcdno IS '病历号';
COMMENT ON COLUMN yb_inpatient_info_recorde.atddr_no IS '主治医生编码';
COMMENT ON COLUMN yb_inpatient_info_recorde.chfpdr_name IS '主诊医师姓名';
COMMENT ON COLUMN yb_inpatient_info_recorde.adm_diag_dscr IS '入院诊断描述';
COMMENT ON COLUMN yb_inpatient_info_recorde.adm_dept_codg IS '入院科室编码';
COMMENT ON COLUMN yb_inpatient_info_recorde.adm_dept_name IS '入院科室名称';
COMMENT ON COLUMN yb_inpatient_info_recorde.adm_bed IS '入院床位';
COMMENT ON COLUMN yb_inpatient_info_recorde.dscg_maindiag_code IS '住院主诊断代码';
COMMENT ON COLUMN yb_inpatient_info_recorde.dscg_maindiag_name IS '住院主诊断名称';
COMMENT ON COLUMN yb_inpatient_info_recorde.main_cond_dscr IS '主要病情描述';
COMMENT ON COLUMN yb_inpatient_info_recorde.dise_codg IS '病种编码';
COMMENT ON COLUMN yb_inpatient_info_recorde.dise_name IS '病种名称';
COMMENT ON COLUMN yb_inpatient_info_recorde.oprn_oprt_code IS '手术操作代码';
COMMENT ON COLUMN yb_inpatient_info_recorde.oprn_oprt_name IS '手术操作名称';
COMMENT ON COLUMN yb_inpatient_info_recorde.fpsc_no IS '计划生育服务证号';
COMMENT ON COLUMN yb_inpatient_info_recorde.matn_type IS '生育类别';
COMMENT ON COLUMN yb_inpatient_info_recorde.birctrl_type IS '计划生育手术类别';
COMMENT ON COLUMN yb_inpatient_info_recorde.latechb_flag IS '晚育标志';
COMMENT ON COLUMN yb_inpatient_info_recorde.esso_val IS '孕周数';
COMMENT ON COLUMN yb_inpatient_info_recorde.fetts IS '胎次';
COMMENT ON COLUMN yb_inpatient_info_recorde.fetus_cnt IS '胎儿数';
COMMENT ON COLUMN yb_inpatient_info_recorde.pret_flag IS '早产标志';
COMMENT ON COLUMN yb_inpatient_info_recorde.birctrl_matn_date IS '计划生育手术或生育日期（格式：yyyy-MM-dd）';
COMMENT ON COLUMN yb_inpatient_info_recorde.dise_type_code IS '病种编号';
COMMENT ON COLUMN yb_inpatient_info_recorde.input_param IS '输入参数';
COMMENT ON COLUMN yb_inpatient_info_recorde.output_result IS '输出结果';


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