=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2012-03-27 07:20:28 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentAction.java 2012-03-28 07:10:48 +0000 @@ -33,6 +33,8 @@ import java.util.List; import java.util.Map; +import org.hisp.dhis.caseentry.state.SelectedStateManager; +import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.patient.Patient; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeGroup; @@ -47,6 +49,8 @@ import org.hisp.dhis.patientattributevalue.PatientAttributeValue; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramAttribute; +import org.hisp.dhis.program.ProgramAttributeService; import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramInstanceService; import org.hisp.dhis.program.ProgramService; @@ -81,6 +85,10 @@ private PatientAttributeValueService patientAttributeValueService; + private ProgramAttributeService programAttributeService; + + private SelectedStateManager selectedStateManager; + // ------------------------------------------------------------------------- // Input/Output // ------------------------------------------------------------------------- @@ -107,15 +115,34 @@ private Map patientAttributeValueMap = new HashMap(); + private Collection programAttributes; + + private Boolean hasDataEntry; + // ------------------------------------------------------------------------- // Getters/Setters // ------------------------------------------------------------------------- + public void setSelectedStateManager( SelectedStateManager selectedStateManager ) + { + this.selectedStateManager = selectedStateManager; + } + public void setPatientService( PatientService patientService ) { this.patientService = patientService; } + public Collection getProgramAttributes() + { + return programAttributes; + } + + public void setProgramAttributeService( ProgramAttributeService programAttributeService ) + { + this.programAttributeService = programAttributeService; + } + public Collection getNoGroupAttributes() { return noGroupAttributes; @@ -206,6 +233,11 @@ return programStageInstances; } + public Boolean getHasDataEntry() + { + return hasDataEntry; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -213,6 +245,8 @@ public String execute() throws Exception { + OrganisationUnit orgunit = selectedStateManager.getSelectedOrganisationUnit(); + patient = patientService.getPatient( patientId ); program = programService.getProgram( programId ); @@ -230,53 +264,90 @@ programStageInstances = programInstance.getProgramStageInstances(); - // --------------------------------------------------------------------- - // Load identifier types of the selected program - // --------------------------------------------------------------------- - - identifierTypes = identifierTypeService.getPatientIdentifierTypes( program ); - identiferMap = new HashMap(); - - if ( identifierTypes != null && identifierTypes.size() > 0 ) - { - Collection patientIdentifiers = patientIdentifierService.getPatientIdentifiers( - identifierTypes, patient ); - - for ( PatientIdentifier identifier : patientIdentifiers ) - { - identiferMap.put( identifier.getIdentifierType().getId(), identifier.getIdentifier() ); - } - } - - // --------------------------------------------------------------------- + loadIdentifierTypes(); + + loadPatientAttributes(); + + // ----------------------------------------------------------------- // Load patient-attributes of the selected program - // --------------------------------------------------------------------- - - attributeGroups = new ArrayList( patientAttributeGroupService - .getPatientAttributeGroups( program ) ); - Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() ); - - noGroupAttributes = patientAttributeService.getPatientAttributes( program, null ); - - Collection patientAttributeValues = patientAttributeValueService - .getPatientAttributeValues( patient ); - - for ( PatientAttributeValue patientAttributeValue : patientAttributeValues ) - { - if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttributeValue.getPatientAttribute() - .getValueType() ) ) - { - patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), - patientAttributeValue.getPatientAttributeOption().getName() ); - } - else - { - patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), - patientAttributeValue.getValue() ); - } - } + // ----------------------------------------------------------------- + + programAttributes = programAttributeService.getAllProgramAttributes(); } - + + hasDataEntry = showDataEntry( orgunit, program, programInstance ); + return SUCCESS; } + + // ------------------------------------------------------------------------- + // Supportive methods + // ------------------------------------------------------------------------- + + private void loadIdentifierTypes() + { + // --------------------------------------------------------------------- + // Load identifier types of the selected program + // --------------------------------------------------------------------- + + identifierTypes = identifierTypeService.getPatientIdentifierTypes( program ); + identiferMap = new HashMap(); + + if ( identifierTypes != null && identifierTypes.size() > 0 ) + { + Collection patientIdentifiers = patientIdentifierService.getPatientIdentifiers( + identifierTypes, patient ); + + for ( PatientIdentifier identifier : patientIdentifiers ) + { + identiferMap.put( identifier.getIdentifierType().getId(), identifier.getIdentifier() ); + } + } + } + + private void loadPatientAttributes() + { + // --------------------------------------------------------------------- + // Load patient-attributes of the selected program + // --------------------------------------------------------------------- + + attributeGroups = new ArrayList( patientAttributeGroupService + .getPatientAttributeGroups( program ) ); + Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() ); + + noGroupAttributes = patientAttributeService.getPatientAttributes( program, null ); + + Collection patientAttributeValues = patientAttributeValueService + .getPatientAttributeValues( patient ); + + for ( PatientAttributeValue patientAttributeValue : patientAttributeValues ) + { + if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttributeValue.getPatientAttribute() + .getValueType() ) ) + { + patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), + patientAttributeValue.getPatientAttributeOption().getName() ); + } + else + { + patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), + patientAttributeValue.getValue() ); + } + } + } + + private boolean showDataEntry( OrganisationUnit orgunit, Program program, ProgramInstance programInstance ) + { + if ( !program.getOrganisationUnits().contains( orgunit ) ) + { + return false; + } + else if ( !program.getSingleEvent() && programInstance == null ) + { + return false; + } + + return true; + } + } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java 2012-03-26 06:36:24 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/ProgramEnrollmentSelectAction.java 2012-03-28 07:10:48 +0000 @@ -28,12 +28,15 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.HashSet; +import org.hisp.dhis.caseentry.state.SelectedStateManager; import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; 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 com.opensymphony.xwork2.Action; @@ -63,11 +66,18 @@ this.programService = programService; } - private OrganisationUnitSelectionManager selectionManager; - - public void setSelectionManager( OrganisationUnitSelectionManager selectionManager ) - { - this.selectionManager = selectionManager; + private ProgramInstanceService programInstanceService; + + public void setProgramInstanceService( ProgramInstanceService programInstanceService ) + { + this.programInstanceService = programInstanceService; + } + + private SelectedStateManager selectedStateManager; + + public void setSelectedStateManager( SelectedStateManager selectedStateManager ) + { + this.selectedStateManager = selectedStateManager; } // ------------------------------------------------------------------------- @@ -102,19 +112,37 @@ public String execute() throws Exception { + OrganisationUnit orgunit = selectedStateManager.getSelectedOrganisationUnit(); + patient = patientService.getPatient( id ); - OrganisationUnit selectedOrgunit = selectionManager.getSelectedOrganisationUnit(); - - // Get none single-event programs + // Get all programs programs = programService.getPrograms( false ); - // Check the selected orgunit has any single-event program or not - Collection programsbyOrgunit = programService.getPrograms( selectedOrgunit ); - - Collection singleEventPrograms = programService.getPrograms( true, false ); - - singleEventPrograms.retainAll( programsbyOrgunit ); + // Except anonymous program + programs.removeAll( programService.getPrograms( true, true ) ); + + // Get single-event if patient no have any single event + // OR have un-completed single-event + Collection programInstances = programInstanceService.getProgramInstances( patient, true ); + + Collection completedPrograms = new HashSet(); + + for ( ProgramInstance programInstance : programInstances ) + { + if ( programInstance.getProgram().getSingleEvent() ) + { + completedPrograms.add( programInstance.getProgram() ); + } + } +System.out.println("\n\n completedPrograms : " + completedPrograms.iterator().next().getName() ); + // Get single-event programs by the selected orgunit + Collection singleProgramsByOrgunit = programService.getPrograms( true, false, orgunit ); +System.out.println("\n\n singleProgramsByOrgunit : " + singleProgramsByOrgunit.iterator().next().getName() ); + singleProgramsByOrgunit.remove( completedPrograms ); +System.out.println("\n\n singlePrograms 2 : " + singleProgramsByOrgunit.iterator().next().getName() ); + programs.addAll( singleProgramsByOrgunit ); +System.out.println("\n\n programs : " + singleProgramsByOrgunit.iterator().next().getName() ); return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentAction.java 2011-09-14 06:36:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentAction.java 2012-03-28 07:10:48 +0000 @@ -136,7 +136,6 @@ public String execute() throws Exception { - ProgramInstance programInstance = programInstanceService.getProgramInstance( programInstanceId ); Patient patient = programInstance.getPatient(); @@ -144,18 +143,6 @@ Program program = programInstance.getProgram(); // --------------------------------------------------------------------- - // Update Information of programInstance - // --------------------------------------------------------------------- - - programInstance.setEndDate( new Date() ); - programInstance.setCompleted( true ); - - programInstanceService.updateProgramInstance( programInstance ); - - patient.getPrograms().remove( program ); - patientService.updatePatient( patient ); - - // --------------------------------------------------------------------- // Save Program Attributes // --------------------------------------------------------------------- @@ -168,14 +155,18 @@ // --------------------------------------------------------------------- // End-user inputs attribute value for DEAD-attribute // --------------------------------------------------------------------- - + boolean flag = false; + Date closedDate = new Date(); if ( attributes != null && attributes.size() > 0 ) { programInstance.getAttributes().clear(); + // ----------------------------------------------------------------- // Save other attributes + // ----------------------------------------------------------------- + for ( ProgramAttribute attribute : attributes ) { String value = request.getParameter( RemoveEnrollmentAction.PREFIX_ATTRIBUTE + attribute.getId() ); @@ -193,36 +184,37 @@ attributeValue.setProgramInstance( programInstance ); attributeValue.setProgramAttribute( attribute ); - // DEAD program-attribute - if ( attribute.getName().equalsIgnoreCase( ProgramAttribute.DEAD_NAME ) - && attribute.getValueType().equalsIgnoreCase( ProgramAttribute.TYPE_BOOL ) ) - { - attributeValue.setValue( value.trim() ); - patient.setIsDead( Boolean.parseBoolean( value.trim() ) ); - patientService.updatePatient( patient ); - flag = true; - } - else if ( ProgramAttribute.TYPE_COMBO.equalsIgnoreCase( attribute.getValueType() ) ) - { - ProgramAttributeOption option = programAttributeOptionService.get( NumberUtils.toInt( - value, 0 ) ); - if ( option != null ) - { - attributeValue.setProgramAttributeOption( option ); - attributeValue.setValue( option.getName() ); - } - } - else - { - attributeValue.setValue( value.trim() ); - } - // CLOSED-DATE program-attribute if ( attribute.getName().equalsIgnoreCase( ProgramAttribute.CLOSED_DATE ) && attribute.getValueType().equalsIgnoreCase( ProgramAttribute.TYPE_DATE ) && flag ) { - patient.setDeathDate( format.parseDate( value.trim() ) ); - patientService.updatePatient( patient ); + attributeValue.setValue( value.trim() ); + + closedDate = format.parseDate( value.trim() ); + patient.setDeathDate( closedDate ); + flag = true; + } + // IS-DEAD program-attribute + else if ( attribute.getName().equalsIgnoreCase( ProgramAttribute.DEAD_NAME ) ) + { + attributeValue.setValue( value.trim() ); + + patient.setIsDead( Boolean.parseBoolean( value.trim() ) ); + flag = true; + } + else if ( ProgramAttribute.TYPE_COMBO.equalsIgnoreCase( attribute.getValueType() ) ) + { + ProgramAttributeOption option = programAttributeOptionService.get( NumberUtils.toInt( + value, 0 ) ); + if ( option != null ) + { + attributeValue.setProgramAttributeOption( option ); + attributeValue.setValue( option.getName() ); + } + } + else + { + attributeValue.setValue( value.trim() ); } programAttributeValueService.saveProgramAttributeValue( attributeValue ); @@ -250,9 +242,37 @@ } } + // --------------------------------------------------------------------- + // Update Information of programInstance + // --------------------------------------------------------------------- + + programInstance.setEndDate( closedDate ); + programInstance.setCompleted( true ); +// programInstanceService.updateProgramInstance( programInstance ); programInstance.setAttributes( programAttributes ); - programInstanceService.updateProgramInstance( programInstance ); + + patient.getPrograms().remove( program ); + + // --------------------------------------------------------------------- + // Set Completed status all program-instaces of Death case + // --------------------------------------------------------------------- + + if ( flag ) + { + Collection programInstancesByPatient = programInstanceService.getProgramInstances( + patient, false ); + + for ( ProgramInstance _programInstance : programInstancesByPatient ) + { + patient.getPrograms().remove( _programInstance.getProgram() ); + _programInstance.setEndDate( closedDate ); + _programInstance.setCompleted( true ); + programInstanceService.updateProgramInstance( _programInstance ); + } + } + + patientService.updatePatient( patient ); return SUCCESS; } === removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentSelectAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentSelectAction.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemoveEnrollmentSelectAction.java 1970-01-01 00:00:00 +0000 @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2004-2012, 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.caseentry.action.patient; - -import java.util.ArrayList; -import java.util.Collection; - -import org.hisp.dhis.patient.Patient; -import org.hisp.dhis.patient.PatientService; -import org.hisp.dhis.program.Program; -import org.hisp.dhis.program.ProgramAttribute; -import org.hisp.dhis.program.ProgramAttributeService; -import org.hisp.dhis.program.ProgramInstance; -import org.hisp.dhis.program.ProgramInstanceService; -import org.hisp.dhis.program.ProgramService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Chau Thu Tran - * @version $ID : RemoveEnrollmentSelectAction.java Jan 11, 2011 10:00:55 AM $ - */ -public class RemoveEnrollmentSelectAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private ProgramAttributeService programAttributeService; - - private ProgramInstanceService programInstanceService; - - private ProgramService programService; - - private PatientService patientService; - - // ------------------------------------------------------------------------- - // Input/Output - // ------------------------------------------------------------------------- - - private Integer patientId; - - private Collection programInstances; - - private Collection programAttributes; - - private ProgramInstance programInstance; - - private Patient patient; - - // ------------------------------------------------------------------------- - // Setter && Getter - // ------------------------------------------------------------------------- - - public void setProgramAttributeService( ProgramAttributeService programAttributeService ) - { - this.programAttributeService = programAttributeService; - } - - public ProgramInstance getProgramInstance() - { - return programInstance; - } - - public void setPatientService( PatientService patientService ) - { - this.patientService = patientService; - } - - public void setProgramService( ProgramService programService ) - { - this.programService = programService; - } - - public Patient getPatient() - { - return patient; - } - - public void setPatientId( Integer patientId ) - { - this.patientId = patientId; - } - - public Collection getProgramInstances() - { - return programInstances; - } - - public Collection getProgramAttributes() - { - return programAttributes; - } - - public void setProgramInstanceService( ProgramInstanceService programInstanceService ) - { - this.programInstanceService = programInstanceService; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - @Override - public String execute() - throws Exception - { - patient = patientService.getPatient( patientId ); - - programAttributes = programAttributeService.getAllProgramAttributes(); - - // --------------------------------------------------------------------- - // Get programInstance - // --------------------------------------------------------------------- - - programInstances = new ArrayList(); - - Collection programs = programService.getAllPrograms(); - - for ( Program program : programs ) - { - Collection instances = programInstanceService - .getProgramInstances( patient, program, false ); - - if ( instances.iterator().hasNext() ) - { - programInstances.add( instances.iterator().next() ); - } - } - - return SUCCESS; - } -} === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java 2012-03-27 07:20:28 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/SaveProgramEnrollmentAction.java 2012-03-28 07:10:48 +0000 @@ -26,28 +26,12 @@ */ package org.hisp.dhis.caseentry.action.patient; -import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.patient.Patient; -import org.hisp.dhis.patient.PatientAttribute; -import org.hisp.dhis.patient.PatientAttributeGroup; -import org.hisp.dhis.patient.PatientAttributeGroupService; -import org.hisp.dhis.patient.PatientAttributeService; -import org.hisp.dhis.patient.PatientIdentifier; -import org.hisp.dhis.patient.PatientIdentifierService; -import org.hisp.dhis.patient.PatientIdentifierType; -import org.hisp.dhis.patient.PatientIdentifierTypeService; import org.hisp.dhis.patient.PatientService; -import org.hisp.dhis.patient.comparator.PatientAttributeGroupSortOrderComparator; -import org.hisp.dhis.patientattributevalue.PatientAttributeValue; -import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramInstanceService; @@ -98,41 +82,6 @@ this.programStageInstanceService = programStageInstanceService; } - public Collection getIdentifierTypes() - { - return identifierTypes; - } - - public Map getIdentiferMap() - { - return identiferMap; - } - - public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService ) - { - this.patientIdentifierService = patientIdentifierService; - } - - public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService ) - { - this.identifierTypeService = identifierTypeService; - } - - public void setProgramStageInstances( Collection programStageInstances ) - { - this.programStageInstances = programStageInstances; - } - - private PatientIdentifierService patientIdentifierService; - - private PatientIdentifierTypeService identifierTypeService; - - private PatientAttributeService patientAttributeService; - - private PatientAttributeGroupService patientAttributeGroupService; - - private PatientAttributeValueService patientAttributeValueService; - private I18nFormat format; public void setFormat( I18nFormat format ) @@ -144,27 +93,13 @@ // Input/Output // ------------------------------------------------------------------------- - private Collection identifierTypes; - - public void setPatientAttributeService( PatientAttributeService patientAttributeService ) - { - this.patientAttributeService = patientAttributeService; - } - - public void setPatientAttributeGroupService( PatientAttributeGroupService patientAttributeGroupService ) - { - this.patientAttributeGroupService = patientAttributeGroupService; - } - - public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService ) - { - this.patientAttributeValueService = patientAttributeValueService; - } - - private Map identiferMap; - private Integer patientId; + public Integer getPatientId() + { + return patientId; + } + public void setPatientId( Integer patientId ) { this.patientId = patientId; @@ -177,6 +112,11 @@ this.programId = programId; } + public Integer getProgramId() + { + return programId; + } + private Patient patient; public Patient getPatient() @@ -191,13 +131,6 @@ return program; } - private ProgramInstance programInstance; - - public ProgramInstance getProgramInstance() - { - return programInstance; - } - private String enrollmentDate; public void setEnrollmentDate( String enrollmentDate ) @@ -212,34 +145,6 @@ this.dateOfIncident = dateOfIncident; } - private Collection programStageInstances = new ArrayList(); - - public Collection getProgramStageInstances() - { - return programStageInstances; - } - - private Collection noGroupAttributes; - - public Collection getNoGroupAttributes() - { - return noGroupAttributes; - } - - private List attributeGroups; - - public List getAttributeGroups() - { - return attributeGroups; - } - - private Map patientAttributeValueMap = new HashMap(); - - public Map getPatientAttributeValueMap() - { - return patientAttributeValueMap; - } - // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -251,14 +156,16 @@ program = programService.getProgram( programId ); - if( dateOfIncident == null ) + if ( dateOfIncident == null || dateOfIncident.isEmpty() ) { dateOfIncident = enrollmentDate; } - + Collection programInstances = programInstanceService.getProgramInstances( patient, program, false ); + ProgramInstance programInstance = null; + if ( programInstances.iterator().hasNext() ) { programInstance = programInstances.iterator().next(); @@ -291,11 +198,8 @@ programStageInstance.setDueDate( dueDate ); programStageInstanceService.addProgramStageInstance( programStageInstance ); - - programStageInstances.add( programStageInstance ); } } - else { programInstance.setEnrollmentDate( format.parseDate( enrollmentDate ) ); @@ -311,57 +215,9 @@ programStageInstance.setDueDate( dueDate ); programStageInstanceService.updateProgramStageInstance( programStageInstance ); - - programStageInstances.add( programStageInstance ); - } - } - - // --------------------------------------------------------------------- - // Load identifier types of the selected program - // --------------------------------------------------------------------- - - identifierTypes = identifierTypeService.getPatientIdentifierTypes( program ); - identiferMap = new HashMap(); - - if ( identifierTypes != null && identifierTypes.size() > 0 ) - { - Collection patientIdentifiers = patientIdentifierService.getPatientIdentifiers( - identifierTypes, patient ); - - for ( PatientIdentifier identifier : patientIdentifiers ) - { - identiferMap.put( identifier.getIdentifierType().getId(), identifier.getIdentifier() ); - } - } - - // --------------------------------------------------------------------- - // Load patient-attributes of the selected program - // --------------------------------------------------------------------- - - attributeGroups = new ArrayList( patientAttributeGroupService - .getPatientAttributeGroups( program ) ); - Collections.sort( attributeGroups, new PatientAttributeGroupSortOrderComparator() ); - - noGroupAttributes = patientAttributeService.getPatientAttributes( program, null ); - - Collection patientAttributeValues = patientAttributeValueService - .getPatientAttributeValues( patient ); - - for ( PatientAttributeValue patientAttributeValue : patientAttributeValues ) - { - if ( PatientAttribute.TYPE_COMBO.equalsIgnoreCase( patientAttributeValue.getPatientAttribute() - .getValueType() ) ) - { - patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), - patientAttributeValue.getPatientAttributeOption().getName() ); - } - else - { - patientAttributeValueMap.put( patientAttributeValue.getPatientAttribute().getId(), - patientAttributeValue.getValue() ); - } - } - + } + } + return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-03-27 14:19:09 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-03-28 07:10:48 +0000 @@ -624,7 +624,8 @@ scope="prototype"> - + + + + - - - - - - - - - - - - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-03-27 14:19:09 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-03-28 07:10:48 +0000 @@ -287,8 +287,14 @@ some_data_element_not_exist = Some data element is not exist orgunit_hiererachy_included_on = Organisation unit hiererachy included on level = Level -patient_identifier_and_attributes = Beneficiary identifier and attributes please_fill_out_only_one_of_these_fields = Please fill out at only one of these fields. age_year = Age year create = Create -migration_patient = Migration patient \ No newline at end of file +migration_patient = Migration Beneficiary +patient_info = Beneficiary Information +program_enrolled_for = Program Enrolled for +identifier_and_attribute = Identifier/Attribute +unenrollment = Un-Enrollment +modify_due_date_or_visit_date = Modify Due/Visit dates +data_entry_screen = Data entry Screen +unenrol_success = Beneficiary un-enrolled successfully \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-03-27 14:19:09 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-03-28 07:10:48 +0000 @@ -543,18 +543,10 @@ - /content.vm - /dhis-web-caseentry/programEnrollmentForm.vm + enrollmentform.action?programId=${programId}&patientId=${patientId} F_PROGRAM_ENROLLMENT - - /content.vm - /dhis-web-caseentry/programUnenrollmentSelectForm.vm - F_PROGRAM_UNENROLLMENT - - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm 2012-03-27 08:30:45 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm 2012-03-28 07:10:48 +0000 @@ -14,11 +14,7 @@ $i18n.getString( "date_of_birth" ): - $format.formatDate( $patient.birthDate ) - - - $i18n.getString( "age" ): - $encoder.htmlEncode( $patient.getAge() ) + $format.formatDate( $patient.birthDate ) $patient.getAge() @@ -44,7 +40,7 @@ - + @@ -93,7 +93,7 @@ #foreach ($identifierType in $identifierTypes) - #if( $identifierType.program ) + #if( $identifierType && $identifierType.program ) #else @@ -109,7 +109,7 @@ #foreach($attribute in $attributeGroup.attributes ) - #if( $attribute.program ) + #if( $!attribute && $attribute.program ) #else @@ -147,7 +147,7 @@ #if ( $noGroupAttributes && $noGroupAttributes.size() > 0) #foreach($attribute in $noGroupAttributes ) - #if( $attribute.program ) + #if( $!attribute && $attribute.program ) #else === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2012-03-27 14:19:09 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientRegistrationList.vm 2012-03-28 07:10:48 +0000 @@ -92,7 +92,6 @@
-       $i18n.getString( "verified" ) + $i18n.getString( "verified" ) $i18n.getString( "age_year" )
 
