<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="ACTI000133" label="Activité. Origine population" title="= 'Origine population (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ') - ' + SELECT.VERSION_GROUPAGE_LABEL" database="iCTI" swf="*CTI_view1" softCode="iCTI_activite" globals="ACTI_globals.XML" componentsFile="ACTI_components.XML"
    helpFile="iCTI_ACTI_ACTI000132.HTML"
    helpDokuWIkiDir="activite:population:analyse_par_age_et_par_sexe" 
    helpDokuWIkiFile="acti000132" 
>

	<VIEWPROPERTIES componentName="PROPERTIES_OCCUPATION" />
	
	<SELECTIONS label="Paramètres de l'analyse">
		
		<GROUP>
			<FIELD name="ALIAS_PERIODE" label="" UI="combo" width="220" default="CUM_LAST_MONTH" tree="true" globalListProvider="ALIAS_PERIODE" />
            <FIELD name="PERIODE" label="Période" UI="combo" tree="true" width="220" default="2009-01-01" globalListProvider="DATE_DEBUT" >
			</FIELD>
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="220" default="2009-01-31" globalListProvider="DATE_FIN" >
			</FIELD>
		</GROUP>
		<GROUP label="Regroupement">
			<FIELD name="GROUPBY" label="" UI="combo" width="220" default="SER" tree="true">
				<OPTION label="Options" data="" globalListProvider="AGE_GROUPBY_OPTIONS" />
			</FIELD>
			<FIELD name="GROUPBY_TAB" width="100" label="Présentation" UI="combo" default="AUTO" visible="= SELECT.GROUPBY_2 != '-1' ">
				<OPTION label="Automatique" data="AUTO" />
				<OPTION label="Arbre" data="TREE" />
				<OPTION label="Onglet" data="TAB" />
			</FIELD>
		</GROUP>

		<GROUP label="">
			<FIELD name="GROUPBY_2" label="" UI="combo" width="220" default="-1" tree="true">
				<OPTION label="" data="-1" treeLevel="1" />
				<OPTION label="Options" data="" globalListProvider="AGE_GROUPBY_OPTIONS" />
			</FIELD>
			<FIELD name="GROUPBY_3" label="" UI="combo" width="220" default="-1" tree="true">
				<OPTION label="" data="-1" treeLevel="1" />
				<OPTION label="Options" data="" globalListProvider="AGE_GROUPBY_OPTIONS" />
			</FIELD>
		</GROUP>
		
	</SELECTIONS>
	<SELECTIONS componentName="DAYS_SELECTIONS" />

	<SELECTIONS componentName="FILTRES_ETAT_SEJOURS_SOUSSELECTIONS" />

	<SELECTIONS componentName="FILTRES_SEJOURS_SELECTIONS" />

	<SELECTIONS componentName="FILTRES_PATIENTS_SELECTIONS" />
	
	<SELECTIONS componentName="FILTRES_PASSAGES_SELECTIONS" />
	

	<QUERIES>
		<QUERY label="0">
			<SQL optimizer="V_SEJOURS_X" cacheEnabled="true" >
				<select><![CDATA[ 
					DROP TABLE IF EXISTS acti000133_temp
					.,
					
					CREATE TEMP TABLE acti000133_temp AS
					(
					SELECT no_patient FROM #V_SEJOURS_X# WHERE date_sortie &lt; '[PERIODE]' GROUP BY no_patient
					);					
					
					
					CTISELECT_TREE 
						WORKTABLE{acti000133} 
						GROUPBY1{[VIEW.GROUPBY_OID_FIELD],, [VIEW.GROUPBY_COD_FIELD],, [VIEW.GROUPBY_TXT_FIELD]} 
						GROUPBY1MODE{[GROUPBY_TAB]} 
						GROUPBY2{[VIEW.GROUPBY_2_OID_FIELD],, [VIEW.GROUPBY_2_COD_FIELD],, [VIEW.GROUPBY_2_TXT_FIELD]} 
						GROUPBY3{[VIEW.GROUPBY_3_OID_FIELD],, [VIEW.GROUPBY_3_COD_FIELD],, [VIEW.GROUPBY_3_TXT_FIELD]} 
						SIGNIFDATA{[VIEW.ACTIVITE_SIGNIFICATIVE_DATA],, [ACTIVITE_SIGNIFICATIVE_MODE],, [ACTIVITE_SIGNIFICATIVE_NUMBER]} 
					INDICATORS{ 
						count(DISTINCT v_sejours_1.no_patient),, 	
						count(DISTINCT v_sejours_1.no_patient) - count(DISTINCT acti000133_temp.no_patient),,  						
						count(distinct v_sejours_1.sejour_id)
					}					
					FROM #V_MOUVEMENTS_SEJOUR_X#
						JOIN #V_SEJOURS_X#  ON v_mouvements_sejour_2.no_sejour = v_sejours_1.no_sejour  
						LEFT JOIN  acti000133_temp ON (v_sejours_1.no_patient = acti000133_temp.no_patient)
					WHERE 
							v_mouvements_sejour_2.date BETWEEN '[PERIODE]' AND '[TOPERIODE]' AND
							service_facturation_est_absence IS DISTINCT FROM '1' AND
							type_sejour <> '9'
							[VIEW.SEJOURS_SELECT] [VIEW.PATIENTS_SELECT] 
							[VIEW.JOURS_SELECT]
							[VIEW.PASSAGES_SELECT]
				
				
				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS" />			
					<FIELD name="NBP"/>
					<FIELD name="NBNP"/>
					<FIELD name="NB"/>
				</FIELDS>
				
				<FIELDS_COMMENTAIRE>	<!-- pour cacher le contenu -->  
					<FIELDS>
						<INSERT name="CTISELECT_TREE_FIELDS" />
						<FIELD name="SORT" />
						<FIELD name="LIT" /><!-- 			1	nombre de lits -->
						<FIELD name="ENT" /><!-- 			2	entrées -->
						<FIELD name="ENTM" /><!-- 			3	entrées par service/etage/uf -->
						<FIELD name="SOR" /><!-- 			4	sorties -->
						<FIELD name="SORM" /><!-- 			5	sorties par service/etage/uf -->
						<FIELD name="JRN" /><!-- 			6	journées sur la période -->
						<FIELD name="NCP" /><!-- 			7	chambres particulières -->
						<FIELD name="EXT" /><!-- 			8	externes -->
						<FIELD name="AMB" /><!-- 			9	ambulatoires -->
						<FIELD name="SEA" /><!-- 			10	séances -->
						<FIELD name="URG" /><!-- 			11	urgence -->
						<FIELD name="BB" /><!-- 			12	bébés -->
							
						<FIELD name="OUV" /><!--  			13	jours ouverts -->
						<FIELD name="PER" /><!--  			14	jours période -->
						<FIELD name="JRNM" /><!-- 			15	moyenne quotidienne journées -->
						<FIELD name="EXTM" /><!-- 			16	moyenne quotidienne externes -->
						<FIELD name="AMBM" /><!-- 			17	moyenne quotidienne nb_ambulatoires -->
						<FIELD name="URGM" /><!-- 			18	moyenne quotidienne nb_urgences  -->
						<FIELD name="BBM" /><!--  			19	moyenne quotidienne nb_bebes  -->
						<FIELD name="TAU" /><!--  			20	taux d'occupation  -->
						<FIELD name="SEAM" /><!--  			21	séances par jour  -->
							
						<FIELD name="JRNHON" /><!--  		22	journées hospitalisation  -->
						<FIELD name="SEJ" /><!--  			23	séjours  -->
						<FIELD name="ENTPRE" /><!--  		24	admissions < période  -->
						<FIELD name="ENTPER" /><!--  		25	admissions pendant période  -->
						<FIELD name="FULL" /><!--  			26	entiers période  -->
						<FIELD name="NONSOR" /><!--  		27	séjours non sortis  -->
						<FIELD name="SORPOST" /><!-- 		28	sorties > période  -->
						<FIELD name="SORPER" /><!-- 		29	sorties période  -->
							
						<FIELD name="SORFAC" /><!--  		30	sorties période facturées  -->
						<FIELD name="SORNONFAC" /><!--  	31	sorties période non facturées  -->
							
						<FIELD name="JRNSOR" /><!-- 		32	journées hospitalisés sorties  -->
						<FIELD name="JRNSORFAC" /><!--  	33	journées hospitalisés sorties facturées  -->
						<FIELD name="JRNSORHON" /><!-- 		34	journées hospitalisation sorties  -->
						<FIELD name="JRNSORHONFAC" /><!--  	35	journées hospitalisation sorties facturées  -->
							
						<FIELD name="DURHES" /><!--  		36	Durée hospitalisés  -->
						<FIELD name="DURHON" /><!--  		37	Durée hospitalisation  -->
						<FIELD name="SORHON" /><!--  		38	Sorties hospitalisation  -->
							
						<FIELD name="TYPSEJ" /><!--  		39	Type de séjour  -->
						<FIELD name="SEATAU" /><!--  		40	Nombre de séances dans taux  -->
						<FIELD name="DECES" /><!--  		41	Nombre de décès  -->
						<FIELD name="CPOUV" /><!--  		42	Nombre de Journées CP ouvertes  -->
						<FIELD name="CPTAU" /><!--  		43	Taux d'occupation en chambre particulière  -->
					</FIELDS>
				</FIELDS_COMMENTAIRE>
			</SQL>
		</QUERY>
	</QUERIES>
	
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Liste des séjours" shortLabel="Séjours" view="ACTI000134.XML" componentName="OCC_BASE_VIEWLINK" component3Name="STANDARD_BASE_VIEWLINK">
				<ARG name="DATA">
					<value><![CDATA[ 
						
						var s:String = '';
						switch (COLUMN.NAME) {
							case 'ENT' :			s = 'ENT'; 			break;
							case 'ENTM' :			s = 'ENTMUT';		break;
							case 'SOR' :			s = 'SOR';			break;
							case 'SORM' :			s = 'SORMUT';		break;
							case 'JRN' :			s = 'JRN';			break;
							case 'JRNM' :			s = 'JRN';			break;
							case 'NCP' :			s = 'CP';			break;
							case 'EXT' :			s = 'EXT';			break;
							case 'EXTM' :			s = 'EXT';			break;
							case 'AMB' :			s = 'AMB';			break;
							case 'AMBM' :			s = 'AMB';			break;
							case 'URG' :			s = 'URG';			break;
							case 'URGM' :			s = 'URG';			break;
							case 'BB' :				s = 'BB';			break;
							case 'BBM' :			s = 'BB';			break;
							case 'SEA' :			s = 'SEA';			break;
							case 'SEAM' :			s = 'SEA';			break;
							case 'JRNHON' :			s = 'JRNHON';		break;
							case 'SORFAC' :			s = 'SORFAC';		break;
							case 'JRNSOR' :			s = 'JRNSOR';		break;
							case 'JRNSORFAC' :		s = 'JRNSORFAC';	break;
							case 'JRNSORHON' :		s = 'JRNSORHON';	break;
							case 'JRNSORHONFAC' :	s = 'JRNSORHONFAC';	break;
							case 'SORNONFAC' :		s = 'SORNONFAC';	break;
							case 'DECES' :			s = 'DECES';		break;
							default :				s = '-1';			break;
						}
						return s;
						
					]]></value>
				</ARG>
				<ARG name="STATUT_SEJOUR">
					<value><![CDATA[ 
						
						var s:String = '';
						switch (COLUMN.NAME) {
							case 'FULL' :		s = '1';	break; 
							case 'SORPER' :		s = '2';	break; 
							case 'ENTPER' :		s = '3';	break; 
							case 'ENTPRE' :		s = '4';	break; 
							case 'SORPOST' :	s = '5';	break; 
							default :			s = '-1';	break; 
						}
						return s;
						
					]]></value>
				</ARG>
			</VIEWLINK>
		</VIEWLINKS>
		<ONGLET excelLabel="Origine" label="Origine" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
 <!--  			 <CHART title="Répartition géographique des séjours" type="map" 
				visibleCondition="(SELECT.GROUPBY == 'CODEPOST' &amp;&amp; SUBTAB == 0 &amp;&amp; ) 
								" 
				condition="ROW.LVL == '1'" 
				significativeField="NB"
				mapLvl="CDP"
				>
				<CATEGORY field="COD" type="Char"/>
				<SERIE field="NB" displayName="Nombre séjours" />
			</CHART>   -->

			<CHART title="Origine géographique" type="pieChart" subType="" maxItems="10" maxItemsSortOn="NB" maxItemsSortSeq="D" sortField="COD" sortSeq="A" condition="ROW.LVL == '1'">
				<CATEGORY field="COD" type="Number"/>
				<SERIE field="NB" displayName="RSA"/>
			</CHART> 
			<DATAGRID title="" total="true" showOthers="true" headerHeight="48" variableRowHeight="true" selectRowInRows="= ROW.OID == '-9999997'" otherRowInRows="= ROW.OID == '-9999998'" totalRowInRows="= ROW.OID == '-9999999'"
				sortable="= SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_TAB == 'TAB'">
				<ROWSTYLE name="rowHeight" value="20" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'"/>
				<ROWSTYLE name="backgroundColor" value="0xFFD393" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'"/>
				<ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'"/>
				<ROWSTYLE name="borderSides" value="top bottom" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'"/>
				<ROWSTYLE name="borderStyle" value="solid" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'"/>
				<ROWSTYLE name="borderThickness" value="2" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'"/>
				<COLUMN dataField="LVL" width="50" type="Char" visible="false" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="OID1" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD1" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="OID2" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD2" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="OID3" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD3" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD" width="60" type="Char" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
					<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'"/>
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="200" maxWidth="300" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres">
				</COLUMN>
				<COLUMN dataField="POP" width="80" type="Number" outputFormat="#" visibleCondition="SELECT.GROUPBY == 'CODEGEOPMSI' || SELECT.GROUPBY_2 == 'CODEGEOPMSI'" headerText="Population" textAlign="right" totalFunction="text" otherFunction="text">
				</COLUMN>
				<COLUMN dataField="NBP" width="80" type="Number" outputFormat="#" headerText="Nb patients" textAlign="right" totalFunction="sum" otherFunction="text">
				</COLUMN>
				<COLUMN dataField="NBNP" width="80" type="Number" outputFormat="#" headerText="Dont nouveaux Patients" textAlign="right" totalFunction="sum" otherFunction="text">
				</COLUMN>
				<COLUMN dataField="PNBP" type="Number" headerText="% Population" visibleCondition="SELECT.GROUPBY == 'CODEGEOPMSI' || SELECT.GROUPBY_2 == 'CODEGEOPMSI'" width="80" outputFormat="#,00%" textAlign="right" totalFunction="text" totalComplement="" otherFunction="text" calc="true" largeSeparator="true">
					<CALC formula="if (ROW.POP &gt; 0) {ROW.NBP / ROW.POP * 100} else {0}"/>
				</COLUMN>
				<COLUMN dataField="NB" width="80" type="Number" outputFormat="#" headerText="Nb séjours" textAlign="right" totalFunction="sum" otherFunction="sum">
				</COLUMN>
				<COLUMN dataField="PNB" type="Number" headerText="% séjours / Total" width="80" outputFormat="#%" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.NB / TOTALROW.NB * 100"/>
				</COLUMN>
				<COLUMN dataField="CAT2A" width="80" type="Number" outputFormat="#" visibleCondition="SELECT.INCLUDE == 'CAT2A'" headerText="CA T2A" textAlign="right" totalFunction="sum" otherFunction="sum">
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
