<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="PMSI000057" 
	label="PMSI. Justificatif Interventions par RSS" 
	title="= 'Justificatif Intervention par RSS (' + SELECT.QUELLEDATE_LABEL + ' : ' +  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:actes:interventions" helpDokuWIkiFile="pmsi000056"  helpFile="iCTI_PMSI_PMSI000056.HTML">
	
	<VIEWPROPERTIES componentName="PROPERTIES_INTERVENTIONS" />
		
	<SELECTIONS label="Paramètres de l'analyse">
		<GROUP label="Période">
			<FIELD name="QUELLEDATE" label="" UI="combo" default="1" default2="date_fin" printable="false">
				<OPTION label="Date sortie" data="1" data2="date_sortie" />
				<OPTION label="Date acte" data="2" data2="date_acte" />
			</FIELD>
			<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" 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_INTERV_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.finess, 
						identite_nom::text || ' '::text || identite_prenom::text, 
						v_rss_1.date_entree, 
						v_rss_1.date_sortie,
						date_acte, 
						medecin_reference_code, 
						medecin_reference_nom, 
						anesthesiste_reference_code, 
						anesthesiste_reference_nom, 
						v_rss_actes_4.acte_principal_code, 
						v_rss_actes_4.acte_principal_texte, 
						nb_interventions, 
						icr
					FROM #V_RSS_X#, pmsi.v_rss_actes_4
					WHERE 
							v_rss_1.rss_id = v_rss_actes_4.rss_id
							AND [VIEW.QUELLEDATE] BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						
							[VIEW.FILTRE_INTERV_SELECT]
							[VIEW.FILTRE_RSS_SELECT]
					)
					
					UNION ALL
					
					(SELECT 
						-9999999, 
						COUNT(DISTINCT v_rss_1.no_rss), 
						'', 
						COUNT(DISTINCT v_rss_1.rss_id)::text || ' séjours, '::text || COUNT(DISTINCT v_rss_1.patient_id)::text || ' patients, '::text || SUM(nb_interventions)::text || ' interventions'::text , 
						null, 
						null, 
						null, 
						'', 
						COUNT(DISTINCT CASE WHEN v_rss_actes_4.medecin_reference_id > 0 THEN v_rss_actes_4.medecin_reference_id ELSE null END)::text || ' exécutants'::text , 
						'', 
						COUNT(DISTINCT CASE WHEN v_rss_actes_4.anesthesiste_reference_id > 0 THEN v_rss_actes_4.anesthesiste_reference_id ELSE null END)::text || ' anesthésistes'::text , 
						'', 
						COUNT(DISTINCT v_rss_actes_4.acte_principal_id)::text || ' codes actes'::text , 
						SUM(nb_interventions), 
						SUM(icr)
					FROM 
						#V_RSS_X#, pmsi.v_rss_actes_4
					WHERE 
						v_rss_1.rss_id = v_rss_actes_4.rss_id
						AND [VIEW.QUELLEDATE] BETWEEN '[PERIODE]' AND '[TOPERIODE]'
					
						[VIEW.FILTRE_INTERV_SELECT]
						[VIEW.FILTRE_RSS_SELECT]
					)
					
					ORDER BY 2, 5
					
				]]></select>
				<FIELDS>
					<FIELD name="OID" />
					<FIELD name="RSS" />
					<FIELD name="FIN" />
					<FIELD name="NOM" ifHideNames="Non autorisé" />
					<FIELD name="DATE" />
					<FIELD name="DATS" />
					<FIELD name="DAT" />
					<FIELD name="CODM" />
					<FIELD name="TXTM" />
					<FIELD name="CODMA" />
					<FIELD name="TXTMA" />
					<FIELD name="CODA" />
					<FIELD name="TXTA" />
					<FIELD name="NB" />
					<FIELD name="ICR" />
				</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 Actes" label="Justificatif Actes" >
			<DATAGRID title="" total="true" headerHeight="48"    
				totalRowInRows="= ROW.OID == '-9999999'">
				<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 dataField="RSS"
					width="60"
					type="Char"
					visible="true"
					headerText="N° RSS" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text" 
					totalComplement="TOTAL" />
				<COLUMN dataField="NOM"
					minWidth="150"
					type="Char"
					visible="true"
					headerText="Nom" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text"
					totalComplement="*ROW" />
				<COLUMN dataField="DATE" 
					type="Date"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YY"
					visible="true"
					headerText="Date&#xD;Entrée"
					width="70" 
					textAlign="left" />
				<COLUMN dataField="DATS" 
					type="Date"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YY"
					visible="true"
					headerText="Date&#xD;Sortie"
					width="70" 
					textAlign="left" />
				<COLUMN dataField="CODM" 
					type="Char"
					visibleCondition="SELECT.MEDECIN == '-1' || SELECT.MEDECIN.toString().substr(0,2) == 'LI'"
					headerText="Code médecin"
					width="60" 
					textAlign="left" />
				<COLUMN dataField="TXTM" 
					type="Char"
					visibleCondition="SELECT.MEDECIN == '-1' || SELECT.MEDECIN.toString().substr(0,2) == 'LI'"
					headerText="Nom médecin"
					minWidth="100" 
					textAlign="left"
					totalFunction="text"
					totalComplement="*ROW" />
				<COLUMN dataField="CODMA" 
					type="Char"
					visibleCondition="SELECT.ANESTHESISTE == '-1' || SELECT.ANESTHESISTE.toString().substr(0,2) == 'LI'"
					headerText="Code anesth."
					width="60" 
					textAlign="left" />
				<COLUMN dataField="TXTMA" 
					type="Char"
					visibleCondition="SELECT.ANESTHESISTE == '-1' || SELECT.ANESTHESISTE.toString().substr(0,2) == 'LI'"
					headerText="Nom anesthésiste"
					minWidth="100" 
					textAlign="left"
					totalFunction="text"
					totalComplement="*ROW" />
				<COLUMN dataField="CODA" 
					type="Char"
					visibleCondition="SELECT.ACTE == '-1' || SELECT.ACTE.toString().substr(0,2) == 'LI'"
					headerText="Code acte"
					width="60" 
					textAlign="left" />
				<COLUMN dataField="TXTA" 
					type="Char"
					visibleCondition="SELECT.ACTE == '-1' || SELECT.ACTE.toString().substr(0,2) == 'LI'"
					headerText="Texte acte"
					minWidth="100" 
					textAlign="left"
					totalFunction="text"
					totalComplement="*ROW" />
				<COLUMN dataField="DAT" 
					type="Date"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YY"
					visible="true"
					headerText="Date&#xD;Interv"
					width="70" 
					textAlign="left" />
				<COLUMN dataField="NB" 
					type="Number"
					visible="false"
					outputFormat="#"
					headerText="Nb total"
					width="60" 
					textAlign="left" 
					totalFunction="sum" />
				<COLUMN dataField="ICR" 
					type="Number"
					visible="true"
					outputFormat="#"
					headerText="ICR"
					width="70" 
					textAlign="left" 
					totalFunction="sum" />
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>

			
