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

@@ -37,7 +37,11 @@ source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${project_cxx})
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${project_cc}) source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${project_cc})
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${project_c}) source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${project_c})
find_package(Qt5 COMPONENTS Core Widgets Gui OpenGL Sql VirtualKeyboard Network REQUIRED Multimedia MultimediaWidgets) find_package(Qt5 COMPONENTS Core Widgets Gui OpenGL Sql VirtualKeyboard Network Multimedia MultimediaWidgets REQUIRED)
find_package(DCMTK REQUIRED)
include_directories(${DCMTK_INCLUDE_DIRS})
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
file(GLOB_RECURSE project_uis ./src/*.ui) file(GLOB_RECURSE project_uis ./src/*.ui)
@@ -60,6 +64,10 @@ set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_SOURC
qt5_create_translation(QM_FILES ${cpp_source_all} ${ui_FILES} ${TS_FILES}) qt5_create_translation(QM_FILES ${cpp_source_all} ${ui_FILES} ${TS_FILES})
add_executable(${PROJECT_NAME} ${project_headers} ${project_cpps} ${project_cxx} ${project_res} ${project_cc} ${project_c} ${ui_FILES} ${QM_FILES} ) add_executable(${PROJECT_NAME} ${project_headers} ${project_cpps} ${project_cxx} ${project_res} ${project_cc} ${project_c} ${ui_FILES} ${QM_FILES} )
if(${DCMTK_FOUND})
target_link_libraries(${PROJECT_NAME} ${DCMTK_LIBRARIES})
endif()
if(NOT UNIX) if(NOT UNIX)
find_program(POWERSHELL_PATH NAMES powershell) find_program(POWERSHELL_PATH NAMES powershell)

View File

@@ -0,0 +1,3 @@
#include "ActionCreator.h"
QMap<QString,AsyncActionPointer> ActionCreator::mAsyncActionContainer;

View File

@@ -0,0 +1,31 @@
#ifndef GUI_ACTIONCREATOR_H
#define GUI_ACTIONCREATOR_H
#include "AsyncAction.h"
#include <QList>
#include <QMap>
class ActionCreator
{
public:
template <typename T>
static T* getAsyncAction(const QString& aActionId)
{
if (mAsyncActionContainer.contains(aActionId))
{
return static_cast<T*>(mAsyncActionContainer.value(aActionId).data());
}
else
{
T* action = new T();
mAsyncActionContainer.insert(aActionId, AsyncActionPointer(action));
return action;
}
};
private:
static QMap<QString, AsyncActionPointer> mAsyncActionContainer;
};
#endif //GUI_ACTIONCREATOR_H

View File

@@ -0,0 +1,22 @@
#include "AsyncAction.h"
#include <QThreadPool>
#include <QThread>
#include <QDebug>
AsyncAction::AsyncAction(QObject* aParent)
: QObject(aParent)
, QRunnable()
{
setAutoDelete(false);
}
AsyncAction::~AsyncAction()
{
}
void AsyncAction::execute()
{
QThreadPool::globalInstance()->start(this);
}

41
src/action/AsyncAction.h Normal file
View File

@@ -0,0 +1,41 @@
#ifndef GUI_ASYNCACTION_H
#define GUI_ASYNCACTION_H
#include <QObject>
#include <QString>
#include <QRunnable>
#include <QSharedPointer>
enum ActionCode :unsigned int
{
Sucessed, Failed
};
class ActionResult
{
public:
ActionResult(ActionCode aCode = Sucessed, const QString& aMessage = "")
{
Code = aCode;
Message = aMessage;
}
ActionCode Code;
QString Message;
};
class AsyncAction : public QObject, public QRunnable
{
Q_OBJECT
public:
explicit AsyncAction(QObject* aParent);
~AsyncAction();
void execute();
signals:
void actionCompleted(const ActionResult& aResult);
};
typedef QSharedPointer<AsyncAction> AsyncActionPointer;
#endif //GUI_ASYNCACTION_H

View File

@@ -0,0 +1,77 @@
#include "GetWorkListAction.h"
#include "dicom/WorkListManager.h"
#include <QThread>
#include <QDateTime>
#include <QSqlTableModel>
#include <QUuid>
#include <QDebug>
GetWorkListAction::GetWorkListAction(QObject* aParent)
: AsyncAction(aParent)
, mSqlModel(nullptr)
{
}
GetWorkListAction::~GetWorkListAction()
{
}
void GetWorkListAction::run()
{
if (!mQueryData.isEmpty())
{
PatientInformationPointer info = WorkListManager::getPatientFromWorkList(mQueryData.mAccessionNum, mQueryData.mPatientId);
emit actionCompleted(insertPatientFromWorkList(info));
}
else
{
emit actionCompleted(ActionResult(Failed,tr("Search Query Error")));
}
}
void GetWorkListAction::setWorkListQueryData(const WorkListQueryData& aQueryData)
{
mQueryData = aQueryData;
}
void GetWorkListAction::setSqlModel(QSqlTableModel* aSqlModel)
{
mSqlModel = aSqlModel;
}
ActionResult GetWorkListAction::insertPatientFromWorkList(PatientInformationPointer aPatientInformation)
{
if (mSqlModel == nullptr)
{
return ActionResult(Failed,tr("DB Unknow Error"));
}
if (aPatientInformation.isNull())
{
return ActionResult(Failed,tr("WorkList Search Failed"));
}
mSqlModel->setFilter(QString("PatientID='%1'").arg(aPatientInformation->ID));
if (mSqlModel->rowCount() > 0)
{
mSqlModel->setFilter("");
return ActionResult(Failed,tr("Same Patient Existed"));
}
mSqlModel->setFilter("");
aPatientInformation->PatientUID = QUuid::createUuid().toString();
aPatientInformation->AddDate = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
mSqlModel->insertRow(0);
#define ADD_PATIENT_PROPERTY(val)\
mSqlModel->setData(mSqlModel->index(0, PatientInformationEnum:: val),aPatientInformation->val);
EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
if (mSqlModel->submitAll())
{
return ActionResult();
}
else
{
return ActionResult(Failed,tr("DB Error,Patient Write Failed"));;
}
}

View File

@@ -0,0 +1,46 @@
#ifndef GUI_GETWORKLISTACTION_H
#define GUI_GETWORKLISTACTION_H
#include "AsyncAction.h"
#include "forms/select/PatientInformation.h"
class QSqlTableModel;
class WorkListQueryData
{
public:
WorkListQueryData(const QString& aAccessionNum = QString(),const QString& aPatientId = QString())
: mAccessionNum(aAccessionNum)
, mPatientId(aPatientId)
{
};
bool isEmpty()
{
return mAccessionNum.isEmpty() && mPatientId.isEmpty();
}
QString mAccessionNum;
QString mPatientId;
};
class GetWorkListAction : public AsyncAction
{
Q_OBJECT
public:
explicit GetWorkListAction(QObject* aParent = nullptr);
~GetWorkListAction() override;
void run() override;
void setWorkListQueryData(const WorkListQueryData& aQueryData);
void setSqlModel(QSqlTableModel* aSqlModel);
private:
ActionResult insertPatientFromWorkList(PatientInformationPointer aPatientInformation);
private:
WorkListQueryData mQueryData;
QSqlTableModel* mSqlModel;
};
#endif //GUI_GETWORKLISTACTION_H

View File

@@ -0,0 +1,101 @@
#include "LoadingWidget.h"
#include <QTimer>
#include <QtMath>
#include <QPainter>
#include <QDebug>
LoadingWidget::LoadingWidget(QWidget* aParent)
: QWidget(aParent)
, mTimer(new QTimer(this))
, mColor(QColor(Qt::white))
, mCount(12)
, mMaxDiameter(30)
, mMinDiameter(5)
{
connect(mTimer,&QTimer::timeout,this,QOverload<>::of(&QWidget::repaint));
initPaintArea();
}
LoadingWidget::~LoadingWidget()
{
}
void LoadingWidget::setMaxDiameter(const int aValue)
{
mMaxDiameter = aValue;
}
void LoadingWidget::setMinDiameter(const int aValue)
{
mMinDiameter = aValue;
}
void LoadingWidget::setColor(const QColor& aColor)
{
mColor = aColor;
}
void LoadingWidget::setCount(const int aCount)
{
mCount = aCount;
}
void LoadingWidget::resizeEvent(QResizeEvent *aEvent)
{
QWidget::resizeEvent(aEvent);
initPaintArea();
}
void LoadingWidget::showEvent(QShowEvent *aEvent)
{
QWidget::showEvent(aEvent);
mTimer->start(60);
}
void LoadingWidget::hideEvent(QHideEvent *aEvent)
{
QWidget::hideEvent(aEvent);
mTimer->stop();
}
void LoadingWidget::initPaintArea()
{
double halfWidth = width() /2;
double halfHeight = height() /2;
double half = qMin(width(),height())/2;
double distance = half - mMaxDiameter/2 - 1;
double gap = (mMaxDiameter - mMinDiameter)/(mCount-1)/2;
double angleGap = 360/mCount;
mPointList.clear();
mRadiusList.clear();
for(int i=0;i<mCount;i++)
{
mRadiusList << mMaxDiameter/2-i*gap;
double radian = qDegreesToRadians(angleGap*i);
mPointList.append(QPointF(halfWidth + distance*qCos(radian),halfHeight - distance*qSin(radian)));
}
}
void LoadingWidget::paintEvent(QPaintEvent *aEvent)
{
if(mStatus == mCount)
{
mStatus = 0;
}
QWidget::paintEvent(aEvent);
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(mColor);
painter.setBrush(mColor);
for(int i=0;i<mCount;i++)
{
double radius= mRadiusList.at((mStatus + i)%mCount);
painter.drawEllipse(mPointList.at(i),radius,radius);
}
++mStatus;
}

View File

@@ -0,0 +1,43 @@
#ifndef LOADINGWIDGET_H
#define LOADINGWIDGET_H
#include <QWidget>
class QTimer;
class QColor;
class LoadingWidget : public QWidget
{
public:
explicit LoadingWidget(QWidget* aParent);
~LoadingWidget() override;
void setMaxDiameter(const int aValue);
void setMinDiameter(const int aValue);
void setColor(const QColor& aColor);
void setCount(const int aCount);
protected:
void paintEvent(QPaintEvent *aEvent) override;
void resizeEvent(QResizeEvent *aEvent) override;
void showEvent(QShowEvent *aEvent) override;
void hideEvent(QHideEvent *aEvent) override;
private:
void initPaintArea();
private:
QTimer* mTimer;
QColor mColor;
int mCount;
double mMaxDiameter;
double mMinDiameter;
QRect mPaintAreaRect;
QList<QPointF> mPointList;
QList<double> mRadiusList;
int mStatus = 0;
};
#endif // LOADINGWIDGET_H

View File

@@ -57,6 +57,7 @@ void ULineEdit::focusOutEvent(QFocusEvent* aEvent)
QWidget* widget = QApplication::focusWidget(); QWidget* widget = QApplication::focusWidget();
if (nullptr == widget) if (nullptr == widget)
{ {
KeyboardManager::getInstance()->hideKeyboard();
return; return;
} }

View File

@@ -57,6 +57,7 @@ void UTextEdit::focusOutEvent(QFocusEvent* aEvent)
QWidget* widget = QApplication::focusWidget(); QWidget* widget = QApplication::focusWidget();
if (nullptr == widget) if (nullptr == widget)
{ {
KeyboardManager::getInstance()->hideKeyboard();
return; return;
} }

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/AlertDialog.h"
#include "dialogs/DateSelectDialog.h" #include "dialogs/DateSelectDialog.h"
#include "dialogs/SelectDialog.h" #include "dialogs/SelectDialog.h"
#include "dialogs/GetWorkListDialog.h"
#include "network/DicomCfgDialog.h" #include "network/DicomCfgDialog.h"
#include "network/GetAdminPsw.h" #include "network/GetAdminPsw.h"
@@ -295,6 +296,16 @@ DialogResult DialogManager::requestEditRouteInfo(const QStringList& aEditData)
return DialogResult(ret,dialog.getList()); 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) void DialogManager::raiseDeviceInfo(QObject* parent, QObject* aInfoData)
{ {
QPair<QString, unsigned int>* infoData = (QPair<QString, unsigned int>*)(aInfoData); QPair<QString, unsigned int>* infoData = (QPair<QString, unsigned int>*)(aInfoData);

View File

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

View File

@@ -0,0 +1,148 @@
#include "WorkListManager.h"
#include <dcmtk/dcmnet/scu.h>
#include <dcmtk/dcmdata/dcpath.h>
#include "json/jsonobject.h"
#include <QDebug>
WorkListManager::WorkListManager()
{
}
WorkListManager::~WorkListManager()
{
}
PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString& aAccessionNum, const QString& aPatientId)
{
DcmSCU scu;
OFString temp_str;
host serverInfo = JsonObject::Instance()->getServer(JsonObject::WORKLIST);
QByteArray ip = serverInfo.ip.toLatin1();
QByteArray aeTitle = serverInfo.ae.toLatin1();
OFList<OFString> overrideKeys;
overrideKeys.push_back(OFString((QString("0008,0050=") + aAccessionNum).toLatin1()));
overrideKeys.push_back(OFString((QString("0010,0020=") + aPatientId).toLatin1()));
overrideKeys.push_back("0010,0010");
overrideKeys.push_back("0010,0030");
overrideKeys.push_back("0010,0040");
if (!dcmDataDict.isDictionaryLoaded())
{
qDebug()<<"dcmdatadict error";
}
/*<2A><><EFBFBD><EFBFBD> scu*/
OFList<OFString> syntaxes;
syntaxes.push_back(UID_LittleEndianImplicitTransferSyntax);
scu.setMaxReceivePDULength(ASC_DEFAULTMAXPDU);
scu.setACSETimeout(30);
scu.setDIMSEBlockingMode(DIMSE_BLOCKING);
scu.setDIMSETimeout(0);
scu.setAETitle("USCT");
scu.setPeerHostName(ip.data());
scu.setPeerPort(OFstatic_cast(Uint16, serverInfo.port.toInt()));
scu.setPeerAETitle(aeTitle.data());
scu.setVerbosePCMode(OFFalse);
scu.addPresentationContext(UID_FINDModalityWorklistInformationModel, syntaxes);//UID_FINDStudyRootQueryRetrieveInformationModel
OFCondition cond = scu.initNetwork();
if(cond.bad())
{
qDebug()<<cond.code() <<cond.text();
qDebug()<<"worklist initNetwork failed";
return PatientInformationPointer();
}
cond = scu.negotiateAssociation();
if(cond.bad())
{
qDebug()<<cond.code();//<< "----"<<cond.text();
qDebug()<<"worklist connect failed";
return PatientInformationPointer();
}
cond = EC_Normal;
T_ASC_PresentationContextID pcid = scu.findPresentationContextID(UID_FINDModalityWorklistInformationModel,"");
if (pcid == 0)
{
qDebug()<<"worklist pcid bad";
return PatientInformationPointer();
}
DcmFileFormat dcmff;
DcmDataset *dset = dcmff.getDataset();
OFList<QRResponse*> responses;
//<2F><>ѯ
DcmPathProcessor proc;
proc.setItemWildcardSupport(OFFalse);
proc.checkPrivateReservations(OFFalse);
for(auto &item:overrideKeys)
{
proc.applyPathWithValue(dset, item);
}
PatientInformationPointer result = PatientInformationPointer(new PatientInformation());
cond = scu.sendFINDRequest(pcid, dset, &responses);
if (!responses.empty())
{
auto item = *responses.begin();
if (item->m_dataset)
{
OFString ID;
OFString Name;
OFString BirthDate;
OFString Sex;
item->m_dataset->findAndGetOFString(DCM_PatientID, ID);
if (ID.empty())
{
return PatientInformationPointer();
}
item->m_dataset->findAndGetOFString(DCM_PatientName, Name);
item->m_dataset->findAndGetOFString(DCM_PatientBirthDate, BirthDate);
item->m_dataset->findAndGetOFString(DCM_PatientSex, Sex);
result->ID = QString(ID.c_str());
result->Name = QString(Name.c_str());
result->BirthDate = QString(BirthDate.c_str()).insert(4,"-").insert(7,"-");
result->Sex = QString(Sex.c_str());
//if (patientName.bad())
//{
// std::cout << patientName.text() << std::endl;
//}
}
else
{
return PatientInformationPointer();
}
OFListIterator(QRResponse*) iter = responses.begin();
OFListConstIterator(QRResponse*) last = responses.end();
while (iter != last)
{
delete (*iter);
iter = responses.erase(iter);
}
}
else
{
return PatientInformationPointer();
}
if (cond == EC_Normal)
{
scu.releaseAssociation();
}
else
{
if (cond == DUL_PEERREQUESTEDRELEASE)
scu.closeAssociation(DCMSCU_PEER_REQUESTED_RELEASE);
else if (cond == DUL_PEERABORTEDASSOCIATION)
scu.closeAssociation(DCMSCU_PEER_ABORTED_ASSOCIATION);
else
{
scu.abortAssociation();
}
}
return result;
}

View File

@@ -0,0 +1,18 @@
#ifndef GUI_WORKLISTMANAGER_H
#define GUI_WORKLISTMANAGER_H
#include <QString>
#include "forms/select/PatientInformation.h"
class WorkListManager
{
public:
WorkListManager();
~WorkListManager();
static PatientInformationPointer getPatientFromWorkList(const QString& aAccessionNum, const QString& aPatientId);
};
#endif //GUI_WORKLISTMANAGER_H

View File

@@ -23,6 +23,9 @@ enum PatientInformationEnum{
#undef ADD_PATIENT_PROPERTY #undef ADD_PATIENT_PROPERTY
}; };
#include <QObject>
#include <QSharedPointer>
/** /**
* @brief this class was designed to be a edit form, * @brief this class was designed to be a edit form,
* but now has been change to a detail display class. * but now has been change to a detail display class.
@@ -33,7 +36,9 @@ public:
#define ADD_PATIENT_PROPERTY(val) QString val; #define ADD_PATIENT_PROPERTY(val) QString val;
EDIT_PATIENT(); EDIT_PATIENT();
#undef ADD_PATIENT_PROPERTY #undef ADD_PATIENT_PROPERTY
PatientInformation(){ PatientInformation()
: QObject()
{
this->Flag = QString("0"); this->Flag = QString("0");
} }
PatientInformation* Copy() PatientInformation* Copy()
@@ -48,4 +53,5 @@ public:
return n; return n;
} }
}; };
typedef QSharedPointer<PatientInformation> PatientInformationPointer;
#endif //GUI_PATIENTINFORMATION_H #endif //GUI_PATIENTINFORMATION_H

View File

@@ -83,6 +83,13 @@ void SelectFormWidget::initGeneralButtons(QHBoxLayout *layout) {
layout->addWidget(mBtnWorklist); layout->addWidget(mBtnWorklist);
// mBtn account slot // mBtn account slot
connect(mBtnAccount, &QToolButton::clicked, DialogManager::Default(),&DialogManager::requestEditSelfAccount); connect(mBtnAccount, &QToolButton::clicked, DialogManager::Default(),&DialogManager::requestEditSelfAccount);
connect(mBtnWorklist, &QToolButton::clicked, [&]()
{
if (DialogManager::Default()->requestGetWorkList(mModel) == QDialog::Accepted)
{
mPatTable->selectRow(0);
}
});
} }
void SelectFormWidget::initPatEditButtons(QHBoxLayout *layout) { void SelectFormWidget::initPatEditButtons(QHBoxLayout *layout) {
@@ -140,7 +147,8 @@ void SelectFormWidget::delPatient() {
if (DialogManager::Default()->requestAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name),DialogButtonMode::OkAndCancel,tr("Confirm")) != QDialog::Accepted) return; if (DialogManager::Default()->requestAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name),DialogButtonMode::OkAndCancel,tr("Confirm")) != QDialog::Accepted) return;
// need delete clear edit panel detail // need delete clear edit panel detail
patientDetailForm->clearPatientInformation(); patientDetailForm->clearPatientInformation();
mModel->setData(mModel->index(mPatTable->currentIndex().row(), Flag), 9); //mModel->setData(mModel->index(mPatTable->currentIndex().row(), Flag), 9);
mModel->removeRow(mPatTable->currentIndex().row());
if (mModel->submitAll()) { if (mModel->submitAll()) {
mModel->select(); mModel->select();
@@ -229,7 +237,6 @@ void SelectFormWidget::initTableView(QHBoxLayout *contentLayout) {// TableView f
void SelectFormWidget::initDataModel() {//TODO:单独初始化预防SQL错误 void SelectFormWidget::initDataModel() {//TODO:单独初始化预防SQL错误
mModel = SQLHelper::getTable("Patient"); mModel = SQLHelper::getTable("Patient");
mModel->setFilter("Flag=0");
mModel->sort(5, Qt::DescendingOrder); mModel->sort(5, Qt::DescendingOrder);
mModel->select(); mModel->select();
mModel->setHeaderData(1, Qt::Horizontal, "ID"); mModel->setHeaderData(1, Qt::Horizontal, "ID");

View File

@@ -13,6 +13,7 @@
#include <src/device/DeviceManager.h> #include <src/device/DeviceManager.h>
#include "dialogs/DialogManager.h" #include "dialogs/DialogManager.h"
#include "dialogs/MultyMessageDialogManager.h" #include "dialogs/MultyMessageDialogManager.h"
#include "action/AsyncAction.h"
#include "json/jsonobject.h" #include "json/jsonobject.h"
#include "src/utilities/Locker.h" #include "src/utilities/Locker.h"
#include "src/utilities/LanguageSwitcher.h" #include "src/utilities/LanguageSwitcher.h"
@@ -47,6 +48,9 @@ int main(int argc, char* argv[])
UsctApplication a(argc, argv); UsctApplication a(argc, argv);
qRegisterMetaType<QPair<QString, uint>>("QPair<QString, uint>"); qRegisterMetaType<QPair<QString, uint>>("QPair<QString, uint>");
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
qRegisterMetaType<ActionResult>("ActionResult");
QString layouts_path = QString(QCoreApplication::applicationDirPath()).append("/layouts"); QString layouts_path = QString(QCoreApplication::applicationDirPath()).append("/layouts");
qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", QByteArray(layouts_path.toStdString().c_str())); qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", QByteArray(layouts_path.toStdString().c_str()));