Skip to content

Commit 14914f9

Browse files
committedMay 15, 2013
reverting backport for TRUNK-3822: Search for patient by identifier fails when identifier is made of only letters
1 parent 539307a commit 14914f9

File tree

2 files changed

+12
-42
lines changed

2 files changed

+12
-42
lines changed
 

‎web/src/main/java/org/openmrs/web/dwr/DWRPatientService.java

+9-10
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@
1313
*/
1414
package org.openmrs.web.dwr;
1515

16-
import java.text.ParseException;
17-
import java.text.SimpleDateFormat;
18-
import java.util.Collection;
19-
import java.util.Date;
20-
import java.util.HashMap;
21-
import java.util.List;
22-
import java.util.Map;
23-
import java.util.Vector;
24-
2516
import org.apache.commons.lang.StringUtils;
2617
import org.apache.commons.logging.Log;
2718
import org.apache.commons.logging.LogFactory;
@@ -54,6 +45,15 @@
5445
import org.openmrs.patient.UnallowedIdentifierException;
5546
import org.openmrs.util.OpenmrsConstants;
5647

48+
import java.text.ParseException;
49+
import java.text.SimpleDateFormat;
50+
import java.util.Collection;
51+
import java.util.Date;
52+
import java.util.HashMap;
53+
import java.util.List;
54+
import java.util.Map;
55+
import java.util.Vector;
56+
5757
/**
5858
* DWR patient methods. The methods in here are used in the webapp to get data from the database via
5959
* javascript calls.
@@ -176,7 +176,6 @@ else if (validCheckDigit)
176176
* @should signal for a new search if the new search value has matches and is a first call
177177
* @should not signal for a new search if it is not the first ajax call
178178
* @should not signal for a new search if the new search value has no matches
179-
* @should match patient with identifiers that contain no digit
180179
*/
181180
public Map<String, Object> findCountAndPatients(String searchValue, Integer start, Integer length, boolean getMatchCount)
182181
throws APIException {

‎web/src/test/java/org/openmrs/web/dwr/DWRPatientServiceTest.java

+3-32
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,15 @@
1313
*/
1414
package org.openmrs.web.dwr;
1515

16-
import java.util.Collection;
17-
import java.util.List;
18-
import java.util.Map;
19-
2016
import org.junit.Assert;
2117
import org.junit.Ignore;
2218
import org.junit.Test;
23-
import org.openmrs.Patient;
24-
import org.openmrs.PatientIdentifier;
25-
import org.openmrs.api.PatientService;
26-
import org.openmrs.api.context.Context;
2719
import org.openmrs.test.Verifies;
2820
import org.openmrs.web.test.BaseWebContextSensitiveTest;
2921

22+
import java.util.Collection;
23+
import java.util.Map;
24+
3025
/**
3126
* Test the methods in {@link DWRPatientsServiceTest}
3227
*/
@@ -100,28 +95,4 @@ public void findCountAndPatients_shouldSignalForANewSearchIfTheNewSearchValueHas
10095
Assert.assertNotNull(resultObjects.get("notification"));
10196
}
10297

103-
/**
104-
* @see {@link DWRPatientService#findCountAndPatients(String,Integer,Integer,null)}
105-
*/
106-
@Test
107-
@Verifies(value = "should match patient with identifiers that contain no digit", method = "findCountAndPatients(String,Integer,Integer,null)")
108-
public void findCountAndPatients_shouldMatchPatientWithIdentifiersThatContainNoDigit() throws Exception {
109-
PatientService ps = Context.getPatientService();
110-
final String identifier = "XYZ";
111-
//should have no patient with this identifiers
112-
Assert.assertEquals(0, ps.getCountOfPatients(identifier).intValue());
113-
114-
Patient patient = ps.getPatient(2);
115-
PatientIdentifier pId = new PatientIdentifier(identifier, ps.getPatientIdentifierType(2), Context
116-
.getLocationService().getLocation(1));
117-
patient.addIdentifier(pId);
118-
ps.savePatient(patient);
119-
120-
//Let's do this in a case insensitive way
121-
Map<String, Object> resultObjects = new DWRPatientService().findCountAndPatients(identifier.toLowerCase(), 0, null,
122-
true);
123-
Assert.assertEquals(1, resultObjects.get("count"));
124-
Assert.assertEquals(1, ((List<?>) resultObjects.get("objectList")).size());
125-
}
126-
12798
}

0 commit comments

Comments
 (0)
Please sign in to comment.