← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3145: Improve case-aggregation function and add new function to show details of result after run agg-co...

 

------------------------------------------------------------
revno: 3145
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-03-24 10:34:53 +0700
message:
  Improve case-aggregation function and add new function to show details of result after run agg-condition.
added:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultDetailsAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResultDetails.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseAggregationForm.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java	2011-01-12 02:26:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionService.java	2011-03-24 03:34:53 +0000
@@ -32,6 +32,7 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patientdatavalue.PatientDataValue;
 import org.hisp.dhis.period.Period;
 
@@ -59,5 +60,9 @@
         
     Collection<PatientDataValue> getPatientDataValues( CaseAggregationCondition aggregationCondition, OrganisationUnit orgunit, Period period );
     
+    Collection<Patient> getPatients( CaseAggregationCondition aggregationCondition, OrganisationUnit orgunit, Period period );
+    
+    Collection<DataElement> getDataElementsInCondition( String aggregationExpression );
+    
     String getConditionDescription( String condition );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2011-02-28 04:40:24 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2011-03-24 03:34:53 +0000
@@ -76,7 +76,7 @@
         + SEPARATOR_ID + "[0-9]*]*)" + "\\]";
 
     private final String IS_NULL = "is null";
-    
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -174,7 +174,7 @@
         Period period )
     {
         String sql = createSQL( aggregationCondition, orgunit, period );
-
+        
         Collection<Integer> patientIds = aggregationConditionStore.executeSQL( sql );
 
         return calValue( patientIds, aggregationCondition.getOperator() );
@@ -206,6 +206,23 @@
         return result;
     }
 
+    public Collection<Patient> getPatients( CaseAggregationCondition aggregationCondition, OrganisationUnit orgunit,
+        Period period )
+    {
+        Collection<Patient> result = new HashSet<Patient>();
+
+        String sql = createSQL( aggregationCondition, orgunit, period );
+        
+        Collection<Integer> patientIds = aggregationConditionStore.executeSQL( sql );
+
+        for ( Integer patientId : patientIds )
+        {
+            result.add( patientService.getPatient( patientId ) );
+        }
+
+        return result;
+    }
+
     public String getConditionDescription( String condition )
     {
         StringBuffer decription = new StringBuffer();
@@ -247,6 +264,38 @@
         return decription.toString();
     }
 
+    public Collection<DataElement> getDataElementsInCondition( String aggregationExpression )
+    {
+        String regExp = "\\[" + OBJECT_PROGRAM_STAGE_DATAELEMENT + SEPARATOR_OBJECT + "[0-9]+" + SEPARATOR_ID
+            + "[0-9]+" + SEPARATOR_ID + "[0-9]+" + "\\]";
+
+        Collection<DataElement> dataElements = new HashSet<DataElement>();
+
+        // ---------------------------------------------------------------------
+        // parse expressions
+        // ---------------------------------------------------------------------
+
+        Pattern pattern = Pattern.compile( regExp );
+
+        Matcher matcher = pattern.matcher( aggregationExpression );
+
+        while ( matcher.find() )
+        {
+            String match = matcher.group();
+            match = match.replaceAll( "[\\[\\]]", "" );
+
+            String[] info = match.split( SEPARATOR_OBJECT );
+            String[] ids = info[1].split( SEPARATOR_ID );
+
+            int dataElementId = Integer.parseInt( ids[1] );
+            DataElement dataElement = dataElementService.getDataElement( dataElementId );
+
+            dataElements.add( dataElement );
+        }
+
+        return dataElements;
+    }
+
     // -------------------------------------------------------------------------
     // Support Methods
     // -------------------------------------------------------------------------
@@ -389,53 +438,26 @@
 
     }
 
