protected void buildConclusions(Analysis analysis, Report report) throws DocumentException {
Font titleFont = new Font(fontMapper.awtToPdf(this.reportSettingsProperties.loadBodyTextTitleFont()));
Font textFont = new Font(fontMapper.awtToPdf(this.reportSettingsProperties.loadBodyTextFont()));
if ((report.getComments() != null) && (!report.getComments().isEmpty())) {
Chunk coment = new Chunk(EntityDescriptions.COMMENTS + ":" + System.getProperty("line.separator"));
coment.setFont(titleFont);
this.document.add(coment);
Chunk coments = new Chunk(report.getComments());
coments.setFont(textFont);
this.document.add(coments);
this.writeEmptyLine();
}
boolean iarEmpty = ((report.getCommentIAR() == null) || (report.getCommentIAR().isEmpty()));
boolean aosEmpty = (report.getCommentAOS() == null) || (report.getCommentAOS().isEmpty());
boolean aodEmpty = ((report.getCommentAOD() == null) || (report.getCommentAOD().isEmpty()));
if ((!iarEmpty) || (!aodEmpty) || (!aosEmpty)) {
Chunk indice = new Chunk(EntityDescriptions.INDEXS + ":" + System.getProperty("line.separator"));
indice.setFont(titleFont);
this.document.add(indice);
this.document.add(new Paragraph());
int samples = 0;
try {
AverageByDecade averageByDecade = FacadeDB.getInstance().getAveragesBroker().getAverageByPatient(analysis.getPatient());
if (averageByDecade != null) {
samples = averageByDecade.getSamples();
}
} catch (ExceptionDAO aO) {
//
}
Chunk detail = new Chunk(ReportTexts.ideal_characteristics + System.getProperty("line.separator")
+ ReportTexts.values_to + analysis.getPatient().getDecade() + ReportTexts.decade_and_averages + String.valueOf(samples) + System.getProperty("line.separator"));
Font detailFont = new Font(fontMapper.awtToPdf(this.reportSettingsProperties.loadBodyTextFont().deriveFont(Font.ITALIC, textFont.getSize() - 2)));
detail.setFont(detailFont);
this.document.add(detail);
if (!iarEmpty) {
Chunk indiceIAR = new Chunk(report.getCommentIAR() + System.getProperty("line.separator"));
indiceIAR.setFont(textFont);
this.document.add(indiceIAR);
}
if (!aosEmpty) {
Chunk indiceAOS = new Chunk(report.getCommentAOS() + System.getProperty("line.separator"));
indiceAOS.setFont(textFont);
this.document.add(indiceAOS);
}
if (!aodEmpty) {
Chunk indiceAOD = new Chunk(report.getCommentAOD() + System.getProperty("line.separator"));
indiceAOD.setFont(textFont);
this.document.add(indiceAOD);
}
this.writeEmptyLine();
}
if ((report.getAllBackground() != null) && (!report.getAllBackground().isEmpty())) {
Chunk antedecente = new Chunk(EntityDescriptions.BACKGROUNDS + ":" + System.getProperty("line.separator"));
antedecente.setFont(titleFont);
this.document.add(antedecente);
Chunk antecedentes = new Chunk(report.getAllBackground());
antecedentes.setFont(textFont);
this.document.add(antecedentes);
this.writeEmptyLine();
}
if ((report.getConclusion() != null) && (!report.getConclusion().isEmpty())) {
Chunk concluson = new Chunk(EntityDescriptions.CONCLUSION + ":" + System.getProperty("line.separator"));
concluson.setFont(titleFont);
this.document.add(concluson);
Chunk conclusiones = new Chunk(report.getConclusion());
conclusiones.setFont(textFont);
this.document.add(conclusiones);
}
}