From 34137ef49b2e2f7dadfec7dc2f0c53481ca0f193 Mon Sep 17 00:00:00 2001 From: Sulochan Khadka <122200551+Sulochan-khadka@users.noreply.github.com> Date: Fri, 14 Jun 2024 18:28:04 +0530 Subject: [PATCH 01/11] Issues/7971/aspect ratio of bed icon (#8017) * fixes: Linked skills- to show on patient dashboard for "treating doctor" #7810 * Update src/Components/Patient/PatientInfoCard.tsx Co-authored-by: Rithvik Nishad * updated with implementing suggestions * made changes * refactor based on suggestions * show tooltip only if overflow * Update src/Components/Patient/PatientInfoCard.tsx * fixes:Maintain aspect ratio for Bed Icon in Patient Dashboard #7971 --- src/Components/Patient/PatientInfoCard.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index f9adacc0d3c..a43d49a26ac 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -140,7 +140,6 @@ export default function PatientInfoCard(props: { }, prefetch: !!consultation?.treating_physician_object?.username, }); - const { data: consentRecords, loading: consentRecordsLoading } = useQuery( routes.listConsents, { @@ -219,7 +218,7 @@ export default function PatientInfoCard(props: {
{consultation?.current_bed && consultation?.discharge_date === null ? ( From d76e13c72c2c64d3bff47a6790b3184b6f89b625 Mon Sep 17 00:00:00 2001 From: Ashutosh Rai <85889617+Ashutosh0602@users.noreply.github.com> Date: Fri, 14 Jun 2024 18:29:49 +0530 Subject: [PATCH 02/11] fixed zooming problem (#8001) --- src/Components/Common/FilePreviewDialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Common/FilePreviewDialog.tsx b/src/Components/Common/FilePreviewDialog.tsx index b4443d330ea..3f55621e8c7 100644 --- a/src/Components/Common/FilePreviewDialog.tsx +++ b/src/Components/Common/FilePreviewDialog.tsx @@ -130,7 +130,7 @@ const FilePreviewDialog = (props: FilePreviewProps) => { file From b857722b4d9f874c57b7f055540316133455987e Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 14 Jun 2024 18:30:55 +0530 Subject: [PATCH 03/11] Show IP/OP number in patients list page (#7990) * Show IP/OP number in patients list page * update ui * fix text for OP Number --- .../Facility/DischargedPatientsList.tsx | 8 ++++ src/Components/Patient/ManagePatients.tsx | 46 ++++++++++++------- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/Components/Facility/DischargedPatientsList.tsx b/src/Components/Facility/DischargedPatientsList.tsx index 098be9141c2..6878613d4cd 100644 --- a/src/Components/Facility/DischargedPatientsList.tsx +++ b/src/Components/Facility/DischargedPatientsList.tsx @@ -453,6 +453,14 @@ const PatientListItem = ({ patient }: { patient: PatientModel }) => { {GENDER_TYPES.find((g) => g.id === patient.gender)?.text} -{" "} {formatPatientAge(patient)} + {patient.last_consultation?.patient_no && ( + + {patient.last_consultation?.suggestion === "A" + ? "IP No: " + : "OP No: "} + {patient.last_consultation?.patient_no} + + )}
{ )}
+ {!patient.last_consultation || + patient.last_consultation?.facility !== patient.facility || + (patient.last_consultation?.discharge_date && + patient.is_active) ? ( + + + + + + + + ) : ( + <> + {patient.last_consultation?.patient_no && ( + + )} + + )} {patient.review_time && !patient.last_consultation?.discharge_date && Number(patient.last_consultation?.review_interval) > 0 && @@ -605,23 +634,6 @@ export const PatientManager = () => { text="Medical Worker" /> )} - {(!patient.last_consultation || - patient.last_consultation?.facility !== patient.facility || - (patient.last_consultation?.discharge_date && - patient.is_active)) && ( - - - - - - - - )} {!( patient.last_consultation?.facility !== patient.facility ) && From c4b1fd0efee043a2017d87570bb176cc2376dbbc Mon Sep 17 00:00:00 2001 From: Ashraf Mohammed <98876115+AshrafMd-1@users.noreply.github.com> Date: Fri, 14 Jun 2024 18:31:47 +0530 Subject: [PATCH 04/11] Fix error message when session expires (#7957) * fix session notification * change notification script * revert notification * Update src/Utils/request/handleResponse.ts Co-authored-by: Rithvik Nishad --------- Co-authored-by: Rithvik Nishad --- src/Utils/request/handleResponse.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Utils/request/handleResponse.ts b/src/Utils/request/handleResponse.ts index 46e24f988e9..9f85b50a68d 100644 --- a/src/Utils/request/handleResponse.ts +++ b/src/Utils/request/handleResponse.ts @@ -25,6 +25,12 @@ export default function handleResponse( navigate(`/session-expired?redirect=${window.location.href}`); } + // Handle session expiry + if (error?.detail === "Authentication credentials were not provided.") { + notify?.Error({ msg: "Session expired. Please Login again." }); + return; + } + notify?.Error({ msg: error?.detail || "Something went wrong...!" }); return; } From 160eaa73f774f0be687ca0e8b566c39bd9e99fd6 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 14 Jun 2024 18:33:02 +0530 Subject: [PATCH 05/11] Show confirmation for preset update (#8013) --- .../ConsultationFeedTab.tsx | 189 ++++++++++-------- 1 file changed, 102 insertions(+), 87 deletions(-) diff --git a/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx index 91cd86c606e..ad966d58a6d 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx @@ -17,6 +17,7 @@ import useOperateCamera, { } from "../../CameraFeed/useOperateCamera"; import request from "../../../Utils/request/request"; import { classNames, isIOS } from "../../../Utils/utils"; +import ConfirmDialog from "../../Common/ConfirmDialog"; export const ConsultationFeedTab = (props: ConsultationTabProps) => { const authUser = useAuthUser(); @@ -25,6 +26,8 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => { const [asset, setAsset] = useState(); const [preset, setPreset] = useState(); + const [showPresetSaveConfirmation, setShowPresetSaveConfirmation] = + useState(false); const [isUpdatingPreset, setIsUpdatingPreset] = useState(false); const [hasMoved, setHasMoved] = useState(false); const [key, setKey] = useState(0); @@ -77,6 +80,7 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => { setPreset(updated); setHasMoved(false); setIsUpdatingPreset(false); + setShowPresetSaveConfirmation(false); }; useEffect(() => { @@ -94,97 +98,108 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => { } return ( -
- + setShowPresetSaveConfirmation(false)} + onConfirm={handleUpdatePreset} /> - - - For better experience, rotate your device. - -
- setHasMoved(true)} - onReset={() => { - if (isIOS) { - setKey(key + 1); - } - }} - onStreamError={() => { - triggerGoal("Camera Feed Viewed", { - consultationId: props.consultationId, - userId: authUser.id, - result: "error", - }); - }} - onStreamSuccess={() => { - triggerGoal("Camera Feed Viewed", { - consultationId: props.consultationId, - userId: authUser.id, - result: "success", - }); - }} - > -
- {presets ? ( - <> - obj.meta.preset_name} - value={preset} - onChange={(value) => { - triggerGoal("Camera Preset Clicked", { - presetName: preset?.meta?.preset_name, - consultationId: props.consultationId, - userId: authUser.id, - result: "success", - }); - setHasMoved(false); - setPreset(value); - }} - /> - {isUpdatingPreset ? ( - + + + + For better experience, rotate your device. + +
+ setHasMoved(true)} + onReset={() => { + if (isIOS) { + setKey(key + 1); + } + }} + onStreamError={() => { + triggerGoal("Camera Feed Viewed", { + consultationId: props.consultationId, + userId: authUser.id, + result: "error", + }); + }} + onStreamSuccess={() => { + triggerGoal("Camera Feed Viewed", { + consultationId: props.consultationId, + userId: authUser.id, + result: "success", + }); + }} + > +
+ {presets ? ( + <> + obj.meta.preset_name} + value={preset} + onChange={(value) => { + triggerGoal("Camera Preset Clicked", { + presetName: preset?.meta?.preset_name, + consultationId: props.consultationId, + userId: authUser.id, + result: "success", + }); + setHasMoved(false); + setPreset(value); + }} /> - ) : ( - + {isUpdatingPreset ? ( - - )} - - ) : ( - loading presets... - )} -
-
+ ) : ( + setShowPresetSaveConfirmation(true)} + > + + + )} + + ) : ( + loading presets... + )} +
+ +
-
+ ); }; From bad85246466890e208417bfdc6584b136420f28f Mon Sep 17 00:00:00 2001 From: Shivank Kacker Date: Tue, 18 Jun 2024 20:11:25 +0530 Subject: [PATCH 06/11] Changed Doctors Log to progress notes (#8039) * Changed Doctors Log to progress notes * Update src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx --------- Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- .../Consultations/DailyRounds/LogUpdateCardAttribute.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx b/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx index 4e5b7408266..5d407a09fea 100644 --- a/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx +++ b/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx @@ -69,7 +69,9 @@ const LogUpdateCardAttribute = ({ {(attributeValue as string) === "VENTILATOR" ? "CRITICAL CARE" - : (attributeValue as string)} + : (attributeValue as string) === "DOCTORS_LOG" + ? "PROGRESS NOTE" + : (attributeValue as string)}
); From 6e7679e24322056ab56339dedbb9a4afba79d9aa Mon Sep 17 00:00:00 2001 From: Shivank Kacker Date: Tue, 18 Jun 2024 21:43:46 +0530 Subject: [PATCH 07/11] Fixes pagination for shifting board (#8041) * fix pagination * minor change --- src/Components/Shifting/ShiftingBoard.tsx | 71 +++++++++-------------- 1 file changed, 26 insertions(+), 45 deletions(-) diff --git a/src/Components/Shifting/ShiftingBoard.tsx b/src/Components/Shifting/ShiftingBoard.tsx index 3203b5027f5..84a4ac419d3 100644 --- a/src/Components/Shifting/ShiftingBoard.tsx +++ b/src/Components/Shifting/ShiftingBoard.tsx @@ -39,17 +39,6 @@ interface boardProps { containerHeight: number; } -const reduceLoading = (action: string, current: any) => { - switch (action) { - case "MORE": - return { ...current, more: true }; - case "BOARD": - return { ...current, board: true }; - case "COMPLETE": - return { board: false, more: false }; - } -}; - const ShiftCard = ({ shift, filter }: any) => { const { wartime_shifting } = useConfig(); const [modalFor, setModalFor] = useState({ @@ -268,7 +257,8 @@ export default function ShiftingBoard({ }: boardProps) { const containerRef = useRef(null); const [offset, setOffSet] = useState(0); - const [isLoading, setIsLoading] = useState({ board: "BOARD", more: false }); + const [pages, setPages] = useState[]>([]); + const [isLoading, setIsLoading] = useState(true); const [{ isOver }, drop] = useDrop(() => ({ accept: "shift-card", drop: (item: any) => { @@ -278,23 +268,24 @@ export default function ShiftingBoard({ }, collect: (monitor) => ({ isOver: !!monitor.isOver() }), })); - const [data, setData] = useState>(); - useQuery(routes.listShiftRequests, { + const query = useQuery(routes.listShiftRequests, { query: formatFilter({ ...filterProp, status: board, }), onResponse: ({ res, data: listShiftData }) => { + setIsLoading(false); if (res?.ok && listShiftData) { - setData(listShiftData); + setPages((prev) => [...prev, listShiftData]); } - setIsLoading((loading) => reduceLoading("COMPLETE", loading)); }, }); useEffect(() => { - setIsLoading((loading) => reduceLoading("BOARD", loading)); + setPages([]); + setIsLoading(true); + query.refetch(); }, [ filterProp.facility, filterProp.origin_facility, @@ -316,7 +307,7 @@ export default function ShiftingBoard({ ]); const handlePagination = async () => { - setIsLoading((loading) => reduceLoading("MORE", loading)); + setIsLoading(true); setOffSet(offset + 14); const { res, data: newPageData } = await request(routes.listShiftRequests, { query: formatFilter({ @@ -326,18 +317,15 @@ export default function ShiftingBoard({ }), }); if (res?.ok && newPageData) { - setData((prev) => - prev - ? { ...prev, results: [...prev.results, ...newPageData.results] } - : newPageData, - ); + setPages((prev) => [...prev, newPageData]); } - setIsLoading((loading) => reduceLoading("COMPLETE", loading)); + setIsLoading(false); }; const { t } = useTranslation(); const patientFilter = (filter: string) => { - return data?.results + return pages + .flatMap((p) => p.results) .filter(({ status }) => status === filter) .map((shift: any) => ( @@ -350,7 +338,7 @@ export default function ShiftingBoard({ const { height } = container.getBoundingClientRect(); containerHeight < height && setContainerHeight(height); } - }, [containerRef.current, data?.results.length]); + }, [containerRef.current, pages.flatMap((p) => p.results).length]); return (
- {data?.count || "0"} + {pages[0] ? pages[0].count : "..."}
- {isLoading.board ? ( + {pages[0]?.count > 0 + ? patientFilter(board) + : !isLoading && ( +

{t("no_patients_to_show")}

+ )} + {isLoading ? (
@@ -395,25 +388,13 @@ export default function ShiftingBoard({
- ) : data?.count ?? 0 > 0 ? ( - patientFilter(board) ) : ( -

{t("no_patients_to_show")}

+ pages.at(-1)?.next && ( + handlePagination()} className="m-2 block"> + Load More + + ) )} - {!isLoading.board && - (data?.count ?? 0) < (data?.results.length || 0) && - (isLoading.more ? ( -
- {t("loading")} -
- ) : ( - - ))}
); From f2a192b34cee4733a8eec4cb8d7836de1085b8d7 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:20:14 +0530 Subject: [PATCH 08/11] New Cypress Test | Bulk Administration of Medicine | Prescription Module (#7978) * bulk administration partial * fix flaky interception --- .../patient_spec/patient_prescription.cy.ts | 49 ++++++++++++++++--- .../pageobject/Patient/PatientPrescription.ts | 29 ++++++++--- .../Medicine/MedicineAdministration.tsx | 6 ++- .../BulkAdminister.tsx | 1 + 4 files changed, 70 insertions(+), 15 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_prescription.cy.ts b/cypress/e2e/patient_spec/patient_prescription.cy.ts index d9a7bf7a080..6bb3fc82f37 100644 --- a/cypress/e2e/patient_spec/patient_prescription.cy.ts +++ b/cypress/e2e/patient_spec/patient_prescription.cy.ts @@ -1,3 +1,4 @@ +import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress"; import PatientPrescription from "../../pageobject/Patient/PatientPrescription"; import LoginPage from "../../pageobject/Login/LoginPage"; import { PatientPage } from "../../pageobject/Patient/PatientCreation"; @@ -5,11 +6,13 @@ import { PatientPage } from "../../pageobject/Patient/PatientCreation"; const patientPrescription = new PatientPrescription(); const loginPage = new LoginPage(); const patientPage = new PatientPage(); -const medicineName = "DOLO"; +const medicineNameOne = "DOLO"; +const medicineNameTwo = "FDEP PLUS"; const medicineBaseDosage = "4"; const medicineTargetDosage = "9"; const medicineFrequency = "Twice daily"; const medicineAdministerNote = "Medicine Administration Note"; +const medicineIndicator = "Test Indicator"; describe("Patient Medicine Administration", () => { before(() => { @@ -23,6 +26,40 @@ describe("Patient Medicine Administration", () => { cy.awaitUrl("/patients"); }); + it("Add a PRN Prescription medicine | Group Administrate it |", () => { + patientPage.visitPatient("Dummy Patient 6"); + patientPrescription.visitMedicineTab(); + patientPrescription.visitEditPrescription(); + // Add First Medicine + patientPrescription.clickAddPrnPrescriptionButton(); + patientPrescription.interceptMedibase(); + patientPrescription.selectMedicinebox(); + patientPrescription.selectMedicine(medicineNameOne); + patientPrescription.enterDosage(medicineBaseDosage); + patientPrescription.enterIndicator(medicineIndicator); + cy.submitButton("Submit"); + cy.verifyNotification("Medicine prescribed"); + cy.closeNotification(); + // Add Second Medicine + patientPrescription.clickAddPrnPrescriptionButton(); + patientPrescription.interceptMedibase(); + patientPrescription.selectMedicinebox(); + patientPrescription.selectMedicine(medicineNameTwo); + patientPrescription.enterDosage(medicineBaseDosage); + patientPrescription.enterIndicator(medicineIndicator); + cy.submitButton("Submit"); + cy.verifyNotification("Medicine prescribed"); + cy.closeNotification(); + patientPrescription.clickReturnToDashboard(); + // Group Administer the PRN Medicine + patientPrescription.visitMedicineTab(); + patientPrescription.clickAdministerBulkMedicine(); + patientPrescription.clickAllVisibleAdministration(); + patientPrescription.clickAdministerSelectedMedicine(); + cy.verifyNotification("Medicine(s) administered"); + cy.closeNotification(); + }); + it("Add a new titrated medicine for a patient | Individual Administeration |", () => { patientPage.visitPatient("Dummy Patient 5"); patientPrescription.visitMedicineTab(); @@ -30,7 +67,7 @@ describe("Patient Medicine Administration", () => { patientPrescription.clickAddPrescription(); patientPrescription.interceptMedibase(); patientPrescription.selectMedicinebox(); - patientPrescription.selectMedicine(medicineName); + patientPrescription.selectMedicine(medicineNameOne); patientPrescription.clickTitratedDosage(); patientPrescription.enterDosage(medicineBaseDosage); patientPrescription.enterTargetDosage(medicineTargetDosage); @@ -47,14 +84,14 @@ describe("Patient Medicine Administration", () => { cy.closeNotification(); // Verify the Reflection on the Medicine cy.verifyContentPresence("#medicine-preview", [ - medicineName, + medicineNameOne, medicineBaseDosage, medicineTargetDosage, ]); patientPrescription.clickReturnToDashboard(); // Go to medicine tab and administer it again patientPrescription.visitMedicineTab(); - cy.verifyAndClickElement("#0", medicineName); + cy.verifyAndClickElement("#0", medicineNameOne); cy.submitButton("Administer"); patientPrescription.enterAdministerDosage(medicineBaseDosage); cy.submitButton("Administer Medicine"); @@ -68,7 +105,7 @@ describe("Patient Medicine Administration", () => { patientPrescription.clickAddPrescription(); patientPrescription.interceptMedibase(); patientPrescription.selectMedicinebox(); - patientPrescription.selectMedicine(medicineName); + patientPrescription.selectMedicine(medicineNameOne); patientPrescription.enterDosage(medicineBaseDosage); patientPrescription.selectDosageFrequency(medicineFrequency); cy.submitButton("Submit"); @@ -78,7 +115,7 @@ describe("Patient Medicine Administration", () => { patientPrescription.clickAddPrescription(); patientPrescription.interceptMedibase(); patientPrescription.selectMedicinebox(); - patientPrescription.selectMedicine(medicineName); + patientPrescription.selectMedicine(medicineNameOne); patientPrescription.enterDosage(medicineBaseDosage); patientPrescription.selectDosageFrequency(medicineFrequency); cy.submitButton("Submit"); diff --git a/cypress/pageobject/Patient/PatientPrescription.ts b/cypress/pageobject/Patient/PatientPrescription.ts index a4b92b0a5fa..50f072f1d9b 100644 --- a/cypress/pageobject/Patient/PatientPrescription.ts +++ b/cypress/pageobject/Patient/PatientPrescription.ts @@ -1,3 +1,4 @@ +import { cy } from "local-cypress"; export class PatientPrescription { clickAddPrescription() { cy.get("#add-prescription").scrollIntoView(); @@ -7,6 +8,10 @@ export class PatientPrescription { ); } + clickAddPrnPrescriptionButton() { + cy.contains("button", "Add PRN Prescription").click(); + } + interceptMedibase() { cy.intercept("GET", "**/api/v1/medibase/**").as("getMedibase"); } @@ -27,6 +32,15 @@ export class PatientPrescription { cy.verifyAndClickElement("#administer-medicine", "Administer"); } + clickAdministerBulkMedicine() { + cy.get("#bulk-administer").should("be.visible"); + cy.get("#bulk-administer").click(); + } + + clickAllVisibleAdministration() { + cy.get("#should_administer").should("be.visible").click(); + } + selectMedicinebox() { cy.get( "div#medicine_object input[placeholder='Select'][role='combobox']", @@ -41,6 +55,10 @@ export class PatientPrescription { cy.get("#base_dosage").type(doseAmount, { force: true }); } + enterIndicator(indicator: string) { + cy.get("#indicator").type(indicator); + } + enterAdministerDosage(dosage: string) { cy.get("#dosage").type(dosage); } @@ -64,14 +82,9 @@ export class PatientPrescription { ); } - discontinuePreviousPrescription() { - cy.intercept( - "POST", - "**/api/v1/consultation/*/prescriptions/*/discontinue/", - ).as("deletePrescription"); - cy.get("button").contains("Discontinue").click(); - cy.get("#submit").contains("Discontinue").click(); - cy.wait("@deletePrescription").its("response.statusCode").should("eq", 200); + clickAdministerSelectedMedicine() { + cy.get("#administer-selected-medicine").should("be.visible"); + cy.get("#administer-selected-medicine").click(); } visitMedicineTab() { diff --git a/src/Components/Medicine/MedicineAdministration.tsx b/src/Components/Medicine/MedicineAdministration.tsx index d495ed162bc..650f720caa0 100644 --- a/src/Components/Medicine/MedicineAdministration.tsx +++ b/src/Components/Medicine/MedicineAdministration.tsx @@ -223,7 +223,11 @@ export default function MedicineAdministration(props: Props) { ))}
- + {t("administer_selected_medicines")}{" "} {selectedCount > 0 && `(${selectedCount})`} diff --git a/src/Components/Medicine/MedicineAdministrationSheet/BulkAdminister.tsx b/src/Components/Medicine/MedicineAdministrationSheet/BulkAdminister.tsx index abd609871c8..f4111f24eb0 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/BulkAdminister.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/BulkAdminister.tsx @@ -18,6 +18,7 @@ export default function BulkAdminister({ prescriptions, onDone }: Props) { return ( <> setShowBulkAdminister(true)} From 715bd4ad870f6358c515772fbd9f69e99f97c06c Mon Sep 17 00:00:00 2001 From: Shivank Kacker Date: Wed, 19 Jun 2024 19:48:40 +0530 Subject: [PATCH 09/11] Show notifications on prescription edit / failure (#8049) --- src/Components/Form/Form.tsx | 1 - src/Components/Medicine/EditPrescriptionForm.tsx | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Components/Form/Form.tsx b/src/Components/Form/Form.tsx index 6d6a4cbed0e..fccc579286c 100644 --- a/src/Components/Form/Form.tsx +++ b/src/Components/Form/Form.tsx @@ -49,7 +49,6 @@ const Form = ({ if (validate) { const errors = omitBy(validate(state.form), isEmpty) as FormErrors; - if (Object.keys(errors).length) { dispatch({ type: "set_errors", errors }); diff --git a/src/Components/Medicine/EditPrescriptionForm.tsx b/src/Components/Medicine/EditPrescriptionForm.tsx index 1af7a1a0356..78af7f38526 100644 --- a/src/Components/Medicine/EditPrescriptionForm.tsx +++ b/src/Components/Medicine/EditPrescriptionForm.tsx @@ -77,6 +77,9 @@ export default function EditPrescriptionForm(props: Props) { if (success) { props.onDone(true); + Notification.Success({ msg: "Prescription edited successfully" }); + } else { + Notification.Error({ msg: "Failed to edit prescription" }); } }} noPadding From 5a77383b87bd117d7b2a85966bdcd348ffa02d7d Mon Sep 17 00:00:00 2001 From: Shivank Kacker Date: Wed, 19 Jun 2024 23:16:06 +0530 Subject: [PATCH 10/11] Fixed Log Update Details Page Crashing (#8056) * Fixed Log Update Details Page Crashing * fixed buttons * redirect fix * minor fix * fix submit * inverted if * fixed filter * fix notification * filter fix --- .../Others/DailyRound__General.res | 29 ++++++++++++------- .../types/CriticalCare__Others.res | 14 ++++----- .../Consultations/DailyRoundsFilter.tsx | 4 ++- .../Consultations/DailyRoundsList.tsx | 8 +++-- src/Components/Patient/DailyRounds.tsx | 10 +++++-- 5 files changed, 41 insertions(+), 24 deletions(-) diff --git a/src/Components/CriticalCareRecording/Others/DailyRound__General.res b/src/Components/CriticalCareRecording/Others/DailyRound__General.res index 18caeb0e597..22c5051083e 100644 --- a/src/Components/CriticalCareRecording/Others/DailyRound__General.res +++ b/src/Components/CriticalCareRecording/Others/DailyRound__General.res @@ -30,19 +30,28 @@ let symptoms = [ "CONSTIPATION", "HEAD ACHE", "BLEEDING", - "DIZZINESS" -]; + "DIZZINESS", +] @react.component let make = (~others, ~renderOptionalDescription, ~title) => { -
{title("Symptoms")}
{Js.Array.map(id => { -
- {str(symptoms[id - 1])} -
- }, Others.additional_symptoms( - others, - ))->React.array}
{renderOptionalDescription( + let additionalSymptoms = Others.additional_symptoms(others) +
+ {title("Symptoms")} +
+ {switch additionalSymptoms { + | Some(symptomsArray) => Js.Array.map(id => { +
+ {str(symptoms[id - 1])} +
+ }, symptomsArray)->React.array + | None => React.null + }} +
+ {renderOptionalDescription( "Physical Examination Info", Others.physical_examination_info(others), - )} {renderOptionalDescription("Other Details", Others.other_details(others))}
+ )} + {renderOptionalDescription("Other Details", Others.other_details(others))} +
} diff --git a/src/Components/CriticalCareRecording/types/CriticalCare__Others.res b/src/Components/CriticalCareRecording/types/CriticalCare__Others.res index 93cf8508872..21b9513eb8d 100644 --- a/src/Components/CriticalCareRecording/types/CriticalCare__Others.res +++ b/src/Components/CriticalCareRecording/types/CriticalCare__Others.res @@ -2,7 +2,7 @@ type t = { bilateral_air_entry: option, etco2: option, physical_examination_info: option, - additional_symptoms: array, + additional_symptoms: option>, other_details: option, other_symptoms: option, } @@ -21,12 +21,12 @@ let make = ( ~other_symptoms, ~other_details, ) => { - bilateral_air_entry: bilateral_air_entry, - etco2: etco2, - physical_examination_info: physical_examination_info, - other_details: other_details, - additional_symptoms: additional_symptoms, - other_symptoms: other_symptoms, + bilateral_air_entry, + etco2, + physical_examination_info, + other_details, + additional_symptoms, + other_symptoms, } let makeFromJs = dailyRound => { diff --git a/src/Components/Facility/Consultations/DailyRoundsFilter.tsx b/src/Components/Facility/Consultations/DailyRoundsFilter.tsx index 829c085a840..430154d6689 100644 --- a/src/Components/Facility/Consultations/DailyRoundsFilter.tsx +++ b/src/Components/Facility/Consultations/DailyRoundsFilter.tsx @@ -73,7 +73,9 @@ export default function DailyRoundsFilter(props: Props) { label={t("Round Type")} options={DailyRoundTypes} placeholder={t("show_all")} - optionLabel={(o) => t(o)} + optionLabel={(o) => + o === "DOCTORS_LOG" ? "Progress Note" : t(o) + } optionValue={(o) => o} /> { review_interval: Number(prevReviewInterval), }; - if (["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type)) { + if (!["VENTILATOR"].includes(state.form.rounds_type)) { data = { ...data, bp: state.form.bp ?? {}, @@ -342,9 +342,13 @@ export const DailyRounds = (props: any) => { if (obj) { dispatch({ type: "set_form", form: initForm }); Notification.Success({ - msg: `${obj.rounds_type === "VENTILATOR" ? "Critical Care" : capitalize(obj.rounds_type)} log update details updated successfully`, + msg: `${obj.rounds_type === "DOCTORS_LOG" ? "Progress Notes" : (obj.rounds_type === "VENTILATOR" ? "Critical Care" : capitalize(obj.rounds_type)) + " log update"} details updated successfully`, }); - if (["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type)) { + if ( + ["NORMAL", "TELEMEDICINE", "DOCTORS_LOG"].includes( + state.form.rounds_type, + ) + ) { navigate( `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`, ); From c8a579a100192b4a2124af406c6f14462da6968a Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Thu, 20 Jun 2024 15:39:16 +0530 Subject: [PATCH 11/11] added test for edit and discontinue medicines (#8068) --- .../patient_spec/patient_prescription.cy.ts | 37 +++++++++++++++++++ .../pageobject/Patient/PatientPrescription.ts | 7 ++++ cypress/support/commands.ts | 1 + .../MedicineAdministrationSheet/index.tsx | 1 + 4 files changed, 46 insertions(+) diff --git a/cypress/e2e/patient_spec/patient_prescription.cy.ts b/cypress/e2e/patient_spec/patient_prescription.cy.ts index 6bb3fc82f37..c7a7cd9aba4 100644 --- a/cypress/e2e/patient_spec/patient_prescription.cy.ts +++ b/cypress/e2e/patient_spec/patient_prescription.cy.ts @@ -26,6 +26,43 @@ describe("Patient Medicine Administration", () => { cy.awaitUrl("/patients"); }); + it("Add a new medicine | Verify the Edit and Discontinue Medicine workflow |", () => { + patientPage.visitPatient("Dummy Patient 9"); + patientPrescription.visitMedicineTab(); + patientPrescription.visitEditPrescription(); + // Add a normal Medicine to the patient + patientPrescription.clickAddPrescription(); + patientPrescription.interceptMedibase(); + patientPrescription.selectMedicinebox(); + patientPrescription.selectMedicine(medicineNameOne); + patientPrescription.enterDosage(medicineBaseDosage); + patientPrescription.selectDosageFrequency(medicineFrequency); + cy.submitButton("Submit"); + cy.verifyNotification("Medicine prescribed"); + cy.closeNotification(); + // Edit the existing medicine & Verify they are properly moved to discontinue position + patientPrescription.clickReturnToDashboard(); + patientPrescription.visitMedicineTab(); + cy.verifyAndClickElement("#0", medicineNameOne); + cy.verifyContentPresence("#submit", ["Discontinue"]); // To verify the pop-up is open + cy.submitButton("Edit"); + patientPrescription.enterDosage(medicineTargetDosage); + cy.submitButton("Submit"); + cy.verifyNotification("Prescription edited successfully"); + cy.closeNotification(); + // Discontinue a medicine & Verify the notification + cy.verifyAndClickElement("#0", medicineNameOne); + cy.submitButton("Discontinue"); + patientPrescription.enterDiscontinueReason("Medicine is been discontinued"); + cy.submitButton("Discontinue"); + cy.verifyNotification("Prescription discontinued"); + cy.closeNotification(); + // verify the discontinue medicine view + cy.verifyContentPresence("#discontinued-medicine", [ + "discontinued prescription(s)", + ]); + }); + it("Add a PRN Prescription medicine | Group Administrate it |", () => { patientPage.visitPatient("Dummy Patient 6"); patientPrescription.visitMedicineTab(); diff --git a/cypress/pageobject/Patient/PatientPrescription.ts b/cypress/pageobject/Patient/PatientPrescription.ts index 50f072f1d9b..8e006465e08 100644 --- a/cypress/pageobject/Patient/PatientPrescription.ts +++ b/cypress/pageobject/Patient/PatientPrescription.ts @@ -52,6 +52,8 @@ export class PatientPrescription { } enterDosage(doseAmount: string) { + cy.get("#base_dosage").clear({ force: true }); + cy.get("#base_dosage").click({ force: true }); cy.get("#base_dosage").type(doseAmount, { force: true }); } @@ -59,6 +61,11 @@ export class PatientPrescription { cy.get("#indicator").type(indicator); } + enterDiscontinueReason(reason: string) { + cy.wait(2000); + cy.get("#discontinuedReason").type(reason); + } + enterAdministerDosage(dosage: string) { cy.get("#dosage").type(dosage); } diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index b710e310bfb..45a3cde3245 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -112,6 +112,7 @@ Cypress.Commands.add("clearAllFilters", () => { }); Cypress.Commands.add("submitButton", (buttonText = "Submit") => { + cy.get("button[type='submit']").contains(buttonText).scrollIntoView(); cy.get("button[type='submit']").contains(buttonText).click(); }); diff --git a/src/Components/Medicine/MedicineAdministrationSheet/index.tsx b/src/Components/Medicine/MedicineAdministrationSheet/index.tsx index 59d3976d763..29431fefdf9 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/index.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/index.tsx @@ -150,6 +150,7 @@ const MedicineAdministrationSheet = ({ readonly, is_prn }: Props) => { {!!discontinuedCount && (