Java Code Examples for ims.assessment.vo.PatientAssessmentQuestionVo.getPatientAnswers()

The following are Jave code examples for showing how to use getPatientAnswers() of the ims.assessment.vo.PatientAssessmentQuestionVo class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 6 votes
private AnswerDetailsVo getInstAnswerType(PatientAssessmentQuestionVo instQuestion, QuestionAnswerTypeVo configAnswerType)
{
	if (instQuestion == null || instQuestion.getPatientAnswers() == null || instQuestion.getPatientAnswers().size() == 0 || configAnswerType == null)
		return null;

	for (int x = 0; x < instQuestion.getPatientAnswers().size(); x++)
	{
		PatientAssessmentAnswerVo answer = instQuestion.getPatientAnswers().get(x);
		if (answer != null && answer.getAnswerDetails() != null)
		{
			for (int y = 0; y < answer.getAnswerDetails().size(); y++)
			{
				if (answer.getAnswerDetails().get(y).getAnswerTypeIsNotNull() && answer.getAnswerDetails().get(y).getAnswerType().equals(configAnswerType))
				{
					return answer.getAnswerDetails().get(y);
				}
			}
		}
	}

	return null;
}
 
Example 2
Project: AvoinApotti   File: UserAssessmentInstHelper.java   View Source Code Vote up 6 votes
@SuppressWarnings("unchecked")
private ArrayList validateAnswer(PatientAssessmentQuestionVo assessmentQuestion, ArrayList errors)
{
	if(errors == null)
		errors = new ArrayList();	
	if(assessmentQuestion == null || assessmentQuestion.getAssessmentQuestion() == null || assessmentQuestion.getPatientAnswers() == null)
		return errors;
	
	QuestionInformationVo question = assessmentQuestion.getAssessmentQuestion().getQuestion();
	PatientAssessmentAnswerVoCollection patientAnswers = assessmentQuestion.getPatientAnswers();
	Boolean isMandatory = assessmentQuestion.getIsMandatory();
	
	validateAllAnswers(errors, question, patientAnswers, isMandatory);			
	
	return errors;
}
 
Example 3
Project: AvoinApotti   File: UserAssessmentInstHelper.java   View Source Code Vote up 6 votes
private AnswerDetailsVo getInstAnswerType(PatientAssessmentQuestionVo instQuestion, QuestionAnswerTypeVo configAnswerType)
{
	if(instQuestion == null || instQuestion.getPatientAnswers() == null || instQuestion.getPatientAnswers().size() == 0 || configAnswerType == null)
		return null;
	
	for(int x = 0; x < instQuestion.getPatientAnswers().size(); x++)
	{
		PatientAssessmentAnswerVo answer = instQuestion.getPatientAnswers().get(x);		
		if(answer != null && answer.getAnswerDetails() != null)
		{
			for(int y = 0; y < answer.getAnswerDetails().size(); y++)
			{
				if(answer.getAnswerDetails().get(y).getAnswerTypeIsNotNull() && answer.getAnswerDetails().get(y).getAnswerType().equals(configAnswerType))
				{
					return answer.getAnswerDetails().get(y);
				}
			}
		}		
	}
	
	return null;
}
 
Example 4
Project: openmaxims-linux   File: Logic.java   View Source Code Vote up 6 votes
private AnswerDetailsVo getInstAnswerType(PatientAssessmentQuestionVo instQuestion, QuestionAnswerTypeVo configAnswerType)
{
	if (instQuestion == null || instQuestion.getPatientAnswers() == null || instQuestion.getPatientAnswers().size() == 0 || configAnswerType == null)
		return null;

	for (int x = 0; x < instQuestion.getPatientAnswers().size(); x++)
	{
		PatientAssessmentAnswerVo answer = instQuestion.getPatientAnswers().get(x);
		if (answer != null && answer.getAnswerDetails() != null)
		{
			for (int y = 0; y < answer.getAnswerDetails().size(); y++)
			{
				if (answer.getAnswerDetails().get(y).getAnswerTypeIsNotNull() && answer.getAnswerDetails().get(y).getAnswerType().equals(configAnswerType))
				{
					return answer.getAnswerDetails().get(y);
				}
			}
		}
	}

	return null;
}
 
Example 5
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View Source Code Vote up 6 votes
@SuppressWarnings("unchecked")
private ArrayList validateAnswer(PatientAssessmentQuestionVo assessmentQuestion, ArrayList errors)
{
	if(errors == null)
		errors = new ArrayList();	
	if(assessmentQuestion == null || assessmentQuestion.getAssessmentQuestion() == null || assessmentQuestion.getPatientAnswers() == null)
		return errors;
	
	QuestionInformationVo question = assessmentQuestion.getAssessmentQuestion().getQuestion();
	PatientAssessmentAnswerVoCollection patientAnswers = assessmentQuestion.getPatientAnswers();
	Boolean isMandatory = assessmentQuestion.getIsMandatory();
	
	validateAllAnswers(errors, question, patientAnswers, isMandatory);			
	
	return errors;
}
 
