use of org.hl7.gravity.refimpl.sdohexchange.dto.converter.ConsentToDtoConverter in project Gravity-SDOH-Exchange-RI by FHIR.
the class ConsentService method listConsents.
public List<ConsentDto> listConsents() {
Bundle bundle = consentRepository.findAllByPatient(SmartOnFhirContext.get().getPatient());
List<Consent> consentResources = FhirUtil.getFromBundle(bundle, Consent.class);
return consentResources.stream().map(consent -> new ConsentToDtoConverter().convert(consent)).collect(Collectors.toList());
}
use of org.hl7.gravity.refimpl.sdohexchange.dto.converter.ConsentToDtoConverter 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