public PatientShortListVo getPatientByCareContext(CareContextRefVo careContext) { if(careContext == null || careContext.getID_CareContext() == null) { throw new CodingRuntimeException("CareContextRefVo is null"); } if(careContext.getID_CareContext() == null) { throw new CodingRuntimeException("CareContextRefVo id is null"); } DomainFactory factory = getDomainFactory(); List domainObjectList = factory.find("select p from CareContext as cc left join cc.episodeOfCare as eoc left join eoc.careSpell as cs left join cs.patient as p where (cc.id = :idCareContext)", new String[]{"idCareContext"}, new Object[]{careContext.getID_CareContext()}); PatientShortListVoCollection patient = PatientShortListVoAssembler.createPatientShortListVoCollectionFromPatient(domainObjectList); return patient != null && patient.size() > 0 ? (patient.get(0) != null ? patient.get(0) : null) : null; }