forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
206 lines
9.9 KiB
206 lines
9.9 KiB
package siprp.ficha;
|
|
|
|
import java.awt.Color;
|
|
import java.io.*;
|
|
import java.util.*;
|
|
|
|
import com.lowagie.text.*;
|
|
import com.lowagie.text.pdf.PdfWriter;
|
|
|
|
public class ExamePDF {
|
|
private static final Font FONT_BOLD = new Font( Font.TIMES_ROMAN, 9, Font.BOLD, new Color( 0, 0, 0 ) );
|
|
private static final Font FONT_NORMAL = new Font( Font.TIMES_ROMAN, 9, Font.NORMAL, new Color( 0, 0, 0 ) );
|
|
|
|
public ExamePDF()
|
|
{
|
|
}
|
|
|
|
public static void main( String[] args ) {
|
|
try
|
|
{
|
|
Hashtable ht = new Hashtable();
|
|
ht.put( "trabalhadores.nome", "Trabalhador do comércio" );
|
|
ht.put( "servico_saude_designacao", "Designacao servico saude" );
|
|
ht.put( "servico_saude_tipo_externo", Boolean.TRUE );
|
|
ht.put( "tipo_periodico", Boolean.TRUE );
|
|
ht.put( "resultado_inapto_temp", Boolean.TRUE );
|
|
new FileOutputStream( "C:\\Chap0804.pdf" ).write( new ExamePDF().createPDF( ht ) );
|
|
}
|
|
catch( Exception e )
|
|
{
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public byte[] createPDF( Hashtable values )
|
|
{
|
|
Document document = new Document();
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
|
|
document.setPageSize( PageSize.A4 );
|
|
|
|
try {
|
|
PdfWriter.getInstance( document, bos );
|
|
|
|
document.addTitle( "Ficha de Aptid\u00e3o" );
|
|
document.addAuthor( "SIPRP" );
|
|
document.addCreator( "Evolute" );
|
|
|
|
document.open();
|
|
|
|
Paragraph conteudo = new Paragraph();
|
|
|
|
conteudo.add( new Chunk( "FICHA DE APTID\u00c3O\n",
|
|
new Font( Font.TIMES_ROMAN, 10, Font.BOLD, new Color( 0, 0, 0 ) ) ) );
|
|
conteudo.add( new Chunk( "(Portaria n\u00ba1031/2002, de 10 de Agosto)",
|
|
new Font( Font.TIMES_ROMAN, 7, Font.NORMAL, new Color( 0, 0, 0 ) ) ) );
|
|
conteudo.setAlignment( Element.ALIGN_CENTER );
|
|
|
|
document.add( conteudo );
|
|
|
|
Table table = new Table( 1 );
|
|
table.setBorderWidth( 1 );
|
|
table.setPadding( 5 );
|
|
table.setOffset( 0 );
|
|
table.setWidth( 100 );
|
|
|
|
table.addCell( new Phrase( "Empresa/Entidade",
|
|
FONT_BOLD ) );
|
|
|
|
StringBuffer texto = new StringBuffer();
|
|
|
|
texto.append( "Designa\u00e7\u00e3o social " + values.get( "designacao_social" ) + "\n" );
|
|
texto.append( "Estabelecimento " + values.get( "estabelecimentos.nome" ) + " Localidade " + values.get( "estabelecimentos.localidade" ) + "\n" );
|
|
texto.append( "Servi\u00e7o de sa\u00fade: Tipo Interno " + ( ( values.get( "servico_saude_tipo_interno" ) == null ) ? "" : "X" ) + " Interempresas " + ( ( values.get( "servico_saude_tipo_interempresas" ) == null ) ? "" : "X" ) + " Externo " + ( ( values.get( "servico_saude_tipo_externo" ) == null ) ? "" : "X" ) + " Servi\u00e7o Nacional de Sa\u00fade " + ( ( values.get( "servico_saude_tipo_sns" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( "Designa\u00e7\u00e3o " + values.get( "servico_saude_designacao" ) + "\n" );
|
|
texto.append( "Servi\u00e7o de Higiene e Seguran\u00e7a: Tipo Interno " + ( ( values.get( "servico_higiene_tipo_interno" ) == null ) ? "" : "X" ) + " Interempresas " + ( ( values.get( "servico_higiene_tipo_interempresas" ) == null ) ? "" : "X" ) + " Externo " + ( ( values.get( "servico_higiene_tipo_externo" ) == null ) ? "" : "X" ) + " Outro " + ( ( values.get( "servico_higiene_outro" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( "Designa\u00e7\u00e3o " + values.get( "servico_higiene_designacao" ) + "" );
|
|
|
|
table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) );
|
|
document.add( table );
|
|
|
|
table = new Table( 1 );
|
|
table.setBorderWidth( 1 );
|
|
table.setPadding( 5 );
|
|
table.setOffset( 0 );
|
|
table.setWidth( 100 );
|
|
|
|
table.addCell( new Phrase( "Trabalhador",
|
|
FONT_BOLD ) );
|
|
|
|
texto = new StringBuffer();
|
|
|
|
texto.append( "Nome " + values.get( "trabalhadores.nome" ) + "\n" );
|
|
texto.append( "Sexo " + values.get( "sexo" ) + " Data de Nascimento " + values.get( "data_nascimento" ) + " Nacionalidade " + values.get( "nacionalidade" ) + "\n" );
|
|
texto.append( "N\u00famero mecanogr\u00e1fico/outro " + values.get( "numero_mecanografico" ) + " Data de admiss\u00e3o " + values.get( "data_admissao" ) + "\n" );
|
|
texto.append( "Categoria Profissional " + values.get( "categoria" ) + " Local de Trabalho " + values.get( "local_trabalho" ) + "\n" );
|
|
texto.append( "Fun\u00e7\u00e3o Proposta " + values.get( "funcao_proposta" ) + " Data de admiss\u00e3o na fun\u00e7\u00e3o " + values.get( "data_admissao_funcao" ) + "" );
|
|
|
|
table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) );
|
|
document.add( table );
|
|
|
|
table = new Table( 1 );
|
|
table.setBorderWidth( 1 );
|
|
table.setOffset( 0 );
|
|
table.setPadding( 5 );
|
|
table.setWidth( 100 );
|
|
|
|
table.addCell( new Phrase( "Observa\u00e7\u00f5es",
|
|
FONT_BOLD ) );
|
|
|
|
texto = new StringBuffer();
|
|
texto.append( values.get( "observacoes" ) );
|
|
|
|
table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) );
|
|
document.add( table );
|
|
|
|
table = new Table( 2 );
|
|
table.setBorderWidth( 1 );
|
|
table.setOffset( 0 );
|
|
table.setPadding( 5 );
|
|
table.setWidth( 100 );
|
|
|
|
Cell cell = new Cell( new Phrase( "Exame M\u00e9dico",
|
|
FONT_BOLD ) );
|
|
|
|
cell.setColspan( 2 );
|
|
table.addCell( cell );
|
|
|
|
texto = new StringBuffer();
|
|
|
|
texto.append( "Data do exame " + values.get( "exames.data" ) + "\n" );
|
|
texto.append( "Tipo\n" );
|
|
texto.append( "Admiss\u00e3o ........................................................................................ " + ( ( values.get( "tipo_admissao" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( "Peri\u00f3dico ......................................................................................... " + ( ( values.get( "tipo_periodico" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( "Ocasional\n" );
|
|
texto.append( " Ap\u00f3s doen\u00e7a .......................................................................... " + ( ( values.get( "tipo_apos_doenca" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( " Ap\u00f3s 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\u00e7o ............................................................... " + ( ( values.get( "tipo_pedido_empresa" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( " Por mudan\u00e7a de fun\u00e7\u00e3o ......................................................... " + ( ( values.get( "tipo_mudanca_funcao" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( " Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho ................................ " + ( ( values.get( "tipo_trabalho" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( "Outro\n" );
|
|
texto.append( "Especifique " + ( ( values.get( "tipo_outro" ) == null ) ? "" : values.get( "tipo_outro" ) ) + "" );
|
|
|
|
table.addCell( new Phrase( texto.toString(), FONT_NORMAL ) );
|
|
texto = new StringBuffer();
|
|
|
|
texto.append( "Resultado\n" );
|
|
texto.append( "Apto ................................................................................................ " + ( ( values.get( "resultado_apto" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( "Apto condicionalmente ................................................................... " + ( ( values.get( "resultado_apto_condicionalmente" ) == null ) ? "" : "X" ) + "\n\n" );
|
|
texto.append( "Inapto temporariamente .................................................................. " + ( ( values.get( "resultado_inapto_temp" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( "Inapto definitivamente .................................................................... " + ( ( values.get( "resultado_inapto_def" ) == null ) ? "" : "X" ) + "\n" );
|
|
texto.append( "Outras fun\u00e7\u00f5es que pode desempenhar\n" );
|
|
texto.append( " 1 " + ( ( values.get( "outra_funcao_1" ) == null ) ? "" : values.get( "outra_funcao_1" ) ) + "\n" );
|
|
texto.append( " 2 " + ( ( values.get( "outra_funcao_2" ) == null ) ? "" : values.get( "outra_funcao_2" ) ) + "\n" );
|
|
texto.append( " 3 " + ( ( values.get( "outra_funcao_3" ) == null ) ? "" : values.get( "outra_funcao_3" ) ) + "\n" );
|
|
texto.append( " 4 " + ( ( values.get( "outra_funcao_4" ) == null ) ? "" : values.get( "outra_funcao_4" ) ) + "" );
|
|
|
|
table.addCell( new Phrase( 14f, texto.toString(), FONT_NORMAL ) );
|
|
|
|
document.add( table );
|
|
|
|
table = new Table( 1 );
|
|
table.setBorderWidth( 1 );
|
|
table.setOffset( 0 );
|
|
table.setPadding( 5 );
|
|
table.setWidth( 100 );
|
|
|
|
table.addCell( new Phrase( "Outras Recomenda\u00e7\u00f5es",
|
|
FONT_BOLD ) );
|
|
|
|
texto = new StringBuffer();
|
|
|
|
texto.append( "Pr\u00f3ximo Exame " + values.get( "proximo_exame" ) + "\n" );
|
|
texto.append( "" + values.get( "outras_recomendacoes" ) + "" );
|
|
|
|
table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) );
|
|
document.add( table );
|
|
|
|
|
|
table = new Table( 1 );
|
|
table.setBorderWidth( 1 );
|
|
table.setOffset( 0 );
|
|
table.setPadding( 5 );
|
|
table.setWidth( 100 );
|
|
|
|
texto = new StringBuffer();
|
|
|
|
texto.append( "M\u00e9dico do Trabalho " + values.get( "medicos.nome" ) + " C.P. " + values.get( "numero_cedula" ) + "\n" );
|
|
texto.append( "Assinatura _____________________________________________________________________________________\n" );
|
|
texto.append( "Tomei conhecimento ___________________________________________________________ Data\n" );
|
|
texto.append( " O Respons\u00e1vel dos Recursos Humanos" );
|
|
|
|
table.addCell( new Phrase( 18f, texto.toString(), FONT_NORMAL ) );
|
|
document.add( table );
|
|
|
|
}
|
|
catch( Exception e ) {
|
|
e.printStackTrace();
|
|
return null;
|
|
}
|
|
|
|
document.close();
|
|
return bos.toByteArray();
|
|
}
|
|
} |