public SimpleObject searchById(
      @RequestParam(value = "primaryId", required = false) String primaryId,
      @SpringBean EmrPatientService service,
      @SpringBean EmrApiProperties emrApiProperties,
      UiUtils ui) {

    Patient patient = service.findPatientByPrimaryId(primaryId);
    return simplify(ui, emrApiProperties, patient);
  }
 public List<SimpleObject> search(
     @RequestParam(value = "q", required = false) String query,
     @RequestParam(value = "term", required = false) String term,
     @RequestParam(value = "checkedInAt", required = false) Location checkedInAt,
     @RequestParam(value = "maxResults", required = false) Integer maxResults,
     @SpringBean EmrPatientService service,
     @SpringBean EmrApiProperties emrApiProperties,
     UiUtils ui) {
   if (StringUtils.isBlank(query)) {
     query = term;
   }
   int resultLimit = 100;
   if (maxResults != null && maxResults.intValue() > 0) {
     resultLimit = maxResults.intValue();
   }
   List<Patient> results = service.findPatients(query, checkedInAt, 0, resultLimit);
   return simplify(ui, emrApiProperties, results);
 }