/** * Saves the given Fluid Balance to the database */ public ims.core.vo.DailyFluidBalanceVo saveFluidBalance(ims.core.vo.DailyFluidBalanceVo balance) throws ims.domain.exceptions.StaleObjectException { if (!balance.isValidated()) throw new DomainRuntimeException("FluidBalance details have not been validated!"); DomainFactory factory = getDomainFactory(); DailyFluidBalance domBalance = DailyFluidBalanceVoAssembler.extractDailyFluidBalance(factory, balance); factory.save(domBalance); return (DailyFluidBalanceVoAssembler.create(domBalance)); }
public DailyFluidBalanceVo saveDailyFluidBalance(DailyFluidBalanceVo dfbVo) throws DomainInterfaceException, StaleObjectException { if (!dfbVo.isValidated()) throw new DomainRuntimeException("FluidBalance details have not been validated!"); DomainFactory factory = getDomainFactory(); DailyFluidBalance domBalance = DailyFluidBalanceVoAssembler.extractDailyFluidBalance(factory, dfbVo); factory.save(domBalance); return (DailyFluidBalanceVoAssembler.create(domBalance)); }
public DailyFluidBalanceVo listFluidBalance(DateTime date, CareContextRefVo refCareContext) { DomainFactory factory = getDomainFactory(); String filter = " from DailyFluidBalance fb "; String andStr = " "; StringBuffer filterString = new StringBuffer(); ArrayList markerNames = new ArrayList(); ArrayList markerValues = new ArrayList(); if (refCareContext != null) { filterString.append(" fb.careContext.id = :careContext "); markerNames.add("careContext"); markerValues.add(refCareContext.getID_CareContext()); andStr = " and "; } if(date != null) { filterString.append(andStr + " fb.shiftDetails.startDateTime = :dateFrom "); markerNames.add("dateFrom"); markerValues.add(date.getJavaDate()); } if(andStr.equals(" and ")) filter += " where "; filter += filterString.toString(); List dailyFluidList = factory.find(filter, markerNames, markerValues); if(dailyFluidList != null && dailyFluidList.size()>0) return DailyFluidBalanceVoAssembler.create((DailyFluidBalance) dailyFluidList.get(0)); return null; }
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; }