Modify PatientDetailform
This commit is contained in:
@@ -4,41 +4,59 @@
|
||||
#include <QListView>
|
||||
#include <QToolButton>
|
||||
#include <QButtonGroup>
|
||||
#include <qboxlayout.h>
|
||||
#include <qdebug.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
#include "event/EventCenter.h"
|
||||
|
||||
PatientDetailForm::PatientDetailForm(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
mUI(new Ui::PatientDetailForm)
|
||||
QWidget(parent),
|
||||
mUI(new Ui::PatientDetailForm)
|
||||
, mBtnEdit(new QToolButton())
|
||||
, mBtnDelete(new QToolButton())
|
||||
{
|
||||
mUI->setupUi(this);
|
||||
mUI->hideBtn->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred);
|
||||
mUI->hideBtn->setObjectName("btnHidePanel");
|
||||
mUI->hideBtn->setText(tr(" Hide Panel"));
|
||||
mUI->hideBtn->setVisible(false);
|
||||
connect(mUI->hideBtn, &QToolButton::clicked, [=](){
|
||||
emit hideBtnClicked();
|
||||
});
|
||||
mUI->tbxDob->setDisplayFormat("yyyy/MM/dd");
|
||||
|
||||
mUI->tbxID->setEnabled(false);
|
||||
mUI->tbxID->setObjectName("displayLineEdit");
|
||||
mUI->tbxDob->setEnabled(false);
|
||||
mUI->tbxDob->setObjectName("displayLineEdit");
|
||||
mUI->tbxName->setEnabled(false);
|
||||
mUI->tbxName->setObjectName("displayLineEdit");
|
||||
mUI->tbxSex->setEnabled(false);
|
||||
mUI->tbxSex->setObjectName("displayLineEdit");
|
||||
mUI->rtbxComment->setEnabled(false);
|
||||
mUI->rtbxComment->setObjectName("displayLineEdit");
|
||||
|
||||
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);
|
||||
QWidget * widget = new QWidget(this);
|
||||
widget->setFixedHeight(120);
|
||||
mUI->verticalLayout_2->setSpacing(50);
|
||||
|
||||
mUI->verticalLayout_3->insertWidget(5, widget);
|
||||
|
||||
QHBoxLayout * layout = new QHBoxLayout(widget);
|
||||
mBtnEdit->setObjectName("btnEdit");
|
||||
mBtnDelete->setObjectName("btnDelete");
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
||||
void PatientDetailForm::reloadLanguage() {
|
||||
mUI->retranslateUi(this);
|
||||
mUI->tbxSex->setText(mStore.Sex == "F" ? tr("Female") : (mStore.Sex == "M" ? tr("Male") : tr("Other")));
|
||||
mUI->lbl_Sex->setText(mStore.Sex == "F" ? tr("Female") : (mStore.Sex == "M" ? tr("Male") : tr("Other")));
|
||||
}
|
||||
|
||||
PatientDetailForm::~PatientDetailForm()
|
||||
@@ -49,35 +67,27 @@ PatientDetailForm::~PatientDetailForm()
|
||||
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")));
|
||||
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"))));
|
||||
mCurrentPatientUID = information->PatientUID;
|
||||
mAddDate = information->AddDate;
|
||||
mStore.Sex = information->Sex;
|
||||
mStore.AccessionNumber = information->AccessionNumber;
|
||||
storePatientInformation();
|
||||
mUI->lblAddDate->setText(tr("Add Date: ")+information->AddDate);
|
||||
mUI->lblAccno->setText(tr("AccNo: ")+information->AccessionNumber);
|
||||
|
||||
mStore = *information;
|
||||
}
|
||||
}
|
||||
|
||||
void PatientDetailForm::clearPatientInformation() {
|
||||
mUI->tbxID->clear();
|
||||
mUI->tbxDob->setDate(QDate::currentDate());
|
||||
mUI->tbxName->clear();
|
||||
mUI->tbxSex->clear();
|
||||
mUI->rtbxComment->clear();
|
||||
mCurrentPatientUID.clear();
|
||||
mAddDate.clear();
|
||||
mUI->lblPatID->clear();
|
||||
mUI->lbl_DOB->clear();
|
||||
mUI->lbl_Name->clear();
|
||||
mUI->lbl_Sex->clear();
|
||||
mUI->lblAddDate->clear();
|
||||
mUI->lblAccno->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