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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • TBD
    • Resolution: Fixed
    • None
    • Platform 2.2.0, Core 2.2.0
    • None
    • None

    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());
         
      }

      Gliffy Diagrams

        Attachments

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: