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 json) => _$StatisticsResultFromJson(json); // 将 RoomType 对象转化为 JSON Map toJson() => _$StatisticsResultToJson(this); // 使用查询参数填充 RoomType 对象 static StatisticsResult fromQueryParameters( Map queryParameters, Map jwt) { var json = {}; queryParameters.forEach((key, value) { json[key] = value; }); json['tid'] = jwt['tid']; json['level'] = jwt['level']; return StatisticsResult.fromJson(json); } }