diff --git a/src/Components/HCX/models.ts b/src/Components/HCX/models.ts
index 7e624c474d7..a8a9812d31d 100644
--- a/src/Components/HCX/models.ts
+++ b/src/Components/HCX/models.ts
@@ -26,8 +26,8 @@ export interface HCXPolicyModel {
patient_object?: PatientModel;
subscriber_id: string;
policy_id: string;
- insurer_id: string;
- insurer_name: string;
+ insurer_id?: string;
+ insurer_name?: string;
status?: HCXPolicyStatus;
priority?: "Immediate" | "Normal" | "Deferred";
purpose?: "Auth Requirements" | "Benefits" | "Discovery" | "Validation";
diff --git a/src/Components/Patient/InsuranceDetails.tsx b/src/Components/Patient/InsuranceDetails.tsx
new file mode 100644
index 00000000000..dc8df8ff8a9
--- /dev/null
+++ b/src/Components/Patient/InsuranceDetails.tsx
@@ -0,0 +1,62 @@
+import { lazy } from "react";
+
+import Page from "../Common/components/Page";
+
+import useQuery from "../../Utils/request/useQuery";
+import routes from "../../Redux/api";
+import { HCXPolicyModel } from "../HCX/models";
+import { InsuranceDetialsCard } from "./InsuranceDetailsCard";
+
+const Loading = lazy(() => import("../Common/Loading"));
+
+interface IProps {
+ facilityId: string;
+ id: string;
+}
+
+export const InsuranceDetails = (props: IProps) => {
+ const { facilityId, id } = props;
+
+ const { data: insuranceDetials, loading } = useQuery(routes.listHCXPolicies, {
+ query: {
+ patient: id,
+ },
+ });
+
+ if (loading) {
+ return ;
+ }
+
+ return (
+
+ {loading ? (
+
+ ) : insuranceDetials?.count === 0 ? (
+
+ No Insurance Details Available
+
+ ) : (
+
+ {insuranceDetials?.results.map((data: HCXPolicyModel) => (
+
+ ))}
+
+ )}
+
+ );
+};
diff --git a/src/Components/Patient/InsuranceDetailsCard.tsx b/src/Components/Patient/InsuranceDetailsCard.tsx
new file mode 100644
index 00000000000..b928ce7bffd
--- /dev/null
+++ b/src/Components/Patient/InsuranceDetailsCard.tsx
@@ -0,0 +1,78 @@
+import ButtonV2 from "../Common/components/ButtonV2";
+import { HCXPolicyModel } from "../HCX/models";
+import { navigate } from "raviger";
+
+interface InsuranceDetails {
+ data?: HCXPolicyModel;
+ showViewAllDetails?: boolean;
+}
+
+export const InsuranceDetialsCard = (props: InsuranceDetails) => {
+ const { data, showViewAllDetails } = props;
+
+ return (
+
+
+
+ Policy Details
+
+ {data ? (
+
+
+
+ Member ID
+
+
+ {data.subscriber_id || ""}
+
+
+
+
+ Policy ID / Policy Name
+
+
+ {data.policy_id || ""}
+
+
+
+
+ Insurer ID
+
+
+ {data.insurer_id || ""}
+
+
+
+
+ Insurer Name
+
+
+ {data.insurer_name || ""}
+
+
+ {showViewAllDetails && (
+
+
+ {
+ navigate(
+ `/facility/${data.patient_object?.facility_object?.id}/patient/${data.patient_object?.id}/insurance`
+ );
+ }}
+ className="h-auto whitespace-pre-wrap border border-gray-500 bg-white text-black hover:bg-gray-300"
+ >
+ View All Details
+
+
+
+ )}
+
+ ) : (
+
+ No Insurance Details Available
+
+ )}
+
+
+ );
+};
diff --git a/src/Components/Patient/PatientHome.tsx b/src/Components/Patient/PatientHome.tsx
index a8f2335d484..fad482934ac 100644
--- a/src/Components/Patient/PatientHome.tsx
+++ b/src/Components/Patient/PatientHome.tsx
@@ -32,6 +32,9 @@ import UserAutocompleteFormField from "../Common/UserAutocompleteFormField";
import dayjs from "../../Utils/dayjs";
import { triggerGoal } from "../../Integrations/Plausible";
import useAuthUser from "../../Common/hooks/useAuthUser";
+import useQuery from "../../Utils/request/useQuery";
+import routes from "../../Redux/api";
+import { InsuranceDetialsCard } from "./InsuranceDetailsCard";
const Loading = lazy(() => import("../Common/Loading"));
@@ -91,6 +94,13 @@ export const PatientHome = (props: any) => {
});
};
+ const { data: insuranceDetials } = useQuery(routes.listHCXPolicies, {
+ query: {
+ patient: id,
+ limit: 1,
+ },
+ });
+
const handleAssignedVolunteer = () => {
dispatch(
patchPatient(
@@ -975,7 +985,7 @@ export const PatientHome = (props: any) => {
@@ -1110,6 +1120,14 @@ export const PatientHome = (props: any) => {
+
+ 1
+ }
+ />
diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx
index 8217c3ab14c..a69914bddb7 100644
--- a/src/Redux/api.tsx
+++ b/src/Redux/api.tsx
@@ -58,6 +58,7 @@ import {
import { IComment, IResource } from "../Components/Resource/models";
import { IShift } from "../Components/Shifting/models";
+import { HCXPolicyModel } from "../Components/HCX/models";
/**
* A fake function that returns an empty object casted to type T
@@ -1232,6 +1233,7 @@ const routes = {
listHCXPolicies: {
path: "/api/v1/hcx/policy/",
method: "GET",
+ TRes: Type
>(),
},
createHCXPolicy: {
diff --git a/src/Routers/routes/PatientRoutes.tsx b/src/Routers/routes/PatientRoutes.tsx
index ae594d767ec..ce2798c4492 100644
--- a/src/Routers/routes/PatientRoutes.tsx
+++ b/src/Routers/routes/PatientRoutes.tsx
@@ -6,6 +6,7 @@ import PatientNotes from "../../Components/Patient/PatientNotes";
import { PatientRegister } from "../../Components/Patient/PatientRegister";
import { DetailRoute } from "../types";
import DeathReport from "../../Components/DeathReport/DeathReport";
+import { InsuranceDetails } from "../../Components/Patient/InsuranceDetails";
export default {
"/patients": () => ,
@@ -21,6 +22,9 @@ export default {
"/facility/:facilityId/patient/:id": ({ facilityId, id }: any) => (
),
+ "/facility/:facilityId/patient/:id/insurance": ({ facilityId, id }: any) => (
+
+ ),
"/facility/:facilityId/patient/:id/update": ({ facilityId, id }: any) => (
),