$i18n.getString( "patient_identifiers" )
 
$attributeGroup.name
$i18n.getString( "other_details" )
$i18n.getString( "program_enrollment" ) - $i18n.getString( "program_unenrollment_management" ) $i18n.getString( "edit_profile" ) $i18n.getString( "manage_relationship" ) $i18n.getString( "migration_patient" ) === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2012-03-27 10:33:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2012-03-28 07:10:48 +0000 @@ -1,46 +1,46 @@ - +#if( $programInstance || $hasDataEntry=='true') +
-
- #if( $identifierTypes.size() > 0 || $noGroupAttributes.size() > 0 || $attributeGroups.size() > 0 ) + #if( $identifierTypes || $noGroupAttributes || $attributeGroups ) #if( $identifierTypes.size() > 0 ) - + #end - #set( $tabIndex = 1 ) #set( $mark = false ) #foreach ($identifierType in $identifierTypes) #set( $identifier = $identiferMap.get( $identifierType.id ) ) - + - #set( $tabIndex = $tabIndex + 1 ) #set( $mark = !$mark ) #end - #set( $mark = false ) + #foreach ($attributeGroup in $attributeGroups ) - + #set( $mark = false ) #foreach($attribute in $attributeGroup.attributes) #if( $!attribute.program ) #set( $attributeValue = $!patientAttributeValueMap.get( $attribute.id ) ) @@ -48,31 +48,30 @@ + #set( $mark = !$mark ) #end - #set( $tabIndex = $tabIndex + 1 ) - #set( $mark = !$mark ) #end #end @@ -89,47 +88,40 @@ + #set( $mark = !$mark ) #end - #set( $tabIndex = $tabIndex + 1 ) - #set( $mark = !$mark ) #end #end
$i18n.getString( "patient_identifier" )$i18n.getString( "identifier" )
- + +
 
 
$attributeGroup.name
#if( $attribute.valueType == "YES/NO" ) - #elseif( $attribute.valueType == "DATE" ) - + #elseif( $attribute.valueType == "COMBO" ) - #foreach ($option in $attribute.attributeOptions ) #end #else - + #end
 