Example 6
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View Source Code Vote up 6 votes
private AnswerDetailsVo getInstAnswerType(PatientAssessmentQuestionVo instQuestion, QuestionAnswerTypeVo configAnswerType)
{
	if(instQuestion == null || instQuestion.getPatientAnswers() == null || instQuestion.getPatientAnswers().size() == 0 || configAnswerType == null)
		return null;
	
	for(int x = 0; x < instQuestion.getPatientAnswers().size(); x++)
	{
		PatientAssessmentAnswerVo answer = instQuestion.getPatientAnswers().get(x);		
		if(answer != null && answer.getAnswerDetails() != null)
		{
			for(int y = 0; y < answer.getAnswerDetails().size(); y++)
			{
				if(answer.getAnswerDetails().get(y).getAnswerTypeIsNotNull() && answer.getAnswerDetails().get(y).getAnswerType().equals(configAnswerType))
				{
					return answer.getAnswerDetails().get(y);
				}
			}
		}		
	}
	
	return null;
}
 
Example 7
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 6 votes
private AnswerDetailsVo getInstAnswerType(PatientAssessmentQuestionVo instQuestion, QuestionAnswerTypeVo configAnswerType)
{
	if (instQuestion == null || instQuestion.getPatientAnswers() == null || instQuestion.getPatientAnswers().size() == 0 || configAnswerType == null)
		return null;

	for (int x = 0; x < instQuestion.getPatientAnswers().size(); x++)
	{
		PatientAssessmentAnswerVo answer = instQuestion.getPatientAnswers().get(x);
		if (answer != null && answer.getAnswerDetails() != null)
		{
			for (int y = 0; y < answer.getAnswerDetails().size(); y++)
			{
				if (answer.getAnswerDetails().get(y).getAnswerTypeIsNotNull() && answer.getAnswerDetails().get(y).getAnswerType().equals(configAnswerType))
				{
					return answer.getAnswerDetails().get(y);
				}
			}
		}
	}

	return null;
}
 
Example 8
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View Source Code Vote up 6 votes
private AnswerDetailsVo getInstAnswerType(PatientAssessmentQuestionVo instQuestion, QuestionAnswerTypeVo configAnswerType)
{
	if(instQuestion == null || instQuestion.getPatientAnswers() == null || instQuestion.getPatientAnswers().size() == 0 || configAnswerType == null)
		return null;
	
	for(int x = 0; x < instQuestion.getPatientAnswers().size(); x++)
	{
		PatientAssessmentAnswerVo answer = instQuestion.getPatientAnswers().get(x);		
		if(answer != null && answer.getAnswerDetails() != null)
		{
			for(int y = 0; y < answer.getAnswerDetails().size(); y++)
			{
				if(answer.getAnswerDetails().get(y).getAnswerTypeIsNotNull() && answer.getAnswerDetails().get(y).getAnswerType().equals(configAnswerType))
				{
					return answer.getAnswerDetails().get(y);
				}
			}
		}		
	}
	
	return null;
}
 
Example 9
Project: openmaxims-linux   File: UserAssessmentInstHelper.java   View Source Code Vote up 6 votes
@SuppressWarnings("unchecked")
private ArrayList validateAnswer(PatientAssessmentQuestionVo assessmentQuestion, ArrayList errors)
{
	if(errors == null)
		errors = new ArrayList();	
	if(assessmentQuestion == null || assessmentQuestion.getAssessmentQuestion() == null || assessmentQuestion.getPatientAnswers() == null)
		return errors;
	
	QuestionInformationVo question = assessmentQuestion.getAssessmentQuestion().getQuestion();
	PatientAssessmentAnswerVoCollection patientAnswers = assessmentQuestion.getPatientAnswers();
	Boolean isMandatory = assessmentQuestion.getIsMandatory();
	
	validateAllAnswers(errors, question, patientAnswers, isMandatory);			
	
	return errors;
}
 
Example 10
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 5 votes
private ArrayList<String> validateAnswer(PatientAssessmentQuestionVo assessmentQuestion, ArrayList<String> errors)
{
	if (errors == null)
		errors = new ArrayList<String>();
	if (assessmentQuestion == null || assessmentQuestion.getAssessmentQuestion() == null || assessmentQuestion.getPatientAnswers() == null)
		return errors;

	QuestionInformationVo question = assessmentQuestion.getAssessmentQuestion().getQuestion();
	PatientAssessmentAnswerVoCollection patientAnswers = assessmentQuestion.getPatientAnswers();
	Boolean isMandatory = assessmentQuestion.getIsMandatory();

	validateAllAnswers(errors, question, patientAnswers, isMandatory);

	return errors;
}
 
