O3 Framework / fetchCurrentPatient
fetchCurrentPatient(
patientUuid,fetchInit?):Promise<null|Patient>
Defined in: packages/framework/esm-emr-api/src/current-patient.ts:38
Fetches a patient by their UUID from the FHIR API.
The UUID of the patient to fetch, or null.
Optional fetch configuration options to pass to the request.
Promise<null | Patient>
A Promise that resolves with the FHIR Patient object, or null if
the patient UUID is null.
Rethrows any error from the server request.
import { fetchCurrentPatient } from '@openmrs/esm-framework';
const patient = await fetchCurrentPatient('patient-uuid');
if (patient) {
console.log('Patient name:', patient.name?.[0]?.text);
}