← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15330: https://blueprints.launchpad.net/dhis-mobile/+spec/enhance-tracker-client

 

------------------------------------------------------------
revno: 15330
committer: sherylyn.marie
branch nick: dhis2
timestamp: Wed 2014-05-21 17:03:33 +0800
message:
  https://blueprints.launchpad.net/dhis-mobile/+spec/enhance-tracker-client
  #3 VISIT SCHEDULE
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java
  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/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java
  dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java
  dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.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/api/mobile/ActivityReportingService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java	2014-05-21 08:14:27 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java	2014-05-21 09:03:33 +0000
@@ -105,6 +105,9 @@
     Collection<User> findUser( String keyword )
         throws NotAllowedException;
 
+    String findVisitSchedule( int orgUnitId, int programId, String info )
+        throws NotAllowedException;
+
     String sendMessage( Message message )
         throws NotAllowedException;
 

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java	2014-05-16 06:06:48 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java	2014-05-21 09:03:33 +0000
@@ -91,6 +91,8 @@
 
     private String findPatientInAdvancedUrl;
 
+    private String findVisitScheduleUrl;
+
     private String findLostToFollowUpUrl;
 
     private String handleLostToFollowUpUrl;
@@ -352,6 +354,16 @@
     {
         this.findPatientInAdvancedUrl = findPatientInAdvancedUrl;
     }
+    
+    public String getFindVisitScheduleUrl()
+    {
+        return findVisitScheduleUrl;
+    }
+    
+    public void setFindVisitScheduleUrl( String findVisitScheduleUrl )
+    {
+        this.findVisitScheduleUrl = findVisitScheduleUrl;
+    }
 
     public String getFindLostToFollowUpUrl()
     {
@@ -420,6 +432,7 @@
         dataOutputStream.writeUTF( downloadAnonymousProgramUrl );
         dataOutputStream.writeUTF( findProgramUrl );
         dataOutputStream.writeUTF( findPatientInAdvancedUrl );
+        dataOutputStream.writeUTF( findVisitScheduleUrl );
         dataOutputStream.writeUTF( findLostToFollowUpUrl );
         dataOutputStream.writeUTF( handleLostToFollowUpUrl );
         dataOutputStream.writeUTF( generateRepeatableEventUrl );
@@ -454,6 +467,7 @@
         downloadAnonymousProgramUrl = dataInputStream.readUTF();
         findProgramUrl = dataInputStream.readUTF();
         findPatientInAdvancedUrl = dataInputStream.readUTF();
+        findVisitScheduleUrl = dataInputStream.readUTF();
         findLostToFollowUpUrl = dataInputStream.readUTF();
         handleLostToFollowUpUrl = dataInputStream.readUTF();
         generateRepeatableEventUrl = dataInputStream.readUTF();
@@ -526,6 +540,7 @@
         dataOutputStream.writeUTF( downloadAnonymousProgramUrl );
         dataOutputStream.writeUTF( findProgramUrl );
         dataOutputStream.writeUTF( findPatientInAdvancedUrl );
+        dataOutputStream.writeUTF( findVisitScheduleUrl );
         dataOutputStream.writeUTF( findLostToFollowUpUrl );
         dataOutputStream.writeUTF( handleLostToFollowUpUrl );
         dataOutputStream.writeUTF( generateRepeatableEventUrl );

=== 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	2014-05-21 08:14:27 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2014-05-21 09:03:33 +0000
@@ -1776,7 +1776,8 @@
         programInstanceService.updateProgramInstance( programInstance );
 
         org.hisp.dhis.api.mobile.model.LWUITmodel.Patient mobilePatient = getPatientModel( entityInstanceService
-            .getTrackedEntityInstance( programInstance.getEntityInstance().getId() ) );
+            .getTrackedEntityInstance( programInstance.getEntityInstance().getId() ) ); // TODO:
+                                                                                        // SHERIE
 
         return mobilePatient;
     }
@@ -1896,6 +1897,111 @@
     }
 
     @Override
+    public String findVisitSchedule( int orgUnitId, int programId, String info )
+        throws NotAllowedException
+    {
+        String status = info.substring( 0, info.indexOf( "$" ) );
+        String fromDays = info.substring( info.indexOf( "$" ) + 1, info.indexOf( "/" ) );
+        String toDays = info.substring( info.indexOf( "/" ) + 1 );
+
+        // Event Status
+        EventStatus eventStatus = null;
+
+        if ( status.equals( "Schedule in future" ) )
+        {
+            eventStatus = EventStatus.FUTURE_VISIT;
+        }
+        else if ( status.equals( "Overdue" ) )
+        {
+            eventStatus = EventStatus.LATE_VISIT;
+        }
+        else if ( status.equals( "Incomplete" ) )
+        {
+            eventStatus = EventStatus.VISITED;
+        }
+        else if ( status.equals( "Completed" ) )
+        {
+            eventStatus = EventStatus.COMPLETED;
+        }
+        else if ( status.equals( "Skipped" ) )
+        {
+            eventStatus = EventStatus.SKIPPED;
+        }
+
+        // From/To Date
+        Date fromDate = getDate( -1, fromDays );
+        Date toDate = getDate( 1, toDays );
+
+        TrackedEntityInstanceQueryParams param = new TrackedEntityInstanceQueryParams();
+        List<TrackedEntityAttribute> trackedEntityAttributeList = new ArrayList<TrackedEntityAttribute>(
+            attributeService.getTrackedEntityAttributesByDisplayOnVisitSchedule( true ) );
+
+        for ( TrackedEntityAttribute trackedEntityAttribute : trackedEntityAttributeList )
+        {
+            QueryItem queryItem = new QueryItem( trackedEntityAttribute );
+            param.addAttribute( queryItem );
+        }
+
+        param.setProgram( programService.getProgram( programId ) );
+        param.addOrganisationUnit( organisationUnitService.getOrganisationUnit( orgUnitId ) );
+        param.setEventStatus( eventStatus );
+        param.setEventStartDate( fromDate );
+        param.setEventEndDate( toDate );
+
+        Grid programStageInstanceGrid = entityInstanceService.getTrackedEntityInstances( param );
+        List<List<Object>> listOfListProgramStageInstance = programStageInstanceGrid.getRows();
+
+        if ( listOfListProgramStageInstance.size() == 0 )
+        {
+            throw NotAllowedException.NO_EVENT_FOUND;
+        }
+
+        String eventsInfo = "";
+        for ( List<Object> row : listOfListProgramStageInstance )
+        {
+            TrackedEntityInstance instance = entityInstanceService.getTrackedEntityInstance( (String)row.get(0) );
+            Collection<TrackedEntityAttribute> displayAttributes = attributeService.getTrackedEntityAttributesDisplayInList();
+            
+            eventsInfo += instance.getId() + "/";
+            String displayName = "";
+            for ( TrackedEntityAttribute displayAttribute : displayAttributes )
+            {
+                TrackedEntityAttributeValue value = attValueService.getTrackedEntityAttributeValue( instance, displayAttribute );
+                if ( value != null )
+                {
+                    displayName += value.getValue() + " ";
+                }
+            }
+            eventsInfo += displayName.trim() + "$";
+        }
+
+        return eventsInfo;
+    }
+
+    public Date getDate( int operation, String adjustment )
+    {
+        Calendar calendar = Calendar.getInstance();
+
+        if ( adjustment.equals( "1 day" ) )
+        {
+            calendar.add( Calendar.DATE, operation );
+        }
+        else if ( adjustment.equals( "3 days" ) )
+        {
+            calendar.add( Calendar.DATE, operation * 3 );
+        }
+        else if ( adjustment.equals( "1 week" ) )
+        {
+            calendar.add( Calendar.DATE, operation * 7 );
+        }
+        else if ( adjustment.equals( "1 month"   ))
+        {
+            calendar.add( Calendar.DATE, operation * 30 );
+        }
+        return calendar.getTime();
+    }
+
+    @Override
     public String sendMessage( org.hisp.dhis.api.mobile.model.Message message )
         throws NotAllowedException
     {

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java	2014-05-16 06:06:48 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java	2014-05-21 09:03:33 +0000
@@ -72,6 +72,7 @@
         unit.setDownloadAnonymousProgramUrl( "downloadAnonymousProgramUrl" );
         unit.setFindProgramUrl( "findProgramUrl" );
         unit.setFindPatientInAdvancedUrl( "findPatientInAdvanced" );
+        unit.setFindVisitScheduleUrl( "findVisitSchedule" );
         unit.setFindLostToFollowUpUrl( "findLostToFollowUpUrl" );
         unit.setHandleLostToFollowUpUrl( "handleLostToFollowUpUrl" );
         unit.setGenerateRepeatableEventUrl( "generateRepeatableEventUrl" );

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java	2014-05-16 06:06:48 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java	2014-05-21 09:03:33 +0000
@@ -98,6 +98,7 @@
         orgUnit.setDownloadAnonymousProgramUrl( "downloadAnonymousProgram" );
         orgUnit.setFindProgramUrl( "findProgram" );
         orgUnit.setFindPatientInAdvancedUrl( "findPatientInAdvanced" );
+        orgUnit.setFindVisitScheduleUrl( "findVisitSchedule" );
         orgUnit.setFindLostToFollowUpUrl( "findLostToFollowUp" );
         orgUnit.setHandleLostToFollowUpUrl( "handleLostToFollowUp" );
         orgUnit.setGenerateRepeatableEventUrl( "generateRepeatableEvent" );

=== modified file 'dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java	2014-05-16 06:06:48 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java	2014-05-21 09:03:33 +0000
@@ -160,6 +160,7 @@
         orgUnit.setDownloadAnonymousProgramUrl( getUrl( request, unit.getId(), "downloadAnonymousProgram" ) );
         orgUnit.setFindProgramUrl( getUrl( request, unit.getId(), "findProgram" ) );
         orgUnit.setFindPatientInAdvancedUrl( getUrl( request, unit.getId(), "findPatientInAdvanced" ) );
+        orgUnit.setFindVisitScheduleUrl( getUrl( request, unit.getId(), "findVisitSchedule" ) );
         orgUnit.setFindLostToFollowUpUrl( getUrl( request, unit.getId(), "findLostToFollowUp" ) );
         orgUnit.setHandleLostToFollowUpUrl( getUrl( request, unit.getId(), "handleLostToFollowUp" ) );
         orgUnit.setGenerateRepeatableEventUrl( getUrl( request, unit.getId(), "generateRepeatableEvent" ) );

=== 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	2014-05-21 08:14:27 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java	2014-05-21 09:03:33 +0000
@@ -112,9 +112,7 @@
     // For client version 2.8 and lower
     @RequestMapping( method = RequestMethod.GET, value = "orgUnits/{id}/all" )
     @ResponseBody
-    public MobileModel getAllDataForOrgUnit2_8( @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale )
+    public MobileModel getAllDataForOrgUnit2_8( @PathVariable int id, @RequestHeader( "accept-language" ) String locale )
     {
         MobileModel mobileModel = new MobileModel();
         mobileModel.setClientVersion( DataStreamSerializable.TWO_POINT_EIGHT );
@@ -129,10 +127,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "orgUnits/{id}/updateDataSets" )
     @ResponseBody
-    public DataSetList checkUpdatedDataSet2_8( @PathVariable
-    int id, @RequestBody
-    DataSetList dataSetList, @RequestHeader( "accept-language" )
-    String locale )
+    public DataSetList checkUpdatedDataSet2_8( @PathVariable int id, @RequestBody DataSetList dataSetList,
+        @RequestHeader( "accept-language" ) String locale )
     {
         DataSetList returnList = facilityReportingService.getUpdatedDataSet( dataSetList, getUnit( id ), locale );
         returnList.setClientVersion( DataStreamSerializable.TWO_POINT_EIGHT );
@@ -147,9 +143,7 @@
      */
     @RequestMapping( method = RequestMethod.POST, value = "orgUnits/{id}/dataSets" )
     @ResponseBody
-    public String saveDataSetValues2_8( @PathVariable
-    int id, @RequestBody
-    DataSetValue dataSetValue )
+    public String saveDataSetValues2_8( @PathVariable int id, @RequestBody DataSetValue dataSetValue )
         throws NotAllowedException
     {
         facilityReportingService.saveDataSetValues( getUnit( id ), dataSetValue );
@@ -165,9 +159,7 @@
      */
     @RequestMapping( method = RequestMethod.POST, value = "orgUnits/{id}/activities" )
     @ResponseBody
-    public String saveActivityReport2_8( @PathVariable
-    int id, @RequestBody
-    ActivityValue activityValue )
+    public String saveActivityReport2_8( @PathVariable int id, @RequestBody ActivityValue activityValue )
         throws NotAllowedException
     {
         // FIXME set the last argument to 0 to fix compilation error
@@ -177,10 +169,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "orgUnits/{id}/activitiyplan" )
     @ResponseBody
-    public MobileModel updatePrograms2_8( @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale, @RequestBody
-    ModelList programsFromClient )
+    public MobileModel updatePrograms2_8( @PathVariable int id, @RequestHeader( "accept-language" ) String locale,
+        @RequestBody ModelList programsFromClient )
     {
         MobileModel model = new MobileModel();
         model.setClientVersion( DataStreamSerializable.TWO_POINT_EIGHT );
@@ -192,9 +182,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "orgUnits/{id}/changeLanguageDataSet" )
     @ResponseBody
-    public DataSetList changeLanguageDataSet2_8( @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale )
+    public DataSetList changeLanguageDataSet2_8( @PathVariable int id, @RequestHeader( "accept-language" ) String locale )
     {
         return facilityReportingService.getDataSetsForLocale( getUnit( id ), locale );
     }
@@ -203,10 +191,8 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/all" )
     @ResponseBody
-    public MobileModel getAllDataForOrgUnit( @PathVariable
-    String clientVersion, @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale )
+    public MobileModel getAllDataForOrgUnit( @PathVariable String clientVersion, @PathVariable int id,
+        @RequestHeader( "accept-language" ) String locale )
     {
         MobileModel mobileModel = new MobileModel();
         mobileModel.setClientVersion( clientVersion );
@@ -224,11 +210,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/updateDataSets" )
     @ResponseBody
-    public DataSetList checkUpdatedDataSet( @PathVariable
-    String clientVersion, @PathVariable
-    int id, @RequestBody
-    DataSetList dataSetList, @RequestHeader( "accept-language" )
-    String locale )
+    public DataSetList checkUpdatedDataSet( @PathVariable String clientVersion, @PathVariable int id,
+        @RequestBody DataSetList dataSetList, @RequestHeader( "accept-language" ) String locale )
     {
         DataSetList returnList = facilityReportingService.getUpdatedDataSet( dataSetList, getUnit( id ), locale );
         returnList.setClientVersion( clientVersion );
@@ -244,9 +227,7 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/dataSets" )
     @ResponseBody
-    public String saveDataSetValues( @PathVariable
-    int id, @RequestBody
-    DataSetValue dataSetValue )
+    public String saveDataSetValues( @PathVariable int id, @RequestBody DataSetValue dataSetValue )
         throws NotAllowedException
     {
         facilityReportingService.saveDataSetValues( getUnit( id ), dataSetValue );
@@ -255,9 +236,7 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/dataSetValue" )
     @ResponseBody
-    public DataSetValueList getDataSetValues( @PathVariable
-    int id, @RequestBody
-    DataSetList dataSetList )
+    public DataSetValueList getDataSetValues( @PathVariable int id, @RequestBody DataSetList dataSetList )
         throws NotAllowedException
     {
         return facilityReportingService.getDataSetValues( getUnit( id ), dataSetList );
@@ -265,11 +244,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/activitiyplan" )
     @ResponseBody
-    public MobileModel updatePrograms( @PathVariable
-    String clientVersion, @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale, @RequestBody
-    ModelList programsFromClient )
+    public MobileModel updatePrograms( @PathVariable String clientVersion, @PathVariable int id,
+        @RequestHeader( "accept-language" ) String locale, @RequestBody ModelList programsFromClient )
     {
         MobileModel model = new MobileModel();
         model.setClientVersion( clientVersion );
@@ -307,9 +283,7 @@
      */
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/activities" )
     @ResponseBody
-    public String saveActivityReport( @PathVariable
-    int id, @RequestBody
-    ActivityValue activityValue )
+    public String saveActivityReport( @PathVariable int id, @RequestBody ActivityValue activityValue )
         throws NotAllowedException
     {
         // FIXME set the last argument to 0 to fix compilation error
@@ -319,9 +293,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/changeLanguageDataSet" )
     @ResponseBody
-    public DataSetList changeLanguageDataSet( @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale )
+    public DataSetList changeLanguageDataSet( @PathVariable int id, @RequestHeader( "accept-language" ) String locale )
     {
         return facilityReportingService.getDataSetsForLocale( getUnit( id ), locale );
     }
@@ -335,9 +307,8 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/all" )
     @ResponseBody
-    public org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel getAllDataForOrgUnitLWUIT( @PathVariable
-    String clientVersion, @PathVariable
-    int id )
+    public org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel getAllDataForOrgUnitLWUIT(
+        @PathVariable String clientVersion, @PathVariable int id )
     {
         org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel mobileModel = new org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel();
         mobileModel.setClientVersion( clientVersion );
@@ -356,9 +327,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/findPatient" )
     @ResponseBody
-    public Patient findPatientByName( @PathVariable
-    int id, @RequestHeader( "patientId" )
-    String patientId )
+    public Patient findPatientByName( @PathVariable int id, @RequestHeader( "patientId" ) String patientId )
         throws NotAllowedException
     {
         return activityReportingService.findPatient( Integer.parseInt( patientId ) );
@@ -366,10 +335,8 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/findPatientInAdvanced/{programId}" )
     @ResponseBody
-    public String findPatientInAdvanced( @PathVariable
-    int programId, @PathVariable
-    int id, @RequestHeader( "name" )
-    String keyword )
+    public String findPatientInAdvanced( @PathVariable int programId, @PathVariable int id,
+        @RequestHeader( "name" ) String keyword )
         throws NotAllowedException
     {
         return activityReportingService.findPatientInAdvanced( keyword, id, programId );
@@ -377,10 +344,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/LWUIT/orgUnits/{id}/uploadProgramStage/{patientId}" )
     @ResponseBody
-    public String saveProgramStage( @PathVariable
-    int patientId, @PathVariable
-    int id, @RequestBody
-    ProgramStage programStage )
+    public String saveProgramStage( @PathVariable int patientId, @PathVariable int id,
+        @RequestBody ProgramStage programStage )
         throws NotAllowedException
     {
         return activityReportingService.saveProgramStage( programStage, patientId, id );
@@ -388,9 +353,7 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/LWUIT/orgUnits/{id}/uploadSingleEventWithoutRegistration" )
     @ResponseBody
-    public String saveSingleEventWithoutRegistration( @PathVariable
-    int id, @RequestBody
-    ProgramStage programStage )
+    public String saveSingleEventWithoutRegistration( @PathVariable int id, @RequestBody ProgramStage programStage )
         throws NotAllowedException
     {
         return activityReportingService.saveSingleEventWithoutRegistration( programStage, id );
@@ -398,9 +361,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/enrollProgram" )
     @ResponseBody
-    public Patient enrollProgram( @PathVariable
-    int id, @RequestHeader( "enrollInfo" )
-    String enrollInfo )
+    public Patient enrollProgram( @PathVariable int id, @RequestHeader( "enrollInfo" ) String enrollInfo )
         throws NotAllowedException
     {
         return activityReportingService.enrollProgram( enrollInfo, null, new Date() );
@@ -408,9 +369,7 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/LWUIT/orgUnits/{id}/addRelationship" )
     @ResponseBody
-    public Patient addRelationship( @PathVariable
-    int id, @RequestBody
-    Relationship enrollmentRelationship )
+    public Patient addRelationship( @PathVariable int id, @RequestBody Relationship enrollmentRelationship )
         throws NotAllowedException
     {
         return activityReportingService.addRelationship( enrollmentRelationship, id );
@@ -418,9 +377,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/downloadAnonymousProgram" )
     @ResponseBody
-    public Program getAnonymousProgram( @PathVariable
-    int id, @RequestHeader( "programType" )
-    String programType )
+    public Program getAnonymousProgram( @PathVariable int id, @RequestHeader( "programType" ) String programType )
         throws NotAllowedException
     {
         return activityReportingService.getAllProgramByOrgUnit( id, programType );
@@ -428,9 +385,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/findProgram" )
     @ResponseBody
-    public Program findProgram( @PathVariable
-    int id, @RequestHeader( "info" )
-    String programInfo )
+    public Program findProgram( @PathVariable int id, @RequestHeader( "info" ) String programInfo )
         throws NotAllowedException
     {
         return activityReportingService.findProgram( programInfo );
@@ -438,9 +393,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/findLostToFollowUp" )
     @ResponseBody
-    public String findLostToFollowUp( @PathVariable
-    int id, @RequestHeader( "searchEventInfos" )
-    String searchEventInfos )
+    public String findLostToFollowUp( @PathVariable int id, @RequestHeader( "searchEventInfos" ) String searchEventInfos )
         throws NotAllowedException
     {
         return activityReportingService.findLostToFollowUp( id, searchEventInfos );
@@ -448,9 +401,7 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/LWUIT/orgUnits/{id}/handleLostToFollowUp" )
     @ResponseBody
-    public Notification handleLostToFollowUp( @PathVariable
-    int id, @RequestBody
-    LostEvent lostEvent )
+    public Notification handleLostToFollowUp( @PathVariable int id, @RequestBody LostEvent lostEvent )
         throws NotAllowedException
     {
         return activityReportingService.handleLostToFollowUp( lostEvent );
@@ -458,9 +409,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/generateRepeatableEvent" )
     @ResponseBody
-    public Patient generateRepeatableEvent( @PathVariable
-    int id, @RequestHeader( "eventInfo" )
-    String eventInfo )
+    public Patient generateRepeatableEvent( @PathVariable int id, @RequestHeader( "eventInfo" ) String eventInfo )
         throws NotAllowedException
     {
         return activityReportingService.generateRepeatableEvent( id, eventInfo );
@@ -518,10 +467,8 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/LWUIT/orgUnits/{id}/registerPerson" )
     @ResponseBody
-    public Patient savePatient( @PathVariable
-    int id, @RequestBody
-    Patient patient, @RequestHeader( "programid" )
-    String programId )
+    public Patient savePatient( @PathVariable int id, @RequestBody Patient patient,
+        @RequestHeader( "programid" ) String programId )
         throws NotAllowedException
     {
         return activityReportingService.savePatient( patient, id, programId );
@@ -529,11 +476,8 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/getVariesInfo" )
     @ResponseBody
-    public PatientIdentifierAndAttribute getVariesInfo( @PathVariable
-    String clientVersion, @PathVariable
-    int id, @RequestHeader( "accept-language" )
-    String locale, @RequestHeader( "programid" )
-    String programId )
+    public PatientIdentifierAndAttribute getVariesInfo( @PathVariable String clientVersion, @PathVariable int id,
+        @RequestHeader( "accept-language" ) String locale, @RequestHeader( "programid" ) String programId )
     {
         PatientIdentifierAndAttribute patientIdentifierAndAttribute = new PatientIdentifierAndAttribute();
         patientIdentifierAndAttribute.setClientVersion( clientVersion );
@@ -545,9 +489,7 @@
 
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/sendFeedback" )
     @ResponseBody
-    public String sendFeedback( @PathVariable
-    int id, @RequestBody
-    Message message )
+    public String sendFeedback( @PathVariable int id, @RequestBody Message message )
         throws NotAllowedException
     {
         return activityReportingService.sendFeedback( message );
@@ -556,9 +498,7 @@
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/findUser" )
     @ResponseBody
-    public Recipient findUser( String clientVersion, @PathVariable
-    int id, @RequestHeader( "name" )
-    String keyword )
+    public Recipient findUser( String clientVersion, @PathVariable int id, @RequestHeader( "name" ) String keyword )
         throws NotAllowedException
     {
         Recipient recipient = new Recipient();
@@ -567,11 +507,18 @@
         return recipient;
     }
 
+    @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/findVisitSchedule/{programId}" )
+    @ResponseBody
+    public String findVisitSchedule( @PathVariable int programId, @PathVariable int id,
+        @RequestHeader( "details" ) String info )
+        throws NotAllowedException
+    {
+        return activityReportingService.findVisitSchedule( id, programId, info );
+    }
+
     @RequestMapping( method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/sendMessage" )
     @ResponseBody
-    public String sendMessage( @PathVariable
-    int id, @RequestBody
-    Message message )
+    public String sendMessage( @PathVariable int id, @RequestBody Message message )
         throws NotAllowedException
     {
         return activityReportingService.sendMessage( message );