use of org.hl7.gravity.refimpl.sdohexchange.fhir.query.PatientTaskQueryFactory in project Gravity-SDOH-Exchange-RI by FHIR.
the class PatientTaskService method read.
public PatientTaskDto read(String id) {
Bundle taskBundle = new PatientTaskQueryFactory().query(ehrClient, SmartOnFhirContext.get().getPatient()).include(Task.INCLUDE_PART_OF).where(Task.RES_ID.exactly().code(id)).where(new TokenClientParam("owner:Patient").exactly().code(SmartOnFhirContext.get().getPatient())).returnBundle(Bundle.class).execute();
addQuestionnairesToTaskBundle(taskBundle);
addQuestionnaireResponsesToTaskBundle(taskBundle);
return new PatientTaskBundleToDtoConverter().convert(taskBundle).stream().findFirst().orElseThrow(() -> new ResourceNotFoundException(new IdType(Task.class.getSimpleName(), id)));
}
use of org.hl7.gravity.refimpl.sdohexchange.fhir.query.PatientTaskQueryFactory in project Gravity-SDOH-Exchange-RI by FHIR.
the class PatientTaskService method listTasks.
public List<PatientTaskItemDto> listTasks() {
Assert.notNull(SmartOnFhirContext.get().getPatient(), "Patient id cannot be null.");
Bundle tasksBundle = new PatientTaskQueryFactory().query(ehrClient, SmartOnFhirContext.get().getPatient()).include(Task.INCLUDE_PART_OF).where(new TokenClientParam("owner:Patient").exactly().code(SmartOnFhirContext.get().getPatient())).returnBundle(Bundle.class).execute();
addQuestionnairesToTaskBundle(tasksBundle);
return new PatientTaskBundleToItemDtoConverter().convert(tasksBundle);
}
Aggregations