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

HibernatePatientDAO getPatients(String,Integer,Integer) only returns single identifier when matching by patient identifier

    XMLWordPrintable

Details

    • Undetermined

    Description

      When you do a patient search using the getPatient method and an exact identifier match, the result Patient object returned only contains the patient identifier searched for, not all the identifiers for that patient.

      This bug first appeared in 1.11.x and appears to happen at the Hibernate level... I tracked it down to these PatientSearchCriteria method:

      https://github.com/openmrs/openmrs-core/blob/master/api/src/main/java/org/openmrs/api/db/hibernate/PatientSearchCriteria.java#L79

      I confirmed that when doing a exact identifier search the following criteria is generated:

      CriteriaImpl(org.openmrs.Patient:this[Subcriteria(identifiers:ids)][(ids.voided=false and ids.identifier=Y2AX43), voided=false])

      After the criteria.list() the resulting Patient object contains only a single identifier (in this case "Y2AX43") no matter how many identifiers the patient has.  

      The main patient REST object uses this search, so, concretely, if you make a call like:

      /openmrs/ws/rest/v1/patient?identifier=CDI000003&v=default

      The resulting object returns will contain an "identifiers" section with only that identifier, not all the patient's identifiers. This seems incorrect.

       

       

       

      Gliffy Diagrams

        Attachments

          Activity

            People

              Unassigned Unassigned
              mogoodrich Mark Goodrich
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: