feat:Change scan confirm dialog from patient selection to button click.

This commit is contained in:
sunwen
2025-02-08 15:18:49 +08:00
parent b2158943ec
commit 80be60042a
5 changed files with 82 additions and 37 deletions

View File

@@ -15,18 +15,18 @@ PatientInformationForm::PatientInformationForm(QWidget* parent)
, mMPPSUID() , mMPPSUID()
, mDicomGender() , mDicomGender()
{ {
mUI->setupUi(this); mUI->setupUi(this);
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() { connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
mUI->retranslateUi(this); mUI->retranslateUi(this);
if(!mUI->mScanProtocol->text().isEmpty()) setExecuteProtocol(mIsExecuteProtocolLeft); if(!mUI->mScanProtocol->text().isEmpty()) setExecuteProtocol(mIsExecuteProtocolLeft);
mUI->mPatientGender->setText(GenderHelper::getStringfromDicomGender(mDicomGender)); mUI->mPatientGender->setText(GenderHelper::getStringfromDicomGender(mDicomGender));
}); });
} }
PatientInformationForm::~PatientInformationForm() PatientInformationForm::~PatientInformationForm()
{ {
delete mUI; delete mUI;
delete mJsonStr; delete mJsonStr;
} }
void PatientInformationForm::setPatientInformation(PatientInformation* information) { void PatientInformationForm::setPatientInformation(PatientInformation* information) {
@@ -37,6 +37,7 @@ void PatientInformationForm::setPatientInformation(PatientInformation* informati
mUI->mPatientName->setText(information->Name); mUI->mPatientName->setText(information->Name);
mDicomGender = information->Sex; mDicomGender = information->Sex;
mUI->mPatientGender->setText(GenderHelper::getStringfromDicomGender(mDicomGender)); mUI->mPatientGender->setText(GenderHelper::getStringfromDicomGender(mDicomGender));
mPatientInformation.reset(information->copy());
} }
else else
{ {
@@ -52,6 +53,11 @@ void PatientInformationForm::setPatientInformation(PatientInformation* informati
} }
} }
PatientInformation* PatientInformationForm::getPatientInformationPtr()
{
return mPatientInformation.get();
}
void PatientInformationForm::setAccessionNumber(AccessionInformation* aAccession) void PatientInformationForm::setAccessionNumber(AccessionInformation* aAccession)
{ {
if(aAccession == nullptr) if(aAccession == nullptr)
@@ -125,8 +131,8 @@ const char* PatientInformationForm::getCurrentPatientJsonString(bool empty)
cJSON_AddItemToObject(patientInfoObject, "MPPSUID", cJSON_CreateString(mMPPSUID.toStdString().data())); cJSON_AddItemToObject(patientInfoObject, "MPPSUID", cJSON_CreateString(mMPPSUID.toStdString().data()));
cJSON* rootObject = cJSON_CreateObject(); cJSON* rootObject = cJSON_CreateObject();
cJSON_AddItemToObject(rootObject, "Patient Info", patientInfoObject); cJSON_AddItemToObject(rootObject, "Patient Info", patientInfoObject);
delete mJsonStr; delete mJsonStr;
mJsonStr = cJSON_PrintUnformatted (rootObject); mJsonStr = cJSON_PrintUnformatted (rootObject);
ScanJson::Current()->store(rootObject); ScanJson::Current()->store(rootObject);
return mJsonStr; return mJsonStr;
} }

View File

@@ -26,7 +26,8 @@ public:
void clear(); void clear();
const char * getCurrentPatientJsonString(bool emptyScan); const char * getCurrentPatientJsonString(bool emptyScan);
QString getPatientID(); QString getPatientID();
PatientInformation* getPatientInformationPtr();
private: private:
Ui::PatientInformationForm *mUI; Ui::PatientInformationForm *mUI;
@@ -37,6 +38,7 @@ private:
QString mModality; QString mModality;
QString mMPPSUID; QString mMPPSUID;
QString mDicomGender; QString mDicomGender;
QScopedPointer<PatientInformation> mPatientInformation;
}; };
#endif // PATIENTINFORMATIONFORM_H #endif // PATIENTINFORMATIONFORM_H

View File

