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

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

@ -404,6 +404,7 @@
<db-entity name="trabalhadores_ecd" schema="public"> <db-entity name="trabalhadores_ecd" schema="public">
<db-attribute name="ecd_id" type="INTEGER" length="10"/> <db-attribute name="ecd_id" type="INTEGER" length="10"/>
<db-attribute name="ecd_oficial_id" type="INTEGER" length="10"/> <db-attribute name="ecd_oficial_id" type="INTEGER" length="10"/>
<db-attribute name="enviado" type="CHAR" length="1"/>
<db-attribute name="estado" type="INTEGER" length="10"/> <db-attribute name="estado" type="INTEGER" length="10"/>
<db-attribute name="id" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/> <db-attribute name="id" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
<db-attribute name="trabalhadores_ecds_datas_id" type="INTEGER" length="10"/> <db-attribute name="trabalhadores_ecds_datas_id" type="INTEGER" length="10"/>
@ -426,7 +427,10 @@
</db-key-generator> </db-key-generator>
</db-entity> </db-entity>
<db-entity name="trabalhadores_ecds_datas" schema="public"> <db-entity name="trabalhadores_ecds_datas" schema="public">
<db-attribute name="analisador_id" type="INTEGER" length="10"/>
<db-attribute name="data" type="DATE" length="13"/> <db-attribute name="data" type="DATE" length="13"/>
<db-attribute name="data_envio" type="DATE" length="13"/>
<db-attribute name="data_recepcao" type="DATE" length="13"/>
<db-attribute name="estado" type="INTEGER" length="10"/> <db-attribute name="estado" type="INTEGER" length="10"/>
<db-attribute name="id" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/> <db-attribute name="id" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
<db-attribute name="prestador_id" type="INTEGER" length="10"/> <db-attribute name="prestador_id" type="INTEGER" length="10"/>
@ -766,6 +770,7 @@
<obj-attribute name="observacao" type="java.lang.String" db-attribute-path="observacao"/> <obj-attribute name="observacao" type="java.lang.String" db-attribute-path="observacao"/>
</obj-entity> </obj-entity>
<obj-entity name="TrabalhadoresEcd" className="siprp.database.cayenne.objects.TrabalhadoresEcd" lock-type="optimistic" dbEntityName="trabalhadores_ecd" superClassName="siprp.database.cayenne.objects.BaseObject"> <obj-entity name="TrabalhadoresEcd" className="siprp.database.cayenne.objects.TrabalhadoresEcd" lock-type="optimistic" dbEntityName="trabalhadores_ecd" superClassName="siprp.database.cayenne.objects.BaseObject">
<obj-attribute name="enviado" type="java.lang.Character" db-attribute-path="enviado"/>
<obj-attribute name="estado" type="java.lang.Integer" db-attribute-path="estado"/> <obj-attribute name="estado" type="java.lang.Integer" db-attribute-path="estado"/>
</obj-entity> </obj-entity>
<obj-entity name="TrabalhadoresEcds" className="siprp.database.cayenne.objects.TrabalhadoresEcds" lock-type="optimistic" dbEntityName="trabalhadores_ecds" superClassName="siprp.database.cayenne.objects.BaseObject"> <obj-entity name="TrabalhadoresEcds" className="siprp.database.cayenne.objects.TrabalhadoresEcds" lock-type="optimistic" dbEntityName="trabalhadores_ecds" superClassName="siprp.database.cayenne.objects.BaseObject">
@ -775,6 +780,8 @@
</obj-entity> </obj-entity>
<obj-entity name="TrabalhadoresEcdsDatas" className="siprp.database.cayenne.objects.TrabalhadoresEcdsDatas" lock-type="optimistic" dbEntityName="trabalhadores_ecds_datas" superClassName="siprp.database.cayenne.objects.BaseObject"> <obj-entity name="TrabalhadoresEcdsDatas" className="siprp.database.cayenne.objects.TrabalhadoresEcdsDatas" lock-type="optimistic" dbEntityName="trabalhadores_ecds_datas" superClassName="siprp.database.cayenne.objects.BaseObject">
<obj-attribute name="data" type="java.util.Date" db-attribute-path="data"/> <obj-attribute name="data" type="java.util.Date" db-attribute-path="data"/>
<obj-attribute name="dataEnvio" type="java.util.Date" db-attribute-path="data_envio"/>
<obj-attribute name="dataRecepcao" type="java.util.Date" db-attribute-path="data_recepcao"/>
<obj-attribute name="estado" type="java.lang.Integer" db-attribute-path="estado"/> <obj-attribute name="estado" type="java.lang.Integer" db-attribute-path="estado"/>
<obj-attribute name="id" type="java.lang.Integer" db-attribute-path="id"/> <obj-attribute name="id" type="java.lang.Integer" db-attribute-path="id"/>
</obj-entity> </obj-entity>
@ -980,8 +987,8 @@
<db-relationship name="trabalhadoresConsultasDatasArray" source="prestadores" target="trabalhadores_consultas_datas" toMany="true"> <db-relationship name="trabalhadoresConsultasDatasArray" source="prestadores" target="trabalhadores_consultas_datas" toMany="true">
<db-attribute-pair source="id" target="prestador_id"/> <db-attribute-pair source="id" target="prestador_id"/>
</db-relationship> </db-relationship>
<db-relationship name="trabalhadoresEcdsDatasArray" source="prestadores" target="trabalhadores_ecds_datas" toMany="true"> <db-relationship name="trabalhadoresEcdsDatasArray1" source="prestadores" target="trabalhadores_ecds_datas" toMany="true">
<db-attribute-pair source="id" target="prestador_id"/> <db-attribute-pair source="id" target="analisador_id"/>
</db-relationship> </db-relationship>
<db-relationship name="toPrestadores" source="prestadores_grupos_protocolo" target="prestadores" toMany="false"> <db-relationship name="toPrestadores" source="prestadores_grupos_protocolo" target="prestadores" toMany="false">
<db-attribute-pair source="prestador_id" target="id"/> <db-attribute-pair source="prestador_id" target="id"/>
@ -1079,6 +1086,9 @@
<db-relationship name="trabalhadoresEcdsDatasArray" source="trabalhadores_ecds" target="trabalhadores_ecds_datas" toMany="true"> <db-relationship name="trabalhadoresEcdsDatasArray" source="trabalhadores_ecds" target="trabalhadores_ecds_datas" toMany="true">
<db-attribute-pair source="id" target="trabalhadores_ecds_id"/> <db-attribute-pair source="id" target="trabalhadores_ecds_id"/>
</db-relationship> </db-relationship>
<db-relationship name="toAnalisador" source="trabalhadores_ecds_datas" target="prestadores" toMany="false">
<db-attribute-pair source="analisador_id" target="id"/>
</db-relationship>
<db-relationship name="toPrestadores" source="trabalhadores_ecds_datas" target="prestadores" toMany="false"> <db-relationship name="toPrestadores" source="trabalhadores_ecds_datas" target="prestadores" toMany="false">
<db-attribute-pair source="prestador_id" target="id"/> <db-attribute-pair source="prestador_id" target="id"/>
</db-relationship> </db-relationship>
@ -1178,7 +1188,7 @@
<obj-relationship name="toContactos" source="Prestadores" target="Contactos" db-relationship-path="toContactos"/> <obj-relationship name="toContactos" source="Prestadores" target="Contactos" db-relationship-path="toContactos"/>
<obj-relationship name="trabalhadoresConsultasArray" source="Prestadores" target="TrabalhadoresConsultas" db-relationship-path="trabalhadoresConsultasArray"/> <obj-relationship name="trabalhadoresConsultasArray" source="Prestadores" target="TrabalhadoresConsultas" db-relationship-path="trabalhadoresConsultasArray"/>
<obj-relationship name="trabalhadoresConsultasDatasArray" source="Prestadores" target="TrabalhadoresConsultasDatas" db-relationship-path="trabalhadoresConsultasDatasArray"/> <obj-relationship name="trabalhadoresConsultasDatasArray" source="Prestadores" target="TrabalhadoresConsultasDatas" db-relationship-path="trabalhadoresConsultasDatasArray"/>
<obj-relationship name="trabalhadoresEcdsDatasArray" source="Prestadores" target="TrabalhadoresEcdsDatas" db-relationship-path="trabalhadoresEcdsDatasArray"/> <obj-relationship name="trabalhadoresEcdsDatasArray" source="Prestadores" target="TrabalhadoresEcdsDatas" db-relationship-path="trabalhadoresEcdsDatasArray1"/>
<obj-relationship name="toPrestadores" source="PrestadoresGruposProtocolo" target="Prestadores" db-relationship-path="toPrestadores"/> <obj-relationship name="toPrestadores" source="PrestadoresGruposProtocolo" target="Prestadores" db-relationship-path="toPrestadores"/>
<obj-relationship name="toPrtGruposProtocolo" source="PrestadoresGruposProtocolo" target="PrtGruposProtocolo" db-relationship-path="toPrtGruposProtocolo"/> <obj-relationship name="toPrtGruposProtocolo" source="PrestadoresGruposProtocolo" target="PrtGruposProtocolo" db-relationship-path="toPrtGruposProtocolo"/>
<obj-relationship name="toEmpresas" source="PrtElementosProtocolo" target="Empresas" db-relationship-path="toEmpresas"/> <obj-relationship name="toEmpresas" source="PrtElementosProtocolo" target="Empresas" db-relationship-path="toEmpresas"/>
@ -1211,6 +1221,7 @@
<obj-relationship name="toTrabalhadores" source="TrabalhadoresEcds" target="Trabalhadores" db-relationship-path="toTrabalhadores"/> <obj-relationship name="toTrabalhadores" source="TrabalhadoresEcds" target="Trabalhadores" db-relationship-path="toTrabalhadores"/>
<obj-relationship name="toTrabalhadoresProcesso" source="TrabalhadoresEcds" target="TrabalhadoresProcesso" db-relationship-path="toTrabalhadoresProcesso"/> <obj-relationship name="toTrabalhadoresProcesso" source="TrabalhadoresEcds" target="TrabalhadoresProcesso" db-relationship-path="toTrabalhadoresProcesso"/>
<obj-relationship name="trabalhadoresEcdsDatasArray" source="TrabalhadoresEcds" target="TrabalhadoresEcdsDatas" db-relationship-path="trabalhadoresEcdsDatasArray"/> <obj-relationship name="trabalhadoresEcdsDatasArray" source="TrabalhadoresEcds" target="TrabalhadoresEcdsDatas" db-relationship-path="trabalhadoresEcdsDatasArray"/>
<obj-relationship name="toAnalisador" source="TrabalhadoresEcdsDatas" target="Prestadores" db-relationship-path="toAnalisador"/>
<obj-relationship name="toPrestadores" source="TrabalhadoresEcdsDatas" target="Prestadores" db-relationship-path="toPrestadores"/> <obj-relationship name="toPrestadores" source="TrabalhadoresEcdsDatas" target="Prestadores" db-relationship-path="toPrestadores"/>
<obj-relationship name="toTrabalhadoresEcds" source="TrabalhadoresEcdsDatas" target="TrabalhadoresEcds" db-relationship-path="toTrabalhadoresEcds"/> <obj-relationship name="toTrabalhadoresEcds" source="TrabalhadoresEcdsDatas" target="TrabalhadoresEcds" db-relationship-path="toTrabalhadoresEcds"/>
<obj-relationship name="trabalhadoresEcdArray" source="TrabalhadoresEcdsDatas" target="TrabalhadoresEcd" db-relationship-path="trabalhadoresEcdArray"/> <obj-relationship name="trabalhadoresEcdArray" source="TrabalhadoresEcdsDatas" target="TrabalhadoresEcd" db-relationship-path="trabalhadoresEcdArray"/>

