@@ -324,6 +324,44 @@ <originalText>Prothrombin time (observed)</originalText>
324324 assertThat (outputMessage ).isEqualToIgnoringWhitespace (expectedOutput );
325325 }
326326
327+ @ Test
328+ void When_WithSnomedCodingAndLegacyCodings_Expect_SnomedCdXmlWithTranslations () {
329+ var inputJson = """
330+ {
331+ "resourceType": "Observation",
332+ "code": {
333+ "coding": [
334+ {
335+ "system": "http://snomed.info/sct",
336+ "display": "Prothrombin time",
337+ "code": "852471000000107"
338+ },
339+ {
340+ "system": "http://read.info/readv2",
341+ "code": "42Q5.00",
342+ "display": "Observed Prothrombin time"
343+ },
344+ {
345+ "system": "http://read.info/ctv3",
346+ "code": "123456",
347+ "display": "Prothrombin time (observed)"
348+ }
349+ ]
350+ }
351+ }""" ;
352+ var expectedOutput = """
353+ <code code="852471000000107" codeSystem="2.16.840.1.113883.2.1.3.2.4.15" displayName="Prothrombin time">
354+ <translation code="42Q5.00" codeSystem="2.16.840.1.113883.2.1.6.2" displayName="Observed Prothrombin time" />
355+ <translation code="123456" codeSystem="2.16.840.1.113883.2.1.3.2.4.14" displayName="Prothrombin time (observed)" />
356+ <originalText>Prothrombin time</originalText>
357+ </code>""" ;
358+ var codeableConcept = fhirParseService .parseResource (inputJson , Observation .class ).getCode ();
359+
360+ var outputMessage = codeableConceptCdMapper .mapCodeableConceptToCdForBloodPressure (codeableConcept );
361+
362+ assertThat (outputMessage ).isEqualToIgnoringWhitespace (expectedOutput );
363+ }
364+
327365 @ Test
328366 void When_WithNonSnomedCodingWithText_Expect_NullFlavorUnkCDWithOriginalTextFromText () {
329367 var inputJson = """
@@ -451,6 +489,37 @@ <originalText>Prothrombin time (observed)</originalText>
451489
452490 assertThat (outputMessage ).isEqualToIgnoringWhitespace (expectedOutput );
453491 }
492+
493+ @ Test
494+ void When_WithoutSnomedCodingAndWithLegacyCodings_Expect_NullFlavorSnomedCdXmlWithoutTranslations () {
495+ var inputJson = """
496+ {
497+ "resourceType": "Observation",
498+ "code": {
499+ "coding": [
500+ {
501+ "system": "http://read.info/readv2",
502+ "code": "42Q5.00",
503+ "display": "Observed Prothrombin time"
504+ },
505+ {
506+ "system": "http://read.info/ctv3",
507+ "code": "123456",
508+ "display": "Prothrombin time (observed)"
509+ }
510+ ]
511+ }
512+ }""" ;
513+ var expectedOutput = """
514+ <code nullFlavor="UNK">
515+ <originalText>Observed Prothrombin time</originalText>
516+ </code>""" ;
517+ var codeableConcept = fhirParseService .parseResource (inputJson , Observation .class ).getCode ();
518+
519+ var outputMessage = codeableConceptCdMapper .mapCodeableConceptToCdForBloodPressure (codeableConcept );
520+
521+ assertThat (outputMessage ).isEqualToIgnoringWhitespace (expectedOutput );
522+ }
454523 }
455524
456525 @ Nested
0 commit comments