Modify PatientDetailform

This commit is contained in:
kradchen
2023-09-07 11:17:47 +08:00
parent 3a281f4db5
commit 198018b165
8 changed files with 786 additions and 542 deletions

View File

@@ -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();
}

View File

@@ -20,6 +20,9 @@ public:
signals:
void hideBtnClicked();
void editClicked();
void deleteClicked();
private:
void storePatientInformation();
void reloadLanguage();
@@ -27,6 +30,8 @@ private:
QString mCurrentPatientUID;
QString mAddDate;
PatientInformation mStore;
QToolButton *mBtnEdit;
QToolButton *mBtnDelete;
};
#endif // EDITPATIENTFORM_H

View File

@@ -17,13 +17,6 @@
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="hideBtn">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
@@ -32,93 +25,36 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<item>
<widget class="QLabel" name="lbl_ID">
<widget class="QToolButton" name="hideBtn">
<property name="text">
<string>ID</string>
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="ULineEdit" name="tbxID">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Name">
<widget class="QLabel" name="lblPatInfPanel">
<property name="text">
<string>Name</string>
<string>Patient Information</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="ULineEdit" name="tbxName">
<property name="enabled">
<bool>true</bool>
<widget class="QFrame" name="frame_4">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="readOnly">
<bool>true</bool>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Sex">
<property name="text">
<string>Gender</string>
</property>
</widget>
</item>
<item>
<widget class="ULineEdit" name="tbxSex">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_DOB">
<property name="text">
<string>Date Of Birth</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="tbxDob">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>1</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
@@ -131,46 +67,127 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lblIcon">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>111</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="PatinfLayout">
<item>
<widget class="QLabel" name="lbl_Name">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Sex">
<property name="text">
<string>Gender</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_DOB">
<property name="text">
<string>Date Of Birth</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_Comment">
<property name="text">
<string>Comment</string>
<widget class="QFrame" name="frame_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>30</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lblPatID">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblAccno">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblAddDate">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="UTextEdit" name="rtbxComment">
<property name="enabled">
<bool>true</bool>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="readOnly">
<bool>true</bool>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</widget>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="editcmdWidget" native="true"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>ULineEdit</class>
<extends>QLineEdit</extends>
<header>components/ULineEdit.h</header>
</customwidget>
<customwidget>
<class>UTextEdit</class>
<extends>QTextEdit</extends>
<header>components/UTextEdit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -40,6 +40,15 @@ public:
: QObject()
{
}
void operator=(const PatientInformation& other){
this->PatientUID = other.PatientUID;
this->ID = other.ID;
this->Name = other.Name;
this->BirthDate = other.BirthDate;
this->Sex = other.Sex;
this->Comment = other.Comment;
this->AccessionNumber = other.AccessionNumber;
}
QString ScheduledStartDate;
PatientInformation* Copy()
{

View File

@@ -25,8 +25,8 @@ SelectFormWidget::SelectFormWidget(QWidget* parent)
, mBtnAccount(new QToolButton(this))
, mBtnWorklist(new QToolButton(this))
, mBtnAdd(new QToolButton(this))
, mBtnEdit(new QToolButton(this))
, mBtnDelete(new QToolButton(this))
// , mBtnEdit(new QToolButton(this))
// , mBtnDelete(new QToolButton(this))
, mBtnSelect(new QToolButton(this))
, mPatTable(new SlideTableView(this))
, mModel(nullptr)
@@ -44,9 +44,9 @@ SelectFormWidget::SelectFormWidget(QWidget* parent)
//Init content widget
auto* contentLayout = new QHBoxLayout(this->ui->contentWidget);
contentLayout->setContentsMargins(0, 0, 0, 0);
initTableView(contentLayout);
addVerticalLine(contentLayout);
initDetailPanel(contentLayout);
addVerticalLine(contentLayout);
initTableView(contentLayout);
//select default row 0
if (mModel->rowCount() > 0)
{
@@ -70,18 +70,15 @@ SelectFormWidget::SelectFormWidget(QWidget* parent)
void SelectFormWidget::prepareButtons(bool disableALL) {
bool stateFlag = (mPatTable->currentIndex().row() >= 0);
mBtnSelect->setEnabled(stateFlag && !disableALL);
mBtnDelete->setEnabled(stateFlag && !disableALL);
mBtnEdit->setEnabled(stateFlag && !disableALL);
// mBtnDelete->setEnabled(stateFlag && !disableALL);
// mBtnEdit->setEnabled(stateFlag && !disableALL);
mBtnAdd->setEnabled(!disableALL);
}
void SelectFormWidget::initGeneralButtons(QHBoxLayout *layout) {
mBtnAccount->setObjectName("btnAccount");
mBtnWorklist->setObjectName("btnWorklist");
mBtnAccount->setText(tr("Account"));
mBtnWorklist->setText(tr("Worklist"));
layout->addWidget(mBtnAccount);
layout->addWidget(mBtnWorklist);
// mBtn account slot
connect(mBtnAccount, &QToolButton::clicked, DialogManager::Default(),&DialogManager::requestEditSelfAccount);
connect(mBtnWorklist, &QToolButton::clicked, [&]()
@@ -92,24 +89,17 @@ void SelectFormWidget::initGeneralButtons(QHBoxLayout *layout) {
void SelectFormWidget::initPatEditButtons(QHBoxLayout *layout) {
mBtnAdd->setObjectName("btnAdd");
mBtnEdit->setObjectName("btnEdit");
mBtnDelete->setObjectName("btnDelete");
mBtnWorklist->setObjectName("btnWorklist");
mBtnSelect->setObjectName("btnSelect");
mBtnAdd->setText(tr("Add"));
mBtnEdit->setText(tr("Edit"));
mBtnDelete->setText(tr("Delete"));
mBtnSelect->setText(tr("Select"));
mBtnWorklist->setText(tr("Worklist"));
layout->addWidget(mBtnAdd);
layout->addWidget(mBtnEdit);
layout->addWidget(mBtnDelete);
layout->addWidget(mBtnWorklist);
layout->addWidget(mBtnSelect);
// btn add & edit slot
// btn add slot
connect(mBtnAdd, &QToolButton::clicked, this, &SelectFormWidget::editPatient);
connect(mBtnEdit, &QToolButton::clicked, this, &SelectFormWidget::editPatient);
// btn delete slot
connect(mBtnDelete, &QToolButton::clicked, this, &SelectFormWidget::delPatient);
// mBtn select slot
connect(mBtnSelect, &QToolButton::clicked, this, &SelectFormWidget::selectPatient);
@@ -172,25 +162,18 @@ void SelectFormWidget::selectPatient() {
void SelectFormWidget::initDetailPanel(QHBoxLayout *contentLayout) {// prepare edit panel
patientDetailForm->setObjectName("patientDetailWidget");
patientDetailForm->hide();
// patientDetailForm->hide();
contentLayout->addWidget(patientDetailForm);
auto* btnShowEdit = new VerticalTextToolButton(this);
btnShowEdit->setObjectName("btnShowPanel");
btnShowEdit->setFixedHeight(225);
btnShowEdit->setVerticalText("Patient Detail");
btnShowEdit->hide();
contentLayout->addWidget(btnShowEdit);
contentLayout->setAlignment(btnShowEdit, Qt::AlignTop);
// btn show slot
connect(btnShowEdit, &QToolButton::clicked, [=]() {
patientDetailForm->show();
btnShowEdit->hide();
});
//btn hide slot
connect(patientDetailForm, &PatientDetailForm::hideBtnClicked, [=]() {
patientDetailForm->hide();
btnShowEdit->show();
});
connect(patientDetailForm, &PatientDetailForm::editClicked, this, &SelectFormWidget::editPatient);
connect(patientDetailForm, &PatientDetailForm::deleteClicked, this, &SelectFormWidget::delPatient);
}
void SelectFormWidget::initTableView(QHBoxLayout *contentLayout) {// TableView for patient
@@ -213,9 +196,10 @@ void SelectFormWidget::initTableView(QHBoxLayout *contentLayout) {// TableView f
mPatTable->setColumnWidth(1, 250);
mPatTable->setColumnWidth(2, 250);
mPatTable->setColumnWidth(3, 250);
mPatTable->setColumnWidth(4, 160);
mPatTable->setColumnWidth(5, 120);
mPatTable->setColumnWidth(6, 250);
mPatTable->setColumnWidth(4, 120);
mPatTable->setColumnWidth(5, 80);
mPatTable->setColumnWidth(6, 120);
mPatTable->setColumnHidden(7, true);
contentLayout->addWidget(mPatTable);
//table current row selection changing event
connect(mPatTable, &SlideTableView::currentRowChanged, [=](int row) {

View File

@@ -390,8 +390,8 @@ QWidget#commandWidget QToolButton{
/*------SelectformWidget-----------------------------------------------------*/
QWidget#patientDetailWidget {
min-width: 300px;
max-width: 300px;
min-width: 680px;
max-width: 680px;
margin-top: 5;
}
@@ -418,6 +418,8 @@ QToolButton#btnHidePanel {
border-radius: 0;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
min-height: 50px;
max-height: 50px;
font-size: 20px;
font-weight: normal;
background: #505050;
@@ -432,12 +434,53 @@ QWidget#editcmdWidget {
max-height: 83px;
}
QLineEdit#displayLineEdit:disabled {
background-color: #3c3c3c;
border-bottom-color: #4a88c7;
QLabel#displayTitle {
border-bottom: 1px solid grey;
color: #fcfcfc;
min-height: 50px;
max-height: 50px;
font-size: 40px;
font-weight: Bold;
border-bottom: 1px solid #4a88c7;
font-weight: normal;
}
QLabel#displayDetail {
border-bottom: 1px solid grey;
color: #fcfcfc;
min-height: 50px;
max-height: 50px;
font-size: 40px;
font-weight: Bold;
border-bottom: 1px solid #4a88c7;
font-weight: normal;
}
QLabel#PatInfTitle {
border-bottom: 1px solid grey;
color: #fcfcfc;
min-height: 80px;
max-height: 80px;
font-size: 50px;
font-weight: Bold;
margin-top: 20px;
margin-bottom: 30px;
}
QLabel#PatIcon {
border: 1px solid grey;
qproperty-pixmap:url(":/icons/patient.png");
color: #fcfcfc;
min-height: 200px;
max-height: 200px;
min-width: 200px;
max-width: 200px;
font-size: 40px;
font-weight: Bold;
}
QWidget#commandWidget QToolButton#btnAccount {
qproperty-icon:url(":/icons/account.png");
}
@@ -451,10 +494,16 @@ QToolButton#btnAdd {
}
QToolButton#btnEdit {
border:2px solid grey;
qproperty-toolButtonStyle:ToolButtonTextBesideIcon;
qproperty-iconSize:120px 120px;
qproperty-icon:url(":/icons/details.png");
}
QToolButton#btnDelete {
border:2px solid grey;
qproperty-toolButtonStyle:ToolButtonTextBesideIcon;
qproperty-iconSize:120px 120px;
qproperty-icon:url(":/icons/close_circle.png");
}

File diff suppressed because it is too large Load Diff

View File

@@ -789,13 +789,13 @@ parameters
<message>
<location filename="../SelectFormWidget.cpp" line="46"/>
<source>Worklist</source>
<translation></translation>
<translation>()</translation>
</message>
<message>
<location filename="../SelectFormWidget.cpp" line="57"/>
<location filename="../SelectFormWidget.cpp" line="290"/>
<source>Add</source>
<translation></translation>
<translation>()</translation>
</message>
<message>
<location filename="../SelectFormWidget.cpp" line="58"/>