#if( $attribute.valueType == "YES/NO" ) - #elseif( $attribute.valueType == "DATE" ) - + #elseif( $attribute.valueType == "COMBO" ) - #foreach ($option in $attribute.attributeOptions ) #end #else - + #end
#end +
+
- - -
- - - -
- #if( $programStageInstances.size() > 0 ) @@ -143,7 +135,6 @@ #set( $rowCount = 0 ) #set( $mark = false ) - #set( $tabIndex = 1 ) #foreach( $programStageInstance in $programStageInstances ) #set( $rowCount = $rowCount + 1 ) @@ -159,37 +150,102 @@ ##entry #set( $duedateId = "value_"+$programStageInstance.id+"_date" ) - #set( $tabIndex = $tabIndex + 1 ) #set( $mark = !$mark ) #end
- +
#end - -
-
+ + +
+ + +
+ +
+ + #foreach($attribute in $programAttributes) + + + + + #end + + + + + + + + + +
$attribute.name + #if( $attribute.valueType == "YES/NO" ) + + #elseif( $attribute.valueType == "DATE" ) + + + #elseif( $attribute.valueType == "COMBO" ) + + #else + + #end + + #if($!programAttribute.description) ($!programAttribute.description) #end +
+ +
+
+ + + +#end - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2012-03-27 14:19:09 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2012-03-28 07:10:48 +0000 @@ -1,38 +1,39 @@ -

