<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000074" 
    label="PMSI. Registre des cancers" 
    title="= 'Registre des cancers (' + 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="DIAG_RSS_SELECT" value="[EVAL 
                                                if (substr('[DIAG]',0,2) == 'LI') {return 'AND v_rss_1.rss_id IN (SELECT rss_id FROM pmsi.p_rss_diagnostics WHERE diagnostic_id IN (SELECT to_id FROM pmsi.t_listes_contenu WHERE liste_id = ' . substr('[DIAG]',2) . '))';}
                                                if (substr('[DIAG]',0,2) == 'SL') {return 'AND v_rss_1.rss_id IN (SELECT rss_id FROM pmsi.p_rss_diagnostics WHERE diagnostic_id NOT IN (SELECT to_id FROM pmsi.t_listes_contenu WHERE liste_id = ' . substr('[DIAG]',2) . '))';}
                                                if (substr('[DIAG]',0,2) == 'DG') {return 'AND v_rss_1.rss_id IN (SELECT rss_id FROM pmsi.p_rss_diagnostics WHERE diagnostic_id = ' . substr('[DIAG]',2) . ')' ;}
                                                return '';
                                            EVAL]" />
                                            
        <PROPERTY name="DIAG_SELECT" value="[EVAL 
                if (substr('[DIAG]',0,2) == 'LI') {return 'AND v_rss_diagnostics_1.diagnostic_id IN (SELECT to_id FROM pmsi.t_listes_contenu WHERE liste_id = ' . substr('[DIAG]',2) . ')';}
                if (substr('[DIAG]',0,2) == 'SL') {return 'AND v_rss_diagnostics_1.diagnostic_id NOT IN (SELECT to_id FROM pmsi.t_listes_contenu WHERE liste_id = ' . substr('[DIAG]',2) . ')';}
                if (substr('[DIAG]',0,2) == 'DG') {return 'AND v_rss_diagnostics_1.diagnostic_id = ' . substr('[DIAG]',2) ;}
            EVAL]" />
    
        <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>
            <FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2014-12-31"  globalListProvider="DATE_FIN" printable="false">
            </FIELD>
        </GROUP>
        
        <GROUP label="Diagnostic analysé">
            <FIELD name="DIAG" label="" UI="combo" tree="true" width="400" default="" globalListProvider="DIAG"  >
            </FIELD>
        </GROUP>
        
    </SELECTIONS>
    
    <SELECTIONS componentName="FILTRES_RSS_SELECTIONS" />
    
    <QUERIES>
    
        <QUERY label="RSS"> 
        
            <SQL 
                optimizer="V_RSS_X"
                select="
                    DROP TABLE IF EXISTS w_PMSI000074;
                    CREATE TEMP TABLE w_PMSI000074 AS
                    SELECT v_rss_1.rss_id, base.cti_group_concat(v_rss_diagnostics_1.diagnostic_code) as diagnostics_associes_codes
                        FROM #V_RSS_X#
                        JOIN pmsi.v_rss_diagnostics_1 ON  v_rss_1.rss_id = v_rss_diagnostics_1.rss_id
                        WHERE
                        v_rss_1.date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
                        AND v_rss_diagnostics_1.diagnostic_id &lt;&gt; v_rss_1.diagnostic_principal_id AND v_rss_diagnostics_1.diagnostic_id &lt;&gt; v_rss_1.diagnostic_relie_id
                        [VIEW.FILTRE_RSS_SELECT] [VIEW.DIAG_SELECT]
                        GROUP BY v_rss_1.rss_id
                ">
            </SQL>
            <SQL 
                optimizer="V_RSS_X"
                select="
                SELECT  
                        v_rss_1.rss_id,
                        v_rss_1.finess,
                        v_rss_1.no_rss, 
                        v_rss_1.no_sejour_administratif, 
                        identite_nom || ' ' || CASE WHEN identite_nom_naissance IS NOT NULL AND identite_nom_naissance &lt;&gt; '' THEN 'née ' || identite_nom_naissance ELSE '' END,
                        identite_prenom,
                        v_rss_1.date_naissance,
                        sexe_texte_court,
                        unite_medicale_principale_code,
                        v_rss_1.date_entree,
                        p_rss_rum.date_entree,
                        p_rss_rum.date_sortie,
                        p_rss_rum.mode_sortie,
                        v_rss_1.date_sortie,
                        v_rss_1.mode_sortie,
                        v_rss_1.code_postal,
                        code_postal_texte,
                        v_rss_1.ghm_code,
                        v_rss_1.ghs_code,
                        diagnostic_principal_code,
                        CASE WHEN v_rss_1.diagnostic_relie_id &lt;&gt; 0 THEN diagnostic_relie_code ELSE '' END,
                        w_PMSI000074.diagnostics_associes_codes,
                        acte_principal_code,
                        patient_no_patient,
                        medecin_reference_rss_nom,
                        matricule_assure
                FROM #V_RSS_X#
                    JOIN pmsi.p_rss ON v_rss_1.rss_id = p_rss.oid 
                    JOIN pmsi.p_rss_rum ON p_rss.oid = p_rss_rum.rss_id AND p_rss.no_rum_principal = p_rss_rum.no_rum
                    LEFT JOIN w_PMSI000074  ON (p_rss.oid = w_PMSI000074.rss_id)                    
                WHERE 
                    v_rss_1.date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
                    
                    [VIEW.FILTRE_RSS_SELECT]
                    [VIEW.DIAG_RSS_SELECT]

                    ORDER BY v_rss_1.no_rss
                "
                 >
                <FIELDS>
                    <FIELD name="OID" />
                    <FIELD name="FINESS" />
                    <FIELD name="RSS" />
                    <FIELD name="NADMIN" />
                    <FIELD name="NOM" />
                    <FIELD name="PRENOM" />
                    <FIELD name="DATEN" />
                    <FIELD name="SEXE" />
                    <FIELD name="UM" />
                    <FIELD name="DATEE" />
                    <FIELD name="DATEEU" />
                    <FIELD name="DATESU" />
                    <FIELD name="MODESU" />
                    <FIELD name="DATES" />
                    <FIELD name="MODES" />
                    <FIELD name="CODEP" />
                    <FIELD name="CODEP_TEXT" />
                    <FIELD name="GHM" />
                    <FIELD name="GHS" />
                    <FIELD name="DIAGP" />
                    <FIELD name="DIAGR" />
                    <FIELD name="DIAGAS" />
                    <FIELD name="ACTEP" />
                    <FIELD name="NO_PAT" />
                    <FIELD name="MED" />
                    <FIELD name="MAT" 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="false" key="RSS" headerHeight="48"  
            >
                <ROWSTYLE name="fontSize" value="11" />
                <FOOTERROWSTYLE name="fontSize" value="11" />
                
                <COLUMN dataField="OID"
                    type="Char"
                    visible="false">
                </COLUMN>
                <COLUMN dataField="FINESS"
                    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="NO_PAT"
                    width="60"
                    type="Number"
                    visible="true"
                    outputFormat="#"
                    headerText="IPP" 
                    textAlign="right" 
                    otherFunction="text"
                    totalFunction="text" 
                    totalComplement="TOTAL">
                </COLUMN>
                <COLUMN dataField="NADMIN"
                    width="70"
                    type="text"
                    visible="true"
                    outputFormat="#"
                    headerText="N° séjour" 
                    textAlign="center" 
                    otherFunction="text"
                    totalFunction="text" 
                    totalComplement="TOTAL">
                </COLUMN>
                
                <COLUMN dataField="NOM"
                    minWidth="150"
                    type="Char"
                    visible="true"
                    headerText="Nom" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text"
                    totalComplement="*ROW">
                </COLUMN>
                <COLUMN dataField="PRENOM"
                    minWidth="100"
                    type="Char"
                    visible="true"
                    headerText="Prénom" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text"
                    totalComplement="*ROW">
                </COLUMN>
                <COLUMN dataField="MAT"
                    width="115"
                    type="Char"
                    visible="true"
                    outputFormat="#"
                    headerText="NIR assuré social" 
                    textAlign="center" 
                    otherFunction="text"
                    totalFunction="text" 
                    totalComplement=""
                    description="Numéro de sécurité sociale">
                </COLUMN>
                <COLUMN dataField="DATEN"
                    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="SEXE"
                    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.SEXE == 'F'" /> 
                    <CELLSTYLE name="cellIndicator" value="homme, 12,left middle , 0x75a0eb " condition="ROW.SEXE == 'M'" /> 
                    <CELLSTYLE name="cellIndicator" value="rectangle, 10, left middle, 0x666666" condition="ROW.SEXE != 'F' &amp;&amp; ROW.SEXE != 'M'" /> 
                </COLUMN>
                
                <COLUMN dataField="UM"
                    width="50"
                    type="Char"
                    visible="true"
                    headerText="UM" 
                    fixed="false"
                    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"
                    description="Identité du médecin responsable du séjour" >
                </COLUMN>
                
                <COLUMN dataField="DATEE"
                    width="70"
                    type="Date"
                    inputFormat="AAAA-MM-JJ"
                    outputFormat="DD/MM/YY"
                    visible="true"
                    fixed="false"
                    headerText="Date entrée séjour" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                <COLUMN dataField="DATEEU"
                    width="70"
                    type="Date"
                    inputFormat="AAAA-MM-JJ"
                    outputFormat="DD/MM/YY"
                    visible="true"
                    fixed="false"
                    headerText="Date entrée UM" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                <COLUMN dataField="DATESU"
                    width="70"
                    type="Date"
                    inputFormat="AAAA-MM-JJ"
                    outputFormat="DD/MM/YY"
                    visible="true"
                    fixed="false"
                    headerText="Date sortie UM" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                <COLUMN dataField="MODESU"
                    width="60"
                    type="Char"
                    visible="true"
                    fixed="false"
                    headerText="Mode sortie UM" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                <COLUMN dataField="DATES"
                    width="70"
                    type="Date"
                    inputFormat="AAAA-MM-JJ"
                    outputFormat="DD/MM/YY"
                    visible="true"
                    fixed="false"
                    headerText="Date sortie séjour" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                <COLUMN dataField="MODES"
                    width="50"
                    type="Char"
                    visible="true"
                    fixed="false"
                    headerText="Mode sortie séjour" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                
                <COLUMN dataField="CODEP"
                    width="50"
                    type="Char"
                    outputFormat="#"
                    fixed="false"
                    visible="true"
                    headerText="Code postal" 
                    textAlign="right" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                <COLUMN dataField="CODEP_TEXT"
                    width="120"
                    type="Char"
                    outputFormat="#"
                    fixed="false"
                    visible="true"
                    headerText="Ville" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                
                <COLUMN dataField="GHM"
                    width="50"
                    type="Char"
                    fixed="false"
                    visible="true"
                    headerText="GHM" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                <COLUMN dataField="GHS"
                    width="50"
                    type="Char"
                    fixed="false"
                    visible="true"
                    headerText="GHS" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                
                <COLUMN dataField="DIAGP"
                    width="70"
                    type="Char"
                    fixed="false"
                    visible="true"
                    headerText="Diagnostic Principal" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                
                <COLUMN dataField="DIAGR"
                    width="70"
                    type="Char"
                    fixed="false"
                    visible="true"
                    headerText="Diagnostic Relié" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                
                <COLUMN dataField="DIAGAS"
                    width="70"
                    type="Char"
                    fixed="false"
                    visible="true"
                    headerText="Diagnostic Associé" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>

                <COLUMN dataField="ACTEP"
                    width="70"
                    type="Char"
                    fixed="false"
                    visible="true"
                    headerText="Acte principal" 
                    textAlign="left" 
                    otherFunction="text"
                    totalFunction="text">
                </COLUMN>
                
                
            </DATAGRID>
        
        </ONGLET>
        
    </PRESENTATION>
    
</VUE>

            
