Skip to content

Commit

Permalink
Merge pull request #8078 from coronasafe/staging
Browse files Browse the repository at this point in the history
  • Loading branch information
gigincg authored Jun 24, 2024
2 parents d764ee2 + 408dae0 commit 9f6e684
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 39 deletions.
12 changes: 6 additions & 6 deletions cypress/e2e/patient_spec/patient_logupdate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand All @@ -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();
Expand All @@ -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", [
Expand Down Expand Up @@ -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]);
Expand All @@ -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
Expand All @@ -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", ["-"]);
});
Expand Down
37 changes: 37 additions & 0 deletions cypress/e2e/patient_spec/patient_prescription.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion cypress/pageobject/Patient/PatientLogupdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
7 changes: 7 additions & 0 deletions cypress/pageobject/Patient/PatientPrescription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,20 @@ 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 });
}

enterIndicator(indicator: string) {
cy.get("#indicator").type(indicator);
}

enterDiscontinueReason(reason: string) {
cy.wait(2000);
cy.get("#discontinuedReason").type(reason);
}

enterAdministerDosage(dosage: string) {
cy.get("#dosage").type(dosage);
}
Expand Down
1 change: 1 addition & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
4 changes: 4 additions & 0 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,12 @@ export const REVIEW_AT_CHOICES: Array<OptionsType> = [
{ 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" },
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ let make = (~id, ~facilityId, ~patientId, ~consultationId, ~dailyRound) => {
href={`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`}>
<button
onClick={_ =>
Notifications.success({msg: "Critical care log updates are filed successfully"})}
Notifications.success({msg: "Detailed Update filed successfully"})}
className="btn btn-primary w-full mt-6">
{str("Complete")}
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Facility/Consultations/Beds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ const Beds = (props: BedsProps) => {
<div>
<ButtonV2 variant="primary" type="submit">
<CareIcon icon="l-bed" className="text-xl" />
Move to bed
Update
</ButtonV2>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useTranslation } from "react-i18next";
import PatientCategoryBadge from "../../../Common/PatientCategoryBadge";
import {
BloodPressure,
Expand All @@ -15,6 +16,8 @@ const LogUpdateCardAttribute = <T extends keyof DailyRoundsModel>({
attributeKey,
attributeValue,
}: Props<T>) => {
const { t } = useTranslation();

switch (attributeKey) {
// case "id":
// case "external_id":
Expand Down Expand Up @@ -67,11 +70,7 @@ const LogUpdateCardAttribute = <T extends keyof DailyRoundsModel>({
<div className="flex flex-col items-center gap-2 md:flex-row">
<AttributeLabel attributeKey={attributeKey} />
<span className="text-sm font-semibold text-gray-700">
{(attributeValue as string) === "VENTILATOR"
? "CRITICAL CARE"
: (attributeValue as string) === "DOCTORS_LOG"
? "PROGRESS NOTE"
: (attributeValue as string)}
{t(attributeValue)}
</span>
</div>
);
Expand Down
4 changes: 1 addition & 3 deletions src/Components/Facility/Consultations/DailyRoundsFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
/>
<TextFormField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ const MedicineAdministrationSheet = ({ readonly, is_prn }: Props) => {
</ScrollOverlay>
{!!discontinuedCount && (
<ButtonV2
id="discontinued-medicine"
variant="secondary"
className="group sticky left-0 w-full rounded-b-lg rounded-t-none bg-gray-100"
disabled={loading || discontinuedPrescriptions.loading}
Expand Down
34 changes: 14 additions & 20 deletions src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import useAppHistory from "../../Common/hooks/useAppHistory";
import { DraftSection, useAutoSaveReducer } from "../../Utils/AutoSave";
import * as Notification from "../../Utils/Notifications";
import { formatDateTime } from "../../Utils/utils";
import { capitalize } from "lodash-es";
import BloodPressureFormField, {
BloodPressureValidator,
} from "../Common/BloodPressureFormField";
Expand Down Expand Up @@ -342,7 +341,7 @@ export const DailyRounds = (props: any) => {
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(
Expand All @@ -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`,
);
Expand Down Expand Up @@ -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") {
Expand Down
5 changes: 3 additions & 2 deletions src/Locale/en/Consultation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9f6e684

Please sign in to comment.