public ims.clinical.vo.TTAMedicationAndPharmacyForTTAHistoryVoCollection listTTAforPatient(ims.core.patient.vo.PatientRefVo patient,TTAMedicationAndPharmacyRefVo exlude) { String hql = "select ttamp from TTAMedicationAndPharmacy as ttamp left join ttamp.patient as pat where (pat.id=:patId "; ArrayList<String> paramName = new ArrayList<String>(); paramName.add("patId"); ArrayList<Object> paramValues = new ArrayList<Object>(); paramValues.add(patient.getID_Patient()); if (exlude!=null) { hql+=" and ttamp.id <> :exludeId"; paramName.add("exludeId"); paramValues.add(exlude.getID_TTAMedicationAndPharmacy()); } hql+=") order by ttamp.systemInformation.creationDateTime asc"; List<?> dos = getDomainFactory().find(hql,paramName,paramValues); if (dos == null || dos.size() == 0) return null; return TTAMedicationAndPharmacyForTTAHistoryVoAssembler.createTTAMedicationAndPharmacyForTTAHistoryVoCollectionFromTTAMedicationAndPharmacy(dos); }