<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
<VUE name="PMSI000379"
|
|
label="PMSI. Justificatif REA par critères"
|
|
title="= 'Justificatif REA (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ') - ' + SELECT.VERSION_GROUPAGE_LABEL"
|
|
database="iCTI"
|
|
swf="*CTI_view1"
|
|
softCode="iCTI_pmsi"
|
|
globals="PMSI_globals.XML"
|
|
componentsFile="PMSI_components.XML">
|
|
|
|
<VIEWPROPERTIES>
|
|
<PROPERTY name="NO_RSS_SELECT">
|
|
<value><![CDATA[[EVAL
|
|
|
|
if (('[NO_RSS]' + 0) != 0) {return 'AND v_rss_1.no_rss = ' . ('[NO_RSS]' + 0);}
|
|
return '';
|
|
|
|
EVAL]]]></value>
|
|
</PROPERTY>
|
|
<PROPERTY name="NOM_SELECT">
|
|
<value><![CDATA[[EVAL
|
|
|
|
if ('[NOM]' != '') {return 'AND p_identites.nom ILIKE ' .''. '[NOM]%' .''. ' ' ;}
|
|
return '';
|
|
|
|
EVAL]]]></value>
|
|
</PROPERTY>
|
|
<PROPERTY name="IND_REA_SELECT">
|
|
<value><![CDATA[[EVAL
|
|
|
|
if ('[IND_REA]' == 'FRE') {return 'AND temp_pmsi000378_rss.rea_facturee_nb_rss <> 0 ';}
|
|
if ('[IND_REA]' == 'FLE') {return 'AND temp_pmsi000378_rss.rea_facturable_nb_rss <> 0 ';}
|
|
if ('[IND_REA]' == 'ECA') {return 'AND (temp_pmsi000378_rss.rea_facturable_nb_rss <> temp_pmsi000378_rss.rea_facturee_nb_rss
|
|
OR temp_pmsi000378_rss.rea_facturable_nb_prestations <> temp_pmsi000378_rss.rea_facturee_nb_prestations
|
|
OR temp_pmsi000378_rss.rea_facturable_base_remboursement <> temp_pmsi000378_rss.rea_facturee_base_remboursement
|
|
) ';}
|
|
if ('[IND_REA]' == 'SRCNF') {return 'AND temp_pmsi000378_rss.rea_facturable_nb_rss = 0 AND temp_pmsi000378_rss.rea_passage_nb_rss <> 0 ';}
|
|
if ('[IND_REA]' == 'NSRCF') {return 'AND temp_pmsi000378_rss.rea_facturable_sans_rea_ni_igs_nb_rss <> 0 ';}
|
|
return '';
|
|
|
|
EVAL]]]></value>
|
|
</PROPERTY>
|
|
</VIEWPROPERTIES>
|
|
|
|
<SELECTIONS label="Paramètres de l'analyse" displayText="= var display:String = '';
|
|
if (SELECT.IND_REA != '-1') {
|
|
display = display + '#B#' + SELECT.IND_REA_LABEL + '#/B#';
|
|
}
|
|
return display;">
|
|
<GROUP label="Date sortie">
|
|
<FIELD name="ALIAS_PERIODE" label="" UI="combo" width="220" default="CUM_LAST_MONTH" tree="true" globalListProvider="ALIAS_PERIODE" />
|
|
<FIELD name="PERIODE" label="" UI="combo" tree="true" width="200" default="2014-01-01" globalListProvider="DATE_DEBUT" printable="false" />
|
|
<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2014-12-31" globalListProvider="DATE_FIN" printable="false" />
|
|
</GROUP>
|
|
|
|
<GROUP label="Indicateur REA">
|
|
<FIELD name="IND_REA" label="" UI="combo" default="-1" printable="false">
|
|
<OPTION label="Pas de filtre" data="-1" />
|
|
<OPTION label="REA facturées" data="FRE" />
|
|
<OPTION label="REA facturables" data="FLE" />
|
|
<OPTION label="Ecarts REA facturables/facturées" data="ECA" />
|
|
<OPTION label="Séjours Passés en REA mais non facturables" data="SRCNF" />
|
|
<OPTION label="Séjours Non passés en REA avec un acte éligible" data="NSRCF" />
|
|
</FIELD>
|
|
</GROUP>
|
|
|
|
<GROUP label="N° de RSS">
|
|
<FIELD name="NO_RSS" label="" UI="number" width="100" default="" showIfNotDefault="true" />
|
|
</GROUP>
|
|
<GROUP label="Ou Nom">
|
|
<FIELD name="NOM" label="" UI="text" width="200" default="" showIfNotDefault="true" />
|
|
</GROUP>
|
|
</SELECTIONS>
|
|
|
|
<SELECTIONS componentName="FILTRES_RSS_SELECTIONS" />
|
|
|
|
<QUERIES>
|
|
<QUERY label="">
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<com><![CDATA[
|
|
|
|
listes utilisées par l'étude REA
|
|
|
|
]]></com>
|
|
<select><![CDATA[
|
|
|
|
DROP TABLE IF EXISTS w_listes_rea;
|
|
CREATE TEMP TABLE w_listes_rea AS
|
|
SELECT liste_code, to_id FROM pmsi.v_listes_3 WHERE v_listes_3.liste_code IN ('CTI_VIT15_10A', 'CTI_VIT15_20A');
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
DROP TABLE IF EXISTS temp_pmsi000378_rss;
|
|
CREATE TEMP TABLE temp_pmsi000378_rss(
|
|
finess character(9),
|
|
no_rss bigint,
|
|
oid bigint,
|
|
date_sortie date,
|
|
age integer,
|
|
rea_facturee_nb_rss numeric(5) DEFAULT 0,
|
|
rea_facturee_nb_prestations numeric(5) DEFAULT 0,
|
|
rea_facturee_base_remboursement numeric(11, 2) DEFAULT 0,
|
|
rea_facturable_nb_rss numeric(5) DEFAULT 0,
|
|
rea_facturable_nb_prestations numeric(5) DEFAULT 0,
|
|
rea_facturable_base_remboursement numeric(11, 2) DEFAULT 0,
|
|
rea_facturable_regle character(1) DEFAULT '',
|
|
rea_facturable_regle_justificatif character varying(255) DEFAULT '',
|
|
rea_passage_nb_rss numeric(5) DEFAULT 0,
|
|
rea_passage_duree_sejour numeric(5) DEFAULT 0,
|
|
rea_passage_base_remboursement numeric(11, 2) DEFAULT 0,
|
|
rea_facturable_sans_rea_ni_igs_nb_rss numeric(5) DEFAULT 0
|
|
);
|
|
|
|
CREATE INDEX temp_pmsi000378_rss_i1
|
|
ON temp_pmsi000378_rss
|
|
USING btree
|
|
(oid);
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
|
|
DROP TABLE IF EXISTS temp_pmsi000378_rss_detail;
|
|
CREATE TEMP TABLE temp_pmsi000378_rss_detail
|
|
(
|
|
date_debut date,
|
|
date_fin date,
|
|
nombre numeric(13,2) DEFAULT 1,
|
|
prix_unitaire numeric(13,2) DEFAULT 0,
|
|
base_remboursement numeric(13,2) DEFAULT 0,
|
|
coefficient_mco numeric(5,4) DEFAULT 0,
|
|
prestation_id bigint DEFAULT 0,
|
|
regle character(1) DEFAULT '',
|
|
rss_id bigint DEFAULT 0
|
|
);
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<com><![CDATA[
|
|
|
|
DOSSIERS DE LA PERIODE
|
|
|
|
]]></com>
|
|
<select><![CDATA[
|
|
|
|
INSERT INTO temp_pmsi000378_rss(finess, no_rss, oid, date_sortie, age)
|
|
SELECT
|
|
v_rss_1.finess,
|
|
v_rss_1.no_rss,
|
|
v_rss_1.rss_id,
|
|
v_rss_1.date_sortie,
|
|
v_rss_1.age
|
|
FROM
|
|
[VIEW.V_RSS_VIEW_OPTIMIZE]
|
|
WHERE
|
|
mois_sortie IN ([VIEW.PERIODE_MOIS_LIST])
|
|
AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
|
|
[VIEW.FILTRE_RSS_SELECT];
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<com><![CDATA[
|
|
|
|
DOSSIERS FACTURES REA
|
|
|
|
]]></com>
|
|
<select><![CDATA[
|
|
|
|
UPDATE temp_pmsi000378_rss SET
|
|
rea_facturee_nb_rss = nb_rss,
|
|
rea_facturee_nb_prestations = nb_prestations,
|
|
rea_facturee_base_remboursement = base_remboursement
|
|
|
|
FROM
|
|
(
|
|
SELECT
|
|
rss_id,
|
|
1 as nb_rss,
|
|
SUM(nombre) as nb_prestations,
|
|
SUM(base_remboursement) as base_remboursement
|
|
FROM
|
|
pmsi.p_rsf_detail
|
|
JOIN temp_pmsi000378_rss ON temp_pmsi000378_rss.oid = p_rsf_detail.rss_id
|
|
JOIN pmsi.t_prestations ON t_prestations.oid = p_rsf_detail.prestation_id
|
|
WHERE 1=1
|
|
AND est_ligne_rss = '1'
|
|
AND t_prestations.code = 'REA'
|
|
GROUP BY rss_id
|
|
) subview
|
|
WHERE subview.rss_id = temp_pmsi000378_rss.oid;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
UPDATE temp_pmsi000378_rss SET
|
|
rea_passage_nb_rss = nb_rss,
|
|
rea_passage_duree_sejour = duree_sejour
|
|
FROM
|
|
( SELECT
|
|
rss_id,
|
|
1 as nb_rss,
|
|
SUM(duree_sejour) as duree_sejour
|
|
FROM
|
|
pmsi.p_rss_rum
|
|
JOIN temp_pmsi000378_rss ON temp_pmsi000378_rss.oid = p_rss_rum.rss_id
|
|
JOIN pmsi.t_unites_medicales ON p_rss_rum.unite_medicale_id = t_unites_medicales.oid
|
|
WHERE
|
|
t_unites_medicales.type_autorisation LIKE '01%'
|
|
GROUP BY rss_id
|
|
) subview
|
|
WHERE subview.rss_id = temp_pmsi000378_rss.oid;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
UPDATE pmsi.p_rss_rum SET
|
|
supplement_code = ''
|
|
FROM
|
|
temp_pmsi000378_rss
|
|
WHERE
|
|
p_rss_rum.rss_id = temp_pmsi000378_rss.oid
|
|
AND (supplement_code IS NULL OR supplement_code <> '');
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
DROP TABLE IF EXISTS w_rss_rea_1;
|
|
DROP TABLE IF EXISTS w_rss_rea_2;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<com><![CDATA[
|
|
|
|
Dossiers avec un acte dans la liste 1 de l''annexe 10 de la norme B2
|
|
|
|
]]></com>
|
|
<select><![CDATA[
|
|
|
|
CREATE TEMP TABLE w_rss_rea_1 AS
|
|
SELECT
|
|
rss_id,
|
|
no_rum
|
|
FROM
|
|
pmsi.p_rss_actes
|
|
JOIN temp_pmsi000378_rss ON p_rss_actes.rss_id = temp_pmsi000378_rss.oid
|
|
JOIN w_listes_rea ON w_listes_rea.to_id = p_rss_actes.acte_id
|
|
WHERE 1=1
|
|
AND temp_pmsi000378_rss.date_sortie BETWEEN '20120101'::date AND '20990228'::date
|
|
AND w_listes_rea.liste_code = 'CTI_VIT15_10A';
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<com><![CDATA[
|
|
|
|
Dossiers avec un acte de la liste 2 de l''annexe 10 realisé au moins 3 fois
|
|
|
|
]]></com>
|
|
<select><![CDATA[
|
|
|
|
CREATE TEMP TABLE w_rss_rea_2 AS
|
|
SELECT
|
|
rss_id,
|
|
no_rum,
|
|
acte_id,
|
|
count(*)
|
|
FROM
|
|
pmsi.p_rss_actes
|
|
JOIN temp_pmsi000378_rss ON p_rss_actes.rss_id = temp_pmsi000378_rss.oid
|
|
JOIN w_listes_rea ON w_listes_rea.to_id = p_rss_actes.acte_id
|
|
WHERE 1=1
|
|
AND temp_pmsi000378_rss.date_sortie BETWEEN '20120101'::date AND '20990228'::date
|
|
AND w_listes_rea.liste_code = 'CTI_VIT15_20A'
|
|
GROUP BY rss_id, no_rum, acte_id
|
|
HAVING count(*) >= 3;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<com><![CDATA[
|
|
|
|
Positionne un supplement REA1 si acte dans liste 1 annexe 10 et ((IGS2 >= 15 et age >= 18) ou (age < 18) et RUM avec autorisation '01'
|
|
|
|
]]></com>
|
|
<select><![CDATA[
|
|
UPDATE pmsi.p_rss_rum SET
|
|
supplement_code = 'REA1'
|
|
FROM
|
|
temp_pmsi000378_rss
|
|
, w_rss_rea_1
|
|
WHERE
|
|
temp_pmsi000378_rss.oid = p_rss_rum.rss_id
|
|
AND temp_pmsi000378_rss.date_sortie BETWEEN '20120101'::date AND '20990228'::date
|
|
AND supplement_code = ''
|
|
AND ((p_rss_rum.igs2 >= 15 AND temp_pmsi000378_rss.age >= 18) OR temp_pmsi000378_rss.age < 18)
|
|
AND unite_medicale_id IN (SELECT oid FROM pmsi.t_unites_medicales WHERE type_autorisation LIKE '01%')
|
|
AND p_rss_rum.rss_id = w_rss_rea_1.rss_id
|
|
AND p_rss_rum.no_rum = w_rss_rea_1.no_rum;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<com><![CDATA[
|
|
|
|
Positionne un supplement REA2 si acte dans liste 2 annexe 7 realise 3 fois et ((IGS2 >= 15 et age >= 18) ou (age < 18) et RUM avec autorisation '01'
|
|
|
|
]]></com>
|
|
<select><![CDATA[
|
|
|
|
UPDATE pmsi.p_rss_rum SET
|
|
supplement_code = 'REA2'
|
|
FROM
|
|
temp_pmsi000378_rss
|
|
, w_rss_rea_2
|
|
WHERE
|
|
temp_pmsi000378_rss.oid = p_rss_rum.rss_id
|
|
AND temp_pmsi000378_rss.date_sortie BETWEEN '20120101'::date AND '20990228'::date
|
|
AND supplement_code = ''
|
|
AND ((p_rss_rum.igs2 >= 15 AND temp_pmsi000378_rss.age >= 18) OR temp_pmsi000378_rss.age < 18)
|
|
AND unite_medicale_id IN (SELECT oid FROM pmsi.t_unites_medicales WHERE type_autorisation LIKE '01%')
|
|
AND p_rss_rum.rss_id = w_rss_rea_2.rss_id
|
|
AND p_rss_rum.no_rum = w_rss_rea_2.no_rum;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
INSERT INTO temp_pmsi000378_rss_detail(
|
|
date_debut, date_fin, regle, nombre, prix_unitaire, base_remboursement, coefficient_mco, rss_id)
|
|
|
|
SELECT
|
|
p_rss_rum.date_entree,
|
|
p_rss_rum.date_sortie,
|
|
SUBSTR(supplement_code, 4 , 1),
|
|
CASE WHEN p_rss_rum.date_sortie > p_rss_rum.date_entree THEN
|
|
CASE WHEN p_rss_rum.mode_sortie <> '9' THEN p_rss_rum.date_sortie - p_rss_rum.date_entree
|
|
ELSE p_rss_rum.date_sortie - p_rss_rum.date_entree + 1 END
|
|
ELSE 1 END,
|
|
CASE
|
|
WHEN t_finess.type_etablissement = '1' THEN
|
|
CASE
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_prive_1 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_prive_1 THEN t_prestations.tarif_prive_1
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_prive_2 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_prive_2 THEN t_prestations.tarif_prive_2
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_prive_3 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_prive_3 THEN t_prestations.tarif_prive_3
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_prive_4 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_prive_4 THEN t_prestations.tarif_prive_4
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_prive_5 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_prive_5 THEN t_prestations.tarif_prive_5
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_prive_6 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_prive_6 THEN t_prestations.tarif_prive_6
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_prive_7 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_prive_7 THEN t_prestations.tarif_prive_7
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_prive_8 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_prive_8 THEN t_prestations.tarif_prive_8
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_prive_9 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_prive_9 THEN t_prestations.tarif_prive_9
|
|
ELSE 0::numeric END
|
|
ELSE
|
|
CASE
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_public_1 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_public_1 THEN t_prestations.tarif_public_1
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_public_2 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_public_2 THEN t_prestations.tarif_public_2
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_public_3 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_public_3 THEN t_prestations.tarif_public_3
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_public_4 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_public_4 THEN t_prestations.tarif_public_4
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_public_5 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_public_5 THEN t_prestations.tarif_public_5
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_public_6 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_public_6 THEN t_prestations.tarif_public_6
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_public_7 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_public_7 THEN t_prestations.tarif_public_7
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_public_8 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_public_8 THEN t_prestations.tarif_public_8
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_prestations.date_debut_public_9 AND temp_pmsi000378_rss.date_sortie <= t_prestations.date_fin_public_9 THEN t_prestations.tarif_public_9
|
|
ELSE 0::numeric END
|
|
END,
|
|
0,
|
|
1,
|
|
temp_pmsi000378_rss.oid
|
|
FROM
|
|
pmsi.p_rss_rum
|
|
JOIN temp_pmsi000378_rss ON temp_pmsi000378_rss.oid = p_rss_rum.rss_id
|
|
JOIN base.t_finess ON t_finess.code = temp_pmsi000378_rss.finess
|
|
,pmsi.t_prestations
|
|
WHERE 1=1
|
|
AND supplement_code <> ''
|
|
AND t_prestations.code = 'REA';
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
UPDATE temp_pmsi000378_rss_detail SET nombre = temp_pmsi000378_rss_detail.nombre - 1
|
|
FROM temp_pmsi000378_rss, temp_pmsi000378_rss_detail temp_pmsi000378_rss_detail2
|
|
WHERE
|
|
temp_pmsi000378_rss_detail.rss_id = temp_pmsi000378_rss.oid
|
|
AND temp_pmsi000378_rss_detail.date_debut <> temp_pmsi000378_rss_detail.date_fin
|
|
AND temp_pmsi000378_rss_detail2.rss_id = temp_pmsi000378_rss.oid
|
|
AND temp_pmsi000378_rss_detail2.date_debut = temp_pmsi000378_rss_detail.date_debut
|
|
AND temp_pmsi000378_rss_detail2.date_fin = temp_pmsi000378_rss_detail2.date_debut;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
UPDATE temp_pmsi000378_rss_detail
|
|
SET
|
|
base_remboursement =
|
|
round( CASE
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_finess.date_debut_coefficient_mco_9 THEN t_finess.coefficient_mco_9
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_finess.date_debut_coefficient_mco_8 THEN t_finess.coefficient_mco_8
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_finess.date_debut_coefficient_mco_7 THEN t_finess.coefficient_mco_7
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_finess.date_debut_coefficient_mco_6 THEN t_finess.coefficient_mco_6
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_finess.date_debut_coefficient_mco_5 THEN t_finess.coefficient_mco_5
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_finess.date_debut_coefficient_mco_4 THEN t_finess.coefficient_mco_4
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_finess.date_debut_coefficient_mco_3 THEN t_finess.coefficient_mco_3
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_finess.date_debut_coefficient_mco_2 THEN t_finess.coefficient_mco_2
|
|
WHEN temp_pmsi000378_rss.date_sortie >= t_finess.date_debut_coefficient_mco_1 THEN t_finess.coefficient_mco_1
|
|
ELSE 1::numeric
|
|
END, 2) * prix_unitaire * nombre
|
|
FROM
|
|
pmsi.t_prestations, base.t_finess, temp_pmsi000378_rss
|
|
WHERE temp_pmsi000378_rss_detail.prestation_id = t_prestations.oid
|
|
AND temp_pmsi000378_rss_detail.rss_id = temp_pmsi000378_rss.oid
|
|
AND temp_pmsi000378_rss.finess = t_finess.code;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
UPDATE temp_pmsi000378_rss SET
|
|
rea_facturable_nb_rss = nb_rss,
|
|
rea_facturable_nb_prestations = nb_prestations,
|
|
rea_facturable_base_remboursement = base_remboursement,
|
|
rea_facturable_regle = regle
|
|
FROM
|
|
(SELECT rss_id, 1 as nb_rss, SUM(nombre) as nb_prestations, SUM(base_remboursement) as base_remboursement, MAX(regle) as regle
|
|
FROM temp_pmsi000378_rss_detail
|
|
GROUP BY rss_id) subview
|
|
WHERE subview.rss_id = temp_pmsi000378_rss.oid;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
UPDATE temp_pmsi000378_rss SET
|
|
rea_facturable_regle_justificatif = 'Passé en REA non facturable ('::text ||' éligible)'::text
|
|
FROM w_rss_rea_1
|
|
WHERE w_rss_rea_1.rss_id = temp_pmsi000378_rss.oid
|
|
AND rea_facturee_nb_rss = 0 AND rea_facturable_nb_rss = 0 AND rea_passage_nb_rss > 0;
|
|
|
|
UPDATE temp_pmsi000378_rss SET
|
|
rea_facturable_regle_justificatif = 'Passé en REA non facturable ('::text || ' éligible)'::text
|
|
FROM w_rss_rea_2
|
|
WHERE w_rss_rea_2.rss_id = temp_pmsi000378_rss.oid
|
|
AND rea_facturee_nb_rss = 0 AND rea_facturable_nb_rss = 0 AND rea_passage_nb_rss > 0;
|
|
|
|
UPDATE temp_pmsi000378_rss SET
|
|
rea_facturable_regle_justificatif = 'Passé en REA non facturable'
|
|
WHERE rea_facturee_nb_rss = 0 AND rea_facturable_nb_rss = 0 AND rea_passage_nb_rss > 0 AND rea_facturable_regle_justificatif = '';
|
|
|
|
UPDATE temp_pmsi000378_rss SET
|
|
rea_facturable_regle_justificatif = 'Règle '::text || rea_facturable_regle::text
|
|
FROM w_rss_rea_1
|
|
WHERE w_rss_rea_1.rss_id = temp_pmsi000378_rss.oid
|
|
AND rea_facturable_regle = '1';
|
|
|
|
UPDATE temp_pmsi000378_rss SET
|
|
rea_facturable_regle_justificatif = 'Règle '::text || rea_facturable_regle::text
|
|
FROM w_rss_rea_2
|
|
WHERE w_rss_rea_2.rss_id = temp_pmsi000378_rss.oid
|
|
AND rea_facturable_regle = '2';
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
UPDATE temp_pmsi000378_rss SET
|
|
rea_facturable_sans_rea_ni_igs_nb_rss = 1,
|
|
rea_facturable_regle_justificatif = 'Vérifier REA ('::text || ' éligible)'::text
|
|
FROM w_rss_rea_1
|
|
WHERE w_rss_rea_1.rss_id = temp_pmsi000378_rss.oid
|
|
AND rea_passage_nb_rss = 0;
|
|
|
|
UPDATE temp_pmsi000378_rss SET
|
|
rea_facturable_sans_rea_ni_igs_nb_rss = 1,
|
|
rea_facturable_regle_justificatif = 'Vérifier REA ('::text || ' éligible)'::text
|
|
FROM w_rss_rea_2
|
|
WHERE w_rss_rea_2.rss_id = temp_pmsi000378_rss.oid
|
|
AND rea_passage_nb_rss = 0;
|
|
|
|
DELETE FROM temp_pmsi000378_rss
|
|
WHERE
|
|
rea_facturee_nb_rss = 0
|
|
AND rea_facturable_nb_rss = 0
|
|
AND rea_passage_nb_rss = 0
|
|
AND rea_facturable_sans_rea_ni_igs_nb_rss = 0;
|
|
|
|
]]></select>
|
|
</SQL>
|
|
<SQL optimizer="V_RSS_X" cacheEnabled="false">
|
|
<select><![CDATA[
|
|
|
|
(SELECT
|
|
v_rss_1.rss_id,
|
|
v_rss_1.no_rss,
|
|
v_rss_1.en_cours_texte_tres_court,
|
|
CASE WHEN p_patients.no_patient > 0 THEN p_patients.no_patient ELSE 0 END,
|
|
v_rss_1.no_sejour_administratif,
|
|
v_rss_1.finess,
|
|
p_identites.nom::text || ' '::text || p_identites.prenom::text,
|
|
ghm_code,
|
|
diagnostic_principal_code,
|
|
acte_principal_code,
|
|
v_rss_1.date_entree,
|
|
v_rss_1.date_sortie,
|
|
v_rss_1.age,
|
|
igs2,
|
|
CASE
|
|
WHEN v_rss_1.age BETWEEN 40 AND 59 THEN igs2 - 7
|
|
WHEN v_rss_1.age BETWEEN 60 AND 69 THEN igs2 - 12
|
|
WHEN v_rss_1.age BETWEEN 70 AND 74 THEN igs2 - 15
|
|
WHEN v_rss_1.age BETWEEN 75 AND 79 THEN igs2 - 16
|
|
WHEN v_rss_1.age >= 80 THEN igs2 - 18
|
|
ELSE igs2 END as igs_sauf_age,
|
|
temp_pmsi000378_rss.rea_facturee_nb_prestations,
|
|
temp_pmsi000378_rss.rea_facturee_base_remboursement,
|
|
temp_pmsi000378_rss.rea_facturable_nb_prestations,
|
|
temp_pmsi000378_rss.rea_facturable_base_remboursement,
|
|
temp_pmsi000378_rss.rea_facturable_nb_prestations - temp_pmsi000378_rss.rea_facturee_nb_prestations,
|
|
temp_pmsi000378_rss.rea_facturable_base_remboursement - temp_pmsi000378_rss.rea_facturee_base_remboursement,
|
|
|
|
temp_pmsi000378_rss.rea_facturable_regle_justificatif,
|
|
v_rss_1.mode_entree::text || v_rss_1.provenance::text
|
|
|
|
FROM
|
|
[VIEW.V_RSS_VIEW_OPTIMIZE]
|
|
JOIN temp_pmsi000378_rss ON v_rss_1.rss_id = temp_pmsi000378_rss.oid
|
|
JOIN pmsi.p_identites ON v_rss_1.rss_id = p_identites.rss_id
|
|
JOIN pmsi.p_patients ON v_rss_1.patient_id = p_patients.oid
|
|
WHERE 1=1
|
|
AND mois_sortie IN ([VIEW.PERIODE_MOIS_LIST])
|
|
AND v_rss_1.date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
|
|
[VIEW.FILTRE_RSS_SELECT]
|
|
[VIEW.IND_REA_SELECT]
|
|
)
|
|
|
|
UNION ALL
|
|
|
|
(SELECT
|
|
-9999997,
|
|
null,
|
|
'',
|
|
0,
|
|
'',
|
|
'',
|
|
count(DISTINCT v_rss_1.rss_id)::text || ' RSS dans la sélection'::text ,
|
|
'',
|
|
'',
|
|
'',
|
|
null,
|
|
null,
|
|
0,
|
|
0,
|
|
0,
|
|
|
|
sum(temp_pmsi000378_rss.rea_facturee_nb_prestations),
|
|
sum(temp_pmsi000378_rss.rea_facturee_base_remboursement),
|
|
sum(temp_pmsi000378_rss.rea_facturable_nb_prestations),
|
|
sum(temp_pmsi000378_rss.rea_facturable_base_remboursement),
|
|
sum(temp_pmsi000378_rss.rea_facturable_nb_prestations - temp_pmsi000378_rss.rea_facturee_nb_prestations),
|
|
sum(temp_pmsi000378_rss.rea_facturable_base_remboursement - temp_pmsi000378_rss.rea_facturee_base_remboursement),
|
|
|
|
'',
|
|
''::text
|
|
|
|
FROM
|
|
[VIEW.V_RSS_VIEW_OPTIMIZE]
|
|
JOIN temp_pmsi000378_rss ON v_rss_1.rss_id = temp_pmsi000378_rss.oid
|
|
JOIN pmsi.p_identites ON v_rss_1.rss_id = p_identites.rss_id
|
|
JOIN pmsi.p_patients ON v_rss_1.patient_id = p_patients.oid
|
|
WHERE 1=1
|
|
AND mois_sortie IN ([VIEW.PERIODE_MOIS_LIST])
|
|
AND v_rss_1.date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
|
|
[VIEW.FILTRE_RSS_SELECT]
|
|
[VIEW.IND_REA_SELECT]
|
|
)
|
|
|
|
UNION ALL
|
|
|
|
(SELECT
|
|
-9999999,
|
|
null,
|
|
'',
|
|
0,
|
|
'',
|
|
'',
|
|
SUM(temp_pmsi000378_rss.rea_facturee_nb_rss)::text || ' RSS facturés, '::text || SUM(temp_pmsi000378_rss.rea_facturable_nb_rss)::text || ' RSS facturables'::text,
|
|
'',
|
|
'',
|
|
'',
|
|
null,
|
|
null,
|
|
0,
|
|
0,
|
|
0,
|
|
|
|
sum(temp_pmsi000378_rss.rea_facturee_nb_prestations),
|
|
sum(temp_pmsi000378_rss.rea_facturee_base_remboursement),
|
|
sum(temp_pmsi000378_rss.rea_facturable_nb_prestations),
|
|
sum(temp_pmsi000378_rss.rea_facturable_base_remboursement),
|
|
sum(temp_pmsi000378_rss.rea_facturable_nb_prestations - temp_pmsi000378_rss.rea_facturee_nb_prestations),
|
|
sum(temp_pmsi000378_rss.rea_facturable_base_remboursement - temp_pmsi000378_rss.rea_facturee_base_remboursement),
|
|
|
|
'',
|
|
''::text
|
|
|
|
FROM
|
|
[VIEW.V_RSS_VIEW_OPTIMIZE]
|
|
JOIN temp_pmsi000378_rss ON v_rss_1.rss_id = temp_pmsi000378_rss.oid
|
|
JOIN pmsi.p_identites ON v_rss_1.rss_id = p_identites.rss_id
|
|
JOIN pmsi.p_patients ON v_rss_1.patient_id = p_patients.oid
|
|
WHERE 1=1
|
|
AND mois_sortie IN ([VIEW.PERIODE_MOIS_LIST])
|
|
AND v_rss_1.date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
|
|
[VIEW.FILTRE_RSS_SELECT]
|
|
)
|
|
|
|
ORDER BY 2;
|
|
|
|
]]></select>
|
|
<FIELDS>
|
|
<FIELD name="OID" />
|
|
<FIELD name="RSS" />
|
|
<FIELD name="EXP" />
|
|
<FIELD name="PAT" />
|
|
<FIELD name="SEJ" />
|
|
<FIELD name="FIN" />
|
|
<FIELD name="NOM" ifHideNames="Non autorisé" />
|
|
<FIELD name="GHM" />
|
|
<FIELD name="DIAGP" />
|
|
<FIELD name="ACTEP" />
|
|
<FIELD name="DATE" />
|
|
<FIELD name="DATS" />
|
|
<FIELD name="AGE" />
|
|
<FIELD name="IGS" />
|
|
<FIELD name="IGSAGE" />
|
|
|
|
<FIELD name="FREDUR" />
|
|
<FIELD name="FRECA" />
|
|
<FIELD name="FLEDUR" />
|
|
<FIELD name="FLECA" />
|
|
<FIELD name="ECADUR" />
|
|
<FIELD name="ECACA" />
|
|
|
|
<FIELD name="COMMEN" />
|
|
<FIELD name="PROV" />
|
|
</FIELDS>
|
|
</SQL>
|
|
</QUERY>
|
|
</QUERIES>
|
|
|
|
<PRESENTATION>
|
|
<VIEWLINKS>
|
|
<VIEWLINK label="Détail RSS" shortLabel="Détail RSS" view="PMSI000006.XML">
|
|
<ARG name="OID" value="ROW.OID" />
|
|
</VIEWLINK>
|
|
<VIEWREF label="Listes des Actes Marqueurs de REA "
|
|
shortLabel="Actes Marqueurs REA" url="http://www.ctisante.com/references/pmsi/ACTES_marqueurs_REA.xls" rowContext="false" />
|
|
</VIEWLINKS>
|
|
<ONGLET excelLabel="Liste RSS" >
|
|
<DATAGRID title="" total="true" key="RSS" showOthers="true" headerHeight="54"
|
|
totalRowInRows="= ROW.OID == '-9999999'"
|
|
selectRowInRows="= ROW.OID == '-9999997'">
|
|
<ROWSTYLE name="fontSize" value="11" />
|
|
<FOOTERROWSTYLE name="fontSize" value="11" />
|
|
|
|
<COLUMN dataField="OID" type="Char" visible="false" />
|
|
<COLUMN dataField="FIN" width="60" type="Char" visible="true" headerText="Etablissement" textAlign="left" visibleCondition="ENV.CONSOLIDATION == '1'" otherFunction="text" totalFunction="text" totalComplement="" />
|
|
<COLUMN dataField="RSS" width="60" type="Number" visible="true" outputFormat="#" headerText="N° RSS" textAlign="center" otherFunction="text" totalFunction="text" totalComplement="" />
|
|
<COLUMN dataField="SEJ" width="90" type="Char" visible="true" outputFormat="#" headerText="N° séjour" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="" />
|
|
<COLUMN dataField="NOM" minWidth="100" maxWidth="200" type="Char" visible="true" headerText="Nom" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="*ROW" />
|
|
|
|
<COLUMN dataField="AGE" width="30" type="Number" outputFormat="#" fixed="false" visible="true" headerText="Age" textAlign="right" otherFunction="text" totalFunction="text" />
|
|
<COLUMN dataField="DATE" width="60" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" visible="true" fixed="false" headerText="Date entrée" textAlign="left" otherFunction="text" totalFunction="text" />
|
|
<COLUMN dataField="DATS" width="60" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" visible="true" fixed="false" headerText="Date sortie" textAlign="left" otherFunction="text" totalFunction="text" />
|
|
<COLUMN dataField="PROV" width="60" type="Char" visible="true" fixed="false" headerText="Provenance" textAlign="left" otherFunction="text" totalFunction="text" />
|
|
<COLUMN dataField="EXP" width="30" type="Char" visible="true" fixed="false" headerText="EXP" textAlign="left" otherFunction="text" totalFunction="text" />
|
|
<COLUMN dataField="GHM" width="50" type="Char" visible="true" fixed="false" headerText="GHM" textAlign="left" otherFunction="text" totalFunction="text" />
|
|
<COLUMN dataField="DIAGP" width="40" type="Char" fixed="false" visible="true" headerText="Diag P" textAlign="left" otherFunction="text" totalFunction="text" />
|
|
<COLUMN dataField="ACTEP" width="60" type="Char" fixed="false" visible="true" headerText="Acte P" textAlign="left" otherFunction="text" totalFunction="text" />
|
|
<COLUMN dataField="IGS" width="30" type="Number" outputFormat="#" fixed="false" visible="true" headerText="IGS" textAlign="right" otherFunction="text" totalFunction="text" />
|
|
<COLUMN dataField="IGSAGE" width="40" type="Number" outputFormat="#" fixed="false" visible="true" headerText="IGS
sauf
âge" textAlign="right" otherFunction="text" totalFunction="text" />
|
|
|
|
<COLUMN dataField="COMMEN" minWidth="150" maxWidth="200" type="Char" visible="true" fixed="false" headerText="Règle" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="*ROW" />
|
|
<COLUMN dataField="FLEDUR" width="60" type="Number" outputFormat="#" fixed="false" headerText="Durée
facturable" textAlign="right" totalFunction="sum" otherFunction="sum" />
|
|
<COLUMN dataField="FLECA" width="70" type="Number" outputFormat="#E" fixed="false" headerText="C.A.
facturable" textAlign="right" totalFunction="sum" otherFunction="sum" />
|
|
|
|
<COLUMN dataField="FREDUR" width="60" type="Number" outputFormat="#" fixed="false" headerText="Durée
facturée" textAlign="right" totalFunction="sum" otherFunction="sum" />
|
|
<COLUMN dataField="FRECA" width="70" type="Number" outputFormat="#E" fixed="false" headerText="C.A.
facturé" textAlign="right" totalFunction="sum" otherFunction="sum" />
|
|
|
|
<COLUMN dataField="ECADUR" width="50" type="Number" outputFormat="#" fixed="false" headerText="Ecart
durée" textAlign="right" totalFunction="sum" otherFunction="sum" />
|
|
<COLUMN dataField="ECACA" width="70" type="Number" outputFormat="#E" fixed="false" headerText="Ecart
C.A." textAlign="right" totalFunction="sum" otherFunction="sum" />
|
|
</DATAGRID>
|
|
</ONGLET>
|
|
</PRESENTATION>
|
|
</VUE>
|