@openmrs/esm-patient-common-lib 7.0.2-pre.3834 → 7.0.2-pre.3846
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-patient-common-lib",
|
|
3
|
-
"version": "7.0.2-pre.
|
|
3
|
+
"version": "7.0.2-pre.3846",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Library for common patient chart components",
|
|
6
6
|
"browser": "dist/openmrs-esm-patient-common-lib.js",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"react": "18.x",
|
|
39
39
|
"single-spa": "6.x"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "8167490f458ef62f39503f71acf0593964c39b08"
|
|
42
42
|
}
|
package/src/orders/postOrders.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
1
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
2
2
|
import { getPatientUuidFromUrl } from '../get-patient-uuid-from-url';
|
|
3
3
|
import { type OrderBasketStore, orderBasketStore } from './store';
|
|
4
4
|
import { type OrderBasketItem, type OrderPost } from './types';
|
|
@@ -26,7 +26,7 @@ export async function postOrders(encounterUuid: string, abortController: AbortCo
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function postOrder(body: OrderPost, abortController?: AbortController) {
|
|
29
|
-
return openmrsFetch(
|
|
29
|
+
return openmrsFetch(`${restBaseUrl}/order`, {
|
|
30
30
|
method: 'POST',
|
|
31
31
|
signal: abortController?.signal,
|
|
32
32
|
headers: { 'Content-Type': 'application/json' },
|
package/src/orders/useOrders.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import useSWR, { mutate } from 'swr';
|
|
2
|
-
import { type FetchResponse, openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { type FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
3
3
|
import { useCallback, useMemo } from 'react';
|
|
4
4
|
import { type OrderTypeFetchResponse, type PatientOrderFetchResponse } from '@openmrs/esm-patient-common-lib';
|
|
5
5
|
|
|
6
6
|
export const careSettingUuid = '6f0c9a92-6f24-11e3-af88-005056821db0';
|
|
7
7
|
|
|
8
8
|
export function usePatientOrders(patientUuid: string, status: 'ACTIVE' | 'any', orderType?: string) {
|
|
9
|
-
const baseOrdersUrl =
|
|
9
|
+
const baseOrdersUrl = `${restBaseUrl}/order?v=full&patient=${patientUuid}&careSetting=${careSettingUuid}&status=${status}`;
|
|
10
10
|
const ordersUrl = orderType ? `${baseOrdersUrl}&orderType=${orderType}` : baseOrdersUrl;
|
|
11
11
|
|
|
12
12
|
const { data, error, isLoading, isValidating } = useSWR<FetchResponse<PatientOrderFetchResponse>, Error>(
|
|
@@ -15,7 +15,7 @@ export function usePatientOrders(patientUuid: string, status: 'ACTIVE' | 'any',
|
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
const mutateOrders = useCallback(
|
|
18
|
-
() => mutate((key) => typeof key === 'string' && key.startsWith(
|
|
18
|
+
() => mutate((key) => typeof key === 'string' && key.startsWith(`${restBaseUrl}/order?patient=${patientUuid}`)),
|
|
19
19
|
[patientUuid],
|
|
20
20
|
);
|
|
21
21
|
|
|
@@ -37,7 +37,7 @@ export function usePatientOrders(patientUuid: string, status: 'ACTIVE' | 'any',
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export function useOrderTypes() {
|
|
40
|
-
const orderTypesUrl =
|
|
40
|
+
const orderTypesUrl = `${restBaseUrl}/ordertype`;
|
|
41
41
|
const { data, error, isLoading, isValidating } = useSWR<FetchResponse<OrderTypeFetchResponse>, Error>(
|
|
42
42
|
orderTypesUrl,
|
|
43
43
|
openmrsFetch,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import useSWR from 'swr';
|
|
2
|
-
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import { type PatientProgram } from '../types';
|
|
5
5
|
import uniqBy from 'lodash-es/uniqBy';
|
|
@@ -7,7 +7,7 @@ const customRepresentation = `custom:(uuid,display,program,dateEnrolled,dateComp
|
|
|
7
7
|
|
|
8
8
|
export const useActivePatientEnrollment = (patientUuid: string) => {
|
|
9
9
|
const { data, error, isLoading } = useSWR<{ data: { results: Array<PatientProgram> } }>(
|
|
10
|
-
|
|
10
|
+
`${restBaseUrl}/programenrollment?patient=${patientUuid}&v=${customRepresentation}`,
|
|
11
11
|
openmrsFetch,
|
|
12
12
|
);
|
|
13
13
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import useSWRImmutable from 'swr/immutable';
|
|
2
|
-
import { type FetchResponse, openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { type FetchResponse, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
|
|
5
5
|
export function useSystemVisitSetting() {
|
|
6
6
|
const { data, isLoading, error } = useSWRImmutable<FetchResponse<{ value: 'true' | 'false' }>, Error>(
|
|
7
|
-
|
|
7
|
+
`${restBaseUrl}/systemsetting/visits.enabled?v=custom:(value)`,
|
|
8
8
|
openmrsFetch,
|
|
9
9
|
);
|
|
10
10
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import useSWRImmutable from 'swr/immutable';
|
|
2
|
-
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import { openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
|
|
3
3
|
|
|
4
4
|
export function useVitalsConceptMetadata() {
|
|
5
5
|
const customRepresentation =
|
|
6
6
|
'custom:(setMembers:(uuid,display,hiNormal,hiAbsolute,hiCritical,lowNormal,lowAbsolute,lowCritical,units))';
|
|
7
7
|
|
|
8
|
-
const apiUrl =
|
|
8
|
+
const apiUrl = `${restBaseUrl}/concept/?q=VITALS SIGNS&v=${customRepresentation}`;
|
|
9
9
|
|
|
10
10
|
const { data, error, isLoading } = useSWRImmutable<{ data: VitalsConceptMetadataResponse }, Error>(
|
|
11
11
|
apiUrl,
|