Fix up Questionnaire rendering/conversion problem for R5
This commit is contained in:
parent
a64d7440df
commit
8aa77b97cd
|
@ -1,5 +1,7 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
import org.hl7.fhir.r5.renderers.QuestionnaireRenderer;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
All rights reserved.
|
||||
|
@ -101,4 +103,5 @@ public class VersionConvertorConstants {
|
|||
|
||||
public static final String EXT_OLD_CONCEPTMAP_EQUIVALENCE = "http://hl7.org/fhir/1.0/StructureDefinition/extension-ConceptMap.element.target.equivalence";
|
||||
public static final String EXT_ACTUAL_RESOURCE_NAME = "http://hl7.org/fhir/tools/StructureDefinition/original-resource-name";
|
||||
public static final String EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL = QuestionnaireRenderer.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package org.hl7.fhir.convertors.conv10_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_50;
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
|
||||
import org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat;
|
||||
|
@ -10,6 +11,7 @@ import org.hl7.fhir.r5.model.ContactDetail;
|
|||
import org.hl7.fhir.r5.model.Questionnaire;
|
||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
|
||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
|
||||
public class Questionnaire10_50 {
|
||||
|
||||
|
@ -126,8 +128,11 @@ public class Questionnaire10_50 {
|
|||
if (src == null || src.isEmpty())
|
||||
return null;
|
||||
org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormatEnumFactory());
|
||||
VersionConvertor_10_50.copyElement(src, tgt);
|
||||
switch(src.getValue()) {
|
||||
VersionConvertor_10_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL);
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) {
|
||||
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL));
|
||||
} else {
|
||||
switch(src.getValue()) {
|
||||
case BOOLEAN:
|
||||
tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN);
|
||||
break;
|
||||
|
@ -174,6 +179,7 @@ public class Questionnaire10_50 {
|
|||
tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -239,6 +245,7 @@ public class Questionnaire10_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
|
||||
VersionConvertor_10_50.copyElement(src, tgt);
|
||||
tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString()));
|
||||
switch(src.getValue()) {
|
||||
case BOOLEAN:
|
||||
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.hl7.fhir.convertors.conv14_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_14_50;
|
||||
import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
@ -7,6 +8,7 @@ import org.hl7.fhir.r5.model.CodeType;
|
|||
import org.hl7.fhir.r5.model.ContactDetail;
|
||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
|
||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.r5.model.UsageContext;
|
||||
|
||||
public class Questionnaire14_50 {
|
||||
|
@ -202,6 +204,7 @@ public class Questionnaire14_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
|
||||
VersionConvertor_14_50.copyElement(src, tgt);
|
||||
tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString()));
|
||||
switch(src.getValue()) {
|
||||
case GROUP:
|
||||
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP);
|
||||
|
@ -268,8 +271,11 @@ public class Questionnaire14_50 {
|
|||
if (src == null || src.isEmpty())
|
||||
return null;
|
||||
org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
|
||||
VersionConvertor_14_50.copyElement(src, tgt);
|
||||
switch(src.getValue()) {
|
||||
VersionConvertor_14_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL);
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) {
|
||||
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL));
|
||||
} else {
|
||||
switch(src.getValue()) {
|
||||
case GROUP:
|
||||
tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP);
|
||||
break;
|
||||
|
@ -322,6 +328,7 @@ public class Questionnaire14_50 {
|
|||
tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package org.hl7.fhir.convertors.conv30_50;
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_30_50;
|
||||
import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.model.CodeType;
|
||||
import org.hl7.fhir.r5.model.Questionnaire;
|
||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
|
||||
public class Questionnaire30_50 {
|
||||
|
||||
|
@ -229,8 +232,11 @@ public class Questionnaire30_50 {
|
|||
if (src == null || src.isEmpty())
|
||||
return null;
|
||||
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
|
||||
VersionConvertor_30_50.copyElement(src, tgt);
|
||||
switch(src.getValue()) {
|
||||
VersionConvertor_30_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL);
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) {
|
||||
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL));
|
||||
} else {
|
||||
switch(src.getValue()) {
|
||||
case GROUP:
|
||||
tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP);
|
||||
break;
|
||||
|
@ -282,6 +288,7 @@ public class Questionnaire30_50 {
|
|||
default:
|
||||
tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
@ -291,6 +298,7 @@ public class Questionnaire30_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
|
||||
VersionConvertor_30_50.copyElement(src, tgt);
|
||||
tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString()));
|
||||
switch(src.getValue()) {
|
||||
case GROUP:
|
||||
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.convertors.conv40_50.resources40_50;
|
||||
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.Element40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.Type40_50;
|
||||
|
@ -15,6 +16,7 @@ import org.hl7.fhir.exceptions.FHIRException;
|
|||
import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType;
|
||||
import org.hl7.fhir.r5.model.CodeType;
|
||||
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -216,6 +218,7 @@ public class Questionnaire40_50 extends VersionConvertor_40_50 {
|
|||
return null;
|
||||
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
|
||||
Element40_50.copyElement(src, tgt);
|
||||
tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString()));
|
||||
switch(src.getValue()) {
|
||||
case GROUP:
|
||||
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP);
|
||||
|
@ -279,60 +282,64 @@ public class Questionnaire40_50 extends VersionConvertor_40_50 {
|
|||
if (src == null || src.isEmpty())
|
||||
return null;
|
||||
org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
|
||||
Element40_50.copyElement(src, tgt);
|
||||
switch(src.getValue()) {
|
||||
case GROUP:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP);
|
||||
break;
|
||||
case DISPLAY:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DISPLAY);
|
||||
break;
|
||||
Element40_50.copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL);
|
||||
if (src.hasExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) {
|
||||
tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL));
|
||||
} else {
|
||||
switch(src.getValue()) {
|
||||
case GROUP:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP);
|
||||
break;
|
||||
case DISPLAY:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DISPLAY);
|
||||
break;
|
||||
// case QUESTION: return org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUESTION;
|
||||
case BOOLEAN:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN);
|
||||
break;
|
||||
case DECIMAL:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL);
|
||||
break;
|
||||
case INTEGER:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER);
|
||||
break;
|
||||
case DATE:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE);
|
||||
break;
|
||||
case DATETIME:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME);
|
||||
break;
|
||||
case TIME:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME);
|
||||
break;
|
||||
case STRING:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING);
|
||||
break;
|
||||
case TEXT:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT);
|
||||
break;
|
||||
case URL:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL);
|
||||
break;
|
||||
case CODING:
|
||||
if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING)
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
|
||||
else
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE);
|
||||
break;
|
||||
case ATTACHMENT:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
|
||||
break;
|
||||
case REFERENCE:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE);
|
||||
break;
|
||||
case QUANTITY:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY);
|
||||
break;
|
||||
default:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL);
|
||||
break;
|
||||
case BOOLEAN:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN);
|
||||
break;
|
||||
case DECIMAL:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL);
|
||||
break;
|
||||
case INTEGER:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER);
|
||||
break;
|
||||
case DATE:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE);
|
||||
break;
|
||||
case DATETIME:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME);
|
||||
break;
|
||||
case TIME:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME);
|
||||
break;
|
||||
case STRING:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING);
|
||||
break;
|
||||
case TEXT:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT);
|
||||
break;
|
||||
case URL:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL);
|
||||
break;
|
||||
case CODING:
|
||||
if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING)
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
|
||||
else
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE);
|
||||
break;
|
||||
case ATTACHMENT:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
|
||||
break;
|
||||
case REFERENCE:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE);
|
||||
break;
|
||||
case QUANTITY:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY);
|
||||
break;
|
||||
default:
|
||||
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel;
|
|||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
|
||||
public class QuestionnaireRenderer extends TerminologyRenderer {
|
||||
public static final String EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL = "http://hl7.org/fhir/tools/StructureDefinition/original-item-type";
|
||||
|
||||
public QuestionnaireRenderer(RenderingContext context) {
|
||||
super(context);
|
||||
|
@ -222,7 +223,12 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
String txt = (i.hasPrefix() ? i.getPrefix() + ". " : "") + i.getText();
|
||||
r.getCells().add(gen.new Cell(null, null, txt, null, null));
|
||||
r.getCells().add(gen.new Cell(null, null, (i.getRequired() ? "1" : "0")+".."+(i.getRepeats() ? "*" : "1"), null, null));
|
||||
r.getCells().add(gen.new Cell(null, context.getSpecificationLink()+"codesystem-item-type.html#"+i.getType().toCode(), i.getType().toCode(), null, null));
|
||||
if (i.getTypeElement().hasExtension(EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) {
|
||||
String t = i.getTypeElement().getExtensionString(EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL);
|
||||
r.getCells().add(gen.new Cell(null, context.getSpecificationLink()+"codesystem-item-type.html#item-type-"+t, t, null, null));
|
||||
} else {
|
||||
r.getCells().add(gen.new Cell(null, context.getSpecificationLink()+"codesystem-item-type.html#item-type-"+i.getType().toCode(), i.getType().toCode(), null, null));
|
||||
}
|
||||
|
||||
if (hasFlags) {
|
||||
// flags:
|
||||
|
|
Loading…
Reference in New Issue