/** * list from OcsOrder where OrderAuthorisaton = AWAITING_AUTHORISATION */ public OcsOrderInvVoCollection listOrdersRequiringAuthorisation(Date dateFrom, Date dateTo, ClinicRefVo clinic, LocationRefVo location, HcpRefVo responsibleClinician) { DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList values = new ArrayList(); String hql = "from OcsOrderSession ocsOrder where ocsOrder.authorisationOrderStatus = :status "; markers.add("status"); values.add(getDomLookup(AuthorisationOrderStatus.AWAITING_AUTHORISATION)); StringBuffer condStr = new StringBuffer(); String andStr = " and "; if(dateFrom != null) { condStr.append(andStr + " ocsOrder.systemInformation.creationDateTime >= :dateFrom"); markers.add("dateFrom"); values.add(dateFrom.getDate()); } if(dateTo != null) { condStr.append(andStr + " ocsOrder.systemInformation.creationDateTime <= :dateTo"); markers.add("dateTo"); values.add(dateTo.addDay(1).getDate()); } if(clinic != null) { condStr.append(andStr + " ocsOrder.patientClinic.id = :clinicId"); markers.add("clinicId"); values.add(clinic.getID_Clinic()); } if(location != null) { condStr.append(andStr + " ocsOrder.patientLocation.id = :locationId"); markers.add("locationId"); values.add(location.getID_Location()); } if(responsibleClinician != null) { condStr.append(andStr + " ocsOrder.responsibleClinician.id = :hcpId"); markers.add("hcpId"); values.add(responsibleClinician.getID_Hcp()); } hql += condStr.toString(); return OcsOrderInvVoAssembler.createOcsOrderInvVoCollectionFromOcsOrderSession(factory.find(hql,markers,values)).sort();//WDEV-16232 }
/** * list from OcsOrder where OrderAuthorisaton = AWAITING_AUTHORISATION */ public OcsOrderInvVoCollection listOrdersRequiringAuthorisation(Date dateFrom, Date dateTo, ClinicRefVo clinic, LocationRefVo location, HcpRefVo responsibleClinician) { DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList values = new ArrayList(); String hql = "from OcsOrderSession ocsOrder where ocsOrder.authorisationOrderStatus = :status "; markers.add("status"); values.add(getDomLookup(AuthorisationOrderStatus.AWAITING_AUTHORISATION)); StringBuffer condStr = new StringBuffer(); String andStr = " and "; if(dateFrom != null) { condStr.append(andStr + " ocsOrder.systemInformation.creationDateTime >= :dateFrom"); markers.add("dateFrom"); values.add(dateFrom.getDate()); } if(dateTo != null) { condStr.append(andStr + " ocsOrder.systemInformation.creationDateTime <= :dateTo"); markers.add("dateTo"); Date toDate = (Date) dateTo.clone(); //WDEV-19389 values.add(toDate.addDay(1).getDate().clone()); } if(clinic != null) { condStr.append(andStr + " ocsOrder.patientClinic.id = :clinicId"); markers.add("clinicId"); values.add(clinic.getID_Clinic()); } if(location != null) { condStr.append(andStr + " ocsOrder.patientLocation.id = :locationId"); markers.add("locationId"); values.add(location.getID_Location()); } if(responsibleClinician != null) { condStr.append(andStr + " ocsOrder.responsibleClinician.id = :hcpId"); markers.add("hcpId"); values.add(responsibleClinician.getID_Hcp()); } hql += condStr.toString(); return OcsOrderInvVoAssembler.createOcsOrderInvVoCollectionFromOcsOrderSession(factory.find(hql,markers,values)).sort();//WDEV-16232 }