=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 2013-10-14 16:17:44 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 2013-10-14 16:24:16 +0000 @@ -28,15 +28,14 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.Collection; +import java.util.Date; +import java.util.List; + import org.hisp.dhis.common.GenericIdentifiableObjectStore; -import org.hisp.dhis.common.Grid; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.program.Program; -import java.util.Collection; -import java.util.Date; -import java.util.List; - /** * @author Abyot Asalefew Gizaw * @version $Id$ @@ -79,10 +78,6 @@ Collection search( List searchKeys, Collection orgunit, Boolean followup, Collection patientAttributes, Collection identifierTypes, Integer statusEnrollment, Integer min, Integer max ); - Grid getPatientEventReport( Grid grid, List searchKeys, Collection orgunit, Boolean followup, - Collection patientAttributes, Collection identifierTypes, Integer statusEnrollment, Integer min, - Integer max ); - List getProgramStageInstances( List searchKeys, Collection orgunits, Boolean followup, Collection patientAttributes, Collection identifierTypes, Integer statusEnrollment, Integer min, Integer max ); === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2013-10-14 16:17:44 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2013-10-14 16:24:16 +0000 @@ -613,9 +613,8 @@ grid.addHeader( new GridHeader( i18n.getString( "program_stage" ), false, true ) ); grid.addHeader( new GridHeader( i18n.getString( "due_date" ), false, true ) ); - return patientStore.getPatientEventReport( grid, searchKeys, orgunits, followup, patientAttributes, null, + return getPatientEventReport( grid, searchKeys, orgunits, followup, patientAttributes, null, statusEnrollment, min, max ); - } @Override @@ -658,9 +657,8 @@ grid.addHeader( new GridHeader( i18n.getString( "due_date" ), false, true ) ); grid.addHeader( new GridHeader( i18n.getString( "risk" ), false, true ) ); - return patientStore.getPatientEventReport( grid, searchKeys, orgunits, followup, null, patientIdentifierTypes, + return getPatientEventReport( grid, searchKeys, orgunits, followup, null, patientIdentifierTypes, statusEnrollment, null, null ); - } @Override @@ -675,4 +673,23 @@ return patientStore.getRegistrationOrgunitIds( startDate, endDate ); } + // ------------------------------------------------------------------------- + // Supportive methods + // ------------------------------------------------------------------------- + + private Grid getPatientEventReport( Grid grid, List searchKeys, Collection orgunits, + Boolean followup, Collection patientAttributes, + Collection identifierTypes, Integer statusEnrollment, Integer min, Integer max ) + { + Collection patients = patientStore.search( searchKeys, orgunits, followup, patientAttributes, identifierTypes, statusEnrollment, min, max ); + + for ( Patient pt : patients ) + { + grid.addRow(); + grid.addValue( pt.getId() ).addValue( pt.getName() ).addValue( pt.getGender() ).addValue( pt.getPhoneNumber() ); + } + + return grid; + } + } === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2013-10-14 16:17:44 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2013-10-14 16:24:16 +0000 @@ -55,7 +55,6 @@ import org.hibernate.criterion.Order; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; -import org.hisp.dhis.common.Grid; import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore; import org.hisp.dhis.jdbc.StatementBuilder; import org.hisp.dhis.organisationunit.OrganisationUnit; @@ -67,10 +66,8 @@ import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramInstance; import org.hisp.dhis.program.ProgramStageInstance; -import org.hisp.dhis.system.grid.GridUtils; import org.hisp.dhis.system.util.TextUtils; import org.springframework.jdbc.core.RowMapper; -import org.springframework.jdbc.support.rowset.SqlRowSet; import org.springframework.transaction.annotation.Transactional; /** @@ -315,25 +312,6 @@ return jdbcTemplate.queryForObject( sql, Integer.class ); } - @Override - public Grid getPatientEventReport( Grid grid, List searchKeys, Collection orgunits, - Boolean followup, Collection patientAttributes, - Collection identifierTypes, Integer statusEnrollment, Integer min, Integer max ) - { - // --------------------------------------------------------------------- - // Get SQL and build grid - // --------------------------------------------------------------------- - - String sql = searchPatientSql( false, searchKeys, orgunits, followup, patientAttributes, identifierTypes, - statusEnrollment, null, null ); - - SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql ); - - GridUtils.addRows( grid, rowSet ); - - return grid; - } - // ------------------------------------------------------------------------- // Supportive methods // -------------------------------------------------------------------------