@ -55,31 +55,5 @@ public class Trabalhadores extends _Trabalhadores
{ {
return getNomePlain(); return getNomePlain();
} }
public List<PrtTiposElementosProtocolo> getAllEcdForGrupo( PrtGruposProtocolo grupo )
{
List<PrtTiposElementosProtocolo> result = new ArrayList<PrtTiposElementosProtocolo>();
Integer perfil = getPerfil();
if( perfil != null )
{
Empresas empresa = getToEstabelecimentos().getToEmpresas();
List<PrtElementosProtocolo> ecdsPerfil = (List<PrtElementosProtocolo>) empresa.getPrtElementosProtocoloArray();
for( PrtElementosProtocolo ecdPerfil : ecdsPerfil )
{
if( perfil.equals( ecdPerfil.getNumeroPerfil() ) )
{
PrtTiposElementosProtocolo ecd = ecdPerfil.getToPrtTiposElementosProtocolo();
if( ecd != null )
{
if( ecd.getToPrtGruposProtocolo().equals( grupo ) && !result.contains( ecd ))
{
result.add( ecd );
}
}
}
}
}
return result;
}
} }

@ -1,5 +1,6 @@
package siprp.database.cayenne.objects; package siprp.database.cayenne.objects;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -43,6 +44,7 @@ public class TrabalhadoresEcds extends _TrabalhadoresEcds implements MedicinaCon
public OrderedMap<PrtGruposProtocolo> getGruposExamesForPerfil() public OrderedMap<PrtGruposProtocolo> getGruposExamesForPerfil()
{ {
OrderedMap<PrtGruposProtocolo> grupos = new OrderedMap<PrtGruposProtocolo>(); OrderedMap<PrtGruposProtocolo> grupos = new OrderedMap<PrtGruposProtocolo>();
List<Integer> estadosSoFar = new ArrayList<Integer>();
Trabalhadores trabalhador = this.getToTrabalhadores(); Trabalhadores trabalhador = this.getToTrabalhadores();
Integer perfil = trabalhador.getPerfil(); Integer perfil = trabalhador.getPerfil();
if( perfil != null ) if( perfil != null )
@ -63,35 +65,90 @@ public class TrabalhadoresEcds extends _TrabalhadoresEcds implements MedicinaCon
if( descricao != null && !grupos.containsKey( grupoEcd ) ) if( descricao != null && !grupos.containsKey( grupoEcd ) )
{ {
grupos.putLast( grupoEcd, descricao ); grupos.putLast( grupoEcd, descricao );
Integer estado = getEstadoForGrupoEcd(grupoEcd); Integer estado = getEstadoForGrupoEcd( grupoEcd );
grupos.putLast( grupoEcd, estado != null ? MedicinaConstants.ESTADOS_EXAME_STR[estado] : " " ); grupos.putLast( grupoEcd, estado != null ? MedicinaConstants.ESTADOS_EXAME_STR[estado] : " " );
if( !estadosSoFar.contains( estado ) )
{
estadosSoFar.add( estado );
}
} }
} }
} }
} }
} }
} }
if( estadosSoFar.size() == 1 )
{
if( estadosSoFar.contains( new Integer( ESTADO_ANULADO ) ) || estadosSoFar.contains( new Integer( ESTADO_REALIZADO ) ) )
{
setEstado( ESTADO_REALIZADO );
}
else if( estadosSoFar.contains( new Integer( ESTADO_POR_REALIZAR ) ) )
{
setEstado( ESTADO_POR_REALIZAR );
}
else
{
setEstado( ESTADO_POR_MARCAR );
}
}
else if( estadosSoFar.size() == 2 )
{
if( estadosSoFar.contains( new Integer( ESTADO_ANULADO ) ) && estadosSoFar.contains( new Integer( ESTADO_REALIZADO ) ) )
{
setEstado( ESTADO_REALIZADO );
}
else if( estadosSoFar.contains( new Integer( ESTADO_POR_MARCAR ) ) )
{
setEstado( ESTADO_POR_MARCAR );
}
else if( estadosSoFar.contains( new Integer( ESTADO_ANULADO ) ) || estadosSoFar.contains( new Integer( ESTADO_REALIZADO ) ) )
{
setEstado( ESTADO_PARCIALMENTE_REALIZADO );
}
else
{
setEstado( ESTADO_POR_REALIZAR );
}
}
else
{
if( estadosSoFar.contains( new Integer( ESTADO_POR_MARCAR ) ) )
{
setEstado( ESTADO_POR_MARCAR );
}
else if( estadosSoFar.contains( new Integer( ESTADO_ANULADO ) ) && estadosSoFar.contains( new Integer( ESTADO_REALIZADO ) ) )
{
setEstado( ESTADO_PARCIALMENTE_REALIZADO );
}
else
{
setEstado( ESTADO_POR_REALIZAR );
}
}
return grupos; return grupos;
} }
private Integer getEstadoForGrupoEcd(PrtGruposProtocolo grupoEcd) private Integer getEstadoForGrupoEcd( PrtGruposProtocolo grupoEcd )
{ {
Integer estado = null; Integer estado = null;
List<TrabalhadoresEcdsDatas> marcacoes = getTrabalhadoresEcdsDatasArray(); List<TrabalhadoresEcdsDatas> marcacoes = getTrabalhadoresEcdsDatasArray();
if(marcacoes != null) if( marcacoes != null )
{ {
for(TrabalhadoresEcdsDatas marcacao : marcacoes) for( TrabalhadoresEcdsDatas marcacao : marcacoes )
{ {
List<TrabalhadoresEcd> ecds = marcacao.getTrabalhadoresEcdArray(); List<TrabalhadoresEcd> ecds = marcacao.getTrabalhadoresEcdArray();
for( TrabalhadoresEcd ecd : ecds ) for( TrabalhadoresEcd ecd : ecds )
{ {
if(ecd.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo().equals( grupoEcd )) if( ecd.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo().equals( grupoEcd ) )
{ {
if(new Integer(ESTADO_REALIZADO).equals(ecd.getEstado())) if( new Integer( ESTADO_REALIZADO ).equals( ecd.getEstado() ) || new Integer( ESTADO_ANULADO ).equals( ecd.getEstado() ) )
{ {
return new Integer(ESTADO_REALIZADO); return ecd.getEstado();
} }
else if(estado == null) else if( new Integer( ESTADO_POR_REALIZAR ).equals( ecd.getEstado() ) )
{ {
estado = ecd.getEstado(); estado = ecd.getEstado();
break; break;
@ -100,7 +157,7 @@ public class TrabalhadoresEcds extends _TrabalhadoresEcds implements MedicinaCon
} }
} }
} }
return estado == null ? ESTADO_POR_REALIZAR : estado; return estado == null ? ESTADO_POR_MARCAR : estado;
} }
} }

@ -1,5 +1,6 @@
package siprp.database.cayenne.objects; package siprp.database.cayenne.objects;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -9,19 +10,20 @@ import siprp.database.cayenne.providers.MedicinaDAO;
import siprp.medicina.MedicinaConstants; import siprp.medicina.MedicinaConstants;
import siprp.medicina.processo.ui.OrderedMap; import siprp.medicina.processo.ui.OrderedMap;
public class TrabalhadoresEcdsDatas extends _TrabalhadoresEcdsDatas implements MedicinaConstants{ public class TrabalhadoresEcdsDatas extends _TrabalhadoresEcdsDatas implements MedicinaConstants
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getDataString() public String getDataString()
{ {
return getData() == null ? "" : sdf.format( getData() ); return getData() == null ? "" : sdf.format( getData() );
} }
public String getEstadoString() public String getEstadoString()
{ {
return getEstado() == null || getEstado() >= ESTADOS_EXAME_STR.length ? "" : ESTADOS_EXAME_STR[ getEstado() ]; return getEstado() == null || getEstado() >= ESTADOS_EXAME_STR.length ? "" : ESTADOS_EXAME_STR[getEstado()];
} }
public HashMap<Integer, String> getEstados() public HashMap<Integer, String> getEstados()
{ {
HashMap<Integer, String> result = new HashMap<Integer, String>(); HashMap<Integer, String> result = new HashMap<Integer, String>();
@ -34,76 +36,86 @@ public class TrabalhadoresEcdsDatas extends _TrabalhadoresEcdsDatas implements M
} }
return result; return result;
} }
@Override @Override
public void setData( Date date ) public void setData( Date date )
{ {
if( date != null && this.getToTrabalhadoresEcds() != null && this.getEstado() != null && new Integer(ESTADO_POR_REALIZAR).equals(this.getEstado())) if( date != null && this.getToTrabalhadoresEcds() != null && this.getEstado() != null && new Integer( ESTADO_POR_REALIZAR ).equals( this.getEstado() ) )
{ {
this.getToTrabalhadoresEcds().setData( date ); this.getToTrabalhadoresEcds().setData( date );
} }
super.setData( date ); super.setData( date );
} }
@Override
public void setEstado( Integer estado )
{
if( estado != null && this.getToTrabalhadoresEcds() != null)
{
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 @Override
public String toString() public String toString()
{ {
return getDataString() + ": " + getEstadoString(); return getDataString() + ": " + getEstadoString();
} }
public OrderedMap<PrtGruposProtocolo> getGruposExames() public OrderedMap<PrtGruposProtocolo> getStatesForeGruposExames()
{ {
OrderedMap<PrtGruposProtocolo> grupos = new OrderedMap<PrtGruposProtocolo>(); OrderedMap<PrtGruposProtocolo> grupos = new OrderedMap<PrtGruposProtocolo>();
List<TrabalhadoresEcd> exames = this.getTrabalhadoresEcdArray(); List<TrabalhadoresEcd> exames = this.getTrabalhadoresEcdArray();
if( exames != null ) if( exames != null )
{ {
for(TrabalhadoresEcd exame : exames) for( TrabalhadoresEcd exame : exames )
{ {
String estado = MedicinaConstants.ESTADOS_EXAME_STR[exame.getEstado()]; String estadoString = MedicinaConstants.ESTADOS_EXAME_STR[exame.getEstado()];
PrtGruposProtocolo grupo = exame.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo(); PrtGruposProtocolo grupo = exame.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo();
if( !grupos.containsKey( grupo )) if( !grupos.containsKey( grupo ) )
{ {
grupos.putLast( grupo, grupo.getDescricao() ); grupos.putLast( grupo, grupo.getDescricao() );
grupos.putLast( grupo, estado ); grupos.putLast( grupo, estadoString );
} }
} }
} }
return grupos; return grupos;
} }
private List<PrtTiposElementosProtocolo> getAllEcdForGrupoForThisMarcacao( PrtGruposProtocolo grupo )
{
List<PrtTiposElementosProtocolo> result = new ArrayList<PrtTiposElementosProtocolo>();
for( TrabalhadoresEcd ecd : (List<TrabalhadoresEcd>) getTrabalhadoresEcdArray() )
{
if( grupo.equals( ecd.getToPrtTiposElementosProtocolo().getToPrtGruposProtocolo() ) )
{
result.add( ecd.getToPrtTiposElementosProtocolo() );
}
}
return result;
}
private List<PrtTiposElementosProtocolo> getAllEcdForGrupoAndCurrentPerfil( PrtGruposProtocolo grupo )
{
Trabalhadores trabalhador = getToTrabalhadoresEcds().getToTrabalhadores();
List<PrtTiposElementosProtocolo> result = new ArrayList<PrtTiposElementosProtocolo>();
Integer perfil = trabalhador.getPerfil();
if( perfil != null )
{
Empresas empresa = trabalhador.getToEstabelecimentos().getToEmpresas();
List<PrtElementosProtocolo> ecdsPerfil = (List<PrtElementosProtocolo>) empresa.getPrtElementosProtocoloArray();
for( PrtElementosProtocolo ecdPerfil : ecdsPerfil )
{
if( perfil.equals( ecdPerfil.getNumeroPerfil() ) )
{
PrtTiposElementosProtocolo ecd = ecdPerfil.getToPrtTiposElementosProtocolo();
if( ecd != null )
{
if( ecd.getToPrtGruposProtocolo().equals( grupo ) && !result.contains( ecd ) )
{
result.add( ecd );
}
}
}
}
}
return result;
}
public void marcarGrupoExames( PrtGruposProtocolo grupo ) public void marcarGrupoExames( PrtGruposProtocolo grupo )
{ {
List<PrtTiposElementosProtocolo> allEcd = getToTrabalhadoresEcds().getToTrabalhadores().getAllEcdForGrupo( grupo ); for( PrtTiposElementosProtocolo ecd : getAllEcdForGrupoAndCurrentPerfil( grupo ) )
for(PrtTiposElementosProtocolo ecd : allEcd)
{ {
TrabalhadoresEcd trabEcd = new TrabalhadoresEcd(); TrabalhadoresEcd trabEcd = new TrabalhadoresEcd();
trabEcd.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR ); trabEcd.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR );
@ -112,21 +124,45 @@ public class TrabalhadoresEcdsDatas extends _TrabalhadoresEcdsDatas implements M
addToTrabalhadoresEcdArray( trabEcd ); addToTrabalhadoresEcdArray( trabEcd );
} }
} }
public void realizar() public void setStateForGrupoProtocolo( PrtGruposProtocolo grupo, Integer estado )
{ {
List<TrabalhadoresEcd> ecds = getTrabalhadoresEcdArray(); List<PrtTiposElementosProtocolo> group = getAllEcdForGrupoForThisMarcacao( grupo );
if( ecds != null ) for(TrabalhadoresEcd ecd : (List<TrabalhadoresEcd>) getTrabalhadoresEcdArray())
{ {
for(TrabalhadoresEcd ecd : ecds) if(group.contains( ecd.getToPrtTiposElementosProtocolo()))
{ {
ecd.setEstado( MedicinaConstants.ESTADO_REALIZADO ); ecd.setEstado( estado );
} }
} }
setEstado( MedicinaConstants.ESTADO_REALIZADO );
} }
}
public void setStateForGrupoProtocolo( PrtGruposProtocolo grupo, String estado )
{
for( int i = 0; i < ESTADOS_EXAME_STR.length; ++i )
{
String currentEstado = ESTADOS_EXAME_STR[i];
if( currentEstado != null && new Integer( i ).equals( estado ) )
{
setStateForGrupoProtocolo( grupo, i );
break;
}
}
}
@Override
public void setEstado( Integer estado )
{
List<TrabalhadoresEcd> allEcd = (List<TrabalhadoresEcd>) getTrabalhadoresEcdArray();
if(allEcd != null)
{
for(TrabalhadoresEcd ecd : allEcd )
{
ecd.setEstado( estado );
}
}
super.setEstado( estado );
getToTrabalhadoresEcds().getGruposExamesForPerfil();
}
}

