Search in sources :

Example 1 with PatientTaskUpdateBundleFactory

use of org.hl7.gravity.refimpl.sdohexchange.fhir.factory.PatientTaskUpdateBundleFactory in project Gravity-SDOH-Exchange-RI by FHIR.

the class PatientTaskService method update.

public void update(String id, UpdateTaskRequestDto update, UserDto user) {
    Task task = ehrClient.read().resource(Task.class).withId(id).execute();
    if (task == null) {
        throw new ResourceNotFoundException(new IdType(Task.class.getSimpleName(), id));
    }
    PatientTaskUpdateBundleFactory updateBundleFactory = new PatientTaskUpdateBundleFactory();
    updateBundleFactory.setTask(task);
    updateBundleFactory.setStatus(update.getFhirStatus());
    updateBundleFactory.setStatusReason(update.getStatusReason());
    updateBundleFactory.setComment(update.getComment());
    updateBundleFactory.setUser(user);
    ehrClient.transaction().withBundle(updateBundleFactory.createUpdateBundle()).execute();
}
Also used : Task(org.hl7.fhir.r4.model.Task) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) PatientTaskUpdateBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.PatientTaskUpdateBundleFactory) IdType(org.hl7.fhir.r4.model.IdType)

Aggregations

ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)1 IdType (org.hl7.fhir.r4.model.IdType)1 Task (org.hl7.fhir.r4.model.Task)1 PatientTaskUpdateBundleFactory (org.hl7.gravity.refimpl.sdohexchange.fhir.factory.PatientTaskUpdateBundleFactory)1