use of org.hl7.gravity.refimpl.sdohexchange.dto.request.patienttask.NewPatientTaskRequestDto in project Gravity-SDOH-Exchange-RI by FHIR.
the class PatientTaskService method newTask.
public String newTask(NewPatientTaskRequestDto taskRequest, UserDto user) {
Assert.notNull(SmartOnFhirContext.get().getPatient(), "Patient id cannot be null.");
PatientTaskBundleFactory taskBundleFactory;
if (taskRequest instanceof NewMakeContactTaskRequestDto) {
taskBundleFactory = createMakeContactTaskBundleFactory(user, (NewMakeContactTaskRequestDto) taskRequest);
} else if (taskRequest instanceof NewSocialRiskTaskRequestDto) {
taskBundleFactory = createSocialRiskTaskBundleFactory(user, (NewSocialRiskTaskRequestDto) taskRequest);
} else if (taskRequest instanceof NewFeedbackTaskRequestDto) {
taskBundleFactory = createFeedbackTaskBundleFactory(user, (NewFeedbackTaskRequestDto) taskRequest);
} else {
throw new IllegalArgumentException(taskRequest.getClass().getSimpleName() + " instances not supported yet.");
}
Bundle taskCreateBundle = ehrClient.transaction().withBundle(taskBundleFactory.createBundle()).execute();
return FhirUtil.getFromResponseBundle(taskCreateBundle, Task.class).getIdPart();
}
Aggregations