Add rendering for UsageContext

This commit is contained in:
Grahame Grieve 2023-07-31 14:37:51 +10:00
parent b42c908328
commit be8276bd4a
2 changed files with 11 additions and 1 deletions

View File

@ -67,6 +67,7 @@ import org.hl7.fhir.r5.model.Timing.EventTiming;
import org.hl7.fhir.r5.model.Timing.TimingRepeatComponent;
import org.hl7.fhir.r5.model.Timing.UnitsOfTime;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.UsageContext;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent;
import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent;
@ -1517,6 +1518,12 @@ public class DataRenderer extends Renderer implements CodeResolver {
x.addText(!p.hasEnd() ? "(ongoing)" : displayDateTime(p.getEndElement()));
}
public void renderUsageContext(XhtmlNode x, UsageContext u) throws FHIRFormatError, DefinitionException, IOException {
renderCoding(x, u.getCode());
x.tx(": ");
render(x, u.getValue());
}
public void renderDataRequirement(XhtmlNode x, DataRequirement dr) throws FHIRFormatError, DefinitionException, IOException {
XhtmlNode tbl = x.table("grid");
XhtmlNode tr = tbl.tr();

View File

@ -485,8 +485,11 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
} else if (e instanceof Resource) {
return;
} else if (e instanceof DataRequirement) {
DataRequirement p = (DataRequirement) e;
DataRequirement p = (DataRequirement) e;
renderDataRequirement(x, p);
} else if (e instanceof UsageContext) {
UsageContext p = (UsageContext) e;
renderUsageContext(x, p);
} else if (e instanceof PrimitiveType) {
x.tx(((PrimitiveType) e).primitiveValue());
} else if (e instanceof ElementDefinition) {