forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.8 KiB
101 lines
2.8 KiB
package siprp.database.cayenne.objects;
|
|
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
|
|
import siprp.database.cayenne.objects.auto._TrabalhadoresEcdsDatas;
|
|
import siprp.database.cayenne.providers.MedicinaDAO;
|
|
import siprp.medicina.MedicinaConstants;
|
|
import siprp.medicina.processo.ui.OrderedMap;
|
|
|
|
public class TrabalhadoresEcdsDatas extends _TrabalhadoresEcdsDatas implements MedicinaConstants{
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
public String getDataString()
|
|
{
|
|
return getData() == null ? "" : sdf.format( getData() );
|
|
}
|
|
|
|
public String getEstadoString()
|
|
{
|
|
return getEstado() == null || getEstado() >= ESTADOS_EXAME_STR.length ? "" : ESTADOS_EXAME_STR[ getEstado() ];
|
|
}
|
|
|
|
public HashMap<Integer, String> getEstados()
|
|
{
|
|
HashMap<Integer, String> result = new HashMap<Integer, String>();
|
|
for( int i = 0; i < ESTADOS_EXAME_STR.length; ++i )
|
|
{
|
|
if( ESTADOS_EXAME_STR[i] != null )
|
|
{
|
|
result.put( new Integer( i ), ESTADOS_EXAME_STR[i] );
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
@Override
|
|
public void setData( Date date )
|
|
{
|
|
if( date != null && this.getToTrabalhadoresEcds() != null && this.getEstado() != null && new Integer(ESTADO_POR_REALIZAR).equals(this.getEstado()))
|
|
{
|
|
this.getToTrabalhadoresEcds().setData( date );
|
|
}
|
|
super.setData( date );
|
|
}
|
|
|
|
@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 )))
|
|
{
|
|
this.getToTrabalhadoresEcds().setEstado( estado );
|
|
}
|
|
super.setEstado( estado );
|
|
}
|
|
|
|
@Override
|
|
public String toString()
|
|
{
|
|
return getDataString() + ": " + getEstadoString();
|
|
}
|
|
|
|
public OrderedMap<PrtGruposProtocolo> getGruposExames()
|
|
{
|
|
OrderedMap<PrtGruposProtocolo> grupos = new OrderedMap<PrtGruposProtocolo>();
|
|
List<TrabalhadoresEcd> exames = this.getTrabalhadoresEcdArray();
|
|
if( exames != null )
|
|
{
|
|
for(TrabalhadoresEcd exame : exames)
|
|
{
|
|
String estado = MedicinaConstants.ESTADOS_EXAME_STR[exame.getEstado()];
|
|
PrtGruposProtocolo grupo = exame.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo();
|
|
if( !grupos.containsKey( grupo ))
|
|
{
|
|
grupos.putLast( grupo, grupo.getDescricao() );
|
|
grupos.putLast( grupo, estado );
|
|
}
|
|
}
|
|
}
|
|
return grupos;
|
|
}
|
|
|
|
public void marcarGrupoExames( PrtGruposProtocolo grupo )
|
|
{
|
|
List<PrtTiposElementosProtocolo> allEcd = getToTrabalhadoresEcds().getToTrabalhadores().getAllEcdForGrupo( grupo );
|
|
for(PrtTiposElementosProtocolo ecd : allEcd)
|
|
{
|
|
TrabalhadoresEcd trabEcd = new TrabalhadoresEcd();
|
|
trabEcd.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR );
|
|
trabEcd.setToPrtTiposElementosProtocolo( ecd );
|
|
trabEcd.setToTrabalhadoresEcdsDatas( this );
|
|
addToTrabalhadoresEcdArray( trabEcd );
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|