<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000123" 
	label="PMSI. RSS avec médecin non exécutant" 
	title="= 'Liste des RSS avec médecin non exécutant (' + 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>
		
		
		<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, 
					medecin_reference_rss_nom, 
					subview.executants_noms,
					ghm_code, 
					diagnostic_principal_code, 
					date_entree, 
					date_sortie, 
					sexe_texte_court, 
					v_rss_1.date_naissance
					
				FROM #V_RSS_X#,
					(SELECT p_rss.oid as rss_id, 
					SUM(case WHEN p_rss.medecin_rss_id = v_rss_actes_1.medecin_id THEN 1 ELSE 0 END),
					base.cti_group_concat(DISTINCT split_part(v_rss_actes_1.medecin_nom, ' ', 1)) as executants_noms
					FROM pmsi.p_rss, pmsi.v_rss_actes_1
					WHERE p_rss.oid = v_rss_actes_1.rss_id
					AND date_sortie &gt;= '[PERIODE]' AND date_sortie &lt;='[TOPERIODE]'
					GROUP BY p_rss.oid
					HAVING SUM(case WHEN p_rss.medecin_rss_id = v_rss_actes_1.medecin_id THEN 1 ELSE 0 END) = 0) subview
				WHERE 
					v_rss_1.rss_id = subview.rss_id
					AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
					[VIEW.FILTRE_RSS_SELECT]
				)	
				
				
				UNION ALL
				
				(SELECT  
					-9999999, 
					null, 
					'', 
					SUM(nb_rsa)::text || ' séjours',
					'', 
					'', 
					'', 
					'', 
					null,
					null, 
					'', 
					null
					
				FROM #V_RSS_X#,
					(SELECT p_rss.oid as rss_id, SUM(case WHEN p_rss.medecin_rss_id = v_rss_actes_1.medecin_id THEN 1 ELSE 0 END)
					FROM pmsi.p_rss, pmsi.v_rss_actes_1
					WHERE p_rss.oid = v_rss_actes_1.rss_id
					AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
					GROUP BY p_rss.oid
					HAVING SUM(case WHEN p_rss.medecin_rss_id = v_rss_actes_1.medecin_id THEN 1 ELSE 0 END) = 0) subview
				WHERE 
					v_rss_1.rss_id = subview.rss_id
					AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
					[VIEW.FILTRE_RSS_SELECT]
				)	
				
				ORDER BY 2
				"
				 >
				<FIELDS>
					<FIELD name="OID" />
					<FIELD name="RSS" />
					<FIELD name="FIN" />
					<FIELD name="NOM"  ifHideNames="Non autorisé"/>
					<FIELD name="MED" />
					<FIELD name="EXECS" />
					<FIELD name="GHM" />
					<FIELD name="DIAGP" />
					<FIELD name="DATE" />
					<FIELD name="DATS" />
					<FIELD name="SEX" />
					<FIELD name="DATN"  ifHideNames="Non autorisé"/>


				</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"  
				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="Number"
					visible="true"
					outputFormat="#"
					headerText="N° RSS" 
					textAlign="center" 
					otherFunction="text"
					totalFunction="text" 
					totalComplement="TOTAL">
				</COLUMN>
				
				<COLUMN dataField="NOM"
					minWidth="100"
					maxWidth="200"
					type="Char"
					visible="true"
					headerText="Nom" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text"
					totalComplement="*ROW">
				</COLUMN>
				<COLUMN dataField="SEX"
					width="40"
					type="Char"
					visible="true"
					headerText="Sexe" 
					fixed="false"
					textAlign="right" 
					otherFunction="text"
					totalFunction="text">
					<CELLSTYLE name="cellIndicator" value="femme, 12,left middle , 0xEB76B1" condition="ROW.SEX == 'F'" /> 
					<CELLSTYLE name="cellIndicator" value="homme, 12,left middle , 0x75a0eb " condition="ROW.SEX == 'M'" /> 
					<CELLSTYLE name="cellIndicator" value="rectangle, 10,left middle , #FF5001 " condition="ROW.SEX == 'I'" /> 
					<CELLSTYLE name="cellIndicator" value="rectangle, 10, left middle, 0x666666" condition="ROW.SEX != 'F' &amp;&amp; ROW.SEX != 'M' &amp;&amp; ROW.SEX != 'I'" />
					<CELLSTYLE name="paddingRight" value="10" />
				</COLUMN>
				
				<COLUMN dataField="DATN"
					width="60"
					type="Date"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YY"
					visible="true"
					fixed="false"
					headerText="Date naissance" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				
				
				<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>
				<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>
				
				<COLUMN dataField="MED"
					minWidth="60"
					maxWidth="150"
					type="Char"
					visible="true"
					fixed="false"
					headerText="Médecin" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="EXECS"
					minWidth="100"
					maxWidth="150"
					type="Char"
					visible="true"
					fixed="false"
					headerText="Exécutants" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				
				
				<COLUMN dataField="GHM"
					width="60"
					type="Char"
					visible="true"
					fixed="false"
					headerText="GHM" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				
				<COLUMN dataField="DIAGP"
					width="50"
					type="Char"
					fixed="false"
					visible="true"
					headerText="Diag P" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>

				
				
			</DATAGRID>
		
		</ONGLET>
		
	</PRESENTATION>
	
</VUE>

			
