user.m.dart 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. import 'connect.m.dart';
  2. import 'patient.m.dart';
  3. import 'identityApply.m.dart';
  4. import 'authentication.m.dart';
  5. enum UserInfoStateEnum {
  6. Nonactivated,
  7. Activated,
  8. }
  9. class UserDTO extends UserBaseDTO{
  10. String? phone;
  11. String? email;
  12. String? nickName;
  13. String? fullName;
  14. String? organizationCode;
  15. String? rootOrganizationCode;
  16. List<String>? authorityGroups;
  17. List<String>? bindDevices;
  18. String? lastIP;
  19. int logintimes;
  20. UserInfoStateEnum userState;
  21. List<String>? roleCodes;
  22. List<String>? rankCodes;
  23. List<String>? positionCodes;
  24. ApplyStateEnum applyState;
  25. String? rankName;
  26. String? positionName;
  27. bool isDirector;
  28. UserDTO({
  29. this.phone,
  30. this.email,
  31. this.nickName,
  32. this.fullName,
  33. this.organizationCode,
  34. this.rootOrganizationCode,
  35. this.authorityGroups,
  36. this.bindDevices,
  37. this.lastIP,
  38. this.logintimes = 0,
  39. this.userState = UserInfoStateEnum.Nonactivated,
  40. this.roleCodes,
  41. this.rankCodes,
  42. this.positionCodes,
  43. this.applyState = ApplyStateEnum.NotApply,
  44. this.rankName,
  45. this.positionName,
  46. this.isDirector = false,
  47. String? userCode,
  48. String? userName,
  49. String? headImageUrl,
  50. DateTime? createTime,
  51. DateTime? updateTime,
  52. }) : super(
  53. userCode: userCode,
  54. userName: userName,
  55. headImageUrl: headImageUrl,
  56. createTime: createTime,
  57. updateTime: updateTime,
  58. );
  59. factory UserDTO.fromJson(Map<String, dynamic> map) {
  60. return UserDTO(
  61. phone: map['Phone'],
  62. email: map['Email'],
  63. nickName: map['NickName'],
  64. fullName: map['FullName'],
  65. organizationCode: map['OrganizationCode'],
  66. rootOrganizationCode: map['RootOrganizationCode'],
  67. authorityGroups: map['AuthorityGroups'] != null ? map['AuthorityGroups'].cast<String>().toList() : null,
  68. bindDevices: map['BindDevices'] != null ? map['BindDevices'].cast<String>().toList() : null,
  69. lastIP: map['LastIP'],
  70. logintimes: map['Logintimes'],
  71. userState: UserInfoStateEnum.values.firstWhere((e) => e.index == map['UserState']),
  72. roleCodes: map['RoleCodes'] != null ? map['RoleCodes'].cast<String>().toList() : null,
  73. rankCodes: map['RankCodes'] != null ? map['RankCodes'].cast<String>().toList() : null,
  74. positionCodes: map['PositionCodes'] != null ? map['PositionCodes'].cast<String>().toList() : null,
  75. applyState: ApplyStateEnum.values.firstWhere((e) => e.index == map['ApplyState']),
  76. rankName: map['RankName'],
  77. positionName: map['PositionName'],
  78. isDirector: map['IsDirector'],
  79. userCode: map['UserCode'],
  80. userName: map['UserName'],
  81. headImageUrl: map['HeadImageUrl'],
  82. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  83. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  84. );
  85. }
  86. Map<String, dynamic> toJson() {
  87. final map = super.toJson();
  88. if(phone != null)
  89. map['Phone'] = phone;
  90. if(email != null)
  91. map['Email'] = email;
  92. if(nickName != null)
  93. map['NickName'] = nickName;
  94. if(fullName != null)
  95. map['FullName'] = fullName;
  96. if(organizationCode != null)
  97. map['OrganizationCode'] = organizationCode;
  98. if(rootOrganizationCode != null)
  99. map['RootOrganizationCode'] = rootOrganizationCode;
  100. if(authorityGroups != null)
  101. map['AuthorityGroups'] = authorityGroups;
  102. if(bindDevices != null)
  103. map['BindDevices'] = bindDevices;
  104. if(lastIP != null)
  105. map['LastIP'] = lastIP;
  106. map['Logintimes'] = logintimes;
  107. map['UserState'] = userState.index;
  108. if(roleCodes != null)
  109. map['RoleCodes'] = roleCodes;
  110. if(rankCodes != null)
  111. map['RankCodes'] = rankCodes;
  112. if(positionCodes != null)
  113. map['PositionCodes'] = positionCodes;
  114. map['ApplyState'] = applyState.index;
  115. if(rankName != null)
  116. map['RankName'] = rankName;
  117. if(positionName != null)
  118. map['PositionName'] = positionName;
  119. map['IsDirector'] = isDirector;
  120. return map;
  121. }
  122. }
  123. class GetUserInfoRequest extends TokenRequest{
  124. GetUserInfoRequest({
  125. String? token,
  126. }) : super(
  127. token: token,
  128. );
  129. factory GetUserInfoRequest.fromJson(Map<String, dynamic> map) {
  130. return GetUserInfoRequest(
  131. token: map['Token'],
  132. );
  133. }
  134. Map<String, dynamic> toJson() {
  135. final map = super.toJson();
  136. return map;
  137. }
  138. }
  139. class AlterUserInfoRequest extends TokenRequest{
  140. String? phone;
  141. String? email;
  142. String? nickName;
  143. String? fullName;
  144. String? headImageUrl;
  145. String? organizationCode;
  146. String? extensionData;
  147. AlterUserInfoRequest({
  148. this.phone,
  149. this.email,
  150. this.nickName,
  151. this.fullName,
  152. this.headImageUrl,
  153. this.organizationCode,
  154. this.extensionData,
  155. String? token,
  156. }) : super(
  157. token: token,
  158. );
  159. factory AlterUserInfoRequest.fromJson(Map<String, dynamic> map) {
  160. return AlterUserInfoRequest(
  161. phone: map['Phone'],
  162. email: map['Email'],
  163. nickName: map['NickName'],
  164. fullName: map['FullName'],
  165. headImageUrl: map['HeadImageUrl'],
  166. organizationCode: map['OrganizationCode'],
  167. extensionData: map['ExtensionData'],
  168. token: map['Token'],
  169. );
  170. }
  171. Map<String, dynamic> toJson() {
  172. final map = super.toJson();
  173. if(phone != null)
  174. map['Phone'] = phone;
  175. if(email != null)
  176. map['Email'] = email;
  177. if(nickName != null)
  178. map['NickName'] = nickName;
  179. if(fullName != null)
  180. map['FullName'] = fullName;
  181. if(headImageUrl != null)
  182. map['HeadImageUrl'] = headImageUrl;
  183. if(organizationCode != null)
  184. map['OrganizationCode'] = organizationCode;
  185. if(extensionData != null)
  186. map['ExtensionData'] = extensionData;
  187. return map;
  188. }
  189. }
  190. enum GetUserListTypeEnum {
  191. FullName,
  192. Phone,
  193. }
  194. enum OrganizationQueryTypeEnum {
  195. Wait,
  196. Single,
  197. AllDep,
  198. }
  199. class GetUserListRequest extends TokenRequest{
  200. GetUserListTypeEnum queryType;
  201. String? keyword;
  202. OrganizationQueryTypeEnum organizationQueryType;
  203. String? organizationCode;
  204. String? rankCode;
  205. String? positionCode;
  206. GetUserListRequest({
  207. this.queryType = GetUserListTypeEnum.FullName,
  208. this.keyword,
  209. this.organizationQueryType = OrganizationQueryTypeEnum.Wait,
  210. this.organizationCode,
  211. this.rankCode,
  212. this.positionCode,
  213. String? token,
  214. }) : super(
  215. token: token,
  216. );
  217. factory GetUserListRequest.fromJson(Map<String, dynamic> map) {
  218. return GetUserListRequest(
  219. queryType: GetUserListTypeEnum.values.firstWhere((e) => e.index == map['QueryType']),
  220. keyword: map['Keyword'],
  221. organizationQueryType: OrganizationQueryTypeEnum.values.firstWhere((e) => e.index == map['OrganizationQueryType']),
  222. organizationCode: map['OrganizationCode'],
  223. rankCode: map['RankCode'],
  224. positionCode: map['PositionCode'],
  225. token: map['Token'],
  226. );
  227. }
  228. Map<String, dynamic> toJson() {
  229. final map = super.toJson();
  230. map['QueryType'] = queryType.index;
  231. if(keyword != null)
  232. map['Keyword'] = keyword;
  233. map['OrganizationQueryType'] = organizationQueryType.index;
  234. if(organizationCode != null)
  235. map['OrganizationCode'] = organizationCode;
  236. if(rankCode != null)
  237. map['RankCode'] = rankCode;
  238. if(positionCode != null)
  239. map['PositionCode'] = positionCode;
  240. return map;
  241. }
  242. }
  243. class RemoveUsersFromOrganizationRequest extends TokenRequest{
  244. List<String>? userCodes;
  245. RemoveUsersFromOrganizationRequest({
  246. this.userCodes,
  247. String? token,
  248. }) : super(
  249. token: token,
  250. );
  251. factory RemoveUsersFromOrganizationRequest.fromJson(Map<String, dynamic> map) {
  252. return RemoveUsersFromOrganizationRequest(
  253. userCodes: map['UserCodes'] != null ? map['UserCodes'].cast<String>().toList() : null,
  254. token: map['Token'],
  255. );
  256. }
  257. Map<String, dynamic> toJson() {
  258. final map = super.toJson();
  259. if(userCodes != null)
  260. map['UserCodes'] = userCodes;
  261. return map;
  262. }
  263. }
  264. class SetUserOrganizationInfoRequest extends TokenRequest{
  265. String? userCode;
  266. List<String>? roleCodes;
  267. List<String>? rankCodes;
  268. List<String>? positionCodes;
  269. String? organizationCode;
  270. SetUserOrganizationInfoRequest({
  271. this.userCode,
  272. this.roleCodes,
  273. this.rankCodes,
  274. this.positionCodes,
  275. this.organizationCode,
  276. String? token,
  277. }) : super(
  278. token: token,
  279. );
  280. factory SetUserOrganizationInfoRequest.fromJson(Map<String, dynamic> map) {
  281. return SetUserOrganizationInfoRequest(
  282. userCode: map['UserCode'],
  283. roleCodes: map['RoleCodes'] != null ? map['RoleCodes'].cast<String>().toList() : null,
  284. rankCodes: map['RankCodes'] != null ? map['RankCodes'].cast<String>().toList() : null,
  285. positionCodes: map['PositionCodes'] != null ? map['PositionCodes'].cast<String>().toList() : null,
  286. organizationCode: map['OrganizationCode'],
  287. token: map['Token'],
  288. );
  289. }
  290. Map<String, dynamic> toJson() {
  291. final map = super.toJson();
  292. if(userCode != null)
  293. map['UserCode'] = userCode;
  294. if(roleCodes != null)
  295. map['RoleCodes'] = roleCodes;
  296. if(rankCodes != null)
  297. map['RankCodes'] = rankCodes;
  298. if(positionCodes != null)
  299. map['PositionCodes'] = positionCodes;
  300. if(organizationCode != null)
  301. map['OrganizationCode'] = organizationCode;
  302. return map;
  303. }
  304. }
  305. class AlterPersonInfoRequest {
  306. String? token;
  307. String? nickName;
  308. String? headImageUrl;
  309. AlterPersonInfoRequest({
  310. this.token,
  311. this.nickName,
  312. this.headImageUrl,
  313. });
  314. factory AlterPersonInfoRequest.fromJson(Map<String, dynamic> map) {
  315. return AlterPersonInfoRequest(
  316. token: map['Token'],
  317. nickName: map['NickName'],
  318. headImageUrl: map['HeadImageUrl'],
  319. );
  320. }
  321. Map<String, dynamic> toJson() {
  322. final map = Map<String, dynamic>();
  323. if(token != null)
  324. map['Token'] = token;
  325. if(nickName != null)
  326. map['NickName'] = nickName;
  327. if(headImageUrl != null)
  328. map['HeadImageUrl'] = headImageUrl;
  329. return map;
  330. }
  331. }
  332. class ShareDeviceUserDTO extends BaseDTO{
  333. String? userCode;
  334. String? fullName;
  335. String? phone;
  336. String? headImageUrl;
  337. List<String>? rankNames;
  338. String? rootOrganizationCode;
  339. String? rootOrganizationName;
  340. ShareDeviceUserDTO({
  341. this.userCode,
  342. this.fullName,
  343. this.phone,
  344. this.headImageUrl,
  345. this.rankNames,
  346. this.rootOrganizationCode,
  347. this.rootOrganizationName,
  348. DateTime? createTime,
  349. DateTime? updateTime,
  350. }) : super(
  351. createTime: createTime,
  352. updateTime: updateTime,
  353. );
  354. factory ShareDeviceUserDTO.fromJson(Map<String, dynamic> map) {
  355. return ShareDeviceUserDTO(
  356. userCode: map['UserCode'],
  357. fullName: map['FullName'],
  358. phone: map['Phone'],
  359. headImageUrl: map['HeadImageUrl'],
  360. rankNames: map['RankNames'] != null ? map['RankNames'].cast<String>().toList() : null,
  361. rootOrganizationCode: map['RootOrganizationCode'],
  362. rootOrganizationName: map['RootOrganizationName'],
  363. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  364. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  365. );
  366. }
  367. Map<String, dynamic> toJson() {
  368. final map = super.toJson();
  369. if(userCode != null)
  370. map['UserCode'] = userCode;
  371. if(fullName != null)
  372. map['FullName'] = fullName;
  373. if(phone != null)
  374. map['Phone'] = phone;
  375. if(headImageUrl != null)
  376. map['HeadImageUrl'] = headImageUrl;
  377. if(rankNames != null)
  378. map['RankNames'] = rankNames;
  379. if(rootOrganizationCode != null)
  380. map['RootOrganizationCode'] = rootOrganizationCode;
  381. if(rootOrganizationName != null)
  382. map['RootOrganizationName'] = rootOrganizationName;
  383. return map;
  384. }
  385. }
  386. class GetShareDeviceUsersPageRequest extends PageRequest{
  387. String? deviceCode;
  388. GetShareDeviceUsersPageRequest({
  389. this.deviceCode,
  390. int pageIndex = 0,
  391. int pageSize = 0,
  392. String? token,
  393. }) : super(
  394. pageIndex: pageIndex,
  395. pageSize: pageSize,
  396. token: token,
  397. );
  398. factory GetShareDeviceUsersPageRequest.fromJson(Map<String, dynamic> map) {
  399. return GetShareDeviceUsersPageRequest(
  400. deviceCode: map['DeviceCode'],
  401. pageIndex: map['PageIndex'],
  402. pageSize: map['PageSize'],
  403. token: map['Token'],
  404. );
  405. }
  406. Map<String, dynamic> toJson() {
  407. final map = super.toJson();
  408. if(deviceCode != null)
  409. map['DeviceCode'] = deviceCode;
  410. return map;
  411. }
  412. }
  413. class UserFeatureInfoResult {
  414. String? featureCode;
  415. String? featureName;
  416. String? fatherCode;
  417. String? uniqueCode;
  418. UserFeatureInfoResult({
  419. this.featureCode,
  420. this.featureName,
  421. this.fatherCode,
  422. this.uniqueCode,
  423. });
  424. factory UserFeatureInfoResult.fromJson(Map<String, dynamic> map) {
  425. return UserFeatureInfoResult(
  426. featureCode: map['FeatureCode'],
  427. featureName: map['FeatureName'],
  428. fatherCode: map['FatherCode'],
  429. uniqueCode: map['UniqueCode'],
  430. );
  431. }
  432. Map<String, dynamic> toJson() {
  433. final map = Map<String, dynamic>();
  434. if(featureCode != null)
  435. map['FeatureCode'] = featureCode;
  436. if(featureName != null)
  437. map['FeatureName'] = featureName;
  438. if(fatherCode != null)
  439. map['FatherCode'] = fatherCode;
  440. if(uniqueCode != null)
  441. map['UniqueCode'] = uniqueCode;
  442. return map;
  443. }
  444. }
  445. class GetUserByCodeRequest extends TokenRequest{
  446. String? userCode;
  447. GetUserByCodeRequest({
  448. this.userCode,
  449. String? token,
  450. }) : super(
  451. token: token,
  452. );
  453. factory GetUserByCodeRequest.fromJson(Map<String, dynamic> map) {
  454. return GetUserByCodeRequest(
  455. userCode: map['UserCode'],
  456. token: map['Token'],
  457. );
  458. }
  459. Map<String, dynamic> toJson() {
  460. final map = super.toJson();
  461. if(userCode != null)
  462. map['UserCode'] = userCode;
  463. return map;
  464. }
  465. }