git-svn-id: https://svn.coded.pt/svn/SIPRP@617 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 18 years ago
parent 2eb7e2730b
commit 45f2647618

@ -49,7 +49,7 @@ import com.evolute.utils.ui.window.LoginWindow;
public class Main implements com.evolute.utils.ui.window.Connector
{
public final static String SHST_VERSION = "7.8";
public final static String SHST_VERSION = "8.1";
private final static ClassLoader classLoader = new EVUtilsImageLib().getClass().getClassLoader();

@ -0,0 +1,11 @@
package siprp.medicina.locais_realizacao;
import com.evolute.utils.data.IDObject;
import com.evolute.utils.data.MappableObject;
public class LocaisRealizacaoConstants
{
protected static final Integer PRESTADOR_ID_SIPRP = new Integer( -1 );
protected static final IDObject PRESTADOR_SIPRP = new MappableObject( PRESTADOR_ID_SIPRP, "SIPRP" );
}

@ -9,8 +9,14 @@
package siprp.medicina.locais_realizacao;
import java.util.Date;
import siprp.medicina.MedicinaConstants;
import com.evolute.utils.Singleton;
import com.evolute.utils.arrays.Virtual2DArray;
import com.evolute.utils.data.IDObject;
import com.evolute.utils.data.MappableObject;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;
import com.evolute.utils.sql.Assignment;
@ -18,9 +24,9 @@ import com.evolute.utils.sql.Expression;
import com.evolute.utils.sql.Field;
import com.evolute.utils.sql.Select;
import com.evolute.utils.sql.Select2;
import com.evolute.utils.sql.Union;
import com.evolute.utils.sql.Update;
import com.evolute.utils.tables.ColumnizedMappable;
import java.util.Date;
/**
*
@ -57,20 +63,50 @@ public class LocaisRealizacaoDataProvider
public ColumnizedMappable[] getEmpresasComMarcacoes( Date data )
throws Exception
{
Select selectConsultas =
new Select2(
new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores", "estabelecimentos" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ),
new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ),
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) },
new String[]{ "estabelecimentos.empresa_id" },
new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
null,
null,
null,
null );
Select selectEcds =
new Select2(
new String[]{ "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores", "estabelecimentos" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ),
new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ),
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) },
new String[]{ "estabelecimentos.empresa_id" },
new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
null,
null,
null,
null );
Select select =
new Select2(
new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos", "empresas" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ),
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ),
new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) },
new String[]{ "DISTINCT empresas.id", "empresas.designacao_social", "empresas.designacao_social_plain" },
new Field( "marcacoes_trabalhador.data" ).isEqual( data ),
new String[]{ "empresas.designacao_social_plain" },
null,
null,
null );
new Select2(
new String[]{ "empresas" },
new Integer[]{},
new Expression[]{},
new String[]{ "DISTINCT empresas.id", "empresas.designacao_social", "empresas.designacao_social_plain" },
new Field( "empresas.id" ).in( new Union( new Select[]{ selectConsultas, selectEcds }, new int[]{} ) ),
new String[]{ "empresas.designacao_social_plain" },
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
ColumnizedMappable empresas[] = new ColumnizedMappable[ array.columnLength() ];
for( int n = 0; n < empresas.length; n++ )
@ -85,85 +121,155 @@ public class LocaisRealizacaoDataProvider
public ColumnizedMappable[] getEstabelecimentosComMarcacoesByEmpresa( Integer empresaID, Date data )
throws Exception
{
Select selectConsultas =
new Select2(
new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ),
new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "trabalhadores.estabelecimento_id" },
new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
null,
null,
null,
null );
Select selectEcds =
new Select2(
new String[]{ "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ),
new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "trabalhadores.estabelecimento_id" },
new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
null,
null,
null,
null );
Select select =
new Select2(
new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ),
new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) },
new String[]{ "DISTINCT estabelecimentos.id", "estabelecimentos.nome", "estabelecimentos.nome_plain" },
new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and(
new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ),
new String[]{ "estabelecimentos.nome_plain" },
null,
null,
null );
new Select2(
new String[]{ "estabelecimentos" },
new Integer[]{},
new Expression[]{},
new String[]{ "DISTINCT estabelecimentos.id", "estabelecimentos.nome", "estabelecimentos.nome_plain" },
new Field( "estabelecimentos.id" ).in( new Union( new Select[]{ selectConsultas, selectEcds }, new int[]{} ) ).and(
new Field( "estabelecimentos.inactivo" ).isEqual( "n" ) ).and(
new Field( "empresa_id" ).isEqual( empresaID ) ),
new String[]{ "estabelecimentos.nome_plain" },
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
ColumnizedMappable estabelecimentos[] = new ColumnizedMappable[ array.columnLength() ];
for( int n = 0; n < estabelecimentos.length; n++ )
{
Integer id = ( Integer ) array.get( n, 0 );
String nome = ( String ) array.get( n, 1 );
System.out.println( id + " - " + nome );
estabelecimentos[ n ] = new ColumnizedMappable( id, nome );
}
System.out.println("Estabelecimentos: " + estabelecimentos.length );
return estabelecimentos;
}
public int getNumeroMarcacoesByEstabelecimentoAndTipo( Integer estabelecimentoID, int tipo, Date data )
public int getNumeroConsultasByEstabelecimentoAndDate( Integer estabelecimentoId, Date data )
throws Exception
{
Select select =
new Select2(
new String[]{ "marcacoes_trabalhador", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER },
new Expression[]{
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "COUNT( * )" },
new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and(
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
new Field( "marcacoes_trabalhador.tipo" ).isEqual( tipo ) ),
null,
null,
null,
null );
new Select2(
new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ),
new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "COUNT( DISTINCT trabalhadores.id )" },
new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and(
new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
null,
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
{
return 0;
}
else
{
return ( ( Number ) array.get( 0, 0 ) ).intValue();
}
return ( ( Number ) array.get( 0, 0 ) ).intValue();
}
public Integer[] getPrestadoresIDByEstabelecimentoAndTipo( Integer estabelecimentoID, int tipo, Date data )
public Integer[] getPrestadoresConsultaIdByEstabelecimentoAndDate( Integer estabelecimentoId, Date data )
throws Exception
{
Select select =
new Select2(
new String[]{ "marcacoes_trabalhador", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER },
new Expression[]{
new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "DISTINCT prestador_id" },
new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and(
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and(
new Field( "marcacoes_trabalhador.tipo" ).isEqual( tipo ) ),
null,
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
Integer ids[] = new Integer[ array.columnLength() ];
for( int n = 0; n < ids.length; n++ )
Select selectExterno =
new Select2(
new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ),
new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "DISTINCT trabalhadores_consultas_datas.prestador_id" },
new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and(
new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
null,
null,
null,
null );
Virtual2DArray arrayExterno = EXECUTER.executeQuery( selectExterno );
Integer ids[] = new Integer[ arrayExterno.columnLength() ];
for( int n = 0; n < arrayExterno.columnLength(); n++ )
{
ids[ n ] = ( Integer ) array.get( n, 0 );
ids[ n ] = ( Integer ) arrayExterno.get( n, 0 );
}
return ids;
}
// public void setPrestadorConsultaIdForEstabelecimentoAndDate( Integer estabelecimentoId, Date data, prestadorId )
// throws Exception
// {
// Select selectConsultas =
// new Select2(
// new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores" },
// new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER },
// new Expression[]{
// new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ),
// new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
// new String[]{ "DISTINCT trabalhadores_consultas_datas.prestador_id" },
// new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and(
// new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and(
// new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
// null,
// null,
// null,
// null );
//
// Select selectExterno =
// new Select2(
// new String[]{ "trabalhadores_consultas_datas", "trabalhadores_consultas", "trabalhadores" },
// new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER },
// new Expression[]{
// new Field( "trabalhadores_consultas_datas.trabalhadores_consultas_id" ).isEqual( new Field( "trabalhadores_consultas.id" ) ),
// new Field( "trabalhadores_consultas.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
// new String[]{ "DISTINCT trabalhadores_consultas_datas.prestador_id" },
// new Field( "trabalhadores_consultas_datas.data" ).isEqual( data ).and(
// new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and(
// new Field( "trabalhadores_consultas_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
// null,
// null,
// null,
// null );
// Virtual2DArray arrayExterno = EXECUTER.executeQuery( selectExterno );
// Integer ids[] = new Integer[ arrayExterno.columnLength() ];
// for( int n = 0; n < arrayExterno.columnLength(); n++ )
// {
// ids[ n ] = ( Integer ) arrayExterno.get( n, 0 );
// }
// return ids;
// }
public void setPrestadorIDForEstabelecimentoAndTipo( Integer estabelecimentoID, int tipo, Date data, Integer prestadorID )
throws Exception
{
@ -194,12 +300,181 @@ public class LocaisRealizacaoDataProvider
}
}
protected Object[][] getGruposEcdsEPrestadoresPorEstabelecimento( Integer estabelecimentoId )
protected IDObject[] getGruposEcdsByEstabelecimentoAndDate( Integer estabelecimentoId, Date data )
throws Exception
{
Select select =
new Select2(
new String[]{ "prt_grupos_protocolo", "prt_tipos_elementos_protocolo", "trabalhadores_ecd",
"trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "prt_grupos_protocolo.id" ).isEqual( new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ) ),
new Field( "prt_tipos_elementos_protocolo.id" ).isEqual( new Field( "trabalhadores_ecd.ecd_id" ) ),
new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ),
new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ),
new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "DISTINCT prt_grupos_protocolo.id", "prt_grupos_protocolo.descricao", "prt_grupos_protocolo.ordem",
"prt_grupos_protocolo.descricao_plain" },
new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and(
new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
new String[]{ "prt_grupos_protocolo.ordem", "prt_grupos_protocolo.descricao_plain" },
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
IDObject grupos[] = new IDObject[ array.columnLength() ];
for( int n = 0; n < grupos.length; n++ )
{
Integer id = ( Integer ) array.get( n, 0 );
String descricao = ( String ) array.get( n, 1 );
grupos[ n ] = new MappableObject( id, descricao );
}
return grupos;
}
public Integer[] getPrestadoresByGrupoEcdEstabelecimentoAndDate( Integer grupoId, Integer estabelecimentoId, Date data )
throws Exception
{
return new Object[][]{ { new Integer( 1 ), "Sangue", new Integer( 1 ) },
{ new Integer( 2 ), "Sangue", new Integer( 1 ) },
{ new Integer( 3 ), "RX Torax", null },
{ new Integer( 4 ), "ECG", new Integer( 1 ) } };
Select select =
new Select2(
new String[]{ "prt_tipos_elementos_protocolo", "trabalhadores_ecd",
"trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "prt_tipos_elementos_protocolo.id" ).isEqual( new Field( "trabalhadores_ecd.ecd_id" ) ),
new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ),
new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ),
new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "DISTINCT trabalhadores_ecds_datas.prestador_id" },
new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and(
new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( grupoId ) ).and(
new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
null,
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
Integer prestadores[] = new Integer[ array.columnLength() ];
for( int n = 0; n < prestadores.length; n++ )
{
prestadores[ n ] = ( Integer ) array.get( n, 0 );
}
return prestadores;
}
public int getNumeroMarcacoesByGrupoEcdEstabelecimentoAndDate( Integer grupoId, Integer estabelecimentoId, Date data )
throws Exception
{
Select select =
new Select2(
new String[]{ "prt_tipos_elementos_protocolo", "trabalhadores_ecd",
"trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "prt_tipos_elementos_protocolo.id" ).isEqual( new Field( "trabalhadores_ecd.ecd_id" ) ),
new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ),
new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ),
new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "COUNT( DISTINCT trabalhadores.id)" },
new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and(
new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( grupoId ) ).and(
new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
null,
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
return ( ( Number ) array.get( 0, 0 ) ).intValue();
}
protected IDObject[] getExamesOficiaisByEstabelecimentoAndDate( Integer estabelecimentoId, Date data )
throws Exception
{
Select select =
new Select2(
new String[]{ "ecd_oficial", "trabalhadores_ecd",
"trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "ecd_oficial.id" ).isEqual( new Field( "trabalhadores_ecd.ecd_oficial_id" ) ),
new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ),
new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ),
new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "DISTINCT ecd_oficial.id", "ecd_oficial.descricao", "ecd_oficial.ordem",
"ecd_oficial.descricao_plain" },
new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and(
new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
new String[]{ "ecd_oficial.ordem", "ecd_oficial.descricao_plain" },
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
IDObject ecds[] = new IDObject[ array.columnLength() ];
for( int n = 0; n < ecds.length; n++ )
{
Integer id = ( Integer ) array.get( n, 0 );
String descricao = ( String ) array.get( n, 1 );
ecds[ n ] = new MappableObject( id, descricao );
}
return ecds;
}
public Integer[] getPrestadoresByEcdOficialEstabelecimentoAndDate( Integer ecdOficialId, Integer estabelecimentoId, Date data )
throws Exception
{
Select select =
new Select2(
new String[]{ "trabalhadores_ecd", "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ),
new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ),
new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "DISTINCT trabalhadores_ecds_datas.prestador_id" },
new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and(
new Field( "trabalhadores_ecd.ecd_oficial_id" ).isEqual( ecdOficialId ) ).and(
new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
null,
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
Integer prestadores[] = new Integer[ array.columnLength() ];
for( int n = 0; n < prestadores.length; n++ )
{
prestadores[ n ] = ( Integer ) array.get( n, 0 );
}
return prestadores;
}
public int getNumeroMarcacaoesByEcdOficialEstabelecimentoAndDate( Integer ecdOficialId, Integer estabelecimentoId, Date data )
throws Exception
{
Select select =
new Select2(
new String[]{ "trabalhadores_ecd", "trabalhadores_ecds_datas", "trabalhadores_ecds", "trabalhadores" },
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER },
new Expression[]{
new Field( "trabalhadores_ecd.trabalhadores_ecds_datas_id" ).isEqual( new Field( "trabalhadores_ecds_datas.id" ) ),
new Field( "trabalhadores_ecds_datas.trabalhadores_ecds_id" ).isEqual( new Field( "trabalhadores_ecds.id" ) ),
new Field( "trabalhadores_ecds.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) },
new String[]{ "COUNT( DISTINCT trabalhadores.id)" },
new Field( "trabalhadores_ecds_datas.data" ).isEqual( data ).and(
new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoId ) ).and(
new Field( "trabalhadores_ecd.ecd_oficial_id" ).isEqual( ecdOficialId ) ).and(
new Field( "trabalhadores_ecds_datas.estado" ).isEqual( new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ) ),
null,
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
return ( ( Number ) array.get( 0, 0 ) ).intValue();
}
}

@ -60,10 +60,6 @@ public class LocaisRealizacaoWindow extends JFrame
*
*/
private static final long serialVersionUID = 1L;
protected static final Integer PRESTADOR_ID_SIPRP = new Integer( -1 );
protected static final IDObject PRESTADOR_SIPRP = new MappableObject( PRESTADOR_ID_SIPRP, "SIPRP" );
protected JCalendarPanel dataPanel;
protected JButton carregarButton;
@ -79,6 +75,8 @@ public class LocaisRealizacaoWindow extends JFrame
// protected JLabel numeroECDsLabel;
protected Integer idsGruposEcds[];
protected JComboBox prestadoresECDsCombos[];
protected Integer idsEcdsOficiais[];
protected JComboBox prestadoresECDsOficiaisCombos[];
protected JButton enviarECDsButton;
protected JScrollPane listaEcdsScroll;
// protected JButton faxECDsButton;
@ -380,8 +378,7 @@ public class LocaisRealizacaoWindow extends JFrame
try
{
int countConsultas =
provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID,
Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data );
provider.getNumeroConsultasByEstabelecimentoAndDate( estabelecimentoID, data );
// int countECDs =
// provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID,
// Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data );
@ -390,8 +387,7 @@ public class LocaisRealizacaoWindow extends JFrame
numeroConsultasLabel.setText( "" + countConsultas );
enviarConsultasButton.setEnabled( true );
Integer[] escolhidos =
provider.getPrestadoresIDByEstabelecimentoAndTipo( estabelecimentoID,
Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data );
provider.getPrestadoresConsultaIdByEstabelecimentoAndDate( estabelecimentoID, data );
if( escolhidos.length == 1 )
{
numeroConsultasLabel.setForeground( Color.green.darker() );
@ -424,9 +420,14 @@ public class LocaisRealizacaoWindow extends JFrame
}
}
}
Object ecds[][] = provider.getGruposEcdsEPrestadoresPorEstabelecimento( estabelecimentoID );
JPanel ecdsPanel = new JPanel();
double rows[] = new double[ ecds.length + 1 ];
IDObject prestadoresECDs[] = prestadoresProvider.getPrestadoresECDsActivos();
IDObject gruposEcds[] = provider.getGruposEcdsByEstabelecimentoAndDate( estabelecimentoID, data );
idsGruposEcds = new Integer[ gruposEcds.length ];
prestadoresECDsCombos = new JComboBox[ gruposEcds.length ];
JPanel gruposEcdsPanel = new JPanel();
double rows[] = new double[ gruposEcds.length + 1 ];
for( int n = 0; n < rows.length - 1; n++ )
{
rows[ n ] = TableLayoutConstraints.MINIMUM;
@ -437,17 +438,145 @@ public class LocaisRealizacaoWindow extends JFrame
new double[]{ TableLayoutConstraints.FILL, TableLayoutConstraints.MINIMUM,
TableLayoutConstraints.FILL },
rows );
ecdsPanel.setLayout( layout );
for( int n = 0; n < ecds.length; n++ )
gruposEcdsPanel.setLayout( layout );
gruposEcdsPanel.setBorder(
BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(),
"Protocolo" ) );
for( int n = 0; n < gruposEcds.length; n++ )
{
JLabel ecdLabel = new JLabel( "" + gruposEcds[ n ].toString() );
int numero =
provider.getNumeroMarcacoesByGrupoEcdEstabelecimentoAndDate(
gruposEcds[ n ].getID(), estabelecimentoID, data );
Integer escolhidos[] =
provider.getPrestadoresByGrupoEcdEstabelecimentoAndDate(
gruposEcds[ n ].getID(), estabelecimentoID, data );
JLabel numeroLabel = new JLabel( "" + numero, JLabel.RIGHT );
if( escolhidos.length > 1 )
{
numeroLabel.setForeground( Color.red.darker() );
}
else
{
numeroLabel.setForeground( Color.green.darker() );
}
prestadoresECDsCombos[ n ] = new JComboBox();
prestadoresECDsCombos[ n ].addItem( LocaisRealizacaoConstants.PRESTADOR_SIPRP );
for( int p = 0; p < prestadoresECDs.length; p++ )
{
prestadoresECDsCombos[ n ].addItem( prestadoresECDs[ p ] );
}
int e;
for( e = 0; e < escolhidos.length; e++ )
{
if( escolhidos[ e ] != null )
{
break;
}
}
if( e == escolhidos.length || escolhidos[ e ] == null )
{
prestadoresECDsCombos[ n ].setSelectedIndex( 0 );
}
else
{
for( int p = 0; p < prestadoresECDsCombos[ n ].getItemCount(); p++ )
{
IDObject prestador = ( IDObject ) prestadoresECDsCombos[ n ].getItemAt( p );
if( prestador.getID().equals( escolhidos[ e ] ) )
{
prestadoresECDsCombos[ n ].setSelectedIndex( p );
}
}
}
gruposEcdsPanel.add( ecdLabel, new TableLayoutConstraints( 0, n ) );
gruposEcdsPanel.add( numeroLabel, new TableLayoutConstraints( 1, n ) );
gruposEcdsPanel.add( prestadoresECDsCombos[ n ], new TableLayoutConstraints( 2, n ) );
}
IDObject ecdsOficiais[] = provider.getExamesOficiaisByEstabelecimentoAndDate( estabelecimentoID, data );
idsEcdsOficiais = new Integer[ ecdsOficiais.length ];
prestadoresECDsOficiaisCombos = new JComboBox[ ecdsOficiais.length ];
JPanel ecdsOficiaisPanel = new JPanel();
rows = new double[ ecdsOficiais.length + 1 ];
for( int n = 0; n < rows.length - 1; n++ )
{
rows[ n ] = TableLayoutConstraints.MINIMUM;
}
rows[ rows.length - 1 ] = TableLayoutConstraints.FILL;
layout = new TableLayout(
new double[]{ TableLayoutConstraints.FILL, TableLayoutConstraints.MINIMUM,
TableLayoutConstraints.FILL },
rows );
ecdsOficiaisPanel.setLayout( layout );
ecdsOficiaisPanel.setBorder(
BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(),
"Extra protocolo" ) );
for( int n = 0; n < ecdsOficiais.length; n++ )
{
JLabel ecdLabel = new JLabel( "" + ecds[ n ][ 1 ] );
JLabel numeroLabel = new JLabel( "" + ( ( n * 23 ) % 7 ), JLabel.RIGHT );
JComboBox prestadorCombo = new JComboBox();
prestadorCombo.addItem( "SIPRP" );
ecdsPanel.add( ecdLabel, new TableLayoutConstraints( 0, n ) );
ecdsPanel.add( numeroLabel, new TableLayoutConstraints( 1, n ) );
ecdsPanel.add( prestadorCombo, new TableLayoutConstraints( 2, n ) );
JLabel ecdLabel = new JLabel( "" + ecdsOficiais[ n ].toString() );
int numero =
provider.getNumeroMarcacaoesByEcdOficialEstabelecimentoAndDate(
ecdsOficiais[ n ].getID(), estabelecimentoID, data );
Integer escolhidos[] =
provider.getPrestadoresByEcdOficialEstabelecimentoAndDate(
ecdsOficiais[ n ].getID(), estabelecimentoID, data );
JLabel numeroLabel = new JLabel( "" + numero, JLabel.RIGHT );
if( escolhidos.length > 1 )
{
numeroLabel.setForeground( Color.red.darker() );
}
else
{
numeroLabel.setForeground( Color.green.darker() );
}
prestadoresECDsOficiaisCombos[ n ] = new JComboBox();
prestadoresECDsOficiaisCombos[ n ].addItem( LocaisRealizacaoConstants.PRESTADOR_SIPRP );
for( int p = 0; p < prestadoresECDs.length; p++ )
{
prestadoresECDsOficiaisCombos[ n ].addItem( prestadoresECDs[ p ] );
}
int e;
for( e = 0; e < escolhidos.length; e++ )
{
if( escolhidos[ e ] != null )
{
break;
}
}
if( e == escolhidos.length || escolhidos[ e ] == null )
{
prestadoresECDsOficiaisCombos[ n ].setSelectedIndex( 0 );
}
else
{
for( int p = 0; p < prestadoresECDsOficiaisCombos[ n ].getItemCount(); p++ )
{
IDObject prestador = ( IDObject ) prestadoresECDsOficiaisCombos[ n ].getItemAt( p );
if( prestador.getID().equals( escolhidos[ e ] ) )
{
prestadoresECDsOficiaisCombos[ n ].setSelectedIndex( p );
}
}
}
ecdsOficiaisPanel.add( ecdLabel, new TableLayoutConstraints( 0, n ) );
ecdsOficiaisPanel.add( numeroLabel, new TableLayoutConstraints( 1, n ) );
ecdsOficiaisPanel.add( prestadoresECDsOficiaisCombos[ n ], new TableLayoutConstraints( 2, n ) );
}
JPanel ecdsPanel = new JPanel();
TableLayout ecdsLayout =
new TableLayout( new double[]{ TableLayoutConstraints.FILL },
new double[]{ TableLayoutConstraints.MINIMUM, TableLayoutConstraints.MINIMUM,
TableLayoutConstraints.FILL } );
ecdsPanel.setLayout( ecdsLayout );
ecdsPanel.add( gruposEcdsPanel, new TableLayoutConstraints( 0, 0 ) );
ecdsPanel.add( ecdsOficiaisPanel, new TableLayoutConstraints( 0, 1 ) );
listaEcdsScroll.setViewportView( ecdsPanel );
// if( countECDs > 0 )
// {
@ -502,7 +631,7 @@ public class LocaisRealizacaoWindow extends JFrame
IDObject prestadoresConsultas[] = prestadoresProvider.getPrestadoresConsultasActivos();
IDObject prestadoresECDs[] = prestadoresProvider.getPrestadoresECDsActivos();
prestadoresConsultasCombo.removeAllItems();
prestadoresConsultasCombo.addItem( PRESTADOR_SIPRP );
prestadoresConsultasCombo.addItem( LocaisRealizacaoConstants.PRESTADOR_SIPRP );
for( int n = 0; n < prestadoresConsultas.length; n++ )
{
prestadoresConsultasCombo.addItem( prestadoresConsultas[ n ] );
@ -582,7 +711,7 @@ public class LocaisRealizacaoWindow extends JFrame
try
{
Integer prestadorID = ( ( IDObject ) prestadoresConsultasCombo.getSelectedItem() ).getID();
if( PRESTADOR_ID_SIPRP.equals( prestadorID ) )
if( LocaisRealizacaoConstants.PRESTADOR_ID_SIPRP.equals( prestadorID ) )
{
prestadorID = null;
}

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultas.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasDatas.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/
@ -16,6 +16,7 @@ public final class TrabalhadoresConsultasDatas implements JDOInnerObject
private Date data;
private Integer trabalhadores_consultas_id;
private Integer estado;
private Integer prestador_id;
public TrabalhadoresConsultasDatas()
{
@ -39,6 +40,10 @@ public final class TrabalhadoresConsultasDatas implements JDOInnerObject
{
return estado;
}
else if( fieldName == TrabalhadoresConsultasDatasData.PRESTADOR_ID )
{
return prestador_id;
}
else if( fieldName.equals( TrabalhadoresConsultasDatasData.ID ) )
{
return id;
@ -55,6 +60,10 @@ public final class TrabalhadoresConsultasDatas implements JDOInnerObject
{
return estado;
}
else if( fieldName.equals( TrabalhadoresConsultasDatasData.PRESTADOR_ID ) )
{
return prestador_id;
}
return null;
}
@ -76,6 +85,10 @@ public final class TrabalhadoresConsultasDatas implements JDOInnerObject
{
estado = ( Integer ) value;
}
else if( fieldName == TrabalhadoresConsultasDatasData.PRESTADOR_ID )
{
prestador_id = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresConsultasDatasData.ID ) )
{
id = ( Integer ) value;
@ -92,6 +105,10 @@ public final class TrabalhadoresConsultasDatas implements JDOInnerObject
{
estado = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresConsultasDatasData.PRESTADOR_ID ) )
{
prestador_id = ( Integer ) value;
}
}
public Class getOuterClass()

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasDatasData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/
@ -16,13 +16,14 @@ public final class TrabalhadoresConsultasDatasData extends JDOObject
public static final String DATA = "data";
public static final String TRABALHADORES_CONSULTAS_ID = "trabalhadores_consultas_id";
public static final String ESTADO = "estado";
public static final String PRESTADOR_ID = "prestador_id";
public static final String FIELD_NAMES[] = new String[]{
DATA, TRABALHADORES_CONSULTAS_ID, ESTADO, };
DATA, TRABALHADORES_CONSULTAS_ID, ESTADO, PRESTADOR_ID, };
protected static final String ALL_FIELD_NAMES[] = new String[]{
ID, DATA, TRABALHADORES_CONSULTAS_ID, ESTADO, };
ID, DATA, TRABALHADORES_CONSULTAS_ID, ESTADO, PRESTADOR_ID, };
private HashMap dataHash;

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasDatasEmails.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasDatasEmailsData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasDatasEmailsID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasDatasID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasDatasObservacoes.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasDatasObservacoesData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasDatasObservacoesID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresConsultasID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcd.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/
@ -14,9 +14,7 @@ public final class TrabalhadoresEcd implements JDOInnerObject
private Integer id;
private Integer ecd_id;
private Integer ecd_oficial_id;
private Integer prestador_id;
private Integer estado;
private Integer trabalhadores_ecds_id;
private Integer trabalhadores_ecds_datas_id;
public TrabalhadoresEcd()
@ -37,18 +35,10 @@ public final class TrabalhadoresEcd implements JDOInnerObject
{
return ecd_oficial_id;
}
else if( fieldName == TrabalhadoresEcdData.PRESTADOR_ID )
{
return prestador_id;
}
else if( fieldName == TrabalhadoresEcdData.ESTADO )
{
return estado;
}
else if( fieldName == TrabalhadoresEcdData.TRABALHADORES_ECDS_ID )
{
return trabalhadores_ecds_id;
}
else if( fieldName == TrabalhadoresEcdData.TRABALHADORES_ECDS_DATAS_ID )
{
return trabalhadores_ecds_datas_id;
@ -65,18 +55,10 @@ public final class TrabalhadoresEcd implements JDOInnerObject
{
return ecd_oficial_id;
}
else if( fieldName.equals( TrabalhadoresEcdData.PRESTADOR_ID ) )
{
return prestador_id;
}
else if( fieldName.equals( TrabalhadoresEcdData.ESTADO ) )
{
return estado;
}
else if( fieldName.equals( TrabalhadoresEcdData.TRABALHADORES_ECDS_ID ) )
{
return trabalhadores_ecds_id;
}
else if( fieldName.equals( TrabalhadoresEcdData.TRABALHADORES_ECDS_DATAS_ID ) )
{
return trabalhadores_ecds_datas_id;
@ -98,18 +80,10 @@ public final class TrabalhadoresEcd implements JDOInnerObject
{
ecd_oficial_id = ( Integer ) value;
}
else if( fieldName == TrabalhadoresEcdData.PRESTADOR_ID )
{
prestador_id = ( Integer ) value;
}
else if( fieldName == TrabalhadoresEcdData.ESTADO )
{
estado = ( Integer ) value;
}
else if( fieldName == TrabalhadoresEcdData.TRABALHADORES_ECDS_ID )
{
trabalhadores_ecds_id = ( Integer ) value;
}
else if( fieldName == TrabalhadoresEcdData.TRABALHADORES_ECDS_DATAS_ID )
{
trabalhadores_ecds_datas_id = ( Integer ) value;
@ -126,18 +100,10 @@ public final class TrabalhadoresEcd implements JDOInnerObject
{
ecd_oficial_id = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresEcdData.PRESTADOR_ID ) )
{
prestador_id = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresEcdData.ESTADO ) )
{
estado = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresEcdData.TRABALHADORES_ECDS_ID ) )
{
trabalhadores_ecds_id = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresEcdData.TRABALHADORES_ECDS_DATAS_ID ) )
{
trabalhadores_ecds_datas_id = ( Integer ) value;

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/
@ -15,19 +15,15 @@ public final class TrabalhadoresEcdData extends JDOObject
public static final String ID = "id";
public static final String ECD_ID = "ecd_id";
public static final String ECD_OFICIAL_ID = "ecd_oficial_id";
public static final String PRESTADOR_ID = "prestador_id";
public static final String ESTADO = "estado";
public static final String TRABALHADORES_ECDS_ID = "trabalhadores_ecds_id";
public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id";
public static final String FIELD_NAMES[] = new String[]{
ECD_ID, ECD_OFICIAL_ID, PRESTADOR_ID, ESTADO, TRABALHADORES_ECDS_ID,
TRABALHADORES_ECDS_DATAS_ID, };
ECD_ID, ECD_OFICIAL_ID, ESTADO, TRABALHADORES_ECDS_DATAS_ID, };
protected static final String ALL_FIELD_NAMES[] = new String[]{
ID, ECD_ID, ECD_OFICIAL_ID, PRESTADOR_ID, ESTADO, TRABALHADORES_ECDS_ID,
TRABALHADORES_ECDS_DATAS_ID, };
ID, ECD_ID, ECD_OFICIAL_ID, ESTADO, TRABALHADORES_ECDS_DATAS_ID, };
private HashMap dataHash;

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcds.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsDatas.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/
@ -16,6 +16,7 @@ public final class TrabalhadoresEcdsDatas implements JDOInnerObject
private Integer trabalhadores_ecds_id;
private Date data;
private Integer estado;
private Integer prestador_id;
public TrabalhadoresEcdsDatas()
{
@ -39,6 +40,10 @@ public final class TrabalhadoresEcdsDatas implements JDOInnerObject
{
return estado;
}
else if( fieldName == TrabalhadoresEcdsDatasData.PRESTADOR_ID )
{
return prestador_id;
}
else if( fieldName.equals( TrabalhadoresEcdsDatasData.ID ) )
{
return id;
@ -55,6 +60,10 @@ public final class TrabalhadoresEcdsDatas implements JDOInnerObject
{
return estado;
}
else if( fieldName.equals( TrabalhadoresEcdsDatasData.PRESTADOR_ID ) )
{
return prestador_id;
}
return null;
}
@ -76,6 +85,10 @@ public final class TrabalhadoresEcdsDatas implements JDOInnerObject
{
estado = ( Integer ) value;
}
else if( fieldName == TrabalhadoresEcdsDatasData.PRESTADOR_ID )
{
prestador_id = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresEcdsDatasData.ID ) )
{
id = ( Integer ) value;
@ -92,6 +105,10 @@ public final class TrabalhadoresEcdsDatas implements JDOInnerObject
{
estado = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresEcdsDatasData.PRESTADOR_ID ) )
{
prestador_id = ( Integer ) value;
}
}
public Class getOuterClass()

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsDatasData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/
@ -16,13 +16,14 @@ public final class TrabalhadoresEcdsDatasData extends JDOObject
public static final String TRABALHADORES_ECDS_ID = "trabalhadores_ecds_id";
public static final String DATA = "data";
public static final String ESTADO = "estado";
public static final String PRESTADOR_ID = "prestador_id";
public static final String FIELD_NAMES[] = new String[]{
TRABALHADORES_ECDS_ID, DATA, ESTADO, };
TRABALHADORES_ECDS_ID, DATA, ESTADO, PRESTADOR_ID, };
protected static final String ALL_FIELD_NAMES[] = new String[]{
ID, TRABALHADORES_ECDS_ID, DATA, ESTADO, };
ID, TRABALHADORES_ECDS_ID, DATA, ESTADO, PRESTADOR_ID, };
private HashMap dataHash;

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsDatasEmails.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsDatasEmailsData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsDatasEmailsID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsDatasID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsDatasObservacoes.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsDatasObservacoesData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsDatasObservacoesID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresEcdsID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresFichasAptidao.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresFichasAptidaoData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresFichasAptidaoID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresProcesso.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresProcessoData.java
*
* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007
* Generated by com.evutils.codegen.JDOObjectGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -1,7 +1,7 @@
/*
* TrabalhadoresProcessoID.java
*
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007
* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Dec 20, 2007
*
* Use but DON'T TOUCH
*/

