From 0634b1b68ebae67df40eabea09f27d042476f185 Mon Sep 17 00:00:00 2001 From: sunwen Date: Fri, 8 Sep 2023 15:55:16 +0800 Subject: [PATCH] Add PatientList auto delete. --- cfgs/usct-product | 3 +++ cfgs/usct-product.json | 3 +++ src/device/DeviceManager.cpp | 9 +++++++-- src/json/jsonobject.cpp | 5 +++++ src/json/jsonobject.h | 1 + 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cfgs/usct-product b/cfgs/usct-product index c01f77f..1ddd3b3 100644 --- a/cfgs/usct-product +++ b/cfgs/usct-product @@ -79,5 +79,8 @@ }, "dms":{ "simulator": true + }, + "patientlist":{ + "expire":"7" } } \ No newline at end of file diff --git a/cfgs/usct-product.json b/cfgs/usct-product.json index ae61434..e2720ac 100644 --- a/cfgs/usct-product.json +++ b/cfgs/usct-product.json @@ -98,5 +98,8 @@ }, "dms": { "simulator": true + }, + "patientlist":{ + "expire":"7" } } \ No newline at end of file diff --git a/src/device/DeviceManager.cpp b/src/device/DeviceManager.cpp index 26f2776..ec4a28d 100644 --- a/src/device/DeviceManager.cpp +++ b/src/device/DeviceManager.cpp @@ -151,9 +151,10 @@ void DeviceManager::initDevice() connect(ReconManager::getInstance(), &ReconManager::restartCreatReconRecord, this, &DeviceManager::startCreateReconRecord); connect(ReconManager::getInstance(), &ReconManager::checkReconConnectionResponsed, this, &DeviceManager::updateReconConnectionState); mReconHttpThread->start(); - QMetaObject::invokeMethod(ReconManager::getInstance(), "checkReconConnection", Qt::QueuedConnection); + mTemperatureTimer = startTimer(GET_TEMPERATURE_TIME); //init dms status--------------------make a function future + QMetaObject::invokeMethod(ReconManager::getInstance(), "checkReconConnection", Qt::QueuedConnection); if(JsonObject::Instance()->isDmsSimulator()) { //set simulator @@ -188,7 +189,11 @@ void DeviceManager::initDevice() startTransfer(); initEmptyScanMeasurementID(); - mTemperatureTimer = startTimer(GET_TEMPERATURE_TIME); + + //process expired patient list + QDate date = QDate::currentDate().addDays(-JsonObject::Instance()->getPatientListExpireDays()); + SQLHelper::exec(QString("DELETE FROM Patient WHERE AddDate <= %1").arg(date.toString("yyyy-MM-dd"))); + //mGetSoftwareVersionAction->execute(); diff --git a/src/json/jsonobject.cpp b/src/json/jsonobject.cpp index e5c1a3f..67bbe2e 100644 --- a/src/json/jsonobject.cpp +++ b/src/json/jsonobject.cpp @@ -554,3 +554,8 @@ int JsonObject::getOperationLogExpireDays() { return QString(getJsonString("operatorlog", "expire")).toInt(); } + +int JsonObject::getPatientListExpireDays() +{ + return QString(getJsonString("patientlist", "expire")).toInt(); +} diff --git a/src/json/jsonobject.h b/src/json/jsonobject.h index 2b7f73b..90168a0 100644 --- a/src/json/jsonobject.h +++ b/src/json/jsonobject.h @@ -111,6 +111,7 @@ public: QStringList getScreenSaverInfomation(); int getOperationLogExpireDays(); + int getPatientListExpireDays(); private: