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

KHP3-6542:Radiology results fails to update from pending review to approved #92

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions src/radiology-tabs/approved/approved-orders.component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo, useState } from "react";

Check warning on line 1 in src/radiology-tabs/approved/approved-orders.component.tsx

View workflow job for this annotation

GitHub Actions / build

'useMemo' is defined but never used

Check warning on line 1 in src/radiology-tabs/approved/approved-orders.component.tsx

View workflow job for this annotation

GitHub Actions / build

'useState' is defined but never used
import { useTranslation } from "react-i18next";
import { DataTableSkeleton } from "@carbon/react";
import { useOrdersWorklist } from "../../hooks/useOrdersWorklist";
Expand All @@ -6,7 +6,10 @@

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 @@
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
Loading