/** * WDEV-13677 * Function used to retrieve the latest MRSA positive result record (Non RIE) */ public MRSASitesResultsVo getLastMrsaPosResult(Integer idPatient) { // If the patient ID is null then return null if (idPatient == null) return null; // Parameters array ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); // Query syntax String query = "select siteRes from MRSAAssessment mrsa left join mrsa.sitesAndResults as siteRes where mrsa.careContext.episodeOfCare.careSpell.patient.id = :PATID and mrsa.isRIE is null and siteRes.result.id = :RES order by siteRes.dateResult desc"; //wdev-14307 // Parameters values paramNames.add("PATID"); paramValues.add(idPatient); paramNames.add("RES"); paramValues.add(MRSAResult.POSITIVE.getID()); //wdev-14307 // Execute query and return the results return MRSASitesResultsVoAssembler.create((MRSASitesResults) getDomainFactory().findFirst(query, paramNames, paramValues)); }