private PatientAssessmentGroupVoCollection setAsNotAnswerdNonStandardQuestions(UserAssessmentVo voUserAssessment, PatientAssessmentGroupVoCollection voPatAssGroupVoColl) { if(voUserAssessment == null || voPatAssGroupVoColl == null) return voPatAssGroupVoColl; for (int i = 0; voPatAssGroupVoColl != null && i < voPatAssGroupVoColl.size(); i++) { for (int j = 0; j < voPatAssGroupVoColl.get(i).getAssessmentAnswers().size(); j++) { AssessmentQuestionVo voAssQuestion = voPatAssGroupVoColl.get(i).getAssessmentAnswers().get(j).getAssessmentQuestion(); if(voAssQuestion.getIsNonStandardIsNotNull() && voAssQuestion.getIsNonStandard().booleanValue()) { voPatAssGroupVoColl.get(i).getAssessmentAnswers().get(j).setIsAnswered(AnswerStatus.NOTANSWERED); } } } return voPatAssGroupVoColl; }
private PlanOfCareGroupings getGroup(AssessmentQuestionVo voAssessmentQuestion) { if (voAssessmentQuestion == null) return null; UserAssessmentVo voUserAssessment = getCurrentUserAssessment(); DPPQuestionGroupShortVoCollection voColl = form.getLocalContext().getDppQuestionGroup(); if (voColl == null) voColl = domain.listDPPGroupings(voUserAssessment, Boolean.TRUE); for (int i = 0; i < voColl.size(); i++) { DPPQuestionGroupShortVo voDppQGroup = voColl.get(i); if (voDppQGroup.getAssessmentQuestionsIsNotNull() && voDppQGroup.getAssessmentQuestions().indexOf(voAssessmentQuestion) >= 0) return voDppQGroup.getGroup(); } return null; }
private void setPocFlag(PatientAssessmentGroupVoCollection currentAnswer, UserAssessmentInstHelper helper) { // Add the records checked for (int i = 0; i < currentAnswer.size(); i++) { PatientAssessmentGroupVo voPatAssessGroup = currentAnswer.get(i); for (int j = 0; j < voPatAssessGroup.getAssessmentAnswers().size(); j++) { PatientAssessmentQuestionVo voPatAssessmQuestion = voPatAssessGroup.getAssessmentAnswers().get(j); AssessmentQuestionVo voAssessmQuestion = voPatAssessmQuestion.getAssessmentQuestion(); //Do not modify the POC if the questions has no Answers boolean isPocSelected = isPocSelected(helper, voAssessmQuestion) && hasAnswers(voPatAssessmQuestion); voPatAssessmQuestion.setIsPoc(new Boolean(isPocSelected)); } } }
protected void onBtnOkClick() throws PresentationLogicException { QuestionInformationShortVoCollection voColl = getSelectedQuestions(); if(isUserAssessmentQuestion()) { AssessmentQuestionVoCollection voAssmntColl = new AssessmentQuestionVoCollection(); for(int i=0; voColl != null && i<voColl.size(); i++) { AssessmentQuestionVo voAssmntQ = new AssessmentQuestionVo(); voAssmntQ.setQuestion(domain.getQuestion(voColl.get(i).getID_QuestionInformation())); voAssmntQ.setLegendText(voAssmntQ.getQuestion().getLegendText()); voAssmntColl.add(voAssmntQ); } form.getGlobalContext().Core.setSelectedAssessmentQuestions(voAssmntColl); closeDialog(DialogResult.OK); } else { form.getGlobalContext().Admin.setSelectedQuestions(voColl); closeDialog(DialogResult.OK); } }
private void editQuestion(AssessmentQuestionVo assessmentQuestionVo) { if (assessmentQuestionVo == null) return; QuestionInformationVo voQInfo = assessmentQuestionVo.getQuestion(); form.getLocalContext().setVoQuestionInformation(voQInfo); clearQuestionControls(); populateControlsFromData(voQInfo); form.lyrTabs().tabNewQuestion().lyrDetails().tabGeneral().txtURL().setValue(assessmentQuestionVo.getURL()); form.lyrTabs().tabNewQuestion().lyrDetails().tabGeneral().txtProtocol().setValue(assessmentQuestionVo.getProtocol()); form.lyrTabs().tabNewQuestion().lyrDetails().tabLegend().richTextLegend().setValue(assessmentQuestionVo.getLegendText()); form.setMode(FormMode.EDIT); setIsNewQuestion(new Boolean(false)); enableTabNewQuestion(true); enableTabSearchQuestion(false); showTabNewQuestion(); }
private void updateQuestionInGrid(AssessmentQuestionVo assessmentQuestionVo) { DynamicGridRow row = form.lyrTabs().tabAssessments().dyngrdDetails().getSelectedRow(); if(row == null) return; row.setValue(assessmentQuestionVo); row.getCells().get(getGridColumn(COLUMN_QUESTIONGROUP)).setValue(assessmentQuestionVo.getQuestionIsNotNull() ? assessmentQuestionVo.getQuestion().getShortText() : ""); row.getCells().get(getGridColumn(COLUMN_QUESTIONGROUP)).setTooltip(getQuestionTooltip(assessmentQuestionVo)); row.getCells().get(getGridColumn(COLUMN_MANDATORY)).setValue(assessmentQuestionVo.getIsMandatory()); row.getCells().get(getGridColumn(COLUMN_MULTIANSWERS)).setValue(assessmentQuestionVo.getAllowsMultipleAnswers()); DynamicGridCell statusCell = row.getCells().get(getGridColumn(COLUMN_STATUS)); //engine.populate(statusCell, ims.core.vo.lookups.LookupHelper.getPreActiveActiveInactiveStatus(this.domain.getLookupService())); statusCell.setValue(assessmentQuestionVo.getActiveStatus()); }
private Boolean checkSeparatorLabel(AssessmentQuestionVo assessmentQuestion) { if(assessmentQuestion == null || assessmentQuestion.getQuestion() == null) return false; if(assessmentQuestion.getQuestion().getAnswerTypesIsNotNull()) { for(int i=0; i<assessmentQuestion.getQuestion().getAnswerTypes().size(); i++) { if(assessmentQuestion.getQuestion().getAnswerTypes().get(i) != null && assessmentQuestion.getQuestion().getAnswerTypes().get(i).getAnswerTypeIsNotNull() && !assessmentQuestion.getQuestion().getAnswerTypes().get(i).getAnswerType().equals(ims.core.vo.lookups.QuestionAnswerType.SEPARATOR)) return false; } } if(assessmentQuestion.getIsMandatoryIsNotNull() && assessmentQuestion.getIsMandatory()) return true; return false; }
protected void onDyngrdQuestionsCellValueChanged(DynamicGridCell cell) { if (cell.getColumn().getIdentifier().equals(COLUMN_SELECT)) { Integer roleId = form.getLocalContext().getSelectedRoleId(); DynamicGridRow row = cell.getRow(); AssessmentQuestionVo voAssessmentQuestion = (AssessmentQuestionVo) row.getValue(); if (roleId != null) { Boolean value = (Boolean) cell.getValue(); if (value != null) { if (value.booleanValue()) addQuestionIntoMap(roleId, voAssessmentQuestion); else removeQuestionFromMap(roleId, voAssessmentQuestion); } } } }
private void refreshGroupCellData(AssessmentQuestionGroupVoCollection voColl) { for (int i = 0; i < form.lyrTabs().tabAssessments().dyngrdDetails().getRows().size(); i++) { DynamicGridRow row = form.lyrTabs().tabAssessments().dyngrdDetails().getRows().get(i); DynamicGridCell cell = row.getCells().get(getGridColumn(COLUMN_GROUP)); Object value = cell.getValue(); cell.getItems().clear(); for (int j = 0; voColl != null && j < voColl.size(); j++) cell.getItems().newItem(voColl.get(j)); cell.setValue(value); if(value instanceof AssessmentQuestionVo) row.setValue(cell); } }
@SuppressWarnings("unchecked") private void removeQuestionFromMap(Integer roleId, AssessmentQuestionVo voAssessQuestions) { if (roleId == null || voAssessQuestions == null) return; HashMap map = form.getLocalContext().getAssessmentRoles(); if (map != null) { AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId); int index = voAssQColl.indexOf(voAssessQuestions); if (index >= 0) { voAssQColl.remove(index); map.put(roleId, voAssQColl); form.getLocalContext().setAssessmentRoles(map); } } }
@SuppressWarnings("unchecked") private Boolean isQuestionSelected(AssessmentQuestionVo assessmentQuestionVo) { HashMap map = form.getLocalContext().getAssessmentRoles(); Integer roleId = form.getLocalContext().getSelectedRoleId(); if (map == null || roleId == null) return Boolean.FALSE; AssessmentQuestionVoCollection voAssQColl = (AssessmentQuestionVoCollection) map.get(roleId); if (voAssQColl != null) { int index = voAssQColl.indexOf(assessmentQuestionVo); if (index >= 0) return Boolean.TRUE; } return Boolean.FALSE; }
private PatientAssessmentQuestionVo findAnswer(PatientAssessmentGroupVoCollection groupVoColl, AssessmentQuestionVo question) { if (groupVoColl == null || question == null) return null; for (int i = 0; i < groupVoColl.size(); i++) { for (int j = 0; j < groupVoColl.get(i).getAssessmentAnswers().size(); j++) { PatientAssessmentQuestionVo answer = groupVoColl.get(i).getAssessmentAnswers().get(j); AssessmentQuestionVo assessmentQuestion = answer.getAssessmentQuestion(); if (assessmentQuestion != null && assessmentQuestion.equals(question)) return answer; } } return null; }
private PatientAssessmentQuestionVo findOrCreateAnswer(PatientAssessmentQuestionVoCollection assesmentQuestions, AssessmentQuestionVo question) { if (assesmentQuestions == null || question == null) return new PatientAssessmentQuestionVo(); for (int x = 0; x < assesmentQuestions.size(); x++) { PatientAssessmentQuestionVo assessmentQuestion = assesmentQuestions.get(x); if (assessmentQuestion != null && assessmentQuestion.getAssessmentQuestionIsNotNull() && assessmentQuestion.getAssessmentQuestion().equals(question)) { return assessmentQuestion; } } return new PatientAssessmentQuestionVo(); }
public PatientAssessmentVo updateNotApplicableQuestionStatus(PatientAssessmentVo voPatientAssessment) { for (int x = 0; x < this.grid.getRows().size(); x++) { DynamicGridRow row = this.grid.getRows().get(x); AssessmentQuestionVo question = (AssessmentQuestionVo) row.getIdentifier(); PatientAssessmentQuestionVo answer = findAnswer(voPatientAssessment.getAssessmentData().getAnswerGroups(), question); if (answer == null) throw new CodingRuntimeException("Unable to find an answer for '" + question.getQuestion().getText() + "' question."); // Change the status from Non Applicable to Answered if (isAnswerStatus(answer, AnswerStatus.NOTAPPLICABLE)) { DynamicGridColumn columnNASelect = this.grid.getColumns().getByIdentifier(SELECT_NA_COLUMN); if (columnNASelect != null) { DynamicGridCell cellNASelect = row.getCells().get(columnNASelect); if (cellNASelect.getValue() instanceof Boolean && ((Boolean) cellNASelect.getValue()).booleanValue()) answer.setIsAnswered(AnswerStatus.ANSWERED); } } } return voPatientAssessment; }
private DynamicGridRow findRow(DynamicGridRow groupRow, AssessmentQuestionVo assessmentQuestion) { if (assessmentQuestion == null) return null; DynamicGridRowCollection rows = null; if (groupRow != null) rows = groupRow.getRows(); else rows = this.grid.getRows(); for (int x = 0; x < rows.size(); x++) { DynamicGridRow row = rows.get(x); if (row.getIdentifier() != null && row.getIdentifier() instanceof AssessmentQuestionVo) { if (row.getIdentifier().equals(assessmentQuestion)) return row; } } return null; }
private PatientAssessmentQuestionVo getInstAnswer(PatientAssessmentDataVo data, AssessmentQuestionGroupVo configGroup, AssessmentQuestionVo configQuestion) { if (data == null || configGroup == null || configQuestion == null) return null; PatientAssessmentGroupVo instGroup = getInstGroup(data, configGroup); if (instGroup == null) return null; for (int x = 0; x < instGroup.getAssessmentAnswers().size(); x++) { if (instGroup.getAssessmentAnswers().get(x) != null && instGroup.getAssessmentAnswers().get(x).getAssessmentQuestion() != null && instGroup.getAssessmentAnswers().get(x).getAssessmentQuestion().equals(configQuestion)) { return instGroup.getAssessmentAnswers().get(x); } } return null; }
private void addQuestionLegend(AssessmentQuestionVo question, DynamicGridRow groupRow) { DynamicGridColumn questionColumn = this.grid.getColumns().getByIdentifier(QUESTION_COLUMN); DynamicGridRow row; if (groupRow != null) row = groupRow.getRows().newRow(); else row = this.grid.getRows().newRow(); row.setSelectable(false); questionColumn.setDynamicWidthSupported(true); DynamicGridCell questionCell = row.getCells().newCell(questionColumn, DynamicCellType.HTMLVIEW); questionCell.setValue(question.getLegendText()); questionCell.setWidth(DEFAULT_LEGEND_CELL_WIDTH); questionCell.setReadOnly(true); }
private boolean userHasRolesToAnswer(AssessmentQuestionVo question) { if(question == null) return false; if(question.getAssessmentAnswerRole()== null) return true; for(AssessmentQuestionRoleVo questionRole : question.getAssessmentAnswerRole()) { if(questionRole == null) continue; if(questionRole.getAppRoleIsNotNull() && questionRole.getAppRole().getID_AppRole().equals(engine.getLoggedInRole().getId())) return true; } return false; }
public boolean isPocSelected(AssessmentQuestionRefVo voAssessmQuestion) { for (int i = 0; i < grid.getRows().size(); i++) { DynamicGridRow row = grid.getRows().get(i); if (row.getIdentifier() instanceof AssessmentQuestionVo && row.getIdentifier().equals(voAssessmQuestion)) { DynamicGridColumn column = this.grid.getColumns().getByIdentifier(POC_COLUMN); if (column != null) { DynamicGridCell cell = row.getCells().get(column); if (cell.getValue() instanceof Boolean) return ((Boolean) cell.getValue()).booleanValue(); } } } return false; }
private static String getPreviousSeparatorIfExists(AssessmentQuestionVo assessmentQuestion, QuestionAnswerTypeVo ansType) { if(assessmentQuestion == null || ansType == null) return null; if(assessmentQuestion.getQuestion() == null || assessmentQuestion.getQuestion().getAnswerTypes() == null) return null; for (int i = 0; i < assessmentQuestion.getQuestion().getAnswerTypes().size(); i++) { QuestionAnswerTypeVo voQuestionAnswerType = assessmentQuestion.getQuestion().getAnswerTypes().get(i); if(voQuestionAnswerType != null && voQuestionAnswerType.equals(ansType)) { if(i > 0) { QuestionAnswerTypeVo voPrevAnswerType = assessmentQuestion.getQuestion().getAnswerTypes().get(i-1); if(voPrevAnswerType != null && voPrevAnswerType.getAnswerTypeIsNotNull() && voPrevAnswerType.getAnswerType().equals(QuestionAnswerType.SEPARATOR)) return voPrevAnswerType.getSeparatorText(); } } } return null; }
private PatientAssessmentQuestionVo findOrCreateAnswer(PatientAssessmentQuestionVoCollection assesmentQuestions, AssessmentQuestionVo question) { if(assesmentQuestions == null || question == null) return new PatientAssessmentQuestionVo(); for(int x = 0; x < assesmentQuestions.size(); x++) { PatientAssessmentQuestionVo assessmentQuestion = assesmentQuestions.get(x); if(assessmentQuestion != null && assessmentQuestion.getAssessmentQuestionIsNotNull() && assessmentQuestion.getAssessmentQuestion().equals(question)) { return assessmentQuestion; } } return new PatientAssessmentQuestionVo(); }
private DynamicGridRow findRow(DynamicGridRow groupRow, AssessmentQuestionVo assessmentQuestion) { if(assessmentQuestion == null) return null; DynamicGridRowCollection rows = null; if(groupRow != null) rows = groupRow.getRows(); else rows = this.grid.getRows(); for(int x = 0; x < rows.size(); x++) { DynamicGridRow row = rows.get(x); if(row.getIdentifier() != null && row.getIdentifier() instanceof AssessmentQuestionVo) { if(row.getIdentifier().equals(assessmentQuestion)) return row; } } return null; }
private PatientAssessmentQuestionVo getInstAnswer(PatientAssessmentDataVo data, AssessmentQuestionGroupVo configGroup, AssessmentQuestionVo configQuestion) { if(data == null || configGroup == null || configQuestion == null) return null; PatientAssessmentGroupVo instGroup = getInstGroup(data, configGroup); if(instGroup == null) return null; for(int x = 0; x < instGroup.getAssessmentAnswers().size(); x++) { if(instGroup.getAssessmentAnswers().get(x) != null && instGroup.getAssessmentAnswers().get(x).getAssessmentQuestion() != null && instGroup.getAssessmentAnswers().get(x).getAssessmentQuestion().equals(configQuestion)) { return instGroup.getAssessmentAnswers().get(x); } } return null; }
public boolean isPocSelected(AssessmentQuestionRefVo voAssessmQuestion) { for (int i = 0; i < grid.getRows().size(); i++) { DynamicGridRow row = grid.getRows().get(i); if(row.getIdentifier() instanceof AssessmentQuestionVo && row.getIdentifier().equals(voAssessmQuestion)) { DynamicGridColumn column = this.grid.getColumns().getByIdentifier(POC_COLUMN); if(column != null) { DynamicGridCell cell = row.getCells().get(column); if(cell.getValue() instanceof Boolean) return ((Boolean)cell.getValue()).booleanValue(); } } } return false; }
private PlanOfCareGroupings getDppQuestionGroup(AssessmentQuestionVo question, UserAssessmentVo assessment) { if (isDppGrid()) { for (int i = 0; voDPPQuestionGroupColl != null && i < voDPPQuestionGroupColl.size(); i++) { DPPQuestionGroupVo voDPPQuestionGroup = voDPPQuestionGroupColl.get(i); boolean sameQuestion = voDPPQuestionGroup.getAssessmentQuestionsIsNotNull() && voDPPQuestionGroup.getAssessmentQuestions().indexOf(question) >= 0; boolean sameAssessment = voDPPQuestionGroup.getAssessmentQuestionsIsNotNull() && voDPPQuestionGroup.getUserAssessment().equals(assessment); if (sameQuestion && sameAssessment) { return voDPPQuestionGroup.getGroup(); } } } return null; }
private void updateDppVoCollection(UserAssessmentVo assessment, AssessmentQuestionVo assessmentQuestion, DynamicGridRow row) { if(assessment == null || assessmentQuestion == null || row == null) return; DynamicGridColumn groupCol = getGridColumn(COLUMN_DPPGROUP); if(groupCol != null) { DynamicGridCell cell = row.getCells().get(groupCol); if(cell != null && cell.getValue() instanceof PlanOfCareGroupings) { PlanOfCareGroupings group = (PlanOfCareGroupings) cell.getValue(); updateDppVoCollection(assessment, assessmentQuestion, group); } } }