+
+
{consultationData?.facility_name}
+
+
+
+ {t("treatment_summary__heading")}
+
-
-
- {consultationData?.facility_name ?? ""}
-
+
{formatDate(date)}
-
INTERIM TREATMENT SUMMARY
+
+
-
{formatDate(date)}
+
-
-
-
- Name : {patientData?.name ?? ""}
-
-
- Address : {patientData?.address ?? ""}
-
-
+
-
-
-
- Age :{" "}
- {patientData ? formatPatientAge(patientData, true) : ""}
-
-
- OP : {consultationData?.patient_no ?? ""}
-
-
+
-
- {consultationData?.suggestion === "DC" ? (
- Date of domiciliary care commenced :
- ) : (
- Date of admission :
- )}
-
- {consultationData?.encounter_date
- ? formatDateTime(consultationData.encounter_date)
- : " --/--/----"}
-
-
-
+
-
-
- Gender :
- {GENDER_TYPES.find((i) => i.id === patientData?.gender)?.text}
-
+
-
- Contact person :
-
- {" "}
- {patientData?.emergency_phone_number
- ? patientData.emergency_phone_number
- : " -"}
-
-
+
+
+
+
+
+ );
+}
-
-
Comorbidities :
-
-
-
-
- Disease |
- Details |
-
-
-
- {patientData?.medical_history &&
- patientData.medical_history.length > 0 ? (
- patientData.medical_history.map(
- (obj: any, index: number) => {
- return (
-
-
- {obj["disease"]}
- |
-
- {obj["details"] ? obj["details"] : "---"}
- |
-
- );
- },
- )
- ) : (
-
-
- ---
- |
-
- ---
- |
-
- )}
-
-
-
-
+interface IBasicDetailsSection {
+ patientData?: PatientModel;
+ consultationData?: ConsultationModel;
+}
-
-
Diagnosis :
-
-
- History of present illness :
- {consultationData?.history_of_present_illness
- ? consultationData.history_of_present_illness
- : " ---"}
-
-
-
- Examination details and clinical conditions :
- {consultationData?.examination_details
- ? consultationData.examination_details
- : " ---"}
-
-
-
- Physical Examination info :
- {consultationData?.last_daily_round?.physical_examination_info
- ? consultationData.last_daily_round
- ?.physical_examination_info
- : " ---"}
-
-
-
+function BasicDetailsSection({
+ patientData,
+ consultationData,
+}: IBasicDetailsSection) {
+ const { t } = useTranslation();
-
-
General Instructions :
- {patientData?.last_consultation?.consultation_notes ? (
-
- {patientData.last_consultation.consultation_notes}
-
- ) : (
- " ---"
- )}
-
+ return (
+ <>
+
+
+ {t("patient_registration__name")} : {patientData?.name ?? ""}
+
+
+ {t("patient_registration__address")} :{" "}
+ {patientData?.address ?? ""}
+
+
-
-
Relevant investigations :
-
-
-
-
-
-
- Date
- |
-
- Name
- |
-
- Result
- |
-
- Ideal value
- |
-
- values range
- |
-
- unit
- |
-
-
-
-
- {investigations && investigations.results.length > 0 ? (
- investigations.results.map(
- (value: any, index: number) => {
- return (
-
-
- {formatDate(
- value["session_object"][
- "session_created_date"
- ],
- )}
- |
-
- {value["investigation_object"]["name"]}
- |
-
- {value["notes"] || value["value"]}
- |
-
- {value["investigation_object"]["ideal_value"] ||
- "-"}
- |
-
- {value["investigation_object"]["min_value"]} -{" "}
- {value["investigation_object"]["max_value"]}
- |
-
- {value["investigation_object"]["unit"] || "-"}
- |
-
- );
- },
- )
- ) : (
-
-
- ---
- |
-
- ---
- |
-
- ---
- |
-
- ---
- |
-
- ---
- |
-
- ---
- |
-
- )}
-
-
+
+
+
+ {t("patient_registration__age")} :{" "}
+ {patientData ? formatPatientAge(patientData, true) : ""}
+
+
+
+ {consultationData?.suggestion === "A"
+ ? t("patient_consultation__ip")
+ : t("patient_consultation__op")}{" "}
+ :
+ {" "}
+ {consultationData?.patient_no ?? ""}
+
+
+
+
+ {consultationData?.suggestion === "DC" ? (
+ {t("patient_consultation__dc_admission")} :
+ ) : (
+ {t("patient_consultation__admission")} :
+ )}{" "}
+
+ {consultationData?.encounter_date
+ ? formatDateTime(consultationData.encounter_date)
+ : t("empty_date_time")}
+
+
+
+
+
+
+ {t("patient_registration__gender")} :{" "}
+ {GENDER_TYPES.find((i) => i.id === patientData?.gender)?.text}
+
+
+
+ {t("patient_registration__contact")} :{" "}
+ {patientData?.emergency_phone_number ?? ""}
+
+
+ >
+ );
+}
+
+interface IComorbiditiesSection {
+ patientData?: PatientModel;
+}
+
+function ComorbiditiesSection({ patientData }: IComorbiditiesSection) {
+ const { t } = useTranslation();
+
+ return patientData?.medical_history?.filter(
+ (comorbidities) => comorbidities.disease !== "NO",
+ ).length ? (
+
+
{t("patient_registration__comorbidities")}
+
+
+
+
+
+ {t("patient_registration__comorbidities__disease")}
+ |
+
+ {t("patient_registration__comorbidities__details")}
+ |
+
+
+
+ {patientData.medical_history.map((obj, index) => {
+ return (
+
+
+ {obj["disease"]}
+ |
+
+ {obj["details"] || "---"}
+ |
+
+ );
+ })}
+
+
+
+
+ ) : null;
+}
+
+interface IDiagnosisSection {
+ consultationData?: ConsultationModel;
+}
+
+type DiagnosisType =
+ | (typeof ActiveConditionVerificationStatuses)[number]
+ | "principal";
+
+function DiagnosisSection({ consultationData }: IDiagnosisSection) {
+ const { t } = useTranslation();
+
+ const diagnoses = useMemo(() => {
+ return consultationData?.diagnoses?.reduce(
+ (acc, curr) => {
+ if (curr.is_principal) {
+ acc.principal.push(curr);
+ } else if (
+ ActiveConditionVerificationStatuses.includes(
+ curr.verification_status as (typeof ActiveConditionVerificationStatuses)[number],
+ )
+ ) {
+ acc[curr.verification_status as keyof typeof acc].push(curr);
+ }
+
+ return acc;
+ },
+ {
+ principal: [],
+ confirmed: [],
+ provisional: [],
+ unconfirmed: [],
+ differential: [],
+ } as Record
,
+ );
+ }, [consultationData?.diagnoses]);
+
+ if (!diagnoses) {
+ return null;
+ }
+
+ return (
+
+
{t("diagnosis")}
+
+ {(
+ [
+ "principal",
+ "confirmed",
+ "provisional",
+ "unconfirmed",
+ "differential",
+ ] as DiagnosisType[]
+ ).map(
+ (type) =>
+ !!diagnoses[type].length && (
+
+
+ {t(`diagnosis__${type}`)} {t("diagnosis")}
+
+
+ {diagnoses[type].map((d) => (
+ -
+ {d.diagnosis_object.label}
+ {d.is_principal && (
+
+ {t(`diagnosis__${d.verification_status}`)}
+
+ )}
+
+ ))}
+
-
+ ),
+ )}
+
+
+ );
+}
+
+interface IInvestigationsSection {
+ consultationId: string;
+}
+
+function InvestigationsSection({ consultationId }: IInvestigationsSection) {
+ const { t } = useTranslation();
+
+ const { data: investigations } = useQuery(routes.getInvestigation, {
+ pathParams: { consultation_external_id: consultationId },
+ prefetch: consultationId !== undefined,
+ });
+
+ return investigations?.results.length ? (
+
+
{t("suggested_investigations")}
+
+
+
+
+
+
+ {t("investigations__date")}
+ |
+
+ {t("investigations__name")}
+ |
+
+ {t("investigations__result")}
+ |
+
+ {t("investigations__ideal_value")}
+ |
+
+ {t("investigations__range")}
+ |
+
+ {t("investigations__unit")}
+ |
+
+
+
+
+ {investigations?.results.map((value, index) => (
+
+
+ {formatDate(value["session_object"]["session_created_date"])}
+ |
+
+ {value["investigation_object"]["name"]}
+ |
+
+ {value["notes"] || value["value"]}
+ |
+
+ {value["investigation_object"]["ideal_value"] || "-"}
+ |
+
+ {value["investigation_object"]["min_value"]} -{" "}
+ {value["investigation_object"]["max_value"]}
+ |
+
+ {value["investigation_object"]["unit"] || "-"}
+ |
+
+ ))}
+
+
+
+
+ ) : null;
+}
+
+interface ITreatmentSection {
+ consultationData?: ConsultationModel;
+}
+
+function TreatmentSection({ consultationData }: ITreatmentSection) {
+ const { t } = useTranslation();
-
-
Treatment :
- {consultationData?.treatment_plan ? (
-
{consultationData.treatment_plan}
- ) : (
-
---
- )}
-
Treatment summary/Treament Plan :
-
-
-
-
-
- Date |
- Spo2 |
-
- Temperature
- |
-
-
-
-
- {consultationData?.last_daily_round ? (
-
-
- {formatDateTime(
- consultationData.last_daily_round.modified_date,
- )}
- |
-
- {consultationData.last_daily_round.ventilator_spo2 ||
- "-"}
- |
-
- {consultationData.last_daily_round.temperature || "-"}
- |
-
- ) : (
-
-
- ---
- |
-
- ---
- |
-
- ---
- |
-
+ const isTreatmentSummaryAvailable = useMemo(() => {
+ return (
+ consultationData?.last_daily_round &&
+ (consultationData.last_daily_round.ventilator_spo2 ||
+ consultationData.last_daily_round.temperature)
+ );
+ }, [consultationData]);
+
+ return consultationData?.treatment_plan || isTreatmentSummaryAvailable ? (
+
+ {consultationData?.treatment_plan && (
+ <>
+
{t("patient_consultation__treatment__plan")}
+
{consultationData.treatment_plan}
+ >
+ )}
+
+ {isTreatmentSummaryAvailable && (
+ <>
+
+ {t("patient_consultation__treatment__summary")}
+
+
+
+
+
+
+ {t("patient_consultation__treatment__summary__date")}
+ |
+
+ {t("patient_consultation__treatment__summary__spo2")}
+ |
+
+ {t("patient_consultation__treatment__summary__temperature")}
+ |
+
+
+
+
+
+
+ {formatDateTime(
+ consultationData?.last_daily_round?.modified_date,
)}
- |
-
-
-
+
+
+ {consultationData?.last_daily_round?.ventilator_spo2 || "-"}
+ |
+
+ {consultationData?.last_daily_round?.temperature || "-"}
+ |
+
+
+
-
+ >
+ )}
+
+ ) : null;
+}
+
+interface IPrescriptionsSection {
+ consultationId: string;
+}
+
+function PrescriptionsSection({ consultationId }: IPrescriptionsSection) {
+ const { t } = useTranslation();
+
+ const { data: prescriptions } = useQuery(MedicineRoutes.listPrescriptions, {
+ pathParams: { consultation: consultationId },
+ query: { discontinued: false },
+ });
+
+ return prescriptions?.results.length ? (
+
+
{t("active_prescriptions")}
+
+
+
+
+
+
+ {t("prescriptions__medicine")}
+ |
+
+ {t("prescriptions__route")}
+ |
+
+ {t("prescriptions__dosage_frequency")}
+ |
+
+ {t("prescriptions__start_date")}
+ |
+
+
+
+
+ {prescriptions?.results.map((prescription, index) => (
+
+
+ {prescription.medicine_object?.name ?? "-"}
+ |
+
+ {prescription.route ?? "-"}
+ |
+
+ {prescription.dosage_type !== "TITRATED" ? (
+ {prescription.base_dosage}
+ ) : (
+
+ {prescription.base_dosage} - {prescription.target_dosage}
+
+ )}
+
+
+ {prescription.dosage_type !== "PRN"
+ ? t("PRESCRIPTION_FREQUENCY_" + prescription.frequency)
+ : prescription.indicator}
+
+ |
+
+ {formatDate(prescription.created_date)}
+ |
+
+ ))}
+
+
- );
-};
+ ) : null;
+}
+
+interface IInstructionsSection {
+ consultationData?: ConsultationModel;
+}
+
+function InstructionsSection({ consultationData }: IInstructionsSection) {
+ const { t } = useTranslation();
+
+ return (
+ <>
+ {consultationData?.consultation_notes && (
+
+
{t("patient_consultation__consultation_notes")}
+
+
{consultationData.consultation_notes}
+
+ )}
-export default TreatmentSummary;
+ {consultationData?.special_instruction && (
+
+
{t("patient_consultation__special_instruction")}
+
+
{consultationData.special_instruction}
+
+ )}
+ >
+ );
+}
diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx
index 5267edf1ca1..9ed52fb53f2 100644
--- a/src/Components/Facility/models.tsx
+++ b/src/Components/Facility/models.tsx
@@ -101,7 +101,12 @@ export interface OptionsType {
disabled?: boolean;
}
-export type PatientCategory = "Comfort Care" | "Mild" | "Moderate" | "Critical";
+export type PatientCategory =
+ | "Comfort Care" // Discontinued
+ | "Mild"
+ | "Moderate"
+ | "Critical"
+ | "Actively Dying";
export interface PatientConsentModel {
id: string;
@@ -277,16 +282,17 @@ export type ICD11DiagnosisModel = {
label: string;
};
-export type ABGPlotsFields =
- | "ph"
- | "pco2"
- | "po2"
- | "hco3"
- | "base_excess"
- | "lactate"
- | "sodium"
- | "potassium"
- | "ventilator_fio2";
+export const ABGPlotsFields = [
+ "ph",
+ "pco2",
+ "po2",
+ "hco3",
+ "base_excess",
+ "lactate",
+ "sodium",
+ "potassium",
+ "ventilator_fio2",
+] as const satisfies (keyof DailyRoundsModel)[];
export type ABGPlotsRes = {
ph: string;
@@ -300,33 +306,35 @@ export type ABGPlotsRes = {
ventilator_fio2: number;
};
-export type DialysisPlotsFields =
- | "dialysis_fluid_balance"
- | "dialysis_net_balance";
+export const DialysisPlotsFields = [
+ "dialysis_fluid_balance",
+ "dialysis_net_balance",
+] as const satisfies (keyof DailyRoundsModel)[];
export type DialysisPlotsRes = {
dialysis_fluid_balance: number;
dialysis_net_balance: number;
};
-export type NeurologicalTablesFields =
- | "consciousness_level"
- | "left_pupil_size"
- | "left_pupil_size_detail"
- | "right_pupil_size"
- | "right_pupil_size_detail"
- | "left_pupil_light_reaction"
- | "left_pupil_light_reaction_detail"
- | "right_pupil_light_reaction"
- | "right_pupil_light_reaction_detail"
- | "limb_response_upper_extremity_right"
- | "limb_response_upper_extremity_left"
- | "limb_response_lower_extremity_left"
- | "limb_response_lower_extremity_right"
- | "glasgow_eye_open"
- | "glasgow_verbal_response"
- | "glasgow_motor_response"
- | "glasgow_total_calculated";
+export const NeurologicalTablesFields = [
+ "consciousness_level",
+ "left_pupil_size",
+ "left_pupil_size_detail",
+ "right_pupil_size",
+ "right_pupil_size_detail",
+ "left_pupil_light_reaction",
+ "left_pupil_light_reaction_detail",
+ "right_pupil_light_reaction",
+ "right_pupil_light_reaction_detail",
+ "limb_response_upper_extremity_right",
+ "limb_response_upper_extremity_left",
+ "limb_response_lower_extremity_left",
+ "limb_response_lower_extremity_right",
+ "glasgow_eye_open",
+ "glasgow_verbal_response",
+ "glasgow_motor_response",
+ "glasgow_total_calculated",
+] as const satisfies (keyof DailyRoundsModel)[];
export type NeurologicalTablesRes = {
consciousness_level: number;
@@ -348,19 +356,36 @@ export type NeurologicalTablesRes = {
glasgow_total_calculated: number;
};
-export type NursingPlotFields = "nursing";
+export const NursingPlotFields = [
+ "nursing",
+] as const satisfies (keyof DailyRoundsModel)[];
export type NursingPlotRes = {
nursing: any[];
};
-export type NutritionPlotsFields =
- | "infusions"
- | "iv_fluids"
- | "feeds"
- | "total_intake_calculated"
- | "total_output_calculated"
- | "output";
+export const RoutineFields = [
+ "sleep",
+ "bowel_issue",
+ "bladder_drainage",
+ "bladder_issue",
+ "is_experiencing_dysuria",
+ "urination_frequency",
+ "nutrition_route",
+ "oral_issue",
+ "appetite",
+] as const satisfies (keyof DailyRoundsModel)[];
+
+export type RoutineAnalysisRes = Record<(typeof RoutineFields)[number], any>;
+
+export const NutritionPlotsFields = [
+ "infusions",
+ "iv_fluids",
+ "feeds",
+ "total_intake_calculated",
+ "total_output_calculated",
+ "output",
+] as const satisfies (keyof DailyRoundsModel)[];
export type NutritionPlotsRes = {
infusions: any[];
@@ -371,30 +396,35 @@ export type NutritionPlotsRes = {
output: any[];
};
-export type PainDiagramsFields = "pain_scale_enhanced";
+export const PainDiagramsFields = [
+ "pain_scale_enhanced",
+] as const satisfies (keyof DailyRoundsModel)[];
export type PainDiagramsRes = {
pain_scale_enhanced: any[];
};
-export type PressureSoreDiagramsFields = "pressure_sore";
+export const PressureSoreDiagramsFields = [
+ "pressure_sore",
+] as const satisfies (keyof DailyRoundsModel)[];
export type PressureSoreDiagramsRes = {
pressure_sore: any[];
};
-export type PrimaryParametersPlotFields =
- | "bp"
- | "pulse"
- | "temperature"
- | "resp"
- | "blood_sugar_level"
- | "insulin_intake_frequency"
- | "insulin_intake_dose"
- | "ventilator_spo2"
- | "ventilator_fio2"
- | "rhythm"
- | "rhythm_detail";
+export const PrimaryParametersPlotFields = [
+ "bp",
+ "pulse",
+ "temperature",
+ "resp",
+ "blood_sugar_level",
+ "insulin_intake_frequency",
+ "insulin_intake_dose",
+ "ventilator_spo2",
+ "ventilator_fio2",
+ "rhythm",
+ "rhythm_detail",
+] as const satisfies (keyof DailyRoundsModel)[];
export type PrimaryParametersPlotRes = {
bp: {
@@ -414,19 +444,20 @@ export type PrimaryParametersPlotRes = {
rhythm_detail: string;
};
-export type VentilatorPlotFields =
- | "ventilator_pip"
- | "ventilator_mean_airway_pressure"
- | "ventilator_resp_rate"
- | "ventilator_pressure_support"
- | "ventilator_tidal_volume"
- | "ventilator_peep"
- | "ventilator_fio2"
- | "ventilator_spo2"
- | "etco2"
- | "bilateral_air_entry"
- | "ventilator_oxygen_modality_oxygen_rate"
- | "ventilator_oxygen_modality_flow_rate";
+export const VentilatorPlotFields = [
+ "ventilator_pip",
+ "ventilator_mean_airway_pressure",
+ "ventilator_resp_rate",
+ "ventilator_pressure_support",
+ "ventilator_tidal_volume",
+ "ventilator_peep",
+ "ventilator_fio2",
+ "ventilator_spo2",
+ "etco2",
+ "bilateral_air_entry",
+ "ventilator_oxygen_modality_oxygen_rate",
+ "ventilator_oxygen_modality_flow_rate",
+] as const satisfies (keyof DailyRoundsModel)[];
export type VentilatorPlotRes = {
ventilator_pip: number;
@@ -446,15 +477,16 @@ export type VentilatorPlotRes = {
export interface DailyRoundsBody {
page?: number;
fields:
- | ABGPlotsFields[]
- | DialysisPlotsFields[]
- | NeurologicalTablesFields[]
- | NursingPlotFields[]
- | NutritionPlotsFields[]
- | PainDiagramsFields[]
- | PressureSoreDiagramsFields[]
- | PrimaryParametersPlotFields[]
- | VentilatorPlotFields[];
+ | typeof ABGPlotsFields
+ | typeof DialysisPlotsFields
+ | typeof NeurologicalTablesFields
+ | typeof NursingPlotFields
+ | typeof RoutineFields
+ | typeof NutritionPlotsFields
+ | typeof PainDiagramsFields
+ | typeof PressureSoreDiagramsFields
+ | typeof PrimaryParametersPlotFields
+ | typeof VentilatorPlotFields;
}
export interface DailyRoundsRes {
@@ -467,6 +499,7 @@ export interface DailyRoundsRes {
| DialysisPlotsRes
| NeurologicalTablesRes
| NursingPlotRes
+ | RoutineAnalysisRes
| NutritionPlotsRes
| PainDiagramsRes
| PrimaryParametersPlotRes
diff --git a/src/Components/Form/AutoCompleteAsync.tsx b/src/Components/Form/AutoCompleteAsync.tsx
index 9b4c1f876e4..1cd07a93df1 100644
--- a/src/Components/Form/AutoCompleteAsync.tsx
+++ b/src/Components/Form/AutoCompleteAsync.tsx
@@ -1,4 +1,3 @@
-import { useEffect, useState, useMemo } from "react";
import {
Combobox,
ComboboxButton,
@@ -6,15 +5,17 @@ import {
ComboboxOption,
ComboboxOptions,
} from "@headlessui/react";
-import { debounce } from "lodash-es";
-import { DropdownTransition } from "../Common/components/HelperComponents";
-import CareIcon from "../../CAREUI/icons/CareIcon";
import {
MultiSelectOptionChip,
dropdownOptionClassNames,
} from "./MultiSelectMenuV2";
-import { useTranslation } from "react-i18next";
+import { useEffect, useMemo, useState } from "react";
+
+import CareIcon from "../../CAREUI/icons/CareIcon";
+import { DropdownTransition } from "../Common/components/HelperComponents";
import { classNames } from "../../Utils/utils";
+import { debounce } from "lodash-es";
+import { useTranslation } from "react-i18next";
interface Props {
id?: string;
@@ -153,6 +154,7 @@ const AutoCompleteAsync = (props: Props) => {