Example 11
Project: AvoinApotti   File: DynamicAssessmentHelper.java   View Source Code Vote up 5 votes
private static void populateHCPDataForAnswerGroups(PatientAssessmentVo initialData, PatientAssessmentVo updatedData, AuthoringInformationVo author) 
{
	int answerGroups = updatedData.getAssessmentData().getAnswerGroups().size();
	
	for(int x = 0; x < answerGroups; x++)
	{
		PatientAssessmentGroupVo answerGroup = updatedData.getAssessmentData().getAnswerGroups().get(x);
		if(answerGroup != null && answerGroup.getAssessmentAnswers() != null)
		{
			int assessmentAnswers = answerGroup.getAssessmentAnswers().size();
			
			for(int y = 0; y < assessmentAnswers; y++)
			{
				PatientAssessmentQuestionVo answer = answerGroup.getAssessmentAnswers().get(y);
				
				if(answer != null && answer.getPatientAnswers() != null && answer.getIsAnswered() != null && answer.getIsAnswered().equals(AnswerStatus.ANSWERED))
				{
					int patientAnswers = answer.getPatientAnswers().size();
					
					for(int z = 0; z < patientAnswers; z++)
					{
						PatientAssessmentAnswerVo patientAnswer = answer.getPatientAnswers().get(z);
						
						if(patientAnswer != null)
						{
							populateHCPDataForPatientAnswer(initialData, patientAnswer, author);
						}
					}
				}
			}
		}
	}
}
 
Example 12
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 5 votes
private ArrayList<String> validateAnswer(PatientAssessmentQuestionVo assessmentQuestion, ArrayList<String> errors)
{
	if (errors == null)
		errors = new ArrayList<String>();
	if (assessmentQuestion == null || assessmentQuestion.getAssessmentQuestion() == null || assessmentQuestion.getPatientAnswers() == null)
		return errors;

	QuestionInformationVo question = assessmentQuestion.getAssessmentQuestion().getQuestion();
	PatientAssessmentAnswerVoCollection patientAnswers = assessmentQuestion.getPatientAnswers();
	Boolean isMandatory = assessmentQuestion.getIsMandatory();

	validateAllAnswers(errors, question, patientAnswers, isMandatory);

	return errors;
}
 
Example 13
Project: openMAXIMS   File: DynamicAssessmentHelper.java   View Source Code Vote up 5 votes
private static void populateHCPDataForAnswerGroups(PatientAssessmentVo initialData, PatientAssessmentVo updatedData, AuthoringInformationVo author) 
{
	int answerGroups = updatedData.getAssessmentData().getAnswerGroups().size();
	
	for(int x = 0; x < answerGroups; x++)
	{
		PatientAssessmentGroupVo answerGroup = updatedData.getAssessmentData().getAnswerGroups().get(x);
		if(answerGroup != null && answerGroup.getAssessmentAnswers() != null)
		{
			int assessmentAnswers = answerGroup.getAssessmentAnswers().size();
			
			for(int y = 0; y < assessmentAnswers; y++)
			{
				PatientAssessmentQuestionVo answer = answerGroup.getAssessmentAnswers().get(y);
				
				if(answer != null && answer.getPatientAnswers() != null && answer.getIsAnswered() != null && answer.getIsAnswered().equals(AnswerStatus.ANSWERED))
				{
					int patientAnswers = answer.getPatientAnswers().size();
					
					for(int z = 0; z < patientAnswers; z++)
					{
						PatientAssessmentAnswerVo patientAnswer = answer.getPatientAnswers().get(z);
						
						if(patientAnswer != null)
						{
							populateHCPDataForPatientAnswer(initialData, patientAnswer, author);
						}
					}
				}
			}
		}
	}
}
 
Example 14
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 5 votes
private ArrayList<String> validateAnswer(PatientAssessmentQuestionVo assessmentQuestion, ArrayList<String> errors)
{
	if (errors == null)
		errors = new ArrayList<String>();
	if (assessmentQuestion == null || assessmentQuestion.getAssessmentQuestion() == null || assessmentQuestion.getPatientAnswers() == null)
		return errors;

	QuestionInformationVo question = assessmentQuestion.getAssessmentQuestion().getQuestion();
	PatientAssessmentAnswerVoCollection patientAnswers = assessmentQuestion.getPatientAnswers();
	Boolean isMandatory = assessmentQuestion.getIsMandatory();

	validateAllAnswers(errors, question, patientAnswers, isMandatory);

	return errors;
}
 
Example 15
Project: openMAXIMS   File: DynamicAssessmentHelper.java   View Source Code Vote up 5 votes
private static void populateHCPDataForAnswerGroups(PatientAssessmentVo initialData, PatientAssessmentVo updatedData, AuthoringInformationVo author) 
{
	int answerGroups = updatedData.getAssessmentData().getAnswerGroups().size();
	
	for(int x = 0; x < answerGroups; x++)
	{
		PatientAssessmentGroupVo answerGroup = updatedData.getAssessmentData().getAnswerGroups().get(x);
		if(answerGroup != null && answerGroup.getAssessmentAnswers() != null)
		{
			int assessmentAnswers = answerGroup.getAssessmentAnswers().size();
			
			for(int y = 0; y < assessmentAnswers; y++)
			{
				PatientAssessmentQuestionVo answer = answerGroup.getAssessmentAnswers().get(y);
				
				if(answer != null && answer.getPatientAnswers() != null && answer.getIsAnswered() != null && answer.getIsAnswered().equals(AnswerStatus.ANSWERED))
				{
					int patientAnswers = answer.getPatientAnswers().size();
					
					for(int z = 0; z < patientAnswers; z++)
					{
						PatientAssessmentAnswerVo patientAnswer = answer.getPatientAnswers().get(z);
						
						if(patientAnswer != null)
						{
							populateHCPDataForPatientAnswer(initialData, patientAnswer, author);
						}
					}
				}
			}
		}
	}
}
 
