From 518200d711904b017216457d0db39098f2e631d3 Mon Sep 17 00:00:00 2001
From: rithviknishad
Date: Sun, 21 Apr 2024 20:21:46 +0530
Subject: [PATCH 01/15] 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 02/15] 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 03/15] 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 04/15] 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 05/15] 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 06/15] 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}
/>
)}
diff --git a/src/Components/Medicine/PrescrpitionTimeline.tsx b/src/Components/Medicine/PrescrpitionTimeline.tsx
index 12cf3fd4998..9422d349b3a 100644
--- a/src/Components/Medicine/PrescrpitionTimeline.tsx
+++ b/src/Components/Medicine/PrescrpitionTimeline.tsx
@@ -29,12 +29,14 @@ interface Props {
prescription: Prescription;
showPrescriptionDetails?: boolean;
onRefetch?: () => void;
+ readonly?: boolean;
}
export default function PrescrpitionTimeline({
prescription,
interval,
onRefetch,
+ readonly,
}: Props) {
const consultation = useSlug("consultation");
const { data, refetch, loading } = useQuery(
@@ -89,7 +91,7 @@ export default function PrescrpitionTimeline({
refetch();
}}
isLastNode={index === events.length - 1}
- hideArchive={prescription.discontinued}
+ hideArchive={prescription.discontinued || readonly}
/>
);
}
From 27231f54873c45511e669be224e57bbd9c671d6c Mon Sep 17 00:00:00 2001
From: Mohammed Nihal <57055998+nihal467@users.noreply.github.com>
Date: Sun, 21 Apr 2024 23:08:10 +0530
Subject: [PATCH 07/15] part-1 discharge reason
---
.../e2e/patient_spec/patient_discharge.cy.ts | 83 +++++++++++++++++++
.../pageobject/Patient/PatientDischarge.ts | 23 +++++
.../ConsultationUpdatesTab.tsx | 51 ++++++------
src/Components/Form/AutoCompleteAsync.tsx | 6 +-
4 files changed, 134 insertions(+), 29 deletions(-)
create mode 100644 cypress/e2e/patient_spec/patient_discharge.cy.ts
create mode 100644 cypress/pageobject/Patient/PatientDischarge.ts
diff --git a/cypress/e2e/patient_spec/patient_discharge.cy.ts b/cypress/e2e/patient_spec/patient_discharge.cy.ts
new file mode 100644
index 00000000000..d53629e276c
--- /dev/null
+++ b/cypress/e2e/patient_spec/patient_discharge.cy.ts
@@ -0,0 +1,83 @@
+import { afterEach, before, beforeEach, cy, describe, it } from "local-cypress";
+import LoginPage from "../../pageobject/Login/LoginPage";
+import { PatientPage } from "../../pageobject/Patient/PatientCreation";
+import PatientDischarge from "../../pageobject/Patient/PatientDischarge";
+import PatientPrescription from "../../pageobject/Patient/PatientPrescription";
+
+describe("Patient Discharge based on multiple reason", () => {
+ const loginPage = new LoginPage();
+ const patientPage = new PatientPage();
+ const patientDischarge = new PatientDischarge();
+ const patientPrescription = new PatientPrescription();
+ const patientDischargeReason1 = "Recovered";
+ const patientDischargeReason2 = "Referred";
+ //const patientDischargeReason3 = "Expired";
+ //const patientDischargeReason4 = "LAMA";
+ const patientDischargeAdvice = "Discharge Advice";
+ const patientMedicine = "ZOLE";
+ const referringFacility = "Dummy Shifting Center, Ernakulam";
+ const referringFreetextFacility = "Aster Mims";
+
+ before(() => {
+ loginPage.loginAsDisctrictAdmin();
+ cy.saveLocalStorage();
+ });
+
+ beforeEach(() => {
+ cy.restoreLocalStorage();
+ cy.clearLocalStorage(/filters--.+/);
+ cy.awaitUrl("/patients");
+ });
+
+ it("Discharge a recovered patient with all fields", () => {
+ patientPage.visitPatient("Dummy Patient 6");
+ 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");
+ // submit the discharge pop-up
+ cy.submitButton("Confirm Discharge");
+ cy.verifyNotification("Patient Discharged Successfully");
+ // Verify the dashboard and discharge information
+ cy.verifyContentPresence("#discharge-information", [
+ patientDischargeReason1,
+ patientDischargeAdvice,
+ patientMedicine,
+ ]);
+ // verify the medicine administration is blocked
+ });
+
+ it("Discharge patient with referred reason to a facility", () => {
+ patientPage.visitPatient("Dummy Patient 6");
+ patientDischarge.clickDischarge();
+ patientDischarge.selectDischargeReason(patientDischargeReason2);
+ patientDischarge.typeDischargeNote(patientDischargeAdvice);
+ // select a registrated facility from dropdown and clear
+ patientDischarge.typeReferringFacility(referringFacility);
+ patientDischarge.clickClearButton();
+ // select a non-registered facility and perform the discharge
+ patientDischarge.typeReferringFacility(referringFreetextFacility);
+ cy.wait(3000);
+ patientDischarge.typeDischargeNote(patientDischargeAdvice);
+ cy.submitButton("Confirm Discharge");
+ cy.verifyNotification("Patient Discharged Successfully");
+ // Verify the dashboard and discharge information
+ cy.verifyContentPresence("#discharge-information", [
+ patientDischargeReason2,
+ patientDischargeAdvice,
+ referringFreetextFacility,
+ ]);
+ });
+
+ afterEach(() => {
+ cy.saveLocalStorage();
+ });
+});
diff --git a/cypress/pageobject/Patient/PatientDischarge.ts b/cypress/pageobject/Patient/PatientDischarge.ts
new file mode 100644
index 00000000000..102c87c29e9
--- /dev/null
+++ b/cypress/pageobject/Patient/PatientDischarge.ts
@@ -0,0 +1,23 @@
+class PatientDischarge {
+ clickDischarge() {
+ cy.clickAndSelectOption("#show-more", "Discharge from CARE");
+ }
+
+ selectDischargeReason(reason: string) {
+ cy.clickAndSelectOption("#discharge_reason", reason);
+ }
+
+ typeDischargeNote(note: string) {
+ cy.get("#discharge_notes").type(note);
+ }
+
+ typeReferringFacility(facility: string) {
+ cy.searchAndSelectOption("#input[name='referred_to']", facility);
+ }
+
+ clickClearButton() {
+ cy.get("#clear-button").click();
+ }
+}
+
+export default PatientDischarge;
diff --git a/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx
index 950ae89b62e..72f2b31eb78 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)
);
}
};
@@ -202,7 +202,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
"lg:col-span-2"
}`}
>
-
+
Discharge Information
@@ -212,8 +212,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
{DISCHARGE_REASONS.find(
(d) =>
- d.id ===
- props.consultationData.new_discharge_reason,
+ d.id === props.consultationData.new_discharge_reason
)?.text ?? "--"}
@@ -238,7 +237,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
{props.consultationData.discharge_date
? formatDate(
- props.consultationData.discharge_date,
+ props.consultationData.discharge_date
)
: "--/--/---- --:-- --"}
@@ -275,7 +274,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
{props.consultationData.death_datetime
? formatDateTime(
- props.consultationData.death_datetime,
+ props.consultationData.death_datetime
)
: "--:--"}
@@ -296,7 +295,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
)}
{[2, 4].includes(
- props.consultationData.new_discharge_reason ?? 0,
+ props.consultationData.new_discharge_reason ?? 0
) && (
@@ -304,7 +303,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
{props.consultationData.discharge_date
? formatDateTime(
- props.consultationData.discharge_date,
+ props.consultationData.discharge_date
)
: "--/--/---- --:-- --"}
@@ -341,12 +340,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
@@ -364,7 +363,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
from{" "}
{formatDate(
- props.consultationData.last_daily_round.taken_at,
+ props.consultationData.last_daily_round.taken_at
)}
>
@@ -380,12 +379,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 && (
@@ -541,7 +540,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
: formatDateTime(String(procedure.time))}
- ),
+ )
)}
@@ -559,7 +558,7 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
Intubation Date{" - "}
{formatDateTime(
- props.consultationData.intubation_start_date,
+ props.consultationData.intubation_start_date
)}
@@ -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 && (
-
+
@@ -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 14/15] 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 15/15] 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);
- }
}