-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) Order summary/history (#1463)
* (feat) lab orders history and results orders print and pending orders adds translations moving orders summary to orders esm translations updates import * fixes to residue after rebase * adds pagination and filter logic * pr changes * PR changes * adds feature flag and minor tweaks * Cleanup --------- Co-authored-by: Vineet Sharma <[email protected]>
- Loading branch information
1 parent
7a49ac2
commit 4087f96
Showing
23 changed files
with
970 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './useOrderBasket'; | ||
export * from './postOrders'; | ||
export * from './useOrders'; | ||
export * from './types'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import useSWR, { mutate } from 'swr'; | ||
import { type FetchResponse, openmrsFetch } from '@openmrs/esm-framework'; | ||
import { useCallback, useMemo } from 'react'; | ||
import { type OrderTypeFetchResponse, type PatientOrderFetchResponse } from '@openmrs/esm-patient-common-lib'; | ||
|
||
export const careSettingUuid = '6f0c9a92-6f24-11e3-af88-005056821db0'; | ||
|
||
export function usePatientOrders(patientUuid: string, status: 'ACTIVE' | 'any', orderType?: string) { | ||
const baseOrdersUrl = `/ws/rest/v1/order?v=full&patient=${patientUuid}&careSetting=${careSettingUuid}&status=${status}`; | ||
const ordersUrl = orderType ? `${baseOrdersUrl}&orderType=${orderType}` : baseOrdersUrl; | ||
|
||
const { data, error, isLoading, isValidating } = useSWR<FetchResponse<PatientOrderFetchResponse>, Error>( | ||
patientUuid ? ordersUrl : null, | ||
openmrsFetch, | ||
); | ||
|
||
const mutateOrders = useCallback( | ||
() => mutate((key) => typeof key === 'string' && key.startsWith(`/ws/rest/v1/order?patient=${patientUuid}`)), | ||
[patientUuid], | ||
); | ||
|
||
const orders = useMemo( | ||
() => | ||
data?.data?.results | ||
? data.data.results?.sort((order1, order2) => (order2.dateActivated > order1.dateActivated ? 1 : -1)) | ||
: null, | ||
[data], | ||
); | ||
|
||
return { | ||
data: orders, | ||
error, | ||
isLoading, | ||
isValidating, | ||
mutate: mutateOrders, | ||
}; | ||
} | ||
|
||
export function useOrderTypes() { | ||
const orderTypesUrl = `/ws/rest/v1/ordertype`; | ||
const { data, error, isLoading, isValidating } = useSWR<FetchResponse<OrderTypeFetchResponse>, Error>( | ||
orderTypesUrl, | ||
openmrsFetch, | ||
); | ||
|
||
return { | ||
data: data?.data?.results, | ||
error, | ||
isLoading, | ||
isValidating, | ||
}; | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/esm-patient-labs-app/src/lab-orders/add-lab-order/lab-order-form.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
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 |
---|---|---|
|
@@ -45,4 +45,4 @@ | |
} | ||
], | ||
"pages": [] | ||
} | ||
} |
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
55 changes: 55 additions & 0 deletions
55
packages/esm-patient-orders-app/src/components/order-details-table.scss
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,55 @@ | ||
@use '@carbon/styles/scss/colors'; | ||
@use '@carbon/styles/scss/spacing'; | ||
@use '@carbon/styles/scss/type'; | ||
@import "../root"; | ||
|
||
.widgetCard { | ||
border: 1px solid colors.$gray-20; | ||
border-bottom: none; | ||
} | ||
|
||
.row { | ||
span { | ||
margin: auto; | ||
} | ||
|
||
p { | ||
padding: spacing.$spacing-02 0; | ||
} | ||
} | ||
|
||
.medicationRecord { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
} | ||
|
||
.startDateColumn { | ||
@include type.type-style("body-compact-01"); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
justify-content: space-between; | ||
min-height: spacing.$spacing-11; | ||
padding-bottom: spacing.$spacing-02; | ||
|
||
span { | ||
margin: 0rem; | ||
} | ||
} | ||
|
||
.dosage { | ||
@include type.type-style("heading-compact-01"); | ||
} | ||
|
||
.tooltip { | ||
margin: 0rem -0.5rem -0.625rem; | ||
} | ||
|
||
.menuItem { | ||
max-width: none; | ||
} | ||
|
||
.buttons { | ||
justify-content: flex-end; | ||
} |
Oops, something went wrong.