Example 16
Project: openmaxims-linux   File: DynamicAssessmentHelper.java   View Source Code Vote up 5 votes
private static void populateHCPDataForAnswerGroups(PatientAssessmentVo initialData, PatientAssessmentVo updatedData, AuthoringInformationVo author) 
{
	int answerGroups = updatedData.getAssessmentData().getAnswerGroups().size();
	
	for(int x = 0; x < answerGroups; x++)
	{
		PatientAssessmentGroupVo answerGroup = updatedData.getAssessmentData().getAnswerGroups().get(x);
		if(answerGroup != null && answerGroup.getAssessmentAnswers() != null)
		{
			int assessmentAnswers = answerGroup.getAssessmentAnswers().size();
			
			for(int y = 0; y < assessmentAnswers; y++)
			{
				PatientAssessmentQuestionVo answer = answerGroup.getAssessmentAnswers().get(y);
				
				if(answer != null && answer.getPatientAnswers() != null && answer.getIsAnswered() != null && answer.getIsAnswered().equals(AnswerStatus.ANSWERED))
				{
					int patientAnswers = answer.getPatientAnswers().size();
					
					for(int z = 0; z < patientAnswers; z++)
					{
						PatientAssessmentAnswerVo patientAnswer = answer.getPatientAnswers().get(z);
						
						if(patientAnswer != null)
						{
							populateHCPDataForPatientAnswer(initialData, patientAnswer, author);
						}
					}
				}
			}
		}
	}
}
 
Example 17
Project: openmaxims-linux   File: Logic.java   View Source Code Vote up 5 votes
private ArrayList<String> validateAnswer(PatientAssessmentQuestionVo assessmentQuestion, ArrayList<String> errors)
{
	if (errors == null)
		errors = new ArrayList<String>();
	if (assessmentQuestion == null || assessmentQuestion.getAssessmentQuestion() == null || assessmentQuestion.getPatientAnswers() == null)
		return errors;

	QuestionInformationVo question = assessmentQuestion.getAssessmentQuestion().getQuestion();
	PatientAssessmentAnswerVoCollection patientAnswers = assessmentQuestion.getPatientAnswers();
	Boolean isMandatory = assessmentQuestion.getIsMandatory();

	validateAllAnswers(errors, question, patientAnswers, isMandatory);

	return errors;
}
 
Example 18
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
private boolean setQuestionRowAnswer(DynamicGridRow groupRow, PatientAssessmentQuestionVo assessmentQuestion, PatientAssessmentGroupVo group)
{
	if (assessmentQuestion == null || assessmentQuestion.getPatientAnswers() == null)
		return false;

	DynamicGridRow initialQuestionRow = null;
	DynamicGridRow questionRow = findRow(groupRow, assessmentQuestion.getAssessmentQuestion());
	if (questionRow == null)
		return false;

	if (isDPP)
	{
		DynamicGridColumn pocColumn = this.grid.getColumns().getByIdentifier(POC_COLUMN);
		if (pocColumn != null)
		{
			DynamicGridCell pocCell = questionRow.getCells().get(pocColumn);
			if (pocCell != null)
			{
				Boolean pocChecked = assessmentQuestion != null ? assessmentQuestion.getIsPoc() : Boolean.FALSE;
				// Set readonly the cell when we have a saved POC value
				// against a Question
				if (pocChecked != null && pocChecked.booleanValue() && assessmentQuestion.getID_PatientAssessmentQuestionIsNotNull())
					pocCell.setReadOnly(true);
				pocCell.setValue(pocChecked);
			}
		}
	}

	for (int i = 0; i < assessmentQuestion.getPatientAnswers().size(); i++)
	{
		PatientAssessmentAnswerVo answerDetail = assessmentQuestion.getPatientAnswers().get(i);

		if (answerDetail != null)
		{
			if (i > 0)
			{
				if (initialQuestionRow == null)
					initialQuestionRow = questionRow;

				questionRow = duplicateQuestionRow(initialQuestionRow);
			}

			for (int x = 0; x < answerDetail.getAnswerDetails().size(); x++)
			{
				AnswerDetailsVo answer = answerDetail.getAnswerDetails().get(x);
				DynamicGridCell cell = findCell(questionRow, answer.getAnswerType());

				if (cell != null)
				{
					if (x == 0)
						cell.getRow().setValue(answerDetail);
					setCellAnswer(cell, answer);
				}
			}
		}
	}

	return true;
}
 
