#include "PatientDetailForm.h" #include #include #include #include #include #include #include #include #include #include "event/EventCenter.h" PatientDetailForm::PatientDetailForm(QWidget* parent) : QWidget(parent) , mLblPatInfTitle(new QLabel(this)) , mLblDOB(new QLabel(this)) , mLblName(new QLabel(this)) , mLblPatID(new QLabel(this)) , mLblSex(new QLabel(this)) , mLblAccno(new QLabel(this)) , mLblAddDate(new QLabel(this)) { mLblPatInfTitle->setObjectName("PatInfTitle"); mLblDOB->setObjectName("displayDetail"); mLblName->setObjectName("displayDetail"); mLblPatID->setObjectName("displayDetail"); mLblSex->setObjectName("displayDetail"); mLblAccno->setObjectName("displayDetail"); mLblAddDate->setObjectName("displayDetail"); auto layout = new QVBoxLayout(this); // mLblPatInfTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); mLblPatInfTitle->setAlignment(Qt::AlignCenter); layout->addWidget(mLblPatInfTitle); mLblPatInfTitle->setText(tr("Patient Detail")); addDetailLabel(layout,tr("Name")+":", mLblName); addDetailLabel(layout,tr("Gender")+":", mLblSex); addDetailLabel(layout,tr("Birth Date")+":", mLblDOB); addDetailLabel(layout,tr("PatientID")+":", mLblPatID); addDetailLabel(layout,tr("AccNo")+":", mLblAccno); auto widgetLayout = new QHBoxLayout; layout->addLayout(widgetLayout); mLblAddDateTitle = new QLabel(tr("Add Date")+":",this); mLblAddDateTitle->setObjectName("displayTitle"); widgetLayout->addWidget(mLblAddDateTitle); widgetLayout->addWidget(mLblAddDate); connect(EventCenter::Default(), &EventCenter::ReloadLanguage, this,&PatientDetailForm::reloadLanguage); layout->addSpacerItem(new QSpacerItem(2,2,QSizePolicy::Expanding, QSizePolicy::Expanding)); } void PatientDetailForm::addDetailLabel(QVBoxLayout *layout, const QString& aTitleText, QLabel* aLabel) { auto widgetLayout = new QHBoxLayout; layout->addLayout(widgetLayout); auto lblTitle = new QLabel(aTitleText,this); mBtnList.append(lblTitle); lblTitle->setObjectName("displayTitle"); widgetLayout->addWidget(lblTitle); widgetLayout->addWidget(aLabel); } void PatientDetailForm::reloadLanguage() { mLblSex->setText(mStore.Sex == "F" ? tr("Female") : (mStore.Sex == "M" ? tr("Male") : tr("Other"))); QList strArray = {"Name","Gender","Birth Date","PatientID","AccNo"}; for (size_t i = 0; i < strArray.length(); i++) { mBtnList[i]->setText(tr(strArray[i].data())+":"); } mLblAddDateTitle->setText(tr("Add Date")+":"); mLblPatInfTitle->setText(tr("Patient Detail")); } PatientDetailForm::~PatientDetailForm() { } void PatientDetailForm::setPatientInformation(PatientInformation* information) { if (information) { mLblPatID->setText(information->ID); mLblDOB->setText(information->BirthDate); mLblName->setText(information->Name); mLblSex->setText((information->Sex == "F" ? tr("Female") : (information->Sex == "M" ? tr("Male") : tr("Other")))); mCurrentPatientUID = information->PatientUID; mLblAddDate->setText(QDateTime::fromString(information->AddDate, Qt::ISODate).toString("yyyy-MM-dd HH:mm:ss")); mLblAccno->setText(information->AccessionNumber); mStore = *information; } } void PatientDetailForm::clearPatientInformation() { mLblPatID->clear(); mLblDOB->clear(); mLblName->clear(); mLblSex->clear(); mLblAddDate->clear(); mLblAccno->clear(); } void PatientDetailForm::confirmModeOn(int protocol) { mLblPatInfTitle->setText(tr("Scan with this Patient?")); mLblAddDate->setText((protocol==0?tr("Left"):tr("Right"))); mLblAddDateTitle->setText(tr("Protocol")); } void PatientDetailForm::storePatientInformation() { }