IUserInfoManager.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5. using System.Threading.Tasks;
  6. namespace WingServerCommon.Interfaces.Cache
  7. {
  8. public interface IUserInfoManager : IBaseCacheManager<CacheUserDTO>
  9. {
  10. }
  11. /// <summary>
  12. /// 账号信息缓存管理类
  13. /// </summary>
  14. public class UserInfoManager : CacheManager<CacheUserDTO>, IUserInfoManager
  15. {
  16. public UserInfoManager() : base()
  17. {
  18. }
  19. }
  20. /// <summary>
  21. /// 缓存账号信息
  22. /// </summary>
  23. public class CacheUserDTO : ICacheObject
  24. {
  25. /// <summary>
  26. /// 用户编码
  27. /// </summary>
  28. /// <value></value>
  29. public string Code { get; set; }
  30. /// <summary>
  31. /// 用户名
  32. /// </summary>
  33. public string UserName { get; set; }
  34. /// <summary>
  35. /// 密码
  36. /// </summary>
  37. public string SecretPassword { get; set; }
  38. /// <summary>
  39. /// 联系电话
  40. /// </summary>
  41. public string Phone { get; set; }
  42. /// <summary>
  43. /// 邮箱
  44. /// </summary>
  45. public string Email { get; set; }
  46. /// <summary>
  47. /// 用户昵称
  48. /// </summary>
  49. public string NickName { get; set; }
  50. /// <summary>
  51. /// 用户姓名
  52. /// </summary>
  53. public string FullName { get; set; }
  54. /// <summary>
  55. /// 头像
  56. /// </summary>
  57. public string HeadImageUrl { get; set; }
  58. /// <summary>
  59. /// 所属组织
  60. /// </summary>
  61. public string OrganizationCode { get; set; }
  62. /// <summary>
  63. /// 所属权限组
  64. /// </summary>
  65. public List<string> AuthorityGroups { get; set; } = new();
  66. /// <summary>
  67. /// 绑定设备列表
  68. /// </summary>
  69. public List<string> BindDevices { get; set; } = new();
  70. /// <summary>
  71. /// 登录次数
  72. /// </summary>
  73. /// <value></value>
  74. public int Logintimes { get; set; }
  75. /// <summary>
  76. /// 积分,计算等级
  77. /// </summary>
  78. public int Score { get; set; }
  79. /// <summary>
  80. /// 最后使用IP地址
  81. /// </summary>
  82. public string LastIP { get; set; }
  83. /// <summary>
  84. /// 用户状态
  85. /// </summary>
  86. /// <value></value>
  87. public int UserState { get; set; }
  88. /// <summary>
  89. /// 岗位身份列表
  90. /// </summary>
  91. /// <value></value>
  92. public List<string> PositionCodes { get; set; } = new();
  93. /// <summary>
  94. /// 用户认证角色列表
  95. /// </summary>
  96. /// <value></value>
  97. public List<string> RoleCodes { get; set; } = new();
  98. /// <summary>
  99. /// 用户职称列表
  100. /// </summary>
  101. /// <value></value>
  102. public List<string> RankCodes { get; set; } = new();
  103. /// <summary>
  104. /// 词条库
  105. /// </summary>
  106. /// <value></value>
  107. public List<string> ThesaurusCodes { get; set; } = new();
  108. /// <summary>
  109. /// 擅长领域
  110. /// </summary>
  111. /// <value>"test1","test2"</value>
  112. public List<string> FieldList { get; set; } = new List<string>();
  113. /// <summary>
  114. /// 删除的病人
  115. /// </summary>
  116. public List<string> DeletePatientCodes { get; set; } = new();
  117. /// <summary>
  118. /// 是否开启批量导出分时诊断数据
  119. /// </summary>
  120. public bool IsBatchExportDiagnoseData { get; set; }
  121. /// <summary>
  122. /// 绑定的助理用户编码
  123. /// </summary>
  124. /// <value></value>
  125. public string BindAssistantUserCode { get; set; }
  126. /// <summary>
  127. /// 助理医师用户编码
  128. /// </summary>
  129. /// <value></value>
  130. public string BindAssistantDoctorUserCode { get; set; }
  131. /// <summary>
  132. /// 登录失败信息
  133. /// </summary>
  134. /// <value></value>
  135. public LoginLockInfo LoginLockInfo { get; set; }
  136. /// <summary>
  137. /// 统一名字展示字段
  138. /// </summary>
  139. /// <value></value>
  140. public string DisplayName
  141. {
  142. get
  143. {
  144. var name = string.IsNullOrWhiteSpace(FullName) ? UserName : FullName;
  145. if(Regex.IsMatch(name,"[0-9A-Z]{32}") && !string.IsNullOrWhiteSpace(Phone))
  146. {
  147. name = Phone;
  148. }
  149. if(Regex.IsMatch(name,"[0-9A-Z]{32}") && !string.IsNullOrWhiteSpace(Email))
  150. {
  151. name = Email;
  152. }
  153. return name;
  154. }
  155. }
  156. }
  157. /// <summary>
  158. ///登录失败信息
  159. /// </summary>
  160. public class LoginLockInfo
  161. {
  162. /// <summary>
  163. /// 登录时间
  164. /// </summary>
  165. /// <value></value>
  166. public DateTime LoginDate { get; set; }
  167. /// <summary>
  168. /// 同一天的登录错误次数
  169. /// </summary>
  170. /// <value></value>
  171. public int Times { get; set; }
  172. }
  173. }