Example 19
Project: AvoinApotti   File: DynamicAssessmentHelper.java   View Source Code Vote up 4 votes
private static PatientAssessmentAnswerVo findAnswer(PatientAssessmentVo initialData, Integer id) 
{
	if(initialData == null || 
			initialData.getAssessmentData() == null ||
			initialData.getAssessmentData().getAnswerGroups() == null ||
			id == null)
		return null;
	
	int answerGroups = initialData.getAssessmentData().getAnswerGroups().size();
	
	for(int x = 0; x < answerGroups; x++)
	{
		PatientAssessmentGroupVo answerGroup = initialData.getAssessmentData().getAnswerGroups().get(x);
		if(answerGroup != null)
		{
			if(answerGroup.getAssessmentAnswers() != null)
			{
				int assessmentAnswers = answerGroup.getAssessmentAnswers().size();
				
				for(int y = 0; y < assessmentAnswers; y++)
				{
					PatientAssessmentQuestionVo assessmentAnswer = answerGroup.getAssessmentAnswers().get(y);
					
					if(assessmentAnswer != null && assessmentAnswer.getPatientAnswers() != null)
					{
						int patientAnswers = assessmentAnswer.getPatientAnswers().size();
						for(int z = 0; z < patientAnswers; z++)
						{
							PatientAssessmentAnswerVo answer = assessmentAnswer.getPatientAnswers().get(z);
							if(answer != null && 
									answer.getID_PatientAssessmentAnswer() != null &&
									answer.getID_PatientAssessmentAnswer().intValue() == id.intValue())
							{
								return answer;
							}
						}
					}
				}
			}
		}
	}
	
	return null;
}
 
