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; }
/** * Function used to retrieve the questions and answers for an investigation */ public InvestigationQuestionAnswerVoCollection getInvestigationQuestionsAnswers(InvestigationRefVo investigation, OcsOrderSessionRefVo orderDetails) { if (investigation == null || orderDetails == null) return null; StringBuilder query = new StringBuilder(); query.append("SELECT questions FROM OcsOrderSession AS ocsorder LEFT JOIN ocsorder.clinicalInfo AS clinInfo LEFT JOIN clinInfo.categoryQuestionAnswers AS category "); query.append(" LEFT JOIN category.serviceQuestionAnswers AS serviceQA LEFT JOIN serviceQA.investigationQuestionAnswers AS questions "); query.append(" LEFT JOIN questions.investigation AS investigation"); query.append(" WHERE ocsorder.id = :ID_ORDERDETAILS AND investigation.id = :ID_INVESTIGATION"); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ID_ORDERDETAILS"); paramValues.add(orderDetails.getID_OcsOrderSession()); paramNames.add("ID_INVESTIGATION"); paramValues.add(investigation.getID_Investigation()); return InvestigationQuestionAnswerVoAssembler.createInvestigationQuestionAnswerVoCollectionFromInvestigationQuestionAnswer(getDomainFactory().find(query.toString(), paramNames, paramValues)); }
/** * WDEV-13999 Function used to populate order to amend values to screen * * @param investigation * @throws PresentationLogicException */ private void populateOrderToAmendsValues(OrderInvestigationLiteVo investigation, OcsOrderVo orderToAmendDetails) throws PresentationLogicException { if (orderToAmendDetails == null) return; // Copy & default in 'Responsible HCP' from order to amend form.lyrDetails().tabClinicalNotes().qmbResponsibleHCP().clear(); form.lyrDetails().tabClinicalNotes().qmbResponsibleHCP().newRow(orderToAmendDetails.getResponsibleClinician(), orderToAmendDetails.getResponsibleClinician().toString()); form.lyrDetails().tabClinicalNotes().qmbResponsibleHCP().setValue(orderToAmendDetails.getResponsibleClinician()); // Copy 'Ordering HCP' form.lyrDetails().tabClinicalNotes().qmbOrderingHCP().clear(); HcpLiteVo orderingHCP = domain.getHCPbyMoS(orderToAmendDetails.getOrderedBy()); if (orderingHCP != null) // Old orders might not have this fields filled in { form.lyrDetails().tabClinicalNotes().qmbOrderingHCP().newRow(orderingHCP, orderingHCP.toString()); form.lyrDetails().tabClinicalNotes().qmbOrderingHCP().setValue(orderingHCP); } if (investigation == null) return; InvestigationQuestionAnswerVoCollection investigationQuestions = null; GeneralQuestionAnswerVoCollection serviceQuestions = null; GeneralQuestionAnswerVoCollection categoryQuestions = null; // Set Questions & Answers values // Get the questions for investigation (domain call and populate appropriate answer values) investigationQuestions = domain.getInvestigationQuestionsAnswers(investigation.getInvestigation(), orderToAmendDetails); // Avoid a null pointer condition - this should be true under correctly configured data if (investigation.getInvestigationIsNotNull() && investigation.getInvestigation().getProviderServiceIsNotNull() && investigation.getInvestigation().getProviderService().getLocationServiceIsNotNull()) { serviceQuestions = domain.getServiceQuestionsAnswers(orderToAmendDetails, investigation.getInvestigation().getProviderService().getLocationService().getService()); } // Avoid a null pointer condition - this should be true under correctly configured data if (investigation.getInvestigationIsNotNull() && investigation.getInvestigation().getProviderServiceIsNotNull() && investigation.getInvestigation().getProviderService().getProviderSystemIsNotNull()) { categoryQuestions = domain.getCategoryQuestionsAnswers(orderToAmendDetails, investigation.getInvestigation().getProviderService().getProviderSystem().getCategory()); } populateAnswerValuesToScreen(investigationQuestions, serviceQuestions, categoryQuestions); // Set 'Additional Information' form.lyrDetails().tabClinicalNotes().txtAdditionalNotes().setValue(orderToAmendDetails.getAdditClinNotes()); // Set Patient Mobility form.lyrDetails().tabRadDetails().cmbPatMobility().setValue(orderToAmendDetails.getPatMobility()); }
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; }