DROP TABLE IF EXISTS czdrg_vstupni_veta;

CREATE TABLE czdrg_vstupni_veta(
	id_poj varchar(20) NULL,
	id_pripadu varchar(15) NULL,
	id_zp int2 NULL,
	idzz bpchar(8) NULL,
	odb_pri bpchar(3) NOT NULL,
	odb_pro bpchar(3) NULL,
	datum_pri date NOT NULL,
	datum_pro date NOT NULL,
	los int2 NOT NULL,
	veklet int2 NOT NULL,
	vekden int2 NULL,
	pohlavi int2 NOT NULL,
	hmotnost int2 NULL,
	gest_vek int2 NULL,
	prijeti bpchar(1) NULL,
	dru_pri bpchar(1) NULL,
	duv_pri bpchar(1) NULL,
	ukonceni bpchar(1) NOT NULL,
	dg_hlavni varchar(5) NOT NULL,
	dg_vedlejsi1 varchar(5) NULL,
	dg_vedlejsi_typ1 bpchar(1) NULL,
	dg_vedlejsi2 varchar(5) NULL,
	dg_vedlejsi_typ2 bpchar(1) NULL,
	dg_vedlejsi3 varchar(5) NULL,
	dg_vedlejsi_typ3 bpchar(1) NULL,
	dg_vedlejsi4 varchar(5) NULL,
	dg_vedlejsi_typ4 bpchar(1) NULL,
	dg_vedlejsi5 varchar(5) NULL,
	dg_vedlejsi_typ5 bpchar(1) NULL,
	dg_vedlejsi6 varchar(5) NULL,
	dg_vedlejsi_typ6 bpchar(1) NULL,
	dg_vedlejsi7 varchar(5) NULL,
	dg_vedlejsi_typ7 bpchar(1) NULL,
	dg_vedlejsi8 varchar(5) NULL,
	dg_vedlejsi_typ8 bpchar(1) NULL,
	dg_vedlejsi9 varchar(5) NULL,
	dg_vedlejsi_typ9 bpchar(1) NULL,
	dg_vedlejsi10 varchar(5) NULL,
	dg_vedlejsi_typ10 bpchar(1) NULL,
	dg_vedlejsi11 varchar(5) NULL,
	dg_vedlejsi_typ11 bpchar(1) NULL,
	dg_vedlejsi12 varchar(5) NULL,
	dg_vedlejsi_typ12 bpchar(1) NULL,
	dg_vedlejsi13 varchar(5) NULL,
	dg_vedlejsi_typ13 bpchar(1) NULL,
	dg_vedlejsi14 varchar(5) NULL,
	dg_vedlejsi_typ14 bpchar(1) NULL,
	dg_vedlejsi15 varchar(5) NULL,
	dg_vedlejsi_typ15 bpchar(1) NULL,
	dg_vedlejsi16 varchar(5) NULL,
	dg_vedlejsi_typ16 bpchar(1) NULL,
	dg_vedlejsi17 varchar(5) NULL,
	dg_vedlejsi_typ17 bpchar(1) NULL,
	dg_vedlejsi18 varchar(5) NULL,
	dg_vedlejsi_typ18 bpchar(1) NULL,
	dg_vedlejsi19 varchar(5) NULL,
	dg_vedlejsi_typ19 bpchar(1) NULL,
	dg_vedlejsi20 varchar(5) NULL,
	dg_vedlejsi_typ20 bpchar(1) NULL,
	dg_vedlejsi21 varchar(5) NULL,
	dg_vedlejsi_typ21 bpchar(1) NULL,
	dg_vedlejsi22 varchar(5) NULL,
	dg_vedlejsi_typ22 bpchar(1) NULL,
	dg_vedlejsi23 varchar(5) NULL,
	dg_vedlejsi_typ23 bpchar(1) NULL,
	dg_vedlejsi24 varchar(5) NULL,
	dg_vedlejsi_typ24 bpchar(1) NULL,
	dg_vedlejsi25 varchar(5) NULL,
	dg_vedlejsi_typ25 bpchar(1) NULL,
	dg_vedlejsi26 varchar(5) NULL,
	dg_vedlejsi_typ26 bpchar(1) NULL,
	dg_vedlejsi27 varchar(5) NULL,
	dg_vedlejsi_typ27 bpchar(1) NULL,
	dg_vedlejsi28 varchar(5) NULL,
	dg_vedlejsi_typ28 bpchar(1) NULL,
	dg_vedlejsi29 varchar(5) NULL,
	dg_vedlejsi_typ29 bpchar(1) NULL,
	dg_vedlejsi30 varchar(5) NULL,
	dg_vedlejsi_typ30 bpchar(1) NULL,
	krit_vyk1 bpchar(5) NULL,
	krit_vyk_poc1 int2 NULL,
	krit_vyk2 bpchar(5) NULL,
	krit_vyk_poc2 int2 NULL,
	krit_vyk3 bpchar(5) NULL,
	krit_vyk_poc3 int2 NULL,
	krit_vyk4 bpchar(5) NULL,
	krit_vyk_poc4 int2 NULL,
	krit_vyk5 bpchar(5) NULL,
	krit_vyk_poc5 int2 NULL,
	krit_vyk6 bpchar(5) NULL,
	krit_vyk_poc6 int2 NULL,
	krit_vyk7 bpchar(5) NULL,
	krit_vyk_poc7 int2 NULL,
	krit_vyk8 bpchar(5) NULL,
	krit_vyk_poc8 int2 NULL,
	krit_vyk9 bpchar(5) NULL,
	krit_vyk_poc9 int2 NULL,
	krit_vyk10 bpchar(5) NULL,
	krit_vyk_poc10 int2 NULL,
	krit_vyk11 bpchar(5) NULL,
	krit_vyk_poc11 int2 NULL,
	krit_vyk12 bpchar(5) NULL,
	krit_vyk_poc12 int2 NULL,
	krit_vyk13 bpchar(5) NULL,
	krit_vyk_poc13 int2 NULL,
	krit_vyk14 bpchar(5) NULL,
	krit_vyk_poc14 int2 NULL,
	krit_vyk15 bpchar(5) NULL,
	krit_vyk_poc15 int2 NULL,
	krit_vyk16 bpchar(5) NULL,
	krit_vyk_poc16 int2 NULL,
	krit_vyk17 bpchar(5) NULL,
	krit_vyk_poc17 int2 NULL,
	krit_vyk18 bpchar(5) NULL,
	krit_vyk_poc18 int2 NULL,
	krit_vyk19 bpchar(5) NULL,
	krit_vyk_poc19 int2 NULL,
	krit_vyk20 bpchar(5) NULL,
	krit_vyk_poc20 int2 NULL,
	krit_vyk21 bpchar(5) NULL,
	krit_vyk_poc21 int2 NULL,
	krit_vyk22 bpchar(5) NULL,
	krit_vyk_poc22 int2 NULL,
	krit_vyk23 bpchar(5) NULL,
	krit_vyk_poc23 int2 NULL,
	krit_vyk24 bpchar(5) NULL,
	krit_vyk_poc24 int2 NULL,
	krit_vyk25 bpchar(5) NULL,
	krit_vyk_poc25 int2 NULL,
	upv int4 NULL,
	zup1 bpchar(8) NULL,
	zup_mno1 numeric(5,2) NULL,
	zup2 bpchar(8) NULL,
	zup_mno2 numeric(5,2) NULL,
	zup3 bpchar(8) NULL,
	zup_mno3 numeric(5,2) NULL,
	zup4 bpchar(8) NULL,
	zup_mno4 numeric(5,2) NULL,
	zup5 bpchar(8) NULL,
	zup_mno5 numeric(5,2) NULL,
	zup6 bpchar(8) NULL,
	zup_mno6 numeric(5,2) NULL,
	zup7 bpchar(8) NULL,
	zup_mno7 numeric(5,2) NULL,
	zup8 bpchar(8) NULL,
	zup_mno8 numeric(5,2) NULL,
	zup9 bpchar(8) NULL,
	zup_mno9 numeric(5,2) NULL,
	zup10 bpchar(8) NULL,
	zup_mno10 numeric(5,2) NULL,
	zup11 bpchar(8) NULL,
	zup_mno11 numeric(5,2) NULL,
	zup12 bpchar(8) NULL,
	zup_mno12 numeric(5,2) NULL,
	zup13 bpchar(8) NULL,
	zup_mno13 numeric(5,2) NULL,
	zup14 bpchar(8) NULL,
	zup_mno14 numeric(5,2) NULL,
	zup15 bpchar(8) NULL,
	zup_mno15 numeric(5,2) NULL,
	oz_dny int2 NULL,
	rhb_dny int2 NULL,
	ps_dny int2 NULL,
	krn_dny int2 NULL,
	pop_dny int2 NULL,
	dia_dny int2 NULL,
	hru_dny int2 NULL,
	bri_dny int2 NULL,
	zlu_dny int2 NULL,
	hrd_dny int2 NULL,
	oko_dny int2 NULL,
	srd_dny int2 NULL,
	cev_dny int2 NULL,
	hdl_dny int2 NULL,
	rezerva varchar(10) NULL,
	verze_p varchar(10) NOT NULL,
	chyba_p int2 NULL,
	kp1 int2 NULL,
	kp2 int2 NULL,
	kp3 int2 NULL,
	kp4 int2 NULL,
	kp5 int2 NULL,
	kp6 numeric(5,2) NULL,
	kp7 numeric(5,2) NULL,
	kp8 numeric(5,2) NULL,
	kp9 numeric(5,2) NULL,
	kp10 numeric(5,2) NULL,
	run_id bigint
) ;

