From 518200d711904b017216457d0db39098f2e631d3 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Sun, 21 Apr 2024 20:21:46 +0530 Subject: [PATCH 1/4] Fixes discharge information showing incorrect label for base dosage --- src/Locale/en/Medicine.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Locale/en/Medicine.json b/src/Locale/en/Medicine.json index 95ddda7c1fd..36adc259514 100644 --- a/src/Locale/en/Medicine.json +++ b/src/Locale/en/Medicine.json @@ -2,6 +2,7 @@ "medicine": "Medicine", "route": "Route", "dosage": "Dosage", + "base_dosage": "Dosage", "start_dosage": "Start Dosage", "target_dosage": "Target Dosage", "instruction_on_titration": "Instruction on titration", @@ -58,4 +59,4 @@ "PRESCRIPTION_FREQUENCY_Q4H": "4th hourly", "PRESCRIPTION_FREQUENCY_QOD": "Alternate day", "PRESCRIPTION_FREQUENCY_QWK": "Once a week" -} +} \ No newline at end of file From a7be2efb7c64a6da71fcea2a1d75e79d9fa5ac4e Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Sun, 21 Apr 2024 20:22:33 +0530 Subject: [PATCH 2/4] disabled discontinue/administer/edit prescription operations for discharged consultations --- .../AdministrationTable.tsx | 3 + .../AdministrationTableRow.tsx | 246 +++++++++--------- .../MedicineAdministrationSheet/index.tsx | 1 + 3 files changed, 132 insertions(+), 118 deletions(-) diff --git a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTable.tsx b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTable.tsx index b983965237a..18d27bf1651 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTable.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTable.tsx @@ -10,9 +10,11 @@ interface Props { prescriptions: Prescription[]; pagination: ReturnType; onRefetch: () => void; + readonly: boolean; } export default function MedicineAdministrationTable({ + readonly, pagination, prescriptions, onRefetch, @@ -101,6 +103,7 @@ export default function MedicineAdministrationTable({ prescription={obj} intervals={pagination.slots!} refetch={onRefetch} + readonly={readonly} /> ))} diff --git a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx index 50b96c9cc0f..f913286c574 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationTableRow.tsx @@ -19,6 +19,7 @@ interface Props { prescription: Prescription; intervals: { start: Date; end: Date }[]; refetch: () => void; + readonly: boolean; } export default function MedicineAdministrationTableRow({ @@ -54,12 +55,7 @@ export default function MedicineAdministrationTableRow({ ); return ( - + <> {showDiscontinue && ( setShowDetails(false)} label={t("close")} /> - setShowDiscontinue(true)} - > - - {t("discontinue")} - - { - setShowDetails(false); - setShowEdit(true); - }} - > - - {t("edit")} - - setShowAdminister(true)} - > - - {t("administer")} - + {!props.readonly && ( + <> + setShowDiscontinue(true)} + > + + {t("discontinue")} + + { + setShowDetails(false); + setShowEdit(true); + }} + > + + {t("edit")} + + setShowAdminister(true)} + > + + {t("administer")} + + + )} @@ -166,93 +166,103 @@ export default function MedicineAdministrationTableRow({ /> )} - setShowDetails(true)} + -
-
- setShowDetails(true)} + > +
+
+ + {prescription.medicine_object?.name ?? + prescription.medicine_old} + + + {prescription.discontinued && ( + + {t("discontinued")} + )} - > - {prescription.medicine_object?.name ?? prescription.medicine_old} - - {prescription.discontinued && ( - - {t("discontinued")} - - )} + {prescription.route && ( + + {t(prescription.route)} + + )} +
- {prescription.route && ( - - {t(prescription.route)} - - )} -
+
+ {prescription.dosage_type !== "TITRATED" ? ( +

{prescription.base_dosage}

+ ) : ( +

+ {prescription.base_dosage} - {prescription.target_dosage} +

+ )} -
- {prescription.dosage_type !== "TITRATED" ? ( -

{prescription.base_dosage}

- ) : (

- {prescription.base_dosage} - {prescription.target_dosage} + {prescription.dosage_type !== "PRN" + ? t("PRESCRIPTION_FREQUENCY_" + prescription.frequency) + : prescription.indicator}

- )} - -

- {prescription.dosage_type !== "PRN" - ? t("PRESCRIPTION_FREQUENCY_" + prescription.frequency) - : prescription.indicator} -

+
-
- + - + - {/* Administration Cells */} - {props.intervals.map(({ start, end }, index) => ( - <> - - - + {/* Administration Cells */} + {props.intervals.map(({ start, end }, index) => ( + <> + + + - - {!data?.results ? ( - - ) : ( - - )} - - - ))} - + + {!data?.results ? ( + + ) : ( + + )} + + + ))} + - {/* Action Buttons */} - - setShowAdminister(true)} - > - {t("administer")} - - - + {/* Action Buttons */} + + {!props.readonly && ( + setShowAdminister(true)} + > + {t("administer")} + + )} + + + ); } diff --git a/src/Components/Medicine/MedicineAdministrationSheet/index.tsx b/src/Components/Medicine/MedicineAdministrationSheet/index.tsx index 41a681f26b0..4c054edcaf3 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/index.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/index.tsx @@ -140,6 +140,7 @@ const MedicineAdministrationSheet = ({ readonly, is_prn }: Props) => { refetch(); discontinuedPrescriptions.refetch(); }} + readonly={readonly || false} /> )} From 6fceb4241c1c632e61759e783ebcb490018a56b0 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Sun, 21 Apr 2024 20:25:33 +0530 Subject: [PATCH 3/4] disallow titrated prescription for discharge --- .../Medicine/CreatePrescriptionForm.tsx | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/Components/Medicine/CreatePrescriptionForm.tsx b/src/Components/Medicine/CreatePrescriptionForm.tsx index 07e8ec208d6..fcc9443eaa3 100644 --- a/src/Components/Medicine/CreatePrescriptionForm.tsx +++ b/src/Components/Medicine/CreatePrescriptionForm.tsx @@ -61,26 +61,27 @@ export default function CreatePrescriptionForm(props: { {...field("medicine_object", RequiredFieldValidator())} required /> - {props.prescription.dosage_type !== "PRN" && ( - { - if (e.value) { - field("dosage_type").onChange({ - name: "dosage_type", - value: "TITRATED", - }); - } else { - field("dosage_type").onChange({ - name: "dosage_type", - value: "REGULAR", - }); - } - }} - /> - )} + {props.prescription.dosage_type !== "PRN" && + props.prescription.prescription_type !== "DISCHARGE" && ( + { + if (e.value) { + field("dosage_type").onChange({ + name: "dosage_type", + value: "TITRATED", + }); + } else { + field("dosage_type").onChange({ + name: "dosage_type", + value: "REGULAR", + }); + } + }} + /> + )}
Date: Sun, 21 Apr 2024 21:08:40 +0530 Subject: [PATCH 4/4] fix archive not disabled --- .../MedicineAdministrationSheet/AdministrationEventCell.tsx | 3 +++ .../MedicineAdministrationSheet/AdministrationTableRow.tsx | 1 + src/Components/Medicine/PrescrpitionTimeline.tsx | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx index aaed004127b..b13e05b5b58 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx @@ -12,6 +12,7 @@ interface Props { interval: { start: Date; end: Date }; prescription: Prescription; refetch: () => void; + readonly?: boolean; } export default function AdministrationEventCell({ @@ -19,6 +20,7 @@ export default function AdministrationEventCell({ interval: { start, end }, prescription, refetch, + readonly, }: Props) { const [showTimeline, setShowTimeline] = useState(false); // Check if cell belongs to an administered prescription (including start and excluding end) @@ -56,6 +58,7 @@ export default function AdministrationEventCell({ prescription={prescription} showPrescriptionDetails onRefetch={refetch} + readonly={readonly} />