<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="PMSI000081" label="PMSI. Justificatif RUM" title="= 'Justificatif RUM ('  +  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" helpDokuWIkiDir="pmsi:sejour_analyse_detaillee:rum:sejours_rum:" helpDokuWIkiFile="pmsi000080"  helpFile="iCTI_PMSI_PMSI000081.HTML">
	<VIEWPROPERTIES componentName="PROPERTIES_RUM" />
	<SELECTIONS label="Paramètres de l'analyse">
		<GROUP label="Période">
			<FIELD name="ALIAS_PERIODE" label="" UI="combo" width="220" default="CUM_LAST_MONTH" tree="true" globalListProvider="ALIAS_PERIODE" />
			<FIELD name="PERIODE" label="de" UI="combo" tree="true" width="200" default="2014-01-01" default2="201401" printable="false" globalListProvider="DATE_DEBUT" />
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2014-12-31" default2="201412" printable="false" globalListProvider="DATE_FIN" />
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_RUM_SELECTIONS" />
	<SELECTIONS componentName="FILTRES_RSS_SELECTIONS" />
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_RSS_X">
				<select><![CDATA[ 
					
					(SELECT v_rss_1.rss_id, 
							v_rss_1.no_rss, 
							v_rss_1.no_sejour_administratif, 
							v_rss_1.finess, 
							identite_nom::text || ' '::text || identite_prenom::text, 
							date_entree_rum, 
							date_sortie_rum, 
							mode_entree_rum::text || ' '::text || mode_entree_rum_texte::text, 
							provenance_rum::text || ' '::text || provenance_rum_texte::text,
							mode_sortie_rum::text || ' '::text || mode_sortie_rum_texte::text,
							destination_rum::text || ' '::text || destination_rum_texte::text, 
							unite_medicale_code, 
							unite_medicale_texte, 
							v_rss_rum_2.type_autorisation,
							nb_rum_rum, 
							duree_sejour_rum, 
							nb_seances,
							igs2_rum,
							medecin_rum_nom
					FROM #V_RSS_X#
						JOIN pmsi.v_rss_rum_2 ON v_rss_1.rss_id = v_rss_rum_2.rss_id 
					WHERE date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
					
						[VIEW.FILTRE_RUM_SELECT]
						
						[VIEW.FILTRE_RSS_SELECT]
						
					ORDER BY no_rss, no_rum, date_sortie_rum
					
					)
					
					UNION ALL
					
					(SELECT -9999999, 
							COUNT(DISTINCT v_rss_1.no_rss), 
							'',
							'', 
							SUM(nb_rum_rum)::text || ' RUM, '::text || COUNT(DISTINCT v_rss_1.rss_id)::text || ' séjours, '::text || COUNT(DISTINCT v_rss_1.patient_id)::text || ' patients'::text , 
							null, 
							null, 
							'', 
							'', 
							'', 
							'', 
							'', 
							'',
							'', 
							SUM(nb_rum_rum), 
							SUM(duree_sejour_rum), 
							SUM(nb_seances),
							SUM(igs2_rum),
							''
					FROM #V_RSS_X#
					 	JOIN pmsi.v_rss_rum_2 ON v_rss_1.rss_id = v_rss_rum_2.rss_id 
					WHERE date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
					
						[VIEW.FILTRE_RUM_SELECT]
						
						[VIEW.FILTRE_RSS_SELECT]

					)
				
				]]></select>
				<FIELDS>
					<FIELD name="OID" />
					<FIELD name="RSS" />
					<FIELD name="SEJ" />
					<FIELD name="FIN" />
					<FIELD name="NOM" ifHideNames="Non autorisé" />
					<FIELD name="DATE" />
					<FIELD name="DATS" />
					<FIELD name="ME" />
					<FIELD name="MEP" />
					<FIELD name="MS" />
					<FIELD name="MSD" />
					<FIELD name="UM" />
					<FIELD name="UMT" />
					<FIELD name="AUT" />
					<FIELD name="NB" />
					<FIELD name="DU" />
					<FIELD name="SE" />
					<FIELD name="IGS" />
					<FIELD name="MEDRUM" />
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forRows="false" />
	</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="Justificatif RUM" label="Justificatif RUM">
			<DATAGRID title="" total="true" showOthers="false" key="RSS" headerHeight="48" totalRowInRows="= ROW.OID == '-9999999'">
				<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="Char" visible="true" headerText="N° RSS" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="TOTAL" />
				<COLUMN dataField="SEJ" width="90" type="Char" outputFormat="#" visible="true" headerText="N° Séjour" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="" />
				<COLUMN dataField="NOM" minWidth="150" type="Char" visible="true" headerText="Nom" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="*ROW" />
				<COLUMN dataField="UM" type="Char" visibleCondition="SELECT.UM.toString().substr(0,2) != 'UM'" headerText="Code UM" width="60" textAlign="left" />
				<COLUMN dataField="UMT" type="Char" visibleCondition="SELECT.UM.toString().substr(0,2) != 'UM'" headerText="Texte UM" minWidth="100" textAlign="left" />
				<COLUMN dataField="AUT" type="Char" visible="true" headerText="Aut." width="40" textAlign="left" />
				<COLUMN dataField="MEDRUM" type="Char" visible="true" headerText="Médecin RUM" width="90" textAlign="left" />
				<COLUMN dataField="DATE" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" visible="true" headerText="Date entrée" width="70" textAlign="left" />
				<COLUMN dataField="ME" type="Char" visible="true" headerText="Mode entrée" width="70" textAlign="left" />
				<COLUMN dataField="MEP" type="Char" visible="true" headerText="Provenance" width="70" textAlign="left" />
				<COLUMN dataField="DATS" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" visible="true" headerText="Date sortie" width="70" textAlign="left" />
				<COLUMN dataField="MS" type="Char" visible="true" headerText="Mode sortie" width="70" textAlign="left" />
				<COLUMN dataField="MSD" type="Char" visible="true" headerText="Destination" width="70" textAlign="left" />
				<COLUMN dataField="NB" type="Number" visible="false" outputFormat="#" headerText="Nb" width="50" textAlign="left" totalFunction="sum" fixed="false" />
				<COLUMN dataField="DU" type="Number" visible="true" outputFormat="0" headerText="Durée" width="60" totalFunction="sum" textAlign="left" />
				<COLUMN dataField="SE" type="Number" visible="true" outputFormat="#" headerText="Séances" width="60" textAlign="left" totalFunction="sum" />
				<COLUMN dataField="IGS" type="Number" visible="true" outputFormat="#" headerText="IGS" width="60" textAlign="left" totalFunction="sum" />
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