@ -131,6 +131,10 @@
<extension vendor-name="jpox" key="column-name" value="estado"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
<field name="prestador_id" primary-key="false">
<extension vendor-name="jpox" key="column-name" value="prestador_id"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
</class>
<class name="TrabalhadoresEcds" identity-type="application" objectid-class="siprp.medicina.processo.data.TrabalhadoresEcdsID">
<extension vendor-name="jpox" key="table-name" value="trabalhadores_ecds"/>
@ -176,18 +180,10 @@
<extension vendor-name="jpox" key="column-name" value="ecd_oficial_id"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
<field name="prestador_id" primary-key="false">
<extension vendor-name="jpox" key="column-name" value="prestador_id"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
<field name="estado" primary-key="false">
<extension vendor-name="jpox" key="column-name" value="estado"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
<field name="trabalhadores_ecds_id" primary-key="false">
<extension vendor-name="jpox" key="column-name" value="trabalhadores_ecds_id"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
<field name="trabalhadores_ecds_datas_id" primary-key="false">
<extension vendor-name="jpox" key="column-name" value="trabalhadores_ecds_datas_id"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
@ -268,6 +264,10 @@
<extension vendor-name="jpox" key="column-name" value="estado"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
<field name="prestador_id" primary-key="false">
<extension vendor-name="jpox" key="column-name" value="prestador_id"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
</class>
<class name="TrabalhadoresConsultas" identity-type="application" objectid-class="siprp.medicina.processo.data.TrabalhadoresConsultasID">
<extension vendor-name="jpox" key="table-name" value="trabalhadores_consultas"/>

