@@ -161,6 +161,7 @@ public String mapCodeableConceptToCdForBloodPressure(CodeableConcept codeableCon
161161
162162 code .ifPresent (builder ::mainCode );
163163 displayText .ifPresent (builder ::mainDisplayName );
164+ builder .translations (getNonSnomedCodeCodings (codeableConcept ));
164165 }
165166
166167 return TemplateUtils .fillTemplate (CODEABLE_CONCEPT_CD_TEMPLATE , builder .build ());
@@ -324,23 +325,20 @@ private List<Coding> getNonSnomedCodeCodings(CodeableConcept codeableConcept) {
324325 }
325326
326327 private Optional <String > findOriginalText (CodeableConcept codeableConcept , Optional <Coding > coding ) {
328+
329+ if (codeableConcept .hasText ()) {
330+ return Optional .ofNullable (codeableConcept .getText ());
331+ }
332+
327333 if (coding .isPresent ()) {
328- if (codeableConcept .hasText ()) {
329- return Optional .ofNullable (codeableConcept .getText ());
330- } else {
331- if (coding .get ().hasDisplay ()) {
332- return getCodingDisplayName (coding .get ());
333- } else {
334- var extension = retrieveDescriptionExtension (coding .get ());
335- return extension .stream ()
336- .filter (displayExtension -> DESCRIPTION_DISPLAY .equals (displayExtension .getUrl ()))
337- .map (extension1 -> extension1 .getValue ().toString ())
338- .findFirst ();
339- }
334+ if (coding .get ().hasDisplay ()) {
335+ return getCodingDisplayName (coding .get ());
340336 }
341- } else {
342- return CodeableConceptMappingUtils . extractTextOrCoding ( codeableConcept );
337+
338+ return getDisplayTextFromDescriptionExtension ( coding . get () );
343339 }
340+
341+ return CodeableConceptMappingUtils .extractTextOrCoding (codeableConcept );
344342 }
345343
346344 private Optional <String > findOriginalTextForAllergy (
@@ -353,13 +351,13 @@ private Optional<String> findOriginalTextForAllergy(
353351 }
354352
355353 if (ACTIVE_CLINICAL_STATUS .equals (allergyIntoleranceClinicalStatus .toCode ())) {
356- return getOriginalTextForActiveAllergy (coding .get ());
354+ return getDisplayTextFromDescriptionExtension (coding .get ());
357355 }
358356
359357 return CodeableConceptMappingUtils .extractTextOrCoding (codeableConcept );
360358 }
361359
362- private Optional <String > getOriginalTextForActiveAllergy (Coding coding ) {
360+ private Optional <String > getDisplayTextFromDescriptionExtension (Coding coding ) {
363361 return retrieveDescriptionExtension (coding )
364362 .flatMap (value -> value
365363 .getExtension ().stream ()
0 commit comments