/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getUpdatableProperties() */ @Override public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { DelegatingResourceDescription description = super.getUpdatableProperties(); //shouldn't be editing the patient description.removeProperty("patient"); return description; }
@RepHandler(RefRepresentation.class) public SimpleObject asRef(T delegate) throws ConversionException { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); if (delegate.isVoided()) description.addProperty("voided"); description.addSelfLink(); return convertDelegateToRepresentation(delegate, description); }
@Override public Object create(SimpleObject propertiesToCreate, RequestContext context) throws ResponseException { // RESTWS-488: set startDatetime if not provided if (propertiesToCreate.get("startDatetime") == null) { propertiesToCreate.add("startDatetime", new Date()); } return super.create(propertiesToCreate, context); };
public Model getGETModel(Representation rep) { ModelImpl model = ((ModelImpl) super.getGETModel(rep)); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("name", new StringProperty()) .property("description", new StringProperty()) .property("voided", new StringProperty()) .property("memberIds", new ArrayProperty(new IntegerProperty())); //FIXME } return model; }
/** * Gets all the programs (excluding voided) of the given patient * * @param context * @return all programs of the given patient */ @Override protected PageableResult doSearch(RequestContext context) { String patientUuid = context.getRequest().getParameter("patient"); if (patientUuid != null) { PatientService patientService = Context.getPatientService(); Patient patient = patientService.getPatientByUuid(patientUuid); if (patient == null) { return new EmptySearchResult(); } List<PatientProgram> patientPrograms = Context.getProgramWorkflowService().getPatientPrograms(patient, null, null, null, null, null, false); return new NeedsPaging<PatientProgram>(patientPrograms, context); } return super.doSearch(context); } }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#search(org.openmrs.module.webservices.rest.web.RequestContext) */ @Override public SimpleObject search(RequestContext context) throws ResponseException { String patientParameter = context.getRequest().getParameter("patient"); String locationParameter = context.getRequest().getParameter("location"); String includeInactiveParameter = context.getRequest().getParameter("includeInactive"); String fromStartDate = context.getRequest().getParameter("fromStartDate"); if (patientParameter != null || includeInactiveParameter != null || locationParameter != null) { Date minStartDate = fromStartDate != null ? (Date) ConversionUtil.convert(fromStartDate, Date.class) : null; return getVisits(context, patientParameter, includeInactiveParameter, minStartDate, locationParameter); } else { return super.search(context); } }
/** * Overrides the base getAuditInfo(delegate) since the dateCreated for person should get * personDateCreated attribute * * @param person the delegate person * @return audit information * @throws Exception */ @PropertyGetter("auditInfo") public SimpleObject getAuditInfo(Person person) throws Exception { SimpleObject ret = super.getAuditInfo(person); ret.put("dateCreated", ConversionUtil.convertToRepresentation(person.getPersonDateCreated(), Representation.DEFAULT)); return ret; } }
@Override public Object update(String uuid, SimpleObject propertiesToUpdate, RequestContext context) throws ResponseException { if (propertiesToUpdate.get("person") == null) { return super.update(uuid, propertiesToUpdate, context); } Patient patient = getPatientForUpdate(uuid, propertiesToUpdate); ValidateUtil.validate(patient); patient = save(patient); return ConversionUtil.convertToRepresentation(patient, Representation.DEFAULT); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getGETModel(Representation) */ @Override public Model getGETModel(Representation rep) { ModelImpl model = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model .property("uuid", new StringProperty()) .property("diagnosis", new StringProperty()) .property("condition", new StringProperty()) .property("certainty", new EnumProperty(ConditionVerificationStatus.class)) .property("rank", new IntegerProperty()) .property("patient", new RefProperty("#/definitions/PatientGetRef")) .property("voided", new BooleanProperty()); } return model; }
return super.doSearch(context);
@Override public Model getGETModel(Representation rep) { ModelImpl model = (ModelImpl) super.getGETModel(rep); //FIXME check uuid, display in ref rep if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("identifiers", new ArrayProperty(new RefProperty("#/definitions/PatientIdentifierGetRef"))) .property("preferred", new BooleanProperty()._default(false)) .property("voided", new BooleanProperty()); } if (rep instanceof DefaultRepresentation) { model .property("person", new RefProperty("#/definitions/PersonGetRef")); } else if (rep instanceof FullRepresentation) { model .property("person", new RefProperty("#/definitions/PersonGet")); } return model; }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getUpdatableProperties() */ @Override public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { DelegatingResourceDescription description = super.getUpdatableProperties(); //shouldn't be editing the patient description.removeProperty("personA"); description.removeProperty("personB"); description.addProperty("voided"); return description; }
@Override public Model getGETModel(Representation rep) { ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation) { modelImpl .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("messageState", new IntegerProperty()); } else if (rep instanceof FullRepresentation) { modelImpl .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("source", new RefProperty("#/definitions/Hl7sourceGet")) .property("sourceKey", new StringProperty()) .property("data", new StringProperty()) .property("messageState", new IntegerProperty()); } return modelImpl; }
@Override public Model getGETModel(Representation rep) { ModelImpl model = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("voided", new BooleanProperty()); } if (rep instanceof DefaultRepresentation) { model .property("personA", new RefProperty("#/definitions/PersonGetRef")) .property("relationshipType", new RefProperty("#/definitions/RelationshiptypeGetRef")) .property("personB", new RefProperty("#/definitions/PersonGetRef")); } else if (rep instanceof FullRepresentation) { model .property("personA", new RefProperty("#/definitions/PersonGet")) .property("relationshipType", new RefProperty("#/definitions/RelationshiptypeGet")) .property("personB", new RefProperty("#/definitions/PersonGet")); } return model; }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#getGETModel(Representation) */ public Model getGETModel(Representation rep) { ModelImpl model = ((ModelImpl) super.getGETModel(rep)); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("condition", new StringProperty()) .property("patient", new RefProperty("#/definitions/PatientGetRef")) .property("clinicalStatus", new StringProperty()) .property("verificationStatus", new StringProperty()) .property("previousVersion", new StringProperty()) .property("onsetDate", new StringProperty()) .property("endDate", new StringProperty()) .property("additionalDetail", new StringProperty()) .property("voided", new StringProperty()); } return model; }
@Override public Model getGETModel(Representation rep) { ModelImpl model = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("dateEnrolled", new DateProperty()) .property("dateCompleted", new DateProperty()) .property("voided", new BooleanProperty()); } if (rep instanceof DefaultRepresentation) { model .property("patient", new RefProperty("#/definitions/PatientGetRef")) .property("program", new RefProperty("#/definitions/ProgramGetRef")) .property("location", new RefProperty("#/definitions/LocationGetRef")); } else if (rep instanceof FullRepresentation) { model .property("patient", new RefProperty("#/definitions/PatientGet")) .property("program", new RefProperty("#/definitions/ProgramGet")) .property("location", new RefProperty("#/definitions/LocationGet")); } return model; }
public Model getGETModel(Representation rep) { ModelImpl model = ((ModelImpl) super.getGETModel(rep)) .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("startDate", new DateProperty()) .property("endDate", new DateProperty()) .property("comments", new StringProperty()) .property("voided", new BooleanProperty()); if (rep instanceof DefaultRepresentation) { model .property("person", new RefProperty("#/definitions/PersonGet")) .property("activeListType", new StringProperty()) //FIXME type .property("startObs", new RefProperty("#/definitions/ObsGet")) .property("stopObs", new RefProperty("#/definitions/ObsGetRef")); } else if (rep instanceof FullRepresentation) { model .property("person", new RefProperty("#/definitions/PersonGetRef")) .property("activeListType", new StringProperty()) //FIXME type .property("startObs", new RefProperty("#/definitions/ObsGetRef")) .property("stopObs", new RefProperty("#/definitions/ObsGetRef")); } return model; }
@Override public Model getGETModel(Representation rep) { ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { modelImpl.property("uuid", new StringProperty()).property("display", new StringProperty()) .property("startDatetime", new DateProperty()).property("stopDatetime", new DateProperty()) .property("attributes", new ArrayProperty(new StringProperty())) //FIXME type .property("voided", new BooleanProperty()); } if (rep instanceof DefaultRepresentation) { modelImpl.property("patient", new RefProperty("#/definitions/PatientGetRef")) .property("visitType", new RefProperty("#/definitions/VisittypeGetRef")) .property("indication", new RefProperty("#/definitions/ConceptGetRef")) .property("location", new RefProperty("#/definitions/LocationGetRef")) .property("encounters", new ArrayProperty(new RefProperty("#/definitions/EncounterGetRef"))); } else if (rep instanceof FullRepresentation) { modelImpl.property("patient", new RefProperty("#/definitions/PatientGet")) .property("visitType", new RefProperty("#/definitions/VisittypeGet")) .property("indication", new RefProperty("#/definitions/ConceptGet")) .property("location", new RefProperty("#/definitions/LocationGet")) .property("encounters", new ArrayProperty(new RefProperty("#/definitions/EncounterGet"))); } return modelImpl; }
public Model getGETModel(Representation rep) { ModelImpl modelImpl = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { modelImpl .property("uuid", new StringProperty()) .property("display", new StringProperty()) .property("encounterDatetime", new DateProperty()) .property("provider", new StringProperty()) //FIXME .property("voided", new BooleanProperty()); } if (rep instanceof DefaultRepresentation) { modelImpl .property("patient", new RefProperty("#/definitions/PatientGetRef")) //FIXME .property("location", new RefProperty("#/definitions/LocationGetRef")) //FIXME .property("form", new RefProperty("#/definitions/FormGetRef")) //FIXME .property("encounterType", new RefProperty("#/definitions/EncountertypeGetRef")) //FIXME .property("obs", new ArrayProperty(new RefProperty("#/definitions/ObsGetRef"))) //FIXME .property("orders", new ArrayProperty(new RefProperty("#/definitions/OrderGetRef"))); //FIXME } else if (rep instanceof FullRepresentation) { modelImpl .property("patient", new RefProperty("#/definitions/PatientGet")) //FIXME .property("location", new RefProperty("#/definitions/LocationGet")) //FIXME .property("form", new RefProperty("#/definitions/FormGet")) //FIXME .property("encounterType", new RefProperty("#/definitions/EncountertypeGet")) //FIXME .property("obs", new ArrayProperty(new RefProperty("#/definitions/ObsGet"))) //FIXME .property("orders", new ArrayProperty(new RefProperty("#/definitions/OrderGet"))); //FIXME } return modelImpl; }
@Override public Model getGETModel(Representation rep) { ModelImpl model = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model