@@ -77,7 +77,6 @@ void ScanFormWidget::initCommandWidget(QHBoxLayout *layout)
mStartScanButton->setText(tr("Start Scan")); mStartScanButton->setText(tr("Start Scan"));
layout->addWidget(mStartScanButton); layout->addWidget(mStartScanButton);
mStartScanButton->setEnabled(false); mStartScanButton->setEnabled(false);
mStartScanButton->setCheckable(true);
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding)); layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
addVerticalLine(layout); addVerticalLine(layout);
@@ -146,17 +145,16 @@ void ScanFormWidget::initCommandWidget(QHBoxLayout *layout)
connect(mStartScanButton, &QToolButton::clicked, [this]() connect(mStartScanButton, &QToolButton::clicked, [this]()
{ {
if(mStartScanButton->isChecked()) PatientInformation* patientInfo = mPatInf->getPatientInformationPtr();
DialogResult result = DialogManager::Default()->reuqestConfirmStartScan(patientInfo);
if(result.ResultCode == QDialog::Accepted)
{ {
ScanProtocal protocal = static_cast<ScanProtocal>(result.ResultData.toInt());
setScanProtocal(patientInfo, protocal);
LOG_USER_OPERATION(QString("Start Scan Process, ID: %1").arg(mPatInf->getPatientID())); LOG_USER_OPERATION(QString("Start Scan Process, ID: %1").arg(mPatInf->getPatientID()));
mStartScanButton->setEnabled(false);
EventCenter::Default()->triggerEvent(GUIEvents::StartScanProcess, nullptr, nullptr); EventCenter::Default()->triggerEvent(GUIEvents::StartScanProcess, nullptr, nullptr);
} }
else
{
LOG_USER_OPERATION(QString("Stop Scan Process, ID: %1").arg(mPatInf->getPatientID()));
EventCenter::Default()->triggerEvent(GUIEvents::StopScanProcess, nullptr, nullptr);
}
}); });
connect(DeviceManager::Default(), &DeviceManager::startAutoLocateResult, [this](bool aResult) connect(DeviceManager::Default(), &DeviceManager::startAutoLocateResult, [this](bool aResult)
@@ -166,7 +164,6 @@ void ScanFormWidget::initCommandWidget(QHBoxLayout *layout)
mAccountButton->setEnabled(false); mAccountButton->setEnabled(false);
mDrainageButton->setEnabled(false); mDrainageButton->setEnabled(false);
mShutdownButton->setEnabled(false); mShutdownButton->setEnabled(false);
mStartScanButton->setText(tr("Stop Scan Process"));
mScanProcessLabel->setText(getAutoLocateMessage()); mScanProcessLabel->setText(getAutoLocateMessage());
} }
@@ -180,13 +177,14 @@ void ScanFormWidget::initCommandWidget(QHBoxLayout *layout)
mAccountButton->setEnabled(true); mAccountButton->setEnabled(true);
mDrainageButton->setEnabled(true); mDrainageButton->setEnabled(true);
mShutdownButton->setEnabled(true); mShutdownButton->setEnabled(true);
mStartScanButton->setChecked(false);
mStartScanButton->setText(tr("Start Scan"));
if(ScanProcessSequence::getInstance()->getScanPositionSize() == 0) if(ScanProcessSequence::getInstance()->getScanPositionSize() == 0)
{ {
mStartScanButton->setEnabled(false);
mPatInf->clear(); mPatInf->clear();
} }
else
{
mStartScanButton->setEnabled(true);
}
mScanProcessLabel->setText(tr("Please confirm checking patient information to start the process")); mScanProcessLabel->setText(tr("Please confirm checking patient information to start the process"));
}); });
@@ -330,19 +328,11 @@ void ScanFormWidget::initEvents()
connect(EventCenter::Default(), &EventCenter::PatientSelected, [=](QObject* sender, QObject* data) { connect(EventCenter::Default(), &EventCenter::PatientSelected, [=](QObject* sender, QObject* data) {
if (data) if (data)
{ {
PatientInformation* patientInfo = (PatientInformation*)data; PatientInformation* patientInfo = (PatientInformation*)data;
DialogResult result = DialogManager::Default()->reuqestConfirmStartScan(patientInfo); mPatInf->setPatientInformation(patientInfo);
if(result.ResultCode == QDialog::Accepted) LOG_USER_OPERATION(QString("Select Patient, ID: %1").arg(patientInfo->ID))
{ mStartScanButton->setEnabled(true);
ScanProtocal protocal = static_cast<ScanProtocal>(result.ResultData.toInt()); EventCenter::Default()->triggerEvent(SetSelectedPatient, nullptr, (QObject*)patientInfo);
mPatInf->setPatientInformation(patientInfo);
setScanProtocal(patientInfo, protocal);
LOG_USER_OPERATION(QString("Select Patient, ID: %1").arg(patientInfo->ID))
mStartScanButton->setEnabled(true);
EventCenter::Default()->triggerEvent(SetSelectedPatient, nullptr, (QObject*)patientInfo);
mStartScanButton->click();
}
} }
}); });
connect(EventCenter::Default(), &EventCenter::ResponseStopPreview, [=](QObject* sender, QObject* data) { connect(EventCenter::Default(), &EventCenter::ResponseStopPreview, [=](QObject* sender, QObject* data) {

View File

@@ -229,6 +229,55 @@ void PatientInformation::operator=(const PatientInformation& aOther)
this->mRecommendAccessions = aOther.mRecommendAccessions; this->mRecommendAccessions = aOther.mRecommendAccessions;
} }
PatientInformation* PatientInformation::copy()
{
PatientInformation* copyPatient = new PatientInformation(ID, Name, Sex, BirthDate, AddDate);
copyPatient->PatientUID = this->PatientUID;
copyPatient->Comment = this->Comment;
for(int i = 1; i < mAccessionList.size(); ++i)
{
AccessionInformation* original = mAccessionList[i];
AccessionInformation* copyAccession = new AccessionInformation(
original->mAccessionNumber,
original->mPosition,
original->mScheduledStartDate,
original->mStudyUID,
original->mRPID,
original->mSPSID,
original->mModality,
original->mMPPSUID,
copyPatient,
copyPatient
);
copyAccession->mScanCount = original->mScanCount;
copyPatient->mAccessionList.append(copyAccession);
}
copyPatient->mSelectedScanProtocol = this->mSelectedScanProtocol;
for(AccessionInformation* selectedAcc : mSelectedAccessions)
{
int index = mAccessionList.indexOf(selectedAcc);
if(index != -1)
{
copyPatient->mSelectedAccessions.append(copyPatient->mAccessionList[index]);
}
}
for(AccessionInformation* recommendedAcc : mRecommendAccessions)
{
int index = mAccessionList.indexOf(recommendedAcc);
if(index != -1)
{
copyPatient->mRecommendAccessions.append(copyPatient->mAccessionList[index]);
}
}
return copyPatient;
}
QList<AccessionInformation*> PatientInformation::getSelectedAccession() QList<AccessionInformation*> PatientInformation::getSelectedAccession()
{ {
return mSelectedAccessions; return mSelectedAccessions;

View File

@@ -55,7 +55,7 @@ public:
void reloadHeaderLanguage(); void reloadHeaderLanguage();
QList<AccessionInformation*> getSelectedAccession(); QList<AccessionInformation*> getSelectedAccession();
AccessionInformation* findSelectedAccession(ScanProtocol aProtocol, bool aIfEmptyGetTop); AccessionInformation* findSelectedAccession(ScanProtocol aProtocol, bool aIfEmptyGetTop);
PatientInformation* copy();
AccessionInformation* mHeader; AccessionInformation* mHeader;
QList<AccessionInformation*> mAccessionList; QList<AccessionInformation*> mAccessionList;
@@ -66,8 +66,6 @@ public:
#define ADD_PATIENT_PROPERTY(val) QString val; #define ADD_PATIENT_PROPERTY(val) QString val;
ADD_PATIENT() ADD_PATIENT()
#undef ADD_PATIENT_PROPERTY #undef ADD_PATIENT_PROPERTY
// QString ScheduledStartDate;
// QString AccessionNumber;
}; };
typedef QSharedPointer<PatientInformation> PatientInformationPointer; typedef QSharedPointer<PatientInformation> PatientInformationPointer;