修复测量存储数据显示错误bug
authorxue <2144439972@qq.com>
Thu, 10 Jul 2025 05:49:12 +0000 (13:49 +0800)
committerxue <2144439972@qq.com>
Thu, 10 Jul 2025 05:49:12 +0000 (13:49 +0800)
code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectEndView.cpp
code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectFirstView.cpp
code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectionView.cpp

index 0398259..fc24f69 100644 (file)
@@ -117,10 +117,14 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DBPText or SBPText or timeLabel is null");
             return;
         }
-        //获取时间更新时间
-        std::string timeStr = BPModel::GetInstance()->GetCurrentTimeStr();
+
+        /*获取上次测量的数据*/
+        BPModel::GetInstance()->GetLastData();
+        uint32_t time = BPModel::GetInstance()->GetLastData().timestamp;
+        std::string timeStr = BPModel::GetInstance()->GetDoubleLineCurrentTimeStr(time);
         timeLabel->SetText(timeStr.c_str());
-        //获取上一次检测数据 ? 待定
+        DBPText->SetText(std::to_string(BPModel::GetInstance()->GetLastData().last_check_dbp_value).c_str());
+        SBPText->SetText(std::to_string(BPModel::GetInstance()->GetLastData().last_check_sbp_value).c_str());
         
     }
    
index 20c49bf..0656e70 100644 (file)
@@ -110,18 +110,13 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DBPText or SBPText or timeLabel is null");
             return;
         }
-        // 获取上一次检测数据 ? 待定
-        // LAST_CHECK_DATA data;
-        // if (BPModel::GetInstance()->get_last_check_bp_data(data))
-        // {
-        //     // 获取时间更新时间
-        //     uint64_t timeStr = data.timestamp;
-        //     std::string dbpValue = std::to_string(data.last_check_dbp_value);
-        //     std::string sbpValue = std::to_string(data.last_check_sbp_value);
-        //     timeLabel->SetText(BPModel::GetInstance()->GetCurrentTimeStr(data.timestamp).c_str());
-        //     DBPText->SetText(dbpValue.c_str());
-        //     SBPText->SetText(sbpValue.c_str());
-        // }
+        /*获取上次测量的数据*/
+        BPModel::GetInstance()->GetLastData();
+        uint32_t time = BPModel::GetInstance()->GetLastData().timestamp;
+        std::string timeStr = BPModel::GetInstance()->GetDoubleLineCurrentTimeStr(time);
+        timeLabel->SetText(timeStr.c_str());
+        DBPText->SetText(std::to_string(BPModel::GetInstance()->GetLastData().last_check_dbp_value).c_str());
+        SBPText->SetText(std::to_string(BPModel::GetInstance()->GetLastData().last_check_sbp_value).c_str());
     }
 
     void BPDetectFirstView::WriteMapToPointArrays(const std::map<int, std::pair<int, int>> &bpMap)
index 5a320bc..830af36 100644 (file)
@@ -101,7 +101,9 @@ namespace OHOS
         container_->SetDraggable(true);
         container_->SetTouchable(true);
         container_->SetOnDragListener(presenter_);
-
+        
+        BPModel::GetInstance()->LoadBP(BP_STORAGE_TYPE::TODAY_DATA);         //加载今日测量数据
+        BPModel::GetInstance()->LoadBP(BP_STORAGE_TYPE::LAST_MEASURE_DATA);  //加载上次测量数据
         // 切换到第一个界面
             ChangeView(MAX_BPDECETVIEW, MAIN_BPVIEW);