Realizacao parcial de marcacoes de exame

git-svn-id: https://svn.coded.pt/svn/SIPRP@636 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Tiago Simão 18 years ago
parent 374b197ccc
commit 132571c462

@ -151,8 +151,37 @@ public class TrabalhadoresEcdsDatas extends _TrabalhadoresEcdsDatas implements M
}
}
@Override
public void setEstado( Integer estado )
public void anular()
{
setEstadoForAllEcd( MedicinaConstants.ESTADO_ANULADO );
}
public void realizar()
{
setEstadoForAllEcd( MedicinaConstants.ESTADO_REALIZADO );
}
public void porRealizar()
{
setEstadoForAllEcd( MedicinaConstants.ESTADO_POR_REALIZAR );
}
public void desmarcarSIPRP()
{
setEstadoForAllEcd( MedicinaConstants.ESTADO_DESMARCADO_EMPRESA );
}
public void desmarcarTrabalhador()
{
setEstadoForAllEcd( MedicinaConstants.ESTADO_DESMARCADO_TRABALHADOR );
}
public void faltou()
{
setEstadoForAllEcd( MedicinaConstants.ESTADO_FALTOU );
}
public void setEstadoForAllEcd( Integer estado )
{
List<TrabalhadoresEcd> allEcd = (List<TrabalhadoresEcd>) getTrabalhadoresEcdArray();
if(allEcd != null)

@ -162,6 +162,9 @@ public class MedicinaProcessoLogic extends SIPRPLogic
@Action(isSave = true)
public static final String REALIZAR_EXAME_MARCACAO = "REALIZAR_EXAME_MARCACAO";
@Action(isSave = true)
public static final String REALIZAR_PARCIAL_EXAME_MARCACAO = "REALIZAR_PARCIAL_EXAME_MARCACAO";
@Action(isSave = true)
public static final String FALTOU_EXAME_MARCACAO = "FALTOU_EXAME_MARCACAO";
@ -173,34 +176,34 @@ public class MedicinaProcessoLogic extends SIPRPLogic
private Trabalhadores currentTrabalhador = null;
@LeafObject(useWithAction = SAVE_PROCESSO)
@LeafObject(useWith = SAVE_PROCESSO)
public TrabalhadoresProcesso currentProcesso = null;
@LeafObject(useWithAction = SAVE_CONSULTA)
@LeafObject(useWith = SAVE_CONSULTA)
public TrabalhadoresConsultas currentConsulta = null;
@LeafObject(useWithAction = SAVE_CONSULTA_MARCACAO)
@LeafObject(useWith = SAVE_CONSULTA_MARCACAO)
public TrabalhadoresConsultasDatas currentConsultaMarcacao = null;
@LeafObject(useWithAction = SAVE_CONSULTA_MARCACAO_EMAIL)
@LeafObject(useWith = SAVE_CONSULTA_MARCACAO_EMAIL)
public TrabalhadoresConsultasDatasEmails currentConsultaMarcacaoEmail = null;
@LeafObject(useWithAction = SAVE_CONSULTA_MARCACAO_OBSERVACOES)
@LeafObject(useWith = SAVE_CONSULTA_MARCACAO_OBSERVACOES)
public TrabalhadoresConsultasDatasObservacoes currentConsultaMarcacaoObservacao = null;
@LeafObject(useWithAction = SAVE_FICHA)
@LeafObject(useWith = SAVE_FICHA)
public FichaAptidaoMutableTreeNode currentFicha = null;
@LeafObject(useWithAction = SAVE_EXAME_MARCACAO_OBSERVACOES)
@LeafObject(useWith = SAVE_EXAME_MARCACAO_OBSERVACOES)
public TrabalhadoresEcdsDatasObservacoes currentExameMarcacaoObservacao = null;
@LeafObject(useWithAction = SAVE_EXAME_MARCACAO_EMAIL)
@LeafObject(useWith = SAVE_EXAME_MARCACAO_EMAIL)
public TrabalhadoresEcdsDatasEmails currentExameMarcacaoEmail = null;
@LeafObject(useWithAction = SAVE_EXAME_MARCACAO)
@LeafObject(useWith = { SAVE_EXAME_MARCACAO, REALIZAR_PARCIAL_EXAME_MARCACAO })
public TrabalhadoresEcdsDatas currentExameMarcacao = null;
@LeafObject(useWithAction = SAVE_EXAME)
@LeafObject(useWith = SAVE_EXAME)
public TrabalhadoresEcds currentExame = null;
public MedicinaProcessoLogic()
@ -309,7 +312,7 @@ public class MedicinaProcessoLogic extends SIPRPLogic
{
if( currentExameMarcacao != null )
{
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_DESMARCADO_EMPRESA );
currentExameMarcacao.desmarcarSIPRP();
runActionLater( SAVE_EXAME_MARCACAO );
}
}
@ -319,7 +322,7 @@ public class MedicinaProcessoLogic extends SIPRPLogic
{
if( currentExameMarcacao != null )
{
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_DESMARCADO_TRABALHADOR );
currentExameMarcacao.desmarcarTrabalhador();
runActionLater( SAVE_EXAME_MARCACAO );
}
}
@ -329,7 +332,7 @@ public class MedicinaProcessoLogic extends SIPRPLogic
{
if( currentExameMarcacao != null )
{
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_FALTOU );
currentExameMarcacao.faltou();
runActionLater( SAVE_EXAME_MARCACAO );
}
}
@ -339,7 +342,7 @@ public class MedicinaProcessoLogic extends SIPRPLogic
{
if( currentExameMarcacao != null )
{
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_ANULADO );
currentExameMarcacao.anular();
runActionLater( SAVE_EXAME_MARCACAO );
}
}
@ -349,7 +352,16 @@ public class MedicinaProcessoLogic extends SIPRPLogic
{
if( currentExameMarcacao != null )
{
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_REALIZADO );
currentExameMarcacao.realizar();
runActionLater( SAVE_EXAME_MARCACAO );
}
}
@LeafLogicActionBinding(actions = REALIZAR_PARCIAL_EXAME_MARCACAO)
public void realizarParcialExame()
{
if( currentExameMarcacao != null )
{
runActionLater( SAVE_EXAME_MARCACAO );
}
}
@ -488,7 +500,7 @@ public class MedicinaProcessoLogic extends SIPRPLogic
currentExameMarcacao.setToTrabalhadoresEcds( currentExame );
currentExameMarcacao.setToPrestadores( getPrestador(false) );
currentExameMarcacao.setToAnalisador( getAnalisador() );
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR );
currentExameMarcacao.porRealizar();
runActionLater( SAVE_EXAME_MARCACAO );
return currentExameMarcacao;

