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);
}
Aggregations