private void countForRecords(PatientDocumentVoCollection list, TreeMap<String, Integer> map) { for(int i = 0; i < list.size(); i++) { String type = list.get(i).getCategory().getIItemText(); Integer count = (Integer) map.get(type); if(count == null) { count = new Integer(1); map.put(type, count); } else { map.put(type, new Integer(count.intValue() + 1)); } } }
private void doEndBatchPrint() { PatientDocumentVoCollection docs = form.getLocalContext().getContextDocumentsCreated(); if (docs == null || docs.size() == 0) { return; } PatientDocumentVoCollection docsForPrint = new PatientDocumentVoCollection(); for (int i = docs.size() - 1; i >= 0; i--) { PatientDocumentVo lockedPatientDoc = lockPatientDoc(docs.get(i)); if (lockedPatientDoc != null) { docs.remove(i); docsForPrint.add(lockedPatientDoc); } } if (docs.size() > 0) { form.getLocalContext().setContextDocumentsCreated(docsForPrint); showErrorsAndPrint(docs); return; } print(docsForPrint); form.getLocalContext().setContextDocumentsCreated(new PatientDocumentVoCollection()); }
private void print(PatientDocumentVoCollection docsForPrint) { if (docsForPrint == null) return; engine.open(form.getForms().Core.MultiPrintDialog, new Object[] { docsForPrint }); }
private void showErrorsAndPrint(PatientDocumentVoCollection docs) { if (docs == null) throw new CodingRuntimeException("Trying to show null errors "); StringBuilder errorMessage = new StringBuilder("Following documents could not be locked and will not be available for print:\n\n"); for (int i = 0; i < docs.size(); i++) { errorMessage.append("" + (i + 1) + ")" + docs.get(i).getName() + " created at: " + docs.get(i).getRecordingDateTime().toString() + "\n"); } engine.showMessage(errorMessage.toString(), "Errors locking documents", MessageButtons.OK, MessageIcon.ERROR); }
private void doStartBatchPrint() { if (form.grdList().getRows().size() < 1) { engine.showMessage("No patients to start batch print were found. Please do a search first"); return; } form.getLocalContext().setContextDocumentsCreated(new PatientDocumentVoCollection()); form.setMode(FormMode.EDIT); }
@Override protected void onFormDialogClosed(FormName formName, DialogResult result) throws PresentationLogicException { if (formName.equals(form.getForms().Core.PatientCorrespondenceTemplates) && DialogResult.OK.equals(result)) { if (!form.getLocalContext().getContextDocumentsCreatedIsNotNull()) { form.getLocalContext().setContextDocumentsCreated(new PatientDocumentVoCollection()); } form.getLocalContext().getContextDocumentsCreated().add(form.getGlobalContext().Core.getPatientCorrespondence()); form.grdList().getSelectedRow().setcolDocCreate(form.getImages().Correspondence.PatientDocumentCreated16); } }
@Override protected void onMessageBoxClosed(int messageBoxId, DialogResult result) throws PresentationLogicException { print(form.getLocalContext().getContextDocumentsCreated()); form.getLocalContext().setContextDocumentsCreated(new PatientDocumentVoCollection()); }
private void populateGrid(DocumentViewLevel level) { form.dyngrd().getRows().clear(); PatientDocumentVoCollection coll = null; TreeMap<String, Integer> map = new TreeMap<String, Integer>(); coll = domain.listPatientDocuments(form.getGlobalContext().Core.getPatientShort(), form.getGlobalContext().Core.getCurrentCareContext(), form.getLocalContext().getDocumentCategory(), form.getLocalContext().getCatsReferralRef(), level); if (coll!= null && coll.size() > 0) { countForRecords(coll, map); DynamicGridRow dynRow = null; for (Iterator<String> iter = map.keySet().iterator(); iter.hasNext();) { String element = (String) iter.next(); dynRow = addParentRow(map, element); for(int i = 0; i < coll.size(); i++) { if (coll.get(i).getCategory().getIItemText().equals(element)) { addRowRecord(coll, dynRow, i); if (level.equals(DocumentViewLevel.REFERRAL) && isGPLetterCategory && !isGPLetterSelected ) { dynRow.setExpanded(true); //form.dyngrd().setValue(coll.get(i)); //onDyngrdRowSelectionChanged(form.dyngrd().getSelectedRow()); isGPLetterSelected = true; } } } } } setSelectedInstance();//WDEV-13695 }
private void rollback(EDischargeSTHKSummaryVo summaryVo, PatientDocumentVo document, DocumentCategory category) throws ForeignKeyViolationException, StaleObjectException { DomainFactory factory = getDomainFactory(); Summary boSUMM = (Summary) factory.getDomainObject(Summary.class, summaryVo.getID_Summary()); summaryVo = EDischargeSTHKSummaryVoAssembler.create(boSUMM); PatientDocumentVoCollection documents = summaryVo.getDischargeDocuments(); documents.remove(document); summaryVo.setDischargeDocuments(documents); if (category.equals(DocumentCategory.DISCHARGE_SUMMARY)) summaryVo.setDischargeLetterStatus(DischargeLetterStatus.IN_PROGRESS); else if (category.equals(DocumentCategory.DISCHARGE_SUPPLEMENTARY)) summaryVo.setDischargeSupplementaryLetterStatus(DischargeSupplementaryLetterStatus.REQUIRED); String[] str = summaryVo.validate(); if (str != null && str.length > 0) { LOG.error("summaryVo is not validate"); return; } summaryVo = saveSummary(summaryVo); try { deletePatientDocument(document); } catch(Exception e) { throw new StaleObjectException(null); } getDomainFactory().getTransaction().commit(); getDomainFactory().setTransaction(null); }
private void displayPatientDocument(DischargeReportDetailVo dischargeReportDetails) { if (dischargeReportDetails != null && dischargeReportDetails.getDischargeDocumentsIsNotNull() && dischargeReportDetails.getDischargeDocuments().size() > 0) { PatientDocumentVoCollection documents = dischargeReportDetails.getDischargeDocuments().sort(SortOrder.DESCENDING); for (int i = 0; i < documents.size(); i++) { if (documents.get(i).getServerDocumentIsNotNull() && documents.get(i).getCategoryIsNotNull()) { if (documents.get(i).getCategory().equals(DocumentCategory.DISCHARGE_SUMMARY)) { if (documents.get(i).getServerDocumentIsNotNull() && documents.get(i).getServerDocument().getFileNameIsNotNull()) { form.htmPreview().setHTML("<IFRAME id=\"PostFrame\" name=\"PostFrame\" width=\"100%\" height=\"100%\" frameborder=0 src='" + ConfigFlag.GEN.FILE_SERVER_URL.getValue() + documents.get(i).getServerDocument().getFileName() + "'></IFRAME>"); form.getLocalContext().setReportURL("<IFRAME id=\"PostFrame\" name=\"PostFrame\" width=\"100%\" height=\"100%\" frameborder=0 src='" + ConfigFlag.GEN.FILE_SERVER_URL.getValue() + documents.get(i).getServerDocument().getFileName() + "'></IFRAME>"); break; } } } } } else { String url = buildReport(); form.htmPreview().setHTML("<p align='center'>" + url); form.getLocalContext().setReportURL("<p align='center'>" + url); } }
public PatientDocumentVoCollection getPatientDocumentsForPatient(PatientRefVo voRef) { if(voRef == null || voRef.getID_Patient() == null) throw new CodingRuntimeException("PatientRefVo is null or id not provided for getPatientDocumentsForPatient"); DomainFactory factory = getDomainFactory(); List domainObjectList = factory.find("select pd from PatientDocument as pd left join pd.patient as patient where patient.id = :idPatient", new String[]{"idPatient"}, new Object[]{voRef.getID_Patient()}); return PatientDocumentVoAssembler.createPatientDocumentVoCollectionFromPatientDocument(domainObjectList); }