<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000038" label="PMSI. Justificatif CA par RSS" title="= 'Justificatif CA par RSS (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ') - ' + SELECT.VERSION_GROUPAGE_LABEL" database="iCTI" swf="*CTI_view1" softCode="iCTI_pmsi" typeEts="" globals="PMSI_globals.XML" componentsFile="PMSI_components.XML" helpDokuWIkiDir="pmsi:sejours_analyse_globale:rss:chiffre_d_affaire_rss:" helpDokuWIkiFile="pmsi000038"  helpFile="iCTI_PMSI_PMSI000038.HTML">
	<VIEWPROPERTIES>
		<PROPERTYx dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres de l'analyse" displayText="">
		<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>
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2014-12-31" globalListProvider="DATE_FIN" printable="false">
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_RSS_SELECTIONS"/>
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_RSS_X" select="
				(SELECT v_rss_1.rss_id,
						v_rss_1.no_rss,
						v_rss_1.no_sejour_administratif,
						v_rss_1.finess,
						identite_nom || ' ' || identite_prenom,
						no_patient,
						ghm_code,
						ghs_code,
						cas_code,
						medecin_reference_rss_nom,
						diagnostic_principal_code, 
						date_sortie, sexe, age,
						nb_rsa, nb_rum,  
						base_remboursement, 
						t2a_facture,
						dmi_facture,
						phc_facture, 
						base_remboursement - t2a_facture - dmi_facture - phc_facture,
						ca_exh, 
						ca_exb, 
						duree_sejour, nb_seances, nb_exh, nb_exb, 
						honoraires_factures, 
						v_rss_1.taux_remboursement,
                        v_rss_1.type_sejour_ovalide,
						etat_sejour_code,
                        severite_cti_code,
                        mode_entree  || provenance,
						etablissement_provenance_code,
						mode_sortie || destination,
						etablissement_destination_code,
                        conversion_hp_hc_code,
                        raac_code,
						ca_ghs_sans_coefficient,
						ca_ghs,
						ca_ghs_theorique,
						rescrit_tarif_code,
						adm_prod_reshospi_code,
						contexte_pat_code,
						nb_intervention_code,
						ca_ghs_raac,
						(CASE WHEN ca_ghs_raac != 0 THEN CA_GHS - CA_GHS_RAAC ELSE 0 END)

				FROM #V_RSS_X#
				WHERE 
					 date_sortie &gt;= '[PERIODE]'	AND date_sortie &lt;='[TOPERIODE]'
					
					[VIEW.FILTRE_RSS_SELECT]
				)
				

				UNION ALL
				
				(SELECT -9999999, COUNT(DISTINCT v_rss_1.no_rss), '', '', 
						SUM(nb_rsa)::text || ' séjours, ' || COUNT(DISTINCT patient_id)::text || ' patients' ,0, 
						'', '', '', '','',
						null, '', 0,
						SUM(nb_rsa), SUM(nb_rum),  SUM(base_remboursement), SUM(t2a_facture), SUM(dmi_facture),
						SUM(phc_facture), 
						SUM(base_remboursement - t2a_facture - dmi_facture - phc_facture),
						SUM(ca_exh), SUM(ca_exb), SUM(duree_sejour), SUM(nb_seances), 
						SUM(nb_exh), SUM(nb_exb), SUM(honoraires_factures), null,''::text,''::text,''::text,''::text,''::text,''::text,''::text,
                        SUM(CASE WHEN conversion_hp_hc_code not in ('0','') THEN 1 ELSE 0 END)::text,
                        SUM(CASE WHEN raac_code not in ('0','') THEN 1 ELSE 0 END)::text,SUM (ca_ghs_sans_coefficient),
                        SUM(ca_ghs),
                        SUM(ca_ghs_theorique),
						SUM(CASE WHEN rescrit_tarif_code not in ('0','') THEN 1 ELSE 0 END)::text,
						SUM(CASE WHEN adm_prod_reshospi_code not in ('0','') THEN 1 ELSE 0 END)::text,
						SUM(CASE WHEN contexte_pat_code not in ('0','') THEN 1 ELSE 0 END)::text,
						SUM(CASE WHEN nb_intervention_code not in ('0','') THEN 1 ELSE 0 END)::text,
						SUM(CA_GHS_RAAC),
						SUM(CASE WHEN ca_ghs_raac != 0 THEN CA_GHS - CA_GHS_RAAC ELSE 0 END)
				FROM #V_RSS_X#
				WHERE 
					 date_sortie &gt;= '[PERIODE]'	AND date_sortie &lt;='[TOPERIODE]'
					
					[VIEW.FILTRE_RSS_SELECT]

				)
					
				ORDER BY 2
				">
				<FIELDS>
					<FIELD name="OID"/>
					<FIELD name="RSS"/>
					<FIELD name="SEJ"/>
					<FIELD name="FIN"/>
					<FIELD name="NOM" ifHideNames="Non autorisé"/>
					<FIELD name="IPP"/>
					<FIELD name="GHM"/>
					<FIELD name="GHS"/>
					<FIELD name="CAST"/>
					<FIELD name="MED"/>
					<FIELD name="DIAGP"/>
					<FIELD name="DATE"/>
					<FIELD name="SEX"/>
					<FIELD name="AGE"/>
					<FIELD name="NRSA"/>
					<FIELD name="NRUM"/>
					<FIELD name="CA"/>
					<FIELD name="CT2A"/>
					<FIELD name="CDMI"/>
					<FIELD name="CPHC"/>
					<FIELD name="CAUT"/>
					<FIELD name="CEXH"/>
					<FIELD name="CEXB"/>
					<FIELD name="NBJ"/>
					<FIELD name="NSEA"/>
					<FIELD name="NEXH"/>
					<FIELD name="NEXB"/>
					<FIELD name="CHON"/>
					<FIELD name="TAUX"/>
					<FIELD name="TYPE_SEJ_OVA"/>
					<FIELD name="ETAT_SEJ"/>
					<FIELD name="SEVCTI"/>
					<FIELD name="MEP"/>
					<FIELD name="ETABP"/>
					<FIELD name="MSD"/>
					<FIELD name="ETABD"/>
					<FIELD name="COHPHC"/>
					<FIELD name="RAAC"/>
					<FIELD name="CA_GHS_BRUT"/>
					<FIELD name="CA_GHS"/>
					<FIELD name="CA_GHS_THEORIQUE"/>
					<FIELD name="RESC_TARIF"/>
					<FIELD name="ADM_PR_RES_HOSP"/>
					<FIELD name="CONT_PAT"/>
					<FIELD name="NB_INTERV"/>
					<FIELD name="CA_SANS_RAAC"/>
					<FIELD name="IMPACT_RAAC"/>
				</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>
		</VIEWLINKS>
		<ONGLET excelLabel="Liste RSS">
			<DATAGRID title="" total="true" key="RSS" headerHeight="40" totalRowInRows="= ROW.OID == '-9999999'">
				<ROWSTYLE name="fontSize" value="11"/>
				<FOOTERROWSTYLE name="fontSize" value="11"/>
				<COLUMN dataField="OID" type="Char" visible="false">
				</COLUMN>
				<COLUMN dataField="FIN" width="60" type="Char" visible="true" headerText="Etablissement" textAlign="left" visibleCondition="ENV.CONSOLIDATION == '1'" otherFunction="text" totalFunction="text" totalComplement="">
				</COLUMN>
				<COLUMN dataField="RSS" width="60" type="Char" visible="true" headerText="N° RSS" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="TOTAL">
				</COLUMN>
				<COLUMN dataField="SEJ" width="90" type="Char" visible="true" outputFormat="#" headerText="N° séjour" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="">
				</COLUMN>
				<COLUMN dataField="NOM" minWidth="150" type="Char" visible="true" headerText="Nom" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="*ROW">
				</COLUMN>
				<COLUMN dataField="IPP" minWidth="90" type="Char" visible="true" headerText="IPP" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="*ROW">
				</COLUMN>
				<COLUMN dataField="SEX" width="40" type="Char" visible="true" headerText="Sexe" textAlign="right" otherFunction="text" totalFunction="text">
					<CELLSTYLE name="cellIndicator" value="femme, 12,left middle , 0xEB76B1" condition="ROW.SEX == '2'" /> 
					<CELLSTYLE name="cellIndicator" value="homme, 12,left middle , 0x75a0eb " condition="ROW.SEX == '1'" /> 
					<CELLSTYLE name="cellIndicator" value="rectangle, 10,left middle , #FF5001 " condition="ROW.SEX == '3'" /> 
					<CELLSTYLE name="cellIndicator" value="rectangle, 10, left middle, 0x666666" condition="ROW.SEX != '2' &amp;&amp; ROW.SEX != '1' &amp;&amp; ROW.SEX != '3'" />
				</COLUMN>
				<COLUMN dataField="AGE" width="35" type="Number" outputFormat="#" visible="true" headerText="Age" textAlign="right" otherFunction="text" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="DATE" width="60" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" visible="true" headerText="Date sortie" textAlign="left" otherFunction="text" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="NBJ" width="50" visible="true" type="Number" outputFormat="#" headerText="Durée séjour" fixed="false" textAlign="right" totalFunction="sum" otherFunction="sum">
				</COLUMN>
				<COLUMN dataField="TYPE_SEJ_OVA" width="40" type="Char" visible="true" headerText="Type OVA." textAlign="center" otherFunction="text" totalFunction="text">
                    <description><![CDATA[
                        <B>Type de séjours OVALIDE</B>
                        
                        - 1 : type de séjours = GHM de niveau J ou T ou durée de séjour inférieure à 2 jours
                        - 2 : type de séjours = CM 28 (séances)
                        - 3 : type de séjours autres GHM.
                    ]]></description>				
                </COLUMN>				
                <COLUMN dataField="ETAT_SEJ" width="30" type="Char" visible="true" headerText="Etat séj." textAlign="center" otherFunction="text" totalFunction="text">
                    <description><![CDATA[
                    <B>Etat de séjours (Module activité)</B>
                    - 3  : Sorti(s) non groupé(s)
                    - 4  : Sorti(s) facturable(s)
                    - 5  : Sorti(s) non facturé(s) avec facturation partielle
                    - 6  : Facturé(s) non soldé(s)
                    - 7  : Soldé(s)
                    - ** : Non renseigné (séjour présent dans MCO et absent dans ACTIVITE)
                    - 9  : Fictif(s)
                        
                    ]]></description>				
                </COLUMN>                
                <COLUMN dataField="SEVCTI" width="40" type="Char" visible="true" headerText="Sév. CTI" textAlign="center" otherFunction="text" totalFunction="text">
                    <description><![CDATA[
                    <B>Sévérité CTI : </B>
                    - 1  : Séances
                    - 2  : Sévérité J
                    - 3  : Sévérité T
                    - 4  : Sévérité Z
                    - 5  : Sévérité 1
                    - 6  : Sévérité ABCDE
                    - 7  : Durée de séjour > 2 nuits
                    - 8  : Non PMSI
                        
                    ]]></description>				
                </COLUMN>                
                <COLUMN dataField="COHPHC" width="45" type="Char" visible="true" headerText="Conv. HP,HC" textAlign="center" otherFunction="text" totalFunction="text">
                    <description><![CDATA[
                    <B>Conversion (HP,HC): </B>
                    - 0 ou vide : Non reinseigné
                    - 1  : Conversion HC
                    - 2  : Absence de conversion HC
                        
                    ]]></description>				
                </COLUMN>                
                <COLUMN dataField="RAAC" width="45" type="Char" visible="true" headerText="RAAC" textAlign="center" otherFunction="text" totalFunction="text">
                    <description><![CDATA[
                    <B>RAAC: </B>
                    - 0 ou vide : Non reinseigné
                    - 1  : Prise en charge RAAC
                    - 2  : Pas de prise en charge RAAC
                        
                    ]]></description>
                </COLUMN>
				<COLUMN dataField="RESC_TARIF" width="45" type="Char" visible="true" headerText="RESC TARIF" textAlign="center" otherFunction="text" totalFunction="text">
                    <description><![CDATA[
                    <B>Rescrit tarif: </B>
                    - 0 ou vide : Non reinseigné
                    - 1  : Situation relevant d'une hospitalisation de jour
                    - 2  : Pas de Situation relevant d'une hospitalisation de jour
                        
                    ]]></description>				
                </COLUMN>
				<COLUMN dataField="ADM_PR_RES_HOSP" width="45" type="Char" visible="true" headerText="ADM PROD RH" textAlign="center" otherFunction="text" totalFunction="text">
                    <description><![CDATA[
                    <B>Administration de produits de la réserve hospitalière: </B>
                    - 0 ou vide : Non reinseigné
                    - 1  : Prise en charge avec administration de produit de la RH
                    - 2  : Pas de prise en charge avec administration de produit de la RH
                        
                    ]]></description>
                </COLUMN>
				<COLUMN dataField="CONT_PAT" width="45" type="Char" visible="true" headerText="CONT PAT" textAlign="center" otherFunction="text" totalFunction="text">
					<description><![CDATA[
                    <B>Contexte particulier ou surveillance particulière: </B>
                    - 0 ou vide : Non renseigné
                    - 1  : Prise en charge avec contexte particulier ou surveillance particulière
                    - 2  : Pas de prise en charge avec contexte particulier ou surveillance particulière
                        
                    ]]>					</description>
				</COLUMN>
				<COLUMN dataField="NB_INTERV" width="45" type="Char" visible="true" headerText="NB  INTER" textAlign="center" otherFunction="text" totalFunction="text">
                    <description><![CDATA[
                    <B>Nombre interventions: </B>
                    - 0 ou vide : Non reinseigné
                    - A  : Nombre d'interventions inférieur à 3  
                    - B  : Plus de 3 interventions
                    - C  : 3 interventions
                    ]]></description>
                </COLUMN>
                <COLUMN dataField="GHM" width="50" type="Char" visible="true" headerText="GHM" textAlign="left" otherFunction="text" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="GHS" width="50" type="Char" visible="true" headerText="GHS" textAlign="left" otherFunction="text" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="CAST" width="30" type="Char" visible="true" headerText="CAS" textAlign="center" otherFunction="text" totalFunction="text">
				</COLUMN>				
                <COLUMN dataField="MED" width="120" type="Char" visible="true" headerText="Médecin" textAlign="left" otherFunction="text" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="DIAGP" width="45" type="Char" visible="true" headerText="Diag P" textAlign="left" otherFunction="text" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="MEP" width="45" type="Char" visible="true" headerText="Prov." description="Mode d'entrée et Provenance"  textAlign="center" otherFunction="text" totalFunction="text">
				</COLUMN>				
				<COLUMN dataField="ETABP" width="60" type="Char" visible="true" headerText="Etab. Prov." description="Etablissement de provenance" textAlign="left" otherFunction="text" totalFunction="text">
				</COLUMN>				
				<COLUMN dataField="MSD" width="45" type="Char" visible="true" headerText="Dest." description="Mode de sortie et destination" textAlign="center" otherFunction="text" totalFunction="text">
				</COLUMN>				
				<COLUMN dataField="ETABD" width="60" type="Char" visible="true" headerText="Etab. Dest" description="Etablissement de destination" textAlign="left" otherFunction="text" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="NRSA" width="40" visible="false" type="Number" outputFormat="#" headerText="Nb Séjours" textAlign="right" totalFunction="sum" otherFunction="sum">
				</COLUMN>
				<COLUMN dataField="NRUM" width="40" visible="false" type="Number" outputFormat="#" headerText="Nb RUM" textAlign="right" totalFunction="sum" otherFunction="sum">
				</COLUMN>
				<COLUMN dataField="TAUX" width="45" type="Number" outputFormat="#%" visible="true" headerText="Taux" textAlign="right" otherFunction="text" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="CA" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="C.A. ETS" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="CT2A" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="C.A. T2A" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="CA_GHS_BRUT" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="CA GHS BRUT" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="CA_GHS" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="CA GHS Facturé" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="CA_GHS_THEORIQUE" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="CA GHS Théorique" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="CEXH" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="CA EXH" textAlign="right" otherFunction="sum" totalFunction="sum"> 
				</COLUMN> 
				<COLUMN dataField="CEXB" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="CA EXB" textAlign="right" otherFunction="sum" totalFunction="sum"> 
				</COLUMN>
				<COLUMN dataField="CDMI" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="C.A. DMI" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="CPHC" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="C.A. PHC" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="CAUT" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="C.A. Autres" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="CHON" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="C.A. HON" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="CA_SANS_RAAC" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="C.A. GHS SANS RAAC" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="IMPACT_RAAC" width="80" visible="true" type="Number" outputFormat="#E" fixed="false" headerText="Impact C.A. GHS RAAC" textAlign="right" otherFunction="sum" totalFunction="sum">
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
