Search in sources :

Example 1 with BaseConsentDto

use of org.hl7.gravity.refimpl.sdohexchange.dto.response.BaseConsentDto in project Gravity-SDOH-Exchange-RI by FHIR.

the class ConsentService method listBaseConsentsInfo.

public List<BaseConsentDto> listBaseConsentsInfo() {
    Bundle bundle = consentRepository.findAllByPatient(SmartOnFhirContext.get().getPatient());
    List<Consent> consentResources = FhirUtil.getFromBundle(bundle, Consent.class);
    return consentResources.stream().map(consent -> new BaseConsentDto(consent.getIdElement().getIdPart(), consent.getSourceAttachment().getTitle())).collect(Collectors.toList());
}
Also used : BaseConsentDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.BaseConsentDto) RequiredArgsConstructor(lombok.RequiredArgsConstructor) Consent(org.hl7.fhir.r4.model.Consent) Autowired(org.springframework.beans.factory.annotation.Autowired) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) AttachmentDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.AttachmentDto) Reference(org.hl7.fhir.r4.model.Reference) Attachment(org.hl7.fhir.r4.model.Attachment) Service(org.springframework.stereotype.Service) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) Patient(org.hl7.fhir.r4.model.Patient) UserDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.UserDto) ConsentToDtoConverter(org.hl7.gravity.refimpl.sdohexchange.dto.converter.ConsentToDtoConverter) ConsentRepository(org.hl7.gravity.refimpl.sdohexchange.dao.impl.ConsentRepository) ConsentDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.ConsentDto) Collectors(java.util.stream.Collectors) PractitionerRole(org.hl7.fhir.r4.model.PractitionerRole) ConsentCreateException(org.hl7.gravity.refimpl.sdohexchange.exception.ConsentCreateException) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) ConsentPrepareBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.ConsentPrepareBundleFactory) CreateConsentFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.resource.CreateConsentFactory) SmartOnFhirContext(com.healthlx.smartonfhir.core.SmartOnFhirContext) MultipartFile(org.springframework.web.multipart.MultipartFile) Optional(java.util.Optional) Bundle(org.hl7.fhir.r4.model.Bundle) FhirUtil(org.hl7.gravity.refimpl.sdohexchange.util.FhirUtil) Consent(org.hl7.fhir.r4.model.Consent) Bundle(org.hl7.fhir.r4.model.Bundle) BaseConsentDto(org.hl7.gravity.refimpl.sdohexchange.dto.response.BaseConsentDto)

Aggregations

MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)1 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)1 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)1 SmartOnFhirContext (com.healthlx.smartonfhir.core.SmartOnFhirContext)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 Slf4j (lombok.extern.slf4j.Slf4j)1 Attachment (org.hl7.fhir.r4.model.Attachment)1 Bundle (org.hl7.fhir.r4.model.Bundle)1 Consent (org.hl7.fhir.r4.model.Consent)1 Patient (org.hl7.fhir.r4.model.Patient)1 PractitionerRole (org.hl7.fhir.r4.model.PractitionerRole)1 Reference (org.hl7.fhir.r4.model.Reference)1 ConsentRepository (org.hl7.gravity.refimpl.sdohexchange.dao.impl.ConsentRepository)1 ConsentToDtoConverter (org.hl7.gravity.refimpl.sdohexchange.dto.converter.ConsentToDtoConverter)1 AttachmentDto (org.hl7.gravity.refimpl.sdohexchange.dto.response.AttachmentDto)1 BaseConsentDto (org.hl7.gravity.refimpl.sdohexchange.dto.response.BaseConsentDto)1 ConsentDto (org.hl7.gravity.refimpl.sdohexchange.dto.response.ConsentDto)1