Skip to content

Commit

Permalink
added newRoute consultation/:id
Browse files Browse the repository at this point in the history
  • Loading branch information
konavivekramakrishna committed Dec 21, 2023
1 parent 9fc041c commit a04c02a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
34 changes: 22 additions & 12 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ const symptomChoices = [...SYMPTOM_CHOICES];

export interface ConsultationTabProps {
consultationId: string;
facilityId: string;
patientId: string;
consultationData: ConsultationModel;
patientData: PatientModel;
}
Expand Down Expand Up @@ -149,6 +147,14 @@ export const ConsultationDetails = (props: any) => {
: "No",
is_vaccinated: patientData.is_vaccinated ? "Yes" : "No",
};
if (
facilityId != data.facility_object?.id ||
patientId != data.id
) {
navigate(
`/facility/${data.facility_object?.id}/patient/${data.id}/consultation/${data?.last_consultation?.id}`
);
}
setPatientData(data);
}

Expand All @@ -172,16 +178,14 @@ export const ConsultationDetails = (props: any) => {
useAbortableEffect((status: statusType) => {
fetchData(status);
triggerGoal("Patient Consultation Viewed", {
facilityId: facilityId,
facilityId: patientData?.facility_object?.id,
consultationId: consultationId,
userId: authUser.id,
});
}, []);

const consultationTabProps: ConsultationTabProps = {
consultationId,
facilityId,
patientId,
consultationData,
patientData,
};
Expand Down Expand Up @@ -256,8 +260,10 @@ export const ConsultationDetails = (props: any) => {
title="Patient Dashboard"
className="sm:m-0 sm:p-0"
crumbsReplacements={{
[facilityId]: { name: patientData?.facility_object?.name },
[patientId]: { name: patientData?.name },
[patientData?.facility_object?.id || ""]: {
name: patientData?.facility_object?.name,
},
[patientData?.id || ""]: { name: patientData?.name },
[consultationId]: {
name:
consultationData.suggestion === "A"
Expand Down Expand Up @@ -312,7 +318,7 @@ export const ConsultationDetails = (props: any) => {
onClick={() =>
showPatientNotesPopup
? navigate(
`/facility/${facilityId}/patient/${patientId}/notes`
`/facility/${patientData?.facility_object?.id}/patient/${patientData?.id}/notes`
)
: setShowPatientNotesPopup(true)
}
Expand Down Expand Up @@ -452,7 +458,11 @@ export const ConsultationDetails = (props: any) => {
<Link
key={p.text}
className={tabButtonClasses(tab === p.text)}
href={`/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}/${p.text.toLocaleLowerCase()}`}
href={`/facility/${
patientData?.facility_object?.id
}/patient/${
patientData?.id
}/consultation/${consultationId}/${p.text.toLocaleLowerCase()}`}
>
{p.desc}
</Link>
Expand All @@ -466,15 +476,15 @@ export const ConsultationDetails = (props: any) => {
</div>

<DoctorVideoSlideover
facilityId={facilityId}
facilityId={String(patientData?.facility_object?.id)}
show={showDoctors}
setShow={setShowDoctors}
/>

{showPatientNotesPopup && (
<PatientNotesSlideover
patientId={patientId}
facilityId={facilityId}
patientId={String(patientData?.id)}
facilityId={String(patientData?.facility_object?.id)}
consultationId={consultationId}
setShowPatientNotesPopup={setShowPatientNotesPopup}
/>
Expand Down
8 changes: 2 additions & 6 deletions src/Components/Facility/Consultations/DailyRoundsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ interface Props {
}

export default function DailyRoundsList({ consultation }: Props) {
const [facilityId, patientId, consultationId] = useSlugs(
"facility",
"patient",
"consultation"
);
const [consultationId] = useSlugs("consultation");
const { t } = useTranslation();

const consultationUrl = `/facility/${facilityId}/patient/${patientId}/consultation/${consultationId}`;
const consultationUrl = `/facility/${consultation.facility}/patient/${consultation.patient}/consultation/${consultation.id}`;

return (
<PaginatedList
Expand Down
3 changes: 3 additions & 0 deletions src/Routers/routes/ConsultationRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ export default {
tab={"updates"}
/>
),
"/consultation/:consultationId": ({ consultationId }: any) => (
<ConsultationDetails consultationId={consultationId} tab={"updates"} />
),
"/facility/:facilityId/patient/:patientId/consultation/:consultationId/treatment-summary":
({ facilityId, patientId, consultationId }: any) => (
<TreatmentSummary
Expand Down

0 comments on commit a04c02a

Please sign in to comment.