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

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Tiago Simão 18 years ago
parent e204420187
commit 2bc75a3b9f

@ -17,6 +17,9 @@ import javax.swing.JPanel;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.MutableTreeNode;
import org.apache.cayenne.conf.Configuration;
import org.apache.cayenne.conf.DefaultConfiguration;
import siprp.clientes.AvisosPanel;
import siprp.companydataloaders.SIPRPDataLoader;
import siprp.data.ActualizacaoSaveHandler;
@ -75,7 +78,6 @@ public class Main implements com.evolute.utils.ui.window.Connector
ESTADO_PROCESSO_BY_CODE.put( PROCESSO_ABERTO_CODE, PROCESSO_ABERTO_DESCRIPTION );
ESTADO_PROCESSO_BY_CODE.put( PROCESSO_FECHADO_CODE, PROCESSO_FECHADO_DESCRIPTION );
ESTADO_PROCESSO_BY_CODE.put( PROCESSO_CANCELADO_CODE, PROCESSO_CANCELADO_DESCRIPTION );
}
public static void main( String args[] )
@ -172,6 +174,7 @@ public class Main implements com.evolute.utils.ui.window.Connector
StatementExecuterFactory.initialize(
new DBStatementExecuter( dbm.getSharedExecuter() ) );
Singleton.setInstance( Singleton.TODAY, new Date() );
initializeCayenne( url, user, passwd);
//cleanData( dbm.getSharedExecuter() );
//msg( dbm.getSharedExecuter() );
@ -256,11 +259,16 @@ public class Main implements com.evolute.utils.ui.window.Connector
{
return siprpTracker.getRoot();
}
public void initializeCayenne(String url, String user, String password)
{
// TODO: override DB location, user and password
}
public void initializeJPOX(String url, String user, String password)
{
Date d = new Date();
System.out.println( "INIT: " + d );
System.out.println( "INIT: " + d );
Properties jpoxProps;

@ -63,15 +63,44 @@ public class TrabalhadoresEcds extends _TrabalhadoresEcds implements MedicinaCon
if( descricao != null && !grupos.containsKey( grupoEcd ) )
{
grupos.putLast( grupoEcd, descricao );
// TODO: calcular estado
grupos.putLast( grupoEcd, MedicinaConstants.ESTADOS_EXAME_STR[MedicinaConstants.ESTADO_POR_REALIZAR] );
Integer estado = getEstadoForGrupoEcd(grupoEcd);
grupos.putLast( grupoEcd, estado != null ? MedicinaConstants.ESTADOS_EXAME_STR[estado] : " " );
}
}
}
}
}
}
}
return grupos;
}
private Integer getEstadoForGrupoEcd(PrtGruposProtocolo grupoEcd)
{
Integer estado = null;
List<TrabalhadoresEcdsDatas> marcacoes = getTrabalhadoresEcdsDatasArray();
if(marcacoes != null)
{
for(TrabalhadoresEcdsDatas marcacao : marcacoes)
{
List<TrabalhadoresEcd> ecds = marcacao.getTrabalhadoresEcdArray();
for( TrabalhadoresEcd ecd : ecds )
{
if(ecd.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo().equals( grupoEcd ))
{
if(new Integer(ESTADO_REALIZADO).equals(ecd.getEstado()))
{
return new Integer(ESTADO_REALIZADO);
}
else if(estado == null)
{
estado = ecd.getEstado();
break;
}
}
}
}
}
return estado == null ? ESTADO_POR_REALIZAR : estado;
}
}

