体征传感器
This commit is contained in:
@@ -19,6 +19,7 @@ part 'device_list_controller.g.dart';
|
||||
class DeviceListModel {
|
||||
//设备列表
|
||||
List<dynamic> deviceList = [];
|
||||
List<dynamic>vitalList=[];
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
String? keyword;
|
||||
@@ -35,7 +36,7 @@ class DeviceListController extends GetControllerEx<DeviceListModel> {
|
||||
DeviceListController() {
|
||||
attr = GetModel(DeviceListModel()).obs;
|
||||
}
|
||||
|
||||
//床和床垫
|
||||
getDeviceList() async {
|
||||
try {
|
||||
String search = (model.keyword != null && model.keyword!.isNotEmpty)
|
||||
@@ -70,6 +71,37 @@ class DeviceListController extends GetControllerEx<DeviceListModel> {
|
||||
}
|
||||
return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
|
||||
}
|
||||
//体征传感器
|
||||
getVitalList(String mac) async {
|
||||
try {
|
||||
ApiResponse apiResponse = ApiResponse(code: -1, msg: "设备.设备列表请求失败".tr);
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.device_list;
|
||||
String queryUrl =
|
||||
"${serviceAddress}${serviceName}${serviceApi}?bindType=1&mac=$mac";
|
||||
var response = await EasyDartModule.dio.get(queryUrl);
|
||||
if (response != null) {
|
||||
var responseData =
|
||||
response.data is String ? jsonDecode(response.data) : response.data;
|
||||
ApiResponse res =
|
||||
ApiResponse.fromJson(responseData, (object) => object);
|
||||
MyUtils.formatResponse(res, "设备.设备列表请求成功".tr, "设备.设备列表请求失败".tr);
|
||||
if (res.code == HttpStatusCodes.ok) {
|
||||
// bindDeviceNum.value = res.total!;
|
||||
model.vitalList = res.data;
|
||||
updateAll();
|
||||
}
|
||||
} else {
|
||||
return ApiResponse(code: -1, msg: "服务器.失败".tr);
|
||||
}
|
||||
return apiResponse;
|
||||
} catch (e) {
|
||||
EasyDartModule.logger.info("体征传感器请求列表: $e");
|
||||
DailyLogUtils.writeLog("体征传感器请求列表: $e");
|
||||
}
|
||||
return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement
|
||||
}
|
||||
|
||||
//主动解绑设备
|
||||
Future<String> unbindDevice(Map<dynamic, dynamic> device) async {
|
||||
|
||||
@@ -7,9 +7,12 @@ part of 'device_list_controller.dart';
|
||||
// **************************************************************************
|
||||
|
||||
DeviceListModel _$DeviceListModelFromJson(Map<String, dynamic> json) =>
|
||||
DeviceListModel()..deviceList = json['deviceList'] as List<dynamic>;
|
||||
DeviceListModel()
|
||||
..deviceList = json['deviceList'] as List<dynamic>
|
||||
..vitalList = json['vitalList'] as List<dynamic>;
|
||||
|
||||
Map<String, dynamic> _$DeviceListModelToJson(DeviceListModel instance) =>
|
||||
<String, dynamic>{
|
||||
'deviceList': instance.deviceList,
|
||||
'vitalList': instance.vitalList,
|
||||
};
|
||||
|
||||
@@ -25,10 +25,14 @@ class SleepReportModel {
|
||||
}
|
||||
|
||||
class SleepReportController extends GetControllerEx<SleepReportModel> {
|
||||
|
||||
Rx<DateTime?> selectedDate = Rx<DateTime?>(null);
|
||||
RxMap sleepReport = RxMap();
|
||||
RxMap<String, dynamic> sleepReport = <String, dynamic>{}.obs;
|
||||
|
||||
var isLoading = false.obs;
|
||||
|
||||
// 每种类型对应一份数据
|
||||
|
||||
SleepReportController() {
|
||||
attr = GetModel(SleepReportModel()).obs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user