diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 2d418714d..b8034d5ff 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -8212,6 +8212,11 @@
任务展示访视 读片任务显示是否顺序
+
+
+ 是否存在未处理的反馈
+
+
是否是转变的任务(转为IRECIST)
@@ -12081,7 +12086,7 @@
-
+
IR影像阅片
@@ -12944,7 +12949,7 @@
项目外部人员 录入流程相关
-
+
项目外部人员 录入流程相关
@@ -13237,6 +13242,14 @@
+
+
+ 项目退出历史数据维护
+
+
+
+
+
用户多账号,初次维护数据
@@ -13794,11 +13807,21 @@
是否是一致性分析产生
+
+
+ 是否存在未处理的反馈
+
+
是否是一致性分析产生
+
+
+ 是否存在未处理的反馈
+
+
未完成阅片量
@@ -15564,7 +15587,7 @@
TrialSiteSurveyService
-
+
TrialSiteSurveyService
diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs
index c195e4511..dc21c1622 100644
--- a/IRaCIS.Core.Application/Service/Common/MailService.cs
+++ b/IRaCIS.Core.Application/Service/Common/MailService.cs
@@ -7,6 +7,7 @@ using IRaCIS.Core.Infrastructure;
using MailKit;
using Medallion.Threading;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using MimeKit;
@@ -485,14 +486,6 @@ namespace IRaCIS.Core.Application.Service
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null);
- //创建账号 和创建角色 一条,更新的时候才记录更新角色
- if (!sysUserInfo.IsFirstAdd)
- {
- await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = userId, OptType = UserOptType.UpdateUserRole }, true);
-
- }
-
-
}
//Site调研 用户加入项目
@@ -553,13 +546,6 @@ namespace IRaCIS.Core.Application.Service
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
- //创建账号 和创建角色 一条,更新的时候才记录更新角色
- if (!sysUserInfo.IsFirstAdd)
- {
- await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = userId, OptType = UserOptType.UpdateUserRole }, true);
-
- }
-
}
@@ -574,6 +560,9 @@ namespace IRaCIS.Core.Application.Service
var userType = await _userTypeRepository.FirstAsync(t => t.UserTypeEnum == UserTypeEnum.IndependentReviewer);
+ //需要创建新的账户
+ var isNeedCreateNewUser = false;
+
var @lock = _distributedLockProvider.CreateLock($"UserCode");
using (await @lock.AcquireAsync())
@@ -583,6 +572,7 @@ namespace IRaCIS.Core.Application.Service
if (!isDoctorHaveAccount)
{
+ isNeedCreateNewUser = true;
var saveItem = new IdentityUser() { FirstName = doctor.FirstName, LastName = doctor.LastName, EMail = doctor.EMail };
@@ -685,10 +675,9 @@ namespace IRaCIS.Core.Application.Service
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null);
//创建账号 和创建角色 一条,更新的时候才记录更新角色
- if (!sysUserInfo.IsFirstAdd)
+ if (isNeedCreateNewUser == false)
{
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = sysUserInfo.Id, OptType = UserOptType.UpdateUserRole }, true);
-
}
diff --git a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs
index 8b15454a4..fabd20b00 100644
--- a/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs
+++ b/IRaCIS.Core.Application/Service/Management/UserFeedBackService.cs
@@ -87,6 +87,8 @@ namespace IRaCIS.Core.Application.Service
addOrEditUserFeedBack.TrialSiteId = info.TrialSiteId;
addOrEditUserFeedBack.SubjectVisitId = info.SourceSubjectVisitId;
}
+
+ addOrEditUserFeedBack.State = 0;//设置解决后IR 更新反馈自动变为未解决
}
else if (addOrEditUserFeedBack.SubjectVisitId != null)
diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs
index fe1dd8fde..7fb3fcec1 100644
--- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs
+++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs
@@ -54,6 +54,7 @@ namespace IRaCIS.Core.Application.Contracts
ITokenService _tokenService,
IRepository _userTypeRepository,
IMailVerificationService _mailVerificationService,
+ IRepository _userLogRepository,
IOptionsMonitor systemEmailConfig, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialSiteSurveyService
{
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
@@ -672,7 +673,7 @@ namespace IRaCIS.Core.Application.Contracts
TrialSiteSurveyId = currentEntity!.Id,
Token = _tokenService.GetToken(new UserTokenInfo()
{
- IdentityUserId=Guid.NewGuid(),
+ IdentityUserId = Guid.NewGuid(),
UserRoleId = Guid.NewGuid(),
UserName = "SiteSurvey",
UserTypeEnum = UserTypeEnum.Undefined,
@@ -871,6 +872,8 @@ namespace IRaCIS.Core.Application.Contracts
#region 人员生成
+ //需要创建新的账户
+ var isNeedCreateNewUser = existSysUser == null;
if (existSysUser != null)
{
@@ -949,11 +952,12 @@ namespace IRaCIS.Core.Application.Contracts
}
+
+
#endregion
await _identityUserRepository.SaveChangesAsync();
-
var identityUserId = existSysUser.Id;
#region 项目加入
@@ -1048,12 +1052,18 @@ namespace IRaCIS.Core.Application.Contracts
if (isNeedSendEmail)
{
+ //创建账号 和创建角色 一条,更新的时候才记录更新角色
+ if (isNeedCreateNewUser == false)
+ {
+ await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.UpdateUserRole });
+ }
var dbUserType = _userTypeRepository.Where(t => userTypeIdList.Contains(t.Id)).ToList();
var usertyps = string.Join(',', dbUserType.Select(t => t.UserTypeName));
await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, identityUserId, usertyps, baseUrl, routeUrl);
+
}
var userJoinIdList = item.Select(t => t.Id).ToList();
@@ -1104,6 +1114,9 @@ namespace IRaCIS.Core.Application.Contracts
var existSysUser = await _identityUserRepository.Where(t => t.EMail == userEmail, true).Include(t => t.UserRoleList).FirstOrDefaultAsync();
+ //需要创建新的账户
+ var isNeedCreateNewUser = existSysUser == null;
+
if (existSysUser != null)
{
@@ -1288,9 +1301,17 @@ namespace IRaCIS.Core.Application.Contracts
if (isNeedSendEmail)
{
+ //创建账号 和创建角色 一条,更新的时候才记录更新角色
+ if (isNeedCreateNewUser == false)
+ {
+ await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.UpdateUserRole });
+ }
+
var dbUserType = _userTypeRepository.Where(t => userTypeIdList.Contains(t.Id)).ToList();
var usertyps = string.Join(',', dbUserType.Select(t => t.UserTypeName));
await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, identityUserId, usertyps, baseUrl, routeUrl);
+
+
}
await _trialSiteUserRoleRepository.SaveChangesAsync();
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs
index 31d253d81..922c7d4fc 100644
--- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs
+++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs
@@ -31,6 +31,7 @@ namespace IRaCIS.Core.Application.Service
IRepository _trialIdentityUserRepository,
IRepository _trialRepository,
IRepository _userTypeRepository,
+ IRepository _userLogRepository,
IMailVerificationService _mailVerificationService,
IDistributedLockProvider _distributedLockProvider, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialExternalUserService
{
@@ -215,8 +216,13 @@ namespace IRaCIS.Core.Application.Service
//var identityUserId = item.Key;
+
+
var existSysUser = await _identityUserRepository.Where(t => t.EMail == userEmail, true).Include(t => t.UserRoleList).FirstOrDefaultAsync();
+ //需要创建新的账户
+ var isNeedCreateNewUser = existSysUser == null;
+
if (existSysUser != null)
{
@@ -294,7 +300,7 @@ namespace IRaCIS.Core.Application.Service
var newAddUser = await _identityUserRepository.AddAsync(generateUser);
-
+
existSysUser = newAddUser;
@@ -390,6 +396,12 @@ namespace IRaCIS.Core.Application.Service
await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => externalIdList.Contains(t.Id), u => new TrialExternalUser() { IsJoin = true });
+ //创建账号 和创建角色 一条,更新的时候才记录更新角色
+ if (isNeedCreateNewUser == false)
+ {
+ await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.UpdateUserRole }, true);
+ }
+
}
diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs
index 8558b55bf..44e6cfcbe 100644
--- a/IRaCIS.Core.Application/TestService.cs
+++ b/IRaCIS.Core.Application/TestService.cs
@@ -154,6 +154,58 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.Ok();
}
+ ///
+ /// 项目退出历史数据维护
+ ///
+ ///
+ ///
+ ///
+ [AllowAnonymous]
+ public async Task OldTrialDeleteUser([FromServices] IRepository _trialIdentityUserRepository, [FromServices] IRepository _trialUserRoleReposiotry)
+ {
+ _userInfo.IsNotNeedInspection = true;
+
+
+ if (_trialUserRoleReposiotry.Any(t => t.TrialUserId == Guid.Empty))
+ {
+ var list = _trialUserRoleReposiotry.Where(t => t.IsDeleted == true, false, true).Select(t => new { t.TrialId, t.UserRole.IdentityUserId, t.UserId, t.JoinTime, t.RemoveTime, t.DeletedTime, t.DeleteUserId }).ToList();
+
+
+ foreach (var item in list.GroupBy(t => new { t.IdentityUserId, t.TrialId }))
+ {
+
+ var id = NewId.NextSequentialGuid();
+
+ var userRoleList = item.ToList();
+
+ var userIdList = item.Select(t => t.UserId).ToList();
+
+ var first = userRoleList.OrderByDescending(t => t.RemoveTime).FirstOrDefault();
+
+
+ await _trialIdentityUserRepository.AddAsync(new TrialIdentityUser()
+ {
+ Id = id,
+ IdentityUserId = item.Key.IdentityUserId,
+ TrialId = item.Key.TrialId,
+ RemoveTime = first.RemoveTime,
+ IsDeleted = true,
+ DeletedTime = first.DeletedTime,
+ DeleteUserId = first.DeleteUserId,
+ });
+
+
+ await _trialUserRoleReposiotry.BatchUpdateNoTrackingAsync(t => t.TrialId == item.Key.TrialId && userIdList.Contains(t.UserId), u => new TrialUserRole() { TrialUserId = id });
+
+ }
+
+ await _trialIdentityUserRepository.SaveChangesAsync();
+ }
+
+
+
+ return ResponseOutput.Ok();
+ }
///
/// 用户多账号,初次维护数据
@@ -173,7 +225,7 @@ namespace IRaCIS.Core.Application.Service
var identityUserId = NewId.NextSequentialGuid();
- var selectUser = item.OrderByDescending(t => t.Status).ThenBy(t=>t.CreateTime).FirstOrDefault();
+ var selectUser = item.OrderByDescending(t => t.Status).ThenBy(t => t.CreateTime).FirstOrDefault();
var identityUser = _mapper.Map(selectUser);