private String displayHeader(DailyFluidBalanceVo voDailyFluidBal) { if(voDailyFluidBal.getShiftDetailsIsNotNull()) { ShiftDetailsVo voShift = voDailyFluidBal.getShiftDetails(); String shiftHeader = voShift.getStartDateTime() + " - " + voShift.getEndDateTime(); return shiftHeader; } return null; }
/** * Lists ventilation chart records for the given episode */ public VitalSignsVoCollection listVentilationCharts(CareContextRefVo refCareContext, ShiftDetailsVo shift) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from VitalSigns vc "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (refCareContext != null) { hql.append(andStr + " vc.careContext.id = :cc"); markers.add("cc"); values.add(refCareContext.getID_CareContext()); andStr = " and "; hql.append(andStr + " vc.isVentilationChartRecord = :record"); markers.add("record"); values.add(Boolean.TRUE); andStr = " and "; } if (shift != null) { hql.append(andStr + " vc.ventilationChart.shiftDetails.id = :shiftId "); markers.add("shiftId"); values.add(shift.getID_ShiftDetails()); andStr = " and "; } if(andStr.equals(" and ")) query += " where"; query += hql.toString(); List lst = factory.find(query, markers, values); VitalSignsVoCollection voVitalsColl = VitalSignsVoAssembler.createVitalSignsVoCollectionFromVitalSigns(lst); return voVitalsColl; }
public ShiftDetailsVo getShiftDetails(DateTime startDate, CareContextRefVo refCareContext) { DomainFactory factory = getDomainFactory(); String filter = " from ShiftDetails sd "; String andStr = " "; StringBuffer filterString = new StringBuffer(); ArrayList markerNames = new ArrayList(); ArrayList markerValues = new ArrayList(); if (refCareContext != null) { filterString.append(" sd.careContext.id = :careContext "); markerNames.add("careContext"); markerValues.add(refCareContext.getID_CareContext()); andStr = " and "; } if(startDate != null) { filterString.append(andStr + " sd.startDateTime = :dateFrom "); markerNames.add("dateFrom"); markerValues.add(startDate.getJavaDate()); } if(andStr.equals(" and ")) filter += " where "; filter += filterString.toString(); List list = factory.find(filter, markerNames, markerValues); if(list != null && list.size() > 0) return ShiftDetailsVoAssembler.create((ShiftDetails) list.get(0)); return null; }
private void previewReport(ShiftDetailsVo shiftDetailsVo) { if(shiftDetailsVo == null) return; String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue(); String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue(); ReportVoCollection coll = domain.listAssignedReports(new Integer(engine.getFormName().getID())); if(coll != null && coll.size() > 0) { //this form must have a single report asigned to it and single template ReportVo rep = coll.get(0); if(rep.getTemplatesIsNotNull() && rep.getTemplates().size() > 0) { ReportTemplateVo template = rep.getTemplates().get(0); String[] obj = null; obj = domain.getReportAndTemplate(rep.getID_ReportBo(), template.getID_TemplateBo()); if(obj == null || obj.length == 0) { engine.showMessage("Could not get the report and template !"); return; } QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId()); client.addSeed(new SeedValue("SHIFTID", shiftDetailsVo.getID_ShiftDetails(), Integer.class)); String resultUrl = ""; try { resultUrl = client.buildReportAsUrlInlineFrame(obj[0], obj[1], urlReportServer, "PDF", "", 1); } catch (QueryBuilderClientException e1) { engine.showMessage("Error creating report: " + e1.getMessage()); return; } form.htmView().setHTML(resultUrl); } } }
private boolean preValidate() { if(form.customControlAuthoring().getValue() == null) { engine.showMessage("'Authoring Hcp' and 'Authoring Date/Time' are mandatory."); return false; } if(form.dteTaken().getValue() != null && form.timTaken().getValue() != null) { if(form.dteTaken().getValue().isGreaterThan(new Date())) { engine.showMessage("'Date/Time Taken' can not be in the future."); return false; } } else{ engine.showMessage("'Date/Time Taken' is mandatory."); return false; } DateTime startShiftDateTime = getStartShiftDateTime(form.dteTaken().getValue(), form.timTaken().getValue()); ShiftDetailsVo shiftDetailsVo = domain.getShiftDetails(startShiftDateTime, form.getGlobalContext().Core.getCurrentCareContext()); if(shiftDetailsVo != null) { VitalSignsVo vc = domain.getVentilationChartByShiftAndTime(shiftDetailsVo, new DateTime(form.dteTaken().getValue(), form.timTaken().getValue())); if(vc != null) { engine.showMessage("A Ventilation Chart record already exists for this hour, please modify the time."); return false; } } if(form.chkonFiO2().getValue()) { if(form.intFractionrate().getValue() == null) { engine.showMessage("Please enter value for O2 Sats % rate.") ; return false; } } return true; }
public VitalSignsVo getVentilationChartByShiftAndTime(ShiftDetailsVo shift, DateTime datetime) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from VitalSigns vc "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; hql.append(andStr + " vc.isVentilationChartRecord = :record"); markers.add("record"); values.add(Boolean.TRUE); andStr = " and "; if (shift != null) { hql.append(andStr + " vc.ventilationChart.shiftDetails.id = :shiftId "); markers.add("shiftId"); values.add(shift.getID_ShiftDetails()); andStr = " and "; } if (datetime != null) { Time time1 = new Time(datetime.getTime().getHour(), 0); DateTime date1 = new DateTime(datetime.getDate(), time1); time1.addMinutes(59); DateTime date2 = new DateTime(datetime.getDate(), time1); hql.append(andStr + " vc.vitalsTakenDateTime between :date1 and :date2 "); markers.add("date1"); values.add(date1.getJavaDate()); markers.add("date2"); values.add(date2.getJavaDate()); andStr = " and "; } if(andStr.equals(" and ")) query += " where"; query += hql.toString(); List lst = factory.find(query, markers, values); VitalSignsVoCollection voVitalsColl = VitalSignsVoAssembler.createVitalSignsVoCollectionFromVitalSigns(lst); if(voVitalsColl != null && voVitalsColl.size() > 0) return voVitalsColl.get(0); return null; }
private boolean preValidate() { if(form.customControlAuthoring().getValue() == null) { engine.showMessage("'Authoring Hcp' and 'Authoring Date/Time' are mandatory."); return false; } if(form.dteTaken().getValue() != null && form.timTaken().getValue() != null) { if(form.dteTaken().getValue().isGreaterThan(new Date())) { engine.showMessage("'Date/Time Taken' cannot be in the future."); //WDEV-18762 return false; } } else{ engine.showMessage("'Date/Time Taken' is mandatory."); return false; } DateTime startShiftDateTime = getStartShiftDateTime(form.dteTaken().getValue(), form.timTaken().getValue()); ShiftDetailsVo shiftDetailsVo = domain.getShiftDetails(startShiftDateTime, form.getGlobalContext().Core.getCurrentCareContext()); if(shiftDetailsVo != null) { VitalSignsVo vc = domain.getVentilationChartByShiftAndTime(shiftDetailsVo, new DateTime(form.dteTaken().getValue(), form.timTaken().getValue())); if(vc != null) { engine.showMessage("A Ventilation Chart record already exists for this hour, please modify the time."); return false; } } if(form.chkonFiO2().getValue()) { if(form.intFractionrate().getValue() == null) { engine.showMessage("Please enter value for O2 Sats % rate.") ; return false; } } return true; }