/*! * * Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file VPostTreatmentAdjustTreatmentLog.cpp * \author (last) Behrouz NematiPour * \date (last) 10-Aug-2023 * \author (original) Behrouz NematiPour * \date (original) 11-Apr-2021 * */ #include "VPostTreatmentAdjustTreatmentLog.h" // Qt #include #include // Project #include "GuiController.h" //#include "FileHandler.h" using namespace Storage; VIEW_DEF_CLASS_ADJUSTMENT(VPostTreatmentAdjustmentTreatmentLog) /*! \brief Connection Initializer \details All the class signal/slot connections are defined here. */ void View::VPostTreatmentAdjustmentTreatmentLog::initConnections() { ADJUST_VIEW_CONNECTION(AdjustTreatmentLogRequestData ); ACTION_VIEW_CONNECTION(AdjustTreatmentLogResponseData); ACTION_VIEW_CONNECTION(TreatmentLogAvrgeData); ACTION_VIEW_CONNECTION(TreatmentLogAlarmData); ACTION_VIEW_CONNECTION(TreatmentLogEventData); connect(&_TreatmentLog , &TreatmentLog::isIdleNotified, [=](bool vIdle) { isIdle(vIdle); } ); connect(&_TreatmentLog , &TreatmentLog::didTxCodeReceive, [=](const QString &vTxCode) { txCode( vTxCode ); } ); connect(&_TreatmentLog , &TreatmentLog::didNotification, [=](const QString &vNotification) { notification(vNotification); } ); } /*! * \brief View::VPostTreatmentAdjustmentTreatmentLog::doRequest * \details the invocable slot to send user's treatment log request */ void View::VPostTreatmentAdjustmentTreatmentLog::doRequest() { AdjustTreatmentLogRequestData data; emit didAdjustment(data); } /*! * \brief View::VPostTreatmentAdjustmentTreatmentLog::doExport * \details the invocable slot to send user's treatment log export request to the controller */ void View::VPostTreatmentAdjustmentTreatmentLog::doExport() { _TreatmentLog.doExport(); } /*! * \brief VPostTreatmentAdjustmentUltrafiltrationInit::onActionReceive * \details received response model data handler * \param vData - model data */ void View::VPostTreatmentAdjustmentTreatmentLog::onActionReceive(const AdjustTreatmentLogResponseData &vData) { adjustment_Accepted ( vData.mAccepted ); adjustment_Reason ( vData.mReason ); // init the TreatmentLog model bool isHeparinOff = heparinBolusVolumeOff() && heparinDispensingRateOff(); _TreatmentLog.initModel ( vData, _patientID.trimmed(), isHeparinOff); if ( vData.mAccepted ) { //TODO Commented out for now // It is needed to display NONE for the heparin items if the heparin set to off on Create Treatment Parameters screen. // The problem is the data comes from the _TreatmentLog model // But if that model changes to have the NONE values, then the CloudSync or Cloud may reject the TxLog. // When the Cloud is updated we can as well update the entire flow. // For now it will only updates the display/Gui value. // Look for the https://diality.atlassian.net/browse/DEN-15911 // to know were to update for full model the view update. // When the model updated the valueGui() can be removed and valuesLog() can be used. parametersText ( _TreatmentLog.valuesGui() ); } else { parametersText ( {} ); } // raw values bloodFlowRate ( vData.mBloodFlowRate ); dialysateFlowRate ( vData.mDialysateFlowRate ); treatmentDuration ( vData.mTreatmentDuration ); actualTreatmentDuration ( vData.mActualTreatmentDuration ); acidConcentrateType ( vData.mAcidConcentrateType ); bicarbonateConcentrateType ( vData.mBicarbonateConcentrateType ); potassiumConcentration ( vData.mPotassiumConcentration ); calciumConcentration ( vData.mCalciumConcentration ); bicarbonateConcentration ( vData.mBicarbonateConcentration ); sodiumConcentration ( vData.mSodiumConcentration ); dialysateTemperature ( vData.mDialysateTemperature ); dialyzerType ( vData.mDialyzerType ); treatmentStartEpoch ( vData.mTreatmentStartEpoch ); treatmentEndEpoch ( vData.mTreatmentEndEpoch ); averageBloodFlow ( vData.mAverageBloodFlow ); averageDialysateFlow ( vData.mAverageDialysateFlow ); dialysateVolumeUsed ( vData.mDialysateVolumeUsed ); averageDialysateTemp ( vData.mAverageDialysateTemp ); originUFVolume ( vData.mOriginUFVolume ); targetUFVolume ( vData.mTargetUFVolume ); actualUFVolume ( vData.mActualUFVolume ); originUFRate ( vData.mOriginUFRate ); targetUFRate ( vData.mTargetUFRate ); actualUFRate ( vData.mActualUFRate ); salineBolusVolume ( vData.mSalineBolusVolume ); heparinBolusVolume ( vData.mHeparinBolusVolume ); heparinDispenseRate ( vData.mHeparinDispenseRate ); heparinStop ( vData.mHeparinStop ); heparinDeliveredVolume ( vData.mHeparinDeliveredVolume ); averageArterialPressure ( vData.mAverageArterialPressure ); averageVenousPressure ( vData.mAverageVenousPressure ); deviceID ( vData.mDeviceID ); waterSampleTestResult ( vData.mWaterSampleTestResult ); heparinType ( vData.mHeparinType ); heparinConcentration ( vData.mHeparinConcentration ); if (adjustment_Accepted()) _TreatmentLog.doSave(); // *** has to be the last to let the information to be set and then emit the signal *** // *** otherwise will use the Previous values before being set. *** adjustment ( true ); } /*! * \brief VPostTreatmentAdjustmentUltrafiltrationInit::onActionReceive * \details received response model data handler * \param vData - model data */ void View::VPostTreatmentAdjustmentTreatmentLog::onActionReceive(const TreatmentLogAvrgeData &vData){ _TreatmentLog.append(vData); } void View::VPostTreatmentAdjustmentTreatmentLog::onActionReceive(const TreatmentLogAlarmData &vData){ _TreatmentLog.append(vData); } void View::VPostTreatmentAdjustmentTreatmentLog::onActionReceive(const TreatmentLogEventData &vData){ _TreatmentLog.append(vData); }