From ea6a6e99e4ba39c14448578d3a71ce0ea14068bc Mon Sep 17 00:00:00 2001 From: sunwen Date: Sat, 14 Sep 2024 13:44:33 +0800 Subject: [PATCH] feat: The gender information which in worklist and local patient table can translate. --- src/dialogs/DialogManager.cpp | 1 - src/dialogs/StartScanProcessDialog.cpp | 8 + src/forms/scan/PatientInformationForm.cpp | 22 +- src/forms/scan/PatientInformationForm.h | 2 +- src/forms/select/LocalTableGenderDelegate.cpp | 21 ++ src/forms/select/LocalTableGenderDelegate.h | 15 + src/forms/select/PatientDetailForm.cpp | 9 +- src/forms/select/PatientDetailForm.h | 1 - src/forms/select/SelectFormWidget.cpp | 9 + src/translations/en_US.ts | 52 +--- src/translations/zh_CN.ts | 256 +++++++++--------- src/utilities/GenderHelper.cpp | 23 ++ src/utilities/GenderHelper.h | 14 + 13 files changed, 245 insertions(+), 188 deletions(-) create mode 100644 src/forms/select/LocalTableGenderDelegate.cpp create mode 100644 src/forms/select/LocalTableGenderDelegate.h create mode 100644 src/utilities/GenderHelper.cpp create mode 100644 src/utilities/GenderHelper.h diff --git a/src/dialogs/DialogManager.cpp b/src/dialogs/DialogManager.cpp index 79619e3..ec4549a 100644 --- a/src/dialogs/DialogManager.cpp +++ b/src/dialogs/DialogManager.cpp @@ -660,7 +660,6 @@ void DialogManager::setFocusToTopDialog() void DialogManager::requestEmergencyButtonPushed(bool aIsLeftButton, bool aIsRest) { - qDebug()<<"requestEmergencyButtonPushed" << aIsLeftButton<mOnlyLeftButton->setEnabled(false); + mUI->mOnlyRightButton->setEnabled(false); + return; + } + if(aPatient->mSelectedScanProtocol == ScanLeftRight) { mUI->mOnlyLeftButton->setEnabled(false); diff --git a/src/forms/scan/PatientInformationForm.cpp b/src/forms/scan/PatientInformationForm.cpp index d24ea82..215f15d 100644 --- a/src/forms/scan/PatientInformationForm.cpp +++ b/src/forms/scan/PatientInformationForm.cpp @@ -4,6 +4,7 @@ #include "event/EventCenter.h" #include "json/ScanJson.h" #include "models/User.h" +#include "utilities/GenderHelper.h" PatientInformationForm::PatientInformationForm(QWidget* parent) : QWidget(parent) @@ -12,10 +13,13 @@ PatientInformationForm::PatientInformationForm(QWidget* parent) , mStudyUID() , mModality() , mMPPSUID() +, mDicomGender() { mUI->setupUi(this); connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() { mUI->retranslateUi(this); + if(!mUI->mScanProtocol->text().isEmpty()) setExecuteProtocol(mIsExecuteProtocolLeft); + mUI->mPatientGender->setText(GenderHelper::getStringfromDicomGender(mDicomGender)); }); } @@ -31,7 +35,8 @@ void PatientInformationForm::setPatientInformation(PatientInformation* informati mUI->mPatientID->setText(information->ID); mUI->mPatientBirthday->setText(information->BirthDate); mUI->mPatientName->setText(information->Name); - mUI->mPatientGender->setText(information->Sex == "F" ? tr("Female") : (information->Sex == "M" ? tr("Male") : tr("Other"))); + mDicomGender = information->Sex; + mUI->mPatientGender->setText(GenderHelper::getStringfromDicomGender(mDicomGender)); } else { @@ -43,6 +48,7 @@ void PatientInformationForm::setPatientInformation(PatientInformation* informati mStudyUID.clear(); mModality.clear(); mMPPSUID.clear(); + mDicomGender.clear(); } } @@ -67,17 +73,6 @@ int PatientInformationForm::getProtocol() return mCurrentProtocol; } -QString PatientInformationForm::getProtocolString(ScanProtocal aProtocal) -{ - switch (aProtocal) - { - case RSTAND: return tr("RSTAND"); - case LSTAND: return tr("LSTAND"); - case LONE: return tr("LONE"); - case RONE: return tr("RONE"); - } -} - QString PatientInformationForm::getPatientID() { return mUI->mPatientID->text(); @@ -107,6 +102,7 @@ void PatientInformationForm::clear() mStudyUID.clear(); mModality.clear(); mMPPSUID.clear(); + mDicomGender.clear(); } const char* PatientInformationForm::getCurrentPatientJsonString(bool empty) @@ -115,7 +111,7 @@ const char* PatientInformationForm::getCurrentPatientJsonString(bool empty) cJSON_AddItemToObject(patientInfoObject, "PatientName", cJSON_CreateString(mUI->mPatientName->text().toStdString().data())); cJSON_AddItemToObject(patientInfoObject, "PatientID", cJSON_CreateString(mUI->mPatientID->text().toStdString().data())); cJSON_AddItemToObject(patientInfoObject, "AccessionNumber", cJSON_CreateString(mUI->mPaitenAccessionNumber->text().toStdString().data())); - cJSON_AddItemToObject(patientInfoObject, "PatientSex", cJSON_CreateString(mUI->mPatientGender->text().toStdString().data())); + cJSON_AddItemToObject(patientInfoObject, "PatientSex", cJSON_CreateString(mDicomGender.toStdString().c_str())); cJSON_AddItemToObject(patientInfoObject, "PatientBirthDate", cJSON_CreateString(mUI->mPatientBirthday->text().replace("/", "").replace("-", "").replace(' ', '.').toStdString().data())); cJSON_AddItemToObject(patientInfoObject, "Laterality", cJSON_CreateString(mIsExecuteProtocolLeft ? "L" : "R")); diff --git a/src/forms/scan/PatientInformationForm.h b/src/forms/scan/PatientInformationForm.h index 47202b2..e9bb4e0 100644 --- a/src/forms/scan/PatientInformationForm.h +++ b/src/forms/scan/PatientInformationForm.h @@ -22,7 +22,6 @@ public: void setPatientInformation(PatientInformation* information); void setAccessionNumber(AccessionInformation* aAccession); int getProtocol(); - QString getProtocolString(ScanProtocal aProtocal); void setExecuteProtocol(bool aIsLeft); void clear(); @@ -37,6 +36,7 @@ private: QString mStudyUID; QString mModality; QString mMPPSUID; + QString mDicomGender; }; #endif // PATIENTINFORMATIONFORM_H diff --git a/src/forms/select/LocalTableGenderDelegate.cpp b/src/forms/select/LocalTableGenderDelegate.cpp new file mode 100644 index 0000000..b5481be --- /dev/null +++ b/src/forms/select/LocalTableGenderDelegate.cpp @@ -0,0 +1,21 @@ +#include "LocalTableGenderDelegate.h" + +#include +#include "utilities/GenderHelper.h" + +LocalTableGenderDelegate::LocalTableGenderDelegate(QObject* aParent) + : QStyledItemDelegate(aParent) +{ + +} + +void LocalTableGenderDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const +{ + QVariant data = index.data(Qt::DisplayRole); + if (data.isValid()) + { + QString gender = GenderHelper::getStringfromDicomGender(data.toString()); + painter->drawText(option.rect, Qt::AlignCenter, gender); + } +} + diff --git a/src/forms/select/LocalTableGenderDelegate.h b/src/forms/select/LocalTableGenderDelegate.h new file mode 100644 index 0000000..513aab6 --- /dev/null +++ b/src/forms/select/LocalTableGenderDelegate.h @@ -0,0 +1,15 @@ +#ifndef LOCALTABLEGENDERDELEGATE_H +#define LOCALTABLEGENDERDELEGATE_H + +#include + +class LocalTableGenderDelegate : public QStyledItemDelegate +{ + Q_OBJECT +public: + LocalTableGenderDelegate(QObject* aParent); + + void paint(QPainter *aPainter, const QStyleOptionViewItem &aOption, const QModelIndex &aIndex) const override; +}; + +#endif // LOCALTABLEGENDERDELEGATE_H diff --git a/src/forms/select/PatientDetailForm.cpp b/src/forms/select/PatientDetailForm.cpp index a3ddcbb..b53dd91 100644 --- a/src/forms/select/PatientDetailForm.cpp +++ b/src/forms/select/PatientDetailForm.cpp @@ -11,6 +11,7 @@ #include #include "event/EventCenter.h" +#include "utilities/GenderHelper.h" PatientDetailLabel::PatientDetailLabel(QLabel* aTitle, QLabel* aText) : mLayout(new QHBoxLayout) @@ -107,7 +108,7 @@ void PatientDetailForm::addDetailLabel(QVBoxLayout *layout, const QString& aTitl void PatientDetailForm::reloadLanguage() { - mLblSex->setText(mStore.Sex == "F" ? tr("Female") : (mStore.Sex == "M" ? tr("Male") : mStore.Sex == "O" ? tr("Other") : "")); + mLblSex->setText(GenderHelper::getStringfromDicomGender(mStore.Sex)); mLblPatInfTitle->setText(tr("Patient Detail")); mLblDOB->setTitle(tr("Birth Date")+":"); mLblName->setTitle(tr("Name")+":"); @@ -117,7 +118,7 @@ void PatientDetailForm::reloadLanguage() mLblProto1->setTitle(tr("Position")+":"); mLblAccno2->setTitle(tr("AccNo")+":"); mLblProto2->setTitle(tr("Position")+":"); - mLblAddDate->setTitle(tr("Add Date")+":"); + mLblAddDate->setTitle(tr("Add Date")+":"); } @@ -151,7 +152,6 @@ void PatientDetailForm::setEmptyInformation() mLblDOB->setText(""); mLblName->setText(""); mLblSex->setText(""); - mCurrentPatientUID = ""; mLblAddDate->setText(""); mLblAccno1->hide(); mLblProto1->hide(); @@ -175,8 +175,7 @@ void PatientDetailForm::setPatientInformation(PatientInformation* aInformation) mLblPatID->setText(aInformation->ID); mLblDOB->setText(aInformation->BirthDate); mLblName->setText(aInformation->Name); - mLblSex->setText((aInformation->Sex == "F" ? tr("Female") : (aInformation->Sex == "M" ? tr("Male") : tr("Other")))); - //mCurrentPatientUID = information->PatientUID; + mLblSex->setText(GenderHelper::getStringfromDicomGender(aInformation->Sex)); mLblAddDate->setText(QDateTime::fromString(aInformation->AddDate, Qt::ISODate).toString("yyyy-MM-dd HH:mm:ss")); int selectAccesionSize = aInformation->mSelectedAccessions.size(); if(selectAccesionSize == 1) diff --git a/src/forms/select/PatientDetailForm.h b/src/forms/select/PatientDetailForm.h index cad542a..e26dd0d 100644 --- a/src/forms/select/PatientDetailForm.h +++ b/src/forms/select/PatientDetailForm.h @@ -51,7 +51,6 @@ private: void setEmptyInformation(); private: - QString mCurrentPatientUID; QString mAddDate; PatientInformation mStore; QLabel* mLblPatInfTitle; diff --git a/src/forms/select/SelectFormWidget.cpp b/src/forms/select/SelectFormWidget.cpp index 914a05f..2b8159c 100644 --- a/src/forms/select/SelectFormWidget.cpp +++ b/src/forms/select/SelectFormWidget.cpp @@ -21,6 +21,7 @@ #include "log/LogManager.h" #include "components/VerticalTextToolButton.h" #include "PatientAddDateDelegate.h" +#include "LocalTableGenderDelegate.h" #include "dicom/WorkListManager.h" #include "utilities/ScanProcessSequence.h" #include "WorklistTableView.h" @@ -302,6 +303,8 @@ void SelectFormWidget::initTableView() PatientAddDateDelegate* patientAddDateDelegate = new PatientAddDateDelegate(mLocalPatTable); mLocalPatTable->setItemDelegateForColumn(5, patientAddDateDelegate); + LocalTableGenderDelegate* patientGenderDelegate = new LocalTableGenderDelegate(mLocalPatTable); + mLocalPatTable->setItemDelegateForColumn(4, patientGenderDelegate); } void SelectFormWidget::initDataModel() { @@ -366,6 +369,7 @@ void SelectFormWidget::reloadLanguage(){ mLocalPatientModel->setHeaderData(4, Qt::Horizontal, tr("Gender")); mLocalPatientModel->setHeaderData(5, Qt::Horizontal, tr("Add Date")); mLocalPatientModel->setHeaderData(6, Qt::Horizontal, tr("Comment")); + mLocalPatTable->update(); mBtnEdit->setText(tr("Edit")); mBtnDelete->setText(tr("Delete")); @@ -376,6 +380,11 @@ void SelectFormWidget::reloadLanguage(){ mTabWidget->setTabText(0,tr("Worklist")); mTabWidget->setTabText(1, tr("Local")); + + if(mTabWidget->currentIndex() == 0) + { + mWorklistTableSelectModel->clearSelect(); + } } void SelectFormWidget::updateDataByAnonymousMode(){ diff --git a/src/translations/en_US.ts b/src/translations/en_US.ts index c07e7de..11fd4b8 100644 --- a/src/translations/en_US.ts +++ b/src/translations/en_US.ts @@ -1252,18 +1252,6 @@ progress:99% Name - - Female - - - - Male - - - - Other - - Scan with this Patient? @@ -1350,22 +1338,6 @@ progress:99% Patient ID: ID: - - RSTAND - - - - LSTAND - - - - LONE - - - - RONE - - Left @@ -1374,18 +1346,6 @@ progress:99% Right - - Female - - - - Male - - - - Other - - QObject @@ -1429,6 +1389,18 @@ progress:99% Last 7 days + + Female + + + + Male + + + + Other + + ReconFormWidget diff --git a/src/translations/zh_CN.ts b/src/translations/zh_CN.ts index 6b53b4b..d736f1c 100644 --- a/src/translations/zh_CN.ts +++ b/src/translations/zh_CN.ts @@ -469,27 +469,27 @@ DeviceManager - - - + + + DMS connection error DMS失去连接 - - + + progress:%1% 进度:%1% - + Patient can leave. progress:%1% 检查对象可以起身 进度:%1% - + Data quality assessment in progress progress:99% 数据质量判断中 @@ -497,8 +497,8 @@ progress:99% - - + + Initialize Failed. 初始化失败 @@ -518,91 +518,91 @@ progress:99% 设备状态错误,无法开始空水扫查 - + Scan completed! 扫查结束 - + Error: 错误: - + Start scan failed. Reason:time out. 扫查启动失败,原因:超时 - + Start scan failed. Reason:%1 扫查启动失败,原因:%1 - + Start CE Scan Failed. CE扫查启动失败 - + Data is currently being transmitted, please shut down later. 数据传输中,请稍后再执行关机。 - + Shut down failed, please push emergency button to shutdown. 关机失败,请按紧急按钮进行关机。 - - - + + + Scan data transfer failed. 扫查数据上传失败 - + Scan data transfer Succeeded! - + Create empty scan data failed 空水数据新增失败 - + Create scan data failed 扫查数据新增失败 - + Recon disconnected. 重建服务器已断开连接 - - + + Open pump failed. 排水阀打开失败 - + Recon error, can't start scan process 重建服务器错误,无法开始检查流程 - - + + Start auto locate failed 自动化定位启动失败 - + The data quality is low, please restart the data scan. 扫查数据质量较低,请重新开始检查流程 - + Device reset failed, please contact maintenance person 设备复位失败,请联系维修人员 @@ -622,12 +622,12 @@ progress:99% 过去7天 - + The left emergency button has been pressed. Please reset left the emergency button before operating the device 检查对象左侧急停按钮被按下,请将左侧急停按钮复位后,再进行设备操作 - + The right emergency button has been pressed. Please reset right the emergency button before operating the device 检查对象右侧急停按钮被按下,请将右侧急停按钮复位后,再进行设备操作 @@ -1870,8 +1870,8 @@ progress:99% DICOM - - + + Name 姓名 @@ -1884,8 +1884,8 @@ progress:99% 备注 - - + + Gender 性别 @@ -1898,65 +1898,59 @@ progress:99% 删除 - - Female - + - - Male - + - - Other - 其他 + 其他 - - + + Patient Detail 当前检查对象信息 - - + + Birth Date 出生日期 - - + + PatientID 检查对象ID - - - - - - AccNo - 检查单号 - + AccNo + 检查单号 + + + + + + Position 检查身侧 - - + + Add Date 添加日期 - + Scan with this Patient? @@ -1965,12 +1959,12 @@ progress:99% 扫描协议 - + Left 单侧左 - + Right 单侧右 @@ -2041,47 +2035,40 @@ progress:99% 检查身侧: - Female - + - Male - + - Other - 其他 + 其他 - RSTAND - 从右至左 + 从右至左 - LSTAND - 从左至右 + 从左至右 - LONE - 单侧左 + 单侧左 - RONE - 单侧右 + 单侧右 - + Left 左侧 - + Right 右侧 @@ -2154,6 +2141,21 @@ progress:99% Last 7 days 过去7天 + + + Female + + + + + Male + + + + + Other + 其他 + ReconFormWidget @@ -2166,44 +2168,44 @@ progress:99% 刷新 - - + + Patient ID 检查对象ID - - + + Accession Number 检查单号 - - + + Patient Name 检查对象姓名 - - + + Operator Name 操作员 - - + + Scan Time 检查时间 - - + + Laterality 检查位置 - - + + State 重建状态 @@ -2546,81 +2548,81 @@ parameters 账户 - - + + Worklist 在线 - - + + Add 新增 - - + + Edit 编辑 - - + + Patient Information Manage 检查对象信息录入 - - + + Local 本地 - - + + Delete 删除 - - + + Pull 拉取 - - + + Select 选择 - + Can't delete selected Patient ! 不能删除已经被选择的对象 - - + + Alert - + Delete Patient "%1" ? 删除检查对象"%1"? - + Confirm 确认 - + Can't delete selected Patient , db submit error! - + ID 检查对象ID @@ -2629,32 +2631,32 @@ parameters 检查单号 - - + + Name 姓名 - - + + Birth Date 出生日期 - - + + Gender 性别 - - + + Add Date 添加日期 - - + + Comment 备注 diff --git a/src/utilities/GenderHelper.cpp b/src/utilities/GenderHelper.cpp new file mode 100644 index 0000000..a2e5cfe --- /dev/null +++ b/src/utilities/GenderHelper.cpp @@ -0,0 +1,23 @@ +#include "GenderHelper.h" + +#include + +QString GenderHelper::getStringfromDicomGender(const QString& aGender) +{ + if(aGender.toLower() == "f") + { + return QObject::tr("Female"); + } + + if(aGender.toLower() == "m") + { + return QObject::tr("Male"); + } + + if(aGender.toLower() == "o") + { + return QObject::tr("Other"); + } + + return ""; +} diff --git a/src/utilities/GenderHelper.h b/src/utilities/GenderHelper.h new file mode 100644 index 0000000..165d228 --- /dev/null +++ b/src/utilities/GenderHelper.h @@ -0,0 +1,14 @@ +#ifndef GENDERHELPER_H +#define GENDERHELPER_H + +#include + +class GenderHelper +{ +public: + GenderHelper() = delete; + + static QString getStringfromDicomGender(const QString& aGender); +}; + +#endif // GENDERHELPER_H