dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09931
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2697: Fix bug: Cannot search fullName of patient.
------------------------------------------------------------
revno: 2697
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-01-21 16:18:56 +0700
message:
Fix bug: Cannot search fullName of patient.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.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-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java 2011-01-20 02:12:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java 2011-01-21 09:18:56 +0000
@@ -80,7 +80,29 @@
public String execute()
{
- patients = new ArrayList<Patient>( patientService.getPatients( fullName ) );
+ int startIndex = fullName.indexOf( ' ' );
+ int endIndex = fullName.lastIndexOf( ' ' );
+
+ String firstName = fullName.toString();
+ String middleName = "";
+ String lastName = "";
+
+ if( startIndex != -1 )
+ {
+ firstName = fullName.substring( 0, startIndex );
+ if ( startIndex == endIndex )
+ {
+ middleName = "";
+ lastName = fullName.substring( startIndex, fullName.length() );
+ }
+ else
+ {
+ middleName = fullName.substring( startIndex + 1, endIndex );
+ lastName = fullName.substring( endIndex, fullName.length() );
+ }
+ }
+
+ patients = new ArrayList<Patient>( patientService.getPatients( firstName + " " + middleName + " " + lastName ) );
return SUCCESS;
}