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 1/4] 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 6bb3fc82f3..c7a7cd9aba 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 50f072f1d9..8e006465e0 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 b710e310bf..45a3cde324 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 59d3976d76..29431fefdf 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 && ( Date: Thu, 20 Jun 2024 20:13:17 +0530 Subject: [PATCH 2/4] Update button text in bed modal (#8072) --- cypress/pageobject/Patient/PatientLogupdate.ts | 2 +- src/Components/Facility/Consultations/Beds.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/pageobject/Patient/PatientLogupdate.ts b/cypress/pageobject/Patient/PatientLogupdate.ts index 92ea02a141..bc141c0498 100644 --- a/cypress/pageobject/Patient/PatientLogupdate.ts +++ b/cypress/pageobject/Patient/PatientLogupdate.ts @@ -11,7 +11,7 @@ class PatientLogupdate { selectBed(bed: string) { cy.searchAndSelectOption("input[name='bed']", bed); - cy.submitButton("Move to bed"); + cy.submitButton("Update"); cy.wait(2000); } diff --git a/src/Components/Facility/Consultations/Beds.tsx b/src/Components/Facility/Consultations/Beds.tsx index f4363411ef..c86e32cc56 100644 --- a/src/Components/Facility/Consultations/Beds.tsx +++ b/src/Components/Facility/Consultations/Beds.tsx @@ -234,7 +234,7 @@ const Beds = (props: BedsProps) => {
- Move to bed + Update
From 1151903cd29711003848e6ff33b1f3d47d3b5e85 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Thu, 20 Jun 2024 20:14:09 +0530 Subject: [PATCH 3/4] added 4 additional review after choices (#8071) --- src/Common/constants.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 5c09b0fd20..35790e77b1 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -313,8 +313,12 @@ export const REVIEW_AT_CHOICES: Array = [ { id: 36 * 60, text: "36 hr" }, { id: 2 * 24 * 60, text: "2 days" }, { id: 3 * 24 * 60, text: "3 days" }, + { id: 5 * 24 * 60, text: "5 days" }, { id: 7 * 24 * 60, text: "7 days" }, + { id: 10 * 24 * 60, text: "10 days" }, { id: 14 * 24 * 60, text: "2 weeks" }, + { id: 21 * 24 * 60, text: "3 weeks" }, + { id: 25 * 24 * 60, text: "25 days" }, { id: 30 * 24 * 60, text: "1 month" }, ]; From a69c0b0a88dacdc4cd80c756a239bcba8805c1c4 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Thu, 20 Jun 2024 20:53:44 +0530 Subject: [PATCH 4/4] Cleanup daily round type text mapping (#8067) --- .../e2e/patient_spec/patient_logupdate.cy.ts | 12 +++---- .../Recording/CriticalCare__Recording.res | 2 +- .../DailyRounds/LogUpdateCardAttribute.tsx | 9 +++-- .../Consultations/DailyRoundsFilter.tsx | 4 +-- src/Components/Patient/DailyRounds.tsx | 34 ++++++++----------- src/Locale/en/Consultation.json | 5 +-- 6 files changed, 29 insertions(+), 37 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_logupdate.cy.ts b/cypress/e2e/patient_spec/patient_logupdate.cy.ts index 562e430a9a..cd7e30e157 100644 --- a/cypress/e2e/patient_spec/patient_logupdate.cy.ts +++ b/cypress/e2e/patient_spec/patient_logupdate.cy.ts @@ -59,7 +59,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-2").click(); cy.submitButton("Save"); - cy.verifyNotification("Tele-medicine log update created successfully"); + cy.verifyNotification("Telemedicine log created successfully"); }); it("Create a new log normal update for a domicilary care patient and edit it", () => { @@ -84,7 +84,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeRhythm(patientRhythm); cy.get("#consciousness_level-2").click(); cy.submitButton("Save"); - cy.verifyNotification("Normal log update created successfully"); + cy.verifyNotification("Brief Update log created successfully"); cy.closeNotification(); // edit the card and verify the data. cy.contains("Daily Rounds").click(); @@ -107,7 +107,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.clickClearButtonInElement("#diastolic"); patientLogupdate.typeDiastolic(patientModifiedDiastolic); cy.submitButton("Continue"); - cy.verifyNotification("Normal log update details updated successfully"); + cy.verifyNotification("Brief Update log updated successfully"); cy.contains("Daily Rounds").click(); patientLogupdate.clickLogupdateCard("#dailyround-entry", patientCategory); cy.verifyContentPresence("#consultation-preview", [ @@ -140,7 +140,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { cy.get("#consciousness_level-2").click(); cy.submitButton("Save"); cy.wait(2000); - cy.verifyNotification("Normal log update created successfully"); + cy.verifyNotification("Brief Update log created successfully"); // Verify the card content cy.get("#basic-information").scrollIntoView(); cy.verifyContentPresence("#encounter-symptoms", [additionalSymptoms]); @@ -163,7 +163,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeRespiratory(patientRespiratory); cy.get("#consciousness_level-2").click(); cy.submitButton("Save"); - cy.verifyNotification("Normal log update created successfully"); + cy.verifyNotification("Brief Update log created successfully"); cy.closeNotification(); cy.verifyContentPresence("#consultation-buttons", ["9"]); // Verify the Incomplete data will give blank info @@ -173,7 +173,7 @@ describe("Patient Log Update in Normal, Critical and TeleIcu", () => { patientLogupdate.typeDiastolic(patientDiastolic); patientLogupdate.typePulse(patientPulse); cy.submitButton("Save"); - cy.verifyNotification("Normal log update created successfully"); + cy.verifyNotification("Brief Update log created successfully"); cy.closeNotification(); cy.verifyContentPresence("#consultation-buttons", ["-"]); }); diff --git a/src/Components/CriticalCareRecording/Recording/CriticalCare__Recording.res b/src/Components/CriticalCareRecording/Recording/CriticalCare__Recording.res index e8bfb91e21..d919215071 100644 --- a/src/Components/CriticalCareRecording/Recording/CriticalCare__Recording.res +++ b/src/Components/CriticalCareRecording/Recording/CriticalCare__Recording.res @@ -240,7 +240,7 @@ let make = (~id, ~facilityId, ~patientId, ~consultationId, ~dailyRound) => { href={`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`}> diff --git a/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx b/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx index 5d407a09fe..e147b2ec3a 100644 --- a/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx +++ b/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx @@ -1,3 +1,4 @@ +import { useTranslation } from "react-i18next"; import PatientCategoryBadge from "../../../Common/PatientCategoryBadge"; import { BloodPressure, @@ -15,6 +16,8 @@ const LogUpdateCardAttribute = ({ attributeKey, attributeValue, }: Props) => { + const { t } = useTranslation(); + switch (attributeKey) { // case "id": // case "external_id": @@ -67,11 +70,7 @@ const LogUpdateCardAttribute = ({
- {(attributeValue as string) === "VENTILATOR" - ? "CRITICAL CARE" - : (attributeValue as string) === "DOCTORS_LOG" - ? "PROGRESS NOTE" - : (attributeValue as string)} + {t(attributeValue)}
); diff --git a/src/Components/Facility/Consultations/DailyRoundsFilter.tsx b/src/Components/Facility/Consultations/DailyRoundsFilter.tsx index 430154d668..829c085a84 100644 --- a/src/Components/Facility/Consultations/DailyRoundsFilter.tsx +++ b/src/Components/Facility/Consultations/DailyRoundsFilter.tsx @@ -73,9 +73,7 @@ export default function DailyRoundsFilter(props: Props) { label={t("Round Type")} options={DailyRoundTypes} placeholder={t("show_all")} - optionLabel={(o) => - o === "DOCTORS_LOG" ? "Progress Note" : t(o) - } + optionLabel={(o) => t(o)} optionValue={(o) => o} /> { if (obj) { dispatch({ type: "set_form", form: initForm }); Notification.Success({ - msg: `${obj.rounds_type === "DOCTORS_LOG" ? "Progress Notes" : (obj.rounds_type === "VENTILATOR" ? "Critical Care" : capitalize(obj.rounds_type)) + " log update"} details updated successfully`, + msg: `${t(obj.rounds_type as string)} log updated successfully`, }); if ( ["NORMAL", "TELEMEDICINE", "DOCTORS_LOG"].includes( @@ -366,24 +365,19 @@ export const DailyRounds = (props: any) => { setIsLoading(false); if (obj) { dispatch({ type: "set_form", form: initForm }); - if (["NORMAL", "TELEMEDICINE"].includes(state.form.rounds_type)) { - Notification.Success({ - msg: `${state.form.rounds_type === "NORMAL" ? "Normal" : "Tele-medicine"} log update created successfully`, - }); - navigate( - `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`, - ); - } else if (state.form.rounds_type === "DOCTORS_LOG") { - Notification.Success({ - msg: "Progress Note update created successfully", - }); + Notification.Success({ + msg: `${t(state.form.rounds_type)} log created successfully`, + }); + + if ( + ["NORMAL", "TELEMEDICINE", "DOCTORS_LOG"].includes( + state.form.rounds_type, + ) + ) { navigate( `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`, ); } else { - Notification.Success({ - msg: "Critical Care log update created successfully", - }); navigate( `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/daily_rounds/${obj.id}/update`, ); @@ -436,16 +430,16 @@ export const DailyRounds = (props: any) => { authUser.user_type, ) ) { - roundTypes.push({ id: "DOCTORS_LOG", text: "Progress Note" }); + roundTypes.push({ id: "DOCTORS_LOG", text: t("DOCTORS_LOG") }); } roundTypes.push( - { id: "NORMAL", text: "Normal" }, - { id: "VENTILATOR", text: "Critical Care" }, + { id: "NORMAL", text: t("NORMAL") }, + { id: "VENTILATOR", text: t("VENTILATOR") }, ); if (consultationSuggestion === "DC") { - roundTypes.push({ id: "TELEMEDICINE", text: "Telemedicine" }); + roundTypes.push({ id: "TELEMEDICINE", text: t("TELEMEDICINE") }); } const submitButtonDisabled = (() => { if (buttonText !== "Save") { diff --git a/src/Locale/en/Consultation.json b/src/Locale/en/Consultation.json index fc1b5ae5f7..4df1a4de9a 100644 --- a/src/Locale/en/Consultation.json +++ b/src/Locale/en/Consultation.json @@ -13,8 +13,9 @@ "download_discharge_summary": "Download discharge summary", "email_discharge_summary_description": "Enter your valid email address to receive the discharge summary", "generated_summary_caution": "This is a computer generated summary using the information captured in the CARE system.", - "NORMAL": "Normal", - "VENTILATOR": "Critical Care", + "NORMAL": "Brief Update", + "VENTILATOR": "Detailed Update", + "DOCTORS_LOG": "Progress Note", "AUTOMATED": "Automated", "TELEMEDICINE": "Telemedicine", "investigations": "Investigations",