------------------------------------------------------------ revno: 10003 committer: Tran Chau <tran.hispviet...@gmail.com> branch nick: dhis2 timestamp: Wed 2013-03-06 15:07:23 +0700 message: Minor fix for getPatientByFullName method modified: dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 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/hibernate/HibernatePatientStore.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-api/src/main/java/org/hisp/dhis/patient/PatientService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2013-03-06 04:25:38 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientService.java 2013-03-06 08:07:23 +0000 @@ -217,5 +217,5 @@ Collection<Patient> getPatientsByPhone( String phoneNumber, Integer min, Integer max ); - Collection<Patient> getPatientByFullname( String fullName, int orgUnitId ); + Collection<Patient> getPatientByFullname( String fullName, Integer orgunitId ); } === 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-03-05 07:29:03 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientStore.java 2013-03-06 08:07:23 +0000 @@ -82,6 +82,6 @@ Collection<Patient> getByPhoneNumber( String phoneNumber, Integer min, Integer max); - Collection<Patient> getByFullName( String fullName ); + Collection<Patient> getByFullName( String fullName, Integer orgunitId ); } === 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-03-06 04:25:38 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/DefaultPatientService.java 2013-03-06 08:07:23 +0000 @@ -590,28 +590,9 @@ } @Override - public Collection<Patient> getPatientByFullname( String fullName, int orgUnitId ) + public Collection<Patient> getPatientByFullname( String fullName, Integer orgunitId ) { - Collection<Patient> patients = new HashSet<Patient>(); - - patients = patientStore.getByFullName( fullName ); - - if ( orgUnitId != 0 ) - { - Set<Patient> toRemoveList = new HashSet<Patient>(); - - for ( Patient patient : patients ) - { - if ( patient.getOrganisationUnit().getId() != orgUnitId ) - { - toRemoveList.add( patient ); - } - } - - patients.removeAll( toRemoveList ); - } - - return patients; + return patientStore.getByFullName( fullName, orgunitId ); } } === 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-03-05 09:01:39 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2013-03-06 08:07:23 +0000 @@ -576,7 +576,7 @@ { sql += statementBuilder.limitRecord( min, max ); } - + return sql; } @@ -596,13 +596,17 @@ } @Override - public Collection<Patient> getByFullName( String fullName ) + public Collection<Patient> getByFullName( String fullName, Integer orgunitId ) { List<Patient> patients = new ArrayList<Patient>(); fullName = fullName.toLowerCase(); - String sql = "SELECT patientid FROM patient " + "where lower( " + statementBuilder.getPatientFullName() + ") " + String sql = "SELECT patientid FROM patient where lower( " + statementBuilder.getPatientFullName() + ") " + "='" + fullName + "'"; + if ( orgunitId != null ) + { + sql += " and organisationunitid=" + orgunitId; + } try {
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp