private PatientAssessmentAnswerVoCollection getPatientAnswers(InvestigationQuestionAnswerVoCollection questions, QuestionInformationShortVo question) { if (questions == null || questions.size() == 0) return null; if (question == null) return null; for (InvestigationQuestionAnswerVo investigationQuestion : questions) { if (investigationQuestion.getInvestigationQuestionAnswersIsNotNull()) { for (GeneralQuestionAnswerVo answer : investigationQuestion.getInvestigationQuestionAnswers()) { if (question.equals(answer.getQuestion())) return answer.getPatientAnswers(); } } } return null; }
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 DynamicGridRow addInvestigationRow(DynamicGridRow serviceRow, InvestigationQuestionAnswerVo voInvQuestionAnswer) { DynamicGridRow investigationRow = addTreeRow(serviceRow.getRows().newRow(), voInvQuestionAnswer.getInvestigation().getInvestigationIndex().getName()); investigationRow.setSelectable(false); investigationRow.setIdentifier(voInvQuestionAnswer); investigationRow.setBackColor(Color.AntiqueWhite); investigationRow.setExpandedImage(investigationImage); investigationRow.setCollapsedImage(investigationImage); investigationRow.setBold(true); return investigationRow; }
public OcsQASessionVo removeInvestigationFromVo(Integer investigationId, OcsQASessionVo ocsQASession) { if (investigationId == null) return ocsQASession; for (int i = 0; ocsQASession != null && ocsQASession.getCategoryQuestionAnswersIsNotNull() && i < ocsQASession.getCategoryQuestionAnswers().size(); i++) { CategoryQuestionAnswerVo categoryQuestionAnswerVo = ocsQASession.getCategoryQuestionAnswers().get(i); for (int j = 0; categoryQuestionAnswerVo.getServiceQuestionAnswersIsNotNull() && j < categoryQuestionAnswerVo.getServiceQuestionAnswers().size(); j++) { ServiceQuestionAnswerVo serviceQuestionAnswerVo = categoryQuestionAnswerVo.getServiceQuestionAnswers().get(j); if (serviceQuestionAnswerVo.getInvestigationQuestionAnswers() != null) { //Remove the Investigation Question Answer for (int k = serviceQuestionAnswerVo.getInvestigationQuestionAnswers().size() - 1; k >= 0; k--) { InvestigationQuestionAnswerVo invQAVo = serviceQuestionAnswerVo.getInvestigationQuestionAnswers().get(k); if (invQAVo.getInvestigationIsNotNull() && invQAVo.getInvestigation().getID_InvestigationIsNotNull() && invQAVo.getInvestigation().getID_Investigation().equals(investigationId)) { serviceQuestionAnswerVo.getInvestigationQuestionAnswers().remove(invQAVo); } } } } } return ocsQASession; }
private static GeneralQuestionAnswerVoCollection getGeneralQuestionAnswerCollection(OcsQASessionVo voOcsQASession) { GeneralQuestionAnswerVoCollection voColl = new GeneralQuestionAnswerVoCollection(); for (int j = 0; voOcsQASession != null && voOcsQASession.getCategoryQuestionAnswersIsNotNull() && j < voOcsQASession.getCategoryQuestionAnswers().size(); j++) { CategoryQuestionAnswerVo voCatQAnswer = voOcsQASession.getCategoryQuestionAnswers().get(j); // Category for (int k = 0; k < voCatQAnswer.getCategoryQuestionAnswers().size(); k++) { voColl.add(voCatQAnswer.getCategoryQuestionAnswers().get(k)); } // Service for (int k = 0; k < voCatQAnswer.getServiceQuestionAnswers().size(); k++) { ServiceQuestionAnswerVo voServiceQAnswer = voCatQAnswer.getServiceQuestionAnswers().get(k); for (int index = 0; index < voServiceQAnswer.getServiceQuestionAnswers().size(); index++) { voColl.add(voServiceQAnswer.getServiceQuestionAnswers().get(index)); } for (int i = 0; i < voServiceQAnswer.getInvestigationQuestionAnswers().size(); i++) { InvestigationQuestionAnswerVo voSQAnswer = voServiceQAnswer.getInvestigationQuestionAnswers().get(i); for (int index = 0; voSQAnswer != null && index < voSQAnswer.getInvestigationQuestionAnswers().size(); index++) { voColl.add(voSQAnswer.getInvestigationQuestionAnswers().get(index)); } } } } return voColl; }
public String[] validateAnswers() { OcsQASessionVo voValidate = new OcsQASessionVo(); voValidate = this.getAnswers(voValidate); ArrayList<String> errors = new ArrayList<String>(); if (voValidate != null) { for (int i = 0; voValidate.getCategoryQuestionAnswersIsNotNull() && i < voValidate.getCategoryQuestionAnswers().size(); i++) { CategoryQuestionAnswerVo voCQA = voValidate.getCategoryQuestionAnswers().get(i); // Category Questions getMandatoryQuestionErrors(errors, voCQA.getCategoryQuestionAnswers(), voCQA.getCategory().toString()); for (int j = 0; j < voCQA.getServiceQuestionAnswers().size(); j++) { ServiceQuestionAnswerVo voSQA = voCQA.getServiceQuestionAnswers().get(j); //ServiceQuestions getMandatoryQuestionErrors(errors, voSQA.getServiceQuestionAnswers(), voSQA.getService().getServiceName()); for (int k = 0; k < voSQA.getInvestigationQuestionAnswers().size(); k++) { InvestigationQuestionAnswerVo voIQA = voSQA.getInvestigationQuestionAnswers().get(k); //Investigation Questions getMandatoryQuestionErrors(errors, voIQA.getInvestigationQuestionAnswers(), voIQA.getInvestigation().getInvestigationIndex().getName()); } } } } if (errors.size() > 0) { String[] errs = new String[errors.size()]; errors.toArray(errs); return errs; } return null; }
public void populate(OcsQASessionVo voOcsQASession, boolean previewMode) throws PresentationLogicException { checkDataIntegrity(voOcsQASession); prepareGraphicGrid(); for (int j = 0; voOcsQASession != null && voOcsQASession.getCategoryQuestionAnswersIsNotNull() && j < voOcsQASession.getCategoryQuestionAnswers().size(); j++) { CategoryQuestionAnswerVo voCatQAnswer = voOcsQASession.getCategoryQuestionAnswers().get(j); DynamicGridRow topCategoryRow = null; if(categoryOrServiceOrQuestionsAdded(voCatQAnswer)) { topCategoryRow = addCategoryRow(voCatQAnswer); topCategoryRow.setSelectable(false); // Category addQuestions(topCategoryRow, voCatQAnswer.getCategoryQuestionAnswers(), previewMode); // Service for (int k = 0; k < voCatQAnswer.getServiceQuestionAnswers().size(); k++) { ServiceQuestionAnswerVo voServiceQAnswer = voCatQAnswer.getServiceQuestionAnswers().get(k); DynamicGridRow serviceRow = addServiceRow(topCategoryRow, voServiceQAnswer); serviceRow.setSelectable(false); addQuestions(serviceRow, voServiceQAnswer.getServiceQuestionAnswers(), previewMode); //Investigations for (int s = 0; voServiceQAnswer.getInvestigationQuestionAnswersIsNotNull() && s < voServiceQAnswer.getInvestigationQuestionAnswers().size(); s++) { InvestigationQuestionAnswerVo voInvQuestionAnswer = voServiceQAnswer.getInvestigationQuestionAnswers().get(s); // WDEV-3953 if(engine != null) { /* boolean isConfidentialInv = voInvQuestionAnswer.getInvestigationIsNotNull() && voInvQuestionAnswer.getInvestigation().getInvestigationIndexIsNotNull() && voInvQuestionAnswer.getInvestigation().getInvestigationIndex().getConfidentialTestIsNotNull() && voInvQuestionAnswer.getInvestigation().getInvestigationIndex().getConfidentialTest().booleanValue(); if (isConfidentialInv) { if (!engine.hasRight(AppRight.CAN_VIEW_CONFIDENTIAL_INVESTIGATIONS_ORDERED)) { continue; } } */ } DynamicGridRow investigationRow = addInvestigationRow(serviceRow, voInvQuestionAnswer); investigationRow.setSelectable(false); addQuestions(investigationRow, voInvQuestionAnswer.getInvestigationQuestionAnswers(), previewMode); } } } //WDEV-6898 if(voCatQAnswer.getClinicalInvestigationQuestionAnswersIsNotNull()) { for(int i=0;i<voCatQAnswer.getClinicalInvestigationQuestionAnswers().size();i++) { for(int y=0;y<voCatQAnswer.getClinicalInvestigationQuestionAnswers().get(i).getInvestigationQuestionAnswers().size();y++) { if(!isClinicalQuestionAlreadyAdded(voCatQAnswer.getClinicalInvestigationQuestionAnswers().get(i).getInvestigationQuestionAnswers().get(y), voOcsQASession.getCategoryQuestionAnswers())) { if(topCategoryRow == null) { topCategoryRow = addCategoryRow(voCatQAnswer); topCategoryRow.setSelectable(false); } addQuestion(topCategoryRow, voCatQAnswer.getClinicalInvestigationQuestionAnswers().get(i).getInvestigationQuestionAnswers().get(y), previewMode); } } } } } }
public OcsQASessionVo setOcsQASessionAnswers(OcsQASessionVo voOcsQASession, CategoryQuestionShortVoCollection categoryConfigQuestions, ServiceQuestionShortVoCollection serviceConfigQuestions, InvestigationOcsQuestionsVoCollection investigationOcsQuestionsColl) { //Everything is driven by the Investigations if(investigationOcsQuestionsColl == null || investigationOcsQuestionsColl.size() == 0) return null; if(voOcsQASession == null) throw new CodingRuntimeException("Cannot set answers for null OcsQASessionVo"); if(voOcsQASession.getCategoryQuestionAnswers() == null) voOcsQASession.setCategoryQuestionAnswers(new CategoryQuestionAnswerVoCollection()); //Get a list of top Categories CategoryCollection categoryColl = getCategoryCollection(investigationOcsQuestionsColl); //Add new Category /Investigations/Service Questions for (int i = 0; i < categoryColl.size(); i++) { Category category = categoryColl.get(i); for (int j = 0; investigationOcsQuestionsColl != null && j < investigationOcsQuestionsColl.size(); j++) { InvestigationOcsQuestionsVo voInvestigation = investigationOcsQuestionsColl.get(j); CategoryQuestionAnswerVo voCategoryQuestionAnswerVo = getCategoryQuestionAnswer(category, voOcsQASession); if(voInvestigation.getInvestigationIndex().getCategory().equals(category) && isInvestigationAdded(voInvestigation, voOcsQASession) == false) { //Category Questions Hierarchy buildCategoryQuestions(category, voCategoryQuestionAnswerVo, categoryConfigQuestions); //Get Questions that have to be asked in every Investigations GeneralQuestionAnswerVoCollection askedInEveryInvestigations = getQuestionsToBeAskedInEveryInvestigation(category, categoryConfigQuestions, serviceConfigQuestions, voInvestigation); //Build Service and Investigation Questions buildServiceQuestions(category, voCategoryQuestionAnswerVo, serviceConfigQuestions, askedInEveryInvestigations, voInvestigation); //Aa CategoryQuestionAnswerVo if there is at least one Question added if(isAtLeastOneQuestionAdded(voCategoryQuestionAnswerVo)) { int index = voOcsQASession.getCategoryQuestionAnswers().indexOf(voCategoryQuestionAnswerVo); if(index < 0) voOcsQASession.getCategoryQuestionAnswers().add(voCategoryQuestionAnswerVo); else voOcsQASession.getCategoryQuestionAnswers().set(index, voCategoryQuestionAnswerVo); } if(voInvestigation.getProviderService() == null) { if(voCategoryQuestionAnswerVo.getClinicalInvestigationQuestionAnswers() == null) voCategoryQuestionAnswerVo.setClinicalInvestigationQuestionAnswers(new InvestigationQuestionAnswerVoCollection()); InvestigationQuestionAnswerVo voInvQuestionAnswer = getInstInvestigationQuestionAnswerFromConfigInvestigation(voInvestigation, voCategoryQuestionAnswerVo.getClinicalInvestigationQuestionAnswers(), askedInEveryInvestigations); voCategoryQuestionAnswerVo.getClinicalInvestigationQuestionAnswers().add(voInvQuestionAnswer); voOcsQASession.getCategoryQuestionAnswers().add(voCategoryQuestionAnswerVo); } } } } removeUnusedCategoryQuestions(categoryColl, voOcsQASession); removeUnusedInvestigations(investigationOcsQuestionsColl, voOcsQASession); return voOcsQASession; }