private void populateCarePlansGrid(CarePlanOverviewCollection coll, boolean bOtherCarePlans) { if (coll != null) { GenForm.gridCarePlansRow row; for (int i=0; i<coll.size(); i++) { CarePlanOverview overview = coll.get(i); row = form.gridCarePlans().getRows().newRow(); row.setValue(overview); row.setcolCarePlanTitle(overview.getTitle()); if(overview!=null && overview.getCarePlanStatusIsNotNull()) { for(int x=0; x<overview.getCarePlanStatus().size(); x++) { overview.getCarePlanStatus().sort(SortOrder.ASCENDING); if(overview.getCarePlanStatus().get(x).getStatus().equals(ims.nursing.vo.lookups.CarePlanStatus.ACTIVE)) { if(overview.getCarePlanStatus().get(x).getDateTime().getDate() != null) row.setcolInitiatedOn(overview.getCarePlanStatus().get(x).getDateTime().getDate()); if(overview.getCarePlanStatus().get(x).getHCP() != null) { if(overview.getCarePlanStatus().get(x).getHCP().getName() != null) row.setcolInitiateBy(overview.getCarePlanStatus().get(x).getHCP().getName().toShortForm()); } break; //you could have a number of actives, i.e.active,then suspended,then active, you want //the first active, so ASCENDING - get first active - need break. } } } if (overview.getCurrentCarePlanStatus()!=null && overview.getCurrentCarePlanStatus().getStatus().equals(ims.nursing.vo.lookups.CarePlanStatus.ACTIVE) && !bOtherCarePlans) { if (overview.getNextEvaluationDate() != null) row.setcolNextEvaluation(overview.getNextEvaluationDate()); // If the careplan evaluation is due today, we want to set the row green if (overview.getNextEvaluationDate() != null && overview.getNextEvaluationDate().equals(new ims.framework.utils.Date())) row.setBackColor(Color.Orange); // If the careplan is overdue, we want to set the row red if (overview.getNextEvaluationDate() != null && overview.getNextEvaluationDate().isLessThan(new ims.framework.utils.Date())) row.setBackColor(Color.LightCoral); } if(bOtherCarePlans){ if (overview.getNextEvaluationDate() != null) row.setcolNextEvaluation(overview.getNextEvaluationDate()); row.setBackColor(Color.LightSlateGray); } if(overview.getCurrentCarePlanStatus()!=null) row.setcolStatus(overview.getCurrentCarePlanStatus().getStatus().getText()); row.setTooltipForcolStatus(fillToolTip(overview.getCarePlanStatus())); } } }
protected void onImbRefreshClick() throws PresentationLogicException { // We need to call the InpatientEpisode list for the ward selected form.grdCarePlans().getRows().clear(); if (form.cmbPatient().getValue() != null) { CarePlanStatus statusFilter = new CarePlanStatus(); statusFilter.setStatus(ims.nursing.vo.lookups.CarePlanStatus.ACTIVE); CarePlanOverviewCollection epColl = domain.listCarePlansForReview(form.cmbPatient().getValue(), statusFilter); CarePlanOverview voCpr; GenForm.grdCarePlansRow row; if (epColl != null) { for (int i = 0; i < epColl.size(); i++) { voCpr = epColl.get(i); row = form.grdCarePlans().getRows().newRow(); row.setcolCarePlan(voCpr.getTitle()); if (voCpr.getNextEvaluationDate() != null) row.setcolEvaluationDate(voCpr.getNextEvaluationDate().toString()); if (voCpr.getLastReviewedDate() != null) row.setColDateReview(voCpr.getLastReviewedDate().toString()); if (voCpr.getLastReviewedBy() != null) row.setColBy(voCpr.getLastReviewedBy().getName().toString()); // If the careplan evaluation is due today, set the row // Orange if (voCpr.getNextEvaluationDate() != null && voCpr.getNextEvaluationDate().equals(new ims.framework.utils.Date())) row.setBackColor(Color.Orange); // If the careplan is overdue, set the row red if (voCpr.getNextEvaluationDate() != null && voCpr.getNextEvaluationDate().isLessThan(new ims.framework.utils.Date())) row.setBackColor(Color.LightCoral); row.setValue(voCpr); } } } form.btnConfirm().setEnabled(false); form.btnReviewHistory().setEnabled(false); }