@ -7,6 +7,7 @@ package siprp.database.cayenne.objects.auto;
*/ */
public abstract class _TrabalhadoresEcd extends siprp.database.cayenne.objects.BaseObject { public abstract class _TrabalhadoresEcd extends siprp.database.cayenne.objects.BaseObject {
public static final String ENVIADO_PROPERTY = "enviado";
public static final String ESTADO_PROPERTY = "estado"; public static final String ESTADO_PROPERTY = "estado";
public static final String TO_ECD_OFICIAL_PROPERTY = "toEcdOficial"; public static final String TO_ECD_OFICIAL_PROPERTY = "toEcdOficial";
public static final String TO_PRT_TIPOS_ELEMENTOS_PROTOCOLO_PROPERTY = "toPrtTiposElementosProtocolo"; public static final String TO_PRT_TIPOS_ELEMENTOS_PROTOCOLO_PROPERTY = "toPrtTiposElementosProtocolo";
@ -14,6 +15,14 @@ public abstract class _TrabalhadoresEcd extends siprp.database.cayenne.objects.B
public static final String ID_PK_COLUMN = "id"; public static final String ID_PK_COLUMN = "id";
public void setEnviado(Character enviado) {
writeProperty("enviado", enviado);
}
public Character getEnviado() {
return (Character)readProperty("enviado");
}
public void setEstado(Integer estado) { public void setEstado(Integer estado) {
writeProperty("estado", estado); writeProperty("estado", estado);
} }

@ -8,8 +8,11 @@ package siprp.database.cayenne.objects.auto;
public abstract class _TrabalhadoresEcdsDatas extends siprp.database.cayenne.objects.BaseObject { public abstract class _TrabalhadoresEcdsDatas extends siprp.database.cayenne.objects.BaseObject {
public static final String DATA_PROPERTY = "data"; public static final String DATA_PROPERTY = "data";
public static final String DATA_ENVIO_PROPERTY = "dataEnvio";
public static final String DATA_RECEPCAO_PROPERTY = "dataRecepcao";
public static final String ESTADO_PROPERTY = "estado"; public static final String ESTADO_PROPERTY = "estado";
public static final String ID_PROPERTY = "id"; public static final String ID_PROPERTY = "id";
public static final String TO_ANALISADOR_PROPERTY = "toAnalisador";
public static final String TO_PRESTADORES_PROPERTY = "toPrestadores"; public static final String TO_PRESTADORES_PROPERTY = "toPrestadores";
public static final String TO_TRABALHADORES_ECDS_PROPERTY = "toTrabalhadoresEcds"; public static final String TO_TRABALHADORES_ECDS_PROPERTY = "toTrabalhadoresEcds";
public static final String TRABALHADORES_ECD_ARRAY_PROPERTY = "trabalhadoresEcdArray"; public static final String TRABALHADORES_ECD_ARRAY_PROPERTY = "trabalhadoresEcdArray";
@ -26,6 +29,22 @@ public abstract class _TrabalhadoresEcdsDatas extends siprp.database.cayenne.obj
} }
public void setDataEnvio(java.util.Date dataEnvio) {
writeProperty("dataEnvio", dataEnvio);
}
public java.util.Date getDataEnvio() {
return (java.util.Date)readProperty("dataEnvio");
}
public void setDataRecepcao(java.util.Date dataRecepcao) {
writeProperty("dataRecepcao", dataRecepcao);
}
public java.util.Date getDataRecepcao() {
return (java.util.Date)readProperty("dataRecepcao");
}
public void setEstado(Integer estado) { public void setEstado(Integer estado) {
writeProperty("estado", estado); writeProperty("estado", estado);
} }
@ -42,6 +61,15 @@ public abstract class _TrabalhadoresEcdsDatas extends siprp.database.cayenne.obj
} }
public void setToAnalisador(siprp.database.cayenne.objects.Prestadores toAnalisador) {
setToOneTarget("toAnalisador", toAnalisador, true);
}
public siprp.database.cayenne.objects.Prestadores getToAnalisador() {
return (siprp.database.cayenne.objects.Prestadores)readProperty("toAnalisador");
}
public void setToPrestadores(siprp.database.cayenne.objects.Prestadores toPrestadores) { public void setToPrestadores(siprp.database.cayenne.objects.Prestadores toPrestadores) {
setToOneTarget("toPrestadores", toPrestadores, true); setToOneTarget("toPrestadores", toPrestadores, true);
} }

