Enable the worklist to retrieve more results based on different combinations of Patient ID and accession number.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
#define GUI_ASYNCACTION_H
|
#define GUI_ASYNCACTION_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QVariant>
|
||||||
#include <QRunnable>
|
#include <QRunnable>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
@@ -14,13 +14,13 @@ enum ActionCode :unsigned int
|
|||||||
class ActionResult
|
class ActionResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ActionResult(ActionCode aCode = Sucessed, const QString& aMessage = "")
|
ActionResult(ActionCode aCode = Sucessed, const QVariant& aData = QVariant())
|
||||||
{
|
{
|
||||||
Code = aCode;
|
Code = aCode;
|
||||||
Message = aMessage;
|
Data = aData;
|
||||||
}
|
}
|
||||||
ActionCode Code;
|
ActionCode Code;
|
||||||
QString Message;
|
QVariant Data;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AsyncAction : public QObject, public QRunnable
|
class AsyncAction : public QObject, public QRunnable
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
#include "GetWorkListAction.h"
|
#include "GetWorkListAction.h"
|
||||||
#include "dicom/WorkListManager.h"
|
#include "dicom/WorkListManager.h"
|
||||||
|
#include "forms/select/PatientInformation.h"
|
||||||
#include <QThread>
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QSqlTableModel>
|
|
||||||
#include <QUuid>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
GetWorkListAction::GetWorkListAction(QObject* aParent)
|
GetWorkListAction::GetWorkListAction(QObject* aParent)
|
||||||
: AsyncAction(aParent)
|
: AsyncAction(aParent)
|
||||||
@@ -23,8 +18,15 @@ void GetWorkListAction::run()
|
|||||||
{
|
{
|
||||||
if (!mQueryData.isEmpty())
|
if (!mQueryData.isEmpty())
|
||||||
{
|
{
|
||||||
PatientInformationPointer info = WorkListManager::getPatientFromWorkList(mQueryData.mAccessionNum, mQueryData.mPatientId);
|
QList<PatientInformationPointer> patients = WorkListManager::getPatientFromWorkList(mQueryData.mAccessionNum, mQueryData.mPatientId);
|
||||||
emit actionCompleted(insertPatientFromWorkList(info));
|
if(patients.isEmpty())
|
||||||
|
{
|
||||||
|
emit actionCompleted(ActionResult(Failed,tr("WorkList Search Failed")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit actionCompleted(ActionResult(Sucessed, QVariant::fromValue(patients)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -41,37 +43,3 @@ void GetWorkListAction::setSqlModel(QSqlTableModel* aSqlModel)
|
|||||||
{
|
{
|
||||||
mSqlModel = 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"));;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#define GUI_GETWORKLISTACTION_H
|
#define GUI_GETWORKLISTACTION_H
|
||||||
|
|
||||||
#include "AsyncAction.h"
|
#include "AsyncAction.h"
|
||||||
#include "forms/select/PatientInformation.h"
|
|
||||||
|
|
||||||
class QSqlTableModel;
|
class QSqlTableModel;
|
||||||
|
|
||||||
@@ -35,8 +34,6 @@ public:
|
|||||||
void setWorkListQueryData(const WorkListQueryData& aQueryData);
|
void setWorkListQueryData(const WorkListQueryData& aQueryData);
|
||||||
void setSqlModel(QSqlTableModel* aSqlModel);
|
void setSqlModel(QSqlTableModel* aSqlModel);
|
||||||
|
|
||||||
private:
|
|
||||||
ActionResult insertPatientFromWorkList(PatientInformationPointer aPatientInformation);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WorkListQueryData mQueryData;
|
WorkListQueryData mQueryData;
|
||||||
|
|||||||
@@ -313,9 +313,9 @@ DialogResult DialogManager::requestEditRouteInfo(const QStringList& aEditData)
|
|||||||
return DialogResult(ret,dialog.getList());
|
return DialogResult(ret,dialog.getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
int DialogManager::requestGetWorkList(QSqlTableModel* aModel)
|
int DialogManager::requestGetWorkList(QSqlTableModel* aModel, QTableView* aTableView)
|
||||||
{
|
{
|
||||||
GetWorkListDialog dialog(aModel,mTopWidget);
|
GetWorkListDialog dialog(aModel, aTableView, mTopWidget);
|
||||||
setTopWidget(&dialog);
|
setTopWidget(&dialog);
|
||||||
dialog.setWindowModality(Qt::WindowModal);
|
dialog.setWindowModality(Qt::WindowModal);
|
||||||
int ret = dialog.exec();
|
int ret = dialog.exec();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
class GUIMessageDialog;
|
class GUIMessageDialog;
|
||||||
class QSqlTableModel;
|
class QSqlTableModel;
|
||||||
|
class QTableView;
|
||||||
class PatientInformation;
|
class PatientInformation;
|
||||||
class LoginDialog;
|
class LoginDialog;
|
||||||
class ScreenSaverWindow;
|
class ScreenSaverWindow;
|
||||||
@@ -59,7 +60,7 @@ public:
|
|||||||
int requestEditDicomConfig();
|
int requestEditDicomConfig();
|
||||||
int requestInputAdminPasswd();
|
int requestInputAdminPasswd();
|
||||||
int requestEditNetworkConfig();
|
int requestEditNetworkConfig();
|
||||||
int requestGetWorkList(QSqlTableModel* aModel);
|
int requestGetWorkList(QSqlTableModel* aModel, QTableView* aTableView);
|
||||||
DialogResult requestEditIpAndNetMask();
|
DialogResult requestEditIpAndNetMask();
|
||||||
DialogResult requestEditIpAndNetMask(const QStringList& aEditData);
|
DialogResult requestEditIpAndNetMask(const QStringList& aEditData);
|
||||||
DialogResult requestEditRouteInfo();
|
DialogResult requestEditRouteInfo();
|
||||||
|
|||||||
@@ -2,17 +2,33 @@
|
|||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QTableView>
|
||||||
|
#include <QStandardItemModel>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QSqlTableModel>
|
||||||
|
#include <QUuid>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QSqlRecord>
|
||||||
|
|
||||||
#include "components/ULineEdit.h"
|
#include "components/ULineEdit.h"
|
||||||
#include "action/GetWorkListAction.h"
|
#include "action/GetWorkListAction.h"
|
||||||
#include "action/ActionCreator.h"
|
#include "action/ActionCreator.h"
|
||||||
|
|
||||||
GetWorkListDialog::GetWorkListDialog(QSqlTableModel* aSqlModel, QWidget* aParent, Qt::WindowFlags aFlags)
|
GetWorkListDialog::GetWorkListDialog(QSqlTableModel* aSqlModel, QTableView* aTableView, QWidget* aParent, Qt::WindowFlags aFlags)
|
||||||
: AsyncActionDialog(ActionCreator::getAsyncAction<GetWorkListAction>("GetWorkListAction"),"Work List", aParent, aFlags)
|
: AsyncActionDialog(ActionCreator::getAsyncAction<GetWorkListAction>("GetWorkListAction"),"Work List", aParent, aFlags)
|
||||||
, mAccessionNumber(new ULineEdit(mContentWidget))
|
, mAccessionNumber(new ULineEdit(mContentWidget))
|
||||||
, mPatientId(new ULineEdit(mContentWidget))
|
, mPatientId(new ULineEdit(mContentWidget))
|
||||||
, mErrorLabel(new QLabel(mContentWidget))
|
, mErrorLabel(new QLabel(mContentWidget))
|
||||||
|
, mAccessionNumText(new QLabel(mContentWidget))
|
||||||
|
, mAccessionNumEndLine(new QLabel(mContentWidget))
|
||||||
|
, mPatientIDText(new QLabel(mContentWidget))
|
||||||
|
, mPatientIDLine(new QLabel(mContentWidget))
|
||||||
|
, mPatientSelectTable(new QTableView(mContentWidget))
|
||||||
|
, mMode(PatientSearchMode)
|
||||||
|
, mPatientSelectModel(new QStandardItemModel(mContentWidget))
|
||||||
|
, mSqlModel(aSqlModel)
|
||||||
|
, mTableView(aTableView)
|
||||||
|
, mSearchedPatients()
|
||||||
{
|
{
|
||||||
initializeContentWidgets();
|
initializeContentWidgets();
|
||||||
GetWorkListAction* action = qobject_cast<GetWorkListAction*>(getAction());
|
GetWorkListAction* action = qobject_cast<GetWorkListAction*>(getAction());
|
||||||
@@ -30,22 +46,41 @@ void GetWorkListDialog::initializeContentWidgets()
|
|||||||
{
|
{
|
||||||
QVBoxLayout* contentLayout = new QVBoxLayout(mContentWidget);
|
QVBoxLayout* contentLayout = new QVBoxLayout(mContentWidget);
|
||||||
//Accession Nummber
|
//Accession Nummber
|
||||||
QLabel* accessionNumText = new QLabel(mContentWidget);
|
mAccessionNumText->setText(tr("Accession Nummber"));
|
||||||
accessionNumText->setText(tr("Accession Nummber"));
|
contentLayout->addWidget(mAccessionNumText);
|
||||||
contentLayout->addWidget(accessionNumText);
|
|
||||||
contentLayout->addWidget(mAccessionNumber);
|
contentLayout->addWidget(mAccessionNumber);
|
||||||
QLabel* endLine1 = new QLabel(mContentWidget);
|
mAccessionNumEndLine->setObjectName("endline");
|
||||||
endLine1->setObjectName("endline");
|
contentLayout->addWidget(mAccessionNumEndLine);
|
||||||
contentLayout->addWidget(endLine1);
|
|
||||||
|
|
||||||
//PatientId
|
//PatientId
|
||||||
QLabel* patientIdText = new QLabel(mContentWidget);
|
mPatientIDText->setText(tr("Patient ID"));
|
||||||
patientIdText->setText(tr("Patient ID"));
|
contentLayout->addWidget(mPatientIDText);
|
||||||
contentLayout->addWidget(patientIdText);
|
|
||||||
contentLayout->addWidget(mPatientId);
|
contentLayout->addWidget(mPatientId);
|
||||||
QLabel* endLine2 = new QLabel(mContentWidget);
|
mPatientIDLine->setObjectName("endline");
|
||||||
endLine2->setObjectName("endline");
|
contentLayout->addWidget(mPatientIDLine);
|
||||||
contentLayout->addWidget(endLine2);
|
|
||||||
|
//TableView
|
||||||
|
contentLayout->addWidget(mPatientSelectTable);
|
||||||
|
mPatientSelectModel->setColumnCount(4);
|
||||||
|
mPatientSelectModel->setHorizontalHeaderItem(0, new QStandardItem("Patient ID"));
|
||||||
|
mPatientSelectModel->setHorizontalHeaderItem(1, new QStandardItem("Accession Number"));
|
||||||
|
mPatientSelectModel->setHorizontalHeaderItem(2, new QStandardItem("Patient Name"));
|
||||||
|
mPatientSelectModel->setHorizontalHeaderItem(3, new QStandardItem("Scheduled Date"));
|
||||||
|
mPatientSelectTable->setModel(mPatientSelectModel);
|
||||||
|
mPatientSelectTable->setColumnWidth(0, 200);
|
||||||
|
mPatientSelectTable->setColumnWidth(1, 200);
|
||||||
|
mPatientSelectTable->setColumnWidth(2, 200);
|
||||||
|
mPatientSelectTable->setColumnWidth(3, 200);
|
||||||
|
|
||||||
|
mPatientSelectTable->setAlternatingRowColors(true);
|
||||||
|
mPatientSelectTable->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
mPatientSelectTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
mPatientSelectTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
// mTableView->verticalHeader()->setDefaultSectionSize(38);
|
||||||
|
// mTableView->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
mPatientSelectTable->viewport()->ungrabGesture(Qt::PanGesture);
|
||||||
|
mPatientSelectTable->setSortingEnabled(false); // enable sortingEnabled
|
||||||
|
mPatientSelectTable->hide();
|
||||||
|
|
||||||
//ErrorLabel
|
//ErrorLabel
|
||||||
contentLayout->addWidget(mErrorLabel);
|
contentLayout->addWidget(mErrorLabel);
|
||||||
@@ -55,6 +90,11 @@ void GetWorkListDialog::initializeContentWidgets()
|
|||||||
|
|
||||||
bool GetWorkListDialog::updateReferenceData()
|
bool GetWorkListDialog::updateReferenceData()
|
||||||
{
|
{
|
||||||
|
if(mMode == PatientSelectMode)
|
||||||
|
{
|
||||||
|
insertPatient(mSearchedPatients.at(mPatientSelectTable->currentIndex().row()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
QString accessionNum = mAccessionNumber->text();
|
QString accessionNum = mAccessionNumber->text();
|
||||||
QString patientId = mPatientId->text();
|
QString patientId = mPatientId->text();
|
||||||
if (accessionNum.isEmpty() && patientId.isEmpty())
|
if (accessionNum.isEmpty() && patientId.isEmpty())
|
||||||
@@ -77,10 +117,108 @@ void GetWorkListDialog::handleFinishedAction(const ActionResult& aResult)
|
|||||||
{
|
{
|
||||||
if (aResult.Code == Failed)
|
if (aResult.Code == Failed)
|
||||||
{
|
{
|
||||||
mErrorLabel->setText(aResult.Message);
|
mErrorLabel->setText(aResult.Data.toString());
|
||||||
mContentWidget->show();
|
mContentWidget->show();
|
||||||
mBtnWidget->show();
|
mBtnWidget->show();
|
||||||
mErrorLabel->show();
|
mErrorLabel->show();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mSearchedPatients = aResult.Data.value<QList<PatientInformationPointer>>();
|
||||||
|
|
||||||
|
if(mSearchedPatients.size() > 1)
|
||||||
|
{
|
||||||
|
updatePatientSelectTable();
|
||||||
|
}
|
||||||
|
else if(mSearchedPatients.size() == 1)
|
||||||
|
{
|
||||||
|
insertPatient(mSearchedPatients.at(0));
|
||||||
AsyncActionDialog::handleFinishedAction(aResult);
|
AsyncActionDialog::handleFinishedAction(aResult);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetWorkListDialog::updatePatientSelectTable()
|
||||||
|
{
|
||||||
|
int rowCount = mSearchedPatients.size();
|
||||||
|
|
||||||
|
mPatientSelectModel->setRowCount(rowCount);
|
||||||
|
for(int i=0; i<rowCount; ++i)
|
||||||
|
{
|
||||||
|
PatientInformationPointer patient = mSearchedPatients.at(i);
|
||||||
|
QModelIndex index = mPatientSelectModel->index(i, 0, QModelIndex());
|
||||||
|
mPatientSelectModel->setData(index, patient->ID);
|
||||||
|
|
||||||
|
index = mPatientSelectModel->index(i, 1, QModelIndex());
|
||||||
|
mPatientSelectModel->setData(index, patient->AccessionNumber);
|
||||||
|
|
||||||
|
index = mPatientSelectModel->index(i, 2, QModelIndex());
|
||||||
|
mPatientSelectModel->setData(index, patient->Name);
|
||||||
|
|
||||||
|
index = mPatientSelectModel->index(i, 3, QModelIndex());
|
||||||
|
mPatientSelectModel->setData(index, patient->ScheduledStartDate);
|
||||||
|
}
|
||||||
|
showPatientSelectTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetWorkListDialog::showPatientSelectTable()
|
||||||
|
{
|
||||||
|
setFixedWidth(900);
|
||||||
|
QRect re = geometry();
|
||||||
|
setGeometry(re.x() - 200, re.y(), 900, re.height());
|
||||||
|
mMode = PatientSelectMode;
|
||||||
|
mAccessionNumber->hide();
|
||||||
|
mPatientId->hide();
|
||||||
|
mErrorLabel->hide();
|
||||||
|
mAccessionNumText->hide();
|
||||||
|
mAccessionNumEndLine->hide();
|
||||||
|
mPatientIDText->hide();
|
||||||
|
mPatientIDLine->hide();
|
||||||
|
|
||||||
|
mPatientSelectTable->show();
|
||||||
|
mContentWidget->show();
|
||||||
|
mBtnWidget->show();
|
||||||
|
mLoadingWidget->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetWorkListDialog::insertPatient(PatientInformationPointer aPatient)
|
||||||
|
{
|
||||||
|
if (mSqlModel == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (aPatient.isNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mSqlModel->setFilter(QString("PatientID='%1' And AccessionNumber='%2'").arg(aPatient->ID).arg(aPatient->AccessionNumber));
|
||||||
|
if (mSqlModel->rowCount() > 0)
|
||||||
|
{
|
||||||
|
mSqlModel->setFilter("");
|
||||||
|
int patientIdIndex = mSqlModel->record().indexOf("PatientID");
|
||||||
|
int accessionNumberIndex = mSqlModel->record().indexOf("AccessionNumber");
|
||||||
|
for (int i = 0; i < mSqlModel->rowCount(); ++i)
|
||||||
|
{
|
||||||
|
if (mSqlModel->data(mSqlModel->index(i, patientIdIndex)) == aPatient->ID &&
|
||||||
|
mSqlModel->data(mSqlModel->index(i, accessionNumberIndex)) == aPatient->AccessionNumber)
|
||||||
|
{
|
||||||
|
mTableView->selectRow(i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mSqlModel->setFilter("");
|
||||||
|
aPatient->PatientUID = QUuid::createUuid().toString();
|
||||||
|
aPatient->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),aPatient->val);
|
||||||
|
EDIT_PATIENT()
|
||||||
|
#undef ADD_PATIENT_PROPERTY
|
||||||
|
if (!mSqlModel->submitAll())
|
||||||
|
{
|
||||||
|
mErrorLabel->setText( tr("DB Error,Patient Write Failed"));
|
||||||
|
mErrorLabel->show();
|
||||||
|
}
|
||||||
|
mTableView->selectRow(0);
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,17 +2,25 @@
|
|||||||
#define GUI_GETWORKLISTDIALOG_H
|
#define GUI_GETWORKLISTDIALOG_H
|
||||||
|
|
||||||
#include "dialogs/AsyncActionDialog.h"
|
#include "dialogs/AsyncActionDialog.h"
|
||||||
|
#include "forms/select/PatientInformation.h"
|
||||||
|
|
||||||
class ULineEdit;
|
class ULineEdit;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QSqlTableModel;
|
class QSqlTableModel;
|
||||||
|
class QTableView;
|
||||||
|
class QStandardItemModel;
|
||||||
|
|
||||||
|
enum GetWorkListDialogMode
|
||||||
|
{
|
||||||
|
PatientSearchMode = 0, PatientSelectMode
|
||||||
|
};
|
||||||
|
|
||||||
class GetWorkListDialog : public AsyncActionDialog
|
class GetWorkListDialog : public AsyncActionDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GetWorkListDialog(QSqlTableModel* aSqlModel, QWidget* aParent = nullptr, Qt::WindowFlags aFlags = Qt::WindowFlags());
|
explicit GetWorkListDialog(QSqlTableModel* aSqlModel, QTableView* aTableView, QWidget* aParent = nullptr, Qt::WindowFlags aFlags = Qt::WindowFlags());
|
||||||
~GetWorkListDialog() override;
|
~GetWorkListDialog() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -20,12 +28,25 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void initializeContentWidgets();
|
void initializeContentWidgets();
|
||||||
|
void updatePatientSelectTable();
|
||||||
|
void showPatientSelectTable();
|
||||||
|
void insertPatient(PatientInformationPointer aPatient);
|
||||||
virtual void handleFinishedAction(const ActionResult& aResult) override;
|
virtual void handleFinishedAction(const ActionResult& aResult) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ULineEdit* mAccessionNumber;
|
ULineEdit* mAccessionNumber;
|
||||||
ULineEdit* mPatientId;
|
ULineEdit* mPatientId;
|
||||||
QLabel* mErrorLabel;
|
QLabel* mErrorLabel;
|
||||||
|
QLabel* mAccessionNumText;
|
||||||
|
QLabel* mAccessionNumEndLine;
|
||||||
|
QLabel* mPatientIDText;
|
||||||
|
QLabel* mPatientIDLine;
|
||||||
|
QTableView* mPatientSelectTable;
|
||||||
|
GetWorkListDialogMode mMode;
|
||||||
|
QStandardItemModel* mPatientSelectModel;
|
||||||
|
QSqlTableModel* mSqlModel;
|
||||||
|
QTableView* mTableView;
|
||||||
|
QList<PatientInformationPointer> mSearchedPatients;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "json/jsonobject.h"
|
#include "json/jsonobject.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QDate>
|
||||||
|
|
||||||
WorkListManager::WorkListManager()
|
WorkListManager::WorkListManager()
|
||||||
{
|
{
|
||||||
@@ -14,7 +15,7 @@ WorkListManager::~WorkListManager()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString& aAccessionNum, const QString& aPatientId)
|
QList<PatientInformationPointer> WorkListManager::getPatientFromWorkList(const QString& aAccessionNum, const QString& aPatientId)
|
||||||
{
|
{
|
||||||
DcmSCU scu;
|
DcmSCU scu;
|
||||||
OFString temp_str;
|
OFString temp_str;
|
||||||
@@ -27,6 +28,7 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
|||||||
overrideKeys.push_back("0010,0010");
|
overrideKeys.push_back("0010,0010");
|
||||||
overrideKeys.push_back("0010,0030");
|
overrideKeys.push_back("0010,0030");
|
||||||
overrideKeys.push_back("0010,0040");
|
overrideKeys.push_back("0010,0040");
|
||||||
|
overrideKeys.push_back("0040,0002");
|
||||||
if (!dcmDataDict.isDictionaryLoaded())
|
if (!dcmDataDict.isDictionaryLoaded())
|
||||||
{
|
{
|
||||||
qDebug()<<"dcmdatadict error";
|
qDebug()<<"dcmdatadict error";
|
||||||
@@ -38,7 +40,7 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
|||||||
scu.setACSETimeout(30);
|
scu.setACSETimeout(30);
|
||||||
scu.setDIMSEBlockingMode(DIMSE_BLOCKING);
|
scu.setDIMSEBlockingMode(DIMSE_BLOCKING);
|
||||||
scu.setDIMSETimeout(0);
|
scu.setDIMSETimeout(0);
|
||||||
scu.setAETitle("USCT");
|
scu.setAETitle(serverInfo.name.toLatin1().data());
|
||||||
scu.setPeerHostName(ip.data());
|
scu.setPeerHostName(ip.data());
|
||||||
scu.setPeerPort(OFstatic_cast(Uint16, serverInfo.port.toInt()));
|
scu.setPeerPort(OFstatic_cast(Uint16, serverInfo.port.toInt()));
|
||||||
scu.setPeerAETitle(aeTitle.data());
|
scu.setPeerAETitle(aeTitle.data());
|
||||||
@@ -50,14 +52,14 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
|||||||
{
|
{
|
||||||
qDebug()<<cond.code() <<cond.text();
|
qDebug()<<cond.code() <<cond.text();
|
||||||
qDebug()<<"worklist initNetwork failed";
|
qDebug()<<"worklist initNetwork failed";
|
||||||
return PatientInformationPointer();
|
return QList<PatientInformationPointer>();
|
||||||
}
|
}
|
||||||
cond = scu.negotiateAssociation();
|
cond = scu.negotiateAssociation();
|
||||||
if(cond.bad())
|
if(cond.bad())
|
||||||
{
|
{
|
||||||
qDebug()<<cond.code();//<< "----"<<cond.text();
|
qDebug()<<cond.code();//<< "----"<<cond.text();
|
||||||
qDebug()<<"worklist connect failed";
|
qDebug()<<"worklist connect failed";
|
||||||
return PatientInformationPointer();
|
return QList<PatientInformationPointer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
cond = EC_Normal;
|
cond = EC_Normal;
|
||||||
@@ -65,7 +67,7 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
|||||||
if (pcid == 0)
|
if (pcid == 0)
|
||||||
{
|
{
|
||||||
qDebug()<<"worklist pcid bad";
|
qDebug()<<"worklist pcid bad";
|
||||||
return PatientInformationPointer();
|
return QList<PatientInformationPointer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
DcmFileFormat dcmff;
|
DcmFileFormat dcmff;
|
||||||
@@ -79,42 +81,41 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
|||||||
{
|
{
|
||||||
proc.applyPathWithValue(dset, item);
|
proc.applyPathWithValue(dset, item);
|
||||||
}
|
}
|
||||||
|
QList<PatientInformationPointer> result;
|
||||||
|
|
||||||
PatientInformationPointer result = PatientInformationPointer(new PatientInformation());
|
|
||||||
cond = scu.sendFINDRequest(pcid, dset, &responses);
|
cond = scu.sendFINDRequest(pcid, dset, &responses);
|
||||||
if (!responses.empty())
|
if (responses.size() > 1)
|
||||||
{
|
{
|
||||||
auto item = *responses.begin();
|
for(auto item = responses.begin(); item != responses.end(); ++item)
|
||||||
if (item->m_dataset)
|
|
||||||
{
|
{
|
||||||
|
if ((*item)->m_dataset)
|
||||||
|
{
|
||||||
|
PatientInformationPointer patient = PatientInformationPointer(new PatientInformation());
|
||||||
OFString ID;
|
OFString ID;
|
||||||
OFString Name;
|
OFString Name;
|
||||||
OFString BirthDate;
|
OFString BirthDate;
|
||||||
OFString Sex;
|
OFString Sex;
|
||||||
OFString AccessionNumber;
|
OFString AccessionNumber;
|
||||||
item->m_dataset->findAndGetOFString(DCM_PatientID, ID);
|
OFString scheduledStartDateStr;
|
||||||
|
(*item)->m_dataset->findAndGetOFString(DCM_PatientID, ID);
|
||||||
|
|
||||||
if (ID.empty())
|
if (ID.empty())
|
||||||
{
|
{
|
||||||
return PatientInformationPointer();
|
return QList<PatientInformationPointer>();
|
||||||
}
|
}
|
||||||
item->m_dataset->findAndGetOFString(DCM_PatientName, Name);
|
(*item)->m_dataset->findAndGetOFString(DCM_PatientName, Name);
|
||||||
item->m_dataset->findAndGetOFString(DCM_PatientBirthDate, BirthDate);
|
(*item)->m_dataset->findAndGetOFString(DCM_PatientBirthDate, BirthDate);
|
||||||
item->m_dataset->findAndGetOFString(DCM_PatientSex, Sex);
|
(*item)->m_dataset->findAndGetOFString(DCM_PatientSex, Sex);
|
||||||
item->m_dataset->findAndGetOFString(DCM_AccessionNumber, AccessionNumber);
|
(*item)->m_dataset->findAndGetOFString(DCM_AccessionNumber, AccessionNumber);
|
||||||
result->ID = QString(ID.c_str());
|
(*item)->m_dataset->findAndGetOFString(DCM_ScheduledProcedureStepStartDate, scheduledStartDateStr);
|
||||||
result->Name = QString(Name.c_str());
|
//(*item)->m_dataset->print(std::cerr);
|
||||||
result->BirthDate = QString(BirthDate.c_str()).insert(4,"-").insert(7,"-");
|
patient->ID = QString(ID.c_str());
|
||||||
result->Sex = QString(Sex.c_str());
|
patient->Name = QString(Name.c_str());
|
||||||
result->AccessionNumber = QString(AccessionNumber.c_str());
|
patient->BirthDate = QString(BirthDate.c_str()).insert(4,"-").insert(7,"-");
|
||||||
//if (patientName.bad())
|
patient->Sex = QString(Sex.c_str());
|
||||||
//{
|
patient->AccessionNumber = QString(AccessionNumber.c_str());
|
||||||
// std::cout << patientName.text() << std::endl;
|
patient->ScheduledStartDate = QString(scheduledStartDateStr.c_str());
|
||||||
//}
|
result.push_back(patient);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return PatientInformationPointer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OFListIterator(QRResponse*) iter = responses.begin();
|
OFListIterator(QRResponse*) iter = responses.begin();
|
||||||
@@ -127,7 +128,7 @@ PatientInformationPointer WorkListManager::getPatientFromWorkList(const QString&
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return PatientInformationPointer();
|
return QList<PatientInformationPointer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cond == EC_Normal)
|
if (cond == EC_Normal)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define GUI_WORKLISTMANAGER_H
|
#define GUI_WORKLISTMANAGER_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
#include "forms/select/PatientInformation.h"
|
#include "forms/select/PatientInformation.h"
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ public:
|
|||||||
WorkListManager();
|
WorkListManager();
|
||||||
~WorkListManager();
|
~WorkListManager();
|
||||||
|
|
||||||
static PatientInformationPointer getPatientFromWorkList(const QString& aAccessionNum, const QString& aPatientId);
|
static QList<PatientInformationPointer> getPatientFromWorkList(const QString& aAccessionNum, const QString& aPatientId);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public:
|
|||||||
: QObject()
|
: QObject()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
QString ScheduledStartDate;
|
||||||
PatientInformation* Copy()
|
PatientInformation* Copy()
|
||||||
{
|
{
|
||||||
PatientInformation* n=new PatientInformation;
|
PatientInformation* n=new PatientInformation;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
|
#include <QSqlRecord>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "components/SlideTableView.h"
|
#include "components/SlideTableView.h"
|
||||||
@@ -85,10 +86,7 @@ void SelectFormWidget::initGeneralButtons(QHBoxLayout *layout) {
|
|||||||
connect(mBtnAccount, &QToolButton::clicked, DialogManager::Default(),&DialogManager::requestEditSelfAccount);
|
connect(mBtnAccount, &QToolButton::clicked, DialogManager::Default(),&DialogManager::requestEditSelfAccount);
|
||||||
connect(mBtnWorklist, &QToolButton::clicked, [&]()
|
connect(mBtnWorklist, &QToolButton::clicked, [&]()
|
||||||
{
|
{
|
||||||
if (DialogManager::Default()->requestGetWorkList(mModel) == QDialog::Accepted)
|
DialogManager::Default()->requestGetWorkList(mModel, mPatTable);
|
||||||
{
|
|
||||||
mPatTable->selectRow(0);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +235,7 @@ 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->sort(5, Qt::DescendingOrder);
|
mModel->sort(mModel->record().indexOf("AddDate"), Qt::DescendingOrder);
|
||||||
mModel->select();
|
mModel->select();
|
||||||
mModel->setHeaderData(1, Qt::Horizontal, "ID");
|
mModel->setHeaderData(1, Qt::Horizontal, "ID");
|
||||||
mModel->setHeaderData(2, Qt::Horizontal, tr("AccessionNumber"));
|
mModel->setHeaderData(2, Qt::Horizontal, tr("AccessionNumber"));
|
||||||
|
|||||||
Reference in New Issue
Block a user