Add WorkList Module.

This commit is contained in:
sunwen
2022-09-29 17:36:55 +08:00
parent 1fe306b532
commit 3a6a755ef1
22 changed files with 803 additions and 4 deletions

View File

@@ -0,0 +1,73 @@
#include "AsyncActionDialog.h"
#include <QVBoxLayout>
#include <QLabel>
#include "action/AsyncAction.h"
#include "components/LoadingWidget.h"
AsyncActionDialog::AsyncActionDialog(AsyncAction* aAsyncAction,const QString& aTitle, QWidget* aParent, Qt::WindowFlags aFlags)
: GUIFormBaseDialog(aParent,aFlags)
, mContentWidget(new QWidget(mFormWidget))
, mLoadingWidget(new QWidget(mFormWidget))
, mAction(aAsyncAction)
, mLayout(new QVBoxLayout(mFormWidget))
{
setFocusPolicy(Qt::ClickFocus);
mLoadingWidget->hide();
initializeTitle(aTitle);
initializeProgressBar();
connect(mAction,&AsyncAction::actionCompleted,this,&AsyncActionDialog::handleFinishedAction);
mLayout->setSpacing(10);
mLayout->addWidget(mContentWidget);
mLayout->addWidget(mLoadingWidget);
}
AsyncActionDialog::~AsyncActionDialog()
{
}
void AsyncActionDialog::initializeTitle(const QString& aTitle)
{
QLabel* title = new QLabel(this);
title->setAlignment(Qt::AlignCenter);
title->setText(tr(aTitle.toLatin1()));
title->setObjectName("title");
title->setFixedHeight(40);
mLayout->addWidget(title);
}
void AsyncActionDialog::initializeProgressBar()
{
QVBoxLayout* loadingLayout = new QVBoxLayout(mLoadingWidget);
LoadingWidget* loadingWidget = new LoadingWidget(mLoadingWidget);
loadingLayout->addWidget(loadingWidget);
}
AsyncAction* AsyncActionDialog::getAction()
{
return mAction;
}
bool AsyncActionDialog::updateReferenceData()
{
mAction->execute();
mContentWidget->hide();
mBtnWidget->hide();
mLoadingWidget->show();
return false;
}
void AsyncActionDialog::handleFinishedAction(const ActionResult& aResult)
{
mLoadingWidget->hide();
if (aResult.Code == Sucessed)
{
accept();
}
}

View File

@@ -0,0 +1,39 @@
#ifndef GUI_ASYNCACTIONDIALOG_H
#define GUI_ASYNCACTIONDIALOG_H
#include "GUIFormBaseDialog.h"
#include "action/AsyncAction.h"
class QVBoxLayout;
class AsyncActionDialog : public GUIFormBaseDialog
{
Q_OBJECT
public:
AsyncActionDialog(AsyncAction* aAsyncAction,const QString& aTitle, QWidget* aParent = nullptr, Qt::WindowFlags aFlags = Qt::WindowFlags());
~AsyncActionDialog() override;
protected:
AsyncAction* getAction();
bool updateReferenceData() override;
protected slots:
virtual void handleFinishedAction(const ActionResult& aResult);
private:
void initializeTitle(const QString& aTitle);
void initializeProgressBar();
protected:
QWidget* mContentWidget;
QWidget* mLoadingWidget;
private:
AsyncAction* mAction;
QVBoxLayout* mLayout;
};
#endif //GUI_ASYNCACTIONDIALOG_H

View File

