@SuppressWarnings("unchecked") public PatientProcedureWebServiceListVoCollection getPatientProceduresForCurrentEpisodeOfCare(Integer patientId) { if(patientId == null) throw new CodingRuntimeException("Invalid patient Id."); EpisodeOfCareRefVo currentEpisodeOfCare = getCurrentEpisodeOfCare(patientId); if(currentEpisodeOfCare == null || !currentEpisodeOfCare.getID_EpisodeOfCareIsNotNull()) return new PatientProcedureWebServiceListVoCollection(); DomainFactory factory = getDomainFactory(); String query = "select pp from PatientProcedure as pp left join pp.careContext as cc left join cc.episodeOfCare as eps where eps.id = :epsId order by pp.id desc"; List patProcList = factory.find(query, new String[] {"epsId"}, new Object[] {currentEpisodeOfCare.getID_EpisodeOfCare()}); return PatientProcedureWebServiceListVoAssembler.createPatientProcedureWebServiceListVoCollectionFromPatientProcedure(patProcList); }