dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25229
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12455: [mobile] fix bug deserialize in mobile Patient model
------------------------------------------------------------
revno: 12455
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Mon 2013-10-07 15:50:13 +0700
message:
[mobile] fix bug deserialize in mobile Patient model
modified:
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Patient.java
dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.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/model/LWUITmodel/Patient.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Patient.java 2013-09-23 08:00:15 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/LWUITmodel/Patient.java 2013-10-07 08:50:13 +0000
@@ -267,7 +267,7 @@
DataOutputStream dout = new DataOutputStream( bout );
dout.writeInt( this.getId() );
-
+
if ( name != null )
{
dout.writeBoolean( true );
@@ -411,7 +411,15 @@
throws IOException, EOFException
{
this.setId( din.readInt() );
- this.setName( din.readUTF() );
+
+ if ( din.readBoolean() )
+ {
+ this.setName( din.readUTF() );
+ }
+ else
+ {
+ this.setName( null );
+ }
// Org Name
if ( din.readBoolean() )
=== 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-10-07 03:36:27 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java 2013-10-07 08:50:13 +0000
@@ -113,8 +113,6 @@
private ProgramStageInstanceService programStageInstanceService;
- // private ActivityPlanService activityPlanService;
-
private PatientService patientService;
private PatientAttributeValueService patientAttValueService;
@@ -1327,6 +1325,7 @@
{
tempPrograms = new ArrayList<Program>(
programService.getProgramsByCurrentUser( Program.MULTIPLE_EVENTS_WITH_REGISTRATION ) );
+ System.out.println("Program size: " + tempPrograms.size());
}
List<Program> programs = new ArrayList<Program>();
@@ -1784,7 +1783,9 @@
throws NotAllowedException
{
org.hisp.dhis.patient.Patient patientWeb = new org.hisp.dhis.patient.Patient();
-
+
+ System.out.println("Name: " + patient.getName());
+
patientWeb.setName( patient.getName() );
patientWeb.setGender( patient.getGender() );
patientWeb.setDobType( patient.getDobType() );
@@ -1939,6 +1940,7 @@
{
name = "unknown";
}
+
if ( each.getBirthDate() != null )
{
DOB = dateFormat.format( each.getBirthDate() );
@@ -1976,6 +1978,7 @@
String eventsInfo = "";
Boolean followUp = false;
DateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd" );
+
List<String> searchTextList = new ArrayList<String>();
Collection<OrganisationUnit> orgUnitList = new HashSet<OrganisationUnit>();
@@ -1987,6 +1990,7 @@
Calendar fromCalendar = new GregorianCalendar();
fromCalendar.add( Calendar.DATE, -1 );
fromCalendar.add( Calendar.YEAR, -100 );
+
Date fromDate = fromCalendar.getTime();
String searchText = Patient.PREFIX_PROGRAM_EVENT_BY_STATUS + "_" + programId + "_"
@@ -1995,7 +1999,6 @@
searchTextList.add( searchText );
orgUnitList.add( organisationUnitService.getOrganisationUnit( orgUnitId ) );
-
List<Integer> stageInstanceIds = patientService.getProgramStageInstances( searchTextList, orgUnitList,
followUp, ProgramInstance.STATUS_ACTIVE, null, null );
@@ -2011,7 +2014,8 @@
.getProgramStageInstance( stageInstanceId );
Patient patient = programStageInstance.getProgramInstance().getPatient();
eventsInfo += programStageInstance.getId() + "/" + patient.getName() + ", "
- + programStageInstance.getProgramStage().getName() + "(" + formatter.format(programStageInstance.getDueDate()) + ")" + "$";
+ + programStageInstance.getProgramStage().getName() + "("
+ + formatter.format( programStageInstance.getDueDate() ) + ")" + "$";
}
throw new NotAllowedException( eventsInfo );
@@ -2020,6 +2024,7 @@
{
return "";
}
+
}
@Override