@ -9,21 +9,22 @@
package siprp.medicina.processo.detalhes;
import com.evolute.utils.Singleton;
import com.evolute.utils.data.IDObject;
import com.evolute.utils.jdo.JDOProvider;
import com.evolute.utils.ui.DialogException;
import com.evolute.utils.ui.calendar.JCalendarPanel;
import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import java.util.HashMap;
import java.util.Vector;
import javax.swing.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import siprp.medicina.MedicinaConstants;
import siprp.medicina.processo.ProcessoConstants;
import siprp.medicina.processo.ProcessoDataProvider;
@ -32,6 +33,12 @@ import siprp.medicina.processo.ProcessoListener;
import siprp.medicina.processo.data.TrabalhadoresConsultasData;
import siprp.medicina.processo.data.TrabalhadoresConsultasDatasData;
import com.evolute.utils.Singleton;
import com.evolute.utils.data.IDObject;
import com.evolute.utils.jdo.JDOProvider;
import com.evolute.utils.ui.DialogException;
import com.evolute.utils.ui.calendar.JCalendarPanel;
/**
*
* @author fpalma

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -27,7 +27,8 @@ public class UpdateList
new Update[]{ new siprp.update.updates.V6_1_To_V7_0(), new siprp.update.updates.V7_0_To_V7_2(),
new siprp.update.updates.V7_2_To_V7_4(), new siprp.update.updates.V7_4_To_V7_5(),
new siprp.update.updates.V7_5_To_V7_6(), new siprp.update.updates.V7_6_To_V7_7(),
new siprp.update.updates.V7_7_To_V7_8(), new siprp.update.updates.V7_8_To_V7_9() };
new siprp.update.updates.V7_7_To_V7_8(), new siprp.update.updates.V7_8_To_V7_9(),
new siprp.update.updates.V7_9_To_V8_0(), new siprp.update.updates.V8_0_To_V8_1() };
protected static Executer EXECUTER;
protected static double version = -1;

@ -0,0 +1,75 @@
/*
* V7_9_To_V8_0.java
*
* Created on December 19, 2007, 3:12 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.update.updates;
import com.evolute.utils.Singleton;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;
import com.evolute.utils.sql.Assignment;
import com.evolute.utils.sql.Field;
/**
*
* @author fpalma
*/
public class V7_9_To_V8_0
implements siprp.update.Update
{
/**
* Creates a new instance of V7_9_To_V8_0
*/
public V7_9_To_V8_0()
{
}
public String []listChanges()
{
return new String[]{ "Alterar tabela dos ecds"};
}
public double getStartVersion()
{
return 7.9;
}
public double getEndVersion()
{
return 8.0;
}
public void doUpdate()
throws Exception
{
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
Executer executer = dbm.getSharedExecuter();
com.evolute.utils.sql.Update update =
new com.evolute.utils.sql.Update(
"ALTER TABLE trabalhadores_ecd DROP CONSTRAINT trabalhadores_ecd_trabalhadores_ecds_id_fkey;" );
executer.executeQuery( update );
update =
new com.evolute.utils.sql.Update(
"ALTER TABLE trabalhadores_ecd DROP trabalhadores_ecds_id;" );
executer.executeQuery( update );
update =
new com.evolute.utils.sql.Update(
"ALTER TABLE trabalhadores_ecd DROP CONSTRAINT trabalhadores_ecg_prestador_id_fkey;" );
executer.executeQuery( update );
update =
new com.evolute.utils.sql.Update(
"ALTER TABLE trabalhadores_ecd DROP prestador_id;" );
executer.executeQuery( update );
}
public String toString()
{
return "v" + getStartVersion() + " para v" + getEndVersion();
}
}

