}
@Override
protected void buildPatientInfo(Analysis analysis) throws DocumentException {
Patient patient = analysis.getPatient();
Chunk pat = new Chunk(EntityDescriptions.PATIENT + ": " + patient.getFullName());
pat.setFont(new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD));
this.document.add(pat);
this.document.add(Chunk.NEWLINE);
this.document.add(Chunk.NEWLINE);
Medic medic = analysis.getMedic();
if (medic != null) {
Chunk med = new Chunk(ReportTexts.request_by + medic.getFullName());
med.setFont(new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD));
this.document.add(med);
this.writeEmptyLine();
}
int amount = this.getAmountOfData();
if (amount > 0) {
PdfPTable patientTable = new PdfPTable(amount);
patientTable.setWidthPercentage(90);
Font title = new Font(this.fontMapper.awtToPdf(this.reportSettingsProperties.loadDataFont()));
Font value = new Font(this.fontMapper.awtToPdf(this.reportSettingsProperties.loadDataValueFont()));
// PUT HEADERS
if (this.reportSettingsProperties.loadUseAge()) {
Chunk a = new Chunk("Edad");
a.setFont(title);
PdfPCell ages = new PdfPCell(new Paragraph(a));
ages.setHorizontalAlignment(Element.ALIGN_CENTER);
ages.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(ages);
}
if (this.reportSettingsProperties.loadUseWeight()) {
Chunk p = new Chunk("Peso" + System.getProperty("line.separator") + Units.kilograms);
p.setFont(title);
PdfPCell weight = new PdfPCell(new Paragraph(p));
weight.setHorizontalAlignment(Element.ALIGN_CENTER);
weight.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(weight);
}
if (this.reportSettingsProperties.loadUseHeight()) {
Chunk h = new Chunk("Altura" + System.getProperty("line.separator") + Units.Centimetres);
h.setFont(title);
PdfPCell height = new PdfPCell(new Paragraph(h));
height.setHorizontalAlignment(Element.ALIGN_CENTER);
height.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(height);
}
if (this.reportSettingsProperties.loadUsePS()) {
Chunk pss = new Chunk("PS" + System.getProperty("line.separator") + Units.pressure);
pss.setFont(title);
PdfPCell ps = new PdfPCell(new Paragraph(pss));
ps.setHorizontalAlignment(Element.ALIGN_CENTER);
ps.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(ps);
}
if (this.reportSettingsProperties.loadUsePD()) {
Chunk pdd = new Chunk("PD" + System.getProperty("line.separator") + Units.pressure);
pdd.setFont(title);
PdfPCell pd = new PdfPCell(new Paragraph(pdd));
pd.setHorizontalAlignment(Element.ALIGN_CENTER);
pd.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(pd);
}
if (this.reportSettingsProperties.loadUseSmoke()) {
Chunk sm = new Chunk("Fuma");
sm.setFont(title);
PdfPCell smooke = new PdfPCell(new Paragraph(sm));
smooke.setHorizontalAlignment(Element.ALIGN_CENTER);
smooke.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(smooke);
}
// PUT DATA
if (this.reportSettingsProperties.loadUseAge()) {
Chunk years = new Chunk(patient.getAge().toString());
years.setFont(value);
PdfPCell agesValue = new PdfPCell(new Paragraph(years));
agesValue.setHorizontalAlignment(Element.ALIGN_CENTER);
agesValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(agesValue);
}
if (this.reportSettingsProperties.loadUseWeight()) {
Chunk weightP = new Chunk(analysis.getClinicalInformation().getWeightAsString(false));
weightP.setFont(value);
PdfPCell weightValue = new PdfPCell(new Paragraph(weightP));
weightValue.setHorizontalAlignment(Element.ALIGN_CENTER);
weightValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(weightValue);
}
if (this.reportSettingsProperties.loadUseHeight()) {
Chunk heightP = new Chunk(analysis.getClinicalInformation().getHeightAsString(false));
heightP.setFont(value);
PdfPCell heightValue = new PdfPCell(new Paragraph(heightP));
heightValue.setHorizontalAlignment(Element.ALIGN_CENTER);
heightValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(heightValue);
}
if (this.reportSettingsProperties.loadUsePS()) {
Chunk psCk = new Chunk(analysis.getClinicalInformation().getSystolicPressureAsString(false));
psCk.setFont(value);
PdfPCell psValue = new PdfPCell(new Paragraph(psCk));
psValue.setHorizontalAlignment(Element.ALIGN_CENTER);
psValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(psValue);
}
if (this.reportSettingsProperties.loadUsePD()) {
Chunk pdCk = new Chunk(analysis.getClinicalInformation().getDiastolicPressureAsString(false));
pdCk.setFont(value);
PdfPCell pdValue = new PdfPCell(new Paragraph(pdCk));
pdValue.setHorizontalAlignment(Element.ALIGN_CENTER);
pdValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(pdValue);
}
if (this.reportSettingsProperties.loadUseSmoke()) {
Chunk smk = new Chunk(patient.getClinicalHistoryProxy().getIsSmoker());
smk.setFont(value);
PdfPCell smookeValue = new PdfPCell(new Paragraph(smk));
smookeValue.setHorizontalAlignment(Element.ALIGN_CENTER);
smookeValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
patientTable.addCell(smookeValue);