Rename patientinformationform to PatientInformationForm.
This commit is contained in:
65
src/forms/scan/PatientInformationForm.cpp
Normal file
65
src/forms/scan/PatientInformationForm.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#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)
|
||||
, mUI(new Ui::PatientInformationForm)
|
||||
, mInfo(nullptr)
|
||||
, mJsonStr(nullptr)
|
||||
{
|
||||
mUI->setupUi(this);
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
||||
mUI->retranslateUi(this);
|
||||
});
|
||||
}
|
||||
|
||||
PatientInformationForm::~PatientInformationForm()
|
||||
{
|
||||
delete mUI;
|
||||
delete mInfo;
|
||||
delete mJsonStr;
|
||||
}
|
||||
|
||||
void PatientInformationForm::setPatientInformation(PatientInformation* information) {
|
||||
mUI->lbl_ID->setText(information->ID);
|
||||
mUI->lbl_Date->setText(information->BirthDate);
|
||||
mUI->lbl_Name->setText(information->Name);
|
||||
mUI->lbl_Sex->setText(information->Sex);
|
||||
mInfo = information;
|
||||
}
|
||||
|
||||
void PatientInformationForm::setProtocol(int type) {
|
||||
mCurrentProtocol = type;
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
mUI->lbl_Protocol->setText(tr("LEFT ONLY"));
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
mUI->lbl_Protocol->setText(tr("RIGHT ONLY"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const char* PatientInformationForm::getCurrentPatientJsonString(bool empty) {
|
||||
cJSON* root = cJSON_CreateObject();
|
||||
cJSON_AddItemToObject(root, "PatientName", cJSON_CreateString(mUI->lbl_Name->text().replace(' ', '_').toStdString().data()));
|
||||
cJSON_AddItemToObject(root, "PatientID", cJSON_CreateString(mUI->lbl_ID->text().replace(' ', '_').toStdString().data()));
|
||||
cJSON_AddItemToObject(root, "PatientSex", cJSON_CreateString(mUI->lbl_Sex->text().toStdString().data()));
|
||||
cJSON_AddItemToObject(root, "PatientBirthDate",
|
||||
cJSON_CreateString(mUI->lbl_Date->text().replace("/", "").replace("-", "").replace(' ', '.').toStdString().data()));
|
||||
cJSON_AddItemToObject(root, "Laterality", cJSON_CreateString(mCurrentProtocol ? "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 mJsonStr;
|
||||
mJsonStr = cJSON_Print(root);
|
||||
ScanJson::Current()->store(root);
|
||||
return mJsonStr;
|
||||
}
|
||||
Reference in New Issue
Block a user