Add use scanner.

This commit is contained in:
sunwen
2024-04-01 16:02:40 +08:00
parent c2fbcf0c02
commit b27dc320f7
11 changed files with 214 additions and 12 deletions

View File

@@ -27,6 +27,8 @@
#include "network/GetIPDialog.h"
#include "network/GetRouteDialog.h"
#include "dicom/WorkListManager.h"
#include "windows/LoginDialog.h"
#include "screensaver/ScreenSaverWindow.h"
@@ -46,6 +48,7 @@ DialogManager::DialogManager()
, mOperationMessageDialog(nullptr)
, mSyncDialog(nullptr)
, mTopWidget(nullptr)
, mGetWorkListDialog(nullptr)
{
}
@@ -57,6 +60,7 @@ void DialogManager::init(QWidget* aParent) {
connect(EventCenter::Default(), &EventCenter::InvokeOperationProgress,this,&DialogManager::invokeOperationProgress);
connect(EventCenter::Default(), &EventCenter::InvokeOperationPending,this,&DialogManager::invokeOperationPending);
connect(EventCenter::Default(), &EventCenter::InvokeOperationEnd,this,&DialogManager::invokeOperationEnd);
connect(EventCenter::Default(), &EventCenter::InputWorkListSearchValue,this,&DialogManager::receiveWorkListInput);
MultyMessageDialogManager::getInstance()->setDialogParent(aParent);
mTopWidget = aParent;
mScreenSaverWindow = new ScreenSaverWindow();
@@ -342,16 +346,40 @@ int DialogManager::requestPatientConfirm(PatientInformation* patientInf, int typ
return ret;
}
int DialogManager::requestGetWorkList(QSqlTableModel* aModel, QTableView* aTableView)
int DialogManager::requestGetWorkList()
{
GetWorkListDialog dialog(aModel, aTableView, mTopWidget);
GetWorkListDialog dialog(WorkListManager::getInstance()->getTableModel(), WorkListManager::getInstance()->getTableView(), mTopWidget);
mGetWorkListDialog = &dialog;
setTopWidget(&dialog);
dialog.setWindowModality(Qt::WindowModal);
int ret = dialog.exec();
releaseTopWidget(&dialog);
mGetWorkListDialog = nullptr;
return ret;
}
int DialogManager::requestGetWorkList(const QString& aInputValue)
{
GetWorkListDialog dialog(WorkListManager::getInstance()->getTableModel(), WorkListManager::getInstance()->getTableView(), mTopWidget);
mGetWorkListDialog = &dialog;
setTopWidget(&dialog);
dialog.setWindowModality(Qt::WindowModal);
mGetWorkListDialog->search(aInputValue);
int ret = dialog.exec();
releaseTopWidget(&dialog);
mGetWorkListDialog = nullptr;
return ret;
}
void DialogManager::receiveWorkListInput(QObject *parent, QObject *msg)
{
QString inputValue = *(QString*)msg;
if(mGetWorkListDialog == nullptr)
{
requestGetWorkList(inputValue);
}
}
void DialogManager::raiseDeviceInfo(QObject* parent, QObject* aInfoData)
{
QPair<QString, unsigned int>* infoData = (QPair<QString, unsigned int>*)(aInfoData);

View File

@@ -18,6 +18,7 @@ class QTableView;
class PatientInformation;
class LoginDialog;
class ScreenSaverWindow;
class GetWorkListDialog;
enum MessageLevel:unsigned int;
@@ -44,8 +45,8 @@ public:
~DialogManager() override;
void init(QWidget* aParent);
void requestLogin(QWidget* aParent);
void init(QWidget* aParent);
void requestLogin(QWidget* aParent);
void requestScreenSaverPlay();
void requestScreenSaverStop(bool aIsStopLocker = false);
DialogResult requestResetAdminPwd();
@@ -62,7 +63,8 @@ public:
int requestEditDicomConfig();
DialogResult requestInputAdminPasswd();
int requestEditNetworkConfig();
int requestGetWorkList(QSqlTableModel* aModel, QTableView* aTableView);
int requestGetWorkList();
int requestGetWorkList(const QString& aInputValue);
int requestPatientConfirm(PatientInformation* patientInf, int type);
DialogResult requestEditIpAndNetMask();
DialogResult requestEditIpAndNetMask(const QStringList& aEditData);
@@ -84,6 +86,7 @@ private:
void clearMessageDialog();
void setTopWidget(QWidget* widget);
void releaseTopWidget(QWidget* expectedTopWidget);
void receiveWorkListInput(QObject *parent, QObject *msg);
signals:
void loginDialogShown();
@@ -95,6 +98,7 @@ private:
QPointer<GUIMessageDialog> mSyncDialog;
QWidget* mTopWidget;
std::mutex mMutex;
GetWorkListDialog* mGetWorkListDialog;
int mDialogCount = 0;
};

View File

@@ -11,6 +11,7 @@
#include <QSqlRecord>
#include <QRadioButton>
#include <QButtonGroup>
#include <QKeyEvent>
#include "components/ULineEdit.h"
#include "action/GetWorkListAction.h"
@@ -27,11 +28,13 @@ GetWorkListDialog::GetWorkListDialog(QSqlTableModel* aSqlModel, QTableView* aTa
, mEditEndLine(new QLabel(mContentWidget))
, mPatientSelectTable(new QTableView(mContentWidget))
, mMode(PatientSearchMode)
, mSearchMode(ByAccessionNumber)
, mPatientSelectModel(new QStandardItemModel(mContentWidget))
, mSqlModel(aSqlModel)
, mTableView(aTableView)
, mSearchedPatients()
, mRadioButtonArea(new QWidget(mContentWidget))
, mIsAutoSearch(false)
{
initializeContentWidgets();
GetWorkListAction* action = qobject_cast<GetWorkListAction*>(getAction());
@@ -70,6 +73,7 @@ void GetWorkListDialog::initializeContentWidgets()
mPatientId->setVisible(false);
mAccessionNumText->setVisible(true);
mAccessionNumber->setVisible(true);
mSearchMode = ByAccessionNumber;
}
else
{
@@ -77,6 +81,7 @@ void GetWorkListDialog::initializeContentWidgets()
mAccessionNumber->setVisible(false);
mPatientIDText->setVisible(true);
mPatientId->setVisible(true);
mSearchMode = ByPatientId;
}
});
//Accession Nummber
@@ -122,6 +127,20 @@ void GetWorkListDialog::initializeContentWidgets()
mErrorLabel->hide();
}
void GetWorkListDialog::search(const QString& aInput)
{
switch(mSearchMode)
{
case ByAccessionNumber:
mAccessionNumber->insert(aInput);
break;
case ByPatientId:
mPatientId->insert(aInput);
break;
}
mIsAutoSearch = true;
}
bool GetWorkListDialog::updateReferenceData()
{
if(mMode == PatientSelectMode)
@@ -257,3 +276,13 @@ void GetWorkListDialog::insertPatient(PatientInformationPointer aPatient)
mTableView->selectRow(0);
LOG_USER_OPERATION(QString("Add Patient, ID:%1").arg(aPatient->ID));
}
void GetWorkListDialog::showEvent(QShowEvent *aEvent)
{
if(mIsAutoSearch)
{
mBtnOk->click();
}
AsyncActionDialog::showEvent(aEvent);
}

View File

@@ -15,6 +15,11 @@ enum GetWorkListDialogMode
PatientSearchMode = 0, PatientSelectMode
};
enum WorkListSearchMode
{
ByAccessionNumber = 0, ByPatientId
};
class GetWorkListDialog : public AsyncActionDialog
{
Q_OBJECT
@@ -22,9 +27,11 @@ class GetWorkListDialog : public AsyncActionDialog
public:
explicit GetWorkListDialog(QSqlTableModel* aSqlModel, QTableView* aTableView, QWidget* aParent = nullptr, Qt::WindowFlags aFlags = Qt::WindowFlags());
~GetWorkListDialog() override;
void search(const QString& aInput);
protected:
bool updateReferenceData() override;
void showEvent(QShowEvent *aEvent) override;
private:
void initializeContentWidgets();
@@ -42,11 +49,13 @@ private:
QLabel* mEditEndLine;
QTableView* mPatientSelectTable;
GetWorkListDialogMode mMode;
WorkListSearchMode mSearchMode;
QStandardItemModel* mPatientSelectModel;
QSqlTableModel* mSqlModel;
QTableView* mTableView;
QList<PatientInformationPointer> mSearchedPatients;
QWidget* mRadioButtonArea;
bool mIsAutoSearch;
};