← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6118: (patient) Don't load details of case aggregation result.

 

------------------------------------------------------------
revno: 6118
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-02-27 13:09:39 +0700
message:
  (patient) Don't load details of case aggregation result.
modified:
  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/caseAggregationResult.vm
  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-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	2012-02-07 08:39:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultDetailsAction.java	2012-02-27 06:09:39 +0000
@@ -35,6 +35,7 @@
 import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
 import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
 import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.patient.Patient;
@@ -42,6 +43,7 @@
 import org.hisp.dhis.patientdatavalue.PatientDataValueService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.program.ProgramStageInstance;
 
 import com.opensymphony.xwork2.Action;
@@ -65,6 +67,8 @@
 
     private PatientDataValueService patientDataValueService;
 
+    private I18nFormat format;
+
     // -------------------------------------------------------------------------
     // Input/Output
     // -------------------------------------------------------------------------
@@ -73,10 +77,12 @@
 
     private Integer aggregationConditionId;
 
-    private Integer periodId;
+    private String periodTypeName;
+
+    private String startDate;
 
     private Map<Patient, Collection<PatientDataValue>> mapPatients;
-    
+
     private Map<ProgramStageInstance, Collection<PatientDataValue>> mapEvents;
 
     // -------------------------------------------------------------------------
@@ -103,6 +109,16 @@
         this.periodService = periodService;
     }
 
+    public void setPeriodTypeName( String periodTypeName )
+    {
+        this.periodTypeName = periodTypeName;
+    }
+
+    public void setStartDate( String startDate )
+    {
+        this.startDate = startDate;
+    }
+
     public Map<Patient, Collection<PatientDataValue>> getMapPatients()
     {
         return mapPatients;
@@ -122,10 +138,10 @@
     {
         this.aggregationConditionId = aggregationConditionId;
     }
-
-    public void setPeriodId( Integer periodId )
+    
+    public void setFormat( I18nFormat format )
     {
-        this.periodId = periodId;
+        this.format = format;
     }
 
     // -------------------------------------------------------------------------
@@ -136,32 +152,33 @@
     public String execute()
         throws Exception
     {
-        
         OrganisationUnit orgunit = organisationUnitService.getOrganisationUnit( orgunitId );
 
-        Period period = periodService.getPeriod( periodId );
+        PeriodType periodType = periodService.getPeriodTypeByName( periodTypeName );
+        Period period = periodType.createPeriod( format.parseDate( startDate ) );
 
         CaseAggregationCondition aggCondition = aggregationConditionService
             .getCaseAggregationCondition( aggregationConditionId );
 
-        if( aggCondition.getOperator().equals( CaseAggregationCondition.AGGRERATION_SUM ) )
+        if ( aggCondition.getOperator().equals( CaseAggregationCondition.AGGRERATION_SUM ) )
         {
             mapEvents = new HashMap<ProgramStageInstance, Collection<PatientDataValue>>();
-            
-            Collection<ProgramStageInstance> programStageInstances = aggregationConditionService.getProgramStageInstances( aggCondition, orgunit, period );
+
+            Collection<ProgramStageInstance> programStageInstances = aggregationConditionService
+                .getProgramStageInstances( aggCondition, orgunit, period );
 
             for ( ProgramStageInstance programStageInstance : programStageInstances )
             {
-                Collection<DataElement> dataElements = aggregationConditionService.getDataElementsInCondition( aggCondition
-                    .getAggregationExpression() );
+                Collection<DataElement> dataElements = aggregationConditionService
+                    .getDataElementsInCondition( aggCondition.getAggregationExpression() );
 
                 Collection<PatientDataValue> dataValues = new HashSet<PatientDataValue>();
-    
+
                 if ( dataElements.size() > 0 )
                 {
                     dataValues = patientDataValueService.getPatientDataValues( programStageInstance, dataElements );
                 }
-                
+
                 mapEvents.put( programStageInstance, dataValues );
             }
         }
@@ -170,20 +187,20 @@
             mapPatients = new HashMap<Patient, Collection<PatientDataValue>>();
 
             Collection<Patient> patients = aggregationConditionService.getPatients( aggCondition, orgunit, period );
-    
+
             for ( Patient patient : patients )
             {
-                Collection<DataElement> dataElements = aggregationConditionService.getDataElementsInCondition( aggCondition
-                    .getAggregationExpression() );
-    
+                Collection<DataElement> dataElements = aggregationConditionService
+                    .getDataElementsInCondition( aggCondition.getAggregationExpression() );
+
                 Collection<PatientDataValue> dataValues = new HashSet<PatientDataValue>();
-    
+
                 if ( dataElements.size() > 0 )
                 {
-                    dataValues = patientDataValueService.getPatientDataValues( patient,
-                        dataElements, period.getStartDate(), period.getEndDate() );
+                    dataValues = patientDataValueService.getPatientDataValues( patient, dataElements, period
+                        .getStartDate(), period.getEndDate() );
                 }
-                
+
                 mapPatients.put( patient, dataValues );
             }
         }

=== 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	2012-02-27 05:35:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm	2012-02-27 06:09:39 +0000
@@ -50,7 +50,7 @@
 							<td>$dataValue.value</td>
 							<td>$!mapStatusValues.get( $statusKey )</td>
 							<td>
-								<a href="javascript:viewResultDetails($orgunit.id,$period.id,$mapCaseAggCondition.get($dataValue).id)" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+								<a href='javascript:viewResultDetails($orgunit.id, "$period.periodType.name", "$format.formatDate($period.startDate)",$mapCaseAggCondition.get($dataValue).id)' title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
 							</td>
 						</tr>
 						#set( $mark = !$mark  )

=== 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	2012-02-27 05:35:23 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js	2012-02-27 06:09:39 +0000
@@ -103,12 +103,13 @@
     }
 }
 
-function viewResultDetails( orgunitId, periodId, aggregationConditionId ) 
+function viewResultDetails( orgunitId, periodTypeName, startDate, aggregationConditionId ) 
 {
 	$('#contentDetails' ).val('');
 	var url = 'caseAggregationResultDetails.action?';
 		url+= 'orgunitId=' + orgunitId;
-		url+= '&periodId=' + periodId;
+		url+= '&periodTypeName=' + periodTypeName;
+		url+= '&startDate=' + startDate;
 		url+= '&aggregationConditionId=' + aggregationConditionId;
 		
 	$('#contentDetails' ).load(url).dialog({