Rename editpatientform to PatientDetailForm
This commit is contained in:
86
src/forms/select/PatientDetailForm.cpp
Normal file
86
src/forms/select/PatientDetailForm.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
#include "PatientDetailForm.h"
|
||||
#include "ui_PatientDetailForm.h"
|
||||
|
||||
#include <QListView>
|
||||
#include <QHBoxLayout>
|
||||
#include <QToolButton>
|
||||
#include <QButtonGroup>
|
||||
#include "guimacros.h"
|
||||
#include <qdebug.h>
|
||||
#include "event/EventCenter.h"
|
||||
|
||||
PatientDetailForm::PatientDetailForm(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
mUI(new Ui::PatientDetailForm)
|
||||
{
|
||||
mUI->setupUi(this);
|
||||
mUI->hideBtn->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred);
|
||||
mUI->hideBtn->setObjectName("hideeditBtn");
|
||||
mUI->hideBtn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
mUI->hideBtn->setIcon(QIcon(":/icons/hidearrow.png"));
|
||||
mUI->hideBtn->setIconSize({30, 30});
|
||||
mUI->hideBtn->setText(tr(" Hide Panel"));
|
||||
connect(mUI->hideBtn, &QToolButton::clicked, [=](){
|
||||
emit hideBtnClicked();
|
||||
});
|
||||
mUI->tbxDob->setDisplayFormat("yyyy/MM/dd");
|
||||
|
||||
mUI->tbxID->setEnabled(false);
|
||||
mUI->tbxID->setObjectName("display_tbx");
|
||||
mUI->tbxDob->setEnabled(false);
|
||||
mUI->tbxDob->setObjectName("display_tbx");
|
||||
mUI->tbxName->setEnabled(false);
|
||||
mUI->tbxName->setObjectName("display_tbx");
|
||||
mUI->tbxSex->setEnabled(false);
|
||||
mUI->tbxSex->setObjectName("display_tbx");
|
||||
mUI->rtbxComment->setEnabled(false);
|
||||
mUI->rtbxComment->setObjectName("display_tbx");
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this,&PatientDetailForm::reloadLanguage);
|
||||
|
||||
}
|
||||
|
||||
void PatientDetailForm::reloadLanguage() {
|
||||
mUI->retranslateUi(this);
|
||||
mUI->tbxSex->setText(mStore.Sex == "F" ? tr("Female") : (mStore.Sex == "M" ? tr("Male") : tr("Other")));
|
||||
}
|
||||
|
||||
PatientDetailForm::~PatientDetailForm()
|
||||
{
|
||||
delete mUI;
|
||||
}
|
||||
|
||||
void PatientDetailForm::setPatientInformation(PatientInformation* information) {
|
||||
if (information)
|
||||
{
|
||||
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;
|
||||
storePatientInformation();
|
||||
}
|
||||
}
|
||||
|
||||
void PatientDetailForm::clearPatientInformation() {
|
||||
mUI->tbxID->clear();
|
||||
mUI->tbxDob->setDate(QDate::currentDate());
|
||||
mUI->tbxName->clear();
|
||||
mUI->tbxSex->clear();
|
||||
mUI->rtbxComment->clear();
|
||||
mCurrentPatientUID.clear();
|
||||
mAddDate.clear();
|
||||
}
|
||||
|
||||
void PatientDetailForm::storePatientInformation() {
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user