Skip to main content

Prescription Management

Overview

Prescription management is a critical aspect of pharmacy practice, ensuring that patients receive the correct medications in a timely manner.

When a patient has an encounter with a physician, the physician will create a prescription for the patient. The prescription will be sent to the pharmacy for processing. The pharmacy will then dispense the medication to the patient.

Key Components of Prescription Management

  1. Listing Prescriptions: View all prescriptions assigned to the pharmacy.
  2. Dispensing Medications: Dispensing medication against a prescription for a patient.
  3. Requesting Alternative Medications: Requesting alternative medications if the prescribed medication is unavailable.
  4. Updating Prescription Status: Updating the status of a prescription (e.g., filled, pending, etc.) so that the physician can be notified and the patient information kept up to date.
info

All requests in this section require a valid pharmacy token. See Pharmacy Login for more information on how to obtain a token.

1. Listing Prescriptions

info

The user initiating the request must have the PHARMACIST role in order to view the prescriptions.

To list all prescriptions assigned to the pharmacy, you can use the following GraphQL query:

query listFacilityAssignedPrescriptions($facilityId: Int!, $searchTerm: String) {
listFacilityAssignedPrescriptions(facilityId: $facilityId, searchTerm: $searchTerm) {
edges {
node {
id
items {
id
name
}
visit{
id
healthFacility {
id
facilityName
}
patient{
id
}
}
}
}
}
}

Variables:

{
"facilityId": 1,
"searchTerm": "patient_name"
}

Response:

{
"data": {
"listFacilityAssignedPrescriptions": {
"edges": [
{
"node": {
"id": "prescription_id",
"items": [
{
"id": "item_id",
"name": "Medication Name"
}
],
"visit": {
"id": "visit_id",
"healthFacility": {
"id": "facility_id",
"facilityName": "Facility Name"
},
"patient": {
"id": "patient_id"
}
}
}
}
]
}
}
}

2. Dispensing Medications

A pharmacy can dispense medications against a prescription for a patient.

A prescription consists of one or more prescription items. Each prescription item can have one or more dispensed items.

The pharmacy can dispense one or more items against a prescription item. This allows the pharmacy to dispense partial quantities of a prescription item.

For pharmacies that have medication inventory management, dispensing a medication will automatically update the inventory.

2a. Dispensing a Prescription

To dispense medication against a prescription for a patient, you can use the following GraphQL mutation:

mutation dispensePrescription($input: DispensePrescriptionInput!) {
dispensePrescription(input: $input) {
result {
id
facilityId
pharmacyId
prescriptionId
attachments {
fileName
fileUrl
}
prescription {
id
prescriptionStatus
}
dispensedItems {
id
prescriptionItemId
facilityId
pharmacyId
formDispensed
quantityDispensed
name
cost
pharmacyDosage {
notes
quantity
quantityUnit
duration
durationUnit
route
frequency
}
dispenseStatus
healthFacilityDrug {
id
name
}
comments
dispensedByUserId
}
}
errors {
fields
message
code
shortMessage
vars
}
}
}

Input Variables:

{
"input": {
"prescriptionId": "prescription_id",
"facilityId": 1,
"dispensedItems": [
{
"prescriptionItemId": "prescription_item_id",
"formDispensed": "tablet",
"quantityDispensed": 1,
"healthFacilityDrugId": "drug_id",
"pharmacyDosage": {
"notes": "Take with food",
"quantity": 1,
"quantityUnit": "tablet",
"duration": 7,
"durationUnit": "days",
"route": "oral",
"frequency": "twice a day"
},
"comments": "Patient advised to take with food"
}
]
}
}

Response:

{
"data": {
"dispensePrescription": {
"result": {
"id": "dispense_id",
"facilityId": 1,
"pharmacyId": 1,
"prescriptionId": "prescription_id",
"attachments": [
{
"fileName": "attachment_name",
"fileUrl": "attachment_url"
}
],
"prescription": {
"id": "prescription_id",
"prescriptionStatus": "filled"
},
"dispensedItems": [
{
"id": "dispensed_item_id",
"prescriptionItemId": "prescription_item_id",
"facilityId": 1,
"pharmacyId": 1,
"formDispensed": "tablet",
"quantityDispensed": 1,
"name": "Medication Name",
"cost": 10.0,
"pharmacyDosage": {
"notes": "Take with food",
"quantity": 1,
"quantityUnit": "tablet",
"duration": 7,
"durationUnit": "days",
"route": "oral",
"frequency": "twice a day"
},
"dispenseStatus": "dispensed",
"healthFacilityDrug": {
"id": "drug_id",
"name": "Medication Name"
},
"comments": "Patient advised to take with food",
"dispensedByUserId": "user_id"
}
]
},
"errors": null
}
}
}

2b. Dispensing a Prescription with Attachments

If the pharmacy has the ability to upload attachments, you can include attachments in the dispense request. The graphql request will include the attachment file name. This means the file must have been uploaded to the server before the dispense request is made.

info

See Attachment Upload Documentation for more details on how to upload attachments.

Using the same graphql request as above, you can include the attachment file name in the request.

Variables:

{
"input": {
"prescriptionId": "prescription_id",
"facilityId": 1,
"dispensedItems": [
{
"prescriptionItemId": "prescription_item_id",
"formDispensed": "tablet",
"quantityDispensed": 1,
"healthFacilityDrugId": "drug_id",
"pharmacyDosage": {
"notes": "Take with food",
"quantity": 1,
"quantityUnit": "tablet",
"duration": 7,
"durationUnit": "days",
"route": "oral",
"frequency": "twice a day"
},
"comments": "Patient advised to take with food"
}
],
"attachmentFilenames": [
"attachment_name"
]
}
}

3. Requesting Alternative Medications

If the prescribed medication is unavailable, the pharmacy can request alternative medications. This will allow the doctor to update the prescription with the alternative medication.

Using the same graphql request as above, you can specify which items are unavailable and request alternatives.

Variables:

{
"input": {
"prescriptionId": 1,
"facilityId": 1,
"dispensedItems": [
{
"prescriptionItemId": 1,
"dispenseStatus": "ALTERNATE_REQUESTED",
"comments": "Alternative requested"
}
]
}
}