/** * list waterlow assessments */ public WaterlowAssessmentVoCollection listAssessments(Date dateFrom, Date dateTo, CareContextRefVo voCurrentCareContext, Integer idPatient) throws DomainInterfaceException { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(""); String query ="from Waterlow wa "; ArrayList<String> markers= new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String andStr = " "; hql.append(" wa.careContext.episodeOfCare.careSpell.patient.id = :patId"); markers.add("patId"); values.add(idPatient); if (dateFrom != null && dateTo != null) { hql.append(" and "); hql.append(" wa.dateTimeInitiated > :fromDate and wa.dateTimeInitiated < :toDate "); markers.add("fromDate"); markers.add("toDate"); values.add(dateFrom.addDay(-1).getDate()); values.add(dateTo.addDay(1).getDate()); } else if (dateFrom != null) { hql.append(" and "); hql.append(" wa.dateTimeInitiated > :fromDate "); markers.add("fromDate"); values.add(dateFrom.getDate()); } if(voCurrentCareContext != null && voCurrentCareContext.getID_CareContextIsNotNull()) { hql.append(" and "); hql.append(andStr + " wa.careContext.id = :rcc"); markers.add("rcc"); values.add(voCurrentCareContext.getID_CareContext()); } if (markers.size() > 0) query += " where "; query += hql.toString(); query += " order by wa.dateTimeInitiated"; return WaterlowAssessmentVoAssembler.createWaterlowAssessmentVoCollectionFromWaterlow(factory.find(query,markers,values)); }
private void loadAssessmentRecords() { WaterlowAssessmentVoCollection waters = null; Date dateFrom = null; Date dateTo = null; if(form.cmbFilter().getValue() != null) { if(form.cmbFilter().getValue().equals(LAST_SIX_MONTHS)) { dateFrom = new Date(); dateFrom.addDay(-183); } else if(form.cmbFilter().getValue().equals(LAST_MONTH)) { dateFrom = new Date(); dateFrom.addDay(-31); } else if(form.cmbFilter().getValue().equals(LAST_YEAR)) { dateFrom = new Date(); dateFrom.addDay(-365); } } try { //list all assessments from dateFrom to dateTo waters = domain.listAssessments(dateFrom, dateTo, null, form.getGlobalContext().Core.getPatientShort().getID_Patient()); } catch (DomainInterfaceException e) { engine.showMessage(e.getMessage()); } form.getLocalContext().setWaterAssessments(waters); populateScreenFromData(); //copy last functionality (WDEV-10253) if(ConfigFlag.UI.COPY_LAST_FUNCTIONALITY.getValue() && Boolean.TRUE.equals(domain.hasWaterlowForCurrentAdmission(form.getGlobalContext().Core.getCurrentCareContext()))) { form.btnCopyLast().setEnabled(true); } else { form.btnCopyLast().setEnabled(false); } //WDEV-10834 if(ConfigFlag.UI.COPY_LAST_FUNCTIONALITY.getValue() == false) { form.btnCopyLast().setVisible(false); } }