@SuppressWarnings("unchecked") public VitalSignsWebServiceVoCollection getPatientVitalSigns(Integer patientId, Integer lastNumberOfDays) { if(patientId == null) throw new CodingRuntimeException("Invalid patient Id."); if(lastNumberOfDays == null || (lastNumberOfDays != null && lastNumberOfDays < 0)) return null; DomainFactory factory = getDomainFactory(); String query = "select vs from VitalSigns as vs left join vs.careContext as cc left join cc.episodeOfCare as ec left join ec.careSpell as cs left join cs.patient as p where p.id = :patient and vs.vitalsTakenDateTime >= :lastDate order by vs.vitalsTakenDateTime"; List listOrder = factory.find(query, new String[] {"patient", "lastDate"}, new Object[] {patientId, (new DateTime()).addDays(-lastNumberOfDays).getJavaDate()}); return VitalSignsWebServiceVoAssembler.createVitalSignsWebServiceVoCollectionFromVitalSigns(listOrder); }