Update to dms control phase1.

This commit is contained in:
sunwen
2023-08-21 14:22:41 +08:00
parent d1dc5df680
commit 20fb814608
59 changed files with 2538 additions and 904 deletions

View File

@@ -3,6 +3,7 @@
#include "json/cJSON.h"
#include "event/EventCenter.h"
#include "json/ScanJson.h"
#include "models/User.h"
PatientInformationForm::PatientInformationForm(QWidget* parent)
: QWidget(parent)
@@ -45,21 +46,25 @@ void PatientInformationForm::setProtocol(int type) {
}
}
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",
const char* PatientInformationForm::getCurrentPatientJsonString(bool empty)
{
cJSON* patientInfoObject = cJSON_CreateObject();
cJSON_AddItemToObject(patientInfoObject, "PatientName", cJSON_CreateString(mUI->lbl_Name->text().replace(' ', '_').toStdString().data()));
cJSON_AddItemToObject(patientInfoObject, "PatientID", cJSON_CreateString(mUI->lbl_ID->text().replace(' ', '_').toStdString().data()));
cJSON_AddItemToObject(patientInfoObject, "PatientSex", cJSON_CreateString(mUI->lbl_Sex->text().toStdString().data()));
cJSON_AddItemToObject(patientInfoObject, "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"));
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()));
cJSON_AddItemToObject(patientInfoObject, "ReferringPhysicianName", cJSON_CreateString("XX"));
cJSON_AddItemToObject(patientInfoObject, "InstitutionName", cJSON_CreateString("EQ9"));
cJSON_AddItemToObject(patientInfoObject, "InstitutionAddress", cJSON_CreateString("HZ"));
cJSON* rootObject = cJSON_CreateObject();
cJSON_AddItemToObject(rootObject, "Patient Info", patientInfoObject);
delete mJsonStr;
mJsonStr = cJSON_Print(root);
ScanJson::Current()->store(root);
mJsonStr = cJSON_PrintUnformatted (rootObject);
ScanJson::Current()->store(rootObject);
return mJsonStr;
}

View File

@@ -3,7 +3,7 @@
//
#include "ScanFormWidget.h"
#include "ui_tabformwidget.h"
#include "ui_TabFormWidget.h"
#include <QVBoxLayout>
#include <QToolButton>
@@ -16,6 +16,7 @@
#include "event/EventCenter.h"
#include "log/UserOperationLog.h"
#include "json/jsonobject.h"
#include "device/DeviceManager.h"
#ifdef WIN32
#else
@@ -157,7 +158,7 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout){
connect(mBtnScan, &QToolButton::clicked, [=]() {
QString patientInf(mPatInf->getCurrentPatientJsonString(false));
LOG_USER_OPERATION(StartScan)
if (!JsonObject::Instance()->getEmptyScanID()){
if (!DeviceManager::Default()->hasValidEmptyScan()){
QString msg(tr("No refresh data exists, please do Refresh operation first."));
EventCenter::Default()->triggerEvent(DeviceErrorRaise, nullptr, (QObject*)(&msg));
return;
@@ -166,7 +167,7 @@ void ScanFormWidget::initScanControlBar(QHBoxLayout *layout){
});
connect(mBtnStop, &QToolButton::clicked, [=]() {
LOG_USER_OPERATION(Stop)
EventCenter::Default()->triggerEvent(RequestStop, nullptr, nullptr);
EventCenter::Default()->triggerEvent(RequestPreviewStop, nullptr, nullptr);
});
connect(mBtnDrainage, &QToolButton::toggled, [=](bool aSatus) {
//Drainage
@@ -218,7 +219,7 @@ void ScanFormWidget::renderLoading() {
mViewer->setPixmap(pic);
}
void ScanFormWidget::renderPreviewData(const QObject *sender,const QObject *data) {
void ScanFormWidget::renderPreviewData(const QObject* /*sender*/,const QObject *data) {
if (!data)return;
auto array = (QByteArray*)data;
auto raw_dataptr = (uchar*)array->data();
@@ -268,7 +269,7 @@ void ScanFormWidget::initEvents() {//Events-------------------------------------
}
mPatInf->setPatientInformation((PatientInformation*)data);
});
connect(EventCenter::Default(), &EventCenter::ResponseStop, [=](QObject* sender, QObject* data) {
connect(EventCenter::Default(), &EventCenter::ResponseStopPreview, [=](QObject* sender, QObject* data) {
setPreviewing(false);
});
connect(EventCenter::Default(), &EventCenter::ResponsePreview, this,&ScanFormWidget::renderLoading);

View File

@@ -38,7 +38,7 @@ private:
void initScanControlBar(QHBoxLayout *layout);
void initScanContent();
void renderLoading();
void renderPreviewData(const QObject *sender,const QObject *data);
void renderPreviewData(const QObject* sender, const QObject *data);
void reloadLanguage();
private slots:
void protocolChanged(int type);