import ims.framework.utils.Date; //導入方法依賴的package包/類
public PatientAssessmentListVoCollection listPatientAssessments(CareContextRefVo careContextRefVo, UserDefinedAssessmentType assessmentType, Date dteDateFrom, Date dteDateTo)
{
if(careContextRefVo == null || careContextRefVo.getID_CareContext() == null)
throw new RuntimeException("Cannot list PatientAssessments for null CareContextRefVo");
DomainFactory factory = getDomainFactory();
StringBuffer hql = new StringBuffer(" from PatientAssessment pa where pa.careContext.id =:RefId");
ArrayList values = new ArrayList();
ArrayList params = new ArrayList();
values.add(careContextRefVo.getID_CareContext());
params.add("RefId");
if(assessmentType != null)
{
hql.append(" and ");
hql.append("pa.assessmentData.userAssessment.assessmentType =:assType");
values.add(getDomLookup(assessmentType));
params.add("assType");
}
if(dteDateFrom != null)
{
hql.append(" and ");
hql.append(" pa.authoringInformation.authoringDateTime >= :dateFrom ");
params.add("dateFrom");
values.add(dteDateFrom.getDate());
}
if(dteDateTo != null)
{
hql.append(" and ");
hql.append(" pa.authoringInformation.authoringDateTime <= :dateTo ");
params.add("dateTo");
Date d = (Date)dteDateTo.clone();
values.add(d.addDay(1).getDate());
}
hql.append(" order by pa.authoringInformation.authoringDateTime desc");
List list = factory.find(hql.toString(), params, values);
return PatientAssessmentListVoAssembler.createPatientAssessmentListVoCollectionFromPatientAssessment(list).sort();
}