@@ -16,6 +16,7 @@
#include "dialogs/AlertDialog.h"
#include "dialogs/DateSelectDialog.h"
#include "dialogs/SelectDialog.h"
#include "dialogs/GetWorkListDialog.h"
#include "network/DicomCfgDialog.h"
#include "network/GetAdminPsw.h"
@@ -295,6 +296,16 @@ DialogResult DialogManager::requestEditRouteInfo(const QStringList& aEditData)
return DialogResult(ret,dialog.getList());
}
int DialogManager::requestGetWorkList(QSqlTableModel* aModel)
{
GetWorkListDialog dialog(aModel,mTopWidget);
setTopWidget(&dialog);
dialog.setWindowModality(Qt::WindowModal);
int ret = dialog.exec();
releaseTopWidget(&dialog);
return ret;
}
void DialogManager::raiseDeviceInfo(QObject* parent, QObject* aInfoData)
{
QPair<QString, unsigned int>* infoData = (QPair<QString, unsigned int>*)(aInfoData);

View File

@@ -58,6 +58,7 @@ public:
int requestEditDicomConfig();
int requestInputAdminPasswd();
int requestEditNetworkConfig();
int requestGetWorkList(QSqlTableModel* aModel);
DialogResult requestEditIpAndNetMask();
DialogResult requestEditIpAndNetMask(const QStringList& aEditData);
DialogResult requestEditRouteInfo();

View File

@@ -0,0 +1,86 @@
#include "GetWorkListDialog.h"
#include <QVBoxLayout>
#include <QPushButton>
#include <QLabel>
#include "components/ULineEdit.h"
#include "action/GetWorkListAction.h"
#include "action/ActionCreator.h"
GetWorkListDialog::GetWorkListDialog(QSqlTableModel* aSqlModel, QWidget* aParent, Qt::WindowFlags aFlags)
: AsyncActionDialog(ActionCreator::getAsyncAction<GetWorkListAction>("GetWorkListAction"),"Work List", aParent, aFlags)
, mAccessionNumber(new ULineEdit(mContentWidget))
, mPatientId(new ULineEdit(mContentWidget))
, mErrorLabel(new QLabel(mContentWidget))
{
initializeContentWidgets();
GetWorkListAction* action = qobject_cast<GetWorkListAction*>(getAction());
if (action != nullptr)
{
action->setSqlModel(aSqlModel);
}
}
GetWorkListDialog::~GetWorkListDialog()
{
}
void GetWorkListDialog::initializeContentWidgets()
{
QVBoxLayout* contentLayout = new QVBoxLayout(mContentWidget);
//Accession Nummber
QLabel* accessionNumText = new QLabel(mContentWidget);
accessionNumText->setText(tr("Accession Nummber"));
contentLayout->addWidget(accessionNumText);
contentLayout->addWidget(mAccessionNumber);
QLabel* endLine1 = new QLabel(mContentWidget);
endLine1->setObjectName("endline");
contentLayout->addWidget(endLine1);
//PatientId
QLabel* patientIdText = new QLabel(mContentWidget);
patientIdText->setText(tr("Patient ID"));
contentLayout->addWidget(patientIdText);
contentLayout->addWidget(mPatientId);
QLabel* endLine2 = new QLabel(mContentWidget);
endLine2->setObjectName("endline");
contentLayout->addWidget(endLine2);
//ErrorLabel
contentLayout->addWidget(mErrorLabel);
mErrorLabel->setObjectName("warn");
mErrorLabel->hide();
}
bool GetWorkListDialog::updateReferenceData()
{
QString accessionNum = mAccessionNumber->text();
QString patientId = mPatientId->text();
if (accessionNum.isEmpty() && patientId.isEmpty())
{
mErrorLabel->setText(tr("Accession Number and Patient Id is Empty."));
mErrorLabel->show();
return false;
}
GetWorkListAction* action = qobject_cast<GetWorkListAction*>(getAction());
if (action == nullptr)
{
mErrorLabel->setText(tr("Unknow Error. code:001001001"));
return false;
}
action->setWorkListQueryData(WorkListQueryData(accessionNum, patientId));
return AsyncActionDialog::updateReferenceData();
}
void GetWorkListDialog::handleFinishedAction(const ActionResult& aResult)
{
if (aResult.Code == Failed)
{
mErrorLabel->setText(aResult.Message);
mContentWidget->show();
mBtnWidget->show();
mErrorLabel->show();
}
AsyncActionDialog::handleFinishedAction(aResult);
}

View File

@@ -0,0 +1,32 @@
#ifndef GUI_GETWORKLISTDIALOG_H
#define GUI_GETWORKLISTDIALOG_H
#include "dialogs/AsyncActionDialog.h"
class ULineEdit;
class QLabel;
class QSqlTableModel;
class GetWorkListDialog : public AsyncActionDialog
{
Q_OBJECT
public:
explicit GetWorkListDialog(QSqlTableModel* aSqlModel, QWidget* aParent = nullptr, Qt::WindowFlags aFlags = Qt::WindowFlags());
~GetWorkListDialog() override;
protected:
bool updateReferenceData() override;
private:
void initializeContentWidgets();
virtual void handleFinishedAction(const ActionResult& aResult) override;
private:
ULineEdit* mAccessionNumber;
ULineEdit* mPatientId;
QLabel* mErrorLabel;
};
#endif //GUI_GETWORKLISTDIALOG_H