DROP TABLE IF EXISTS czdrg_vystupni_veta;

CREATE TABLE czdrg_vystupni_veta(
	id_poj varchar(20) NULL,
	id_pripadu varchar(15) NULL,
	id_zp int2 NULL,
	idzz bpchar(8) NULL,
	odb_pri bpchar(3) NOT NULL,
	odb_pro bpchar(3) NULL,
	datum_pri date NOT NULL,
	datum_pro date NOT NULL,
	los int2 NOT NULL,
	veklet int2 NOT NULL,
	vekden int2 NULL,
	pohlavi int2 NOT NULL,
	hmotnost int2 NULL,
	gest_vek int2 NULL,
	prijeti bpchar(1) NULL,
	dru_pri bpchar(1) NULL,
	duv_pri bpchar(1) NULL,
	ukonceni bpchar(1) NOT NULL,
	dg_hlavni varchar(5) NOT NULL,
	dg_vedlejsi1 varchar(5) NULL,
	dg_vedlejsi_typ1 bpchar(1) NULL,
	dg_vedlejsi2 varchar(5) NULL,
	dg_vedlejsi_typ2 bpchar(1) NULL,
	dg_vedlejsi3 varchar(5) NULL,
	dg_vedlejsi_typ3 bpchar(1) NULL,
	dg_vedlejsi4 varchar(5) NULL,
	dg_vedlejsi_typ4 bpchar(1) NULL,
	dg_vedlejsi5 varchar(5) NULL,
	dg_vedlejsi_typ5 bpchar(1) NULL,
	dg_vedlejsi6 varchar(5) NULL,
	dg_vedlejsi_typ6 bpchar(1) NULL,
	dg_vedlejsi7 varchar(5) NULL,
	dg_vedlejsi_typ7 bpchar(1) NULL,
	dg_vedlejsi8 varchar(5) NULL,
	dg_vedlejsi_typ8 bpchar(1) NULL,
	dg_vedlejsi9 varchar(5) NULL,
	dg_vedlejsi_typ9 bpchar(1) NULL,
	dg_vedlejsi10 varchar(5) NULL,
	dg_vedlejsi_typ10 bpchar(1) NULL,
	dg_vedlejsi11 varchar(5) NULL,
	dg_vedlejsi_typ11 bpchar(1) NULL,
	dg_vedlejsi12 varchar(5) NULL,
	dg_vedlejsi_typ12 bpchar(1) NULL,
	dg_vedlejsi13 varchar(5) NULL,
	dg_vedlejsi_typ13 bpchar(1) NULL,
	dg_vedlejsi14 varchar(5) NULL,
	dg_vedlejsi_typ14 bpchar(1) NULL,
	dg_vedlejsi15 varchar(5) NULL,
	dg_vedlejsi_typ15 bpchar(1) NULL,
	dg_vedlejsi16 varchar(5) NULL,
	dg_vedlejsi_typ16 bpchar(1) NULL,
	dg_vedlejsi17 varchar(5) NULL,
	dg_vedlejsi_typ17 bpchar(1) NULL,
	dg_vedlejsi18 varchar(5) NULL,
	dg_vedlejsi_typ18 bpchar(1) NULL,
	dg_vedlejsi19 varchar(5) NULL,
	dg_vedlejsi_typ19 bpchar(1) NULL,
	dg_vedlejsi20 varchar(5) NULL,
	dg_vedlejsi_typ20 bpchar(1) NULL,
	dg_vedlejsi21 varchar(5) NULL,
	dg_vedlejsi_typ21 bpchar(1) NULL,
	dg_vedlejsi22 varchar(5) NULL,
	dg_vedlejsi_typ22 bpchar(1) NULL,
	dg_vedlejsi23 varchar(5) NULL,
	dg_vedlejsi_typ23 bpchar(1) NULL,
	dg_vedlejsi24 varchar(5) NULL,
	dg_vedlejsi_typ24 bpchar(1) NULL,
	dg_vedlejsi25 varchar(5) NULL,
	dg_vedlejsi_typ25 bpchar(1) NULL,
	dg_vedlejsi26 varchar(5) NULL,
	dg_vedlejsi_typ26 bpchar(1) NULL,
	dg_vedlejsi27 varchar(5) NULL,
	dg_vedlejsi_typ27 bpchar(1) NULL,
	dg_vedlejsi28 varchar(5) NULL,
	dg_vedlejsi_typ28 bpchar(1) NULL,
	dg_vedlejsi29 varchar(5) NULL,
	dg_vedlejsi_typ29 bpchar(1) NULL,
	dg_vedlejsi30 varchar(5) NULL,
	dg_vedlejsi_typ30 bpchar(1) NULL,
	krit_vyk1 bpchar(5) NULL,
	krit_vyk_poc1 int2 NULL,
	krit_vyk2 bpchar(5) NULL,
	krit_vyk_poc2 int2 NULL,
	krit_vyk3 bpchar(5) NULL,
	krit_vyk_poc3 int2 NULL,
	krit_vyk4 bpchar(5) NULL,
	krit_vyk_poc4 int2 NULL,
	krit_vyk5 bpchar(5) NULL,
	krit_vyk_poc5 int2 NULL,
	krit_vyk6 bpchar(5) NULL,
	krit_vyk_poc6 int2 NULL,
	krit_vyk7 bpchar(5) NULL,
	krit_vyk_poc7 int2 NULL,
	krit_vyk8 bpchar(5) NULL,
	krit_vyk_poc8 int2 NULL,
	krit_vyk9 bpchar(5) NULL,
	krit_vyk_poc9 int2 NULL,
	krit_vyk10 bpchar(5) NULL,
	krit_vyk_poc10 int2 NULL,
	krit_vyk11 bpchar(5) NULL,
	krit_vyk_poc11 int2 NULL,
	krit_vyk12 bpchar(5) NULL,
	krit_vyk_poc12 int2 NULL,
	krit_vyk13 bpchar(5) NULL,
	krit_vyk_poc13 int2 NULL,
	krit_vyk14 bpchar(5) NULL,
	krit_vyk_poc14 int2 NULL,
	krit_vyk15 bpchar(5) NULL,
	krit_vyk_poc15 int2 NULL,
	krit_vyk16 bpchar(5) NULL,
	krit_vyk_poc16 int2 NULL,
	krit_vyk17 bpchar(5) NULL,
	krit_vyk_poc17 int2 NULL,
	krit_vyk18 bpchar(5) NULL,
	krit_vyk_poc18 int2 NULL,
	krit_vyk19 bpchar(5) NULL,
	krit_vyk_poc19 int2 NULL,
	krit_vyk20 bpchar(5) NULL,
	krit_vyk_poc20 int2 NULL,
	krit_vyk21 bpchar(5) NULL,
	krit_vyk_poc21 int2 NULL,
	krit_vyk22 bpchar(5) NULL,
	krit_vyk_poc22 int2 NULL,
	krit_vyk23 bpchar(5) NULL,
	krit_vyk_poc23 int2 NULL,
	krit_vyk24 bpchar(5) NULL,
	krit_vyk_poc24 int2 NULL,
	krit_vyk25 bpchar(5) NULL,
	krit_vyk_poc25 int2 NULL,
	upv int4 NULL,
	zup1 bpchar(8) NULL,
	zup_mno1 numeric(5,2) NULL,
	zup2 bpchar(8) NULL,
	zup_mno2 numeric(5,2) NULL,
	zup3 bpchar(8) NULL,
	zup_mno3 numeric(5,2) NULL,
	zup4 bpchar(8) NULL,
	zup_mno4 numeric(5,2) NULL,
	zup5 bpchar(8) NULL,
	zup_mno5 numeric(5,2) NULL,
	zup6 bpchar(8) NULL,
	zup_mno6 numeric(5,2) NULL,
	zup7 bpchar(8) NULL,
	zup_mno7 numeric(5,2) NULL,
	zup8 bpchar(8) NULL,
	zup_mno8 numeric(5,2) NULL,
	zup9 bpchar(8) NULL,
	zup_mno9 numeric(5,2) NULL,
	zup10 bpchar(8) NULL,
	zup_mno10 numeric(5,2) NULL,
	zup11 bpchar(8) NULL,
	zup_mno11 numeric(5,2) NULL,
	zup12 bpchar(8) NULL,
	zup_mno12 numeric(5,2) NULL,
	zup13 bpchar(8) NULL,
	zup_mno13 numeric(5,2) NULL,
	zup14 bpchar(8) NULL,
	zup_mno14 numeric(5,2) NULL,
	zup15 bpchar(8) NULL,
	zup_mno15 numeric(5,2) NULL,
	oz_dny int2 NULL,
	rhb_dny int2 NULL,
	ps_dny int2 NULL,
	krn_dny int2 NULL,
	pop_dny int2 NULL,
	dia_dny int2 NULL,
	hru_dny int2 NULL,
	bri_dny int2 NULL,
	zlu_dny int2 NULL,
	hrd_dny int2 NULL,
	oko_dny int2 NULL,
	srd_dny int2 NULL,
	cev_dny int2 NULL,
	hdl_dny int2 NULL,
	rezerva varchar(10) NULL,
	verze_p varchar(10) NOT NULL,
	chyba_p int2 NULL,
	kp1 int2 NULL,
	kp2 int2 NULL,
	kp3 int2 NULL,
	kp4 int2 NULL,
	kp5 int2 NULL,
	kp6 numeric(5,2) NULL,
	kp7 numeric(5,2) NULL,
	kp8 numeric(5,2) NULL,
	kp9 numeric(5,2) NULL,
	kp10 numeric(5,2) NULL,
	verze_g varchar(10) NOT NULL,
	chyba int2 NOT NULL,
	chyba_dg1 int2 NULL,
	chyba_dg2 int2 NULL,
	chyba_dg3 int2 NULL,
	chyba_dg4 int2 NULL,
	chyba_dg5 int2 NULL,
	chyba_dg6 int2 NULL,
	chyba_dg7 int2 NULL,
	chyba_dg8 int2 NULL,
	chyba_dg9 int2 NULL,
	chyba_dg10 int2 NULL,
	chyba_dg11 int2 NULL,
	chyba_dg12 int2 NULL,
	chyba_dg13 int2 NULL,
	chyba_dg14 int2 NULL,
	chyba_dg15 int2 NULL,
	chyba_dg16 int2 NULL,
	chyba_dg17 int2 NULL,
	chyba_dg18 int2 NULL,
	chyba_dg19 int2 NULL,
	chyba_dg20 int2 NULL,
	chyba_dg21 int2 NULL,
	chyba_dg22 int2 NULL,
	chyba_dg23 int2 NULL,
	chyba_dg24 int2 NULL,
	chyba_dg25 int2 NULL,
	chyba_dg26 int2 NULL,
	chyba_dg27 int2 NULL,
	chyba_dg28 int2 NULL,
	chyba_dg29 int2 NULL,
	chyba_dg30 int2 NULL,
	chyba_vyk1 int2 NULL,
	chyba_vyk2 int2 NULL,
	chyba_vyk3 int2 NULL,
	chyba_vyk4 int2 NULL,
	chyba_vyk5 int2 NULL,
	chyba_vyk6 int2 NULL,
	chyba_vyk7 int2 NULL,
	chyba_vyk8 int2 NULL,
	chyba_vyk9 int2 NULL,
	chyba_vyk10 int2 NULL,
	chyba_vyk11 int2 NULL,
	chyba_vyk12 int2 NULL,
	chyba_vyk13 int2 NULL,
	chyba_vyk14 int2 NULL,
	chyba_vyk15 int2 NULL,
	chyba_vyk16 int2 NULL,
	chyba_vyk17 int2 NULL,
	chyba_vyk18 int2 NULL,
	chyba_vyk19 int2 NULL,
	chyba_vyk20 int2 NULL,
	chyba_vyk21 int2 NULL,
	chyba_vyk22 int2 NULL,
	chyba_vyk23 int2 NULL,
	chyba_vyk24 int2 NULL,
	chyba_vyk25 int2 NULL,
	chyba_zup1 int2 NULL,
	chyba_zup2 int2 NULL,
	chyba_zup3 int2 NULL,
	chyba_zup4 int2 NULL,
	chyba_zup5 int2 NULL,
	chyba_zup6 int2 NULL,
	chyba_zup7 int2 NULL,
	chyba_zup8 int2 NULL,
	chyba_zup9 int2 NULL,
	chyba_zup10 int2 NULL,
	chyba_zup11 int2 NULL,
	chyba_zup12 int2 NULL,
	chyba_zup13 int2 NULL,
	chyba_zup14 int2 NULL,
	chyba_zup15 int2 NULL,
	skore_zav int2 NOT NULL,
	drg varchar(9) NOT NULL,
	drg_kat varchar(7) NOT NULL,
	run_id bigint
);
