Rename patientinformationform to PatientInformationForm.

This commit is contained in:
Krad
2022-06-14 17:15:23 +08:00
parent 487adba746
commit 65f8fdff05
6 changed files with 265 additions and 234 deletions

View 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;
}