@ -348,7 +348,7 @@ public class MedicinaProcessoLogic extends SIPRPLogic
{ {
if( currentExameMarcacao != null ) if( currentExameMarcacao != null )
{ {
currentExameMarcacao.realizar(); currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_REALIZADO );
runActionLater( SAVE_EXAME_MARCACAO ); runActionLater( SAVE_EXAME_MARCACAO );
} }
} }
@ -482,8 +482,8 @@ public class MedicinaProcessoLogic extends SIPRPLogic
public TrabalhadoresEcdsDatas createExameMarcacao() public TrabalhadoresEcdsDatas createExameMarcacao()
{ {
currentExameMarcacao = new TrabalhadoresEcdsDatas(); currentExameMarcacao = new TrabalhadoresEcdsDatas();
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR );
currentExameMarcacao.setToTrabalhadoresEcds( currentExame ); currentExameMarcacao.setToTrabalhadoresEcds( currentExame );
currentExameMarcacao.setEstado( MedicinaConstants.ESTADO_POR_REALIZAR );
runActionLater( SAVE_EXAME_MARCACAO ); runActionLater( SAVE_EXAME_MARCACAO );
return currentExameMarcacao; return currentExameMarcacao;
} }

@ -354,7 +354,7 @@ public class ProcessoDadosPanel extends JPanel
{ {
inputExameMarcacaoData.setObject( exameMarcacao.getData() ); inputExameMarcacaoData.setObject( exameMarcacao.getData() );
inputExameMarcacaoEstado.setObject( exameMarcacao.getEstados(), exameMarcacao.getEstado() ); inputExameMarcacaoEstado.setObject( exameMarcacao.getEstados(), exameMarcacao.getEstado() );
OrderedMap<PrtGruposProtocolo> grupos = exameMarcacao.getGruposExames(); OrderedMap<PrtGruposProtocolo> grupos = exameMarcacao.getStatesForeGruposExames();
inputExameMarcacaoGruposEcds.setCollapseOptions( false ); inputExameMarcacaoGruposEcds.setCollapseOptions( false );
inputExameMarcacaoGruposEcds.setObject( grupos, grupos.getFirst() ); inputExameMarcacaoGruposEcds.setObject( grupos, grupos.getFirst() );
cardLayout.show( this, PANEL_EXAME_MARCACAO_NAME ); cardLayout.show( this, PANEL_EXAME_MARCACAO_NAME );

Loading…
Cancel
Save