$i18n.getString( "patient_registered" )

+

$i18n.getString( "patient_info" )

- - - - - - - - - - - - - - - - - - - - - - - - -
$i18n.getString( "full_name" ):$encoder.htmlEncode( $patient.getFullName() )
$i18n.getString( "gender" ):$i18n.getString( $patient.gender )
$i18n.getString( "date_of_birth" ):$format.formatDate( $patient.birthDate )
$i18n.getString( "age" ):$encoder.htmlEncode( $patient.getAge() )
 
- -
-
-
+ + + + + + + + + + + + + + + + + + + + +
$i18n.getString( "full_name" ):$encoder.htmlEncode( $patient.getFullName() )
$i18n.getString( "gender" ):$i18n.getString( $patient.gender )
$i18n.getString( "date_of_birth" ):$format.formatDate( $patient.birthDate ) $patient.getAge()
 
+ +
+ + +

+ +
+ $i18n.getString( "program_enrolled_for" ) + - +
- + - + - + @@ -72,9 +73,12 @@
@@ -48,12 +49,12 @@
- - - + + +

+ + +
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programUnenrollmentSelectForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programUnenrollmentSelectForm.vm 2012-02-01 09:10:08 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programUnenrollmentSelectForm.vm 1970-01-01 00:00:00 +0000 @@ -1,159 +0,0 @@ - - - -

