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