<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000157"
     label="PMSI. Etude cardiologie interventionnelle (Circulaire 12 août 2009)"
     title="= 'Etude cardiologie interventionnelle (Circulaire 12 août 2009) (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ')'"
     database="iCTI"
     swf="*CTI_view1"
     softCode="iCTI_pmsi"
     globals="PMSI_globals.XML"
     componentsFile="PMSI_components.XML">

    <VIEWPROPERTIES>

        <PROPERTY name="CHAMP_SELECT">
            <value><![CDATA[[EVAL
				// <?php
						$toRet = "";
						switch ('[CHAMP]'){
							case 'EX' :
								$toRet =  " AND p_rss.en_cours = '0' ";
								break;
							case 'EXTR' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi IN ('21', '22', '23', '24', '25', '26', '30', '31', '32', '33') ";
								break;
							case 'EXVA' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi IN ('30','31','32','33') ";
								break;
							case 'EXVA30' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi IN ('30') ";
								break;
							case 'EXVA3032' :
                                $select = " AND v_rss_1.en_cours = '0' AND p_rss.traitement_epmsi IN ('30','32') ";
                                break;
							case 'EXVA31' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi IN ('31') ";
								break;
							case 'EXVA32' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi IN ('32') ";
								break;
							case 'EXVA33' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi IN ('33') ";
								break;
							case 'EXNVA' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi IN ('21', '22', '23', '24', '25', '26') ";
								break;
							case 'EXNVA21' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '21' ";
								break;
							case 'EXNVA22' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '22' ";
								break;
							case 'EXNVA23' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '23' ";
								break;
							case 'EXNVA24' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '24' ";
								break;
							case 'EXNVA25' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '25' ";
								break;
							case 'EXNVA26' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '26' ";
								break;
							case 'EXNTR' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi IN ('11', '12', '13', '14', '15') ";
								break;
							case 'EXNTR11' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '11' ";
								break;
							case 'EXNTR12' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '12' ";
								break;
							case 'EXNTR13' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '13' ";
								break;
							case 'EXNTR14' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '14' ";
								break;
							case 'EXNTR15' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi = '15' ";
								break;
							case 'EXNTRNVA' :
								$toRet =  " AND p_rss.en_cours = '0' AND p_rss.traitement_epmsi IN ('11', '12', '13', '14', '15', '21', '22', '23', '24', '25', '26') ";
								break;

							case 'NEX' :
								$toRet =  " AND p_rss.en_cours <> '0' ";
								break;
							case 'NEXSO' :
								$toRet =  " AND p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('S') ";
								break;
							case 'NEXGR' :
								$toRet =  " AND p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('G','V','F') ";
								break;
							case 'NEXVA' :
								$toRet =  " AND p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('V','F') ";
								break;
							case 'NEXFA' :
								$toRet =  " AND p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('F') ";
								break;
							case 'NEXGRNFA' :
								$toRet =  " AND p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('G','V') ";
								break;
							case 'NEXNFA' :
								$toRet =  " AND p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('S','G','V') ";
								break;


							case 'EXNEX' :
								break;
							case 'EXNEXSO' :
								$toRet =  " AND (p_rss.en_cours = '0' OR p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('S')) ";
								break;
							case 'EXNEXGR' :
								$toRet =  " AND (p_rss.en_cours = '0' OR p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('G','V','F')) ";
								break;
							case 'EXNEXVA' :
								$toRet =  " AND (p_rss.en_cours = '0' OR p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('V','F')) ";
								break;
							case 'EXNEXFA' :
								$toRet =  " AND (p_rss.en_cours = '0' OR p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('F')) ";
								break;
							case 'EXNEXGRNFA' :
								$toRet =  " AND (p_rss.en_cours = '0' OR p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('G','V')) ";
								break;
							case 'EXNEXNFA' :
								$toRet =  " AND (p_rss.en_cours = '0' OR p_rss.en_cours <> '0' AND p_rss.en_cours_etat IN ('S','G','V')) ";
								break;

							// Anciens codes pour compatibilité
							case 'EXGR' :
								$toRet =  " AND (p_rss.en_cours = '0' OR p_rss.en_cours_etat IN ('G', 'V')) ";
								break;
							case 'EXGV' :
								$toRet =  " AND (p_rss.en_cours = '0' OR p_rss.en_cours_etat = 'V') ";
								break;
							case 'GR' :
								$toRet =  " AND p_rss.en_cours_etat IN ('G', 'V') ";
								break;


							default :
								$toRet =  "";
								break;
						}
						return $toRet ;
				// ?>
			EVAL]]]></value>
        </PROPERTY>
    </VIEWPROPERTIES>

    <SELECTIONS label="Paramètres de l'analyse" displayText="= var display:String = '';
					if (SELECT.CHAMP  == 'EXGR' || SELECT.CHAMP  == 'EXGV' || SELECT.CHAMP  == 'GR') {
						display = display + '  Champ : #B#' + SELECT.CHAMP_LABEL + '#/B#';
					}
					return display;
		">

        <GROUP label="Période">
            <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">
            </FIELD>
            <FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2014-12-31" globalListProvider="DATE_FIN">
            </FIELD>
        </GROUP>

        <GROUP label="Champ">
            <FIELD name="CHAMP" label="" UI="combo" tree="true" width="400" default="EX" globalListProvider="CHAMP" showIfNotDefault="true">
            </FIELD>
        </GROUP>

    </SELECTIONS>


    <QUERIES>

        <QUERY label="">

            <SQL
                    optimizer="V_RSS_X"
                    select="
				SELECT
					subview.chapitre,

					CASE WHEN level = '4' THEN acte_id ELSE 0 END,
					CASE WHEN level = '4' THEN acte_code ELSE subview.chapitre END,
					CASE WHEN level = '4' THEN acte_texte ELSE subview.chapitre_texte END,
					CASE WHEN level = '4' THEN 0 ELSE subview.seuil END,

					subview.level,

					COUNT(DISTINCT CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.liste) THEN rss_id ELSE null END) AS nbs,
					SUM(CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.liste) THEN nombre ELSE 0 END) AS nba,
					COUNT(DISTINCT CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listex) AND chapitre &lt;&gt; '9' THEN rss_id ELSE null END) AS nbsx,
					SUM(CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listex) AND chapitre &lt;&gt; '9' THEN nombre ELSE 0 END) AS nbax,
					COUNT(DISTINCT CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listenx) AND chapitre &lt;&gt; '9' THEN rss_id ELSE null END) AS nbsnx,
					SUM(CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listenx) AND chapitre &lt;&gt; '9' THEN nombre ELSE 0 END) AS nbanx,
					CASE WHEN SUM(CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listex) THEN nombre ELSE 0 END) &gt; 0 THEN
						SUM(CASE WHEN p_rss.age &lt;= 18 AND acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listex) THEN nombre ELSE 0 END)
						/
						SUM(CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listex) THEN nombre ELSE 0 END)
						*
						100.00
					ELSE
						0
					END


				FROM pmsi.p_rss, pmsi.v_rss_actes_1,
					(
					SELECT '3'::text as level, '1'::text as chapitre, 'Activité interventionnelle sous imagerie médicale'::text as chapitre_texte, 50::numeric as seuil, 'CTI000016A'::text as liste, 'CTI000017A'::text as listex, 'CTI000018A'::text as listenx
					UNION ALL
					SELECT '4'::text as level, '1'::text as chapitre, 'Activité interventionnelle sous imagerie médicale'::text as chapitre_texte, 0::numeric as seuil, 'CTI000016A'::text as liste, 'CTI000017A'::text as listex, 'CTI000018A'::text as listenx
					UNION ALL
					SELECT '3'::text as level, '2'::text as chapitre, 'Cardiopathies de l ’enfant ou cardiopathies congénitales'::text as chapitre_texte, 40::numeric as seuil, 'CTI000019A'::text as liste, 'CTI000020A'::text as listex, 'CTI000021A'::text as listenx
					UNION ALL
					SELECT '4'::text as level, '2'::text as chapitre, 'Cardiopathies de l’ enfant ou cardiopathies congénitales'::text as chapitre_texte, 0::numeric as seuil, 'CTI000019A'::text as liste, 'CTI000020A'::text as listex, 'CTI000021A'::text as listenx
					UNION ALL
					SELECT '3'::text as level, '3'::text as chapitre, 'Autres cardiopathies de l’ adulte'::text as chapitre_texte, 350::numeric as seuil, 'CTI000022A'::text as liste, 'CTI000023A'::text as listex, 'CTI000024A'::text as listenx
					UNION ALL
					SELECT '4'::text as level, '3'::text as chapitre, 'Autres cardiopathies de l ’adulte'::text as chapitre_texte, 0::numeric as seuil, 'CTI000022A'::text as liste, 'CTI000023A'::text as listex, 'CTI000024A'::text as listenx
					) subview
				WHERE v_rss_actes_1.rss_id = p_rss.oid
					AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
					AND v_rss_actes_1.activite_ccam &lt;&gt; '4'
					[VIEW.CHAMP_SELECT]
					AND acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code IN ('CTI000016A', 'CTI000019A', 'CTI000022A'))
					AND acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code IN (subview.liste))
					GROUP BY 1,2,3,4,5,6
