diff --git a/cypress/e2e/patient_spec/patient_prescription.cy.ts b/cypress/e2e/patient_spec/patient_prescription.cy.ts index 3cf5a1ba5aa..d9a7bf7a080 100644 --- a/cypress/e2e/patient_spec/patient_prescription.cy.ts +++ b/cypress/e2e/patient_spec/patient_prescription.cy.ts @@ -5,6 +5,11 @@ import { PatientPage } from "../../pageobject/Patient/PatientCreation"; const patientPrescription = new PatientPrescription(); const loginPage = new LoginPage(); const patientPage = new PatientPage(); +const medicineName = "DOLO"; +const medicineBaseDosage = "4"; +const medicineTargetDosage = "9"; +const medicineFrequency = "Twice daily"; +const medicineAdministerNote = "Medicine Administration Note"; describe("Patient Medicine Administration", () => { before(() => { @@ -18,15 +23,54 @@ describe("Patient Medicine Administration", () => { cy.awaitUrl("/patients"); }); + it("Add a new titrated medicine for a patient | Individual Administeration |", () => { + patientPage.visitPatient("Dummy Patient 5"); + patientPrescription.visitMedicineTab(); + patientPrescription.visitEditPrescription(); + patientPrescription.clickAddPrescription(); + patientPrescription.interceptMedibase(); + patientPrescription.selectMedicinebox(); + patientPrescription.selectMedicine(medicineName); + patientPrescription.clickTitratedDosage(); + patientPrescription.enterDosage(medicineBaseDosage); + patientPrescription.enterTargetDosage(medicineTargetDosage); + patientPrescription.selectDosageFrequency(medicineFrequency); + cy.submitButton("Submit"); + cy.verifyNotification("Medicine prescribed"); + cy.closeNotification(); + // Administer the medicine in edit form + patientPrescription.clickAdministerButton(); + patientPrescription.enterAdministerDosage(medicineBaseDosage); + patientPrescription.enterAdministerNotes(medicineAdministerNote); + cy.submitButton("Administer Medicine"); + cy.verifyNotification("Medicine(s) administered"); + cy.closeNotification(); + // Verify the Reflection on the Medicine + cy.verifyContentPresence("#medicine-preview", [ + medicineName, + medicineBaseDosage, + medicineTargetDosage, + ]); + patientPrescription.clickReturnToDashboard(); + // Go to medicine tab and administer it again + patientPrescription.visitMedicineTab(); + cy.verifyAndClickElement("#0", medicineName); + cy.submitButton("Administer"); + patientPrescription.enterAdministerDosage(medicineBaseDosage); + cy.submitButton("Administer Medicine"); + cy.verifyNotification("Medicine(s) administered"); + }); + it("Add a new medicine for a patient and verify the duplicate medicine validation", () => { patientPage.visitPatient("Dummy Patient 4"); patientPrescription.visitMedicineTab(); + patientPrescription.visitEditPrescription(); patientPrescription.clickAddPrescription(); patientPrescription.interceptMedibase(); patientPrescription.selectMedicinebox(); - patientPrescription.selectMedicine("DOLO"); - patientPrescription.enterDosage("4"); - patientPrescription.selectDosageFrequency("Twice daily"); + patientPrescription.selectMedicine(medicineName); + patientPrescription.enterDosage(medicineBaseDosage); + patientPrescription.selectDosageFrequency(medicineFrequency); cy.submitButton("Submit"); cy.verifyNotification("Medicine prescribed"); cy.closeNotification(); @@ -34,9 +78,9 @@ describe("Patient Medicine Administration", () => { patientPrescription.clickAddPrescription(); patientPrescription.interceptMedibase(); patientPrescription.selectMedicinebox(); - patientPrescription.selectMedicine("DOLO"); - patientPrescription.enterDosage("4"); - patientPrescription.selectDosageFrequency("Twice daily"); + patientPrescription.selectMedicine(medicineName); + patientPrescription.enterDosage(medicineBaseDosage); + patientPrescription.selectDosageFrequency(medicineFrequency); cy.submitButton("Submit"); cy.verifyNotification( "Medicine - This medicine is already prescribed to this patient. Please discontinue the existing prescription to prescribe again.", diff --git a/cypress/e2e/shifting_spec/filter.cy.ts b/cypress/e2e/shifting_spec/filter.cy.ts index a142a657013..82fad9d99e4 100644 --- a/cypress/e2e/shifting_spec/filter.cy.ts +++ b/cypress/e2e/shifting_spec/filter.cy.ts @@ -20,7 +20,7 @@ describe("Shifting section filter", () => { shiftingPage.filterByFacility( "Dummy Shifting", "Dummy Shifting", - "District" + "District", ); shiftingPage.facilityAssignedBadge().should("exist"); @@ -32,13 +32,10 @@ describe("Shifting section filter", () => { "ASC Created Date", "yes", "yes", - "POSITIVE", "no", "MODERATE", - "9999999999" + "9999999999", ); - - shiftingPage.diseaseStatusBadge().should("exist"); shiftingPage.orderingBadge().should("exist"); shiftingPage.breathlessnessLevelBadge().should("exist"); shiftingPage.phoneNumberBadge().should("exist"); diff --git a/cypress/pageobject/Patient/PatientPrescription.ts b/cypress/pageobject/Patient/PatientPrescription.ts index dc4163e4823..a4b92b0a5fa 100644 --- a/cypress/pageobject/Patient/PatientPrescription.ts +++ b/cypress/pageobject/Patient/PatientPrescription.ts @@ -1,8 +1,10 @@ export class PatientPrescription { clickAddPrescription() { - cy.contains("button", "Add Prescription Medication") - .should("be.visible") - .click(); + cy.get("#add-prescription").scrollIntoView(); + cy.verifyAndClickElement( + "#add-prescription", + "Add Prescription Medication", + ); } interceptMedibase() { @@ -16,6 +18,15 @@ export class PatientPrescription { ); } + clickTitratedDosage() { + cy.get("#titrated-dosage").click(); + } + + clickAdministerButton() { + cy.get("#administer-medicine").should("be.visible"); + cy.verifyAndClickElement("#administer-medicine", "Administer"); + } + selectMedicinebox() { cy.get( "div#medicine_object input[placeholder='Select'][role='combobox']", @@ -30,6 +41,18 @@ export class PatientPrescription { cy.get("#base_dosage").type(doseAmount, { force: true }); } + enterAdministerDosage(dosage: string) { + cy.get("#dosage").type(dosage); + } + + enterAdministerNotes(notes: string) { + cy.get("#administration_notes").type(notes); + } + + enterTargetDosage(targetDosage: string) { + cy.get("#target_dosage").type(targetDosage, { force: true }); + } + selectDosageFrequency(frequency: string) { cy.clickAndSelectOption("#frequency", frequency); } @@ -54,7 +77,10 @@ export class PatientPrescription { visitMedicineTab() { cy.get("#consultation_tab_nav").scrollIntoView(); cy.get("#consultation_tab_nav").contains("Medicines").click(); - cy.get("a[href='prescriptions']").first().click(); + } + + visitEditPrescription() { + cy.get("#edit-prescription").click(); } } export default PatientPrescription; diff --git a/cypress/pageobject/Shift/ShiftFilters.ts b/cypress/pageobject/Shift/ShiftFilters.ts index 87d3f33c37e..1f824cebbb3 100644 --- a/cypress/pageobject/Shift/ShiftFilters.ts +++ b/cypress/pageobject/Shift/ShiftFilters.ts @@ -27,10 +27,6 @@ class ShiftingPage { return cy.get("#is-up-shift"); } - diseaseStatusInput() { - return cy.get("#disease-status"); - } - isAntenatalInput() { return cy.get("#is-antenatal"); } @@ -63,10 +59,6 @@ class ShiftingPage { return cy.get("[data-testid='Current facility']"); } - diseaseStatusBadge() { - return cy.get("[data-testid='Disease status']"); - } - orderingBadge() { return cy.get("[data-testid='Ordering']"); } @@ -98,7 +90,7 @@ class ShiftingPage { filterByFacility( origin_facility: string, assigned_facility: string, - assigned_to: string + assigned_to: string, ) { this.originFacilityInput().click().type(origin_facility); cy.get("[role='option']").contains(origin_facility).click(); @@ -116,10 +108,9 @@ class ShiftingPage { ordering: string, emergency: string, is_up_shift: string, - disease_status: string, is_antenatal: string, breathlessness_level: string, - patient_phone_number: string + patient_phone_number: string, ) { this.orderingInput().click(); cy.get("[role='option']").contains(ordering).click(); @@ -130,9 +121,6 @@ class ShiftingPage { this.isUpShiftInput().click(); cy.get("[role='option']").contains(is_up_shift).click(); - this.diseaseStatusInput().click(); - cy.get("[role='option']").contains(disease_status).click(); - this.isAntenatalInput().click(); cy.get("[role='option']").contains(is_antenatal).click(); @@ -148,7 +136,7 @@ class ShiftingPage { created_date_start: string, created_date_end: string, modified_date_start: string, - modified_date_end: string + modified_date_end: string, ) { this.createdDateStartInput().click(); cy.get("[id^='headlessui-popover-panel-'] .care-l-angle-left-b") diff --git a/src/Common/constants.tsx b/src/Common/constants.tsx index 3d6352b3260..10cdbdbcc7f 100644 --- a/src/Common/constants.tsx +++ b/src/Common/constants.tsx @@ -470,13 +470,6 @@ export const SAMPLE_FLOW_RULES = { RECEIVED_AT_LAB: ["COMPLETED"], }; -export const DISEASE_STATUS = [ - "POSITIVE", - "SUSPECTED", - "NEGATIVE", - "RECOVERED", -]; - export const TEST_TYPE = [ "UNK", "ANTIGEN", diff --git a/src/Common/hooks/useNotificationSubscriptionState.ts b/src/Common/hooks/useNotificationSubscriptionState.ts new file mode 100644 index 00000000000..b7927e0cc70 --- /dev/null +++ b/src/Common/hooks/useNotificationSubscriptionState.ts @@ -0,0 +1,55 @@ +import { useEffect, useState } from "react"; +import routes from "../../Redux/api"; +import request from "../../Utils/request/request"; +import useAuthUser from "./useAuthUser"; +import * as Sentry from "@sentry/browser"; + +export type NotificationSubscriptionState = + | "unsubscribed" + | "subscribed" + | "subscribed_on_other_device" + | "subscribed" + | "pending" + | "error"; + +/** + * This is a temporary hook and will be removed in the future. + * + * This hook is used to get the initial notification subscription state of the user. + * @returns NotificationSubscriptionState + */ +export default function useNotificationSubscriptionState( + dependencies: any[] = [], +) { + const { username } = useAuthUser(); + const [subscriptionState, setSubscriptionState] = + useState("pending"); + + const getSubscriptionState = async () => { + try { + const res = await request(routes.getUserPnconfig, { + pathParams: { username }, + }); + + const reg = await navigator.serviceWorker.ready; + const subscription = await reg.pushManager.getSubscription(); + + if (!subscription && !res.data?.pf_endpoint) { + setSubscriptionState("unsubscribed"); + } else if (subscription?.endpoint !== res.data?.pf_endpoint) { + setSubscriptionState("subscribed_on_other_device"); + } else { + setSubscriptionState("subscribed"); + } + } catch (error) { + setSubscriptionState("error"); + Sentry.captureException(error); + } + }; + + useEffect(() => { + getSubscriptionState(); + }, [username, ...dependencies]); + + return subscriptionState; +} diff --git a/src/Components/ABDM/ABDMFacilityRecords.tsx b/src/Components/ABDM/ABDMFacilityRecords.tsx index 8178e037a7f..96040905d6c 100644 --- a/src/Components/ABDM/ABDMFacilityRecords.tsx +++ b/src/Components/ABDM/ABDMFacilityRecords.tsx @@ -4,6 +4,8 @@ import useQuery from "../../Utils/request/useQuery"; import { formatDateTime } from "../../Utils/utils"; import Loading from "../Common/Loading"; import Page from "../Common/components/Page"; +import CareIcon from "../../CAREUI/icons/CareIcon"; +import ButtonV2 from "../Common/components/ButtonV2"; interface IProps { facilityId: string; @@ -21,7 +23,11 @@ const TableHeads = [ ]; export default function ABDMFacilityRecords({ facilityId }: IProps) { - const { data: consentsResult, loading } = useQuery(routes.abha.listConsents, { + const { + data: consentsResult, + loading, + refetch, + } = useQuery(routes.abha.listConsents, { query: { facility: facilityId, ordering: "-created_date" }, }); @@ -53,6 +59,13 @@ export default function ABDMFacilityRecords({ facilityId }: IProps) { scope="col" className="sticky right-0 top-0 py-3.5 pl-3 pr-4 sm:pr-6" > + refetch()} + ghost + className="max-w-2xl text-sm text-gray-700 hover:text-gray-900" + > + Refresh + View diff --git a/src/Components/ABDM/FetchRecordsModal.tsx b/src/Components/ABDM/FetchRecordsModal.tsx index 8273a9763f1..950b69611c4 100644 --- a/src/Components/ABDM/FetchRecordsModal.tsx +++ b/src/Components/ABDM/FetchRecordsModal.tsx @@ -21,6 +21,7 @@ import CircularProgress from "../Common/components/CircularProgress.js"; import CareIcon from "../../CAREUI/icons/CareIcon.js"; import { classNames } from "../../Utils/utils.js"; import { ConsentHIType, ConsentPurpose } from "./types/consent.js"; +import useNotificationSubscriptionState from "../../Common/hooks/useNotificationSubscriptionState.js"; const getDate = (value: any) => value && dayjs(value).isValid() && dayjs(value).toDate(); @@ -46,6 +47,9 @@ export default function FetchRecordsModal({ patient, show, onClose }: IProps) { dayjs().add(30, "day").toDate(), ); const [errors, setErrors] = useState({}); + const notificationSubscriptionState = useNotificationSubscriptionState([ + show, + ]); useMessageListener((data) => { if (data.type === "MESSAGE" && data.from === "patients/on_find") { @@ -62,7 +66,23 @@ export default function FetchRecordsModal({ patient, show, onClose }: IProps) { }); return ( - + + {["unsubscribed", "subscribed_on_other_device"].includes( + notificationSubscriptionState, + ) && ( +

+ {" "} + Notifications needs to be enabled on this device to verify the + patient. +

+ )} +
Request Consent diff --git a/src/Components/Facility/PatientNotesSlideover.tsx b/src/Components/Facility/PatientNotesSlideover.tsx index 3fd46f92f57..e2da270e532 100644 --- a/src/Components/Facility/PatientNotesSlideover.tsx +++ b/src/Components/Facility/PatientNotesSlideover.tsx @@ -12,9 +12,9 @@ import routes from "../../Redux/api"; import { PatientNoteStateType } from "./models"; import useKeyboardShortcut from "use-keyboard-shortcut"; import AutoExpandingTextInputFormField from "../Form/FormFields/AutoExpandingTextInputFormField.js"; -import * as Sentry from "@sentry/browser"; import useAuthUser from "../../Common/hooks/useAuthUser"; import { PATIENT_NOTES_THREADS } from "../../Common/constants.js"; +import useNotificationSubscriptionState from "../../Common/hooks/useNotificationSubscriptionState.js"; interface PatientNotesProps { patientId: string; @@ -25,6 +25,7 @@ interface PatientNotesProps { export default function PatientNotesSlideover(props: PatientNotesProps) { const authUser = useAuthUser(); + const notificationSubscriptionState = useNotificationSubscriptionState(); const [thread, setThread] = useState( authUser.user_type === "Nurse" ? PATIENT_NOTES_THREADS.Nurses @@ -35,32 +36,17 @@ export default function PatientNotesSlideover(props: PatientNotesProps) { const [reload, setReload] = useState(false); const [focused, setFocused] = useState(false); - const { username } = useAuthUser(); - - const intialSubscriptionState = async () => { - try { - const res = await request(routes.getUserPnconfig, { - pathParams: { username }, + useEffect(() => { + if (notificationSubscriptionState === "unsubscribed") { + Notification.Warn({ + msg: "Please subscribe to notifications to get live updates on discussion notes.", + }); + } else if (notificationSubscriptionState === "subscribed_on_other_device") { + Notification.Warn({ + msg: "Please subscribe to notifications on this device to get live updates on discussion notes.", }); - const reg = await navigator.serviceWorker.ready; - const subscription = await reg.pushManager.getSubscription(); - if (!subscription && !res.data?.pf_endpoint) { - Notification.Warn({ - msg: "Please subscribe to notifications to get live updates on discussion notes.", - }); - } else if (subscription?.endpoint !== res.data?.pf_endpoint) { - Notification.Warn({ - msg: "Please subscribe to notifications on this device to get live updates on discussion notes.", - }); - } - } catch (error) { - Sentry.captureException(error); } - }; - - useEffect(() => { - intialSubscriptionState(); - }, []); + }, [notificationSubscriptionState]); const initialData: PatientNoteStateType = { notes: [], diff --git a/src/Components/Medicine/CreatePrescriptionForm.tsx b/src/Components/Medicine/CreatePrescriptionForm.tsx index b918d5781fe..173f5163427 100644 --- a/src/Components/Medicine/CreatePrescriptionForm.tsx +++ b/src/Components/Medicine/CreatePrescriptionForm.tsx @@ -64,6 +64,7 @@ export default function CreatePrescriptionForm(props: { {props.prescription.dosage_type !== "PRN" && props.prescription.prescription_type !== "DISCHARGE" && ( -
+

diff --git a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx index b13e05b5b58..0949189d96d 100644 --- a/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx +++ b/src/Components/Medicine/MedicineAdministrationSheet/AdministrationEventCell.tsx @@ -62,6 +62,7 @@ export default function AdministrationEventCell({ />

- {patientData.is_vaccinated ? ( + {patientData.is_vaccinated && ( - ) : ( - )} {patientData.allow_transfer ? ( { )} )} - {patientData.contact_with_confirmed_carrier && ( - - )} - {patientData.contact_with_suspected_carrier && ( - - )} {patientData.past_travel && ( { activeShiftingData.results.map((shift: any) => (
-
+
diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index cd99d169544..7a88c478bba 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -37,7 +37,27 @@ import { Mews } from "../Facility/Consultations/Mews.js"; import DischargeSummaryModal from "../Facility/DischargeSummaryModal.js"; import DischargeModal from "../Facility/DischargeModal.js"; import { useTranslation } from "react-i18next"; +import useQuery from "../../Utils/request/useQuery.js"; import FetchRecordsModal from "../ABDM/FetchRecordsModal.js"; +import { SkillModel } from "../Users/models.js"; + +const formatSkills = (arr: SkillModel[]) => { + const skills = arr.map((skill) => skill.skill_object.name); + + if (skills.length === 1) { + return skills[0]; + } + + if (skills.length === 2) { + return `${skills[0]} and ${skills[1]}`; + } + + if (skills.length === 3) { + return `${skills[0]}, ${skills[1]} and ${skills[2]}`; + } + + return `${skills[0]}, ${skills[1]} and ${skills.length - 2} other skills...`; +}; export default function PatientInfoCard(props: { patient: PatientModel; @@ -113,6 +133,12 @@ export default function PatientInfoCard(props: { return false; }; + const skillsQuery = useQuery(routes.userListSkill, { + pathParams: { + username: consultation?.treating_physician_object?.username ?? "", + }, + prefetch: !!consultation?.treating_physician_object?.username, + }); return ( <> @@ -450,7 +476,7 @@ export default function PatientInfoCard(props: { : null} {(consultation?.treating_physician_object || consultation?.deprecated_verified_by) && ( -
+ {t("treating_doctor")}:{" "} @@ -459,9 +485,21 @@ export default function PatientInfoCard(props: { : consultation?.deprecated_verified_by} -
+
+ + {!!skillsQuery.data?.results?.length && + formatSkills(skillsQuery.data?.results)} + {(skillsQuery.data?.results?.length || 0) > 3 && ( +
    + {skillsQuery.data?.results.map((skill) => ( +
  • {skill.skill_object.name}
  • + ))} +
+ )} +
+ )}
diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index c62ad2a8a0d..07e682c137f 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -2,11 +2,9 @@ import * as Notification from "../../Utils/Notifications.js"; import { BLOOD_GROUPS, - DISEASE_STATUS, GENDER_TYPES, MEDICAL_HISTORY_CHOICES, OCCUPATION_TYPES, - TEST_TYPE, VACCINES, } from "../../Common/constants"; import { @@ -89,11 +87,9 @@ const medicalHistoryChoices = MEDICAL_HISTORY_CHOICES.reduce( [], ); const genderTypes = GENDER_TYPES; -const diseaseStatus = [...DISEASE_STATUS]; const bloodGroups = [...BLOOD_GROUPS]; const occupationTypes = OCCUPATION_TYPES; -const testType = [...TEST_TYPE]; -const vaccines = ["Select", ...VACCINES]; +const vaccines = [...VACCINES]; const initForm: any = { name: "", @@ -103,7 +99,6 @@ const initForm: any = { phone_number: "+91", emergency_phone_number: "+91", blood_group: "", - disease_status: diseaseStatus[2], is_declared_positive: "false", date_declared_positive: new Date(), date_of_birth: null, @@ -121,25 +116,13 @@ const initForm: any = { allergies: "", pincode: "", present_health: "", - contact_with_confirmed_carrier: "false", - contact_with_suspected_carrier: "false", - - estimated_contact_date: null, date_of_return: null, - - number_of_primary_contacts: "", - number_of_secondary_contacts: "", is_antenatal: "false", date_of_test: null, - date_of_result: null, - test_id: "", - srf_id: "", - test_type: testType[0], treatment_plan: false, ongoing_medication: "", designation_of_health_care_worker: "", instituion_of_health_care_worker: "", - cluster_name: "", covin_id: "", is_vaccinated: "false", number_of_doses: "0", @@ -323,14 +306,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { ? parseGenderFromExt(data.gender, state.form.gender) : state.form.gender, }); - field.onChange({ - name: "test_id", - value: data.test_id ? data.test_id : state.form.test_id, - }); - field.onChange({ - name: "srf_id", - value: data.srf_id ? data.srf_id : state.form.srf_id, - }); field.onChange({ name: "state", value: data.district_object @@ -353,28 +328,12 @@ export const PatientRegister = (props: PatientRegisterProps) => { name: "village", value: data.village ? data.village : state.form.village, }); - field.onChange({ - name: "disease_status", - value: data.result - ? data.result.toUpperCase() - : state.form.disease_status, - }); - field.onChange({ - name: "test_type", - value: data.test_type - ? data.test_type.toUpperCase() - : state.form.test_type, - }); field.onChange({ name: "date_of_test", value: data.sample_collection_date ? data.sample_collection_date : state.form.date_of_test, }); - field.onChange({ - name: "date_of_result", - value: data.result_date ? data.result_date : state.form.date_of_result, - }); field.onChange({ name: "phone_number", value: data.mobile_number @@ -416,7 +375,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { health_id: data.abha_number_object?.health_id || "", nationality: data.nationality ? data.nationality : "India", gender: data.gender ? data.gender : undefined, - cluster_name: data.cluster_name ? data.cluster_name : "", state: data.state ? data.state : "", district: data.district ? data.district : "", blood_group: data.blood_group @@ -453,19 +411,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { occupation: data.meta_info?.occupation ? parseOccupationFromExt(data.meta_info.occupation) : null, - - number_of_primary_contacts: data.number_of_primary_contacts - ? data.number_of_primary_contacts - : "", - number_of_secondary_contacts: data.number_of_secondary_contacts - ? data.number_of_secondary_contacts - : "", - contact_with_confirmed_carrier: data.contact_with_confirmed_carrier - ? String(data.contact_with_confirmed_carrier) - : "false", - contact_with_suspected_carrier: data.contact_with_suspected_carrier - ? String(data.contact_with_suspected_carrier) - : "false", is_vaccinated: String(data.is_vaccinated), number_of_doses: data.number_of_doses ? String(data.number_of_doses) @@ -645,39 +590,11 @@ export const PatientRegister = (props: PatientRegisterProps) => { errors[field] = "Please enter valid phone number"; } return; - - case "estimated_contact_date": - if ( - JSON.parse(form.contact_with_confirmed_carrier) || - JSON.parse(form.contact_with_suspected_carrier) - ) { - if (!form[field]) { - errors[field] = "Please enter the estimated date of contact"; - } - } - return; - case "cluster_name": - if ( - JSON.parse(form.contact_with_confirmed_carrier) || - JSON.parse(form.contact_with_suspected_carrier) - ) { - if (!form[field]) { - errors[field] = "Please enter the name / cluster of the contact"; - } - } - return; case "blood_group": if (!form[field]) { errors[field] = "Please select a blood group"; } return; - case "number_of_primary_contacts": - case "number_of_secondary_contacts": - if (form[field] && form[field] < 0) { - errors[field] = "Value cannot be negative"; - } - return; - case "is_vaccinated": if (form.is_vaccinated === "true") { if (form.number_of_doses === "0") { @@ -694,23 +611,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { } } return; - - case "date_of_result": - if (form[field] < form.date_of_test) { - errors[field] = - "Date should not be before the date of sample collection"; - } - return; - case "disease_status": - if (form[field] === "POSITIVE") { - if (!form.date_of_test) { - errors["date_of_test"] = "Please fill the date of sample testing"; - } - if (!form.date_of_result) { - errors["date_of_result"] = "Please fill the date of result"; - } - } - return; case "medical_history": if (!form[field].length) { errors[field] = "Please fill the medical history"; @@ -780,18 +680,12 @@ export const PatientRegister = (props: PatientRegisterProps) => { ? dateQueryString(formData.date_of_birth) : null, year_of_birth: ageInputType === "age" ? formData.year_of_birth : null, - disease_status: formData.disease_status, date_of_test: formData.date_of_test ? formData.date_of_test : undefined, - date_of_result: formData.date_of_result - ? formData.date_of_result - : undefined, date_declared_positive: JSON.parse(formData.is_declared_positive) && formData.date_declared_positive ? formData.date_declared_positive : null, - test_id: formData.test_id, - srf_id: formData.srf_id, covin_id: formData.is_vaccinated === "true" ? formData.covin_id : undefined, is_vaccinated: formData.is_vaccinated, @@ -811,7 +705,6 @@ export const PatientRegister = (props: PatientRegisterProps) => { ? formData.last_vaccinated_date : null : null, - test_type: formData.test_type, name: _.startCase(_.toLower(formData.name)), pincode: formData.pincode ? formData.pincode : undefined, gender: Number(formData.gender), @@ -847,33 +740,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { present_health: formData.present_health ? formData.present_health : undefined, - contact_with_confirmed_carrier: JSON.parse( - formData.contact_with_confirmed_carrier, - ), - contact_with_suspected_carrier: JSON.parse( - formData.contact_with_suspected_carrier, - ), - estimated_contact_date: - (JSON.parse(formData.contact_with_confirmed_carrier) || - JSON.parse(formData.contact_with_suspected_carrier)) && - formData.estimated_contact_date - ? formData.estimated_contact_date - : null, - cluster_name: - (JSON.parse(formData.contact_with_confirmed_carrier) || - JSON.parse(formData.contact_with_suspected_carrier)) && - formData.cluster_name - ? formData.cluster_name - : null, allergies: formData.allergies, - number_of_primary_contacts: Number(formData.number_of_primary_contacts) - ? Number(formData.number_of_primary_contacts) - : undefined, - number_of_secondary_contacts: Number( - formData.number_of_secondary_contacts, - ) - ? Number(formData.number_of_secondary_contacts) - : undefined, ongoing_medication: formData.ongoing_medication, is_declared_positive: JSON.parse(formData.is_declared_positive), designation_of_health_care_worker: @@ -1864,7 +1731,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { >
-
+
{ optionValue={(option) => option.value} />
-
- option.label} - optionValue={(option) => option.value} - /> -
-
- option.label} - optionValue={(option) => option.value} - /> -
{
} - -
-
- -
- -
- -
-
-
-
- o} - optionValue={(o) => o} - required - /> -
-
- o} - optionValue={(o) => o} - required - /> -
-
- -
+
+
{
-
- -
-
{ position="LEFT" />
-
- -
- -
- -
-
- -
diff --git a/src/Components/Patient/models.tsx b/src/Components/Patient/models.tsx index 81a06ff659d..b6f6fae7ea2 100644 --- a/src/Components/Patient/models.tsx +++ b/src/Components/Patient/models.tsx @@ -49,7 +49,6 @@ export interface AbhaObject { } export interface PatientModel { - test_id?: string; id?: string; action?: number; name?: string; @@ -87,19 +86,14 @@ export interface PatientModel { sameAddress?: boolean; village?: string; pincode?: number; - contact_with_confirmed_carrier?: boolean; - contact_with_suspected_carrier?: boolean; is_medical_worker?: boolean; designation_of_health_care_worker?: string; instituion_of_health_care_worker?: string; frontline_worker?: string; - estimated_contact_date?: string; past_travel?: boolean; ongoing_medication?: string; countries_travelled?: Array; transit_details?: string; - number_of_primary_contacts?: number; - number_of_secondary_contacts?: number; present_health?: string; has_SARI?: boolean; local_body?: number; @@ -107,11 +101,8 @@ export interface PatientModel { state?: number; nationality?: string; passport_no?: string; - disease_status?: string; - test_type?: string; date_of_test?: string; - date_of_result?: string; - srf_id?: string; + date_of_result?: string; // keeping this to avoid errors in Death report covin_id?: string; is_vaccinated?: boolean; vaccine_name?: string; @@ -124,7 +115,6 @@ export interface PatientModel { review_interval?: number; review_time?: string; date_of_return?: string; - cluster_name?: string; number_of_aged_dependents?: number; number_of_chronic_diseased_dependents?: number; will_donate_blood?: boolean; diff --git a/src/Components/Shifting/BadgesList.tsx b/src/Components/Shifting/BadgesList.tsx index 4490d948cbd..b16d831a96b 100644 --- a/src/Components/Shifting/BadgesList.tsx +++ b/src/Components/Shifting/BadgesList.tsx @@ -48,7 +48,6 @@ export default function BadgesList(props: any) { badge(t("patient_name"), "patient_name"), ...dateRange(t("created"), "created_date"), ...dateRange(t("modified"), "modified_date"), - badge(t("disease_status"), "disease_status"), badge(t("breathlessness_level"), "breathlessness_level"), value( t("assigned_to"), diff --git a/src/Components/Shifting/Commons.tsx b/src/Components/Shifting/Commons.tsx index 57f0b1f8209..284b6e4ce5a 100644 --- a/src/Components/Shifting/Commons.tsx +++ b/src/Components/Shifting/Commons.tsx @@ -19,7 +19,6 @@ export const initialFilterData = { ordering: null, is_kasp: "", assigned_to: "", - disease_status: "", is_antenatal: "", breathlessness_level: "", }; @@ -55,7 +54,6 @@ export const formatFilter = (params: any) => { patient_phone_number: filter.patient_phone_number || undefined, ordering: filter.ordering || undefined, assigned_to: filter.assigned_to || undefined, - disease_status: filter.disease_status || undefined, breathlessness_level: filter.breathlessness_level || undefined, is_kasp: (filter.is_kasp && filter.is_kasp) === "" diff --git a/src/Components/Shifting/ListFilter.tsx b/src/Components/Shifting/ListFilter.tsx index 09393dfdb5c..af98f524ed2 100644 --- a/src/Components/Shifting/ListFilter.tsx +++ b/src/Components/Shifting/ListFilter.tsx @@ -1,6 +1,5 @@ import { BREATHLESSNESS_LEVEL, - DISEASE_STATUS, SHIFTING_FILTER_ORDER, } from "../../Common/constants"; import { DateRange } from "../Common/DateRangeInputV2"; @@ -60,7 +59,6 @@ export default function ListFilter(props: any) { status: filter.status || null, assigned_user_ref: null, assigned_to: filter.assigned_to || "", - disease_status: filter.disease_status || "", is_antenatal: filter.is_antenatal || "", breathlessness_level: filter.breathlessness_level || "", @@ -155,7 +153,6 @@ export default function ListFilter(props: any) { is_kasp, status, assigned_to, - disease_status, is_antenatal, breathlessness_level, } = filterState; @@ -177,7 +174,6 @@ export default function ListFilter(props: any) { is_kasp: is_kasp || "", status: status || "", assigned_to: assigned_to || "", - disease_status: disease_status || "", is_antenatal: is_antenatal || "", breathlessness_level: breathlessness_level || "", }; @@ -340,19 +336,6 @@ export default function ListFilter(props: any) { errorClassName="hidden" /> - option} - optionValue={(option) => option} - onChange={(option) => handleFormFieldChange(option)} - errorClassName="hidden" - /> - (
-
+
diff --git a/src/Components/Shifting/ShiftDetails.tsx b/src/Components/Shifting/ShiftDetails.tsx index 5d29e0c890a..457f110c271 100644 --- a/src/Components/Shifting/ShiftDetails.tsx +++ b/src/Components/Shifting/ShiftDetails.tsx @@ -4,7 +4,6 @@ import { GENDER_TYPES, SHIFTING_CHOICES_PEACETIME, SHIFTING_CHOICES_WARTIME, - TEST_TYPE_CHOICES, } from "../../Common/constants"; import { Link, navigate } from "raviger"; import { lazy, useState } from "react"; @@ -85,10 +84,6 @@ export default function ShiftDetails(props: { id: string }) { const copyContent = (data: any) => { let formattedText = - t("disease_status") + - ": *" + - data?.patient_object?.disease_status + - "* \n" + t("name") + ":" + data?.patient_object?.name + @@ -129,9 +124,6 @@ export default function ShiftDetails(props: { id: string }) { const patientGender = GENDER_TYPES.find( (i) => i.id === patientData?.gender, )?.text; - const testType = TEST_TYPE_CHOICES.find( - (i) => i.id === patientData?.test_type, - )?.text; return (
@@ -150,20 +142,6 @@ export default function ShiftDetails(props: { id: string }) { {t("yes")}
)} -
- - {t("disease_status")}{" "} - - - {patientData?.disease_status} - -
-
- - {t("test_type")}:{" "} - - {(patientData?.test_type && testType) || "-"} -
{t("facility")}:{" "} @@ -319,9 +297,6 @@ export default function ShiftDetails(props: { id: string }) { const patientGender = GENDER_TYPES.find( (i) => i.id === patientData?.gender, )?.text; - const testType = TEST_TYPE_CHOICES.find( - (i) => i.id === patientData?.test_type, - )?.text; return (
@@ -427,12 +402,6 @@ export default function ShiftDetails(props: { id: string }) { formatDateTime(patientData?.date_of_test)) || "-"}
-
- - {t("test_type")}:{" "} - - {(patientData?.test_type && testType) || "-"} -
{/*
diff --git a/src/Components/Shifting/ShiftingBoard.tsx b/src/Components/Shifting/ShiftingBoard.tsx index 088f3d66276..3203b5027f5 100644 --- a/src/Components/Shifting/ShiftingBoard.tsx +++ b/src/Components/Shifting/ShiftingBoard.tsx @@ -82,12 +82,7 @@ const ShiftCard = ({ shift, filter }: any) => { cursor: isDragging ? "grabbing" : "grab", }} > -
+
@@ -316,7 +311,6 @@ export default function ShiftingBoard({ filterProp.ordering, filterProp.is_kasp, filterProp.assigned_to, - filterProp.disease_status, filterProp.is_antenatal, filterProp.breathlessness_level, ]);