private void populateDynGrid(CarePlanInterventionsCollection interventions) { form.dyngrdActions().getRows().clear(); form.dyngrdActions().setValue(null); if (interventions == null) return; for (int i = 0 ; i < interventions.size() ; i++) { if (shouldAdd(interventions.get(i))) { DynamicGridRow newRow = form.dyngrdActions().getRows().newRow(); populateDynGridRowFromData( newRow,interventions.get(i)); } } }
private CarePlanInterventionsCollection createNewCarePlanInterventionsCollection(CarePlanInterventionsCollection collInterventionsToBeCopied) { if (collInterventionsToBeCopied == null || collInterventionsToBeCopied.size() == 0) return null; CarePlanInterventionsCollection collInterventions = new CarePlanInterventionsCollection(); collInterventionsToBeCopied.sort(SortOrder.ASCENDING); int counter = 0; for (int i = 0; i < collInterventionsToBeCopied.size(); i++) { CarePlanInterventions interventionToSave = collInterventionsToBeCopied.get(i); if (interventionToSave.getActive() && (interventionToSave.getIsRemoved() == null || (interventionToSave.getIsRemoved() != null && !interventionToSave.getIsRemoved()))) { interventionToSave.setID_CarePlanIntervention(null); interventionToSave.setStartDate(new Date()); Object hcpUser = domain.getHcpLiteUser(); if (hcpUser != null) { interventionToSave.setStartBy((HcpLiteVo) hcpUser); } interventionToSave.setOrder(counter); counter++; // fields that shouldn't be copied interventionToSave.setStopDate(null); interventionToSave.setStopBy(null); interventionToSave.setRemovedDate(null); collInterventions.add(interventionToSave); } } return collInterventions; }
private CarePlan createDuplicateCarePlan() { CarePlan cpDuplicate = new CarePlan(); CarePlan cp = form.getLocalContext().getCarePlan(); cpDuplicate.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); cpDuplicate.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); cpDuplicate.setTitle(cp.getTitle()); cpDuplicate.setObjective(cp.getObjective()); cpDuplicate.setNextEvaluationDate(new Date()); CarePlanInterventionsCollection collCarePlanInterventions = new CarePlanInterventionsCollection(); if(cp.getInterventions()!=null) for(int i=0; i<cp.getInterventions().size(); i++){ CarePlanInterventions action = cp.getInterventions().get(i); CarePlanInterventions carePlanIntervention = new CarePlanInterventions(); carePlanIntervention.setDescription(action.getDescription()); carePlanIntervention.setActive(true); carePlanIntervention.setStartDate(action.getStartDate()); carePlanIntervention.setStartBy(action.getStartBy()); carePlanIntervention.setOrder(action.getOrder()); carePlanIntervention.setInterventionType(action.getInterventionType()); carePlanIntervention.setFrequency(action.getFrequency()); collCarePlanInterventions.add(carePlanIntervention); } cpDuplicate.setInterventions(collCarePlanInterventions); //Care Plan Status CarePlanStatus status = new CarePlanStatus(); status.setDateTime(new DateTime()); Object Object = domain.getHcpLiteUser(); HcpLiteVo hcpLiteVo = Object != null ? (HcpLiteVo) Object : null; status.setHCP(hcpLiteVo); status.setStatus(ims.nursing.vo.lookups.CarePlanStatus.ACTIVE); cpDuplicate.setCurrentCarePlanStatus(status); CarePlanStatusCollection voColl = new CarePlanStatusCollection(); voColl.add(status); cpDuplicate.setCarePlanStatus(voColl); return cpDuplicate; }
private CarePlanInterventionsCollection createNewCarePlanInterventionsCollection(CarePlanInterventionsCollection collInterventionsToBeCopied) { if (collInterventionsToBeCopied == null || collInterventionsToBeCopied.size() == 0) return null; CarePlanInterventionsCollection collInterventions = new CarePlanInterventionsCollection(); collInterventionsToBeCopied.sort(SortOrder.ASCENDING); int counter = 0; for (int i = 0; i < collInterventionsToBeCopied.size(); i++) { CarePlanInterventions interventionToSave = collInterventionsToBeCopied.get(i); if (interventionToSave.getActive() && (interventionToSave.getIsRemoved() == null || (interventionToSave.getIsRemoved() != null && !interventionToSave.getIsRemoved()))) { interventionToSave.setID_CarePlanIntervention(null); interventionToSave.setStartDate(new Date()); Object hcpUser = domain.getHcpLiteUser(); if (hcpUser != null) { interventionToSave.setStartBy((HcpLiteVo) hcpUser); } interventionToSave.setOrder(counter); counter++; // fields that shouldn't be copied interventionToSave.setStopDate(null); interventionToSave.setStopBy(null); interventionToSave.setIsRemoved(null); //WDEV-16795 interventionToSave.setRemovalAuthoringInformation(null); //WDEV-16795 collInterventions.add(interventionToSave); } } return collInterventions; }