Index: sources/view/VTreatmentCreate.cpp =================================================================== diff -u -rcc7aae88f15228ff37b840946818692e444718bf -readfcc99876849e52370db5dde4c4c42d4dbc76f --- sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision cc7aae88f15228ff37b840946818692e444718bf) +++ sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision eadfcc99876849e52370db5dde4c4c42d4dbc76f) @@ -21,6 +21,7 @@ #include "FileHandler.h" #include "MsgDefs.h" #include "TreatmentLog.h" +#include "RxProfilesController.h" using namespace Gui; using namespace View; @@ -80,7 +81,56 @@ parametersConfirmed(true); emit didAdjustment(confirmTreatmentRequest); } +void VTreatmentCreate::doAddRxProfile(){ + _RxProfilesController.clearRxProfiles(); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eBloodFlowRate , _bloodFlowRate ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eDialysateFlowRate , _dialysateFlowRate ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eTreatmentDuration , _treatmentDuration ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eAcidConcentrateType , _acidConcentrate ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eBicarbonateConcentrateType , _bicarbonateConcentrate ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eDialysateTemperature , _dialysateTemp ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eDialyzerType , _dialyzerType ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eHeparinConcentration , _heparinType ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eHeparinBolusVolume , _heparinBolusVolume ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eHeparinDispenseRate , _heparinDispensingRate ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eHeparinStop , _heparinStopTime ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eSalineVolume , _salineBolusVolume ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eVitalSigns , _bloodPressureMeasureInterval ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eProfileName , _patientID ); + _RxProfilesController.insertRxProfileItem(Model::RxProfilesIndex::eFavorite , false ); + _RxProfilesController.doSave(); +} + +void VTreatmentCreate::doLoadRxProfile(const QVariant &modelData, const bool isEdit) +{ + if (!modelData.canConvert()) { + qDebug() << "Expected QVariantMap, got" << modelData << isEdit; + return; + } + + QVariantMap modelDataMap = modelData.toMap(); + if (isEdit){_patientID = modelDataMap["profileName"].toString(); + _RxProfilesController.savePreviousRxProfileName(_patientID); + } + else{_patientID = "";} //Also save the previous profile Name in the controller, Clear when exit or completed + + _bloodFlowRate = modelDataMap["bloodFlow" ].toInt() ; + _dialysateFlowRate = modelDataMap["dialysateFlow" ].toInt() ; + _treatmentDuration = modelDataMap["treatmentDuration" ].toInt() ; + _acidConcentrate = modelDataMap["acidConcentrate" ].toInt() ; + _bicarbonateConcentrate = modelDataMap["bicarbConcentrate" ].toInt() ; + _dialysateTemp = modelDataMap["dialysateTemperature" ].toFloat() ; + _dialyzerType = modelDataMap["dialyzerType" ].toInt() ; + _heparinType = modelDataMap["heparinConcentrate" ].toInt() ; + _heparinBolusVolume = modelDataMap["heparinVolume" ].toFloat() ; + _heparinDispensingRate = modelDataMap["heparinDispenseRate" ].toFloat() ; + _heparinStopTime = modelDataMap["heparinStop" ].toInt() ; + _salineBolusVolume = modelDataMap["salineVolume" ].toInt() ; + _bloodPressureMeasureInterval = modelDataMap["vitalSigns" ].toInt() ; + qDebug() << "Received QML model data in C++ slot: " << modelDataMap; +} + /** * \brief VCreateTreatment::doCancel * \details Notifies FW the user has canceled confirming the treatment parameters