use of org.hl7.fhir.dstu2.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.dstu2.model.QuestionnaireResponse in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireResponseRenderer method addTreeRoot.
private Row addTreeRoot(HierarchicalTableGenerator gen, List<Row> rows, QuestionnaireResponse q) throws IOException {
Row r = gen.new Row();
rows.add(r);
r.setIcon("icon_q_root.gif", "QuestionnaireResponseRoot");
r.getCells().add(gen.new Cell(null, null, q.getId(), null, null));
r.getCells().add(gen.new Cell(null, null, "", null, null));
r.getCells().add(gen.new Cell(null, null, "QuestionnaireResponse", null, null));
r.getCells().add(gen.new Cell(null, null, "", null, null));
return r;
}
use of org.hl7.fhir.dstu2.model.QuestionnaireResponse in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireResponseRenderer method addTreeRoot.
private Row addTreeRoot(HierarchicalTableGenerator gen, List<Row> rows, ResourceWrapper q) throws IOException {
Row r = gen.new Row();
rows.add(r);
r.setIcon("icon_q_root.gif", "QuestionnaireResponseRoot");
r.getCells().add(gen.new Cell(null, null, q.getId(), null, null));
r.getCells().add(gen.new Cell(null, null, "", null, null));
r.getCells().add(gen.new Cell(null, null, "QuestionnaireResponse", null, null));
r.getCells().add(gen.new Cell(null, null, "", null, null));
return r;
}
use of org.hl7.fhir.dstu2.model.QuestionnaireResponse in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireResponseRenderer method renderTree.
public boolean renderTree(XhtmlNode x, QuestionnaireResponse q) throws UnsupportedEncodingException, IOException {
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
TableModel model = gen.new TableModel("qtree=" + q.getId(), true);
model.setAlternating(true);
model.setDocoImg(context.getSpecificationLink() + "help16.png");
model.setDocoRef(context.getSpecificationLink() + "formats.html#table");
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Definition"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0));
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Answer"), translate("sd.hint", "The type of the item"), null, 0));
boolean hasExt = false;
// first we add a root for the questionaire itself
Row row = addTreeRoot(gen, model.getRows(), q);
for (QuestionnaireResponseItemComponent i : q.getItem()) {
hasExt = renderTreeItem(gen, row.getSubRows(), q, i) || hasExt;
}
XhtmlNode xn = gen.generate(model, context.getLocalPrefix(), 1, null);
x.getChildNodes().add(xn);
return hasExt;
}
use of org.hl7.fhir.dstu2.model.QuestionnaireResponse in project nia-patient-switching-standard-adaptor by NHSDigital.
the class ResourceReferenceUtilTest method testTemplateResourcesReferencedAtEhrCompositionLevel.
@Test
public void testTemplateResourcesReferencedAtEhrCompositionLevel() {
final RCMRMT030101UK04EhrComposition ehrComposition = unmarshallEhrCompositionElement("ehr_composition_template.xml");
List<Reference> references = new ArrayList<>();
resourceReferenceUtil.extractChildReferencesFromEhrComposition(ehrComposition, references);
assertThat(references.size()).isEqualTo(FOUR);
assertThat(references.get(0).getReference()).isEqualTo("QuestionnaireResponse/7334D39A-BBB3-424A-B5D3-E841BCA39BF7-QRSP");
assertThat(references.get(1).getReference()).isEqualTo("Observation/7334D39A-BBB3-424A-B5D3-E841BCA39BF7");
assertThat(references.get(2).getReference()).isEqualTo("Observation/3DCC9FC9-1873-4004-9789-C4E5C52B02B9");
assertThat(references.get(THREE).getReference()).isEqualTo("Observation/278ADD5F-2AC7-48DC-966A-0BA7C029C793");
}
Aggregations