From f217e5781f4b8cda6f8303fb3ab7461e77470339 Mon Sep 17 00:00:00 2001 From: Frederico Palma Date: Fri, 16 Apr 2004 16:20:20 +0000 Subject: [PATCH] no message git-svn-id: https://svn.coded.pt/svn/SIPRP@59 bb69d46d-e84e-40c8-a05a-06db0d633741 --- trunk/siprp/ficha/ExamePDF.java | 257 ++++++++++++++------------------ 1 file changed, 112 insertions(+), 145 deletions(-) diff --git a/trunk/siprp/ficha/ExamePDF.java b/trunk/siprp/ficha/ExamePDF.java index 2a20aabe..583c1ebb 100644 --- a/trunk/siprp/ficha/ExamePDF.java +++ b/trunk/siprp/ficha/ExamePDF.java @@ -142,29 +142,53 @@ public class ExamePDF { FONT_BOLD ) ); StringBuffer texto = new StringBuffer(); + Phrase ph = new Phrase( 12f ); + Cell cell = new Cell(); texto.append( "DESIGNA\u00c7\u00c3O SOCIAL: " + values.get( "designacao_social" ) + "\n" ); texto.append( "ESTABELECIMENTO: " + values.get( "estabelecimentos.nome" ) + " LOCALIDADE: " + values.get( "estabelecimentos.localidade" ) + "\n" ); - texto.append( "SERVI\u00c7O DE SA\u00DaDE: Tipo Interno " - + ( ( values.get( "servico_saude_tipo_interno" ) == null ) ? "\u2610" : "\u2612" ) - + " Interempresas " - + ( ( values.get( "servico_saude_tipo_interempresas" ) == null ) ? "\u2610" : "\u2612" ) - + " Externo " - + ( ( values.get( "servico_saude_tipo_externo" ) == null ) ? "\u2610" : "\u2612" ) - + " Servi\u00e7o Nacional de Sa\u00fade " - + ( ( values.get( "servico_saude_tipo_sns" ) == null ) ? "\u2610" : "\u2612" ) + "\n" ); + texto.append( "SERVI\u00c7O DE SA\u00DaDE: Tipo " ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + texto = new StringBuffer( "Interno" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "servico_saude_tipo_interno" ) != null ) ); + + texto = new StringBuffer( "Interempresas" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "servico_saude_tipo_interempresas" ) != null, true ) ); + + texto = new StringBuffer( "Externo" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "servico_saude_tipo_externo" ) != null, true ) ); + + texto = new StringBuffer( "Servi\u00e7o Nacional de Sa\u00fade\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "servico_saude_tipo_sns" ) != null, true ) ); + + texto = new StringBuffer(); + texto.append( "DESIGNA\u00c7\u00c3O: " + values.get( "servico_saude_designacao" ) + "\n" ); - texto.append( "SERVI\u00c7O DE HIGIENE E SEGURAN\u00c7A: Tipo Interno " - + ( ( values.get( "servico_higiene_tipo_interno" ) == null ) ? "\u2610" : "\u2612" ) - + " Interempresas " - + ( ( values.get( "servico_higiene_tipo_interempresas" ) == null ) ? "\u2610" : "\u2612" ) - + " Externo " - + ( ( values.get( "servico_higiene_tipo_externo" ) == null ) ? "\u2610" : "\u2612" ) - + " Outro " - + ( ( values.get( "servico_higiene_outro" ) == null ) ? "\u2610" : "\u2612" ) + "\n" ); + texto.append( "SERVI\u00c7O DE HIGIENE E SEGURAN\u00c7A: Tipo " ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + texto = new StringBuffer( "Interno" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "servico_higiene_tipo_interno" ) != null ) ); + + texto = new StringBuffer( "Interempresas" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "servico_higiene_tipo_interempresas" ) != null, true ) ); + + texto = new StringBuffer( "Externo" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "servico_higiene_tipo_externo" ) != null, true ) ); + + texto = new StringBuffer( "Outro\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "servico_higiene_outro" ) != null, true ) ); + + texto = new StringBuffer(); + texto.append( "DESIGNA\u00c7\u00c3O: " + values.get( "servico_higiene_designacao" ) + "" ); - cell.addElement( new Phrase( 12f, texto.toString(), FONT_NORMAL ) ); + + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + cell.addElement( ph ); + //cell.addElement( new Phrase( 12f, texto.toString(), FONT_NORMAL ) ); table.addCell( cell ); document.add( table ); @@ -222,146 +246,78 @@ public class ExamePDF { table.addCell( cell ); texto = new StringBuffer(); - + ph = new Phrase( 12f ); texto.append( "DATA DO EXAME: " + values.get( "exames.data" ) + "\n" ); texto.append( "TIPO\n" ); - texto.append( "ADMISS\u00c3O ...................................................................................... " - + ( ( values.get( "tipo_admissao" ) == null ) ? "" : "X" ) + "\n" ); - texto.append( "PERI\u00d3DICO ..................................................................................... " - + ( ( values.get( "tipo_periodico" ) == null ) ? "" : "X" ) + "\n" ); - texto.append( "OCASIONAL .................................................................................... " - + ( ( values.get( "tipo_ocasional" ) == null ) ? "" : "X" ) + "\n" ); - texto.append( " AP\u00d3S DOEN\u00c7A ...................................................................... " - + ( ( values.get( "tipo_apos_doenca" ) == null ) ? "" : "X" ) + "\n" ); - texto.append( " AP\u00d3S ACIDENTE ................................................................... " - + ( ( values.get( "tipo_apos_acidente" ) == null ) ? "" : "X" ) + "\n" ); - texto.append( " A PEDIDO DO TRABALHADOR ............................................. " - + ( ( values.get( "tipo_pedido_trabalhador" ) == null ) ? "" : "X" ) + "\n" ); - texto.append( " A PEDIDO DO SERVI\u00c7O ........................................................ " - + ( ( values.get( "tipo_pedido_empresa" ) == null ) ? "" : "X" ) + "\n" ); - texto.append( " POR MUDAN\u00c7A DE FUN\u00c7\u00c3O ................................................ " - + ( ( values.get( "tipo_mudanca_funcao" ) == null ) ? "" : "X" ) + "\n" ); - texto.append( " POR ALTERA\u00c7\u00c3O DAS CONDI\u00c7\u00d5ES DE TRABALHO ......... " - + ( ( values.get( "tipo_trabalho" ) == null ) ? "" : "X" ) + "\n" ); - texto.append( "OUTRO ............................................................................................ " - + ( ( values.get( "tipo_outro" ) == null ) ? "" : "X" ) + "\n" ); - texto.append( "ESPECIFIQUE: " - + ( ( values.get( "tipo_outro" ) == null ) ? "" : values.get( "tipo_outro" ) ) + "" ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + //texto = new StringBuffer( "ADMISS\u00c3O ...................................................................................... " ); + texto = new StringBuffer( "ADMISS\u00c3O\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "tipo_admissao" ) != null ) ); - table.addCell( new Phrase( texto.toString(), FONT_NORMAL ) ); + //texto = new StringBuffer( "PERI\u00d3DICO ..................................................................................... " ); + texto = new StringBuffer( "PERI\u00d3DICO\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "tipo_periodico" ) != null ) ); + //texto = new StringBuffer( "OCASIONAL .................................................................................... " ); + texto = new StringBuffer( "OCASIONAL\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "tipo_ocasional" ) != null ) ); - Cell cellVazia = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellDataExame = new Cell( new Phrase( 12f, "DATA DO EXAME: " + values.get( "exames.data" ) + "\n", FONT_NORMAL ) ); - Cell cellTipo = new Cell( new Phrase( 12f, "TIPO\n", FONT_NORMAL ) ); - Cell cellAdmissao = new Cell( new Phrase( 12f, "ADMISS\u00c3O ...................................................................................... ", FONT_NORMAL ) ); - Cell cellAdmissaoValor = new Cell( new Phrase( 12f, ( ( values.get( "tipo_admissao" ) == null ) ? "" : "X" ), FONT_NORMAL ) ); - Cell cellPeriodico = new Cell( new Phrase( 12f, "PERI\u00d3DICO ..................................................................................... ", FONT_NORMAL ) ); - Cell cellPeriodicoValor = new Cell( new Phrase( 12f, ( ( values.get( "tipo_periodico" ) == null ) ? "" : "X" ), FONT_NORMAL ) ); - Cell cellOcasional = new Cell( new Phrase( 12f, "OCASIONAL .................................................................................... ", FONT_NORMAL ) ); - Cell cellOcasionalValor = new Cell( new Phrase( 12f, ( ( values.get( "tipo_ocasional" ) == null ) ? "" : "X" ), FONT_NORMAL ) ); - Cell cellAposDoenca = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellAposDoencaValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellAposAcidente = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellAposAcidenteValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellPedidoTrabalhador = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellPedidoTrabalhadorValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellPedidoServico = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellPedidoServicoValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellMudancaFuncao = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellMudancaFuncaoValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellCondicoes = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellCondicoesValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellOutro = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellOutroValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellEspecifique = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); + //texto = new StringBuffer( " AP\u00d3S DOEN\u00c7A ...................................................................... " ); + texto = new StringBuffer( "AP\u00d3S DOEN\u00c7A\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "tipo_apos_doenca" ) != null, true ) ); + + //texto = new StringBuffer( " AP\u00d3S ACIDENTE ................................................................... " ); + texto = new StringBuffer( "AP\u00d3S ACIDENTE\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "tipo_apos_acidente" ) != null, true ) ); + + //texto = new StringBuffer( " A PEDIDO DO TRABALHADOR ............................................. " ); + texto = new StringBuffer( "A PEDIDO DO TRABALHADOR\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "tipo_pedido_trabalhador" ) != null, true ) ); - Cell cellResultado = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellApto = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellAptoValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellAptoCond = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellAptoCondValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellInaptoTemp = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellInaptoTempValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellInaptoDef = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellInaptoDefValor = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellOutrasFuncoes = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellOutrasFuncoes1 = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellOutrasFuncoes2 = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellOutrasFuncoes3 = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); - Cell cellOutrasFuncoes4 = new Cell( new Phrase( 12f, "", FONT_NORMAL ) ); + //texto = new StringBuffer( " A PEDIDO DO SERVI\u00c7O ........................................................ " ); + texto = new StringBuffer( "A PEDIDO DO SERVI\u00c7O\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "tipo_pedido_empresa" ) != null, true ) ); + + //texto = new StringBuffer( " POR MUDAN\u00c7A DE FUN\u00c7\u00c3O ................................................ " ); + texto = new StringBuffer( "POR MUDAN\u00c7A DE FUN\u00c7\u00c3O\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "tipo_mudanca_funcao" ) != null, true ) ); + + //texto = new StringBuffer( " POR ALTERA\u00c7\u00c3O DAS CONDI\u00c7\u00d5ES DE TRABALHO ......... " ); + texto = new StringBuffer( "POR ALTERA\u00c7\u00c3O DAS CONDI\u00c7\u00d5ES DE TRABALHO\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "tipo_trabalho" ) != null, true ) ); + + //texto = new StringBuffer( "OUTRO ............................................................................................ " ); + texto = new StringBuffer( "OUTRO\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( "tipo_outro" ) != null ) ); + + texto = new StringBuffer(); + texto.append( "ESPECIFIQUE: " + + ( ( values.get( "tipo_outro" ) == null ) ? "" : values.get( "tipo_outro" ) ) + "" ); + + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); -// table.endHeaders(); -// table.addCell( cellDataExame ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( cellResultado ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( cellTipo ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( cellApto ); -// table.addCell( cellAptoValor ); -// table.addCell( cellAdmissao ); -// table.addCell( cellAdmissaoValor ); -// table.addCell( cellAptoCond ); -// table.addCell( cellAptoCondValor ); -// table.addCell( cellPeriodico ); -// table.addCell( cellPeriodicoValor ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( cellOcasional ); -// table.addCell( cellOcasionalValor ); -// table.addCell( cellInaptoTemp ); -// table.addCell( cellInaptoTempValor ); -// table.addCell( cellAposDoenca ); -// table.addCell( cellAposDoencaValor ); -// table.addCell( cellInaptoDef ); -// table.addCell( cellInaptoDefValor ); -// table.addCell( cellAposAcidente ); -// table.addCell( cellAposAcidenteValor ); -// table.addCell( cellOutrasFuncoes ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( cellPedidoTrabalhador ); -// table.addCell( cellPedidoTrabalhadorValor ); -// table.addCell( cellOutrasFuncoes1 ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( cellPedidoServico ); -// table.addCell( cellPedidoServicoValor ); -// table.addCell( cellOutrasFuncoes2 ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( cellMudancaFuncao ); -// table.addCell( cellMudancaFuncaoValor ); -// table.addCell( cellOutrasFuncoes3 ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( cellCondicoes ); -// table.addCell( cellCondicoesValor ); -// table.addCell( cellOutrasFuncoes4 ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( cellOutro ); -// table.addCell( cellOutroValor ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( cellEspecifique ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); -// table.addCell( new Cell( new Phrase( 12f, "", FONT_NORMAL ) ) ); + table.addCell( ph ); + //table.addCell( new Phrase( texto.toString(), FONT_NORMAL ) ); texto = new StringBuffer(); - Phrase ph = new Phrase( 12f ); - texto.append( "RESULTADO" ); + ph = new Phrase( 12f ); + texto.append( "RESULTADO\n" ); ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); -// texto.append( "APTO ................................................................................................ " -// + ( ( values.get( "resultado_apto" ) == null ) ? "" : "X" ) + "\n" ); - texto = new StringBuffer( "\nAPTO ............................................................................................ " ); + //texto = new StringBuffer( "\nAPTO ............................................................................................ " ); + texto = new StringBuffer( "APTO\n" ); ph.add( doCheckedPhrase( texto.toString(), values.get( "resultado_apto" ) != null ) ); - texto = new StringBuffer( "\nAPTO CONDICIONALMENTE ..................................................... " ); + //texto = new StringBuffer( "\nAPTO CONDICIONALMENTE ..................................................... " ); + texto = new StringBuffer( "APTO CONDICIONALMENTE\n\n" ); ph.add( doCheckedPhrase( texto.toString(), values.get( "resultado_apto_condicionalmente" ) != null ) ); - texto = new StringBuffer( "INAPTO TEMPORARIAMENTE ................................................... " ); + //texto = new StringBuffer( "INAPTO TEMPORARIAMENTE ................................................... " ); + texto = new StringBuffer( "INAPTO TEMPORARIAMENTE\n" ); ph.add( doCheckedPhrase( texto.toString(), values.get( "resultado_inapto_temp" ) != null ) ); - - - texto = new StringBuffer( "INAPTO DEFINITIVAMENTE ....................................................... " ); + + //texto = new StringBuffer( "INAPTO DEFINITIVAMENTE ....................................................... " ); + texto = new StringBuffer( "INAPTO DEFINITIVAMENTE\n\n" ); ph.add( doCheckedPhrase( texto.toString(), values.get( "resultado_inapto_def" ) != null ) ); texto = new StringBuffer(); @@ -425,12 +381,23 @@ public class ExamePDF { return bos.toByteArray(); } - private Phrase doCheckedPhrase( String text, boolean checked ) + private Phrase doCheckedPhrase( String text, boolean checked, boolean ident ) { Phrase p = new Phrase( 12f ); + if( ident ) + { + p.add( new Chunk( " " + ( char )( checked? 110: 111) + " ", FONT_ZAPFDINGBATS ) ); + } + else + { + p.add( new Chunk( "" + ( char )( checked? 110: 111) + " ", FONT_ZAPFDINGBATS ) ); + } p.add( new Chunk( text, FONT_NORMAL ) ); - - p.add( new Chunk( "" + ( char )( checked? 108: 109), FONT_ZAPFDINGBATS ) ); return p; } + + private Phrase doCheckedPhrase( String text, boolean checked ) + { + return doCheckedPhrase( text, checked, false ); + } } \ No newline at end of file