use of org.hl7.fhir.r5.model.DataRequirement.DataRequirementSortComponent in project org.hl7.fhir.core by hapifhir.
the class DataRenderer method renderDataRequirement.
public void renderDataRequirement(XhtmlNode x, DataRequirement dr) throws FHIRFormatError, DefinitionException, IOException {
XhtmlNode tbl = x.table("grid");
XhtmlNode tr = tbl.tr();
XhtmlNode td = tr.td().colspan("2");
td.b().tx("Type");
td.tx(": ");
StructureDefinition sd = context.getWorker().fetchTypeDefinition(dr.getType().toCode());
if (sd != null && sd.hasUserData("path")) {
td.ah(sd.getUserString("path")).tx(dr.getType().toCode());
} else {
td.tx(dr.getType().toCode());
}
if (dr.hasProfile()) {
td.tx(" (");
boolean first = true;
for (CanonicalType p : dr.getProfile()) {
if (first)
first = false;
else
td.tx(" | ");
sd = context.getWorker().fetchResource(StructureDefinition.class, p.getValue());
if (sd != null && sd.hasUserData("path")) {
td.ah(sd.getUserString("path")).tx(sd.present());
} else {
td.tx(p.asStringValue());
}
}
td.tx(")");
}
if (dr.hasSubject()) {
tr = tbl.tr();
td = tr.td().colspan("2");
td.b().tx("Subject");
if (dr.hasSubjectReference()) {
renderReference(td, dr.getSubjectReference());
} else {
renderCodeableConcept(td, dr.getSubjectCodeableConcept());
}
}
if (dr.hasCodeFilter() || dr.hasDateFilter()) {
tr = tbl.tr().backgroundColor("#efefef");
tr.td().tx("Filter");
tr.td().tx("Value");
}
for (DataRequirementCodeFilterComponent cf : dr.getCodeFilter()) {
tr = tbl.tr();
if (cf.hasPath()) {
tr.td().tx(cf.getPath());
} else {
tr.td().tx("Search on " + cf.getSearchParam());
}
if (cf.hasValueSet()) {
td = tr.td();
td.tx("In ValueSet ");
render(td, cf.getValueSetElement());
} else {
boolean first = true;
td = tr.td();
td.tx("One of these codes: ");
for (Coding c : cf.getCode()) {
if (first)
first = false;
else
td.tx(", ");
render(td, c);
}
}
}
for (DataRequirementDateFilterComponent cf : dr.getDateFilter()) {
tr = tbl.tr();
if (cf.hasPath()) {
tr.td().tx(cf.getPath());
} else {
tr.td().tx("Search on " + cf.getSearchParam());
}
render(tr.td(), cf.getValue());
}
if (dr.hasSort() || dr.hasLimit()) {
tr = tbl.tr();
td = tr.td().colspan("2");
if (dr.hasLimit()) {
td.b().tx("Limit");
td.tx(": ");
td.tx(dr.getLimit());
if (dr.hasSort()) {
td.tx(", ");
}
}
if (dr.hasSort()) {
td.b().tx("Sort");
td.tx(": ");
boolean first = true;
for (DataRequirementSortComponent p : dr.getSort()) {
if (first)
first = false;
else
td.tx(" | ");
td.tx(p.getDirection() == SortDirection.ASCENDING ? "+" : "-");
td.tx(p.getPath());
}
}
}
}
use of org.hl7.fhir.r5.model.DataRequirement.DataRequirementSortComponent in project org.hl7.fhir.core by hapifhir.
the class DataRenderer method renderDataRequirement.
public void renderDataRequirement(XhtmlNode x, DataRequirement dr) throws FHIRFormatError, DefinitionException, IOException {
XhtmlNode tbl = x.table("grid");
XhtmlNode tr = tbl.tr();
XhtmlNode td = tr.td().colspan("2");
td.b().tx("Type");
td.tx(": ");
StructureDefinition sd = context.getWorker().fetchTypeDefinition(dr.getType().toCode());
if (sd != null && sd.hasUserData("path")) {
td.ah(sd.getUserString("path")).tx(dr.getType().toCode());
} else {
td.tx(dr.getType().toCode());
}
if (dr.hasProfile()) {
td.tx(" (");
boolean first = true;
for (CanonicalType p : dr.getProfile()) {
if (first)
first = false;
else
td.tx(" | ");
sd = context.getWorker().fetchResource(StructureDefinition.class, p.getValue());
if (sd != null && sd.hasUserData("path")) {
td.ah(sd.getUserString("path")).tx(sd.present());
} else {
td.tx(p.asStringValue());
}
}
td.tx(")");
}
if (dr.hasSubject()) {
tr = tbl.tr();
td = tr.td().colspan("2");
td.b().tx("Subject");
if (dr.hasSubjectReference()) {
renderReference(td, dr.getSubjectReference());
} else {
renderCodeableConcept(td, dr.getSubjectCodeableConcept());
}
}
if (dr.hasCodeFilter() || dr.hasDateFilter()) {
tr = tbl.tr().backgroundColor("#efefef");
tr.td().tx("Filter");
tr.td().tx("Value");
}
for (DataRequirementCodeFilterComponent cf : dr.getCodeFilter()) {
tr = tbl.tr();
if (cf.hasPath()) {
tr.td().tx(cf.getPath());
} else {
tr.td().tx("Search on " + cf.getSearchParam());
}
if (cf.hasValueSet()) {
td = tr.td();
td.tx("In ValueSet ");
render(td, cf.getValueSetElement());
} else {
boolean first = true;
td = tr.td();
td.tx("One of these codes: ");
for (Coding c : cf.getCode()) {
if (first)
first = false;
else
td.tx(", ");
render(td, c);
}
}
}
for (DataRequirementDateFilterComponent cf : dr.getDateFilter()) {
tr = tbl.tr();
if (cf.hasPath()) {
tr.td().tx(cf.getPath());
} else {
tr.td().tx("Search on " + cf.getSearchParam());
}
render(tr.td(), cf.getValue());
}
if (dr.hasSort() || dr.hasLimit()) {
tr = tbl.tr();
td = tr.td().colspan("2");
if (dr.hasLimit()) {
td.b().tx("Limit");
td.tx(": ");
td.tx(dr.getLimit());
if (dr.hasSort()) {
td.tx(", ");
}
}
if (dr.hasSort()) {
td.b().tx("Sort");
td.tx(": ");
boolean first = true;
for (DataRequirementSortComponent p : dr.getSort()) {
if (first)
first = false;
else
td.tx(" | ");
td.tx(p.getDirection() == SortDirection.ASCENDING ? "+" : "-");
td.tx(p.getPath());
}
}
}
}
Aggregations