Search in sources :

Example 21 with QuestionnaireResponse

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;
}
Also used : QuestionnaireResponseItemAnswerComponent(org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent) Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)

Example 22 with QuestionnaireResponse

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());
}
Also used : MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) QuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse) IIdType(org.hl7.fhir.instance.model.api.IIdType) Test(org.junit.jupiter.api.Test)

Example 23 with QuestionnaireResponse

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());
}
Also used : D4lQuestionnaireCompositionConverter(org.ehrbase.fhirbridge.ehr.converter.specific.d4lquestionnaire.D4lQuestionnaireCompositionConverter) Diff(org.javers.core.diff.Diff) QuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse) D4LQuestionnaireComposition(org.ehrbase.fhirbridge.ehr.opt.d4lquestionnairecomposition.D4LQuestionnaireComposition)

Example 24 with QuestionnaireResponse

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));
}
Also used : Questionnaire(org.hl7.fhir.r4.model.Questionnaire)

Example 25 with QuestionnaireResponse

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;
}
Also used : ParticipantReferenceUtil.getParticipantReference(uk.nhs.adaptors.pss.translator.util.ParticipantReferenceUtil.getParticipantReference) Reference(org.hl7.fhir.dstu3.model.Reference) QuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse)

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