Search in sources :

Example 11 with QuestionnaireResponse

use of org.hl7.fhir.r4.model.QuestionnaireResponse in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeQuestionnaireResponseQuestionnaireResponseItemComponent.

protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(Complex parent, String parentType, String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "item", name, element, index);
    if (element.hasLinkIdElement())
        composeString(t, "QuestionnaireResponse", "linkId", element.getLinkIdElement(), -1);
    if (element.hasDefinitionElement())
        composeUri(t, "QuestionnaireResponse", "definition", element.getDefinitionElement(), -1);
    if (element.hasTextElement())
        composeString(t, "QuestionnaireResponse", "text", element.getTextElement(), -1);
    if (element.hasSubject())
        composeReference(t, "QuestionnaireResponse", "subject", element.getSubject(), -1);
    for (int i = 0; i < element.getAnswer().size(); i++) composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(t, "QuestionnaireResponse", "answer", element.getAnswer().get(i), i);
    for (int i = 0; i < element.getItem().size(); i++) composeQuestionnaireResponseQuestionnaireResponseItemComponent(t, "QuestionnaireResponse", "item", element.getItem().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 12 with QuestionnaireResponse

use of org.hl7.fhir.r4.model.QuestionnaireResponse in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent.

protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(Complex parent, String parentType, String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "answer", name, element, index);
    if (element.hasValue())
        composeType(t, "QuestionnaireResponse", "value", element.getValue(), -1);
    for (int i = 0; i < element.getItem().size(); i++) composeQuestionnaireResponseQuestionnaireResponseItemComponent(t, "QuestionnaireResponse", "item", element.getItem().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 13 with QuestionnaireResponse

use of org.hl7.fhir.r4.model.QuestionnaireResponse in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeQuestionnaireResponse.

protected void composeQuestionnaireResponse(Complex parent, String parentType, String name, QuestionnaireResponse element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "QuestionnaireResponse", name, element, index);
    if (element.hasIdentifier())
        composeIdentifier(t, "QuestionnaireResponse", "identifier", element.getIdentifier(), -1);
    if (element.hasQuestionnaire())
        composeReference(t, "QuestionnaireResponse", "questionnaire", element.getQuestionnaire(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "QuestionnaireResponse", "status", element.getStatusElement(), -1);
    if (element.hasSubject())
        composeReference(t, "QuestionnaireResponse", "subject", element.getSubject(), -1);
    if (element.hasAuthor())
        composeReference(t, "QuestionnaireResponse", "author", element.getAuthor(), -1);
    if (element.hasAuthoredElement())
        composeDateTime(t, "QuestionnaireResponse", "authored", element.getAuthoredElement(), -1);
    if (element.hasSource())
        composeReference(t, "QuestionnaireResponse", "source", element.getSource(), -1);
    if (element.hasEncounter())
        composeReference(t, "QuestionnaireResponse", "encounter", element.getEncounter(), -1);
    for (int i = 0; i < element.getItem().size(); i++) composeQuestionnaireResponseQuestionnaireResponseItemComponent(t, "QuestionnaireResponse", "item", element.getItem().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 14 with QuestionnaireResponse

use of org.hl7.fhir.r4.model.QuestionnaireResponse in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent.

protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(Complex parent, String parentType, String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "answer", name, element, index);
    if (element.hasValue())
        composeType(t, "QuestionnaireResponse", "value", element.getValue(), -1);
    for (int i = 0; i < element.getItem().size(); i++) composeQuestionnaireResponseQuestionnaireResponseItemComponent(t, "QuestionnaireResponse", "item", element.getItem().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 15 with QuestionnaireResponse

use of org.hl7.fhir.r4.model.QuestionnaireResponse in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireBuilder method build.

public void build() throws FHIRException {
    if (profile == null)
        throw new DefinitionException("QuestionnaireBuilder.build: no profile found");
    if (resource != null)
        if (!profile.getBaseType().equals(resource.getResourceType().toString()))
            throw new DefinitionException("Wrong Type");
    if (prebuiltQuestionnaire != null)
        questionnaire = prebuiltQuestionnaire;
    else
        questionnaire = new Questionnaire();
    if (resource != null)
        response = new QuestionnaireResponse();
    processMetadata();
    List<ElementDefinition> list = new ArrayList<ElementDefinition>();
    List<QuestionnaireResponse.QuestionnaireResponseItemComponent> answerGroups = new ArrayList<QuestionnaireResponse.QuestionnaireResponseItemComponent>();
    if (resource != null)
        answerGroups.addAll(response.getItem());
    if (prebuiltQuestionnaire != null) {
        // give it a fake group to build
        Questionnaire.QuestionnaireItemComponent group = new Questionnaire.QuestionnaireItemComponent();
        group.setType(QuestionnaireItemType.GROUP);
        buildGroup(group, profile, profile.getSnapshot().getElement().get(0), list, answerGroups);
    } else
        buildGroup(questionnaire.getItem().get(0), profile, profile.getSnapshot().getElement().get(0), list, answerGroups);
// 
// NarrativeGenerator ngen = new NarrativeGenerator(context);
// ngen.generate(result);
// 
// if FResponse <> nil then
// FResponse.collapseAllContained;
}
Also used : QuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent) Questionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire) ArrayList(java.util.ArrayList) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) ElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition) QuestionnaireResponse(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) QuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent)

Aggregations

QuestionnaireResponse (org.hl7.fhir.r4.model.QuestionnaireResponse)15 ArrayList (java.util.ArrayList)14 Bundle (org.hl7.fhir.r4.model.Bundle)11 QuestionnaireResponse (org.hl7.fhir.dstu3.model.QuestionnaireResponse)8 Questionnaire (org.hl7.fhir.r4.model.Questionnaire)8 Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)8 Test (org.junit.jupiter.api.Test)8 Reference (org.hl7.fhir.dstu3.model.Reference)7 Reference (org.hl7.fhir.r4.model.Reference)7 List (java.util.List)6 Collectors (java.util.stream.Collectors)6 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)6 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)6 Map (java.util.Map)5 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)5 FhirUtil (org.hl7.gravity.refimpl.sdohexchange.util.FhirUtil)5 Coding (org.hl7.fhir.r4.model.Coding)4 Date (java.util.Date)3 Getter (lombok.Getter)3 Bundle (org.hl7.fhir.dstu3.model.Bundle)3