1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
SELECT
sejour.sejo_dat_deb, lit.lipo_code, CASE WHEN (sepr_ind_actif = '1' and to_char(sepr.sepr_dat_deb,'YYYY-MM-DD') >= to_char(mou0.mouv_dat_mou,'YYYY-MM-DD')) THEN prse.prse_code ELSE '' END as prestation
FROM
Ide_sejour as sejour
join sejour.ide_patient as patient
join sejour.bas_etablissement_by_Sejo_id_etab_con as etab
join sejour.bas_uf_by_Sejo_id_unfo_heb as ufh
left join sejour.ide_sejour_prestations as sepr
join sepr.pad_prestation_sejour prse
join sejour.bas_catalogue_pers_by_Sejo_id_cape_ven as type
left join sejour.ide_mouvements as mou0
left join mou0.pad_lit_poste as lit
WHERE
etab.etab_id_etab = 19655
AND sejour.sejo_dat_deb <= current_date
AND(
NVL(sejour.sejo_dat_fin, '31-12-2999')>=current_date
OR sejour.sejo_typ_sor IN ('M','P')
)
AND sejour.sejo_statut NOT IN ('A','P','Z')
AND sejour.sejo_dat_sup IS NULL
AND type.cape_code not in ('E' , 'U')
AND sejour.id = '729863796'
AND sepr_ind_actif = '1' |
Partager