private void populateGrid(DailyFluidBalanceVoCollection coll) { form.grdDetails().getRows().clear(); if (coll != null) { for (int i=0; i<coll.size(); i++) { DailyFluidBalanceVo bal = coll.get(i); displayParentAndItsChild(bal); } } form.grdDetails().expandAll(); }
public DailyFluidBalanceVoCollection listFluidBalanceByCareContextAndDates(CareContextRefVo refCareContext, ims.framework.utils.DateTime startDateTime, ims.framework.utils.DateTime endDateTime) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from DailyFluidBalance t "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (refCareContext != null) { hql.append(andStr + " t.careContext.id = :cc"); markers.add("cc"); values.add(refCareContext.getID_CareContext()); andStr = " and "; } if (startDateTime != null) { hql.append(andStr + " t.shiftDetails.startDateTime >= :sdate"); markers.add("sdate"); values.add(startDateTime.getDate().getDate());//.toString(ims.framework.utils.DateTimeFormat.MEDIUM)); // values.add(startDateTime.toString(ims.framework.utils.DateTimeFormat.MEDIUM)); andStr = " and "; } if (endDateTime != null) { hql.append(andStr + " t.shiftDetails.startDateTime <= :edate"); markers.add("edate"); values.add(endDateTime.getDate().getDate());//.toString(ims.framework.utils.DateTimeFormat.MEDIUM)); // values.add(endDateTime.toString(ims.framework.utils.DateTimeFormat.MEDIUM)); andStr = " and "; } if (andStr.equals(" and ")) query += " where "; query += hql.toString(); List fluidList = factory.find(query, markers, values); DailyFluidBalanceVoCollection voDailyFluidBalanceColl = DailyFluidBalanceVoAssembler.createDailyFluidBalanceVoCollectionFromDailyFluidBalance(fluidList).sort(SortOrder.DESCENDING); return voDailyFluidBalanceColl; }
public DailyFluidBalanceVo getDailyFluidBalanceDetailsByContextDateAndTimePeriod(CareContextRefVo contextRefVo, ims.framework.utils.DateTime datetimeStartShift, ims.framework.utils.DateTime datetimeEndShift) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from DailyFluidBalance dfb"; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String andStr = " "; /* from DailyFluidBalance as d1_1 left join d1_1.clinicalContact as c1_1 left join d1_1.fluidBalanceInstances as f1_1 left join d1_1.shiftDetails as s1_1 left join d1_1.careContext as c2_1 where (d1_1.clinicalContact = 1 and c2_1.id = 2 and f1_1.fluidBalanceDate = '06 Sep 2006 00:00:00' and s1_1.startDateTime >= '06 Sep 2006 00:00:00' and s1_1.endDateTime <= '06 Sep 2006 00:00:00') and d1_1.isRIE is null */ if (contextRefVo != null) { hql.append(andStr + " dfb.careContext.id = :cc"); markers.add("cc"); values.add(contextRefVo.getID_CareContext()); andStr = " and "; } if (datetimeStartShift != null) { hql.append(andStr + " dfb.shiftDetails.startDateTime >= :sdate"); markers.add("sdate"); values.add(datetimeStartShift.getJavaDate()); andStr = " and "; } if (datetimeEndShift != null) { hql.append(andStr + " dfb.shiftDetails.endDateTime <= :edate"); markers.add("edate"); values.add(datetimeEndShift.getJavaDate()); andStr = " and "; } if (andStr.equals(" and ")) query += " where "; query += hql.toString(); List<?> fluidList = factory.find(query, markers, values); DailyFluidBalanceVoCollection voDailyFluidBalanceColl = DailyFluidBalanceVoAssembler.createDailyFluidBalanceVoCollectionFromDailyFluidBalance(fluidList).sort(SortOrder.DESCENDING); if (voDailyFluidBalanceColl.size() > 0) return voDailyFluidBalanceColl.get(0); else return null; }