=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java 2012-07-30 10:56:25 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetDataRecordsAction.java 2012-08-07 05:43:56 +0000 @@ -38,11 +38,7 @@ import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.paging.ActionPagingSupport; import org.hisp.dhis.patient.Patient; -import org.hisp.dhis.patient.PatientAttribute; -import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patient.PatientService; -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; @@ -93,36 +89,10 @@ this.programStageInstanceService = programStageInstanceService; } - private PatientAttributeService patientAttributeService; - - public void setPatientAttributeService( PatientAttributeService patientAttributeService ) - { - this.patientAttributeService = patientAttributeService; - } - - private PatientAttributeValueService patientAttributeValueService; - - public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService ) - { - this.patientAttributeValueService = patientAttributeValueService; - } - // ------------------------------------------------------------------------- // Input/output // ------------------------------------------------------------------------- - private Integer sortPatientAttributeId; - - public void setSortPatientAttributeId( Integer sortPatientAttributeId ) - { - this.sortPatientAttributeId = sortPatientAttributeId; - } - - public Integer getSortPatientAttributeId() - { - return sortPatientAttributeId; - } - private Integer programId; public void setProgramId( Integer programId ) @@ -130,9 +100,18 @@ this.programId = programId; } - public Integer getProgramId() - { - return programId; + private boolean listAll; + + public void setListAll( boolean listAll ) + { + this.listAll = listAll; + } + + private List searchTexts = new ArrayList(); + + public void setSearchTexts( List searchTexts ) + { + this.searchTexts = searchTexts; } private Integer total; @@ -170,32 +149,11 @@ return programInstanceMap; } - private Map patientAttributeValueMap = new HashMap(); - - public Map getPatientAttributeValueMap() - { - return patientAttributeValueMap; - } - - Collection patientListByOrgUnit; - - public Collection getPatientListByOrgUnit() - { - return patientListByOrgUnit; - } - - private PatientAttribute sortPatientAttribute; - - public PatientAttribute getSortPatientAttribute() - { - return sortPatientAttribute; - } - - private Program program; - - public Program getProgram() - { - return program; + Collection patients; + + public Collection getPatients() + { + return patients; } // ------------------------------------------------------------------------- @@ -205,32 +163,36 @@ public String execute() throws Exception { - OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit(); - - program = programService.getProgram( programId ); - - sortPatientAttribute = patientAttributeService.getPatientAttribute( sortPatientAttributeId ); + OrganisationUnit orgunit = selectedStateManager.getSelectedOrganisationUnit(); + + Program program = programService.getProgram( programId ); // --------------------------------------------------------------------- // Program instances for the selected program // --------------------------------------------------------------------- - - total = patientService.countGetPatientsByOrgUnitProgram( organisationUnit, program ); - - this.paging = createPaging( total ); - - patientListByOrgUnit = new ArrayList( patientService.getPatients( organisationUnit, program, paging - .getStartPos(), paging.getPageSize() ) ); - - if ( sortPatientAttribute != null ) - { - patientAttributeValueMap = patientAttributeValueService.getPatientAttributeValueMapForPatients( - patientListByOrgUnit, sortPatientAttribute ); - } + // List all patients + if ( listAll ) + { + total = patientService.countGetPatientsByOrgUnit( orgunit ); + this.paging = createPaging( total ); + + patients = new ArrayList( patientService.getPatients( orgunit, program, paging.getStartPos(), + paging.getPageSize() ) ); + + } + // search patients + else if ( searchTexts.size() > 0 ) + { + total = patientService.countSearchPatients( searchTexts, orgunit ); + this.paging = createPaging( total ); + patients = patientService.searchPatients( searchTexts, orgunit, paging.getStartPos(), + paging.getPageSize() ); + } + Collection programStageInstances = new ArrayList(); - for ( Patient patient : patientListByOrgUnit ) + for ( Patient patient : patients ) { Collection _programInstances = programInstanceService.getProgramInstances( patient, program, false ); @@ -245,7 +207,7 @@ { programInstanceMap.put( patient, programInstance ); programInstances.add( programInstance ); - + List programStageInstanceList = new ArrayList( programInstance.getProgramStageInstances() ); Collections.sort( programStageInstanceList, new ProgramStageInstanceDueDateComparator() ); === 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-07-30 10:56:25 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-08-07 05:43:56 +0000 @@ -168,15 +168,11 @@ scope="prototype"> + - - - /dhis-web-caseentry/multiDataEntrySelect.vm /dhis-web-caseentry/dataEntryMenu.vm style/style.css - ../dhis-web-commons/ouwt/ouwt.js,javascript/commons.js, - javascript/form.js,javascript/multiDataEntry.js + ../dhis-web-commons/ouwt/ouwt.js,javascript/commons.js,javascript/multiDataEntry.js F_NAME_BASED_DATA_ENTRY - /content.vm - /dhis-web-caseentry/multiDataEntryIndex.vm + /dhis-web-commons/ajax/jsonPrograms.vm /content.vm /dhis-web-caseentry/programStageDataEntryForm.vm - javascript/form.js,javascript/entry.js,../dhis-web-commons/javascripts/date.js + javascript/entry.js,../dhis-web-commons/javascripts/date.js style/style.css @@ -227,7 +225,7 @@ class="org.hisp.dhis.caseentry.action.caseentry.ProgramStageCustomDataEntryAction"> /content.vm /dhis-web-caseentry/dataEntryForm.vm - javascript/form.js,../dhis-web-commons/javascripts/date.js + ../dhis-web-commons/javascripts/date.js