r4b changes for r5

This commit is contained in:
Grahame Grieve 2022-08-10 22:22:50 +10:00
parent ba2ff9390d
commit 84cb59683c
2 changed files with 15 additions and 6 deletions

View File

@ -103,14 +103,19 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
@Override
public boolean render(XhtmlNode x, ResourceWrapper r) throws FHIRFormatError, DefinitionException, IOException {
boolean idDone = false;
XhtmlNode p = x.para();
if (context.isAddGeneratedNarrativeHeader()) {
x.para().b().tx("Generated Narrative: "+r.fhirType());
}
if (!Utilities.noString(r.getId())) {
x.an(r.getId());
p.b().tx("Generated Narrative: "+r.fhirType());
p.an(r.getId());
idDone = true;
}
if (context.isTechnicalMode() && !context.isContained()) {
renderResourceHeader(r, x);
renderResourceHeader(r, x, !idDone);
idDone = true;
}
if (!Utilities.noString(r.getId()) && !idDone) {
x.para().an(r.getId());
}
try {
StructureDefinition sd = r.getDefinition();

View File

@ -397,12 +397,16 @@ public abstract class ResourceRenderer extends DataRenderer {
return true;
}
protected void renderResourceHeader(ResourceWrapper r, XhtmlNode x) throws UnsupportedEncodingException, FHIRException, IOException {
protected void renderResourceHeader(ResourceWrapper r, XhtmlNode x, boolean doId) throws UnsupportedEncodingException, FHIRException, IOException {
XhtmlNode div = x.div().style("display: inline-block").style("background-color: #d9e0e7").style("padding: 6px")
.style("margin: 4px").style("border: 1px solid #8da1b4")
.style("border-radius: 5px").style("line-height: 60%");
String id = getPrimitiveValue(r, "id");
if (doId) {
div.an(id);
}
String lang = getPrimitiveValue(r, "language");
String ir = getPrimitiveValue(r, "implicitRules");
BaseWrapper meta = r.getChildByName("meta").hasValues() ? r.getChildByName("meta").getValues().get(0) : null;