From 081f31cbcb78ce349e56ddc2d57e5c96479cb831 Mon Sep 17 00:00:00 2001 From: Mark Goodrich Date: Tue, 13 Aug 2024 14:50:44 -0400 Subject: [PATCH 1/2] O3-3791: Dispensing: display instructions from DrugOrder.instructions when dispensing drugs --- src/components/medication-event.component.tsx | 3 +++ .../medication-dispense.resource.tsx | 11 ++++++++++- src/types.ts | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/medication-event.component.tsx b/src/components/medication-event.component.tsx index 81c2ba3..8ca5eef 100644 --- a/src/components/medication-event.component.tsx +++ b/src/components/medication-event.component.tsx @@ -66,6 +66,9 @@ const MedicationEvent: React.FC<{

)} {dosageInstruction?.text &&

{dosageInstruction.text}

} + {dosageInstruction?.additionalInstruction?.length > 0 && ( +

{dosageInstruction?.additionalInstruction[0].text}

+ )} ); }; diff --git a/src/medication-dispense/medication-dispense.resource.tsx b/src/medication-dispense/medication-dispense.resource.tsx index 47f8528..47f33c9 100644 --- a/src/medication-dispense/medication-dispense.resource.tsx +++ b/src/medication-dispense/medication-dispense.resource.tsx @@ -135,7 +135,16 @@ export function initiateMedicationDispenseBody( whenHandedOver: null, dosageInstruction: [ { - text: medicationRequest.dosageInstruction[0].text, + // see https://openmrs.atlassian.net/browse/O3-3791 for an explanation for the reason for the below + text: + (medicationRequest.dosageInstruction[0].text ? medicationRequest.dosageInstruction[0].text : '') + + (medicationRequest.dosageInstruction[0].text && + medicationRequest.dosageInstruction[0].additionalInstruction?.length > 0 + ? ' ' + : '') + + (medicationRequest.dosageInstruction[0].additionalInstruction?.length > 0 + ? medicationRequest.dosageInstruction[0].additionalInstruction[0].text + : ''), timing: medicationRequest.dosageInstruction[0].timing, asNeededBoolean: false, route: medicationRequest.dosageInstruction[0].route, diff --git a/src/types.ts b/src/types.ts index b73ef30..a89079b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -97,7 +97,7 @@ export interface Attribute { } export interface CodeableConcept { - coding: Coding[]; + coding?: Coding[]; text?: string; } @@ -131,6 +131,7 @@ export interface DosageInstruction { doseAndRate: Array<{ doseQuantity: Quantity; }>; + additionalInstruction?: Array; } export interface Drug { From 9bd1204d2694644bcac919e9aee4f7110fe728d9 Mon Sep 17 00:00:00 2001 From: Mark Goodrich Date: Thu, 15 Aug 2024 13:39:30 -0400 Subject: [PATCH 2/2] (feat) O3-3247: Dispensing: display instructions from DrugOrder.instructions when dispensing drugs --- .../medication-dispense.resource.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/medication-dispense/medication-dispense.resource.tsx b/src/medication-dispense/medication-dispense.resource.tsx index 47f33c9..c703cb7 100644 --- a/src/medication-dispense/medication-dispense.resource.tsx +++ b/src/medication-dispense/medication-dispense.resource.tsx @@ -136,15 +136,14 @@ export function initiateMedicationDispenseBody( dosageInstruction: [ { // see https://openmrs.atlassian.net/browse/O3-3791 for an explanation for the reason for the below - text: - (medicationRequest.dosageInstruction[0].text ? medicationRequest.dosageInstruction[0].text : '') + - (medicationRequest.dosageInstruction[0].text && + text: [ + medicationRequest.dosageInstruction[0].text, medicationRequest.dosageInstruction[0].additionalInstruction?.length > 0 - ? ' ' - : '') + - (medicationRequest.dosageInstruction[0].additionalInstruction?.length > 0 ? medicationRequest.dosageInstruction[0].additionalInstruction[0].text - : ''), + : null, + ] + .filter((str) => str != null) + .join(' '), timing: medicationRequest.dosageInstruction[0].timing, asNeededBoolean: false, route: medicationRequest.dosageInstruction[0].route,