public Patient getPatientForUpdate(String uuid, Map<String, Object> propertiesToUpdate) { Patient patient = getByUniqueId(uuid); PersonResource1_8 personResource = (PersonResource1_8) Context.getService(RestService.class) .getResourceBySupportedClass(Person.class); personResource.setConvertedProperties(patient, (Map<String, Object>) propertiesToUpdate.get("person"), personResource.getUpdatableProperties(), false); return patient; }
private Patient getPatient(String patientUniqueId) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceByName( RestConstants.VERSION_1 + "/patient")).getByUniqueId(patientUniqueId); if (patient == null) throw new ObjectNotFoundException(); return patient; }
Patient.class)).getByUniqueId(patientUuid);
@Override public PageableResult search(RequestContext context) throws ResponseException { String patientUuid = context.getRequest().getParameter("patient"); String encounterTypeUuid = context.getRequest().getParameter("encounterType"); String dateFrom = context.getRequest().getParameter(DATE_FROM); String dateTo = context.getRequest().getParameter(DATE_TO); Date fromDate = dateFrom != null ? (Date) ConversionUtil.convert(dateFrom, Date.class) : null; Date toDate = dateTo != null ? (Date) ConversionUtil.convert(dateTo, Date.class) : null; Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); EncounterType encounterType = ((EncounterTypeResource1_8) Context.getService(RestService.class) .getResourceBySupportedClass(EncounterType.class)).getByUniqueId(encounterTypeUuid); if (patient != null) { List<Encounter> encounters = Context.getEncounterService().getEncounters(patient, null, fromDate, toDate, null, encounterType != null ? Arrays.asList(encounterType) : null, null, false); String order = context.getRequest().getParameter("order"); if ("desc".equals(order)) { Collections.reverse(encounters); } return new NeedsPaging<Encounter>(encounters, context); } return new EmptySearchResult(); }
Patient.class)).getByUniqueId(patientUuid);
/** * Gets allergies for a given patient (paged according to context if necessary) only if a * patient parameter exists in the request set on the {@link RequestContext} * * @param context * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#doSearch(RequestContext) */ @Override protected PageableResult doSearch(RequestContext context) { String patientUuid = context.getRequest().getParameter("patient"); if (patientUuid != null) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); if (patient == null) return new EmptySearchResult(); return new NeedsPaging<Allergy>(Context.getPatientService().getAllergies(patient), context); } //currently this is not supported since the superclass throws an exception return super.doSearch(context); }
/** * Gets problems for a given patient (paged according to context if necessary) only if a patient * parameter exists in the request set on the {@link RequestContext} * * @param context * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#doSearch(org.openmrs.module.webservices.rest.web.RequestContext) */ @Override protected PageableResult doSearch(RequestContext context) { String patientUuid = context.getRequest().getParameter("patient"); if (patientUuid != null) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); if (patient == null) return new EmptySearchResult(); return new NeedsPaging<Problem>(Context.getPatientService().getProblems(patient), context); } //currently this is not supported since the superclass throws an exception return super.doSearch(context); }
Patient.class)).getByUniqueId(patientUuid); EncounterType encounterType = ((EncounterTypeResource1_8) Context.getService(RestService.class) .getResourceBySupportedClass(EncounterType.class)).getByUniqueId(encounterTypeUuid);
/** * Gets encounters for the given patient (paged according to context if necessary) only if a * patient parameter exists in the request set on the {@link RequestContext} otherwise searches * for encounters that match the specified query * * @param context * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#doSearch(org.openmrs.module.webservices.rest.web.RequestContext) */ @Override protected PageableResult doSearch(RequestContext context) { String patientUuid = context.getRequest().getParameter("patient"); if (patientUuid != null) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); if (patient == null) return new EmptySearchResult(); List<Encounter> encs = Context.getEncounterService().getEncountersByPatient(patient); return new NeedsPaging<Encounter>(encs, context); } return new ServiceSearcher<Encounter>(EncounterService.class, "getEncounters", "getCountOfEncounters").search( context.getParameter("q"), context); }
if (patientUuid != null) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); if (patient == null) return new EmptySearchResult();
if (patientUuid != null) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); if (patient == null) { throw new ObjectNotFoundException();
if (patientUuid != null) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); if (patient == null) return new EmptySearchResult();