dep:
  - v_factures_reference_1
  - v_sejours_1
src: |
  SELECT v_factures_reference_1.date_groupage AS date_reference,
      v_sejours_1.lieu_sortie_service_id AS lieu_reference_service_id,
      v_sejours_1.lieu_sortie_service_code AS lieu_reference_service_code,
      v_sejours_1.lieu_sortie_service_texte AS lieu_reference_service_texte,
      v_sejours_1.lieu_sortie_service_section_id AS lieu_reference_service_section_id,
      v_sejours_1.lieu_sortie_service_section_code AS lieu_reference_service_section_code,
      v_sejours_1.lieu_sortie_service_section_texte AS lieu_reference_service_section_texte,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_id AS lieu_reference_unite_fonctionnelle_id,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_code AS lieu_reference_unite_fonctionnelle_code,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_texte AS lieu_reference_unite_fonctionnelle_texte,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_section_id AS lieu_reference_unite_fonctionnelle_section_id,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_section_code AS lieu_reference_unite_fonctionnelle_section_code,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_section_texte AS lieu_reference_unite_fonctionnelle_section_texte,
      v_sejours_1.lieu_sortie_activite_id AS lieu_reference_activite_id,
      v_sejours_1.lieu_sortie_activite_code AS lieu_reference_activite_code,
      v_sejours_1.lieu_sortie_activite_texte AS lieu_reference_activite_texte,
      v_sejours_1.lieu_sortie_etage_id AS lieu_reference_etage_id,
      v_sejours_1.lieu_sortie_etage_code AS lieu_reference_etage_code,
      v_sejours_1.lieu_sortie_etage_texte AS lieu_reference_etage_texte,
      v_sejours_1.lieu_sortie_etage_section_id AS lieu_reference_etage_section_id,
      v_sejours_1.lieu_sortie_etage_section_code AS lieu_reference_etage_section_code,
      v_sejours_1.lieu_sortie_etage_section_texte AS lieu_reference_etage_section_texte,
      v_sejours_1.lieu_sortie_unite_medicale_id AS lieu_reference_unite_medicale_id,
      v_sejours_1.lieu_sortie_unite_medicale_code AS lieu_reference_unite_medicale_code,
      v_sejours_1.lieu_sortie_unite_medicale_texte AS lieu_reference_unite_medicale_texte,
      v_sejours_1.medecin_adm_sejour_id AS medecin_adm_reference_id,
      v_sejours_1.medecin_adm_sejour_code AS medecin_adm_reference_code,
      v_sejours_1.medecin_adm_sejour_nom AS medecin_adm_reference_nom,
      v_sejours_1.medecin_adm_sejour_prenom AS medecin_adm_reference_prenom,
      v_sejours_1.medecin_adm_sejour_nom_prenom AS medecin_adm_reference_nom_prenom,
      v_sejours_1.medecin_adm_sejour_section_id AS medecin_adm_reference_section_id,
      v_sejours_1.medecin_adm_sejour_section_code AS medecin_adm_reference_section_code,
      v_sejours_1.medecin_adm_sejour_section_texte AS medecin_adm_reference_section_texte,
      v_sejours_1.medecin_sejour_specialite_id AS medecin_reference_specialite_id,
      v_sejours_1.medecin_sejour_specialite_code AS medecin_reference_specialite_code,
      v_sejours_1.medecin_sejour_specialite_texte AS medecin_reference_specialite_texte,
      v_sejours_1.medecin_sejour_id AS medecin_reference_id,
      v_sejours_1.medecin_sejour_code AS medecin_reference_code,
      v_sejours_1.medecin_sejour_nom AS medecin_reference_nom,
      v_sejours_1.medecin_sejour_prenom AS medecin_reference_prenom,
      v_sejours_1.medecin_sejour_nom_prenom AS medecin_reference_nom_prenom,
      v_sejours_1.finess_id,
      v_sejours_1.finess_code,
      v_sejours_1.finess_texte,
      v_sejours_1.finess_section_id,
      v_sejours_1.finess_section_code,
      v_sejours_1.finess_section_texte,
      v_sejours_1.finess,
      v_sejours_1.provider_id,
      v_sejours_1.no_sejour,
      v_sejours_1.sejour_id,
      v_sejours_1.no_patient,
      v_sejours_1.code_sexe,
      v_sejours_1.sexe_texte_court,
      v_sejours_1.age,
      v_sejours_1.code_prevu,
      v_sejours_1.type_sejour,
      v_sejours_1.type_sejour_code,
      v_sejours_1.est_budget_global,
      v_sejours_1.type_sejour_id,
      v_sejours_1.type_sejour_texte,
      v_sejours_1.mode_traitement_id,
      v_sejours_1.mode_traitement_code,
      v_sejours_1.mode_traitement_texte,
      v_sejours_1.mois_entree,
      v_sejours_1.date_entree,
      v_sejours_1.heure_entree,
      v_sejours_1.mode_entree,
      v_sejours_1.provenance,
      v_sejours_1.mois_sortie,
      v_factures_reference_1.code_sorti,
      v_sejours_1.date_sortie,
      v_sejours_1.heure_sortie,
      v_sejours_1.mode_sortie,
      v_sejours_1.destination,
      v_sejours_1.est_sans_facturation,
      v_sejours_1.duree,
      v_sejours_1.code_cp_demandee,
      v_sejours_1.ghs_id,
      v_sejours_1.ghs_code,
      v_sejours_1.ghs_texte,
      v_sejours_1.ghm_id,
      v_sejours_1.ghm_code,
      v_sejours_1.ghm_texte,
      v_sejours_1.ghm5_id,
      v_sejours_1.ghm5_code,
      v_sejours_1.ghm5_texte,
      v_sejours_1.severite_ghm_id,
      v_sejours_1.severite_ghm_code,
      v_sejours_1.severite_ghm_texte,
      v_sejours_1.cas_id,
      v_sejours_1.cas_code,
      v_sejours_1.cas_texte,
      v_sejours_1.mco_id,
      v_sejours_1.mco_code,
      v_sejours_1.mco_texte,
      v_sejours_1.cmd_id,
      v_sejours_1.cmd_code,
      v_sejours_1.cmd_texte,
      v_sejours_1.mcos_id,
      v_sejours_1.mcos_code,
      v_sejours_1.mcos_texte,
      v_sejours_1.ghm_section_id,
      v_sejours_1.ghm_section_code,
      v_sejours_1.ghm_section_texte,
      v_sejours_1.medecin_adm_sejour_id,
      v_sejours_1.medecin_adm_sejour_code,
      v_sejours_1.medecin_adm_sejour_nom,
      v_sejours_1.medecin_adm_sejour_prenom,
      v_sejours_1.medecin_adm_sejour_nom_prenom,
      v_sejours_1.medecin_adm_sejour_section_id,
      v_sejours_1.medecin_adm_sejour_section_code,
      v_sejours_1.medecin_adm_sejour_section_texte,
      v_sejours_1.medecin_sejour_id,
      v_sejours_1.medecin_sejour_code,
      v_sejours_1.medecin_sejour_nom,
      v_sejours_1.medecin_sejour_prenom,
      v_sejours_1.medecin_sejour_nom_prenom,
      v_sejours_1.medecin_sejour_specialite_id,
      v_sejours_1.medecin_sejour_specialite_code,
      v_sejours_1.medecin_sejour_specialite_texte,
      v_sejours_1.lieu_sortie_id,
      v_sejours_1.lieu_sortie_service_id,
      v_sejours_1.lieu_sortie_service_code,
      v_sejours_1.lieu_sortie_service_texte,
      v_sejours_1.lieu_sortie_service_section_id,
      v_sejours_1.lieu_sortie_service_section_code,
      v_sejours_1.lieu_sortie_service_section_texte,
      v_sejours_1.lieu_sortie_service_section_nb_lits,
      v_sejours_1.lieu_sortie_service_section_nb_cp,
      v_sejours_1.lieu_sortie_activite_id,
      v_sejours_1.lieu_sortie_activite_code,
      v_sejours_1.lieu_sortie_activite_texte,
      v_sejours_1.lieu_sortie_etage_id,
      v_sejours_1.lieu_sortie_etage_code,
      v_sejours_1.lieu_sortie_etage_texte,
      v_sejours_1.lieu_sortie_etage_section_id,
      v_sejours_1.lieu_sortie_etage_section_code,
      v_sejours_1.lieu_sortie_etage_section_texte,
      v_sejours_1.lieu_sortie_lit_id,
      v_sejours_1.lieu_sortie_lit_code,
      v_sejours_1.lieu_sortie_lit_texte,
      v_sejours_1.lieu_sortie_lit_section_id,
      v_sejours_1.lieu_sortie_lit_section_code,
      v_sejours_1.lieu_sortie_lit_section_texte,
      v_sejours_1.lieu_sortie_unite_medicale_id,
      v_sejours_1.lieu_sortie_unite_medicale_code,
      v_sejours_1.lieu_sortie_unite_medicale_texte,
      v_sejours_1.lieu_sortie_unite_medicale_section_id,
      v_sejours_1.lieu_sortie_unite_medicale_section_code,
      v_sejours_1.lieu_sortie_unite_medicale_section_texte,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_id,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_code,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_texte,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_section_id,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_section_code,
      v_sejours_1.lieu_sortie_unite_fonctionnelle_section_texte,
      v_factures_reference_1.facture_reference_id,
      v_factures_reference_1.no_facture_reference,
      v_factures_reference_1.type_t2a,
      v_factures_reference_1.date_debut_facture,
      v_factures_reference_1.date_fin_facture,
      v_factures_reference_1.date_groupage,
      v_factures_reference_1.retard_groupage,
      v_factures_reference_1.delai_groupage,
      v_factures_reference_1.nb_groupe,
      v_factures_reference_1.nb_non_groupe,
      v_factures_reference_1.nb_calculable,
      v_factures_reference_1.nb_non_groupes,
      v_factures_reference_1.tiers_payant_0_id,
      v_factures_reference_1.tiers_payant_1_id,
      v_factures_reference_1.tiers_payant_2_id,
      v_factures_reference_1.tiers_payant_22_id,
      v_factures_reference_1.tiers_payant_id,
      v_factures_reference_1.tiers_payant_code,
      v_factures_reference_1.tiers_payant_texte,
      v_factures_reference_1.type_tiers_payant_id,
      v_factures_reference_1.type_tiers_payant_code,
      v_factures_reference_1.type_tiers_payant_texte,
      v_factures_reference_1.tiers_payant_grand_regime_id,
      v_factures_reference_1.tiers_payant_grand_regime_code,
      v_factures_reference_1.tiers_payant_grand_regime_texte,
      v_factures_reference_1.tiers_payant_section_id,
      v_factures_reference_1.tiers_payant_section_code,
      v_factures_reference_1.tiers_payant_section_texte,
      v_factures_reference_1.code_facture,
      v_factures_reference_1.date_facture,
      v_factures_reference_1.retard_facture,
      v_factures_reference_1.delai_facture,
      v_factures_reference_1.code_vente,
      v_factures_reference_1.date_vente,
      v_factures_reference_1.nb_factures,
      v_factures_reference_1.nb_calcules,
      v_factures_reference_1.nb_non_calcules,
      v_factures_reference_1.nb_non_calcules_groupes,
      v_factures_reference_1.nb_non_calcules_non_groupes,
      v_factures_reference_1.nb_factures_regularisation,
      v_factures_reference_1.nb_rejets,
      v_factures_reference_1.code_expedie_0,
      v_factures_reference_1.code_expedie_1,
      v_factures_reference_1.code_expedie_2,
      v_factures_reference_1.date_expedition,
      v_factures_reference_1.date_expedition_0,
      v_factures_reference_1.date_expedition_1,
      v_factures_reference_1.date_expedition_2,
      v_factures_reference_1.no_bordereau_0,
      v_factures_reference_1.no_bordereau_1,
      v_factures_reference_1.no_bordereau_2,
      v_factures_reference_1.delai_expedition,
      v_factures_reference_1.delai_expedition_0,
      v_factures_reference_1.delai_expedition_1,
      v_factures_reference_1.delai_expedition_2,
      v_factures_reference_1.nb_non_expedie,
      v_factures_reference_1.nb_non_expedie_c,
      v_factures_reference_1.nb_non_expedie_h,
      v_factures_reference_1.nb_non_expedie_0,
      v_factures_reference_1.nb_non_expedie_0_c,
      v_factures_reference_1.nb_non_expedie_0_h,
      v_factures_reference_1.nb_non_expedie_1,
      v_factures_reference_1.nb_non_expedie_1_c,
      v_factures_reference_1.nb_non_expedie_1_h,
      v_factures_reference_1.nb_non_expedie_2,
      v_factures_reference_1.nb_non_expedie_2_c,
      v_factures_reference_1.nb_non_expedie_2_h,
      v_factures_reference_1.montant_non_expedie,
      v_factures_reference_1.montant_non_expedie_c,
      v_factures_reference_1.montant_non_expedie_h,
      v_factures_reference_1.montant_non_expedie_0,
      v_factures_reference_1.montant_non_expedie_0_c,
      v_factures_reference_1.montant_non_expedie_0_h,
      v_factures_reference_1.montant_non_expedie_1,
      v_factures_reference_1.montant_non_expedie_1_c,
      v_factures_reference_1.montant_non_expedie_1_h,
      v_factures_reference_1.montant_non_expedie_2,
      v_factures_reference_1.montant_non_expedie_2_c,
      v_factures_reference_1.montant_non_expedie_2_h,
      v_factures_reference_1.montant_facture,
      v_factures_reference_1.montant_facture_c,
      v_factures_reference_1.montant_facture_h,
      v_factures_reference_1.montant_facture_0,
      v_factures_reference_1.montant_facture_0_c,
      v_factures_reference_1.montant_facture_0_h,
      v_factures_reference_1.montant_facture_1,
      v_factures_reference_1.montant_facture_1_c,
      v_factures_reference_1.montant_facture_1_h,
      v_factures_reference_1.montant_facture_2,
      v_factures_reference_1.montant_facture_2_c,
      v_factures_reference_1.montant_facture_2_h,
      v_factures_reference_1.montant_facture_c_actes_inclus_dans_sejour,
      v_factures_reference_1.montant_facture_h_actes_inclus_dans_sejour,
      v_factures_reference_1.montant_encours,
      v_factures_reference_1.montant_encours_c,
      v_factures_reference_1.montant_encours_h,
      v_factures_reference_1.montant_encours_0,
      v_factures_reference_1.montant_encours_0_c,
      v_factures_reference_1.montant_encours_0_h,
      v_factures_reference_1.montant_encours_1,
      v_factures_reference_1.montant_encours_1_c,
      v_factures_reference_1.montant_encours_1_h,
      v_factures_reference_1.montant_encours_2,
      v_factures_reference_1.montant_encours_2_c,
      v_factures_reference_1.montant_encours_2_h,
      v_factures_reference_1.montant_encours_groupes,
      v_factures_reference_1.montant_encours_groupes_c,
      v_factures_reference_1.montant_encours_groupes_h,
      v_factures_reference_1.montant_encours_groupes_0,
      v_factures_reference_1.montant_encours_groupes_0_c,
      v_factures_reference_1.montant_encours_groupes_0_h,
      v_factures_reference_1.montant_encours_groupes_1,
      v_factures_reference_1.montant_encours_groupes_1_c,
      v_factures_reference_1.montant_encours_groupes_1_h,
      v_factures_reference_1.montant_encours_groupes_2,
      v_factures_reference_1.montant_encours_groupes_2_c,
      v_factures_reference_1.montant_encours_groupes_2_h,
      v_factures_reference_1.montant_encours_non_groupes,
      v_factures_reference_1.montant_encours_non_groupes_c,
      v_factures_reference_1.montant_encours_non_groupes_h,
      v_factures_reference_1.montant_encours_non_groupes_0,
      v_factures_reference_1.montant_encours_non_groupes_0_c,
      v_factures_reference_1.montant_encours_non_groupes_0_h,
      v_factures_reference_1.montant_encours_non_groupes_1,
      v_factures_reference_1.montant_encours_non_groupes_1_c,
      v_factures_reference_1.montant_encours_non_groupes_1_h,
      v_factures_reference_1.montant_encours_non_groupes_2,
      v_factures_reference_1.montant_encours_non_groupes_2_c,
      v_factures_reference_1.montant_encours_non_groupes_2_h,
      v_factures_reference_1.montant_non_calcules,
      v_factures_reference_1.montant_non_calcules_c,
      v_factures_reference_1.montant_non_calcules_h,
      v_factures_reference_1.montant_non_calcules_0,
      v_factures_reference_1.montant_non_calcules_0_c,
      v_factures_reference_1.montant_non_calcules_0_h,
      v_factures_reference_1.montant_non_calcules_1,
      v_factures_reference_1.montant_non_calcules_1_c,
      v_factures_reference_1.montant_non_calcules_1_h,
      v_factures_reference_1.montant_non_calcules_2,
      v_factures_reference_1.montant_non_calcules_2_c,
      v_factures_reference_1.montant_non_calcules_2_h,
      v_factures_reference_1.montant_non_calcules_groupes,
      v_factures_reference_1.montant_non_calcules_groupes_c,
      v_factures_reference_1.montant_non_calcules_groupes_h,
      v_factures_reference_1.montant_non_calcules_groupes_0,
      v_factures_reference_1.montant_non_calcules_groupes_0_c,
      v_factures_reference_1.montant_non_calcules_groupes_0_h,
      v_factures_reference_1.montant_non_calcules_groupes_1,
      v_factures_reference_1.montant_non_calcules_groupes_1_c,
      v_factures_reference_1.montant_non_calcules_groupes_1_h,
      v_factures_reference_1.montant_non_calcules_groupes_2,
      v_factures_reference_1.montant_non_calcules_groupes_2_c,
      v_factures_reference_1.montant_non_calcules_groupes_2_h,
      v_factures_reference_1.montant_non_calcules_non_groupes,
      v_factures_reference_1.montant_non_calcules_non_groupes_c,
      v_factures_reference_1.montant_non_calcules_non_groupes_h,
      v_factures_reference_1.montant_non_calcules_non_groupes_0,
      v_factures_reference_1.montant_non_calcules_non_groupes_0_c,
      v_factures_reference_1.montant_non_calcules_non_groupes_0_h,
      v_factures_reference_1.montant_non_calcules_non_groupes_1,
      v_factures_reference_1.montant_non_calcules_non_groupes_1_c,
      v_factures_reference_1.montant_non_calcules_non_groupes_1_h,
      v_factures_reference_1.montant_non_calcules_non_groupes_2,
      v_factures_reference_1.montant_non_calcules_non_groupes_2_c,
      v_factures_reference_1.montant_non_calcules_non_groupes_2_h,
      v_factures_reference_1.montant_comptabilise,
      v_factures_reference_1.montant_comptabilise_c,
      v_factures_reference_1.montant_comptabilise_h,
      v_factures_reference_1.montant_comptabilise_0,
      v_factures_reference_1.montant_comptabilise_0_c,
      v_factures_reference_1.montant_comptabilise_0_h,
      v_factures_reference_1.montant_comptabilise_1,
      v_factures_reference_1.montant_comptabilise_1_c,
      v_factures_reference_1.montant_comptabilise_1_h,
      v_factures_reference_1.montant_comptabilise_2,
      v_factures_reference_1.montant_comptabilise_2_c,
      v_factures_reference_1.montant_comptabilise_2_h,
      v_factures_reference_1.montant_comptabilise_budget_global_c,
      v_factures_reference_1.montant_regle,
      v_factures_reference_1.montant_regle_c,
      v_factures_reference_1.montant_regle_h,
      v_factures_reference_1.montant_regle_0,
      v_factures_reference_1.montant_regle_0_c,
      v_factures_reference_1.montant_regle_0_h,
      v_factures_reference_1.montant_regle_1,
      v_factures_reference_1.montant_regle_1_c,
      v_factures_reference_1.montant_regle_1_h,
      v_factures_reference_1.montant_regle_2,
      v_factures_reference_1.montant_regle_2_c,
      v_factures_reference_1.montant_regle_2_h,
      v_factures_reference_1.date_solde,
      v_factures_reference_1.date_solde_c,
      v_factures_reference_1.date_solde_h,
      v_factures_reference_1.date_solde_0,
      v_factures_reference_1.date_solde_0_c,
      v_factures_reference_1.date_solde_0_h,
      v_factures_reference_1.date_solde_1,
      v_factures_reference_1.date_solde_1_c,
      v_factures_reference_1.date_solde_1_h,
      v_factures_reference_1.date_solde_2,
      v_factures_reference_1.date_solde_2_c,
      v_factures_reference_1.date_solde_2_h,
      v_factures_reference_1.delai_solde,
      v_factures_reference_1.delai_solde_c,
      v_factures_reference_1.delai_solde_h,
      v_factures_reference_1.delai_solde_0,
      v_factures_reference_1.delai_solde_0_c,
      v_factures_reference_1.delai_solde_0_h,
      v_factures_reference_1.delai_solde_1,
      v_factures_reference_1.delai_solde_1_c,
      v_factures_reference_1.delai_solde_1_h,
      v_factures_reference_1.delai_solde_2,
      v_factures_reference_1.delai_solde_2_c,
      v_factures_reference_1.delai_solde_2_h,
      v_factures_reference_1.nb_non_solde,
      v_factures_reference_1.nb_non_solde_c,
      v_factures_reference_1.nb_non_solde_h,
      v_factures_reference_1.nb_non_solde_0,
      v_factures_reference_1.nb_non_solde_0_c,
      v_factures_reference_1.nb_non_solde_0_h,
      v_factures_reference_1.nb_non_solde_1,
      v_factures_reference_1.nb_non_solde_1_c,
      v_factures_reference_1.nb_non_solde_1_h,
      v_factures_reference_1.nb_non_solde_2,
      v_factures_reference_1.nb_non_solde_2_c,
      v_factures_reference_1.nb_non_solde_2_h,
      v_factures_reference_1.montant_solde,
      v_factures_reference_1.montant_solde_c,
      v_factures_reference_1.montant_solde_h,
      v_factures_reference_1.montant_solde_0,
      v_factures_reference_1.montant_solde_0_c,
      v_factures_reference_1.montant_solde_0_h,
      v_factures_reference_1.montant_solde_1,
      v_factures_reference_1.montant_solde_1_c,
      v_factures_reference_1.montant_solde_1_h,
      v_factures_reference_1.montant_solde_2,
      v_factures_reference_1.montant_solde_2_c,
      v_factures_reference_1.montant_solde_2_h,
      v_factures_reference_1.nb_non_cloture,
      v_factures_reference_1.nb_non_cloture_c,
      v_factures_reference_1.nb_non_cloture_h,
      v_factures_reference_1.nb_non_cloture_0,
      v_factures_reference_1.nb_non_cloture_0_c,
      v_factures_reference_1.nb_non_cloture_0_h,
      v_factures_reference_1.nb_non_cloture_1,
      v_factures_reference_1.nb_non_cloture_1_c,
      v_factures_reference_1.nb_non_cloture_1_h,
      v_factures_reference_1.nb_non_cloture_2,
      v_factures_reference_1.nb_non_cloture_2_c,
      v_factures_reference_1.nb_non_cloture_2_h,
      v_factures_reference_1.nb_rubriques_c,
      v_factures_reference_1.nb_rubriques_h,
      v_factures_reference_1.pole_id
     FROM activite.v_factures_reference_1
       JOIN activite.v_sejours_1 ON v_factures_reference_1.no_sejour = v_sejours_1.no_sejour;