columns:
  age:
    type: numeric(3,0)
  code_cp_demandee:
    type: character(1)
    default: "0"
  code_original:
    type: text
    default: "''::text"
  code_postal_id:
    type: bigint
    default: "0"
  code_prevu:
    type: numeric(1,0)
    default: "0"
  code_sexe:
    type: character(1)
  code_sorti:
    type: numeric(1,0)
    default: "0"
  date_entree:
    type: date
  date_etat:
    type: timestamp without time zone
  date_expedition:
    type: date
    default: "'2099-12-31'::date"
  date_expedition_0:
    type: date
    default: "'2099-12-31'::date"
  date_expedition_1:
    type: date
    default: "'2099-12-31'::date"
  date_expedition_12:
    type: date
    default: "'2099-12-31'::date"
  date_expedition_2:
    type: date
    default: "'2099-12-31'::date"
  date_expedition_22:
    type: date
    default: "'2099-12-31'::date"
  date_facture:
    type: date
  date_groupage:
    type: date
    default: "'2099-12-31'::date"
  date_solde:
    type: date
  date_solde_0:
    type: date
    default: "'2099-12-31'::date"
  date_solde_1:
    type: date
    default: "'2099-12-31'::date"
  date_solde_12:
    type: date
    default: "'2099-12-31'::date"
  date_solde_2:
    type: date
    default: "'2099-12-31'::date"
  date_solde_22:
    type: date
    default: "'2099-12-31'::date"
  date_sortie:
    type: date
  delai_expedition:
    type: numeric(5,0)
    default: "0"
  delai_expedition_0:
    type: numeric(5,0)
    default: "0"
  delai_expedition_1:
    type: numeric(5,0)
    default: "0"
  delai_expedition_12:
    type: numeric(5,0)
    default: "0"
  delai_expedition_2:
    type: numeric(5,0)
    default: "0"
  delai_expedition_22:
    type: numeric(5,0)
    default: "0"
  delai_facture:
    type: numeric(5,0)
  delai_groupage:
    type: numeric(5,0)
    default: "0"
  delai_solde:
    type: numeric(5,0)
  delai_solde_0:
    type: numeric(5,0)
    default: "0"
  delai_solde_1:
    type: numeric(5,0)
    default: "0"
  delai_solde_12:
    type: numeric(5,0)
    default: "0"
  delai_solde_2:
    type: numeric(5,0)
    default: "0"
  delai_solde_22:
    type: numeric(5,0)
    default: "0"
  destination:
    type: character(1)
    default: "''::bpchar"
  est_budget_global:
    type: numeric(1,0)
    default: "0"
  est_sans_facturation:
    type: character(1)
    default: "'0'::bpchar"
    comment: 1=Pas de facturation pour ce séjour (services ou UF spéciaux)
  etat:
    type: character(1)
    default: "''::bpchar"
    comment: |
      S = Supprimé
      I = Ignoré
  etat_sejour:
    type: text
  filiere_soin_principale_id:
    type: bigint
    default: "0"
  finess:
    type: text
    not_null: NOT NULL
    default: "''::bpchar"
  forme_activite_id:
    type: integer
    default: "0"
  ghm_id:
    type: bigint
    default: "0"
  ghmgme_id:
    type: integer
    default: "0"
  ghs_bebe1_id:
    type: bigint
    default: "0"
  ghs_bebe2_id:
    type: bigint
    default: "0"
  ghs_bebe3_id:
    type: bigint
    default: "0"
  ghs_id:
    type: bigint
    default: "0"
  gme_id:
    type: integer
    default: "0"
  gmt_id:
    type: bigint
    default: "0"
  heure_entree:
    type: numeric(6,0)
    default: "0"
  heure_sortie:
    type: numeric(6,0)
    default: "0"
  lieu_sortie_id:
    type: bigint
    default: "0"
  medecin_sejour_id:
    type: bigint
  medecin_traitant_id:
    type: bigint
    default: "0"
  mode_entree:
    type: character(1)
    default: "'8'::bpchar"
  mode_sortie:
    type: character(1)
  mode_traitement_id:
    type: bigint
    default: "0"
  montant_comptabilise_0_c:
    type: numeric(13,2)
    default: "0"
  montant_comptabilise_0_h:
    type: numeric(13,2)
    default: "0"
  montant_comptabilise_1_c:
    type: numeric(13,2)
    default: "0"
  montant_comptabilise_1_h:
    type: numeric(13,2)
    default: "0"
  montant_comptabilise_22_c:
    type: numeric(13,2)
    default: "0"
  montant_comptabilise_22_h:
    type: numeric(13,2)
    default: "0"
  montant_comptabilise_2_c:
    type: numeric(13,2)
    default: "0"
  montant_comptabilise_2_h:
    type: numeric(13,2)
    default: "0"
  montant_comptabilise_budget_global_c:
    type: numeric(13,2)
    default: "0"
  montant_comptabilise_c:
    type: numeric(13,2)
    default: "0"
  montant_comptabilise_h:
    type: numeric(13,2)
    default: "0"
  montant_facture_0_c:
    type: numeric(13,2)
    default: "0"
  montant_facture_0_h:
    type: numeric(13,2)
    default: "0"
  montant_facture_12_c:
    type: numeric(13,2)
    default: "0"
  montant_facture_12_h:
    type: numeric(13,2)
    default: "0"
  montant_facture_1_c:
    type: numeric(13,2)
    default: "0"
  montant_facture_1_h:
    type: numeric(13,2)
    default: "0"
  montant_facture_22_c:
    type: numeric(13,2)
    default: "0"
  montant_facture_22_h:
    type: numeric(13,2)
    default: "0"
  montant_facture_2_c:
    type: numeric(13,2)
    default: "0"
  montant_facture_2_h:
    type: numeric(13,2)
    default: "0"
  montant_facture_c:
    type: numeric(13,2)
    default: "0"
  montant_facture_c_actes_inclus_dans_sejour:
    type: numeric(13,2)
  montant_facture_h:
    type: numeric(13,2)
    default: "0"
  montant_facture_h_actes_inclus_dans_sejour:
    type: numeric(13,2)
  montant_regle_0_c:
    type: numeric(13,2)
    default: "0"
  montant_regle_0_h:
    type: numeric(13,2)
    default: "0"
  montant_regle_12_c:
    type: numeric(13,2)
    default: "0"
  montant_regle_12_h:
    type: numeric(13,2)
    default: "0"
  montant_regle_1_c:
    type: numeric(13,2)
    default: "0"
  montant_regle_1_h:
    type: numeric(13,2)
    default: "0"
  montant_regle_22_c:
    type: numeric(13,2)
    default: "0"
  montant_regle_22_h:
    type: numeric(13,2)
    default: "0"
  montant_regle_2_c:
    type: numeric(13,2)
    default: "0"
  montant_regle_2_h:
    type: numeric(13,2)
    default: "0"
  montant_regle_c:
    type: numeric(13,2)
  montant_regle_h:
    type: numeric(13,2)
  nb_factures:
    type: numeric(5,0)
  nb_factures_regularisation:
    type: numeric(5,0)
  nb_factures_rejet:
    type: numeric(5,0)
    default: "0"
  no_patient:
    type: character(20)
  no_sejour:
    type: text
    not_null: NOT NULL
  oid:
    type: bigint
    not_null: NOT NULL
    default: "nextval('s_sejours'::regclass)"
  particularite_t2a:
    type: text
    default: "''::text"
    comment: |
      SE1 = Forfait SE1
      SE2 = Forfait SE2
      SE3 = Forfait SE3
  provenance:
    type: character(1)
    default: "''::bpchar"
  provider_id:
    type: bigint
    default: "0"
  risque_id:
    type: integer
    default: "0"
  tiers_payant_0_id:
    type: bigint
    default: "0"
  tiers_payant_1_id:
    type: bigint
    default: "0"
  tiers_payant_22_id:
    type: bigint
    default: "0"
  tiers_payant_2_id:
    type: bigint
    default: "0"
  traitement_epmsi_id:
    type: bigint
    default: "0"
  type_hospi_pmsi_id:
    type: integer
    default: "0"
  type_pmsi:
    type: character(1)
    default: "'0'::bpchar"
    comment: 'Type PMSI : 1=MCO, 2=SSR, 3=PSY'
  type_sejour:
    type: text
    comment: |
      1=Hospitalisés
      2=Ambulatoires
      3=Externes
