public DementiaForWorklistVo getDementia(PatientRefVo patRef) { if( patRef == null ) return null; DomainFactory factory = getDomainFactory(); List lst = factory.find("select d1_1 from Dementia as d1_1 left join d1_1.patient as p1_1 where (p1_1.id = :patId and d1_1.isRIE is null ) order by d1_1.systemInformation.creationDateTime desc", new String[] {"patId"}, new Object[] {patRef.getID_Patient()}); if( lst != null && lst.size() > 0) { DementiaForWorklistVoCollection tempColl = DementiaForWorklistVoAssembler.createDementiaForWorklistVoCollectionFromDementia(lst); if( tempColl != null && tempColl.size() > 0) return tempColl.get(0); } return null; }