-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) O3-3124 Ward App - add patient serach for admitting patient
- Loading branch information
Showing
24 changed files
with
641 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/esm-ward-app/src/hooks/useInpatientAdmissionByPatients.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { restBaseUrl, useOpenmrsFetchAll } from '@openmrs/esm-framework'; | ||
import { type InpatientAdmission } from '../types'; | ||
|
||
/** | ||
* fetches a list of inpatient admissions (in any location) for the given patients | ||
*/ | ||
export function useInpatientAdmissionByPatients(patientUuids: string[]) { | ||
// prettier-ignore | ||
const customRepresentation = | ||
'custom:(visit,' + | ||
'patient:(uuid,identifiers:(uuid,display,identifier,identifierType),voided,' + | ||
'person:(uuid,display,gender,age,birthdate,birthtime,preferredName,preferredAddress,dead,deathDate)),' + | ||
'encounterAssigningToCurrentInpatientLocation:(encounterDatetime),' + | ||
'currentInpatientRequest:(dispositionLocation,dispositionType,disposition:(uuid,display),dispositionEncounter:(uuid,display),dispositionObsGroup:(uuid,display),visit:(uuid),patient:(uuid)),' + | ||
'firstAdmissionOrTransferEncounter:(encounterDatetime),' + | ||
'currentInpatientLocation' + | ||
')'; | ||
|
||
return useOpenmrsFetchAll<InpatientAdmission>( | ||
patientUuids?.length > 0 | ||
? `${restBaseUrl}/emrapi/inpatient/admission?patients=${patientUuids.join(',')}&v=${customRepresentation}` | ||
: null, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/esm-ward-app/src/hooks/useInpatientRequestByPatients.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { restBaseUrl, useOpenmrsFetchAll } from '@openmrs/esm-framework'; | ||
import type { DispositionType, InpatientRequest } from '../types'; | ||
import useWardLocation from './useWardLocation'; | ||
|
||
// prettier-ignore | ||
const defaultRep = | ||
'custom:(' + | ||
'dispositionLocation,' + | ||
'dispositionType,' + | ||
'disposition,' + | ||
'dispositionEncounter:full,' + | ||
'patient:(uuid,identifiers,voided,' + | ||
'person:(uuid,display,gender,age,birthdate,birthtime,preferredName,preferredAddress,dead,deathDate)),' + | ||
'dispositionObsGroup,' + | ||
'visit)'; | ||
|
||
/** | ||
* fetches a list of pending inpatient requests (in any location) for the given patients | ||
*/ | ||
export function useInpatientRequestByPatients( | ||
patientUuids: string[], | ||
dispositionType: Array<DispositionType> = ['ADMIT', 'TRANSFER'], | ||
rep: string = defaultRep, | ||
) { | ||
const searchParams = new URLSearchParams(); | ||
searchParams.set('dispositionType', dispositionType.join(',')); | ||
searchParams.set('patients', patientUuids?.join(',')); | ||
searchParams.set('v', rep); | ||
|
||
const { data, ...rest } = useOpenmrsFetchAll<InpatientRequest>( | ||
patientUuids?.length > 0 ? `${restBaseUrl}/emrapi/inpatient/request?${searchParams.toString()}` : null, | ||
); | ||
|
||
return { inpatientRequests: data, ...rest }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ward-workspace/admission-request-workspace/admission-requests-action-button.extension.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ActionMenuButton, launchWorkspace, UserAvatarIcon } from '@openmrs/esm-framework'; | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { type AdmissionRequestsWorkspaceProps } from './admission-requests.workspace'; | ||
|
||
export default function AdmissionRequestsActionButton() { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<ActionMenuButton | ||
getIcon={(props) => <UserAvatarIcon {...props} />} | ||
label={t('pendingAdmissions', 'Pending admissions')} | ||
iconDescription={t('pendingAdmissions', 'Pending admissions')} | ||
handler={() => launchWorkspace<AdmissionRequestsWorkspaceProps>('admission-requests-workspace')} | ||
type={'pending-admission-requests'} | ||
/> | ||
); | ||
} |
Oops, something went wrong.