private void updateDocumentStatus(DocumentStatus value) { if (value.equals(DocumentStatus.SUPLEMENTRY)) { CorrespondenceDetailsVo voCorrespondenceDetails = form.getLocalContext().getcorrespondenceDetails(); DocumentVo nuDoc = new DocumentVo(); nuDoc.setTemplate(form.getGlobalContext().Correspondence.getReportTemplate()); nuDoc.setPatient(form.getGlobalContext().Core.getPatientShort()); nuDoc.setStatus(DocumentStatus.GENNOTPRINTED); nuDoc.setContent(voCorrespondenceDetails.getCurrentDocument().getContent()); nuDoc.setCreationDate(new Date()); voCorrespondenceDetails.setCurrentDocument(nuDoc); voCorrespondenceDetails.setCurrentStatus(DocumentStatus.GENNOTPRINTED); form.getLocalContext().setcorrespondenceDetails(voCorrespondenceDetails); form.getLocalContext().getcorrespondenceDetails(); } else { form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().setStatus(value); } }
private void initializeCorrespondenceDetails(MemberOfStaffShortVo voMos) { if (null == voMos) { m_strError = "Member of Staff details not supplied."; m_CorrespondenceDetails = null; } //Set PasEventVo m_CorrespondenceDetails.setPasEvent(m_PasEvent); CorrespondenceStatusHistoryVoCollection voCollStatusHistory = new CorrespondenceStatusHistoryVoCollection(); CorrespondenceStatusHistoryVo voStatusHistory = new CorrespondenceStatusHistoryVo(); voStatusHistory.setStatus(DocumentStatus.LETTERREQUIRED); voStatusHistory.setTemplateName(StatusHelper.getGenericTemplateName()); voStatusHistory.setMos(voMos);//wdev-2677 voCollStatusHistory.add(voStatusHistory); m_CorrespondenceDetails.setCspStatusHistory(voCollStatusHistory); //Initialise the current document DocumentVo voCurrentDocument = new DocumentVo(); voCurrentDocument.setStatus(DocumentStatus.LETTERREQUIRED); voCurrentDocument.setPatient(m_PasEvent.getPatient()); //TODO Review voCurrentDocument.setClinicalContact(null); m_CorrespondenceDetails.setCurrentDocument(voCurrentDocument); }
public DocumentVo getCurrentDocument(CorrespondenceDetailsRefVo voRefCorrespondenceDetail) { if (voRefCorrespondenceDetail == null) throw new CodingRuntimeException("Mandatory Argument - Correspondence Details Required"); CorrespondenceDetails cspDet = (CorrespondenceDetails)getDomainImpl(CorrespondenceDetailsImpl.class); return cspDet.getCurrentDocument(voRefCorrespondenceDetail); }
public DocumentVo getCurrentDocument(CorrespondenceDetailsRefVo voRefCorrecpondenceDetail) { if (voRefCorrecpondenceDetail == null) throw new CodingRuntimeException("Mandatory Argument - Correspondence Details Required"); CorrespondenceDetailsVo voCorrDet = getCorrespondenceDetails(voRefCorrecpondenceDetail); return voCorrDet.getCurrentDocument(); }
private void eMailCorrespondence() { if (null == form.getLocalContext().getcorrespondenceDetails() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent().getBytes()) { engine.showMessage("Error retrieving document content."); return; } // get email account information for logged in user UserEmailAccountVo emailAuthor = domain.getEmailAppUser(engine.getLoggedInUser().getUserId()); if (emailAuthor == null || emailAuthor.getEmailAddress() == null || emailAuthor.getEmailAddress().length() == 0) { engine.showMessage("Logged in users email address is not configured. Please add Email communication channel to your account."); return; } StringBuffer sRecipientsNoEmail = new StringBuffer(); if (form.getLocalContext().getcorrespondenceDetailsIsNotNull() && form.getLocalContext().getcorrespondenceDetails().getRecipientsIsNotNull()) { DocumentVo voDoc = new DocumentVo(); voDoc.setID_Document(form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getID_Document()); voDoc = domain.getDocument(voDoc); if (null == voDoc) return; AttachmentHelper correspondenceDocument = new AttachmentHelper(voDoc, engine.getSessionId(), "DischargeLetter_" + String.valueOf(voDoc.getID_Document()) + ".pdf"); StringBuffer emailAddresses = new StringBuffer(); try { String noEmailAddresses = form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientsWithNoEmail(); if (noEmailAddresses != null) { engine.showMessage("The following recipients do not have email addresses\n\n" + sRecipientsNoEmail); // TODO give an option to continue? return; } EmailHelper emailCorresp = new EmailHelper(emailAuthor, emailAuthor); if (form.getLocalContext().getcorrespondenceDetails().getRecipients() != null && form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientlistItems().length > 0) { emailCorresp.addRecipients(form.getLocalContext().getcorrespondenceDetails().getRecipients()); emailCorresp.setAttach(correspondenceDocument); emailCorresp.setSubject("Correspondence Reference : " + form.getLocalContext().getcorrespondenceDetails().getID_CorrespondenceDetails().toString()); emailCorresp.sendEmail(); } engine.showMessage("The discharge letter has been emailed to\n\n" + emailAddresses); } catch (MessagingException me) { engine.showMessage(me.getMessage()); } catch (SecurityException se) { engine.showMessage(se.getMessage()); } } }
protected void onBtnPrintClick() throws ims.framework.exceptions.PresentationLogicException { if ((form.cmbHeadedPaper().getValue() == null) && (form.cmbStandard().getValue() == null)) { engine.showMessage("Please select at least one printer."); return; } String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue(); String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue(); if(form.getGlobalContext().Core.getDocumentIDIsNotNull()) { QueryBuilderClient client = new QueryBuilderClient(urlQueryServer,engine.getSessionId()); //Get Document if (form.getGlobalContext().Core.getDocumentIDIsNotNull()) { DocumentVo voDoc = new DocumentVo(); voDoc.setID_Document(form.getGlobalContext().Core.getDocumentID()); voDoc = domain.getDocument(voDoc); try { if (form.cmbHeadedPaper().getValue() != null) { if (form.intHeaded().getValue() != null) client.printReport(voDoc.getContent().getBytes(),urlReportServer,form.cmbHeadedPaper().getValue(),form.intHeaded().getValue().intValue()); else { engine.showMessage("Please enter number of copiesm for Headed paper."); return; } } if (form.cmbStandard().getValue() != null) { if (form.intStandard().getValue() != null) client.printReport(voDoc.getContent().getBytes(),urlReportServer,form.cmbStandard().getValue(),form.intStandard().getValue().intValue()); else { engine.showMessage("Please enter number of copiesm for Standard paper."); return; } } engine.close(DialogResult.OK); } catch (QueryBuilderClientException e1) { engine.showMessage("Error preparing letter to print: " + e1.getMessage()); return; } } return; } }
private void eMailCorrespondence() { if (null == form.getLocalContext().getcorrespondenceDetails() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent() || null == form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getContent().getBytes()) { engine.showMessage("Error retrieving document content."); return; } // get email account information for logged in user UserEmailAccountVo emailAuthor = domain.getEmailAppUser(engine.getLoggedInUser().getUserId()); if (emailAuthor == null || emailAuthor.getEmailAddress() == null || emailAuthor.getEmailAddress().length() == 0) { engine.showMessage("Logged in users email address is not configured. Please add Email communication channel to your account."); return; } StringBuffer sRecipientsNoEmail = new StringBuffer(); if (form.getLocalContext().getcorrespondenceDetailsIsNotNull() && form.getLocalContext().getcorrespondenceDetails().getRecipientsIsNotNull()) { DocumentVo voDoc = new DocumentVo(); voDoc.setID_Document(form.getLocalContext().getcorrespondenceDetails().getCurrentDocument().getID_Document()); voDoc = domain.getDocument(voDoc); if (null == voDoc) return; AttachmentHelper correspondenceDocument = new AttachmentHelper(voDoc, engine.getSessionId(), "DischargeLetter_" + String.valueOf(voDoc.getID_Document()) + ".pdf"); StringBuffer emailAddresses = new StringBuffer(); try { String noEmailAddresses = form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientsWithNoEmail(); if (noEmailAddresses != null) { engine.showMessage("The following recipients do not have email addresses\n\n" + sRecipientsNoEmail); return; } EmailHelper emailCorresp = new EmailHelper(emailAuthor, emailAuthor); if (form.getLocalContext().getcorrespondenceDetails().getRecipients() != null && form.getLocalContext().getcorrespondenceDetails().getRecipients().getIRecipientlistItems().length > 0) { emailCorresp.addRecipients(form.getLocalContext().getcorrespondenceDetails().getRecipients()); emailCorresp.setAttach(correspondenceDocument); emailCorresp.setSubject("Correspondence Reference : " + form.getLocalContext().getcorrespondenceDetails().getID_CorrespondenceDetails().toString()); emailCorresp.sendEmail(); } engine.showMessage("The discharge letter has been emailed to\n\n" + emailAddresses); } catch (MessagingException me) { engine.showMessage(me.getMessage()); } catch (SecurityException se) { engine.showMessage(se.getMessage()); } } }
private void previewDoc() { String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue(); String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue(); if (urlQueryServer == null || urlQueryServer.length() == 0) { form.getGlobalContext().Correspondence.setCorrespondencePreviewUrl("<center>The <b>QUERY_SERVER_URL</b> config flag was not set !</center>"); return; } if (urlReportServer == null || urlReportServer.length() == 0) { form.getGlobalContext().Correspondence.setCorrespondencePreviewUrl("<center>The <b>REPORT_SERVER_URL</b> config flag was not set !</center>"); return; } if (form.getGlobalContext().Core.getDocumentIDIsNotNull()) { QueryBuilderClient client = new QueryBuilderClient(urlQueryServer, engine.getSessionId()); // Get Document if (form.getGlobalContext().Core.getDocumentIDIsNotNull()) { DocumentVo voDoc = new DocumentVo(); voDoc.setID_Document(form.getGlobalContext().Core.getDocumentID()); voDoc = domain.getDocument(voDoc); if (null == voDoc) return; String resultUrl = ""; byte[] resultPdf = null; try { if (voDoc.getContentIsNotNull()) { resultPdf = client.convertReport(urlReportServer, voDoc.getContent().getBytes(), "PDF", "", 1); resultUrl = client.prepareReportForViewingInlineFrame(resultPdf, "PDF"); form.getGlobalContext().Correspondence.setCorrespondencePreviewUrl(resultUrl); return; } else { engine.showMessage("No Document Content found for report.: "); return; } } catch (QueryBuilderClientException e1) { engine.showMessage("Error preparing report: " + e1.getMessage()); return; } } return; } form.getGlobalContext().Correspondence.setCorrespondencePreviewUrl("<center>No report to build or view, you have not passed down the right parameters !</center>"); }
protected void onFormOpen() throws ims.framework.exceptions.FormOpenException { String urlQueryServer = ConfigFlag.GEN.QUERY_SERVER_URL.getValue(); String urlReportServer = ConfigFlag.GEN.REPORT_SERVER_URL.getValue(); if(urlQueryServer == null || urlQueryServer.length() == 0) { form.htmViewer().setHTML("<center>The <b>QUERY_SERVER_URL</b> config flag was not set !</center>"); return; } if(urlReportServer == null || urlReportServer.length() == 0) { form.htmViewer().setHTML("<center>The <b>REPORT_SERVER_URL</b> config flag was not set !</center>"); return; } if(form.getGlobalContext().Core.getDocumentIDIsNotNull()) { QueryBuilderClient client = new QueryBuilderClient(urlQueryServer,engine.getSessionId()); //Get Document if (form.getGlobalContext().Core.getDocumentIDIsNotNull()) { DocumentVo voDoc = new DocumentVo(); voDoc.setID_Document(form.getGlobalContext().Core.getDocumentID()); voDoc = domain.getDocument(voDoc); if (null == voDoc) return; String resultUrl = ""; byte[] resultPdf = null; try { if (voDoc.getContentIsNotNull()) { resultPdf = client.convertReport(urlReportServer,voDoc.getContent().getBytes(),"PDF","",1); resultUrl = client.prepareReportForViewingInlineFrame(resultPdf,"PDF"); form.htmViewer().setHTML(resultUrl); return; } else { engine.showMessage("No Document Content found for report.: "); return; } } catch (QueryBuilderClientException e1) { engine.showMessage("Error preparing report: " + e1.getMessage()); return; } } return; } form.htmViewer().setHTML("<center>No report to build or view, you have not passed down the right parameters !</center>"); /*if(form.getGlobalContext().Core.getReportIDIsNotNull() && form.getGlobalContext().Core.getTemplateIDIsNotNull()) { form.htmViewer().setHTML((new QueryBuilderClient(urlQueryServer,engine.getSessionId())).getWaitUrl()); return; }*/ //we should not get here }
protected void listDocuments() { if (form.getGlobalContext().Core.getPatientShortIsNotNull()) { DocumentVoCollection voDocColl = domain.listPatientDocs(form.getGlobalContext().Core.getPatientShort()); if (voDocColl != null) { if (voDocColl.size()>0) { for(int i=0;i<voDocColl.size();i++) { DocumentVo voDoc = new DocumentVo(); voDoc = voDocColl.get(i); //add new row GenForm.grdDocumentsRow row; row = form.grdDocuments().getRows().newRow(); row.setValue(voDoc); if (voDoc.getCreationDateIsNotNull()) row.setDate(voDoc.getCreationDate()); if (voDoc.getTemplateIsNotNull() && voDoc.getTemplate().getDescriptionIsNotNull()) row.setDescription(voDoc.getTemplate().getDescription()); if (voDoc.getClinicalContactIsNotNull()) { if (voDoc.getClinicalContact().getSeenByIsNotNull()) row.setConsultant(voDoc.getClinicalContact().getSeenBy().getName().toString()); if (voDoc.getClinicalContact().getStartDateTimeIsNotNull()) row.setDiscDate(voDoc.getClinicalContact().getStartDateTimeIsNotNull()?voDoc.getClinicalContact().getStartDateTime().getDate():null); } if (voDoc.getPasEventIsNotNull()) row.setContactNo(voDoc.getPasEvent().getPasEventId()); if (voDoc.getRecUserIsNotNull()) row.setRecordingUser(voDoc.getRecUser().toString()); if (voDoc.getStatusIsNotNull()) row.setStatus(voDoc.getStatus().getText()); } } } } }
public AttachmentHelper(DocumentVo vo,String sessionId,String filename) { this.voDoc = vo; this.sessionId = sessionId; this.setFileName(filename); }
public DocumentVo getDocument(DocumentVo voDocFilter) { DomainFactory factory = getDomainFactory(); Document domDoc = (Document) factory.getDomainObject(Document.class, voDocFilter.getID_Document()); return DocumentVoAssembler.create(domDoc); }
public DocumentVo getDocument(DocumentVo filter) { ProcessReport impl = (ProcessReport) getDomainImpl(ProcessReportImpl.class); return impl.getDocument(filter); }