constraints:
  p_sejours_pkey:
    type: PRIMARY KEY
    column: oid
indexes:
  i_sejours_1:
    column: no_sejour
    method: btree
  i_sejours_10:
    column: ghs_id
    method: btree
  i_sejours_11:
    column: no_patient
    method: btree
  i_sejours_12:
    column: type_sejour
    method: btree
  i_sejours_13:
    column: code_original
    method: btree
  i_sejours_14:
    column: ghm_id
    method: btree
  i_sejours_15:
    column: medecin_sejour_id
    method: btree
  i_sejours_16:
    column: age
    method: btree
  i_sejours_2:
    column: lieu_sortie_id
    method: btree
  i_sejours_3:
    column: date_sortie
    method: btree
  i_sejours_4:
    column: tiers_payant_1_id
    method: btree
  i_sejours_5:
    column: tiers_payant_2_id
    method: btree
  i_sejours_6:
    column: date_facture
    method: btree
  i_sejours_7:
    column: code_sorti
    method: btree
  i_sejours_8:
    column: tiers_payant_0_id
    method: btree
  i_sejours_9:
    column: tiers_payant_22_id
    method: btree
  i_sejours_forme_activite_id:
    column: forme_activite_id
    method: btree
  i_sejours_gme_id:
    column: gme_id
    method: btree