Search in sources :

Example 6 with QuestionnaireResponseItemComponent

use of org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireResponseRenderer method genDefinitionLink.

public void genDefinitionLink(HierarchicalTableGenerator gen, QuestionnaireResponseItemComponent i, Cell defn) {
    // can we resolve the definition?
    String path = null;
    String d = i.getDefinition();
    if (d.contains("#")) {
        path = d.substring(d.indexOf("#") + 1);
        d = d.substring(0, d.indexOf("#"));
    }
    StructureDefinition sd = context.getWorker().fetchResource(StructureDefinition.class, d);
    if (sd != null) {
        String url = sd.getUserString("path");
        if (url != null) {
            defn.getPieces().add(gen.new Piece(url + "#" + path, path, null));
        } else {
            defn.getPieces().add(gen.new Piece(null, i.getDefinition(), null));
        }
    } else {
        defn.getPieces().add(gen.new Piece(null, i.getDefinition(), null));
    }
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) Piece(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece)

Example 7 with QuestionnaireResponseItemComponent

use of org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireResponseRenderer method genDefinitionLink.

public void genDefinitionLink(XhtmlNode x, QuestionnaireResponseItemComponent i) {
    // can we resolve the definition?
    String path = null;
    String d = i.getDefinition();
    if (d.contains("#")) {
        path = d.substring(d.indexOf("#") + 1);
        d = d.substring(0, d.indexOf("#"));
    }
    StructureDefinition sd = context.getWorker().fetchResource(StructureDefinition.class, d);
    if (sd != null) {
        String url = sd.getUserString("path");
        if (url != null) {
            x.ah(url + "#" + path).tx(path);
        } else {
            x.tx(i.getDefinition());
        }
    } else {
        x.tx(i.getDefinition());
    }
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition)

Example 8 with QuestionnaireResponseItemComponent

use of org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireResponseRenderer method genDefinitionLink.

public void genDefinitionLink(HierarchicalTableGenerator gen, QuestionnaireResponseItemComponent i, Cell defn) {
    // can we resolve the definition?
    String path = null;
    String d = i.getDefinition();
    if (d.contains("#")) {
        path = d.substring(d.indexOf("#") + 1);
        d = d.substring(0, d.indexOf("#"));
    }
    StructureDefinition sd = context.getWorker().fetchResource(StructureDefinition.class, d);
    if (sd != null) {
        String url = sd.getUserString("path");
        if (url != null) {
            defn.getPieces().add(gen.new Piece(url + "#" + path, path, null));
        } else {
            defn.getPieces().add(gen.new Piece(null, i.getDefinition(), null));
        }
    } else {
        defn.getPieces().add(gen.new Piece(null, i.getDefinition(), null));
    }
}
Also used : StructureDefinition(org.hl7.fhir.r4b.model.StructureDefinition) Piece(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece)

Example 9 with QuestionnaireResponseItemComponent

use of org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent 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.r4b.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent) Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)

Example 10 with QuestionnaireResponseItemComponent

use of org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent in project org.hl7.fhir.core by hapifhir.

the class QuestionnaireResponseRenderer method genDefinitionLink.

public void genDefinitionLink(XhtmlNode x, QuestionnaireResponseItemComponent i) {
    // can we resolve the definition?
    String path = null;
    String d = i.getDefinition();
    if (d.contains("#")) {
        path = d.substring(d.indexOf("#") + 1);
        d = d.substring(0, d.indexOf("#"));
    }
    StructureDefinition sd = context.getWorker().fetchResource(StructureDefinition.class, d);
    if (sd != null) {
        String url = sd.getUserString("path");
        if (url != null) {
            x.ah(url + "#" + path).tx(path);
        } else {
            x.tx(i.getDefinition());
        }
    } else {
        x.tx(i.getDefinition());
    }
}
Also used : StructureDefinition(org.hl7.fhir.r4b.model.StructureDefinition)

Aggregations

Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)4 QuestionnaireResponseItemComponent (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent)3 QuestionnaireResponseItemAnswerComponent (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent)2 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)2 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)2 HierarchicalTableGenerator (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator)2 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)2 Piece (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece)2 TableModel (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel)2 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)2 FhirContext (ca.uhn.fhir.context.FhirContext)1 DataFormatException (ca.uhn.fhir.parser.DataFormatException)1 IParser (ca.uhn.fhir.parser.IParser)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1