From 51d1339bfacac698a086a4b40de4ced7d6763bba Mon Sep 17 00:00:00 2001 From: Pranshu1902 Date: Mon, 29 Apr 2024 21:05:05 +0530 Subject: [PATCH] dont show mg twice and show discontinued --- .../Medicine/MedicinePrescriptionSummary.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Components/Medicine/MedicinePrescriptionSummary.tsx b/src/Components/Medicine/MedicinePrescriptionSummary.tsx index f0ed17c254d..e6827d4b7a8 100644 --- a/src/Components/Medicine/MedicinePrescriptionSummary.tsx +++ b/src/Components/Medicine/MedicinePrescriptionSummary.tsx @@ -126,7 +126,7 @@ export default function ConsultationMedicineLogs({ const getDetailsMessage = (prescription: Prescription) => { const message = `Details: ${ prescription.base_dosage != null - ? `Base Dosage: ${prescription.base_dosage} mg, ` + ? `Base Dosage: ${prescription.base_dosage}, ` : "" }${prescription.route != null ? `Route: ${prescription.route}, ` : ""}${ prescription.dosage_type != null @@ -134,7 +134,7 @@ export default function ConsultationMedicineLogs({ : "" }${ prescription.target_dosage != null - ? `Target Dosage: ${prescription.target_dosage} mg, ` + ? `Target Dosage: ${prescription.target_dosage}, ` : "" }${ prescription.instruction_on_titration != null @@ -150,13 +150,16 @@ export default function ConsultationMedicineLogs({ : "" }${ prescription.max_dosage != null - ? `Max Dosage: ${prescription.max_dosage} mg, ` + ? `Max Dosage: ${prescription.max_dosage}, ` : "" }${ prescription.min_hours_between_doses != null ? `Min Hours Between Doses: ${prescription.min_hours_between_doses}, ` : "" - }`.replace(/, $/, ""); + }${prescription.discontinued ? "Discontinued: Yes, " : ""}`.replace( + /, $/, + "", + ); return message; }; @@ -183,7 +186,7 @@ export default function ConsultationMedicineLogs({ // Check for changes in base dosage if (prevPrescription.base_dosage !== currentPrescription.base_dosage) { changesForPrescription.push( - `Base dosage changed to ${currentPrescription.base_dosage} mg from ${prevPrescription.base_dosage} mg`, + `Base dosage changed to ${currentPrescription.base_dosage} from ${prevPrescription.base_dosage}`, ); } @@ -278,6 +281,11 @@ export default function ConsultationMedicineLogs({ ); } + // Check if discontinued + if (currentPrescription.discontinued && !prevPrescription.discontinued) { + changesForPrescription.push("Prescription was discontinued"); + } + // If there are changes, add them to the changes array if (changesForPrescription.length > 0) { const message = `Changes: ${changesForPrescription.join(", ")}`;