|
|
|
@ -10,8 +10,8 @@ import java.io.*;
|
|
|
|
import java.lang.reflect.Array;
|
|
|
|
import java.lang.reflect.Array;
|
|
|
|
import javax.servlet.*;
|
|
|
|
import javax.servlet.*;
|
|
|
|
import javax.servlet.http.*;
|
|
|
|
import javax.servlet.http.*;
|
|
|
|
import java.sql.*;
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.velocity.*;
|
|
|
|
import org.apache.velocity.*;
|
|
|
|
import org.apache.velocity.app.*;
|
|
|
|
import org.apache.velocity.app.*;
|
|
|
|
@ -57,7 +57,7 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
// TEXTOS_ESTADOS.put( new Integer( ESTADO_TRATADO ), "green" );
|
|
|
|
// TEXTOS_ESTADOS.put( new Integer( ESTADO_TRATADO ), "green" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected java.sql.Date today;
|
|
|
|
protected Date today;
|
|
|
|
protected long todayMillis;
|
|
|
|
protected long todayMillis;
|
|
|
|
|
|
|
|
|
|
|
|
/** Creates a new instance of doGetListaTrabalhadores */
|
|
|
|
/** Creates a new instance of doGetListaTrabalhadores */
|
|
|
|
@ -230,40 +230,43 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
public doGetListaTrabalhadoresPendentes( HttpServletRequest req, HttpServletResponse res, boolean print )
|
|
|
|
public doGetListaTrabalhadoresPendentes( HttpServletRequest req, HttpServletResponse res, boolean print )
|
|
|
|
throws IOException
|
|
|
|
throws IOException
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
System.out.println( "\ndoGetListaTrabalhadoresPendentes() : " );
|
|
|
|
|
|
|
|
|
|
|
|
ServletOutputStream out = res.getOutputStream();
|
|
|
|
ServletOutputStream out = res.getOutputStream();
|
|
|
|
String userRole, empresaId, estabelecimentoId;
|
|
|
|
String userRole, empresaId, estabelecimentoId;
|
|
|
|
HttpSession session = req.getSession( false );
|
|
|
|
HttpSession session = req.getSession( false );
|
|
|
|
Vector links = new Vector();
|
|
|
|
Vector links = new Vector();
|
|
|
|
Vector desc = new Vector();
|
|
|
|
Vector desc = new Vector();
|
|
|
|
Vector descAdicional = new Vector();
|
|
|
|
Vector descAdicional = new Vector();
|
|
|
|
// today = new java.util.Date();
|
|
|
|
|
|
|
|
// todayMillis = today.getTime();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Executer executer = getExecuter();
|
|
|
|
Executer executer = getExecuter();
|
|
|
|
Virtual2DArray array = executer.executeQuery( new Select( "SELECT CURRENT_DATE" ) );
|
|
|
|
today = new Date();
|
|
|
|
today = ( java.sql.Date ) array.get( 0, 0 );
|
|
|
|
|
|
|
|
todayMillis = today.getTime();
|
|
|
|
todayMillis = today.getTime();
|
|
|
|
|
|
|
|
|
|
|
|
userRole = ( String ) session.getAttribute( sessionUserRole );
|
|
|
|
userRole = ( String ) session.getAttribute( sessionUserRole );
|
|
|
|
empresaId = ( String ) session.getAttribute( sessionEmpresaId );
|
|
|
|
empresaId = ( String ) session.getAttribute( sessionEmpresaId );
|
|
|
|
estabelecimentoId = ( String ) session.getAttribute( sessionEstabelecimentoId );
|
|
|
|
estabelecimentoId = ( String ) session.getAttribute( sessionEstabelecimentoId );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println( "\tuserRole : " + userRole );
|
|
|
|
|
|
|
|
System.out.println( "\tempresaID : " + empresaId );
|
|
|
|
|
|
|
|
System.out.println( "\testabelecimentoID : " + estabelecimentoId );
|
|
|
|
|
|
|
|
|
|
|
|
if ( userRole.equals ( superUserRole ) || userRole.equals ( empresaId ) )
|
|
|
|
if ( userRole.equals ( superUserRole ) || userRole.equals ( empresaId ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( verificaEstabelecimento( null, empresaId, estabelecimentoId ) ) // estabelecimento pertence 'a empresa ??
|
|
|
|
if ( verificaEstabelecimento( null, empresaId, estabelecimentoId ) ) // estabelecimento pertence 'a empresa ??
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//Class.forName(super.bdDriver);
|
|
|
|
|
|
|
|
//con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword );
|
|
|
|
|
|
|
|
String query = "( SELECT trabalhadores.id, trabalhadores.nome, "
|
|
|
|
String query = "( SELECT trabalhadores.id, trabalhadores.nome, "
|
|
|
|
+ "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, "
|
|
|
|
+ "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, "
|
|
|
|
+ " trabalhadores.nome_plain, marcacoes_trabalhador.motivo, marcacoes_trabalhador.data "
|
|
|
|
+ " trabalhadores.nome_plain, marcacoes_trabalhador.motivo, marcacoes_trabalhador.data "
|
|
|
|
+ "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) "
|
|
|
|
+ "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) "
|
|
|
|
+ "WHERE estabelecimento_id = " + estabelecimentoId
|
|
|
|
+ "WHERE estabelecimento_id = " + estabelecimentoId
|
|
|
|
+ " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL "
|
|
|
|
+ " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL "
|
|
|
|
+ " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) "
|
|
|
|
+ " AND marcacoes_trabalhador.estado NOT IN ( 2, 3, 4, 5 ) "
|
|
|
|
+ " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_CONSULTA
|
|
|
|
+ " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_CONSULTA
|
|
|
|
|
|
|
|
+ " AND marcacoes_trabalhador.deleted_stamp is null"
|
|
|
|
|
|
|
|
+ " AND marcacoes_trabalhador.data < now()"
|
|
|
|
+ " AND marcacoes_trabalhador.motivo <> " + MOTIVO_OCASIONAL + " )"
|
|
|
|
+ " AND marcacoes_trabalhador.motivo <> " + MOTIVO_OCASIONAL + " )"
|
|
|
|
+ " UNION "
|
|
|
|
+ " UNION "
|
|
|
|
+ "( SELECT trabalhadores.id, trabalhadores.nome, "
|
|
|
|
+ "( SELECT trabalhadores.id, trabalhadores.nome, "
|
|
|
|
@ -272,10 +275,12 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
+ "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) "
|
|
|
|
+ "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) "
|
|
|
|
+ "WHERE estabelecimento_id = " + estabelecimentoId
|
|
|
|
+ "WHERE estabelecimento_id = " + estabelecimentoId
|
|
|
|
+ " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL "
|
|
|
|
+ " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL "
|
|
|
|
+ " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) "
|
|
|
|
+ " AND marcacoes_trabalhador.estado NOT IN ( 2, 3, 4, 5 ) "
|
|
|
|
|
|
|
|
+ " AND marcacoes_trabalhador.deleted_stamp is null"
|
|
|
|
|
|
|
|
+ " AND marcacoes_trabalhador.data < now()"
|
|
|
|
+ " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_EXAMES + " )"
|
|
|
|
+ " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_EXAMES + " )"
|
|
|
|
+ " ORDER BY 6, 8, 3 DESC ";
|
|
|
|
+ " ORDER BY 6, 8, 3 DESC ";
|
|
|
|
array = executer.executeQuery( new Select( query ) );
|
|
|
|
Virtual2DArray array = executer.executeQuery( new Select( query ) );
|
|
|
|
|
|
|
|
|
|
|
|
query = "SELECT trabalhadores.id, trabalhadores.nome, "
|
|
|
|
query = "SELECT trabalhadores.id, trabalhadores.nome, "
|
|
|
|
+ "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, "
|
|
|
|
+ "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, "
|
|
|
|
@ -283,9 +288,11 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
+ "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) "
|
|
|
|
+ "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) "
|
|
|
|
+ "WHERE estabelecimento_id = " + estabelecimentoId
|
|
|
|
+ "WHERE estabelecimento_id = " + estabelecimentoId
|
|
|
|
+ " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL "
|
|
|
|
+ " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL "
|
|
|
|
+ " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) "
|
|
|
|
+ " AND marcacoes_trabalhador.estado NOT IN ( 2, 3, 4, 5 ) "
|
|
|
|
+ " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_CONSULTA
|
|
|
|
+ " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_CONSULTA
|
|
|
|
+ " AND marcacoes_trabalhador.motivo = " + MOTIVO_OCASIONAL
|
|
|
|
+ " AND marcacoes_trabalhador.motivo = " + MOTIVO_OCASIONAL
|
|
|
|
|
|
|
|
+ " AND marcacoes_trabalhador.data < now()"
|
|
|
|
|
|
|
|
+ " AND marcacoes_trabalhador.deleted_stamp is null"
|
|
|
|
+ " ORDER BY 6, 8, 3 DESC";
|
|
|
|
+ " ORDER BY 6, 8, 3 DESC";
|
|
|
|
Virtual2DArray ocasionaisArray = executer.executeQuery( new Select( query ) );
|
|
|
|
Virtual2DArray ocasionaisArray = executer.executeQuery( new Select( query ) );
|
|
|
|
|
|
|
|
|
|
|
|
@ -323,30 +330,25 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
|
|
|
|
|
|
|
|
for( int n = 0; n < trabalhadores.length; n++ )
|
|
|
|
for( int n = 0; n < trabalhadores.length; n++ )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Object marcacoes[][];
|
|
|
|
Integer trabalhadorID = trabalhadores[ n ].getID();
|
|
|
|
if( marcacoesPorID.containsKey( trabalhadores[ n ].getID() ) )
|
|
|
|
|
|
|
|
{
|
|
|
|
Object marcacoes[][] = new Object[ 0 ][ ];
|
|
|
|
marcacoes = ( Object[][] ) ( ( Vector )marcacoesPorID.get( trabalhadores[ n ].getID() ) ).toArray( new Object[ 0 ][] );
|
|
|
|
if ( marcacoesPorID.containsKey( trabalhadorID ) )
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
marcacoes = new Object[0][];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Object ocasionais[][];
|
|
|
|
|
|
|
|
if( ocasionaisPorID.containsKey( trabalhadores[ n ].getID() ) )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ocasionais = ( Object[][] ) ( ( Vector )ocasionaisPorID.get( trabalhadores[ n ].getID() ) ).toArray( new Object[ 0 ][] );
|
|
|
|
marcacoes = ( Object[][] ) ( ( Vector ) marcacoesPorID.get( trabalhadorID ) ).toArray( new Object[ 0 ][] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Object ocasionais[][] = new Object[ 0 ][ ];
|
|
|
|
|
|
|
|
if( ocasionaisPorID.containsKey( trabalhadorID ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ocasionais = new Object[ 0 ][];
|
|
|
|
ocasionais = ( Object[][] ) ( ( Vector ) ocasionaisPorID.get( trabalhadorID ) ).toArray( new Object[ 0 ][] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Object agrupadas[][] = agruparMarcacoes( marcacoes, ocasionais );
|
|
|
|
Object agrupadas[][] = agruparMarcacoes( marcacoes, ocasionais );
|
|
|
|
acrescentarTrabalhador( empresaId, estabelecimentoId,
|
|
|
|
acrescentarTrabalhador( empresaId, estabelecimentoId,
|
|
|
|
trabalhadores[ n ], null,
|
|
|
|
trabalhadores[ n ], null,
|
|
|
|
agrupadas, links, desc,
|
|
|
|
agrupadas, links, desc,
|
|
|
|
perfilTemConsultas( trabalhadores[ n ].getID(), new Integer( empresaId ) ),
|
|
|
|
perfilTemConsultas( trabalhadorID, new Integer( empresaId ) ),
|
|
|
|
perfilTemExames( trabalhadores[ n ].getID(), new Integer( empresaId ) ) );
|
|
|
|
perfilTemExames( trabalhadorID, new Integer( empresaId ) ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HashMap hmValues = new HashMap();
|
|
|
|
HashMap hmValues = new HashMap();
|
|
|
|
@ -371,7 +373,6 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
{
|
|
|
|
{
|
|
|
|
out.println( mergeTemplate( hmValues, super.authenticatedUserPrintTemplate ) );
|
|
|
|
out.println( mergeTemplate( hmValues, super.authenticatedUserPrintTemplate ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else // est nao pertence 'a empresa
|
|
|
|
else // est nao pertence 'a empresa
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -395,17 +396,18 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void preencherMarcacoes( Virtual2DArray array, Hashtable nomesPorID, Hashtable marcacoesPorID )
|
|
|
|
protected void preencherMarcacoes( Virtual2DArray array, Hashtable nomesPorID, Hashtable marcacoesPorID )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int max = array.columnLength();
|
|
|
|
for ( int index = 0; index < array.columnLength(); index++ )
|
|
|
|
for( int index = 0; index < max; index++ )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Integer id = index < max ? ( Integer ) array.get( index, 0 ) : new Integer( -1 );
|
|
|
|
Integer id = ( Integer ) array.get( index, 0 );
|
|
|
|
Integer tipo = ( Integer ) array.get( index, 2 );
|
|
|
|
Integer tipo = ( Integer ) array.get( index, 2 );
|
|
|
|
String nome = ( String ) array.get( index, 1 );
|
|
|
|
String nome = ( String ) array.get( index, 1 );
|
|
|
|
java.util.Date data = ( java.util.Date ) array.get( index, 3 );
|
|
|
|
java.util.Date data = ( java.util.Date ) array.get( index, 3 );
|
|
|
|
Integer estado = ( Integer ) array.get( index, 4 );
|
|
|
|
Integer estado = ( Integer ) array.get( index, 4 );
|
|
|
|
Integer motivo = ( Integer ) array.get( index, 6 );
|
|
|
|
Integer motivo = ( Integer ) array.get( index, 6 );
|
|
|
|
|
|
|
|
|
|
|
|
if ( ! marcacoesPorID.containsKey( id ) )
|
|
|
|
if ( ! marcacoesPorID.containsKey( id ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nomesPorID.put( id, nome );
|
|
|
|
nomesPorID.put( id, nome );
|
|
|
|
@ -511,7 +513,8 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Object agrupadas[][] = ( Object[][] ) grupos.toArray( new Object[ grupos.size() ][] );
|
|
|
|
Object agrupadas[][] = ( Object[][] ) grupos.toArray( new Object[ grupos.size() ][] );
|
|
|
|
Arrays.sort( agrupadas, new Comparator(){
|
|
|
|
Arrays.sort( agrupadas, new Comparator()
|
|
|
|
|
|
|
|
{
|
|
|
|
public int compare( Object o1, Object o2 )
|
|
|
|
public int compare( Object o1, Object o2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Object g1[] = ( Object[] ) o1;
|
|
|
|
Object g1[] = ( Object[] ) o1;
|
|
|
|
@ -529,16 +532,28 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
Object marcacoes[][], Vector links, Vector dados,
|
|
|
|
Object marcacoes[][], Vector links, Vector dados,
|
|
|
|
boolean perfilConsultas, boolean perfilExames )
|
|
|
|
boolean perfilConsultas, boolean perfilExames )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// System.out.println( "\ndoGetListaTrabalhadoresPendentes . acrescentarTrabalhador( " + empresaID + ", " + estabelecimentoID + ", "
|
|
|
|
|
|
|
|
// + trabalhador + ", " + dataFicha + ", " + marcacoes + ", " + links + ", " + dados + ", " + perfilConsultas + ", " + perfilExames + " ) : " );
|
|
|
|
|
|
|
|
// System.out.println( "\tTrabalhador : " + trabalhador.getID() );
|
|
|
|
|
|
|
|
|
|
|
|
int estado[] = new int[ 2 ];
|
|
|
|
int estado[] = new int[ 2 ];
|
|
|
|
int index = 0;
|
|
|
|
int index = 0;
|
|
|
|
boolean pendente = false;
|
|
|
|
boolean pendente = false;
|
|
|
|
if ( marcacoes.length == 0 )
|
|
|
|
if ( marcacoes.length == 0 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// System.out.println( "\tmarcacoes.length == 0 : true" );
|
|
|
|
|
|
|
|
|
|
|
|
estado[ 0 ] = perfilConsultas ? ESTADO_PENDENTE : ESTADO_NAO_APLICAVEL;
|
|
|
|
estado[ 0 ] = perfilConsultas ? ESTADO_PENDENTE : ESTADO_NAO_APLICAVEL;
|
|
|
|
estado[ 1 ] = perfilExames ? ESTADO_PENDENTE : ESTADO_NAO_APLICAVEL;
|
|
|
|
estado[ 1 ] = perfilExames ? ESTADO_PENDENTE : ESTADO_NAO_APLICAVEL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// System.out.println( "\t\testado[ 0 ] : " + estado[ 0 ] );
|
|
|
|
|
|
|
|
// System.out.println( "\t\testado[ 1 ] : " + estado[ 1 ] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// System.out.println( "\tmarcacoes.length == 0 : false" );
|
|
|
|
|
|
|
|
|
|
|
|
java.util.Date dataConsulta;
|
|
|
|
java.util.Date dataConsulta;
|
|
|
|
java.util.Date dataExame;
|
|
|
|
java.util.Date dataExame;
|
|
|
|
index = -1;
|
|
|
|
index = -1;
|
|
|
|
@ -559,14 +574,8 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( index == -1 )
|
|
|
|
|
|
|
|
{
|
|
|
|
index = index == -1 ? 0 : index;
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// else if( index < marcacoes.length - 1 )
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// index = 0;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
for ( ; index < marcacoes.length; index++ )
|
|
|
|
for ( ; index < marcacoes.length; index++ )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dataConsulta = ( java.util.Date ) marcacoes[ index ][ 0 ];
|
|
|
|
dataConsulta = ( java.util.Date ) marcacoes[ index ][ 0 ];
|
|
|
|
@ -580,6 +589,7 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( index >= marcacoes.length )
|
|
|
|
if ( index >= marcacoes.length )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
index = marcacoes.length - 1;
|
|
|
|
index = marcacoes.length - 1;
|
|
|
|
@ -631,18 +641,13 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
{
|
|
|
|
{
|
|
|
|
estado[ 0 ] = ESTADO_NAO_APLICAVEL;
|
|
|
|
estado[ 0 ] = ESTADO_NAO_APLICAVEL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( perfilExames )
|
|
|
|
if ( perfilExames )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( dataExame == null || pendente )
|
|
|
|
if ( dataExame == null || pendente )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( motivoConsulta != null && motivoConsulta.intValue() != MOTIVO_OCASIONAL )
|
|
|
|
estado[ 1 ] = motivoConsulta != null && motivoConsulta.intValue() != MOTIVO_OCASIONAL ?
|
|
|
|
{
|
|
|
|
ESTADO_PENDENTE : ESTADO_NAO_APLICAVEL ;
|
|
|
|
estado[ 1 ] = ESTADO_PENDENTE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
estado[ 1 ] = ESTADO_NAO_APLICAVEL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( estadoExame == null || estadoExame.intValue() != 2 )
|
|
|
|
else if ( estadoExame == null || estadoExame.intValue() != 2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -658,18 +663,29 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
estado[ 1 ] = ESTADO_NAO_APLICAVEL;
|
|
|
|
estado[ 1 ] = ESTADO_NAO_APLICAVEL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( estado[ 0 ] == 1 || estado[ 0 ] == 2 ||
|
|
|
|
|
|
|
|
estado[ 1 ] == 1 || estado[ 1 ] == 2 )
|
|
|
|
// System.out.println( "\testado[ 0 ] : " + estado[ 0 ] );
|
|
|
|
|
|
|
|
// System.out.println( "\testado[ 1 ] : " + estado[ 1 ] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( estado[ 0 ] == 1 || estado[ 0 ] == 2 || estado[ 1 ] == 1 || estado[ 1 ] == 2 )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// System.out.println( "\t\testado[ 0 ] == 1 || estado[ 0 ] == 2 || estado[ 1 ] == 1 || estado[ 1 ] == 2 : true" );
|
|
|
|
|
|
|
|
|
|
|
|
links.add( "/" + servletName + "/?" + empresaID + "/" + estabelecimentoID + "/" + trabalhador.getID() );
|
|
|
|
links.add( "/" + servletName + "/?" + empresaID + "/" + estabelecimentoID + "/" + trabalhador.getID() );
|
|
|
|
HashMap dadosTrabalhador = new HashMap();
|
|
|
|
HashMap dadosTrabalhador = new HashMap();
|
|
|
|
dadosTrabalhador.put( "Nome", trabalhador.toString() );
|
|
|
|
dadosTrabalhador.put( "Nome", trabalhador.toString() );
|
|
|
|
dadosTrabalhador.put( "Consulta", CORES_ESTADOS.get( new Integer( estado[ 0 ] ) ) );
|
|
|
|
dadosTrabalhador.put( "Consulta", CORES_ESTADOS.get( new Integer( estado[ 0 ] ) ) );
|
|
|
|
Object text = TEXTOS_ESTADOS.get( new Integer( estado[ 0 ] ) );
|
|
|
|
Object text = TEXTOS_ESTADOS.get( new Integer( estado[ 0 ] ) );
|
|
|
|
|
|
|
|
// System.out.println( "\t\t\tCONSULTA_ESTADO : " + text );
|
|
|
|
dadosTrabalhador.put( "Consulta_estado", text != null ? text : marcacoes[ index ][ 0 ] );
|
|
|
|
dadosTrabalhador.put( "Consulta_estado", text != null ? text : marcacoes[ index ][ 0 ] );
|
|
|
|
|
|
|
|
// System.out.println( "\t\t\t\tFinal : " + dadosTrabalhador.get( "Consulta_estado" ) );
|
|
|
|
|
|
|
|
|
|
|
|
dadosTrabalhador.put( "Exame", CORES_ESTADOS.get( new Integer( estado[ 1 ] ) ) );
|
|
|
|
dadosTrabalhador.put( "Exame", CORES_ESTADOS.get( new Integer( estado[ 1 ] ) ) );
|
|
|
|
text = TEXTOS_ESTADOS.get( new Integer( estado[ 1 ] ) );
|
|
|
|
text = TEXTOS_ESTADOS.get( new Integer( estado[ 1 ] ) );
|
|
|
|
|
|
|
|
// System.out.println( "\t\t\tEXAME_ESTADO : " + text );
|
|
|
|
dadosTrabalhador.put( "Exame_estado", text != null ? text : marcacoes[ index ][ 3 ] );
|
|
|
|
dadosTrabalhador.put( "Exame_estado", text != null ? text : marcacoes[ index ][ 3 ] );
|
|
|
|
|
|
|
|
// System.out.println( "\t\t\t\tFinal : " + dadosTrabalhador.get( "Exame_estado" ) );
|
|
|
|
|
|
|
|
|
|
|
|
dados.add( dadosTrabalhador );
|
|
|
|
dados.add( dadosTrabalhador );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -677,43 +693,33 @@ public class doGetListaTrabalhadoresPendentes
|
|
|
|
protected boolean perfilTemConsultas( Integer trabalhadorID, Integer empresaID )
|
|
|
|
protected boolean perfilTemConsultas( Integer trabalhadorID, Integer empresaID )
|
|
|
|
throws Exception
|
|
|
|
throws Exception
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Executer executer = getExecuter();
|
|
|
|
|
|
|
|
String query = "SELECT a_consultas, b_consultas FROM empresas WHERE id = " + empresaID;
|
|
|
|
String query = "SELECT a_consultas, b_consultas FROM empresas WHERE id = " + empresaID;
|
|
|
|
Virtual2DArray array = executer.executeQuery( new Select( query ) );
|
|
|
|
return perfilTem( query, trabalhadorID );
|
|
|
|
boolean consultas[] = new boolean[]{ "y".equals( array.get( 0, 0 ) ), "n".equals( array.get( 0, 0 ) ) };
|
|
|
|
|
|
|
|
query = "SELECT perfil FROM trabalhadores WHERE id = " + trabalhadorID;
|
|
|
|
|
|
|
|
array = executer.executeQuery( new Select( query ) );
|
|
|
|
|
|
|
|
Integer perfil = ( Integer )array.get( 0, 0 );
|
|
|
|
|
|
|
|
if( perfil != null )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return consultas[ perfil.intValue() - 1 ];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected boolean perfilTemExames( Integer trabalhadorID, Integer empresaID )
|
|
|
|
protected boolean perfilTemExames( Integer trabalhadorID, Integer empresaID )
|
|
|
|
throws Exception
|
|
|
|
throws Exception
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Executer executer = getExecuter();
|
|
|
|
|
|
|
|
String query = "SELECT a_exames, b_exames FROM empresas WHERE id = " + empresaID;
|
|
|
|
String query = "SELECT a_exames, b_exames FROM empresas WHERE id = " + empresaID;
|
|
|
|
|
|
|
|
return perfilTem( query, trabalhadorID );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean perfilTem( String query, Integer trabalhadorID ) throws Exception
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Executer executer = getExecuter();
|
|
|
|
Virtual2DArray array = executer.executeQuery( new Select( query ) );
|
|
|
|
Virtual2DArray array = executer.executeQuery( new Select( query ) );
|
|
|
|
boolean consultas[] = new boolean[]{ "y".equals( array.get( 0, 0 ) ), "n".equals( array.get( 0, 0 ) ) };
|
|
|
|
boolean consultas[] = new boolean[]{ "y".equals( array.get( 0, 0 ) ), "n".equals( array.get( 0, 0 ) ) };
|
|
|
|
query = "SELECT perfil FROM trabalhadores WHERE id = " + trabalhadorID;
|
|
|
|
query = "SELECT perfil FROM trabalhadores WHERE id = " + trabalhadorID;
|
|
|
|
array = executer.executeQuery( new Select( query ) );
|
|
|
|
array = executer.executeQuery( new Select( query ) );
|
|
|
|
Integer perfil = ( Integer )array.get( 0, 0 );
|
|
|
|
Integer perfil = ( Integer )array.get( 0, 0 );
|
|
|
|
if( perfil != null )
|
|
|
|
return perfil != null && consultas[ perfil.intValue() - 1 ];
|
|
|
|
{
|
|
|
|
|
|
|
|
return consultas[ perfil.intValue() - 1 ];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// protected boolean verificarTrabalhador( Object consultas[][], Object exames[][] )
|
|
|
|
// protected boolean verificarTrabalhador( Object consultas[][], Object exames[][] )
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
// boolean estadoConsultas = false;
|
|
|
|
// boolean estadoConsultas = false;
|
|
|
|
|