use of org.nhspathways.webservices.pathways.pathwayscase.PathwaysCaseDocument.PathwaysCase.PathwayDetails.PathwayTriageDetails.PathwayTriage.TriageLineDetails.TriageLine.Question.Answers.Answer in project integration-adaptor-111 by nhsconnect.
the class QuestionnaireMapper method getItem.
private QuestionnaireItemComponent getItem(Question question, String caseId) {
if (question != null) {
List<QuestionnaireItemOptionComponent> questionnaireItemOptionComponentList = new ArrayList<>();
QuestionnaireItemComponent item = new QuestionnaireItemComponent();
item.setLinkId(caseId);
item.setPrefix(getPrefix(question));
item.setType(Questionnaire.QuestionnaireItemType.CHOICE);
item.setRequired(true);
item.setRepeats(false);
if (question.getQuestionText() != null) {
item.setText(question.getQuestionText());
} else {
item.setText(NOT_APPLICABLE);
}
if (question.getAnswers() != null) {
if (question.getAnswers().sizeOfAnswerArray() > 0) {
for (Answer answer : question.getAnswers().getAnswerArray()) {
QuestionnaireItemOptionComponent optionComponent = new QuestionnaireItemOptionComponent();
StringType answerStringType = new StringType();
answerStringType.setValueAsString(String.format("%s, Selected: %s", answer.getText(), answer.getSelected()));
optionComponent.setValue(answerStringType);
questionnaireItemOptionComponentList.add(optionComponent);
}
}
}
item.setOption(questionnaireItemOptionComponentList);
return item;
}
return null;
}
use of org.nhspathways.webservices.pathways.pathwayscase.PathwaysCaseDocument.PathwaysCase.PathwayDetails.PathwayTriageDetails.PathwayTriage.TriageLineDetails.TriageLine.Question.Answers.Answer in project integration-adaptor-111 by nhsconnect.
the class QuestionnaireResponseMapper method getItem.
private QuestionnaireResponseItemComponent getItem(Question question) {
QuestionnaireResponseItemComponent item = new QuestionnaireResponseItemComponent();
QuestionnaireResponseItemAnswerComponent answer = new QuestionnaireResponseItemAnswerComponent();
StringType correctAnswerText = new StringType();
if (StringUtils.isBlank(question.getQuestionId())) {
item.setLinkId(NOT_APPLICABLE);
} else {
item.setLinkId(question.getQuestionId());
}
item.setText(question.getQuestionText());
for (Answer singleAnswer : question.getAnswers().getAnswerArray()) {
if (singleAnswer.getSelected() && !singleAnswer.getText().isBlank()) {
correctAnswerText.setValueAsString(singleAnswer.getText());
}
}
answer.setValue(correctAnswerText);
item.addAnswer(answer);
return item;
}
Aggregations