diff --git a/.example.env b/.example.env index 8cee07d7925..5466250e094 100644 --- a/.example.env +++ b/.example.env @@ -67,5 +67,8 @@ REACT_JWT_TOKEN_REFRESH_INTERVAL= # Minimum encounter date (default: 2020-01-01) REACT_MIN_ENCOUNTER_DATE= +# Default Encounter Type (default: "hh" - Home Health) +REACT_DEFAULT_ENCOUNTER_TYPE= + # Available languages to switch between (2 Digit language code seperated by comas. See src->Locale->config.ts for available codes) REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn" diff --git a/care.config.ts b/care.config.ts index bf1ae695061..f48d842d262 100644 --- a/care.config.ts +++ b/care.config.ts @@ -1,3 +1,5 @@ +import { EncounterClass } from "@/types/emr/encounter"; + const env = import.meta.env; interface ILogo { @@ -48,6 +50,9 @@ const careConfig = { .split(",") .map((l) => l.trim()), + defaultEncounterType: (env.REACT_DEFAULT_ENCOUNTER_TYPE || + "hh") as EncounterClass, + gmapsApiKey: env.REACT_GMAPS_API_KEY || "AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk", diff --git a/src/components/Encounter/CreateEncounterForm.tsx b/src/components/Encounter/CreateEncounterForm.tsx index 8bc81f74865..39a5e8363e2 100644 --- a/src/components/Encounter/CreateEncounterForm.tsx +++ b/src/components/Encounter/CreateEncounterForm.tsx @@ -1,3 +1,4 @@ +import careConfig from "@careConfig"; import { zodResolver } from "@hookform/resolvers/zod"; import { useMutation, useQueryClient } from "@tanstack/react-query"; import { @@ -139,7 +140,7 @@ export default function CreateEncounterForm({ resolver: zodResolver(encounterFormSchema), defaultValues: { status: "planned", - encounter_class: encounterClass || "amb", + encounter_class: encounterClass || careConfig.defaultEncounterType, priority: "routine", organizations: [], }, diff --git a/src/types/notes/messages.ts b/src/types/notes/messages.ts index 92a88107930..bca88676392 100644 --- a/src/types/notes/messages.ts +++ b/src/types/notes/messages.ts @@ -7,4 +7,3 @@ export interface Message { created_by: UserBase; updated_by: UserBase; } - diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index f9cf1f9d763..bbaaef0c91d 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -27,6 +27,7 @@ interface ImportMetaEnv { readonly REACT_STILL_WATCHING_PROMPT_DURATION?: string; readonly REACT_JWT_TOKEN_REFRESH_INTERVAL?: string; readonly REACT_MIN_ENCOUNTER_DATE?: string; + readonly REACT_DEFAULT_ENCOUNTER_TYPE?: string; readonly REACT_ALLOWED_LOCALES?: string; readonly REACT_ENABLED_APPS?: string;