Create a method to get Patient json from current patient.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "patientinformationform.h"
|
||||
#include "ui_patientinformationform.h"
|
||||
|
||||
#include "json/cJSON.h"
|
||||
PatientInformationForm::PatientInformationForm(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::PatientInformationForm)
|
||||
@@ -11,7 +11,8 @@ PatientInformationForm::PatientInformationForm(QWidget *parent) :
|
||||
PatientInformationForm::~PatientInformationForm()
|
||||
{
|
||||
delete ui;
|
||||
if (inf) delete inf;
|
||||
delete inf;
|
||||
delete jsonstr;
|
||||
}
|
||||
|
||||
void PatientInformationForm::setPatientInformation(PatientInformation* information) {
|
||||
@@ -23,6 +24,7 @@ void PatientInformationForm::setPatientInformation(PatientInformation* informati
|
||||
}
|
||||
|
||||
void PatientInformationForm::setProtocol(int type) {
|
||||
currentProtocol = type;
|
||||
switch(type)
|
||||
{
|
||||
case 0:
|
||||
@@ -34,3 +36,22 @@ void PatientInformationForm::setProtocol(int type) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const char *PatientInformationForm::getCurrentPatientJsonString(bool empty) {
|
||||
cJSON* root=cJSON_CreateObject();
|
||||
cJSON_AddItemToObject(root, "PatientName",cJSON_CreateString(ui->lbl_Name->text().toStdString().data()));
|
||||
cJSON_AddItemToObject(root, "PatientID",cJSON_CreateString(ui->lbl_ID->text().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("-","").toStdString().data()));
|
||||
cJSON_AddItemToObject(root, "Laterality",cJSON_CreateString(currentProtocol?"R":"L"));
|
||||
cJSON_AddItemToObject(root, "EmptyDataFlag",cJSON_CreateNumber(empty?1:0));
|
||||
cJSON_AddItemToObject(root, "OperatorName",cJSON_CreateString("Bob"));
|
||||
cJSON_AddItemToObject(root, "ReferringPhysicianName",cJSON_CreateString("XX"));
|
||||
cJSON_AddItemToObject(root, "InstituteName",cJSON_CreateString("EQ9"));
|
||||
cJSON_AddItemToObject(root, "InstituteAddress",cJSON_CreateString("HZ"));
|
||||
delete jsonstr;
|
||||
jsonstr = cJSON_Print(root);
|
||||
cJSON_Delete(root);
|
||||
return jsonstr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user