@ -42,9 +42,9 @@ public class LeafOptionDialog<KeyClass extends Object> extends JDialog
private List<KeyClass> selected = new ArrayList<KeyClass>();
private Map<KeyClass, Boolean> mapEnabledForKey = new HashMap<KeyClass, Boolean>();
private Map<KeyClass, Boolean> mapEnabledForKey = null;
private Map<KeyClass, Boolean> mapChosenForKey = new HashMap<KeyClass, Boolean>();
private Map<KeyClass, Boolean> mapChosenForKey = null;
private String message = null;
@ -75,8 +75,8 @@ public class LeafOptionDialog<KeyClass extends Object> extends JDialog
ordered = true;
this.message = message;
okLabel = okButton;
this.mapChosenForKey = chosen;
this.mapEnabledForKey = enabled;
this.mapChosenForKey = chosen == null ? new HashMap<KeyClass, Boolean>() : chosen;
this.mapEnabledForKey = enabled == null ? new HashMap<KeyClass, Boolean>() : chosen;
if( chosen != null )
{
for( KeyClass key : chosen.keySet() )
@ -159,7 +159,7 @@ public class LeafOptionDialog<KeyClass extends Object> extends JDialog
component.setSelected( isChosen != null && isChosen );
Boolean isEnabled = mapEnabledForKey.get( current );
component.setClickable( isEnabled != null && isEnabled );
component.setClickable( isEnabled == null || isEnabled );
component.setPreferredSize( OPTION_SIZE );
getContentPane().add( component, new TableLayoutConstraints( 0, i + shift ) );

@ -1,14 +1,19 @@
package siprp.medicina.processo.ui;
import static siprp.medicina.processo.logic.MedicinaProcessoLogic.CLOSE;
import static siprp.medicina.processo.logic.MedicinaProcessoLogic.*;
import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
import java.awt.Dimension;
import java.util.List;
import javax.swing.JSeparator;
import siprp.database.cayenne.objects.PrtGruposProtocolo;
import siprp.database.cayenne.objects.TrabalhadoresEcd;
import siprp.database.cayenne.objects.TrabalhadoresEcdsDatas;
import siprp.logic.SIPRPLogic.LeafUIActionBinding;
import siprp.medicina.MedicinaConstants;
import siprp.medicina.processo.logic.MedicinaProcessoLogic;
import siprp.ui.SIPRPWindow;
@ -79,9 +84,59 @@ public class MedicinaProcessoWindow extends SIPRPWindow
this.add( panelProcessoDados, new TableLayoutConstraints( 2, 2 ) );
}
@LeafUIActionBinding(action=CLOSE)
@LeafUIActionBinding(action = CLOSE)
public void closeWindow()
{
close();
}
@LeafUIActionBinding(action = REALIZAR_PARCIAL_EXAME_MARCACAO)
public void realizarExameParcial( TrabalhadoresEcdsDatas marcacao )
{
boolean atLeastOneRealizado = false;
boolean atLeastOneFalta = false;
if( marcacao != null )
{
List<TrabalhadoresEcd> ecds = marcacao.getTrabalhadoresEcdArray();
if( ecds != null )
{
OrderedMap<PrtGruposProtocolo> grupos = marcacao.getStatesForeGruposExames();
LeafOptionDialog<PrtGruposProtocolo> option = new LeafOptionDialog<PrtGruposProtocolo>( grupos, null, null, "Marcar falta para:", "Faltou >>" );
List<PrtGruposProtocolo> selected = option.getSelected();
if( selected != null )
{
for( TrabalhadoresEcd ecd : ecds )
{
if( selected.contains( ecd.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo() ) )
{
ecd.setEstado( MedicinaConstants.ESTADO_FALTOU );
atLeastOneFalta = true;
}else
{
ecd.setEstado( MedicinaConstants.ESTADO_REALIZADO );
atLeastOneRealizado = true;
}
}
}
}
}
if(atLeastOneFalta)
{
if(atLeastOneRealizado)
{
marcacao.setEstado( MedicinaConstants.ESTADO_PARCIALMENTE_REALIZADO);
}else
{
marcacao.setEstado( MedicinaConstants.ESTADO_FALTOU);
}
}else
{
if(atLeastOneRealizado)
{
marcacao.setEstado( MedicinaConstants.ESTADO_REALIZADO);
}else
{
}
}
}
}

