use of org.hl7.gravity.refimpl.sdohexchange.fhir.factory.resource.CreateConsentFactory in project Gravity-SDOH-Exchange-RI by FHIR.
the class ConsentService method createConsent.
public ConsentDto createConsent(String name, MultipartFile attachment, UserDto userDto) {
Reference patient = FhirUtil.toReference(Patient.class, SmartOnFhirContext.get().getPatient());
Reference organization = retrieveOrganization(userDto);
Consent consent = new CreateConsentFactory(name, patient, attachment, organization).createConsent();
MethodOutcome methodOutcome = ehrClient.create().resource(consent).execute();
Consent savedConsent = (Consent) methodOutcome.getResource();
return new ConsentToDtoConverter().convert(savedConsent);
}
Aggregations