List of usage examples for com.lowagie.text Phrase add
public boolean add(Object o)
Chunk
, Anchor
or another Phrase
to this Phrase
. From source file:org.mapfish.print.PDFUtils.java
License:Open Source License
/** * Create a PDF table cell with support for styling using the {@link org.mapfish.print.config.layout.CellConfig} stuff. *//*from w w w.ja v a 2 s . co m*/ public static PdfPCell createCell(final PJsonObject params, final RenderingContext context, final Block block, final int row, final int col, final int nbRows, final int nbCols, final TableConfig tableConfig) throws DocumentException { final PdfPCell[] cell = new PdfPCell[1]; block.render(params, new Block.PdfElement() { public void add(Element element) throws DocumentException { if (element instanceof PdfPTable) { cell[0] = new PdfPCell((PdfPTable) element); } else { final Phrase phrase = new Phrase(); phrase.add(element); cell[0] = new PdfPCell(phrase); } cell[0].setBorder(PdfPCell.NO_BORDER); cell[0].setPadding(0); if (tableConfig != null) { tableConfig.apply(cell[0], row, col, nbRows, nbCols, context, params); } if (block.getAlign() != null) { cell[0].setHorizontalAlignment(block.getAlign().getCode()); } if (block.getVertAlign() != null) { cell[0].setVerticalAlignment(block.getVertAlign().getCode()); } if (!(block instanceof MapBlock) && !(block instanceof ScalebarBlock) && block.getBackgroundColorVal(context, params) != null) { cell[0].setBackgroundColor(block.getBackgroundColorVal(context, params)); } } }, context); return cell[0]; }
From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java
License:Open Source License
public void printMasterRecord() throws DocumentException { if (newPage) { document.newPage();//from www .j ava 2s. c o m newPage = false; } Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Paragraph p = null; Phrase phrase = null; p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); phrase = new Phrase(LEADING, "Patient Information", boldFont); phrase.add("\n"); p.add(phrase); document.add(p); p = new Paragraph(); phrase = new Phrase(LEADING, "", font); phrase.add("Title: " + demographic.getTitle() + "\n"); phrase.add("Last Name: " + demographic.getLastName() + "\n"); phrase.add("First Name: " + demographic.getFirstName() + "\n"); phrase.add("Gender: " + demographic.getSex() + "\n"); phrase.add("Date of Birth: " + demographic.getFormattedDob() + "\n"); phrase.add("Offical Language: " + demographic.getOfficialLanguage() + "\n"); phrase.add("Spoken Language: " + demographic.getSpokenLanguage() + "\n"); phrase.add("\n"); p.add(phrase); document.add(p); p = new Paragraph(); phrase = new Phrase(LEADING, "", font); phrase.add("Roster Status: " + demographic.getRosterStatus() + "\n"); phrase.add("Date Rostered: " + "\n"); phrase.add("Patient Status: " + demographic.getPatientStatus() + "\n"); phrase.add("Chart No (MRN): " + demographic.getChartNo() + "\n"); if (demographic.getDateJoined() != null) { phrase.add("Date Joined: " + formatter.format(demographic.getDateJoined()) + "\n"); } if (demographic.getEndDate() != null) { phrase.add("End Date: " + formatter.format(demographic.getEndDate()) + "\n"); } phrase.add("\n"); p.add(phrase); document.add(p); p = new Paragraph(); phrase = new Phrase(LEADING, "", font); phrase.add("Address: " + demographic.getAddress() + "\n"); phrase.add("City: " + demographic.getCity() + "\n"); phrase.add("Province: " + demographic.getProvince() + "\n"); phrase.add("Postal Code: " + demographic.getPostal() + "\n"); phrase.add("Email: " + demographic.getEmail() + "\n"); phrase.add("Phone: " + demographic.getPhone() + "\n"); List<DemographicExt> exts = demographicExtDao .getDemographicExtByDemographicNo(demographic.getDemographicNo()); String phoneExt = null; String cell = null; for (DemographicExt ext : exts) { if (ext.getKey().equals("wPhoneExt")) { phoneExt = ext.getValue(); } if (ext.getKey().equals("demo_cell")) { cell = ext.getValue(); } } phrase.add("Work Phone: " + demographic.getPhone2()); if (phoneExt != null) { phrase.add(" ext:" + phoneExt + "\n"); } else { phrase.add("\n"); } if (cell != null) { phrase.add("Cell Phone: " + cell + "\n"); } phrase.add("\n"); p.add(phrase); document.add(p); p = new Paragraph(); phrase = new Phrase(LEADING, "", font); phrase.add("Health Insurance #: " + demographic.getHin() + "\n"); phrase.add("HC Type: " + demographic.getHcType() + "\n"); if (demographic.getEffDate() != null) { phrase.add("Eff Date: " + formatter.format(demographic.getEffDate()) + "\n"); } phrase.add("\n"); p.add(phrase); document.add(p); DemographicCust demographicCust = demographicCustDao.find(demographic.getDemographicNo()); p = new Paragraph(); phrase = new Phrase(LEADING, "", font); phrase.add("Physician: " + getProviderName(demographic.getProviderNo()) + "\n"); if (demographicCust != null) { phrase.add("Nurse: " + getProviderName(demographicCust.getNurse()) + "\n"); phrase.add("Midwife: " + getProviderName(demographicCust.getMidwife()) + "\n"); phrase.add("Resident: " + getProviderName(demographicCust.getResident()) + "\n"); } phrase.add("Referral Doctor: " + getReferralDoctor(demographic.getFamilyDoctor()) + "\n"); phrase.add("\n"); p.add(phrase); document.add(p); p = new Paragraph(); phrase = new Phrase(LEADING, "", font); //alerts & notes if (demographicCust != null) { phrase.add("Alerts: " + demographicCust.getAlert() + "\n"); if (demographicCust.getNotes().length() > 0) { phrase.add("Notes: " + SxmlMisc.getXmlContent(demographicCust.getNotes(), "unotes") + "\n"); } } phrase.add("\n"); p.add(phrase); document.add(p); //relationships p = new Paragraph(); phrase = new Phrase(LEADING, "", font); DemographicRelationship demoRel = new DemographicRelationship(); @SuppressWarnings("unchecked") ArrayList<HashMap<String, String>> demoR = demoRel .getDemographicRelationships(String.valueOf(demographic.getDemographicNo())); for (int j = 0; j < demoR.size(); j++) { HashMap<String, String> r = demoR.get(j); String relationDemographicNo = r.get("demographic_no"); Demographic relationDemographic = demographicDao .getClientByDemographicNo(Integer.parseInt(relationDemographicNo)); String relation = r.get("relation"); String subDecisionMaker = r.get("sub_decision_maker"); String emergencyContact = r.get("emergency_contact"); String notes = r.get("notes"); phrase.add(relation + " - " + relationDemographic.getFormattedName() + " - " + subDecisionMaker + " - " + emergencyContact + " - " + notes + "\n"); } phrase.add("\n"); p.add(phrase); document.add(p); }
From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java
License:Open Source License
public void printNotes(Collection<CaseManagementNote> notes, boolean compact) throws DocumentException { CaseManagementNote note;//from www. j a v a 2 s . co m Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Paragraph p; Phrase phrase; Chunk chunk; //if( newPage ) // document.newPage(); // else // newPage = true; //Print notes Iterator<CaseManagementNote> notesIter = notes.iterator(); while (notesIter.hasNext()) { note = notesIter.next(); p = new Paragraph(); //p.setSpacingBefore(font.leading(LINESPACING)*2f); phrase = new Phrase(LEADING, "", font); if (compact) { phrase.add(new Chunk(formatter.format(note.getObservation_date()) + ":")); } else { chunk = new Chunk("Impression/Plan: (" + formatter.format(note.getObservation_date()) + ")\n", obsfont); phrase.add(chunk); } if (compact) { phrase.add(note.getNote() + "\n"); } else { phrase.add(note.getNote() + "\n\n"); } p.add(phrase); document.add(p); } }
From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java
License:Open Source License
public void printAllergies(List<Allergy> allergies) throws DocumentException { ProviderDao providerDao = (ProviderDao) SpringUtils.getBean("providerDao"); /*/* ww w .j av a 2s .co m*/ if( getNewPage() ) getDocument().newPage(); else setNewPage(true); */ Font obsfont = new Font(getBaseFont(), FONTSIZE, Font.UNDERLINE); Paragraph p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); Phrase phrase = new Phrase(LEADING, "\n", getFont()); p.add(phrase); phrase = new Phrase(LEADING, "Allergies", obsfont); p.add(phrase); getDocument().add(p); for (Allergy allergy : allergies) { p = new Paragraph(); phrase = new Phrase(LEADING, "", getFont()); Chunk chunk = new Chunk(allergy.getDescription()); phrase.add(chunk); p.add(phrase); getDocument().add(p); } getDocument().add(new Phrase("\n", getFont())); }
From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java
License:Open Source License
public void printRx(String demoNo, List<CaseManagementNote> cpp) throws DocumentException { if (demoNo == null) return;/* www .j a v a 2 s .co m*/ /* if( newPage ) document.newPage(); else newPage = true; */ oscar.oscarRx.data.RxPrescriptionData prescriptData = new oscar.oscarRx.data.RxPrescriptionData(); oscar.oscarRx.data.RxPrescriptionData.Prescription[] arr = {}; arr = prescriptData.getUniquePrescriptionsByPatient(Integer.parseInt(demoNo)); if (arr.length == 0) { return; } Paragraph p = new Paragraph(); Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Phrase phrase = new Phrase(LEADING, "", obsfont); p.setAlignment(Paragraph.ALIGN_LEFT); phrase.add("Prescriptions"); p.add(phrase); document.add(p); Font normal = new Font(bf, FONTSIZE, Font.NORMAL); Font curFont; for (int idx = 0; idx < arr.length; ++idx) { oscar.oscarRx.data.RxPrescriptionData.Prescription drug = arr[idx]; p = new Paragraph(); p.setAlignment(Paragraph.ALIGN_LEFT); if (drug.isCurrent() && !drug.isArchived()) { curFont = normal; phrase = new Phrase(LEADING, "", curFont); phrase.add(formatter.format(drug.getRxDate()) + " - "); phrase.add(drug.getFullOutLine().replaceAll(";", " ")); p.add(phrase); document.add(p); } } }
From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java
License:Open Source License
public void printPreventions() throws DocumentException { List<Prevention> preventions = preventionDao.findNotDeletedByDemographicId(demographic.getDemographicNo()); if (preventions.size() == 0) { return;/*from www.j a va 2s . c o m*/ } Paragraph p = new Paragraph(); Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Phrase phrase = new Phrase(LEADING, "", obsfont); p.setAlignment(Paragraph.ALIGN_LEFT); phrase.add("Preventions"); p.add(phrase); document.add(p); for (Prevention prevention : preventions) { String type = prevention.getPreventionType(); Date date = prevention.getPreventionDate(); p = new Paragraph(); phrase = new Phrase(LEADING, "", getFont()); Chunk chunk = new Chunk(type + " " + formatter.format(date) + "\n"); phrase.add(chunk); p.add(phrase); getDocument().add(p); } }
From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java
License:Open Source License
public void printTicklers() throws DocumentException { TicklerDAO ticklerDao = (TicklerDAO) SpringUtils.getBean("ticklerDAOT"); CustomFilter filter = new CustomFilter(); filter.setDemographic_no(String.valueOf(demographic.getDemographicNo())); List<Tickler> ticklers = ticklerDao.getTicklers(filter); if (ticklers.size() == 0) { return;// w w w .j av a2 s. c o m } Paragraph p = new Paragraph(); Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Phrase phrase = new Phrase(LEADING, "", obsfont); p.setAlignment(Paragraph.ALIGN_LEFT); phrase.add("Ticklers"); p.add(phrase); document.add(p); for (Tickler tickler : ticklers) { String providerName = tickler.getProvider().getFormattedName(); String assigneeName = tickler.getAssignee().getFormattedName(); String serviceDate = tickler.getServiceDate(); String priority = tickler.getPriority(); char status = tickler.getStatus(); String message = tickler.getMessage(); p = new Paragraph(); phrase = new Phrase(LEADING, "", getFont()); Chunk chunk = new Chunk("Provider:" + providerName + "\n"); phrase.add(chunk); chunk = new Chunk("Assignee:" + assigneeName + "\n"); phrase.add(chunk); chunk = new Chunk("Service Date:" + serviceDate + "\n"); phrase.add(chunk); chunk = new Chunk("Priority:" + priority + "\n"); phrase.add(chunk); chunk = new Chunk("Status:" + status + "\n"); phrase.add(chunk); chunk = new Chunk("Message:" + message + "\n\n"); phrase.add(chunk); p.add(phrase); getDocument().add(p); } }
From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java
License:Open Source License
public void printDiseaseRegistry() throws DocumentException { DxresearchDAO dxDao = (DxresearchDAO) SpringUtils.getBean("DxresearchDAO"); IssueDAO issueDao = (IssueDAO) SpringUtils.getBean("IssueDAO"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); List<Dxresearch> dxs = dxDao.getDxResearchItemsByPatient(demographic.getDemographicNo()); if (dxs.size() == 0) { return;//from www .j a v a 2s . c om } Paragraph p = new Paragraph(); Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Phrase phrase = new Phrase(LEADING, "", obsfont); p.setAlignment(Paragraph.ALIGN_LEFT); phrase.add("Disease Registry"); p.add(phrase); document.add(p); for (Dxresearch dx : dxs) { String codingSystem = dx.getCodingSystem(); String code = dx.getDxresearchCode(); Date startDate = dx.getStartDate(); char status = dx.getStatus(); Issue issue = issueDao.findIssueByTypeAndCode(codingSystem, code); p = new Paragraph(); phrase = new Phrase(LEADING, "", getFont()); Chunk chunk = new Chunk("Start Date:" + formatter.format(startDate) + "\n"); phrase.add(chunk); if (issue != null) { chunk = new Chunk("Issue:" + issue.getDescription() + "\n"); phrase.add(chunk); } else { chunk = new Chunk("Issue: <Unknown>" + "\n"); phrase.add(chunk); } chunk = new Chunk("Status:" + status + "\n\n"); phrase.add(chunk); p.add(phrase); getDocument().add(p); } }
From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java
License:Open Source License
public void printCurrentAdmissions() throws DocumentException { AdmissionDao admissionDao = (AdmissionDao) SpringUtils.getBean("admissionDao"); ProgramDao programDao = (ProgramDao) SpringUtils.getBean("programDao"); List<Admission> admissions = admissionDao.getCurrentAdmissions(demographic.getDemographicNo()); if (admissions.size() == 0) { return;//from w ww. j a v a 2s .c om } Paragraph p = new Paragraph(); Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Phrase phrase = new Phrase(LEADING, "", obsfont); p.setAlignment(Paragraph.ALIGN_LEFT); phrase.add("Current Admissions"); p.add(phrase); document.add(p); for (Admission admission : admissions) { String admissionDate = admission.getAdmissionDate("yyyy-MM-dd"); String admissionNotes = admission.getAdmissionNotes(); String programName = programDao.getProgramName(admission.getProgramId()); String programType = admission.getProgramType(); String providerName = providerDao.getProvider(admission.getProviderNo()).getFormattedName(); p = new Paragraph(); phrase = new Phrase(LEADING, "", getFont()); Chunk chunk = new Chunk("Summary:" + programName + "(" + programType + ")" + " by " + providerName + " on " + admissionDate + "\n"); phrase.add(chunk); chunk = new Chunk("Admission Notes:" + admissionNotes + "\n\n"); phrase.add(chunk); p.add(phrase); getDocument().add(p); } }
From source file:org.oscarehr.casemgmt.print.OscarChartPrinter.java
License:Open Source License
public void printPastAdmissions() throws DocumentException { AdmissionDao admissionDao = (AdmissionDao) SpringUtils.getBean("admissionDao"); ProgramDao programDao = (ProgramDao) SpringUtils.getBean("programDao"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); List<Admission> admissions = admissionDao.getAdmissions(demographic.getDemographicNo()); admissions = filterOutCurrentAdmissions(admissions); if (admissions.size() == 0) { return;// w w w . ja va2 s . co m } Paragraph p = new Paragraph(); Font obsfont = new Font(bf, FONTSIZE, Font.UNDERLINE); Phrase phrase = new Phrase(LEADING, "", obsfont); p.setAlignment(Paragraph.ALIGN_LEFT); phrase.add("Past Admissions"); p.add(phrase); document.add(p); for (Admission admission : admissions) { String admissionDate = admission.getAdmissionDate("yyyy-MM-dd"); String admissionNotes = admission.getAdmissionNotes(); String programName = programDao.getProgramName(admission.getProgramId()); String programType = admission.getProgramType(); String providerName = providerDao.getProvider(admission.getProviderNo()).getFormattedName(); String dischargeDate = formatter.format(admission.getDischargeDate()); String dischargeNotes = admission.getDischargeNotes(); p = new Paragraph(); phrase = new Phrase(LEADING, "", getFont()); Chunk chunk = new Chunk("Summary:" + programName + "(" + programType + ")" + " by " + providerName + " on " + admissionDate + "\n"); phrase.add(chunk); chunk = new Chunk("Admission Notes:" + admissionNotes + "\n\n"); phrase.add(chunk); chunk = new Chunk("Discharged on " + dischargeDate + ", Notes:" + dischargeNotes + "\n\n"); phrase.add(chunk); p.add(phrase); getDocument().add(p); } }