private void populateScreenFromData(EmergencyAttendanceForPendingArrivalsVoCollection coll) { if (coll == null) return; for (int i = 0; i < coll.size(); i++) { addRow(coll.get(i)); } }
private void doSearch() { form.grdResults().getRows().clear(); form.grdResults().setValue(null); form.getLocalContext().setselectedRecord(null); updateControlsState(); //latest changes 07/05/2012 LocationLiteVo currentLocation = null; if (domain.getCurrentLocation() instanceof LocationLiteVo ) { currentLocation = (LocationLiteVo) domain.getCurrentLocation(); } else if (domain.getCurrentLocation() instanceof LocSiteLiteVo) { LocSiteLiteVo locsite = (LocSiteLiteVo) domain.getCurrentLocation(); if (locsite!=null) { currentLocation = new LocationLiteVo(locsite.getID_Location(), locsite.getVersion_Location()); } } EmergencyAttendanceForPendingArrivalsVoCollection coll = domain.listPendingArrivals(currentLocation, form.txtSurname().getValue(), form.txtForename().getValue(), form.cmbSourceOfReferral().getValue()); form.getGlobalContext().Emergency.setPendingArrivalsSearchCriteria(getSearchCriteria());//WDEV-19389 if (coll == null || coll.size() == 0) { engine.showMessage("There are no Records for the Search Criteria Provided"); return; } populateScreenFromData(coll); }
private void doSearch() { form.grdResults().getRows().clear(); form.grdResults().setValue(null); form.getLocalContext().setselectedRecord(null); updateControlsState(); //latest changes 07/05/2012 LocationLiteVo currentLocation = null; if (domain.getCurrentLocation() instanceof LocationLiteVo ) { currentLocation = (LocationLiteVo) domain.getCurrentLocation(); } else if (domain.getCurrentLocation() instanceof LocSiteLiteVo) { LocSiteLiteVo locsite = (LocSiteLiteVo) domain.getCurrentLocation(); if (locsite!=null) { currentLocation = new LocationLiteVo(locsite.getID_Location(), locsite.getVersion_Location()); } } EmergencyAttendanceForPendingArrivalsVoCollection coll = domain.listPendingArrivals(currentLocation, form.txtSurname().getValue(), form.txtForename().getValue(), form.cmbSourceOfReferral().getValue()); if (coll == null || coll.size() == 0) { engine.showMessage("There are no Records for the Search Criteria Provided"); return; } populateScreenFromData(coll); }
public EmergencyAttendanceForPendingArrivalsVoCollection listPendingArrivals(LocationRefVo location, String surnameSearchText, String forenameSearchText, ReferredBy sourceOfReferral) { if (location == null || location.getID_Location() == null) { throw new CodingRuntimeException("Cannot get EmergencyAttendanceForPendingArrivalsVoCollection on null Id for Location "); } String hql = "select emergAtt from EmergencyAttendance as emergAtt left join emergAtt.emergencyEpisode as emergEpisode left join emergAtt.patient as patient where emergAtt.dischargeDateTime is null and emergAtt.expectedArrivalDateTime is not null "; StringBuilder hqlConditions = new StringBuilder(" "); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String andStr = "and"; hqlConditions.append(andStr); hqlConditions.append(" emergAtt.registrationLocation.id = :locID "); markers.add("locID"); values.add(location.getID_Location()); andStr = " and "; hqlConditions.append(andStr); hqlConditions.append(" emergAtt.isExpectedArrival = :isExpectedArrival "); markers.add("isExpectedArrival"); values.add(Boolean.TRUE); andStr = " and "; if (surnameSearchText != null) { hqlConditions.append(andStr); hqlConditions.append(" patient.name.upperSurname like :surname "); markers.add("surname"); values.add(surnameSearchText.toUpperCase() + "%"); andStr = " and "; } if (forenameSearchText != null) { hqlConditions.append(andStr); hqlConditions.append(" patient.name.upperForename like :forename "); markers.add("forename"); values.add(forenameSearchText.toUpperCase() + "%"); andStr = " and "; } if (sourceOfReferral != null) { hqlConditions.append(andStr); hqlConditions.append(" emergEpisode.sourceOfReferral.id = :source "); markers.add("source"); values.add(sourceOfReferral.getID()); andStr = " and "; } hqlConditions.append(" ) order by emergAtt.arrivalDateTime asc "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find((hql + hqlConditions.toString()).toString(), markers, values); EmergencyAttendanceForPendingArrivalsVoCollection collection = EmergencyAttendanceForPendingArrivalsVoAssembler.createEmergencyAttendanceForPendingArrivalsVoCollectionFromEmergencyAttendance(list); return collection; }