|  |  | @ -29,6 +29,8 @@ import java.util.Date; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.HashMap; |  |  |  | import java.util.HashMap; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Vector; |  |  |  | import java.util.Vector; | 
			
		
	
		
		
			
				
					
					|  |  |  | import siprp.medicina.MedicinaConstants; |  |  |  | import siprp.medicina.MedicinaConstants; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import siprp.medicina.processo.data.TrabalhadoresConsultasData; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import siprp.medicina.processo.data.TrabalhadoresConsultasDatasData; | 
			
		
	
		
		
			
				
					
					|  |  |  | import siprp.medicina.processo.data.TrabalhadoresProcessoData; |  |  |  | import siprp.medicina.processo.data.TrabalhadoresProcessoData; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | /** |  |  |  | /** | 
			
		
	
	
		
		
			
				
					|  |  | @ -347,4 +349,150 @@ public class ProcessoDataProvider | 
			
		
	
		
		
			
				
					
					|  |  |  | 			return ( Integer ) array.get( 0, 0 ); |  |  |  | 			return ( Integer ) array.get( 0, 0 ); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public boolean getProcessoTemConsultasPorRealizar( Integer processoID ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Select select =  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			new Select2( new String[]{ "trabalhadores_consultas" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Integer[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Expression[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new String[]{ "id", "estado" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Field( "processo_id" ).isEqual( processoID ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new String[]{ "estado" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Virtual2DArray array = EXECUTER.executeQuery( select ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		return ( array.columnLength() > 0 ) && (  new Integer( ESTADO_POR_REALIZAR ).equals( array.get( 0, 1 ) ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public boolean getProcessoTemECDsPorRealizar( Integer processoID ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Select select =  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			new Select2( new String[]{ "trabalhadores_ecds" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Integer[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Expression[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new String[]{ "id", "estado" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Field( "processo_id" ).isEqual( processoID ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new String[]{ "estado" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Virtual2DArray array = EXECUTER.executeQuery( select ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		return ( array.columnLength() > 0 ) && (  new Integer( ESTADO_POR_REALIZAR ).equals( array.get( 0, 1 ) ) ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public Integer getConsultaEmAbertoForProcesso( Integer processoID ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Select select =  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			new Select2( new String[]{ "trabalhadores_consultas" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Integer[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Expression[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new String[]{ "id" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Field( "processo_id" ).isEqual( processoID ).and(  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								new Field( "estado" ).isEqual( new Integer( ESTADO_POR_REALIZAR ) ) ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Virtual2DArray array = EXECUTER.executeQuery( select ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		if( array.columnLength() == 0 ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			return null; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			return ( Integer ) array.get( 0, 0 ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public Integer getECDsEmAbertoForProcesso( Integer processoID ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Select select =  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			new Select2( new String[]{ "trabalhadores_ecds" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Integer[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Expression[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new String[]{ "id" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Field( "processo_id" ).isEqual( processoID ).and(  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								new Field( "estado" ).isDifferent( new Integer( ESTADO_POR_REALIZAR ) ) ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Virtual2DArray array = EXECUTER.executeQuery( select ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		if( array.columnLength() == 0 ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			return null; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			return ( Integer ) array.get( 0, 0 ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public TrabalhadoresConsultasData getConsultaByID( Integer id ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		return ( TrabalhadoresConsultasData ) JDO.load( TrabalhadoresConsultasData.class, id ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public void saveConsulta( TrabalhadoresConsultasData consulta ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		consulta.save(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public TrabalhadoresConsultasDatasData getConsultaDataByID( Integer id ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		return ( TrabalhadoresConsultasDatasData ) JDO.load( TrabalhadoresConsultasDatasData.class, id ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public void saveConsultaData( TrabalhadoresConsultasDatasData consultaData ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		consultaData.save(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public boolean verificarDataValidaForConsulta( Integer consultaID, Date data ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Select select = | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			new Select2( new String[]{ "trabalhadores_consultas_datas" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Integer[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Expression[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new String[]{ "id" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Field( "trabalhadores_consultas_id" ).isEqual( consultaID ).and(  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								new Field( "estado" ).isDifferent( new Integer( ESTADO_POR_REALIZAR ) ) ).and( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								new Field( "data" ).isGreater( data ) ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Virtual2DArray array = EXECUTER.executeQuery( select ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		return array.columnLength() == 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	public boolean verificarDataValidaForECDs( Integer ecdsID, Date data ) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		throws Exception | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Select select = | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			new Select2( new String[]{ "trabalhadores_ecds_datas" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Integer[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Expression[]{}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new String[]{ "id" }, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							new Field( "trabalhadores_ecdss_id" ).isEqual( ecdsID ).and(  | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								new Field( "estado" ).isDifferent( new Integer( ESTADO_POR_REALIZAR ) ) ).and( | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 								new Field( "data" ).isGreater( data ) ), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 							null ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		Virtual2DArray array = EXECUTER.executeQuery( select ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		return array.columnLength() == 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |