From 6319cff72c0909cfc838b7da248c0cdb86ffc65b Mon Sep 17 00:00:00 2001 From: Ashesh <3626859+Ashesh3@users.noreply.github.com> Date: Wed, 27 Sep 2023 20:21:28 +0530 Subject: [PATCH] Remove default selection of patient category (#6354) * Remove default selection of patient category * Fix cypress --- cypress/e2e/patient_spec/patient_crud.cy.ts | 1 + .../pageobject/Patient/PatientConsultation.ts | 8 ++++++++ src/Components/Facility/ConsultationForm.tsx | 6 +++--- src/Components/Patient/DailyRounds.tsx | 18 ++++++++++++------ 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/cypress/e2e/patient_spec/patient_crud.cy.ts b/cypress/e2e/patient_spec/patient_crud.cy.ts index b22ccdbce13..fcfd97039f7 100644 --- a/cypress/e2e/patient_spec/patient_crud.cy.ts +++ b/cypress/e2e/patient_spec/patient_crud.cy.ts @@ -115,6 +115,7 @@ describe("Patient Creation with consultation", () => { patientConsultationPage.selectSymptoms("ASYMPTOMATIC"); patientConsultationPage.enterConsultationDetails( + "Stable", "Examination details and Clinical conditions", "70", "170", diff --git a/cypress/pageobject/Patient/PatientConsultation.ts b/cypress/pageobject/Patient/PatientConsultation.ts index b1c95d19140..6937559d548 100644 --- a/cypress/pageobject/Patient/PatientConsultation.ts +++ b/cypress/pageobject/Patient/PatientConsultation.ts @@ -23,6 +23,7 @@ export class PatientConsultationPage { } enterConsultationDetails( + category: string, examinationDetails: string, weight: string, height: string, @@ -31,6 +32,11 @@ export class PatientConsultationPage { verificationBy: string ) { cy.get("#symptoms").click(); + cy.get("#category") + .click() + .then(() => { + cy.get("[role='option']").contains(category).click(); + }); cy.get("#examination_details").click().type(examinationDetails); cy.get("#weight").click().type(height); cy.get("#height").click().type(weight); @@ -39,10 +45,12 @@ export class PatientConsultationPage { cy.get( "#icd11_diagnoses_object input[placeholder='Select'][role='combobox']" ) + .scrollIntoView() .click() .type("1A"); cy.get("#icd11_diagnoses_object [role='option']") .contains("1A03 Intestinal infections due to Escherichia coli") + .scrollIntoView() .click(); cy.get("label[for='icd11_diagnoses_object']").click(); cy.wait("@getIcdResults").its("response.statusCode").should("eq", 200); diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 6c7e8a6760e..01a5f02b7b1 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -123,7 +123,7 @@ const initForm: FormDetails = { facility: "", admitted: "false", admitted_to: "", - category: "Comfort", + category: "", admission_date: new Date(), discharge_date: null, referred_to: "", @@ -373,8 +373,8 @@ export const ConsultationForm = (props: any) => { admitted_to: res.data.admitted_to ? res.data.admitted_to : "", category: res.data.category ? PATIENT_CATEGORIES.find((i) => i.text === res.data.category) - ?.id ?? "Comfort" - : "Comfort", + ?.id ?? "" + : "", patient_no: res.data.patient_no ?? "", OPconsultation: res.data.consultation_notes, is_telemedicine: `${res.data.is_telemedicine}`, diff --git a/src/Components/Patient/DailyRounds.tsx b/src/Components/Patient/DailyRounds.tsx index 351136e32d4..a84ad4a3e8b 100644 --- a/src/Components/Patient/DailyRounds.tsx +++ b/src/Components/Patient/DailyRounds.tsx @@ -42,7 +42,7 @@ const initForm: any = { other_symptoms: "", physical_examination_info: "", other_details: "", - patient_category: "Comfort", + patient_category: "", current_health: 0, recommend_discharge: false, action: null, @@ -142,14 +142,14 @@ export const DailyRounds = (props: any) => { ); if (!status.aborted) { - if (res && res.data) { + if (res?.data) { const data = { ...res.data, patient_category: res.data.patient_category ? PATIENT_CATEGORIES.find( (i) => i.text === res.data.patient_category - )?.id || "Comfort" - : "Comfort", + )?.id ?? "" + : "", rhythm: (res.data.rhythm && RHYTHM_CHOICES.find((i) => i.text === res.data.rhythm)?.id) || @@ -186,8 +186,8 @@ export const DailyRounds = (props: any) => { patient_category: res.data.patient_category ? PATIENT_CATEGORIES.find( (i) => i.text === res.data.patient_category - )?.id || "Comfort" - : "Comfort", + )?.id ?? "" + : "", rhythm: (res.data.rhythm && RHYTHM_CHOICES.find((i) => i.text === res.data.rhythm)?.id) || @@ -205,6 +205,12 @@ export const DailyRounds = (props: any) => { let invalidForm = false; Object.keys(state.form).forEach((field) => { switch (field) { + case "patient_category": + if (!state.form[field]) { + errors[field] = "Please select a category"; + invalidForm = true; + } + return; case "other_symptoms": if ( state.form.additional_symptoms?.includes(9) &&