vitalStatistic.m.dart 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. import 'liveConsultation.m.dart';
  2. import 'notification.m.dart';
  3. import 'device.m.dart';
  4. enum StatisticTypeEnum {
  5. Number,
  6. Customer,
  7. }
  8. class CreateStatisticRequest extends TokenRequest{
  9. String? code;
  10. String? statisticKey;
  11. StatisticTypeEnum statisticType;
  12. String? time;
  13. String? statisticData;
  14. CreateStatisticRequest({
  15. this.code,
  16. this.statisticKey,
  17. this.statisticType = StatisticTypeEnum.Number,
  18. this.time,
  19. this.statisticData,
  20. String? token,
  21. }) : super(
  22. token: token,
  23. );
  24. factory CreateStatisticRequest.fromJson(Map<String, dynamic> map) {
  25. return CreateStatisticRequest(
  26. code: map['Code'],
  27. statisticKey: map['StatisticKey'],
  28. statisticType: StatisticTypeEnum.values.firstWhere((e) => e.index == map['StatisticType']),
  29. time: map['Time'],
  30. statisticData: map['StatisticData'],
  31. token: map['Token'],
  32. );
  33. }
  34. Map<String, dynamic> toJson() {
  35. final map = super.toJson();
  36. if (code != null)
  37. map['Code'] = code;
  38. if (statisticKey != null)
  39. map['StatisticKey'] = statisticKey;
  40. map['StatisticType'] = statisticType.index;
  41. if (time != null)
  42. map['Time'] = time;
  43. if (statisticData != null)
  44. map['StatisticData'] = statisticData;
  45. return map;
  46. }
  47. }
  48. class StatisticDTO extends BaseDTO{
  49. String? code;
  50. String? statisticKey;
  51. StatisticTypeEnum statisticType;
  52. String? time;
  53. String? statisticData;
  54. StatisticDTO({
  55. this.code,
  56. this.statisticKey,
  57. this.statisticType = StatisticTypeEnum.Number,
  58. this.time,
  59. this.statisticData,
  60. DateTime? createTime,
  61. DateTime? updateTime,
  62. }) : super(
  63. createTime: createTime,
  64. updateTime: updateTime,
  65. );
  66. factory StatisticDTO.fromJson(Map<String, dynamic> map) {
  67. return StatisticDTO(
  68. code: map['Code'],
  69. statisticKey: map['StatisticKey'],
  70. statisticType: StatisticTypeEnum.values.firstWhere((e) => e.index == map['StatisticType']),
  71. time: map['Time'],
  72. statisticData: map['StatisticData'],
  73. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  74. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  75. );
  76. }
  77. Map<String, dynamic> toJson() {
  78. final map = super.toJson();
  79. if (code != null)
  80. map['Code'] = code;
  81. if (statisticKey != null)
  82. map['StatisticKey'] = statisticKey;
  83. map['StatisticType'] = statisticType.index;
  84. if (time != null)
  85. map['Time'] = time;
  86. if (statisticData != null)
  87. map['StatisticData'] = statisticData;
  88. return map;
  89. }
  90. }
  91. class GetStatisticRequest extends TokenRequest{
  92. String? code;
  93. GetStatisticRequest({
  94. this.code,
  95. String? token,
  96. }) : super(
  97. token: token,
  98. );
  99. factory GetStatisticRequest.fromJson(Map<String, dynamic> map) {
  100. return GetStatisticRequest(
  101. code: map['Code'],
  102. token: map['Token'],
  103. );
  104. }
  105. Map<String, dynamic> toJson() {
  106. final map = super.toJson();
  107. if (code != null)
  108. map['Code'] = code;
  109. return map;
  110. }
  111. }
  112. class GetStatisticByKeyRequest extends TokenRequest{
  113. String? key;
  114. String? value;
  115. GetStatisticByKeyRequest({
  116. this.key,
  117. this.value,
  118. String? token,
  119. }) : super(
  120. token: token,
  121. );
  122. factory GetStatisticByKeyRequest.fromJson(Map<String, dynamic> map) {
  123. return GetStatisticByKeyRequest(
  124. key: map['Key'],
  125. value: map['Value'],
  126. token: map['Token'],
  127. );
  128. }
  129. Map<String, dynamic> toJson() {
  130. final map = super.toJson();
  131. if (key != null)
  132. map['Key'] = key;
  133. if (value != null)
  134. map['Value'] = value;
  135. return map;
  136. }
  137. }
  138. class StatisticPageRequest extends PageRequest{
  139. StatisticPageRequest({
  140. int pageIndex = 0,
  141. int pageSize = 0,
  142. String? token,
  143. }) : super(
  144. pageIndex: pageIndex,
  145. pageSize: pageSize,
  146. token: token,
  147. );
  148. factory StatisticPageRequest.fromJson(Map<String, dynamic> map) {
  149. return StatisticPageRequest(
  150. pageIndex: map['PageIndex'],
  151. pageSize: map['PageSize'],
  152. token: map['Token'],
  153. );
  154. }
  155. Map<String, dynamic> toJson() {
  156. final map = super.toJson();
  157. return map;
  158. }
  159. }
  160. class RemoveStatisticRequest extends TokenRequest{
  161. String? code;
  162. RemoveStatisticRequest({
  163. this.code,
  164. String? token,
  165. }) : super(
  166. token: token,
  167. );
  168. factory RemoveStatisticRequest.fromJson(Map<String, dynamic> map) {
  169. return RemoveStatisticRequest(
  170. code: map['Code'],
  171. token: map['Token'],
  172. );
  173. }
  174. Map<String, dynamic> toJson() {
  175. final map = super.toJson();
  176. if (code != null)
  177. map['Code'] = code;
  178. return map;
  179. }
  180. }
  181. class GetStatisticListRequest extends TokenRequest{
  182. List<String>? codes;
  183. GetStatisticListRequest({
  184. this.codes,
  185. String? token,
  186. }) : super(
  187. token: token,
  188. );
  189. factory GetStatisticListRequest.fromJson(Map<String, dynamic> map) {
  190. return GetStatisticListRequest(
  191. codes: map['Codes']?.cast<String>().toList(),
  192. token: map['Token'],
  193. );
  194. }
  195. Map<String, dynamic> toJson() {
  196. final map = super.toJson();
  197. if (codes != null)
  198. map['Codes'] = codes;
  199. return map;
  200. }
  201. }
  202. class UpdateStatisticRequest extends TokenRequest{
  203. String? code;
  204. String? statisticKey;
  205. StatisticTypeEnum statisticType;
  206. String? time;
  207. String? statisticData;
  208. UpdateStatisticRequest({
  209. this.code,
  210. this.statisticKey,
  211. this.statisticType = StatisticTypeEnum.Number,
  212. this.time,
  213. this.statisticData,
  214. String? token,
  215. }) : super(
  216. token: token,
  217. );
  218. factory UpdateStatisticRequest.fromJson(Map<String, dynamic> map) {
  219. return UpdateStatisticRequest(
  220. code: map['Code'],
  221. statisticKey: map['StatisticKey'],
  222. statisticType: StatisticTypeEnum.values.firstWhere((e) => e.index == map['StatisticType']),
  223. time: map['Time'],
  224. statisticData: map['StatisticData'],
  225. token: map['Token'],
  226. );
  227. }
  228. Map<String, dynamic> toJson() {
  229. final map = super.toJson();
  230. if (code != null)
  231. map['Code'] = code;
  232. if (statisticKey != null)
  233. map['StatisticKey'] = statisticKey;
  234. map['StatisticType'] = statisticType.index;
  235. if (time != null)
  236. map['Time'] = time;
  237. if (statisticData != null)
  238. map['StatisticData'] = statisticData;
  239. return map;
  240. }
  241. }
  242. class GetHomePageStatisticRequest extends TokenRequest{
  243. GetHomePageStatisticRequest({
  244. String? token,
  245. }) : super(
  246. token: token,
  247. );
  248. factory GetHomePageStatisticRequest.fromJson(Map<String, dynamic> map) {
  249. return GetHomePageStatisticRequest(
  250. token: map['Token'],
  251. );
  252. }
  253. Map<String, dynamic> toJson() {
  254. final map = super.toJson();
  255. return map;
  256. }
  257. }