2022-06-14 17:15:23 +08:00
|
|
|
#include "PatientInformationForm.h"
|
|
|
|
|
#include "ui_PatientInformationForm.h"
|
2021-10-14 14:38:31 +08:00
|
|
|
#include "json/cJSON.h"
|
2021-12-30 13:33:16 +08:00
|
|
|
#include "event/EventCenter.h"
|
2022-05-11 15:44:43 +08:00
|
|
|
#include "json/ScanJson.h"
|
2023-08-21 14:22:41 +08:00
|
|
|
#include "models/User.h"
|
2021-12-30 13:33:16 +08:00
|
|
|
|
2022-06-13 11:21:44 +08:00
|
|
|
PatientInformationForm::PatientInformationForm(QWidget* parent)
|
|
|
|
|
: QWidget(parent)
|
|
|
|
|
, mUI(new Ui::PatientInformationForm)
|
|
|
|
|
, mInfo(nullptr)
|
|
|
|
|
, mJsonStr(nullptr)
|
2021-10-09 16:38:34 +08:00
|
|
|
{
|
2022-06-13 11:21:44 +08:00
|
|
|
mUI->setupUi(this);
|
2021-12-30 13:33:16 +08:00
|
|
|
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
2022-06-13 11:21:44 +08:00
|
|
|
mUI->retranslateUi(this);
|
|
|
|
|
});
|
2021-10-09 16:38:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PatientInformationForm::~PatientInformationForm()
|
|
|
|
|
{
|
2022-06-13 11:21:44 +08:00
|
|
|
delete mUI;
|
|
|
|
|
delete mJsonStr;
|
2021-10-12 17:43:12 +08:00
|
|
|
}
|
|
|
|
|
|
2024-04-29 17:58:17 +08:00
|
|
|
void PatientInformationForm::setPatientInformation(PatientInformationPointer information) {
|
|
|
|
|
if(information)
|
|
|
|
|
{
|
|
|
|
|
mUI->mPatientID->setText(information->ID);
|
|
|
|
|
mUI->mPatientBirthday->setText(information->BirthDate);
|
|
|
|
|
mUI->mPatientName->setText(information->Name);
|
|
|
|
|
mUI->mPatientGender->setText(information->Sex);
|
|
|
|
|
mUI->mPaitenAccessionNumber->setText(information->AccessionNumber);
|
2023-09-15 11:42:40 +08:00
|
|
|
}
|
2024-04-29 17:58:17 +08:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mUI->mPatientID->clear();
|
|
|
|
|
mUI->mPatientBirthday->clear();
|
|
|
|
|
mUI->mPatientName->clear();
|
|
|
|
|
mUI->mPatientGender->clear();
|
|
|
|
|
mUI->mPaitenAccessionNumber->clear();
|
2023-09-15 11:42:40 +08:00
|
|
|
}
|
2024-04-29 17:58:17 +08:00
|
|
|
if (mInfo)
|
|
|
|
|
{
|
2023-09-15 11:42:40 +08:00
|
|
|
mInfo->deleteLater();
|
|
|
|
|
}
|
2022-06-13 11:21:44 +08:00
|
|
|
mInfo = information;
|
2021-10-12 17:43:12 +08:00
|
|
|
}
|
|
|
|
|
|
2024-04-29 17:58:17 +08:00
|
|
|
PatientInformationPointer PatientInformationForm::getPatientInformation()
|
2023-09-08 17:09:49 +08:00
|
|
|
{
|
|
|
|
|
return mInfo->Copy();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int PatientInformationForm::getProtocol()
|
|
|
|
|
{
|
|
|
|
|
return mCurrentProtocol;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-05 16:32:38 +08:00
|
|
|
QString PatientInformationForm::getPatientID()
|
|
|
|
|
{
|
2024-04-29 17:58:17 +08:00
|
|
|
return mUI->mPatientID->text();
|
2023-09-05 16:32:38 +08:00
|
|
|
}
|
|
|
|
|
|
2023-08-21 14:22:41 +08:00
|
|
|
const char* PatientInformationForm::getCurrentPatientJsonString(bool empty)
|
|
|
|
|
{
|
|
|
|
|
cJSON* patientInfoObject = cJSON_CreateObject();
|
2023-09-08 17:09:49 +08:00
|
|
|
cJSON_AddItemToObject(patientInfoObject, "PatientName", cJSON_CreateString(mInfo->Name.toStdString().data()));
|
|
|
|
|
cJSON_AddItemToObject(patientInfoObject, "PatientID", cJSON_CreateString(mInfo->ID.toStdString().data()));
|
|
|
|
|
cJSON_AddItemToObject(patientInfoObject, "AccessionNumber", cJSON_CreateString(mInfo->AccessionNumber.toStdString().data()));
|
|
|
|
|
cJSON_AddItemToObject(patientInfoObject, "PatientSex", cJSON_CreateString(mInfo->Sex.toStdString().data()));
|
2023-08-21 14:22:41 +08:00
|
|
|
cJSON_AddItemToObject(patientInfoObject, "PatientBirthDate",
|
2023-09-08 17:09:49 +08:00
|
|
|
cJSON_CreateString(mInfo->BirthDate.replace("/", "").replace("-", "").replace(' ', '.').toStdString().data()));
|
2023-08-21 14:22:41 +08:00
|
|
|
cJSON_AddItemToObject(patientInfoObject, "Laterality", cJSON_CreateString(mCurrentProtocol ? "R" : "L"));
|
|
|
|
|
cJSON_AddItemToObject(patientInfoObject, "IsEmptyData", cJSON_CreateNumber(empty ? 1 : 0));
|
|
|
|
|
cJSON_AddItemToObject(patientInfoObject, "OperatorName", cJSON_CreateString(User::Current()->getUserName().toStdString().c_str()));
|
2023-11-21 16:36:11 +08:00
|
|
|
cJSON_AddItemToObject(patientInfoObject, "ReferringPhysicianName", cJSON_CreateString(User::Current()->getUserName().toStdString().c_str()));
|
2023-08-21 14:22:41 +08:00
|
|
|
cJSON_AddItemToObject(patientInfoObject, "InstitutionName", cJSON_CreateString("EQ9"));
|
|
|
|
|
cJSON_AddItemToObject(patientInfoObject, "InstitutionAddress", cJSON_CreateString("HZ"));
|
|
|
|
|
|
|
|
|
|
cJSON* rootObject = cJSON_CreateObject();
|
|
|
|
|
cJSON_AddItemToObject(rootObject, "Patient Info", patientInfoObject);
|
2022-06-13 11:21:44 +08:00
|
|
|
delete mJsonStr;
|
2023-08-21 14:22:41 +08:00
|
|
|
mJsonStr = cJSON_PrintUnformatted (rootObject);
|
|
|
|
|
ScanJson::Current()->store(rootObject);
|
2022-06-13 11:21:44 +08:00
|
|
|
return mJsonStr;
|
2021-10-14 14:38:31 +08:00
|
|
|
}
|