← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 15447
committer: sherylyn.marie
branch nick: dhis2
timestamp: Wed 2014-05-28 19:12:00 +0800
message:
  https://blueprints.launchpad.net/dhis-mobile/+spec/enhance-tracker-client
  Enhance the feature and offline capacity of tracker client
  #2 DATAENTRY FOR OFFLINE PATIENT
  - Save thru Visit Schedule
  - View thru History List
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-22 08:23:41 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/ActivityReportingService.java	2014-05-28 11:12:00 +0000
@@ -41,6 +41,7 @@
 import org.hisp.dhis.api.mobile.model.LWUITmodel.LostEvent;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Notification;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Patient;
+import org.hisp.dhis.api.mobile.model.LWUITmodel.PatientList;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Program;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Relationship;
@@ -57,6 +58,9 @@
 
     Patient findPatient( int patientId )
         throws NotAllowedException;
+    
+    PatientList findPatients( String patientIds )
+        throws NotAllowedException;
 
     String findPatientInAdvanced( String keyword, int orgUnitId, int programId )
         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-22 08:23:41 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java	2014-05-28 11:12:00 +0000
@@ -80,6 +80,8 @@
     private String updateContactUrl;
 
     private String findPatientUrl;
+    
+    private String findPatientsUrl;
 
     private String uploadProgramStageUrl;
 
@@ -309,6 +311,16 @@
         this.findPatientUrl = findPatientUrl;
     }
 
+    public String getFindPatientsUrl()
+    {
+        return findPatientsUrl;
+    }
+    
+    public void setFindPatientsUrl( String findPatientsUrl )
+    {
+        this.findPatientsUrl = findPatientsUrl;
+    }
+    
     public String getUploadProgramStageUrl()
     {
         return uploadProgramStageUrl;
@@ -469,6 +481,7 @@
         dataOutputStream.writeUTF( downloadAnonymousProgramUrl );
         dataOutputStream.writeUTF( findProgramUrl );
         dataOutputStream.writeUTF( findPatientInAdvancedUrl );
+        dataOutputStream.writeUTF( findPatientsUrl );
         dataOutputStream.writeUTF( findVisitScheduleUrl );
         dataOutputStream.writeUTF( findLostToFollowUpUrl );
         dataOutputStream.writeUTF( handleLostToFollowUpUrl );
@@ -507,6 +520,7 @@
         downloadAnonymousProgramUrl = dataInputStream.readUTF();
         findProgramUrl = dataInputStream.readUTF();
         findPatientInAdvancedUrl = dataInputStream.readUTF();
+        findPatientsUrl = dataInputStream.readUTF();
         findVisitScheduleUrl = dataInputStream.readUTF();
         findLostToFollowUpUrl = dataInputStream.readUTF();
         handleLostToFollowUpUrl = dataInputStream.readUTF();
@@ -586,6 +600,7 @@
         dataOutputStream.writeUTF( downloadAnonymousProgramUrl );
         dataOutputStream.writeUTF( findProgramUrl );
         dataOutputStream.writeUTF( findPatientInAdvancedUrl );
+        dataOutputStream.writeUTF( findPatientsUrl );
         dataOutputStream.writeUTF( findVisitScheduleUrl );
         dataOutputStream.writeUTF( findLostToFollowUpUrl );
         dataOutputStream.writeUTF( handleLostToFollowUpUrl );

=== 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-22 08:57:05 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2014-05-28 11:12:00 +0000
@@ -55,6 +55,7 @@
 import org.hisp.dhis.api.mobile.model.LWUITmodel.LostEvent;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Notification;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Patient;
+import org.hisp.dhis.api.mobile.model.LWUITmodel.PatientList;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Section;
 import org.hisp.dhis.api.mobile.model.comparator.ActivityComparator;
 import org.hisp.dhis.common.Grid;
@@ -1447,6 +1448,22 @@
         org.hisp.dhis.api.mobile.model.LWUITmodel.Patient patientMobile = getPatientModel( patient );
         return patientMobile;
     }
