user.m.dart 13 KB

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