src: |
  ( SELECT DISTINCT 'NA'::text AS oid,
      'Sans autorisation'::text AS texte,
      ''::text AS code,
      '1'::text AS level,
      '1'::text AS tri
    ORDER BY 'NA'::text, 'Sans autorisation'::text, ''::text, '1'::text)
  UNION
  ( SELECT DISTINCT 'TT'::text AS oid,
      'Avec autorisation'::text AS texte,
      ''::text AS code,
      '1'::text AS level,
      '2'::text AS tri
     FROM pmsi.t_unites_medicales,
      pmsi.t_types_autorisations
    WHERE t_unites_medicales.type_autorisation = t_types_autorisations.code AND t_unites_medicales.type_autorisation <> ''::text AND (t_unites_medicales.oid IN ( SELECT p_oids.oid
             FROM pmsi.p_oids
            WHERE p_oids.code_table::text = 'um'::text))
    ORDER BY 'TT'::text, 'Avec autorisation'::text, ''::text, '1'::text, '2'::text)
  UNION
  ( SELECT DISTINCT 'TA'::text || t_types_autorisations.code AS oid,
      (t_types_autorisations.code || ' '::text) || t_types_autorisations.texte AS texte,
      t_types_autorisations.code,
      '1'::text AS level,
      '9'::text || t_types_autorisations.code AS tri
     FROM pmsi.t_unites_medicales,
      pmsi.t_types_autorisations
    WHERE t_unites_medicales.type_autorisation = t_types_autorisations.code AND t_unites_medicales.type_autorisation <> ''::text AND (t_unites_medicales.oid IN ( SELECT p_oids.oid
             FROM pmsi.p_oids
            WHERE p_oids.code_table::text = 'um'::text))
    ORDER BY ('TA'::text || t_types_autorisations.code), ((t_types_autorisations.code || ' '::text) || t_types_autorisations.texte), t_types_autorisations.code, '1'::text, ('9'::text || t_types_autorisations.code))
    ORDER BY 5;