<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
<VUE
|
|
name="PMSI003691"
|
|
label="PMSI. Synthèse Simulation FG 2324"
|
|
title="= 'Synthèse Simulation FG 2324 (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ')'"
|
|
database="iCTI"
|
|
swf="*CTI_view1"
|
|
softCode="iCTI_pmsi"
|
|
typeEts=""
|
|
componentsFile="PMSI_components.XML"
|
|
>
|
|
<VIEWPROPERTIES componentName="PROPERTIES_RSS"/>
|
|
<VIEWPROPERTIES componentName="PROPERTIES_SELECT_TABTREE"/>
|
|
<VIEWPROPERTIES>
|
|
<PROPERTY name="SIMULATION_FILTERS">
|
|
<value><![CDATA[[EVAL
|
|
// <?php
|
|
$select = '';
|
|
|
|
if ('[FINESS]' != '-1') {
|
|
$mode = substr('[FINESS]',0,2);
|
|
$oid = '[FINESS]';
|
|
if ($mode == 'LS') {
|
|
$section_id = PMSI_get_section_id('[FINESS]');
|
|
$oid = PMSI_get_classe_oid('[FINESS]');
|
|
}
|
|
if ($mode != 'LI' && $mode != 'SL' && $mode != 'LS' ) {
|
|
$mode = 'FI';
|
|
}
|
|
if ($mode == 'LI' || $mode == 'SL') {
|
|
$oid = substr('[FINESS]',2);
|
|
}
|
|
$subselect_select = '';
|
|
|
|
if ($mode == 'LI') {$subselect_select = " v_rss_1.finess_id IN (SELECT to_id FROM base.t_listes_contenu WHERE liste_id = $oid)";}
|
|
if ($mode == 'SL') {$subselect_select = " v_rss_1.finess_id NOT IN (SELECT to_id FROM base.t_listes_contenu WHERE liste_id = $oid)";}
|
|
if ($mode == 'LS') {$subselect_select = " v_rss_1.finess_id IN (SELECT oid FROM base.t_finess WHERE $section_id = $oid)";}
|
|
if ($mode == 'FI') {$subselect_select = " v_rss_1.finess = '$oid' ";}
|
|
|
|
if ($subselect_select != '') {
|
|
$select .= " AND $subselect_select ";
|
|
}
|
|
}
|
|
|
|
$select .= " AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]' ";
|
|
$select .= " AND en_cours = '0' ";
|
|
|
|
return $select;
|
|
// ?>
|
|
EVAL]]]></value>
|
|
</PROPERTY>
|
|
<PROPERTY name="SIMULATION_UPDATE">
|
|
<value><![CDATA[[EVAL
|
|
// <?php
|
|
$update = '
|
|
UPDATE pmsi.pmsi000196
|
|
SET
|
|
montant_total_autres_prestations_fg0 = coalesce(subq.montant_total_autres_prestations_fg0, 0),
|
|
montant_total_autres_prestations_fg1 = coalesce(subq.montant_total_autres_prestations_fg1, 0),
|
|
%s
|
|
FROM
|
|
(
|
|
SELECT
|
|
SUM(montant_fg0) AS montant_total_autres_prestations_fg0,
|
|
SUM(montant_fg1) AS montant_total_autres_prestations_fg1,
|
|
%s
|
|
FROM pmsi000196_prestas
|
|
) AS subq
|
|
;
|
|
';
|
|
|
|
$pArray = array('ATU', 'FFM', 'SE1', 'SE2', 'SE3', 'SE4' ,'SE5', 'SE6', 'SE7', 'APE', 'AP2', 'FPI') ;
|
|
for ($i = 1; $i <= 23; $i++) {
|
|
array_push($pArray, 'D' . str_pad($i, 2, '0', STR_PAD_LEFT));
|
|
}
|
|
|
|
|
|
$a1 = array();
|
|
$a2 = array();
|
|
|
|
foreach ($pArray as $value) {
|
|
$a1[] = 'montant_'.strtolower($value).'_fg0 = subq.montant_'.strtolower($value).'_fg0';
|
|
$a1[] = 'montant_'.strtolower($value).'_fg1 = subq.montant_'.strtolower($value).'_fg1';
|
|
|
|
$a2[] = 'SUM(CASE WHEN prestation_code = \'' . $value . '\' THEN montant_fg0 ELSE 0 END) AS montant_'.strtolower($value).'_fg0';
|
|
$a2[] = 'SUM(CASE WHEN prestation_code = \'' . $value . '\' THEN montant_fg1 ELSE 0 END) AS montant_'.strtolower($value).'_fg1';
|
|
}
|
|
|
|
$ret = sprintf($update, implode(',' . PHP_EOL, $a1), implode(',' . PHP_EOL, $a2));
|
|
|
|
return $ret;
|
|
// ?>
|
|
EVAL]]]></value>
|
|
</PROPERTY>
|
|
<PROPERTY name="SIMULATION_PRESTA_FIELDS">
|
|
<value><![CDATA[[EVAL
|
|
// <?php
|
|
$pArray = array('ATU', 'FFM', 'SE1', 'SE2', 'SE3', 'SE4' ,'SE5', 'SE6', 'SE7', 'APE', 'AP2', 'FPI') ;
|
|
for ($i = 1; $i <= 23; $i++) {
|
|
array_push($pArray, 'D' . str_pad($i, 2, '0', STR_PAD_LEFT));
|
|
}
|
|
|
|
$a = array();
|
|
|
|
foreach ($pArray as $value) {
|
|
$a[] = '0 AS montant_'.strtolower($value).'_fg0';
|
|
$a[] = '0 AS montant_'.strtolower($value).'_fg1';
|
|
}
|
|
|
|
$ret = implode(',' . PHP_EOL, $a);
|
|
|
|
return $ret;
|
|
// ?>
|
|
EVAL]]]></value>
|
|
</PROPERTY>
|
|
<PROPERTY name="SIMULATION_PRESTA_DISPLAY">
|
|
<value><![CDATA[[EVAL
|
|
// <?php
|
|
$pArray = array('ATU', 'FFM', 'SE1', 'SE2', 'SE3', 'SE4' ,'SE5', 'SE6', 'SE7', 'APE', 'AP2', 'FPI') ;
|
|
for ($i = 1; $i <= 23; $i++) {
|
|
array_push($pArray, 'D' . str_pad($i, 2, '0', STR_PAD_LEFT));
|
|
}
|
|
|
|
$a = array();
|
|
|
|
$cpt = 0;
|
|
foreach ($pArray as $value) {
|
|
$a[] = "
|
|
UNION
|
|
SELECT 61 + ".str_replace(',', '.', $cpt*0.01).", '2', '".$value."',
|
|
montant_".strtolower($value)."_fg0, montant_".strtolower($value)."_fg1,
|
|
montant_".strtolower($value)."_fg1 - montant_".strtolower($value)."_fg0,
|
|
base.cti_division((montant_".strtolower($value)."_fg1 - montant_".strtolower($value)."_fg0), montant_".strtolower($value)."_fg0) * 100
|
|
,montant_".strtolower($value)."_fg1*prd
|
|
,montant_".strtolower($value)."_fg1 - montant_".strtolower($value)."_fg0 + (montant_".strtolower($value)."_fg1*prd)
|
|
,base.cti_division((montant_".strtolower($value)."_fg1 - montant_".strtolower($value)."_fg0 + (montant_".strtolower($value)."_fg1*prd)), montant_".strtolower($value)."_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
WHERE montant_".strtolower($value)."_fg1 != 0
|
|
";
|
|
$cpt++;
|
|
}
|
|
|
|
$ret = implode(PHP_EOL, $a);
|
|
|
|
return $ret;
|
|
// ?>
|
|
EVAL]]]></value>
|
|
</PROPERTY>
|
|
</VIEWPROPERTIES>
|
|
<SELECTIONS label="Paramètres de l'analyse" displayText="= var display:String = '';
|
|
if (SELECT.FINESS != '-1') {
|
|
display = display + ' Etablissement : #B#' + SELECT.FINESS_LABEL + '#/B#';
|
|
}
|
|
if (display != '') {
|
|
display = '#B#Filtres RSS#/B# = ' + display;
|
|
}
|
|
return display;
|
|
">
|
|
<GROUP label="Période">
|
|
<FIELD name="PERIODE" label="" UI="combo" tree="true" width="200" default="2023-03-01">
|
|
<OPTION dataLink="DATE_DEBUT" treeLevelField="lvl" dataField="cod" aliasField="alias" data2Field="mois" labelField="txt" />
|
|
</FIELD>
|
|
<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2024-02-29" >
|
|
<OPTION dataLink="DATE_FIN" treeLevelField="lvl" dataField="cod" aliasField="alias" data2Field="mois" labelField="txt" />
|
|
</FIELD>
|
|
</GROUP>
|
|
<GROUP label="FINESS">
|
|
<FIELD name="FINESS" label="" UI="combo" tree="true" width="400" default="-1" showIfNotDefault="true" >
|
|
<OPTION label="Pas de sélection" data="-1" treeLevel="1"/>
|
|
<OPTION dataLink="FINESS" dataField="cod" labelField="txt" treeLevelField="lvl"/>
|
|
</FIELD>
|
|
</GROUP>
|
|
</SELECTIONS>
|
|
<QUERIES>
|
|
<QUERY label="">
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
DROP TABLE IF EXISTS pmsi.pmsi000196
|
|
;
|
|
|
|
CREATE TABLE pmsi.pmsi000196 AS
|
|
SELECT
|
|
-- PRD N'EST UTILISÉ QUE POUR DES CHAMPS NON AFFICHES (VALEURS DU PRUDENTIEL)
|
|
-- PAR DÉFAUT LE PRD EST INCLUS DANS LE COEF CALCULÉ PAR SIMULATION
|
|
0.007 AS prd, -- Prudentiel
|
|
SUM(CASE WHEN mco = ANY (array['M', 'C', 'O']) THEN nb_rsa ELSE 0 END) AS nb_sejours,
|
|
SUM(CASE WHEN mco = ANY (array['M', 'C', 'O']) AND est_envoye IS DISTINCT FROM '1' AND COALESCE(montant_ghs_theorique_fg0,0) = 0 THEN nb_rsa ELSE 0 END) AS nb_sejours_facture_nulle,
|
|
SUM(CASE WHEN mco = ANY (array['M', 'C', 'O']) AND est_envoye IS DISTINCT FROM '1' AND
|
|
COALESCE(montant_ghs_theorique_fg0,0) <> 0 AND
|
|
(
|
|
mode_entree = '0'
|
|
AND mode_sortie = '0'
|
|
OR v_rss_1.rss_id = ANY (ARRAY(SELECT DISTINCT rss_id FROM pmsi.p_rss_rum WHERE mode_sortie = '0' OR mode_entree = '0')::bigint[])
|
|
)
|
|
THEN nb_rsa ELSE 0 END) AS nb_sejours_presta_inter,
|
|
SUM(CASE WHEN est_envoye = '1' THEN nb_rsa ELSE 0 END) AS nb_envoyes,
|
|
SUM(CASE WHEN est_envoye = '1' AND est_regroupe <> '1' THEN nb_rsa ELSE 0 END) AS nb_non_regroupes,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_rsa ELSE 0 END) AS nb_regroupes,
|
|
SUM(CASE WHEN est_regroupe = '1' AND p_simulation_fg2324.commentaire <> '' THEN nb_rsa ELSE 0 END) AS nb_translations,
|
|
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ghs_theorique_fg0 + montant_exb_fg0 + montant_exh_fg0 ELSE 0 END) as montant_ghsexh_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ghs_theorique_fg1 + montant_exb_fg1 + montant_exh_fg1 ELSE 0 END) as montant_ghsexh_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ghs_theorique_fg0 ELSE 0 END) AS montant_ghs_theorique_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ghs_theorique_fg1 ELSE 0 END) AS montant_ghs_theorique_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' AND is_raac ='is_raac' THEN montant_ghs_theorique_fg0 ELSE 0 END) AS montant_ghs_theorique_raac_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' AND is_raac ='is_raac' THEN montant_ghs_theorique_fg1 ELSE 0 END) AS montant_ghs_theorique_raac_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_exb_fg0 ELSE 0 END) AS montant_exb_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_exb_fg1 ELSE 0 END) AS montant_exb_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_exh_fg0 ELSE 0 END) AS montant_exh_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_exh_fg1 ELSE 0 END) AS montant_exh_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_src_fg0 ELSE 0 END) AS montant_src_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_src_fg1 ELSE 0 END) AS montant_src_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_stf_fg0 ELSE 0 END) AS montant_stf_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_stf_fg1 ELSE 0 END) AS montant_stf_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_rea_fg0 ELSE 0 END) AS montant_rea_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_rea_fg1 ELSE 0 END) AS montant_rea_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_nn1_fg0 + montant_nn2_fg0 + montant_nn3_fg0 ELSE 0 END) AS montant_nnx_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_nn1_fg1 + montant_nn2_fg1 + montant_nn3_fg1 ELSE 0 END) AS montant_nnx_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ant_fg0 ELSE 0 END) AS montant_ant_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ant_fg1 ELSE 0 END) AS montant_ant_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_rap_fg0 ELSE 0 END) AS montant_rap_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_rap_fg1 ELSE 0 END) AS montant_rap_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_sdc_fg0 ELSE 0 END) AS montant_sdc_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_sdc_fg1 ELSE 0 END) AS montant_sdc_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_tde_fg0 ELSE 0 END) AS montant_tde_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_tde_fg1 ELSE 0 END) AS montant_tde_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_tse_fg0 ELSE 0 END) AS montant_tse_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_tse_fg1 ELSE 0 END) AS montant_tse_fg1,
|
|
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_src_fg0 ELSE 0 END)::BIGINT AS nb_src_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_src_fg1 ELSE 0 END)::BIGINT AS nb_src_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_stf_fg0 ELSE 0 END)::BIGINT AS nb_stf_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_stf_fg1 ELSE 0 END)::BIGINT AS nb_stf_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_rea_fg0 ELSE 0 END)::BIGINT AS nb_rea_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_rea_fg1 ELSE 0 END)::BIGINT AS nb_rea_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_nn1_fg0 + nb_nn2_fg0 + nb_nn3_fg0 ELSE 0 END)::BIGINT AS nb_nnx_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_nn1_fg1 + nb_nn2_fg1 + nb_nn3_fg1 ELSE 0 END)::BIGINT AS nb_nnx_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_ant_fg0 ELSE 0 END)::BIGINT AS nb_ant_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_ant_fg1 ELSE 0 END)::BIGINT AS nb_ant_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_rap_fg0 ELSE 0 END)::BIGINT AS nb_rap_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_rap_fg1 ELSE 0 END)::BIGINT AS nb_rap_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_sdc_fg0 ELSE 0 END)::BIGINT AS nb_sdc_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_sdc_fg1 ELSE 0 END)::BIGINT AS nb_sdc_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_tde_fg0 ELSE 0 END)::BIGINT AS nb_tde_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_tde_fg1 ELSE 0 END)::BIGINT AS nb_tde_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_tse_fg0 ELSE 0 END)::BIGINT AS nb_tse_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN nb_tse_fg1 ELSE 0 END)::BIGINT AS nb_tse_fg1,
|
|
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_src_fg0 + montant_stf_fg0 + montant_rea_fg0 + montant_nn1_fg0 + montant_nn2_fg0 + montant_nn3_fg0 + montant_ant_fg0 + montant_rap_fg0 + montant_sdc_fg0 + montant_tde_fg0 + montant_tse_fg0 ELSE 0 END) AS montant_sup_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_src_fg1 + montant_stf_fg1 + montant_rea_fg1 + montant_nn1_fg1 + montant_nn2_fg1 + montant_nn3_fg1 + montant_ant_fg1 + montant_rap_fg1 + montant_sdc_fg1 + montant_tde_fg1 + montant_tse_fg1 ELSE 0 END) AS montant_sup_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' AND duree_sejour = 0 AND cmd_code <> '28' THEN montant_ghs_theorique_fg0 + montant_exb_fg0 + montant_exh_fg0 ELSE 0 END) as montant_ghsexh_a_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' AND duree_sejour = 0 AND cmd_code <> '28' THEN montant_ghs_theorique_fg1 + montant_exb_fg1 + montant_exh_fg1 ELSE 0 END) as montant_ghsexh_a_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' AND duree_sejour > 0 AND cmd_code <> '28' THEN montant_ghs_theorique_fg0 + montant_exb_fg0 + montant_exh_fg0 ELSE 0 END) as montant_ghsexh_h_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' AND duree_sejour > 0 AND cmd_code <> '28' THEN montant_ghs_theorique_fg1 + montant_exb_fg1 + montant_exh_fg1 ELSE 0 END) as montant_ghsexh_h_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' AND cmd_code = '28' THEN montant_ghs_theorique_fg0 + montant_exb_fg0 + montant_exh_fg0 ELSE 0 END) as montant_ghsexh_s_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' AND cmd_code = '28' THEN montant_ghs_theorique_fg1 + montant_exb_fg1 + montant_exh_fg1 ELSE 0 END) as montant_ghsexh_s_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ucd_fg0 ELSE 0 END) AS montant_ucd_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ucd_fg1 ELSE 0 END) AS montant_ucd_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_emi_fg0 ELSE 0 END) AS montant_emi_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_emi_fg1 ELSE 0 END) AS montant_emi_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ucd_fg0 + montant_emi_fg0 ELSE 0 END) AS montant_ucdemi_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ucd_fg1 + montant_emi_fg1 ELSE 0 END) AS montant_ucdemi_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_lpp_fg0 ELSE 0 END) AS montant_lpp_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_lpp_fg1 ELSE 0 END) AS montant_lpp_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_eti_fg0 ELSE 0 END) AS montant_eti_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_eti_fg1 ELSE 0 END) AS montant_eti_fg1,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_lpp_fg0 + montant_eti_fg0 ELSE 0 END) AS montant_lppeti_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_lpp_fg1 + montant_eti_fg1 ELSE 0 END) AS montant_lppeti_fg1,
|
|
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ghs_theorique_fg0 + montant_exb_fg0 + montant_exh_fg0 + montant_src_fg0 + montant_stf_fg0 + montant_rea_fg0 + montant_sdc_fg0 + montant_tde_fg0 + montant_tse_fg0 + montant_nn1_fg0 + montant_nn2_fg0 + montant_nn3_fg0 + montant_ant_fg0 + montant_rap_fg0 + montant_ucd_fg0 + montant_emi_fg0 + montant_lpp_fg0 + montant_eti_fg0 ELSE 0 END) AS montant_total_fg0,
|
|
SUM(CASE WHEN est_regroupe = '1' THEN montant_ghs_theorique_fg1 + montant_exb_fg1 + montant_exh_fg1 + montant_src_fg1 + montant_stf_fg1 + montant_rea_fg1 + montant_sdc_fg1 + montant_tde_fg1 + montant_tse_fg1 + montant_nn1_fg1 + montant_nn2_fg1 + montant_nn3_fg1 + montant_ant_fg1 + montant_rap_fg1 + montant_ucd_fg1 + montant_emi_fg1 + montant_lpp_fg1 + montant_eti_fg1 ELSE 0 END) AS montant_total_fg1,
|
|
|
|
SUM(CASE WHEN est_regroupe = '1' AND substr(ghm_code,1,5) = substr(ghm_fg1_code,1,5) THEN nb_rsa ELSE 0 END) AS nombre_racines_identiques,
|
|
SUM(CASE WHEN est_regroupe = '1' AND substr(ghm_code,1,5) <> substr(ghm_fg1_code,1,5) THEN nb_rsa ELSE 0 END) AS nombre_racines_differentes,
|
|
SUM(CASE WHEN est_regroupe = '1' AND substr(ghm_code,6,1) = '1' AND substr(ghm_fg1_code,6,1) = ANY (array['2','3','4']) THEN nb_rsa ELSE 0 END) AS nombre_1p,
|
|
SUM(CASE WHEN est_regroupe = '1' AND substr(ghm_code,6,1) = '2' AND substr(ghm_fg1_code,6,1) = ANY (array['3','4']) THEN nb_rsa ELSE 0 END) AS nombre_2p,
|
|
SUM(CASE WHEN est_regroupe = '1' AND substr(ghm_code,6,1) = '3' AND substr(ghm_fg1_code,6,1) = '4' THEN nb_rsa ELSE 0 END) AS nombre_3p,
|
|
SUM(CASE WHEN est_regroupe = '1' AND substr(ghm_code,6,1) = '1' AND substr(ghm_fg1_code,6,1) = 'T' THEN nb_rsa ELSE 0 END) AS nombre_1m,
|
|
SUM(CASE WHEN est_regroupe = '1' AND substr(ghm_code,6,1) = '2' AND substr(ghm_fg1_code,6,1) = ANY (array['1', 'T']) THEN nb_rsa ELSE 0 END) AS nombre_2m,
|
|
SUM(CASE WHEN est_regroupe = '1' AND substr(ghm_code,6,1) = '3' AND substr(ghm_fg1_code,6,1) = ANY (array['1', 'T', '2']) THEN nb_rsa ELSE 0 END) AS nombre_3m,
|
|
SUM(CASE WHEN est_regroupe = '1' AND substr(ghm_code,6,1) = '4' AND substr(ghm_fg1_code,6,1) = ANY (array['1', 'T','2','3']) THEN nb_rsa ELSE 0 END) AS nombre_4m,
|
|
|
|
0 AS montant_total_autres_prestations_fg0,
|
|
0 AS montant_total_autres_prestations_fg1,
|
|
|
|
0 AS montant_ucd_horsghm_fg0,
|
|
0 AS montant_ucd_horsghm_fg1,
|
|
0 AS montant_lpp_horsghm_fg0,
|
|
0 AS montant_lpp_horsghm_fg1,
|
|
|
|
[VIEW.SIMULATION_PRESTA_FIELDS]
|
|
|
|
FROM #V_RSS_X#
|
|
JOIN pmsi.p_simulation_fg2324 ON p_simulation_fg2324.rss_id = v_rss_1.rss_id
|
|
WHERE 1=1
|
|
[VIEW.SIMULATION_FILTERS]
|
|
;
|
|
|
|
-- LPP Déremboursés
|
|
DROP TABLE IF EXISTS pmsi000196_lpp_deremb
|
|
;
|
|
|
|
CREATE TEMP TABLE pmsi000196_lpp_deremb AS
|
|
SELECT t_lpp.oid as lpp_id
|
|
FROM pmsi.t_listes
|
|
JOIN pmsi.t_listes_contenu ON t_listes_contenu.liste_id = t_listes.oid
|
|
JOIN pmsi.t_listes_tables ON t_listes_tables.oid = t_listes.table_id
|
|
JOIN pmsi.t_lpp ON t_lpp.oid = t_listes_contenu.to_id
|
|
WHERE 1=1
|
|
AND t_listes.is_cti = '1'
|
|
AND t_listes_tables.name = 't_lpp'
|
|
AND t_listes.code = 'CTI_DR24_1L'
|
|
;
|
|
|
|
-- UCD Déremboursés
|
|
DROP TABLE IF EXISTS pmsi000196_ucd_deremb
|
|
;
|
|
|
|
CREATE TEMP TABLE pmsi000196_ucd_deremb AS
|
|
SELECT t_ucd.oid as ucd_id
|
|
FROM pmsi.t_listes
|
|
JOIN pmsi.t_listes_contenu ON t_listes_contenu.liste_id = t_listes.oid
|
|
JOIN pmsi.t_listes_tables ON t_listes_tables.oid = t_listes.table_id
|
|
JOIN pmsi.t_ucd ON t_ucd.oid = t_listes_contenu.to_id
|
|
WHERE 1=1
|
|
AND t_listes.is_cti = '1'
|
|
AND t_listes_tables.name = 't_ucd'
|
|
AND t_listes.code = 'CTI_DR24_1U'
|
|
;
|
|
|
|
-- Sélectionner tous les RSS qui n'ont pas de prestation GHS.
|
|
DROP TABLE IF EXISTS pmsi000196_rss_horsghs
|
|
;
|
|
|
|
CREATE TEMP TABLE pmsi000196_rss_horsghs AS
|
|
SELECT DISTINCT v_rss_1.rss_id
|
|
FROM pmsi.v_rss_1
|
|
LEFT JOIN pmsi.v_rsf_detail_1 ON 1=1
|
|
AND v_rsf_detail_1.rss_id = v_rss_1.rss_id
|
|
AND v_rsf_detail_1.prestation_code = 'GHS'
|
|
WHERE 1=1
|
|
AND v_rsf_detail_1.rss_id IS NULL
|
|
[VIEW.SIMULATION_FILTERS]
|
|
;
|
|
|
|
UPDATE pmsi.pmsi000196
|
|
SET
|
|
montant_ucd_horsghm_fg0 = subq.montant_ucd_horsghm_fg0,
|
|
montant_ucd_horsghm_fg1 = subq.montant_ucd_horsghm_fg1,
|
|
montant_ucdemi_fg0 = montant_ucdemi_fg0 + subq.montant_ucd_horsghm_fg0,
|
|
montant_ucdemi_fg1 = montant_ucdemi_fg1 + subq.montant_ucd_horsghm_fg1,
|
|
montant_total_fg0 = montant_total_fg0 + subq.montant_ucd_horsghm_fg0,
|
|
montant_total_fg1 = montant_total_fg1 + subq.montant_ucd_horsghm_fg1
|
|
FROM (
|
|
SELECT
|
|
coalesce(SUM(v_rss_ucd_1.montant_facture), 0) AS montant_ucd_horsghm_fg0,
|
|
coalesce(SUM(CASE WHEN v_rss_ucd_1.ucd_id IN (SELECT ucd_id FROM pmsi000196_ucd_deremb) THEN 0 ELSE v_rss_ucd_1.montant_facture END), 0) AS montant_ucd_horsghm_fg1
|
|
FROM pmsi.v_rss_ucd_1
|
|
JOIN pmsi000196_rss_horsghs ON pmsi000196_rss_horsghs.rss_id = v_rss_ucd_1.rss_id
|
|
WHERE 1=1
|
|
AND v_rss_ucd_1.type_ucd_code = 'SUS'::text
|
|
-- A commenter dans le cas ou le PMSI n'est pas à jour pour ne pas tenir compte de cette vue. AND v_rss_ucd_1.type_ucd_code = 'SUS'::text
|
|
|
|
) AS subq
|
|
;
|
|
|
|
UPDATE pmsi.pmsi000196
|
|
SET
|
|
montant_lpp_horsghm_fg0 = subq.montant_lpp_horsghm_fg0,
|
|
montant_lpp_horsghm_fg1 = subq.montant_lpp_horsghm_fg1,
|
|
montant_lppeti_fg0 = montant_lppeti_fg0 + subq.montant_lpp_horsghm_fg0,
|
|
montant_lppeti_fg1 = montant_lppeti_fg1 + subq.montant_lpp_horsghm_fg1,
|
|
montant_total_fg0 = montant_total_fg0 + subq.montant_lpp_horsghm_fg0,
|
|
montant_total_fg1 = montant_total_fg1 + subq.montant_lpp_horsghm_fg1
|
|
FROM (
|
|
SELECT
|
|
coalesce(SUM(v_rss_lpp_1.montant_facture), 0) AS montant_lpp_horsghm_fg0,
|
|
coalesce(SUM(CASE WHEN v_rss_lpp_1.lpp_id IN (SELECT lpp_id FROM pmsi000196_lpp_deremb) THEN 0 ELSE v_rss_lpp_1.montant_facture END), 0) AS montant_lpp_horsghm_fg1
|
|
FROM pmsi.v_rss_lpp_1
|
|
JOIN pmsi000196_rss_horsghs ON pmsi000196_rss_horsghs.rss_id = v_rss_lpp_1.rss_id
|
|
) AS subq
|
|
;
|
|
|
|
-- Calcul du coefficient prudentiel
|
|
|
|
DROP TABLE IF EXISTS w_coefficient_prudentiel
|
|
;
|
|
|
|
-- Récupération du coefficient ( geographique , prudentiel et pacte de responsabilité prealablement determiné pour GHS par le XML simulation)
|
|
CREATE TEMP TABLE w_coefficient_prudentiel AS
|
|
SELECT
|
|
MAX(coefficient_mco_fg1) AS coeff,
|
|
finess
|
|
FROM pmsi.p_simulation_fg2324
|
|
GROUP BY finess
|
|
;
|
|
|
|
DROP TABLE IF EXISTS pmsi000196_prestas_table
|
|
;
|
|
|
|
CREATE TEMP TABLE pmsi000196_prestas_table AS
|
|
SELECT
|
|
t_prestation_tarif.code AS prestation_code,
|
|
t_prestation_tarif.prestation_id,
|
|
t_prestation_tarif.tarif,
|
|
t_finess.code as finess
|
|
FROM pmsi.t_prestation_tarif
|
|
JOIN base.t_finess ON t_prestation_tarif.type_ets = CASE WHEN t_finess.type_etablissement = 1 THEN 1 ELSE 2 END
|
|
WHERE 1=1
|
|
AND t_prestation_tarif.date_fin = '2099-12-31' -- uniquement le dernier tarif en vigueur
|
|
AND (1!=1
|
|
OR t_prestation_tarif.code = ANY (array['ATU', 'FFM', 'SE1', 'SE2', 'SE3', 'SE4' ,'SE5', 'SE6', 'SE7', 'APE', 'AP2', 'FPI'])
|
|
OR t_prestation_tarif.code like 'D%'
|
|
)
|
|
GROUP BY 1,2,3,4
|
|
;
|
|
|
|
DROP TABLE IF EXISTS pmsi000196_prestas
|
|
;
|
|
|
|
CREATE TEMP TABLE pmsi000196_prestas AS
|
|
SELECT
|
|
v_rsf_detail_1.prestation_code,
|
|
SUM(v_rsf_detail_1.base_remboursement) AS montant_fg0,
|
|
SUM(
|
|
CASE WHEN pmsi000196_prestas_table.prestation_id IS NOT NULL
|
|
THEN v_rsf_detail_1.nombre * pmsi000196_prestas_table.tarif * w_coefficient_prudentiel.coeff * CASE WHEN v_rsf_detail_1.coefficient = 0.5 THEN 0.5 ELSE 1 END
|
|
ELSE v_rsf_detail_1.base_remboursement
|
|
END
|
|
) AS montant_fg1
|
|
FROM #V_RSS_X#
|
|
JOIN pmsi.v_rsf_detail_1 ON v_rsf_detail_1.rss_id = v_rss_1.rss_id
|
|
JOIN base.t_finess ON t_finess.oid = v_rss_1.finess_id
|
|
JOIN pmsi000196_prestas_table ON v_rsf_detail_1.prestation_code = pmsi000196_prestas_table.prestation_code AND t_finess.code = pmsi000196_prestas_table.finess
|
|
JOIN w_coefficient_prudentiel ON w_coefficient_prudentiel.finess = v_rss_1.finess
|
|
WHERE 1=1
|
|
[VIEW.SIMULATION_FILTERS]
|
|
GROUP BY 1
|
|
;
|
|
|
|
|
|
[VIEW.SIMULATION_UPDATE]
|
|
;
|
|
|
|
-- Màj de l'impact tarifaire total FG13
|
|
UPDATE pmsi.pmsi000196
|
|
SET
|
|
montant_total_fg0 = montant_total_fg0 + montant_total_autres_prestations_fg0,
|
|
montant_total_fg1 = montant_total_fg1 + montant_total_autres_prestations_fg1
|
|
;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
SELECT 16, '1.1', 'Nombre de séjours traités sur simulation FG 2324', nb_regroupes, nb_regroupes,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
|
|
SELECT 19, '9', '',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 20, '1', '(A) CHIFFRE D''AFFAIRE GHS',
|
|
montant_ghsexh_fg0
|
|
,montant_ghsexh_fg1
|
|
,montant_ghsexh_fg1 - montant_ghsexh_fg0
|
|
,base.cti_division((montant_ghsexh_fg1 - montant_ghsexh_fg0), montant_ghsexh_fg0) * 100
|
|
,montant_ghsexh_fg1 * prd
|
|
,montant_ghsexh_fg1 - montant_ghsexh_fg0 + (montant_ghsexh_fg1 * prd)
|
|
, base.cti_division( montant_ghsexh_fg1 - montant_ghsexh_fg0 + ( montant_ghsexh_fg1 * prd ), montant_ghsexh_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 21, '2.2', 'dont GHS Théorique',
|
|
montant_ghs_theorique_fg0, montant_ghs_theorique_fg1,
|
|
montant_ghs_theorique_fg1 - montant_ghs_theorique_fg0,
|
|
0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 21.2, '2.201', 'dont GHS Raac',
|
|
montant_ghs_theorique_raac_fg0, montant_ghs_theorique_raac_fg1,
|
|
montant_ghs_theorique_raac_fg1 - montant_ghs_theorique_raac_fg0,
|
|
0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
WHERE montant_ghs_theorique_raac_fg0 <> 0 OR montant_ghs_theorique_raac_fg1 <> 0
|
|
UNION
|
|
SELECT 22, '2.2', 'dont EXB',
|
|
montant_exb_fg0, montant_exb_fg1,
|
|
montant_exb_fg1 - montant_exb_fg0,
|
|
0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 23, '2.2', 'dont EXH',
|
|
montant_exh_fg0, montant_exh_fg1,
|
|
montant_exh_fg1 - montant_exh_fg0,
|
|
0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 29, '9', '',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 32, '2.2', 'dont Ambulatoires (0 nuit)',
|
|
montant_ghsexh_a_fg0, montant_ghsexh_a_fg1,
|
|
montant_ghsexh_a_fg1 - montant_ghsexh_a_fg0,
|
|
base.cti_division((montant_ghsexh_a_fg1 - montant_ghsexh_a_fg0), montant_ghsexh_a_fg0) * 100
|
|
,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 33, '2.2', 'dont Hospitalisés (1 nuit et plus)',
|
|
montant_ghsexh_h_fg0, montant_ghsexh_h_fg1,
|
|
montant_ghsexh_h_fg1 - montant_ghsexh_h_fg0,
|
|
base.cti_division((montant_ghsexh_h_fg1 - montant_ghsexh_h_fg0), montant_ghsexh_h_fg0) * 100
|
|
,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 34, '2.2', 'dont Séances',
|
|
montant_ghsexh_s_fg0,
|
|
montant_ghsexh_s_fg1,
|
|
montant_ghsexh_s_fg1 - montant_ghsexh_s_fg0 ,
|
|
base.cti_division(( montant_ghsexh_s_fg1 - montant_ghsexh_s_fg0), montant_ghsexh_s_fg0) * 100
|
|
,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 35, '0', '',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 35.1, '2.2', 'GHS moyen par séjour',
|
|
base.cti_division(montant_ghsexh_fg0,nb_regroupes::numeric)
|
|
,base.cti_division(montant_ghsexh_fg1,nb_regroupes::numeric)
|
|
,base.cti_division(montant_ghsexh_fg1,nb_regroupes) - base.cti_division(montant_ghsexh_fg0,nb_regroupes)
|
|
,base.cti_division (
|
|
base.cti_division(montant_ghsexh_fg1,nb_regroupes) - base.cti_division(montant_ghsexh_fg0,nb_regroupes)
|
|
,
|
|
base.cti_division(montant_ghsexh_fg0,nb_regroupes::numeric)
|
|
) * 100
|
|
,0
|
|
,0
|
|
,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 35.9, '9', '',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 41, '1', '(B) CHIFFRE D''AFFAIRE SUPPLEMENTS',
|
|
montant_sup_fg0, montant_sup_fg1,
|
|
montant_sup_fg1 - montant_sup_fg0,
|
|
base.cti_division((montant_sup_fg1 - montant_sup_fg0), montant_sup_fg0) * 100
|
|
,montant_sup_fg1*prd
|
|
,montant_sup_fg1 - montant_sup_fg0 + (montant_sup_fg1*prd)
|
|
,base.cti_division(montant_sup_fg1 - montant_sup_fg0 + (montant_sup_fg1*prd), montant_sup_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 42, '2', 'SRC' || chr(9)||chr(9)||chr(9) || '(nb N: ' || nb_src_fg0::text || ' / N+1: ' || nb_src_fg1::text || ')',
|
|
montant_src_fg0, montant_src_fg1,
|
|
montant_src_fg1 - montant_src_fg0,
|
|
base.cti_division((montant_src_fg1 - montant_src_fg0), montant_src_fg0) * 100
|
|
,montant_src_fg1*prd
|
|
,montant_src_fg1 - montant_src_fg0 + (montant_src_fg1*prd)
|
|
,base.cti_division(montant_src_fg1 - montant_src_fg0 + (montant_src_fg1*prd), montant_src_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 44, '2', 'STF' || chr(9)||chr(9)||chr(9) || '(nb N: ' || nb_stf_fg0::text || ' / N+1: ' || nb_stf_fg1::text || ')',
|
|
montant_stf_fg0, montant_stf_fg1,
|
|
montant_stf_fg1 - montant_stf_fg0,
|
|
base.cti_division((montant_stf_fg1 - montant_stf_fg0), montant_stf_fg0) * 100
|
|
,montant_stf_fg1*prd
|
|
,montant_stf_fg1 - montant_stf_fg0 + (montant_stf_fg1*prd)
|
|
,base.cti_division(montant_stf_fg1 - montant_stf_fg0 + (montant_stf_fg1*prd), montant_stf_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 45, '2', 'REA' || chr(9)||chr(9)||chr(9) || '(nb N: ' || nb_rea_fg0::text || ' / N+1: ' || nb_rea_fg1::text || ')',
|
|
montant_rea_fg0, montant_rea_fg1,
|
|
montant_rea_fg1 - montant_rea_fg0,
|
|
base.cti_division((montant_rea_fg1 - montant_rea_fg0), montant_rea_fg0) * 100
|
|
,montant_rea_fg1*prd
|
|
,montant_rea_fg1 - montant_rea_fg0 + (montant_rea_fg1*prd)
|
|
,base.cti_division(montant_rea_fg1 - montant_rea_fg0 + (montant_rea_fg1*prd), montant_rea_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 46, '2', 'NNX' || chr(9)||chr(9)||chr(9) || '(nb N: ' || nb_nnx_fg0::text || ' / N+1: ' || nb_nnx_fg1::text || ')',
|
|
montant_nnx_fg0,
|
|
montant_nnx_fg1,
|
|
montant_nnx_fg1 - montant_nnx_fg0,
|
|
base.cti_division((montant_nnx_fg1 - montant_nnx_fg0), montant_nnx_fg0) * 100
|
|
,montant_nnx_fg1*prd
|
|
,montant_nnx_fg1 - montant_nnx_fg0 + (montant_nnx_fg1*prd)
|
|
,base.cti_division(montant_nnx_fg1 - montant_nnx_fg0 + (montant_nnx_fg1*prd), montant_nnx_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 47, '2', 'ANT' || chr(9)||chr(9)||chr(9) || '(nb N: ' || nb_ant_fg0::text || ' / N+1: ' || nb_ant_fg1::text || ')',
|
|
montant_ant_fg0, montant_ant_fg1,
|
|
montant_ant_fg1 - montant_ant_fg0,
|
|
base.cti_division((montant_ant_fg1 - montant_ant_fg0), montant_ant_fg0) * 100
|
|
,montant_ant_fg1*prd
|
|
,montant_ant_fg1 - montant_ant_fg0 + (montant_ant_fg1*prd)
|
|
,base.cti_division(montant_ant_fg1 - montant_ant_fg0 + (montant_ant_fg1*prd), montant_ant_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 48, '2', 'RAP' || chr(9)||chr(9)||chr(9) || '(nb N: ' || nb_rap_fg0::text || ' / N+1: ' || nb_rap_fg1::text || ')',
|
|
montant_rap_fg0, montant_rap_fg1,
|
|
montant_rap_fg1 - montant_rap_fg0,
|
|
base.cti_division((montant_rap_fg1 - montant_rap_fg0), montant_rap_fg0) * 100
|
|
,montant_rap_fg1*prd
|
|
,montant_rap_fg1 - montant_rap_fg0 + (montant_rap_fg1*prd)
|
|
,base.cti_division(montant_rap_fg1 - montant_rap_fg0 + (montant_rap_fg1*prd), montant_rap_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 48.1, '2', 'SDC' || chr(9)||chr(9)||chr(9) || '(nb N: ' || nb_sdc_fg0::text || ' / N+1: ' || nb_sdc_fg1::text || ')',
|
|
montant_sdc_fg0, montant_sdc_fg1,
|
|
montant_sdc_fg1 - montant_sdc_fg0,
|
|
base.cti_division((montant_sdc_fg1 - montant_sdc_fg0), montant_sdc_fg0) * 100
|
|
,montant_sdc_fg1*prd
|
|
,montant_sdc_fg1 - montant_sdc_fg0 + (montant_sdc_fg1*prd)
|
|
,base.cti_division(montant_sdc_fg1 - montant_sdc_fg0 + (montant_sdc_fg1*prd), montant_sdc_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 48.2, '2', 'TDE' || chr(9)||chr(9)||chr(9) || '(nb N: ' || nb_tde_fg0::text || ' / N+1: ' || nb_tde_fg1::text || ')',
|
|
montant_tde_fg0, montant_tde_fg1,
|
|
montant_tde_fg1 - montant_tde_fg0,
|
|
base.cti_division((montant_tde_fg1 - montant_tde_fg0), montant_tde_fg0) * 100
|
|
,montant_tde_fg1*prd
|
|
,montant_tde_fg1 - montant_tde_fg0 + (montant_tde_fg1*prd)
|
|
,base.cti_division(montant_tde_fg1 - montant_tde_fg0 + (montant_tde_fg1*prd), montant_tde_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 48.3, '2', 'TSE' || chr(9)||chr(9)||chr(9) || '(nb N: ' || nb_tse_fg0::text || ' / N+1: ' || nb_tse_fg1::text || ')',
|
|
montant_tse_fg0, montant_tse_fg1,
|
|
montant_tse_fg1 - montant_tse_fg0,
|
|
base.cti_division((montant_tse_fg1 - montant_tse_fg0), montant_tse_fg0) * 100
|
|
,montant_tse_fg1*prd
|
|
,montant_tse_fg1 - montant_tse_fg0 + (montant_tse_fg1*prd)
|
|
,base.cti_division(montant_tse_fg1 - montant_tse_fg0 + (montant_tse_fg1*prd), montant_tse_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 49, '9', '',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 50, '1', '(C) CHIFFRE D''AFFAIRE UCD et LPP',
|
|
montant_ucdemi_fg0 + montant_lppeti_fg0,
|
|
montant_ucdemi_fg1 + montant_lppeti_fg1,
|
|
(montant_ucdemi_fg1 + montant_lppeti_fg1) - (montant_ucdemi_fg0 + montant_lppeti_fg0),
|
|
base.cti_division((montant_ucdemi_fg1 + montant_lppeti_fg1) - (montant_ucdemi_fg0 + montant_lppeti_fg0), (montant_ucdemi_fg0 + montant_lppeti_fg0)) * 100
|
|
,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 51, '2', 'UCD',
|
|
montant_ucd_fg0, montant_ucd_fg1,
|
|
montant_ucd_fg1 - montant_ucd_fg0,
|
|
base.cti_division((montant_ucd_fg1 - montant_ucd_fg0), montant_ucd_fg0) * 100
|
|
,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 52, '2', 'UCD (sans GHS associé)',
|
|
montant_ucd_horsghm_fg0, montant_ucd_horsghm_fg1,
|
|
montant_ucd_horsghm_fg1 - montant_ucd_horsghm_fg0,
|
|
base.cti_division((montant_ucd_horsghm_fg1 - montant_ucd_horsghm_fg0), montant_ucd_horsghm_fg0) * 100
|
|
,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 53, '2', 'EMI',
|
|
montant_emi_fg0, montant_emi_fg1,
|
|
montant_emi_fg1 - montant_emi_fg0,
|
|
base.cti_division((montant_emi_fg1 - montant_emi_fg0), montant_emi_fg0) * 100
|
|
,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 54, '2', 'LPP',
|
|
montant_lpp_fg0, montant_lpp_fg1,
|
|
montant_lpp_fg1 - montant_lpp_fg0,
|
|
base.cti_division((montant_lpp_fg1 - montant_lpp_fg0), montant_lpp_fg0) * 100
|
|
,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 55, '2', 'LPP (sans GHS associé)',
|
|
montant_lpp_horsghm_fg0, montant_lpp_horsghm_fg1,
|
|
montant_lpp_horsghm_fg1 - montant_lpp_horsghm_fg0,
|
|
base.cti_division((montant_lpp_horsghm_fg1 - montant_lpp_horsghm_fg0), montant_lpp_horsghm_fg0) * 100
|
|
,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 59, '9', '',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 60, '1', '(D) CHIFFRE D''AFFAIRE ATU, FFM, SEh et Dxx',
|
|
montant_total_autres_prestations_fg0,
|
|
montant_total_autres_prestations_fg1,
|
|
montant_total_autres_prestations_fg1 - montant_total_autres_prestations_fg0,
|
|
base.cti_division(montant_total_autres_prestations_fg1 - montant_total_autres_prestations_fg0, montant_total_autres_prestations_fg0) * 100
|
|
,montant_total_autres_prestations_fg1*prd
|
|
,montant_total_autres_prestations_fg1 - montant_total_autres_prestations_fg0 + (montant_total_autres_prestations_fg1*prd)
|
|
,base.cti_division(montant_total_autres_prestations_fg1 - montant_total_autres_prestations_fg0 + (montant_total_autres_prestations_fg1*prd), montant_total_autres_prestations_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
|
|
[VIEW.SIMULATION_PRESTA_DISPLAY]
|
|
|
|
UNION
|
|
SELECT 69, '9', '',0,0,0,0,0,0,0
|
|
UNION
|
|
|
|
SELECT 73, '1.2', 'TOTAL : (A) + (B) + (D) et prise en compte écart (C)',
|
|
(montant_total_fg0 - (montant_ucdemi_fg0 + montant_lppeti_fg0))
|
|
,(montant_total_fg1 - (montant_ucdemi_fg1 + montant_lppeti_fg1))
|
|
,(montant_total_fg1 - (montant_ucdemi_fg1 + montant_lppeti_fg1)) - (montant_total_fg0 - (montant_ucdemi_fg0 + montant_lppeti_fg0))
|
|
, base.cti_division(
|
|
(montant_total_fg1 - (montant_ucdemi_fg1 + montant_lppeti_fg1)) - (montant_total_fg0 - (montant_ucdemi_fg0 + montant_lppeti_fg0))
|
|
, (montant_total_fg0 - (montant_ucdemi_fg0 + montant_lppeti_fg0))
|
|
) * 100
|
|
,(montant_ghsexh_fg1 + montant_sup_fg1 + montant_total_autres_prestations_fg1)*prd
|
|
, (montant_total_fg1 - (montant_ucdemi_fg1 + montant_lppeti_fg1))
|
|
-
|
|
(montant_total_fg0 - (montant_ucdemi_fg0 + montant_lppeti_fg0))
|
|
+
|
|
(montant_ghsexh_fg1*prd + montant_sup_fg1*prd + montant_total_autres_prestations_fg1*prd )
|
|
,base.cti_division(
|
|
(montant_total_fg1 - (montant_ucdemi_fg1 + montant_lppeti_fg1))
|
|
-
|
|
(montant_total_fg0 - (montant_ucdemi_fg0 + montant_lppeti_fg0))
|
|
+
|
|
(montant_ghsexh_fg1 + montant_sup_fg1 + montant_total_autres_prestations_fg1)*prd
|
|
,
|
|
(montant_total_fg0 - (montant_ucdemi_fg0 + montant_lppeti_fg0))
|
|
) * 100
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 74, '2', 'TOTAL : (A) + (B) + (C) + (D)',
|
|
montant_total_fg0
|
|
,montant_total_fg1
|
|
,montant_total_fg1 - montant_total_fg0
|
|
, base.cti_division( montant_total_fg1 - montant_total_fg0, montant_total_fg0) * 100
|
|
,(montant_ghsexh_fg1 + montant_sup_fg1 + montant_total_autres_prestations_fg1)*prd
|
|
,(montant_total_fg1 - montant_total_fg0) + (montant_ghsexh_fg1 + montant_sup_fg1 + montant_total_autres_prestations_fg1)*prd
|
|
,base.cti_division(montant_total_fg1 - montant_total_fg0 + (montant_ghsexh_fg1 + montant_sup_fg1 + montant_total_autres_prestations_fg1)*prd , montant_total_fg0) * 100
|
|
FROM pmsi.pmsi000196
|
|
|
|
ORDER BY 1
|
|
;
|
|
|
|
]]></select>
|
|
<FIELDS>
|
|
<FIELD name="LIG"/>
|
|
<FIELD name="LVL"/>
|
|
<FIELD name="TXT"/>
|
|
<FIELD name="VAL12"/>
|
|
<FIELD name="VAL13"/>
|
|
<FIELD name="ECART"/>
|
|
<FIELD name="PECART"/>
|
|
<FIELD name="PRUD"/>
|
|
<FIELD name="EPRUD"/>
|
|
<FIELD name="PPRUD"/>
|
|
</FIELDS>
|
|
</SQL>
|
|
</QUERY>
|
|
<QUERY >
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
SELECT 10, '1', 'REGROUPEMENT',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 11, '2', 'Nombre de séjours (ou séances)', nb_sejours, nb_sejours, 0, 0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 12, '3', 'Nombre de séjours (ou séances) exclus : sans GHS facturé', nb_sejours_facture_nulle, nb_sejours_facture_nulle,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 13, '3', 'Nombre de séjours (ou séances) exclus : prestations inter_etablissement', nb_sejours_presta_inter, nb_sejours_presta_inter,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 14, '3', 'Nombre de séjours (ou séances) avec GHS', nb_envoyes, nb_envoyes,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 15, '3', 'Nombre de séjours avec GHS non regroupés FG 232324', nb_non_regroupes, nb_non_regroupes,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 16, '2', 'Nombre de séjours traités sur simulation FG 2324', nb_regroupes, nb_regroupes,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 17, '3', 'Dont regroupés après translation de diagnostic', nb_translations, nb_translations,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 19, '9', '',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 79, '3', '',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 80, '1', 'EVOLUTION RACINES DE GHM',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 81, '3', 'Nombre de racines identiques', 0, nombre_racines_identiques,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 82, '3', 'Nombre de racines différentes', 0, nombre_racines_differentes,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 85, '3', '',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 86, '3', '',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 90, '1', 'EVOLUTION SEVERITES',0,0,0,0,0,0,0
|
|
UNION
|
|
SELECT 91, '2', 'Evolution positive', 0, nombre_1p + nombre_2p + nombre_3p, 0, 0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 92, '3', 'Sévérité 1 vers 2,3,4', 0, nombre_1p,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 93, '3', 'Sévérité 2 vers 3,4', 0, nombre_2p,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 94, '3', 'Sévérité 3 vers 4', 0, nombre_3p,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 95, '2', 'Evolution négative', 0, nombre_1m + nombre_2m + nombre_3m + nombre_4m,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 96, '3', 'Sévérité 1 vers T', 0, nombre_1m,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 97, '3', 'Sévérité 2 vers 1', 0, nombre_2m,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 98, '3', 'Sévérité 3 vers 1,2', 0, nombre_3m,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
UNION
|
|
SELECT 99, '3', 'Sévérité 4 vers 1,2,3', 0, nombre_4m,0,0,0,0,0
|
|
FROM pmsi.pmsi000196
|
|
ORDER BY 1
|
|
;
|
|
|
|
]]></select>
|
|
<FIELDS>
|
|
<FIELD name="LIG"/>
|
|
<FIELD name="LVL"/>
|
|
<FIELD name="TXT"/>
|
|
<FIELD name="VAL12"/>
|
|
<FIELD name="VAL13"/>
|
|
<FIELD name="ECART"/>
|
|
<FIELD name="PECART"/>
|
|
<FIELD name="PRUD"/>
|
|
<FIELD name="EPRUD"/>
|
|
<FIELD name="PPRUD"/>
|
|
</FIELDS>
|
|
</SQL>
|
|
</QUERY>
|
|
<QUERY type="comboLink" name="DATE_DEBUT" >
|
|
<SQL select="SELECT date, alias, texte, mois, level
|
|
FROM pmsi.v_calendrier_1
|
|
WHERE date_part('year',date) IN (SELECT annee_sortie FROM pmsi.p_simulation_fg2324 WHERE est_envoye <> '0' GROUP BY 1)" >
|
|
<FIELDS>
|
|
<FIELD name="cod" />
|
|
<FIELD name="alias" />
|
|
<FIELD name="txt" />
|
|
<FIELD name="mois" />
|
|
<FIELD name="lvl" />
|
|
</FIELDS>
|
|
</SQL>
|
|
</QUERY>
|
|
<QUERY type="comboLink" name="DATE_FIN" >
|
|
<SQL select="SELECT date, alias, texte, mois, level
|
|
FROM pmsi.v_calendrier_2
|
|
WHERE date_part('year',date) IN (SELECT annee_sortie FROM pmsi.p_simulation_fg2324 WHERE est_envoye <> '0' GROUP BY 1)" >
|
|
<FIELDS>
|
|
<FIELD name="cod" />
|
|
<FIELD name="alias" />
|
|
<FIELD name="txt" />
|
|
<FIELD name="mois" />
|
|
<FIELD name="lvl" />
|
|
</FIELDS>
|
|
</SQL>
|
|
</QUERY>
|
|
<QUERY type="comboLink" name="FINESS" >
|
|
<SQL select="SELECT code, texte, level FROM pmsi.v_finess_1" >
|
|
<FIELDS>
|
|
<FIELD name="cod" />
|
|
<FIELD name="txt" />
|
|
<FIELD name="lvl" />
|
|
</FIELDS>
|
|
</SQL>
|
|
</QUERY>
|
|
</QUERIES>
|
|
<PRESENTATION>
|
|
<ONGLET excelLabel="Synthèse" label="Synthèse C.A." queryNumber="0">
|
|
<DATAGRID
|
|
title=""
|
|
headerHeight="54"
|
|
sortable="false"
|
|
variableRowHeight="true"
|
|
backgroundColor="#F2F1EF"
|
|
>
|
|
<ROWSTYLE name="fontSize" value="12"/>
|
|
<ROWSTYLE name="rowHeight" value="20" condition="ROW.LVL == '0'"/>
|
|
<ROWSTYLE name="rowHeight" value="25" condition="ROW.LVL == '1'"/>
|
|
<ROWSTYLE name="rowHeight" value="25" condition="ROW.LVL == '1.1'"/>
|
|
<ROWSTYLE name="rowHeight" value="28" condition="ROW.LVL == '1.2'"/>
|
|
<ROWSTYLE name="fontSize" value="15" condition="ROW.LVL == '1.2'"/>
|
|
<ROWSTYLE name="fontSize" value="14" condition="ROW.LVL == '1'"/>
|
|
<ROWSTYLE name="fontSize" value="12" condition="ROW.LVL == '2.2'"/>
|
|
<ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '1'"/>
|
|
<ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '1.2'"/>
|
|
<ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '2.2'"/>
|
|
|
|
<COLUMN dataField="LVL" minWidth="50" type="Char" visible="false" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
|
|
</COLUMN>
|
|
<COLUMN dataField="TXT" type="Char" minWidth="800" width= "600" headerText="" textAlign="left" totalFunction="text" otherFunction="text" otherComplement="Autres">
|
|
<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2'"/>
|
|
<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2.2'"/>
|
|
<CELLSTYLE name="paddingLeft" value="30" condition="ROW.LVL == '3'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.2'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.1'"/>
|
|
</COLUMN>
|
|
<COLUMN dataField="VAL12" minWidth="120" type="Number" outputFormat="= if(ROW.LVL != '1.1'){ return '# E';}else{return '#'}" headerText="'Facturation' +'\n'+ 'FG-MCO 2324' +'\n'+ 'Tarifs 2023'" visible="true" textAlign="right" totalFunction="sum" otherFunction="sum" headerTextCalc="true" >
|
|
<HEADERCELLSTYLE name="color" value="0x000000"/>
|
|
<CELLSTYLE name="color" value="0x000000"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.2'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.1'"/>
|
|
</COLUMN>
|
|
<COLUMN dataField="VAL13" minWidth="120" type="Number" outputFormat="= if(ROW.LVL != '1.1'){ return '# E';}else{return '#'}" headerText="'Simulation' +'\n'+ 'FG-MCO 2324' +'\n'+ 'Tarifs 2024'" visible="true" textAlign="right" totalFunction="sum" otherFunction="sum" headerTextCalc="true" >
|
|
<HEADERCELLSTYLE name="color" value="0xff5001"/>
|
|
<CELLSTYLE name="color" value="0xff5001"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.2'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.1'"/>
|
|
</COLUMN>
|
|
<COLUMN dataField="ECART" minWidth="120" type="Number" outputFormat="= if(ROW.LVL != '1.1'){ return '# E';}else{return '#'}" headerText="'Ecart' +'\n'+ '(2024 - 2023)'" visible="true" textAlign="right" totalFunction="sum" otherFunction="sum" headerTextCalc="true" >
|
|
<CELLSTYLE name="color" value="#1F3A93"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.2'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.1'"/>
|
|
</COLUMN>
|
|
<COLUMN dataField="PECART" minWidth="120" type="Number" outputFormat="#,0%" headerText="'% Ecart' " visible="true" textAlign="right" totalFunction="sum" otherFunction="sum" headerTextCalc="true" >
|
|
<CELLSTYLE name="color" value="#1F3A93"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.2'"/>
|
|
<CELLSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.1'"/>
|
|
</COLUMN>
|
|
</DATAGRID>
|
|
</ONGLET>
|
|
<ONGLET excelLabel="Synthèse" label="Synthèse Séjours" queryNumber="1">
|
|
<DATAGRID
|
|
title=""
|
|
headerHeight="54"
|
|
sortable="false"
|
|
variableRowHeight="true"
|
|
>
|
|
<ROWSTYLE name="fontSize" value="12"/>
|
|
<ROWSTYLE name="rowHeight" value="20" condition="ROW.LVL == '0'"/>
|
|
<ROWSTYLE name="rowHeight" value="25" condition="ROW.LVL == '1'"/>
|
|
<ROWSTYLE name="rowHeight" value="25" condition="ROW.LVL == '1.1'"/>
|
|
<ROWSTYLE name="fontSize" value="14" condition="ROW.LVL == '1'"/>
|
|
<ROWSTYLE name="fontSize" value="12" condition="ROW.LVL == '2.2'"/>
|
|
<ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '1'"/>
|
|
<ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '2'"/>
|
|
<ROWSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1'"/>
|
|
<ROWSTYLE name="backgroundColor" value="#DCDCDC" condition="ROW.LVL == '1.1'"/>
|
|
<ROWSTYLE name="backgroundColor" value="#F2F1EF" condition="ROW.LVL != '1.1' && ROW.LVL != '1'"/>
|
|
|
|
<COLUMN dataField="LVL" minWidth="50" type="Char" visible="false" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
|
|
</COLUMN>
|
|
<COLUMN dataField="TXT" type="Char" minWidth="400" headerText="" textAlign="left" totalFunction="text" otherFunction="text" otherComplement="Autres">
|
|
<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2'"/>
|
|
<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2.2'"/>
|
|
<CELLSTYLE name="paddingLeft" value="30" condition="ROW.LVL == '3'"/>
|
|
</COLUMN>
|
|
<COLUMN dataField="VAL13" minWidth="80" type="Number" outputFormat="#" headerText="'Simulation' +'\n'+ 'FG-MCO 2324' +'\n'" visible="true" textAlign="right" totalFunction="sum" otherFunction="sum" headerTextCalc="true" >
|
|
<CELLSTYLE name="color" value="0x000000"/>
|
|
<CELLSTYLE name="fontSize" value="13"/>
|
|
</COLUMN>
|
|
</DATAGRID>
|
|
</ONGLET>
|
|
</PRESENTATION>
|
|
</VUE>
|