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

84 lines
2.7 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>
2021-10-12 14:11:19 +08:00
#include <qdebug.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) :
2022-06-14 13:52:42 +08:00
QWidget(parent),
mUI(new Ui::PatientDetailForm)
2021-10-09 16:38:34 +08:00
{
2022-06-14 13:52:42 +08:00
mUI->setupUi(this);
mUI->hideBtn->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred);
mUI->hideBtn->setObjectName("btnHidePanel");
2022-06-14 13:52:42 +08:00
mUI->hideBtn->setText(tr(" Hide Panel"));
connect(mUI->hideBtn, &QToolButton::clicked, [=](){
2022-01-12 11:24:37 +08:00
emit hideBtnClicked();
});
2022-06-14 13:52:42 +08:00
mUI->tbxDob->setDisplayFormat("yyyy/MM/dd");
2021-12-28 18:23:02 +08:00
2022-06-14 13:52:42 +08:00
mUI->tbxID->setEnabled(false);
2022-07-12 16:13:09 +08:00
mUI->tbxID->setObjectName("displayLineEdit");
2022-06-14 13:52:42 +08:00
mUI->tbxDob->setEnabled(false);
2022-07-12 16:13:09 +08:00
mUI->tbxDob->setObjectName("displayLineEdit");
2022-06-14 13:52:42 +08:00
mUI->tbxName->setEnabled(false);
2022-07-12 16:13:09 +08:00
mUI->tbxName->setObjectName("displayLineEdit");
2022-06-14 13:52:42 +08:00
mUI->tbxSex->setEnabled(false);
2022-07-12 16:13:09 +08:00
mUI->tbxSex->setObjectName("displayLineEdit");
2022-06-14 13:52:42 +08:00
mUI->rtbxComment->setEnabled(false);
2022-07-12 16:13:09 +08:00
mUI->rtbxComment->setObjectName("displayLineEdit");
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this,&PatientDetailForm::reloadLanguage);
2021-12-28 18:23:02 +08:00
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);
mUI->tbxSex->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)
{
2022-06-14 13:52:42 +08:00
mUI->tbxID->setText(information->ID);
mUI->tbxDob->setDate(QDate::fromString(information->BirthDate, "yyyy-MM-dd"));
mUI->tbxName->setText(information->Name);
mUI->rtbxComment->setText(information->Comment);
mUI->tbxSex->setText(information->Sex == "F" ? tr("Female") : (information->Sex == "M" ? tr("Male") : tr("Other")));
mCurrentPatientUID = information->PatientUID;
mAddDate = information->AddDate;
mStore.Sex = information->Sex;
mStore.AccessionNumber = information->AccessionNumber;
2021-12-28 18:23:02 +08:00
storePatientInformation();
}
}
void PatientDetailForm::clearPatientInformation() {
mUI->tbxID->clear();
2022-06-14 13:52:42 +08:00
mUI->tbxDob->setDate(QDate::currentDate());
mUI->tbxName->clear();
mUI->tbxSex->clear();
mUI->rtbxComment->clear();
mCurrentPatientUID.clear();
mAddDate.clear();
}
void PatientDetailForm::storePatientInformation() {
2022-06-14 13:52:42 +08:00
mStore.PatientUID = mCurrentPatientUID;
mStore.AddDate = mAddDate;
mStore.ID = mUI->tbxID->text();
mStore.BirthDate = mUI->tbxDob->date().toString("yyyy-MM-dd");
mStore.Name = mUI->tbxName->text();
mStore.Comment = mUI->rtbxComment->toPlainText();
}