diff --git a/trunk/siprp/medicina/MedicinaConstants.java b/trunk/siprp/medicina/MedicinaConstants.java new file mode 100644 index 00000000..81181e28 --- /dev/null +++ b/trunk/siprp/medicina/MedicinaConstants.java @@ -0,0 +1,26 @@ +/* + * MedicinaConstants.java + * + * Created on 6 de Julho de 2006, 15:22 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina; + +/** + * + * @author fpalma + */ +public interface MedicinaConstants +{ + public static final int MOTIVO_ADMISSAO = 1; + public static final Integer MOTIVO_ADMISSAO_INTEGER = new Integer( MOTIVO_ADMISSAO ); + public static final int MOTIVO_PERIODICO = 2; + public static final Integer MOTIVO_PERIODICO_INTEGER = new Integer( MOTIVO_PERIODICO ); + public static final int MOTIVO_OCASIONAL = 3; + public static final Integer MOTIVO_OCASIONAL_INTEGER = new Integer( MOTIVO_OCASIONAL ); + public static final int MOTIVO_PERIODICO_INICIAL = 5; + public static final Integer MOTIVO_PERIODICO_INICIAL_INTEGER = new Integer( MOTIVO_PERIODICO_INICIAL ); +} diff --git a/trunk/siprp/medicina/MedicinaDataProvider.java b/trunk/siprp/medicina/MedicinaDataProvider.java index 130aa9a9..7296243e 100644 --- a/trunk/siprp/medicina/MedicinaDataProvider.java +++ b/trunk/siprp/medicina/MedicinaDataProvider.java @@ -27,6 +27,7 @@ import siprp.data.*; * @author fpalma */ public class MedicinaDataProvider extends MetaProvider + implements MedicinaConstants { public static final int ESTADO_POR_REALIZAR = 0; public static final int ESTADO_PARCIALMENTE_REALIZADO = 1; @@ -292,13 +293,22 @@ public class MedicinaDataProvider extends MetaProvider public Integer getConsultaIDByTrabalhadorMotivoAndDate( Integer trabalhadorID, Integer motivo, Date data ) throws Exception { + Integer motivos[]; + if( motivo != null && ( motivo.intValue() == MOTIVO_PERIODICO || motivo.intValue() == MOTIVO_PERIODICO_INICIAL ) ) + { + motivos = new Integer[]{ MOTIVO_PERIODICO_INTEGER, MOTIVO_PERIODICO_INICIAL_INTEGER }; + } + else + { + motivos = new Integer[]{ motivo }; + } Select select = new Select( new String[]{ "marcacoes_trabalhador" }, new String[]{ "id" }, new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( new Field( "data" ).isEqual( data ) ).and( - new Field( "motivo" ).isEqual( motivo ) ) ); + new Field( "motivo" ).in( motivos ) ) ); Virtual2DArray array = executer.executeQuery( select ); Integer id; if( array.columnLength() == 0 || array.get( 0, 0 ) == null )