public EquipmentVoCollection listEquipment(PatientShort voPrisoner, Boolean activeOnly) { if (voPrisoner == null) throw new RuntimeException("Cannot get EquipmentVoCollection for null patient"); DomainFactory factory = getDomainFactory(); ArrayList<String> params = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String hql = "from Equipment eq where eq.careContext.episodeOfCare.careSpell.patient.id = :patientId"; params.add("patientId"); values.add(voPrisoner.getID_Patient()); if (Boolean.TRUE.equals(activeOnly)) { hql += " and (eq.inactive = :inactive or eq.inactive is null) "; params.add("inactive"); values.add(Boolean.FALSE); } List equipList = factory.find(hql, params, values); return EquipmentVoAssembler.createEquipmentVoCollectionFromEquipment(equipList); }
public EquipmentVoCollection listEquipmentByCareContext(CareContextLiteVo voCareContextLite, Boolean activeOnly) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); String query = " from Equipment eq "; ArrayList markers= new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if(voCareContextLite.getEpisodeOfCareIsNotNull()) { hql.append(andStr + " eq.careContext.id = :ec"); markers.add("ec"); values.add(voCareContextLite.getID_CareContext()); andStr = " and "; } if (Boolean.TRUE.equals(activeOnly)) { hql.append(andStr + " eq.inactive is null "); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); java.util.List edList = factory.find(query,markers,values); EquipmentVoCollection voEquipmentColl = EquipmentVoAssembler.createEquipmentVoCollectionFromEquipment(edList); if(voEquipmentColl.size()>0) return voEquipmentColl; else return null; }
private void populateEquipmentGrid() { EquipmentVoCollection voColl; PatientShort voPatientShort = form.getGlobalContext().Core.getPatientShort(); Boolean bTherapiesEquipmentForm = new Boolean(engine.getFormName().equals(form.getForms().Core.Equipment2)); if (bTherapiesEquipmentForm.equals(Boolean.TRUE)) voColl = domain.listEquipmentByCareContext(form.getGlobalContext().Core.getCurrentCareContext(), form.groupFilter().getValue().equals(GenForm.groupFilterEnumeration.rdoActive)); else voColl = domain.listEquipment(voPatientShort, form.groupFilter().getValue().equals(GenForm.groupFilterEnumeration.rdoActive)); if (voColl != null) { GenForm.grdEquipmentRow row = null; for (int i = 0; i < voColl.size(); i++) { row = form.grdEquipment().getRows().newRow(); if (voColl.get(i).getType().getParent() != null) row.setColEquipmentParent(voColl.get(i).getType().getParentNode().toString()); if (voColl.get(i).getType() != null) row.setColEquipmentChild(voColl.get(i).getType().toString()); if (voColl.get(i).getSupplier() != null) row.setColSupplier(voColl.get(i).getSupplier().toString()); if (voColl.get(i).getDateRequired() != null) row.setColDateRequired(voColl.get(i).getDateRequired().toString()); if (voColl.get(i).getDateSupplied() != null) row.setColDateSupplied(voColl.get(i).getDateSupplied().toString()); if (voColl.get(i).getSuppliedFor() != null) row.setColSuppliedFor(voColl.get(i).getSuppliedFor().toString()); if (voColl.get(i).getLoan() != null) row.setColLoan(voColl.get(i).getLoan().toString()); if (voColl.get(i).getFundedBy() != null) row.setColFundedby(voColl.get(i).getFundedBy().toString()); row.setValue(voColl.get(i)); if (Boolean.TRUE.equals(voColl.get(i).getInactive())) //wdev-9543 row.setTooltip("Inactivation Reason : " + voColl.get(i).getInactivationReason() + "Last Update by : " + (voColl.get(i).getAuthoringInformationIsNotNull() && voColl.get(i).getAuthoringInformation().getAuthoringHcpIsNotNull() ? voColl.get(i).getAuthoringInformation().getAuthoringHcp().toString() : "")); row.setBackColor(Boolean.TRUE.equals(voColl.get(i).getInactive()) ? Color.Beige : null); } } }
private void populateEquipmentGrid() { EquipmentVoCollection voColl; PatientShort voPatientShort = form.getGlobalContext().Core.getPatientShort(); Boolean bTherapiesEquipmentForm = new Boolean(engine.getFormName().equals(form.getForms().Core.Equipment2)); if (bTherapiesEquipmentForm.equals(Boolean.TRUE)) voColl = domain.listEquipmentByCareContext(form.getGlobalContext().Core.getCurrentCareContext(), form.groupFilter().getValue().equals(GenForm.groupFilterEnumeration.rdoActive)); else voColl = domain.listEquipment(voPatientShort, form.groupFilter().getValue().equals(GenForm.groupFilterEnumeration.rdoActive)); if (voColl != null) { GenForm.grdEquipmentRow row = null; for (int i = 0; i < voColl.size(); i++) { row = form.grdEquipment().getRows().newRow(); if (voColl.get(i).getType().getParent() != null) row.setColEquipmentParent(voColl.get(i).getType().getParentNode().toString()); if (voColl.get(i).getType() != null) row.setColEquipmentChild(voColl.get(i).getType().toString()); if (voColl.get(i).getSupplier() != null) row.setColSupplier(voColl.get(i).getSupplier().toString()); if (voColl.get(i).getDateRequired() != null) row.setColDateRequired(voColl.get(i).getDateRequired().toString()); if (voColl.get(i).getDateSupplied() != null) row.setColDateSupplied(voColl.get(i).getDateSupplied().toString()); if (voColl.get(i).getSuppliedFor() != null) row.setColSuppliedFor(voColl.get(i).getSuppliedFor().toString()); if (voColl.get(i).getLoan() != null) row.setColLoan(voColl.get(i).getLoan().toString()); if (voColl.get(i).getFundedBy() != null) row.setColFundedby(voColl.get(i).getFundedBy().toString()); row.setValue(voColl.get(i)); boolean hasInactivatingHCPInfo = voColl.get(i).getAuthoringInformationIsNotNull() && voColl.get(i).getAuthoringInformation().getAuthoringHcpIsNotNull(); if (Boolean.TRUE.equals(voColl.get(i).getInactive())) //wdev-9543 row.setTooltip("Inactivation Reason: " +(voColl.get(i).getInactivationReasonIsNotNull() && voColl.get(i).getInactivationReason().length() > 0 ? voColl.get(i).getInactivationReason() :"") + " <br/> Last Updated by: " + (hasInactivatingHCPInfo ? voColl.get(i).getAuthoringInformation().getAuthoringHcp().toString() : "")); //WDEV-18768 row.setBackColor(Boolean.TRUE.equals(voColl.get(i).getInactive()) ? Color.Beige : null); } } }