65 lines
2.2 KiB
C++
65 lines
2.2 KiB
C++
#include "patientinformationform.h"
|
|
#include "ui_patientinformationform.h"
|
|
#include "json/cJSON.h"
|
|
#include "event/EventCenter.h"
|
|
#include "json/ScanJson.h"
|
|
|
|
PatientInformationForm::PatientInformationForm(QWidget* parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::PatientInformationForm)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
|
ui->retranslateUi(this);
|
|
});
|
|
}
|
|
|
|
PatientInformationForm::~PatientInformationForm()
|
|
{
|
|
delete ui;
|
|
delete inf;
|
|
delete jsonstr;
|
|
}
|
|
|
|
void PatientInformationForm::setPatientInformation(PatientInformation* information) {
|
|
ui->lbl_ID->setText(information->ID);
|
|
ui->lbl_Date->setText(information->BirthDate);
|
|
ui->lbl_Name->setText(information->Name);
|
|
ui->lbl_Sex->setText(information->Sex);
|
|
inf = information;
|
|
}
|
|
|
|
void PatientInformationForm::setProtocol(int type) {
|
|
currentProtocol = type;
|
|
switch (type)
|
|
{
|
|
case 0:
|
|
ui->lbl_Protocol->setText(tr("LEFT ONLY"));
|
|
break;
|
|
case 1:
|
|
default:
|
|
ui->lbl_Protocol->setText(tr("RIGHT ONLY"));
|
|
break;
|
|
}
|
|
}
|
|
|
|
const char* PatientInformationForm::getCurrentPatientJsonString(bool empty) {
|
|
cJSON* root = cJSON_CreateObject();
|
|
cJSON_AddItemToObject(root, "PatientName", cJSON_CreateString(ui->lbl_Name->text().replace(' ', '_').toStdString().data()));
|
|
cJSON_AddItemToObject(root, "PatientID", cJSON_CreateString(ui->lbl_ID->text().replace(' ', '_').toStdString().data()));
|
|
cJSON_AddItemToObject(root, "PatientSex", cJSON_CreateString(ui->lbl_Sex->text().toStdString().data()));
|
|
cJSON_AddItemToObject(root, "PatientBirthDate",
|
|
cJSON_CreateString(ui->lbl_Date->text().replace("/", "").replace("-", "").replace(' ', '.').toStdString().data()));
|
|
cJSON_AddItemToObject(root, "Laterality", cJSON_CreateString(currentProtocol ? "R" : "L"));
|
|
cJSON_AddItemToObject(root, "IsEmptyData", cJSON_CreateNumber(empty ? 1 : 0));
|
|
cJSON_AddItemToObject(root, "OperatorName", cJSON_CreateString("Bob"));
|
|
cJSON_AddItemToObject(root, "ReferringPhysicianName", cJSON_CreateString("XX"));
|
|
cJSON_AddItemToObject(root, "InstitutionName", cJSON_CreateString("EQ9"));
|
|
cJSON_AddItemToObject(root, "InstitutionAddress", cJSON_CreateString("HZ"));
|
|
delete jsonstr;
|
|
jsonstr = cJSON_Print(root);
|
|
ScanJson::Current()->store(root);
|
|
return jsonstr;
|
|
}
|