2021-10-09 16:38:34 +08:00
|
|
|
//
|
|
|
|
|
// Created by Krad on 2021/10/8.
|
|
|
|
|
//
|
2023-08-21 14:22:41 +08:00
|
|
|
#include "ui_TabFormWidget.h"
|
2021-10-09 16:38:34 +08:00
|
|
|
#include "SelectFormWidget.h"
|
2022-06-14 11:29:56 +08:00
|
|
|
|
2021-10-09 16:38:34 +08:00
|
|
|
#include <QToolButton>
|
|
|
|
|
#include <QTableWidget>
|
2022-06-14 11:29:56 +08:00
|
|
|
#include <QScroller>
|
2021-10-09 16:38:34 +08:00
|
|
|
#include <QHeaderView>
|
2021-10-12 14:11:19 +08:00
|
|
|
#include <QUuid>
|
|
|
|
|
#include <QDate>
|
2023-08-28 16:31:52 +08:00
|
|
|
#include <QSqlRecord>
|
2022-06-14 11:29:56 +08:00
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
|
|
#include "components/SlideTableView.h"
|
2023-09-15 11:42:40 +08:00
|
|
|
#include "json/jsonobject.h"
|
2021-10-12 10:28:30 +08:00
|
|
|
#include "db/SQLHelper.h"
|
2021-10-12 17:38:56 +08:00
|
|
|
#include "event/EventCenter.h"
|
2022-07-21 10:39:24 +08:00
|
|
|
#include "dialogs/DialogManager.h"
|
2022-06-14 11:29:56 +08:00
|
|
|
#include "log/UserOperationLog.h"
|
|
|
|
|
#include "components/VerticalTextToolButton.h"
|
2023-11-21 15:45:27 +08:00
|
|
|
#include "PatientAddDateDelegate.h"
|
2022-06-14 11:29:56 +08:00
|
|
|
|
|
|
|
|
SelectFormWidget::SelectFormWidget(QWidget* parent)
|
|
|
|
|
: TabFormWidget(parent)
|
|
|
|
|
, mBtnAccount(new QToolButton(this))
|
|
|
|
|
, mBtnWorklist(new QToolButton(this))
|
|
|
|
|
, mBtnAdd(new QToolButton(this))
|
|
|
|
|
, mBtnSelect(new QToolButton(this))
|
2023-09-19 14:59:51 +08:00
|
|
|
, mBtnTurnOff(new QToolButton(this))
|
2022-06-14 13:52:42 +08:00
|
|
|
, mPatTable(new SlideTableView(this))
|
|
|
|
|
, mModel(nullptr)
|
2022-07-15 17:32:21 +08:00
|
|
|
, patientDetailForm(new PatientDetailForm(this))
|
2021-10-09 16:38:34 +08:00
|
|
|
{
|
2023-09-19 14:59:51 +08:00
|
|
|
//process expired patient list
|
|
|
|
|
QDate date = QDate::currentDate().addDays(-JsonObject::Instance()->getPatientListExpireDays());
|
|
|
|
|
SQLHelper::exec(QString("DELETE FROM Patient WHERE AddDate <= '%1'").arg(date.toString("yyyy-MM-dd")));
|
|
|
|
|
|
2022-01-12 11:24:37 +08:00
|
|
|
//init command bar
|
2022-06-14 11:29:56 +08:00
|
|
|
auto layout = new QHBoxLayout();
|
2021-12-17 18:02:39 +08:00
|
|
|
ui->commandWidget->setLayout(layout);
|
2022-06-14 13:52:42 +08:00
|
|
|
initGeneralButtons(layout);
|
2022-06-14 14:43:41 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding));
|
2022-06-14 11:29:56 +08:00
|
|
|
addVerticalLine(layout);
|
2022-06-14 13:52:42 +08:00
|
|
|
initPatEditButtons(layout);
|
|
|
|
|
initDataModel();
|
|
|
|
|
//Init content widget
|
2022-07-14 14:41:54 +08:00
|
|
|
auto* contentLayout = new QHBoxLayout(this->ui->contentWidget);
|
|
|
|
|
contentLayout->setContentsMargins(0, 0, 0, 0);
|
2022-06-14 13:52:42 +08:00
|
|
|
initDetailPanel(contentLayout);
|
2023-09-07 11:17:47 +08:00
|
|
|
addVerticalLine(contentLayout);
|
|
|
|
|
initTableView(contentLayout);
|
2022-06-14 13:52:42 +08:00
|
|
|
//select default row 0
|
|
|
|
|
if (mModel->rowCount() > 0)
|
2021-12-17 18:02:39 +08:00
|
|
|
{
|
2022-06-14 13:52:42 +08:00
|
|
|
mPatTable->selectRow(0);
|
2022-07-15 17:32:21 +08:00
|
|
|
setPatientDetail(mPatTable, mModel, patientDetailForm);
|
2022-04-02 14:52:21 +08:00
|
|
|
}
|
2022-06-14 13:52:42 +08:00
|
|
|
// event ResponsePreview slot
|
|
|
|
|
connect(EventCenter::Default(), &EventCenter::ResponsePreview, [=](QObject* sender, QObject* data) {
|
|
|
|
|
prepareButtons(true);
|
|
|
|
|
});
|
|
|
|
|
// event ResponseStop slot
|
2023-08-21 14:22:41 +08:00
|
|
|
connect(EventCenter::Default(), &EventCenter::ResponseStopPreview, [=](QObject* sender, QObject* data) {
|
2022-03-15 16:22:58 +08:00
|
|
|
prepareButtons(false);
|
|
|
|
|
});
|
2022-06-14 13:52:42 +08:00
|
|
|
// event ReloadLanguage slot;
|
|
|
|
|
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this, &SelectFormWidget::reloadLanguage);
|
2023-09-15 11:42:40 +08:00
|
|
|
|
|
|
|
|
connect(EventCenter::Default(), &EventCenter::AnonymousModeChanged, this, &SelectFormWidget::updateDataByAnonymousMode);
|
|
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
//first prepare buttons!
|
|
|
|
|
prepareButtons(false);
|
|
|
|
|
}
|
2021-12-17 18:02:39 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
void SelectFormWidget::prepareButtons(bool disableALL) {
|
2023-09-15 11:42:40 +08:00
|
|
|
bool anonymousMode = JsonObject::Instance()->getAnonymousMode();
|
2022-06-14 13:52:42 +08:00
|
|
|
bool stateFlag = (mPatTable->currentIndex().row() >= 0);
|
2023-09-15 11:42:40 +08:00
|
|
|
|
|
|
|
|
mBtnAdd->setEnabled(!anonymousMode && !disableALL);
|
|
|
|
|
mBtnWorklist->setEnabled(!anonymousMode && !disableALL);
|
|
|
|
|
patientDetailForm->setBtnEnable(!anonymousMode && stateFlag && !disableALL);
|
|
|
|
|
// if (mBtnAdd)mBtnEdit->setEnabled(!anonymousMode && stateFlag && !disableALL);
|
|
|
|
|
// if (mBtnAdd)mBtnDelete->setEnabled(!anonymousMode&& stateFlag && !disableALL);
|
2022-06-14 13:52:42 +08:00
|
|
|
mBtnSelect->setEnabled(stateFlag && !disableALL);
|
|
|
|
|
}
|
2022-03-15 16:22:58 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
void SelectFormWidget::initGeneralButtons(QHBoxLayout *layout) {
|
2022-07-14 16:59:30 +08:00
|
|
|
mBtnAccount->setObjectName("btnAccount");
|
2022-06-14 13:52:42 +08:00
|
|
|
mBtnAccount->setText(tr("Account"));
|
2022-07-14 16:59:30 +08:00
|
|
|
layout->addWidget(mBtnAccount);
|
2023-09-08 13:54:11 +08:00
|
|
|
mBtnTurnOff->setObjectName("btnShutDown");
|
|
|
|
|
mBtnTurnOff->setText(tr("ShutDown"));
|
|
|
|
|
layout->addWidget(mBtnTurnOff);
|
2022-06-14 13:52:42 +08:00
|
|
|
// mBtn account slot
|
2022-07-21 10:39:24 +08:00
|
|
|
connect(mBtnAccount, &QToolButton::clicked, DialogManager::Default(),&DialogManager::requestEditSelfAccount);
|
2023-09-08 13:54:11 +08:00
|
|
|
connect(mBtnTurnOff, &QToolButton::clicked, []()
|
|
|
|
|
{
|
|
|
|
|
if(DialogManager::Default()->requestAlertMessage(QString(tr("Shut down now ?")), DialogButtonMode::OkAndCancel,tr("Shut Down")) == QDialog::Accepted)
|
|
|
|
|
{
|
|
|
|
|
LOG_USER_OPERATION("Shut Down")
|
|
|
|
|
EventCenter::Default()->triggerEvent(GUIEvents::RequestShutdown, nullptr, nullptr);
|
|
|
|
|
}
|
|
|
|
|
});
|
2022-09-29 17:36:55 +08:00
|
|
|
connect(mBtnWorklist, &QToolButton::clicked, [&]()
|
|
|
|
|
{
|
2023-08-28 16:31:52 +08:00
|
|
|
DialogManager::Default()->requestGetWorkList(mModel, mPatTable);
|
2022-09-29 17:36:55 +08:00
|
|
|
});
|
2022-06-14 13:52:42 +08:00
|
|
|
}
|
2022-05-10 16:40:42 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
void SelectFormWidget::initPatEditButtons(QHBoxLayout *layout) {
|
2022-07-14 16:59:30 +08:00
|
|
|
mBtnAdd->setObjectName("btnAdd");
|
2023-09-07 11:17:47 +08:00
|
|
|
mBtnWorklist->setObjectName("btnWorklist");
|
2022-07-14 16:59:30 +08:00
|
|
|
mBtnSelect->setObjectName("btnSelect");
|
2022-06-14 13:52:42 +08:00
|
|
|
mBtnAdd->setText(tr("Add"));
|
|
|
|
|
mBtnSelect->setText(tr("Select"));
|
2023-09-07 11:17:47 +08:00
|
|
|
mBtnWorklist->setText(tr("Worklist"));
|
2022-07-14 16:59:30 +08:00
|
|
|
layout->addWidget(mBtnAdd);
|
2023-09-07 11:17:47 +08:00
|
|
|
layout->addWidget(mBtnWorklist);
|
2022-07-14 16:59:30 +08:00
|
|
|
layout->addWidget(mBtnSelect);
|
2022-06-14 13:52:42 +08:00
|
|
|
|
2023-09-07 11:17:47 +08:00
|
|
|
// btn add slot
|
2022-06-14 13:52:42 +08:00
|
|
|
connect(mBtnAdd, &QToolButton::clicked, this, &SelectFormWidget::editPatient);
|
2022-03-15 16:22:58 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
// mBtn select slot
|
|
|
|
|
connect(mBtnSelect, &QToolButton::clicked, this, &SelectFormWidget::selectPatient);
|
|
|
|
|
}
|
2022-03-15 16:22:58 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
void SelectFormWidget::editPatient() {
|
|
|
|
|
bool addFlag = sender() == mBtnAdd;
|
|
|
|
|
// accept change
|
2022-08-10 15:28:59 +08:00
|
|
|
if (DialogManager::Default()->requestEditPatientInfo(addFlag ? nullptr:patientDetailForm->getPatientInformation(),mModel) == QDialog::Accepted) {
|
2022-06-14 13:52:42 +08:00
|
|
|
if (addFlag){
|
|
|
|
|
mPatTable->selectRow(0);
|
|
|
|
|
mModel->selectRow(0);
|
2023-09-05 16:32:38 +08:00
|
|
|
LOG_USER_OPERATION(QString("Add Patient, ID: %1").arg(patientDetailForm->getPatientInformation()->ID))
|
2022-03-15 16:22:58 +08:00
|
|
|
}
|
2022-06-14 13:52:42 +08:00
|
|
|
else{
|
|
|
|
|
mPatTable->clicked(mPatTable->currentIndex());
|
2022-07-15 17:32:21 +08:00
|
|
|
setPatientDetail(mPatTable, mModel, patientDetailForm);
|
2023-09-05 16:32:38 +08:00
|
|
|
LOG_USER_OPERATION(QString("Edit Patient, ID: %1").arg(patientDetailForm->getPatientInformation()->ID))
|
2022-03-15 16:22:58 +08:00
|
|
|
}
|
2022-06-14 13:52:42 +08:00
|
|
|
mBtnSelect->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-15 16:22:58 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
void SelectFormWidget::delPatient() {
|
|
|
|
|
if (mPatTable->currentIndex().row() < 0) return;
|
|
|
|
|
QString pUid = mModel->index(mPatTable->currentIndex().row(), PatientUID).data().toString();
|
|
|
|
|
// patient has been selected as the scan patient!
|
|
|
|
|
if (selectedPatientUID == pUid){
|
2022-08-10 15:28:59 +08:00
|
|
|
DialogManager::Default()->requestAlertMessage(tr("Can't delete selected Patient !"),DialogButtonMode::OkOnly,tr("Alert"));
|
2022-06-14 13:52:42 +08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// not the selected one, confirm!
|
|
|
|
|
QString pat_name = mModel->index(mPatTable->currentIndex().row(), Name).data().toString();
|
2022-08-10 15:28:59 +08:00
|
|
|
if (DialogManager::Default()->requestAlertMessage(QString(tr("Delete Patient \"%1\" ?")).arg(pat_name),DialogButtonMode::OkAndCancel,tr("Confirm")) != QDialog::Accepted) return;
|
2022-06-14 13:52:42 +08:00
|
|
|
// need delete clear edit panel detail
|
2022-07-15 17:32:21 +08:00
|
|
|
patientDetailForm->clearPatientInformation();
|
2022-09-29 17:36:55 +08:00
|
|
|
//mModel->setData(mModel->index(mPatTable->currentIndex().row(), Flag), 9);
|
|
|
|
|
mModel->removeRow(mPatTable->currentIndex().row());
|
2022-06-14 13:52:42 +08:00
|
|
|
|
|
|
|
|
if (mModel->submitAll()) {
|
|
|
|
|
mModel->select();
|
|
|
|
|
if (mModel->rowCount() > 0) {
|
|
|
|
|
mPatTable->selectRow(0);
|
|
|
|
|
mModel->selectRow(0);
|
2022-07-15 17:32:21 +08:00
|
|
|
setPatientDetail(mPatTable, mModel, patientDetailForm);
|
2023-09-05 16:32:38 +08:00
|
|
|
LOG_USER_OPERATION(QString("Delete Patient, ID: %1").arg(patientDetailForm->getPatientInformation()->ID))
|
2022-06-14 13:52:42 +08:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//TODO:error handle
|
2022-08-10 15:28:59 +08:00
|
|
|
DialogManager::Default()->requestAlertMessage(tr("Can't delete selected Patient , db submit error!"),DialogButtonMode::OkOnly,tr("Alert"));
|
2022-06-14 13:52:42 +08:00
|
|
|
}
|
|
|
|
|
prepareButtons(false);
|
|
|
|
|
}
|
2021-12-17 18:02:39 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
void SelectFormWidget::selectPatient() {
|
2022-07-15 17:32:21 +08:00
|
|
|
EventCenter::Default()->triggerEvent(PatientSelected, nullptr, patientDetailForm->getPatientInformation()->Copy());
|
|
|
|
|
selectedPatientUID = patientDetailForm->getPatientInformation()->PatientUID;
|
2023-09-05 16:32:38 +08:00
|
|
|
LOG_USER_OPERATION(QString("Select Patient, ID: %1").arg(patientDetailForm->getPatientInformation()->ID))
|
2022-06-14 13:52:42 +08:00
|
|
|
}
|
2022-03-15 16:22:58 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
void SelectFormWidget::initDetailPanel(QHBoxLayout *contentLayout) {// prepare edit panel
|
2022-07-15 17:32:21 +08:00
|
|
|
patientDetailForm->setObjectName("patientDetailWidget");
|
2023-09-07 11:17:47 +08:00
|
|
|
// patientDetailForm->hide();
|
2022-07-15 17:32:21 +08:00
|
|
|
contentLayout->addWidget(patientDetailForm);
|
2022-06-14 13:52:42 +08:00
|
|
|
auto* btnShowEdit = new VerticalTextToolButton(this);
|
2022-07-15 17:32:21 +08:00
|
|
|
btnShowEdit->setObjectName("btnShowPanel");
|
2022-06-14 13:52:42 +08:00
|
|
|
btnShowEdit->setFixedHeight(225);
|
|
|
|
|
btnShowEdit->setVerticalText("Patient Detail");
|
2023-09-07 11:17:47 +08:00
|
|
|
btnShowEdit->hide();
|
2022-06-14 13:52:42 +08:00
|
|
|
contentLayout->addWidget(btnShowEdit);
|
|
|
|
|
contentLayout->setAlignment(btnShowEdit, Qt::AlignTop);
|
|
|
|
|
|
2023-09-07 11:17:47 +08:00
|
|
|
connect(patientDetailForm, &PatientDetailForm::editClicked, this, &SelectFormWidget::editPatient);
|
|
|
|
|
connect(patientDetailForm, &PatientDetailForm::deleteClicked, this, &SelectFormWidget::delPatient);
|
2022-06-14 13:52:42 +08:00
|
|
|
}
|
2022-03-15 16:22:58 +08:00
|
|
|
|
2023-11-21 15:45:27 +08:00
|
|
|
void SelectFormWidget::initTableView(QHBoxLayout *contentLayout)
|
|
|
|
|
{
|
|
|
|
|
// TableView for patient
|
2022-06-14 13:52:42 +08:00
|
|
|
mPatTable->setAlternatingRowColors(true);
|
|
|
|
|
mPatTable->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
|
mPatTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
|
|
|
mPatTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
|
|
|
mPatTable->verticalHeader()->setDefaultSectionSize(38);
|
|
|
|
|
mPatTable->horizontalHeader()->setStretchLastSection(true);
|
|
|
|
|
//data from SQLITE
|
|
|
|
|
//
|
|
|
|
|
//avoid pan comsumed by tableview!
|
|
|
|
|
mPatTable->viewport()->ungrabGesture(Qt::PanGesture);
|
|
|
|
|
|
|
|
|
|
mPatTable->setSortingEnabled(true); // enable sortingEnabled
|
|
|
|
|
mPatTable->setModel((QAbstractItemModel*) mModel);
|
|
|
|
|
mPatTable->hideColumn(0);
|
|
|
|
|
mPatTable->show();
|
|
|
|
|
|
|
|
|
|
mPatTable->setColumnWidth(1, 250);
|
|
|
|
|
mPatTable->setColumnWidth(2, 250);
|
2023-08-23 16:49:56 +08:00
|
|
|
mPatTable->setColumnWidth(3, 250);
|
2023-09-07 11:17:47 +08:00
|
|
|
mPatTable->setColumnWidth(4, 120);
|
|
|
|
|
mPatTable->setColumnWidth(5, 80);
|
|
|
|
|
mPatTable->setColumnWidth(6, 120);
|
|
|
|
|
mPatTable->setColumnHidden(7, true);
|
2022-06-14 13:52:42 +08:00
|
|
|
contentLayout->addWidget(mPatTable);
|
|
|
|
|
//table current row selection changing event
|
|
|
|
|
connect(mPatTable, &SlideTableView::currentRowChanged, [=](int row) {
|
2022-07-15 17:32:21 +08:00
|
|
|
setPatientDetail(mPatTable, mModel, patientDetailForm);
|
2022-03-15 16:22:58 +08:00
|
|
|
prepareButtons(false);
|
2022-06-14 13:52:42 +08:00
|
|
|
});
|
2021-12-23 10:09:35 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
// after sort by column
|
|
|
|
|
connect(mPatTable->horizontalHeader(), &QHeaderView::sectionClicked, [=](int index){
|
2022-07-15 17:32:21 +08:00
|
|
|
patientDetailForm->clearPatientInformation();
|
2022-06-14 13:52:42 +08:00
|
|
|
prepareButtons(false);
|
|
|
|
|
if(mModel->rowCount() > 0){
|
|
|
|
|
mPatTable->selectRow(0);
|
|
|
|
|
mModel->selectRow(0);
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-11-21 15:45:27 +08:00
|
|
|
|
|
|
|
|
PatientAddDateDelegate* patientAddDateDelegate = new PatientAddDateDelegate(mPatTable);
|
|
|
|
|
mPatTable->setItemDelegateForColumn(6, patientAddDateDelegate);
|
2022-06-14 13:52:42 +08:00
|
|
|
}
|
2021-12-23 10:09:35 +08:00
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
void SelectFormWidget::initDataModel() {//TODO:单独初始化预防SQL错误
|
|
|
|
|
mModel = SQLHelper::getTable("Patient");
|
2023-08-28 16:31:52 +08:00
|
|
|
mModel->sort(mModel->record().indexOf("AddDate"), Qt::DescendingOrder);
|
2023-09-15 11:42:40 +08:00
|
|
|
mModel->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
|
|
|
|
bool anonymousMode = JsonObject::Instance()->getAnonymousMode();
|
|
|
|
|
if (anonymousMode)
|
|
|
|
|
{
|
|
|
|
|
mModel->setFilter("1=2");
|
|
|
|
|
}
|
2022-06-14 13:52:42 +08:00
|
|
|
mModel->select();
|
2023-09-15 11:42:40 +08:00
|
|
|
if (anonymousMode)
|
|
|
|
|
{
|
|
|
|
|
mModel->insertRow(0);
|
|
|
|
|
mModel->setData(mModel->index(0,0),"000000001");
|
|
|
|
|
mModel->setData(mModel->index(0,1),"AnonymousPatient");
|
|
|
|
|
mModel->setData(mModel->index(0,2),"");
|
|
|
|
|
mModel->setData(mModel->index(0,3),"AnonymousPatient");
|
|
|
|
|
mModel->setData(mModel->index(0,4),"2000-01-01");
|
2023-09-20 10:11:07 +08:00
|
|
|
mModel->setData(mModel->index(0,5),"F");
|
2023-09-15 11:42:40 +08:00
|
|
|
mModel->setData(mModel->index(0,6),"2000-01-01");
|
|
|
|
|
mModel->setData(mModel->index(0,7),"");
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
mModel->setHeaderData(1, Qt::Horizontal, "ID");
|
2023-08-23 16:49:56 +08:00
|
|
|
mModel->setHeaderData(2, Qt::Horizontal, tr("AccessionNumber"));
|
|
|
|
|
mModel->setHeaderData(3, Qt::Horizontal, tr("Name"));
|
|
|
|
|
mModel->setHeaderData(4, Qt::Horizontal, tr("Birth Date"));
|
|
|
|
|
mModel->setHeaderData(5, Qt::Horizontal, tr("Gender"));
|
|
|
|
|
mModel->setHeaderData(6, Qt::Horizontal, tr("Add Date"));
|
|
|
|
|
mModel->setHeaderData(7, Qt::Horizontal, tr("Comment"));
|
2021-10-09 16:38:34 +08:00
|
|
|
}
|
|
|
|
|
|
2022-06-07 15:19:14 +08:00
|
|
|
void SelectFormWidget::setPatientDetail(const SlideTableView *table, const QSqlTableModel *model,
|
2022-06-14 14:43:41 +08:00
|
|
|
PatientDetailForm *edit_patient) const {
|
2022-04-02 14:52:21 +08:00
|
|
|
PatientInformation pat;
|
|
|
|
|
#define ADD_PATIENT_PROPERTY(val)\
|
|
|
|
|
pat. val = model->data(model->index(table->currentIndex().row(),PatientInformationEnum:: val),Qt::EditRole).toString();
|
|
|
|
|
EDIT_PATIENT()
|
|
|
|
|
#undef ADD_PATIENT_PROPERTY
|
|
|
|
|
edit_patient->setPatientInformation(&pat);
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-14 13:52:42 +08:00
|
|
|
void SelectFormWidget::reloadLanguage(){
|
|
|
|
|
mModel->setHeaderData(1, Qt::Horizontal, "ID");
|
2023-08-23 16:49:56 +08:00
|
|
|
mModel->setHeaderData(2, Qt::Horizontal, tr("AccessionNumber"));
|
|
|
|
|
mModel->setHeaderData(3, Qt::Horizontal, tr("Name"));
|
|
|
|
|
mModel->setHeaderData(4, Qt::Horizontal, tr("Birth Date"));
|
|
|
|
|
mModel->setHeaderData(5, Qt::Horizontal, tr("Gender"));
|
|
|
|
|
mModel->setHeaderData(6, Qt::Horizontal, tr("Add Date"));
|
|
|
|
|
mModel->setHeaderData(7, Qt::Horizontal, tr("Comment"));
|
2022-06-14 13:52:42 +08:00
|
|
|
|
|
|
|
|
mBtnAccount->setText(tr("Account"));
|
|
|
|
|
//mBtnWorklist->setText(tr("Worklist"));
|
|
|
|
|
mBtnAdd->setText(tr("Add"));
|
2023-09-15 11:42:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SelectFormWidget::updateDataByAnonymousMode(){
|
|
|
|
|
bool anonymousMode = JsonObject::Instance()->getAnonymousMode();
|
|
|
|
|
EventCenter::Default()->triggerEvent(GUIEvents::PatientSelected,this,nullptr);
|
|
|
|
|
if (anonymousMode)
|
|
|
|
|
{
|
|
|
|
|
mModel->setFilter("1=2");
|
|
|
|
|
mModel->select();
|
|
|
|
|
mModel->insertRow(0);
|
|
|
|
|
mModel->setData(mModel->index(0,0),"000000001");
|
|
|
|
|
mModel->setData(mModel->index(0,1),"AnonymousPatient");
|
|
|
|
|
mModel->setData(mModel->index(0,2),"");
|
|
|
|
|
mModel->setData(mModel->index(0,3),"AnonymousPatient");
|
|
|
|
|
mModel->setData(mModel->index(0,4),"2000-01-01");
|
|
|
|
|
mModel->setData(mModel->index(0,5),"M");
|
|
|
|
|
mModel->setData(mModel->index(0,6),"2000-01-01");
|
|
|
|
|
mModel->setData(mModel->index(0,7),"");
|
|
|
|
|
mPatTable->selectRow(0);
|
|
|
|
|
mModel->selectRow(0);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
mModel->revertAll();
|
|
|
|
|
mModel->setFilter("");
|
|
|
|
|
mModel->select();
|
|
|
|
|
if (mModel->rowCount()>0){
|
|
|
|
|
mPatTable->selectRow(0);
|
|
|
|
|
mModel->selectRow(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
prepareButtons(false);
|
2022-06-14 13:52:42 +08:00
|
|
|
}
|
|
|
|
|
|
2021-12-03 14:21:21 +08:00
|
|
|
|
2022-03-15 16:22:58 +08:00
|
|
|
|