<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000236" 
	label="PMSI. Expert. Justificatif" 
	title="= 'Justificatif Contrôles Expert (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ') - ' + SELECT.VERSION_GROUPAGE_LABEL" 
	database="iCTI" 
	swf="*CTI_view1" 
	softCode="iCTI_pmsi" 
	softOption="iCTI_expert"
	globals="PMSI_globals.XML"
	componentsFile="PMSI_components.XML"	helpDokuWIkiDir="pmsi:qualite:expert" helpDokuWIkiFile="pmsi000235"  helpFile="iCTI_PMSI_PMSI000273.HTML">
	<CACHE cachable="false" />
	<VIEWPROPERTIES>
		<PROPERTYx dataLink="VIEWPROPERTIES" nameField="name" valueField="value" />
	</VIEWPROPERTIES>
	
	<SELECTIONS label="Paramètres de l'analyse">
	
		<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 name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2014-12-31"  globalListProvider="DATE_FIN" printable="false" />
		</GROUP>
		<GROUP label="Force">
			<FIELD name="_FORCE_UPDATE" label="" UI="textArea" width="100" height="20" default="" visible="false" />
		</GROUP>
	</SELECTIONS>
		
	<SELECTIONS componentName="FILTRES_EXPERT_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.en_cours_texte_tres_court,
						CASE WHEN no_patient &gt; 0 THEN no_patient ELSE 0 END,
						v_rss_1.no_sejour_administratif,
						v_rss_1.finess,
						identite_nom::text || ' '::text || identite_prenom::text,
						ghm_code,
						medecin_reference_rss_nom,
						diagnostic_principal_code,
						unite_medicale_principale_code,
						acte_principal_code,
						date_entree,
						date_sortie,
						mode_sortie::text || destination::text,
						sexe_texte_court,
						age,
						v_rss_1.date_naissance,
						duree_sejour,
						v_expert_rss_controle_1.date_signalement,
						v_expert_rss_controle_1.date_correction,
						v_expert_rss_controle_1.etat,
						v_expert_rss_controle_1.etat_texte,
						v_expert_rss_controle_1.expert_controle_code,
						v_expert_rss_controle_1.expert_controle_id,
						v_expert_rss_controle_1.expert_controle_texte,
						v_expert_rss_controle_1.expert_controle_gravite_texte,
						v_expert_rss_controle_1.code_justificatif,
                        CASE WHEN v_rss_etat_1.date_groupage_code != '20991231' THEN v_rss_etat_1.date_groupage_code ELSE 'N/D'::text END as date_groupage_code
					FROM #V_RSS_X#
						JOIN pmsi.v_expert_rss_controle_1  ON v_expert_rss_controle_1 .rss_id = v_rss_1.rss_id
					WHERE
						date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.FILTRE_RSS_SELECT]
						[VIEW.EXPERT_CONTROLE_SELECT]
				
					ORDER BY 2
				;
				
				]]></select>
				<FIELDS>
					<FIELD name="OID" />
					<FIELD name="RSS" />
					<FIELD name="EXP" />
					<FIELD name="PAT" />
					<FIELD name="SEJ" />
					<FIELD name="FIN" />
					<FIELD name="NOM"  ifHideNames="Non autorisé"/>
					<FIELD name="GHM" />
					<FIELD name="MED" />
					<FIELD name="DIAGP" />
					<FIELD name="UMP" />
					<FIELD name="ACTEP" />
					<FIELD name="DATE" />
					<FIELD name="DATS" />
					<FIELD name="MODS" />
					<FIELD name="SEX" />
					<FIELD name="AGE" />
					<FIELD name="DATN"  ifHideNames="Non autorisé"/>
					<FIELD name="NBJ"/>
					<FIELD name="CXDS"/>
					<FIELD name="CXDC"/>
					<FIELD name="CXEC"/>
					<FIELD name="CXE"/>
					<FIELD name="CXC"/>
					<FIELD name="CXI"/>
					<FIELD name="CXT"/>
					<FIELD name="CXG"/>
					<FIELD name="CXJ"/>
					<FIELD name="DATG"/>
				</FIELDS>
			</SQL>
			
			<SQL optimizer="V_RSS_X">
				<select><![CDATA[
				
				
					SELECT 
						-9999999, 
						COUNT(DISTINCT v_rss_1.no_rss)::text || ' séjours, '::text || COUNT(DISTINCT patient_id)::text || ' patients'::text,
						COUNT(*)::text || ' Erreurs'::text						
					FROM pmsi.v_expert_rss_controle_1 
						JOIN #V_RSS_X# ON v_expert_rss_controle_1 .rss_id = v_rss_1.rss_id
					WHERE
						date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.FILTRE_RSS_SELECT]
						[VIEW.EXPERT_CONTROLE_SELECT]
				;
				
				]]></select>
				<FIELDS>
					<FIELD name="OID" />
					<FIELD name="NOM" />
					<FIELD name="CXT"/>
				</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>
			
			
			<VIEWLINK label="Ignorer" shortLabel="Ignorer" view="PMSI000271.XML" 
				enabled="= ROW.CXEC == ''" 
				visible="= ROW.CXEC == ''">
				<ARG name="RSS_ID" value="ROW.OID" />
				<ARG name="EXPERT_CONTROLE" value="'DT' + ROW.CXI" />
				<ARG name="VAL_ACTION" value="'I'" />
				<ARG name="PERIODE" value="SELECT.PERIODE" />
				<ARG name="TOPERIODE" value="SELECT.TOPERIODE" />
			</VIEWLINK>
			
			<VIEWLINK label="Pointer comme corrigé" shortLabel="Pointer comme corrigé" view="PMSI000271.XML" 
				enabled="= ROW.CXEC == '' || ROW.CXEC == 'I'" 
				visible="= ROW.CXEC == '' || ROW.CXEC == 'I'">
				<ARG name="RSS_ID" value="ROW.OID" />
				<ARG name="EXPERT_CONTROLE" value="'DT' + ROW.CXI" />
				<ARG name="VAL_ACTION" value="'T'" />
				<ARG name="PERIODE" value="SELECT.PERIODE" />
				<ARG name="TOPERIODE" value="SELECT.TOPERIODE" />
			</VIEWLINK>
			
			<VIEWLINK label="Remettre en service" shortLabel="Remettre en service" view="PMSI000271.XML" 
				enabled="= ROW.CXEC == 'I' || ROW.CXEC == 'T'" 
				visible="= ROW.CXEC == 'I' || ROW.CXEC == 'T'">
				<ARG name="RSS_ID" value="ROW.OID" />
				<ARG name="EXPERT_CONTROLE" value="'DT' + ROW.CXI" />
				<ARG name="VAL_ACTION" value="''" />
				<ARG name="PERIODE" value="SELECT.PERIODE" />
				<ARG name="TOPERIODE" value="SELECT.TOPERIODE" />
			</VIEWLINK>
			
		<!--	<VIEWREF label="Guide_Datim_MCO_2012" shortLabel="Guide_Datim_MCO_2012" 
				url="http://www.ctisante.com/references/pmsi/Guide_Datim_MCO_2012.pdf" rowContext="false" /> -->
			<VIEWREF label="Description des controles" shortLabel="Description des controles" 
				url="modules/pmsi/references/iCTI_PMSI_ExpertControle.HTML"  rowContext="false"/>

		</VIEWLINKS>
	
		<ONGLET excelLabel="Liste RSS" >
				
			<DATAGRID title="" total="true" key="RSS" headerHeight="36"  rowHeight="48"
				totalRowInRows="= ROW.OID == '-9999999'"
			>
				<ROWSTYLE name="rowHeight" value="48" />
				<ROWSTYLE name="fontSize" value="11" />
				<FOOTERROWSTYLE name="fontSize" value="11" />
				<COLUMN dataField="OID"
					type="Char"
					visible="false">
				</COLUMN>
				<COLUMN dataField="CXI"
					type="Char"
					visible="false">
				</COLUMN>
				<COLUMN dataField="CXEC"
					type="Char"
					visible="false">
				</COLUMN>
				<COLUMN dataField="FIN"
					frozen="left"
					width="60"
					type="Char"
					visible="true"
					headerText="Etablissement" 
					textAlign="left" 
					visibleCondition="ENV.CONSOLIDATION == '1'"
					otherFunction="text"
					totalFunction="text" 
					totalComplement="">
				</COLUMN>
				<COLUMN dataField="RSS"
					frozen="left"
					width="70"
					type="Number"
					visible="true"
					outputFormat="#"
					headerText="N° RSS" 
					textAlign="center" 
					otherFunction="text"
					totalFunction="text" 
					totalComplement="TOTAL">
				</COLUMN>
				<COLUMN dataField="PAT"
					frozen="left"
					width="80"
					type="Number"
					visible="true"
					outputFormat="#"
					headerText="N° Patient" 
					textAlign="center" 
					otherFunction="text"
					totalFunction="text" 
					totalComplement=""
					visibleCondition="SELECT.NIP != ''">
				</COLUMN>
				<COLUMN dataField="SEJ"
					frozen="left"
					width="80"
					type="Char"
					visible="true"
					outputFormat="#"
					headerText="N° séjour" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text" 
					totalComplement="">
				</COLUMN>
				<COLUMN dataField="NOM"
					frozen="left"
					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'" />
				</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="AGE"
					width="40"
					type="Number"
					outputFormat="#"
					fixed="false"
					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"
					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="NBJ" 
					width="40"
					visible="true"
					type="Number" 
					outputFormat="#" 
					headerText="Durée séjour" 
					fixed="false"
					textAlign="right" 
					totalFunction="sum"
					otherFunction="sum">
				</COLUMN>
				<COLUMN dataField="MODS"
					width="45"
					type="Char"
					visible="true"
					fixed="false"
					headerText="Mode sortie" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="EXP"
					width="30"
					type="Char"
					visible="true"
					fixed="false"
					headerText="EXP" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="GHM"
					width="55"
					type="Char"
					visible="true"
					fixed="false"
					headerText="GHM" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="DATG"
					width="60"
					type="Date"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YY"
					visible="true"
					fixed="false"
					headerText="Date groupage"
                    visibleCondition="SELECT.GROUP_PERIODE == '-1' &amp;&amp; SELECT.GROUP_TOPERIODE == '-1'"
					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="UMP"
					width="50"
					type="Char"
					visible="true"
					fixed="false"
					headerText="UM" 
					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>
				<COLUMN dataField="ACTEP"
					width="60"
					type="Char"
					fixed="false"
					visible="true"
					headerText="Acte P" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="CXDS"
					width="60"
					type="Date"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YY"
					visible="true"
					fixed="false"
					headerText="Date signalement" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="CXE"
					width="60"
					type="Char"
					visibleCondition="SELECT.EXPERT_CONTROLE_OPT == 'LIIT' || SELECT.EXPERT_CONTROLE_OPT == 'LI_IT'"
					headerText="Etat" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text"
					totalComplement="">
				</COLUMN>
				<COLUMN dataField="CXDC"
					width="60"
					type="Date"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YY"
					visibleCondition="SELECT.EXPERT_CONTROLE_OPT == 'LIIT' || 
								SELECT.EXPERT_CONTROLE_OPT == 'LI_IT' ||
								SELECT.EXPERT_CONTROLE_OPT == 'DTI' ||
								SELECT.EXPERT_CONTROLE_OPT == 'DTT'"
					fixed="false"
					headerText="Date correction" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text">
				</COLUMN>
				<COLUMN dataField="CXG"
					width="60"
					type="Char"
					visible="true"
					headerText="Gravité" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text"
					totalComplement="">
				</COLUMN>
				<COLUMN dataField="CXC"
					width="100"
					type="Char"
					visible="true"
					outputFormat="#"
					headerText="Code Controle" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text" 
					totalComplement="">
				</COLUMN>
				<COLUMN dataField="CXT"
					minWidth="200"
					type="Char"
					visible="true"
					headerText="Texte Controle" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text"
					totalComplement="">
				</COLUMN>
				<COLUMN dataField="CXJ"
					width="100"
					type="Char"
					visible="true"
					headerText="Justificatif Controle" 
					textAlign="left" 
					otherFunction="text"
					totalFunction="text"
					totalComplement="">
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>

			
