dep:
  - v_listes_1
src: |
  (
           SELECT v_listes_1.liste_id_combo AS oid,
              v_listes_1.texte,
              ''::text AS code,
              v_listes_1.lvl AS level,
              ('0'::text || v_listes_1.sort) || chr(1) AS tri,
              v_listes_1.liste_alias_combo AS alias,
                  CASE
                      WHEN v_listes_1.is_cti = '1'::text OR v_listes_1.code ~~ 'CTI_%'::text THEN '1'::character(1)
                      ELSE '0'::character(1)
                  END AS is_cti
             FROM pmsi.v_listes_1
            WHERE v_listes_1.table_code = 'UM'::text AND v_listes_1.lvl <> '0'::text
          UNION
           SELECT ('LC'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || t_classes.oid::text AS oid,
              t_classes.texte,
              ''::text AS code,
              '1'::text AS level,
              '5'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text)) AS tri,
              ''::text AS alias,
                  CASE
                      WHEN t_classes.is_cti = '1'::bpchar OR t_classes.code ~~ 'CTI_%'::text THEN '1'::character(1)
                      ELSE '0'::character(1)
                  END AS is_cti
             FROM pmsi.t_classes,
              pmsi.t_listes_tables
            WHERE t_classes.table_id = t_listes_tables.oid AND t_listes_tables.code = 'UM'::text
  ) UNION ALL
   SELECT ('LS'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || t_classes_sections.oid::text AS oid,
      t_classes_sections.texte,
      ''::text AS code,
      '2'::text AS level,
      '5'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text) || t_classes_sections.code) AS tri,
      ''::text AS alias,
          CASE
              WHEN t_classes.is_cti = '1'::bpchar OR t_classes.code ~~ 'CTI_%'::text THEN '1'::character(1)
              ELSE '0'::character(1)
          END AS is_cti
     FROM pmsi.t_classes,
      pmsi.t_classes_sections,
      pmsi.t_listes_tables
    WHERE t_classes.table_id = t_listes_tables.oid AND t_classes_sections.classe_id = t_classes.oid AND t_listes_tables.code = 'UM'::text
  UNION ALL
   SELECT ('LS'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || '0'::text AS oid,
      'Section non attribuée'::character varying AS texte,
      ''::text AS code,
      '2'::text AS level,
      '5'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text) || chr(255)) AS tri,
      ''::text AS alias,
          CASE
              WHEN t_classes.is_cti = '1'::bpchar OR t_classes.code ~~ 'CTI_%'::text THEN '1'::character(1)
              ELSE '0'::character(1)
          END AS is_cti
     FROM pmsi.t_classes,
      pmsi.t_listes_tables
    WHERE t_classes.table_id = t_listes_tables.oid AND t_listes_tables.code = 'UM'::text
  UNION ALL
  ( SELECT DISTINCT '-8'::text AS oid,
      'Autorisations'::text AS texte,
      ''::text AS code,
      '1'::text AS level,
      '6'::text AS tri,
      ''::text AS alias,
      '0'::character(1) AS is_cti
    ORDER BY '-8'::text, 'Autorisations'::text, ''::text, '1'::text, '6'::text)
  UNION ALL
  ( SELECT DISTINCT 'AN'::text AS oid,
      'Sans autorisation'::text AS texte,
      ''::text AS code,
      '2'::text AS level,
      '6000'::text AS tri,
      ''::text AS alias,
      '0'::character(1) AS is_cti
    ORDER BY 'AN'::text, 'Sans autorisation'::text, ''::text, '2'::text, '6000'::text)
  UNION ALL
  ( SELECT DISTINCT 'AT'::text AS oid,
      'Avec une autorisation'::text AS texte,
      ''::text AS code,
      '2'::text AS level,
      '6001'::text AS tri,
      ''::text AS alias,
      '0'::character(1) AS is_cti
     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 'AT'::text, 'Avec une autorisation'::text, ''::text, '2'::text, '6001'::text)
  UNION ALL
  ( SELECT DISTINCT 'AU'::text || t_types_autorisations.code AS oid,
      (t_types_autorisations.code || ' '::text) || t_types_autorisations.texte AS texte,
      t_types_autorisations.code,
      '2'::text AS level,
      '6'::text || t_types_autorisations.code AS tri,
      ''::text AS alias,
      '0'::character(1) AS is_cti
     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 ('AU'::text || t_types_autorisations.code), ((t_types_autorisations.code || ' '::text) || t_types_autorisations.texte), t_types_autorisations.code, '2'::text, ('6'::text || t_types_autorisations.code))
  UNION ALL
   SELECT 'UM'::text || t_unites_medicales.oid::text AS oid,
      (t_unites_medicales.code || ' '::text) || t_unites_medicales.texte AS texte,
      t_unites_medicales.code,
      '1'::text AS level,
      '9'::text || t_unites_medicales.code AS tri,
          CASE
              WHEN t_unites_medicales.code IS DISTINCT FROM ''::text THEN '#UM'::text || t_unites_medicales.code
              ELSE t_unites_medicales.oid::text
          END AS alias,
      '0'::character(1) AS is_cti
     FROM pmsi.t_unites_medicales
    WHERE (t_unites_medicales.oid IN ( SELECT p_oids.oid
             FROM pmsi.p_oids
            WHERE p_oids.code_table::text = 'um'::text))
    ORDER BY 5;