private void open() { form.setMode(FormMode.VIEW); form.grdList().getRows().clear(); CareContextShortVo currentCareContext = form.getGlobalContext().Core.getCurrentCareContext(); ReferralsRecordingShortVoCollection list = domain.list(currentCareContext); if(list != null) { for(int i = 0; i < list.size(); i++) { addRowRecord(list.get(i)); } } updateControlState(); }
private void search() { ReferralSearchCriteriaVo voFilter = new ReferralSearchCriteriaVo(); if ( (form.dteFrom().getValue() != null) && (form.dteTo().getValue() != null)) { if (form.dteFrom().getValue().isGreaterThan(form.dteTo().getValue())) { engine.showMessage("The From and To dates are not in chronological order. Please change."); return; } } if(form.cmbSpecialty().getValue() != null) voFilter.setSpecialtyFunctionCode(form.cmbSpecialty().getValue()); if(form.cmbDiscipline().getValue() != null) voFilter.setDiscipline(form.cmbDiscipline().getValue()); if(form.cmbStatus().getValue() != null) voFilter.setReferralStatus(form.cmbStatus().getValue()); if(form.cmbSourceOfReferral().getValue() != null) voFilter.setReferralSource(form.cmbSourceOfReferral().getValue()); if(form.customControlMos().getValue() != null) voFilter.setReferralHCP(form.customControlMos().getValue() instanceof HcpLiteVo ? ((HcpLiteVo)form.customControlMos().getValue()).getMos() : null); if(form.dteFrom().getValue() != null) voFilter.setFromDate(form.dteFrom().getValue()); if(form.dteTo().getValue() != null) voFilter.setToDate(form.dteTo().getValue()); voFilter.setPatient(form.getGlobalContext().Core.getPatientShort()); ReferralsRecordingShortVoCollection voColl = domain.listReferralsForPatient(voFilter); form.grdDetails().getRows().clear(); form.getContextMenus().getGenericGridAddItem().setVisible(true); form.getContextMenus().getGenericGridUpdateItem().setVisible(false); form.getContextMenus().getGenericGridViewItem().setVisible(false); if (voColl == null) { engine.showMessage("No Referrals found."); return; } for(int i = 0 ; i < voColl.size() ; i++) addRow(form.grdDetails().getRows().newRow(), voColl.get(i)); }
/** * List Referrals */ public ReferralsRecordingShortVoCollection listReferralsForPatient(ReferralSearchCriteriaVo referralCriteria) { if(referralCriteria == null) throw new RuntimeException("Cannot get ReferralsRecordingVo for null referralCriteria"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from ReferralsRecording rr "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; hql.append(andStr + " rr.careContext.episodeOfCare.careSpell.patient.id = :patient"); markers.add("patient"); values.add(referralCriteria.getPatient().getID_Patient()); andStr = " and "; if(referralCriteria.getSpecialtyFunctionCode() != null) { hql.append(andStr + " rr.specialtyFunctionCode = :specialtyFunctionCode"); markers.add("specialtyFunctionCode"); values.add(getDomLookup(referralCriteria.getSpecialtyFunctionCode())); andStr = " and "; } if(referralCriteria.getDisciplineIsNotNull()) { hql.append(andStr + " rr.discipline = :discipline"); markers.add("discipline"); values.add(getDomLookup(referralCriteria.getDiscipline())); andStr = " and "; } if(referralCriteria.getReferralStatus() != null) { hql.append(andStr + " rr.referralStatus = :rStat"); markers.add("rStat"); values.add(getDomLookup(referralCriteria.getReferralStatus())); andStr = " and "; } if(referralCriteria.getReferralSource() != null) { hql.append(andStr + " rr.referralSource = :rS"); markers.add("rS"); values.add(getDomLookup(referralCriteria.getReferralSource())); andStr = " and "; } if(referralCriteria.getReferralHCP() != null) { hql.append(andStr + " rr.referralHCP.id = :rHCP"); markers.add("rHCP"); values.add(referralCriteria.getReferralHCP().getID_MemberOfStaff()); andStr = " and "; } if(referralCriteria.getFromDateIsNotNull()) { hql.append(andStr + " rr.dateSent >= :dateReceivedFrom"); markers.add("dateReceivedFrom"); values.add(referralCriteria.getFromDate().getDate()); andStr = " and "; } if(referralCriteria.getToDateIsNotNull()) { hql.append(andStr + " rr.dateSent <= :dateReceivedTo"); markers.add("dateReceivedTo"); values.add(referralCriteria.getToDate().getDate()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List rrList = factory.find(query, markers, values); ReferralsRecordingShortVoCollection coll = ReferralsRecordingShortVoAssembler.createReferralsRecordingShortVoCollectionFromReferralsRecording(rrList); if(coll != null && coll.size() > 0) return coll; else return null; }
public ReferralsRecordingShortVoCollection list(CareContextRefVo careContext) { return ReferralsRecordingShortVoAssembler.createReferralsRecordingShortVoCollectionFromReferralsRecording( getDomainFactory().find("from ReferralsRecording as ref where ref.careContext.id = :CARE_CONTEXT and ref.referralCategory = :REF_CAT", new String[] {"CARE_CONTEXT", "REF_CAT"}, new Object[] {careContext.getID_CareContext(), getDomLookup(ReferralCategory.FURTHERREFERRAL)})); }