@ -48,13 +48,32 @@ public class TrabalhadoresEcdsDatas extends _TrabalhadoresEcdsDatas implements M
@Override
public void setEstado( Integer estado )
{
if( estado != null && this.getToTrabalhadoresEcds() != null && (new Integer(ESTADO_POR_REALIZAR).equals( this.getEstado() ) || new Integer(ESTADO_POR_REALIZAR).equals( estado )))
if( estado != null && this.getToTrabalhadoresEcds() != null)
{
this.getToTrabalhadoresEcds().setEstado( estado );
Integer oldExameEstado = this.getToTrabalhadoresEcds().getEstado();
if(new Integer(ESTADO_POR_REALIZAR).equals( oldExameEstado))
{
boolean todosRealizados = todosRealizados();
if(new Integer(ESTADO_REALIZADO).equals( estado ) && !todosRealizados)
{
this.getToTrabalhadoresEcds().setEstado( ESTADO_PARCIALMENTE_REALIZADO );
}
else if(new Integer(ESTADO_REALIZADO).equals( estado ) && todosRealizados)
{
this.getToTrabalhadoresEcds().setEstado( ESTADO_REALIZADO );
}
}
}
super.setEstado( estado );
}
private boolean todosRealizados()
{
//TODO
return true;
}
@Override
public String toString()
{
@ -94,6 +113,19 @@ public class TrabalhadoresEcdsDatas extends _TrabalhadoresEcdsDatas implements M
}
}
public void realizar()
{
List<TrabalhadoresEcd> ecds = getTrabalhadoresEcdArray();
if( ecds != null )
{
for(TrabalhadoresEcd ecd : ecds)
{
ecd.setEstado( MedicinaConstants.ESTADO_REALIZADO );
}
}
setEstado( MedicinaConstants.ESTADO_REALIZADO );
}
}

