render contained resources on patient

This commit is contained in:
Grahame Grieve 2024-02-27 23:53:16 +11:00
parent eb770f830a
commit c2c792cb78
1 changed files with 15 additions and 1 deletions

View File

@ -32,6 +32,7 @@ import org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper;
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.PropertyWrapper; import org.hl7.fhir.r5.renderers.utils.BaseWrappers.PropertyWrapper;
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper; import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper;
import org.hl7.fhir.r5.renderers.utils.RenderingContext; import org.hl7.fhir.r5.renderers.utils.RenderingContext;
import org.hl7.fhir.r5.utils.EOperationOutcome;
import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlNode; import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -269,7 +270,7 @@ public class PatientRenderer extends ResourceRenderer {
} }
@Override @Override
public boolean render(XhtmlNode x, ResourceWrapper r) throws FHIRFormatError, DefinitionException, IOException { public boolean render(XhtmlNode x, ResourceWrapper r) throws IOException, FHIRException, EOperationOutcome {
// banner // banner
describe(makeBanner(x.para()), r); describe(makeBanner(x.para()), r);
x.hr(); x.hr();
@ -295,9 +296,22 @@ public class PatientRenderer extends ResourceRenderer {
if (tbl.isEmpty()) { if (tbl.isEmpty()) {
x.remove(tbl); x.remove(tbl);
} }
if (r.has("contained") && context.isTechnicalMode()) {
x.hr();
x.para().b().tx("Contained Resources");
addContained(x, r.getContained());
}
return false; return false;
} }
private void addContained(XhtmlNode x, List<ResourceWrapper> list) throws FHIRFormatError, DefinitionException, FHIRException, IOException, EOperationOutcome {
for (ResourceWrapper c : list) {
x.hr();
x.an(c.getId());
new RendererFactory().factory(c, context).render(x, c);
}
}
private void addExtensions(XhtmlNode tbl, ResourceWrapper r) throws UnsupportedEncodingException, FHIRException, IOException { private void addExtensions(XhtmlNode tbl, ResourceWrapper r) throws UnsupportedEncodingException, FHIRException, IOException {
Map<String, List<Extension>> extensions = new HashMap<>(); Map<String, List<Extension>> extensions = new HashMap<>();
PropertyWrapper pw = getProperty(r, "extension"); PropertyWrapper pw = getProperty(r, "extension");