use of org.hl7.fhir.r4b.renderers.utils.BaseWrappers.PropertyWrapper in project org.hl7.fhir.core by hapifhir.
the class ParametersRenderer method render.
@Override
public boolean render(XhtmlNode x, ResourceWrapper params) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome {
x.h2().tx("Parameters");
XhtmlNode tbl = x.table("grid");
PropertyWrapper pw = getProperty(params, "parameter");
if (valued(pw)) {
paramsW(tbl, pw.getValues(), 0);
}
return false;
}
use of org.hl7.fhir.r4b.renderers.utils.BaseWrappers.PropertyWrapper in project org.hl7.fhir.core by hapifhir.
the class DiagnosticReportRenderer method scanObsForFlags.
private boolean scanObsForFlags(List<ObservationNode> observations) throws UnsupportedEncodingException, FHIRException, IOException {
for (ObservationNode o : observations) {
if (o.obs != null && o.obs.getResource() != null) {
PropertyWrapper pw = getProperty(o.obs.getResource(), "interpretation");
if (valued(pw)) {
return true;
}
pw = getProperty(o.obs.getResource(), "status");
if (valued(pw)) {
if (!pw.value().getBase().primitiveValue().equals("final")) {
return true;
}
}
}
if (o.contained != null) {
if (scanObsForFlags(o.contained)) {
return true;
}
}
}
return false;
}
use of org.hl7.fhir.r4b.renderers.utils.BaseWrappers.PropertyWrapper in project org.hl7.fhir.core by hapifhir.
the class DiagnosticReportRenderer method render.
public boolean render(XhtmlNode x, ResourceWrapper dr) throws IOException, FHIRException, EOperationOutcome {
XhtmlNode h2 = x.h2();
render(h2, getProperty(dr, "code").value());
h2.tx(" ");
PropertyWrapper pw = getProperty(dr, "category");
if (valued(pw)) {
h2.tx("(");
boolean first = true;
for (BaseWrapper b : pw.getValues()) {
if (first)
first = false;
else
h2.tx(", ");
render(h2, b);
}
h2.tx(") ");
}
XhtmlNode tbl = x.table("grid");
XhtmlNode tr;
if (dr.has("subject")) {
tr = tbl.tr();
tr.td().tx("Subject");
populateSubjectSummary(tr.td(), getProperty(dr, "subject").value());
}
DataType eff = null;
DataType iss = null;
if (dr.has("effective[x]")) {
tr = tbl.tr();
tr.td().tx("When For");
eff = (DataType) getProperty(dr, "effective[x]").value().getBase();
render(tr.td(), eff);
}
if (dr.has("issued")) {
tr = tbl.tr();
tr.td().tx("Reported");
eff = (DataType) getProperty(dr, "issued").value().getBase();
render(tr.td(), getProperty(dr, "issued").value());
}
pw = getProperty(dr, "perfomer");
if (valued(pw)) {
tr = tbl.tr();
tr.td().tx(Utilities.pluralize("Performer", pw.getValues().size()));
XhtmlNode tdr = tr.td();
for (BaseWrapper v : pw.getValues()) {
tdr.tx(" ");
render(tdr, v);
}
}
pw = getProperty(dr, "identifier");
if (valued(pw)) {
tr = tbl.tr();
tr.td().tx(Utilities.pluralize("Identifier", pw.getValues().size()) + ":");
XhtmlNode tdr = tr.td();
for (BaseWrapper v : pw.getValues()) {
tdr.tx(" ");
render(tdr, v);
}
}
pw = getProperty(dr, "request");
if (valued(pw)) {
tr = tbl.tr();
tr.td().tx(Utilities.pluralize("Request", pw.getValues().size()) + ":");
XhtmlNode tdr = tr.td();
for (BaseWrapper v : pw.getValues()) {
tdr.tx(" ");
render(tdr, v);
}
tdr.br();
}
x.para().b().tx("Report Details");
pw = getProperty(dr, "result");
if (valued(pw)) {
List<ObservationNode> observations = fetchObservations(pw.getValues(), dr);
buildObservationsTable(x, observations, eff, iss);
}
pw = getProperty(dr, "conclusion");
if (valued(pw)) {
render(x.para(), pw.value());
}
pw = getProperty(dr, "conclusionCode");
if (!valued(pw)) {
pw = getProperty(dr, "codedDiagnosis");
}
if (valued(pw)) {
XhtmlNode p = x.para();
p.b().tx("Coded Conclusions :");
XhtmlNode ul = x.ul();
for (BaseWrapper v : pw.getValues()) {
render(ul.li(), v);
}
}
return false;
}
use of org.hl7.fhir.r4b.renderers.utils.BaseWrappers.PropertyWrapper in project org.hl7.fhir.core by hapifhir.
the class DiagnosticReportRenderer method fetchObservations.
private List<ObservationNode> fetchObservations(List<BaseWrapper> list, ResourceWrapper rw) throws UnsupportedEncodingException, FHIRException, IOException {
List<ObservationNode> res = new ArrayList<ObservationNode>();
for (BaseWrapper b : list) {
if (b.has("reference")) {
ObservationNode obs = new ObservationNode();
obs.ref = b.get("reference").primitiveValue();
obs.obs = resolveReference(rw, obs.ref);
if (obs.obs != null && obs.obs.getResource() != null) {
PropertyWrapper t = getProperty(obs.obs.getResource(), "contained");
if (t != null && t.hasValues()) {
obs.contained = fetchObservations(t.getValues(), rw);
}
}
res.add(obs);
}
}
return res;
}
use of org.hl7.fhir.r4b.renderers.utils.BaseWrappers.PropertyWrapper in project org.hl7.fhir.core by hapifhir.
the class LibraryRenderer method render.
public boolean render(XhtmlNode x, ResourceWrapper lib) throws FHIRFormatError, DefinitionException, IOException {
PropertyWrapper authors = lib.getChildByName("author");
PropertyWrapper editors = lib.getChildByName("editor");
PropertyWrapper reviewers = lib.getChildByName("reviewer");
PropertyWrapper endorsers = lib.getChildByName("endorser");
if ((authors != null && authors.hasValues()) || (editors != null && editors.hasValues()) || (reviewers != null && reviewers.hasValues()) || (endorsers != null && endorsers.hasValues())) {
boolean email = hasCT(authors, "email") || hasCT(editors, "email") || hasCT(reviewers, "email") || hasCT(endorsers, "email");
boolean phone = hasCT(authors, "phone") || hasCT(editors, "phone") || hasCT(reviewers, "phone") || hasCT(endorsers, "phone");
boolean url = hasCT(authors, "url") || hasCT(editors, "url") || hasCT(reviewers, "url") || hasCT(endorsers, "url");
x.h2().tx("Participants");
XhtmlNode t = x.table("grid");
if (authors != null) {
for (BaseWrapper cd : authors.getValues()) {
participantRow(t, "Author", cd, email, phone, url);
}
}
if (authors != null) {
for (BaseWrapper cd : editors.getValues()) {
participantRow(t, "Editor", cd, email, phone, url);
}
}
if (authors != null) {
for (BaseWrapper cd : reviewers.getValues()) {
participantRow(t, "Reviewer", cd, email, phone, url);
}
}
if (authors != null) {
for (BaseWrapper cd : endorsers.getValues()) {
participantRow(t, "Endorser", cd, email, phone, url);
}
}
}
PropertyWrapper artifacts = lib.getChildByName("relatedArtifact");
if (artifacts != null && artifacts.hasValues()) {
x.h2().tx("Related Artifacts");
XhtmlNode t = x.table("grid");
boolean label = false;
boolean display = false;
boolean citation = false;
for (BaseWrapper ra : artifacts.getValues()) {
label = label || ra.has("label");
display = display || ra.has("display");
citation = citation || ra.has("citation");
}
for (BaseWrapper ra : artifacts.getValues()) {
renderArtifact(t, ra, lib, label, display, citation);
}
}
PropertyWrapper parameters = lib.getChildByName("parameter");
if (parameters != null && parameters.hasValues()) {
x.h2().tx("Parameters");
XhtmlNode t = x.table("grid");
boolean doco = false;
for (BaseWrapper p : parameters.getValues()) {
doco = doco || p.has("documentation");
}
for (BaseWrapper p : parameters.getValues()) {
renderParameter(t, p, doco);
}
}
PropertyWrapper dataRequirements = lib.getChildByName("dataRequirement");
if (dataRequirements != null && dataRequirements.hasValues()) {
x.h2().tx("Data Requirements");
for (BaseWrapper p : dataRequirements.getValues()) {
renderDataRequirement(x, (DataRequirement) p.getBase());
}
}
PropertyWrapper contents = lib.getChildByName("content");
if (contents != null) {
x.h2().tx("Contents");
boolean isCql = false;
int counter = 0;
for (BaseWrapper p : contents.getValues()) {
Attachment att = (Attachment) p.getBase();
renderAttachment(x, att, isCql, counter, lib.getId());
isCql = isCql || (att.hasContentType() && att.getContentType().startsWith("text/cql"));
counter++;
}
}
return false;
}
Aggregations