diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/translators/impl/DosageTranslatorImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/translators/impl/DosageTranslatorImpl.java index 7e0ee7867..c3897c2a2 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/translators/impl/DosageTranslatorImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/translators/impl/DosageTranslatorImpl.java @@ -14,7 +14,6 @@ import lombok.AccessLevel; import lombok.Setter; import org.hl7.fhir.r4.model.BooleanType; -import org.hl7.fhir.r4.model.CodeableConcept; import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.Dosage; import org.hl7.fhir.r4.model.Quantity; @@ -53,9 +52,7 @@ public Dosage toFhirResource(@Nonnull DrugOrder drugOrder) { dosage.setTiming(timingTranslator.toFhirResource(drugOrder)); if (drugOrder.getInstructions() != null) { - CodeableConcept additionalInstructions = new CodeableConcept(); - additionalInstructions.setText(drugOrder.getInstructions()); - dosage.addAdditionalInstruction(additionalInstructions); + dosage.addAdditionalInstruction().setText(drugOrder.getInstructions()); } if (drugOrder.getDose() != null) { @@ -81,7 +78,7 @@ public Dosage toFhirResource(@Nonnull DrugOrder drugOrder) { public DrugOrder toOpenmrsType(@Nonnull DrugOrder drugOrder, @Nonnull Dosage dosage) { drugOrder.setDosingInstructions(dosage.getText()); - if (!dosage.getAdditionalInstruction().isEmpty()) { + if (dosage.hasAdditionalInstruction()) { drugOrder.setInstructions(dosage.getAdditionalInstructionFirstRep().getText()); }