vitalDevice.m.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. import 'liveConsultation.m.dart';
  2. import 'notification.m.dart';
  3. import 'device.m.dart';
  4. class PeripheralDeviceDTO {
  5. String? code;
  6. String? key;
  7. String? name;
  8. bool enable;
  9. PeripheralDeviceDTO({
  10. this.code,
  11. this.key,
  12. this.name,
  13. this.enable = false,
  14. });
  15. factory PeripheralDeviceDTO.fromJson(Map<String, dynamic> map) {
  16. return PeripheralDeviceDTO(
  17. code: map['Code'],
  18. key: map['Key'],
  19. name: map['Name'],
  20. enable: map['Enable'],
  21. );
  22. }
  23. Map<String, dynamic> toJson() {
  24. final map = Map<String, dynamic>();
  25. if (code != null) {
  26. map['Code'] = code;
  27. }
  28. if (key != null) {
  29. map['Key'] = key;
  30. }
  31. if (name != null) {
  32. map['Name'] = name;
  33. }
  34. map['Enable'] = enable;
  35. return map;
  36. }
  37. }
  38. class CreateDeviceRequest2 extends TokenRequest{
  39. String? code;
  40. String? serialNumber;
  41. String? model;
  42. String? softwareVersion;
  43. String? oSVersion;
  44. String? description;
  45. String? organizationCode;
  46. String? teamCode;
  47. List<PeripheralDeviceDTO>? peripheralPermissions;
  48. CreateDeviceRequest2({
  49. this.code,
  50. this.serialNumber,
  51. this.model,
  52. this.softwareVersion,
  53. this.oSVersion,
  54. this.description,
  55. this.organizationCode,
  56. this.teamCode,
  57. this.peripheralPermissions,
  58. String? token,
  59. }) : super(
  60. token: token,
  61. );
  62. factory CreateDeviceRequest2.fromJson(Map<String, dynamic> map) {
  63. return CreateDeviceRequest2(
  64. code: map['Code'],
  65. serialNumber: map['SerialNumber'],
  66. model: map['Model'],
  67. softwareVersion: map['SoftwareVersion'],
  68. oSVersion: map['OSVersion'],
  69. description: map['Description'],
  70. organizationCode: map['OrganizationCode'],
  71. teamCode: map['TeamCode'],
  72. peripheralPermissions: map['PeripheralPermissions'] != null ? (map['PeripheralPermissions'] as List).map((e)=>PeripheralDeviceDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  73. token: map['Token'],
  74. );
  75. }
  76. Map<String, dynamic> toJson() {
  77. final map = super.toJson();
  78. if (code != null)
  79. map['Code'] = code;
  80. if (serialNumber != null)
  81. map['SerialNumber'] = serialNumber;
  82. if (model != null)
  83. map['Model'] = model;
  84. if (softwareVersion != null)
  85. map['SoftwareVersion'] = softwareVersion;
  86. if (oSVersion != null)
  87. map['OSVersion'] = oSVersion;
  88. if (description != null)
  89. map['Description'] = description;
  90. if (organizationCode != null)
  91. map['OrganizationCode'] = organizationCode;
  92. if (teamCode != null)
  93. map['TeamCode'] = teamCode;
  94. if (peripheralPermissions != null)
  95. map['PeripheralPermissions'] = peripheralPermissions;
  96. return map;
  97. }
  98. }
  99. class DeviceDTO extends BaseDTO{
  100. String? code;
  101. String? uniqueCode;
  102. String? serialNumber;
  103. String? model;
  104. String? softwareVersion;
  105. String? oSVersion;
  106. String? description;
  107. String? organizationCode;
  108. String? organizationName;
  109. String? teamCode;
  110. String? teamName;
  111. List<PeripheralDeviceDTO>? peripheralPermissions;
  112. DeviceDTO({
  113. this.code,
  114. this.uniqueCode,
  115. this.serialNumber,
  116. this.model,
  117. this.softwareVersion,
  118. this.oSVersion,
  119. this.description,
  120. this.organizationCode,
  121. this.organizationName,
  122. this.teamCode,
  123. this.teamName,
  124. this.peripheralPermissions,
  125. DateTime? createTime,
  126. DateTime? updateTime,
  127. }) : super(
  128. createTime: createTime,
  129. updateTime: updateTime,
  130. );
  131. factory DeviceDTO.fromJson(Map<String, dynamic> map) {
  132. return DeviceDTO(
  133. code: map['Code'],
  134. uniqueCode: map['UniqueCode'],
  135. serialNumber: map['SerialNumber'],
  136. model: map['Model'],
  137. softwareVersion: map['SoftwareVersion'],
  138. oSVersion: map['OSVersion'],
  139. description: map['Description'],
  140. organizationCode: map['OrganizationCode'],
  141. organizationName: map['OrganizationName'],
  142. teamCode: map['TeamCode'],
  143. teamName: map['TeamName'],
  144. peripheralPermissions: map['PeripheralPermissions'] != null ? (map['PeripheralPermissions'] as List).map((e)=>PeripheralDeviceDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  145. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  146. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  147. );
  148. }
  149. Map<String, dynamic> toJson() {
  150. final map = super.toJson();
  151. if (code != null)
  152. map['Code'] = code;
  153. if (uniqueCode != null)
  154. map['UniqueCode'] = uniqueCode;
  155. if (serialNumber != null)
  156. map['SerialNumber'] = serialNumber;
  157. if (model != null)
  158. map['Model'] = model;
  159. if (softwareVersion != null)
  160. map['SoftwareVersion'] = softwareVersion;
  161. if (oSVersion != null)
  162. map['OSVersion'] = oSVersion;
  163. if (description != null)
  164. map['Description'] = description;
  165. if (organizationCode != null)
  166. map['OrganizationCode'] = organizationCode;
  167. if (organizationName != null)
  168. map['OrganizationName'] = organizationName;
  169. if (teamCode != null)
  170. map['TeamCode'] = teamCode;
  171. if (teamName != null)
  172. map['TeamName'] = teamName;
  173. if (peripheralPermissions != null)
  174. map['PeripheralPermissions'] = peripheralPermissions;
  175. return map;
  176. }
  177. }
  178. class GetDeviceRequest2 extends TokenRequest{
  179. String? code;
  180. GetDeviceRequest2({
  181. this.code,
  182. String? token,
  183. }) : super(
  184. token: token,
  185. );
  186. factory GetDeviceRequest2.fromJson(Map<String, dynamic> map) {
  187. return GetDeviceRequest2(
  188. code: map['Code'],
  189. token: map['Token'],
  190. );
  191. }
  192. Map<String, dynamic> toJson() {
  193. final map = super.toJson();
  194. if (code != null)
  195. map['Code'] = code;
  196. return map;
  197. }
  198. }
  199. class GetDeviceByUniqueCodeRequest extends TokenRequest{
  200. String? uniqueCode;
  201. GetDeviceByUniqueCodeRequest({
  202. this.uniqueCode,
  203. String? token,
  204. }) : super(
  205. token: token,
  206. );
  207. factory GetDeviceByUniqueCodeRequest.fromJson(Map<String, dynamic> map) {
  208. return GetDeviceByUniqueCodeRequest(
  209. uniqueCode: map['UniqueCode'],
  210. token: map['Token'],
  211. );
  212. }
  213. Map<String, dynamic> toJson() {
  214. final map = super.toJson();
  215. if (uniqueCode != null)
  216. map['UniqueCode'] = uniqueCode;
  217. return map;
  218. }
  219. }
  220. class GetDeviceBySerialNumberRequest extends TokenRequest{
  221. String? uniqueCode;
  222. GetDeviceBySerialNumberRequest({
  223. this.uniqueCode,
  224. String? token,
  225. }) : super(
  226. token: token,
  227. );
  228. factory GetDeviceBySerialNumberRequest.fromJson(Map<String, dynamic> map) {
  229. return GetDeviceBySerialNumberRequest(
  230. uniqueCode: map['UniqueCode'],
  231. token: map['Token'],
  232. );
  233. }
  234. Map<String, dynamic> toJson() {
  235. final map = super.toJson();
  236. if (uniqueCode != null)
  237. map['UniqueCode'] = uniqueCode;
  238. return map;
  239. }
  240. }
  241. class SetDeviceOrganizationRequest extends TokenRequest{
  242. String? code;
  243. String? organizationCode;
  244. String? teamCode;
  245. SetDeviceOrganizationRequest({
  246. this.code,
  247. this.organizationCode,
  248. this.teamCode,
  249. String? token,
  250. }) : super(
  251. token: token,
  252. );
  253. factory SetDeviceOrganizationRequest.fromJson(Map<String, dynamic> map) {
  254. return SetDeviceOrganizationRequest(
  255. code: map['Code'],
  256. organizationCode: map['OrganizationCode'],
  257. teamCode: map['TeamCode'],
  258. token: map['Token'],
  259. );
  260. }
  261. Map<String, dynamic> toJson() {
  262. final map = super.toJson();
  263. if (code != null)
  264. map['Code'] = code;
  265. if (organizationCode != null)
  266. map['OrganizationCode'] = organizationCode;
  267. if (teamCode != null)
  268. map['TeamCode'] = teamCode;
  269. return map;
  270. }
  271. }
  272. class DevicePageRequest extends PageRequest{
  273. DevicePageRequest({
  274. int pageIndex = 0,
  275. int pageSize = 0,
  276. String? token,
  277. }) : super(
  278. pageIndex: pageIndex,
  279. pageSize: pageSize,
  280. token: token,
  281. );
  282. factory DevicePageRequest.fromJson(Map<String, dynamic> map) {
  283. return DevicePageRequest(
  284. pageIndex: map['PageIndex'],
  285. pageSize: map['PageSize'],
  286. token: map['Token'],
  287. );
  288. }
  289. Map<String, dynamic> toJson() {
  290. final map = super.toJson();
  291. return map;
  292. }
  293. }
  294. class RemoveDeviceRequest extends TokenRequest{
  295. String? code;
  296. RemoveDeviceRequest({
  297. this.code,
  298. String? token,
  299. }) : super(
  300. token: token,
  301. );
  302. factory RemoveDeviceRequest.fromJson(Map<String, dynamic> map) {
  303. return RemoveDeviceRequest(
  304. code: map['Code'],
  305. token: map['Token'],
  306. );
  307. }
  308. Map<String, dynamic> toJson() {
  309. final map = super.toJson();
  310. if (code != null)
  311. map['Code'] = code;
  312. return map;
  313. }
  314. }
  315. class UpdateDeviceRequest2 extends TokenRequest{
  316. String? code;
  317. String? model;
  318. String? softwareVersion;
  319. String? oSVersion;
  320. String? description;
  321. String? organizationCode;
  322. String? teamCode;
  323. UpdateDeviceRequest2({
  324. this.code,
  325. this.model,
  326. this.softwareVersion,
  327. this.oSVersion,
  328. this.description,
  329. this.organizationCode,
  330. this.teamCode,
  331. String? token,
  332. }) : super(
  333. token: token,
  334. );
  335. factory UpdateDeviceRequest2.fromJson(Map<String, dynamic> map) {
  336. return UpdateDeviceRequest2(
  337. code: map['Code'],
  338. model: map['Model'],
  339. softwareVersion: map['SoftwareVersion'],
  340. oSVersion: map['OSVersion'],
  341. description: map['Description'],
  342. organizationCode: map['OrganizationCode'],
  343. teamCode: map['TeamCode'],
  344. token: map['Token'],
  345. );
  346. }
  347. Map<String, dynamic> toJson() {
  348. final map = super.toJson();
  349. if (code != null)
  350. map['Code'] = code;
  351. if (model != null)
  352. map['Model'] = model;
  353. if (softwareVersion != null)
  354. map['SoftwareVersion'] = softwareVersion;
  355. if (oSVersion != null)
  356. map['OSVersion'] = oSVersion;
  357. if (description != null)
  358. map['Description'] = description;
  359. if (organizationCode != null)
  360. map['OrganizationCode'] = organizationCode;
  361. if (teamCode != null)
  362. map['TeamCode'] = teamCode;
  363. return map;
  364. }
  365. }
  366. class ReportingDeviceInfoRequest extends TokenRequest{
  367. String? serialNumber;
  368. String? model;
  369. String? softwareVersion;
  370. String? oSVersion;
  371. ReportingDeviceInfoRequest({
  372. this.serialNumber,
  373. this.model,
  374. this.softwareVersion,
  375. this.oSVersion,
  376. String? token,
  377. }) : super(
  378. token: token,
  379. );
  380. factory ReportingDeviceInfoRequest.fromJson(Map<String, dynamic> map) {
  381. return ReportingDeviceInfoRequest(
  382. serialNumber: map['SerialNumber'],
  383. model: map['Model'],
  384. softwareVersion: map['SoftwareVersion'],
  385. oSVersion: map['OSVersion'],
  386. token: map['Token'],
  387. );
  388. }
  389. Map<String, dynamic> toJson() {
  390. final map = super.toJson();
  391. if (serialNumber != null)
  392. map['SerialNumber'] = serialNumber;
  393. if (model != null)
  394. map['Model'] = model;
  395. if (softwareVersion != null)
  396. map['SoftwareVersion'] = softwareVersion;
  397. if (oSVersion != null)
  398. map['OSVersion'] = oSVersion;
  399. return map;
  400. }
  401. }
  402. class CreatePeripheralDeviceRequest extends TokenRequest{
  403. String? deviceCode;
  404. String? key;
  405. String? name;
  406. bool enable;
  407. CreatePeripheralDeviceRequest({
  408. this.deviceCode,
  409. this.key,
  410. this.name,
  411. this.enable = false,
  412. String? token,
  413. }) : super(
  414. token: token,
  415. );
  416. factory CreatePeripheralDeviceRequest.fromJson(Map<String, dynamic> map) {
  417. return CreatePeripheralDeviceRequest(
  418. deviceCode: map['DeviceCode'],
  419. key: map['Key'],
  420. name: map['Name'],
  421. enable: map['Enable'],
  422. token: map['Token'],
  423. );
  424. }
  425. Map<String, dynamic> toJson() {
  426. final map = super.toJson();
  427. if (deviceCode != null)
  428. map['DeviceCode'] = deviceCode;
  429. if (key != null)
  430. map['Key'] = key;
  431. if (name != null)
  432. map['Name'] = name;
  433. map['Enable'] = enable;
  434. return map;
  435. }
  436. }
  437. class RemovePeripheralDeviceRequest extends TokenRequest{
  438. String? deviceCode;
  439. String? peripheralDeviceCode;
  440. RemovePeripheralDeviceRequest({
  441. this.deviceCode,
  442. this.peripheralDeviceCode,
  443. String? token,
  444. }) : super(
  445. token: token,
  446. );
  447. factory RemovePeripheralDeviceRequest.fromJson(Map<String, dynamic> map) {
  448. return RemovePeripheralDeviceRequest(
  449. deviceCode: map['DeviceCode'],
  450. peripheralDeviceCode: map['PeripheralDeviceCode'],
  451. token: map['Token'],
  452. );
  453. }
  454. Map<String, dynamic> toJson() {
  455. final map = super.toJson();
  456. if (deviceCode != null)
  457. map['DeviceCode'] = deviceCode;
  458. if (peripheralDeviceCode != null)
  459. map['PeripheralDeviceCode'] = peripheralDeviceCode;
  460. return map;
  461. }
  462. }
  463. class GetEnablePeripheralDeviceKeysRequest extends TokenRequest{
  464. String? deviceCode;
  465. GetEnablePeripheralDeviceKeysRequest({
  466. this.deviceCode,
  467. String? token,
  468. }) : super(
  469. token: token,
  470. );
  471. factory GetEnablePeripheralDeviceKeysRequest.fromJson(Map<String, dynamic> map) {
  472. return GetEnablePeripheralDeviceKeysRequest(
  473. deviceCode: map['DeviceCode'],
  474. token: map['Token'],
  475. );
  476. }
  477. Map<String, dynamic> toJson() {
  478. final map = super.toJson();
  479. if (deviceCode != null)
  480. map['DeviceCode'] = deviceCode;
  481. return map;
  482. }
  483. }