fix: Delete patient error while patient finish scan process.

This commit is contained in:
sunwen
2024-07-22 14:57:36 +08:00
parent 728228bf88
commit 40fc64b552
4 changed files with 30 additions and 25 deletions

View File

@@ -21,6 +21,7 @@
#include "components/VerticalTextToolButton.h" #include "components/VerticalTextToolButton.h"
#include "PatientAddDateDelegate.h" #include "PatientAddDateDelegate.h"
#include "dicom/WorkListManager.h" #include "dicom/WorkListManager.h"
#include "utilities/ScanProcessSequence.h"
SelectFormWidget::SelectFormWidget(QWidget* parent) SelectFormWidget::SelectFormWidget(QWidget* parent)
: TabFormWidget(parent) : TabFormWidget(parent)
@@ -84,6 +85,8 @@ SelectFormWidget::SelectFormWidget(QWidget* parent)
this->setSelectedPatient(patientInfo); this->setSelectedPatient(patientInfo);
}); });
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::ScanProcessSequenceFinished, this, &SelectFormWidget::clearSelectedPatient);
//first prepare buttons! //first prepare buttons!
prepareButtons(false); prepareButtons(false);
@@ -154,7 +157,7 @@ void SelectFormWidget::delPatient() {
if (mPatTable->currentIndex().row() < 0) return; if (mPatTable->currentIndex().row() < 0) return;
QString pUid = mModel->index(mPatTable->currentIndex().row(), PatientUID).data().toString(); QString pUid = mModel->index(mPatTable->currentIndex().row(), PatientUID).data().toString();
// patient has been selected as the scan patient! // patient has been selected as the scan patient!
if (selectedPatientUID == pUid){ if (mSelectedPatientUID == pUid){
DialogManager::Default()->requestAlertMessage(tr("Can't delete selected Patient !"),DialogButtonMode::OkOnly,tr("Alert")); DialogManager::Default()->requestAlertMessage(tr("Can't delete selected Patient !"),DialogButtonMode::OkOnly,tr("Alert"));
return; return;
} }
@@ -187,7 +190,12 @@ void SelectFormWidget::selectPatient() {
void SelectFormWidget::setSelectedPatient(PatientInformation* aPatient) void SelectFormWidget::setSelectedPatient(PatientInformation* aPatient)
{ {
selectedPatientUID = aPatient->PatientUID; mSelectedPatientUID = aPatient->PatientUID;
}
void SelectFormWidget::clearSelectedPatient()
{
mSelectedPatientUID.clear();
} }
void SelectFormWidget::initDetailPanel(QHBoxLayout *contentLayout) {// prepare edit panel void SelectFormWidget::initDetailPanel(QHBoxLayout *contentLayout) {// prepare edit panel

View File

@@ -21,10 +21,21 @@ public:
public slots: public slots:
void updateDataByAnonymousMode(); void updateDataByAnonymousMode();
private: private:
QString selectedPatientUID;
void setPatientDetail(const SlideTableView *table, const QSqlTableModel *model, PatientDetailForm *edit_patient) const; void setPatientDetail(const SlideTableView *table, const QSqlTableModel *model, PatientDetailForm *edit_patient) const;
void prepareButtons(bool disableALL);
void initPatEditButtons(QHBoxLayout *layout);
void editPatient();
void delPatient();
void selectPatient();
void setSelectedPatient(PatientInformation* aPatient);
void initDataModel();
void initDetailPanel(QHBoxLayout *contentLayout);
void initTableView(QLayout *contentLayout);
void reloadLanguage();
void clearSelectedPatient();
private:
QString mSelectedPatientUID;
QToolButton *mBtnEdit; QToolButton *mBtnEdit;
QToolButton *mBtnDelete; QToolButton *mBtnDelete;
QToolButton *mBtnAdd; QToolButton *mBtnAdd;
@@ -33,26 +44,6 @@ private:
QSqlTableModel *mModel; QSqlTableModel *mModel;
PatientDetailForm *patientDetailForm; PatientDetailForm *patientDetailForm;
QLabel* mSelectTabTitle; QLabel* mSelectTabTitle;
void prepareButtons(bool disableALL);
void initPatEditButtons(QHBoxLayout *layout);
void editPatient();
void delPatient();
void selectPatient();
void setSelectedPatient(PatientInformation* aPatient);
void initDataModel();
void initDetailPanel(QHBoxLayout *contentLayout);
void initTableView(QLayout *contentLayout);
void reloadLanguage();
}; };

View File

@@ -32,7 +32,12 @@ void ScanProcessSequence::pushPosition(ScanPosition aPostion)
ScanPosition ScanProcessSequence::popPosition() ScanPosition ScanProcessSequence::popPosition()
{ {
return mScanProtocol.pop(); ScanPosition result = mScanProtocol.pop();
if(mScanProtocol.size() == 0)
{
emit ScanProcessSequenceFinished();
}
return result;
} }
ScanPosition ScanProcessSequence::topPosition() ScanPosition ScanProcessSequence::topPosition()

View File

@@ -28,6 +28,7 @@ signals:
void fullScanDataExport(); void fullScanDataExport();
void autoLocateXYUpdated(int aX, int aY); void autoLocateXYUpdated(int aX, int aY);
void autoLocateZUpdated(int aZ); void autoLocateZUpdated(int aZ);
void ScanProcessSequenceFinished();
private slots: private slots:
void updateAutoLocatePosition(int aX, int aY, int aZ); void updateAutoLocatePosition(int aX, int aY, int aZ);