3
* $Id: panelhistorial2.cpp 3710 2011-04-15 10:29:01Z tovar $
6
* Copyright 2008-10 MetaEmotion S.L. All rights reserved.
7
* http://ginkgo-cadx.com
9
* This file is licensed under LGPL v3 license.
10
* See License.txt for details
14
//#define _GINKGO_TRACE
15
#include <api/globals.h>
19
#include <wx/filename.h>
21
#include <wx/textfile.h>
22
#include <wx/imaglist.h>
24
#include <wx/config.h>
25
#include <wx/busyinfo.h>
26
#include <wx/bmpcbox.h>
27
#include <wx/ginkgostyle/ginkgostyle.h>
29
#include "panelhistorial2.h"
30
#include "panelserie.h"
31
#include "panelpaciente.h"
32
#include "panelestudio.h"
33
#include "dialogoconfirmacioneliminar.h"
34
#include <main/gui/import/wxwizardimportacionginkgo.h>
35
#include <main/gui/adquisition/dialogoadquisicion.h>
36
#include <main/gui/open/abrir.h>
38
#include <api/idicommanager.h>
39
#include <eventos/eventosginkgo.h>
41
#include <main/entorno.h>
42
#include <main/gui/mainwindow/ventanaprincipal.h>
43
#include <main/controllers/controladorextensiones.h>
44
#include <main/controllers/controladorpermisos.h>
45
#include <main/controllers/controladorhistorial.h>
46
#include <commands/comandoincluirhistorial.h>
47
#include <api/icontroladorcomandos.h>
48
#include <api/internacionalizacion.h>
49
#include <api/icontextoestudio.h>
50
#include <resources/ginkgoresourcemanager.h>
54
#include <api/imodelodicom.h>
65
class TimerRecargarHistorial:public wxTimer
68
TimerRecargarHistorial(PanelHistorial2* pHistorial){
69
m_pHistorial = pHistorial;
72
~TimerRecargarHistorial()
79
m_pHistorial->RecargarBusqueda();
82
PanelHistorial2* m_pHistorial;
85
class wxDataPaciente: public wxClientData {
87
wxDataPaciente(const GNC::GCS::ControladorHistorial::ModeloPaciente& modeloPaciente):wxClientData()
89
m_modeloPaciente = modeloPaciente;
93
GNC::GCS::ControladorHistorial::ModeloPaciente m_modeloPaciente;
97
PanelHistorial2::PanelHistorial2(wxWindow* parent) : PanelHistorial2Base(parent),
98
INodoHistorial(NULL,"")
100
m_pTimerRecargar = new TimerRecargarHistorial(this);
101
m_pacienteActual = _Std("All");
102
m_modalidadActual = _Std("All");
103
m_fromActual = wxDateTime::Now();
104
m_toActual = wxInvalidDateTime;
106
m_pHistoryTitle->GetButtonBar()->AddTool(ID_EJECUTAR,_("Hide"),GinkgoResourcesManager::PanelHistorial::GetIcoPlegar(),_("Hide"), wxITEM_NORMAL);
107
m_pHistoryTitle->GetButtonBar()->Connect(ID_EJECUTAR,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( PanelHistorial2::OnPlegarClick),NULL,this);
108
m_pHistoryTitle->Realize();
111
m_pFiltersTitle->GetButtonBar()->AddTool(ID_EJECUTAR,_("Hide"),GinkgoResourcesManager::PanelHistorial::GetIcoPlegar(),_("Hide"), wxITEM_NORMAL);
112
m_pFiltersTitle->GetButtonBar()->Connect(ID_EJECUTAR,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( PanelHistorial2::OnPlegarFilters),NULL,this);
113
m_pFiltersTitle->Realize();
116
m_pComboBoxPaciente->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( PanelHistorial2::OnComboBox ), NULL, this );
119
m_pComboDate->Select(0);
121
//se conecta el evento Ginkgo
122
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GCS::Eventos::EventoModificacionFichero());
123
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GCS::Eventos::EventoAddFicheroHistorial());
124
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GUI::Eventos::EventoSeleccionarHistorial());
125
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GUI::Eventos::EventoLayoutHistorial());
126
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GUI::Eventos::EventoAbribleEliminado());
127
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GUI::Eventos::EventoRecargarHistorial());
128
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GUI::Eventos::EventoAddModeloHistorial());
129
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GCS::Eventos::EventoColorPaciente());
130
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GUI::Eventos::EventoLimpiarHistorial());
131
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GCS::Eventos::EvtHandleDicom());
132
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GCS::Eventos::EventView());
133
GNC::Entorno::Instance()->GetControladorEventos()->Registrar(this, GNC::GCS::Eventos::EventDeleteFileHistory());
135
m_pSeleccionado = NULL;
138
SetMinSize(wxSize(230, -1));
139
SetMaxSize(wxSize(230, -1));
143
PanelHistorial2::~PanelHistorial2() {
144
//stores filter state
146
wxConfigBase * config = wxConfigBase::Get();
147
config->SetPath(wxT("/GinkgoCore/History"));
148
config->Write(wxT("PatientComboValue"),m_pComboBoxPaciente->GetValue());
149
config->Write(wxT("ModalityValue"),m_pComboModalidad->GetValue());
150
config->Write(wxT("DateChoice") , m_pComboDate->GetSelection());
151
if (m_fromActual.IsValid()) {
152
config->Write(wxT("DateFrom"), m_fromActual.Format(wxT("%Y/%m/%d")));
154
config->DeleteEntry(wxT("DateFrom"));
156
if (m_toActual.IsValid()) {
157
config->Write(wxT("DateTo"), m_toActual.Format(wxT("%Y/%m/%d")));
159
config->DeleteEntry(wxT("DateTo"));
163
//si es preciso limpiar historial...
164
GNC::GCS::Permisos::EstadoPermiso estado = GNC::GCS::ControladorPermisos::Instance()->Get("core.history", "anonymous");
166
GNC::GCS::ControladorHistorial::Instance()->VaciarHistorial(true);
168
delete m_pTimerRecargar;
170
this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PanelHistorial2::OnSize ) );
171
this->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( PanelHistorial2::OnMenuMouse ), NULL, this );
174
void PanelHistorial2::RecargarCombos(bool comprobarPurga)
176
if (comprobarPurga) {
177
//si es preciso limpiar historial...
178
GNC::GCS::Permisos::EstadoPermiso estado = GNC::GCS::ControladorPermisos::Instance()->Get("core.history", "anonymous");
180
GNC::GCS::ControladorHistorial::Instance()->VaciarHistorial(true);
184
//combo box pacientes
185
GNC::GCS::ControladorHistorial::ListaModelosPaciente listaPacientes;
186
GNC::GCS::ControladorHistorial::Instance()->GetAllPatients(listaPacientes);
188
m_pComboBoxPaciente->Clear();
190
m_pComboBoxPaciente->AppendString(_("All"));
191
if (m_pacienteActual == _Std("All")) {
192
m_pComboBoxPaciente->Select(0);
194
m_pComboBoxPaciente->AppendString(wxT("-----------------------------"));
196
for (GNC::GCS::ControladorHistorial::ListaModelosPaciente::iterator it = listaPacientes.begin(); it != listaPacientes.end(); ++it) {
197
std::ostringstream ostr;
198
ostr << (*it).m_nombrePaciente << " (" << (*it).m_idPaciente << ")";
200
wxDataPaciente* pData = new wxDataPaciente((*it));
202
if ((*it).m_sexo == 'M'){
203
indice = m_pComboBoxPaciente->Append(wxString::FromUTF8(ostr.str().c_str()), GinkgoResourcesManager::PanelHistorial::GetIcoHombre(), pData);
204
}else if((*it).m_sexo =='F'){
205
indice = m_pComboBoxPaciente->Append(wxString::FromUTF8(ostr.str().c_str()), GinkgoResourcesManager::PanelHistorial::GetIcoMujer(), pData);
207
indice = m_pComboBoxPaciente->Append(wxString::FromUTF8(ostr.str().c_str()), GinkgoResourcesManager::PanelHistorial::GetIcoOtro(), pData);
210
if ((*it).m_idPaciente == m_pacienteActual) {
211
m_pComboBoxPaciente->Select(indice);
214
if (m_pComboBoxPaciente->GetSelection() <0) {
215
m_pComboBoxPaciente->Select(0);
218
//combo box modalidades
219
m_pComboModalidad->Clear();
220
m_pComboModalidad->AppendString(_("All"));
221
if (m_modalidadActual == _Std("All")) {
222
m_pComboModalidad->Select(0);
224
m_pComboModalidad->AppendString(wxT("-----------------------------"));
226
std::list<std::string> listaModalidades;
227
GNC::GCS::ControladorHistorial::Instance()->GetAllModalities(listaModalidades);
228
for (std::list<std::string>::iterator it = listaModalidades.begin(); it != listaModalidades.end(); ++it) {
229
int item = m_pComboModalidad->Append((wxString::FromUTF8((*it).c_str())));
230
if (m_modalidadActual == (*it)) {
231
m_pComboModalidad->Select(item);
235
if (comprobarPurga) {
237
wxConfigBase * config = wxConfigBase::Get();
238
config->SetPath(wxT("/GinkgoCore/History"));
240
if ( config->Read(wxT("PatientComboValue"), &tmp, wxEmptyString) ) {
241
int pos = m_pComboBoxPaciente->FindString(tmp);
243
m_pComboBoxPaciente->Select(pos);
246
if ( config->Read(wxT("ModalityValue"), &tmp) ) {
247
int pos = m_pComboModalidad->FindString(tmp);
249
m_pComboModalidad->Select(pos);
253
if (config->Read(wxT("DateChoice"), &intTmp)) {
254
m_pComboDate->Select(intTmp);
256
if (m_pComboDate->GetValue() == _("Between:")) {
257
if (config->Read(wxT("DateFrom"), &tmp)) {
259
from.ParseFormat(tmp, wxT("%Y/%m/%d"),wxDateTime::Now());
260
m_pDatePickerFrom->SetValue(from);
262
if (config->Read(wxT("DateTo"), &tmp)) {
264
to.ParseFormat(tmp, wxT("%Y/%m/%d"),wxDateTime::Now());
265
m_pDatePickerTo->SetValue(to);
271
void PanelHistorial2::CargarSeries( const GNC::GCS::IControladorHistorial::ListaModelosSeries& modelos, GnkPtr<GIL::IModeloIntegracion> pModeloIntegracion)
273
GNC::Entorno::Instance()->GetVentanaPrincipal()->SuperFreeze();
275
m_pPanelHistorial->Freeze();
276
std::string uidScroll = "";
278
m_pPanelNoCabeMas->Show(false);
280
bool refrescar = false;
281
for(GNC::GCS::ControladorHistorial::ListaModelosSeries::const_iterator it = modelos.begin(); it!= modelos.end(); it++) {
282
GNC::GCS::ControladorHistorial::ModeloSerie modeloControlador = (*it);
284
if(m_mapaUIDsAbribles.find(modeloControlador.m_uidSerie) != m_mapaUIDsAbribles.end()){
285
uidScroll = modeloControlador.m_uidSerie;
287
if(modeloControlador.m_modalidad != "SR") {
288
//se rellena el modelo
289
PanelPaciente* pPaciente = GetPaciente(modeloControlador);
291
if (pPaciente != NULL) {
292
uidScroll = modeloControlador.m_uidSerie;
293
m_mapaUIDsAbribles[modeloControlador.m_uidSerie] = pPaciente;
294
pPaciente->AddModeloSerie(modeloControlador);
297
//no caben más pacientes...
298
m_pPanelNoCabeMas->Show(true);
299
m_pPanelHistorial->Layout();
307
m_pResultTitle->SetTitle(_("Results") + wxString::Format(_(" (%d series)"), m_mapaUIDsAbribles.size()));
308
GNC::GCS::ControladorEventos::Instance()->ProcesarEvento(new GNC::GUI::Eventos::EventoLayoutHistorial());
311
if(uidScroll != "") {
312
PanelSerie* pPanel = m_mapaUIDsAbribles[uidScroll]->GetSeries(uidScroll, true);
313
wxWindow* pWin = dynamic_cast<wxWindow*>(pPanel);
316
m_pPanelHistorial->GetScrollPixelsPerUnit(&pixelsx,&pixelsy);
318
wxWindow* pParent = pWin;
320
punto.y += pParent->GetPosition().y;
321
pParent = pParent->GetParent();
322
}while (pParent != this);
324
m_pPanelHistorial->CalcUnscrolledPosition(punto.x,punto.y,&x,&y);
325
m_pPanelHistorial->Scroll(0,y/pixelsy);
327
m_pPanelHistorial->Scroll(0,0);
330
m_pPanelHistorial->Scroll(0,0);
332
GNC::Entorno::Instance()->GetVentanaPrincipal()->SuperThaw();
334
m_pPanelHistorial->Thaw();
338
void PanelHistorial2::CargarDCMs( const GNC::GCS::IControladorHistorial::ListaModelosDCM& modelos, GnkPtr<GIL::IModeloIntegracion> pModeloIntegracion, bool desplegarNodo)
340
GNC::Entorno::Instance()->GetVentanaPrincipal()->SuperFreeze();
342
m_pPanelHistorial->Freeze();
343
std::string uidScroll = "";
345
m_pPanelNoCabeMas->Show(false);
347
bool refrescar = false;
348
//los ficheros que pertenecen a series que ya existen provocan el refresco
349
std::set<std::string> listaRefrescarSlices;
350
for(GNC::GCS::ControladorHistorial::ListaModelosDCM::const_iterator it = modelos.begin(); it!= modelos.end(); it++) {
351
GNC::GCS::ControladorHistorial::ModeloDCM modeloDCM = (*it);
353
if(m_mapaUIDsAbribles.find(modeloDCM.m_uidSerie) != m_mapaUIDsAbribles.end()){
354
uidScroll = modeloDCM.m_uidSerie;
355
listaRefrescarSlices.insert(modeloDCM.m_uidSerie);
359
//ahora se meten las nuevas series
360
for(GNC::GCS::ControladorHistorial::ListaModelosDCM::const_iterator it = modelos.begin(); it!= modelos.end(); it++) {
361
GNC::GCS::ControladorHistorial::ModeloDCM modeloDCM = (*it);
363
if(m_mapaUIDsAbribles.find(modeloDCM.m_uidSerie) != m_mapaUIDsAbribles.end()){
364
uidScroll = modeloDCM.m_uidSerie;
366
PanelSerie* pPanel = m_mapaUIDsAbribles[modeloDCM.m_uidSerie]->GetSeries(modeloDCM.m_uidSerie);
367
if (pPanel != NULL) {
368
pPanel->IncrementarNumeroSlices();
371
if(modeloDCM.m_modalidad != "SR") {
372
GNC::GCS::ControladorHistorial::ModeloSerie modeloSerie(modeloDCM);
373
//se rellena el modelo
374
PanelPaciente* pPaciente = GetPaciente(modeloSerie, desplegarNodo);
375
if (pPaciente != NULL) {
376
m_mapaUIDsAbribles[modeloSerie.m_uidSerie] = pPaciente;
377
uidScroll = modeloDCM.m_uidSerie;
378
pPaciente->AddModeloSerie(modeloSerie);
381
//no caben más pacientes
382
m_pPanelNoCabeMas->Show(true);
383
m_pPanelHistorial->Layout();
390
//por último se refresca el numero d slices de las series que exisitian
391
for (std::set<std::string>::iterator it = listaRefrescarSlices.begin(); it != listaRefrescarSlices.end(); ++it) {
392
PanelSerie* pPanel = m_mapaUIDsAbribles[(*it)]->GetSeries((*it));
393
if (pPanel != NULL) {
394
pPanel->RefrescarNumeroSlices();
400
m_pResultTitle->SetTitle(_("Results") + wxString::Format(_(" (%d series)"), m_mapaUIDsAbribles.size()));
401
GNC::GCS::ControladorEventos::Instance()->ProcesarEvento(new GNC::GUI::Eventos::EventoLayoutHistorial());
404
if(uidScroll != "") {
405
PanelSerie* pPanel = m_mapaUIDsAbribles[uidScroll]->GetSeries(uidScroll, true);
406
wxWindow* pWin = dynamic_cast<wxWindow*>(pPanel);
409
m_pPanelHistorial->GetScrollPixelsPerUnit(&pixelsx,&pixelsy);
411
wxWindow* pParent = pWin;
413
punto.y += pParent->GetPosition().y;
414
pParent = pParent->GetParent();
415
}while (pParent != this);
417
m_pPanelHistorial->CalcUnscrolledPosition(punto.x,punto.y,&x,&y);
418
m_pPanelHistorial->Scroll(0,y/pixelsy);
420
m_pPanelHistorial->Scroll(0,0);
423
m_pPanelHistorial->Scroll(0,0);
426
GNC::Entorno::Instance()->GetVentanaPrincipal()->SuperThaw();
428
m_pPanelHistorial->Thaw();
431
//cargo pasando el path si es directorio cargo uno a uno... eso creo q no es asi xo bueno...
432
/* void PanelHistorial2::CargarDICOM( const std::vector<std::string>& paths, bool abrirDespuesDeCargar,GnkPtr<GIL::IModeloIntegracion> pModeloIntegracion)
434
//controlador historial....
435
GNC::GCS::ControladorHistorial::ListaModelosDCM listaModelos;
436
GNC::GCS::ControladorHistorial::ListaModelosDCM listaModelosSR;
437
GNC::GCS::ControladorHistorial::ListaPaths rutasAdd;
438
GNC::GCS::ControladorHistorial::ListaPaths rutasModificar;
439
for(std::vector<std::string>::const_iterator it = paths.begin(); it != paths.end(); ++it){
440
wxString wxPath = FROMPATH((*it));
441
if(wxFileExists(wxPath)){
442
std::string pathRelativo = GNC::Entorno::Instance()->GetPathRelativoFichero((*it));
443
if(!GNC::GCS::ControladorHistorial::Instance()->ExisteFichero(pathRelativo)) {
444
rutasAdd.push_back((*it));
446
if(m_mapaPathsAbribles.find((*it)) != m_mapaPathsAbribles.end()){
447
GNC::GCS::ControladorHistorial::ModeloDCM modelo;
448
modelo.m_pathRelativo = pathRelativo;
449
listaModelos.push_back(modelo);
451
//es un "SR" que posiblemente se ha modificado, lo refrescamos
452
rutasModificar.push_back((*it));
455
} else if(wxDirExists(wxPath)) {
456
//se listan los dcms del directorio y se cargan
458
std::vector<std::string> dcmEnElDirectorio;
459
if (dir.Open(wxPath)) {
461
bool cont = dir.GetFirst(&dcmName,wxT("*.dcm"));
463
dcmName=dir.GetName()+ wxFileName::GetPathSeparator(wxPATH_NATIVE) +dcmName;
464
dcmEnElDirectorio.push_back(std::string(TOPATH(dcmName)));
465
cont = dir.GetNext(&dcmName);
468
for(std::vector<std::string>::iterator it2=dcmEnElDirectorio.begin();it2!=dcmEnElDirectorio.end();++it2){
469
std::string pathRelativo = GNC::Entorno::Instance()->GetPathRelativoFichero((*it2));
470
if(!GNC::GCS::ControladorHistorial::Instance()->ExisteFichero(pathRelativo)) {
471
rutasAdd.push_back((*it2));
473
if(m_mapaPathsAbribles.find((*it2)) != m_mapaPathsAbribles.end()){
474
GNC::GCS::ControladorHistorial::ModeloDCM modelo;
475
modelo.m_pathRelativo = pathRelativo;
476
listaModelos.push_back(modelo);
478
//es un "SR" que posiblemente se ha modificado, lo refrescamos
479
rutasModificar.push_back((*it2));
485
if(rutasAdd.size()>0 || rutasModificar.size() >0){
486
wxBusyInfo* info = new wxBusyInfo(_("Updating History..."),this);
487
GNC::Entorno::Instance()->YieldApp();
488
GNC::GCS::ControladorHistorial::ListaPaths fooLista;
489
if(GNC::GCS::ControladorHistorial::Instance()->AddFiles(rutasAdd, listaModelos, fooLista, true) && GNC::GCS::ControladorHistorial::Instance()->UpdateFiles(rutasModificar,listaModelosSR)){
491
CargarDICOM(listaModelos,abrirDespuesDeCargar,pModeloIntegracion);
496
CargarDICOM(listaModelos, abrirDespuesDeCargar, pModeloIntegracion);
501
//ya esta cargado... me avisan
502
void PanelHistorial2::DICOMActivado(GNC::GCS::IVista* pVista)
504
for(std::list<std::string>::const_iterator it = pVista->GetEstudio()->ListaUIDsSerie.begin(); it != pVista->GetEstudio()->ListaUIDsSerie.end(); ++it){
505
TMapaAbribles::iterator it2 = m_mapaUIDsAbribles.find( (*it) );
506
if(it2 != m_mapaUIDsAbribles.end()){
508
PanelSerie* pPanel = (*it2).second->GetSeries((*it), true);
509
if (pPanel != NULL) {
510
pPanel->AddVista(pVista);
514
std::cerr << _Std("error, have tried to select a file that is not added to history")<<std::endl;
520
void PanelHistorial2::DICOMDesactivado(GNC::GCS::IVista* pVista)
522
for(std::list<std::string>::const_iterator it = pVista->GetEstudio()->ListaUIDsSerie.begin(); it != pVista->GetEstudio()->ListaUIDsSerie.end(); ++it){
523
TMapaAbribles::iterator it2 = m_mapaUIDsAbribles.find( (*it) );
524
if(it2 != m_mapaUIDsAbribles.end()){
527
PanelSerie* pPanel = (*it2).second->GetSeries((*it), true);
528
if (pPanel != NULL) {
529
pPanel->RemoveVista(pVista);
533
std::cerr << _Std("error, have tried to select a file that is not added to history")<<std::endl;
537
PurgarHistorial(true);
538
GNC::GCS::ControladorEventos::Instance()->ProcesarEvento(new GNC::GUI::Eventos::EventoLayoutHistorial());
544
//interfaz modelo dicom
545
PanelPaciente* PanelHistorial2::GetPaciente(const GNC::GCS::ControladorHistorial::ModeloSerie& modeloSerie, bool desplegarNodo)
547
TMapaHijos::iterator it=m_mapaHijos.find(modeloSerie.m_idPaciente);
548
if(it!=m_mapaHijos.end()){
549
return (PanelPaciente*)(*it).second;
551
//si el virtual size pasa de 16 bits (32000 pasan cosas malas) hay que dejar un margen para desplegar
552
if (m_pPanelHistorial->GetVirtualSize().y < 30000) {
553
if(m_pPanelMensajeVacio->IsShown()) {
554
m_pPanelMensajeVacio->Hide();
557
//si el virtual size pasa de 16 bits (32000 pasan cosas malas)
558
desplegarNodo = m_pPanelHistorial->GetVirtualSize().y < 25000;
560
PanelPaciente* pPanelPaciente = new PanelPaciente(this,m_pPanelHistorial,modeloSerie, desplegarNodo);
561
m_pPanelHistorial->GetSizer()->Add(pPanelPaciente,0,wxBOTTOM|wxEXPAND,0);
562
m_pPanelHistorial->Layout();
563
m_mapaHijos[modeloSerie.m_idPaciente]=pPanelPaciente;
564
return pPanelPaciente;
566
//implica que no caben todos...
572
wxColour PanelHistorial2::GetColorPaciente(const std::string& idPaciente)
574
TMapaHijos::iterator it=m_mapaHijos.find(idPaciente);
575
if(it!=m_mapaHijos.end()){
576
return ((PanelPaciente*)(*it).second)->GetBackgroundColour();
578
return wxColour(49,106,197);
582
void PanelHistorial2::ForzarCargarTodos()
584
m_pComboBoxPaciente->SetSelection(m_pComboBoxPaciente->FindString(_("All")) );
585
m_pacienteActual = _Std("All");
586
//se eliminan todos los estudios que no están abiertos
588
//se eliminan los nodos que ya no van a valer
589
PurgarHistorial(false);
591
//pillamos los estudios del paciente seleccionado
592
GNC::GCS::ControladorHistorial::ListaModelosSeries listaSeries;
593
GNC::GCS::ControladorHistorial::Instance()->GetAllModelosSerie(listaSeries);
594
CargarSeries(listaSeries, NULL);
595
GNC::GCS::ControladorEventos::Instance()->ProcesarEvento(new GNC::GUI::Eventos::EventoLayoutHistorial());
599
std::list<std::string> PanelHistorial2::GetOpenedSeriesUIDs()
601
std::list<std::string> result;
602
for (TMapaAbribles::iterator it = m_mapaUIDsAbribles.begin(); it != m_mapaUIDsAbribles.end(); ++it)
604
GNC::GUI::PanelSerie* pPanel = (*it).second->GetSeries((*it).first);
605
if (pPanel != NULL && pPanel->EstaAbierto()) {
606
result.push_back((*it).first);
612
std::list<std::string> PanelHistorial2::GetOpenedStudiesUIDs()
614
std::set<std::string> studies;
615
for (TMapaAbribles::iterator it = m_mapaUIDsAbribles.begin(); it != m_mapaUIDsAbribles.end(); ++it)
617
GNC::GUI::PanelSerie* pPanel = (*it).second->GetSeries((*it).first);
618
if (pPanel != NULL && pPanel->EstaAbierto()) {
619
studies.insert(pPanel->GetParentNode()->GetClave());
622
std::list<std::string> result;
623
for(std::set<std::string>::iterator it = studies.begin(); it != studies.end(); ++it)
625
result.push_back((*it));
630
GNC::GCS::IVista* PanelHistorial2::GetVistaFromSeriesUID(const std::string& uid)
632
TMapaAbribles::iterator it = m_mapaUIDsAbribles.find(uid);
633
if (it != m_mapaUIDsAbribles.end()) {
634
GNC::GUI::PanelSerie* pPanel = (*it).second->GetSeries((*it).first);
635
if (pPanel != NULL && pPanel->EstaAbierto()) {
636
return pPanel->m_pVistas.front();
642
GNC::GCS::IVista* PanelHistorial2::GetVistaFromStudyUID(const std::string& uid)
644
for (TMapaAbribles::iterator it = m_mapaUIDsAbribles.begin(); it != m_mapaUIDsAbribles.end(); ++it)
646
GNC::GUI::PanelSerie* pPanel = (*it).second->GetSeries((*it).first);
647
if (pPanel != NULL && pPanel->EstaAbierto()) {
648
if (pPanel->GetParentNode()->GetClave() == uid)
650
return pPanel->m_pVistas.front();
658
void PanelHistorial2::OnCheckFromClick(wxCommandEvent &)
660
m_pTimerRecargar->Stop();
661
m_pTimerRecargar->Start(500,true);
664
void PanelHistorial2::OnCheckToClick(wxCommandEvent &)
666
m_pTimerRecargar->Stop();
667
m_pTimerRecargar->Start(500,true);
670
void PanelHistorial2::OnPlegarFilters(wxCommandEvent&)
672
GNC::Entorno::Instance()->GetVentanaPrincipal()->SuperFreeze();
673
m_pFiltersPanel->Show(!m_pFiltersPanel->IsShown());
674
if (m_pFiltersPanel->IsShown()) {
675
m_pFiltersTitle->GetButtonBar()->SetToolBitmap(ID_EJECUTAR, GinkgoResourcesManager::PanelHistorial::GetIcoPlegar());
677
m_pFiltersTitle->GetButtonBar()->SetToolBitmap(ID_EJECUTAR, GinkgoResourcesManager::PanelHistorial::GetIcoDesplegar());
681
GNC::Entorno::Instance()->GetVentanaPrincipal()->SuperThaw();
684
void PanelHistorial2::OnPlegarClick(wxCommandEvent& )
689
void PanelHistorial2::OnDesplegar(wxMouseEvent& )
694
void PanelHistorial2::Plegar(bool plegar)
696
GNC::Entorno::Instance()->GetVentanaPrincipal()->SuperFreeze();
699
SetMinSize(wxSize(230, -1));
700
SetMaxSize(wxSize(300, -1));
703
SetMinSize(wxSize(26, -1));
705
GetParent()->Layout();
706
m_pPanelHistorial->Show(!plegar);
707
m_pFiltersPanel->Show(!plegar);
708
m_pFiltersTitle->Show(!plegar);
709
m_pResultTitle->Show(!plegar);
710
m_pHistoryTitle->Show(!plegar);
711
m_pPanelVertical->Show(plegar);
712
if (m_pFiltersPanel->IsShown()) {
713
m_pFiltersTitle->GetButtonBar()->SetToolBitmap(ID_EJECUTAR, GinkgoResourcesManager::PanelHistorial::GetIcoPlegar());
715
m_pFiltersTitle->GetButtonBar()->SetToolBitmap(ID_EJECUTAR, GinkgoResourcesManager::PanelHistorial::GetIcoDesplegar());
718
GNC::Entorno::Instance()->GetVentanaPrincipal()->SuperThaw();
721
void PanelHistorial2::OnDateFromChanged( wxDateEvent& )
723
m_pComboDate->Select(m_pComboDate->FindString(_("Between:")));
724
m_pTimerRecargar->Stop();
725
m_pTimerRecargar->Start(500,true);
728
void PanelHistorial2::OnDateToChanged( wxDateEvent& )
730
m_pComboDate->Select(m_pComboDate->FindString(_("Between:")));
731
m_pTimerRecargar->Stop();
732
m_pTimerRecargar->Start(500,true);
735
void PanelHistorial2::OnComboBox( wxCommandEvent& )
737
m_pTimerRecargar->Stop();
738
m_pTimerRecargar->Start(500,true);
741
void PanelHistorial2::RecargarBusqueda(bool force)
744
if (m_pComboBoxPaciente->GetSelection() >= 0) {
745
if (m_pComboBoxPaciente->GetSelection() > 1) {
746
wxDataPaciente* pPaciente = (wxDataPaciente*)(m_pComboBoxPaciente->GetClientObject(m_pComboBoxPaciente->GetSelection()));
747
std::string idPacienteSeleccionado = pPaciente->m_modeloPaciente.m_idPaciente;
748
if (idPacienteSeleccionado != m_pacienteActual) {
749
m_pacienteActual = idPacienteSeleccionado;
752
} else if (m_pComboBoxPaciente->GetSelection() == 0) {
753
wxString stringSeleccionado = m_pComboBoxPaciente->GetString(m_pComboBoxPaciente->GetSelection());
754
if (stringSeleccionado == _("All") && m_pacienteActual != _Std("All")) {
755
m_pacienteActual = std::string(stringSeleccionado.ToUTF8());
761
//distinto del separador
762
if (m_pComboModalidad->GetSelection() >= 0) {
763
if (m_pComboModalidad->GetSelection() != 1) {
764
std::string modalidadSeleccionada (m_pComboModalidad->GetString(m_pComboModalidad->GetSelection()).ToUTF8());
765
if (modalidadSeleccionada != m_modalidadActual) {
766
m_modalidadActual = modalidadSeleccionada;
771
/*if (!m_fromActual.IsValid() || m_fromActual != m_pDatePickerFrom->GetValue()) {
772
m_fromActual = m_pDatePickerFrom->GetValue();
775
if (m_fromActual.IsValid()) {
776
m_fromActual = wxInvalidDateTime;
782
wxDateTime newFechaDesde = wxInvalidDateTime, newFechaHasta = wxInvalidDateTime;
783
std::string timeFrom(""), timeTo("");
784
if (m_pComboDate->GetValue() == _("Between:")) {
785
newFechaDesde = m_pDatePickerFrom->GetValue();
786
newFechaHasta = m_pDatePickerTo->GetValue();
787
} else if (m_pComboDate->GetValue() == _("Today") || m_pComboDate->GetValue() == _("Today AM") || m_pComboDate->GetValue() == _("Today PM")) {
788
newFechaDesde = newFechaHasta = wxDateTime::Now();
789
if (m_pComboDate->GetValue() == _("Today AM")) {
790
timeFrom = "00:00:00";
792
} else if (m_pComboDate->GetValue() == _("Today PM")) {
793
timeFrom = "12:00:00";
796
} else if (m_pComboDate->GetValue() == _("Yesterday")) {
797
newFechaDesde = newFechaHasta = wxDateTime::Now().Add(wxDateSpan(0,0,0,-1));
798
m_pDatePickerTo->SetValue(wxDateTime::Now());
799
} else if (m_pComboDate->GetValue() == _("Last week")) {
800
newFechaDesde = wxDateTime::Now().Add(wxDateSpan(0,0,-1,0));
801
m_pDatePickerTo->SetValue(wxDateTime::Now());
802
} else if (m_pComboDate->GetValue() == _("Last month")) {
803
newFechaDesde = wxDateTime::Now().Add(wxDateSpan(0,-1,0,0));
804
m_pDatePickerTo->SetValue(wxDateTime::Now());
805
} else if (m_pComboDate->GetValue() == _("Last 3 months")) {
806
newFechaDesde = wxDateTime::Now().Add(wxDateSpan(0,-3,0,0));
807
m_pDatePickerTo->SetValue(wxDateTime::Now());
808
} //else any date (invalid datetimes)
810
if ((newFechaDesde.IsValid() && !m_fromActual.IsValid()) || (!newFechaDesde.IsValid() && m_fromActual.IsValid()) ||
811
(newFechaDesde.IsValid() && m_fromActual.IsValid() && newFechaDesde != m_fromActual))
814
m_fromActual = newFechaDesde;
816
if ((newFechaHasta.IsValid() && !m_toActual.IsValid()) || (!newFechaHasta.IsValid() && m_toActual.IsValid()) ||
817
(newFechaHasta.IsValid() && m_toActual.IsValid() && newFechaHasta != m_toActual))
820
m_toActual = newFechaHasta;
822
if (m_fromActual.IsValid()) {
823
m_pDatePickerFrom->SetValue(m_fromActual);
825
if (m_toActual.IsValid()) {
826
m_pDatePickerTo->SetValue(m_toActual);
829
if (cambio || force) {
830
//se eliminan todos los estudios que no están abiertos
832
//se eliminan los nodos que ya no van a valer
833
PurgarHistorial(false);
835
//pillamos los estudios del paciente seleccionado
836
GNC::GCS::ControladorHistorial::ListaModelosSeries listaSeries;
837
GNC::GCS::ControladorHistorial::Instance()->GetModelosSeriePacienteModalidad(m_pacienteActual, m_modalidadActual, m_fromActual, m_toActual, timeFrom, timeTo, listaSeries);
838
CargarSeries(listaSeries, NULL);
839
GNC::GCS::ControladorEventos::Instance()->ProcesarEvento(new GNC::GUI::Eventos::EventoLayoutHistorial());
840
m_pResultTitle->SetTitle(_("Results") + wxString::Format(_(" (%d series)"), m_mapaUIDsAbribles.size()));
845
void PanelHistorial2::PurgarHistorial(bool ignoreActual)
851
//#1 eliminamos los estudios de pacientes que sobran
853
std::list<GNC::GUI::INodoHistorial*> listaEliminar;
854
bool todosLosPacientes = m_pacienteActual == _Std("All");
855
if (!todosLosPacientes) {
856
for(TMapaHijos::iterator it=m_mapaHijos.begin(); it!= m_mapaHijos.end(); it++) {
858
if (((PanelPaciente*)(*it).second)->GetIdPaciente() == m_pacienteActual )
861
if ((*it).second->HayNodosAbiertos()) {
862
(*it).second->EliminarNodosNoAbiertos();
864
listaEliminar.push_back((*it).second);
868
for (std::list<GNC::GUI::INodoHistorial*>::iterator it = listaEliminar.begin(); it != listaEliminar.end(); ++it) {
872
//#2 eliminamos las series que sobran por modalidad
874
std::list<GNC::GUI::INodoHistorial*> listaEliminar;
875
bool todosLasModalidades = m_modalidadActual == _Std("All");
876
if (!todosLasModalidades) {
877
for (TMapaAbribles::iterator it = m_mapaUIDsAbribles.begin(); it != m_mapaUIDsAbribles.end(); ++it) {
878
PanelSerie* pPanel = (*it).second->GetSeries((*it).first);
879
if (pPanel != NULL) {
880
if (!pPanel->EstaAbierto() && pPanel->GetModalidad() != m_modalidadActual) {
881
listaEliminar.push_back( pPanel);
886
for (std::list<GNC::GUI::INodoHistorial*>::iterator it = listaEliminar.begin(); it != listaEliminar.end(); ++it) {
891
std::list<GNC::GUI::INodoHistorial*> listaEliminar;
892
for(TMapaHijos::iterator it=m_mapaHijos.begin(); it!= m_mapaHijos.end(); it++) {
893
if ((*it).second->HayNodosAbiertos()) {
894
(*it).second->EliminarNodosNoAbiertos();
896
listaEliminar.push_back((*it).second);
899
for (std::list<GNC::GUI::INodoHistorial*>::iterator it = listaEliminar.begin(); it != listaEliminar.end(); ++it) {
904
m_pResultTitle->SetTitle(_("Results") + wxString::Format(_(" (%d series)"), m_mapaUIDsAbribles.size()));
909
void PanelHistorial2::OnSize(wxSizeEvent &event)
911
m_pCabeceraVacio->SetLabel(_("\nThere aren't any stored study that matches with the search filter.\n"));
912
m_pCabeceraVacio->Wrap(event.GetSize().x-20);
914
m_pMensajeVacio->SetLabel(_("\nTo begin working must change filter criteria, acquire an existing study or Import DICOM images to DICOM format.\n"));
915
m_pMensajeVacio->Wrap(event.GetSize().x-20);
917
m_pCabeceraNoCabeMas->SetLabel(_("\nThere is no size in the medical history to show every patients\n"));
918
m_pCabeceraNoCabeMas->Wrap(event.GetSize().x-40);
920
m_pMensajeNoCabeMas->SetLabel(_("\nTry using filters or collapsing nodes and refresh search\n"));
921
m_pMensajeNoCabeMas->Wrap(event.GetSize().x-40);
923
m_pPanelHistorial->Layout();
925
this->GetParent()->Layout();
929
void PanelHistorial2::OnMenuMouse(wxMouseEvent &event)
931
wxMenu menu(wxEmptyString);
932
wxMenuItem* pMenuEliminar = new wxMenuItem(&menu, 1, wxString( _("&Clear History") ), _("Delete"), wxITEM_NORMAL );
933
menu.Connect(1,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler( PanelHistorial2::OnLimpiarHistorial),NULL,this);
935
pMenuEliminar->SetBitmaps(GinkgoResourcesManager::IconosMenus::GetIcoEliminar());
937
pMenuEliminar->SetBitmap(GinkgoResourcesManager::IconosMenus::GetIcoEliminar());
939
menu.Append(pMenuEliminar);
940
if(m_mapaHijos.size() == 0) {
941
pMenuEliminar->Enable(false);
943
menu.AppendSeparator();
945
wxMenuItem* pMenuAdquirir = new wxMenuItem(&menu, 3, wxString( _("&DICOM &Acquisition") ), _("Acquiring a new DICOM study"), wxITEM_NORMAL );
946
menu.Connect(3,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler( PanelPaciente::OnAdquirir),NULL,this);
948
wxMenuItem* pMenuOpenFile = new wxMenuItem(&menu, 4, wxString( _("&Open File") ), _("Open a DICOM file"), wxITEM_NORMAL );
949
menu.Connect(4,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler( PanelPaciente::OnOpenFile),NULL,this);
951
wxMenuItem* pMenuOpenFolder = new wxMenuItem(&menu, 5, wxString( _("&Open Folder") ), _("Acquire from a local folder"), wxITEM_NORMAL );
952
menu.Connect(5,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler( PanelPaciente::OnOpenFolder),NULL,this);
954
wxMenuItem* pMenuImportar = new wxMenuItem( &menu, 6, wxString( _("&Import ...") ), _("Import images"), wxITEM_NORMAL );
955
menu.Connect(6,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler( PanelPaciente::OnImportar),NULL,this);
957
wxMenuItem* pMenuSend = new wxMenuItem(&menu, 7, wxString( _("Send to PACS server") ), _("Send to PACS server"), wxITEM_NORMAL );
958
menu.Connect(7,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler( PanelPaciente::OnUploadPACS),NULL,this);
962
pMenuAdquirir->SetBitmaps(GinkgoResourcesManager::IconosMenus::GetIcoAbrir());
963
pMenuImportar->SetBitmaps(GinkgoResourcesManager::IconosMenus::GetIcoImportar());
964
pMenuOpenFile->SetBitmaps(GinkgoResourcesManager::IconosMenus::GetIcoOpenFile());
965
pMenuOpenFolder->SetBitmaps(GinkgoResourcesManager::IconosMenus::GetIcoOpenDir());
966
pMenuSend->SetBitmaps(GinkgoResourcesManager::IconosMenus::GetIcoSendToPACS());
968
pMenuAdquirir->SetBitmap(GinkgoResourcesManager::IconosMenus::GetIcoAbrir());
969
pMenuImportar->SetBitmap(GinkgoResourcesManager::IconosMenus::GetIcoImportar());
970
pMenuOpenFile->SetBitmap(GinkgoResourcesManager::IconosMenus::GetIcoOpenFile());
971
pMenuOpenFolder->SetBitmap(GinkgoResourcesManager::IconosMenus::GetIcoOpenDir());
972
pMenuSend->SetBitmap(GinkgoResourcesManager::IconosMenus::GetIcoSendToPACS());
975
menu.Append(pMenuOpenFile);
976
menu.Append(pMenuOpenFolder);
977
if(GNC::GCS::ControladorPermisos::Instance()->Get("core.adquisicion","pacs")) {
978
menu.AppendSeparator();
979
menu.Append( pMenuAdquirir );
981
delete pMenuAdquirir;
983
menu.AppendSeparator();
984
menu.Append(pMenuSend);
985
menu.AppendSeparator();
986
menu.Append(pMenuImportar);
991
void PanelHistorial2::OnMouseWheel(wxMouseEvent &event)
993
if(event.GetWheelRotation() > 0)
995
m_pPanelHistorial->ScrollLines(-1);
997
else if(event.GetWheelRotation() < 0)
999
m_pPanelHistorial->ScrollLines(1);
1003
void PanelHistorial2::OnMedicalHistoryClick(wxMouseEvent &)
1005
m_pPanelHistorial->SetFocus();
1008
void PanelHistorial2::OnLimpiarHistorial(wxCommandEvent& event)
1014
void PanelHistorial2::LimpiarHistorial()
1016
for(TMapaHijos::iterator it=m_mapaHijos.begin(); it!= m_mapaHijos.end(); it++) {
1017
if ((*it).second->HayNodosAbiertos())
1019
wxMessageBox(_("Failed to empty the history, you have to close opened studies"), _("Info"),
1020
wxOK | wxICON_WARNING);
1025
bool eliminar = false;
1027
DialogoConfirmacionEliminar dlg(GNC::Entorno::Instance()->GetVentanaRaiz(), _("all files"));
1029
switch (dlg.GetResultado()) {
1030
case DialogoConfirmacionEliminar::TR_Eliminar :
1031
eliminar = GNC::GCS::ControladorHistorial::Instance()->VaciarHistorial(true);
1033
case DialogoConfirmacionEliminar::TR_Cancelar :
1038
for(TMapaHijos::iterator it=m_mapaHijos.begin(); it!= m_mapaHijos.end(); it++) {
1039
wxWindow* pWin = dynamic_cast<wxWindow*> ((*it).second);
1041
GetSizer()->Detach(pWin);
1045
m_mapaHijos.clear();
1046
m_mapaUIDsAbribles.clear();
1047
if(!m_pPanelMensajeVacio->IsShown()) {
1048
m_pPanelMensajeVacio->Show();
1050
m_pResultTitle->SetTitle(_("Results") + wxString::Format(_(" (%d series)"), 0));
1051
RecargarCombos(false);
1052
GNC::GCS::ControladorEventos::Instance()->ProcesarEvento(new GNC::GUI::Eventos::EventoLayoutHistorial());
1057
void PanelHistorial2::OnImportar(wxCommandEvent& )
1060
GNC::GUI::wxWizardImportacionGinkgo ib(this,NULL);
1063
catch(GIL::DICOM::I2DException i){
1067
void PanelHistorial2::OnAdquirir(wxCommandEvent& )
1069
GNC::GUI::DialogoAdquisicion::Instance()->Show();
1072
void PanelHistorial2::Eliminar()
1074
if(!m_pPanelMensajeVacio->IsShown()) {
1075
m_pPanelMensajeVacio->Show();
1078
m_mapaHijos.clear();
1079
m_mapaUIDsAbribles.clear();
1082
void PanelHistorial2::Detach(wxWindow* pHijo)
1084
m_pPanelHistorial->GetSizer()->Detach(pHijo);
1088
void PanelHistorial2::PreProcesarEvento(GNC::GCS::Eventos::IEvento * evt, GNC::GCS::IControladorEventos::TipoListaPunterosEventos& lista)
1091
std::cerr << "Error: Evento nulo" << std::endl;
1094
switch (evt->GetCodigoEvento()) {
1095
case ginkgoEVT_Core_HistorialSeleccionar:
1096
case ginkgoEVT_Core_HistorialLayout:
1098
lista.push_back(new GNC::GUI::Eventos::EventoSetFocusHistorial());
1107
void PanelHistorial2::ProcesarEvento(GNC::GCS::Eventos::IEvento *evt)
1109
switch(evt->GetCodigoEvento()) {
1110
case ginkgoEVT_Core_ModificacionFichero:
1112
GNC::GCS::Eventos::EventoModificacionFichero* pEvt = dynamic_cast<GNC::GCS::Eventos::EventoModificacionFichero*>(evt);
1113
if(pEvt != NULL && pEvt->GetVistaModificada()!=NULL){
1114
std::list<std::string> listaUIDsSerie = pEvt->GetContextoEstudio()->ListaUIDsSerie;
1115
for(std::list<std::string>::const_iterator it = listaUIDsSerie.begin(); it != listaUIDsSerie.end(); ++it){
1116
TMapaAbribles::iterator it2 = m_mapaUIDsAbribles.find( (*it) );
1117
if(it2 != m_mapaUIDsAbribles.end()){//si esta en el arbol
1118
if(pEvt->GetTipoEvento() == GNC::GCS::Eventos::EventoModificacionFichero::FicheroModificado){
1119
PanelSerie* pPanel = (*it2).second->GetSeries((*it), true);
1120
if (pPanel != NULL) {
1121
pPanel->VistaModificada(pEvt->GetVistaModificada());
1123
} else if(pEvt->GetTipoEvento() == GNC::GCS::Eventos::EventoModificacionFichero::FicheroGuardado){
1124
PanelSerie* pPanel = (*it2).second->GetSeries((*it), true);
1125
if (pPanel != NULL) {
1126
pPanel->VistaGuardada(pEvt->GetVistaModificada());
1132
if(pEvt->GetTipoEvento() == GNC::GCS::Eventos::EventoModificacionFichero::FicheroGuardado){
1133
//se lanza el comando de incluir en el historial con los diagnosticos
1134
std::list<std::string> nuevasRutas;
1135
std::vector<std::string> listaPaths = pEvt->GetContextoEstudio()->GetRutasDiagnosticos();
1136
for (std::vector<std::string>::const_iterator it = listaPaths.begin(); it != listaPaths.end(); ++it) {
1137
nuevasRutas.push_back((*it));
1139
GADAPI::ComandoIncluirHistorial::ComandoIncluirHistorialParams* pParams = new GADAPI::ComandoIncluirHistorial::ComandoIncluirHistorialParams(nuevasRutas,false,true);
1140
pParams->m_informar = false;
1141
GADAPI::ComandoIncluirHistorial::ComandoIncluirHistorial* pCmd = new GADAPI::ComandoIncluirHistorial::ComandoIncluirHistorial(pParams);
1142
GNC::Entorno::Instance()->GetControladorComandos()->ProcessAsync(_Std("Storing in the history..."),pCmd, NULL);
1147
case ginkgoEVT_Core_AddFicheroHistorial:
1149
GNC::GCS::Eventos::EventoAddFicheroHistorial* pEvtMod = dynamic_cast<GNC::GCS::Eventos::EventoAddFicheroHistorial*>(evt);
1150
if(pEvtMod != NULL){
1151
//se lanza el comando de incluir en el historial
1152
GADAPI::ComandoIncluirHistorial::ComandoIncluirHistorialParams* pParams = new GADAPI::ComandoIncluirHistorial::ComandoIncluirHistorialParams(pEvtMod->GetListaRutas(), false, true);
1153
pParams->m_informar = false;
1154
GADAPI::ComandoIncluirHistorial::ComandoIncluirHistorial* pCmd = new GADAPI::ComandoIncluirHistorial::ComandoIncluirHistorial(pParams);
1155
GNC::Entorno::Instance()->GetControladorComandos()->ProcessAsync(_Std("Storing in the history..."),pCmd, NULL);
1159
case ginkgoEVT_Core_HistorialSeleccionar:
1161
GNC::GUI::Eventos::EventoSeleccionarHistorial* pEvtSelecc = dynamic_cast<GNC::GUI::Eventos::EventoSeleccionarHistorial*>(evt);
1162
if(pEvtSelecc != NULL) {
1163
GNC::GUI::ISeleccionableHistorial* pSeleccionable = pEvtSelecc->GetSeleccionable();
1164
if(pSeleccionable != m_pSeleccionado){
1165
if(m_pSeleccionado!= NULL) {
1166
m_pSeleccionado->Seleccionar(false);
1168
if(pSeleccionable != NULL){
1169
pSeleccionable->Seleccionar(true);
1171
m_pSeleccionado = pSeleccionable;
1176
case ginkgoEVT_Core_SetFocus:
1178
#if defined(_WIN32) || defined(__WXOSX__)
1179
m_pPanelHistorial->SetFocus();
1183
case ginkgoEVT_Core_HistorialLayout:
1186
GNC::Entorno::Instance()->GetVentanaPrincipal()->SuperFreeze();
1188
m_pPanelHistorial->Freeze();
1189
#if defined(_WIN32) || defined(__WXOSX__)
1190
int yPos = m_pPanelHistorial->GetScrollPos(wxVERTICAL);
1191
m_pPanelHistorial->SetScrollbars(20, 20, 20, 30, 0, yPos, false);
1192
m_pPanelHistorial->AdjustScrollbars();
1195
m_pPanelHistorial->Layout();
1197
this->GetParent()->Layout();
1198
#if defined(_WIN32) || defined(__WXOSX__)
1199
m_pPanelHistorial->Scroll(0, yPos);
1202
m_pPanelHistorial->Thaw();
1204
GNC::Entorno::Instance()->GetVentanaPrincipal()->SuperThaw();
1207
case ginkgoEVT_Core_HistorialAbribleEliminado:
1210
GNC::GUI::Eventos::EventoAbribleEliminado* pEvtElim = dynamic_cast<GNC::GUI::Eventos::EventoAbribleEliminado*>(evt);
1211
if(pEvtElim != NULL) {
1212
for(std::list<std::string>::const_iterator itUIDs = pEvtElim->GetUIDs().begin(); itUIDs!= pEvtElim->GetUIDs().end(); itUIDs++){
1213
TMapaAbribles::iterator it = m_mapaUIDsAbribles.find((*itUIDs));
1214
if(it!= m_mapaUIDsAbribles.end()) {
1215
m_mapaUIDsAbribles.erase(it);
1222
case ginkgoEVT_Core_HistorialRecargarHistorial:
1225
GNC::GUI::Eventos::EventoRecargarHistorial* pEvtRecargar = dynamic_cast<GNC::GUI::Eventos::EventoRecargarHistorial*>(evt);
1226
if(pEvtRecargar != NULL) {
1227
for(TMapaHijos::iterator it=m_mapaHijos.begin(); it!= m_mapaHijos.end(); it++) {
1228
wxWindow* pWin = dynamic_cast<wxWindow*> ((*it).second);
1230
GetSizer()->Detach(pWin);
1234
m_mapaHijos.clear();
1235
m_mapaUIDsAbribles.clear();
1236
if(!m_pPanelMensajeVacio->IsShown()) {
1237
m_pPanelMensajeVacio->Show();
1241
//se vacia el historial
1242
GNC::GCS::ControladorHistorial::Instance()->RecargarHistorial();
1243
RecargarCombos(false);
1244
RecargarBusqueda(true);
1249
case ginkgoEVT_Core_AddModeloHistorial:
1251
//no freeze porque muestra diálogos
1252
GNC::GUI::Eventos::EventoAddModeloHistorial* pEvtAdd = dynamic_cast<GNC::GUI::Eventos::EventoAddModeloHistorial*>(evt);
1253
if(pEvtAdd != NULL) {
1255
bool todos = m_pacienteActual == _Std("All");
1256
GNC::GCS::ControladorHistorial::ListaModelosDCM listaPacienteActual;
1257
for(GNC::GCS::ControladorHistorial::ListaModelosDCM::iterator it = pEvtAdd->GetListaModelos()->begin(); it!= pEvtAdd->GetListaModelos()->end(); it++) {
1258
if (todos || (*it).m_idPaciente == m_pacienteActual || pEvtAdd->GetAbrirDespuesDeCargar()) {
1259
listaPacienteActual.push_back((*it));
1262
if (listaPacienteActual.size() > 0) {
1263
CargarDCMs( listaPacienteActual, pEvtAdd->GetModeloIntegracion(), true);
1264
if (pEvtAdd->GetAbrirDespuesDeCargar()) {
1265
//se pilla la primear serie y se abre
1266
const std::string& uidSerie =listaPacienteActual.front().m_uidSerie;
1267
if ( m_mapaUIDsAbribles.find(uidSerie) != m_mapaUIDsAbribles.end() ){
1268
PanelSerie* pPanel = m_mapaUIDsAbribles[uidSerie]->GetSeries(uidSerie, true);
1269
if (pPanel != NULL) {
1275
RecargarCombos(false);
1280
case ginkgoEVT_Core_Estilo:
1283
GNC::GCS::Eventos::EventoColorPaciente* pEvtColor = dynamic_cast<GNC::GCS::Eventos::EventoColorPaciente*>(evt);
1284
if(pEvtColor != NULL) {
1285
wxColour colorPaciente = GetColorPaciente(pEvtColor->GetIdPaciente());
1286
GNC::GCS::Eventos::EventoColorPaciente::TColor color;
1287
color.r = colorPaciente.Red();
1288
color.g = colorPaciente.Green();
1289
color.b = colorPaciente.Blue();
1290
pEvtColor->SetColorPaciente(color);
1295
case ginkgoEVT_Core_LimpiarHistorial:
1297
//no freeze porque muestra diálogos
1301
case ginkgoEVT_Core_HandleDICOM :
1303
GNC::GCS::Eventos::EvtHandleDicom* pEvt = dynamic_cast<GNC::GCS::Eventos::EvtHandleDicom*>(evt);
1304
if (pEvt->GetAction() == GNC::GCS::Eventos::EvtHandleDicom::OpenSeries) {
1305
const GNC::GCS::Eventos::EvtHandleDicom::ListaUIDs& listaUIDs = pEvt->GetListaUIDs();
1306
GNC::GCS::Eventos::EvtHandleDicom::ListaUIDs listaUIDsNoHistorial;
1307
for (GNC::GCS::Eventos::EvtHandleDicom::ListaUIDs::const_iterator it = listaUIDs.begin(); it != listaUIDs.end(); ++it)
1309
if (m_mapaUIDsAbribles.find((*it)) == m_mapaUIDsAbribles.end()) {
1310
listaUIDsNoHistorial.push_back((*it));
1312
PanelSerie* pPanel = m_mapaUIDsAbribles[(*it)]->GetSeries((*it), true);
1318
//se añaden al historial
1319
GNC::GCS::IControladorHistorial::ListaModelosSeries listaModelosSerie;
1320
GNC::GCS::ControladorHistorial::Instance()->GetAllModelosSerieSeries(listaUIDsNoHistorial, listaModelosSerie);
1321
CargarSeries(listaModelosSerie, NULL);
1323
for (GNC::GCS::IControladorHistorial::ListaModelosSeries::iterator it = listaModelosSerie.begin(); it != listaModelosSerie.end(); ++it) {
1324
//se pilla la serie y se abre
1325
const std::string& uidSerie =(*it).m_uidSerie;
1326
if ( m_mapaUIDsAbribles.find(uidSerie) != m_mapaUIDsAbribles.end() ){
1327
PanelSerie* pPanel = m_mapaUIDsAbribles[uidSerie]->GetSeries(uidSerie, true);
1328
if (pPanel != NULL) {
1335
const GNC::GCS::Eventos::EvtHandleDicom::ListaUIDs& listaUIDs = pEvt->GetListaUIDs();
1336
GNC::GCS::Eventos::EvtHandleDicom::ListaUIDs listaUIDsNoHistorial;
1337
for (GNC::GCS::Eventos::EvtHandleDicom::ListaUIDs::const_iterator it = listaUIDs.begin(); it != listaUIDs.end(); ++it)
1339
if (m_mapaUIDsAbribles.find((*it)) == m_mapaUIDsAbribles.end()) {
1340
listaUIDsNoHistorial.push_back((*it));
1342
PanelSerie* pPanel = m_mapaUIDsAbribles[(*it)]->GetSeries((*it), true);
1344
if (!pPanel->DoDelete(false)) {
1351
GNC::GCS::ControladorHistorial::Instance()->DeleteSeriesList(listaUIDsNoHistorial, true);
1352
RecargarCombos(false);
1357
case ginkgoEVT_Core_Views:
1359
GNC::GCS::Eventos::EventView* pEvt = dynamic_cast<GNC::GCS::Eventos::EventView*>(evt);
1362
if (pEvt->GetType() == GNC::GCS::Eventos::EventView::Creation) {
1363
DICOMActivado(pEvt->GetView());
1365
DICOMDesactivado(pEvt->GetView());
1370
case ginkgoEVT_Core_DeleteFile:
1372
GNC::GCS::Eventos::EventDeleteFileHistory* pEvt = dynamic_cast<GNC::GCS::Eventos::EventDeleteFileHistory*>(evt);
1375
//delete files from history
1376
if (GNC::GCS::ControladorHistorial::Instance()->DeleteFilesList(pEvt->GetPatientId(), pEvt->GetStudyId(), pEvt->GetSeriesId(), (GNC::GCS::IControladorHistorial::ListaStrings)pEvt->GetIdList()))
1378
if (m_mapaUIDsAbribles.find(pEvt->GetSeriesId()) != m_mapaUIDsAbribles.end()) {
1379
PanelSerie* pPanel = m_mapaUIDsAbribles[pEvt->GetSeriesId()]->GetSeries(pEvt->GetSeriesId(), true);
1381
if (pPanel->RefrescarNumeroSlices() == 0) {
1382
pPanel->DoDelete(false);