Data submit success
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include <QToolButton>
|
||||
#include <QTableWidget>
|
||||
#include <QHeaderView>
|
||||
#include <QUuid>
|
||||
#include <QDate>
|
||||
#include "db/SQLHelper.h"
|
||||
#include "editpatientform.h"
|
||||
#include "guimacros.h"
|
||||
@@ -104,6 +106,40 @@ SelectFormWidget::SelectFormWidget(QWidget *parent) :
|
||||
table->clicked(table->currentIndex());
|
||||
edit_patient->setEditEnable(true);
|
||||
});
|
||||
connect(edit_patient, &EditPatientForm::editAccept,[=](PatientInformation* inf){
|
||||
|
||||
// QSqlRecord record = inf->PatientUID.isEmpty()?model->record():model->record(currentRow);
|
||||
int rowCount = model->rowCount();
|
||||
|
||||
bool isAdd = false;
|
||||
if (inf->PatientUID.isEmpty()) {
|
||||
isAdd = true;
|
||||
inf->PatientUID = QUuid::createUuid().toString();
|
||||
printf(inf->PatientUID.toStdString().data());
|
||||
model->insertRow(rowCount);
|
||||
}
|
||||
#define ADD_PATIENT_PROPERTY(val)\
|
||||
model->setData(model->index(rowCount,PatientInformationEnum:: val),inf-> val);
|
||||
// record.setValue(PatientInformationEnum:: val, inf-> val);
|
||||
EDIT_PATIENT()
|
||||
#undef ADD_PATIENT_PROPERTY
|
||||
// model->setData(model->index(rowCount,PatientInformationEnum::BirthDate), QDate::fromString(inf->BirthDate,"yyyy/MM/dd"));
|
||||
// record.setValue(PatientInformationEnum::BirthDate, QDate::fromString(inf->BirthDate,"yyyy/MM/dd"));
|
||||
// if (isAdd)
|
||||
// {
|
||||
// model->insertRecord(1,record);
|
||||
// } else{
|
||||
// model->setRecord(currentRow,record);
|
||||
// }
|
||||
// model->database().transaction();
|
||||
if (model->submitAll())
|
||||
{
|
||||
// model->database().commit();
|
||||
}
|
||||
// else{
|
||||
// model->database().rollback();
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
SelectFormWidget::~SelectFormWidget()
|
||||
|
||||
Reference in New Issue
Block a user