2021-10-09 16:38:34 +08:00
|
|
|
#include "patientinformationform.h"
|
|
|
|
|
#include "ui_patientinformationform.h"
|
2021-10-14 14:38:31 +08:00
|
|
|
#include "json/cJSON.h"
|
2021-10-09 16:38:34 +08:00
|
|
|
PatientInformationForm::PatientInformationForm(QWidget *parent) :
|
|
|
|
|
QWidget(parent),
|
|
|
|
|
ui(new Ui::PatientInformationForm)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
2021-12-23 16:22:51 +08:00
|
|
|
ui->lbl_ID->setText("");
|
|
|
|
|
ui->lbl_Date->setText("");
|
|
|
|
|
ui->lbl_Name->setText("");
|
|
|
|
|
ui->lbl_Sex->setText("");
|
|
|
|
|
ui->lbl_Acc->setText("");
|
2021-10-09 16:38:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PatientInformationForm::~PatientInformationForm()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
2021-10-14 14:38:31 +08:00
|
|
|
delete inf;
|
|
|
|
|
delete jsonstr;
|
2021-10-12 17:43:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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) {
|
2021-10-14 14:38:31 +08:00
|
|
|
currentProtocol = type;
|
2021-10-12 17:43:12 +08:00
|
|
|
switch(type)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
2021-12-23 16:22:51 +08:00
|
|
|
ui->lbl_Protocol->setText("LEFT ONLY");
|
2021-10-12 17:43:12 +08:00
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
default:
|
2021-12-23 16:22:51 +08:00
|
|
|
ui->lbl_Protocol->setText("RIGHT ONLY");
|
2021-10-12 17:43:12 +08:00
|
|
|
break;
|
|
|
|
|
}
|
2021-10-09 16:38:34 +08:00
|
|
|
}
|
2021-10-14 14:38:31 +08:00
|
|
|
|
|
|
|
|
const char *PatientInformationForm::getCurrentPatientJsonString(bool empty) {
|
|
|
|
|
cJSON* root=cJSON_CreateObject();
|
2021-10-21 12:33:49 +08:00
|
|
|
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()));
|
2021-10-14 14:38:31 +08:00
|
|
|
cJSON_AddItemToObject(root, "PatientBirthDate",
|
2021-12-23 16:22:51 +08:00
|
|
|
cJSON_CreateString(ui->lbl_Date->text().replace("/","").replace("-","").replace(' ','.').toStdString().data()));
|
2021-10-14 14:38:31 +08:00
|
|
|
cJSON_AddItemToObject(root, "Laterality",cJSON_CreateString(currentProtocol?"R":"L"));
|
2021-11-09 17:33:24 +08:00
|
|
|
cJSON_AddItemToObject(root, "IsEmptyData",cJSON_CreateNumber(empty?1:0));
|
2021-10-14 14:38:31 +08:00
|
|
|
cJSON_AddItemToObject(root, "OperatorName",cJSON_CreateString("Bob"));
|
|
|
|
|
cJSON_AddItemToObject(root, "ReferringPhysicianName",cJSON_CreateString("XX"));
|
2021-11-09 09:19:09 +08:00
|
|
|
cJSON_AddItemToObject(root, "InstitutionName",cJSON_CreateString("EQ9"));
|
|
|
|
|
cJSON_AddItemToObject(root, "InstitutionAddress",cJSON_CreateString("HZ"));
|
2021-10-28 09:09:09 +08:00
|
|
|
delete jsonstr;
|
2021-10-14 14:38:31 +08:00
|
|
|
jsonstr = cJSON_Print(root);
|
|
|
|
|
cJSON_Delete(root);
|
|
|
|
|
return jsonstr;
|
|
|
|
|
}
|