Update GUI and Recon connection.
This commit is contained in:
@@ -132,7 +132,7 @@ void DeviceManager::initDevice()
|
|||||||
mStopScanAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_STOP, this, "responseStopScan(const QString&)", this);
|
mStopScanAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_STOP, this, "responseStopScan(const QString&)", this);
|
||||||
mPreviewScanAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_PREVIEW, this, "responsePreviewScan(const QString&)", this);
|
mPreviewScanAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_PREVIEW, this, "responsePreviewScan(const QString&)", this);
|
||||||
mTransferAction = new DmsSyncAction(USRV_XFR, ACT_XFR_START, this, "responseTransfer(const QString&)", this);
|
mTransferAction = new DmsSyncAction(USRV_XFR, ACT_XFR_START, this, "responseTransfer(const QString&)", this);
|
||||||
|
mGetTransferProgressAction = new DmsSyncAction(USRV_XFR, ACT_XFR_PROGRESS_PASSIVE, this, "responseGetTransferProgress(const QString&)", this);
|
||||||
|
|
||||||
//Async action
|
//Async action
|
||||||
mGetScanProgressAction = new DmsAsyncAction(USRV_SCAN, ACT_SCAN_PROGRESS_PASSIVE, this,"responseGetScanProgress(const QString&)", this);
|
mGetScanProgressAction = new DmsAsyncAction(USRV_SCAN, ACT_SCAN_PROGRESS_PASSIVE, this,"responseGetScanProgress(const QString&)", this);
|
||||||
@@ -479,7 +479,7 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
|||||||
emit responseTransfer(aContents);
|
emit responseTransfer(aContents);
|
||||||
break;
|
break;
|
||||||
case ACT_XFR_PROGRESS_PASSIVE :
|
case ACT_XFR_PROGRESS_PASSIVE :
|
||||||
processTransferProgress(aContents);
|
emit responseGetTransferProgress(aContents);
|
||||||
break;
|
break;
|
||||||
case ACT_XFR_PROGRESS_ACTIVE :
|
case ACT_XFR_PROGRESS_ACTIVE :
|
||||||
processTransferProgress(aContents);
|
processTransferProgress(aContents);
|
||||||
@@ -654,7 +654,7 @@ void DeviceManager::startTransfer()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString sql = "SELECT ScanID FROM %1 WHERE State=0 ORDER BY ScanDateTime ASC LIMIT 1";
|
QString sql = "SELECT ScanID FROM %1 WHERE State<200 ORDER BY ScanDateTime ASC LIMIT 1";
|
||||||
QString table = "EScan";
|
QString table = "EScan";
|
||||||
QVariant sqlResult = SQLHelper::queryValue(sql.arg(table));
|
QVariant sqlResult = SQLHelper::queryValue(sql.arg(table));
|
||||||
mIsTransferEmptyScan = true;
|
mIsTransferEmptyScan = true;
|
||||||
@@ -668,7 +668,6 @@ void DeviceManager::startTransfer()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString scanID = sqlResult.toString();
|
QString scanID = sqlResult.toString();
|
||||||
auto host = JsonObject::Instance()->getServer(JsonObject::RECON);
|
auto host = JsonObject::Instance()->getServer(JsonObject::RECON);
|
||||||
mTransferAction->setSendData("{\"MD5\":1, \"dst\":\"" + host.ae + "@" + host.ip +":" + RECON_TRANSFER_PATH + "\", \"src\":\"" + scanID + "\",\"delete\":1,\"active report\":0}");
|
mTransferAction->setSendData("{\"MD5\":1, \"dst\":\"" + host.ae + "@" + host.ip +":" + RECON_TRANSFER_PATH + "\", \"src\":\"" + scanID + "\",\"delete\":1,\"active report\":0}");
|
||||||
@@ -812,6 +811,7 @@ void DeviceManager::processReconQueryScanState(const QMap<QString, int> aResult)
|
|||||||
emitInfoCallback(msg, MessageLevel::Error);
|
emitInfoCallback(msg, MessageLevel::Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
emit updateReconStateFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::createScanReconRecord(const QString& aScanID, const QString& aPatientID, const QString& aReferenceID)
|
void DeviceManager::createScanReconRecord(const QString& aScanID, const QString& aPatientID, const QString& aReferenceID)
|
||||||
@@ -834,6 +834,7 @@ void DeviceManager::initEmptyScanMeasurementID()
|
|||||||
|
|
||||||
void DeviceManager::updateReconState()
|
void DeviceManager::updateReconState()
|
||||||
{
|
{
|
||||||
|
updateTransferProgress();
|
||||||
QString sql = "SELECT ScanID FROM Scan WHERE State != 999";
|
QString sql = "SELECT ScanID FROM Scan WHERE State != 999";
|
||||||
auto result = SQLHelper::queryValues(sql);
|
auto result = SQLHelper::queryValues(sql);
|
||||||
QStringList scanIDs;
|
QStringList scanIDs;
|
||||||
@@ -842,9 +843,31 @@ void DeviceManager::updateReconState()
|
|||||||
scanIDs << variant.toString();
|
scanIDs << variant.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!scanIDs.isEmpty())
|
if(scanIDs.isEmpty())
|
||||||
{
|
{
|
||||||
emit queryScanStatusToRecon(scanIDs);
|
emit updateReconStateFinished();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit queryScanStatusToRecon(scanIDs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceManager::updateTransferProgress()
|
||||||
|
{
|
||||||
|
if(!mIsTransfering)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mTransferProgress = 0;
|
||||||
|
auto result = mGetTransferProgressAction->execute();
|
||||||
|
QJsonObject jsonObj = toJsonObject(result.mData);
|
||||||
|
if(jsonObj["code"].toInt() == 0 )
|
||||||
|
{
|
||||||
|
mTransferProgress = jsonObj["info"].toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DeviceManager::getTransferProgress()
|
||||||
|
{
|
||||||
|
return mTransferProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,11 @@ public:
|
|||||||
void emitErrorCallback(const char *msg);
|
void emitErrorCallback(const char *msg);
|
||||||
void emitInfoCallback(const QString& aMessage,const unsigned int aInfoType);
|
void emitInfoCallback(const QString& aMessage,const unsigned int aInfoType);
|
||||||
bool hasValidEmptyScan();
|
bool hasValidEmptyScan();
|
||||||
|
void updateTransferProgress();
|
||||||
|
int getTransferProgress();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateReconState();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
@@ -98,7 +103,6 @@ private:
|
|||||||
void getScanProcess();
|
void getScanProcess();
|
||||||
void startTransfer();
|
void startTransfer();
|
||||||
void initEmptyScanMeasurementID();
|
void initEmptyScanMeasurementID();
|
||||||
void updateReconState();
|
|
||||||
|
|
||||||
void processScanProcess(const QString& aProgress);
|
void processScanProcess(const QString& aProgress);
|
||||||
void prepareFinishScan(bool isNormalFinish, const QString& aReason = "");
|
void prepareFinishScan(bool isNormalFinish, const QString& aReason = "");
|
||||||
@@ -132,15 +136,18 @@ signals:
|
|||||||
void responsePreviewScan(const QString& aResponse);
|
void responsePreviewScan(const QString& aResponse);
|
||||||
void responseGetSoftwareVersion(const QString& aSoftwareVersion);
|
void responseGetSoftwareVersion(const QString& aSoftwareVersion);
|
||||||
void responseTransfer(const QString& aResponse);
|
void responseTransfer(const QString& aResponse);
|
||||||
|
void responseGetTransferProgress(const QString& aProgress);
|
||||||
//Recon
|
//Recon
|
||||||
void createEmptyScanToRecon(const QString& aScanID, const QString& aPath);
|
void createEmptyScanToRecon(const QString& aScanID, const QString& aPath);
|
||||||
void createScanToRecon(const QString& aScanID, const QString& aPatientID, const QString& aReferenceID, const QString& aPath);
|
void createScanToRecon(const QString& aScanID, const QString& aPatientID, const QString& aReferenceID, const QString& aPath);
|
||||||
void queryScanStatusToRecon(const QStringList& aScanIDs);
|
void queryScanStatusToRecon(const QStringList& aScanIDs);
|
||||||
|
void updateReconStateFinished();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mTemperatureTimer = -1;
|
int mTemperatureTimer = -1;
|
||||||
int mScanProgressTimer = -1;
|
int mScanProgressTimer = -1;
|
||||||
|
int mTransferProgress = 0;
|
||||||
bool mIsEmptyScan = false;
|
bool mIsEmptyScan = false;
|
||||||
bool mIsTransferEmptyScan = false;
|
bool mIsTransferEmptyScan = false;
|
||||||
bool mIsScanning = false;
|
bool mIsScanning = false;
|
||||||
@@ -164,6 +171,7 @@ private:
|
|||||||
DmsSyncAction* mCEScanAction = nullptr;
|
DmsSyncAction* mCEScanAction = nullptr;
|
||||||
DmsSyncAction* mStopScanAction = nullptr;
|
DmsSyncAction* mStopScanAction = nullptr;
|
||||||
DmsSyncAction* mTransferAction = nullptr;
|
DmsSyncAction* mTransferAction = nullptr;
|
||||||
|
DmsSyncAction* mGetTransferProgressAction = nullptr;
|
||||||
|
|
||||||
DmsAsyncAction* mGetDeviceTemperatureAction = nullptr;
|
DmsAsyncAction* mGetDeviceTemperatureAction = nullptr;
|
||||||
DmsAsyncAction* mGetScanProgressAction = nullptr;
|
DmsAsyncAction* mGetScanProgressAction = nullptr;
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
|
|
||||||
#include "components/SlideTableView.h"
|
#include "components/SlideTableView.h"
|
||||||
#include "db/SQLHelper.h"
|
#include "db/SQLHelper.h"
|
||||||
|
#include "device/DeviceManager.h"
|
||||||
#include "ScanSearchCriteriaForm.h"
|
#include "ScanSearchCriteriaForm.h"
|
||||||
|
#include "ReconStateDelegate.h"
|
||||||
|
|
||||||
ReconFormWidget::ReconFormWidget(QWidget *parent)
|
ReconFormWidget::ReconFormWidget(QWidget *parent)
|
||||||
: TabFormWidget(parent)
|
: TabFormWidget(parent)
|
||||||
@@ -16,9 +18,9 @@ ReconFormWidget::ReconFormWidget(QWidget *parent)
|
|||||||
, mBtnDelete(new QToolButton(this))
|
, mBtnDelete(new QToolButton(this))
|
||||||
, mBtnRefresh(new QToolButton(this))
|
, mBtnRefresh(new QToolButton(this))
|
||||||
, mScanTable(new SlideTableView(this))
|
, mScanTable(new SlideTableView(this))
|
||||||
, mModel(nullptr){
|
, mSearchWidget(new ScanSearchCriteriaForm(this))
|
||||||
|
, mModel(nullptr)
|
||||||
|
{
|
||||||
auto layout = new QHBoxLayout(ui->commandWidget);
|
auto layout = new QHBoxLayout(ui->commandWidget);
|
||||||
layout->setAlignment(Qt::AlignmentFlag::AlignLeft);
|
layout->setAlignment(Qt::AlignmentFlag::AlignLeft);
|
||||||
mBtnDiscard->setObjectName("btnDiscard");
|
mBtnDiscard->setObjectName("btnDiscard");
|
||||||
@@ -37,17 +39,24 @@ ReconFormWidget::ReconFormWidget(QWidget *parent)
|
|||||||
initDataModel();
|
initDataModel();
|
||||||
//Init content widget
|
//Init content widget
|
||||||
|
|
||||||
QWidget * widget = new ScanSearchCriteriaForm(this);
|
mSearchWidget->setObjectName("SearchCriteriaForm");
|
||||||
widget->setObjectName("SearchCriteriaForm");
|
ui->horizontalLayout->insertWidget(0, mSearchWidget);
|
||||||
ui->horizontalLayout->insertWidget(0,widget);
|
|
||||||
insertVerticalLine(1,ui->horizontalLayout);
|
insertVerticalLine(1,ui->horizontalLayout);
|
||||||
auto* contentLayout = new QHBoxLayout(this->ui->contentWidget);
|
auto* contentLayout = new QHBoxLayout(this->ui->contentWidget);
|
||||||
contentLayout->setContentsMargins(0, 0, 0, 0);
|
contentLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
initTableView(contentLayout);
|
initTableView(contentLayout);
|
||||||
|
|
||||||
|
connect(mBtnRefresh, &QToolButton::clicked, DeviceManager::Default(), &DeviceManager::updateReconState);
|
||||||
|
connect(DeviceManager::Default(), &DeviceManager::updateReconStateFinished, mModel, &QSqlTableModel::select);
|
||||||
|
connect(mSearchWidget, &ScanSearchCriteriaForm::searchFilterUpdated, this, &ReconFormWidget::updateSearchFilter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReconFormWidget::initTableView(QHBoxLayout *contentLayout) {// TableView for Scan
|
void ReconFormWidget::initTableView(QHBoxLayout *contentLayout)
|
||||||
|
{
|
||||||
|
// TableView for Scan
|
||||||
|
ReconStateDelegate* delegate = new ReconStateDelegate(this);
|
||||||
|
mScanTable->setItemDelegateForColumn(8, delegate);
|
||||||
mScanTable->setAlternatingRowColors(true);
|
mScanTable->setAlternatingRowColors(true);
|
||||||
mScanTable->setSelectionMode(QAbstractItemView::SingleSelection);
|
mScanTable->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
mScanTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
mScanTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
@@ -60,30 +69,41 @@ void ReconFormWidget::initTableView(QHBoxLayout *contentLayout) {// TableView fo
|
|||||||
mScanTable->viewport()->ungrabGesture(Qt::PanGesture);
|
mScanTable->viewport()->ungrabGesture(Qt::PanGesture);
|
||||||
|
|
||||||
mScanTable->setSortingEnabled(true); // enable sortingEnabled
|
mScanTable->setSortingEnabled(true); // enable sortingEnabled
|
||||||
mScanTable->setModel((QAbstractItemModel*) mModel);
|
mScanTable->setModel(mModel);
|
||||||
mScanTable->hideColumn(0);
|
mScanTable->hideColumn(0);
|
||||||
mScanTable->hideColumn(1);
|
mScanTable->hideColumn(1);
|
||||||
mScanTable->show();
|
mScanTable->hideColumn(4);
|
||||||
|
|
||||||
mScanTable->setColumnWidth(2, 250);
|
mScanTable->setColumnWidth(2, 250);
|
||||||
mScanTable->setColumnWidth(3, 200);
|
mScanTable->setColumnWidth(3, 250);
|
||||||
mScanTable->setColumnWidth(4, 160);
|
|
||||||
mScanTable->setColumnWidth(5, 250);
|
mScanTable->setColumnWidth(5, 250);
|
||||||
mScanTable->setColumnWidth(6, 250);
|
mScanTable->setColumnWidth(6, 100);
|
||||||
|
mScanTable->setColumnWidth(7, 250);
|
||||||
contentLayout->addWidget(mScanTable);
|
contentLayout->addWidget(mScanTable);
|
||||||
|
|
||||||
|
mScanTable->show();
|
||||||
//table current row selection changing event
|
//table current row selection changing event
|
||||||
|
|
||||||
// after sort by column
|
// after sort by column
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReconFormWidget::initDataModel() {//TODO:单独初始化预防SQL错误
|
void ReconFormWidget::initDataModel()
|
||||||
|
{
|
||||||
|
//TODO:单独初始化预防SQL错误
|
||||||
mModel = SQLHelper::getTable("Scan");
|
mModel = SQLHelper::getTable("Scan");
|
||||||
mModel->sort(5, Qt::DescendingOrder);
|
mModel->sort(3, Qt::DescendingOrder);
|
||||||
mModel->select();
|
updateSearchFilter();
|
||||||
mModel->setHeaderData(2, Qt::Horizontal, "PatientID");
|
|
||||||
|
mModel->setHeaderData(2, Qt::Horizontal, tr("PatientID"));
|
||||||
mModel->setHeaderData(5, Qt::Horizontal, tr("PatientName"));
|
mModel->setHeaderData(5, Qt::Horizontal, tr("PatientName"));
|
||||||
mModel->setHeaderData(3, Qt::Horizontal, tr("Scan Time"));
|
mModel->setHeaderData(3, Qt::Horizontal, tr("Scan Time"));
|
||||||
mModel->setHeaderData(6, Qt::Horizontal, tr("Laterality"));
|
mModel->setHeaderData(6, Qt::Horizontal, tr("Laterality"));
|
||||||
mModel->setHeaderData(7, Qt::Horizontal, tr("OperatorName"));
|
mModel->setHeaderData(7, Qt::Horizontal, tr("OperatorName"));
|
||||||
mModel->setHeaderData(8, Qt::Horizontal, tr("State"));
|
mModel->setHeaderData(8, Qt::Horizontal, tr("State"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReconFormWidget::updateSearchFilter()
|
||||||
|
{
|
||||||
|
mModel->setFilter(mSearchWidget->getSearchFilter());
|
||||||
|
mModel->select();
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,21 +3,29 @@
|
|||||||
#define IMG1_V2_BIN_RECONFORMWIDGET_H
|
#define IMG1_V2_BIN_RECONFORMWIDGET_H
|
||||||
|
|
||||||
#include "forms/TabFormWidget.h"
|
#include "forms/TabFormWidget.h"
|
||||||
|
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
class SlideTableView;
|
class SlideTableView;
|
||||||
class QSqlTableModel;
|
class QSqlTableModel;
|
||||||
class ReconFormWidget: public TabFormWidget {
|
class ScanSearchCriteriaForm;
|
||||||
|
|
||||||
|
class ReconFormWidget: public TabFormWidget
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ReconFormWidget(QWidget *parent = nullptr);
|
explicit ReconFormWidget(QWidget *parent = nullptr);
|
||||||
|
|
||||||
~ReconFormWidget() override = default;
|
~ReconFormWidget() override = default;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateSearchFilter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QToolButton* mBtnDiscard;
|
QToolButton* mBtnDiscard;
|
||||||
QToolButton* mBtnDelete;
|
QToolButton* mBtnDelete;
|
||||||
QToolButton* mBtnRefresh;
|
QToolButton* mBtnRefresh;
|
||||||
SlideTableView* mScanTable;
|
SlideTableView* mScanTable;
|
||||||
|
ScanSearchCriteriaForm* mSearchWidget;
|
||||||
QSqlTableModel *mModel;
|
QSqlTableModel *mModel;
|
||||||
|
|
||||||
void initTableView(QHBoxLayout *contentLayout);
|
void initTableView(QHBoxLayout *contentLayout);
|
||||||
|
|||||||
87
src/forms/recon/ReconStateDelegate.cpp
Normal file
87
src/forms/recon/ReconStateDelegate.cpp
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#include "ReconStateDelegate.h"
|
||||||
|
#include "device/DeviceManager.h"
|
||||||
|
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QProgressBar>
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
ReconStateDelegate::ReconStateDelegate(QObject* aParent)
|
||||||
|
: QStyledItemDelegate(aParent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReconStateDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
QVariant data = index.data(Qt::DisplayRole);
|
||||||
|
|
||||||
|
if (data.isValid())
|
||||||
|
{
|
||||||
|
int state = data.toInt();
|
||||||
|
QString displayText;
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
displayText = tr("Wait to transfer");
|
||||||
|
break;
|
||||||
|
case 100:
|
||||||
|
{
|
||||||
|
displayText = tr("Transfering");
|
||||||
|
int progress = DeviceManager::Default()->getTransferProgress();
|
||||||
|
QRect textRect = option.rect;
|
||||||
|
textRect.setRight(option.rect.right() - 300);
|
||||||
|
painter->drawText(textRect, Qt::AlignCenter, displayText);
|
||||||
|
|
||||||
|
QRect progressBarRect = option.rect;
|
||||||
|
progressBarRect.setLeft(textRect.right() + 20);
|
||||||
|
progressBarRect.setRight(option.rect.right() - 5);
|
||||||
|
progressBarRect.setTop(option.rect.top() + 5);
|
||||||
|
progressBarRect.setBottom(option.rect.bottom() - 5);
|
||||||
|
|
||||||
|
QStyleOptionProgressBarV2 progressBarOption;
|
||||||
|
progressBarOption.rect = progressBarRect;
|
||||||
|
progressBarOption.minimum = 0;
|
||||||
|
progressBarOption.maximum = 100;
|
||||||
|
progressBarOption.progress = progress;
|
||||||
|
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case 104:
|
||||||
|
displayText = tr("Transfer failed");
|
||||||
|
break;
|
||||||
|
case 200:
|
||||||
|
displayText = tr("Transfer completed");
|
||||||
|
break;
|
||||||
|
case 204:
|
||||||
|
displayText = tr("Recon create failed");
|
||||||
|
break;
|
||||||
|
case 300:
|
||||||
|
displayText = tr("Recon create succeed");
|
||||||
|
break;
|
||||||
|
case 400:
|
||||||
|
displayText = tr("Wait to recon");
|
||||||
|
break;
|
||||||
|
case 500:
|
||||||
|
displayText = tr("Recon ing");
|
||||||
|
break;
|
||||||
|
case 504:
|
||||||
|
displayText = tr("Recon failed");
|
||||||
|
break;
|
||||||
|
case 600:
|
||||||
|
displayText = tr("Recon succeed");
|
||||||
|
break;
|
||||||
|
case 604:
|
||||||
|
displayText = tr("PACS failed");
|
||||||
|
break;
|
||||||
|
case 999:
|
||||||
|
displayText = tr("PACS succeed");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
displayText = tr("Unknow");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
painter->drawText(option.rect, Qt::AlignCenter, displayText);
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/forms/recon/ReconStateDelegate.h
Normal file
15
src/forms/recon/ReconStateDelegate.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef RECONSTATEDELEGATE_H
|
||||||
|
#define RECONSTATEDELEGATE_H
|
||||||
|
|
||||||
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
|
class ReconStateDelegate : public QStyledItemDelegate
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ReconStateDelegate(QObject* aParent);
|
||||||
|
|
||||||
|
void paint(QPainter *aPainter, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RECONSTATEDELEGATE_H
|
||||||
@@ -3,15 +3,17 @@
|
|||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include "components/ListBox.h"
|
#include "components/ListBox.h"
|
||||||
|
#include "dialogs/DialogManager.h"
|
||||||
|
|
||||||
ScanSearchCriteriaForm::ScanSearchCriteriaForm(QWidget *parent) :
|
ScanSearchCriteriaForm::ScanSearchCriteriaForm(QWidget *parent)
|
||||||
QWidget(parent),
|
: QWidget(parent)
|
||||||
ui(new Ui::ScanSearchCriteriaForm)
|
, ui(new Ui::ScanSearchCriteriaForm)
|
||||||
|
, mSearchFilter()
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
auto beginBox = new ListBox(this);
|
auto beginBox = new ListBox(this);
|
||||||
// beginBox->setSmallBox(true);
|
// beginBox->setSmallBox(true);
|
||||||
ui->verticalLayoutDate->replaceWidget(ui->mLBBeginDate,beginBox);
|
ui->verticalLayoutDate->replaceWidget(ui->mLBBeginDate,beginBox);
|
||||||
ui->mLBBeginDate->setVisible(false);
|
ui->mLBBeginDate->setVisible(false);
|
||||||
ui->mLBBeginDate->deleteLater();
|
ui->mLBBeginDate->deleteLater();
|
||||||
@@ -21,7 +23,7 @@ ScanSearchCriteriaForm::ScanSearchCriteriaForm(QWidget *parent) :
|
|||||||
ui->mLBBeginDate->setText(QDate::currentDate().toString("yyyy-MM-dd"));
|
ui->mLBBeginDate->setText(QDate::currentDate().toString("yyyy-MM-dd"));
|
||||||
|
|
||||||
auto endBox = new ListBox(this);
|
auto endBox = new ListBox(this);
|
||||||
// endBox->setSmallBox(true);
|
// endBox->setSmallBox(true);
|
||||||
ui->verticalLayoutDate->replaceWidget(ui->mLBEndDate,endBox);
|
ui->verticalLayoutDate->replaceWidget(ui->mLBEndDate,endBox);
|
||||||
ui->mLBEndDate->setVisible(false);
|
ui->mLBEndDate->setVisible(false);
|
||||||
ui->mLBEndDate->deleteLater();
|
ui->mLBEndDate->deleteLater();
|
||||||
@@ -33,9 +35,71 @@ ScanSearchCriteriaForm::ScanSearchCriteriaForm(QWidget *parent) :
|
|||||||
ui->ScanTitle->setObjectName("parameterTitle");
|
ui->ScanTitle->setObjectName("parameterTitle");
|
||||||
|
|
||||||
ui->holder1->setObjectName("endSpaceLine");
|
ui->holder1->setObjectName("endSpaceLine");
|
||||||
|
|
||||||
|
connect(ui->mLBEndDate, &QToolButton::clicked, [=]()
|
||||||
|
{
|
||||||
|
DialogResult result = DialogManager::Default()->requestSelectDate(ui->mLBEndDate->text());
|
||||||
|
if (result.ResultCode == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
ui->mLBEndDate->setText(result.ResultData.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->mLBBeginDate, &QToolButton::clicked, [=]()
|
||||||
|
{
|
||||||
|
DialogResult result = DialogManager::Default()->requestSelectDate(ui->mLBEndDate->text());
|
||||||
|
if (result.ResultCode == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
ui->mLBBeginDate->setText(result.ResultData.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->mBtnToday, &QToolButton::clicked, [=]()
|
||||||
|
{
|
||||||
|
QString today = QDate::currentDate().toString("yyyy-MM-dd");
|
||||||
|
ui->mLBEndDate->setText(today);
|
||||||
|
ui->mLBBeginDate->setText(today);
|
||||||
|
updateSearchFilter();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->mBtnSevenDays, &QToolButton::clicked, [=]()
|
||||||
|
{
|
||||||
|
ui->mLBEndDate->setText(QDate::currentDate().toString("yyyy-MM-dd"));
|
||||||
|
ui->mLBBeginDate->setText(QDate::currentDate().addDays(-7).toString("yyyy-MM-dd"));
|
||||||
|
updateSearchFilter();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->mBtnYesterday, &QToolButton::clicked, [=]()
|
||||||
|
{
|
||||||
|
QString yesterday = QDate::currentDate().addDays(-1).toString("yyyy-MM-dd");
|
||||||
|
ui->mLBEndDate->setText(yesterday);
|
||||||
|
ui->mLBBeginDate->setText(yesterday);
|
||||||
|
updateSearchFilter();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->mBtnAll, &QToolButton::clicked, [=]()
|
||||||
|
{
|
||||||
|
QString today = QDate::currentDate().toString("yyyy-MM-dd");
|
||||||
|
ui->mLBEndDate->setText(today);
|
||||||
|
ui->mLBBeginDate->setText("1990-01-01");
|
||||||
|
updateSearchFilter();
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->mBtnDates, &QPushButton::clicked, this, &ScanSearchCriteriaForm::updateSearchFilter);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanSearchCriteriaForm::~ScanSearchCriteriaForm()
|
ScanSearchCriteriaForm::~ScanSearchCriteriaForm()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ScanSearchCriteriaForm::getSearchFilter()
|
||||||
|
{
|
||||||
|
return QString("ScanDateTime >= '%1 00:00:00' And ScanDateTime <= '%2 23:59:59'").arg(ui->mLBBeginDate->text()).arg(ui->mLBEndDate->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScanSearchCriteriaForm::updateSearchFilter()
|
||||||
|
{
|
||||||
|
emit searchFilterUpdated();
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,8 +15,17 @@ public:
|
|||||||
explicit ScanSearchCriteriaForm(QWidget *parent = nullptr);
|
explicit ScanSearchCriteriaForm(QWidget *parent = nullptr);
|
||||||
~ScanSearchCriteriaForm();
|
~ScanSearchCriteriaForm();
|
||||||
|
|
||||||
|
QString getSearchFilter();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateSearchFilter();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void searchFilterUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ScanSearchCriteriaForm *ui;
|
Ui::ScanSearchCriteriaForm *ui;
|
||||||
|
QString mSearchFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SCANSEARCHCRITERIAFORM_H
|
#endif // SCANSEARCHCRITERIAFORM_H
|
||||||
|
|||||||
@@ -66,12 +66,12 @@ void ReconManager::createScan(const QString& aScanID, const QString& aPatientID,
|
|||||||
auto response = mReconClient->Create(scan);
|
auto response = mReconClient->Create(scan);
|
||||||
if(response.good())
|
if(response.good())
|
||||||
{
|
{
|
||||||
qDebug()<< "create scan success, scanID: "<< aScanID;
|
qDebug()<< "Recon create scan success, scanID: "<< aScanID;
|
||||||
emit createScanResponsed(true, aScanID);
|
emit createScanResponsed(true, aScanID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug()<< "Create scan fail by " << response.error().data();
|
qDebug()<< "Recon create scan failed by " << response.error().data();
|
||||||
emit createScanResponsed(false, aScanID, response.error().data());
|
emit createScanResponsed(false, aScanID, response.error().data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,6 +85,7 @@ void ReconManager::queryReconStatus(const QStringList& aScanIDs)
|
|||||||
auto response = mReconClient->QueryScan(scanID.toStdString(), state);
|
auto response = mReconClient->QueryScan(scanID.toStdString(), state);
|
||||||
if(response.bad())
|
if(response.bad())
|
||||||
{
|
{
|
||||||
|
qDebug()<< "Recon query failed by " << response.error().data();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result.insert(scanID, state);
|
result.insert(scanID, state);
|
||||||
|
|||||||
Reference in New Issue
Block a user