$i18n.getString( "program_unenrollment" )

- - - - - - - - - - - - - - - - - - - - - - - -
$i18n.getString( "full_name" ):$encoder.htmlEncode( $patient.getFullName() )
$i18n.getString( "gender" ):$i18n.getString( $patient.gender )
$i18n.getString( "date_of_birth" ):$format.formatDate( $patient.birthDate )
$i18n.getString( "age" ):$encoder.htmlEncode( $patient.getAge() )
 
- -
- -
- -
- - - - - - - - - -
- -
- - - -
- - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-03-27 14:19:09 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/selectPatient.vm 2012-03-28 07:10:48 +0000 @@ -62,6 +62,7 @@ var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'")'; var i18n_list_all_patient = '$encoder.jsEscape( $i18n.getString( "list_all_patient" ) , "'")'; var i18n_enrol_success = '$encoder.jsEscape( $i18n.getString( "enrol_success" ) , "'")'; + var i18n_unenrol_success = '$encoder.jsEscape( $i18n.getString( "unenrol_success" ) , "'")'; var i18n_list_patients_by_program = '$encoder.jsEscape( $i18n.getString( "list_patients_by_program" ) , "'" )'; var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient" ) , "'" )'; var i18n_adding_patient_failed = '$encoder.jsEscape( $i18n.getString( "adding_patient_failed" ), "'")'; === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/patient.css' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/patient.css 2012-03-27 04:22:51 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/patient.css 2012-03-28 07:10:48 +0000 @@ -73,3 +73,8 @@ { width: 130px; } + +fieldset +{ + border: 1px solid #3f5d8e; +}