use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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;
}
Aggregations