questionnaire rendering improvements

This commit is contained in:
Grahame Grieve 2024-12-02 06:50:31 +03:00
parent 7d54780cad
commit 1cdb7ea695
5 changed files with 18 additions and 7 deletions

View File

@ -99,7 +99,7 @@ public class DiagnosticReportRenderer extends ResourceRenderer {
for (ResourceWrapper cont : dr.children("contained")) {
x.hr();
RendererFactory.factory(cont, context.forContained()).buildNarrative(status, x, cont);
RendererFactory.factory(cont, context.forContained()).setInner(true).buildNarrative(status, x, cont);
}
}

View File

@ -75,7 +75,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
first = false;
}
x.hr();
RendererFactory.factory(cont, context.forContained()).buildNarrative(status, x, cont);
RendererFactory.factory(cont, context.forContained()).setInner(true).buildNarrative(status, x, cont);
}
}
@ -565,7 +565,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
if (i.has("answerValueSet")) {
if (!defn.getPieces().isEmpty()) defn.addPiece(gen.new Piece("br"));
defn.getPieces().add(gen.new Piece(null, (context.formatPhrase(RenderingContext.QUEST_VALUE)+" "), null));
if (Utilities.noString(i.primitiveValue("answerValueSet")) && i.primitiveValue("answerValueSet").startsWith("#")) {
if (Utilities.noString(i.primitiveValue("answerValueSet")) && i.primitiveValue("answerValueSet").startsWith("#")) {
ResourceWrapper vs = q.getContained(i.primitiveValue("answerValueSet").substring(1));
if (vs == null) {
defn.getPieces().add(gen.new Piece(null, i.primitiveValue("answerValueSet"), null));

View File

@ -76,6 +76,7 @@ public class RendererFactory {
case "Patient": return new PatientRenderer(context);
case "Provenance": return new ProvenanceRenderer(context);
case "Parameters": return new ParametersRenderer(context);
case "Questionnaire": return new QuestionnaireRenderer(context);
case "QuestionnaireResponse": return new QuestionnaireResponseRenderer(context);
}
if (resource.isDirect()) {

View File

@ -51,6 +51,7 @@ public abstract class ResourceRenderer extends DataRenderer {
protected XVerExtensionManager xverManager;
protected boolean multiLangMode;
protected boolean inner;
public ResourceRenderer(RenderingContext context) {
@ -70,6 +71,15 @@ public abstract class ResourceRenderer extends DataRenderer {
return false;
}
public boolean isInner() {
return inner;
}
public ResourceRenderer setInner(boolean inner) {
this.inner = inner;
return this;
}
/**
* Just build the narrative that would go in the resource (per @renderResource()), but don't put it in the resource
* @param dr
@ -837,9 +847,9 @@ public abstract class ResourceRenderer extends DataRenderer {
XhtmlNode p = x.para().attribute("class", "res-header-id");
String ft = context.getTranslatedCode(r.fhirType(), "http://hl7.org/fhir/fhir-types");
if (desc == null) {
p.b().tx(context.formatPhrase(context.isTechnicalMode() ? RenderingContext.PROF_DRIV_GEN_NARR_TECH : RenderingContext.PROF_DRIV_GEN_NARR, ft, ""));
p.b().tx(context.formatPhrase(context.isTechnicalMode() && !isInner() ? RenderingContext.PROF_DRIV_GEN_NARR_TECH : RenderingContext.PROF_DRIV_GEN_NARR, ft, ""));
} else {
p.b().tx(context.formatPhrase(context.isTechnicalMode() ? RenderingContext.PROF_DRIV_GEN_NARR_TECH : RenderingContext.PROF_DRIV_GEN_NARR, ft, desc));
p.b().tx(context.formatPhrase(context.isTechnicalMode() && !isInner() ? RenderingContext.PROF_DRIV_GEN_NARR_TECH : RenderingContext.PROF_DRIV_GEN_NARR, ft, desc));
}
// first thing we do is lay down the resource anchors.
@ -1464,7 +1474,7 @@ public abstract class ResourceRenderer extends DataRenderer {
context.addAnchor(id);
x.an(context.prefixAnchor(id));
}
RendererFactory.factory(c, context.forContained()).buildNarrative(status, x, c);
RendererFactory.factory(c, context.forContained()).setInner(true).buildNarrative(status, x, c);
}
}

View File

@ -256,7 +256,7 @@ public class ResourceWrapperModel extends ResourceWrapper {
}
public String getWebPath() {
return null;
return model.getWebPath();
}
public String getCodeSystemUri() {