/** * listResults * * @return */ public ClinicalResultListVoCollection listResults(ims.framework.utils.DateTime dateFrom, ims.framework.utils.DateTime dateTo, ims.core.clinical.vo.ServiceRefVo department, ims.ocrr.configuration.vo.InvestigationIndexRefVo exam, ims.core.resource.people.vo.HcpRefVo clinician, Boolean resultsOnly, ims.core.patient.vo.PatientRefVo patientId) { if (resultsOnly == null) throw new CodingRuntimeException("ResultsOnly parameter cannot be null !"); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); StringBuffer sb = new StringBuffer("from OrderInvestigation as o1_1 where "); sb.append(" o1_1.investigation.investigationIndex.category = :cat"); markers.add("cat"); values.add(getDomLookup(Category.CLINICAL)); if (dateFrom != null && dateTo != null) { sb.append(" and"); sb.append(" o1_1.displayDateTime between :fromdate and :todate"); markers.add("fromdate"); values.add(dateFrom.getJavaDate()); markers.add("todate"); values.add(dateTo.getJavaDate()); } if (department != null) { sb.append(" and o1_1.investigation.providerService.locationService.service.id = :DEPARTMENT"); markers.add("DEPARTMENT"); values.add(department.getID_Service()); } if (exam != null) { sb.append(" and o1_1.investigation.investigationIndex.id = :INV"); markers.add("INV"); values.add(exam.getID_InvestigationIndex()); } if (clinician != null) { sb.append(" and o1_1.orderDetails.responsibleClinician.id = :CLINICIAN"); markers.add("CLINICIAN"); values.add(clinician.getID_Hcp()); } if (resultsOnly != null && resultsOnly.booleanValue()) { sb.append(" and o1_1.resultDetails is not null"); } if (patientId != null) { sb.append(" and o1_1.orderDetails.patient.id = :PID"); markers.add("PID"); values.add(patientId.getID_Patient()); } sb.append(" order by o1_1.displayDateTime desc, o1_1.ordInvSeq asc, o1_1.systemInformation.creationDateTime, o1_1.systemInformation.creationUser"); List<?> results = getDomainFactory().find(sb.toString(), markers, values); ClinicalResultListVoCollection voCollResults = ClinicalResultListVoAssembler.createClinicalResultListVoCollectionFromOrderInvestigation(results); return voCollResults; }