Skip to content

Commit

Permalink
KHP3-6542:Radiology results fails to update from pending review to ap…
Browse files Browse the repository at this point in the history
…proved
  • Loading branch information
makombe committed Oct 2, 2024
1 parent 4c329bb commit 49c6d49
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/radiology-tabs/approved/approved-orders.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import GroupedOrdersTable from "../common/groupedOrdersTable.component";

export const ApprovedOrders: React.FC = () => {
const { t } = useTranslation();
const { workListEntries, isLoading } = useOrdersWorklist("", "ON_HOLD");
const { workListEntries, isLoading } = useOrdersWorklist("", "COMPLETED");
const approved = workListEntries.filter((item) =>
item.procedures?.some((procedure) => procedure.outcome === "SUCCESSFUL")
);

if (isLoading) {
return <DataTableSkeleton />;
Expand All @@ -15,7 +18,7 @@ export const ApprovedOrders: React.FC = () => {
return (
<div>
<GroupedOrdersTable
orders={workListEntries}
orders={approved}
showStatus={false}
showStartButton={false}
showActions={false}
Expand Down
14 changes: 11 additions & 3 deletions src/radiology-tabs/radiology-tabs.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ import { Review } from "./review-ordered/review-ordered.component";
import { ApprovedOrders } from "./approved/approved-orders.component";
import { OrdersNotDone } from "./orders-not-done/orders-not-done.component";
import { useProcedureOrderStats } from "../summary-tiles/radiology-summary.resource";
import { useOrdersWorklist } from "../hooks/useOrdersWorklist";

export const RadiologyTabs: React.FC = () => {
const { t } = useTranslation();

const { count: activeOrdersCount } = useProcedureOrderStats("");
const { count: workListCount } = useProcedureOrderStats("IN_PROGRESS");
const { count: referredTestsCount } = useProcedureOrderStats("EXCEPTION");
const { count: reviewCount } = useProcedureOrderStats("COMPLETED");
const { count: approvedOrdersCount } = useProcedureOrderStats("ON_HOLD");
const { count: ordersNotDoneCount } = useProcedureOrderStats("DECLINED");
const { workListEntries } = useOrdersWorklist("", "COMPLETED");
const pendingReview = workListEntries.filter((item) =>
item.procedures?.some((procedure) => procedure.outcome !== "SUCCESSFUL")
);
const pendingReviewCount = pendingReview?.length ?? 0;
const approved = workListEntries.filter((item) =>
item.procedures?.some((procedure) => procedure.outcome === "SUCCESSFUL")
);
const approvedOrdersCount = approved?.length ?? 0;

return (
<div>
Expand All @@ -37,7 +45,7 @@ export const RadiologyTabs: React.FC = () => {
{t("referredProcedures", "Referred Out")} ({referredTestsCount})
</Tab>
<Tab>
{t("review", "Pending Review")} ({reviewCount})
{t("review", "Pending Review")} ({pendingReviewCount})
</Tab>
<Tab>
{t("approved", "Approved")} ({approvedOrdersCount})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import { DataTableSkeleton } from "@carbon/react";

export const Review: React.FC = () => {
const { workListEntries, isLoading } = useOrdersWorklist("", "COMPLETED");

const pendingReview = workListEntries.filter((item) =>
item.procedures?.some((procedure) => procedure.outcome !== "SUCCESSFUL")
);
return isLoading ? (
<DataTableSkeleton />
) : (
<div>
<GroupedOrdersTable
orders={workListEntries}
orders={pendingReview}
showStatus={false}
showStartButton={false}
showActions={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ const ReviewOrderDialog: React.FC<ReviewOrderDialogProps> = ({
undefined,
{ revalidate: true }
);

mutate(
(key) =>
typeof key === "string" && key.startsWith("/ws/rest/v1/order"),
undefined,
{ revalidate: true }
);
})
.catch((error) => {
showNotification({
Expand Down
9 changes: 8 additions & 1 deletion src/results/result-form.component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useMemo, useState } from "react";
import { mutate } from "swr";
import styles from "./result-form.scss";
import {
Button,
Expand Down Expand Up @@ -57,7 +58,7 @@ const ProcedureReportForm: React.FC<ResultFormProps> = ({
}, [patient, patientUuid]);

if (isLoadingConcepts) {
return <div>Loading test details</div>;
return <div>{t("loadingTestDetails", "Loading test details")}</div>;
}

const onSubmit = (data, e) => {
Expand Down Expand Up @@ -85,6 +86,12 @@ const ProcedureReportForm: React.FC<ResultFormProps> = ({
),
});
closeOverlay();
mutate(
(key) =>
typeof key === "string" && key.startsWith("/ws/rest/v1/order"),
undefined,
{ revalidate: true }
);
},
(err) => {
showNotification({
Expand Down

0 comments on commit 49c6d49

Please sign in to comment.