dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17040
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6652: [mobile] add beneficiary enrollment
------------------------------------------------------------
revno: 6652
committer: Long <thanhlongngo1988>
branch nick: dhis2
timestamp: Fri 2012-04-20 09:32:43 +0700
message:
[mobile] add beneficiary enrollment
added:
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetEnrollmentProgramListAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetProgramEnrollmentFormAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/enrollmentProgramList.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/programEnrollmentForm.vm
modified:
dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/support/DataStreamSerializer.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SearchBeneficiaryAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java
dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties
dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiarySearchResult.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiarySearchingForm.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm
--
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-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/support/DataStreamSerializer.java'
--- dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/support/DataStreamSerializer.java 2011-11-29 12:06:35 +0000
+++ dhis-2/dhis-web/dhis-web-api-mobile/src/main/java/org/hisp/dhis/api/mobile/support/DataStreamSerializer.java 2012-04-20 02:32:43 +0000
@@ -35,12 +35,11 @@
}
}
-
public static void write( DataStreamSerializable entity, OutputStream out )
throws IOException
{
ByteArrayOutputStream baos = serializePersistent( entity );
- ZOutputStream gzip = new ZOutputStream(out, JZlib.Z_BEST_COMPRESSION );
+ ZOutputStream gzip = new ZOutputStream( out, JZlib.Z_BEST_COMPRESSION );
DataOutputStream dos = new DataOutputStream( gzip );
try
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetEnrollmentProgramListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetEnrollmentProgramListAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetEnrollmentProgramListAction.java 2012-04-20 02:32:43 +0000
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2004-2011, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.beneficiaryenrollment.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetEnrollmentProgramListAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private PatientService patientService;
+
+ public PatientService getPatientService()
+ {
+ return patientService;
+ }
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ private ProgramService programService;
+
+ public ProgramService getProgramService()
+ {
+ return programService;
+ }
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ private ProgramInstanceService programInstanceService;
+
+ public ProgramInstanceService getProgramInstanceService()
+ {
+ return programInstanceService;
+ }
+
+ public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+ {
+ this.programInstanceService = programInstanceService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private String beneficiaryId;
+
+ public String getBeneficiaryId()
+ {
+ return beneficiaryId;
+ }
+
+ public void setBeneficiaryId( String beneficiaryId )
+ {
+ this.beneficiaryId = beneficiaryId;
+ }
+
+ private List<Program> programList = new ArrayList<Program>();
+
+ public List<Program> getProgramList()
+ {
+ return programList;
+ }
+
+ public void setProgramList( List<Program> programList )
+ {
+ this.programList = programList;
+ }
+
+ private List<Program> enrolledProgramList = new ArrayList<Program>();
+
+ public List<Program> getEnrolledProgramList()
+ {
+ return enrolledProgramList;
+ }
+
+ public void setEnrolledProgramList( List<Program> enrolledProgramList )
+ {
+ this.enrolledProgramList = enrolledProgramList;
+ }
+
+ private Patient patient;
+
+ public Patient getPatient()
+ {
+ return patient;
+ }
+
+ public void setPatient( Patient patient )
+ {
+ this.patient = patient;
+ }
+
+ private boolean validated;
+
+ public boolean isValidated()
+ {
+ return validated;
+ }
+
+ public void setValidated( boolean validated )
+ {
+ this.validated = validated;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ patient = patientService.getPatient( Integer.parseInt( beneficiaryId ) );
+ for ( Program program : programService.getPrograms( patient.getOrganisationUnit() ) )
+ {
+ if ( !program.getAnonymous() && !program.getSingleEvent() )
+ {
+ if ( programInstanceService.getProgramInstances( patient, program ).size() > 0 )
+ {
+ enrolledProgramList.add( program );
+
+ } else {
+ programList.add( program );
+ }
+ }
+ }
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetProgramEnrollmentFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetProgramEnrollmentFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/GetProgramEnrollmentFormAction.java 2012-04-20 02:32:43 +0000
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2004-2009, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.hisp.dhis.light.beneficiaryenrollment.action;
+
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetProgramEnrollmentFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private PatientService patientService;
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private String programId;
+
+ public String getProgramId()
+ {
+ return programId;
+ }
+
+ public void setProgramId( String programId )
+ {
+ this.programId = programId;
+ }
+
+ private String beneficiaryId;
+
+ public String getBeneficiaryId()
+ {
+ return beneficiaryId;
+ }
+
+ public void setBeneficiaryId( String beneficiaryId )
+ {
+ this.beneficiaryId = beneficiaryId;
+ }
+
+ private Patient patient;
+
+ public Patient getPatient()
+ {
+ return patient;
+ }
+
+ public void setPatient( Patient patient )
+ {
+ this.patient = patient;
+ }
+
+ public Program getProgram()
+ {
+ return program;
+ }
+
+ public void setProgram( Program program )
+ {
+ this.program = program;
+ }
+
+ private Program program;
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ patient = patientService.getPatient( Integer.parseInt( beneficiaryId ) );
+ program = programService.getProgram( Integer.parseInt( programId ) );
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SaveMobileProgramEnrollmentAction.java 2012-04-20 02:32:43 +0000
@@ -0,0 +1,257 @@
+package org.hisp.dhis.light.beneficiaryenrollment.action;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import org.hisp.dhis.light.utils.FormUtils;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.system.util.DateUtils;
+import org.joda.time.format.DateTimeFormatter;
+import org.joda.time.format.ISODateTimeFormat;
+
+import com.opensymphony.xwork2.Action;
+
+public class SaveMobileProgramEnrollmentAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private PatientService patientService;
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
+ private ProgramInstanceService programInstanceService;
+
+ public void setProgramInstanceService( ProgramInstanceService programInstanceService )
+ {
+ this.programInstanceService = programInstanceService;
+ }
+
+ private ProgramStageInstanceService programStageInstanceService;
+
+ public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
+ {
+ this.programStageInstanceService = programStageInstanceService;
+ }
+
+ private FormUtils formUtils;
+
+ public FormUtils getFormUtils()
+ {
+ return formUtils;
+ }
+
+ public void setFormUtils( FormUtils formUtils )
+ {
+ this.formUtils = formUtils;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private String beneficiaryId;
+
+ public String getBeneficiaryId()
+ {
+ return beneficiaryId;
+ }
+
+ public void setBeneficiaryId( String beneficiaryId )
+ {
+ this.beneficiaryId = beneficiaryId;
+ }
+
+ private String programId;
+
+ public void setProgramId( String programId )
+ {
+ this.programId = programId;
+ }
+
+ public String getProgramId()
+ {
+ return programId;
+ }
+
+ private Patient patient;
+
+ public Patient getPatient()
+ {
+ return patient;
+ }
+
+ private Program program;
+
+ public Program getProgram()
+ {
+ return program;
+ }
+
+ private String enrollmentDate;
+
+ public void setEnrollmentDate( String enrollmentDate )
+ {
+ this.enrollmentDate = enrollmentDate;
+ }
+
+ private String incidentDate;
+
+ public String getIncidentDate()
+ {
+ return incidentDate;
+ }
+
+ public void setIncidentDate( String incidentDate )
+ {
+ this.incidentDate = incidentDate;
+ }
+
+ private Map<String, String> validationMap = new HashMap<String, String>();
+
+ public Map<String, String> getValidationMap()
+ {
+ return validationMap;
+ }
+
+ public void setValidationMap( Map<String, String> validationMap )
+ {
+ this.validationMap = validationMap;
+ }
+
+ private Map<String, String> previousValues = new HashMap<String, String>();
+
+ public Map<String, String> getPreviousValues()
+ {
+ return previousValues;
+ }
+
+ public void setPreviousValues( Map<String, String> previousValues )
+ {
+ this.previousValues = previousValues;
+ }
+
+ private boolean validated;
+
+ public boolean isValidated()
+ {
+ return validated;
+ }
+
+ public void setValidated( boolean validated )
+ {
+ this.validated = validated;
+ }
+
+ public String execute()
+ throws Exception
+ {
+ DateTimeFormatter sdf = ISODateTimeFormat.yearMonthDay();
+
+ if ( !FormUtils.isDate( enrollmentDate ) )
+ {
+ validationMap.put( "enrollmentDate", "is_invalid_date" );
+ }
+
+ if ( !FormUtils.isDate( incidentDate ) )
+ {
+ validationMap.put( "incidentDate", "is_invalid_date" );
+ }
+
+ if ( validationMap.size() > 0 )
+ {
+ previousValues.put( "enrollmentDate", enrollmentDate );
+ previousValues.put( "incidentDate", incidentDate );
+ validated = false;
+ return ERROR;
+ }
+
+ System.out.println("service: " + patientService);
+
+ patient = patientService.getPatient( Integer.parseInt( beneficiaryId ) );
+
+ program = programService.getProgram( Integer.parseInt( programId ) );
+
+ Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( patient, program,
+ false );
+
+ ProgramInstance programInstance = null;
+
+ if ( programInstances.iterator().hasNext() )
+ {
+ programInstance = programInstances.iterator().next();
+ }
+
+ if ( programInstance == null )
+ {
+ programInstance = new ProgramInstance();
+ programInstance.setEnrollmentDate( sdf.parseDateTime( enrollmentDate ).toDate() );
+ programInstance.setDateOfIncident( sdf.parseDateTime( incidentDate ).toDate() );
+ programInstance.setProgram( program );
+ programInstance.setPatient( patient );
+ programInstance.setCompleted( false );
+
+ programInstanceService.addProgramInstance( programInstance );
+
+ patient.getPrograms().add( program );
+ patientService.updatePatient( patient );
+
+ for ( ProgramStage programStage : program.getProgramStages() )
+ {
+ ProgramStageInstance programStageInstance = new ProgramStageInstance();
+ programStageInstance.setProgramInstance( programInstance );
+ programStageInstance.setProgramStage( programStage );
+ programStageInstance.setStageInProgram( programStage.getStageInProgram() );
+
+ Date dueDate = DateUtils.getDateAfterAddition( sdf.parseDateTime( incidentDate ).toDate(),
+ programStage.getMinDaysFromStart() );
+
+ programStageInstance.setDueDate( dueDate );
+
+ programStageInstanceService.addProgramStageInstance( programStageInstance );
+ }
+ }
+ else
+ {
+ programInstance.setEnrollmentDate( sdf.parseDateTime( enrollmentDate ).toDate() );
+ programInstance.setDateOfIncident( sdf.parseDateTime( incidentDate ).toDate() );
+
+ programInstanceService.updateProgramInstance( programInstance );
+
+ for ( ProgramStageInstance programStageInstance : programInstance.getProgramStageInstances() )
+ {
+ Date dueDate = DateUtils.getDateAfterAddition( sdf.parseDateTime( incidentDate ).toDate(),
+ programStageInstance.getProgramStage().getMinDaysFromStart() );
+
+ programStageInstance.setDueDate( dueDate );
+
+ programStageInstanceService.updateProgramStageInstance( programStageInstance );
+ }
+ }
+ validated = true;
+ return SUCCESS;
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SearchBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SearchBeneficiaryAction.java 2012-04-13 03:30:35 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryenrollment/action/SearchBeneficiaryAction.java 2012-04-20 02:32:43 +0000
@@ -86,6 +86,11 @@
public String execute()
throws Exception
{
+ String[] tokens = keyword.split( " " );
+ if ( tokens.length == 2 )
+ {
+ keyword = tokens[0] + " " + tokens[1];
+ }
patientList = new ArrayList<Patient>( patientService.getPatientsByNames( keyword ) );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java 2012-04-11 09:59:20 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/beneficiaryregistration/action/SaveBeneficiaryAction.java 2012-04-20 02:32:43 +0000
@@ -27,6 +27,7 @@
package org.hisp.dhis.light.beneficiaryregistration.action;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -184,24 +185,38 @@
}
else
{
- String[] tokens = this.patientFullName.split( " " );
-
- patient.setFirstName( tokens[0] );
-
- if ( tokens.length == 2 )
- {
- patient.setLastName( tokens[1] );
- }
- else if ( tokens.length > 2 )
- {
- patient.setMiddleName( tokens[1] );
- patient.setLastName( tokens[2] );
- }
+ patientFullName = patientFullName.trim();
+
+ int startIndex = patientFullName.indexOf( ' ' );
+ int endIndex = patientFullName.lastIndexOf( ' ' );
+
+ String firstName = patientFullName.toString();
+ String middleName = "";
+ String lastName = "";
+
+ if ( patientFullName.indexOf( ' ' ) != -1 )
+ {
+ firstName = patientFullName.substring( 0, startIndex );
+ if ( startIndex == endIndex )
+ {
+ middleName = "";
+ lastName = patientFullName.substring( startIndex + 1, patientFullName.length() );
+ }
+ else
+ {
+ middleName = patientFullName.substring( startIndex + 1, endIndex );
+ lastName = patientFullName.substring( endIndex + 1, patientFullName.length() );
+ }
+ }
+
+ patient.setFirstName( firstName );
+ patient.setMiddleName( middleName );
+ patient.setLastName( lastName );
}
patient.setGender( gender );
patient.setBloodGroup( bloodGroup );
-
+ patient.setRegistrationDate( new Date() );
try
{
DateTimeFormatter sdf = ISODateTimeFormat.yearMonthDay();
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-04-13 08:56:48 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-04-20 02:32:43 +0000
@@ -136,6 +136,7 @@
</bean>
<!-- Namebased Data entry -->
+
<bean
id="org.hisp.dhis.light.namebaseddataentry.action.GetNamebasedOrganisationUnitsAction"
class="org.hisp.dhis.light.namebaseddataentry.action.GetNamebasedOrganisationUnitsAction"
@@ -246,9 +247,47 @@
<bean
id="org.hisp.dhis.light.beneficiaryenrollment.action.SearchBeneficiaryAction"
class="org.hisp.dhis.light.beneficiaryenrollment.action.SearchBeneficiaryAction"
- scope="prototype">
- <property name="patientService"
- ref="org.hisp.dhis.patient.PatientService"/>
+ scope="prototype">
+ <property name="patientService"
+ ref="org.hisp.dhis.patient.PatientService"/>
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.light.beneficiaryenrollment.action.GetEnrollmentProgramListAction"
+ class="org.hisp.dhis.light.beneficiaryenrollment.action.GetEnrollmentProgramListAction"
+ scope="prototype">
+ <property name="patientService"
+ ref="org.hisp.dhis.patient.PatientService"/>
+ <property name="programService"
+ ref="org.hisp.dhis.program.ProgramService"/>
+ <property name="programInstanceService"
+ ref="org.hisp.dhis.program.ProgramInstanceService"/>
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.light.beneficiaryenrollment.action.GetProgramEnrollmentFormAction"
+ class="org.hisp.dhis.light.beneficiaryenrollment.action.GetProgramEnrollmentFormAction"
+ scope="prototype">
+ <property name="patientService"
+ ref="org.hisp.dhis.patient.PatientService"/>
+ <property name="programService"
+ ref="org.hisp.dhis.program.ProgramService"/>
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.light.beneficiaryenrollment.action.SaveMobileProgramEnrollmentAction"
+ class="org.hisp.dhis.light.beneficiaryenrollment.action.SaveMobileProgramEnrollmentAction"
+ scope="prototype">
+ <property name="patientService"
+ ref="org.hisp.dhis.patient.PatientService"/>
+ <property name="programService"
+ ref="org.hisp.dhis.program.ProgramService"/>
+ <property name="programInstanceService"
+ ref="org.hisp.dhis.program.ProgramInstanceService"/>
+ <property name="programStageInstanceService"
+ ref="org.hisp.dhis.program.ProgramStageInstanceService"/>
+ <property name="formUtils"
+ ref="org.hisp.dhis.light.dataentry.utils.FormUtils"/>
</bean>
<!-- Dashboard -->
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-04-13 03:30:35 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-04-20 02:32:43 +0000
@@ -62,4 +62,12 @@
is_empty=Empty Field
beneficiary_enrollment=Beneficiary Enrollment
beneficiary_search=Beneficiary Search
-beneficiary_name=Beneficiary Name
\ No newline at end of file
+beneficiary_name=Beneficiary Name
+search_result_for=Search Result for
+search=Search
+enrolled_programs=Enrolled Program(s)
+other_programs=Other Programs
+enroll=Enroll
+enrollment_date=Enrollment Date
+incident_date=Incident Date
+program_list=Program List
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2012-04-13 08:56:48 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2012-04-20 02:32:43 +0000
@@ -172,9 +172,31 @@
class="org.hisp.dhis.light.beneficiaryenrollment.action.SearchBeneficiaryAction">
<result name="success" type="velocity">
/dhis-web-light/main.vm</result>
- <param name="page">
- /dhis-web-light/beneficiarySearchResult.vm</param>
- </action>
+ <param name="page"> /dhis-web-light/beneficiarySearchResult.vm</param>
+ </action>
+
+ <action name="selectEnrollmentProgram"
+ class="org.hisp.dhis.light.beneficiaryenrollment.action.GetEnrollmentProgramListAction">
+ <result name="success" type="velocity">
+ /dhis-web-light/main.vm</result>
+ <param name="page"> /dhis-web-light/enrollmentProgramList.vm</param>
+ </action>
+
+ <action name="showProgramEnrollmentForm"
+ class="org.hisp.dhis.light.beneficiaryenrollment.action.GetProgramEnrollmentFormAction">
+ <result name="success" type="velocity">
+ /dhis-web-light/main.vm</result>
+ <param name="page"> /dhis-web-light/programEnrollmentForm.vm</param>
+ </action>
+
+ <action name="saveMobileProgramEnrollment"
+ class="org.hisp.dhis.light.beneficiaryenrollment.action.SaveMobileProgramEnrollmentAction">
+ <result name="success" type="redirect">
+ /mobile/selectEnrollmentProgram.action?beneficiaryId=${beneficiaryId}&validated=true</result>
+ <result name="error" type="velocity">/dhis-web-light/main.vm</result>
+ <param name="page">/dhis-web-light/programEnrollmentForm.vm</param>
+ </action>
+
<!-- Reports -->
<action name="reports"
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiarySearchResult.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiarySearchResult.vm 2012-04-13 08:56:48 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiarySearchResult.vm 2012-04-20 02:32:43 +0000
@@ -9,8 +9,8 @@
<p>
<ul>
#foreach( $patient in $patientList )
- #set($fullName = $patient.getFirstName() + $patient.getMiddle() + $patient.getLastName())
- <li><a href="selectProgram.action?organisationUnitId=$organisationUnit.id&beneficiaryId=$beneficiary.id¤t=$current">$!encoder.htmlEncode( ${fullName} )</a></li>
+ #set($fullName = $patient.getFirstName() + " " + $patient.getMiddleName() + " " + $patient.getLastName())
+ <li><a href="selectEnrollmentProgram.action?beneficiaryId=$patient.Id">$!encoder.htmlEncode( ${fullName} )</a></li>
#end
</ul>
</p>
@@ -18,7 +18,7 @@
<div id="footer">
<h2>$i18n.getString( "navigate_to" )</h2>
<ul>
- <li><a href="selectActivityType.action?orgUnitId=$organisationUnit.id">$i18n.getString("activity_type")</a></li>
+ <li><a href="showBeneficiarySearchingForm.action">$i18n.getString("beneficiary_search")</a></li>
<li><a href="index.action">$i18n.getString("home")</a></li>
</ul>
</div>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiarySearchingForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiarySearchingForm.vm 2012-04-13 08:56:48 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/beneficiarySearchingForm.vm 2012-04-20 02:32:43 +0000
@@ -16,7 +16,7 @@
#if( $validationMap.get( "fullName" ) )
<br /><span style="color: #990000;"> $i18n.getString($validationMap.get( "fullName" ))</span>
#end
- <input type="text" name="patientFullName" value="$!previousValues.get("fullName")" />
+ <input type="text" name="keyword" value="$!previousValues.get("fullName")" />
</p>
</div>
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/enrollmentProgramList.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/enrollmentProgramList.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/enrollmentProgramList.vm 2012-04-20 02:32:43 +0000
@@ -0,0 +1,32 @@
+<h2>$i18n.getString( "enrolled_programs" ) for $patient.firstName $patient.middleName $patient.lastName</h2>
+ #if( $validated)
+ <div class="header-box">
+ <h3 style="text-align: left;">$i18n.getString("successfully_saved")</h3>
+ </div>
+ #else
+
+ #end
+<p>
+<ul>
+#foreach( $program in $enrolledProgramList )
+ <li>$program.getName()</li>
+#end
+</ul>
+</p>
+
+<h2>$i18n.getString( "other_programs" )</h2>
+<p>
+<ul>
+#foreach( $program in $programList )
+ <li><a href="showProgramEnrollmentForm.action?beneficiaryId=$patient.Id&programId=$program.Id">$program.getName()</a></li>
+#end
+</ul>
+</p>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+ <li><a href="showBeneficiarySearchingForm.action">$i18n.getString("beneficiary_search")</a></li>
+ <li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm 2012-04-10 06:49:47 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm 2012-04-20 02:32:43 +0000
@@ -23,6 +23,7 @@
<li><a href="selectOrganisationUnit.action">$i18n.getString( "data_entry" )</a></li>
<li><a href="selectNamebasedOrganisationUnit.action">$i18n.getString( "namebased_data_entry" )</a></li>
<li><a href="selectRegistrationOrganisationUnit.action">$i18n.getString( "beneficiary_registration" )</a></li>
+ <li><a href="showBeneficiarySearchingForm.action">$i18n.getString( "beneficiary_enrollment" )</a></li>
<li><a href="messages.action">$i18n.getString( "messages" ) #if($unreadMessageConversationCount > 0)($unreadMessageConversationCount)#end</a></li>
<li><a href="reports.action">$i18n.getString( "reports" )</a></li>
<li><a href="settings.action">$i18n.getString( "settings" )</a></li>
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/programEnrollmentForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/programEnrollmentForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/programEnrollmentForm.vm 2012-04-20 02:32:43 +0000
@@ -0,0 +1,35 @@
+<h2>$i18n.getString( "enroll" ) $patient.getFullName() to $program.getName()</h2>
+<form action="saveMobileProgramEnrollment.action" method="POST">
+<div class="header-box" align="center">
+<input type="hidden" name="beneficiaryId" value="$beneficiaryId"/>
+<input type="hidden" name="programId" value="$programId"/>
+ <p style="text-align: left;">
+ <label>$i18n.getString( "enrollment_date" ) [yyyy-MM-dd] </label>
+ #if( $validationMap.get( "enrollmentDate" ) )
+ <br /><span style="color: #990000;"> $i18n.getString($validationMap.get( "enrollmentDate" ))</span>
+ #end
+ <input type="text" name="enrollmentDate" value="$!previousValues.get("enrollmentDate")" />
+
+ <label>$i18n.getString( "incident_date" ) [yyyy-MM-dd] </label>
+ #if( $validationMap.get( "incidentDate" ) )
+ <br /><span style="color: #990000;"> $i18n.getString($validationMap.get( "incidentDate" ))</span>
+ #end
+ <input type="text" name="incidentDate" value="$!previousValues.get("incidentDate")" />
+ </p>
+</div>
+
+<div class="header-box" align="center">
+ <p>
+ <input type="submit" style="width: 100%;" value="$i18n.getString("enroll")" />
+ </p>
+</div>
+
+</form>
+
+<div id="footer">
+<h2>$i18n.getString( "navigate_to" )</h2>
+<ul>
+ <li> <a href="selectEnrollmentProgram.action?beneficiaryId=$beneficiaryId"> $i18n.getString("program_list")</a> </li>
+ <li><a href="index.action">$i18n.getString("home")</a></li>
+</ul>
+</div>