use of org.hl7.fhir.dstu2.model.Questionnaire in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeQuestionnaire.
protected void composeQuestionnaire(Complex parent, String parentType, String name, Questionnaire element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Questionnaire", name, element, index);
if (element.hasUrlElement())
composeUri(t, "Questionnaire", "url", element.getUrlElement(), -1);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Questionnaire", "identifier", element.getIdentifier().get(i), i);
if (element.hasVersionElement())
composeString(t, "Questionnaire", "version", element.getVersionElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "Questionnaire", "status", element.getStatusElement(), -1);
if (element.hasDateElement())
composeDateTime(t, "Questionnaire", "date", element.getDateElement(), -1);
if (element.hasPublisherElement())
composeString(t, "Questionnaire", "publisher", element.getPublisherElement(), -1);
for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "Questionnaire", "telecom", element.getTelecom().get(i), i);
for (int i = 0; i < element.getUseContext().size(); i++) composeCodeableConcept(t, "Questionnaire", "useContext", element.getUseContext().get(i), i);
if (element.hasTitleElement())
composeString(t, "Questionnaire", "title", element.getTitleElement(), -1);
for (int i = 0; i < element.getConcept().size(); i++) composeCoding(t, "Questionnaire", "concept", element.getConcept().get(i), i);
for (int i = 0; i < element.getSubjectType().size(); i++) composeCode(t, "Questionnaire", "subjectType", element.getSubjectType().get(i), i);
for (int i = 0; i < element.getItem().size(); i++) composeQuestionnaireQuestionnaireItemComponent(t, "Questionnaire", "item", element.getItem().get(i), i);
}
use of org.hl7.fhir.dstu2.model.Questionnaire in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeQuestionnaireQuestionnaireItemEnableWhenComponent.
protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(Complex parent, String parentType, String name, Questionnaire.QuestionnaireItemEnableWhenComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "enableWhen", name, element, index);
if (element.hasQuestionElement())
composeString(t, "Questionnaire", "question", element.getQuestionElement(), -1);
if (element.hasAnsweredElement())
composeBoolean(t, "Questionnaire", "answered", element.getAnsweredElement(), -1);
if (element.hasAnswer())
composeType(t, "Questionnaire", "answer", element.getAnswer(), -1);
}
use of org.hl7.fhir.dstu2.model.Questionnaire 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.Questionnaire 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;
}
use of org.hl7.fhir.dstu2.model.Questionnaire in project org.hl7.fhir.core by hapifhir.
the class ToolingExtensions method addFlyOver.
public static void addFlyOver(QuestionnaireItemComponent item, String text) {
if (!StringUtils.isBlank(text)) {
QuestionnaireItemComponent display = item.addItem();
display.setType(QuestionnaireItemType.DISPLAY);
display.setText(text);
display.getExtension().add(Factory.newExtension(EXT_CONTROL, Factory.newCodeableConcept("flyover", "http://hl7.org/fhir/questionnaire-item-control", "Fly-over"), true));
}
}
Aggregations