use of org.hl7.gravity.refimpl.sdohexchange.fhir.extract.patienttask.PatientMakeContactTaskPrepareBundleExtractor in project Gravity-SDOH-Exchange-RI by FHIR.
the class PatientTaskService method createMakeContactTaskBundleFactory.
private PatientMakeContactTaskBundleFactory createMakeContactTaskBundleFactory(UserDto user, NewMakeContactTaskRequestDto makeContactTaskRequest) {
PatientMakeContactTaskPrepareBundleFactory taskPrepareBundleFactory = new PatientMakeContactTaskPrepareBundleFactory(SmartOnFhirContext.get().getPatient(), user.getId(), makeContactTaskRequest.getHealthcareServiceId(), makeContactTaskRequest.getReferralTaskId());
Bundle taskRelatedResources = ehrClient.transaction().withBundle(taskPrepareBundleFactory.createPrepareBundle()).execute();
PatientMakeContactTaskPrepareBundleExtractor.PatientMakeContactTaskPrepareInfoHolder taskPrepareInfoHolder = new PatientMakeContactTaskPrepareBundleExtractor().extract(taskRelatedResources);
PatientMakeContactTaskBundleFactory taskBundleFactory = new PatientMakeContactTaskBundleFactory();
taskBundleFactory.setName(makeContactTaskRequest.getName());
taskBundleFactory.setPatient(taskPrepareInfoHolder.getPatient());
taskBundleFactory.setPriority(makeContactTaskRequest.getPriority());
taskBundleFactory.setOccurrence(makeContactTaskRequest.getOccurrence());
taskBundleFactory.setRequester(taskPrepareInfoHolder.getPerformer());
// TODO verify whether the passed Task instance is related to the Patient
taskBundleFactory.setReferralTask(taskPrepareInfoHolder.getReferralTask());
taskBundleFactory.setComment(makeContactTaskRequest.getComment());
taskBundleFactory.setUser(user);
// TODO verify whether the passed HealthcareService instance is related to the task
taskBundleFactory.setContactInfo(taskPrepareInfoHolder.getHealthcareService());
return taskBundleFactory;
}
Aggregations