From 1c29587015732abe5c777c5052b7b4d627318c47 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 26 Aug 2022 21:18:39 +1000 Subject: [PATCH] fixed --- .../fhir/r4b/renderers/CodeSystemRenderer.java | 18 +++++++++++++----- .../fhir/r5/renderers/CodeSystemRenderer.java | 10 ++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/CodeSystemRenderer.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/CodeSystemRenderer.java index 6ec470092..241da9890 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/CodeSystemRenderer.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/CodeSystemRenderer.java @@ -95,9 +95,11 @@ public class CodeSystemRenderer extends TerminologyRenderer { if (cs.hasProperty()) { boolean hasRendered = false; boolean hasURI = false; + boolean hasDescription = false; for (PropertyComponent p : cs.getProperty()) { hasRendered = hasRendered || !p.getCode().equals(ToolingExtensions.getPresentation(p, p.getCodeElement())); hasURI = hasURI || p.hasUri(); + hasDescription = hasDescription || p.hasDescription(); } x.para().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Properties", getContext().getLang())); @@ -111,7 +113,9 @@ public class CodeSystemRenderer extends TerminologyRenderer { tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "URL", getContext().getLang())); } tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Type", getContext().getLang())); + if (hasDescription) { tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Description", getContext().getLang())); + } for (PropertyComponent p : cs.getProperty()) { tr = tbl.tr(); if (hasRendered) { @@ -122,21 +126,25 @@ public class CodeSystemRenderer extends TerminologyRenderer { tr.td().tx(p.getUri()); } tr.td().tx(p.hasType() ? p.getType().toCode() : ""); + if (hasDescription) { tr.td().tx(p.getDescription()); } } } + } private boolean generateCodeSystemContent(XhtmlNode x, CodeSystem cs, boolean hasExtensions, List maps) throws FHIRFormatError, DefinitionException, IOException { XhtmlNode p = x.para(); + p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), "This code system ")); + p.code().tx(cs.getUrl()); if (cs.getContent() == CodeSystemContentMode.COMPLETE) - p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), "This code system %s defines the following codes", cs.getUrl())+":"); + p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), " defines the following codes")+":"); else if (cs.getContent() == CodeSystemContentMode.EXAMPLE) - p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), "This code system %s defines some example codes", cs.getUrl())+":"); + p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), " defines some example codes")+":"); else if (cs.getContent() == CodeSystemContentMode.FRAGMENT ) - p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), "This code system %s defines many codes, of which the following are a subset", cs.getUrl())+":"); + p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), " defines many codes, of which the following are a subset")+":"); else if (cs.getContent() == CodeSystemContentMode.NOTPRESENT ) { - p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), "This code system %s defines many codes, but they are not represented here", cs.getUrl())); + p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), " defines many codes, but they are not represented here")); return false; } XhtmlNode t = x.table( "codes"); @@ -245,7 +253,7 @@ public class CodeSystemRenderer extends TerminologyRenderer { if (cs == null) { return false; } - return CodeSystemUtilities.hasCode(cs, code); + return code == null ? false : CodeSystemUtilities.hasCode(cs, code); } return false; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java index 4ed97f849..bb8d121b2 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java @@ -135,14 +135,16 @@ public class CodeSystemRenderer extends TerminologyRenderer { private boolean generateCodeSystemContent(XhtmlNode x, CodeSystem cs, boolean hasExtensions, List maps) throws FHIRFormatError, DefinitionException, IOException { XhtmlNode p = x.para(); + p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), "This code system ")); + p.code().tx(cs.getUrl()); if (cs.getContent() == CodeSystemContentMode.COMPLETE) - p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), "This code system %s defines the following codes", cs.getUrl())+":"); + p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), " defines the following codes")+":"); else if (cs.getContent() == CodeSystemContentMode.EXAMPLE) - p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), "This code system %s defines some example codes", cs.getUrl())+":"); + p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), " defines some example codes")+":"); else if (cs.getContent() == CodeSystemContentMode.FRAGMENT ) - p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), "This code system %s defines many codes, of which the following are a subset", cs.getUrl())+":"); + p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), " defines many codes, of which the following are a subset")+":"); else if (cs.getContent() == CodeSystemContentMode.NOTPRESENT ) { - p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), "This code system %s defines many codes, but they are not represented here", cs.getUrl())); + p.tx(getContext().getWorker().translator().translateAndFormat("xhtml-gen-cs", getContext().getLang(), " defines many codes, but they are not represented here")); return false; } XhtmlNode t = x.table( "codes");