34 lines
997 B
Dart
34 lines
997 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'StatisticsResult.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class StatisticsResult {
|
|
@JsonKey(name: '_id')
|
|
String? id; // ID
|
|
int? type; // type 1睡眠评分统计 2.hrv统计
|
|
int? start_time; // 开始时间
|
|
int? end_time; // 结束时间
|
|
String? data; // 统计数据
|
|
StatisticsResult();
|
|
|
|
// 从 JSON 中生成 RoomType 对象
|
|
static StatisticsResult fromJson(Map<String, dynamic> json) =>
|
|
_$StatisticsResultFromJson(json);
|
|
|
|
// 将 RoomType 对象转化为 JSON
|
|
Map<String, dynamic> toJson() => _$StatisticsResultToJson(this);
|
|
|
|
// 使用查询参数填充 RoomType 对象
|
|
static StatisticsResult fromQueryParameters(
|
|
Map<String, String> queryParameters, Map<String, dynamic> jwt) {
|
|
var json = <String, dynamic>{};
|
|
queryParameters.forEach((key, value) {
|
|
json[key] = value;
|
|
});
|
|
json['tid'] = jwt['tid'];
|
|
json['level'] = jwt['level'];
|
|
return StatisticsResult.fromJson(json);
|
|
}
|
|
}
|