From 04fe16b69fe8111f1ac7bfb8784065cf3424861e Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Wed, 21 Dec 2022 13:22:04 +0530 Subject: [PATCH 1/2] Drug's display to be used instead of drug's concept display --- packages/esm-patient-medications-app/src/api/api.ts | 2 +- .../src/order-basket/order-basket-search-results.component.tsx | 2 +- packages/esm-patient-medications-app/src/types/order.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/esm-patient-medications-app/src/api/api.ts b/packages/esm-patient-medications-app/src/api/api.ts index f3dbc6cbf8..ef85d7a0d5 100644 --- a/packages/esm-patient-medications-app/src/api/api.ts +++ b/packages/esm-patient-medications-app/src/api/api.ts @@ -54,7 +54,7 @@ export function getPatientEncounterId(patientUuid: string, abortController: Abor export function getDrugByName(drugName: string, abortController?: AbortController) { return openmrsFetch( - `/ws/rest/v1/drug?q=${drugName}&v=custom:(uuid,name,strength,dosageForm:(display,uuid),concept)`, + `/ws/rest/v1/drug?q=${drugName}&v=custom:(uuid,display,name,strength,dosageForm:(display,uuid),concept)`, { signal: abortController?.signal, }, diff --git a/packages/esm-patient-medications-app/src/order-basket/order-basket-search-results.component.tsx b/packages/esm-patient-medications-app/src/order-basket/order-basket-search-results.component.tsx index 94d071d654..a6231f9821 100644 --- a/packages/esm-patient-medications-app/src/order-basket/order-basket-search-results.component.tsx +++ b/packages/esm-patient-medications-app/src/order-basket/order-basket-search-results.component.tsx @@ -85,7 +85,7 @@ export default function OrderBasketSearchResults({

- {result.drug?.concept?.display} — {result?.drug?.strength} —{' '} + {result.drug?.display} — {result?.drug?.strength} —{' '} {result?.drug?.dosageForm?.display} {result.template && ( <> diff --git a/packages/esm-patient-medications-app/src/types/order.ts b/packages/esm-patient-medications-app/src/types/order.ts index 35c3ec1991..bad4835ba4 100644 --- a/packages/esm-patient-medications-app/src/types/order.ts +++ b/packages/esm-patient-medications-app/src/types/order.ts @@ -61,6 +61,7 @@ export interface Drug { strength: string; concept: OpenmrsResource; dosageForm: OpenmrsResource; + display: string; } export interface OrderPost { From bd4a1d4a4cf18e936042889e82f71c95a444cb46 Mon Sep 17 00:00:00 2001 From: Vineet Sharma Date: Wed, 21 Dec 2022 13:28:21 +0530 Subject: [PATCH 2/2] FIxed the medication's mock data and failing tests --- __mocks__/medication.mock.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/__mocks__/medication.mock.ts b/__mocks__/medication.mock.ts index 7c672ec53b..7574cf51cb 100644 --- a/__mocks__/medication.mock.ts +++ b/__mocks__/medication.mock.ts @@ -5,7 +5,8 @@ export const mockDrugSearchResults = { results: [ { uuid: '18f43c99-2329-426e-97b5-c3356e6afe54', - name: 'aspirin', + name: 'Aspirin', + display: 'Aspirin', strength: '81mg', dosageForm: { display: 'Tablet', @@ -280,7 +281,8 @@ export const mockMedicationOrderSearchResults = [ action: 'NEW', drug: { uuid: '18f43c99-2329-426e-97b5-c3356e6afe54', - name: 'aspirin', + name: 'Aspirin', + display: 'Aspirin', strength: '81mg', dosageForm: { display: 'Tablet', @@ -364,7 +366,8 @@ export const mockMedicationOrderSearchResults = [ action: 'NEW', drug: { uuid: '18f43c99-2329-426e-97b5-c3356e6afe54', - name: 'Aspirin 125mg', + name: 'Aspirin', + display: 'Aspirin', strength: '125mg', dosageForm: { display: 'Tablet', @@ -478,7 +481,8 @@ export const mockMedicationOrderSearchResults = [ action: 'NEW', drug: { uuid: '18f43c99-2329-426e-97b5-c3356e6afe54', - name: 'Aspirin 243mg', + name: 'Aspirin', + display: 'Aspirin', strength: '243mg', dosageForm: { display: 'Tablet', @@ -682,7 +686,7 @@ export const mockDrugOrders = { commentToFulfiller: null, drug: { uuid: '18f43c99-2329-426e-97b5-c3356e6afe54', - name: 'aspirin', + name: 'Aspirin', strength: '81mg', dosageForm: { display: 'Tablet',