From 363411f57c2edbe7dbe00da14419c224d97cb5ca Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 17 Oct 2023 10:26:52 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E8=BF=81=E7=A7=BBStudy=20=E4=B8=AD?=
=?UTF-8?q?=E5=BF=83=E8=B0=83=E7=A0=94=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Document/TrialEmailNoticeConfigService.cs | 4 -
.../DTO/TrialSiteSurveyViewModel.cs | 28 +-
.../DTO/TrialSiteUserSurveyViewModel.cs | 65 +-
.../Interface/ITrialSiteUserSurveyService.cs | 2 +-
.../TrialSiteEquipmentSurveyService.cs | 23 +-
.../SiteSurvey/TrialSiteSurveyService.cs | 688 ++++++++++--------
.../SiteSurvey/TrialSiteUserSurveyService.cs | 94 ++-
.../SiteSurvey/TrialSiteUserSurvey.cs | 25 +-
8 files changed, 561 insertions(+), 368 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
index 70ad72dd1..91d9e117e 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs
@@ -370,10 +370,6 @@ namespace IRaCIS.Core.Application.Service
}
-
-
-
-
}
else if (businessScenarioEnum == EmailBusinessScenario.PDConfirmed)
{
diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs
index c6cecba91..83d826c51 100644
--- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs
+++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs
@@ -84,7 +84,6 @@ namespace IRaCIS.Core.Application.Contracts
public bool? IsGenerateAccount { get; set; }
- public Guid? TrialRoleNameId { get; set; }
public TrialSiteUserStateEnum? State { get; set; }
@@ -168,6 +167,29 @@ namespace IRaCIS.Core.Application.Contracts
+ }
+
+ public class TrialSiteSurveySelectView
+ {
+ public Guid Id { get; set; }
+ public TrialSiteSurveyEnum State { get; set; }
+ public DateTime CreateTime { get; set; }
+ public bool IsDeleted { get; set; }
+
+ public string Phone { get; set; } = string.Empty;
+ public string Email { get; set; } = string.Empty;
+
+ public string UserName { get; set; } = string.Empty;
+
+ }
+
+ public class TrialSiteSurveySelectquery
+ {
+ public Guid TrialId { get; set; }
+
+ public Guid SiteId { get; set; }
+
+ public Guid TrialSiteSurveyId { get; set; }
}
///TrialSiteSurveyQuery 列表查询参数模型
@@ -221,7 +243,7 @@ namespace IRaCIS.Core.Application.Contracts
public string Email { get; set; } = string.Empty;
[NotDefault]
- public Guid TrialId { get; set; }
+ public Guid TrialId { get; set; }
}
@@ -324,7 +346,7 @@ namespace IRaCIS.Core.Application.Contracts
public string UserKeyInfo { get; set; } = string.Empty;
-
+
public TrialSiteSurveyEnum? State { get; set; }
diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs
index f3e868457..e7be7023c 100644
--- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs
+++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs
@@ -5,19 +5,21 @@
//--------------------------------------------------------------------
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Domain.Share;
+using MiniExcelLibs.Attributes;
using Newtonsoft.Json;
+using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.Contracts
{
/// TrialSiteUserSurveyView 列表视图模型
- public class TrialSiteUserSurveyView: TrialSiteUserSurveyAddOrEdit
+ public class TrialSiteUserSurveyView : TrialSiteUserSurveyAddOrEdit
{
public bool IsGenerateSuccess { get; set; }
public DateTime CreateTime { get; set; }
public Guid CreateUserId { get; set; }
public DateTime UpdateTime { get; set; }
public Guid UpdateUserId { get; set; }
-
+
public string UserType { get; set; } = string.Empty;
[JsonIgnore]
@@ -48,14 +50,18 @@ namespace IRaCIS.Core.Application.Contracts
}
}
- public string TrialRoleName { get; set; }
- public string TrialRoleCode { get; set; }
public UserTypeEnum? UserTypeEnum { get; set; }
public Guid? SystemUserId { get; set; }
+
+
+
+ public bool? IsHistoryUserOriginDeleted { get; set; }
+
+
}
@@ -88,7 +94,7 @@ namespace IRaCIS.Core.Application.Contracts
public class TrialSiteUserSurveyAddOrEdit
{
public Guid? Id { get; set; }
-
+
public Guid TrialSiteSurveyId { get; set; }
public Guid? UserTypeId { get; set; }
public string FirstName { get; set; } = string.Empty;
@@ -98,11 +104,20 @@ namespace IRaCIS.Core.Application.Contracts
[DictionaryTranslateAttribute("YesOrNo")]
public bool IsGenerateAccount { get; set; }
- public Guid TrialRoleNameId { get; set; }
+ public int TrialRoleCode { get; set; }
public string OrganizationName { get; set; } = string.Empty;
+
+ public bool IsHistoryUser { get; set; }
+ public bool? IsHistoryUserDeleted { get; set; }
}
+ public class TrialSiteUserSurverQuery
+ {
+ public Guid TrialSiteSurveyId { get; set; }
+
+ public bool? IsHistoryUser { get; set; }
+ }
public class TrialSiteUserSurveyVerfyResult
{
@@ -111,6 +126,44 @@ namespace IRaCIS.Core.Application.Contracts
public List ErroMsgList { get; set; } = new List();
}
+ public class SiteSurveyUserImportUploadDto
+ {
+ [NotDefault]
+ public Guid TrialId { get; set; }
+
+ public string BaseUrl { get; set; }
+ public string RouteUrl { get; set; }
+ }
+
+ public class SiteSurveyUserImportDto
+ {
+ public string TrialSiteCode { get; set; } = string.Empty;
+ public string FirstName { get; set; } = string.Empty;
+ public string LastName { get; set; } = string.Empty;
+ public string Email { get; set; } = string.Empty;
+ public string Phone { get; set; } = string.Empty;
+ public string OrganizationName { get; set; } = string.Empty;
+
+ [ExcelColumnName("UserType")]
+ public string UserTypeStr { get; set; }
+
+ [JsonIgnore]
+ public Guid SiteId { get; set; }
+
+ [JsonIgnore]
+ public UserTypeEnum UserTypeEnum { get; set; } = UserTypeEnum.Undefined;
+
+
+ [JsonIgnore]
+ public Guid UserTypeId { get; set; }
+
+
+ [JsonIgnore]
+ public bool IsGeneratedAccount { get; set; }
+ [JsonIgnore]
+ public bool IsJoinedTrial { get; set; }
+ }
+
}
diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs
index 32942f1ac..10de23ac1 100644
--- a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs
+++ b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteUserSurveyService.cs
@@ -10,6 +10,6 @@ namespace IRaCIS.Core.Application.Contracts
{
Task AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey);
Task DeleteTrialSiteUserSurvey(Guid trialSiteUserSurveyId);
- Task> GetTrialSiteUserSurveyList(Guid trialSiteSurveyId);
+ Task> GetTrialSiteUserSurveyList(TrialSiteUserSurverQuery inquery);
}
}
\ No newline at end of file
diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs
index 5a1de2dff..1eb6ff320 100644
--- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs
+++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs
@@ -17,10 +17,12 @@ namespace IRaCIS.Core.Application.Contracts
public class TrialSiteEquipmentSurveyService : BaseService, ITrialSiteEquipmentSurveyService
{
private readonly IRepository _trialSiteEquipmentSurveyRepository;
+ private readonly IRepository _trialSiteSurveyRepository;
- public TrialSiteEquipmentSurveyService(IRepository trialSiteEquipmentSurveyRepository)
+ public TrialSiteEquipmentSurveyService(IRepository trialSiteEquipmentSurveyRepository, IRepository trialSiteSurveyRepository)
{
_trialSiteEquipmentSurveyRepository = trialSiteEquipmentSurveyRepository;
+ _trialSiteSurveyRepository = trialSiteSurveyRepository;
}
@@ -34,20 +36,15 @@ namespace IRaCIS.Core.Application.Contracts
return await trialSiteEquipmentSurveyQueryable.ToListAsync();
}
- [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
+ [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[HttpPost("{trialId:guid}")]
public async Task AddOrUpdateTrialSiteEquipmentSurvey(TrialSiteEquipmentSurveyAddOrEdit addOrEditTrialSiteEquipmentSurvey)
{
-
- if (addOrEditTrialSiteEquipmentSurvey.Id != null)
- {
- if (await _trialSiteEquipmentSurveyRepository.Where(t => t.Id == addOrEditTrialSiteEquipmentSurvey.Id).AnyAsync(t => t.TrialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock))
- {
- //---已锁定,不允许操作
- return ResponseOutput.NotOk(_localizer["TrialSiteEquipment_Locked"]);
- }
- }
+ if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteEquipmentSurvey.TrialSiteSurveyId && (t.IsDeleted == true || t.State == TrialSiteSurveyEnum.PMCreatedAndLock), true))
+ {
+ return ResponseOutput.NotOk(_localizer["TrialSiteEquipment_Invalid"]);
+ }
var entity = await _trialSiteEquipmentSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteEquipmentSurvey, true);
@@ -55,11 +52,11 @@ namespace IRaCIS.Core.Application.Contracts
}
- [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
+ [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[HttpDelete("{trialSiteEquipmentSurveyId:guid}/{trialId:guid}")]
public async Task DeleteTrialSiteEquipmentSurvey(Guid trialSiteEquipmentSurveyId)
{
- if (await _trialSiteEquipmentSurveyRepository.Where(t => t.Id == trialSiteEquipmentSurveyId).AnyAsync(t => t.TrialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock))
+ if (await _trialSiteEquipmentSurveyRepository.Where(t => t.Id == trialSiteEquipmentSurveyId).AnyAsync(t => t.TrialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock))
{
//---已锁定,不允许操作
return ResponseOutput.NotOk(_localizer["TrialSiteEquipment_Locked"]);
diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs
index 522885748..aa9dfd485 100644
--- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs
+++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs
@@ -15,6 +15,11 @@ using MailKit.Security;
using MimeKit;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Filter;
+using IRaCIS.Core.Infrastructure.Extention;
+using Microsoft.VisualBasic;
+using DocumentFormat.OpenXml.Spreadsheet;
+using IRaCIS.Core.Domain.Models;
+using IRaCIS.Core.Application.ViewModel;
using Medallion.Threading;
namespace IRaCIS.Core.Application.Contracts
@@ -29,26 +34,25 @@ namespace IRaCIS.Core.Application.Contracts
private readonly IRepository _trialSiteUserSurveyRepository;
private readonly IRepository _userRepository;
private readonly IRepository _trialSiteRepository;
- private readonly IRepository _doctorRepository;
private readonly IRepository _trialUserRepository;
+ private readonly IRepository _trialSiteUserRepository;
+ private readonly IDistributedLockProvider _distributedLockProvider;
private readonly ITokenService _tokenService;
private readonly IMailVerificationService _mailVerificationService;
- private readonly IDistributedLockProvider _distributedLockProvider;
public TrialSiteSurveyService(IRepository trialSiteSurveyRepository, IRepository trialUserRepository, IRepository trialSiteUserSurveyRepository,
IRepository userRepository, IRepository trialSiteRepository,
- IRepository doctorRepository,
ITokenService tokenService,
- IMailVerificationService mailVerificationService, IDistributedLockProvider distributedLockProvider)
+ IMailVerificationService mailVerificationService, IRepository trialSiteUserRepository, IDistributedLockProvider distributedLockProvider)
{
_trialSiteSurveyRepository = trialSiteSurveyRepository;
_trialSiteUserSurveyRepository = trialSiteUserSurveyRepository;
_userRepository = userRepository;
_trialUserRepository = trialUserRepository;
_trialSiteRepository = trialSiteRepository;
- _doctorRepository = doctorRepository;
_tokenService = tokenService;
_mailVerificationService = mailVerificationService;
+ _trialSiteUserRepository = trialSiteUserRepository;
_distributedLockProvider = distributedLockProvider;
}
@@ -88,11 +92,6 @@ namespace IRaCIS.Core.Application.Contracts
var verificationRecord = await _repository.GetQueryable().OrderByDescending(x => x.ExpirationTime).Where(t => (t.EmailOrPhone == inDto.EmailOrPhone) && t.Code == inDto.VerificationCode && t.CodeType == VerifyType.Email).FirstOrDefaultAsync();
VerifyEmialGetDoctorInfoOutDto result = new VerifyEmialGetDoctorInfoOutDto();
- var doctorInfo = await _doctorRepository.Where(x => x.EMail == inDto.EmailOrPhone).FirstOrDefaultAsync();
-
- result.DoctorId = doctorInfo == null ? null : doctorInfo.Id;
- result.ReviewStatus = doctorInfo == null ? null : doctorInfo.ReviewStatus;
-
//检查数据库是否存在该验证码
if (verificationRecord == null)
{
@@ -104,7 +103,7 @@ namespace IRaCIS.Core.Application.Contracts
//检查验证码是否失效
if (verificationRecord.ExpirationTime < DateTime.Now)
{
- //---验证码已经过期。
+ //---验证码已经过期。
throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]);
}
else //验证码正确 并且 没有超时
@@ -117,7 +116,7 @@ namespace IRaCIS.Core.Application.Contracts
}
///
- /// 发送验证码
+ ///site 调研 发送验证码
///
///
///
@@ -160,225 +159,194 @@ namespace IRaCIS.Core.Application.Contracts
public async Task VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService)
{
- var isReplaceUser = !string.IsNullOrEmpty(userInfo.ReplaceUserEmailOrPhone);
+ #region 20230804 修改调研表逻辑
- if (userInfo.IsUpdate && isReplaceUser && !await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId))
- {
- //---该中心不存在该交接人的中心调研记录表,不允许选择更新。
- return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoRecordToUpdate"]);
- }
-
-
- if (userInfo.IsUpdate && await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock))
- {
- //---您的中心调研记录正在审核中,不允许进行更新操作。若需要更新,请在驳回后进行操作。
- return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_RecordUnderReview"]);
- }
-
-
- //自己的记录锁定了 只能更新自己的,不能更新别人的(但是别人能更新自己锁定的)
- if (userInfo.IsUpdate && userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone && await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock))
- {
- //自己的锁了 想更新别人的
- //---当前中心中,您提交调研记录表已锁定,不允许更新其他人邮箱调研记录。
- return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_LockedByCurrentUser"]);
- }
-
- //自己的锁定了 如果有其他未锁定的,也不能更新自己的
- if (userInfo.IsUpdate && userInfo.ReplaceUserEmailOrPhone == userInfo.EmailOrPhone &&
- await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock)
- && await _trialSiteSurveyRepository.AnyAsync(t => (t.Email != userInfo.EmailOrPhone && t.Phone != userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock))
- {
-
- //---当前中心,您提交的调研记录表已锁定。当前存在其他人员提交的调研记录表未锁定,不允许更新您之前提交的调研记录。
- return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_LockedByOtherUsers"]);
- }
-
-
- ////存在未锁定的记录,却去更新已锁定的
- if (userInfo.IsUpdate && userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone && await _trialSiteSurveyRepository.AnyAsync(t => t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock)
- && await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock)
- && !await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock)
- )
- {
- //---当前中心存在未锁定的调研记录,不允许更新已锁定的调研记录。
- return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_UnlockedRecordsExist"]);
- }
-
-
-
- var verificationRecord = await _repository
- .FirstOrDefaultAsync(t => (t.EmailOrPhone == userInfo.EmailOrPhone) && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
-
+ var verifyRecord = await _repository.FirstOrDefaultAsync(t => (t.EmailOrPhone == userInfo.EmailOrPhone) && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
//检查数据库是否存在该验证码
- if (verificationRecord == null)
+ if (verifyRecord == null)
{
//---验证码错误。
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_WrongVerificationCode"]);
}
+ else if (verifyRecord.ExpirationTime < DateTime.Now)
+ {
+ return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_WrongVerificationCode"]);
+ }
else
{
- //检查验证码是否失效
- if (verificationRecord.ExpirationTime < DateTime.Now)
+ //验证码正确 不处理
+ }
+
+ TrialSiteSurvey? currentEntity = null;
+
+
+ var userList = await _trialSiteUserRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, false, true).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
+
+ //普通登录
+ if (userInfo.IsUpdate == false)
+ {
+
+ var dbEntityList = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId).ToListAsync();
+
+
+ //没有记录 new一份
+ if (dbEntityList.Count == 0)
{
- //---验证码已经过期。
- return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]);
+ var addSurvey = _mapper.Map(userInfo);
+
+
+ //从项目site 中找到已存在的 加到历史人员中
+ addSurvey.TrialSiteUserSurveyList = userList;
+
+ currentEntity = await _repository.AddAsync(addSurvey);
+
}
- else //验证码正确 并且 没有超时
+ else
{
- TrialSiteSurvey? dbEntity = null;
+ //找到当前最新的调研表
+ var currentLatest = dbEntityList.OrderByDescending(t => t.CreateTime).FirstOrDefault();
- //替换交接人
- if (isReplaceUser)
+ if (currentLatest!.Email != userInfo.EmailOrPhone)
{
- //该交接人的记录 是否有未锁定的 有就用未锁定的,没有就用 锁定的最后一条
-
- var noLockedLastSurvey = await _trialSiteSurveyRepository.Where(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock == false, true)
- .Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
-
- //都是锁定的
- if (noLockedLastSurvey == null)
- {
-
- var latestLock = await _trialSiteSurveyRepository.Where(t => t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
-
- if (latestLock!.Email != userInfo.ReplaceUserEmailOrPhone)
- {
- return ResponseOutput.NotOk($"该邮箱{userInfo.ReplaceUserEmailOrPhone}对应的调查表不是最新锁定的记录,不允许更新!");
- }
-
- var lockedLastSurvey = await _trialSiteSurveyRepository.Where(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock == true)
- .Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync().IfNullThrowException();
-
- //Copy 一份 更换邮箱
-
- var copy = lockedLastSurvey.Clone();
-
- copy.State = TrialSiteSurveyEnum.ToSubmit;
-
- copy.Email = userInfo.EmailOrPhone;
-
- if (userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone)
- {
- copy.UserName = String.Empty;
- copy.Phone = String.Empty;
- }
-
-
- copy.Id = Guid.Empty;
- copy.TrialSiteEquipmentSurveyList.ForEach(t => t.Id = Guid.Empty);
- copy.TrialSiteUserSurveyList.ForEach(t => t.Id = Guid.Empty);
-
- dbEntity = await _repository.AddAsync(copy);
-
- }
- else
- {
- //有未锁定的 更新下邮箱
- noLockedLastSurvey.Email = userInfo.EmailOrPhone;
- noLockedLastSurvey.UserName = String.Empty;
- noLockedLastSurvey.Phone = String.Empty;
-
- dbEntity = noLockedLastSurvey;
- }
-
-
-
- ////邮箱相同的话 就是同一个人进来 copy一份
- //if (userInfo.EmailOrPhone == userInfo.ReplaceUserEmailOrPhone)
- //{
- // dbEntity = await _repository.Where(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId).Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).FirstOrDefaultAsync().IfNullThrowConvertException();
-
- // var clone = dbEntity.Clone();
- // clone.Id = Guid.Empty;
- // clone.TrialSiteEquipmentSurveyList.ForEach(t => t.Id = Guid.Empty);
- // clone.TrialSiteUserSurveyList.ForEach(t => t.Id = Guid.Empty);
- // clone.State = TrialSiteSurveyEnum.ToSubmit;
-
- // dbEntity = await _repository.AddAsync(clone);
-
- //}
-
+ //---该中心下已经有其他用户已填写的调研表,您不被允许继续填写
+ return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_AlreadyFilledByOtherUsers"]);
}
- else
+
+ currentEntity = currentLatest;
+
+ if (currentEntity.State != TrialSiteSurveyEnum.PMCreatedAndLock)
{
- var dbEntityList = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId).ToListAsync();
-
-
- //没有记录 new一份
- if (dbEntityList.Count == 0)
- {
-
- dbEntity = await _repository.AddAsync(_mapper.Map(userInfo));
-
- }
- else
- {
-
-
-
- //该site 下不存在该邮箱的记录
- if (!dbEntityList.Any(t => t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone))
- {
- //---该中心下已经有其他用户已填写的调研表,您不被允许继续填写
- return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_AlreadyFilledByOtherUsers"]);
- }
-
-
- //有没有该邮箱 未锁定的
- var nolockEntity = dbEntityList.Where(t => t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone).FirstOrDefault(t => t.State != TrialSiteSurveyEnum.PMCreatedAndLock);
-
- // 未锁定的 为空
- if (nolockEntity == null)
- {
- //查看最新锁定的
- dbEntity = dbEntityList.Where(t => t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone).OrderByDescending(t => t.CreateTime).FirstOrDefault(t => t.State == TrialSiteSurveyEnum.PMCreatedAndLock).IfNullThrowException();
-
- }
- else //有未锁定的 直接用未锁定的
- {
- dbEntity = nolockEntity;
- }
-
- }
- //_mapper.Map(userInfo, dbEntity);
-
-
-
+ await UnlockSyncSiteUserAsync(userInfo.TrialId, userInfo.SiteId, currentEntity.Id, userList);
}
+ }
- //删除验证码历史记录
- await _repository.BatchDeleteAsync(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
- await _repository.SaveChangesAsync();
- return ResponseOutput.Ok(new
- {
- TrialSiteSurveyId = dbEntity!.Id,
- Token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo()
- {
- Id = Guid.NewGuid(),
- IsReviewer = false,
- IsAdmin = false,
- RealName = "SiteSurvey",
- UserName = "SiteSurvey",
- Sex = 0,
- //UserType = "ShareType",
- UserTypeEnum = UserTypeEnum.Undefined,
- Code = "SiteSurvey",
- }))
- });
+ }
+ //更新调研表
+ else
+ {
+ //找到最新的调研表
+ var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, true)
+ .Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
+
+ if (currentLatest == null)
+ {
+ return ResponseOutput.NotOk(_localizer["TrialSite_NoSurveyToUpdate"]);
+ }
+
+ if (currentLatest.Email != userInfo.ReplaceUserEmailOrPhone)
+ {
+ //---该中心不存在该交接人的中心调研记录表,不允许选择更新。
+ return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoRecordToUpdate"]);
+ }
+
+
+
+ //未锁定的状态 就改为废除
+ if (currentLatest.State != TrialSiteSurveyEnum.PMCreatedAndLock)
+ {
+ currentLatest.IsDeleted = true;
+ }
+ //锁定的 需要改状态么?
+ else
+ {
+
+ }
+ var copy = currentLatest.Clone();
+
+ copy.State = TrialSiteSurveyEnum.ToSubmit;
+ copy.IsDeleted = false;
+
+ copy.Phone = string.Empty;
+ copy.UserName = string.Empty;
+ copy.Email = userInfo.EmailOrPhone;
+ copy.Id = Guid.Empty;
+ copy.CreateTime = DateAndTime.Now;
+
+ if (userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone)
+ {
+ copy.UserName = String.Empty;
+ copy.Phone = String.Empty;
+ }
+
+
+
+ copy.TrialSiteEquipmentSurveyList = currentLatest.TrialSiteEquipmentSurveyList.Clone();
+ copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty; t.CreateTime = DateTime.Now; });
+
+ //锁定了的话,就不拷贝
+ if (currentLatest.State != TrialSiteSurveyEnum.PMCreatedAndLock)
+ {
+ copy.TrialSiteUserSurveyList = currentLatest.TrialSiteUserSurveyList.Clone().Where(t => t.IsHistoryUser == false).ToList();
+ copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; t.CreateTime = DateTime.Now; });
+ }
+
+ //从项目site 中找到已存在的 加到历史人员中
+
+
+ copy.TrialSiteUserSurveyList.AddRange(userList);
+
+ currentEntity = await _trialSiteSurveyRepository.AddAsync(copy);
+
+
+
+ }
+
+
+ //删除验证码历史记录
+ await _repository.BatchDeleteAsync(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
+
+ await _trialSiteSurveyRepository.SaveChangesAsync();
+
+ return ResponseOutput.Ok(new
+ {
+ TrialSiteSurveyId = currentEntity!.Id,
+ Token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo()
+ {
+ Id = Guid.NewGuid(),
+ IsReviewer = false,
+ IsAdmin = false,
+ RealName = "SiteSurvey",
+ UserName = "SiteSurvey",
+ Sex = 0,
+ //UserType = "ShareType",
+ UserTypeEnum = UserTypeEnum.Undefined,
+ Code = "SiteSurvey",
+ }))
+ });
+
+ #endregion
+ }
+
+ private async Task UnlockSyncSiteUserAsync(Guid trialId, Guid siteId, Guid trialSiteSurveyId, List userList)
+ {
+ var existList = await _trialSiteUserSurveyRepository.Where(t => t.IsHistoryUser && t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.SiteId == siteId, true).ToListAsync();
+
+ foreach (var item in userList)
+ {
+ var find = existList.FirstOrDefault(t => t.SystemUserId == item.SystemUserId);
+ //不存在就加入
+ if (find == null)
+ {
+ item.TrialSiteSurveyId = trialSiteSurveyId;
+ await _trialSiteUserSurveyRepository.AddAsync(item);
+ }
+ else
+ {
+ find.IsHistoryUserOriginDeleted = item.IsHistoryUserOriginDeleted;
}
}
+ await _trialSiteUserSurveyRepository.SaveChangesAsync();
}
@@ -389,9 +357,24 @@ namespace IRaCIS.Core.Application.Contracts
[HttpGet("{trialId:guid}/{trialSiteSurveyId:guid}")]
public async Task GetSiteSurveyInfo(Guid trialSiteSurveyId, Guid trialId)
{
- var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId)
- .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException();
+ //有可能填表人提交了,但是此时PM手动对人员信息进行了更改,此时需要将数据同步下(选择在这里同步是因为 不想改动 中心人员哪里的两个接口的逻辑)
+ var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId, true);
+
+
+ if (find.State != TrialSiteSurveyEnum.PMCreatedAndLock && find.IsDeleted != true)
+ {
+ var userList = await _trialSiteUserRepository.Where(t => t.TrialId == find.TrialId && t.SiteId == find.SiteId, false, true).ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
+
+
+ await UnlockSyncSiteUserAsync(find.TrialId, find.SiteId, find.Id, userList);
+ }
+
+
+
+
+ var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters()
+ .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException();
return result;
}
@@ -409,7 +392,7 @@ namespace IRaCIS.Core.Application.Contracts
{
if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.PMCreatedAndLock))
{
- //---中心调研已锁定,不允许操作。
+ //---中心调研已锁定,不允许操作。
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_Locked"]);
}
}
@@ -469,11 +452,21 @@ namespace IRaCIS.Core.Application.Contracts
.WhereIf(surveyQueryDTO.UpdateTimeBegin != null, t => t.UpdateTime >= surveyQueryDTO.UpdateTimeBegin)
.WhereIf(surveyQueryDTO.UpdateTimeEnd != null, t => t.UpdateTime <= surveyQueryDTO.UpdateTimeEnd)
- .ProjectTo(_mapper.ConfigurationProvider);
+ .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us });
return await trialSiteSurveyQueryable.ToPagedListAsync(surveyQueryDTO.PageIndex, surveyQueryDTO.PageSize, surveyQueryDTO.SortField, surveyQueryDTO.Asc);
}
+ [HttpPost]
+ public async Task> GetTrialSiteSurveySelectList(TrialSiteSurveySelectquery inQuery)
+ {
+ var trialSiteSurveyQueryable = _trialSiteSurveyRepository
+ .Where(t => t.Id != inQuery.TrialSiteSurveyId)
+ .Where(t => t.TrialId == inQuery.TrialId && t.SiteId == inQuery.SiteId).IgnoreQueryFilters()
+ .ProjectTo(_mapper.ConfigurationProvider);
+
+ return await trialSiteSurveyQueryable.ToListAsync();
+ }
///
/// 项目Site调研用户列表 所有site的调研用户 最新的调研表的记录的用户 new
@@ -495,27 +488,12 @@ namespace IRaCIS.Core.Application.Contracts
.Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId))
.WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId)
.WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount)
- .WhereIf(queryParam.TrialRoleNameId != null, t => t.TrialRoleNameId == queryParam.TrialRoleNameId)
.WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State)
- .WhereIf(queryParam.State != null && queryParam.State == TrialSiteUserStateEnum.OverTime, t => t.InviteState == TrialSiteUserStateEnum.HasSend && t.ExpireTime < DateTime.Now)
.WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName))
.WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName))
.ProjectTo(_mapper.ConfigurationProvider);
- //var query = _trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId && t.IsAbandon == false)
- // .WhereIf(queryParam.SiteId != null, t => t.SiteId == queryParam.SiteId)
- // .WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.UserName).Contains(queryParam.FormWriterKeyInfo) || t.Email.Contains(queryParam.FormWriterKeyInfo) || t.Phone.Contains(queryParam.FormWriterKeyInfo))
- // .GroupBy(t => t.SiteId)
- // .Select(g => g.OrderByDescending(u => u.CreateTime).FirstOrDefault())
- // .SelectMany(t => t.TrialSiteUserSurveyList)
- //.WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId)
- //.WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount)
- //.WhereIf(queryParam.TrialRoleNameId != null, t => t.TrialRoleNameId == queryParam.TrialRoleNameId)
- //.WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State)
- //.WhereIf(queryParam.State != null && queryParam.State == TrialSiteUserStateEnum.OverTime, t => t.InviteState == TrialSiteUserStateEnum.HasSend && t.ExpireTime < DateTime.Now)
- //.WhereIf(!string.IsNullOrEmpty(queryParam.UserKeyInfo), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserKeyInfo) || t.Email.Contains(queryParam.UserKeyInfo) || t.Phone.Contains(queryParam.UserKeyInfo))
- //.ProjectTo(_mapper.ConfigurationProvider);
return await query.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, queryParam.SortField, queryParam.Asc);
@@ -561,13 +539,11 @@ namespace IRaCIS.Core.Application.Contracts
var messageToSend = new MimeMessage();
-
if (await _repository.AnyAsync(t => t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id == trialSiteSurveyId))
{
//---中心调研已锁定,不允许操作。
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_Locked"]);
}
-
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
{
@@ -595,6 +571,7 @@ namespace IRaCIS.Core.Application.Contracts
}
else
{
+
//没有SPM 给填表人发
messageToSend.To.Add(new MailboxAddress(String.Empty, survey.Email));
@@ -651,52 +628,13 @@ namespace IRaCIS.Core.Application.Contracts
await _IMailVerificationService.SiteSurveyRejectEmail(messageToSend);
-
-
-
await _trialSiteSurveyRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
- ///
- /// 驳回
- ///
- ///
- ///
- ///
- [HttpPut("{trialId:guid}/{trialSiteSurveyId:guid}")]
- [Obsolete]
- public async Task SubmissionRejection(Guid trialId, Guid trialSiteSurveyId)
- {
- if (await _repository.AnyAsync(t => t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id == trialSiteSurveyId))
- {
- //---中心调研已锁定,不允许操作。
- return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_Locked"]);
- }
- if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
- {
- await _repository.BatchUpdateAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
- }
- else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
- {
- var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialUserList.Any(u => u.User.UserTypeEnum == UserTypeEnum.SPM || u.User.UserTypeEnum == UserTypeEnum.CPM));
-
- if (hasSPMOrCPM)
- {
- await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.CRCSubmitted });
-
- }
- else
- {
- await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
- }
- }
- return ResponseOutput.Ok();
-
- }
[HttpPut("{trialId:guid}/{trialSiteSurveyId:guid}")]
@@ -736,13 +674,48 @@ namespace IRaCIS.Core.Application.Contracts
var trialId = siteSurvyeSubmit.TrialId;
var trialSiteSurveyId = siteSurvyeSubmit.TrialSiteSurveyId;
- if (_userInfo.IsAdmin)
+ var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId, false, true).FirstOrDefaultAsync()).IfNullThrowException();
+
+
+ if (trialSiteSurvey.IsDeleted == true || trialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock)
{
- //---不允许管理员操作。
- return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoAdminAcces"]);
+ throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_Invalid"]);
}
+
+
+ var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId)
+ .Where(t => !(t.IsHistoryUser && t.IsHistoryUserDeleted == true))
+ .Select(t =>
+ new
+ {
+ t.TrialSiteSurveyId,
+ t.IsGenerateAccount,
+ t.IsGenerateSuccess,
+ t.UserTypeId,
+ UserTypeEnum = (UserTypeEnum?)t.UserTypeRole.UserTypeEnum,
+ t.TrialRoleCode,
+ t.Email,
+ }).ToListAsync();
+
+ var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList();
+
+
+ if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator) ||
+ !currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.SR))
+ {
+ throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_MissingAccount"]);
+ }
+
+ if (currentUserList.GroupBy(t => new { t.UserTypeId, t.Email })
+ .Any(g => g.Count() > 1))
+ {
+ throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_DuplicateEmail"]);
+ }
+
+
+
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined)
{
var hasSPMOrCPM = await _trialSiteSurveyRepository.AnyAsync(t => t.TrialId == trialId && t.Trial.TrialUserList.Any(u => u.User.UserTypeEnum == UserTypeEnum.SPM || u.User.UserTypeEnum == UserTypeEnum.CPM));
@@ -765,23 +738,28 @@ namespace IRaCIS.Core.Application.Contracts
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now });
}
- else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
+ else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
{
- var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).FirstOrDefaultAsync()).IfNullThrowException();
-
-
+ var allUserList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ProjectTo(_mapper.ConfigurationProvider).ToList();
//已生成的不管 管的只需要是 生成失败的并且需要生成账号的
- var needGenerateList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsJoin != true).ProjectTo(_mapper.ConfigurationProvider).ToList();
-
-
- //await SendInviteEmail(new InviteEmailCommand() { TrialId = trialId, RouteUrl = siteSurvyeSubmit.RouteUrl, UserList = needGenerateList });
-
+ var needGenerateList = allUserList.Where(t => t.IsHistoryUser == false && t.IsGenerateAccount && t.IsJoin != true).ToList();
await GenerateAccountAsync(needGenerateList, trialId);
- await SendSiteSurveyUserJoinEmail(new TrialSiteUserSurveyJoinCommand() { TrialId = trialId, TrialSiteSurveyId = trialSiteSurveyId, RouteUrl = siteSurvyeSubmit.RouteUrl, BaseUrl = siteSurvyeSubmit.BaseUrl, UserList = needGenerateList });
+ //新加入的 或者历史人员退出改为加入的
+ var needSendEmailList = allUserList.Where(t => (t.IsHistoryUser == false && t.IsGenerateAccount && t.IsJoin != true) || (t.IsHistoryUser == true && t.IsHistoryUserOriginDeleted == true && t.IsHistoryUserDeleted == false)).ToList();
+
+ await SendSiteSurveyUserJoinEmail(new TrialSiteUserSurveyJoinCommand() { TrialId = trialId, TrialSiteSurveyId = trialSiteSurveyId, RouteUrl = siteSurvyeSubmit.RouteUrl, BaseUrl = siteSurvyeSubmit.BaseUrl, UserList = needSendEmailList });
+
+
+ var needQuitUserList = allUserList.Where(t => t.IsHistoryUser && t.IsHistoryUserOriginDeleted == false && t.IsHistoryUserDeleted == true).ToList();
+
+ await DealSiteUserQuitSiteAsync(trialId, trialSiteSurvey.SiteId, needQuitUserList);
+
+ //将历史锁定的调研表废弃
+ await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id != trialSiteSurveyId, z => new TrialSiteSurvey() { IsDeleted = true });
}
await _trialSiteSurveyRepository.SaveChangesAsync();
@@ -792,13 +770,14 @@ namespace IRaCIS.Core.Application.Contracts
private async Task GenerateAccountAsync(List needGenerateList, Guid trialId)
{
+ var trialType = _repository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault();
+
foreach (var item in needGenerateList)
{
//找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户
var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync();
- var trialType = _repository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault();
if (sysUserInfo == null)
{
@@ -825,7 +804,6 @@ namespace IRaCIS.Core.Application.Contracts
saveItem.UserTypeEnum = _repository.Where(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First();
- //saveItem.Password = MD5Helper.Md5(verificationCode.ToString());
var newUser = _userRepository.AddAsync(saveItem).Result;
@@ -834,29 +812,24 @@ namespace IRaCIS.Core.Application.Contracts
sysUserInfo = newUser;
+
}
+ await _trialSiteUserSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, SystemUserId = sysUserInfo.Id });
+
}
//发送邮件的时候需要用到该字段
item.SystemUserId = sysUserInfo.Id;
- await _trialSiteUserSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, SystemUserId = sysUserInfo.Id });
-
-
-
-
}
await _trialSiteUserSurveyRepository.SaveChangesAsync();
}
-
-
- [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
- public async Task SendSiteSurveyUserJoinEmail(TrialSiteUserSurveyJoinCommand joinCommand)
+ private async Task SendSiteSurveyUserJoinEmail(TrialSiteUserSurveyJoinCommand joinCommand)
{
var trialSiteSurvey = await _trialSiteSurveyRepository.FirstAsync(t => t.Id == joinCommand.TrialSiteSurveyId);
@@ -866,7 +839,7 @@ namespace IRaCIS.Core.Application.Contracts
if (userInfo.SystemUserId == null)
{
- //---生成账户Id 未取到值,请排查
+ //---生成账户Id 未取到值,请排查
throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_FailedToGenerateAccountId"]);
}
@@ -877,24 +850,48 @@ namespace IRaCIS.Core.Application.Contracts
//判断TrialUser中是否存在 不存在就插入
- if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true))
+
+ var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true);
+ if (findTrialUser == null)
{
- await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
+ await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
+
+ await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl);
+
}
- if (!await _repository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId==siteId, true))
+ else if (findTrialUser.IsDeleted == true)
+ {
+ await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser()
+ {
+ IsDeleted = false,
+ DeletedTime = null,
+ JoinTime = DateTime.Now,
+ });
+
+ await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl);
+ }
+
+ var findTrialSiteUser = await _trialSiteUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true);
+
+ if (findTrialSiteUser == null)
{
await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId });
+
+ }
+ else
+ {
+ findTrialSiteUser.IsDeleted = false;
+ findTrialSiteUser.DeletedTime = null;
}
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
+
await _trialSiteUserSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == userInfo.Id, u => new TrialSiteUserSurvey() { IsJoin = true });
-
- await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl);
-
}
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now });
+
await _userRepository.SaveChangesAsync();
return ResponseOutput.Ok();
@@ -903,11 +900,118 @@ namespace IRaCIS.Core.Application.Contracts
}
+ private async Task DealSiteUserQuitSiteAsync(Guid trialId, Guid siteId, List list)
+ {
+
+ var userIdList = list.Select(t => t.SystemUserId).ToList();
+
+
+ await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.SiteId == siteId && userIdList.Contains(t.UserId), c => new TrialSiteUser()
+ {
+ IsDeleted = true,
+ DeletedTime = DateTime.Now,
+ });
+
+
+ await _repository.SaveChangesAsync();
+ }
+ public async Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, string baseUrl, string routeUrl, List list)
+ {
+ var trialType = _repository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault();
+
+ //判断是否有系统账号
+ foreach (var item in list)
+ {
+ //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户
+ var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync();
+
+ if (sysUserInfo == null)
+ {
+
+ var @lock = _distributedLockProvider.CreateLock($"UserCode");
+
+ using (await @lock.AcquireAsync())
+ {
+ var saveItem = _mapper.Map(item);
+
+
+ if (trialType == TrialType.NoneOfficial)
+ {
+ saveItem.IsTestUser = true;
+ }
+
+ // 中心调研生成账号 都是外部的
+ saveItem.IsZhiZhun = false;
+ saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1;
+
+ saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User));
+
+ saveItem.UserName = saveItem.UserCode;
+
+ var newUser = _userRepository.AddAsync(saveItem).Result;
+
+ _ = _userRepository.SaveChangesAsync().Result;
+
+ sysUserInfo = newUser;
+
+ }
+
+ item.IsGeneratedAccount = true;
+
+ }
+
+ var userId = sysUserInfo.Id;
+ var siteId = item.SiteId;
+
+ //判断是否加入到项目
+ var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true);
+ if (findTrialUser == null)
+ {
+ await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
+
+ await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl);
+
+ }
+ else if (findTrialUser.IsDeleted == true)
+ {
+ await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser()
+ {
+ IsDeleted = false,
+ DeletedTime = null,
+ JoinTime = DateTime.Now,
+ });
+
+ await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl);
+ }
+
+
+ var findTrialSiteUser = await _trialSiteUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true);
+
+ if (findTrialSiteUser == null)
+ {
+ await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId });
+
+ }
+ else
+ {
+ findTrialSiteUser.IsDeleted = false;
+ findTrialSiteUser.DeletedTime = null;
+ }
+
+ await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
+
+ await _trialSiteUserRepository.SaveChangesAsync();
+
+ }
+
+
+
+ }
}
diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs
index 72d104b1b..472be8d48 100644
--- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs
+++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs
@@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Infrastructure;
+using IRaCIS.Application.Contracts;
namespace IRaCIS.Core.Application.Contracts
{
@@ -17,57 +18,43 @@ namespace IRaCIS.Core.Application.Contracts
public class TrialSiteUserSurveyService : BaseService, ITrialSiteUserSurveyService
{
private readonly IRepository _trialSiteUserSurveyRepository;
+ private readonly IRepository _trialSiteSurveyRepository;
- public TrialSiteUserSurveyService(IRepository trialSiteUserSurveyRepository)
+ public TrialSiteUserSurveyService(IRepository trialSiteUserSurveyRepository, IRepository trialSiteSurveyRepository)
{
_trialSiteUserSurveyRepository = trialSiteUserSurveyRepository;
+ _trialSiteSurveyRepository = trialSiteSurveyRepository;
}
- [HttpGet("{trialSiteSurveyId:guid}")]
- public async Task> GetTrialSiteUserSurveyList(Guid trialSiteSurveyId)
+ [HttpPost]
+ public async Task> GetTrialSiteUserSurveyList(TrialSiteUserSurverQuery inquery)
{
- var trialSiteUserSurveyQueryable = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId)
- //.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, t => t.TrialSiteSurvey.State >= TrialSiteSurveyEnum.CRCSubmitted)
- //.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM, t => t.TrialSiteSurvey.State >= TrialSiteSurveyEnum.SPMApproved)
+ var trialSiteUserSurveyQueryable = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == inquery.TrialSiteSurveyId)
+ .WhereIf(inquery.IsHistoryUser != null, t => t.IsHistoryUser == inquery.IsHistoryUser)
.ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us });
return await trialSiteUserSurveyQueryable.ToListAsync();
}
- [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
+
+ [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[HttpPost("{trialId:guid}")]
public async Task AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey)
{
-
- if (await _trialSiteUserSurveyRepository.Where(t => t.Id == addOrEditTrialSiteUserSurvey.Id).AnyAsync(t => t.TrialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock))
+
+
+
+ if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId && (t.IsDeleted == true || t.State == TrialSiteSurveyEnum.PMCreatedAndLock), true))
{
- //---已锁定,不允许操作
- return ResponseOutput.NotOk(_localizer["TrialSiteUser_Locked"]);
- }
-
- if (addOrEditTrialSiteUserSurvey.UserTypeId != null && ( _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM))
- {
- var existSysUser = await _repository.FirstOrDefaultAsync(t => t.EMail == addOrEditTrialSiteUserSurvey.Email && t.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId);
-
-
- if (existSysUser != null)
- {
- if (existSysUser.LastName != addOrEditTrialSiteUserSurvey.LastName || existSysUser.FirstName != addOrEditTrialSiteUserSurvey.FirstName)
- {
- //$"该用户在系统中账户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} ,与填写信息存在不一致项, 现将界面信息修改为与系统一致,可进行保存"
- return ResponseOutput.NotOk(_localizer["TrialSiteUser_InconsistentInfo", existSysUser.LastName + " / " + existSysUser.FirstName,existSysUser.Phone],
- new { existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone,existSysUser.IsTestUser,existSysUser.IsZhiZhun }, ApiResponseCodeEnum.NeedTips);
- }
-
- }
-
+ //当前调研表已废除,或者调研表状态已锁定,不允许操作
+ return ResponseOutput.NotOk(_localizer["TrialSiteUserSurvey_Invalid"]);
}
- if (addOrEditTrialSiteUserSurvey.IsGenerateAccount )
+ if (addOrEditTrialSiteUserSurvey.IsGenerateAccount)
{
- var trialId= _trialSiteUserSurveyRepository.Where(t=>t.TrialSiteSurveyId == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId).Select(t=>t.TrialSiteSurvey.TrialId).FirstOrDefault();
+ var trialId = _trialSiteSurveyRepository.Where(t => t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId, false, true).Select(t => t.TrialId).FirstOrDefault();
var trialType = _repository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault();
@@ -84,7 +71,7 @@ namespace IRaCIS.Core.Application.Contracts
if (sysUserInfo.IsTestUser)
{
- //---正式类型 、培训类型的项目 不允许加入测试用户
+ //---正式类型 、培训类型的项目 不允许加入测试用户
throw new BusinessValidationFailedException(_localizer["TrialSiteUser_NoTestUserForFormal"]);
}
@@ -95,26 +82,59 @@ namespace IRaCIS.Core.Application.Contracts
if (sysUserInfo.IsTestUser == false)
{
- //---测试项目 不允许加入正式用户
+ //---测试项目 不允许加入正式用户
throw new BusinessValidationFailedException(_localizer["TrialSiteUser_NoFormalUserForTest"]);
}
}
}
-
+
}
- var entity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true);
+ var verifyExp1 = new EntityVerifyExp()
+ {
+ VerifyExp = u => u.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId && u.Email == addOrEditTrialSiteUserSurvey.Email && u.TrialSiteSurveyId == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId,
+ VerifyMsg = "同一邮箱同一用户类型,生成账号的数据只允许存在一条!",
+ IsVerify = addOrEditTrialSiteUserSurvey.IsGenerateAccount
+
+ };
+
+ if (addOrEditTrialSiteUserSurvey.UserTypeId != null)
+ {
+ var existSysUser = await _repository.Where(t => t.EMail == addOrEditTrialSiteUserSurvey.Email && t.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId).Include(d => d.UserTypeRole).FirstOrDefaultAsync();
+
+
+ if (existSysUser != null)
+ {
+ if (existSysUser.LastName != addOrEditTrialSiteUserSurvey.LastName || existSysUser.FirstName != addOrEditTrialSiteUserSurvey.FirstName)
+ {
+
+
+ var optEntity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true, verifyExp1);
+
+ //$"该用户在系统中账户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} ,与填写信息存在不一致项, 现将界面信息修改为与系统一致,可进行保存"
+ return ResponseOutput.NotOk(_localizer["TrialSiteUser_InconsistentInfo", existSysUser.UserTypeRole.UserTypeShortName, existSysUser.EMail, existSysUser.LastName + " / " + existSysUser.FirstName, existSysUser.Phone],
+ new { Id = optEntity.Id, existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone, existSysUser.IsTestUser, existSysUser.IsZhiZhun }, ApiResponseCodeEnum.NeedTips);
+ }
+
+ }
+ }
+
+
+ var entity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true, verifyExp1);
+
+
+
return ResponseOutput.Ok(entity.Id.ToString());
}
- [TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
+ [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[HttpDelete("{trialSiteUserSurveyId:guid}/{trialId:guid}")]
public async Task DeleteTrialSiteUserSurvey(Guid trialSiteUserSurveyId)
- {
+ {
if (await _trialSiteUserSurveyRepository.Where(t => t.Id == trialSiteUserSurveyId).AnyAsync(t => t.TrialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock))
{
diff --git a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs
index 69563657c..b82f4f698 100644
--- a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs
+++ b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs
@@ -28,11 +28,11 @@ namespace IRaCIS.Core.Domain.Models
public Guid? UserTypeId { get; set; }
- public Guid TrialRoleNameId { get; set; }
-
- public Dictionary TrialRoleName { get; set; }
+ //public Guid TrialRoleNameId { get; set; }
+ //public Dictionary TrialRoleName { get; set; }
+ public int? TrialRoleCode { get; set; }
///
@@ -59,7 +59,6 @@ namespace IRaCIS.Core.Domain.Models
[Required]
public Guid UpdateUserId { get; set; }
- public string UserName { get; set; } = string.Empty;
///
/// Phone
@@ -85,13 +84,6 @@ namespace IRaCIS.Core.Domain.Models
public Guid? SystemUserId { get; set; }
- public DateTime? ExpireTime { get; set; }
-
- public bool IsJoin { get; set; }
-
- public DateTime? ConfirmTime { get; set; }
-
- public string RejectReason { get; set; } = string.Empty;
///
/// IsGenerateAccount
@@ -104,7 +96,16 @@ namespace IRaCIS.Core.Domain.Models
public TrialSiteUserStateEnum InviteState { get; set; } = TrialSiteUserStateEnum.WaitSent;
-
+ public bool IsJoin { get; set; }
+
+
+ public bool IsHistoryUser { get; set; }
+
+ public bool? IsHistoryUserDeleted { get; set; }
+
+ public bool? IsHistoryUserOriginDeleted { get; set; }
+
+
}
From 4e5b96b8eac7ab444b35681211c2f09dbb8af653 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Thu, 26 Oct 2023 10:03:10 +0800
Subject: [PATCH 2/3] xx
---
IRaCIS.Core.API/IRaCIS.Core.API.xml | 9 +++++
.../IRaCIS.Core.Application.xml | 37 ++++++++++++++++++-
.../Service/Visit/SubjectVisitService.cs | 3 +-
3 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml
index 5e57621b6..5198124a0 100644
--- a/IRaCIS.Core.API/IRaCIS.Core.API.xml
+++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml
@@ -300,6 +300,15 @@
+
+
+ new 医生详情 下载指定简历
+
+
+
+
+
+
下载多个医生的所有附件
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index c0fc753c7..4650ad18a 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -4813,6 +4813,11 @@
Path
+
+
+ 分组分类
+
+
问题分类
@@ -6598,6 +6603,11 @@
问题分类
+
+
+ 分组分类
+
+
单位
@@ -6676,6 +6686,11 @@
问题分类
+
+
+ 分组分类
+
+
数据来源
@@ -7024,6 +7039,11 @@
问题分类
+
+
+ 分组分类
+
+
单位
@@ -7084,6 +7104,11 @@
问题分类
+
+
+ 分组分类
+
+
备注
@@ -7439,6 +7464,11 @@
问题分类
+
+
+ 分组分类
+
+
限制编辑
@@ -7769,6 +7799,11 @@
问题分类
+
+
+ 分组分类
+
+
数据来源
@@ -13183,7 +13218,7 @@
-
+
获取阅片外层问题
diff --git a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs
index 2c7f9e564..695454728 100644
--- a/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs
+++ b/IRaCIS.Core.Application/Service/Visit/SubjectVisitService.cs
@@ -267,8 +267,7 @@ namespace IRaCIS.Core.Application.Services
foreach (var t in studyList)
{
t.SeriesList = await _repository.Where(s => s.StudyId == t.StudyId)
- .WhereIf(isReading == 1, s => s.IsReading).OrderBy(s => s.SeriesNumber).
- ThenBy(s => s.SeriesTime)
+ .WhereIf(isReading == 1, s => s.IsReading).OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime)
.ProjectTo(_mapper.ConfigurationProvider).ToListAsync();
From 1d12d8e2ff8abdc2b820f3043e0ba4bbfd9c8c05 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Thu, 26 Oct 2023 10:10:16 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs
index 3dca2c49c..86e510f07 100644
--- a/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs
+++ b/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs
@@ -12,8 +12,11 @@ namespace IRaCIS.Core.Application.Service
{
public ImageAndDocConfig()
{
- CreateMap();
- CreateMap();
+ CreateMap()
+ .ForMember(d => d.SeriesList, u => u.Ignore());
+ CreateMap()
+ .ForMember(d => d.DicomInstanceList, u => u.Ignore());
+
CreateMap();
CreateMap();