User operation log, v1

This commit is contained in:
Krad
2021-11-19 15:36:12 +08:00
parent bca10e3e60
commit 99754ab84f
9 changed files with 144 additions and 44 deletions

View File

@@ -15,6 +15,7 @@
#include "event/EventCenter.h"
#include "AccountFormDialog.h"
#include <qDebug>
#include "log/UserOperationLog.h"
#define ADD_CENTER_ITEM(row,col,text)\
item = new QTableWidgetItem(text);\
@@ -137,7 +138,8 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
});
connect(edit_patient, &EditPatientForm::editAccept,[=](PatientInformation* inf){
int selectedRow = currentRow;
if (inf->PatientUID.isEmpty()) {
bool isAdd = inf->PatientUID.isEmpty();
if (isAdd) {
selectedRow = model->rowCount();
inf->PatientUID = QUuid::createUuid().toString();
printf(inf->PatientUID.toStdString().data());
@@ -155,6 +157,13 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
else{
//TODO:add some error handle logic
}
if(isAdd){
LOG_USER_OPERATION(AddPatient);
}
else
{
LOG_USER_OPERATION(ChangePatientInfo);
}
btnSelect->setEnabled(true);
});
@@ -170,11 +179,12 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
table->selectRow(0);
model->selectRow(0);
PatientInformation pat;
#define ADD_PATIENT_PROPERTY(val)\
pat. val = model->data(model->index(0,PatientInformationEnum:: val)).toString();
#define ADD_PATIENT_PROPERTY(val)\
pat. val = model->data(model->index(0,PatientInformationEnum:: val)).toString();
EDIT_PATIENT()
#undef ADD_PATIENT_PROPERTY
#undef ADD_PATIENT_PROPERTY
edit_patient->setPatientInformation(&pat);
LOG_USER_OPERATION(DeletePatient);
} else{
currentRow=-1;
}
@@ -188,6 +198,7 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
connect(btnSelect, &QToolButton::clicked,[=](){
if (currentRow<0)return;
EventCenter::Default()->triggerEvent(GUIEvents::PatientSelected, nullptr,edit_patient->getPatientInformation()->Copy());
LOG_USER_OPERATION(SelectPatient);
});
connect(btnAccount, &QToolButton::clicked,[=](){