private boolean save() { PatientDocumentVo vo = populatePatientDocumentVo(populateServetDocumentVo()); String[] str = vo.validate(); if (str != null && str.length > 0) { engine.showErrors(str); return false; } if (form.getLocalContext().getUploadDocumentStoreLevelIsNotNull()) { if (form.getLocalContext().getUploadDocumentStoreLevel().equals(UploadDocumentStoreLevel.REFERRAL)) { if (!saveDocAtReferralLevel(vo)) return false; } else if (form.getLocalContext().getUploadDocumentStoreLevel().equals(UploadDocumentStoreLevel.CARECONTEXT) ||form.getLocalContext().getUploadDocumentStoreLevel().equals(UploadDocumentStoreLevel.EPISODEOFCARE) ||form.getLocalContext().getUploadDocumentStoreLevel().equals(UploadDocumentStoreLevel.PATIENT)) { try { PatientDocumentSaveVo voSave = domain.savePatientDocument(vo, null, null); form.getGlobalContext().Core.setPatientDocument(voSave.getPatientDocumentVo()); } catch (StaleObjectException e) { catchErrors(e.toString(), SystemLogLevel.ERROR); return false; } } engine.close(DialogResult.OK); return true; } return false; }
public void saveReport(PatientDocumentVo document, CatsReferralRefVo referral) throws StaleObjectException { if (document != null) { if (!document.isValidated()) throw new DomainRuntimeException("PatientDocumentVo not validated"); } DomainFactory factory = getDomainFactory(); PatientDocument domDocument = PatientDocumentVoAssembler.extractPatientDocument(factory, document); factory.save(domDocument); CatsReferral domCats = (CatsReferral) factory.getDomainObject(CatsReferral.class, referral.getID_CatsReferral()); domCats.getReferralDocuments().add(domDocument); //wdev-8305 if (document.getCategoryIsNotNull() && document.getCategory().equals(DocumentCategory.DISCHARGE_SUPPLEMENTARY)) domCats.setRequiresDischargeRep(Boolean.FALSE); factory.save(domCats); PatientDocumentSaveVo vo = new PatientDocumentSaveVo(); vo.setPatientDocumentVo(PatientDocumentVoAssembler.create(domDocument)); vo.setCatsReferralWizardVo(CatsReferralWizardVoAssembler.create(domCats)); }
public void saveDocument(PatientDocumentVo document, CatsReferralRefVo referral, Boolean bIsCurrent) throws StaleObjectException { if (document != null) { if (!document.isValidated()) throw new DomainRuntimeException("PatientDocumentVo not validated"); } DomainFactory factory = getDomainFactory(); PatientDocument domDocument = PatientDocumentVoAssembler.extractPatientDocument(factory, document); factory.save(domDocument); CatsReferral domCats = (CatsReferral) factory.getDomainObject(CatsReferral.class, referral.getID_CatsReferral()); //wdev-8305 if (document.getCategoryIsNotNull() && document.getCategory().equals(DocumentCategory.DISCHARGE_SUPPLEMENTARY) && bIsCurrent != null && bIsCurrent) domCats.setRequiresDischargeRep(Boolean.FALSE); domCats.getReferralDocuments().add(domDocument); factory.save(domCats); PatientDocumentSaveVo vo = new PatientDocumentSaveVo(); vo.setPatientDocumentVo(PatientDocumentVoAssembler.create(domDocument)); vo.setCatsReferralWizardVo(CatsReferralWizardVoAssembler.create(domCats)); }
private boolean saveDocAtReferralLevel(PatientDocumentVo vo) { hasGPLetter = false; CatsReferralWizardVo catReferral = null; if (form.getGlobalContext().RefMan.getCatsReferralIsNotNull()) { catReferral = domain.getCatsReferral(form.getGlobalContext().RefMan.getCatsReferral()); } if (catReferral == null) return false; if (catReferral.getHasReferralLetter() == null || (catReferral.getHasReferralLetter() != null && catReferral.getHasReferralLetter() == false)) { if (form.cmbSource().getValue() != null) { if (form.cmbSource().getValue().equals(DocumentCategory.GPLETTER)) { hasGPLetter = true; catReferral.setHasReferralLetter(Boolean.TRUE);//wdev-10222 if(catReferral.getCurrentStatusIsNotNull() && catReferral.getCurrentStatus().getReferralStatusIsNotNull() && catReferral.getCurrentStatus().getReferralStatus().equals(ReferralApptStatus.REFERRAL_RECEIVED)) setCatsReferralStatus(catReferral); } } } if (catReferral.getHasDocumentsIsNotNull()) { if (catReferral.getHasDocuments().equals(Boolean.FALSE)) { if (form.cmbSource().getValue() != null) { if (!form.cmbSource().getValue().equals(DocumentCategory.GPLETTER)) { catReferral.setHasDocuments(Boolean.TRUE); } } } } else { if (form.cmbSource().getValue() != null) { if (!form.cmbSource().getValue().equals(DocumentCategory.GPLETTER)) { catReferral.setHasDocuments(Boolean.TRUE); } } } try { PatientDocumentSaveVo voSave = domain.savePatientDocument(vo, catReferral, form.getGlobalContext().RefMan.getCatsReferralIsNotNull() ? form.getGlobalContext().RefMan.getCatsReferral() : null ); form.getGlobalContext().Core.setPatientDocument(voSave.getPatientDocumentVo()); form.getGlobalContext().RefMan.setCatsReferralWizard(voSave.getCatsReferralWizardVo()); if (!hasGPLetter) { form.getGlobalContext().RefMan.setCatsReferralHasGpLetter(Boolean.FALSE); } else form.getGlobalContext().RefMan.setCatsReferralHasGpLetter(Boolean.TRUE); } catch (StaleObjectException e) { catchErrors(e.toString(), SystemLogLevel.ERROR); return false; } return true; }
private boolean save() { PatientDocumentVo vo = populatePatientDocumentVo(populateServetDocumentVo()); String[] str = vo.validate(); if (str != null && str.length > 0) { engine.showErrors(str); return false; } if (form.getLocalContext().getUploadDocumentStoreLevelIsNotNull()) { if (form.getLocalContext().getUploadDocumentStoreLevel().equals(UploadDocumentStoreLevel.REFERRAL)) { if (!saveDocAtReferralLevel(vo)) return false; } else if (form.getLocalContext().getUploadDocumentStoreLevel().equals(UploadDocumentStoreLevel.CARECONTEXT) ||form.getLocalContext().getUploadDocumentStoreLevel().equals(UploadDocumentStoreLevel.EPISODEOFCARE) ||form.getLocalContext().getUploadDocumentStoreLevel().equals(UploadDocumentStoreLevel.PATIENT)) { try { PatientDocumentSaveVo voSave = domain.savePatientDocument(vo, null, null); form.getGlobalContext().Core.setPatientDocument(voSave.getPatientDocumentVo()); } catch (StaleObjectException e) { catchErrors(e,e.toString(), SystemLogLevel.ERROR); return false; } } engine.close(DialogResult.OK); //WDEV-18856 if (form.getGlobalContext().Core.getPatientDocumentsCollectionForClinicalReferral() == null) { form.getGlobalContext().Core.setPatientDocumentsCollectionForClinicalReferral( new PatientDocumentVoCollection()); } form.getGlobalContext().Core.getPatientDocumentsCollectionForClinicalReferral().add(form.getGlobalContext().Core.getPatientDocument()); return true; } return false; }
private boolean saveDocAtReferralLevel(PatientDocumentVo vo) { hasGPLetter = false; CatsReferralWizardVo catReferral = null; if (form.getGlobalContext().RefMan.getCatsReferralIsNotNull()) { catReferral = domain.getCatsReferral(form.getGlobalContext().RefMan.getCatsReferral()); } if (catReferral == null) return false; if (catReferral.getHasReferralLetter() == null || (catReferral.getHasReferralLetter() != null && catReferral.getHasReferralLetter() == false)) { if (form.cmbSource().getValue() != null) { if (form.cmbSource().getValue().equals(DocumentCategory.GPLETTER)) { hasGPLetter = true; catReferral.setHasReferralLetter(Boolean.TRUE);//wdev-10222 if(catReferral.getCurrentStatusIsNotNull() && catReferral.getCurrentStatus().getReferralStatusIsNotNull() && catReferral.getCurrentStatus().getReferralStatus().equals(ReferralApptStatus.REFERRAL_RECEIVED)) setCatsReferralStatus(catReferral); //WDEV-19330 if (catReferral.getReferralDetailsIsNotNull() && !catReferral.getReferralDetails().getDateReferralReceivedIsNotNull()) catReferral.getReferralDetails().setDateReferralReceived(new Date()); } } } if (catReferral.getHasDocumentsIsNotNull()) { if (catReferral.getHasDocuments().equals(Boolean.FALSE)) { if (form.cmbSource().getValue() != null) { if (!form.cmbSource().getValue().equals(DocumentCategory.GPLETTER)) { catReferral.setHasDocuments(Boolean.TRUE); } } } } else { if (form.cmbSource().getValue() != null) { if (!form.cmbSource().getValue().equals(DocumentCategory.GPLETTER)) { catReferral.setHasDocuments(Boolean.TRUE); } } } try { PatientDocumentSaveVo voSave = domain.savePatientDocument(vo, catReferral, form.getGlobalContext().RefMan.getCatsReferralIsNotNull() ? form.getGlobalContext().RefMan.getCatsReferral() : null ); form.getGlobalContext().Core.setPatientDocument(voSave.getPatientDocumentVo()); form.getGlobalContext().RefMan.setCatsReferralWizard(voSave.getCatsReferralWizardVo()); if (!hasGPLetter) { form.getGlobalContext().RefMan.setCatsReferralHasGpLetter(Boolean.FALSE); } else form.getGlobalContext().RefMan.setCatsReferralHasGpLetter(Boolean.TRUE); } catch (StaleObjectException e) { catchErrors(e,e.toString(), SystemLogLevel.ERROR); return false; } return true; }
private boolean saveDocAtReferralLevel(PatientDocumentVo vo) { hasGPLetter = false; CatsReferralWizardVo catReferral = null; if (form.getGlobalContext().CareUk.getCatsReferralIsNotNull()) { catReferral = domain.getCatsReferral(form.getGlobalContext().CareUk.getCatsReferral()); } if (catReferral == null) return false; if (catReferral.getHasReferralLetter() == null || (catReferral.getHasReferralLetter() != null && catReferral.getHasReferralLetter() == false)) { if (form.cmbSource().getValue() != null) { if (form.cmbSource().getValue().equals(DocumentCategory.GPLETTER)) { hasGPLetter = true; catReferral.setHasReferralLetter(Boolean.TRUE);//wdev-10222 if(catReferral.getCurrentStatusIsNotNull() && catReferral.getCurrentStatus().getReferralStatusIsNotNull() && catReferral.getCurrentStatus().getReferralStatus().equals(ReferralApptStatus.REFERRAL_RECEIVED)) setCatsReferralStatus(catReferral); } } } if (catReferral.getHasDocumentsIsNotNull()) { if (catReferral.getHasDocuments().equals(Boolean.FALSE)) { if (form.cmbSource().getValue() != null) { if (!form.cmbSource().getValue().equals(DocumentCategory.GPLETTER)) { catReferral.setHasDocuments(Boolean.TRUE); } } } } else { if (form.cmbSource().getValue() != null) { if (!form.cmbSource().getValue().equals(DocumentCategory.GPLETTER)) { catReferral.setHasDocuments(Boolean.TRUE); } } } try { PatientDocumentSaveVo voSave = domain.savePatientDocument(vo, catReferral, form.getGlobalContext().CareUk.getCatsReferralIsNotNull() ? form.getGlobalContext().CareUk.getCatsReferral() : null ); form.getGlobalContext().Core.setPatientDocument(voSave.getPatientDocumentVo()); form.getGlobalContext().CareUk.setCatsReferralWizard(voSave.getCatsReferralWizardVo()); if (!hasGPLetter) { form.getGlobalContext().CareUk.setCatsReferralHasGpLetter(Boolean.FALSE); } else form.getGlobalContext().CareUk.setCatsReferralHasGpLetter(Boolean.TRUE); } catch (StaleObjectException e) { catchErrors(e.toString(), SystemLogLevel.ERROR); return false; } return true; }