@ -0,0 +1,67 @@
/*
* V8_0_To_V8_1.java
*
* Created on December 19, 2007, 3:12 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.update.updates;
import com.evolute.utils.Singleton;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;
import com.evolute.utils.sql.Assignment;
import com.evolute.utils.sql.Field;
/**
*
* @author fpalma
*/
public class V8_0_To_V8_1
implements siprp.update.Update
{
/**
* Creates a new instance of V8_0_To_V8_1
*/
public V8_0_To_V8_1()
{
}
public String []listChanges()
{
return new String[]{ "Alterar tabela dos ecds"};
}
public double getStartVersion()
{
return 8.0;
}
public double getEndVersion()
{
return 8.1;
}
public void doUpdate()
throws Exception
{
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
Executer executer = dbm.getSharedExecuter();
com.evolute.utils.sql.Update update =
new com.evolute.utils.sql.Update(
"CREATE SEQUENCE trabalhadores_ecd_id_seq;" );
executer.executeQuery( update );
update =
new com.evolute.utils.sql.Update(
"ALTER TABLE trabalhadores_ecd ALTER COLUMN id SET DEFAULT NEXTVAL('trabalhadores_ecd_id_seq');" );
executer.executeQuery( update );
}
public String toString()
{
return "v" + getStartVersion() + " para v" + getEndVersion();
}
}
Loading…
Cancel
Save