private void populateListControl(CategoryQuestionShortVoCollection voCollCatQuestions) { for (int j = 0; voCollCatQuestions != null && j < voCollCatQuestions.size(); j++) { CategoryQuestionShortVo voCategoryQuestionShortVo = voCollCatQuestions.get(j); GenForm.grdDetailsRow row = form.grdDetails().getRows().newRow(); setCategoryQuestion(row, voCategoryQuestionShortVo); } }
/** * @param row * @param voCategoryQuestionShortVo */ private void setCategoryQuestion(GenForm.grdDetailsRow row, CategoryQuestionShortVo voCategoryQuestionShortVo) { if (voCategoryQuestionShortVo.getQuestionInformationIsNotNull()) { row.setcolQuestion(voCategoryQuestionShortVo.getQuestionInformation().getText()); row.setcolMandatory(voCategoryQuestionShortVo.getIsMandatoryIsNotNull() ? voCategoryQuestionShortVo.getIsMandatory().booleanValue() : false); row.setcolAskForInvestigation(voCategoryQuestionShortVo.getAskForInvestigationsIsNotNull()?voCategoryQuestionShortVo.getAskForInvestigations().booleanValue():false); row.setTooltip(voCategoryQuestionShortVo.getQuestionInformation().getTooltip()); } voCategoryQuestionShortVo.setID_CategoryQuestion(null); row.setValue(voCategoryQuestionShortVo); }
private CategoryQuestionShortVoCollection populateInstancesData() { CategoryQuestionShortVoCollection voCollCategoryQuestions = new CategoryQuestionShortVoCollection(); for (int i = 0; i < form.grdDetails().getRows().size(); i++) { CategoryQuestionShortVo voCatQShort = form.grdDetails().getRows().get(i).getValue(); voCatQShort.setOCRRCategory(form.cmbCategory().getValue()); voCatQShort.setIsMandatory(new Boolean(form.grdDetails().getRows().get(i).getcolMandatory())); voCatQShort.setAskForInvestigations(form.grdDetails().getRows().get(i).getcolAskForInvestigation()?Boolean.TRUE:Boolean.FALSE); voCollCategoryQuestions.add(voCatQShort); } return voCollCategoryQuestions; }
private boolean isCategoryQuestionActive(CategoryQuestionShortVo categoryQuestion) { if(categoryQuestion == null) return false; PreActiveActiveInactiveStatus questionStatus = categoryQuestion.getQuestionInformationIsNotNull()?categoryQuestion.getQuestionInformation().getStatus():null; if(questionStatus != null && questionStatus.equals(PreActiveActiveInactiveStatus.ACTIVE)) { return true; } return false; }
private void buildCategoryQuestions(Category category, CategoryQuestionAnswerVo voCategoryQuestionAnswer, CategoryQuestionShortVoCollection categoryConfigQuestions) { // Add the Category question if now added before if (categoryConfigQuestions != null && categoryConfigQuestions.size() > 0) { if (voCategoryQuestionAnswer.getCategoryQuestionAnswers() == null) voCategoryQuestionAnswer.setCategoryQuestionAnswers(new GeneralQuestionAnswerVoCollection()); for (int i = 0; i < categoryConfigQuestions.size(); i++) { CategoryQuestionShortVo categoryQuestionShortVo = categoryConfigQuestions.get(i); if (categoryQuestionShortVo.getOCRRCategoryIsNotNull() && categoryQuestionShortVo.getOCRRCategory().equals(category)) { boolean categoryQuestionAdded = isCategoryQuestionAdded(voCategoryQuestionAnswer, categoryQuestionShortVo.getQuestionInformation()); boolean askedForEveryInvestigation = categoryQuestionShortVo.getAskForInvestigationsIsNotNull() && categoryQuestionShortVo.getAskForInvestigations().booleanValue(); //Don't add duplicated questions or questions marked as "Ask for every Investigation" if (categoryQuestionAdded == false && askedForEveryInvestigation == false && isCategoryQuestionActive(categoryQuestionShortVo)) voCategoryQuestionAnswer.getCategoryQuestionAnswers().add(createNewCategoryQuestion(categoryQuestionShortVo)); } } } else { // Clear category questions voCategoryQuestionAnswer.setCategoryQuestionAnswers(null); } }
private GeneralQuestionAnswerVo createNewCategoryQuestion(CategoryQuestionShortVo categoryConfigQuestion) { if(categoryConfigQuestion == null) return null; if(isQuestionRelevant(categoryConfigQuestion.getQuestionInformation(), getAge(), getSex()) == false) return null; GeneralQuestionAnswerVo categoryQuestion = new GeneralQuestionAnswerVo(); categoryQuestion.setQuestion(categoryConfigQuestion.getQuestionInformation()); categoryQuestion.setPatientAnswers(new PatientAssessmentAnswerVoCollection()); categoryQuestion.setWasMandatory(categoryConfigQuestion.getIsMandatory()); return categoryQuestion; }
private GeneralQuestionAnswerVoCollection getQuestionsToBeAskedInEveryInvestigation(Category category, CategoryQuestionShortVoCollection categoryConfigQuestions, ServiceQuestionShortVoCollection serviceConfigQuestions, InvestigationOcsQuestionsVo voInvOcs) { //Category Questions GeneralQuestionAnswerVoCollection voColl = new GeneralQuestionAnswerVoCollection(); for (int i = 0; categoryConfigQuestions != null && i < categoryConfigQuestions.size(); i++) { CategoryQuestionShortVo categoryQuestion = categoryConfigQuestions.get(i); if(categoryQuestion.getOCRRCategoryIsNotNull() && categoryQuestion.getOCRRCategory().equals(category)) { if(categoryQuestion.getAskForInvestigationsIsNotNull() && categoryQuestion.getAskForInvestigations().booleanValue()) { //WDEV-3332 if(isCategoryQuestionActive(categoryQuestion)) { GeneralQuestionAnswerVo voGCQ = createNewCategoryQuestion(categoryQuestion); if(voGCQ != null) voColl.add(voGCQ); } } } } //Service Questions Category investigationCategory = voInvOcs != null && voInvOcs.getInvestigationIndexIsNotNull() && voInvOcs.getInvestigationIndex().getCategoryIsNotNull()?voInvOcs.getInvestigationIndex().getCategory():null; if(investigationCategory != null && investigationCategory .equals(category)) { for (int j = 0; serviceConfigQuestions != null && j < serviceConfigQuestions.size(); j++) { ServiceQuestionShortVo voServiceQ = serviceConfigQuestions.get(j); if(voServiceQ.getAskForInvestigationsIsNotNull() && voServiceQ.getAskForInvestigations().booleanValue()) { if(isSameService(voServiceQ, voInvOcs)) { GeneralQuestionAnswerVo voGSQ = createNewServiceQuestion(voServiceQ); if(voGSQ != null) voColl.add(voGSQ); } } } } return voColl; }