Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5396

PatientService getPatients(name, identifier, types, matchIdentifierExactly) ignores matchIdentifierExactly parameter

    Details

    • Type: Bug
    • Status: Closed
    • Priority: TBD
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Platform 2.2.0, Core 2.2.0
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Undetermined

      Description

      It appears to require an exact identifier match in all cases.

      @Override
      @Transactional(readOnly = true)
      public List<Patient> getPatients(String name, String identifier, List<PatientIdentifierType> identifierTypes,
              boolean matchIdentifierExactly, Integer start, Integer length) throws APIException {
         
         return dao.getPatients(name != null ? name : identifier, start, length);
      }

      Example failing unit test here.

      @Test
      @SkipBaseSetup
      public void shouldGetPatientsByIdentifierAndIdentifierType() throws Exception {
         initializeInMemoryDatabase();
         executeDataSet(FIND_PATIENTS_XML);
         authenticate();
         updateSearchIndex();
         
         List<PatientIdentifierType> types = new ArrayList<>();
         types.add(new PatientIdentifierType(1));
         // make sure we get back only one patient
         List<Patient> patients = patientService.getPatients("1234", null, types, false);
         assertEquals(1, patients.size());
         
         // make sure we get back only one patient
         patients = patientService.getPatients("1234", null, null, false);
         assertEquals(1, patients.size());
         
         // make sure we can search a padded identifier
         patients = patientService.getPatients("00000001234", null, null, false);
         assertEquals(1, patients.size());
      
         // should match unexact identifier
         patients = patientService.getPatients(null, "56342", null, false);
         assertEquals(1, patients.size());
         
      }

        Attachments

          Activity

            People

            • Assignee:
              fruether Fred Rue
              Reporter:
              mogoodrich Mark Goodrich
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: