-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat) O3-3677: Implement ability to add patient to a queue from lab app #1258
Merged
brandones
merged 23 commits into
openmrs:main
from
its-kios09:itskios-09/lab-modal-send
Sep 15, 2024
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
91e79f4
(feat) Enhance Service Queue Management for sending back patient to …
its-kios09 6a5e5bb
(feat) retaining previous queue details from the queue
its-kios09 6551b5a
(chore) removed the overflow button and renamed the title
its-kios09 4237402
(refactor) added defualt value to be urgent
its-kios09 8549ac3
(refactor) passed wait and urgent conceptUuid as configurable
its-kios09 3a31c7c
(chore) renamed and lab defualt should be blank
its-kios09 9da6f5f
Merge branch 'main' into itskios-09/lab-modal-send
its-kios09 4e5ffc4
(chore) transferred all the service-queue into one place and made the…
its-kios09 b7d2086
(refactor) translation json
its-kios09 a92f267
(refactor) renaming of defualts values of configuration schemas
its-kios09 c7bc383
(refactor) renaming of the defualt view on config-schema.ts
its-kios09 f4f3e2d
(refactor) rename the filenames for send-back-patient-toqueue
its-kios09 d265571
(refactor) renaming of the button
its-kios09 0d118f0
(refactor) translation.json
its-kios09 3c936fb
(refactor) reused the transition component and pass the patient uuid
its-kios09 f25e9d6
(refactor) translation json
its-kios09 748b2bf
(refactor) The reduce method is used to iterate through the results a…
its-kios09 dad80e1
(refactor) translation.json
its-kios09 c4dc507
(chore)removed ResultReviewConceptUuid
its-kios09 91bf7a0
(refactor) resolve issues addressed from the PR
its-kios09 2eaad49
Merge branch 'main' into itskios-09/lab-modal-send
denniskigen a16a5a5
(refactor) updated the hook
its-kios09 a583c97
Merge branch 'main' into itskios-09/lab-modal-send
brandones File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
33 changes: 33 additions & 0 deletions
33
...-queues-app/src/transition-latest-queue-entry/transition-latest-queue-entry.component.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,33 @@ | ||
import React, { useEffect } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useLatestQueueEntry } from './transition-latest-queue-entry.resource'; | ||
import TransitionQueueEntryModal from '../queue-table/queue-entry-actions/transition-queue-entry.modal'; | ||
|
||
interface TransitionLatestQueueEntryProps { | ||
patientUuid: string; | ||
closeModal: () => void; | ||
modalTitle?: string; | ||
} | ||
|
||
const TransitionLatestQueueEntry: React.FC<TransitionLatestQueueEntryProps> = ({ | ||
closeModal, | ||
patientUuid, | ||
modalTitle, | ||
}) => { | ||
const { t } = useTranslation(); | ||
const { data: queueEntry, error, isLoading } = useLatestQueueEntry(patientUuid); | ||
|
||
if (error || !queueEntry) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<TransitionQueueEntryModal | ||
queueEntry={queueEntry} | ||
closeModal={closeModal} | ||
modalTitle={t('TransitionLatestQueueEntry', "Transition patient's latest queue")} | ||
/> | ||
); | ||
}; | ||
|
||
export default TransitionLatestQueueEntry; |
30 changes: 30 additions & 0 deletions
30
...ce-queues-app/src/transition-latest-queue-entry/transition-latest-queue-entry.resource.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,30 @@ | ||
import { | ||
type FetchResponse, | ||
openmrsFetch, | ||
type OpenmrsResource, | ||
type Patient, | ||
type Visit, | ||
} from '@openmrs/esm-framework'; | ||
import useSWR from 'swr'; | ||
import useSWRImmutable from 'swr/immutable'; | ||
import { type QueueEntry } from '../types'; | ||
import { FetcherResponse } from 'swr/_internal'; | ||
|
||
export function useLatestQueueEntry(patientUuid: string) { | ||
const customRepresentation = | ||
'custom:(uuid,display,queue:(uuid,display,name,location:(uuid,display),service:(uuid,display),allowedPriorities:(uuid,display),allowedStatuses:(uuid,display)),status,patient:(uuid,display),visit:(uuid,display,startDatetime),priority,priorityComment,sortWeight,startedAt,endedAt,locationWaitingFor,queueComingFrom,providerWaitingFor,previousQueueEntry)'; | ||
|
||
const encodedRepresentation = encodeURIComponent(customRepresentation); | ||
const url = `/ws/rest/v1/queue-entry?v=${encodedRepresentation}&patient=${patientUuid}&isEnded=false`; | ||
const { data, error, isLoading, mutate } = useSWR<FetchResponse<{ results: QueueEntry[] }>>(url, openmrsFetch); | ||
|
||
const queueEntry = | ||
data?.data?.results?.reduce((latestEntry, currentEntry) => { | ||
if (!latestEntry || new Date(currentEntry.startedAt) > new Date(latestEntry.startedAt)) { | ||
return currentEntry; | ||
} | ||
return latestEntry; | ||
}, null) || null; | ||
|
||
return { data: queueEntry, error, isLoading, mutate }; | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we rename this to 'transitionPatientToNewQueue'? @chibongho what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can go with the current naming.