private void search() { if (!validateSearch()) return; form.dyngrdList().getRows().clear(); form.chkSelectAll().setValue(false); ClinicalNotesPullingSearchCriteriaVo filterVo = new ClinicalNotesPullingSearchCriteriaVo(); filterVo = populateSearchFilter(filterVo); form.getGlobalContext().Clinical.setClinicalNotesPullingSearchCriteria(filterVo); OutpatientEpisodeWithICPInfoVoCollection list = domain.listOPEpisodes(filterVo); if (list == null || list.size() == 0) { engine.showMessage("No records match your search criteria.", "No data found", MessageButtons.OK, MessageIcon.WARNING); form.lblTotal().setValue("Total: 0"); updateControlsState(); return; } list.sort(OutpatientEpisodeWithICPInfoVo.getTimeComparator(SortOrder.ASCENDING)); form.lblTotal().setValue("Total: " + list.size()); populateGrid(list); updateControlsState(); }
private ClinicalNotesPullingSearchCriteriaVo populateSearchFilter(ClinicalNotesPullingSearchCriteriaVo filterVo) { if (form.cmbHospital().getValue() != null) filterVo.setHospital(form.cmbHospital().getValue()); if (form.cmbClinic().getValue() != null) filterVo.setClinic(form.cmbClinic().getValue()); if (form.dteDate().getValue() != null) filterVo.setDate(form.dteDate().getValue()); return filterVo; }
private void refreshSearchCriteria(ClinicalNotesPullingSearchCriteriaVo searchCriteria) { if (searchCriteria == null) return; form.cmbHospital().setValue((LocationLiteVo) searchCriteria.getHospital()); form.dteDate().setValue(searchCriteria.getDate()); if (form.cmbHospital().getValue() != null && form.dteDate().getValue() != null) loadClinics(searchCriteria.getClinicIsNotNull()); form.cmbClinic().setValue((SessionShortVo) searchCriteria.getClinic()); search(); }
public OutpatientEpisodeWithICPInfoVoCollection listOPEpisodes(ClinicalNotesPullingSearchCriteriaVo searchCriteria) { ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); StringBuffer query = new StringBuffer(); query.append("SELECT icp, appts, apptTrackStatus"); query.append(", referral"); query.append(" FROM PatientICP AS icp RIGHT JOIN icp.appointments AS appts LEFT JOIN appts.apptTrackingStatusHistory AS apptTrackStatus LEFT JOIN icp.careContext AS icpContext"); query.append(", CatsReferral AS referral LEFT JOIN referral.appointments AS refAppt"); query.append(" WHERE "); query.append(" refAppt.id = appts.id AND "); query.append(" (apptTrackStatus.id is null or "); query.append(" apptTrackStatus.id = (select max(th.id) from Booking_Appointment as ba join ba.apptTrackingStatusHistory as th where ba.id = appts.id))"); if (searchCriteria.getClinicIsNotNull()) { query.append(" and appts.session.id = :clinic"); markers.add("clinic"); values.add(searchCriteria.getClinic().getID_Sch_Session()); } else { query.append(" and ( appts.session.schLocation.id = :idHosp or appts.session.schLocation.parentLocation.id = :idHosp)"); markers.add("idHosp"); values.add(searchCriteria.getHospital().getID_Location()); query.append(" and appts.session.sessionDate = :sessionDate"); markers.add("sessionDate"); values.add(searchCriteria.getDate().getDate()); query.append(" and appts.session.isActive = :isActive"); markers.add("isActive"); values.add(Boolean.TRUE); query.append(" and appts.session.isTheatreSession = :falseTheatre"); markers.add("falseTheatre"); values.add(Boolean.FALSE); } query.append(" and appts.apptStatus.id != :CAN_ID "); markers.add("CAN_ID"); values.add(Status_Reason.CANCELLED.getID()); java.util.List list = getDomainFactory().find(query.toString(), markers, values, 500); Iterator it = list.iterator(); OutpatientEpisodeWithICPInfoVoCollection voColl = new OutpatientEpisodeWithICPInfoVoCollection(); while (it.hasNext()) { Object[] lstItem = (Object[]) it.next(); Booking_Appointment doOP = (Booking_Appointment) lstItem[1]; // Populate database mapped fields OutpatientEpisodeWithICPInfoVo voOPEpis = OutpatientEpisodeWithICPInfoVoAssembler.create(doOP); // Set ICP Information if (lstItem[0] instanceof PatientICP) { PatientICP domPatientICP = (PatientICP) lstItem[0]; voOPEpis.setICPInfo(PatientICPLiteVoAssembler.create(domPatientICP)); } //Get the CatsReferral for this appointment if (lstItem[3] instanceof CatsReferral) { voOPEpis.setReferral(CatsReferralBreachDatesVoAssembler.create((CatsReferral) lstItem[3])); } voColl.add(voOPEpis); } return voColl; }
public OutpatientEpisodeWithICPInfoVoCollection listOPEpisodes(ClinicalNotesPullingSearchCriteriaVo searchCriteria) { ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); StringBuffer query = new StringBuffer(); query.append("SELECT icp, appts, apptTrackStatus"); query.append(", referral"); query.append(" FROM PatientICP AS icp RIGHT JOIN icp.appointments AS appts LEFT JOIN appts.apptTrackingStatusHistory AS apptTrackStatus LEFT JOIN icp.careContext AS icpContext"); query.append(", CatsReferral AS referral LEFT JOIN referral.appointments AS refAppt"); query.append(" WHERE "); query.append(" refAppt.id = appts.id AND "); query.append(" (apptTrackStatus.id is null or "); query.append(" apptTrackStatus.id = (select max(th.id) from Booking_Appointment as ba join ba.apptTrackingStatusHistory as th where ba.id = appts.id))"); if (searchCriteria.getClinicIsNotNull()) { query.append(" and appts.session.id = :clinic"); markers.add("clinic"); values.add(searchCriteria.getClinic().getID_Sch_Session()); } else { query.append(" and ( appts.session.schLocation.id = :idHosp or appts.session.schLocation.parentLocation.id = :idHosp)"); markers.add("idHosp"); values.add(searchCriteria.getHospital().getID_Location()); query.append(" and appts.session.sessionDate = :sessionDate"); markers.add("sessionDate"); values.add(searchCriteria.getDate().getDate()); query.append(" and appts.session.isActive = :isActive"); markers.add("isActive"); values.add(Boolean.TRUE); query.append(" and appts.session.sessionProfileType.id = :OUTPATIENT_SESSION"); markers.add("OUTPATIENT_SESSION"); values.add(SchProfileType.OUTPATIENT.getID()); } query.append(" and appts.apptStatus.id != :CAN_ID "); markers.add("CAN_ID"); values.add(Status_Reason.CANCELLED.getID()); java.util.List list = getDomainFactory().find(query.toString(), markers, values, 500); Iterator it = list.iterator(); OutpatientEpisodeWithICPInfoVoCollection voColl = new OutpatientEpisodeWithICPInfoVoCollection(); while (it.hasNext()) { Object[] lstItem = (Object[]) it.next(); Booking_Appointment doOP = (Booking_Appointment) lstItem[1]; // Populate database mapped fields OutpatientEpisodeWithICPInfoVo voOPEpis = OutpatientEpisodeWithICPInfoVoAssembler.create(doOP); // Set ICP Information if (lstItem[0] instanceof PatientICP) { PatientICP domPatientICP = (PatientICP) lstItem[0]; voOPEpis.setICPInfo(PatientICPLiteVoAssembler.create(domPatientICP)); } //Get the CatsReferral for this appointment if (lstItem[3] instanceof CatsReferral) { voOPEpis.setReferral(CatsReferralBreachDatesVoAssembler.create((CatsReferral) lstItem[3])); } voColl.add(voOPEpis); } return voColl; }