Search in sources :

Example 1 with PatientFeedbackTaskPrepareBundleFactory

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

the class PatientTaskService method createFeedbackTaskBundleFactory.

private PatientTaskBundleFactory createFeedbackTaskBundleFactory(UserDto user, NewFeedbackTaskRequestDto feedbackTaskRequest) {
    PatientFeedbackTaskPrepareBundleFactory taskPrepareBundleFactory = new PatientFeedbackTaskPrepareBundleFactory(SmartOnFhirContext.get().getPatient(), user.getId(), feedbackTaskRequest.getReferralTaskId());
    Bundle taskRelatedResources = ehrClient.transaction().withBundle(taskPrepareBundleFactory.createPrepareBundle()).execute();
    PatientFeedbackTaskPrepareBundleExtractor.PatientFeedbackTaskPrepareInfoHolder taskPrepareInfoHolder = new PatientFeedbackTaskPrepareBundleExtractor().extract(taskRelatedResources);
    PatientFeedbackTaskBundleFactory taskBundleFactory = new PatientFeedbackTaskBundleFactory();
    taskBundleFactory.setName(feedbackTaskRequest.getName());
    taskBundleFactory.setPatient(taskPrepareInfoHolder.getPatient());
    taskBundleFactory.setPriority(feedbackTaskRequest.getPriority());
    taskBundleFactory.setOccurrence(feedbackTaskRequest.getOccurrence());
    taskBundleFactory.setRequester(taskPrepareInfoHolder.getPerformer());
    // TODO verify whether the passed Task instance is related to the Patient
    taskBundleFactory.setReferralTask(taskPrepareInfoHolder.getReferralTask());
    taskBundleFactory.setComment(feedbackTaskRequest.getComment());
    taskBundleFactory.setUser(user);
    return taskBundleFactory;
}
Also used : PatientFeedbackTaskBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientFeedbackTaskBundleFactory) PatientFeedbackTaskPrepareBundleExtractor(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.patienttask.PatientFeedbackTaskPrepareBundleExtractor) Bundle(org.hl7.fhir.r4.model.Bundle) PatientFeedbackTaskPrepareBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientFeedbackTaskPrepareBundleFactory)

Aggregations

Bundle (org.hl7.fhir.r4.model.Bundle)1 PatientFeedbackTaskPrepareBundleExtractor (org.hl7.gravity.refimpl.sdohexchange.fhir.extract.patienttask.PatientFeedbackTaskPrepareBundleExtractor)1 PatientFeedbackTaskBundleFactory (org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientFeedbackTaskBundleFactory)1 PatientFeedbackTaskPrepareBundleFactory (org.hl7.gravity.refimpl.sdohexchange.fhir.factory.patienttask.PatientFeedbackTaskPrepareBundleFactory)1