-    private Collection<DataElement> getDataElementsInCondition( String aggregationExpression )
-    {
-        String regExp = "\\[" + OBJECT_PROGRAM_STAGE_DATAELEMENT + SEPARATOR_OBJECT + "[0-9]+" + SEPARATOR_ID
-            + "[0-9]+" + SEPARATOR_ID + "[0-9]+" + "\\]";
-
-        Collection<DataElement> dataElements = new HashSet<DataElement>();
-
-        // ---------------------------------------------------------------------
-        // parse expressions
-        // ---------------------------------------------------------------------
-
-        Pattern pattern = Pattern.compile( regExp );
-
-        Matcher matcher = pattern.matcher( aggregationExpression );
-
-        while ( matcher.find() )
-        {
-            String match = matcher.group();
-            match = match.replaceAll( "[\\[\\]]", "" );
-
-            String[] info = match.split( SEPARATOR_OBJECT );
-            String[] ids = info[1].split( SEPARATOR_ID );
-
-            int dataElementId = Integer.parseInt( ids[1] );
-            DataElement dataElement = dataElementService.getDataElement( dataElementId );
-
-            dataElements.add( dataElement );
-        }
-
-        return dataElements;
-    }
-
-    private String getConditionForNotDataElement( int programStageId, int dataElementId, int optionComboId, int orgunitId,
-        String startDate, String endDate )
+    private String getConditionForNotDataElement( int programStageId, int dataElementId, int optionComboId,
+        int orgunitId, String startDate, String endDate )
     {
         return "SELECT distinct(pi.patientid) FROM programstageinstance as psi "
-            + "INNER JOIN programstage as ps ON psi.programstageid = ps.programstageid "
-            + "INNER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid "
-            + "INNER JOIN programinstance as pi ON pi.programinstanceid = psi.programinstanceid "
-            + "WHERE pd.organisationunitid = " + orgunitId + " AND ps.programstageid = " + programStageId + " "
-            + "AND psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate + "' "
-            + "AND ( ( pd.dataelementid != " + dataElementId+ " AND pd.categoryoptioncomboid != " + optionComboId+ "  ) "
-            + "      OR ( pd.dataelementid = " + dataElementId+ "  AND pd.categoryoptioncomboid != " + optionComboId+ " ) "
-            + "      OR ( pd.dataelementid != " + dataElementId+ "  AND pd.categoryoptioncomboid = " + optionComboId+ "  ) )";
+                + "INNER JOIN programstage as ps ON psi.programstageid = ps.programstageid "
+                + "INNER JOIN programinstance as pi ON pi.programinstanceid = psi.programinstanceid "
+                + "LEFT OUTER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid "
+                + "WHERE psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate + "' "
+                + "AND pd.value IS NULL AND pi.patientid NOT IN  ( "
+                    + "SELECT distinct(pi.patientid) FROM programstageinstance as psi "
+                    + "INNER JOIN programstage as ps ON psi.programstageid = ps.programstageid "
+                    + "INNER JOIN programinstance as pi ON pi.programinstanceid = psi.programinstanceid "
+                    + "INNER JOIN patientdatavalue as pd ON psi.programstageinstanceid = pd.programstageinstanceid "
+                    + "WHERE pd.organisationunitid = " + orgunitId + " AND ps.programstageid = " + programStageId + " "
+                    + "AND psi.executionDate >= '" + startDate + "' AND psi.executionDate <= '" + endDate + "' "
+                    + "AND pd.dataelementid = " + dataElementId + " " + "AND pd.categoryoptioncomboid = " + optionComboId
+                + "  ) ";
 
     }
-    
+
     private String getConditionForDataElement( int programStageId, int dataElementId, int optionComboId, int orgunitId,
         String startDate, String endDate )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java	2011-03-22 02:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java	2011-03-24 03:34:53 +0000
@@ -127,20 +127,6 @@
     // Input & Output Parameters
     // -------------------------------------------------------------------------
 
-    private int sDateLB;
-
-    public void setSDateLB( int dateLB )
-    {
-        sDateLB = dateLB;
-    }
-
-    private int eDateLB;
-
-    public void setEDateLB( int dateLB )
-    {
-        eDateLB = dateLB;
-    }
-
     private String facilityLB;
 
     public void setFacilityLB( String facilityLB )
@@ -161,6 +147,13 @@
     {
         return mapDataValues;
     }
+    
+    private Map<DataValue, CaseAggregationCondition> mapCaseAggCondition;
+
+    public Map<DataValue, CaseAggregationCondition> getMapCaseAggCondition()
+    {
+        return mapCaseAggCondition;
+    }
 
     // -------------------------------------------------------------------------
     // Action Implementation
