public OutPatientListVoCollection listOutPatients(ClinicRefVo clinic, Date clinicDate) { DomainFactory factory = getDomainFactory(); String hql; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); hql = " from OutpatientAttendance op "; StringBuffer condStr = new StringBuffer(); String andStr = " and "; condStr.append(" op.isActive = :isActive"); markers.add("isActive"); values.add(Boolean.TRUE); if (clinic != null) { condStr.append(andStr + " op.clinic.id = :clinic"); markers.add("clinic"); values.add(clinic.getID_Clinic()); } if (clinicDate != null) { condStr.append(andStr + " op.appointmentDateTime >= :startdate"); condStr.append(andStr + " op.appointmentDateTime < :enddate"); markers.add("startdate"); markers.add("enddate"); values.add(clinicDate.getDate()); values.add(clinicDate.copy().addDay(1).getDate()); } hql += " where "; hql += condStr.toString(); List<?> ops = factory.find(hql, markers, values); return OutPatientListVoAssembler.createOutPatientListVoCollectionFromOutpatientAttendance(ops).sort(); }
public ims.core.vo.OutPatientListVoCollection listOutpatients(ims.core.resource.place.vo.ClinicRefVo voClinicRef, ims.core.resource.people.vo.MedicRefVo voConsultantRef, ims.core.vo.lookups.Specialty specialty, ims.framework.utils.Date clinicDate) { DomainFactory factory = getDomainFactory(); String hql; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); hql = " from OutpatientAttendance op "; StringBuffer condStr = new StringBuffer(); String andStr = " and "; condStr.append(" op.isActive = :isActive"); markers.add("isActive"); values.add(Boolean.TRUE); if (voClinicRef != null) { condStr.append(andStr + " op.clinic.id = :clinic"); markers.add("clinic"); values.add(voClinicRef.getID_Clinic()); } if (voConsultantRef != null) { condStr.append(andStr + " op.pasEvent.consultant.id = :cons"); markers.add("cons"); values.add(voConsultantRef.getID_Hcp()); } if (specialty != null) { condStr.append(andStr + " op.pasEvent.specialty = :spec"); markers.add("spec"); values.add(getDomLookup(specialty)); } if (clinicDate != null) { condStr.append(andStr + " op.appointmentDateTime >= :startdate"); condStr.append(andStr + " op.appointmentDateTime < :enddate"); markers.add("startdate"); markers.add("enddate"); values.add(clinicDate.getDate()); values.add(clinicDate.copy().addDay(1).getDate()); } hql += " where "; hql += condStr.toString(); List ops = factory.find(hql, markers, values); return OutPatientListVoAssembler.createOutPatientListVoCollectionFromOutpatientAttendance(ops).sort(); }