public InpatientEpisodeForVTERiskAsessmentVo getInpatientEpisodes( PASEventRefVo pasRefVo) { if(pasRefVo == null ) throw new CodingRuntimeException("Pas Event not provided"); DomainFactory factory = getDomainFactory(); List inpat = factory.find("select i1_1 from InpatientEpisode as i1_1 left join i1_1.pasEvent as p1_1 where p1_1.id =:idPasEvent", new String[] {"idPasEvent"}, new Object[] {pasRefVo.getID_PASEvent()}); if( inpat != null && inpat.size() > 0) { InpatientEpisodeForVTERiskAsessmentVoCollection tempColl = InpatientEpisodeForVTERiskAsessmentVoAssembler.createInpatientEpisodeForVTERiskAsessmentVoCollectionFromInpatientEpisode(inpat).sort(SortOrder.DESCENDING); if(tempColl != null && tempColl.size() > 0) return tempColl.get(0); } return null; }