no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@409 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 19 years ago
parent 0417d50159
commit b6657cde83

@ -139,6 +139,7 @@ public class ProcessoController
{
idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
processoPanel.fill( idProcesso );
detalhesProcessoPanel.setProcessoID( idProcesso );
detalhesProcessoPanel.clear();
}
catch( Exception ex )
@ -155,9 +156,11 @@ public class ProcessoController
if( !idProcesso.equals( idProcessoAntigo ) )
{
processoPanel.fill( idProcesso );
detalhesProcessoPanel.setProcessoID( idProcesso );
}
idMarcacao = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
detalhesProcessoPanel.setConsulta( idMarcacao );
}
catch( Exception ex )
{
@ -168,8 +171,16 @@ public class ProcessoController
{
try
{
Integer idProcessoAntigo = idProcesso;
idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
idMarcacao = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
if( !idProcesso.equals( idProcessoAntigo ) )
{
processoPanel.fill( idProcesso );
detalhesProcessoPanel.setProcessoID( idProcesso );
}
idMarcacao = e.getObjecto( ProcessoEvent.TIPO_ECDS );
detalhesProcessoPanel.setECDs( idMarcacao );
}
catch( Exception ex )
{
@ -192,11 +203,31 @@ public class ProcessoController
{
try
{
Integer idProcessoAntigo = idProcesso;
idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
if( !idProcesso.equals( idProcessoAntigo ) )
{
processoPanel.fill( idProcesso );
detalhesProcessoPanel.setProcessoID( idProcesso );
}
Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
idMarcacao = idConsulta != null ? idConsulta : idECDs;
Integer idData = e.getObjecto( ProcessoEvent.TIPO_DATA );
if( idConsulta != null )
{
idMarcacao = idConsulta;
detalhesProcessoPanel.setConsulta( idConsulta );
}
else if( idECDs != null )
{
idMarcacao = idECDs;
detalhesProcessoPanel.setECDs( idECDs );
}
else
{
idMarcacao = null;
detalhesProcessoPanel.clear();
}
}
catch( Exception ex )
{
@ -207,11 +238,7 @@ public class ProcessoController
{
try
{
idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
idMarcacao = idConsulta != null ? idConsulta : idECDs;
Integer idData = e.getObjecto( ProcessoEvent.TIPO_DATA );
escolherData( e );
Integer idObservacoes = e.getObjecto( ProcessoEvent.TIPO_OBSERVACOES );
}
catch( Exception ex )
@ -223,11 +250,7 @@ public class ProcessoController
{
try
{
idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
idMarcacao = idConsulta != null ? idConsulta : idECDs;
Integer idData = e.getObjecto( ProcessoEvent.TIPO_DATA );
escolherData( e );
Integer idMail = e.getObjecto( ProcessoEvent.TIPO_MAIL );
}
catch( Exception ex )
@ -253,6 +276,7 @@ public class ProcessoController
try
{
idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
detalhesProcessoPanel.setConsulta( null );
}
catch( Exception ex )
@ -265,6 +289,7 @@ public class ProcessoController
try
{
idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
detalhesProcessoPanel.setECDs( null );
}
catch( Exception ex )
{
@ -276,6 +301,7 @@ public class ProcessoController
try
{
idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO );
estruturaProcessoPanel.actualizarProcessoEscolhido( idProcesso );
}
catch( Exception ex )
{
@ -302,6 +328,7 @@ public class ProcessoController
Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
idMarcacao = idConsulta != null ? idConsulta : idECDs;
estruturaProcessoPanel.actualizarMarcacaoEscolhida( idMarcacao );
}
catch( Exception ex )
{
@ -316,6 +343,7 @@ public class ProcessoController
Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
idMarcacao = idConsulta != null ? idConsulta : idECDs;
estruturaProcessoPanel.actualizarMarcacaoEscolhida( idMarcacao );
}
catch( Exception ex )
{
@ -330,6 +358,7 @@ public class ProcessoController
Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA );
Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS );
idMarcacao = idConsulta != null ? idConsulta : idECDs;
estruturaProcessoPanel.actualizarMarcacaoEscolhida( idMarcacao );
}
catch( Exception ex )
{

@ -384,6 +384,50 @@ public class ProcessoDataProvider
return ( array.columnLength() > 0 ) && ( new Integer( ESTADO_POR_REALIZAR ).equals( array.get( 0, 1 ) ) );
}
public Integer[] getConsultaIDsForProcesso( 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 ),
null,
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
Integer ids[] = new Integer[ array.columnLength() ];
for( int n = 0; n < ids.length; n++ )
{
ids[ n ] = ( Integer ) array.get( n, 0 );
}
return ids;
}
public Integer[] getECDsIDsForProcesso( 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 ),
null,
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
Integer ids[] = new Integer[ array.columnLength() ];
for( int n = 0; n < ids.length; n++ )
{
ids[ n ] = ( Integer ) array.get( n, 0 );
}
return ids;
}
public Integer getConsultaEmAbertoForProcesso( Integer processoID )
throws Exception
{
@ -495,4 +539,9 @@ public class ProcessoDataProvider
Virtual2DArray array = EXECUTER.executeQuery( select );
return array.columnLength() == 0;
}
public void saveLigacaoProcessoFichaAptidao( Integer processoID, Integer fichaID )
throws Exception
{
}
}

@ -247,20 +247,36 @@ public class ProcessoPanel extends JPanel
inicioText.setText( "" );
fimText.setText( "" );
motivoButton.setText( "Motivo" );
enableButtons();
}
protected void enableButtons()
{
String estado = null;
Integer motivo = null;
boolean consultasPorRealizar = false;
boolean ecdsPorRealizar = false;
if( processo != null )
{
Integer id = ( Integer ) processo.get( TrabalhadoresProcessoData.ID );
estado = ( String ) processo.get( TrabalhadoresProcessoData.ESTADO );
motivo = ( Integer ) processo.get( TrabalhadoresProcessoData.MOTIVO );
try
{
if( id != null )
{
consultasPorRealizar = provider.getProcessoTemConsultasPorRealizar( id );
ecdsPorRealizar = provider.getProcessoTemECDsPorRealizar( id );
}
}
catch( Exception ex )
{
ex.printStackTrace();
}
}
// novoECDButton.setEnabled( processo != null && motivo != null );
novoECDButton.setEnabled( false );
novaConsultaButton.setEnabled( processo != null && motivo != null );
novaConsultaButton.setEnabled( processo != null && motivo != null && !consultasPorRealizar );
emitirFAButton.setEnabled( processo != null && motivo != null );
fecharButton.setEnabled( processo != null && motivo != null && PROCESSO_ABERTO_CODE.equals( estado ) );
motivoButton.setEnabled( processo != null );

@ -115,7 +115,13 @@ public class ConsultaPanel extends JPanel
Object source = e.getSource();
if( source.equals( dataConsultaPanel ) )
{
if( consulta != null )
{
}
else
{
}
}
}
@ -170,6 +176,7 @@ public class ConsultaPanel extends JPanel
{
dataConsultaPanel.setDate( null );
estadoButton.setText( " " );
consulta = null;
}
public void fill( Object value )

@ -13,7 +13,7 @@ package siprp.medicina.processo.estrutura;
*
* @author Frederico
*/
public class ConsultaMutableTreeNode extends EstruturaProcessoMutableTreeNode
public class ConsultaMutableTreeNode extends MarcacaoMutableTreeNode
{
public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/consulta.png";

@ -13,7 +13,7 @@ package siprp.medicina.processo.estrutura;
*
* @author Frederico
*/
public class ECDsMutableTreeNode extends EstruturaProcessoMutableTreeNode
public class ECDsMutableTreeNode extends MarcacaoMutableTreeNode
{
public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/ecds.png";

@ -13,6 +13,7 @@ import com.evolute.utils.data.IDObject;
import com.evolute.utils.ui.DialogException;
import java.awt.*;
import java.text.DateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
@ -23,8 +24,10 @@ import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import siprp.medicina.MedicinaConstants;
import siprp.medicina.MedicinaDataProvider;
import siprp.medicina.processo.*;
import siprp.medicina.processo.data.TrabalhadoresConsultasData;
import siprp.medicina.processo.data.TrabalhadoresProcessoData;
/**
@ -131,16 +134,74 @@ public class EstruturaProcessoPanel extends JPanel
Integer motivo = ( Integer ) processo.get( TrabalhadoresProcessoData.MOTIVO );
desc += ": " + MedicinaDataProvider.MOTIVOS_BY_ID.get( motivo ) + " : " + estado;
PROCESSOS_POR_ID.put( id, processo );
ProcessoMutableTreeNode processoNode;
if( node == null )
{
return new ProcessoMutableTreeNode( id, desc );
processoNode = new ProcessoMutableTreeNode( id, desc );
}
else
{
node.setID( id );
node.setDescricao( desc );
return node;
processoNode = node;
processoNode.setID( id );
processoNode.setDescricao( desc );
}
processoNode.removeAllChildren();
MarcacaoMutableTreeNode marcacoes[] = loadMarcacoes( id );
for( int n = 0; n < marcacoes.length; n++ )
{
processoNode.add( marcacoes[ n ] );
}
( ( DefaultTreeModel ) mainTree.getModel() ).nodeStructureChanged( processoNode );
return processoNode;
}
public MarcacaoMutableTreeNode[] loadMarcacoes( Integer processoID )
{
try
{
Integer consultaIDs[] = provider.getConsultaIDsForProcesso( processoID );
Vector<MarcacaoMutableTreeNode> nodesVector = new Vector<MarcacaoMutableTreeNode>();
for( int n = 0; n < consultaIDs.length; n++ )
{
nodesVector.add( loadConsulta( consultaIDs[ n ], null ) );
}
MarcacaoMutableTreeNode nodes[] = nodesVector.toArray( new MarcacaoMutableTreeNode[ nodesVector.size() ] );
Arrays.sort( nodes );
return nodes;
}
catch( Exception ex )
{
DialogException.showExceptionMessage( ex, "Erro a carregar dados", true );
return new MarcacaoMutableTreeNode[ 0 ];
}
}
public ConsultaMutableTreeNode loadConsulta( Integer id, ConsultaMutableTreeNode node )
throws Exception
{
TrabalhadoresConsultasData consulta = provider.getConsultaByID( id );
Date data = ( Date ) consulta.get( TrabalhadoresConsultasData.DATA );
Integer estado = ( Integer ) consulta.get( TrabalhadoresConsultasData.ESTADO );
String estadoStr = MedicinaConstants.ESTADOS_CONSULTA_STR[ estado != null ? estado.intValue() : 0 ];
String desc = "Consulta de " + ( data != null ? D_F.format( data ) : "--" );
desc += ": " + estado;
ConsultaMutableTreeNode consultaNode;
if( node == null )
{
consultaNode = new ConsultaMutableTreeNode( id, desc );
consultaNode.setData( data );
}
else
{
consultaNode = node;
consultaNode.setID( id );
consultaNode.setDescricao( desc );
consultaNode.setData( data );
}
( ( DefaultTreeModel ) mainTree.getModel() ).nodeStructureChanged( rootNode );
return consultaNode;
}
public void valueChanged( TreeSelectionEvent e )
@ -269,6 +330,22 @@ public class EstruturaProcessoPanel extends JPanel
}
}
public void actualizarMarcacaoEscolhida( Integer id )
throws Exception
{
// TreePath path = mainTree.getSelectionPath();
// MarcacaoMutableTreeNode processoNode = ( ProcessoMutableTreeNode ) path.getPathComponent( 1 );
// boolean vazio = processoNode.getID().intValue() == -1;
// loadProcesso( id, processoNode );
// ( ( DefaultTreeModel ) mainTree.getModel() ).nodeChanged( processoNode ) ;
// if( vazio )
// {
// ProcessoMutableTreeNode novo = criarProcessoVazio();
// rootNode.insert( novo, 0 );
// ( ( DefaultTreeModel ) mainTree.getModel() ).nodesWereInserted( rootNode, new int[]{ 0 } ) ;
// }
}
public ProcessoMutableTreeNode criarProcessoVazio()
{
return new ProcessoMutableTreeNode( new Integer( -1 ), "Novo Processo..." );
@ -287,6 +364,6 @@ public class EstruturaProcessoPanel extends JPanel
PROCESSOS_POR_ID.clear();
rootNode.setID( null );
rootNode.setDescricao( "" );
( ( DefaultTreeModel ) mainTree.getModel() ).nodeStructureChanged( rootNode ) ;
( ( DefaultTreeModel ) mainTree.getModel() ).nodeStructureChanged( rootNode );
}
}

@ -0,0 +1,59 @@
/*
* MarcacaoMutableTreeNode.java
*
* Created on 18 de Maio de 2007, 7:02
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package siprp.medicina.processo.estrutura;
import java.util.Date;
/**
*
* @author Frederico
*/
public abstract class MarcacaoMutableTreeNode extends EstruturaProcessoMutableTreeNode
implements Comparable
{
protected Date data;
/** Creates a new instance of MarcacaoMutableTreeNode */
public MarcacaoMutableTreeNode( Integer id, String descricao )
{
super( id, descricao );
}
public void setData( Date data )
{
this.data = data;
}
public Date getData()
{
return data;
}
public int compareTo( Object other )
{
if( !( other instanceof MarcacaoMutableTreeNode ) )
{
return 0;
}
MarcacaoMutableTreeNode om = ( MarcacaoMutableTreeNode ) other;
if( data == null )
{
return -1;
}
else if( om == null || om.getData() == null )
{
return 1;
}
else
{
return getData().compareTo( om.getData() );
}
}
}
Loading…
Cancel
Save