+    
+    public org.hisp.dhis.api.mobile.model.LWUITmodel.PatientList findPatients( String patientIds )
+        throws NotAllowedException
+    {
+        PatientList patientlist = new PatientList();
+        
+        while ( patientIds.length() > 0 )
+        {
+            int patientId = Integer.parseInt( patientIds.substring( 0, patientIds.indexOf( "$" ) ) );
+            TrackedEntityInstance patient = entityInstanceService.getTrackedEntityInstance( patientId );
+            patientlist.getPatientList().add( getPatientModel( patient ) );
+            patientIds = patientIds.substring( patientIds.indexOf( "$" ) + 1, patientIds.length() );
+        }
+        
+        return patientlist;
+    }
 
     @Override
     public String findPatientInAdvanced( String keyword, int orgUnitId, int programId )

=== 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-22 08:23:41 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitTest.java	2014-05-28 11:12:00 +0000
@@ -75,6 +75,7 @@
         unit.setDownloadAnonymousProgramUrl( "downloadAnonymousProgramUrl" );
         unit.setFindProgramUrl( "findProgramUrl" );
         unit.setFindPatientInAdvancedUrl( "findPatientInAdvanced" );
+        unit.setFindPatientsUrl( "findPatientsUrl" );
         unit.setFindVisitScheduleUrl( "findVisitSchedule" );
         unit.setFindLostToFollowUpUrl( "findLostToFollowUpUrl" );
         unit.setHandleLostToFollowUpUrl( "handleLostToFollowUpUrl" );

=== 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-22 08:23:41 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/test/java/org/hisp/dhis/mobile/api/model/OrgUnitsTest.java	2014-05-28 11:12:00 +0000
@@ -101,6 +101,7 @@
         orgUnit.setDownloadAnonymousProgramUrl( "downloadAnonymousProgram" );
         orgUnit.setFindProgramUrl( "findProgram" );
         orgUnit.setFindPatientInAdvancedUrl( "findPatientInAdvanced" );
+        orgUnit.setFindPatientsUrl( "findPatients" );
         orgUnit.setFindVisitScheduleUrl( "findVisitSchedule" );
         orgUnit.setFindLostToFollowUpUrl( "findLostToFollowUp" );
         orgUnit.setHandleLostToFollowUpUrl( "handleLostToFollowUp" );

=== 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-22 08:23:41 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileClientController.java	2014-05-28 11:12:00 +0000
@@ -163,6 +163,7 @@
         orgUnit.setDownloadAnonymousProgramUrl( getUrl( request, unit.getId(), "downloadAnonymousProgram" ) );
         orgUnit.setFindProgramUrl( getUrl( request, unit.getId(), "findProgram" ) );
         orgUnit.setFindPatientInAdvancedUrl( getUrl( request, unit.getId(), "findPatientInAdvanced" ) );
+        orgUnit.setFindPatientsUrl( getUrl( request, unit.getId(), "findPatients" ) );
         orgUnit.setFindVisitScheduleUrl( getUrl( request, unit.getId(), "findVisitSchedule" ) );
         orgUnit.setFindLostToFollowUpUrl( getUrl( request, unit.getId(), "findLostToFollowUp" ) );
         orgUnit.setHandleLostToFollowUpUrl( getUrl( request, unit.getId(), "handleLostToFollowUp" ) );

=== 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-22 08:23:41 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/controller/MobileOrganisationUnitController.java	2014-05-28 11:12:00 +0000
@@ -54,6 +54,7 @@
 import org.hisp.dhis.api.mobile.model.LWUITmodel.LostEvent;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Notification;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Patient;
+import org.hisp.dhis.api.mobile.model.LWUITmodel.PatientList;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.PatientIdentifierAndAttribute;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.Program;
 import org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage;
@@ -364,6 +365,16 @@
     {
         return activityReportingService.findPatient( Integer.parseInt( patientId ) );
     }
+    
+    @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/findPatients" )
+    @ResponseBody
+    public PatientList findPatientsById( @PathVariable
+    int id, @RequestHeader( "patientIds" )
+    String patientIds )
+        throws NotAllowedException
+    {
+        return activityReportingService.findPatients( patientIds );
+    }
 
     @RequestMapping( method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/findPatientInAdvanced/{programId}" )
     @ResponseBody