protected void onCmbSourceOfReferralValueChanged() throws PresentationLogicException { form.txtReferralGP().setValue(null); form.txtOther().setValue(null); if (!ReferredBy.GP.equals(form.cmbSourceOfReferral().getValue())) { form.txtReferralGP().setValue(null); form.imbReferralGP().setTooltip("Find and Select GP");//WDEV-17297 } if (!ReferredBy.OTHER.equals(form.cmbSourceOfReferral().getValue())) { form.txtOther().setValue(null); form.imbReferralGP().setTooltip("Find and Select GP");//WDEV-17297 } if (ReferredBy.GP.equals(form.cmbSourceOfReferral().getValue()) && form.txtReferralGP().getValue() == null) { GpShortVo gpShortVo = domain.getGpPatient(form.getGlobalContext().Core.getPatientShort()); form.getLocalContext().setSelectedGp(gpShortVo); if (gpShortVo != null) { form.txtReferralGP().setValue(gpShortVo.getNameIsNotNull() ? gpShortVo.getName().toString() : ""); form.imbReferralGP().setTooltip(getReferalGpTooltip(gpShortVo)); } } updateControlState(); }
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; }