From e2e3438fcaf1e1f28f5736a5a22fd07a053465b3 Mon Sep 17 00:00:00 2001 From: H Vs Date: Fri, 16 Aug 2024 17:08:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E5=90=8E=E4=B8=80=E6=9D=A1=E5=B8=B8?= =?UTF-8?q?=E8=A7=84=E5=BF=83=E7=8E=87=E8=AE=A1=E7=AE=97=E7=9A=84=E8=83=8E?= =?UTF-8?q?=E5=BF=83=E6=95=B0=E6=8D=AE=E5=88=B0iot=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HealthMonitor.WebApi/Worker.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/HealthMonitor.WebApi/Worker.cs b/HealthMonitor.WebApi/Worker.cs index a9e7eaf..235b93a 100644 --- a/HealthMonitor.WebApi/Worker.cs +++ b/HealthMonitor.WebApi/Worker.cs @@ -15,6 +15,7 @@ using HealthMonitor.Service.Etcd; using HealthMonitor.Service.MessageQueue; using HealthMonitor.Service.Sub; using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.Extensions.Options; using NetTaste; @@ -1100,8 +1101,13 @@ namespace HealthMonitor.WebApi await _hisFetalHeartApiClient.AddAsync(gpsFetalHeartRate).ConfigureAwait(false); // 推送到api/v1/open/OpenIot/SetFetalHeartRateConfig - await _serviceIotApi.SetFetalHeartRateConfig(heartRate.Serialno, fetalHeartRate, sampleTime, isAbnormal); - + // 推送最后一条平常心率到iot设备 + var lastPhr = await _serviceTDengine.GetLastAsync(heartRate.Serialno); + if (lastPhr.MessageId== heartRate.MessageId) + { + await _serviceIotApi.SetFetalHeartRateConfig(heartRate.Serialno, fetalHeartRate, sampleTime, isAbnormal); + _logger.LogInformation($"{heartRate.Serialno} 推送最后一条常规心率计算的胎心数据到iot设备"); + } var device = await _deviceCacheMgr.GetDeviceBySerialNoAsync(heartRate.Serialno).ConfigureAwait(false); var fhrMsgId = $"{heartRate.Serialno}-{sampleTime}-{Guid.NewGuid().ToString("D")[^3..]}";