From: xue <2144439972@qq.com> Date: Thu, 10 Jul 2025 08:21:08 +0000 (+0800) Subject: 增加高低血压时预警逻辑 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=25c4ee1788a377ad4941ebdf6d836d27332c6218;p=mirrors%2FFD230.git 增加高低血压时预警逻辑 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/detection/BPDetectFirstView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/detection/BPDetectFirstView.h index 6dfc14962..ae1ccca55 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/detection/BPDetectFirstView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/detection/BPDetectFirstView.h @@ -20,7 +20,7 @@ public: UIViewGroup *BPDetectFirstInit(); void UpdateText(); //更新文本数据 void InitChartView(); - void WriteMapToPointArrays(const std::map> &bpMap); + void WriteMapToPointArrays(); private: UILabelExt *DBPTitleLabel{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPSecUnderCalibrationView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPSecUnderCalibrationView.cpp index e7beb0dda..43a2c5091 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPSecUnderCalibrationView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPSecUnderCalibrationView.cpp @@ -170,7 +170,7 @@ namespace OHOS remindLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); remindLabel->SetTextColor(Color::Red()); InitLabelExt(timeLabel, 165, 400, 300, 35, "timeLabel",STR_S, DEFAULT_VECTOR_FONT_FILENAME, 30); - InitUILabel(timenumLabel, 133, 300, 200, 200, "timenumLabel", "30", DEFAULT_VECTOR_FONT_FILENAME, 100); + InitUILabel(timenumLabel, 133, 300, 200, 200, "timenumLabel", "90", DEFAULT_VECTOR_FONT_FILENAME, 100); InitChartView(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectErrorView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectErrorView.cpp index 2ffc5c205..0c6d24fda 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectErrorView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectErrorView.cpp @@ -15,7 +15,7 @@ namespace OHOS { static BPDetectErrorView *g_pBPDetectErrorView{nullptr}; - static const char* image_bp = "/user/res/BPCalibration/error_bg.bin"; + static const char *image_bp = "/user/res/BPCalibration/error_bg.bin"; BPDetectErrorView::BPDetectErrorView() { @@ -25,35 +25,35 @@ namespace OHOS BPDetectErrorView::~BPDetectErrorView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BPDetectErrorView::~BPDetectErrorView"); - if(group) + if (group) { - group->RemoveAll(); - if(background) + group->RemoveAll(); + if (background) { delete background; background = nullptr; } - if(titlelabel) + if (titlelabel) { delete titlelabel; titlelabel = nullptr; } - if(alertlabel) + if (alertlabel) { delete alertlabel; alertlabel = nullptr; } - if(notelabel) + if (notelabel) { delete notelabel; notelabel = nullptr; } - if(soslabel) + if (soslabel) { delete soslabel; soslabel = nullptr; } - if(exitlabel) + if (exitlabel) { delete exitlabel; exitlabel = nullptr; @@ -71,29 +71,44 @@ namespace OHOS void BPDetectErrorView::UpdateText() { - if(titlelabel == nullptr ||alertlabel ==nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPDetectErrorView::UpdateText titlelabel or alertlabel is nullptr"); - return; - } - //进行label更新 需要判断是什么警报 - /* - //if(错误判断) + if (titlelabel == nullptr || alertlabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPDetectErrorView::UpdateText titlelabel or alertlabel is nullptr"); + return; + } + // 判断结果类型 + const auto &ErrorType = BPModel::GetInstance()->GettResultState(); + const auto &data = BPModel::GetInstance()->GetLastData(); + if (ErrorType == BPRESULT::HIGH_RESULT) + { + titlelabel->SetText("收缩压偏高"); + if (data.last_check_sbp_value >= 140) // 收缩压到达预警值 { - titlelabel->SetText("收缩压偏高"); + alertlabel->SetText(("预警值:" + std::to_string(data.last_check_dbp_value)).c_str()); } - else + else// 舒张压到达预警值 { - titlelabel->SetText("舒张压偏低"); + alertlabel->SetText(("预警值:" + std::to_string(data.last_check_dbp_value)).c_str()); } - - //预警值拼接 - uint8_t systolic = 0; - systolic = BPModel::GetInstance()->GetSystolic(); - alertlabel->SetText("预警值:" + (std::to_string(systolic).c_str())); - */ + } + else if (ErrorType == BPRESULT::LOW_RESULT) + { + titlelabel->SetText("舒张压偏低"); + if (data.last_check_sbp_value < 90) // 收缩压到达预警值 + { + alertlabel->SetText(("预警值:" + std::to_string(data.last_check_dbp_value)).c_str()); + } + else// 舒张压到达预警值 + { + alertlabel->SetText(("预警值:" + std::to_string(data.last_check_dbp_value)).c_str()); + } + } + else + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to BPDetectErrorView"); + } } - + /*** * @description: * @return 是否初始化成功 @@ -108,9 +123,9 @@ namespace OHOS group->Add(background); /*初始化label*/ - InitLabelExt(titlelabel, 133, 57, 200, 60, "titlelabel", STR_SBP_ELEVATED, DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabelExt(alertlabel, 133, 115, 200, 60, "alertlabel", STR_WARN_THRESH, DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabelExt(notelabel, 58, 180, 350, 150, "notelabel", STR_BP_WARN_CONSULT_DOC, DEFAULT_VECTOR_FONT_FILENAME, 26); + InitLabelExt(titlelabel, 133, 107, 200, 60, "titlelabel", STR_SBP_ELEVATED, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(alertlabel, 133, 165, 200, 60, "alertlabel", STR_WARN_THRESH, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(notelabel, 58, 230, 350, 150, "notelabel", STR_BP_WARN_CONSULT_DOC, DEFAULT_VECTOR_FONT_FILENAME, 26); InitLabel(soslabel, 54, 366, 200, 60, BP_SOS_CLICK, "SOS", DEFAULT_VECTOR_FONT_FILENAME, 30); InitLabelExt(exitlabel, 215, 366, 200, 60, EXIE_CLICK, STR_KONW, DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -118,10 +133,12 @@ namespace OHOS exitlabel->SetTouchable(true); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::BPDetectionPresenter::GetInstance(); - soslabel->SetOnClickListener(clickListener);//设置按键监听 + soslabel->SetOnClickListener(clickListener); // 设置按键监听 exitlabel->SetOnClickListener(clickListener); - + alertlabel->SetTextColor(Color::Red()); + UpdateText(); + group->Add(titlelabel); group->Add(alertlabel); @@ -132,6 +149,4 @@ namespace OHOS return group; } - - }