use of org.hl7.fhir.r4.model.QuestionnaireResponse in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireResponseRenderer method renderTreeItem.
private boolean renderTreeItem(HierarchicalTableGenerator gen, List<Row> rows, QuestionnaireResponse q, QuestionnaireResponseItemComponent i) throws IOException {
Row r = gen.new Row();
rows.add(r);
boolean hasExt = false;
boolean hasItem = i.hasItem();
for (QuestionnaireResponseItemAnswerComponent a : i.getAnswer()) {
hasItem = a.hasItem();
}
if (hasItem) {
r.setIcon("icon-q-group.png", "Group");
} else {
r.setIcon("icon-q-string.png", "Item");
}
r.getCells().add(gen.new Cell(null, context.getDefinitionsTarget() == null ? "" : context.getDefinitionsTarget() + "#item." + i.getLinkId(), i.getLinkId(), null, null));
r.getCells().add(gen.new Cell(null, null, i.getText(), null, null));
r.getCells().add(gen.new Cell(null, null, null, null, null));
r.getCells().add(gen.new Cell(null, null, null, null, null));
return hasExt;
}
use of org.hl7.fhir.r4.model.QuestionnaireResponse in project fhir-bridge by ehrbase.
the class ProvideQuestionnaireResponseTransactionIT method provideQuestionnaireResponseConditionalUpdate.
@Test
void provideQuestionnaireResponseConditionalUpdate() throws IOException {
MethodOutcome outcome;
outcome = create("QuestionnaireResponse/transactions/provide-questionnaire-response-create.json");
IIdType id = outcome.getId();
outcome = update("QuestionnaireResponse/transactions/provide-questionnaire-response-update.json", "QuestionnaireResponse?_id=" + id.getIdPart() + "&patient.identifier=" + PATIENT_ID);
Assertions.assertEquals(id.getIdPart(), outcome.getId().getIdPart());
Assertions.assertEquals(id.getVersionIdPartAsLong() + 1, outcome.getId().getVersionIdPartAsLong());
QuestionnaireResponse questionnaireResponse = (QuestionnaireResponse) outcome.getResource();
Assertions.assertEquals(PATIENT_ID, questionnaireResponse.getSubject().getIdentifier().getValue());
Assertions.assertEquals(QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED, questionnaireResponse.getStatus());
}
use of org.hl7.fhir.r4.model.QuestionnaireResponse in project fhir-bridge by ehrbase.
the class QuestionnaireResponseIT method testMapping.
@Override
public void testMapping(String resourcePath, String paragonPath) throws IOException {
QuestionnaireResponse resource = (QuestionnaireResponse) super.testFileLoader.loadResource(resourcePath);
D4lQuestionnaireCompositionConverter d4lQuestionnaireCompositionConverter = new D4lQuestionnaireCompositionConverter();
D4LQuestionnaireComposition mappedD4LQuestionnaireComposition = d4lQuestionnaireCompositionConverter.convert(resource);
Diff diff = compareCompositions(getJavers(), paragonPath, mappedD4LQuestionnaireComposition);
assertEquals(0, diff.getChanges().size());
}
use of org.hl7.fhir.r4.model.QuestionnaireResponse in project CRD by HL7-DaVinci.
the class QuestionnaireController method addQuestionSetToQuestionnaireResponse.
/**
* Adds the given set of questions to the contained questionniare in the questionnaire response.
* @param inputQuestionnaireResponse
* @param questionSet
*/
private static void addQuestionSetToQuestionnaireResponse(QuestionnaireResponse inputQuestionnaireResponse, List<QuestionnaireItemComponent> questionSet) {
// Add the next question set to the QuestionnaireResponse.contained[0].item[].
Questionnaire containedQuestionnaire = (Questionnaire) inputQuestionnaireResponse.getContained().get(0);
questionSet.forEach(questionItem -> containedQuestionnaire.addItem(questionItem));
}
use of org.hl7.fhir.r4.model.QuestionnaireResponse in project nia-patient-switching-standard-adaptor by NHSDigital.
the class TemplateMapper method createQuestionnaireResponse.
private QuestionnaireResponse createQuestionnaireResponse(RCMRMT030101UK04CompoundStatement compoundStatement, String practiseCode, Patient patient, Optional<Reference> encounter, Observation parentObservation, RCMRMT030101UK04EhrComposition ehrComposition, RCMRMT030101UK04EhrExtract ehrExtract) {
var questionnaireResponse = new QuestionnaireResponse();
var id = compoundStatement.getId().get(0).getRoot();
questionnaireResponse.addItem(createdLinkedId(compoundStatement)).setAuthoredElement(getAuthored(ehrComposition, ehrExtract)).setSubject(new Reference(patient)).setStatus(COMPLETED).setParent(List.of(new Reference(parentObservation))).setIdentifier(buildIdentifier(id, practiseCode)).setMeta(generateMeta(QUESTIONNAIRE_META_PROFILE)).setId(QUESTIONNAIRE_REFERENCE.formatted(id));
encounter.ifPresent(questionnaireResponse::setContext);
return questionnaireResponse;
}
Aggregations