Return ID part when FhirPath expression result is converted to string
This commit is contained in:
parent
3a2b5b1be4
commit
2fd0a07d9f
|
@ -22,6 +22,7 @@ import org.fhir.ucum.UcumException;
|
|||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.PathEngineException;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r4.conformance.ProfileUtilities;
|
||||
import org.hl7.fhir.r4.context.IWorkerContext;
|
||||
import org.hl7.fhir.r4.context.IWorkerContext.ValidationResult;
|
||||
|
@ -894,7 +895,9 @@ public class FHIRPathEngine {
|
|||
}
|
||||
|
||||
public String convertToString(Base item) {
|
||||
if (item.isPrimitive()) {
|
||||
if (item instanceof IIdType) {
|
||||
return ((IIdType)item).getIdPart();
|
||||
} else if (item.isPrimitive()) {
|
||||
return item.primitiveValue();
|
||||
} else if (item instanceof Quantity) {
|
||||
Quantity q = (Quantity) item;
|
||||
|
|
|
@ -295,4 +295,16 @@ public class FHIRPathTests {
|
|||
assertEquals(DUMMY_CONSTANT_1, result.get(0).primitiveValue());
|
||||
assertEquals(DUMMY_CONSTANT_2, result.get(1).primitiveValue());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEvaluateToString_Id() {
|
||||
Patient input = new Patient();
|
||||
input.setId(new IdType("http://base/Patient/123/_history/222"));
|
||||
String actual = fp.evaluateToString(input, "Patient.id");
|
||||
assertEquals("123", actual);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -22,6 +22,7 @@ import org.fhir.ucum.UcumException;
|
|||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.PathEngineException;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
|
||||
import org.hl7.fhir.r4b.context.IWorkerContext;
|
||||
import org.hl7.fhir.r4b.context.IWorkerContext.ValidationResult;
|
||||
|
@ -890,7 +891,9 @@ public class FHIRPathEngine {
|
|||
}
|
||||
|
||||
public String convertToString(Base item) {
|
||||
if (item.isPrimitive()) {
|
||||
if (item instanceof IIdType) {
|
||||
return ((IIdType)item).getIdPart();
|
||||
} else if (item.isPrimitive()) {
|
||||
return item.primitiveValue();
|
||||
} else if (item instanceof Quantity) {
|
||||
Quantity q = (Quantity) item;
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.fhir.ucum.UcumException;
|
|||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.PathEngineException;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities.SourcedChildDefinitions;
|
||||
import org.hl7.fhir.r5.context.ContextUtilities;
|
||||
|
@ -952,7 +953,9 @@ public class FHIRPathEngine {
|
|||
}
|
||||
|
||||
public String convertToString(Base item) {
|
||||
if (item.isPrimitive()) {
|
||||
if (item instanceof IIdType) {
|
||||
return ((IIdType)item).getIdPart();
|
||||
} else if (item.isPrimitive()) {
|
||||
return item.primitiveValue();
|
||||
} else if (item instanceof Quantity) {
|
||||
Quantity q = (Quantity) item;
|
||||
|
|
Loading…
Reference in New Issue