Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consultationDetails.tsx file broken down into smaller components fixes #5830 #5838

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/Common/constants.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { IConfig } from "./hooks/useConfig";
import { PatientCategory } from "../Components/Facility/models";
import {
ConsultationModel,
PatientCategory,
} from "../Components/Facility/models";
import { SortOption } from "../Components/Common/SortDropdown";
import moment from "moment";
import { parsePhoneNumberFromString } from "libphonenumber-js";
import { PatientModel } from "../Components/Patient/models";

export const RESULTS_PER_PAGE_LIMIT = 14;
export const PAGINATION_LIMIT = 36;
Expand All @@ -22,6 +26,17 @@ export interface OptionsType {
disabled?: boolean;
}

export interface ConsultationTabProps {
// necessary props received for each tab
consultationData: ConsultationModel;
hl7SocketUrl?: string;
ventilatorSocketUrl?: string;
nazrul7711 marked this conversation as resolved.
Show resolved Hide resolved
patientData: PatientModel;
facilityId: any;
patientId: any;
consultationId: any;
}

export type UserRole =
| "Pharmacist"
| "Volunteer"
Expand Down
23 changes: 23 additions & 0 deletions src/Components/Facility/ConsultationABGTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ConsultationTabProps } from "../../Common/constants";
import PageTitle from "../Common/PageTitle";
import { ABGPlots } from "./Consultations/ABGPlots";
export default function ConsultationABGTab({
facilityId,
patientId,
consultationId,
}: ConsultationTabProps) {
return (
<div>
<PageTitle
title="ABG Analysis Plot"
hideBack={true}
breadcrumbs={false}
/>
nazrul7711 marked this conversation as resolved.
Show resolved Hide resolved
<ABGPlots
facilityId={facilityId}
patientId={patientId}
consultationId={consultationId}
></ABGPlots>
</div>
);
}
818 changes: 52 additions & 766 deletions src/Components/Facility/ConsultationDetails.tsx

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/Components/Facility/ConsultationDialysisTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ConsultationTabProps } from "../../Common/constants";
import PageTitle from "../Common/PageTitle";
import { DialysisPlots } from "./Consultations/DialysisPlots";
export default function ConsultationDialysisTab({
consultationId,
}: ConsultationTabProps) {
return (
<div>
<PageTitle title="Dialysis Plots" hideBack={true} breadcrumbs={false} />
<DialysisPlots consultationId={consultationId}></DialysisPlots>
</div>
);
}
24 changes: 24 additions & 0 deletions src/Components/Facility/ConsultationFeedTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ConsultationTabProps } from "../../Common/constants";
import PageTitle from "../Common/PageTitle";
import { Feed } from "./Consultations/Feed";
export default function ConsultationFeedTab({
facilityId,
patientId,
consultationId,
}: ConsultationTabProps) {
return (
<div>
<PageTitle
title="Camera Feed"
breadcrumbs={false}
hideBack={true}
focusOnLoad={true}
/>
<Feed
facilityId={facilityId}
patientId={patientId}
consultationId={consultationId}
/>
</div>
);
}
22 changes: 22 additions & 0 deletions src/Components/Facility/ConsultationFilesTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { FileUpload } from "../Patient/FileUpload";
import { ConsultationTabProps } from "../../Common/constants";

export default function ConsultationFilesTab({
facilityId,
patientId,
consultationId,
}: ConsultationTabProps) {
return (
<div>
<FileUpload
facilityId={facilityId}
patientId={patientId}
consultationId={consultationId}
type="CONSULTATION"
hideBack={true}
audio={true}
unspecified={true}
/>
</div>
);
}
44 changes: 44 additions & 0 deletions src/Components/Facility/ConsultationInvestigationsTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import ButtonV2 from "../Common/components/ButtonV2";
import { ConsultationTabProps } from "../../Common/constants";
import PageTitle from "../Common/PageTitle";
import CareIcon from "../../CAREUI/icons/CareIcon";
import InvestigationTab from "./Investigations/investigationsTab";
import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor";
import { navigate } from "raviger";
import { useTranslation } from "react-i18next";