UNION
		SELECT
					'9',
					0,
					'',
					'TOTAL',
					0,
					'9',

					COUNT(DISTINCT CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.liste) THEN rss_id ELSE null END) AS nbs,
					SUM(CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.liste) THEN nombre ELSE 0 END) AS nba,
					COUNT(DISTINCT CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listex) AND chapitre &lt;&gt; '9' THEN rss_id ELSE null END) AS nbsx,
					SUM(CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listex) AND chapitre &lt;&gt; '9' THEN nombre ELSE 0 END) AS nbax,
					COUNT(DISTINCT CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listenx) AND chapitre &lt;&gt; '9' THEN rss_id ELSE null END) AS nbsnx,
					SUM(CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listenx) AND chapitre &lt;&gt; '9' THEN nombre ELSE 0 END) AS nbanx,
					CASE WHEN SUM(CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listex) THEN nombre ELSE 0 END) &gt; 0 THEN
						SUM(CASE WHEN p_rss.age &lt;= 18 AND acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listex) THEN nombre ELSE 0 END)
						/
						SUM(CASE WHEN acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code = subview.listex) THEN nombre ELSE 0 END)
						*
						100.00
					ELSE
						0
					END


				FROM pmsi.p_rss, pmsi.v_rss_actes_1,
					(
					SELECT '3'::text as level, '1'::text as chapitre, 'Activité interventionnelle sous imagerie médicale'::text as chapitre_texte, 50::numeric as seuil, 'CTI000016A'::text as liste, 'CTI000017A'::text as listex, 'CTI000018A'::text as listenx
					UNION ALL
					SELECT '4'::text as level, '1'::text as chapitre, 'Activité interventionnelle sous imagerie médicale'::text as chapitre_texte, 0::numeric as seuil, 'CTI000016A'::text as liste, 'CTI000017A'::text as listex, 'CTI000018A'::text as listenx
					UNION ALL
					SELECT '3'::text as level, '2'::text as chapitre, 'Cardiopathies de l ’enfant ou cardiopathies congénitales'::text as chapitre_texte, 40::numeric as seuil, 'CTI000019A'::text as liste, 'CTI000020A'::text as listex, 'CTI000021A'::text as listenx
					UNION ALL
					SELECT '4'::text as level, '2'::text as chapitre, 'Cardiopathies de l’ enfant ou cardiopathies congénitales'::text as chapitre_texte, 0::numeric as seuil, 'CTI000019A'::text as liste, 'CTI000020A'::text as listex, 'CTI000021A'::text as listenx
					UNION ALL
					SELECT '3'::text as level, '3'::text as chapitre, 'Autres cardiopathies de l’ adulte'::text as chapitre_texte, 350::numeric as seuil, 'CTI000022A'::text as liste, 'CTI000023A'::text as listex, 'CTI000024A'::text as listenx
					UNION ALL
					SELECT '4'::text as level, '3'::text as chapitre, 'Autres cardiopathies de l ’adulte'::text as chapitre_texte, 0::numeric as seuil, 'CTI000022A'::text as liste, 'CTI000023A'::text as listex, 'CTI000024A'::text as listenx
					) subview
				WHERE v_rss_actes_1.rss_id = p_rss.oid
					AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
					AND v_rss_actes_1.activite_ccam &lt;&gt; '4'
					[VIEW.CHAMP_SELECT]
					AND acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code IN ('CTI000016A', 'CTI000019A', 'CTI000022A'))
					AND acte_id IN (SELECT to_id FROM pmsi.v_listes_3 WHERE liste_code IN (subview.liste))
					AND level = '3'
				ORDER BY 1,2


				"
            >
                <FIELDS>
                    <FIELD name="CHAP" />
                    <FIELD name="OID" />
                    <FIELD name="COD" />
                    <FIELD name="TXT" />
                    <FIELD name="NBAS" />
                    <FIELD name="LVL" />
                    <FIELD name="NBS" />
                    <FIELD name="NBA" />
                    <FIELD name="NBSX" />
                    <FIELD name="NBAX" />
                    <FIELD name="NBSNX" />
                    <FIELD name="NBANX" />
                    <FIELD name="NBAXP18" />
                </FIELDS>
            </SQL>


        </QUERY>

    </QUERIES>

    <PRESENTATION>

        <VIEWLINKS>

            <VIEWREF label="Circulaire relative aux activités interventionnelles sous imagerie médicale, par voie endovasculaire, en cardiologie (DHOS/O4/2009/279 du 12 août 2009)" shortLabel="Circulaire"
                     url="http://www.ctisante.com/references/pmsi/Circulaire_DHOS042009279_12_aout_2009.pdf" rowContext="false" />

        </VIEWLINKS>

        <ONGLET excelLabel="Etude" >

            <DATAGRID title="" total="true" headerHeight="36" sortable="false" variableRowHeight="true" totalRowInRows="= ROW.LVL == '9'"
            >
                <ROWSTYLE name="rowHeight" value="20" condition="ROW.LVL == '3' " />
                <ROWSTYLE name="backgroundColor" value="0xFFD393" condition="ROW.LVL == '3'" />
                <ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '3' " />
                <ROWSTYLE name="borderSides" value="top bottom" condition="ROW.LVL == '3' " />
                <ROWSTYLE name="borderStyle" value="solid" condition="ROW.LVL == '3' " />
                <ROWSTYLE name="borderThickness" value="2" condition="ROW.LVL == '3' " />

                <COLUMN dataField="LVL"
                        type="Char"
                        visible="false">
                </COLUMN>
                <COLUMN dataField="OID"
                        type="Char"
                        visible="false">
                </COLUMN>


                <COLUMN dataField="COD" width="70" type="Char" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
                    <CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '4' " />
                </COLUMN>
                <COLUMN dataField="TXT" type="Char" minWidth="200" maxWidth="300" headerText="Actes" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres">
                </COLUMN>


                <COLUMN dataField="NBS"
                        width="80"
                        type="Number"
                        visible="true"
                        outputFormat="#"
                        headerText="Total séjours"
                        textAlign="right"
                        otherFunction="text"
                        totalFunction="sum"
                        totalComplement="">
                </COLUMN>
                <COLUMN dataField="NBA"
                        width="80"
                        type="Number"
                        visible="true"
                        outputFormat="#"
                        headerText="Total actes"
                        textAlign="right"
                        otherFunction="text"
                        totalFunction="sum"
                        totalComplement=""
                        largeSeparator="true">
                </COLUMN>

                <COLUMN dataField="NBSX"
                        width="80"
                        type="Number"
                        visible="true"
                        outputFormat="#"
                        headerText="Total séjours Dans Seuil"
                        textAlign="right"
                        otherFunction="text"
                        totalFunction="sum"
                        totalComplement="">
                </COLUMN>


                <COLUMN dataField="NBAX"
                        width="80"
                        type="Number"
                        visible="true"
                        outputFormat="#"
                        headerText="Total actes Dans Seuil"
                        textAlign="right"
                        otherFunction="text"
                        totalFunction="sum"
                        totalComplement="">
                </COLUMN>

                <COLUMN dataField="NBAXP18"
                        width="80"
                        type="Number"
                        visible="true"
                        outputFormat="#,00%"
                        headerText="Dont % enfants 0-18 ans"
                        textAlign="right"
                        otherFunction="text"
                        totalFunction="sum"
                        totalComplement="">
                </COLUMN>

                <COLUMN dataField="NBAS"
                        width="80"
                        type="Number"
                        visible="true"
                        outputFormat="#"
                        headerText="Valeur du Seuil"
                        textAlign="right"
                        otherFunction="text"
                        totalFunction="sum"
                        totalComplement=""
                        largeSeparator="true">
                </COLUMN>

                <COLUMN dataField="NBSNX"
                        width="80"
                        type="Number"
                        visible="true"
                        outputFormat="#"
                        headerText="Total séjours Hors Seuil"
                        textAlign="right"
                        otherFunction="text"
                        totalFunction="sum"
                        totalComplement="">
                </COLUMN>
                <COLUMN dataField="NBANX"
                        width="80"
                        type="Number"
                        visible="true"
                        outputFormat="#"
                        headerText="Total actes Hors Seuil"
                        textAlign="right"
                        otherFunction="text"
                        totalFunction="sum"
                        totalComplement="">
                </COLUMN>

            </DATAGRID>

        </ONGLET>

    </PRESENTATION>

</VUE>

			
