← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5890: (patient) Description for program-stage formula.

 

------------------------------------------------------------
revno: 5890
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-02-08 20:27:22 +0700
message:
  (patient) Description for program-stage formula.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java


--
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-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	2012-02-08 12:43:00 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2012-02-08 13:27:22 +0000
@@ -214,7 +214,7 @@
         Period period )
     {
         String sql = convertCondition( aggregationCondition, orgunit, period );
-System.out.println("\n\n SQL : " + sql);
+
         Collection<Integer> patientIds = aggregationConditionStore.executeSQL( sql );
 
         if ( patientIds == null )
@@ -381,6 +381,20 @@
                     matcher.appendReplacement( description, "[" + OBJECT_PROGRAM + SEPARATOR_OBJECT + program.getName()
                         + "]" );
                 }
+                else if ( info[0].equalsIgnoreCase( OBJECT_PROGRAM_STAGE ) )
+                {
+                    int objectId = Integer.parseInt( ids[0] );
+
+                    ProgramStage programStage = programStageService.getProgramStage( objectId );
+
+                    if ( programStage == null )
+                    {
+                        return INVALID_CONDITION;
+                    }
+
+                    matcher.appendReplacement( description, "[" + OBJECT_PROGRAM_STAGE + SEPARATOR_OBJECT + programStage.getName()
+                        + "]" );
+                }
             }
 
         }