Support parsing valueReference
This commit is contained in:
parent
f5f9dff391
commit
23a09ef7d7
|
@ -831,7 +831,7 @@ public class QuestionnaireResponse extends DomainResource {
|
|||
/**
|
||||
* The answer (or one of the answers) provided by the respondent to the question.
|
||||
*/
|
||||
@Child(name = "value", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, InstantType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class, Quantity.class}, order=1, min=0, max=1, modifier=false, summary=false)
|
||||
@Child(name = "value", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, InstantType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class, Quantity.class, Reference.class}, order=1, min=0, max=1, modifier=false, summary=false)
|
||||
@Description(shortDefinition="Single-valued answer to the question", formalDefinition="The answer (or one of the answers) provided by the respondent to the question." )
|
||||
protected Type value;
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.apache.commons.io.IOUtils;
|
|||
import org.hamcrest.core.IsNot;
|
||||
import org.hamcrest.core.StringContains;
|
||||
import org.hamcrest.text.StringContainsInOrder;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.*;
|
||||
import org.hl7.fhir.instance.model.Address.AddressUse;
|
||||
import org.hl7.fhir.instance.model.Address.AddressUseEnumFactory;
|
||||
|
@ -19,6 +20,7 @@ import org.hl7.fhir.instance.model.Conformance.UnknownContentCode;
|
|||
import org.hl7.fhir.instance.model.Identifier.IdentifierUse;
|
||||
import org.hl7.fhir.instance.model.Narrative.NarrativeStatus;
|
||||
import org.hl7.fhir.instance.model.Patient.ContactComponent;
|
||||
import org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent;
|
||||
import org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent;
|
||||
import org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
|
@ -1257,6 +1259,17 @@ public class JsonParserHl7OrgDstu2Test {
|
|||
Assert.assertEquals(refVal, ((Reference) extlst.get(0).getValue()).getReference());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseQuestionnaireResponseAnswerWithValueReference() throws FHIRException {
|
||||
String response = "{\"resourceType\":\"QuestionnaireResponse\",\"group\":{\"question\":[{\"answer\": [{\"valueReference\": {\"reference\": \"Observation/testid\"}}]}]}}";
|
||||
QuestionnaireResponse r = ourCtx.newJsonParser().parseResource(QuestionnaireResponse.class, response);
|
||||
|
||||
QuestionAnswerComponent answer = r.getGroup().getQuestion().get(0).getAnswer().get(0);
|
||||
assertNotNull(answer);
|
||||
assertNotNull(answer.getValueReference());
|
||||
assertEquals("Observation/testid", answer.getValueReference().getReference());
|
||||
}
|
||||
|
||||
@ResourceDef(name = "Patient")
|
||||
public static class MyPatientWithOneDeclaredAddressExtension extends Patient {
|
||||
|
||||
|
|
Loading…
Reference in New Issue