Example 20
Project: AvoinApotti   File: UserAssessmentInstHelper.java   View Source Code Vote up 4 votes
private PatientAssessmentGroupVoCollection calculateScores(PatientAssessmentGroupVoCollection groups)
{
	if(groups == null)
		return null;
			
	for(int x = 0; x < groups.size(); x++)
	{
		Float groupScore = new Float(0);
		PatientAssessmentGroupVo group = groups.get(x);
			
		if(group != null && group.getAssessmentAnswersIsNotNull())
		{
			for(int y = 0; y < group.getAssessmentAnswers().size(); y++)
			{
				PatientAssessmentQuestionVo assessmentQuestion = group.getAssessmentAnswers().get(y);
				
				if(assessmentQuestion.getPatientAnswers() != null)
				{
					for(int i = 0; i < assessmentQuestion.getPatientAnswers().size(); i++)
					{						
						PatientAssessmentAnswerVo answerDetail = assessmentQuestion.getPatientAnswers().get(i);
					
						if(assessmentQuestion != null && assessmentQuestion.getAssessmentQuestionIsNotNull() && answerDetail.getAnswerDetailsIsNotNull())
						{
							AssessmentQuestionVo question = assessmentQuestion.getAssessmentQuestion();
							if(question.getScoringAnswerTypeIsNotNull())
							{
								for(int z = 0; z < answerDetail.getAnswerDetails().size(); z++)
								{								
									AnswerDetailsVo answerDetails = answerDetail.getAnswerDetails().get(z);
									if(answerDetails != null && answerDetails.getAnswerTypeIsNotNull())
									{									
										if(answerDetails.getAnswerType().equals(question.getScoringAnswerType()))
										{
											if(answerDetails.getPicklist() != null && answerDetails.getAnswerType().getOptionsIsNotNull())
											{
												for(int o = 0; o < answerDetails.getAnswerType().getOptions().size(); o++)
												{
													if(answerDetails.getPicklist().equals(answerDetails.getAnswerType().getOptions().get(o)))
													{
														if(answerDetails.getAnswerType().getOptions().get(o).getScoreIsNotNull())
														{
															groupScore += answerDetails.getAnswerType().getOptions().get(o).getScore();
															break;
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			
			//WDEV-3916
			group.setCurrentScore(new Float(groupScore));			
			groups.set(x, group);
		}
	}
	
	return groups;
}
 
Example 21
Project: AvoinApotti   File: Logic.java   View Source Code Vote up 4 votes
/**
 *	Function used to create a clone without ID for a PatientAssessment record marked as source 
 */
private PatientAssessmentVo createCopyAssessment(PatientAssessmentVo assessmentSource)
{
	if (assessmentSource == null)
		return null;
	
	PatientAssessmentVo assessmentCopy = (PatientAssessmentVo) assessmentSource.clone();
	assessmentCopy.clearIDAndVersion();
	
	assessmentCopy.setAuthoringInformation(null);
	assessmentCopy.setCompletedHCP(null);
	assessmentCopy.setCompletedDateTime(null);
	
	assessmentCopy.setStatus(null);
	
	if (assessmentCopy.getAssessmentData() != null)
	{
		assessmentCopy.getAssessmentData().clearIDAndVersion();
		
		if (assessmentCopy.getAssessmentData().getAnswerGroups() != null)
			for (PatientAssessmentGroupVo group : assessmentCopy.getAssessmentData().getAnswerGroups())
			{
				group.clearIDAndVersion();
				
				if (group.getAssessmentAnswers() != null)
					for (PatientAssessmentQuestionVo assessmentQuestion : group.getAssessmentAnswers())
					{
						assessmentQuestion.clearIDAndVersion();
						
						if (assessmentQuestion.getPatientAnswers() != null)
							for (PatientAssessmentAnswerVo patientAnswer : assessmentQuestion.getPatientAnswers())
							{
								patientAnswer.clearIDAndVersion();
								
								if (patientAnswer.getAnswerDetails() != null)
									for (AnswerDetailsVo answerDetails : patientAnswer.getAnswerDetails())
										answerDetails.clearIDAndVersion();
							}
					}
			}
	}
	
	return assessmentCopy;
}
 
Example 22
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
private boolean setQuestionRowAnswer(DynamicGridRow groupRow, PatientAssessmentQuestionVo assessmentQuestion, PatientAssessmentGroupVo group)
{
	if (assessmentQuestion == null || assessmentQuestion.getPatientAnswers() == null)
		return false;

	DynamicGridRow initialQuestionRow = null;
	DynamicGridRow questionRow = findRow(groupRow, assessmentQuestion.getAssessmentQuestion());
	if (questionRow == null)
		return false;

	if (isDPP)
	{
		DynamicGridColumn pocColumn = this.grid.getColumns().getByIdentifier(POC_COLUMN);
		if (pocColumn != null)
		{
			DynamicGridCell pocCell = questionRow.getCells().get(pocColumn);
			if (pocCell != null)
			{
				Boolean pocChecked = assessmentQuestion != null ? assessmentQuestion.getIsPoc() : Boolean.FALSE;
				// Set readonly the cell when we have a saved POC value
				// against a Question
				if (pocChecked != null && pocChecked.booleanValue() && assessmentQuestion.getID_PatientAssessmentQuestionIsNotNull())
					pocCell.setReadOnly(true);
				pocCell.setValue(pocChecked);
			}
		}
	}

	for (int i = 0; i < assessmentQuestion.getPatientAnswers().size(); i++)
	{
		PatientAssessmentAnswerVo answerDetail = assessmentQuestion.getPatientAnswers().get(i);

		if (answerDetail != null)
		{
			if (i > 0)
			{
				if (initialQuestionRow == null)
					initialQuestionRow = questionRow;

				questionRow = duplicateQuestionRow(initialQuestionRow);
			}

			for (int x = 0; x < answerDetail.getAnswerDetails().size(); x++)
			{
				AnswerDetailsVo answer = answerDetail.getAnswerDetails().get(x);
				DynamicGridCell cell = findCell(questionRow, answer.getAnswerType());

				if (cell != null)
				{
					if (x == 0)
						cell.getRow().setValue(answerDetail);
					setCellAnswer(cell, answer);
				}
			}
		}
	}

	return true;
}
 
Example 23
Project: openMAXIMS   File: DynamicAssessmentHelper.java   View Source Code Vote up 4 votes
private static PatientAssessmentAnswerVo findAnswer(PatientAssessmentVo initialData, Integer id) 
{
	if(initialData == null || 
			initialData.getAssessmentData() == null ||
			initialData.getAssessmentData().getAnswerGroups() == null ||
			id == null)
		return null;
	
	int answerGroups = initialData.getAssessmentData().getAnswerGroups().size();
	
	for(int x = 0; x < answerGroups; x++)
	{
		PatientAssessmentGroupVo answerGroup = initialData.getAssessmentData().getAnswerGroups().get(x);
		if(answerGroup != null)
		{
			if(answerGroup.getAssessmentAnswers() != null)
			{
				int assessmentAnswers = answerGroup.getAssessmentAnswers().size();
				
				for(int y = 0; y < assessmentAnswers; y++)
				{
					PatientAssessmentQuestionVo assessmentAnswer = answerGroup.getAssessmentAnswers().get(y);
					
					if(assessmentAnswer != null && assessmentAnswer.getPatientAnswers() != null)
					{
						int patientAnswers = assessmentAnswer.getPatientAnswers().size();
						for(int z = 0; z < patientAnswers; z++)
						{
							PatientAssessmentAnswerVo answer = assessmentAnswer.getPatientAnswers().get(z);
							if(answer != null && 
									answer.getID_PatientAssessmentAnswer() != null &&
									answer.getID_PatientAssessmentAnswer().intValue() == id.intValue())
							{
								return answer;
							}
						}
					}
				}
			}
		}
	}
	
	return null;
}
 
Example 24
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View Source Code Vote up 4 votes
private PatientAssessmentGroupVoCollection calculateScores(PatientAssessmentGroupVoCollection groups)
{
	if(groups == null)
		return null;
			
	for(int x = 0; x < groups.size(); x++)
	{
		Float groupScore = new Float(0);
		PatientAssessmentGroupVo group = groups.get(x);
			
		if(group != null && group.getAssessmentAnswersIsNotNull())
		{
			for(int y = 0; y < group.getAssessmentAnswers().size(); y++)
			{
				PatientAssessmentQuestionVo assessmentQuestion = group.getAssessmentAnswers().get(y);
				
				if(assessmentQuestion.getPatientAnswers() != null)
				{
					for(int i = 0; i < assessmentQuestion.getPatientAnswers().size(); i++)
					{						
						PatientAssessmentAnswerVo answerDetail = assessmentQuestion.getPatientAnswers().get(i);
					
						if(assessmentQuestion != null && assessmentQuestion.getAssessmentQuestionIsNotNull() && answerDetail.getAnswerDetailsIsNotNull())
						{
							AssessmentQuestionVo question = assessmentQuestion.getAssessmentQuestion();
							if(question.getScoringAnswerTypeIsNotNull())
							{
								for(int z = 0; z < answerDetail.getAnswerDetails().size(); z++)
								{								
									AnswerDetailsVo answerDetails = answerDetail.getAnswerDetails().get(z);
									if(answerDetails != null && answerDetails.getAnswerTypeIsNotNull())
									{									
										if(answerDetails.getAnswerType().equals(question.getScoringAnswerType()))
										{
											if(answerDetails.getPicklist() != null && answerDetails.getAnswerType().getOptionsIsNotNull())
											{
												for(int o = 0; o < answerDetails.getAnswerType().getOptions().size(); o++)
												{
													if(answerDetails.getPicklist().equals(answerDetails.getAnswerType().getOptions().get(o)))
													{
														if(answerDetails.getAnswerType().getOptions().get(o).getScoreIsNotNull())
														{
															groupScore += answerDetails.getAnswerType().getOptions().get(o).getScore();
															break;
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			
			//WDEV-3916
			group.setCurrentScore(new Float(groupScore));			
			groups.set(x, group);
		}
	}
	
	return groups;
}
 
Example 25
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
/**
 *	Function used to create a clone without ID for a PatientAssessment record marked as source 
 */
private PatientAssessmentVo createCopyAssessment(PatientAssessmentVo assessmentSource)
{
	if (assessmentSource == null)
		return null;
	
	PatientAssessmentVo assessmentCopy = (PatientAssessmentVo) assessmentSource.clone();
	assessmentCopy.clearIDAndVersion();
	
	assessmentCopy.setAuthoringInformation(null);
	assessmentCopy.setCompletedHCP(null);
	assessmentCopy.setCompletedDateTime(null);
	
	assessmentCopy.setStatus(null);
	
	if (assessmentCopy.getAssessmentData() != null)
	{
		assessmentCopy.getAssessmentData().clearIDAndVersion();
		
		if (assessmentCopy.getAssessmentData().getAnswerGroups() != null)
			for (PatientAssessmentGroupVo group : assessmentCopy.getAssessmentData().getAnswerGroups())
			{
				group.clearIDAndVersion();
				
				if (group.getAssessmentAnswers() != null)
					for (PatientAssessmentQuestionVo assessmentQuestion : group.getAssessmentAnswers())
					{
						assessmentQuestion.clearIDAndVersion();
						
						if (assessmentQuestion.getPatientAnswers() != null)
							for (PatientAssessmentAnswerVo patientAnswer : assessmentQuestion.getPatientAnswers())
							{
								patientAnswer.clearIDAndVersion();
								
								if (patientAnswer.getAnswerDetails() != null)
									for (AnswerDetailsVo answerDetails : patientAnswer.getAnswerDetails())
										answerDetails.clearIDAndVersion();
							}
					}
			}
	}
	
	return assessmentCopy;
}
 
Example 26
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
private boolean setQuestionRowAnswer(DynamicGridRow groupRow, PatientAssessmentQuestionVo assessmentQuestion, PatientAssessmentGroupVo group)
{
	if (assessmentQuestion == null || assessmentQuestion.getPatientAnswers() == null)
		return false;

	DynamicGridRow initialQuestionRow = null;
	DynamicGridRow questionRow = findRow(groupRow, assessmentQuestion.getAssessmentQuestion());
	if (questionRow == null)
		return false;

	if (isDPP)
	{
		DynamicGridColumn pocColumn = this.grid.getColumns().getByIdentifier(POC_COLUMN);
		if (pocColumn != null)
		{
			DynamicGridCell pocCell = questionRow.getCells().get(pocColumn);
			if (pocCell != null)
			{
				Boolean pocChecked = assessmentQuestion != null ? assessmentQuestion.getIsPoc() : Boolean.FALSE;
				// Set readonly the cell when we have a saved POC value
				// against a Question
				if (pocChecked != null && pocChecked.booleanValue() && assessmentQuestion.getID_PatientAssessmentQuestionIsNotNull())
					pocCell.setReadOnly(true);
				pocCell.setValue(pocChecked);
			}
		}
	}

	for (int i = 0; i < assessmentQuestion.getPatientAnswers().size(); i++)
	{
		PatientAssessmentAnswerVo answerDetail = assessmentQuestion.getPatientAnswers().get(i);

		if (answerDetail != null)
		{
			if (i > 0)
			{
				if (initialQuestionRow == null)
					initialQuestionRow = questionRow;

				questionRow = duplicateQuestionRow(initialQuestionRow);
			}

			for (int x = 0; x < answerDetail.getAnswerDetails().size(); x++)
			{
				AnswerDetailsVo answer = answerDetail.getAnswerDetails().get(x);
				DynamicGridCell cell = findCell(questionRow, answer.getAnswerType());

				if (cell != null)
				{
					if (x == 0)
						cell.getRow().setValue(answerDetail);
					setCellAnswer(cell, answer);
				}
			}
		}
	}

	return true;
}
 
Example 27
Project: openMAXIMS   File: DynamicAssessmentHelper.java   View Source Code Vote up 4 votes
private static PatientAssessmentAnswerVo findAnswer(PatientAssessmentVo initialData, Integer id) 
{
	if(initialData == null || 
			initialData.getAssessmentData() == null ||
			initialData.getAssessmentData().getAnswerGroups() == null ||
			id == null)
		return null;
	
	int answerGroups = initialData.getAssessmentData().getAnswerGroups().size();
	
	for(int x = 0; x < answerGroups; x++)
	{
		PatientAssessmentGroupVo answerGroup = initialData.getAssessmentData().getAnswerGroups().get(x);
		if(answerGroup != null)
		{
			if(answerGroup.getAssessmentAnswers() != null)
			{
				int assessmentAnswers = answerGroup.getAssessmentAnswers().size();
				
				for(int y = 0; y < assessmentAnswers; y++)
				{
					PatientAssessmentQuestionVo assessmentAnswer = answerGroup.getAssessmentAnswers().get(y);
					
					if(assessmentAnswer != null && assessmentAnswer.getPatientAnswers() != null)
					{
						int patientAnswers = assessmentAnswer.getPatientAnswers().size();
						for(int z = 0; z < patientAnswers; z++)
						{
							PatientAssessmentAnswerVo answer = assessmentAnswer.getPatientAnswers().get(z);
							if(answer != null && 
									answer.getID_PatientAssessmentAnswer() != null &&
									answer.getID_PatientAssessmentAnswer().intValue() == id.intValue())
							{
								return answer;
							}
						}
					}
				}
			}
		}
	}
	
	return null;
}
 
Example 28
Project: openMAXIMS   File: UserAssessmentInstHelper.java   View Source Code Vote up 4 votes
private PatientAssessmentGroupVoCollection calculateScores(PatientAssessmentGroupVoCollection groups)
{
	if(groups == null)
		return null;
			
	for(int x = 0; x < groups.size(); x++)
	{
		Float groupScore = new Float(0);
		PatientAssessmentGroupVo group = groups.get(x);
			
		if(group != null && group.getAssessmentAnswersIsNotNull())
		{
			for(int y = 0; y < group.getAssessmentAnswers().size(); y++)
			{
				PatientAssessmentQuestionVo assessmentQuestion = group.getAssessmentAnswers().get(y);
				
				if(assessmentQuestion.getPatientAnswers() != null)
				{
					for(int i = 0; i < assessmentQuestion.getPatientAnswers().size(); i++)
					{						
						PatientAssessmentAnswerVo answerDetail = assessmentQuestion.getPatientAnswers().get(i);
					
						if(assessmentQuestion != null && assessmentQuestion.getAssessmentQuestionIsNotNull() && answerDetail.getAnswerDetailsIsNotNull())
						{
							AssessmentQuestionVo question = assessmentQuestion.getAssessmentQuestion();
							if(question.getScoringAnswerTypeIsNotNull())
							{
								for(int z = 0; z < answerDetail.getAnswerDetails().size(); z++)
								{								
									AnswerDetailsVo answerDetails = answerDetail.getAnswerDetails().get(z);
									if(answerDetails != null && answerDetails.getAnswerTypeIsNotNull())
									{									
										if(answerDetails.getAnswerType().equals(question.getScoringAnswerType()))
										{
											if(answerDetails.getPicklist() != null && answerDetails.getAnswerType().getOptionsIsNotNull())
											{
												for(int o = 0; o < answerDetails.getAnswerType().getOptions().size(); o++)
												{
													if(answerDetails.getPicklist().equals(answerDetails.getAnswerType().getOptions().get(o)))
													{
														if(answerDetails.getAnswerType().getOptions().get(o).getScoreIsNotNull())
														{
															groupScore += answerDetails.getAnswerType().getOptions().get(o).getScore();
															break;
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			
			//WDEV-3916
			group.setCurrentScore(new Float(groupScore));			
			groups.set(x, group);
		}
	}
	
	return groups;
}
 
Example 29
Project: openMAXIMS   File: Logic.java   View Source Code Vote up 4 votes
/**
 *	Function used to create a clone without ID for a PatientAssessment record marked as source 
 */
private PatientAssessmentVo createCopyAssessment(PatientAssessmentVo assessmentSource)
{
	if (assessmentSource == null)
		return null;
	
	PatientAssessmentVo assessmentCopy = (PatientAssessmentVo) assessmentSource.clone();
	assessmentCopy.clearIDAndVersion();
	
	assessmentCopy.setAuthoringInformation(null);
	assessmentCopy.setCompletedHCP(null);
	assessmentCopy.setCompletedDateTime(null);
	
	assessmentCopy.setStatus(null);
	
	if (assessmentCopy.getAssessmentData() != null)
	{
		assessmentCopy.getAssessmentData().clearIDAndVersion();
		
		if (assessmentCopy.getAssessmentData().getAnswerGroups() != null)
			for (PatientAssessmentGroupVo group : assessmentCopy.getAssessmentData().getAnswerGroups())
			{
				group.clearIDAndVersion();
				
				if (group.getAssessmentAnswers() != null)
					for (PatientAssessmentQuestionVo assessmentQuestion : group.getAssessmentAnswers())
					{
						assessmentQuestion.clearIDAndVersion();
						
						if (assessmentQuestion.getPatientAnswers() != null)
							for (PatientAssessmentAnswerVo patientAnswer : assessmentQuestion.getPatientAnswers())
							{
								patientAnswer.clearIDAndVersion();
								
								if (patientAnswer.getAnswerDetails() != null)
									for (AnswerDetailsVo answerDetails : patientAnswer.getAnswerDetails())
										answerDetails.clearIDAndVersion();
							}
					}
			}
	}
	
	return assessmentCopy;
}