private PatientAssessmentAnswerVoCollection getPatientAnswers(GeneralQuestionAnswerVoCollection categoryQA, QuestionInformationShortVo question) { if (categoryQA == null || categoryQA.size() == 0) return null; if (question == null) return null; for (GeneralQuestionAnswerVo answer : categoryQA) { if (question.equals(answer.getQuestion())) return answer.getPatientAnswers(); } return null; }
private void removeQuestionsInformations() { GeneralQuestionAnswerVoCollection questions = form.getGlobalContext().OCRR.getMyOrderInformations(); if(questions == null || questions.size() == 0) return; for(int i = questions.size() - 1; i >= 0; i--) { if(questions.get(i) == null || questions.get(i).getItemId() == null) continue; if(itemIdIsInRefusedList(questions.get(i))) { questions.remove(questions.get(i)); } } }
private ServiceQuestionAnswerVo createDummyServiceQuaetionAnswerVo(InvestigationOcsQuestionsVo voInvOcs) { ServiceQuestionAnswerVo voServiceQuestionAnswer = new ServiceQuestionAnswerVo(); voServiceQuestionAnswer.setService(new ServiceLiteVo()); voServiceQuestionAnswer.getService().setServiceName("No Service"); voServiceQuestionAnswer.getService().setServiceCategory(ServiceCategory.CLINICAL); voServiceQuestionAnswer.setInvestigationQuestionAnswers(new InvestigationQuestionAnswerVoCollection()); voServiceQuestionAnswer.getInvestigationQuestionAnswers().add(new InvestigationQuestionAnswerVo()); voServiceQuestionAnswer.getInvestigationQuestionAnswers().get(0).setInvestigationQuestionAnswers(new GeneralQuestionAnswerVoCollection()); voServiceQuestionAnswer.getInvestigationQuestionAnswers().get(0).setInvestigation(voInvOcs); GeneralQuestionAnswerVoCollection voGQAColl = getInvestigationQuestions(voInvOcs); for( GeneralQuestionAnswerVo voItem : voGQAColl) voServiceQuestionAnswer.getInvestigationQuestionAnswers().get(0).getInvestigationQuestionAnswers().add(voItem); return voServiceQuestionAnswer; }
private GeneralQuestionAnswerVoCollection getServiceQuestions(ServiceQuestionShortVoCollection serviceConfigQuestions, ServiceLiteVo voServiceLite) { GeneralQuestionAnswerVoCollection serviceQuestions = new GeneralQuestionAnswerVoCollection(); for (int i = 0; serviceConfigQuestions != null && i < serviceConfigQuestions.size(); i++) { ServiceQuestionShortVo serviceQuestionShortVo = serviceConfigQuestions.get(i); boolean askedForEveryInvestigation = serviceQuestionShortVo.getAskForInvestigationsIsNotNull() && serviceQuestionShortVo.getAskForInvestigations().booleanValue(); if(askedForEveryInvestigation == false && serviceQuestionShortVo.getService().equals(voServiceLite)) { GeneralQuestionAnswerVo voGQA = createNewServiceQuestion(serviceQuestionShortVo); if(voGQA != null) serviceQuestions.add(voGQA); } } return serviceQuestions; }
private GeneralQuestionAnswerVoCollection getInvestigationQuestions(InvestigationOcsQuestionsVo voInvOcs) { if(voInvOcs == null) return null; GeneralQuestionAnswerVoCollection invQuestions = new GeneralQuestionAnswerVoCollection(); for (int i = 0; i < voInvOcs.getAssocQuestions().size(); i++) { InvestigationQuestionShortVo voInvestigationQuestion = voInvOcs.getAssocQuestions().get(i); if(isQuestionRelevant(voInvestigationQuestion.getQuestion(), getAge(), getSex())) { GeneralQuestionAnswerVo voGeneralQuestionAnswer = new GeneralQuestionAnswerVo(); voGeneralQuestionAnswer.setQuestion(voInvestigationQuestion.getQuestion()); voGeneralQuestionAnswer.setWasMandatory(voInvestigationQuestion.getIsMandatory()); invQuestions.add(voGeneralQuestionAnswer); } } return invQuestions; }
private int getDynamicColumnsNumber(GeneralQuestionAnswerVoCollection questions) { if(questions == null) return 0; int max = 0; for(int x = 0; x < questions.size(); x++) { IQuestionType question = questions.get(x); if(question.getIQuestionTypeQuestion().getAnswerTypesIsNotNull()) { int ansersCount = question.getIQuestionTypeQuestion().getAnswerTypes().size(); if(ansersCount > max) max = ansersCount; } } return max; }
/** * Function used to retrieve Questions & Answers for the service of the amended investigation */ public GeneralQuestionAnswerVoCollection getServiceQuestionsAnswers(OcsOrderSessionRefVo orderDetails, ServiceRefVo service) { if (orderDetails == null || service == null) return null; StringBuilder query = new StringBuilder(); query.append("SELECT questions "); query.append(" FROM OcsOrderSession AS ocsOrder LEFT JOIN ocsOrder.clinicalInfo AS clinInfo LEFT JOIN clinInfo.categoryQuestionAnswers AS categoryQA "); query.append(" LEFT JOIN categoryQA.serviceQuestionAnswers AS serviceQA LEFT JOIN serviceQA.service AS service LEFT JOIN serviceQA.serviceQuestionAnswers AS questions"); query.append(" WHERE ocsOrder.id = :ID_ORDER AND service.id = :ID_SERVICE"); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ID_ORDER"); paramValues.add(orderDetails.getID_OcsOrderSession()); paramNames.add("ID_SERVICE"); paramValues.add(service.getID_Service()); return GeneralQuestionAnswerVoAssembler.createGeneralQuestionAnswerVoCollectionFromGeneralQuestionAnswer(getDomainFactory().find(query.toString(), paramNames, paramValues)); }
/** * Function used to retrieve Question & Answers for the category for amended investigation */ public GeneralQuestionAnswerVoCollection getCategoryQuestionsAnswers(OcsOrderSessionRefVo orderDetails, Category category) { if (orderDetails == null || category == null) return null; StringBuilder query = new StringBuilder(); query.append("SELECT questions "); query.append(" FROM OcsOrderSession AS ocsOrder LEFT JOIN ocsOrder.clinicalInfo AS clinInfo LEFT JOIN clinInfo.categoryQuestionAnswers AS categoryQA "); query.append(" LEFT JOIN categoryQA.categoryQuestionAnswers AS questions LEFT JOIN categoryQA.category AS category "); query.append(" WHERE ocsOrder.id = :ID_ORDER AND category.id = :ID_CATEGORY "); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ID_ORDER"); paramValues.add(orderDetails.getID_OcsOrderSession()); paramNames.add("ID_CATEGORY"); paramValues.add(category.getID()); return GeneralQuestionAnswerVoAssembler.createGeneralQuestionAnswerVoCollectionFromGeneralQuestionAnswer(getDomainFactory().find(query.toString(), paramNames, paramValues)); }
public void populateQuestionInformation(GeneralQuestionAnswerVoCollection questions) { clearQuestions(); if(questions == null) return; if(questionOrInformation.equals("Information")) this.columnName = this.gridQuestions.getColumns().newColumn(questionOrInformation); else this.columnName = this.gridQuestions.getColumns().newColumn("Question / Information"); this.columnName.setWidth(DEFAULT_QUESTION_COLUMN_WIDTH); int noDynamicColumns = getDynamicColumnsNumber(questions); DynamicGridColumn[] columnsAnswer = new DynamicGridColumn[noDynamicColumns]; for(int x = 0; x < noDynamicColumns; x++) { if(x == 0) columnsAnswer[x] = this.gridQuestions.getColumns().newColumn("Answer(s)"); else columnsAnswer[x] = this.gridQuestions.getColumns().newColumn(" "); columnsAnswer[x].setDynamicWidthSupported(true); } GeneralQuestionAnswerVoCollection collInvQuestions = getQuestionsByType(questions, OrderQuestionType.INVESTIGATION); if(collInvQuestions != null) { for(int i=0; i<collInvQuestions.size(); i++) { DynamicGridRow row = createOrFindInvestigationRow(collInvQuestions.get(i)); GeneralQuestionAnswerVoCollection question = new GeneralQuestionAnswerVoCollection(); question.add(collInvQuestions.get(i)); addQuestions(row, columnsAnswer, question); } } }
private CategoryQuestionAnswerVo getCategoryQuestionAnswer(Category category, OcsQASessionVo voOcsQASession) { for (int i = 0; voOcsQASession != null && i < voOcsQASession.getCategoryQuestionAnswers().size(); i++) { if(voOcsQASession.getCategoryQuestionAnswers().get(i).getCategory().equals(category)) return voOcsQASession.getCategoryQuestionAnswers().get(i); } CategoryQuestionAnswerVo voCategoryQuestionAnswer = new CategoryQuestionAnswerVo(); voCategoryQuestionAnswer.setCategory(category); voCategoryQuestionAnswer.setServiceQuestionAnswers(new ServiceQuestionAnswerVoCollection()); voCategoryQuestionAnswer.setCategoryQuestionAnswers(new GeneralQuestionAnswerVoCollection()); return voCategoryQuestionAnswer; }
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 void buildServiceQuestions(Category category, CategoryQuestionAnswerVo voCategoryQuestionAnswerVo, ServiceQuestionShortVoCollection serviceConfigQuestions, GeneralQuestionAnswerVoCollection askedInEveryInvestigations, InvestigationOcsQuestionsVo voInvOcs) { if (voInvOcs != null) { Category investigationCategory = voInvOcs.getInvestigationIndexIsNotNull() && voInvOcs.getInvestigationIndex().getCategoryIsNotNull() ? voInvOcs.getInvestigationIndex().getCategory() : null; if (investigationCategory != null && investigationCategory.equals(category)) { ServiceLiteVo serviceVo = voInvOcs.getProviderServiceIsNotNull() && voInvOcs.getProviderService().getLocationServiceIsNotNull() ? voInvOcs.getProviderService().getLocationService().getService() : null; if(serviceVo != null) { ServiceQuestionAnswerVo voServiceQA = getInstServiceQuestionAnswerFromConfigService(serviceConfigQuestions, voCategoryQuestionAnswerVo, askedInEveryInvestigations, serviceVo, voInvOcs); boolean questionsAdded = voServiceQA != null && voServiceQA.getServiceQuestionAnswersIsNotNull() && voServiceQA.getServiceQuestionAnswers().size() > 0; boolean investigationQuestionsAdded = voServiceQA != null && voServiceQA.getInvestigationQuestionAnswersIsNotNull() && voServiceQA.getInvestigationQuestionAnswers().size() > 0; //Add the Service only if there is at least one Service or Investigation Question if(questionsAdded || investigationQuestionsAdded) { if (voCategoryQuestionAnswerVo.getServiceQuestionAnswers() == null) voCategoryQuestionAnswerVo.setServiceQuestionAnswers(new ServiceQuestionAnswerVoCollection()); int index = voCategoryQuestionAnswerVo.getServiceQuestionAnswers().indexOf(voServiceQA); if(index < 0) voCategoryQuestionAnswerVo.getServiceQuestionAnswers().add(voServiceQA); else voCategoryQuestionAnswerVo.getServiceQuestionAnswers().set(index, voServiceQA); } } } } else { voCategoryQuestionAnswerVo.setServiceQuestionAnswers(null); } }
private boolean isQuestionAdded(GeneralQuestionAnswerVo vo, GeneralQuestionAnswerVoCollection serviceQuestionAnswers) { if(serviceQuestionAnswers == null) return false; for (int i = 0; i < serviceQuestionAnswers.size(); i++) { if(serviceQuestionAnswers.get(i).getQuestion().equals(vo.getQuestion())) return true; } return false; }
private void addQuestions(DynamicGridRow pRow, DynamicGridColumn[] columnsAnswer, GeneralQuestionAnswerVoCollection collQuestions) { for (int i = 0; i < collQuestions.size(); i++) { Image rowQuestionImage = null; if(collQuestions.get(i).getIQuestionTypeQuestion().getIsQuestionIsNotNull() && collQuestions.get(i).getIQuestionTypeQuestion().getIsQuestion().equals(Boolean.FALSE)) rowQuestionImage = this.infoImage; else { rowQuestionImage = this.questionImage; if(collQuestions.get(i).getIQuestionTypeIsMandatory() != null && collQuestions.get(i).getIQuestionTypeIsMandatory().booleanValue()) rowQuestionImage = this.mandatoryQuestionImage; } DynamicGridRow row = pRow.getRows().newRow(); row.setSelectable(false); row.setCollapsedImage(rowQuestionImage); row.setExpandedImage(rowQuestionImage); DynamicGridCell questionNameCell = row.getCells().newCell(this.columnName, DynamicCellType.WRAPTEXT); questionNameCell.setReadOnly(true); questionNameCell.setValue(collQuestions.get(i).getIQuestionTypeQuestion().getText()); row.setIdentifier(collQuestions.get(i)); if(collQuestions.get(i).getQuestionIsNotNull()) addAnswers(row, columnsAnswer, collQuestions.get(i)); } }
private void addQuestions(DynamicGridRow pRow, GeneralQuestionAnswerVoCollection collQuestions, boolean previewMode) throws PresentationLogicException { for (int i = 0; collQuestions != null && i < collQuestions.size(); i++) { addQuestion(pRow, collQuestions.get(i),previewMode); } }
private GeneralQuestionAnswerVoCollection getQuestionsByType(GeneralQuestionAnswerVoCollection questions, OrderQuestionType type) { if(questions == null || type == null) return null; GeneralQuestionAnswerVoCollection voCollQuestionAnswers = new GeneralQuestionAnswerVoCollection(); for(int i=0;i<questions.size();i++) { if(questions.get(i).getIQuestionTypeOrderQuestionType().equals(type)) voCollQuestionAnswers.add(questions.get(i)); } return voCollQuestionAnswers.size() > 0 ? voCollQuestionAnswers : null; }