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 "PatientAddDateDelegate.h"
#include "dicom/WorkListManager.h"
#include "utilities/ScanProcessSequence.h"
SelectFormWidget::SelectFormWidget(QWidget* parent)
: TabFormWidget(parent)
@@ -84,6 +85,8 @@ SelectFormWidget::SelectFormWidget(QWidget* parent)
this->setSelectedPatient(patientInfo);
});
connect(ScanProcessSequence::getInstance(), &ScanProcessSequence::ScanProcessSequenceFinished, this, &SelectFormWidget::clearSelectedPatient);
//first prepare buttons!
prepareButtons(false);
@@ -154,7 +157,7 @@ void SelectFormWidget::delPatient() {
if (mPatTable->currentIndex().row() < 0) return;
QString pUid = mModel->index(mPatTable->currentIndex().row(), PatientUID).data().toString();
// 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"));
return;
}
@@ -187,7 +190,12 @@ void SelectFormWidget::selectPatient() {
void SelectFormWidget::setSelectedPatient(PatientInformation* aPatient)
{
selectedPatientUID = aPatient->PatientUID;
mSelectedPatientUID = aPatient->PatientUID;
}
void SelectFormWidget::clearSelectedPatient()
{
mSelectedPatientUID.clear();
}
void SelectFormWidget::initDetailPanel(QHBoxLayout *contentLayout) {// prepare edit panel

View File

@@ -21,10 +21,21 @@ public:
public slots:
void updateDataByAnonymousMode();
private:
QString selectedPatientUID;
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 *mBtnDelete;
QToolButton *mBtnAdd;
@@ -33,26 +44,6 @@ private:
QSqlTableModel *mModel;
PatientDetailForm *patientDetailForm;
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();
};