dep:
  - v_listes_1
src: |
  SELECT v_listes_1.liste_id_combo AS oid,
      v_listes_1.code,
      v_listes_1.texte,
      v_listes_1.lvl AS level,
      ('0'::text || v_listes_1.sort) || chr(1) AS tri1,
      ''::text AS tri2
     FROM pmsi.v_listes_1
    WHERE v_listes_1.table_code = 'MEDECIN'::text AND v_listes_1.lvl <> '0'::text
  UNION
  ( SELECT DISTINCT 'SP'::text || t_specialites_medecin.oid::text AS oid,
      t_specialites_medecin.code,
      (t_specialites_medecin.code::text || ' '::text) || t_specialites_medecin.texte::text AS texte,
      '1'::text AS level,
      '2'::text || t_specialites_medecin.code::text AS tri1,
      ''::text AS tri2
     FROM pmsi.t_specialites_medecin,
      pmsi.t_medecins
    WHERE t_medecins.specialite_id = t_specialites_medecin.oid AND (t_medecins.oid IN ( SELECT DISTINCT p_rss.medecin_rss_id
             FROM pmsi.p_rss
            ORDER BY p_rss.medecin_rss_id))
    ORDER BY ('SP'::text || t_specialites_medecin.oid::text), ((t_specialites_medecin.code::text || ' '::text) || t_specialites_medecin.texte::text), '1'::text, ('2'::text || t_specialites_medecin.code::text), ''::text)
  UNION
  ( SELECT DISTINCT 'MD'::text || t_medecins.oid::text AS oid,
      t_medecins.code,
      ((((t_medecins.nom || ' '::text) || t_medecins.prenom) || ' ('::text) || t_medecins.code) || ')'::text AS texte,
      '2'::text AS level,
      '2'::text || t_specialites_medecin.code::text AS tri1,
      t_medecins.nom AS tri2
     FROM pmsi.t_medecins,
      pmsi.t_specialites_medecin
    WHERE t_medecins.specialite_id = t_specialites_medecin.oid AND (t_medecins.oid IN ( SELECT DISTINCT p_rss.medecin_rss_id
             FROM pmsi.p_rss
            ORDER BY p_rss.medecin_rss_id))
    ORDER BY ('MD'::text || t_medecins.oid::text), (((((t_medecins.nom || ' '::text) || t_medecins.prenom) || ' ('::text) || t_medecins.code) || ')'::text), '2'::text, ('2'::text || t_specialites_medecin.code::text), t_medecins.nom)
    ORDER BY 4, 5;