src: |
  SELECT t_medecins.oid,
      t_medecins.code,
      t_medecins.nom,
      t_medecins.prenom,
      btrim((t_medecins.nom || ' '::text) || COALESCE(t_medecins.prenom, ''::text)) AS nom_prenom,
      t_medecins.no_adeli,
      t_medecins.specialite_id,
      t_specialites_medecin.code AS specialite_medecin_code,
      t_specialites_medecin.texte AS specialite_medecin_texte,
      t_medecins.specialite_interne_id,
      t_specialites_internes_medecin.code AS specialite_interne_medecin_code,
      t_specialites_internes_medecin.texte AS specialite_interne_medecin_texte,
      t_medecins_reference.oid AS medecin_reference_id,
      t_medecins_reference.code AS medecin_reference_code,
      t_medecins_reference.nom AS medecin_reference_nom,
      t_medecins_reference.prenom AS medecin_reference_prenom,
      btrim((t_medecins_reference.nom || ' '::text) || COALESCE(t_medecins_reference.prenom, ''::text)) AS medecin_reference_nom_prenom,
      t_medecins_reference.numero_ordre AS medecin_reference_no_adeli,
      t_medecins_reference.specialite_id AS specialite_medecin_reference_id,
      t_specialites_medecin_reference.code AS specialite_medecin_reference_code,
      t_specialites_medecin_reference.texte AS specialite_medecin_reference_texte,
      t_medecins_reference.specialite_id AS specialite_interne_medecin_reference_id,
      t_specialites_internes_medecin_reference.code AS specialite_interne_medecin_reference_code,
      t_specialites_internes_medecin_reference.texte AS specialite_interne_medecin_reference_texte
     FROM pmsi.t_medecins
       JOIN pmsi.t_specialites_medecin ON t_medecins.specialite_id = t_specialites_medecin.oid
       JOIN pmsi.t_specialites_internes_medecin ON t_medecins.specialite_interne_id = t_specialites_internes_medecin.oid
       JOIN base.t_medecins t_medecins_reference ON t_medecins.medecin_id = t_medecins_reference.oid
       JOIN pmsi.t_specialites_medecin t_specialites_medecin_reference ON t_specialites_medecin_reference.oid = 0
       JOIN base.t_specialites_medecin t_specialites_internes_medecin_reference ON t_medecins_reference.specialite_id = t_specialites_internes_medecin_reference.oid;