Files
GUI/src/forms/select/PatientDetailForm.cpp

110 lines
3.4 KiB
C++
Raw Normal View History

#include "PatientDetailForm.h"
#include "ui_PatientDetailForm.h"
2021-10-09 16:38:34 +08:00
#include <QListView>
#include <QToolButton>
2021-10-12 15:07:06 +08:00
#include <QButtonGroup>
2023-11-21 16:19:51 +08:00
#include <QDateTime>
2023-09-07 11:17:47 +08:00
#include <qboxlayout.h>
2021-10-12 14:11:19 +08:00
#include <qdebug.h>
2023-09-07 11:17:47 +08:00
#include <qwidget.h>
2022-07-13 10:29:09 +08:00
2021-12-28 18:23:02 +08:00
#include "event/EventCenter.h"
PatientDetailForm::PatientDetailForm(QWidget* parent) :
2023-09-07 11:17:47 +08:00
QWidget(parent),
mUI(new Ui::PatientDetailForm)
, mBtnEdit(new QToolButton())
, mBtnDelete(new QToolButton())
, mBtnPlaceWidget(new QWidget(this))
, mLblMessage(new QLabel(this))
2021-10-09 16:38:34 +08:00
{
2022-06-14 13:52:42 +08:00
mUI->setupUi(this);
2023-09-07 11:17:47 +08:00
mUI->lblPatInfPanel->setObjectName("PatInfTitle");
mUI->lblIcon->setObjectName("PatIcon");
mUI->lbl_DOB->setObjectName("displayDetail");
mUI->lbl_Name->setObjectName("displayDetail");
mUI->lblPatID->setObjectName("displayDetail");
mUI->lbl_Sex->setObjectName("displayDetail");
mUI->lblAccno->setObjectName("displayDetail");
mUI->lblAddDate->setObjectName("displayDetail");
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this,&PatientDetailForm::reloadLanguage);
mBtnPlaceWidget->setFixedHeight(120);
2023-09-07 11:17:47 +08:00
mUI->verticalLayout_2->setSpacing(50);
mUI->verticalLayout_3->insertWidget(5, mBtnPlaceWidget);
mUI->verticalLayout_3->insertWidget(5, mLblMessage);
mLblMessage->setVisible(false);
QHBoxLayout * layout = new QHBoxLayout(mBtnPlaceWidget);
mBtnEdit->setObjectName("btnPatEdit");
mBtnDelete->setObjectName("btnPatDelete");
2023-09-07 11:17:47 +08:00
mBtnEdit->setText(tr("Edit"));
mBtnDelete->setText(tr("Delete"));
layout->addWidget(mBtnEdit);
layout->addWidget(mBtnDelete);
connect(mBtnEdit, &QToolButton::clicked, [=](){
emit editClicked();
});
connect(mBtnDelete, &QToolButton::clicked, [=](){
emit deleteClicked();
});
2023-09-15 11:42:40 +08:00
setBtnEnable(false);
2022-06-14 13:52:42 +08:00
}
2021-12-28 18:23:02 +08:00
void PatientDetailForm::reloadLanguage() {
2022-06-14 13:52:42 +08:00
mUI->retranslateUi(this);
2023-09-07 11:17:47 +08:00
mUI->lbl_Sex->setText(mStore.Sex == "F" ? tr("Female") : (mStore.Sex == "M" ? tr("Male") : tr("Other")));
2021-10-09 16:38:34 +08:00
}
PatientDetailForm::~PatientDetailForm()
2021-10-09 16:38:34 +08:00
{
2022-06-14 13:52:42 +08:00
delete mUI;
2021-10-09 16:38:34 +08:00
}
void PatientDetailForm::setPatientInformation(PatientInformation* information) {
2021-12-28 18:23:02 +08:00
if (information)
{
2023-09-07 11:17:47 +08:00
mUI->lblPatID->setText(tr("PatientID: ")+information->ID);
mUI->lbl_DOB->setText(" "+information->BirthDate);
mUI->lbl_Name->setText(" "+information->Name);
mUI->lbl_Sex->setText(" "+ (information->Sex == "F" ? tr("Female") : (information->Sex == "M" ? tr("Male") : tr("Other"))));
2022-06-14 13:52:42 +08:00
mCurrentPatientUID = information->PatientUID;
2023-11-21 16:19:51 +08:00
mUI->lblAddDate->setText(tr("Add Date: ")+ QDateTime::fromString(information->AddDate, Qt::ISODate).toString("yyyy-MM-dd HH:mm:ss"));
2023-09-07 11:17:47 +08:00
mUI->lblAccno->setText(tr("AccNo: ")+information->AccessionNumber);
mStore = *information;
2023-09-15 11:42:40 +08:00
setBtnEnable(true);
2021-12-28 18:23:02 +08:00
}
}
void PatientDetailForm::clearPatientInformation() {
2023-09-07 11:17:47 +08:00
mUI->lblPatID->clear();
mUI->lbl_DOB->clear();
mUI->lbl_Name->clear();
mUI->lbl_Sex->clear();
mUI->lblAddDate->clear();
mUI->lblAccno->clear();
}
void PatientDetailForm::confirmModeOn(int protocol)
{
mBtnPlaceWidget->setVisible(false);
mLblMessage->setVisible(true);
mUI->lblPatInfPanel->setText(tr("Scan with this Patient?"));
mUI->lblAddDate->setText(tr("Protocol: ")+(protocol==0?tr("Left"):tr("Right")));
}
2023-09-15 11:42:40 +08:00
void PatientDetailForm::setBtnEnable(bool enable)
{
mBtnDelete->setEnabled(enable);
mBtnEdit->setEnabled(enable);
}
void PatientDetailForm::storePatientInformation() {
}