core.addpreferredpharmacytopatient
Home > @medplum/core > addPreferredPharmacyToPatient
addPreferredPharmacyToPatient() function
Adds or updates a preferred pharmacy extension on a Patient. If the pharmacy already exists, updates its type. Otherwise, adds a new extension. If isPrimary is true, other pharmacies are set to 'preferred'.
Signature:
export declare function addPreferredPharmacyToPatient(patient: Patient, orgRef: Reference<Organization>, isPrimary: boolean, preferenceTypeSystem?: string): Patient;
Parameters
Parameter | Type | Description |
|---|---|---|
patient | Patient | The Patient resource to modify (will be mutated). |
orgRef | Reference<Organization> | Reference to the Organization resource. |
isPrimary | boolean | Whether to set this as the primary pharmacy. |
preferenceTypeSystem | string | (Optional) Optional coding system URL for pharmacy preference type. Defaults to PHARMACY_PREFERENCE_TYPE_SYSTEM. |
Returns:
Patient
The modified Patient resource.