@ -143,6 +143,9 @@ public class ProcessoAccoesPanel extends JPanel
@ActionActivation(onSelect = REALIZAR_EXAME_MARCACAO, onChange = "")
public final LeafButton buttonExameMarcacaoRealizar = new LeafButton( "Realizar" );
@ActionActivation(onSelect = REALIZAR_PARCIAL_EXAME_MARCACAO, onChange = "")
public final LeafButton buttonExameMarcacaoRealizarParcial = new LeafButton( "Realizar Parcial." );
@ActionActivation(onSelect = FALTOU_EXAME_MARCACAO, onChange = "")
public final LeafButton buttonExameMarcacaoFaltou = new LeafButton( "Faltou" );
@ -346,6 +349,7 @@ public class ProcessoAccoesPanel extends JPanel
buttonExameMarcacaoDesmarcarTrabalhador.setEnabled( porRealizar );
buttonExameMarcacaoFaltou.setEnabled( porRealizar );
buttonExameMarcacaoRealizar.setEnabled( porRealizar );
buttonExameMarcacaoRealizarParcial.setEnabled( porRealizar );
buttonExameMarcacaoAnular.setEnabled( porRealizar );
buttonNovoExameMarcacaoObservacoes.setEnabled( noObservacoes );
cardLayout.show( cardPanel, PANEL_EXAME_MARCACAO_NAME );
@ -419,7 +423,7 @@ public class ProcessoAccoesPanel extends JPanel
JPanel exameMarcacaoUpperPanel = new JPanel();
JPanel exameMarcacaoLowerPanel = new JPanel();
setupSimpleActionsPanel( exameMarcacaoUpperPanel, buttonNovoExameMarcacaoEmail, buttonNovoExameMarcacaoObservacoes, new JPanel() );
setupSimpleActionsPanel( exameMarcacaoLowerPanel, buttonExameMarcacaoRealizar, buttonExameMarcacaoAnular, buttonExameMarcacaoDesmarcarSiprp, buttonExameMarcacaoDesmarcarTrabalhador, buttonExameMarcacaoFaltou );
setupSimpleActionsPanel( exameMarcacaoLowerPanel, buttonExameMarcacaoRealizar, buttonExameMarcacaoRealizarParcial, buttonExameMarcacaoFaltou, buttonExameMarcacaoAnular, buttonExameMarcacaoDesmarcarTrabalhador, buttonExameMarcacaoDesmarcarSiprp );
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) );

@ -488,7 +488,7 @@ public class ProcessoDadosPanel extends JPanel
}
}
}
LeafOptionDialog<PrtGruposProtocolo> gruposChosen = new LeafOptionDialog<PrtGruposProtocolo>( grupos, gruposSelected, gruposEnabled, "Escolha os ECDs para esta marca" +ccedil + atilde + "o" , "Marcar »" );
LeafOptionDialog<PrtGruposProtocolo> gruposChosen = new LeafOptionDialog<PrtGruposProtocolo>( grupos, gruposSelected, gruposEnabled, "Escolha os ECDs para esta marca" +ccedil + atilde + "o" , "Marcar >>" );
for( PrtGruposProtocolo grupo : gruposChosen.getSelected() )
{
marcacao.marcarGrupoExames( grupo );

@ -76,7 +76,7 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio
}
/**
* Binds data fields to actions
* Binds an Object to actions
*
* @author tsimao
*
@ -86,9 +86,9 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio
{
/**
* Actions that update this field
* Actions that use this field
*/
String useWithAction();
String [] useWith();
}
/**
@ -250,12 +250,18 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio
LeafObject leafObject = field.getAnnotation( LeafObject.class );
if( leafObject != null )
{
String updateOn = leafObject.useWithAction();
if( mapActionByName.containsKey( updateOn ) )
String [] useWith = leafObject.useWith();
if( useWith != null )
{
// valid action
mapLeafObjectByActionName.put( updateOn, field );
mapInstanceByField.put( field, instance );
for(String current : useWith )
{
if( mapActionByName.containsKey( current ) )
{
// valid action
mapLeafObjectByActionName.put( current, field );
mapInstanceByField.put( field, instance );
}
}
}
}
}

Loading…
Cancel
Save