|
|
|
|
@@ -3,57 +3,59 @@
|
|
|
|
|
//
|
|
|
|
|
#include "ui_tabformwidget.h"
|
|
|
|
|
#include "SelectFormWidget.h"
|
|
|
|
|
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QTableWidget>
|
|
|
|
|
#include "components/SlideTableView.h"
|
|
|
|
|
#include <QScroller>
|
|
|
|
|
#include <QHeaderView>
|
|
|
|
|
#include <QUuid>
|
|
|
|
|
#include <QDate>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
|
|
#include "components/SlideTableView.h"
|
|
|
|
|
#include "db/SQLHelper.h"
|
|
|
|
|
#include "guimacros.h"
|
|
|
|
|
#include "event/EventCenter.h"
|
|
|
|
|
#include "src/dialogs/AccountFormDialog.h"
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include "log/UserOperationLog.h"
|
|
|
|
|
#include "src/components/VerticalTextToolButton.h"
|
|
|
|
|
#include "dialogs/AccountFormDialog.h"
|
|
|
|
|
#include "dialogs/AlertDialog.h"
|
|
|
|
|
#include "log/UserOperationLog.h"
|
|
|
|
|
#include "components/VerticalTextToolButton.h"
|
|
|
|
|
|
|
|
|
|
#include <QScroller>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|
|
|
|
TabFormWidget(parent)
|
|
|
|
|
SelectFormWidget::SelectFormWidget(QWidget* parent)
|
|
|
|
|
: TabFormWidget(parent)
|
|
|
|
|
, mBtnAccount(new QToolButton(this))
|
|
|
|
|
, mBtnWorklist(new QToolButton(this))
|
|
|
|
|
, mBtnAdd(new QToolButton(this))
|
|
|
|
|
, mBtnEdit(new QToolButton(this))
|
|
|
|
|
, mBtnDelete(new QToolButton(this))
|
|
|
|
|
, mBtnSelect(new QToolButton(this))
|
|
|
|
|
{
|
|
|
|
|
//init command bar
|
|
|
|
|
QHBoxLayout* layout = new QHBoxLayout();
|
|
|
|
|
auto layout = new QHBoxLayout();
|
|
|
|
|
ui->commandWidget->setLayout(layout);
|
|
|
|
|
ADD_TOOL_BTN(Account, ":/icons/account.png");
|
|
|
|
|
ADD_TOOL_BTN(Worklist, ":/icons/setting.png");
|
|
|
|
|
btnAccount->setText(tr("Account"));
|
|
|
|
|
btnWorklist->setText(tr("Worklist"));
|
|
|
|
|
INIT_TOOL_BTN(Account, ":/icons/account.png")
|
|
|
|
|
INIT_TOOL_BTN(Worklist, ":/icons/setting.png")
|
|
|
|
|
mBtnAccount->setText(tr("Account"));
|
|
|
|
|
mBtnWorklist->setText(tr("Worklist"));
|
|
|
|
|
|
|
|
|
|
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
|
|
|
|
QWidget* spacerLine = new QWidget(this);
|
|
|
|
|
spacerLine->setFixedWidth(2);
|
|
|
|
|
spacerLine->setObjectName("verSpaceLine");
|
|
|
|
|
layout->addWidget(spacerLine);
|
|
|
|
|
ADD_TOOL_BTN(Add, ":/icons/add.png");
|
|
|
|
|
ADD_TOOL_BTN(Edit, ":/icons/details.png");
|
|
|
|
|
ADD_TOOL_BTN(Delete, ":/icons/close_circle.png");
|
|
|
|
|
ADD_TOOL_BTN(Select, ":/icons/selected.png");
|
|
|
|
|
btnAdd->setText(tr("Add"));
|
|
|
|
|
btnEdit->setText(tr("Edit"));
|
|
|
|
|
btnDelete->setText(tr("Delete"));
|
|
|
|
|
btnSelect->setText(tr("Select"));
|
|
|
|
|
addVerticalLine(layout);
|
|
|
|
|
INIT_TOOL_BTN(Add, ":/icons/add.png")
|
|
|
|
|
INIT_TOOL_BTN(Edit, ":/icons/details.png")
|
|
|
|
|
INIT_TOOL_BTN(Delete, ":/icons/close_circle.png")
|
|
|
|
|
INIT_TOOL_BTN(Select, ":/icons/selected.png")
|
|
|
|
|
mBtnAdd->setText(tr("Add"));
|
|
|
|
|
mBtnEdit->setText(tr("Edit"));
|
|
|
|
|
mBtnDelete->setText(tr("Delete"));
|
|
|
|
|
mBtnSelect->setText(tr("Select"));
|
|
|
|
|
|
|
|
|
|
//Init content widget
|
|
|
|
|
QHBoxLayout* contentLayout = new QHBoxLayout();
|
|
|
|
|
auto* contentLayout = new QHBoxLayout();
|
|
|
|
|
contentLayout->setContentsMargins(5, 5, 0, 5);
|
|
|
|
|
this->ui->contentWidget->setLayout(contentLayout);
|
|
|
|
|
// TableView for patient
|
|
|
|
|
SlideTableView* table = new SlideTableView(this);
|
|
|
|
|
auto table = new SlideTableView(this);
|
|
|
|
|
table->setAlternatingRowColors(true);
|
|
|
|
|
table->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
|
table->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
|
|
|
@@ -88,12 +90,9 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|
|
|
|
table->setColumnWidth(4, 120);
|
|
|
|
|
table->setColumnWidth(5, 250);
|
|
|
|
|
contentLayout->addWidget(table);
|
|
|
|
|
QWidget* spacerLine2 = new QWidget(this);
|
|
|
|
|
spacerLine2->setFixedWidth(2);
|
|
|
|
|
spacerLine2->setObjectName("verSpaceLine");
|
|
|
|
|
contentLayout->addWidget(spacerLine2);
|
|
|
|
|
addVerticalLine(layout);
|
|
|
|
|
// prepare edit panel
|
|
|
|
|
EditPatientForm* edit_patient = new EditPatientForm(this);
|
|
|
|
|
auto edit_patient = new EditPatientForm(this);
|
|
|
|
|
edit_patient->setObjectName("edit_patient");
|
|
|
|
|
edit_patient->hide();
|
|
|
|
|
contentLayout->addWidget(edit_patient);
|
|
|
|
|
@@ -128,10 +127,10 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|
|
|
|
//prepare button state
|
|
|
|
|
auto prepareButtons = [=](bool disableALL){
|
|
|
|
|
bool state_flag = (table->currentIndex().row()>=0);
|
|
|
|
|
btnSelect->setEnabled(state_flag && !disableALL);
|
|
|
|
|
btnDelete->setEnabled(state_flag && !disableALL);
|
|
|
|
|
btnEdit->setEnabled(state_flag && !disableALL);
|
|
|
|
|
btnAdd->setEnabled(!disableALL);
|
|
|
|
|
mBtnSelect->setEnabled(state_flag && !disableALL);
|
|
|
|
|
mBtnDelete->setEnabled(state_flag && !disableALL);
|
|
|
|
|
mBtnEdit->setEnabled(state_flag && !disableALL);
|
|
|
|
|
mBtnAdd->setEnabled(!disableALL);
|
|
|
|
|
};
|
|
|
|
|
//table current row selection changing event
|
|
|
|
|
connect(table, &SlideTableView::currentRowChanged, [=](int row) {
|
|
|
|
|
@@ -150,7 +149,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// btn add slot
|
|
|
|
|
connect(btnAdd, &QToolButton::clicked, [=]() {
|
|
|
|
|
connect(mBtnAdd, &QToolButton::clicked, [=]() {
|
|
|
|
|
EditPatientDialog dialog(this);
|
|
|
|
|
dialog.clearPatientInformation();
|
|
|
|
|
dialog.setWindowModality(Qt::WindowModal);
|
|
|
|
|
@@ -160,13 +159,13 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|
|
|
|
table->selectRow(0);
|
|
|
|
|
model->selectRow(0);
|
|
|
|
|
LOG_USER_OPERATION(AddPatient)
|
|
|
|
|
btnSelect->setEnabled(true);
|
|
|
|
|
mBtnSelect->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// btn edit slot
|
|
|
|
|
connect(btnEdit, &QToolButton::clicked, [=]() {
|
|
|
|
|
// mBtn edit slot
|
|
|
|
|
connect(mBtnEdit, &QToolButton::clicked, [=]() {
|
|
|
|
|
EditPatientDialog dialog(this);
|
|
|
|
|
dialog.setPatientInformation(edit_patient->getPatientInformation());
|
|
|
|
|
dialog.setWindowModality(Qt::WindowModal);
|
|
|
|
|
@@ -175,15 +174,15 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|
|
|
|
if (dialog.exec() == QDialog::Accepted) {
|
|
|
|
|
table->clicked(table->currentIndex());
|
|
|
|
|
setPatientDetail(table, model, edit_patient);
|
|
|
|
|
LOG_USER_OPERATION(AddPatient);
|
|
|
|
|
btnSelect->setEnabled(true);
|
|
|
|
|
LOG_USER_OPERATION(AddPatient)
|
|
|
|
|
mBtnSelect->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// btn add slot
|
|
|
|
|
// mBtn add slot
|
|
|
|
|
connect(edit_patient, &EditPatientForm::editCancel, [=]() {
|
|
|
|
|
if (table->currentIndex().row()<0) return;
|
|
|
|
|
btnSelect->setEnabled(true);
|
|
|
|
|
mBtnSelect->setEnabled(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// EditPatientForm editAccept slot
|
|
|
|
|
@@ -217,11 +216,11 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|
|
|
|
{
|
|
|
|
|
LOG_USER_OPERATION(ChangePatientInfo)
|
|
|
|
|
}
|
|
|
|
|
btnSelect->setEnabled(true);
|
|
|
|
|
mBtnSelect->setEnabled(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// btn delete slot
|
|
|
|
|
connect(btnDelete, &QToolButton::clicked, [=]() {
|
|
|
|
|
connect(mBtnDelete, &QToolButton::clicked, [=]() {
|
|
|
|
|
if (table->currentIndex().row()<0) return;
|
|
|
|
|
AlertDialog dialog(this);
|
|
|
|
|
dialog.setWindowModality(Qt::WindowModal);
|
|
|
|
|
@@ -263,16 +262,16 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// btn select slot
|
|
|
|
|
connect(btnSelect, &QToolButton::clicked, [=]() {
|
|
|
|
|
// mBtn select slot
|
|
|
|
|
connect(mBtnSelect, &QToolButton::clicked, [=]() {
|
|
|
|
|
|
|
|
|
|
EventCenter::Default()->triggerEvent(GUIEvents::PatientSelected, nullptr, edit_patient->getPatientInformation()->Copy());
|
|
|
|
|
selectedPatientUID = edit_patient->getPatientInformation()->PatientUID;
|
|
|
|
|
LOG_USER_OPERATION(SelectPatient)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// btn account slot
|
|
|
|
|
connect(btnAccount, &QToolButton::clicked, [=]() {
|
|
|
|
|
// mBtn account slot
|
|
|
|
|
connect(mBtnAccount, &QToolButton::clicked, [=]() {
|
|
|
|
|
AccountFormDialog dia(this);
|
|
|
|
|
dia.setWindowModality(Qt::WindowModal);
|
|
|
|
|
dia.exec();
|
|
|
|
|
@@ -298,12 +297,12 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|
|
|
|
model->setHeaderData(5, Qt::Horizontal, tr("Add Date"));
|
|
|
|
|
model->setHeaderData(6, Qt::Horizontal, tr("Comment"));
|
|
|
|
|
|
|
|
|
|
btnAccount->setText(tr("Account"));
|
|
|
|
|
//btnWorklist->setText(tr("Worklist"));
|
|
|
|
|
btnAdd->setText(tr("Add"));
|
|
|
|
|
btnEdit->setText(tr("Edit"));
|
|
|
|
|
btnDelete->setText(tr("Delete"));
|
|
|
|
|
btnSelect->setText(tr("Select"));
|
|
|
|
|
mBtnAccount->setText(tr("Account"));
|
|
|
|
|
//mBtnWorklist->setText(tr("Worklist"));
|
|
|
|
|
mBtnAdd->setText(tr("Add"));
|
|
|
|
|
mBtnEdit->setText(tr("Edit"));
|
|
|
|
|
mBtnDelete->setText(tr("Delete"));
|
|
|
|
|
mBtnSelect->setText(tr("Select"));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//first prepare buttons!
|
|
|
|
|
@@ -321,9 +320,4 @@ void SelectFormWidget::setPatientDetail(const SlideTableView *table, const QSqlT
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SelectFormWidget::~SelectFormWidget()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|