Skip to content

Commit

Permalink
added patient registration form plugin hook
Browse files Browse the repository at this point in the history
  • Loading branch information
khavinshankar committed Jan 9, 2025
1 parent bd25bd4 commit 745d45e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/Patient/PatientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ import {
} from "@/common/constants";
import countryList from "@/common/static/countries.json";

import { PLUGIN_Component } from "@/PluginEngine";
import * as Notification from "@/Utils/Notifications";
import routes from "@/Utils/request/api";
import mutate from "@/Utils/request/mutate";
import query from "@/Utils/request/query";
import { parsePhoneNumber } from "@/Utils/utils";
import OrganizationSelector from "@/pages/Organization/components/OrganizationSelector";
import { PatientModel } from "@/types/emr/patient";
import { Organization } from "@/types/organization/organization";

import Autocomplete from "../ui/autocomplete";

Expand Down Expand Up @@ -256,6 +258,9 @@ export default function PatientRegistration(
same_address:
patientQuery.data.address === patientQuery.data.permanent_address,
yob_or_dob: patientQuery.data.date_of_birth ? "dob" : "age",
geo_organization: (
patientQuery.data.geo_organization as unknown as Organization
)?.id,
} as unknown as z.infer<typeof formSchema>);
}
}, [patientQuery.data]); // eslint-disable-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -289,6 +294,12 @@ export default function PatientRegistration(
className="md:w-[500px] space-y-10"
onSubmit={form.handleSubmit(onSubmit)}
>
<PLUGIN_Component
__name="PatientRegistrationForm"
form={form}
patientId={patientId}
/>

<div id="general-info" className="space-y-6">
<div>
<h2 className="text-lg font-semibold">
Expand Down Expand Up @@ -400,7 +411,7 @@ export default function PatientRegistration(
<RadioGroup
{...field}
onValueChange={field.onChange}
defaultValue={field.value}
value={field.value}
className="flex gap-5 flex-wrap"
>
{GENDER_TYPES.map((g) => (
Expand Down
7 changes: 7 additions & 0 deletions src/pluginTypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LazyExoticComponent } from "react";
import { UseFormReturn } from "react-hook-form";

import { FacilityModel } from "@/components/Facility/models";
import { UserAssignedModel } from "@/components/Users/models";
Expand All @@ -23,11 +24,17 @@ export type PatientHomeActionsComponentType = React.FC<{
className?: string;
}>;

export type PatientRegistrationFormComponentType = React.FC<{
form: UseFormReturn<any>; // eslint-disable-line @typescript-eslint/no-explicit-any
patientId?: string;
}>;

// Define supported plugin components
export type SupportedPluginComponents = {
DoctorConnectButtons: DoctorConnectButtonComponentType;
Scribe: ScribeComponentType;
PatientHomeActions: PatientHomeActionsComponentType;
PatientRegistrationForm: PatientRegistrationFormComponentType;
};

// Create a type for lazy-loaded components
Expand Down

0 comments on commit 745d45e

Please sign in to comment.