2024-10-30 09:27:16 +08:00
|
|
|
#include "medicalrecordmanager.h"
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QDebug>
|
|
|
|
|
2024-11-06 15:59:13 +08:00
|
|
|
MedicalRecordManager::MedicalRecordManager(QWidget * parent):QWidget(parent)
|
2024-10-30 09:27:16 +08:00
|
|
|
{
|
|
|
|
init();
|
|
|
|
initLay();
|
|
|
|
initConnect();
|
2024-11-06 15:59:13 +08:00
|
|
|
initTable();
|
2024-11-07 16:02:31 +08:00
|
|
|
|
2024-11-07 15:11:15 +08:00
|
|
|
m_labMedRecManager.setStyleSheet("QLabel { font-size: 14px;\
|
|
|
|
color: rgb(13,157,219); }\
|
|
|
|
");
|
2024-11-07 14:20:38 +08:00
|
|
|
m_btnOpen.setStyleSheet("QPushButton{\
|
|
|
|
background: white;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: rgb(85, 85, 85);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: rgb(80, 80, 80);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
m_btnEdit.setStyleSheet("QPushButton{\
|
|
|
|
background: white;\
|
|
|
|
color: green;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: rgb(85, 85, 85);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: rgb(80, 80, 80);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
m_btnExport.setStyleSheet("QPushButton{\
|
|
|
|
background: white;\
|
|
|
|
color: blue;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: rgb(85, 85, 85);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: rgb(80, 80, 80);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
m_btnDelete.setStyleSheet("QPushButton{\
|
|
|
|
background: red;\
|
|
|
|
color:white;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: rgb(85, 85, 85);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: rgb(80, 80, 80);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
//上一页
|
|
|
|
m_btnUpPage.setStyleSheet("QPushButton{\
|
2024-11-07 16:19:36 +08:00
|
|
|
border-image:url(:/image/setting_btn_left.png);\
|
2024-11-07 14:20:38 +08:00
|
|
|
background: white;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: rgb(85, 85, 85);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: rgb(80, 80, 80);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
//下一页
|
|
|
|
m_btnNetPage.setStyleSheet("QPushButton{\
|
2024-11-07 16:19:36 +08:00
|
|
|
border-image:url(:/image/setting_btn_right.png);\
|
2024-11-07 14:20:38 +08:00
|
|
|
background: white;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: rgb(85, 85, 85);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: rgb(80, 80, 80);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
//首页
|
|
|
|
m_btnfirstPage.setStyleSheet("QPushButton{\
|
2024-11-07 16:19:36 +08:00
|
|
|
border-image:url(:/image/setting_btn_firstPage.png);\
|
2024-11-07 14:20:38 +08:00
|
|
|
background: white;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: rgb(85, 85, 85);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: rgb(80, 80, 80);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
|
|
|
//尾页
|
|
|
|
m_btnlastPage.setStyleSheet("QPushButton{\
|
2024-11-07 16:19:36 +08:00
|
|
|
border-image:url(:/image/setting_btn_lastPage.png);\
|
2024-11-07 14:20:38 +08:00
|
|
|
background: white;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:hover{\
|
|
|
|
background: rgb(85, 85, 85);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:pressed{\
|
|
|
|
background: rgb(80, 80, 80);\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}\
|
|
|
|
QPushButton:checked{\
|
|
|
|
background: #0d9ddb;\
|
|
|
|
border-radius:10px;padding:7px 10px;\
|
|
|
|
}");
|
2024-11-07 10:49:44 +08:00
|
|
|
|
2024-11-07 16:02:31 +08:00
|
|
|
|
|
|
|
m_tableWidget.horizontalHeader()->setStyleSheet(
|
|
|
|
"QHeaderView::section{"
|
|
|
|
"border-top:0px solid #E5E5E5;"
|
|
|
|
"border-left:0px solid #E5E5E5;"
|
|
|
|
"border-right:0.5px solid #E5E5E5;"
|
|
|
|
"border-bottom: 0.5px solid #E5E5E5;"
|
|
|
|
"background-color:white;"
|
|
|
|
"padding:4px;"
|
|
|
|
"}"
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2024-10-30 09:27:16 +08:00
|
|
|
}
|
|
|
|
MedicalRecordManager::~MedicalRecordManager()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
void MedicalRecordManager::init()
|
|
|
|
{
|
2024-11-07 15:11:15 +08:00
|
|
|
m_labMedRecManager.setText("病例管理");
|
2024-11-06 17:02:44 +08:00
|
|
|
//QAction
|
2024-11-06 17:11:36 +08:00
|
|
|
m_actSearch = new QAction;
|
|
|
|
m_actSearch->setToolTip("搜索");//设置鼠标悬浮的提示
|
|
|
|
m_actSearch->setIcon(QIcon(":/image/EGG_icon_amplify.png"));//加载显示图片
|
|
|
|
//第二个编辑框
|
|
|
|
m_editSearch.setGeometry(100, 150, 400, 50);//设置编辑框位置大小
|
|
|
|
m_editSearch.setPlaceholderText("请输入你想要搜索的内容");//设置编辑框没有输入内容时的友好提示
|
2024-11-06 17:02:44 +08:00
|
|
|
|
2024-11-06 17:11:36 +08:00
|
|
|
//TrailingPosition:将action放置在右边
|
|
|
|
m_editSearch.addAction(m_actSearch, QLineEdit::LeadingPosition);//QLineEdit::TrailingPosition);
|
2024-10-30 09:27:16 +08:00
|
|
|
|
2024-11-07 10:49:44 +08:00
|
|
|
//打开
|
|
|
|
m_btnOpen.setText(tr("打开"));
|
|
|
|
//编辑
|
|
|
|
m_btnEdit.setText(tr("编辑"));
|
|
|
|
//导出
|
|
|
|
m_btnExport.setText(tr("导出"));
|
|
|
|
//删除
|
|
|
|
m_btnDelete.setText(tr("删除"));
|
|
|
|
//上一页
|
2024-11-07 16:19:36 +08:00
|
|
|
//m_btnUpPage.setText(tr("上一页"));
|
2024-11-07 10:49:44 +08:00
|
|
|
//下一页
|
2024-11-07 16:19:36 +08:00
|
|
|
// m_btnNetPage.setText(tr("下一页"));
|
|
|
|
m_labPageNumTxt.setText(tr("0/0"));
|
2024-11-07 10:49:44 +08:00
|
|
|
//首页
|
2024-11-07 16:19:36 +08:00
|
|
|
// m_btnfirstPage.setText(tr("首页"));
|
2024-11-07 10:49:44 +08:00
|
|
|
//尾页
|
2024-11-07 16:19:36 +08:00
|
|
|
// m_btnlastPage.setText(tr("尾页"));
|
2024-10-30 09:27:16 +08:00
|
|
|
|
2024-11-06 17:02:44 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
void MedicalRecordManager::initLay()
|
|
|
|
{
|
|
|
|
|
|
|
|
QHBoxLayout * hlay = new QHBoxLayout;
|
|
|
|
m_editSearch.setStyleSheet(":/image/EGG_icon_amplify.png");
|
2024-11-07 15:11:15 +08:00
|
|
|
hlay->addWidget(&m_labMedRecManager);
|
2024-11-07 10:49:44 +08:00
|
|
|
hlay->addStretch();
|
2024-11-06 17:02:44 +08:00
|
|
|
hlay->addWidget(&m_editSearch);
|
2024-11-07 10:49:44 +08:00
|
|
|
|
|
|
|
QHBoxLayout * hlay2 = new QHBoxLayout;
|
2024-11-07 16:19:36 +08:00
|
|
|
hlay2->addSpacing(20);
|
2024-11-07 10:49:44 +08:00
|
|
|
hlay2->addWidget(&m_btnOpen);
|
|
|
|
hlay2->addWidget(&m_btnEdit);
|
|
|
|
hlay2->addWidget(&m_btnExport);
|
|
|
|
hlay2->addWidget(&m_btnDelete);
|
|
|
|
hlay2->addStretch();
|
2024-11-07 14:20:38 +08:00
|
|
|
hlay2->addWidget(&m_btnfirstPage);
|
2024-11-07 16:19:36 +08:00
|
|
|
hlay2->addWidget(&m_btnUpPage);//
|
|
|
|
hlay2->addWidget(&m_labPageNumTxt);
|
2024-11-07 10:49:44 +08:00
|
|
|
hlay2->addWidget(&m_btnNetPage);
|
|
|
|
hlay2->addWidget(&m_btnlastPage);
|
|
|
|
|
|
|
|
QVBoxLayout * vlay = new QVBoxLayout;
|
2024-11-07 16:02:31 +08:00
|
|
|
QWidget * w = new QWidget;
|
|
|
|
|
|
|
|
w->setObjectName("MedicalRecordManager");
|
|
|
|
w->setStyleSheet("QWidget#MedicalRecordManager{background:white;}");
|
2024-11-07 10:49:44 +08:00
|
|
|
vlay->addLayout(hlay);
|
|
|
|
vlay->addWidget(&m_tableWidget);
|
2024-11-07 16:02:31 +08:00
|
|
|
w->setLayout(vlay);
|
|
|
|
QVBoxLayout * vlay2 = new QVBoxLayout;
|
|
|
|
vlay2->addWidget(w);
|
|
|
|
vlay2->addLayout(hlay2);
|
|
|
|
setLayout(vlay2);
|
2024-11-07 16:19:36 +08:00
|
|
|
QSize tempSize(80,30);
|
2024-11-07 10:49:44 +08:00
|
|
|
m_btnOpen.setFixedSize(tempSize);
|
|
|
|
m_btnEdit.setFixedSize(tempSize);
|
|
|
|
m_btnExport.setFixedSize(tempSize);
|
|
|
|
m_btnDelete.setFixedSize(tempSize);
|
2024-11-07 16:19:36 +08:00
|
|
|
|
|
|
|
QSize tempSize2(60,30);
|
|
|
|
m_btnfirstPage.setFixedSize(tempSize2);
|
|
|
|
m_btnUpPage.setFixedSize(tempSize2);
|
|
|
|
m_btnNetPage.setFixedSize(tempSize2);
|
|
|
|
m_btnlastPage.setFixedSize(tempSize2);
|
2024-11-07 16:02:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
this->setStyleSheet("QWidget \
|
|
|
|
{\
|
|
|
|
background-color:white;\
|
|
|
|
border-radius:10px;\
|
|
|
|
}"\
|
|
|
|
);
|
|
|
|
m_tableWidget.setStyleSheet("QWidget \
|
|
|
|
{\
|
|
|
|
background-color:white;\
|
|
|
|
border-radius:10px;\
|
|
|
|
}"\
|
|
|
|
);
|
2024-10-30 09:27:16 +08:00
|
|
|
}
|
|
|
|
bool MedicalRecordManager::initConnect()
|
|
|
|
{
|
|
|
|
|
2024-11-06 17:11:36 +08:00
|
|
|
connect(m_actSearch, SIGNAL(triggered(bool)), this, SLOT(slotSearch()));
|
|
|
|
return true;
|
2024-10-30 09:27:16 +08:00
|
|
|
}
|
2024-11-06 17:11:36 +08:00
|
|
|
void MedicalRecordManager::slotSearch()
|
|
|
|
{
|
2024-11-07 10:49:44 +08:00
|
|
|
qDebug()<<"search"<<endl;
|
2024-11-06 15:59:13 +08:00
|
|
|
|
2024-11-06 17:11:36 +08:00
|
|
|
}
|
2024-11-06 15:59:13 +08:00
|
|
|
void MedicalRecordManager::initTable()
|
|
|
|
{
|
|
|
|
m_tableWidget.setFocusPolicy(Qt::NoFocus);
|
|
|
|
m_tableWidget.setColumnCount(8);
|
|
|
|
m_tableWidget.setRowCount(100);
|
|
|
|
//m_tableWidget.setShowGrid(false);
|
|
|
|
QFont font;
|
|
|
|
font.setFamily("SimSun");
|
|
|
|
font.setPixelSize(12);
|
|
|
|
font.setBold(false);
|
|
|
|
m_tableWidget.horizontalHeader()->setFont(font);
|
|
|
|
m_tableWidget.setFont(font);
|
|
|
|
//设置全选按钮
|
2024-11-07 10:49:44 +08:00
|
|
|
//connect(&m_tableWidget, SIGNAL(itemClicked(QTableWidgetItem *)), this, SLOT(slotCilclidItem(QTableWidgetItem *)), Qt::QueuedConnection);
|
2024-11-06 15:59:13 +08:00
|
|
|
|
|
|
|
/* 设置 tableWidget */
|
|
|
|
//m_tableWidget.verticalHeader()->setVisible(true);
|
2024-11-07 16:19:36 +08:00
|
|
|
m_tableWidget.verticalHeader()->setVisible(false);
|
2024-11-06 15:59:13 +08:00
|
|
|
//设置选择一个
|
|
|
|
m_tableWidget.setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
m_tableWidget.setSelectionBehavior(QAbstractItemView::SelectItems);
|
|
|
|
m_tableWidget.setWordWrap(false);
|
|
|
|
/*单个选中 QAbstractItemView::ExtendedSelection); 可以选中多个*/
|
|
|
|
m_tableWidget.horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
|
|
|
m_tableWidget.horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
|
|
|
//m_tableWidget.horizontalHea der()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
|
|
|
m_tableWidget.horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
|
|
|
|
m_tableWidget.horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
|
|
|
m_tableWidget.horizontalHeader()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
|
|
|
|
m_tableWidget.setEditTriggers(QAbstractItemView::NoEditTriggers);
|
2024-11-07 16:02:31 +08:00
|
|
|
m_tableWidget.setShowGrid(false);
|
2024-11-06 15:59:13 +08:00
|
|
|
for (int row = 0; row < m_tableWidget.rowCount(); row++)
|
|
|
|
{
|
|
|
|
QTableWidgetItem *item_id = new QTableWidgetItem;
|
|
|
|
QTableWidgetItem *item_fileName = new QTableWidgetItem;
|
|
|
|
QTableWidgetItem *item_hash = new QTableWidgetItem;
|
|
|
|
QTableWidgetItem *item_butt = new QTableWidgetItem;
|
|
|
|
QTableWidgetItem *item_createDate = new QTableWidgetItem;
|
|
|
|
QTableWidgetItem *item_hash6 = new QTableWidgetItem;
|
|
|
|
QTableWidgetItem *item_butt7 = new QTableWidgetItem;
|
|
|
|
QTableWidgetItem *item_createDate8 = new QTableWidgetItem;
|
|
|
|
item_id->setData(Qt::DisplayRole, "");
|
|
|
|
item_fileName->setData(Qt::DisplayRole, "");
|
|
|
|
|
|
|
|
item_hash->setData(Qt::DisplayRole, "");
|
|
|
|
item_butt->setData(Qt::DisplayRole, "");
|
2024-11-07 10:49:44 +08:00
|
|
|
item_createDate->setData(Qt::DisplayRole, "");
|
2024-11-06 15:59:13 +08:00
|
|
|
|
|
|
|
item_hash6->setData(Qt::DisplayRole, "");
|
|
|
|
item_butt7->setData(Qt::DisplayRole, "");
|
|
|
|
item_createDate8->setData(Qt::DisplayRole, "");
|
|
|
|
|
|
|
|
m_tableWidget.setItem(row, 0, item_id);
|
|
|
|
m_tableWidget.setItem(row, 1, item_fileName);
|
|
|
|
m_tableWidget.setItem(row, 2, item_hash);
|
|
|
|
m_tableWidget.setItem(row, 3, item_butt);
|
|
|
|
m_tableWidget.setItem(row, 4, item_createDate);
|
|
|
|
|
2024-11-07 10:49:44 +08:00
|
|
|
m_tableWidget.setItem(row, 5, item_hash6);
|
|
|
|
m_tableWidget.setItem(row, 6, item_butt7);
|
|
|
|
m_tableWidget.setItem(row, 7, item_createDate8);
|
2024-11-06 15:59:13 +08:00
|
|
|
|
2024-11-07 10:49:44 +08:00
|
|
|
//m_tableWidget.item(row, 4)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
2024-11-06 15:59:13 +08:00
|
|
|
}
|
|
|
|
QStringList lstHHead;
|
2024-11-06 17:11:36 +08:00
|
|
|
/*("序号") "文件") << "修改日期"*/
|
2024-11-06 15:59:13 +08:00
|
|
|
lstHHead << tr("序号") << tr("检查号") << tr("类别") << tr("姓名") <<tr("性别")
|
|
|
|
<< tr("年龄") <<tr("左右利")<<tr("其他信息");
|
|
|
|
m_tableWidget.setHorizontalHeaderLabels(lstHHead);//setWordWrap(true)
|
2024-11-07 10:49:44 +08:00
|
|
|
//m_tableWidget.show();
|
2024-11-06 15:59:13 +08:00
|
|
|
}
|