export default function ConsultationInvestigationsTab({
patientData,
facilityId,
patientId,
consultationId,
}: ConsultationTabProps) {
const { t } = useTranslation();
return (
<div>
<div className="sm:flex justify-between">
<PageTitle title="Investigations" hideBack={true} breadcrumbs={false} />
<div className="pt-6">
<ButtonV2
authorizeFor={NonReadOnlyUsers}
disabled={!patientData.is_active}
onClick={() =>
navigate(
`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/investigation/`
)
}
>
<CareIcon className="care-l-plus" />
<span>{t("log_lab_results")}</span>
</ButtonV2>
</div>
</div>
<InvestigationTab
consultationId={consultationId}
facilityId={facilityId}
patientId={patientId}
patientData={patientData}
/>
</div>
);
}
38 changes: 38 additions & 0 deletions src/Components/Facility/ConsultationMedicinesTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useState } from "react";
import MedicineAdministrationsTable from "../Medicine/MedicineAdministrationsTable";
import PrescriptionsTable from "../Medicine/PrescriptionsTable";
import { ConsultationTabProps } from "../../Common/constants";

export default function ConsultationMedicinesTab({
consultationId,
consultationData,
}: ConsultationTabProps) {
const [medicinesKey, setMedicinesKey] = useState(0);
return (
<div>
<div className="mt-4">
<PrescriptionsTable
key={medicinesKey}
consultation_id={consultationId}
onChange={() => setMedicinesKey((k) => k + 1)}
readonly={!!consultationData.discharge_date}
/>
</div>
<div className="mt-8">
<PrescriptionsTable
key={medicinesKey}
consultation_id={consultationId}
is_prn
onChange={() => setMedicinesKey((k) => k + 1)}
readonly={!!consultationData.discharge_date}
/>
</div>
<div className="mt-8">
<MedicineAdministrationsTable
key={medicinesKey}
consultation_id={consultationId}
/>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ConsultationTabProps } from "../../Common/constants";
import PageTitle from "../Common/PageTitle";
import { NeurologicalTable } from "./Consultations/NeurologicalTables";
export default function ConsultationNeurologicalMonitoringTab({
facilityId,
patientId,
consultationId,
}: ConsultationTabProps) {
return (
<div>
<PageTitle
title="Neurological Monitoring"
hideBack={true}
breadcrumbs={false}
/>
<NeurologicalTable
facilityId={facilityId}
patientId={patientId}
consultationId={consultationId}
></NeurologicalTable>
</div>
);
}
20 changes: 20 additions & 0 deletions src/Components/Facility/ConsultationNursingTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import PageTitle from "../Common/PageTitle";
import { ConsultationTabProps } from "../../Common/constants";
import { NursingPlot } from "./Consultations/NursingPlot";

export default function ConsultationNursingTab({
facilityId,
patientId,
consultationId,
}: ConsultationTabProps) {
return (
<div>
<PageTitle title="Nursing Analysis" hideBack={true} breadcrumbs={false} />
<NursingPlot
facilityId={facilityId}
patientId={patientId}
consultationId={consultationId}
></NursingPlot>
</div>
);
}
19 changes: 19 additions & 0 deletions src/Components/Facility/ConsultationNutritionTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ConsultationTabProps } from "../../Common/constants";
import PageTitle from "../Common/PageTitle";
import { NutritionPlots } from "./Consultations/NutritionPlots";
export default function ConsultationNutritionTab({
facilityId,
patientId,
consultationId,
}: ConsultationTabProps) {
return (
<div>
<PageTitle title="Nutrition" hideBack={true} breadcrumbs={false} />
<NutritionPlots
facilityId={facilityId}
patientId={patientId}
consultationId={consultationId}
></NutritionPlots>
</div>
);
}
14 changes: 14 additions & 0 deletions src/Components/Facility/ConsultationPressureSoreTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ConsultationTabProps } from "../../Common/constants";
import { PressureSoreDiagrams } from "./Consultations/PressureSoreDiagrams";
import PageTitle from "../Common/PageTitle";

export default function ConsultationPressureSoreTab({
consultationId,
}: ConsultationTabProps) {
return (
<div className="mt-4">
<PageTitle title="Pressure Sore" hideBack={true} breadcrumbs={false} />
<PressureSoreDiagrams consultationId={consultationId} />
</div>
);
}
23 changes: 23 additions & 0 deletions src/Components/Facility/ConsultationSummaryTab.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ConsultationTabProps } from "../../Common/constants";
import PageTitle from "../Common/PageTitle";
import { PrimaryParametersPlot } from "./Consultations/PrimaryParametersPlot";
export default function ConsultationSummaryTab({
facilityId,
patientId,
consultationId,
}: ConsultationTabProps) {
return (
<div className="mt-4">
<PageTitle
title="Primary Parameters Plot"
hideBack={true}
breadcrumbs={false}
/>
<PrimaryParametersPlot
facilityId={facilityId}
patientId={patientId}
consultationId={consultationId}
></PrimaryParametersPlot>
</div>
);
}
Loading