From 7742c017b30ac0771dde8ffcaed33eb0880e3de6 Mon Sep 17 00:00:00 2001 From: Ashraf Mohammed <98876115+AshrafMd-1@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:22:19 +0530 Subject: [PATCH 01/21] fix loading (#7643) --- src/Components/Patient/SampleDetails.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Patient/SampleDetails.tsx b/src/Components/Patient/SampleDetails.tsx index f66805a3ded..a3d3df95c21 100644 --- a/src/Components/Patient/SampleDetails.tsx +++ b/src/Components/Patient/SampleDetails.tsx @@ -265,7 +265,7 @@ export const SampleDetails = ({ id }: DetailRoute) => { ); }; - if (isLoading) { + if (isLoading || !sampleDetails) { return ; } From c331b845a57b64b1466ea327ae712e625300e20f Mon Sep 17 00:00:00 2001 From: Pranshu Aggarwal <70687348+Pranshu1902@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:33:39 +0530 Subject: [PATCH 02/21] Add option to mark notification as unread (#7553) * add option to mark notification as unread * Update src/Locale/en/Notifications.json Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> * fix lint errrors * fix lint with updated prettier --------- Co-authored-by: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> --- .../Notifications/NotificationsList.tsx | 33 +++++++++++++++---- src/Locale/en/Notifications.json | 1 + src/Redux/api.tsx | 5 +++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/Components/Notifications/NotificationsList.tsx b/src/Components/Notifications/NotificationsList.tsx index 02cb1f4fa8b..c9e6720e6ad 100644 --- a/src/Components/Notifications/NotificationsList.tsx +++ b/src/Components/Notifications/NotificationsList.tsx @@ -46,6 +46,16 @@ const NotificationTile = ({ setIsMarkingAsRead(false); }; + const handleMarkAsUnRead = async () => { + setIsMarkingAsRead(true); + await request(routes.markNotificationAsUnRead, { + pathParams: { id: result.id }, + body: { read_at: null }, + }); + setResult({ ...result, read_at: null }); + setIsMarkingAsRead(false); + }; + const resultUrl = (event: string, data: any) => { switch (event) { case "PATIENT_CREATED": @@ -107,24 +117,33 @@ const NotificationTile = ({
{ event.stopPropagation(); - handleMarkAsRead(); + if (result.read_at) { + handleMarkAsUnRead(); + } else { + handleMarkAsRead(); + } }} > - {t("mark_as_read")} + + {result.read_at ? t("mark_as_unread") : t("mark_as_read")} + (), }, + markNotificationAsUnRead: { + path: "/api/v1/notification/{id}/", + method: "PATCH", + TRes: Type(), + }, getPublicKey: { path: "/api/v1/notification/public_key/", method: "GET", From 48db450d15e66789d0e8a33f02d3e4c0c359bc93 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Thu, 18 Apr 2024 16:22:26 +0530 Subject: [PATCH 03/21] added support for various abha qr in scan and pull (#7565) --- src/Components/ABDM/LinkABHANumberModal.tsx | 4 ++-- src/Components/ABDM/models.ts | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Components/ABDM/LinkABHANumberModal.tsx b/src/Components/ABDM/LinkABHANumberModal.tsx index fe789e6c909..d7dfc9f60c1 100644 --- a/src/Components/ABDM/LinkABHANumberModal.tsx +++ b/src/Components/ABDM/LinkABHANumberModal.tsx @@ -194,12 +194,12 @@ const ScanABHAQRSection = ({ body: { patientId, hidn: abha?.hidn, - phr: abha?.hid, + phr: (abha?.phr ?? abha?.hid) as string, name: abha?.name, gender: abha?.gender, dob: abha?.dob.replace(/\//g, "-"), address: abha?.address, - "dist name": abha?.district_name, + "dist name": abha?.["dist name"] ?? abha?.district_name, "state name": abha?.["state name"], }, }); diff --git a/src/Components/ABDM/models.ts b/src/Components/ABDM/models.ts index 957dc9c2d17..9dc362f5cac 100644 --- a/src/Components/ABDM/models.ts +++ b/src/Components/ABDM/models.ts @@ -123,10 +123,12 @@ export interface ILinkViaQRBody { export interface ABHAQRContent { address: string; distlgd: string; - district_name: string; + district_name?: string; dob: string; - gender: "M"; - hid: string; + gender: "M" | "F" | "O"; + hid?: string; + phr?: string; + "dist name"?: string; hidn: string; mobile: string; name: string; From 78bdc551587c095dabed92b07a115c07f7f41331 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:57:13 +0530 Subject: [PATCH 04/21] flaky test (#7657) --- cypress/e2e/assets_spec/assets_creation.cy.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cypress/e2e/assets_spec/assets_creation.cy.ts b/cypress/e2e/assets_spec/assets_creation.cy.ts index f8edc2bb172..cd3489a14d8 100644 --- a/cypress/e2e/assets_spec/assets_creation.cy.ts +++ b/cypress/e2e/assets_spec/assets_creation.cy.ts @@ -160,12 +160,10 @@ describe("Asset", () => { assetPage.interceptAssetCreation(); assetPage.clickCreateAsset(); assetPage.verifyAssetCreation(); - assetSearchPage.typeSearchKeyword("New Test Asset Vital"); assetSearchPage.pressEnter(); - assetPage.openCreatedAsset(); - assetPage.configureVitalAsset("Host name", "192.168.1.64"); + assetPage.configureVitalAsset("Host name", "192.168.1.20"); assetPage.clickConfigureVital(); }); From e84087a71225a70ad61b5560d8b27f898a6d648e Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:05:41 +0530 Subject: [PATCH 05/21] Fix round type display and qr field (#7666) --- .../DailyRounds/LogUpdateCardAttribute.tsx | 12 ++++++++++++ src/Components/Form/FormFields/TextFormField.tsx | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx b/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx index 3afed28dda8..d3e4b03be0a 100644 --- a/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx +++ b/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx @@ -62,6 +62,18 @@ const LogUpdateCardAttribute = ({
); + case "rounds_type": + return ( +
+ + + {(attributeValue as string) === "VENTILATOR" + ? "Critical Care" + : (attributeValue as string)} + +
+ ); + default: return (
diff --git a/src/Components/Form/FormFields/TextFormField.tsx b/src/Components/Form/FormFields/TextFormField.tsx index b2a84e51595..8f1ee341e34 100644 --- a/src/Components/Form/FormFields/TextFormField.tsx +++ b/src/Components/Form/FormFields/TextFormField.tsx @@ -100,7 +100,7 @@ const TextFormField = forwardRef((props: TextFormFieldProps, ref) => { ); const _trailing = trailing === trailingFocused ? ( -
+
{trailing}
) : ( From 768a5b39b19156e59414175e03e7ff6a247c5970 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Sat, 20 Apr 2024 18:47:18 +0530 Subject: [PATCH 06/21] minor case issue (#7668) --- .../Consultations/DailyRounds/LogUpdateCardAttribute.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx b/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx index d3e4b03be0a..4e5b7408266 100644 --- a/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx +++ b/src/Components/Facility/Consultations/DailyRounds/LogUpdateCardAttribute.tsx @@ -68,7 +68,7 @@ const LogUpdateCardAttribute = ({ {(attributeValue as string) === "VENTILATOR" - ? "Critical Care" + ? "CRITICAL CARE" : (attributeValue as string)}
From 518200d711904b017216457d0db39098f2e631d3 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Sun, 21 Apr 2024 20:21:46 +0530 Subject: [PATCH 07/21] 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 08/21] 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 09/21] 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 20:35:40 +0530 Subject: [PATCH 10/21] fixes incorrect null checks for referred to facility in discharge modal --- src/Components/Facility/DischargeModal.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx index 6a6b8c48ead..35e6fba1cf6 100644 --- a/src/Components/Facility/DischargeModal.tsx +++ b/src/Components/Facility/DischargeModal.tsx @@ -165,12 +165,12 @@ const DischargeModal = ({ } }; - const handleFacilitySelect = (selected: FacilityModel) => { + const handleFacilitySelect = (selected?: FacilityModel) => { setFacility(selected); setPreDischargeForm((prev) => ({ ...prev, - referred_to: selected.id ?? null, - referred_to_external: !selected.id ? selected.name : null, + referred_to: selected?.id ?? null, + referred_to_external: selected?.name || null, })); }; @@ -215,7 +215,7 @@ const DischargeModal = ({ - handleFacilitySelect(selected as FacilityModel) + handleFacilitySelect(selected as FacilityModel | undefined) } selected={facility ?? null} showAll From e8fefad23ff60c88473a3e83f94ed13ea236e745 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Sun, 21 Apr 2024 20:56:29 +0530 Subject: [PATCH 11/21] fix typo --- src/Components/Facility/DischargeModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx index 35e6fba1cf6..7b170379066 100644 --- a/src/Components/Facility/DischargeModal.tsx +++ b/src/Components/Facility/DischargeModal.tsx @@ -170,7 +170,7 @@ const DischargeModal = ({ setPreDischargeForm((prev) => ({ ...prev, referred_to: selected?.id ?? null, - referred_to_external: selected?.name || null, + referred_to_external: !selected?.id ? selected?.name : null, })); }; From dfede2cca5a016af91216091b4abc1d90f54b2c8 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Sun, 21 Apr 2024 21:08:40 +0530 Subject: [PATCH 12/21] 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} />
@@ -568,7 +567,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { {props.consultationData.intubation_end_date && formatDateTime( - props.consultationData.intubation_end_date, + props.consultationData.intubation_end_date )}
@@ -618,7 +617,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {

- ), + ) )} @@ -661,7 +660,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { {Math.sqrt( (Number(props.consultationData.weight) * Number(props.consultationData.height)) / - 3600, + 3600 ).toFixed(2)}{" "} m2 @@ -677,7 +676,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { {( props.consultationData.consent_records?.filter( - (record) => record.deleted !== true, + (record) => record.deleted !== true ) || [] ).length > 0 && ( <> @@ -692,13 +691,13 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
{ CONSENT_TYPE_CHOICES.find( - (c) => c.id === record.type, + (c) => c.id === record.type )?.text }{" "} {record.patient_code_status && `( ${ CONSENT_PATIENT_CODE_STATUS_CHOICES.find( - (c) => c.id === record.patient_code_status, + (c) => c.id === record.patient_code_status )?.text } )`}
diff --git a/src/Components/Form/AutoCompleteAsync.tsx b/src/Components/Form/AutoCompleteAsync.tsx index b7660b3dcb7..2102f254480 100644 --- a/src/Components/Form/AutoCompleteAsync.tsx +++ b/src/Components/Form/AutoCompleteAsync.tsx @@ -65,7 +65,7 @@ const AutoCompleteAsync = (props: Props) => { setData(data?.slice(0, showNOptions) || []); setLoading(false); }, debounceTime), - [fetchData, showNOptions, debounceTime], + [fetchData, showNOptions, debounceTime] ); useEffect(() => { @@ -107,7 +107,7 @@ const AutoCompleteAsync = (props: Props) => {
{hasSelection && !loading && !required && ( -
+
{ label={optionLabel(option)} onRemove={() => onChange( - selected.filter((item: any) => item.id !== option.id), + selected.filter((item: any) => item.id !== option.id) ) } /> From 4c1b3d4dd4a9a4128cad9073cb9d8162562a0354 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Sun, 21 Apr 2024 23:08:45 +0530 Subject: [PATCH 14/21] part-1 discharge reason --- cypress/e2e/patient_spec/patient_discharge.cy.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/cypress/e2e/patient_spec/patient_discharge.cy.ts b/cypress/e2e/patient_spec/patient_discharge.cy.ts index d53629e276c..b1a0c70c5e1 100644 --- a/cypress/e2e/patient_spec/patient_discharge.cy.ts +++ b/cypress/e2e/patient_spec/patient_discharge.cy.ts @@ -52,7 +52,6 @@ describe("Patient Discharge based on multiple reason", () => { patientDischargeAdvice, patientMedicine, ]); - // verify the medicine administration is blocked }); it("Discharge patient with referred reason to a facility", () => { From 04d5f7ecf1b565e1fab892a5713892c4a2af09e1 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 22 Apr 2024 00:58:04 +0530 Subject: [PATCH 15/21] fix id --- cypress/pageobject/Patient/PatientDischarge.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cypress/pageobject/Patient/PatientDischarge.ts b/cypress/pageobject/Patient/PatientDischarge.ts index 102c87c29e9..2000354b944 100644 --- a/cypress/pageobject/Patient/PatientDischarge.ts +++ b/cypress/pageobject/Patient/PatientDischarge.ts @@ -1,6 +1,8 @@ class PatientDischarge { clickDischarge() { - cy.clickAndSelectOption("#show-more", "Discharge from CARE"); + cy.get("#show-more").scrollIntoView(); + cy.verifyAndClickElement("#show-more", "Manage Patient"); + cy.verifyAndClickElement("#show-more", "Discharge from CARE"); } selectDischargeReason(reason: string) { From cc0b17c8555a64eff6af50d75159614e643fae34 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 22 Apr 2024 01:10:33 +0530 Subject: [PATCH 16/21] debug --- cypress/e2e/patient_spec/patient_discharge.cy.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_discharge.cy.ts b/cypress/e2e/patient_spec/patient_discharge.cy.ts index b1a0c70c5e1..2bbc0e59557 100644 --- a/cypress/e2e/patient_spec/patient_discharge.cy.ts +++ b/cypress/e2e/patient_spec/patient_discharge.cy.ts @@ -30,7 +30,7 @@ describe("Patient Discharge based on multiple reason", () => { }); it("Discharge a recovered patient with all fields", () => { - patientPage.visitPatient("Dummy Patient 6"); + patientPage.visitPatient("Dummy Patient 16"); patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason1); patientDischarge.typeDischargeNote(patientDischargeAdvice); @@ -43,9 +43,13 @@ describe("Patient Discharge based on multiple reason", () => { patientPrescription.selectDosageFrequency("Twice daily"); cy.submitButton("Submit"); cy.verifyNotification("Medicine prescribed"); + cy.wait(2000); + cy.closeNotification(); // submit the discharge pop-up cy.submitButton("Confirm Discharge"); + cy.wait(2000); cy.verifyNotification("Patient Discharged Successfully"); + cy.closeNotification(); // Verify the dashboard and discharge information cy.verifyContentPresence("#discharge-information", [ patientDischargeReason1, @@ -55,7 +59,7 @@ describe("Patient Discharge based on multiple reason", () => { }); it("Discharge patient with referred reason to a facility", () => { - patientPage.visitPatient("Dummy Patient 6"); + patientPage.visitPatient("Dummy Patient 15"); patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason2); patientDischarge.typeDischargeNote(patientDischargeAdvice); @@ -67,7 +71,9 @@ describe("Patient Discharge based on multiple reason", () => { cy.wait(3000); patientDischarge.typeDischargeNote(patientDischargeAdvice); cy.submitButton("Confirm Discharge"); + cy.wait(2000); cy.verifyNotification("Patient Discharged Successfully"); + cy.closeNotification(); // Verify the dashboard and discharge information cy.verifyContentPresence("#discharge-information", [ patientDischargeReason2, From e7ab4d549dc54b3da8ae9613bb9a50237b4def20 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 22 Apr 2024 01:29:26 +0530 Subject: [PATCH 17/21] changed the id --- .../pageobject/Patient/PatientDischarge.ts | 2 +- src/Components/Facility/DischargeModal.tsx | 36 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/cypress/pageobject/Patient/PatientDischarge.ts b/cypress/pageobject/Patient/PatientDischarge.ts index 2000354b944..bcddab45902 100644 --- a/cypress/pageobject/Patient/PatientDischarge.ts +++ b/cypress/pageobject/Patient/PatientDischarge.ts @@ -14,7 +14,7 @@ class PatientDischarge { } typeReferringFacility(facility: string) { - cy.searchAndSelectOption("#input[name='referred_to']", facility); + cy.searchAndSelectOption("#facility-referredto", facility); } clickClearButton() { diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx index 7b170379066..1e8fe6d4b03 100644 --- a/src/Components/Facility/DischargeModal.tsx +++ b/src/Components/Facility/DischargeModal.tsx @@ -79,7 +79,7 @@ const DischargeModal = ({ ordering: "-modified_date", use: "claim", consultation: consultationData.id, - }), + }) ); if (res?.data?.results?.length > 0) { @@ -151,8 +151,8 @@ const DischargeModal = ({ discharge: value, discharge_date: dayjs(preDischargeForm.discharge_date).toISOString(), }, - { id: consultationData.id }, - ), + { id: consultationData.id } + ) ); setIsSendingDischargeApi(false); @@ -211,19 +211,21 @@ const DischargeModal = ({ {preDischargeForm.new_discharge_reason === DISCHARGE_REASONS.find((i) => i.text == "Referred")?.id && ( <> - Referred to - - handleFacilitySelect(selected as FacilityModel | undefined) - } - selected={facility ?? null} - showAll - freeText - multiple={false} - errors={errors?.referred_to} - className="mb-4" - /> +
+ Referred to + + handleFacilitySelect(selected as FacilityModel | undefined) + } + selected={facility ?? null} + showAll + freeText + multiple={false} + errors={errors?.referred_to} + className="mb-4" + /> +
)} Date: Mon, 22 Apr 2024 17:50:58 +0530 Subject: [PATCH 18/21] FINAL part --- .../e2e/patient_spec/patient_discharge.cy.ts | 89 +++++++++++++------ .../pageobject/Patient/PatientDischarge.ts | 4 + src/Components/Facility/DischargeModal.tsx | 2 +- 3 files changed, 69 insertions(+), 26 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_discharge.cy.ts b/cypress/e2e/patient_spec/patient_discharge.cy.ts index 2bbc0e59557..9c66e8c1c14 100644 --- a/cypress/e2e/patient_spec/patient_discharge.cy.ts +++ b/cypress/e2e/patient_spec/patient_discharge.cy.ts @@ -11,12 +11,14 @@ describe("Patient Discharge based on multiple reason", () => { const patientPrescription = new PatientPrescription(); const patientDischargeReason1 = "Recovered"; const patientDischargeReason2 = "Referred"; - //const patientDischargeReason3 = "Expired"; - //const patientDischargeReason4 = "LAMA"; + const patientDischargeReason3 = "Expired"; + const patientDischargeReason4 = "LAMA"; const patientDischargeAdvice = "Discharge Advice"; const patientMedicine = "ZOLE"; const referringFacility = "Dummy Shifting Center, Ernakulam"; const referringFreetextFacility = "Aster Mims"; + const patientDeathCause = "Cause Of Death"; + const doctorName = "Custom Doctor"; before(() => { loginPage.loginAsDisctrictAdmin(); @@ -29,37 +31,42 @@ describe("Patient Discharge based on multiple reason", () => { cy.awaitUrl("/patients"); }); - it("Discharge a recovered patient with all fields", () => { - patientPage.visitPatient("Dummy Patient 16"); + it("Discharge a LAMA patient in the consultation", () => { + patientPage.visitPatient("Dummy Patient 18"); patientDischarge.clickDischarge(); - patientDischarge.selectDischargeReason(patientDischargeReason1); - patientDischarge.typeDischargeNote(patientDischargeAdvice); - // Prescribe a medicine for the patient - patientPrescription.clickAddPrescription(); - patientPrescription.interceptMedibase(); - patientPrescription.selectMedicinebox(); - patientPrescription.selectMedicine(patientMedicine); - patientPrescription.enterDosage("4"); - patientPrescription.selectDosageFrequency("Twice daily"); - cy.submitButton("Submit"); - cy.verifyNotification("Medicine prescribed"); - cy.wait(2000); + patientDischarge.selectDischargeReason(patientDischargeReason4); + cy.submitButton("Confirm Discharge"); + cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); - // submit the discharge pop-up + // Verify the consultation dashboard reflection + cy.verifyContentPresence("#consultation-buttons", ["LAMA"]); + // verify the discharge information card + cy.verifyContentPresence("#discharge-information", [ + patientDischargeReason4, + ]); + }); + + it("Discharge a expired patient in the consultation", () => { + patientPage.visitPatient("Dummy Patient 17"); + patientDischarge.clickDischarge(); + patientDischarge.selectDischargeReason(patientDischargeReason3); + patientDischarge.typeDischargeNote(patientDeathCause); + patientDischarge.typeDoctorName(doctorName); cy.submitButton("Confirm Discharge"); - cy.wait(2000); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); - // Verify the dashboard and discharge information + // Verify the consultation dashboard reflection + cy.verifyContentPresence("#consultation-buttons", ["EXPIRED"]); + // verify the discharge information card cy.verifyContentPresence("#discharge-information", [ - patientDischargeReason1, - patientDischargeAdvice, - patientMedicine, + patientDischargeReason3, + patientDeathCause, + doctorName, ]); }); it("Discharge patient with referred reason to a facility", () => { - patientPage.visitPatient("Dummy Patient 15"); + patientPage.visitPatient("Dummy Patient 16"); patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason2); patientDischarge.typeDischargeNote(patientDischargeAdvice); @@ -68,12 +75,13 @@ describe("Patient Discharge based on multiple reason", () => { patientDischarge.clickClearButton(); // select a non-registered facility and perform the discharge patientDischarge.typeReferringFacility(referringFreetextFacility); - cy.wait(3000); - patientDischarge.typeDischargeNote(patientDischargeAdvice); + cy.wait(2000); cy.submitButton("Confirm Discharge"); cy.wait(2000); cy.verifyNotification("Patient Discharged Successfully"); cy.closeNotification(); + // Verify the consultation dashboard reflection + cy.verifyContentPresence("#consultation-buttons", ["Referred"]); // Verify the dashboard and discharge information cy.verifyContentPresence("#discharge-information", [ patientDischargeReason2, @@ -82,6 +90,37 @@ describe("Patient Discharge based on multiple reason", () => { ]); }); + it("Discharge a recovered patient with all relevant fields", () => { + patientPage.visitPatient("Dummy Patient 15"); + patientDischarge.clickDischarge(); + patientDischarge.selectDischargeReason(patientDischargeReason1); + patientDischarge.typeDischargeNote(patientDischargeAdvice); + // Prescribe a medicine for the patient + patientPrescription.clickAddPrescription(); + patientPrescription.interceptMedibase(); + patientPrescription.selectMedicinebox(); + patientPrescription.selectMedicine(patientMedicine); + patientPrescription.enterDosage("4"); + patientPrescription.selectDosageFrequency("Twice daily"); + cy.submitButton("Submit"); + cy.verifyNotification("Medicine prescribed"); + cy.wait(2000); + cy.closeNotification(); + // submit the discharge pop-up + cy.submitButton("Confirm Discharge"); + cy.wait(2000); + cy.verifyNotification("Patient Discharged Successfully"); + cy.closeNotification(); + // Verify the consultation dashboard reflection + cy.verifyContentPresence("#consultation-buttons", ["Recovered"]); + // Verify the dashboard and discharge information + cy.verifyContentPresence("#discharge-information", [ + patientDischargeReason1, + patientDischargeAdvice, + patientMedicine, + ]); + }); + afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/pageobject/Patient/PatientDischarge.ts b/cypress/pageobject/Patient/PatientDischarge.ts index bcddab45902..eda6a379a3f 100644 --- a/cypress/pageobject/Patient/PatientDischarge.ts +++ b/cypress/pageobject/Patient/PatientDischarge.ts @@ -20,6 +20,10 @@ class PatientDischarge { clickClearButton() { cy.get("#clear-button").click(); } + + typeDoctorName(doctorName: string) { + cy.get("#death_confirmed_by").type(doctorName); + } } export default PatientDischarge; diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx index 1e8fe6d4b03..d70246522c1 100644 --- a/src/Components/Facility/DischargeModal.tsx +++ b/src/Components/Facility/DischargeModal.tsx @@ -211,7 +211,7 @@ const DischargeModal = ({ {preDischargeForm.new_discharge_reason === DISCHARGE_REASONS.find((i) => i.text == "Referred")?.id && ( <> -
+
Referred to Date: Mon, 22 Apr 2024 18:07:11 +0530 Subject: [PATCH 19/21] fix lint error --- .../ConsultationUpdatesTab.tsx | 49 ++++++++++--------- src/Components/Facility/DischargeModal.tsx | 8 +-- src/Components/Form/AutoCompleteAsync.tsx | 4 +- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx index 72f2b31eb78..f4150617f1f 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx @@ -58,24 +58,24 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { listAssetBeds({ facility: props.consultationData.facility as any, bed: props.consultationData.current_bed?.bed_object.id, - }) + }), ); const assetBeds = assetBedRes?.data?.results as AssetBedModel[]; const monitorBedData = assetBeds?.find( - (i) => i.asset_object?.asset_class === AssetClass.HL7MONITOR + (i) => i.asset_object?.asset_class === AssetClass.HL7MONITOR, ); setMonitorBedData(monitorBedData); if (monitorBedData?.asset_object) { setHL7SocketUrl( - getVitalsMonitorSocketUrl(monitorBedData?.asset_object) + getVitalsMonitorSocketUrl(monitorBedData?.asset_object), ); } const consultationBedVentilator = props.consultationData?.current_bed?.assets_objects?.find( - (i) => i.asset_class === AssetClass.VENTILATOR + (i) => i.asset_class === AssetClass.VENTILATOR, ); let ventilatorBedData; @@ -86,14 +86,14 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { } as AssetBedModel; } else { ventilatorBedData = assetBeds?.find( - (i) => i.asset_object.asset_class === AssetClass.VENTILATOR + (i) => i.asset_object.asset_class === AssetClass.VENTILATOR, ); } setVentilatorBedData(ventilatorBedData); if (ventilatorBedData?.asset_object) { setVentilatorSocketUrl( - getVitalsMonitorSocketUrl(ventilatorBedData?.asset_object) + getVitalsMonitorSocketUrl(ventilatorBedData?.asset_object), ); } }; @@ -212,7 +212,8 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { {DISCHARGE_REASONS.find( (d) => - d.id === props.consultationData.new_discharge_reason + d.id === + props.consultationData.new_discharge_reason, )?.text ?? "--"}
@@ -237,7 +238,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { {props.consultationData.discharge_date ? formatDate( - props.consultationData.discharge_date + props.consultationData.discharge_date, ) : "--/--/---- --:-- --"} @@ -274,7 +275,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { {props.consultationData.death_datetime ? formatDateTime( - props.consultationData.death_datetime + props.consultationData.death_datetime, ) : "--:--"} @@ -295,7 +296,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
)} {[2, 4].includes( - props.consultationData.new_discharge_reason ?? 0 + props.consultationData.new_discharge_reason ?? 0, ) && (
@@ -303,7 +304,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { {props.consultationData.discharge_date ? formatDateTime( - props.consultationData.discharge_date + props.consultationData.discharge_date, ) : "--/--/---- --:-- --"} @@ -340,12 +341,12 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { key={index} text={ SYMPTOM_CHOICES.find( - (choice) => choice.id === symptom + (choice) => choice.id === symptom, )?.text ?? "Err. Unknown" } size="small" /> - ) + ), )}
{props.consultationData.last_daily_round @@ -363,7 +364,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { from{" "} {formatDate( - props.consultationData.last_daily_round.taken_at + props.consultationData.last_daily_round.taken_at, )} @@ -379,12 +380,12 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { key={index} text={ SYMPTOM_CHOICES.find( - (choice) => choice.id === symptom + (choice) => choice.id === symptom, )?.text ?? "Err. Unknown" } size="small" /> - ) + ), )}
{props.consultationData.other_symptoms && ( @@ -540,7 +541,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { : formatDateTime(String(procedure.time))} - ) + ), )} @@ -558,7 +559,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { Intubation Date{" - "} {formatDateTime( - props.consultationData.intubation_start_date + props.consultationData.intubation_start_date, )}
@@ -567,7 +568,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { {props.consultationData.intubation_end_date && formatDateTime( - props.consultationData.intubation_end_date + props.consultationData.intubation_end_date, )}
@@ -617,7 +618,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {

- ) + ), )} @@ -660,7 +661,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { {Math.sqrt( (Number(props.consultationData.weight) * Number(props.consultationData.height)) / - 3600 + 3600, ).toFixed(2)}{" "} m2 @@ -676,7 +677,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => { {( props.consultationData.consent_records?.filter( - (record) => record.deleted !== true + (record) => record.deleted !== true, ) || [] ).length > 0 && ( <> @@ -691,13 +692,13 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
{ CONSENT_TYPE_CHOICES.find( - (c) => c.id === record.type + (c) => c.id === record.type, )?.text }{" "} {record.patient_code_status && `( ${ CONSENT_PATIENT_CODE_STATUS_CHOICES.find( - (c) => c.id === record.patient_code_status + (c) => c.id === record.patient_code_status, )?.text } )`}
diff --git a/src/Components/Facility/DischargeModal.tsx b/src/Components/Facility/DischargeModal.tsx index d70246522c1..c81ab2cf74e 100644 --- a/src/Components/Facility/DischargeModal.tsx +++ b/src/Components/Facility/DischargeModal.tsx @@ -79,7 +79,7 @@ const DischargeModal = ({ ordering: "-modified_date", use: "claim", consultation: consultationData.id, - }) + }), ); if (res?.data?.results?.length > 0) { @@ -151,8 +151,8 @@ const DischargeModal = ({ discharge: value, discharge_date: dayjs(preDischargeForm.discharge_date).toISOString(), }, - { id: consultationData.id } - ) + { id: consultationData.id }, + ), ); setIsSendingDischargeApi(false); @@ -281,7 +281,7 @@ const DischargeModal = ({ }} required min={dayjs(consultationData?.encounter_date).format( - "YYYY-MM-DDTHH:mm" + "YYYY-MM-DDTHH:mm", )} max={dayjs().format("YYYY-MM-DDTHH:mm")} error={ diff --git a/src/Components/Form/AutoCompleteAsync.tsx b/src/Components/Form/AutoCompleteAsync.tsx index 2102f254480..d4e686c41fa 100644 --- a/src/Components/Form/AutoCompleteAsync.tsx +++ b/src/Components/Form/AutoCompleteAsync.tsx @@ -65,7 +65,7 @@ const AutoCompleteAsync = (props: Props) => { setData(data?.slice(0, showNOptions) || []); setLoading(false); }, debounceTime), - [fetchData, showNOptions, debounceTime] + [fetchData, showNOptions, debounceTime], ); useEffect(() => { @@ -175,7 +175,7 @@ const AutoCompleteAsync = (props: Props) => { label={optionLabel(option)} onRemove={() => onChange( - selected.filter((item: any) => item.id !== option.id) + selected.filter((item: any) => item.id !== option.id), ) } /> From bed41aa3a6cc256af84bcdc064a85c4b0f7e4396 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 22 Apr 2024 18:25:31 +0530 Subject: [PATCH 20/21] update patient name --- cypress/e2e/patient_spec/patient_discharge.cy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_discharge.cy.ts b/cypress/e2e/patient_spec/patient_discharge.cy.ts index 9c66e8c1c14..34ad423d1e8 100644 --- a/cypress/e2e/patient_spec/patient_discharge.cy.ts +++ b/cypress/e2e/patient_spec/patient_discharge.cy.ts @@ -32,7 +32,7 @@ describe("Patient Discharge based on multiple reason", () => { }); it("Discharge a LAMA patient in the consultation", () => { - patientPage.visitPatient("Dummy Patient 18"); + patientPage.visitPatient("Dummy Patient 12"); patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason4); cy.submitButton("Confirm Discharge"); @@ -47,7 +47,7 @@ describe("Patient Discharge based on multiple reason", () => { }); it("Discharge a expired patient in the consultation", () => { - patientPage.visitPatient("Dummy Patient 17"); + patientPage.visitPatient("Dummy Patient 13"); patientDischarge.clickDischarge(); patientDischarge.selectDischargeReason(patientDischargeReason3); patientDischarge.typeDischargeNote(patientDeathCause); From 898afbc7406ef37098642b6bdca8c51b6f110de9 Mon Sep 17 00:00:00 2001 From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com> Date: Mon, 22 Apr 2024 19:04:07 +0530 Subject: [PATCH 21/21] delete existing discharge test --- cypress/e2e/patient_spec/patient_manage.cy.ts | 8 ------ .../pageobject/Patient/PatientConsultation.ts | 28 +------------------ 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_manage.cy.ts b/cypress/e2e/patient_spec/patient_manage.cy.ts index 35b89aedb7f..c25677d9e8b 100644 --- a/cypress/e2e/patient_spec/patient_manage.cy.ts +++ b/cypress/e2e/patient_spec/patient_manage.cy.ts @@ -58,14 +58,6 @@ describe("Patient", () => { cy.verifyNotification("Medicine prescribed"); }); - it("Discharge a patient", () => { - patientPage.visitPatient("Dummy Patient 6"); - patientConsultationPage.clickDischargePatient(); - patientConsultationPage.selectDischargeReason("Recovered"); - patientConsultationPage.addDischargeNotes("Discharge notes"); - patientConsultationPage.confirmDischarge(); - }); - afterEach(() => { cy.saveLocalStorage(); }); diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index 0a39a1f839a..87cead3fc1f 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -100,7 +100,7 @@ export class PatientConsultationPage { cy.get("button").contains("Manage Patient").click(); cy.verifyAndClickElement( "#consultation-buttons", - "Edit Consultation Details" + "Edit Consultation Details", ); cy.wait(3000); } @@ -130,30 +130,4 @@ export class PatientConsultationPage { cy.get("#add_doctor_note_button").click(); cy.wait("@postDoctorNotes").its("response.statusCode").should("eq", 201); } - - clickDischargePatient() { - cy.get("#show-more").scrollIntoView(); - cy.get("#show-more").click(); - cy.contains("p", "Discharge from CARE").click(); - } - - selectDischargeReason(reason: string) { - cy.get("#discharge_reason") - .click() - .then(() => { - cy.get("[role='option']").contains(reason).click(); - }); - } - - addDischargeNotes(notes: string) { - cy.get("#discharge_notes").type(notes); - } - - confirmDischarge() { - cy.intercept("POST", "**/api/v1/consultation/*/discharge_patient/").as( - "dischargePatient" - ); - cy.get("#submit").contains("Confirm Discharge").click(); - cy.wait("@dischargePatient").its("response.statusCode").should("eq", 200); - } }