use of org.hl7.fhir.r4b.model.DataType in project org.hl7.fhir.core by hapifhir.
the class StructureMapUtilities method describeTransformCCorC.
@SuppressWarnings("rawtypes")
private String describeTransformCCorC(StructureMapGroupRuleTargetComponent tgt) throws FHIRException {
if (tgt.getParameter().size() < 2)
return null;
DataType p1 = tgt.getParameter().get(0).getValue();
DataType p2 = tgt.getParameter().get(1).getValue();
if (p1 instanceof IdType || p2 instanceof IdType)
return null;
if (!(p1 instanceof PrimitiveType) || !(p2 instanceof PrimitiveType))
return null;
String uri = ((PrimitiveType) p1).asStringValue();
String code = ((PrimitiveType) p2).asStringValue();
if (Utilities.noString(uri))
throw new FHIRException("Describe Transform, but the uri is blank");
if (Utilities.noString(code))
throw new FHIRException("Describe Transform, but the code is blank");
Coding c = buildCoding(uri, code);
return TerminologyRenderer.describeSystem(c.getSystem()) + "#" + c.getCode() + (c.hasDisplay() ? "(" + c.getDisplay() + ")" : "");
}
use of org.hl7.fhir.r4b.model.DataType in project org.hl7.fhir.core by hapifhir.
the class StructureMapUtilities method getParam.
private Base getParam(Variables vars, StructureMapGroupRuleTargetParameterComponent parameter) throws DefinitionException {
DataType p = parameter.getValue();
if (!(p instanceof IdType))
return p;
else {
String n = ((IdType) p).asStringValue();
Base b = vars.get(VariableMode.INPUT, n);
if (b == null)
b = vars.get(VariableMode.OUTPUT, n);
if (b == null)
throw new DefinitionException("Variable " + n + " not found (" + vars.summary() + ")");
return b;
}
}
use of org.hl7.fhir.r4b.model.DataType in project org.hl7.fhir.core by hapifhir.
the class DataRenderer method renderExtensionsInList.
public void renderExtensionsInList(XhtmlNode ul, DataType element) throws FHIRFormatError, DefinitionException, IOException {
for (Extension ext : element.getExtension()) {
if (canRender(ext)) {
String lbl = getExtensionLabel(ext);
XhtmlNode li = ul.li();
li.tx(lbl);
li.tx(": ");
render(li, ext.getValue());
}
}
}
use of org.hl7.fhir.r4b.model.DataType in project org.hl7.fhir.core by hapifhir.
the class DiagnosticReportRenderer method buildObservationsTable.
private void buildObservationsTable(XhtmlNode root, List<ObservationNode> observations, DataType eff, DataType iss) throws UnsupportedEncodingException, FHIRException, IOException {
XhtmlNode tbl = root.table("grid");
boolean refRange = scanObsForRefRange(observations);
boolean flags = scanObsForFlags(observations);
boolean note = scanObsForNote(observations);
boolean effectiveTime = scanObsForEffective(observations, eff);
boolean issued = scanObsForIssued(observations, iss);
int cs = 2;
if (refRange)
cs++;
if (flags)
cs++;
if (note)
cs++;
if (issued)
cs++;
if (effectiveTime)
cs++;
XhtmlNode tr = tbl.tr();
tr.td().b().tx("Code");
tr.td().b().tx("Value");
if (refRange) {
tr.td().b().tx("Reference Range");
}
if (flags) {
tr.td().b().tx("Flags");
}
if (note) {
tr.td().b().tx("Note");
}
if (effectiveTime) {
tr.td().b().tx("When For");
}
if (issued) {
tr.td().b().tx("Reported");
}
for (ObservationNode o : observations) {
addObservationToTable(tbl, o, 0, Integer.toString(cs), refRange, flags, note, effectiveTime, issued, eff, iss);
}
}
use of org.hl7.fhir.r4b.model.DataType 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;
}
Aggregations