update to bundle rendering to fix broken links

This commit is contained in:
Grahame Grieve 2024-04-04 06:50:00 +11:00
parent 5faa2df2fa
commit f9a3501857
2 changed files with 5 additions and 1 deletions

View File

@ -84,9 +84,11 @@ public class BundleRenderer extends ResourceRenderer {
if (be.has("resource")) {
if (be.getChildByName("resource").getValues().get(0).has("id")) {
root.an(be.get("resource").fhirType() + "_" + be.getChildByName("resource").getValues().get(0).get("id").primitiveValue());
root.an("hc"+be.get("resource").fhirType() + "_" + be.getChildByName("resource").getValues().get(0).get("id").primitiveValue());
} else {
String id = makeIdFromBundleEntry(be.get("fullUrl").primitiveValue());
root.an(be.get("resource").fhirType() + "_" + id);
root.an("hc"+be.get("resource").fhirType() + "_" + id);
}
}
root.hr();
@ -305,9 +307,11 @@ public class BundleRenderer extends ResourceRenderer {
if (be.hasResource()) {
if (be.getResource().hasId()) {
x.an(be.getResource().getResourceType().name() + "_" + be.getResource().getId());
x.an("hc"+be.getResource().getResourceType().name() + "_" + be.getResource().getId());
} else {
String id = makeIdFromBundleEntry(be.getFullUrl());
x.an(be.getResource().getResourceType().name() + "_" + id);
x.an("hc"+be.getResource().getResourceType().name() + "_" + id);
}
}
x.hr();

View File

@ -380,7 +380,7 @@ public abstract class ResourceRenderer extends DataRenderer {
if (tr.getReference().startsWith("#")) {
onPage = true;
if (context.getRules() == GenerationRules.IG_PUBLISHER || (tr != null && tr.getKind() != ResourceReferenceKind.BUNDLE)) {
c = x.ah("#hc"+r.getReference().substring(1));
c = x.ah("#hc"+tr.getReference().substring(1));
} else {
c = x;
}