Search in sources :

Example 1 with PractitionerToDtoConverter

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

the class ContextService method getUser.

protected UserDto getUser() {
    IdType fhirUser = new IdType(SmartOnFhirContext.get().getFhirUser());
    Assert.isTrue(fhirUser.hasIdPart(), "Current User cannot be null.");
    // TODO support other user Resource types. For example another Patient can create Tasks.
    Assert.isTrue(Practitioner.class.getSimpleName().equals(fhirUser.getResourceType()), "Current user is not a Practitioner. Only Practitioner resource type is supported for now.");
    Practitioner practitioner = ehrClient.read().resource(Practitioner.class).withId(fhirUser.getIdPart()).execute();
    return new PractitionerToDtoConverter().convert(practitioner);
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) PractitionerToDtoConverter(org.hl7.gravity.refimpl.sdohexchange.dto.converter.PractitionerToDtoConverter) IdType(org.hl7.fhir.r4.model.IdType)

Aggregations

IdType (org.hl7.fhir.r4.model.IdType)1 Practitioner (org.hl7.fhir.r4.model.Practitioner)1 PractitionerToDtoConverter (org.hl7.gravity.refimpl.sdohexchange.dto.converter.PractitionerToDtoConverter)1