<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000040" 
	label="PMSI. Justificatif CMA par RSS" 
	title="= 'Justificatif CMA par RSS (' + 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:sejours_analyse_globale:severites:severites_v10" helpDokuWIkiFile="pmsi000039">
	
	<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.finess, identite_nom || ' ' || identite_prenom,v_rss_1.no_patient, sexe, age, ghm_code, ligne_oap_code, medecin_reference_rss_nom, diagnostic_principal_code, 
						date_entree, date_sortie, duree_sejour,
						CASE WHEN substr(ghm_code,6,1) = 'V' OR substr(ghm_code,6,1) = 'W' THEN nb_rsa ELSE 0 END as nb_rsa_vw,
						CASE WHEN substr(ghm_code,6,1) = 'W' THEN nb_rsa ELSE 0 END as nb_rsa_w,
						CASE WHEN substr(ghm_code,6,1) = 'S' THEN nb_rsa ELSE 0 END as nb_rsa_s
				FROM #V_RSS_X#
				WHERE 
					date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
					AND substr(ghm_code,6,1) IN ('V','W','S')
					
					[VIEW.FILTRE_RSS_SELECT]
					
					ORDER BY v_rss_1.no_rss
				"
				 >
				<FIELDS>
					<FIELD name="OID" />
					<FIELD name="RSS" />
					<FIELD name="FIN" />
					<FIELD name="NOM" ifHideNames="Non autorisé"/>
					<FIELD name="IPP"/>
					<FIELD name="SEX" />
					<FIELD name="AGE" />
					
					<FIELD name="GHM" />
					<FIELD name="OAP" />
					<FIELD name="MED" />
					<FIELD name="DIAGP" />
					<FIELD name="DATE" />
					<FIELD name="DATS" />
					<FIELD name="NBJ"/>
					<FIELD name="NVW"/>
					<FIELD name="NW"/>
					<FIELD name="NS"/>
				</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="36" printRatio="0.8">
				
				<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="NOM"
					minWidth="150"
					type="Char"
					visible="true"
					headerText="Nom" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="IPP"
					width="60"
					type="Char"
					visible="true"
					headerText="IPP"
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="SEX"
					width="20"
					type="Char"
					visible="true"
					headerText="S" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="AGE"
					width="40"
					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 entrée" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="DATS"
					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="text"
					otherFunction="text">
				</COLUMN>
				<COLUMN dataField="GHM"
					width="60"
					type="Char"
					visible="true"
					headerText="GHM" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="OAP"
					width="50"
					type="Char"
					visible="true"
					headerText="OAP" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="MED"
					width="60"
					type="Char"
					visible="true"
					headerText="Médecin" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="DIAGP"
					width="50"
					type="Char"
					visible="true"
					headerText="Diag P" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="NVW" 
					width="55"
					visible="true"
					type="Number" 
					outputFormat="#" 
					headerText="Nb V+W" 
					textAlign="right" 
					totalFunction="sum"
					otherFunction="sum">
				</COLUMN>
				<COLUMN dataField="NW" 
					width="55"
					visible="true"
					type="Number" 
					outputFormat="#" 
					headerText="Nb W" 
					textAlign="right" 
					totalFunction="sum"
					otherFunction="sum">
				</COLUMN>
				<COLUMN dataField="NS" 
					width="55"
					visible="true"
					type="Number" 
					outputFormat="#" 
					headerText="Nb S" 
					fixed="false"
					textAlign="right" 
					totalFunction="sum"
					otherFunction="sum">
				</COLUMN>
				
			</DATAGRID>
		
		</ONGLET>
		
	</PRESENTATION>
	
</VUE>

			
