private SkinAssessment copySkinAssessment(SkinAssessment skinAssessment) { if (skinAssessment == null) return null; skinAssessment.clearIDAndVersion(); skinAssessment.setCareContext(form.getGlobalContext().Core.getCurrentCareContext()); skinAssessment.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); skinAssessment.setDateTimeInitiated(new DateTime()); skinAssessment.setHcpInitiated(domain.getHcpLiteUser() instanceof HcpLiteVo ? (HcpLiteVo) domain.getHcpLiteUser() : null); skinAssessment.setSkinAssessmentFindings(copySkinAssessmentFindings(skinAssessment.getSkinAssessmentFindings())); return skinAssessment; }
protected void onBNewClick() throws ims.framework.exceptions.PresentationLogicException { DateTime now = new DateTime(new Date(), new Time()); if ((form.getGlobalContext().COE.SkinBodyChart.getSkinAssessmentVOIsNotNull()) && form.getGlobalContext().COE.SkinBodyChart.getSkinAssessmentVO().getCareContext().equals(form.getGlobalContext().Core.getCurrentCareContext())) { SkinAssessment lastSkinAssessment = form.getGlobalContext().COE.SkinBodyChart.getSkinAssessmentVO(); if(lastSkinAssessment.getDateTimeInitiatedIsNotNull() && lastSkinAssessment.getDateTimeInitiated().getDate().equals(now.getDate()) && lastSkinAssessment.getDateTimeInitiated().getTime().equals(now.getTime())) { engine.showMessage("An assessment already exists for " + now); return; } else populateControls(); } else if (form.getGlobalContext().COE.SkinBodyChart.getSkinAssessmentVOIsNotNull()) { form.getGlobalContext().Core.setYesNoDialogMessage("Do you wish to copy this assessment?"); engine.open(form.getForms().Core.YesNoDialog,false); } else { populateControls(); } }
private void populateControls() { //Prepopulate Controls if(domain.getMosUser() != null) form.textBoxHCP().setValue(((MemberOfStaffShortVo)domain.getMosUser()).toString()); form.dateAssess().setValue(new Date()); form.timeAssess().setValue(new Time()); form.chkSkinIntact().setValue(false); //Save the previous Assessment form.getLocalContext().setPreviousSkinAssessment(form.getGlobalContext().COE.SkinBodyChart.getSkinAssessmentVO()); SkinAssessment skinAssVO = new SkinAssessment(); DrawingImageVersionVo drawingVO = new DrawingImageVersionVo(); //Set the Current Image Name & Version No drawingVO.setImageName(getCurrentImageName()); if(getCurrentVersionNumber() != null) drawingVO.setVersionNumber(getCurrentVersionNumber()); skinAssVO.setImageVersion(drawingVO); skinAssVO.setSkinAssessmentFindings(new SkinAssessmentFindingsCollection()); //Copy the previous Findings getPreviousFindings(skinAssVO); //Set back to the context the SkinAssVO form.getGlobalContext().COE.SkinBodyChart.setSkinAssessmentVO(skinAssVO); form.bNew().setEnabled(false); form.setMode(FormMode.EDIT); }
protected void onDrawingBodyChartRemoved(int index) throws PresentationLogicException { SkinAssessment skinAssVO = form.getGlobalContext().COE.SkinBodyChart.getSkinAssessmentVO(); SkinAssessmentFindings findingVO; if(skinAssVO != null) { for(int i=0; i<skinAssVO.getSkinAssessmentFindings().size(); i++) { findingVO = skinAssVO.getSkinAssessmentFindings().get(i); if(findingVO.getID_SkinAssessmentFindingsIsNotNull() && findingVO.getID_SkinAssessmentFindings().intValue() == index) { if(recordSaved(findingVO.getID_SkinAssessmentFindings())) { displayError("Previous saved Findings cannot be updated"); //Redraw the shape DrawingControlShape shape = new DrawingControlShape(findingVO.getID_SkinAssessmentFindings().intValue(), savedTargetID, findingVO.getSiteImage(), findingVO.getWoundType().getId(), true); form.drawingBodyChart().addShape(shape); return; } else { skinAssVO.getSkinAssessmentFindings().remove(i); form.getGlobalContext().COE.SkinBodyChart.setSkinAssessmentVO(skinAssVO); return; } } } } }
private boolean activeFindings(SkinAssessment skinAssVO) { if(skinAssVO != null && skinAssVO.getSkinAssessmentFindings() != null) { for(int i=0; i<skinAssVO.getSkinAssessmentFindings().size(); i++) if(skinAssVO.getSkinAssessmentFindings().get(i).getIsDiscontinuedAssess() != null && skinAssVO.getSkinAssessmentFindings().get(i).getIsDiscontinuedAssess().booleanValue()) continue; else return true; } return false; }
private void addFindingToAssessment(SkinAssessment assessmentVO, SkinAssessmentFindings findingVO) { for(int i=0; i<assessmentVO.getSkinAssessmentFindings().size(); i++) { if(assessmentVO.getSkinAssessmentFindings().get(i).equals(findingVO)) { assessmentVO.getSkinAssessmentFindings().remove(i); assessmentVO.getSkinAssessmentFindings().add(findingVO); break; } } }
private void populateInstance(CareContextShortVo voCareContext) { clearScreen(); if (voCareContext != null) { SkinAssessmentCollection skinAssVOCollection = domain.listSkinAssessment(voCareContext); if (skinAssVOCollection != null) { skinAssVOCollection = skinAssVOCollection.sort(SortOrder.DESCENDING); form.bNew().setEnabled(false); form.btnNext().setEnabled(false); form.btnPrevious().setEnabled(false); clearCombos(); //String dateTime = ""; form.comboBoxAssessment().clear(); for(int i=0; i<skinAssVOCollection.size(); i++) { if(skinAssVOCollection.get(i).getDateTimeInitiated() != null && skinAssVOCollection.get(i).getDateTimeInitiated().getDate() != null && skinAssVOCollection.get(i).getDateTimeInitiated().getTime() != null) form.comboBoxAssessment().newRow(skinAssVOCollection.get(i), skinAssVOCollection.get(i).getDateTimeInitiated().getDate().toString(DateFormat.STANDARD) + " / " + skinAssVOCollection.get(i).getDateTimeInitiated().getTime().toString(TimeFormat.DEFAULT)); } if(form.comboBoxAssessment().getValues() != null && form.comboBoxAssessment().getValues().size() > 0) { if(form.getGlobalContext().COE.SkinBodyChart.getSelectedSkinAssessment() != null) form.comboBoxAssessment().setValue(form.getGlobalContext().COE.SkinBodyChart.getSelectedSkinAssessment()); else form.comboBoxAssessment().setValue((SkinAssessment)form.comboBoxAssessment().getValues().get(0)); refreshAssessment(); } } } else form.getLocalContext().setSkinAssessment(null); }
/** * save record */ public AssessmentHeaderInfo saveRecord(SkinAssessment skinAssessment, AssessmentHeaderInfo assessment, AssessmentComponent component) throws StaleObjectException { if(!skinAssessment.isValidated()) throw new DomainRuntimeException("This Skin Assessment has not been validated"); DomainFactory factory = getDomainFactory(); ims.nursing.assessmenttools.domain.objects.SkinAssessment domSkinAssess = SkinAssessmentAssembler.extractSkinAssessment(factory, skinAssessment); try { if(domSkinAssess == null) throw new DomainException("No Skin Assessment"); if (assessment != null) { String[] arrErrors = component.validate(); if(arrErrors != null) throw new DomainRuntimeException("Validation Errors"); return (saveAssessmentComponent(assessment, component)); } else { factory.save(domSkinAssess); SkinAssessment voSkin = SkinAssessmentAssembler.create(domSkinAssess); return null; } } catch (DomainException e) { throw new DomainRuntimeException("DomainException occurred saving Skin Assessment.\r\n" + e.getMessage(), e); } }
/** * gets last Skin Assessment */ public SkinAssessment getLastSkinAssessmentByCareContext(CareContextRefVo voCurrentCareContext) { if(voCurrentCareContext == null && voCurrentCareContext.getID_CareContextIsNotNull()) throw new CodingRuntimeException("Current Care Context not available."); DomainFactory factory = getDomainFactory(); String filter = " from SkinAssessment sa "; StringBuffer filterString = new StringBuffer(); ArrayList markerNames = new ArrayList(); ArrayList markerValues = new ArrayList(); filterString.append(" where sa.careContext.id = :rcc"); markerNames.add("rcc"); markerValues.add(voCurrentCareContext.getID_CareContext()); filter += filterString.toString(); filter += " order by sa.dateTimeInitiated desc"; java.util.List skinAssess = factory.find(filter, markerNames, markerValues); SkinAssessmentCollection voSkinAssessColl = SkinAssessmentAssembler.createSkinAssessmentCollectionFromSkinAssessment(skinAssess).sort(SortOrder.DESCENDING); if(voSkinAssessColl.size() > 0) return voSkinAssessColl.get(0); return null; }
public SkinAssessment getLastSkinAssessmentByPatient(Integer idPatient) { if(idPatient == null) throw new CodingRuntimeException("Patient context not available."); DomainFactory factory = getDomainFactory(); String filter = " from SkinAssessment sa "; StringBuffer filterString = new StringBuffer(); ArrayList markerNames = new ArrayList(); ArrayList markerValues = new ArrayList(); filterString.append(" where sa.careContext.episodeOfCare.careSpell.patient.id = :idPat"); markerNames.add("idPat"); markerValues.add(idPatient); filter += filterString.toString(); java.util.List skinAssess = factory.find(filter, markerNames, markerValues); if (skinAssess != null && skinAssess.size() > 0) { SkinAssessmentCollection voSkinAssessColl = SkinAssessmentAssembler.createSkinAssessmentCollectionFromSkinAssessment(skinAssess).sort(SortOrder.DESCENDING); if(voSkinAssessColl!=null && voSkinAssessColl.size()>0) return voSkinAssessColl.get(0); } return null; }