This commit is contained in:
Grahame Grieve 2019-05-30 13:29:48 +10:00
commit 627caca905
3 changed files with 12 additions and 8 deletions

View File

@ -5789,8 +5789,8 @@ public class VersionConvertor_10_30 {
tgt.setEffective(convertType(src.getEffective()));
tgt.setIssued(src.getIssued());
// tgt.setPerformer(convertReference(src.getPerformer()));
// for (org.hl7.fhir.dstu2.model.Reference t : src.getRequest())
// tgt.addRequest(convertReference(t));
for (org.hl7.fhir.dstu2.model.Reference t : src.getRequest())
tgt.addBasedOn(convertReference(t));
for (org.hl7.fhir.dstu2.model.Reference t : src.getSpecimen())
tgt.addSpecimen(convertReference(t));
for (org.hl7.fhir.dstu2.model.Reference t : src.getResult())
@ -5822,8 +5822,8 @@ public class VersionConvertor_10_30 {
tgt.setEffective(convertType(src.getEffective()));
tgt.setIssued(src.getIssued());
// tgt.setPerformer(convertReference(src.getPerformer()));
// for (org.hl7.fhir.dstu3.model.Reference t : src.getRequest())
// tgt.addRequest(convertReference(t));
for (org.hl7.fhir.dstu3.model.Reference t : src.getBasedOn())
tgt.addRequest(convertReference(t));
for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen())
tgt.addSpecimen(convertReference(t));
for (org.hl7.fhir.dstu3.model.Reference t : src.getResult())

View File

@ -2804,8 +2804,10 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
element.getNamedChildren("answer", answers);
if (inProgress)
warning(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), isAnswerRequirementFulfilled(qItem, answers), "No response answer found for required item "+qItem.getLinkId());
else
else if(myEnableWhenEvaluator.isQuestionEnabled(qItem, questionnaireResponseRoot))
rule(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), isAnswerRequirementFulfilled(qItem, answers), "No response answer found for required item "+qItem.getLinkId());
else if (!answers.isEmpty()) // items without answers should be allowed, but not items with answers to questions that are disabled
rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), !isAnswerRequirementFulfilled(qItem, answers), "Item has answer, even though it is not enabled "+qItem.getLinkId());
if (answers.size() > 1)
rule(errors, IssueType.INVALID, answers.get(1).line(), answers.get(1).col(), stack.getLiteralPath(), qItem.getRepeats(), "Only one response answer item with this linkId allowed");
@ -2949,8 +2951,7 @@ private boolean isAnswerRequirementFulfilled(QuestionnaireItemComponent qItem, L
// ok, now we have a list of known items, grouped by linkId. We've made an error for anything out of order
for (QuestionnaireItemComponent qItem : qItems) {
List<Element> mapItem = map.get(qItem.getLinkId());
if (mapItem != null){
rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), myEnableWhenEvaluator.isQuestionEnabled(qItem, questionnaireResponseRoot), "Item with linkId [{0}] has answer, even though it is not enabled", qItem.getLinkId());
if (mapItem != null) {
validateQuestionannaireResponseItem(qsrc, qItem, errors, mapItem, stack, inProgress, questionnaireResponseRoot);
} else {
//item is missing, is the question enabled?

View File

@ -2937,8 +2937,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
element.getNamedChildren("answer", answers);
if (inProgress)
warning(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), isAnswerRequirementFulfilled(qItem, answers), "No response answer found for required item "+qItem.getLinkId());
else
else if (myEnableWhenEvaluator.isQuestionEnabled(qItem, questionnaireResponseRoot))
rule(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), isAnswerRequirementFulfilled(qItem, answers), "No response answer found for required item "+qItem.getLinkId());
else if (!answers.isEmpty()) // items without answers should be allowed, but not items with answers to questions that are disabled
rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), !isAnswerRequirementFulfilled(qItem, answers), "Item has answer, even though it is not enabled "+qItem.getLinkId());
if (answers.size() > 1)
rule(errors, IssueType.INVALID, answers.get(1).line(), answers.get(1).col(), stack.getLiteralPath(), qItem.getRepeats(), "Only one response answer item with this linkId allowed");