From 771091a557d6d82765f7d442f4137061128600ec Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Mon, 17 Feb 2025 14:16:34 +0800
Subject: [PATCH 1/3] =?UTF-8?q?IR=20=E5=8F=8D=E9=A6=88bug=20=E9=87=8D?=
=?UTF-8?q?=E6=96=B0=E8=AE=BE=E7=BD=AE=E7=8A=B6=E6=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/Management/UserFeedBackService.cs | 2 ++
1 file changed, 2 insertions(+)
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)
From dd09c78cd21433036cbdc45aca0dc1a515058eb3 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Mon, 17 Feb 2025 15:12:59 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=80=80=E5=87=BA?=
=?UTF-8?q?=E4=BA=BA=E5=91=98=E7=BB=B4=E6=8A=A4=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 25 ++++++++-
IRaCIS.Core.Application/TestService.cs | 54 ++++++++++++++++++-
2 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 2d418714d..3950e6f79 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影像阅片
@@ -13237,6 +13242,14 @@
+
+
+ 项目退出历史数据维护
+
+
+
+
+
用户多账号,初次维护数据
@@ -13794,11 +13807,21 @@
是否是一致性分析产生
+
+
+ 是否存在未处理的反馈
+
+
是否是一致性分析产生
+
+
+ 是否存在未处理的反馈
+
+
未完成阅片量
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);
From fed2cbe0431fbfcd0b03b203df0f5079fdb19b3f Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Mon, 17 Feb 2025 17:15:25 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=88=9B=E5=BB=BA?=
=?UTF-8?q?=E8=B4=A6=E5=8F=B7=E4=BB=85=E4=BB=85=E8=AE=B0=E5=BD=95=E4=B8=80?=
=?UTF-8?q?=E6=9D=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 4 +--
.../Service/Common/MailService.cs | 23 +++++------------
.../SiteSurvey/TrialSiteSurveyService.cs | 25 +++++++++++++++++--
.../TrialSiteUser/TrialExternalUserService.cs | 14 ++++++++++-
4 files changed, 44 insertions(+), 22 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 909f16392..c8db7aee2 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -12924,7 +12924,7 @@
项目外部人员 录入流程相关
-
+
项目外部人员 录入流程相关
@@ -15539,7 +15539,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/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);
+ }
+
}