Package org.openmrs.api

Examples of org.openmrs.api.PatientService


   
    List<Integer> personId = new ArrayList<Integer>();
    List<Object> personList = new ArrayList<Object>();
   
    //first we are going to search by name for patients
    PatientService patientService = Context.getPatientService();
    for (Patient p : patientService.getPatients(searchPhrase, null, null, false)) {
      personList.add(PersonListItem.createBestMatch(p));
      personId.add(p.getId());
    }
   
    // now we check for persons (that won't be brought back by the patient search)
    PersonService ps = Context.getPersonService();
    for (Person p : ps.getPeople(searchPhrase, null)) {
     
      if(!personId.contains(p.getId()))
      {
        personList.add(PersonListItem.createBestMatch(p));
      }
    }
   
    // also search on patient identifier if the query contains a number
    if (searchPhrase.matches(".*\\d+.*")) {
      patientService = Context.getPatientService();
      for (Patient p : patientService.getPatients(null, searchPhrase, null, false)) {
        if(!personId.contains(p.getId()))
        {
          personList.add(PersonListItem.createBestMatch(p));
        }
      }
View Full Code Here

TOP

Related Classes of org.openmrs.api.PatientService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.