Enable the worklist to retrieve more results based on different combinations of Patient ID and accession number.

This commit is contained in:
sunwen
2023-08-28 16:31:52 +08:00
parent 89ccd96278
commit 52605ed981
11 changed files with 239 additions and 113 deletions

View File

@@ -2,7 +2,7 @@
#define GUI_ASYNCACTION_H
#include <QObject>
#include <QString>
#include <QVariant>
#include <QRunnable>
#include <QSharedPointer>
@@ -14,13 +14,13 @@ enum ActionCode :unsigned int
class ActionResult
{
public:
ActionResult(ActionCode aCode = Sucessed, const QString& aMessage = "")
ActionResult(ActionCode aCode = Sucessed, const QVariant& aData = QVariant())
{
Code = aCode;
Message = aMessage;
Data = aData;
}
ActionCode Code;
QString Message;
QVariant Data;
};
class AsyncAction : public QObject, public QRunnable

View File

@@ -1,11 +1,6 @@
#include "GetWorkListAction.h"
#include "dicom/WorkListManager.h"
#include <QThread>
#include <QDateTime>
#include <QSqlTableModel>
#include <QUuid>
#include <QDebug>
#include "forms/select/PatientInformation.h"
GetWorkListAction::GetWorkListAction(QObject* aParent)
: AsyncAction(aParent)
@@ -23,8 +18,15 @@ void GetWorkListAction::run()
{
if (!mQueryData.isEmpty())
{
PatientInformationPointer info = WorkListManager::getPatientFromWorkList(mQueryData.mAccessionNum, mQueryData.mPatientId);
emit actionCompleted(insertPatientFromWorkList(info));
QList<PatientInformationPointer> patients = WorkListManager::getPatientFromWorkList(mQueryData.mAccessionNum, mQueryData.mPatientId);
if(patients.isEmpty())
{
emit actionCompleted(ActionResult(Failed,tr("WorkList Search Failed")));
}
else
{
emit actionCompleted(ActionResult(Sucessed, QVariant::fromValue(patients)));
}
}
else
{
@@ -41,37 +43,3 @@ 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

@@ -2,7 +2,6 @@
#define GUI_GETWORKLISTACTION_H
#include "AsyncAction.h"
#include "forms/select/PatientInformation.h"
class QSqlTableModel;
@@ -35,12 +34,10 @@ public:
void setWorkListQueryData(const WorkListQueryData& aQueryData);
void setSqlModel(QSqlTableModel* aSqlModel);
private:
ActionResult insertPatientFromWorkList(PatientInformationPointer aPatientInformation);
private:
WorkListQueryData mQueryData;
QSqlTableModel* mSqlModel;
};
#endif //GUI_GETWORKLISTACTION_H
#endif //GUI_GETWORKLISTACTION_H