Skip to content

Commit

Permalink
Merge pull request #10397 from ohcnetwork/rithviknishad/feat/filter-a…
Browse files Browse the repository at this point in the history
…llergies-if-encounter-completed

Filter allergies by encounter if encounter is marked as completed
  • Loading branch information
amjithtitus09 authored Feb 6, 2025
2 parents ae568f7 + c242c96 commit c65f395
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/Patient/allergy/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,32 @@ import { Avatar } from "@/components/Common/Avatar";
import query from "@/Utils/request/query";
import { AllergyIntolerance } from "@/types/emr/allergyIntolerance/allergyIntolerance";
import allergyIntoleranceApi from "@/types/emr/allergyIntolerance/allergyIntoleranceApi";
import { Encounter, completedEncounterStatus } from "@/types/emr/encounter";

interface AllergyListProps {
facilityId?: string;
patientId: string;
encounterId?: string;
encounterStatus?: Encounter["status"];
}

export function AllergyList({
facilityId,
patientId,
encounterId,
encounterStatus,
}: AllergyListProps) {
const [showEnteredInError, setShowEnteredInError] = useState(false);

const { data: allergies, isLoading } = useQuery({
queryKey: ["allergies", patientId, encounterId],
queryKey: ["allergies", patientId, encounterId, encounterStatus],
queryFn: query(allergyIntoleranceApi.getAllergy, {
pathParams: { patientId },
queryParams: {
encounter: completedEncounterStatus.includes(encounterStatus as string)
? encounterId
: undefined,
},
}),
});

Expand Down
1 change: 1 addition & 0 deletions src/pages/Encounters/tabs/EncounterUpdatesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const EncounterUpdatesTab = ({
facilityId={facilityId}
patientId={patient.id}
encounterId={encounter.id}
encounterStatus={encounter.status}
/>
</div>

Expand Down

0 comments on commit c65f395

Please sign in to comment.