From 01a5420a68c5d82db79a7d57fec091a43303b5ee Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 29 Apr 2020 14:49:08 +1000 Subject: [PATCH] Generate Narrative correctly for ContactDetails --- .../java/org/hl7/fhir/r5/model/Coding.java | 4 ++++ .../hl7/fhir/r5/utils/NarrativeGenerator.java | 21 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Coding.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Coding.java index 0d1e8eef7..f10416cb8 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Coding.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Coding.java @@ -567,6 +567,10 @@ public class Coding extends DataType implements IBaseCoding, ICompositeType, ICo base = base+": "+getDisplay(); return base; + } + + public boolean matches(Coding other) { + return other.hasCode() && this.hasCode() && other.hasSystem() && this.hasSystem() && this.getCode().equals(other.getCode()) && this.getSystem().equals(other.getSystem()) ; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java index d0e7d6701..0e028f0f6 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java @@ -1542,6 +1542,16 @@ public class NarrativeGenerator implements INarrativeGenerator { renderAddress((Address) e, x); } else if (e instanceof ContactPoint) { renderContactPoint((ContactPoint) e, x); + } else if (e instanceof ContactDetail) { + ContactDetail cd = (ContactDetail) e; + if (cd.hasName()) { + x.tx(cd.getName()+": "); + } + boolean first = true; + for (ContactPoint c : cd.getTelecom()) { + if (first) first = false; else x.tx(","); + renderContactPoint(c, x); + } } else if (e instanceof UriType) { renderUri((UriType) e, x, defn.getPath(), rc != null && rc.resourceResource != null ? rc.resourceResource.getId() : null); } else if (e instanceof Timing) { @@ -1709,7 +1719,16 @@ public class NarrativeGenerator implements INarrativeGenerator { } else if (e instanceof Resource) { return false; } else if (e instanceof ContactDetail) { - return false; + ContactDetail cd = (ContactDetail) e; + if (cd.hasName()) { + x.tx(cd.getName()+": "); + } + boolean first = true; + for (ContactPoint c : cd.getTelecom()) { + if (first) first = false; else x.tx(","); + renderContactPoint(c, x); + } + return true; } else if (e instanceof Range) { return false; } else if (e instanceof Meta) {