← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12922: support more cases for lost to follow up [j2me]

 

------------------------------------------------------------
revno: 12922
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-11-12 15:07:20 +0700
message:
  support more cases for lost to follow up [j2me] 
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
  dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.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-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-11-11 02:20:40 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-11-12 08:07:20 +0000
@@ -1325,8 +1325,13 @@
                 {
                     programs.add( program );
                 }
+                else
+                {
+                    System.out.println("program name: "+program.getName());
+                }
             }
         }
+        System.out.println("final size: "+programs.size());
         return programs;
     }
 
@@ -1972,11 +1977,35 @@
     }
 
     @Override
-    public String findLostToFollowUp( int orgUnitId, String programId )
+    public String findLostToFollowUp( int orgUnitId, String searchEventInfos )
         throws NotAllowedException
     {
+        String[] searchEventInfosArray = searchEventInfos.split( "-" );
+        
+        int programStageStatus = 0;
+        
+        if ( searchEventInfosArray[1].equalsIgnoreCase("Scheduled in future") )
+        {
+            programStageStatus = ProgramStageInstance.FUTURE_VISIT_STATUS;
+        }
+        else if ( searchEventInfosArray[1].equalsIgnoreCase("Overdue") )
+        {
+            programStageStatus = ProgramStageInstance.LATE_VISIT_STATUS;
+        }
+        
+        boolean followUp;
+        
+        if ( searchEventInfosArray[2].equalsIgnoreCase( "true" ) )
+        {
+            followUp = true;
+        }
+        else
+        {
+            followUp = false;
+        }
+            
         String eventsInfo = "";
-        Boolean followUp = false;
+        
         DateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd" );
 
         List<String> searchTextList = new ArrayList<String>();
@@ -1993,9 +2022,9 @@
 
         Date fromDate = fromCalendar.getTime();
 
-        String searchText = Patient.PREFIX_PROGRAM_EVENT_BY_STATUS + "_" + programId + "_"
+        String searchText = Patient.PREFIX_PROGRAM_EVENT_BY_STATUS + "_" + searchEventInfosArray[0] + "_"
             + formatter.format( fromDate ) + "_" + formatter.format( toDate ) + "_" + orgUnitId + "_" + true + "_"
-            + ProgramStageInstance.LATE_VISIT_STATUS;
+            + programStageStatus;
 
         searchTextList.add( searchText );
         orgUnitList.add( organisationUnitService.getOrganisationUnit( orgUnitId ) );

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-11-05 08:07:19 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-11-12 08:07:20 +0000
@@ -641,7 +641,7 @@
                     case ProgramStageInstance.FUTURE_VISIT_STATUS:
                         patientWhere += condition + operatorStatus + "( psi.executiondate is null and psi.duedate>='"
                             + keys[2] + "' and psi.duedate<='" + keys[3]
-                            + "' and psi.status is null and (DATE(now()) - DATE(psi.duedate) <= 0) ";
+                            + "' and psi.status is not null and (DATE(now()) - DATE(psi.duedate) <= 0) ";
 
                         // get events by orgunit children
                         if ( keys[4].equals( "-1" ) )

=== modified file 'dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java	2013-11-11 02:20:40 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java	2013-11-12 08:07:20 +0000
@@ -442,11 +442,11 @@
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/findLostToFollowUp" )
     @ResponseBody
     public String findLostToFollowUp( @PathVariable
-    int id, @RequestHeader( "programId" )
-    String programId )
+    int id, @RequestHeader( "searchEventInfos" )
+    String searchEventInfos )
         throws NotAllowedException
     {
-        return activityReportingService.findLostToFollowUp( id, programId );
+        return activityReportingService.findLostToFollowUp( id, searchEventInfos );
     }
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/LWUIT/orgUnits/{id}/handleLostToFollowUp" )