@@ -170,7 +163,8 @@
         throws Exception
     {
         mapDataValues = new HashMap<DataValue, String>();
-
+        mapCaseAggCondition = new HashMap<DataValue, CaseAggregationCondition>();
+        
         String storedBy = currentUserService.getCurrentUsername() + "_CAE";
 
         // ---------------------------------------------------------------------
@@ -183,7 +177,7 @@
         {
             return SUCCESS;
         }
-
+        
         List<OrganisationUnit> orgUnitList = new ArrayList<OrganisationUnit>();
         if ( facilityLB.equals( "children" ) )
         {
@@ -218,12 +212,12 @@
         Period startPeriod = periodGenericManager.getSelectedPeriod(
             PeriodGenericManager.SESSION_KEY_SELECTED_PERIOD_INDEX_START,
             PeriodGenericManager.SESSION_KEY_BASE_PERIOD_START );
-        
+
         Period endPeriod = periodGenericManager.getSelectedPeriod(
             PeriodGenericManager.SESSION_KEY_SELECTED_PERIOD_INDEX_END,
             PeriodGenericManager.SESSION_KEY_BASE_PERIOD_END );
-     
-        periodList = getPeriodList( (CalendarPeriodType)selectedDataSet.getPeriodType(), startPeriod, endPeriod );
+
+        periodList = getPeriodList( (CalendarPeriodType) selectedDataSet.getPeriodType(), startPeriod, endPeriod );
 
         // ---------------------------------------------------------------------
         // Aggregation
@@ -250,12 +244,10 @@
 
                         double resultValue = aggregationConditionService.parseConditition( condition, orgUnit, period );
 
-                        DataValue dataValue = dataValueService
-                                    .getDataValue( orgUnit, dElement, period, optionCombo );
-
+                        DataValue dataValue = dataValueService.getDataValue( orgUnit, dElement, period, optionCombo );
+                        
                         if ( resultValue != 0 )
                         {
-                           
                             if ( dataValue == null )
                             {
                                 dataValue = new DataValue( dElement, period, orgUnit, "" + resultValue, storedBy,
@@ -274,17 +266,19 @@
 
                                 mapDataValues.put( dataValue, i18n.getString( "updated" ) + " " + message );
                             }
+                            
+                            mapCaseAggCondition.put( dataValue, condition );
 
                         }
                         else if ( dataValue != null )
                         {
-                                DataValue dvalue = new DataValue( dElement, period, orgUnit, "", storedBy,
-                                    new Date(), null, optionCombo );
-                                dvalue.setValue( dataValue.getValue() + " " + i18n.getString( "old_value" ) ); 
-                                
-                                dataValueService.deleteDataValue( dataValue );
-
-                                mapDataValues.put( dvalue, i18n.getString( "deleted" ) + " " + message );
+                            DataValue dvalue = new DataValue( dElement, period, orgUnit, "", storedBy, new Date(),
+                                null, optionCombo );
+                            dvalue.setValue( dataValue.getValue() + " " + i18n.getString( "old_value" ) );
+
+                            dataValueService.deleteDataValue( dataValue );
+
+                            mapDataValues.put( dvalue, i18n.getString( "deleted" ) + " " + message );
                         }
 
                     }// PeriodList end
@@ -319,21 +313,21 @@
 
     private List<Period> getPeriodList( CalendarPeriodType periodType, Period startPeriod, Period endPeriod )
     {
-        Period period = periodType.createPeriod( startPeriod.getStartDate());
+        Period period = periodType.createPeriod( startPeriod.getStartDate() );
 
         List<Period> periods = new ArrayList<Period>();
-        
+
         periods.add( period );
-        
-        while ( period.getEndDate().before( endPeriod.getEndDate() ))
+
+        while ( period.getEndDate().before( endPeriod.getEndDate() ) )
         {
-            period = periodType.getNextPeriod( period ) ;
+            period = periodType.getNextPeriod( period );
             periods.add( period );
         }
 
-        period = periodType.createPeriod( endPeriod.getStartDate() ) ;
+        period = periodType.createPeriod( endPeriod.getStartDate() );
         periods.add( period );
-        
+
         return periods;
     }
 

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultDetailsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultDetailsAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultDetailsAction.java	2011-03-24 03:34:53 +0000
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2004-2009, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.caseentry.action.caseaggregation;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
+import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patientdatavalue.PatientDataValue;
+import org.hisp.dhis.patientdatavalue.PatientDataValueService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version CaseAggregationResultDetailsAction.java Mar 23, 2011 10:42:51 AM $
+ */
+public class CaseAggregationResultDetailsAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnitService organisationUnitService;
+
+    private PeriodService periodService;
+
+    private CaseAggregationConditionService aggregationConditionService;
+
+    private PatientDataValueService patientDataValueService;
+
+    // -------------------------------------------------------------------------
+    // Input and Output
+    // -------------------------------------------------------------------------
+
+    private Integer orgunitId;
+
+    private Integer aggregationConditionId;
+
+    private Integer periodId;
+
+    private Map<Patient, Collection<PatientDataValue>> mapPatients;
+
+    // -------------------------------------------------------------------------
+    // Getters && Setters
+    // -------------------------------------------------------------------------
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    public void setPatientDataValueService( PatientDataValueService patientDataValueService )
+    {
+        this.patientDataValueService = patientDataValueService;
+    }
+
+    public void setAggregationConditionService( CaseAggregationConditionService aggregationConditionService )
+    {
+        this.aggregationConditionService = aggregationConditionService;
+    }
+
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    public Map<Patient, Collection<PatientDataValue>> getMapPatients()
+    {
+        return mapPatients;
+    }
+
+    public void setOrgunitId( Integer orgunitId )
+    {
+        this.orgunitId = orgunitId;
+    }
+
+    public void setAggregationConditionId( Integer aggregationConditionId )
+    {
+        this.aggregationConditionId = aggregationConditionId;
+    }
+
+    public void setPeriodId( Integer periodId )
+    {
+        this.periodId = periodId;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action Implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        mapPatients = new HashMap<Patient, Collection<PatientDataValue>>();
+        
+        OrganisationUnit orgunit = organisationUnitService.getOrganisationUnit( orgunitId );
+        
+        Period period = periodService.getPeriod( periodId );
+
+        CaseAggregationCondition aggCondition = aggregationConditionService
+            .getCaseAggregationCondition( aggregationConditionId );
+
+        Collection<Patient> patients = aggregationConditionService.getPatients( aggCondition, orgunit, period );
+
+        for ( Patient patient : patients )
+        {
+            Collection<DataElement> dataElements = aggregationConditionService.getDataElementsInCondition( aggCondition
+                .getAggregationExpression() );
+
+            Collection<PatientDataValue> dataValues = patientDataValueService.getPatientDataValues( patient,
+                dataElements, period.getStartDate(), period.getEndDate() );
+            
+            mapPatients.put( patient, dataValues );
+        }
+        return SUCCESS;
+    }
+
+}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2011-03-22 02:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2011-03-24 03:34:53 +0000
@@ -358,6 +358,7 @@
 		<property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
 		<property name="periodGenericManager" ref="org.hisp.dhis.caseentry.state.PeriodGenericManager" />
 	</bean>
+	
 	<bean
 		id="org.hisp.dhis.caseentry.action.caseaggregation.CaseAggregationResultAction"
 		class="org.hisp.dhis.caseentry.action.caseaggregation.CaseAggregationResultAction"
@@ -372,6 +373,18 @@
 		<property name="periodGenericManager" ref="org.hisp.dhis.caseentry.state.PeriodGenericManager" />
 	</bean>
 	
+	<bean
+		id="org.hisp.dhis.caseentry.action.caseaggregation.CaseAggregationResultDetailsAction"
+		class="org.hisp.dhis.caseentry.action.caseaggregation.CaseAggregationResultDetailsAction"
+		scope="prototype">
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+		<property name="aggregationConditionService"
+			ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
+		<property name="patientDataValueService"
+			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+	</bean>
+	
 	<bean id="org.hisp.dhis.caseentry.state.PeriodGenericManager"
 		class="org.hisp.dhis.caseentry.state.DefaultPeriodGenericManager"
 		scope="singleton">

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2011-03-22 02:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2011-03-24 03:34:53 +0000
@@ -238,20 +238,25 @@
     <action name="caseAggregationResult" class="org.hisp.dhis.caseentry.action.caseaggregation.CaseAggregationResultAction">                 
       <result name="success" type="velocity">/main.vm</result>
       <param name="page">/dhis-web-caseentry/caseAggregationResult.vm</param>
-      <param name="menu">/dhis-web-caseentry/menu.vm</param>      
+      <param name="menu">/dhis-web-caseentry/menu.vm</param>
+      <param name="javascripts">javascript/caseagg.js,javascript/date.js,javascript/caseAggregationForm.js</param>
+    </action>
+    
+    <action name="caseAggregationResultDetails" 
+    	class="org.hisp.dhis.caseentry.action.caseaggregation.CaseAggregationResultDetailsAction">
+    	<result name="success" type="velocity">/popup.vm</result>
+      	<param name="page">/dhis-web-caseentry/caseAggregationResultDetails.vm</param>    
     </action>
     
     <action name="nextPeriods"
-			class="org.hisp.dhis.caseentry.state.NextPeriodsAction">
-			<result name="success" type="velocity-json">
-				/dhis-web-commons/ajax/jsonPeriods.vm</result>
-		</action>
+		class="org.hisp.dhis.caseentry.state.NextPeriodsAction">
+		<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonPeriods.vm</result>
+	</action>
 
-		<action name="previousPeriods"
-			class="org.hisp.dhis.caseentry.state.PreviousPeriodsAction">
-			<result name="success" type="velocity-json">
-				/dhis-web-commons/ajax/jsonPeriods.vm</result>
-		</action>
+	<action name="previousPeriods"
+		class="org.hisp.dhis.caseentry.state.PreviousPeriodsAction">
+		<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonPeriods.vm</result>
+	</action>
 		  
   </package>
 </struts>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm	2010-12-03 06:08:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm	2011-03-24 03:34:53 +0000
@@ -4,24 +4,33 @@
 <p></p>
 <div>
 #if( $mapDataValues.keySet().size() > 0 )
-	<table width='100%'>
-		<tr>
-			<th>#</th>
-			<th>$i18n.getString('name')</th>
-			<th>$i18n.getString('value')</th>
-			<th>$i18n.getString('status')</th>
-		</tr>
-	#set ( $keys = $mapDataValues.keySet() )
-	#set ($index = 1)
-	#foreach( $key in $keys)
-		<tr id="tr${key.dataElement.id}">
-			<td>$index</td>
-			<td>$key.dataElement.getName()</td>
-			<td>$key.getValue()</td>
-			<td>$mapDataValues.get($key)</td>
-		</tr>
-		#set ($index = $index + 1)
-	#end
+	<table class='mainPageTable listTable'>
+		  <col width="40">          
+          <col>
+          <col>
+          <col>  
+		<thead>
+			<tr>
+				<th>#</th>
+				<th>$i18n.getString('name')</th>
+				<th>$i18n.getString('value')</th>
+				<th>$i18n.getString('status')</th>
+			</tr>
+		</thead>
+		
+		#set ( $keys = $mapDataValues.keySet() )
+		#set ($index = 1)
+		<tbody>
+			#foreach( $key in $keys)
+				<tr id="tr${key.dataElement.id}" style="cursor: pointer" onclick="viewResultDetails($key.source.id,$key.period.id,$mapCaseAggCondition.get($key).id)">
+					<td>$index</td>
+					<td>$key.dataElement.getName()</td>
+					<td>$key.getValue()</td>
+					<td>$mapDataValues.get($key)</td>
+				</tr>
+				#set ($index = $index + 1)
+			#end
+		</tbody>
 	</table>
 
 #else

=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResultDetails.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResultDetails.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResultDetails.vm	2011-03-24 03:34:53 +0000
@@ -0,0 +1,34 @@
+<table class='mainPageTable listTable'>
+	<thead>
+		<th>$i18n.getString('full_name')</th>
+		<th>$i18n.getString('program_stage')</th>
+		<th>$i18n.getString('data_element')</th>
+		<th>$i18n.getString('value')</th>
+	</thead>
+	<tbody>
+		#foreach( $patient in $mapPatients.keySet())
+			<tr id="tr${patientDataValue.dataElement.id}" style='background-color: #cccccc'>
+				<td>$patient.getFullName()</td>
+				<td></td>
+				<td></td>
+				<td></td>
+			</tr>
+			
+			#set($dataValues = $mapPatients.get($patient) )
+			#if( $!dataValues )
+				#foreach( $dataValue in $dataValues )
+				<tr>
+					<td></td>
+					<td>$dataValue.programStageInstance.programStage.name</td>
+					<td>$dataValue.dataElement.name</td>
+					<td>$dataValue.value</td>
+				</tr>
+				#end
+			#else
+				<tr>
+					<td colspan='4'></td>
+				</tr>
+			#end
+		#end
+	</tbody>
+</table>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseAggregationForm.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseAggregationForm.js	2011-03-22 09:35:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseAggregationForm.js	2011-03-24 03:34:53 +0000
@@ -14,6 +14,7 @@
 	validation2( 'caseAggregationForm', function(form) {
 		validationCaseAggregation();
 	}, {
+		
 		'rules': rules
 	})
 }); 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js	2011-03-22 02:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js	2011-03-24 03:34:53 +0000
@@ -111,3 +111,22 @@
         setMessage(message.firstChild.nodeValue);
     }
 }
+
+function viewResultDetails( orgunitId, periodId, aggregationConditionId ) 
+{
+	var url = 'caseAggregationResultDetails.action?';
+		url+= 'orgunitId=' + orgunitId;
+		url+= '&periodId=' + periodId;
+		url+= '&aggregationConditionId=' + aggregationConditionId;
+		
+	$('#contentDetails').dialog('destroy').remove();
+    $('<div id="contentDetails">' ).load(url).dialog({
+        title: '',
+		maximize: true, 
+		closable: true,
+		modal:true,
+		overlay:{background:'#000000', opacity:0.1},
+		width: 800,
+        height: 400
+    });
+}