pour déploiement auto v2 via gitlab
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

71 lines
2.3 KiB

return: SETOF record
lang: plpgsql
parameters:
p0:
type: bigint
name: i_rapport_id
src: |
DECLARE
sqlcmd text;
temp_cursor refcursor;
_oid integer;
_maxind integer;
row RECORD;
BEGIN
FOR row IN
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rss_1', '') AS (name text, value text)
UNION
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rss_rum_1', '') AS (name text, value text)
UNION
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rsf_detail_1', '') AS (name text, value text)
UNION
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rsf_detail_6', '') AS (name text, value text)
UNION
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rss_lpp_1', '') AS (name text, value text)
UNION
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rss_ucd_1', '') AS (name text, value text)
UNION
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rss_actes_1', '') AS (name text, value text)
UNION
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rss_diagnostics_1', '') AS (name text, value text)
UNION
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rss_cancero_1', '') AS (name text, value text)
UNION
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rsf_detail_rum_1', '') AS (name text, value text)
UNION
SELECT * FROM pmsi.cti_prepare_jauge_indicateurs(i_rapport_id, 'v_rss_sae_1', '') AS (name text, value text)
UNION
SELECT 'RUBRIQUES_RAPPORT',
base.cti_group_concat(
CASE WHEN table_name <> '*CALC' THEN 'SUM(indicateurs[000' || indicateur_id || '])'
ELSE
replace(
replace(
column_name,
'[1]',
'SUM(indicateurs[000' || indicateur_associe_1_id || '])'
),
'[2]',
'SUM(indicateurs[000' || indicateur_associe_2_id || '])'
)
END)
FROM (SELECT * FROM pmsi.t_rapports_rubriques
JOIN pmsi.t_indicateurs ON t_rapports_rubriques.indicateur_id = t_indicateurs.oid
WHERE rapport_id = i_rapport_id ORDER BY numero_rubrique
) subview
LOOP
RETURN NEXT row;
END LOOP;
RETURN ;
END;