dep:
  - v_listes_3
src: |
  (
          (
                   SELECT '-8'::text AS oid,
                      'Listes paramétrées'::text AS texte,
                      '1'::text AS level,
                      '0'::text AS tri,
                      '0'::character(1) AS is_cti
                     FROM pmsi.t_listes_tables
                    WHERE t_listes_tables.name = 't_actes'::text AND (t_listes_tables.oid IN ( SELECT t_listes.table_id
                             FROM pmsi.t_listes
                            WHERE t_listes.is_cti::text <> 1::text AND t_listes.code <> 'CTI_INTERV'::text))
                  UNION
                   SELECT 'LI'::text || t_listes.oid::text AS oid,
                      t_listes.texte,
                      '2'::text AS level,
                      '1 '::text || t_listes.texte AS tri,
                          CASE
                              WHEN t_listes.is_cti::text = '1'::text OR t_listes.code ~~ 'CTI_%'::text THEN '1'::character(1)
                              ELSE '0'::character(1)
                          END AS is_cti
                     FROM pmsi.t_listes,
                      pmsi.t_listes_tables
                    WHERE t_listes.table_id = t_listes_tables.oid AND t_listes_tables.name = 't_actes'::text AND t_listes.is_cti::text <> 1::text AND t_listes.code <> 'CTI_INTERV'::text
                  UNION
                   SELECT 'SL'::text || t_listes.oid::text AS oid,
                      'Sauf '::text || t_listes.texte AS texte,
                      '2'::text AS level,
                      '1S'::text || t_listes.texte AS tri,
                          CASE
                              WHEN t_listes.is_cti::text = '1'::text OR t_listes.code ~~ 'CTI_%'::text THEN '1'::character(1)
                              ELSE '0'::character(1)
                          END AS is_cti
                     FROM pmsi.t_listes,
                      pmsi.t_listes_tables
                    WHERE t_listes.table_id = t_listes_tables.oid AND t_listes_tables.name = 't_actes'::text AND t_listes.is_cti::text <> 1::text AND t_listes.code <> 'CTI_INTERV'::text AND (t_listes.show_omit::text <> '0'::text OR t_listes.show_omit::text IS NULL)
                  UNION
                   SELECT '-8'::text AS oid,
                      'Listes paramétrées CTI'::text AS texte,
                      '1'::text AS level,
                      '2'::text AS tri,
                      '0'::character(1) AS is_cti
                     FROM pmsi.t_listes_tables
                    WHERE t_listes_tables.name = 't_actes'::text AND (t_listes_tables.oid IN ( SELECT t_listes.table_id
                             FROM pmsi.t_listes
                            WHERE t_listes.is_cti::text = 1::text AND t_listes.code <> 'CTI_INTERV'::text))
                  UNION
                   SELECT 'LI'::text || t_listes.oid::text AS oid,
                      t_listes.texte,
                      '2'::text AS level,
                      '3 '::text || t_listes.texte AS tri,
                          CASE
                              WHEN t_listes.is_cti::text = '1'::text OR t_listes.code ~~ 'CTI_%'::text THEN '1'::character(1)
                              ELSE '0'::character(1)
                          END AS is_cti
                     FROM pmsi.t_listes,
                      pmsi.t_listes_tables
                    WHERE t_listes.table_id = t_listes_tables.oid AND t_listes_tables.name = 't_actes'::text AND t_listes.is_cti::text = 1::text AND t_listes.code <> 'CTI_INTERV'::text
                  UNION
                   SELECT 'SL'::text || t_listes.oid::text AS oid,
                      'Sauf '::text || t_listes.texte AS texte,
                      '2'::text AS level,
                      '3S'::text || t_listes.texte AS tri,
                          CASE
                              WHEN t_listes.is_cti::text = '1'::text OR t_listes.code ~~ 'CTI_%'::text THEN '1'::character(1)
                              ELSE '0'::character(1)
                          END AS is_cti
                     FROM pmsi.t_listes,
                      pmsi.t_listes_tables
                    WHERE t_listes.table_id = t_listes_tables.oid AND t_listes_tables.name = 't_actes'::text AND t_listes.is_cti::text = 1::text AND t_listes.code <> 'CTI_INTERV'::text AND (t_listes.show_omit::text <> '0'::text OR t_listes.show_omit::text IS NULL)
                  UNION
                   SELECT ('LC'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || t_classes.oid::text AS oid,
                      t_classes.texte,
                      '1'::text AS level,
                      '6'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text)) AS tri,
                          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 = 'ACTE'::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,
              '2'::text AS level,
              '6'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text) || t_classes_sections.code) AS tri,
                  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 = 'ACTE'::text
          UNION ALL
           SELECT ('LS'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || '0'::text AS oid,
              'Section non attribuée'::text AS texte,
              '2'::text AS level,
              '6'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text) || chr(255)) AS tri,
                  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 = 'ACTE'::text
  ) UNION
  ( SELECT DISTINCT 'NO'::text || t_actes.nomenclature AS oid,
      t_actes.nomenclature AS texte,
      '1'::text AS level,
      '7'::text || t_actes.nomenclature AS tri,
      '0'::character(1) AS is_cti
     FROM pmsi.t_actes
    WHERE t_actes.oid > 0 AND (t_actes.oid IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI_INTERV'::text)) AND (t_actes.oid IN ( SELECT p_oids.oid
             FROM pmsi.p_oids
            WHERE p_oids.code_table::text = 'actes'::text))
    ORDER BY ('NO'::text || t_actes.nomenclature), t_actes.nomenclature, '1'::text, ('7'::text || t_actes.nomenclature))
  UNION
   SELECT 'RC'::text || t_ccam_regroupements.oid::text AS oid,
      (t_ccam_regroupements.code::text || ' '::text) || t_ccam_regroupements.texte::text AS texte,
      '2'::text AS level,
      ('7'::text || 'CCAM0'::text) || t_ccam_regroupements.code::text AS tri,
      '0'::character(1) AS is_cti
     FROM pmsi.t_ccam_regroupements
    WHERE t_ccam_regroupements.oid > 0 AND (t_ccam_regroupements.code::text <> ALL (ARRAY['CCAM'::character varying::text]))
  UNION
   SELECT 'AC'::text || t_actes.oid::text AS oid,
      (t_actes.code || ' '::text) || t_actes.texte AS texte,
      '2'::text AS level,
      (('7'::text || t_actes.nomenclature) || '1'::text) || t_actes.code AS tri,
      '0'::character(1) AS is_cti
     FROM pmsi.t_actes
    WHERE t_actes.oid > 0 AND (t_actes.oid IN ( SELECT v_listes_3.to_id
             FROM pmsi.v_listes_3
            WHERE v_listes_3.liste_code = 'CTI_INTERV'::text)) AND (t_actes.oid IN ( SELECT p_oids.oid
             FROM pmsi.p_oids
            WHERE p_oids.code_table::text = 'actes'::text))
    ORDER BY 4;