Index: sources/view/VTreatmentCreate.cpp =================================================================== diff -u -r996ce7bc2fbe8814d3a4fd1d9bcc6633d9debc59 -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision 996ce7bc2fbe8814d3a4fd1d9bcc6633d9debc59) +++ sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2024 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 VTreatmentCreate.cpp * \author (last) Behrouz NematiPour - * \date (last) 31-May-2023 + * \date (last) 21-Nov-2023 * \author (original) Peter Lucia * \date (original) 22-Sep-2020 * @@ -20,6 +20,7 @@ #include "VTreatmentCreate.h" #include "FileHandler.h" #include "MsgDefs.h" +#include "TreatmentLog.h" using namespace Gui; using namespace View; @@ -30,6 +31,7 @@ ADJUST_VIEW_CONNECTION(AdjustParametersValidationRequestData ) ACTION_VIEW_CONNECTION(AdjustParametersValidationResponseData ) ADJUST_VIEW_CONNECTION(AdjustParametersConfirmRequestData ) + ACTION_VIEW_CONNECTION(AdjustSerialNumberHDResponseData ) } @@ -105,7 +107,6 @@ * \returns True if FW OK's treatment parameters, false otherwise */ void VTreatmentCreate::onActionReceive(const AdjustParametersValidationResponseData &data) { - if (! data.mAccepted) { bloodFlowRateRejectReason (data.mBloodFlowRate ); dialysateFlowRateRejectReason (data.mDialysateFlowRate ); @@ -130,24 +131,47 @@ emit didValidationFail(); } else { + generateTxCode(); emit didValidationPass(); } } /*! + * \brief VTreatmentCreate::onActionReceive + * \details This message is received from the HD in POST through the applicationController and GuiController. + * This class keeps the serial for any treatment Code (txCode) generation + * \param data - the message model data + */ +void VTreatmentCreate::onActionReceive(const AdjustSerialNumberHDResponseData &data) { + _HDSerialNumber = data.mSerialNumber; +} + +/*! + * \brief VTreatmentCreate::generateTxCode + * \details Generates the txCode by combination of the HD serial number and date and time in yyyyMMddHHmmss + * And updates the TreatmenLog class to be saved in the Tx Report. + */ +void VTreatmentCreate::generateTxCode() { + QDateTime datetime = QDateTime::currentDateTime(); + QString today = datetime.toString("yyyyMMddHHmmss"); + txCode(_HDSerialNumber + today); + _TreatmentLog.gTxCode(_txCode); + LOG_APPED_UI(QString("Generated Treatment Code is %1").arg(_txCode)); +} + +/*! * \brief VCreateTreatment::doGetPrescriptionParameterValues * \details Gets a list of the prescription parameter values * \return (QStringList) The list of parameter values with units */ -QStringList VTreatmentCreate::doGetPrescriptionParameterValues() -{ - return QStringList() << QString("%0 mL/min").arg(_bloodFlowRate) - << QString("%0 mL/min").arg(_dialysateFlowRate) - << QString("%0 min").arg(_treatmentDuration) - << ( _heparinDispensingRate ? QString("%0 mL/hr").arg(_heparinDispensingRate) : tr("OFF") ) - << ( _heparinBolusVolume ? QString("%0 mL" ).arg(_heparinBolusVolume ) : tr("OFF") ) - << QString("%0 min").arg(_heparinStopTime) - << QString("%0 mL").arg(_salineBolusVolume); +QStringList VTreatmentCreate::doGetPrescriptionParameterValues() { + return QStringList() << QString("%1 mL/min" ).arg(_bloodFlowRate ) + << QString("%1 mL/min" ).arg(_dialysateFlowRate ) + << QString("%1 min" ).arg(_treatmentDuration ) + << ( _heparinDispensingRate ? QString("%1 mL/hr" ).arg(_heparinDispensingRate) : tr("OFF") ) + << ( _heparinBolusVolume ? QString("%1 mL" ).arg(_heparinBolusVolume ) : tr("OFF") ) + << ( _heparinDispensingRate ? QString("%1 min" ).arg(_heparinStopTime ) : tr("OFF") ) + << QString("%1 mL" ).arg(_salineBolusVolume ) ; } /*! @@ -169,7 +193,7 @@ QString mCategory = Storage::Settings_Category_ConfigurationsDataList; - if ( heparinTypeSet () ) { + if ( heparinTypeSet () ) { // this is managed on UI with heparinTypeSet() // && ( _heparinDispensingRate || _heparinBolusVolume ) mHeparinTypeOptions = _Settings.keys(mCategory, "Heparin Type Options" ); if ((int) _heparinType < mHeparinTypeOptions .length()) mHeparinType = mHeparinTypeOptions .at( _heparinType ); } else { mHeparinType = tr("NONE"); }