Skip to content

Commit

Permalink
Move Diagnoses data to Info Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 committed Jan 4, 2024
1 parent 1a0bd2c commit 6ff1813
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 64 deletions.
116 changes: 65 additions & 51 deletions src/Components/Facility/ConsultationDetails/ConsultationUpdatesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Chip from "../../../CAREUI/display/Chip";
import { formatAge, formatDate, formatDateTime } from "../../../Utils/utils";
import ReadMore from "../../Common/components/Readmore";
import DailyRoundsList from "../Consultations/DailyRoundsList";
import LegacyDiagnosesList from "../../Diagnosis/LegacyDiagnosesList";

const PageTitle = lazy(() => import("../../Common/PageTitle"));

Expand Down Expand Up @@ -615,58 +616,71 @@ export const ConsultationUpdatesTab = (props: ConsultationTabProps) => {
</div>
</div>
)}

<div className="mt-4 overflow-hidden rounded-lg bg-white shadow">
<div className="px-4 py-5 sm:p-6">
<h3 className="text-lg font-semibold leading-relaxed text-gray-900">
Body Details
</h3>
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<div>
Gender {" - "}
<span className="font-semibold">
{props.patientData.gender ?? "-"}
</span>
</div>
<div>
Age {" - "}
<span className="font-semibold">
{props.patientData.age !== undefined // 0 is a valid age, so we need to check for undefined
? formatAge(
props.patientData.age,
props.patientData.date_of_birth
)
: "-"}
</span>
</div>
<div>
Weight {" - "}
<span className="font-semibold">
{props.consultationData.weight ?? "-"} Kg
</span>
</div>
<div>
Height {" - "}
<span className="font-semibold">
{props.consultationData.height ?? "-"} cm
</span>
</div>
<div>
Body Surface Area {" - "}
<span className="font-semibold">
{Math.sqrt(
(Number(props.consultationData.weight) *
Number(props.consultationData.height)) /
3600
).toFixed(2)}{" "}
m<sup>2</sup>
</span>
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<div className="col-span-1 mt-4 overflow-hidden rounded-lg bg-white shadow">
<div className="px-4 py-5 sm:p-6">
<h3 className="text-lg font-semibold leading-relaxed text-gray-900">
Diagnoses
</h3>
<div className="mt-2">
<LegacyDiagnosesList
diagnoses={props.consultationData.diagnoses || []}
/>
</div>
<div>
Blood Group {" - "}
<span className="font-semibold">
{props.patientData.blood_group ?? "-"}
</span>
</div>
</div>
<div className="col-span-1 mt-4 overflow-hidden rounded-lg bg-white shadow">
<div className="px-4 py-5 sm:p-6">
<h3 className="text-lg font-semibold leading-relaxed text-gray-900">
Body Details
</h3>
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<div>
Gender {" - "}
<span className="font-semibold">
{props.patientData.gender ?? "-"}
</span>
</div>
<div>
Age {" - "}
<span className="font-semibold">
{props.patientData.age !== undefined // 0 is a valid age, so we need to check for undefined
? formatAge(
props.patientData.age,
props.patientData.date_of_birth
)
: "-"}
</span>
</div>
<div>
Weight {" - "}
<span className="font-semibold">
{props.consultationData.weight ?? "-"} Kg
</span>
</div>
<div>
Height {" - "}
<span className="font-semibold">
{props.consultationData.height ?? "-"} cm
</span>
</div>
<div>
Body Surface Area {" - "}
<span className="font-semibold">
{Math.sqrt(
(Number(props.consultationData.weight) *
Number(props.consultationData.height)) /
3600
).toFixed(2)}{" "}
m<sup>2</sup>
</span>
</div>
<div>
Blood Group {" - "}
<span className="font-semibold">
{props.patientData.blood_group ?? "-"}
</span>
</div>
</div>
</div>
</div>
Expand Down
31 changes: 18 additions & 13 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { ConsultationDialysisTab } from "./ConsultationDialysisTab";
import { ConsultationNeurologicalMonitoringTab } from "./ConsultationNeurologicalMonitoringTab";
import { ConsultationNutritionTab } from "./ConsultationNutritionTab";
import PatientNotesSlideover from "../PatientNotesSlideover";
import LegacyDiagnosesList from "../../Diagnosis/LegacyDiagnosesList";
import { AssetBedModel } from "../../Assets/AssetTypes";

const Loading = lazy(() => import("../../Common/Loading"));
Expand Down Expand Up @@ -377,18 +376,24 @@ export const ConsultationDetails = (props: any) => {

<div className="flex flex-col-reverse gap-2 px-4 lg:flex-row">
<div className="flex h-full w-3/4 flex-col">
{/*consultationData.other_symptoms && (
<div className="capitalize">
<span className="font-semibold leading-relaxed">
Other Symptoms:{" "}
</span>
{consultationData.other_symptoms}
</div>
)*/}

<LegacyDiagnosesList
diagnoses={consultationData.diagnoses || []}
/>
{consultationData.diagnoses?.length
? (() => {
const principal_diagnosis =
consultationData.diagnoses.find(
(diagnosis) => diagnosis.is_principal
);
return principal_diagnosis ? (
<div className="mt-2">
<div className="text-sm font-semibold">
Principal Diagnosis
</div>
<div className="text-sm">
{principal_diagnosis.diagnosis_object.label}
</div>
</div>
) : null;
})()
: null}

{(consultationData.treating_physician_object ||
consultationData.deprecated_verified_by) && (
Expand Down

0 comments on commit 6ff1813

Please sign in to comment.