|
|
|
|
@ -108,6 +108,7 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes";
|
|
|
|
|
public static final String TRABALHADOR_ID = "trabalhador_id";
|
|
|
|
|
public static final String MEDICO_ID = "medico_id";
|
|
|
|
|
public static final String PDF = "pdf";
|
|
|
|
|
|
|
|
|
|
public static final DBTable EXAMES =
|
|
|
|
|
new DBTable( T_EXAMES,
|
|
|
|
|
@ -115,7 +116,7 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1,
|
|
|
|
|
OUTRA_FUNCAO_2, OUTRA_FUNCAO_3,
|
|
|
|
|
OUTRA_FUNCAO_4, PROXIMO_EXAME,
|
|
|
|
|
OUTRAS_RECOMENDACOES, TRABALHADOR_ID, MEDICO_ID },
|
|
|
|
|
OUTRAS_RECOMENDACOES, TRABALHADOR_ID, MEDICO_ID, PDF },
|
|
|
|
|
ID );
|
|
|
|
|
|
|
|
|
|
public static DBReference R_ESTABELECIMENTO_EMPRESA = new DBReference( ESTABELECIMENTOS.getFieldByName( EMPRESA_ID ) );
|
|
|
|
|
@ -141,6 +142,7 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
EMPRESAS.disableSave( INACTIVO );
|
|
|
|
|
ESTABELECIMENTOS.disableSave( INACTIVO );
|
|
|
|
|
TRABALHADORES.disableSave( INACTIVO );
|
|
|
|
|
EXAMES.disableSave( PDF );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception e )
|
|
|
|
|
{
|
|
|
|
|
@ -292,4 +294,39 @@ public class FichaDataProvider extends MetaProvider implements SearchExecuter {
|
|
|
|
|
return array.getObjects();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void savePDF( MetaObject exame )
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
if( exame == null )
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DBKey key = exame.getPrimaryKeyValue();
|
|
|
|
|
DBField fields[] = EXAMES.getPrimaryKey();
|
|
|
|
|
Integer id = new Integer( ((Number)key.getFieldValue( fields[ 0 ] )).intValue() );
|
|
|
|
|
if( id == null )
|
|
|
|
|
{
|
|
|
|
|
throw new Exception( "Error saving pdf: id is null" );
|
|
|
|
|
}
|
|
|
|
|
byte []pdf = (byte[]) exame.getProperty( PDF );
|
|
|
|
|
BlobUpdate bUpdate = new BlobUpdate( T_EXAMES, PDF, pdf, new Field( ID ).isEqual( id ) );
|
|
|
|
|
executer.executeQuery( bUpdate );
|
|
|
|
|
bUpdate = new BlobUpdate( T_EXAMES, "pdf2", pdf, new Field( ID ).isEqual( id ) );
|
|
|
|
|
executer.executeQuery( bUpdate );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Integer getLastExameIDForTrabalhador( Integer trabalhadorID )
|
|
|
|
|
throws Exception
|
|
|
|
|
{
|
|
|
|
|
Select select = new Select( new String[]{ T_EXAMES },
|
|
|
|
|
new String[]{ ID, DATA },
|
|
|
|
|
new Field( TRABALHADOR_ID ).isEqual( trabalhadorID ),
|
|
|
|
|
new String[]{ DATA + " DESC", ID + " DESC" }, null );
|
|
|
|
|
Virtual2DArray array = executer.executeQuery( select );
|
|
|
|
|
if( array.columnLength() == 0 )
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return new Integer( ( (Number) array.get( 0, 0 ) ).intValue() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|