@ -715,7 +715,7 @@ public class LocaisRealizacaoWindow extends JFrame
{
prestadorID = null;
}
provider.setPrestadorConsultaIdForEstabelecimentoAndDate( estabelecimentoID, data, prestadorID );
// provider.setPrestadorConsultaIdForEstabelecimentoAndDate( estabelecimentoID, data, prestadorID );
}
catch( Exception ex )
{

@ -1,9 +1,7 @@
package siprp.medicina.processo.logic;
import static siprp.medicina.processo.logic.MedicinaProcessoLogic.DESMARCAR_CONSULTA_MARCACAO;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import javax.swing.tree.DefaultMutableTreeNode;
@ -14,6 +12,7 @@ import siprp.database.cayenne.objects.TrabalhadoresConsultas;
import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas;
import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasEmails;
import siprp.database.cayenne.objects.TrabalhadoresConsultasDatasObservacoes;
import siprp.database.cayenne.objects.TrabalhadoresEcd;
import siprp.database.cayenne.objects.TrabalhadoresEcds;
import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas;
import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasEmails;
@ -21,11 +20,9 @@ import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasObservacoes;
import siprp.database.cayenne.objects.TrabalhadoresProcesso;
import siprp.database.cayenne.providers.MedicinaDAO;
import siprp.logic.SIPRPLogic;
import siprp.logic.SIPRPLogic.LeafUIActionBinding;
import siprp.medicina.MedicinaConstants;
import siprp.medicina.processo.ProcessoConstants;
import siprp.medicina.processo.estrutura.FichaAptidaoMutableTreeNode;
import siprp.medicina.processo.ui.LeafOptionDialog;
import siprp.ui.SIPRPWindow.LeafObject;
import com.evolute.utils.tables.ColumnizedMappable;
@ -144,7 +141,10 @@ public class MedicinaProcessoLogic extends SIPRPLogic
public static final String CLOSE = "CLOSE";
@Action(isSave = true)
public static final String DESMARCAR_CONSULTA_MARCACAO = "DESMARCAR_CONSULTA_MARCACAO";
public static final String DESMARCAR_SIPRP_CONSULTA_MARCACAO = "DESMARCAR_SIPRP_CONSULTA_MARCACAO";
@Action(isSave = true)
public static final String DESMARCAR_TRABALHADOR_CONSULTA_MARCACAO = "DESMARCAR_TRABALHADOR_CONSULTA_MARCACAO";
@Action(isSave = true)
public static final String REALIZAR_CONSULTA_MARCACAO = "REALIZAR_CONSULTA_MARCACAO";
@ -153,7 +153,10 @@ public class MedicinaProcessoLogic extends SIPRPLogic
public static final String FALTOU_CONSULTA_MARCACAO = "FALTOU_CONSULTA_MARCACAO";
@Action(isSave = true)
public static final String DESMARCAR_EXAME_MARCACAO = "DESMARCAR_EXAME_MARCACAO";
public static final String DESMARCAR_SIPRP_EXAME_MARCACAO = "DESMARCAR_SIPRP_EXAME_MARCACAO";
@Action(isSave = true)
public static final String DESMARCAR_TRABALHADOR_EXAME_MARCACAO = "DESMARCAR_TRABALHADOR_EXAME_MARCACAO";
@Action(isSave = true)
public static final String REALIZAR_EXAME_MARCACAO = "REALIZAR_EXAME_MARCACAO";
@ -256,24 +259,22 @@ public class MedicinaProcessoLogic extends SIPRPLogic
}
}
@LeafLogicActionBinding(actions = DESMARCAR_CONSULTA_MARCACAO)
public void desmarcarConsulta()
@LeafLogicActionBinding(actions = DESMARCAR_SIPRP_CONSULTA_MARCACAO)
public void desmarcarConsultaSiprp()
{
if( currentConsultaMarcacao != null )
{
HashMap<Boolean, String> options = new HashMap<Boolean, String>();
options.put( true, "SIPRP" );
options.put( false, "Trabalhador" );
LeafOptionDialog<Boolean> optionDialog = new LeafOptionDialog<Boolean>(options, "Desmarcado por:", false);
Boolean isDesmarcadoPorSIPRP = optionDialog.getOption();
if(isDesmarcadoPorSIPRP)
{
currentConsultaMarcacao.setEstado( MedicinaConstants.ESTADO_DESMARCADO_EMPRESA );
}
else
{
currentConsultaMarcacao.setEstado( MedicinaConstants.ESTADO_DESMARCADO_TRABALHADOR );
}
currentConsultaMarcacao.setEstado( MedicinaConstants.ESTADO_DESMARCADO_EMPRESA );
saveObject( currentConsultaMarcacao );
}
}
@LeafLogicActionBinding(actions = DESMARCAR_TRABALHADOR_CONSULTA_MARCACAO)
public void desmarcarConsultaTrabalhador()
{
if( currentConsultaMarcacao != null )
{
currentConsultaMarcacao.setEstado( MedicinaConstants.ESTADO_DESMARCADO_TRABALHADOR );
saveObject( currentConsultaMarcacao );
}
}
@ -284,7 +285,6 @@ public class MedicinaProcessoLogic extends SIPRPLogic
if( currentConsultaMarcacao != null )
{
currentConsultaMarcacao.setEstado( MedicinaConstants.ESTADO_FALTOU );
//TODO motivo
saveObject( currentConsultaMarcacao );
}
}
@ -298,6 +298,46 @@ public class MedicinaProcessoLogic extends SIPRPLogic
saveObject( currentConsultaMarcacao );
}
}
@LeafLogicActionBinding(actions = DESMARCAR_SIPRP_EXAME_MARCACAO)
public void desmarcarExameSiprp()
{
if( currentExameMarcacao != null )
{
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_DESMARCADO_EMPRESA );
saveObject( currentExameMarcacao );
}
}
@LeafLogicActionBinding(actions = DESMARCAR_TRABALHADOR_EXAME_MARCACAO)
public void desmarcarExameTrabalhador()
{
if( currentExameMarcacao != null )
{
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_DESMARCADO_TRABALHADOR );
saveObject( currentExameMarcacao );
}
}
@LeafLogicActionBinding(actions = FALTOU_EXAME_MARCACAO)
public void faltouExame()
{
if( currentExameMarcacao != null )
{
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_FALTOU );
saveObject( currentExameMarcacao );
}
}
@LeafLogicActionBinding(actions = REALIZAR_EXAME_MARCACAO)
public void realizarExame()
{
if( currentExameMarcacao != null )
{
currentExameMarcacao.realizar();
saveObject( currentConsultaMarcacao );
}
}
@LeafLogicActionBinding(actions = {
SELECT_TREE_NODE

@ -29,6 +29,8 @@ import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import org.apache.cayenne.conf.Configuration;
import siprp.database.cayenne.objects.Trabalhadores;
import siprp.database.cayenne.objects.TrabalhadoresConsultas;
import siprp.database.cayenne.objects.TrabalhadoresConsultasDatas;
@ -107,8 +109,11 @@ public class ProcessoAccoesPanel extends JPanel
@ActionActivation(onSelect = CREATE_CONSULTA_MARCACAO_OBSERVACOES, onChange = "")
public final LeafButton buttonNovoConsultaMarcacaoObservacoes = new LeafButton( "Adicionar Observa" + ccedil + atilde + "o" );
@ActionActivation(onSelect = DESMARCAR_CONSULTA_MARCACAO, onChange = "")
public final LeafButton buttonConsultaMarcacaoDesmarcar = new LeafButton( "Desmarcar" );
@ActionActivation(onSelect = DESMARCAR_SIPRP_CONSULTA_MARCACAO, onChange = "")
public final LeafButton buttonConsultaMarcacaoDesmarcarSiprp = new LeafButton( "Desmarcar (SIPRP)" );
@ActionActivation(onSelect = DESMARCAR_TRABALHADOR_CONSULTA_MARCACAO, onChange = "")
public final LeafButton buttonConsultaMarcacaoDesmarcarTrabalhador = new LeafButton( "Desmarcar (Trab)" );
@ActionActivation(onSelect = REALIZAR_CONSULTA_MARCACAO, onChange = "")
public final LeafButton buttonConsultaMarcacaoRealizar = new LeafButton( "Realizar" );
@ -130,8 +135,11 @@ public class ProcessoAccoesPanel extends JPanel
@ActionActivation(onSelect = CREATE_EXAME_MARCACAO_OBSERVACOES, onChange = "")
public final LeafButton buttonNovoExameMarcacaoObservacoes = new LeafButton( "Adicionar Observa" + ccedil + atilde + "o" );
@ActionActivation(onSelect = DESMARCAR_EXAME_MARCACAO, onChange = "")
public final LeafButton buttonExameMarcacaoDesmarcar = new LeafButton( "Desmarcar" );
@ActionActivation(onSelect = DESMARCAR_SIPRP_EXAME_MARCACAO, onChange = "")
public final LeafButton buttonExameMarcacaoDesmarcarSiprp = new LeafButton( "Desmarcar (SIPRP)" );
@ActionActivation(onSelect = DESMARCAR_TRABALHADOR_EXAME_MARCACAO, onChange = "")
public final LeafButton buttonExameMarcacaoDesmarcarTrabalhador = new LeafButton( "Desmarcar (Trab)" );
@ActionActivation(onSelect = REALIZAR_EXAME_MARCACAO, onChange = "")
public final LeafButton buttonExameMarcacaoRealizar = new LeafButton( "Realizar" );
@ -269,7 +277,8 @@ public class ProcessoAccoesPanel extends JPanel
boolean porRealizar = new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ).equals( marcacao.getEstado() );
List list = marcacao.getTrabalhadoresConsultasDatasObservacoesArray();
boolean noObservacoes = (list == null || list.size() == 0) ? true : false;
buttonConsultaMarcacaoDesmarcar.setEnabled( porRealizar );
buttonConsultaMarcacaoDesmarcarSiprp.setEnabled( porRealizar );
buttonConsultaMarcacaoDesmarcarTrabalhador.setEnabled( porRealizar );
buttonConsultaMarcacaoFaltou.setEnabled( porRealizar );
buttonConsultaMarcacaoRealizar.setEnabled( porRealizar );
buttonNovoConsultaMarcacaoObservacoes.setEnabled( noObservacoes );
@ -325,7 +334,14 @@ public class ProcessoAccoesPanel extends JPanel
{
if( marcacao != null )
{
boolean porRealizar = new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ).equals( marcacao.getEstado() );
List list = marcacao.getTrabalhadoresEcdsDatasObservacoesArray();
boolean noObservacoes = (list == null || list.size() == 0) ? true : false;
buttonExameMarcacaoDesmarcarSiprp.setEnabled( porRealizar );
buttonExameMarcacaoDesmarcarTrabalhador.setEnabled( porRealizar );
buttonExameMarcacaoFaltou.setEnabled( porRealizar );
buttonExameMarcacaoRealizar.setEnabled( porRealizar );
buttonNovoExameMarcacaoObservacoes.setEnabled( noObservacoes );
cardLayout.show( cardPanel, PANEL_EXAME_MARCACAO_NAME );
}
else
@ -384,7 +400,7 @@ public class ProcessoAccoesPanel extends JPanel
JPanel consultaMarcacaoUpperPanel = new JPanel();
JPanel consultaMarcacaoLowerPanel = new JPanel();
setupSimpleActionsPanel( consultaMarcacaoUpperPanel, buttonNovoConsultaMarcacaoEmail, buttonNovoConsultaMarcacaoObservacoes );
setupSimpleActionsPanel( consultaMarcacaoLowerPanel, buttonConsultaMarcacaoRealizar, buttonConsultaMarcacaoDesmarcar, buttonConsultaMarcacaoFaltou);
setupSimpleActionsPanel( consultaMarcacaoLowerPanel, buttonConsultaMarcacaoRealizar, buttonConsultaMarcacaoDesmarcarSiprp, buttonConsultaMarcacaoDesmarcarTrabalhador, buttonConsultaMarcacaoFaltou);
TableLayout consultaMarcacaoLayout = new TableLayout(new double[]{TableLayout.FILL}, new double[]{TableLayout.MINIMUM, TableLayout.FILL,TableLayout.MINIMUM});
panelConsultaMarcacao.setLayout( consultaMarcacaoLayout );
panelConsultaMarcacao.add( consultaMarcacaoUpperPanel, new TableLayoutConstraints(0,0) );
@ -397,7 +413,7 @@ public class ProcessoAccoesPanel extends JPanel
JPanel exameMarcacaoUpperPanel = new JPanel();
JPanel exameMarcacaoLowerPanel = new JPanel();
setupSimpleActionsPanel( exameMarcacaoUpperPanel, buttonNovoExameMarcacaoEmail, buttonNovoExameMarcacaoObservacoes, new JPanel() );
setupSimpleActionsPanel( exameMarcacaoLowerPanel, buttonExameMarcacaoRealizar, buttonExameMarcacaoDesmarcar, buttonExameMarcacaoFaltou);
setupSimpleActionsPanel( exameMarcacaoLowerPanel, buttonExameMarcacaoRealizar, buttonExameMarcacaoDesmarcarSiprp, buttonExameMarcacaoDesmarcarTrabalhador, buttonExameMarcacaoFaltou);
TableLayout exameMarcacaoLayout = new TableLayout(new double[]{TableLayout.FILL}, new double[]{TableLayout.MINIMUM, TableLayout.FILL,TableLayout.MINIMUM});
panelExameMarcacao.setLayout( exameMarcacaoLayout );
panelExameMarcacao.add( exameMarcacaoUpperPanel, new TableLayoutConstraints(0,0) );

@ -457,6 +457,7 @@ public class ProcessoDadosPanel extends JPanel
@LeafUIActionBinding(action = CREATE_EXAME_MARCACAO_EMAIL)
public void setForNewExameMarcacaoEmail( TrabalhadoresEcdsDatasEmails email )
{
}
@LeafUIActionBinding(action = CREATE_EXAME_MARCACAO_OBSERVACOES)

Loading…
Cancel
Save