From 228254db097abee7e38976ab8cb4eba8749e75dc Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 7 Aug 2023 11:47:33 +0800 Subject: [PATCH 01/43] =?UTF-8?q?=E8=B0=83=E7=A0=94=E8=A1=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/TrialSiteSurveyService.cs | 588 ++++++------------ .../SiteSurvey/TrialSiteUserSurveyService.cs | 11 +- .../SiteSurvey/TrialSiteUserSurvey.cs | 19 +- 3 files changed, 219 insertions(+), 399 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index afdf8c648..3e3cea717 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -15,6 +15,7 @@ using MailKit.Security; using MimeKit; using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Filter; +using IRaCIS.Core.Infrastructure.Extention; namespace IRaCIS.Core.Application.Contracts { @@ -107,7 +108,7 @@ namespace IRaCIS.Core.Application.Contracts } /// - /// 发送验证码 + ///site 调研 发送验证码 /// /// /// @@ -150,225 +151,187 @@ namespace IRaCIS.Core.Application.Contracts public async Task VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService) { - var isReplaceUser = !string.IsNullOrEmpty(userInfo.ReplaceUserEmailOrPhone); + + #region 历史版本 删除前 + + //var isReplaceUser = !string.IsNullOrEmpty(userInfo.ReplaceUserEmailOrPhone); - 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 && 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 && 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)) + //{ + // //自己的锁了 想更新别人的 + // //---当前中心中,您提交调研记录表已锁定,不允许更新其他人邮箱调研记录。 + // 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)) - { + ////自己的锁定了 如果有其他未锁定的,也不能更新自己的 + //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"]); - } + // //---当前中心,您提交的调研记录表已锁定。当前存在其他人员提交的调研记录表未锁定,不允许更新您之前提交的调研记录。 + // 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"]); - } + //////存在未锁定的记录,却去更新已锁定的 + //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"]); + //} + #endregion - var verificationRecord = await _repository - .FirstOrDefaultAsync(t => (t.EmailOrPhone == userInfo.EmailOrPhone) && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType); + #region 20230804 修改调研表逻辑 + + 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) - { - //---验证码已经过期。 - return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]); - } - else //验证码正确 并且 没有超时 - { - - TrialSiteSurvey? dbEntity = null; - - - //替换交接人 - if (isReplaceUser) - { - //该交接人的记录 是否有未锁定的 有就用未锁定的,没有就用 锁定的最后一条 - - 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); - - //} - - } - else - { - - - 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 _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", - })) - }); - - } + //验证码正确 不处理 } + TrialSiteSurvey? currentEntity = null; + + //普通登录 + if (userInfo.IsUpdate == false) + { + + var dbEntityList = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId).ToListAsync(); + + + //没有记录 new一份 + if (dbEntityList.Count == 0) + { + + currentEntity = await _repository.AddAsync(_mapper.Map(userInfo)); + + } + else + { + + //找到当前最新的调研表 + + var currentLatest = dbEntityList.OrderByDescending(t => t.CreateTime).FirstOrDefault(); + + if (currentLatest.Email != userInfo.EmailOrPhone) + { + //---该中心下已经有其他用户已填写的调研表,您不被允许继续填写 + return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_AlreadyFilledByOtherUsers"]); + } + + currentEntity = currentLatest; + + } + + + + } + //更新调研表 + else + { + //找到最新的调研表 + + var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId,true).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync(); + + if (currentLatest == null) + { + return ResponseOutput.NotOk("当前site没有调研表可以更新,请确认"); + } + + 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.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; t.IsGenerateSuccess = false; }); + + currentEntity = await _repository.AddAsync(copy); + + } + + + //删除验证码历史记录 + await _repository.BatchDeleteAsync(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType); + + await _repository.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 } @@ -487,25 +450,11 @@ namespace IRaCIS.Core.Application.Contracts .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); @@ -556,18 +505,18 @@ namespace IRaCIS.Core.Application.Contracts //---中心调研已锁定,不允许操作。 return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_Locked"]); } - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager ) + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) { - //没有SPM 给填表人发 - messageToSend.To.Add(new MailboxAddress(String.Empty, survey.Email)); + //没有SPM 给填表人发 + messageToSend.To.Add(new MailboxAddress(String.Empty, survey.Email)); - survey.State = TrialSiteSurveyEnum.ToSubmit; + survey.State = TrialSiteSurveyEnum.ToSubmit; - survey.PreliminaryUserId = null; - survey.ReviewerUserId = null; - survey.PreliminaryTime = null; - survey.ReviewerTime = null; + survey.PreliminaryUserId = null; + survey.ReviewerUserId = null; + survey.PreliminaryTime = null; + survey.ReviewerTime = null; } @@ -620,29 +569,8 @@ namespace IRaCIS.Core.Application.Contracts } - /// - /// 驳回 - /// - /// - /// - /// - [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"]); - } - await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit }); - - return ResponseOutput.Ok(); - - } - [HttpPut("{trialId:guid}/{trialSiteSurveyId:guid}")] [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] @@ -696,60 +624,40 @@ namespace IRaCIS.Core.Application.Contracts }).ToListAsync(); - - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined) { - //是第一次 - if (!siteUserList.Any(t => t.IsGenerateSuccess)) - { - var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); + var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); - if (!currentUserList.Any(t => t.Code == "1") || !currentUserList.Any(t => t.Code == "5")) - { - throw new BusinessValidationFailedException("本次提交,必须有CRC和影像阅片人信息"); - } + + if (!currentUserList.Any(t => t.Code == "1") || !currentUserList.Any(t => t.Code == "5")) + { + throw new BusinessValidationFailedException("本次提交,必须有CRC和影像阅片人信息"); } + + if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator) || + !currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.SR)) + { + throw new BusinessValidationFailedException("本次提交,生成账号必须要有CRC和SR"); + } + + await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved }); } else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) { - foreach (var group in (siteUserList.Where(t => t.IsGenerateAccount && t.TrialSiteSurveyId == trialSiteSurveyId) - .GroupBy(t => new { t.Email, t.IsGenerateAccount, t.UserTypeId }))) - { - if (group.Count() > 1) - { - throw new BusinessValidationFailedException("同一邮箱同一用户类型,生成账号的数据只允许存在一条!"); - } - } - - //是第一次 - if (!siteUserList.Any(t => t.IsGenerateSuccess)) - { - 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("本次提交,生成账号必须要有CRC 和SR"); - } - } - //已生成的不管 管的只需要是 生成失败的并且需要生成账号的 - 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 = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsGenerateSuccess != true).ProjectTo(_mapper.ConfigurationProvider).ToList(); await GenerateAccountAsync(needGenerateList, trialId); await SendSiteSurveyUserJoinEmail(new TrialSiteUserSurveyJoinCommand() { TrialId = trialId, TrialSiteSurveyId = trialSiteSurveyId, RouteUrl = siteSurvyeSubmit.RouteUrl, BaseUrl = siteSurvyeSubmit.BaseUrl, UserList = needGenerateList }); + await DealSiteUserQuitSiteAsync(trialId, trialSiteSurvey.SiteId, needGenerateList); } await _trialSiteSurveyRepository.SaveChangesAsync(); @@ -811,18 +719,13 @@ namespace IRaCIS.Core.Application.Contracts 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); @@ -846,17 +749,20 @@ namespace IRaCIS.Core.Application.Contracts if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true)) { 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)) { await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); + + await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } 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); } @@ -869,123 +775,25 @@ namespace IRaCIS.Core.Application.Contracts } - - - - #region 废弃 - //Site 调研邀请 - public async Task SendInviteEmail(InviteEmailCommand inviteEmailCommand) + private async Task DealSiteUserQuitSiteAsync(Guid trialId, Guid siteId, List list) { + //跟踪查询该site下的所有的用户 + var siteUserList = await _repository.Where(t => t.TrialId == trialId && t.SiteId == siteId, true).ToListAsync(); - var trialInfo = await _repository.FirstOrDefaultAsync(t => t.Id == inviteEmailCommand.TrialId); - - - foreach (var item in inviteEmailCommand.UserList) + foreach (var siteUser in siteUserList) { - - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com")); - //收件地址 - messageToSend.To.Add(new MailboxAddress(String.Empty, item.Email)); - //主题 - //$"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 邀请信"; - messageToSend.Subject = _localizer["TrialSiteSurvey_IRCInvitation", trialInfo.ResearchProgramNo]; - - var builder = new BodyBuilder(); - - //找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户 - var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); - - //int verificationCode = new Random().Next(100000, 1000000); - - //var baseApiUrl = baseUrl.Remove(baseUrl.IndexOf("#")) + "api"; - - - if (sysUserInfo == null) + //当前中心用户 不在调研表存在,就将该人退出 + if (!list.Any(t => t.SystemUserId == siteUser.UserId)) { - - lock (lockObj) - { - var saveItem = _mapper.Map(item); - - saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1; - - saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User)); ; - - saveItem.UserName = saveItem.UserCode; - - saveItem.UserTypeEnum = _repository.Where(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First(); - - //saveItem.Password = MD5Helper.Md5(verificationCode.ToString()); - - _ = _repository.AddAsync(saveItem).Result; - - _ = _repository.SaveChangesAsync().Result; - - - sysUserInfo = saveItem; - } - - } - - - - builder.HtmlBody = @$" -
-
-
- {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}: -
-
- {_localizer["TrialSiteSurvey_IRCInvitationContent", trialInfo.ResearchProgramNo]} -
- - - 查看并确认 - -
-
- "; - - - - messageToSend.Body = builder.ToMessageBody(); - - using (var smtp = new MailKit.Net.Smtp.SmtpClient()) - { - - smtp.ServerCertificateValidationCallback = (s, c, h, e) => true; - - smtp.MessageSent += (sender, args) => - { - - _ = _trialSiteUserSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, InviteState = TrialSiteUserStateEnum.HasSend, ConfirmTime = null, RejectReason = String.Empty, SystemUserId = sysUserInfo.Id, ExpireTime = DateTime.Now.AddDays(7) }).Result; - - }; - - - await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls); - - - await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH"); - - - await smtp.SendAsync(messageToSend); - - - await smtp.DisconnectAsync(true); + siteUser.IsDeleted = true; + siteUser.DeletedTime = DateTime.Now; } } - - return ResponseOutput.Ok(); + await _repository.SaveChangesAsync(); } - #endregion - - } } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 78a25359e..248db3de0 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 { @@ -105,7 +106,15 @@ namespace IRaCIS.Core.Application.Contracts } - var entity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true); + var verifyExp1 = new EntityVerifyExp() + { + VerifyExp = u => u.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId && u.Email == addOrEditTrialSiteUserSurvey.Email, + VerifyMsg = "同一邮箱同一用户类型,生成账号的数据只允许存在一条!", + IsVerify=addOrEditTrialSiteUserSurvey.IsGenerateAccount + + }; + + var entity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true, verifyExp1); return ResponseOutput.Ok(entity.Id.ToString()); diff --git a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs index 69563657c..9600b3c91 100644 --- a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs +++ b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs @@ -85,13 +85,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 +97,17 @@ namespace IRaCIS.Core.Domain.Models public TrialSiteUserStateEnum InviteState { get; set; } = TrialSiteUserStateEnum.WaitSent; - + + #region 废弃 + public DateTime? ExpireTime { get; set; } + + public bool IsJoin { get; set; } + + public DateTime? ConfirmTime { get; set; } + + public string RejectReason { get; set; } = string.Empty; + #endregion + } From 56e3bf64f2cdb76fd9fb28dbb3dac77cdac8345b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 7 Aug 2023 12:22:17 +0800 Subject: [PATCH 02/43] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=98=85=E7=89=87?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 18 +--- .../Allocation/Interface/IVisitTaskService.cs | 2 + .../Service/Allocation/VisitTaskService.cs | 91 +++++++++++-------- .../ReadingImageTaskService.cs | 57 ++++++++---- .../TrialSiteUser/TrialMaintenanceService.cs | 2 +- 5 files changed, 99 insertions(+), 71 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 5fd42050b..e666c4b8e 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -9460,11 +9460,11 @@ - - 发送验证码 - - - + + site 调研 发送验证码 + + + @@ -9520,14 +9520,6 @@ - - - 驳回 - - - - - 提交 后台自动识别是谁提交 diff --git a/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskService.cs index c9a5a55bd..7d91e0221 100644 --- a/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/Interface/IVisitTaskService.cs @@ -17,5 +17,7 @@ namespace IRaCIS.Core.Application.Service Task ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService); Task<(int, List)> GetOrderReadingIQueryable(GetOrderReadingIQueryableInDto inDto); + + Task> GetNotOrderReadingQueryableAsync(Guid trialId, Guid trialReadingCriterionId); } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index cd21a404b..9bbeef1b5 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -518,44 +518,17 @@ namespace IRaCIS.Core.Application.Service.Allocation else { - var readingDivisionEnum = critrion.ReadingDivisionEnum; - - var piReadingScopenEnum = critrion.PIReadingScopenEnum; - - var taskQuery = _visitTaskRepository.Where(x => x.TrialId == iRUnReadSubjectQuery.TrialId /*&& x.DoctorUserId == _userInfo.Id*/ && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId) - - .Where(x => (x.IsNeedClinicalDataSign && x.IsClinicalDataSign) || !x.IsNeedClinicalDataSign) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR, t => t.Subject.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) - // 仅仅SR阅片 PI 没有任务列表 - .WhereIf(readingDivisionEnum == ReadingDivisionEnum.OnlySR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI, t => t.TrialId == Guid.Empty) - .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI && piReadingScopenEnum == PIReadingScopenEnum.AllBaseline, - t => t.SourceSubjectVisit.IsBaseLine == true) - //PI 阅片所有 - .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI && piReadingScopenEnum == PIReadingScopenEnum.AllBaselineandVisit, - t => true) + var taskQuery = await GetNotOrderReadingQueryableAsync(iRUnReadSubjectQuery.TrialId, trialReadingCriterionId); - .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI && piReadingScopenEnum == PIReadingScopenEnum.AllVisit, - t => t.SourceSubjectVisit.IsBaseLine == false) - - .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR && piReadingScopenEnum == PIReadingScopenEnum.AllBaseline, - t => t.SourceSubjectVisit.IsBaseLine == false) - - //SR 不阅片 - .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR && piReadingScopenEnum == PIReadingScopenEnum.AllBaselineandVisit, - t => t.TrialId == Guid.Empty) - - .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR && piReadingScopenEnum == PIReadingScopenEnum.AllVisit, - t => t.SourceSubjectVisit.IsBaseLine == true); IRUnReadOutDto iRUnReadOut = new IRUnReadOutDto() { FinishTaskCount = await taskQuery.Where(x => x.ReadingCategory != ReadingCategory.Judge && x.ReadingTaskState == ReadingTaskState.HaveSigned).CountAsync(), SuggesteFinishedTime = await taskQuery.Where(x => x.ReadingTaskState != ReadingTaskState.HaveSigned).MaxAsync(x => x.SuggesteFinishedTime), - UnReadTaskCount = await taskQuery.Where(x => x.ReadingCategory != ReadingCategory.Judge && x.ReadingTaskState != ReadingTaskState.HaveSigned).CountAsync(), }; @@ -586,6 +559,46 @@ namespace IRaCIS.Core.Application.Service.Allocation } + + public async Task> GetNotOrderReadingQueryableAsync(Guid trialId, Guid trialReadingCriterionId) + { + var critrion = await _trialReadingCriterionRepository.FindAsync(trialReadingCriterionId); + + var readingDivisionEnum = critrion.ReadingDivisionEnum; + + var piReadingScopenEnum = critrion.PIReadingScopenEnum; + + var taskQuery = _visitTaskRepository.Where(x => x.TrialId == trialId /*&& x.DoctorUserId == _userInfo.Id*/ && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId) + + .Where(x => (x.IsNeedClinicalDataSign && x.IsClinicalDataSign) || !x.IsNeedClinicalDataSign) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR, t => t.Subject.TrialSite.CRCUserList.Any(u => u.UserId == _userInfo.Id)) + // 仅仅SR阅片 PI 没有任务列表 + .WhereIf(readingDivisionEnum == ReadingDivisionEnum.OnlySR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI, t => t.TrialId == Guid.Empty) + + + .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI && piReadingScopenEnum == PIReadingScopenEnum.AllBaseline, + t => t.SourceSubjectVisit.IsBaseLine == true) + + //PI 阅片所有 + .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI && piReadingScopenEnum == PIReadingScopenEnum.AllBaselineandVisit, + t => true) + + .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI && piReadingScopenEnum == PIReadingScopenEnum.AllVisit, + t => t.SourceSubjectVisit.IsBaseLine == false) + + .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR && piReadingScopenEnum == PIReadingScopenEnum.AllBaseline, + t => t.SourceSubjectVisit.IsBaseLine == false) + + //SR 不阅片 + .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR && piReadingScopenEnum == PIReadingScopenEnum.AllBaselineandVisit, + t => t.TrialId == Guid.Empty) + + .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR && piReadingScopenEnum == PIReadingScopenEnum.AllVisit, + t => t.SourceSubjectVisit.IsBaseLine == true); + + return taskQuery; + } + /// /// 获取有序阅片IQuery对象 /// @@ -609,11 +622,11 @@ namespace IRaCIS.Core.Application.Service.Allocation //PI 读基线的时候,subject 如果PI基线没阅片完,SR就不能看 .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR && piReadingScopenEnum == PIReadingScopenEnum.AllBaseline, - t => t.Subject.SubjectVisitTaskList.Any(c => c.SourceSubjectVisit.IsBaseLine == true && c.ReadingTaskState == ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterionId==trialReadingCriterionId)) + t => t.Subject.SubjectVisitTaskList.Any(c => c.SourceSubjectVisit.IsBaseLine == true && c.ReadingTaskState == ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterionId == trialReadingCriterionId)) //PI 读随访的时候, subject 如果SR基线没阅片完,PI就不能看 .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI && piReadingScopenEnum == PIReadingScopenEnum.AllVisit, - t => t.Subject.SubjectVisitTaskList.Any(c => c.SourceSubjectVisit.IsBaseLine == true && c.ReadingTaskState == ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterionId == trialReadingCriterionId)) + t => t.Subject.SubjectVisitTaskList.Any(c => c.SourceSubjectVisit.IsBaseLine == true && c.ReadingTaskState == ReadingTaskState.HaveSigned && c.TaskState == TaskState.Effect && c.TrialReadingCriterionId == trialReadingCriterionId)) @@ -630,7 +643,7 @@ namespace IRaCIS.Core.Application.Service.Allocation t => true) .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.PI && piReadingScopenEnum == PIReadingScopenEnum.AllVisit, - t => t.SourceSubjectVisit.IsBaseLine == false ) + t => t.SourceSubjectVisit.IsBaseLine == false) .WhereIf(readingDivisionEnum == ReadingDivisionEnum.PIandSR && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SR && piReadingScopenEnum == PIReadingScopenEnum.AllBaseline, t => t.SourceSubjectVisit.IsBaseLine == false) @@ -644,7 +657,7 @@ namespace IRaCIS.Core.Application.Service.Allocation // 前序 不存在 未一致性核查未通过的 并且前序不存在未完成阅片的有效任务 - .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum )) + .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) //.WhereIf(piReadingScopenEnum == PIReadingScopenEnum.AllVisit,t => // !t.Subject.SubjectVisitTaskList.Any(tk => tk.ReadingTaskState != ReadingTaskState.HaveSigned && tk.TaskState == TaskState.Effect && tk.VisitTaskNum < t.VisitTaskNum)) @@ -652,7 +665,7 @@ namespace IRaCIS.Core.Application.Service.Allocation .WhereIf(!string.IsNullOrEmpty(inDto.SubjectCode), t => (t.Subject.Code.Contains(inDto.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inDto.SubjectCode) && t.IsAnalysisCreate)); - var visitGroupQuery = visitQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode, x.SubjectCriterionClaimUserId ,x.SubjectCriterionClaimUser.UserName }); + var visitGroupQuery = visitQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode, x.SubjectCriterionClaimUserId, x.SubjectCriterionClaimUser.UserName }); var visitTaskQuery = visitGroupQuery.Select(x => new IRUnReadSubjectView() { @@ -660,7 +673,7 @@ namespace IRaCIS.Core.Application.Service.Allocation SubjectCode = x.Key.BlindSubjectCode == string.Empty ? x.Key.Code : x.Key.BlindSubjectCode, ClaimUserId = x.Key.SubjectCriterionClaimUserId, - ClaimUserName=x.Key.UserName, + ClaimUserName = x.Key.UserName, SuggesteFinishedTime = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Min(x => x.SuggesteFinishedTime), @@ -857,13 +870,13 @@ namespace IRaCIS.Core.Application.Service.Allocation { // 针对同一个subject 不同阅片人 针对同一个访视申请重阅,是允许的,所以同一阅片人,针对同一suject 有访视申请重阅还未处理,不允许申请重阅 if (await _visitTaskReReadingRepository.AnyAsync(t => t.OriginalReReadingTask.TrialId == task.TrialId && t.OriginalReReadingTask.SubjectId == task.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect - && t.OriginalReReadingTask.TrialReadingCriterionId == task.TrialReadingCriterionId + && t.OriginalReReadingTask.TrialReadingCriterionId == task.TrialReadingCriterionId && t.OriginalReReadingTask.ReadingTaskState == ReadingTaskState.HaveSigned && t.RequestReReadingType == RequestReReadingType.DocotorApply && t.RequestReReadingResultEnum == RequestReReadingResult.Default)) { //---当前为有序阅片,该受试者已有访视已申请重阅还未处理,暂不能继续申请重阅 throw new BusinessValidationFailedException(_localizer["VisitTask_SequentialReading"]); } - + } else { @@ -1101,7 +1114,7 @@ namespace IRaCIS.Core.Application.Service.Allocation await SetMedicalReviewInvalidAsync(influenceTaskList, false); - + } @@ -1486,7 +1499,7 @@ namespace IRaCIS.Core.Application.Service.Allocation if (influenceTask.Id == task.Id) { - + await SetReReadingOrBackInfluenceAnalysisAsync(influenceTask.SubjectId); @@ -1564,7 +1577,7 @@ namespace IRaCIS.Core.Application.Service.Allocation } - + //包括临床数据签名状态 private async Task VisitBackAsync(Guid? subjectVisitId) diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index a7b900325..fc10a4b61 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -178,7 +178,7 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task> GetCustomTag(GetCustomTagInDto inQuery) { - var result= await _readingCustomTagRepository.Where(x => x.VisitTaskId == inQuery.VisitTaskId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + var result = await _readingCustomTagRepository.Where(x => x.VisitTaskId == inQuery.VisitTaskId).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); return result; } @@ -664,7 +664,7 @@ namespace IRaCIS.Application.Services throw new BusinessValidationFailedException(_localizer["ReadingImage_BeSigned"]); } - if(await _visitTaskRepository.AnyAsync(x=> x.Id == visitTaskid && x.DoctorUserId != _userInfo.Id && x.SubjectCriterionClaimUserId != _userInfo.Id)) + if (await _visitTaskRepository.AnyAsync(x => x.Id == visitTaskid && x.DoctorUserId != _userInfo.Id && x.SubjectCriterionClaimUserId != _userInfo.Id)) { throw new BusinessValidationFailedException("当前任务领取人不是你,不允许提交签名"); } @@ -2111,7 +2111,7 @@ namespace IRaCIS.Application.Services [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task SubmitDicomVisitTask(SubmitDicomVisitTaskInDto inDto) { - + await this.SubmitTaskChangeState(inDto.VisitTaskId); return ResponseOutput.Ok(true); } @@ -2209,7 +2209,7 @@ namespace IRaCIS.Application.Services SubjectId = taskInfo.SubjectId, TrialId = taskInfo.TrialId, VisitTaskId = taskInfo.Id, - + }); var isBaseLine = false; @@ -2330,16 +2330,37 @@ namespace IRaCIS.Application.Services if (task != null) { // 有序 自动领取该Subject - await ClaimOrCancelSubjectAsync(new ClaimSubjectDto() { IsClaim = true, SubejctId = task.SubjectId, TrialReadingCriterionId=task.TrialReadingCriterionId, VisitTaskId=task.VisitTaskId, IsInOrder = true }); + await ClaimOrCancelSubjectAsync(new ClaimSubjectDto() { IsClaim = true, SubejctId = task.SubjectId, TrialReadingCriterionId = task.TrialReadingCriterionId, VisitTaskId = task.VisitTaskId, IsInOrder = true }); } } else { - //无序取数据 - task = await _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned /*&& x.DoctorUserId == _userInfo.Id*/ - && x.TrialReadingCriterionId == trialReadingCriterionId - && x.TaskState == TaskState.Effect) - .Where(x => (x.IsNeedClinicalDataSign && x.IsClinicalDataSign) || !x.IsNeedClinicalDataSign) + + #region 这里多了分配,删除之前的逻辑 + ////无序取数据 + //task = await _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned /*&& x.DoctorUserId == _userInfo.Id*/ + //&& x.TrialReadingCriterionId == trialReadingCriterionId + //&& x.TaskState == TaskState.Effect) + // .Where(x => (x.IsNeedClinicalDataSign && x.IsClinicalDataSign) || !x.IsNeedClinicalDataSign) + // .Select(x => new GetReadingTaskDto() + // { + // VisitTaskId = x.Id, + // ArmEnum = x.ArmEnum, + // TaskBlindName = x.TaskBlindName, + // ReadingCategory = x.ReadingCategory, + // VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId, + // VisitNum = x.VisitTaskNum, + // SubjectId = x.SubjectId, + // SubjectCode = x.Subject.Code, + // TrialReadingCriterionId = x.TrialReadingCriterionId, + // }).OrderByDescending(t => t.TaskBlindName).FirstOrDefaultAsync(); + #endregion + + var taskQuery = await _visitTaskService.GetNotOrderReadingQueryableAsync(inDto.TrialId,(Guid) trialReadingCriterionId); + + var list = taskQuery.ToList(); + + task = await taskQuery.OrderByDescending(t => t.TaskBlindName) .Select(x => new GetReadingTaskDto() { VisitTaskId = x.Id, @@ -2351,12 +2372,12 @@ namespace IRaCIS.Application.Services SubjectId = x.SubjectId, SubjectCode = x.Subject.Code, TrialReadingCriterionId = x.TrialReadingCriterionId, - }).OrderByDescending(t => t.TaskBlindName).FirstOrDefaultAsync(); + }).OrderByDescending(t => t.TaskBlindName).FirstOrDefaultAsync(); if (task != null) { // 无序 - await ClaimOrCancelSubjectAsync(new ClaimSubjectDto() { IsClaim = true, VisitTaskId = task.VisitTaskId, IsInOrder = false }); + await ClaimOrCancelSubjectAsync(new ClaimSubjectDto() { IsClaim = true, VisitTaskId = task.VisitTaskId, IsInOrder = false }); } } @@ -2506,14 +2527,14 @@ namespace IRaCIS.Application.Services if (claimSubjectDto.IsClaim) { //每个subject 每个标准的领取放在 任务上 免得加表 - if(_visitTaskRepository.Any(t=>t.Id== claimSubjectDto.SubejctId && t.TrialReadingCriterionId==claimSubjectDto.TrialReadingCriterionId + if (_visitTaskRepository.Any(t => t.Id == claimSubjectDto.SubejctId && t.TrialReadingCriterionId == claimSubjectDto.TrialReadingCriterionId && t.SubjectCriterionClaimUserId != _userInfo.Id && t.SubjectCriterionClaimUserId != null)) { throw new BusinessValidationFailedException("当前任务已被其他人领取,请进行其他的阅片任务"); } else { - await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == claimSubjectDto.SubejctId && t.TrialReadingCriterionId == claimSubjectDto.TrialReadingCriterionId , u => new VisitTask() { SubjectCriterionClaimUserId = _userInfo.Id }); + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == claimSubjectDto.SubejctId && t.TrialReadingCriterionId == claimSubjectDto.TrialReadingCriterionId, u => new VisitTask() { SubjectCriterionClaimUserId = _userInfo.Id }); //列表可以看到当前阅片人是谁 await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.Id == claimSubjectDto.VisitTaskId, u => new VisitTask() { DoctorUserId = _userInfo.Id }); @@ -2524,7 +2545,7 @@ namespace IRaCIS.Application.Services // 创建一个任务 IJobDetail job = JobBuilder.Create() - + .UsingJobData("SubjectId", claimSubjectDto.SubejctId) // 传递GUID参数给任务 .UsingJobData("TrialReadingCriterionId", claimSubjectDto.TrialReadingCriterionId) .UsingJobData("IsInOrder", claimSubjectDto.IsInOrder) @@ -2543,7 +2564,7 @@ namespace IRaCIS.Application.Services } else { - await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == claimSubjectDto.SubejctId && t.TrialReadingCriterionId == claimSubjectDto.TrialReadingCriterionId , u => new VisitTask() { SubjectCriterionClaimUserId = null }); + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => t.SubjectId == claimSubjectDto.SubejctId && t.TrialReadingCriterionId == claimSubjectDto.TrialReadingCriterionId, u => new VisitTask() { SubjectCriterionClaimUserId = null }); } } //无序 直接用DoctorUserId 当做领取人 @@ -2563,7 +2584,7 @@ namespace IRaCIS.Application.Services IJobDetail job = JobBuilder.Create() - .UsingJobData("VisitTaskId",(Guid) claimSubjectDto.VisitTaskId) // 传递GUID参数给任务 + .UsingJobData("VisitTaskId", (Guid)claimSubjectDto.VisitTaskId) // 传递GUID参数给任务 .UsingJobData("IsInOrder", claimSubjectDto.IsInOrder).Build(); // 创建一个触发器,设置任务执行时间为24小时后 @@ -2590,7 +2611,7 @@ namespace IRaCIS.Application.Services await VerifyTaskIsSign(visitTaskId); await _visitTaskRepository.UpdatePartialFromQueryAsync(visitTaskId, x => new VisitTask() { - DoctorUserId=_userInfo.Id, + DoctorUserId = _userInfo.Id, ReadingTaskState = ReadingTaskState.HaveSigned, SignTime = DateTime.Now, }); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs index b7404b4df..cd3ce5564 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialMaintenanceService.cs @@ -97,7 +97,7 @@ namespace IRaCIS.Application.Services // 最开始过滤site已经选择的用户 现在又改回去。。。 var query = _trialUseRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters() - .Where(t => t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.User.UserTypeEnum == UserTypeEnum.CRA) + .Where(t => t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.User.UserTypeEnum == UserTypeEnum.CRA ||t.User.UserTypeEnum==UserTypeEnum.SR) .WhereIf(param.UserTypeId != null, t => t.User.UserTypeId == param.UserTypeId) .WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), t => (t.User.FullName).Contains(param.UserRealName)) .WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName), t => t.User.OrganizationName.Contains(param.OrganizationName)) From 75ccbe9bfb3a4932bbceb3867f54ebf44be43cd7 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 7 Aug 2023 14:06:49 +0800 Subject: [PATCH 03/43] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appsettings.CertificateApply.json | 33 --------------- IRaCIS.Core.API/appsettings.Development.json | 37 ---------------- IRaCIS.Core.API/appsettings.Production.json | 42 ------------------- IRaCIS.Core.API/appsettings.Staging.json | 34 --------------- ...geDev.json => appsettings.Test_Study.json} | 0 IRaCIS.Core.API/appsettings.USDemo.json | 37 ---------------- 6 files changed, 183 deletions(-) delete mode 100644 IRaCIS.Core.API/appsettings.CertificateApply.json delete mode 100644 IRaCIS.Core.API/appsettings.Development.json delete mode 100644 IRaCIS.Core.API/appsettings.Production.json delete mode 100644 IRaCIS.Core.API/appsettings.Staging.json rename IRaCIS.Core.API/{appsettings.CenterImageDev.json => appsettings.Test_Study.json} (100%) delete mode 100644 IRaCIS.Core.API/appsettings.USDemo.json diff --git a/IRaCIS.Core.API/appsettings.CertificateApply.json b/IRaCIS.Core.API/appsettings.CertificateApply.json deleted file mode 100644 index 2c04ce923..000000000 --- a/IRaCIS.Core.API/appsettings.CertificateApply.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "ConnectionStrings": { - "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_Certificate;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true", - "Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Hangfire_IRaCIS;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" - - }, - "BasicSystemConfig": { - - "OpenUserComplexPassword": false, - - "OpenSignDocumentBeforeWork": false, - - "OpenTrialRelationDelete": true, - - "OpenLoginLimit": false - }, - - "SystemEmailSendConfig": { - "Port": 465, - "Host": "smtp.qiye.aliyun.com", - "FromEmail": "test@extimaging.com", - "FromName": "Test_IRC", - "AuthorizationCode": "SHzyyl2021" - } - -} diff --git a/IRaCIS.Core.API/appsettings.Development.json b/IRaCIS.Core.API/appsettings.Development.json deleted file mode 100644 index db4a1fba2..000000000 --- a/IRaCIS.Core.API/appsettings.Development.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "ConnectionStrings": { - "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_New_Tet;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true", - "Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Hangfire_IRaCIS;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" - - }, - "BasicSystemConfig": { - - "OpenUserComplexPassword": false, - - "OpenSignDocumentBeforeWork": false, - - "OpenTrialRelationDelete": true, - - "OpenLoginLimit": false, - - "LoginMaxFailCount": 5, - - "LoginFailLockMinutes":1 - }, - - "SystemEmailSendConfig": { - "Port": 465, - "Host": "smtp.qiye.aliyun.com", - "FromEmail": "test@extimaging.com", - "FromName": "Test_IRC", - "AuthorizationCode": "SHzyyl2021" - } - -} diff --git a/IRaCIS.Core.API/appsettings.Production.json b/IRaCIS.Core.API/appsettings.Production.json deleted file mode 100644 index 91ca65025..000000000 --- a/IRaCIS.Core.API/appsettings.Production.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - //"RootUrl": "http://123.56.181.144:8060/", - "ConnectionStrings": { - "RemoteNew": "Server=101.132.193.237,1433;Database=IRaCIS.Production;User ID=sa;Password=zhanying2021;TrustServerCertificate=true", - "Hangfire": "Server=101.132.193.237,1433;Database=Hangfire.IRaCIS.Production;User ID=sa;Password=zhanying2021;TrustServerCertificate=true" - }, - "BasicSystemConfig": { - - "OpenUserComplexPassword": true, - - "OpenSignDocumentBeforeWork": true, - - "OpenLoginLimit": true, - "LoginMaxFailCount": 5, - - "LoginFailLockMinutes": 30 - }, - //"SystemEmailSendConfig": { - // "Port": 465, - // "Host": "smtp.163.com", - // "FromEmail": "zhou941003@qq.com", - // "FromName": "hangZhou", - // "AuthorizationCode": "sqfhlpfdvnexbcab" - //} - - "SystemEmailSendConfig": { - "Port": 465, - "Host": "smtp.qiye.aliyun.com", - "FromEmail": "IRC@extimaging.com", - "FromName": "IRC", - "AuthorizationCode": "ExtImg@2022" - } - - -} diff --git a/IRaCIS.Core.API/appsettings.Staging.json b/IRaCIS.Core.API/appsettings.Staging.json deleted file mode 100644 index c40e2367e..000000000 --- a/IRaCIS.Core.API/appsettings.Staging.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "ConnectionStrings": { - "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_Verify;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true", - "Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Hangfire_IRaCIS;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" - }, - "BasicSystemConfig": { - - "OpenUserComplexPassword": true, - - "OpenSignDocumentBeforeWork": true, - - "OpenLoginLimit": true, - "LoginMaxFailCount": 5, - - "LoginFailLockMinutes": 30 - - }, - "SystemEmailSendConfig": { - "Port": 465, - "Host": "smtp.qiye.aliyun.com", - "FromEmail": "uat@extimaging.com", - "FromName": "UAT_IRC", - "AuthorizationCode": "SHzyyl2021" - } - - -} diff --git a/IRaCIS.Core.API/appsettings.CenterImageDev.json b/IRaCIS.Core.API/appsettings.Test_Study.json similarity index 100% rename from IRaCIS.Core.API/appsettings.CenterImageDev.json rename to IRaCIS.Core.API/appsettings.Test_Study.json diff --git a/IRaCIS.Core.API/appsettings.USDemo.json b/IRaCIS.Core.API/appsettings.USDemo.json deleted file mode 100644 index 973c6c597..000000000 --- a/IRaCIS.Core.API/appsettings.USDemo.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "ConnectionStrings": { - "RemoteNew": "Server=47.90.161.85,1433\\MSSQLSERVER;Database=IRaCIS_Demo_US;User ID=sa;Password=zhanying2021;TrustServerCertificate=true", - "Hangfire": "Server=47.90.161.85,1433\\MSSQLSERVER;Database=Hangfire.IRaCIS_Demo_US;User ID=sa;Password=zhanying2021;TrustServerCertificate=true" - - }, - "BasicSystemConfig": { - - "OpenUserComplexPassword": false, - - "OpenSignDocumentBeforeWork": false, - - "OpenTrialRelationDelete": true, - - "OpenLoginLimit": false, - - "LoginMaxFailCount": 5, - - "LoginFailLockMinutes": 30 - }, - - "SystemEmailSendConfig": { - "Port": 465, - "Host": "smtp.qiye.aliyun.com", - "FromEmail": "test@extimaging.com", - "FromName": "Test_IRC", - "AuthorizationCode": "SHzyyl2021" - } - -} From 212701fa8c2cee1225ed5813369d5ab536cf59c1 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 7 Aug 2023 13:28:26 +0800 Subject: [PATCH 04/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=98=85=E7=89=87?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 18 +++++++++++++----- .../Reading/Dto/ReadingImageTaskViewModel.cs | 3 ++- .../ReadingImageTaskService.cs | 13 +++++++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index e666c4b8e..5fd42050b 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -9460,11 +9460,11 @@ - - site 调研 发送验证码 - - - + + 发送验证码 + + + @@ -9520,6 +9520,14 @@ + + + 驳回 + + + + + 提交 后台自动识别是谁提交 diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index 60cc90cc6..b01c8e1ef 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -1398,7 +1398,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Guid? SubjectId { get; set; } - public Guid? TrialReadingCriterionId { get; set; } + [NotDefault] + public Guid TrialReadingCriterionId { get; set; } public Guid? VisitTaskId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index fc10a4b61..8ed453112 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2259,11 +2259,12 @@ namespace IRaCIS.Application.Services var trialReadingCriterionId = inDto.TrialReadingCriterionId; + var trialReadingCriterion= await _readingQuestionCriterionTrialRepository.FindAsync(trialReadingCriterionId); - if (trialReadingCriterionId == null && inDto.VisitTaskId == null) - { - throw new BusinessValidationFailedException(_localizer["ReadingImage_IDMust"]); - } + //if (trialReadingCriterionId == null && inDto.VisitTaskId == null) + //{ + // throw new BusinessValidationFailedException(_localizer["ReadingImage_IDMust"]); + //} //看已阅的任务 if (inDto.VisitTaskId != null) @@ -2284,12 +2285,12 @@ namespace IRaCIS.Application.Services trialReadingCriterionId = task.TrialReadingCriterionId; } - else if (inDto.SubjectId != null) + else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder) { var subjectTaskList = (await _visitTaskService.GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto() { TrialId = inDto.TrialId, - TrialReadingCriterionId = trialReadingCriterionId.Value, + TrialReadingCriterionId = trialReadingCriterionId, Page = new PageInput() { PageIndex = 1, From fc800672e16d1abb700a12a76db3db8112e2b9b3 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Mon, 7 Aug 2023 16:44:32 +0800 Subject: [PATCH 05/43] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ReadingCalculate/General/GeneralCalculateService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs index faaf8a8ad..74c1d5777 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs @@ -361,7 +361,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate .Where(x => (x.SubjectId == visitTaskInfo.SubjectId && (x.TaskState == TaskState.Effect||x.TaskState==TaskState.Freeze) && x.IsAnalysisCreate == visitTaskInfo.IsAnalysisCreate - && x.DoctorUserId == visitTaskInfo.DoctorUserId + //&& x.DoctorUserId == visitTaskInfo.DoctorUserId && x.IsSelfAnalysis == visitTaskInfo.IsSelfAnalysis && x.VisitTaskNum <= visitTaskInfo.VisitTaskNum && x.ArmEnum == visitTaskInfo.ArmEnum From d8894e92c03041a011b326e52831425eecb6d3a1 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 7 Aug 2023 17:28:21 +0800 Subject: [PATCH 06/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/EmailTemplate/TrialDoctorExistJoin.html | 2 +- .../wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html | 2 +- .../wwwroot/EmailTemplate/TrialDoctorFirstJoin.html | 2 +- .../wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html | 2 +- .../wwwroot/EmailTemplate/TrialUserExistJoin.html | 2 +- .../wwwroot/EmailTemplate/TrialUserExistJoin_US.html | 2 +- .../wwwroot/EmailTemplate/TrialUserFirstJoin.html | 2 +- .../wwwroot/EmailTemplate/TrialUserFirstJoin_US.html | 2 +- .../wwwroot/EmailTemplate/UserOptCommon_US.html | 2 +- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 9 ++++++--- 10 files changed, 15 insertions(+), 12 deletions(-) diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html index 5e154e16f..8ae645e3b 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html @@ -11,7 +11,7 @@ 尊敬的 {0} ,您好:
- 展影医疗作为 [{1} (试验方案号:{2 })] 项目的IRC供应商,诚邀您参加该项目IRC阅片相关工作。 + 展影医疗作为 [{1} (试验方案号:{2 })] 项目的供应商,诚邀您参加该项目阅片相关工作。
该项目采用电子化工作流,系统及您的账号信息如下: diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html index af5a32a3e..fcea3bd36 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html @@ -11,7 +11,7 @@ Dear {0},
- As the IRC service provider of {1} trial(Protocol ID is {2}), Extensive Imaging invites you to participate in the independent assessment work of this trial. + As the service provider of {1} trial(Protocol ID is {2}), Extensive Imaging invites you to participate in the independent assessment work of this trial.
Digital workflow is implemented for this trial, and your account information is as follows: diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html index cb7f00034..9f7422603 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html @@ -11,7 +11,7 @@ 尊敬的 {0} ,您好:
- 展影医疗作为 [{1} (试验方案号:{2 })] 项目的IRC供应商,诚邀您参加该项目IRC阅片相关工作,欢迎您提供指导和建议,非常感谢! + 展影医疗作为 [{1} (试验方案号:{2 })] 项目的供应商,诚邀您参加该项目阅片相关工作,欢迎您提供指导和建议,非常感谢!
该项目采用电子化工作流,系统及您的账号信息如下: diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html index 83d919950..8e5d37d94 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html @@ -11,7 +11,7 @@ Dear {0},
- As the IRC service provider of {1}trial (Protocol ID is {2}), Extensive Imaging invites you to participate in the independent assessment work of this trial. + As the service provider of {1}trial (Protocol ID is {2}), Extensive Imaging invites you to participate in the independent assessment work of this trial.
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html index 260ad6bba..5020ee521 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html @@ -11,7 +11,7 @@ 尊敬的 {0} ,您好:
- 展影医疗作为 [{1} (试验方案号:{2 })] 项目的IRC供应商,诚邀您参加该项目IRC相关工作,欢迎您提供指导和建议,非常感谢! + 展影医疗作为 [{1} (试验方案号:{2 })] 项目的供应商,诚邀您参加该项目相关工作,欢迎您提供指导和建议,非常感谢!
该项目采用电子化工作流,系统及您的账号信息如下: diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html index 5e33fc801..6be54f794 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html @@ -11,7 +11,7 @@ Dear {0},
- As the IRC service provider of {1} trial (Protocol ID is {2}), Extensive Imaging invites you to participate in IRC-related work of this trial. + As the service provider of {1} trial (Protocol ID is {2}), Extensive Imaging invites you to participate in related work of this trial.
Digital workflow is implemented for this trial, and your account information is as follows: diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html index 48019299e..958d8fe83 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html @@ -11,7 +11,7 @@ 尊敬的 {0} ,您好:
- 展影医疗作为 [{1} (试验方案号:{2 })] 项目的IRC供应商,诚邀您参加该项目IRC相关工作。 + 展影医疗作为 [{1} (试验方案号:{2 })] 项目的供应商,诚邀您参加该项目相关工作。
该项目采用电子化工作流,系统及您的账号信息如下: diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html index e402530d6..f0de7c29f 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html @@ -11,7 +11,7 @@ Dear {0},
- As the IRC service provider of {1} trial (Protocol ID is {2}), Extensive Imaging invites you to participate in IRC-related work of this trial. + As the service provider of {1} trial (Protocol ID is {2}), Extensive Imaging invites you to participate in related work of this trial.
Digital workflow is implemented for this trial, and your account information is as follows: diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html index e828eb2ea..94ee774f1 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html @@ -11,7 +11,7 @@ Dear Sir or Madam:
- Thank you for using our IRC imaging system. + Thank you for using our imaging system.
{0}, the verification code is {1}. Please enter this code within 3 minutes for follow-up operations. diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 3e3cea717..9a9dbab04 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -263,21 +263,21 @@ namespace IRaCIS.Core.Application.Contracts { //找到最新的调研表 - var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId,true).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync(); + var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, true).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync(); if (currentLatest == null) { return ResponseOutput.NotOk("当前site没有调研表可以更新,请确认"); } - if(currentLatest.Email != userInfo.ReplaceUserEmailOrPhone) + if (currentLatest.Email != userInfo.ReplaceUserEmailOrPhone) { //---该中心不存在该交接人的中心调研记录表,不允许选择更新。 return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoRecordToUpdate"]); } //未锁定的状态 就改为废除 - if(currentLatest.State!= TrialSiteSurveyEnum.PMCreatedAndLock) + if (currentLatest.State != TrialSiteSurveyEnum.PMCreatedAndLock) { currentLatest.IsDeleted = true; } @@ -659,6 +659,9 @@ namespace IRaCIS.Core.Application.Contracts await DealSiteUserQuitSiteAsync(trialId, trialSiteSurvey.SiteId, needGenerateList); + //将历史锁定的调研表废弃 + await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock, z => new TrialSiteSurvey() { IsDeleted = true }); + } await _trialSiteSurveyRepository.SaveChangesAsync(); return ResponseOutput.Ok(); From eb58745f1911241841101016fd732ee47eadcf2b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 8 Aug 2023 09:27:09 +0800 Subject: [PATCH 07/43] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Uat=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/IRC系统更新日志.docx | Bin 18441 -> 0 bytes IRaCIS.Core.API/IRaCIS.Core.API.csproj | 5 +++ .../Properties/launchSettings.json | 2 +- IRaCIS.Core.API/appsettings.Uat_Study.json | 36 ++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) delete mode 100644 IRaCIS.Core.API/IRC系统更新日志.docx create mode 100644 IRaCIS.Core.API/appsettings.Uat_Study.json diff --git a/IRaCIS.Core.API/IRC系统更新日志.docx b/IRaCIS.Core.API/IRC系统更新日志.docx deleted file mode 100644 index 467c074a1e7709eb03de8e22214976827220fcea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18441 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 J9y^0H0RRi!yVd{z diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index 4b04686c8..171f527da 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -97,6 +97,11 @@ + + PreserveNewest + true + PreserveNewest + Always diff --git a/IRaCIS.Core.API/Properties/launchSettings.json b/IRaCIS.Core.API/Properties/launchSettings.json index 3f1f494d5..dbb6e2d78 100644 --- a/IRaCIS.Core.API/Properties/launchSettings.json +++ b/IRaCIS.Core.API/Properties/launchSettings.json @@ -58,7 +58,7 @@ "commandName": "Project", "launchBrowser": true, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "CenterImageDev" + "ASPNETCORE_ENVIRONMENT": "Test_Study" }, "applicationUrl": "http://localhost:6100" } diff --git a/IRaCIS.Core.API/appsettings.Uat_Study.json b/IRaCIS.Core.API/appsettings.Uat_Study.json new file mode 100644 index 000000000..2f3ac31ff --- /dev/null +++ b/IRaCIS.Core.API/appsettings.Uat_Study.json @@ -0,0 +1,36 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "ConnectionStrings": { + "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" + }, + "BasicSystemConfig": { + + "OpenUserComplexPassword": false, + + "OpenSignDocumentBeforeWork": false, + + "OpenTrialRelationDelete": true, + + "OpenLoginLimit": false, + "LoginMaxFailCount": 5, + + "LoginFailLockMinutes": 30 + + + }, + + "SystemEmailSendConfig": { + "Port": 465, + "Host": "smtp.qiye.aliyun.com", + "FromEmail": "test@extimaging.com", + "FromName": "Test_IRC", + "AuthorizationCode": "SHzyyl2021" + } + +} From 106cbfaccedda576b467555612d386182ba1479a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 8 Aug 2023 11:35:44 +0800 Subject: [PATCH 08/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=8F=AF=E4=BC=A0=E4=B8=8E=E5=90=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/Dto/ReadingImageTaskViewModel.cs | 3 +-- .../ReadingImageTaskService.cs | 27 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index b01c8e1ef..60cc90cc6 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -1398,8 +1398,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Guid? SubjectId { get; set; } - [NotDefault] - public Guid TrialReadingCriterionId { get; set; } + public Guid? TrialReadingCriterionId { get; set; } public Guid? VisitTaskId { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs index 8ed453112..69fafccdb 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingImageTaskService.cs @@ -2259,12 +2259,19 @@ namespace IRaCIS.Application.Services var trialReadingCriterionId = inDto.TrialReadingCriterionId; - var trialReadingCriterion= await _readingQuestionCriterionTrialRepository.FindAsync(trialReadingCriterionId); - //if (trialReadingCriterionId == null && inDto.VisitTaskId == null) - //{ - // throw new BusinessValidationFailedException(_localizer["ReadingImage_IDMust"]); - //} + if (trialReadingCriterionId == null && inDto.VisitTaskId == null) + { + throw new BusinessValidationFailedException(_localizer["ReadingImage_IDMust"]); + } + + if (inDto.VisitTaskId != null) + { + trialReadingCriterionId = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(t => t.TrialReadingCriterionId).FirstOrDefaultAsync(); + } + + var trialReadingCriterion = await _readingQuestionCriterionTrialRepository.FindAsync(trialReadingCriterionId ?? Guid.Empty); + //看已阅的任务 if (inDto.VisitTaskId != null) @@ -2282,15 +2289,13 @@ namespace IRaCIS.Application.Services }).FirstOrDefaultAsync(); - trialReadingCriterionId = task.TrialReadingCriterionId; - } else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder) { var subjectTaskList = (await _visitTaskService.GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto() { TrialId = inDto.TrialId, - TrialReadingCriterionId = trialReadingCriterionId, + TrialReadingCriterionId = trialReadingCriterionId.Value, Page = new PageInput() { PageIndex = 1, @@ -2357,11 +2362,11 @@ namespace IRaCIS.Application.Services // }).OrderByDescending(t => t.TaskBlindName).FirstOrDefaultAsync(); #endregion - var taskQuery = await _visitTaskService.GetNotOrderReadingQueryableAsync(inDto.TrialId,(Guid) trialReadingCriterionId); + var taskQuery = await _visitTaskService.GetNotOrderReadingQueryableAsync(inDto.TrialId, (Guid)trialReadingCriterionId); var list = taskQuery.ToList(); - task = await taskQuery.OrderByDescending(t => t.TaskBlindName) + task = await taskQuery.OrderByDescending(t => t.TaskBlindName) .Select(x => new GetReadingTaskDto() { VisitTaskId = x.Id, @@ -2373,7 +2378,7 @@ namespace IRaCIS.Application.Services SubjectId = x.SubjectId, SubjectCode = x.Subject.Code, TrialReadingCriterionId = x.TrialReadingCriterionId, - }).OrderByDescending(t => t.TaskBlindName).FirstOrDefaultAsync(); + }).OrderByDescending(t => t.TaskBlindName).FirstOrDefaultAsync(); if (task != null) { From 7e518bf3ab25518c7cc065ac5c1f3d05956055a3 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 8 Aug 2023 14:53:07 +0800 Subject: [PATCH 09/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 18 +++++------------- .../Service/Common/ExcelExportService.cs | 1 - .../SiteSurvey/DTO/TrialSiteSurveyViewModel.cs | 1 - .../DTO/TrialSiteUserSurveyViewModel.cs | 4 +--- .../SiteSurvey/TrialSiteSurveyService.cs | 10 +++++----- .../SiteSurvey/TrialSiteUserSurveyService.cs | 1 - .../Service/SiteSurvey/_MapConfig.cs | 3 --- .../Service/TrialSiteUser/_MapConfig.cs | 1 - IRaCIS.Core.Domain/SQLFile/20220808.sql | 2 ++ .../SiteSurvey/TrialSiteUserSurvey.cs | 6 +++--- .../_IRaCIS/Output/ApiResponseCodeEnum.cs | 7 ------- 11 files changed, 16 insertions(+), 38 deletions(-) create mode 100644 IRaCIS.Core.Domain/SQLFile/20220808.sql diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 5fd42050b..e666c4b8e 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -9460,11 +9460,11 @@ - - 发送验证码 - - - + + site 调研 发送验证码 + + + @@ -9520,14 +9520,6 @@ - - - 驳回 - - - - - 提交 后台自动识别是谁提交 diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 33cc8d6a6..ab17ac18a 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -155,7 +155,6 @@ namespace IRaCIS.Core.Application.Service.Common .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)) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs index c6cecba91..613550431 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; } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs index f3e868457..949d7f0e7 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs @@ -48,9 +48,7 @@ namespace IRaCIS.Core.Application.Contracts } } - public string TrialRoleName { get; set; } - public string TrialRoleCode { get; set; } public UserTypeEnum? UserTypeEnum { get; set; } @@ -98,7 +96,7 @@ 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; } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 9a9dbab04..da2aa69b1 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -263,7 +263,8 @@ namespace IRaCIS.Core.Application.Contracts { //找到最新的调研表 - var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, true).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync(); + 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) { @@ -304,7 +305,7 @@ namespace IRaCIS.Core.Application.Contracts copy.TrialSiteEquipmentSurveyList.ForEach(t => t.Id = Guid.Empty); copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; }); - currentEntity = await _repository.AddAsync(copy); + currentEntity = await _trialSiteSurveyRepository.AddAsync(copy); } @@ -448,7 +449,6 @@ 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(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName)) .WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName)) @@ -619,7 +619,7 @@ namespace IRaCIS.Core.Application.Contracts t.IsGenerateSuccess, t.UserTypeId, UserTypeEnum = (UserTypeEnum?)t.UserTypeRole.UserTypeEnum, - t.TrialRoleName.Code, + t.TrialRoleCode, t.Email }).ToListAsync(); @@ -629,7 +629,7 @@ namespace IRaCIS.Core.Application.Contracts var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); - if (!currentUserList.Any(t => t.Code == "1") || !currentUserList.Any(t => t.Code == "5")) + if (!currentUserList.Any(t => t.TrialRoleCode == 1) || !currentUserList.Any(t => t.TrialRoleCode == 5)) { throw new BusinessValidationFailedException("本次提交,必须有CRC和影像阅片人信息"); } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 248db3de0..5a375ecee 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -62,7 +62,6 @@ namespace IRaCIS.Core.Application.Contracts } } - } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs index 311a8fda6..51c756067 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs @@ -36,8 +36,6 @@ namespace IRaCIS.Core.Application.AutoMapper var isEn_Us = false; CreateMap() - .ForMember(t => t.TrialRoleName, u => u.MapFrom(d => isEn_Us? d.TrialRoleName.Value:d.TrialRoleName.ValueCN)) - .ForMember(t => t.TrialRoleCode, u => u.MapFrom(d => d.TrialRoleName.Code)) .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum)); @@ -70,7 +68,6 @@ namespace IRaCIS.Core.Application.AutoMapper CreateMap() .ForMember(t=>t.TrialSiteSurvey,u=>u.MapFrom(c=>c.TrialSiteSurvey)) - .ForMember(t => t.TrialRoleName, u => u.MapFrom(d => d.TrialRoleName.Value)) .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum)); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index 00a6a8be6..13bdab22a 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -285,7 +285,6 @@ namespace IRaCIS.Core.Application.Service .ForMember(t => t.TrialSiteUserList, u => u.Ignore()); CreateMap() - .ForMember(t => t.TrialRoleName, u => u.MapFrom(d => d.TrialRoleName.Value)) .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) .ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum)) .ForMember(t => t.TrialSiteCode, u => u.MapFrom(d => d.TrialSiteSurvey.TrialSite.TrialSiteCode)) diff --git a/IRaCIS.Core.Domain/SQLFile/20220808.sql b/IRaCIS.Core.Domain/SQLFile/20220808.sql new file mode 100644 index 000000000..639ad02c0 --- /dev/null +++ b/IRaCIS.Core.Domain/SQLFile/20220808.sql @@ -0,0 +1,2 @@ + +update TrialSiteUserSurvey set TrialRoleCode= (select Code from Dictionary where Id=TrialSiteUserSurvey.TrialRoleNameId) \ No newline at end of file diff --git a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs index 9600b3c91..78ebde226 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; } /// diff --git a/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs b/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs index 0fb88dff2..73b9597ae 100644 --- a/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs +++ b/IRaCIS.Core.Infrastructure/_IRaCIS/Output/ApiResponseCodeEnum.cs @@ -23,17 +23,10 @@ namespace IRaCIS.Core.Infrastructure.Extention //程序异常 相当于之前的 IsSuccess = false ProgramException = 4, - - - //需要提示 ,需要提示 从Result 取数据 ( 0 可以继续处理提交 ,1 不能进行继续处理提交 ,2 刷新列表 ) NeedTips = 5, - - - - //在其他地方登陆,被迫下线 LoginInOtherPlace = -1, From ce3bfaeb5c263e3226e217a8d57404e3c906dbe9 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 9 Aug 2023 17:18:21 +0800 Subject: [PATCH 10/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/appsettings.Test_Study.json | 6 +- IRaCIS.Core.API/appsettings.Uat_Study.json | 6 +- .../DTO/TrialSiteSurveyViewModel.cs | 23 ++++++ .../SiteSurvey/TrialSiteSurveyService.cs | 26 +++++-- .../SiteSurvey/TrialSiteUserSurveyService.cs | 46 +++++++----- .../Service/SiteSurvey/_MapConfig.cs | 3 +- irc_api.drone.yml | 72 +++++++++++++++++++ 7 files changed, 152 insertions(+), 30 deletions(-) create mode 100644 irc_api.drone.yml diff --git a/IRaCIS.Core.API/appsettings.Test_Study.json b/IRaCIS.Core.API/appsettings.Test_Study.json index 8b87a0e23..6022d9a33 100644 --- a/IRaCIS.Core.API/appsettings.Test_Study.json +++ b/IRaCIS.Core.API/appsettings.Test_Study.json @@ -28,9 +28,9 @@ "SystemEmailSendConfig": { "Port": 465, "Host": "smtp.qiye.aliyun.com", - "FromEmail": "test@extimaging.com", - "FromName": "Test_IRC", - "AuthorizationCode": "SHzyyl2021" + "FromEmail": "test-study@extimaging.com", + "FromName": "Test_Study", + "AuthorizationCode": "zhanying123" } } diff --git a/IRaCIS.Core.API/appsettings.Uat_Study.json b/IRaCIS.Core.API/appsettings.Uat_Study.json index 2f3ac31ff..ba0d344bc 100644 --- a/IRaCIS.Core.API/appsettings.Uat_Study.json +++ b/IRaCIS.Core.API/appsettings.Uat_Study.json @@ -28,9 +28,9 @@ "SystemEmailSendConfig": { "Port": 465, "Host": "smtp.qiye.aliyun.com", - "FromEmail": "test@extimaging.com", - "FromName": "Test_IRC", - "AuthorizationCode": "SHzyyl2021" + "FromEmail": "uat-study@extimaging.com", + "FromName": "Uat_Study", + "AuthorizationCode": "zhanying123" } } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs index 613550431..bd658172b 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs @@ -167,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 列表查询参数模型 diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index da2aa69b1..dd8af2f8c 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -16,6 +16,7 @@ using MimeKit; using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Application.Filter; using IRaCIS.Core.Infrastructure.Extention; +using Microsoft.VisualBasic; namespace IRaCIS.Core.Application.Contracts { @@ -293,6 +294,8 @@ namespace IRaCIS.Core.Application.Contracts copy.State = TrialSiteSurveyEnum.ToSubmit; copy.Email = userInfo.EmailOrPhone; + copy.Id = Guid.Empty; + copy.CreateTime = DateAndTime.Now; if (userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone) { @@ -301,19 +304,24 @@ namespace IRaCIS.Core.Application.Contracts } - copy.Id = Guid.Empty; - copy.TrialSiteEquipmentSurveyList.ForEach(t => t.Id = Guid.Empty); - copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; }); + + copy.TrialSiteEquipmentSurveyList = currentLatest.TrialSiteEquipmentSurveyList.Clone(); + copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty;t.CreateTime = DateTime.Now; }); + + copy.TrialSiteUserSurveyList = currentLatest.TrialSiteUserSurveyList.Clone(); + copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; t.CreateTime = DateTime.Now; }); currentEntity = await _trialSiteSurveyRepository.AddAsync(copy); + + } //删除验证码历史记录 await _repository.BatchDeleteAsync(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType); - await _repository.SaveChangesAsync(); + await _trialSiteSurveyRepository.SaveChangesAsync(); return ResponseOutput.Ok(new { @@ -428,6 +436,16 @@ namespace IRaCIS.Core.Application.Contracts 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 diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 5a375ecee..0a98f5078 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -46,24 +46,7 @@ namespace IRaCIS.Core.Application.Contracts //---已锁定,不允许操作 return ResponseOutput.NotOk(_localizer["TrialSiteUser_Locked"]); } - - if (addOrEditTrialSiteUserSurvey.UserTypeId != null && ( _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)) - { - 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) - { - //$"该用户在系统中账户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} ,与填写信息存在不一致项, 现将界面信息修改为与系统一致,可进行保存" - return ResponseOutput.NotOk(_localizer["TrialSiteUser_InconsistentInfo", existSysUser.UserTypeRole.UserTypeShortName, existSysUser.EMail, existSysUser.LastName + " / " + existSysUser.FirstName,existSysUser.Phone], - new { existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone,existSysUser.IsTestUser,existSysUser.IsZhiZhun }, ApiResponseCodeEnum.NeedTips); - } - - } - } - + if (addOrEditTrialSiteUserSurvey.IsGenerateAccount ) { @@ -107,14 +90,39 @@ namespace IRaCIS.Core.Application.Contracts var verifyExp1 = new EntityVerifyExp() { - VerifyExp = u => u.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId && u.Email == addOrEditTrialSiteUserSurvey.Email, + 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()); } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs index 51c756067..974ecbfd3 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs @@ -33,7 +33,8 @@ namespace IRaCIS.Core.Application.AutoMapper .ForMember(d => d.SiteName, u => u.MapFrom(s => s.Site.SiteName)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)); - + CreateMap(); + var isEn_Us = false; CreateMap() .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName)) diff --git a/irc_api.drone.yml b/irc_api.drone.yml new file mode 100644 index 000000000..f90c72887 --- /dev/null +++ b/irc_api.drone.yml @@ -0,0 +1,72 @@ +kind: pipeline +type: docker +name: dotnet-core-app-test-study + +steps: + - name: docker-build + image: docker + pull: if-not-exists + volumes: + - name: dockersock + path: /var/run/docker.sock + - name: cached_nuget_packages + path: /drone/nuget_packages + commands: + - date +%H:%M:%S + - pwd + - docker build -t Test.Study . + - date +%H:%M:%S + + - name: docker-deploy + image: docker + pull: if-not-exists + depends_on: + - docker-build + volumes: + - name: dockersock + path: /var/run/docker.sock + commands: + - date +%H:%M:%S + - docker rm -f test-study-container + - docker run -itd -e TZ=Asia/Shanghai -e ASPNETCORE_ENVIRONMENT=Test_Study --restart=always --name test-study-container -p 8030:80 Test.Study + - date +%H:%M:%S + +volumes: + - name: cached_nuget_packages + host: + path: /mnt/f/docker_publish/nuget_packages + - name: dockersock + host: + path: /var/run/docker.sock + +trigger: + branch: + - Test.Study + +--- + + +kind: pipeline +type: ssh +name: default + +platform: + os: windows + arch: amd64 + +clone: + disable: true #禁用默认克隆 + +server: + host: 123.56.94.154 + user: Administrator + password: WHxckj2019 + +steps: +- name: test + commands: + - Start-Process -FilePath "C:\Users\Administrator\Desktop\win.bat" + +trigger: + branch: + - master \ No newline at end of file From 133120e8c0c147d06d29fae0e0c0b101abe58d30 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 9 Aug 2023 18:05:48 +0800 Subject: [PATCH 11/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index f90c72887..04bc628f6 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -1,6 +1,6 @@ kind: pipeline type: docker -name: dotnet-core-app-test-study +name: irc-netcore-api steps: - name: docker-build @@ -41,14 +41,14 @@ volumes: trigger: branch: - - Test.Study + - master --- kind: pipeline type: ssh -name: default +name: ssh-windows-publish platform: os: windows @@ -65,8 +65,8 @@ server: steps: - name: test commands: - - Start-Process -FilePath "C:\Users\Administrator\Desktop\win.bat" + - Start-Process -FilePath "C:\CICD\Test.Study\netcore_Publish.bat" trigger: branch: - - master \ No newline at end of file + - Test.Study \ No newline at end of file From 08754b9a24f928e6a3f98d95587799b6b8ced986 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 9 Aug 2023 18:15:25 +0800 Subject: [PATCH 12/43] =?UTF-8?q?=E5=B0=9D=E8=AF=95call?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index 04bc628f6..b6a3a310f 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -63,9 +63,9 @@ server: password: WHxckj2019 steps: -- name: test +- name: publish-test-study commands: - - Start-Process -FilePath "C:\CICD\Test.Study\netcore_Publish.bat" + - call "C:\CICD\Test.Study\netcore_Publish.bat" trigger: branch: From a7d41772f70b2d07858666fa9a12120541ea6c4e Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 9 Aug 2023 18:18:40 +0800 Subject: [PATCH 13/43] =?UTF-8?q?ps=20=E7=AD=89=E5=BE=85=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index b6a3a310f..4e449c79d 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -65,7 +65,7 @@ server: steps: - name: publish-test-study commands: - - call "C:\CICD\Test.Study\netcore_Publish.bat" + - Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait trigger: branch: From 0a398bd712e20160ccd5c4207fbc4224102f7e95 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 10:56:39 +0800 Subject: [PATCH 14/43] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Test.IRC=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index 4e449c79d..689c4c2bd 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -48,7 +48,7 @@ trigger: kind: pipeline type: ssh -name: ssh-windows-publish +name: ssh-windows-test-study-publish platform: os: windows @@ -69,4 +69,33 @@ steps: trigger: branch: - - Test.Study \ No newline at end of file + - Test.Study + + +--- + + +kind: pipeline +type: ssh +name: ssh-windows-test-irc-publish + +platform: + os: windows + arch: amd64 + +clone: + disable: true #禁用默认克隆 + +server: + host: 123.56.94.154 + user: Administrator + password: WHxckj2019 + +steps: +- name: publish-test-irc + commands: + - Start-Process "C:\CICD\Test.IRC\netcore_Publish.bat" -Wait + +trigger: + branch: + - Test.IRC \ No newline at end of file From d81fee17ba846ece752d2028f9b5cbe1834af02e Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 11:36:28 +0800 Subject: [PATCH 15/43] =?UTF-8?q?bat=20=E6=89=A7=E8=A1=8C=E4=B8=80?= =?UTF-8?q?=E9=83=A8=E5=88=86=20=E6=B5=8B=E8=AF=95=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index 689c4c2bd..a8284defb 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -65,7 +65,11 @@ server: steps: - name: publish-test-study commands: + #拉取代码 并停止服务 - Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait + - cd C:\CICD\Test.Study\netcore_repo + - dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API + - Start-Service -Name "Test_Study_API" trigger: branch: From bf230924d74fdbca0a1fcd63095446240d190ed4 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 11:52:33 +0800 Subject: [PATCH 16/43] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E5=8F=91=E5=B8=83=E5=B0=9D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- irc_api.drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/irc_api.drone.yml b/irc_api.drone.yml index a8284defb..5a9d7c9e7 100644 --- a/irc_api.drone.yml +++ b/irc_api.drone.yml @@ -68,7 +68,8 @@ steps: #拉取代码 并停止服务 - Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait - cd C:\CICD\Test.Study\netcore_repo - - dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API + - dotnet restore .\IRaCIS.Core.API\IRaCIS.Core.API.csproj --packages C:\Users\Administrator\.nuget\packages + - dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -c Release --no-restore --packages C:\Users\Administrator\.nuget\packages -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API - Start-Service -Name "Test_Study_API" trigger: From 775927c484401e7c38371716e34373e337958377 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 13:54:36 +0800 Subject: [PATCH 17/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20Test.Study?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/appsettings.Test_Study.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.API/appsettings.Test_Study.json b/IRaCIS.Core.API/appsettings.Test_Study.json index 6022d9a33..9e82384b7 100644 --- a/IRaCIS.Core.API/appsettings.Test_Study.json +++ b/IRaCIS.Core.API/appsettings.Test_Study.json @@ -7,7 +7,7 @@ } }, "ConnectionStrings": { - "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=CenterImage_Test;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" + "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" }, "BasicSystemConfig": { From dcdf03ca8e0ec034d98f5d4358403e7576dcee3b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 16:40:01 +0800 Subject: [PATCH 18/43] x --- IRaCIS.Core.API/Test.cs | 99 ----------------------------------------- 1 file changed, 99 deletions(-) delete mode 100644 IRaCIS.Core.API/Test.cs diff --git a/IRaCIS.Core.API/Test.cs b/IRaCIS.Core.API/Test.cs deleted file mode 100644 index f7567c3ca..000000000 --- a/IRaCIS.Core.API/Test.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using Microsoft.EntityFrameworkCore; - -namespace EFSaving.Concurrency -{ - public class Sample - { - public static void Run() - { - // Ensure database is created and has a person in it - using (var setupContext = new PersonContext()) - { - setupContext.Database.EnsureDeleted(); - setupContext.Database.EnsureCreated(); - - setupContext.People.Add(new Person { FirstName = "John", LastName = "Doe" }); - setupContext.SaveChanges(); - } - - #region ConcurrencyHandlingCode - using var context = new PersonContext(); - // Fetch a person from database and change phone number - var person = context.People.Single(p => p.PersonId == 1); - person.PhoneNumber = "555-555-5555"; - - // Change the person's name in the database to simulate a concurrency conflict - context.Database.ExecuteSqlRaw( - "UPDATE dbo.People SET FirstName = 'Jane' WHERE PersonId = 1"); - - var saved = false; - while (!saved) - { - try - { - // Attempt to save changes to the database - context.SaveChanges(); - saved = true; - } - catch (DbUpdateConcurrencyException ex) - { - foreach (var entry in ex.Entries) - { - if (entry.Entity is Person) - { - var proposedValues = entry.CurrentValues; - var databaseValues = entry.GetDatabaseValues(); - - foreach (var property in proposedValues.Properties) - { - var proposedValue = proposedValues[property]; - var databaseValue = databaseValues[property]; - - // TODO: decide which value should be written to database - // proposedValues[property] = ; - } - - // Refresh original values to bypass next concurrency check - entry.OriginalValues.SetValues(databaseValues); - } - else - { - throw new NotSupportedException( - "Don't know how to handle concurrency conflicts for " - + entry.Metadata.Name); - } - } - } - } - #endregion - } - - public class PersonContext : DbContext - { - public DbSet People { get; set; } - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - // Requires NuGet package Microsoft.EntityFrameworkCore.SqlServer - optionsBuilder.UseSqlServer( - @"Server=(localdb)\mssqllocaldb;Database=EFSaving.Concurrency;Trusted_Connection=True"); - } - } - - public class Person - { - public int PersonId { get; set; } - - [ConcurrencyCheck] - public string FirstName { get; set; } - - [ConcurrencyCheck] - public string LastName { get; set; } - - public string PhoneNumber { get; set; } - } - } -} \ No newline at end of file From 5ae02e0d1f28616ae41affe47fa123ddc1f68478 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 16:56:22 +0800 Subject: [PATCH 19/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2trialId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Properties/launchSettings.json | 24 ++++--------------- .../SiteSurvey/TrialSiteUserSurveyService.cs | 6 +++-- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/IRaCIS.Core.API/Properties/launchSettings.json b/IRaCIS.Core.API/Properties/launchSettings.json index dbb6e2d78..a8d648f0a 100644 --- a/IRaCIS.Core.API/Properties/launchSettings.json +++ b/IRaCIS.Core.API/Properties/launchSettings.json @@ -30,31 +30,15 @@ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", "publishAllPorts": true }, - "IRaCIS.Staging": { + "Uat_Study": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Staging" + "ASPNETCORE_ENVIRONMENT": "Uat_Study" }, - "applicationUrl": "http://localhost:6200" + "applicationUrl": "http://localhost:6100" }, - "IRaCIS.Production": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Production" - }, - "applicationUrl": "http://localhost:6300" - }, - "IRaCIS.CertificateApply": { - "commandName": "Project", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "CertificateApply" - }, - "applicationUrl": "http://localhost:6400" - }, - "IRaCIS.CenterImageDev": { + "Test_Study": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 0a98f5078..9d4bce551 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -18,10 +18,12 @@ 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}")] @@ -50,7 +52,7 @@ namespace IRaCIS.Core.Application.Contracts 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).Select(t=>t.TrialId).FirstOrDefault(); var trialType = _repository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault(); From f9274c8fda489cb1852fbcb9e240fca9b11862a4 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 17:21:32 +0800 Subject: [PATCH 20/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=81=E5=AE=9A?= =?UTF-8?q?=E5=BA=9F=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index dd8af2f8c..fb75b1e3b 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -678,7 +678,7 @@ namespace IRaCIS.Core.Application.Contracts await DealSiteUserQuitSiteAsync(trialId, trialSiteSurvey.SiteId, needGenerateList); //将历史锁定的调研表废弃 - await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock, z => new TrialSiteSurvey() { IsDeleted = true }); + 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(); From c77cf1bf1eb93e2268b1280bb23989be433c180d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 10 Aug 2023 17:44:10 +0800 Subject: [PATCH 21/43] =?UTF-8?q?=E5=BA=9F=E9=99=A4=E7=9A=84=E4=B9=9F?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E7=9C=8B=E5=88=B0=E8=B0=83=E7=A0=94=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index fb75b1e3b..2273d8add 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -351,7 +351,7 @@ 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) + var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters() .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); return result; From 33ef76ad9809a4ee780f35cfd52b0ba3a62d53b6 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 14 Aug 2023 17:48:44 +0800 Subject: [PATCH 22/43] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E7=95=8C=E9=9D=A2tab=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8E=E5=90=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/TrialDocumentService.cs | 2 +- .../Service/Management/UserTypeService.cs | 10 +++++++++- .../TrialSiteUser/DTO/TrialConfigDTO.cs | 19 +++++++++++++++++++ .../Service/TrialSiteUser/_MapConfig.cs | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 9defbfcbb..64556463d 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -224,7 +224,7 @@ namespace IRaCIS.Core.Application.Services .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .CountAsync(); - var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); + var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefault(); //var trialCriterionAdditionalAssessmentTypeList = _trialCriterionAdditionalAssessmentTypeRepository diff --git a/IRaCIS.Core.Application/Service/Management/UserTypeService.cs b/IRaCIS.Core.Application/Service/Management/UserTypeService.cs index c6aa10fd2..c6b5a168e 100644 --- a/IRaCIS.Core.Application/Service/Management/UserTypeService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserTypeService.cs @@ -113,7 +113,15 @@ namespace IRaCIS.Core.Application.Contracts if (userTypeSelectEnum == UserTypeSelectEnum.ExternalUser) { - userTypeEnums = new List() { UserTypeEnum.PI, UserTypeEnum.MIM }; + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.TA) + { + userTypeEnums = new List() { UserTypeEnum.ProjectManager }; + } + else + { + userTypeEnums = new List() { UserTypeEnum.PI, UserTypeEnum.MIM }; + } + } if (userTypeSelectEnum == UserTypeSelectEnum.SiteSurvey) diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs index 9da0f6e88..ba9cedd59 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialConfigDTO.cs @@ -214,6 +214,25 @@ namespace IRaCIS.Core.Application.Contracts } + public class TrialConfigTabDto + { + public TrialQCProcess QCProcessEnum { get; set; } = TrialQCProcess.DoubleAudit; + + public bool IsImageConsistencyVerification { get; set; } = true; + + public bool IsMedicalReview { get; set; } + + + public bool IsEnrollementQualificationConfirm { get; set; } = false; + + + public bool IsPDProgressView { get; set; } + + public UserTypeEnum? EnrollConfirmDefaultUserType { get; set; } + + public UserTypeEnum? PDProgressDefaultUserType { get; set; } + } + public class TrialProcessConfigDTO { /// diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index 13bdab22a..27f03fa41 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -22,8 +22,8 @@ namespace IRaCIS.Core.Application.Service CreateMap(); + CreateMap(); - CreateMap () .ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum)) .ForMember(d => d.IsImageConsistencyVerification, u => u.MapFrom(s => s.Trial.IsImageConsistencyVerification)) From c04d3a3fe478b20e128d92b10062b4cbe7359b8c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 14 Aug 2023 18:24:45 +0800 Subject: [PATCH 23/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9PI=20=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 9bbeef1b5..80167909a 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -255,6 +255,8 @@ namespace IRaCIS.Core.Application.Service.Allocation visitTask.LatestReplyUserId = _userInfo.Id; visitTask.LatestReplyTime = DateTime.Now; + visitTask.IsEnrollment = incommand.PIAuditState == PIAuditState.PINotAgree ? null : visitTask.IsEnrollment; + visitTask.IsPDConfirm = incommand.PIAuditState == PIAuditState.PINotAgree ? null : visitTask.IsPDConfirm; if (isFirstAudit) { From 5d2acf44c10b4e340868908cf1f94c0fc9b50f6f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 15 Aug 2023 15:25:18 +0800 Subject: [PATCH 24/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94=20isJoin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Allocation/VisitTaskHelpeService.cs | 2 +- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 10 ++++++---- IRaCIS.Core.Application/TestService.cs | 15 +++++++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs index d5498f96f..548987b2b 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskHelpeService.cs @@ -55,7 +55,7 @@ namespace IRaCIS.Core.Application.Service public VisitTaskHelpeService(IRepository visitTaskRepository, IRepository trialRepository, IEasyCachingProvider provider, IRepository subjectVisitRepository, IRepository readModuleRepository, - IRepository readingTaskQuestionAnswerRepository, + IRepository readingTaskQuestionAnswerRepository, IRepository readingTableAnswerRowInfoRepository, IRepository readingTableQuestionAnswerRepository, IRepository readingTableQuestionTrialRepository, diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 2273d8add..784239717 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -729,17 +729,18 @@ 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(); @@ -784,10 +785,11 @@ namespace IRaCIS.Core.Application.Contracts 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 _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(); diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 54a486acc..a2b12a4da 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -2,6 +2,7 @@ using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infrastructure; +using MassTransit; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; @@ -171,9 +172,19 @@ namespace IRaCIS.Application.Services [AllowAnonymous] - public async Task testwwwww([FromServices] IWebHostEnvironment env) + public async Task> testwwwww([FromServices] IWebHostEnvironment env) { - await Task.CompletedTask; + int count = 200; + + var list=new List(); + + for (int i = 0; i < count; i++) + { + Guid guid = NewId.NextGuid(); + list.Add(guid); + } + + return list; } From 008f5203c0a63a545eef8065fa5d434e4903c5e4 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 15 Aug 2023 16:40:36 +0800 Subject: [PATCH 25/43] =?UTF-8?q?=E5=A4=96=E9=83=A8=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- .../Service/TrialSiteUser/DTO/TrialExternalUserViewModel.cs | 2 +- IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs | 3 ++- IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 784239717..8a6ec6d21 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -669,7 +669,7 @@ namespace IRaCIS.Core.Application.Contracts //已生成的不管 管的只需要是 生成失败的并且需要生成账号的 - var needGenerateList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsGenerateSuccess != true).ProjectTo(_mapper.ConfigurationProvider).ToList(); + var needGenerateList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsJoin != true ).ProjectTo(_mapper.ConfigurationProvider).ToList(); await GenerateAccountAsync(needGenerateList, trialId); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialExternalUserViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialExternalUserViewModel.cs index ca5d4e631..69e0d5b83 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialExternalUserViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialExternalUserViewModel.cs @@ -50,7 +50,7 @@ namespace IRaCIS.Core.Application.ViewModel - + public UserTypeEnum? UserTypeEnum { get; set; } public DateTime? ExpireTime { get; set; } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index 27f03fa41..c8e56eebb 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -206,7 +206,8 @@ namespace IRaCIS.Core.Application.Service CreateMap().ReverseMap(); CreateMap(); - CreateMap(); + CreateMap() + .ForMember(t=>t.UserTypeEnum,u=>u.MapFrom(c=>c.SystemUser.UserTypeEnum)); CreateMap().ReverseMap(); diff --git a/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs b/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs index 297b37279..148c6e53c 100644 --- a/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs +++ b/IRaCIS.Core.Domain/TrialSiteUser/TrialExternalUser.cs @@ -92,7 +92,8 @@ namespace IRaCIS.Core.Domain.Models public Guid SystemUserId { get; set; } - + [JsonIgnore] + public User SystemUser { get; set; } public bool IsJoin { get; set; } From 4bc2c3107a77becf76b3cd31531ceb66d4e26297 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 16 Aug 2023 13:10:51 +0800 Subject: [PATCH 26/43] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=85=8D=E7=BD=AE=E5=A2=9E=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/SystemDocumentService.cs | 25 ++++++++++++++++--- IRaCIS.Core.Domain/Allocation/VisitTask.cs | 4 +-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs index fc4b1efa1..4d3003ad9 100644 --- a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Application.Contracts; using User = IRaCIS.Core.Domain.Models.User; +using DocumentFormat.OpenXml.Office2010.Word; namespace IRaCIS.Core.Application.Services { @@ -19,14 +20,16 @@ namespace IRaCIS.Core.Application.Services private readonly IRepository _systemDocumentRepository; private readonly IRepository _systemDocNeedConfirmedUserTypeRepository; + private readonly IRepository _systemDocConfirmedUserRepository; public SystemDocumentService( IRepository systemDocumentRepository, - IRepository systemDocNeedConfirmedUserTypeRepository - ) + IRepository systemDocNeedConfirmedUserTypeRepository, + IRepository systemDocConfirmedUserRepository) { _systemDocumentRepository = systemDocumentRepository; this._systemDocNeedConfirmedUserTypeRepository = systemDocNeedConfirmedUserTypeRepository; - } + _systemDocConfirmedUserRepository = systemDocConfirmedUserRepository; + } @@ -109,6 +112,22 @@ namespace IRaCIS.Core.Application.Services } + [HttpDelete("{systemDocumentId:guid}")] + public async Task AbandonSystemDocumentAsync(Guid systemDocumentId) + { + + await _systemDocumentRepository.UpdatePartialFromQueryAsync(systemDocumentId, u => new SystemDocument() { IsDeleted = true }); + + await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == systemDocumentId, x => new SystemDocConfirmedUser() + { + IsDeleted = true + }); + + await _systemDocConfirmedUserRepository.SaveChangesAsync(); + return ResponseOutput.Result(true); + } + + [HttpDelete("{systemDocumentId:guid}")] public async Task DeleteSystemDocumentAsync(Guid systemDocumentId) diff --git a/IRaCIS.Core.Domain/Allocation/VisitTask.cs b/IRaCIS.Core.Domain/Allocation/VisitTask.cs index 1135e0088..263ac8f46 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTask.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTask.cs @@ -489,11 +489,11 @@ namespace IRaCIS.Core.Domain.Models /// /// PI不认同 /// - PIAgree = 1, + PINotAgree = 1, /// /// PI认同 /// - PINotAgree = 2 + PIAgree = 2 } } From b9ccf4bb12f91646ca730b099ccc729bd73fca9a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 11:18:01 +0800 Subject: [PATCH 27/43] =?UTF-8?q?=E4=B8=AD=E5=BF=83=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/UploadDownLoadController.cs | 96 +++- .../Helper/FileStoreHelper.cs | 22 + .../IRaCIS.Core.Application.xml | 36 -- .../Service/Common/ExcelExportService.cs | 1 - .../DTO/TrialSiteUserSurveyViewModel.cs | 55 ++ .../Interface/ITrialSiteSurveyService.cs | 2 + .../Interface/ITrialSiteUserSurveyService.cs | 2 +- .../SiteSurvey/TrialSiteSurveyService.cs | 256 ++++++++- .../SiteSurvey/TrialSiteUserSurveyService.cs | 12 +- .../Service/SiteSurvey/_MapConfig.cs | 21 + .../Interface/ITrialExternalUserService.cs | 1 - .../TrialSiteUser/TrialExternalUserService.cs | 530 ------------------ .../SiteSurvey/TrialSiteUserSurvey.cs | 14 +- IRaCIS.Core.Domain/_Config/_StaticData.cs | 2 + 14 files changed, 439 insertions(+), 611 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 9d2cb6003..7e2bd5d35 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -37,6 +37,7 @@ using Microsoft.Net.Http.Headers; using MiniExcelLibs; using Newtonsoft.Json; using SharpCompress.Archives; +using SharpCompress.Common; using System; using System.Collections.Generic; using System.Data; @@ -704,8 +705,8 @@ namespace IRaCIS.Core.API.Controllers { var subjectVisitId = incommand.SubjectVisitId; - var studyMonitorId=incommand.StudyMonitorId; - var noneDicomStudyId=incommand.NoneDicomStudyId; + var studyMonitorId = incommand.StudyMonitorId; + var noneDicomStudyId = incommand.NoneDicomStudyId; await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId); @@ -936,6 +937,97 @@ namespace IRaCIS.Core.API.Controllers return ResponseOutput.Ok(); } + + + [HttpPost] + [UnitOfWork] + public async Task UploadTrialSiteSurveyUser(Guid trialId, + [FromServices] IRepository _trialSiteRepository, + [FromServices] IRepository _usertypeRepository, + [FromServices] ITrialSiteSurveyService _trialSiteSurveyService) + { + var (serverFilePath, relativePath, fileName) = (string.Empty, string.Empty, string.Empty); + await FileUploadAsync(async (realFileName) => + { + fileName = realFileName; + + if (!fileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase)) + { + throw new BusinessValidationFailedException("请用提供格式的模板excel上传需要处理的数据"); + } + + (serverFilePath, relativePath) = FileStoreHelper.GetTrialSiteSurveyFilePath(_hostEnvironment, fileName, trialId); + + return serverFilePath; + }); + + //去掉空白行 + var excelList = MiniExcel.Query(serverFilePath).ToList() + .Where(t => !(string.IsNullOrWhiteSpace(t.TrialSiteCode) && string.IsNullOrWhiteSpace(t.FirstName) && string.IsNullOrWhiteSpace(t.LastName)) && string.IsNullOrWhiteSpace(t.Email) + && string.IsNullOrWhiteSpace(t.Phone) && string.IsNullOrWhiteSpace(t.UserTypeStr) && string.IsNullOrWhiteSpace(t.OrganizationName)); + + if (excelList.Any(t => string.IsNullOrWhiteSpace(t.TrialSiteCode) || string.IsNullOrWhiteSpace(t.FirstName) || string.IsNullOrWhiteSpace(t.LastName) || string.IsNullOrWhiteSpace(t.Email) || string.IsNullOrWhiteSpace(t.UserTypeStr))) + { + throw new BusinessValidationFailedException("请确保Excel中 每一行的 中心编号,姓名,邮箱,用户类型数据记录完整再进行上传"); + } + + var siteCodeList = excelList.Select(t => t.TrialSiteCode.Trim()).Distinct().ToList(); + + if (_trialSiteRepository.Where(t => siteCodeList.Contains(t.TrialSiteCode)).Count() != siteCodeList.Count) + { + throw new BusinessValidationFailedException("在项目中未找到该Excel中部分或全部中心"); + } + + if (excelList.GroupBy(t => new { t.UserTypeStr, t.Email }).Any(g => g.Count() > 1)) + { + throw new BusinessValidationFailedException("同一邮箱,同一用户类型,只能生成一个账户,请核查Excel数据"); + } + + if (excelList.Any(t => t.Email.Contains("@"))) + { + throw new BusinessValidationFailedException("有邮箱不符合邮箱格式,请核查Excel数据"); + } + var generateUserTypeList = new List() { "CRC", "SR", "CRA" }; + + if (excelList.Any(t => !generateUserTypeList.Contains(t.UserTypeStr.ToUpper()))) + { + throw new BusinessValidationFailedException("用户类型仅能为 CRC,SR,CRA 请核查Excel数据"); + } + + //处理好 用户类型 和用户类型枚举 + var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.SR).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList(); + var siteList= _trialSiteRepository.Where(t=>t.TrialId==trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t=>new {t.TrialSiteCode,t.SiteId}).ToList(); + + foreach (var item in excelList) + { + switch (item.UserTypeStr.ToUpper()) + { + case "CRC": + + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).UserTypeId; + item.UserTypeEnum = UserTypeEnum.ClinicalResearchCoordinator; + break; + + case "CRA": + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.CRA).UserTypeId; + item.UserTypeEnum = UserTypeEnum.CRA; + break; + + case "SR": + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.SR).UserTypeId; + item.UserTypeEnum = UserTypeEnum.SR; + break; + + } + + item.SiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).SiteId; + } + + await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, excelList.ToList()); + + return ResponseOutput.Ok(); + + } } diff --git a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs index dbdd13cd4..cd9090ffb 100644 --- a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs +++ b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs @@ -292,6 +292,28 @@ public static class FileStoreHelper return (serverFilePath, relativePath); } + //获取 中心调研用户路径 + + public static (string PhysicalPath, string RelativePath) GetTrialSiteSurveyFilePath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId) + { + var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); + + //上传根路径 + string uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), StaticData.Folder.UploadSiteSurveyData); + + if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); + + + var (trustedFileNameForFileStorage, realFileName) = FileStoreHelper.GetStoreFileName(fileName); + + + var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{StaticData.Folder.UploadSiteSurveyData}/{trustedFileNameForFileStorage}"; + + var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); + + return (serverFilePath, relativePath); + } + public static (string PhysicalPath, string RelativePath, string FileRealName) GetClinicalTemplatePath(IWebHostEnvironment _hostEnvironment, string fileName,Guid trialId) { diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index e666c4b8e..3ec98cf7f 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -7741,42 +7741,6 @@ - - - 勾选用户 批量发送邮件 - - - - - - 不带Token 访问 用户选择 参与 不参与 Id: TrialExternalUserId 加入发送邮件 - - - - - - - 不带Token 访问 Site调研用户 加入项目 Id: TrialSiteSurveyUserId - - - - - - - 不带Token 访问 页面获取项目基本信息 和参与情况 (已经确认了 就不允许再次确认) Id: TrialExternalUserId/TrialSiteSurveyUserId - - - - - - - - 加入项目 - - - - - TaskAllocationRuleView 列表视图模型 diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index ab17ac18a..abdba14f3 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -156,7 +156,6 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId) .WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount) .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); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs index 949d7f0e7..d2959bb4f 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs @@ -5,7 +5,9 @@ //-------------------------------------------------------------------- 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 { @@ -54,6 +56,12 @@ namespace IRaCIS.Core.Application.Contracts public Guid? SystemUserId { get; set; } + + + + public bool? IsHistoryUserOriginDeleted { get; set; } + + } @@ -99,8 +107,17 @@ namespace IRaCIS.Core.Application.Contracts 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 { @@ -109,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; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + public string Phone { get; set; } + public string OrganizationName { get; set; } + + [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/ITrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs index 6bc2fc3ec..61ee8a14e 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs @@ -20,5 +20,7 @@ namespace IRaCIS.Core.Application.Contracts //Task TrialSurveyLock(Guid trialSiteSurveyId, bool isLock); //IResponseOutput TrialSurveySubmmit(Guid trialId, Guid trialSiteSurveyId); Task VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService); + + Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, List list); } } \ No newline at end of file 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/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 8a6ec6d21..ac7241796 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -17,6 +17,9 @@ 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; namespace IRaCIS.Core.Application.Contracts { @@ -31,13 +34,14 @@ namespace IRaCIS.Core.Application.Contracts private readonly IRepository _userRepository; private readonly IRepository _trialSiteRepository; private readonly IRepository _trialUserRepository; + private readonly IRepository _trialSiteUserRepository; private readonly ITokenService _tokenService; private readonly IMailVerificationService _mailVerificationService; public TrialSiteSurveyService(IRepository trialSiteSurveyRepository, IRepository trialUserRepository, IRepository trialSiteUserSurveyRepository, IRepository userRepository, IRepository trialSiteRepository, ITokenService tokenService, - IMailVerificationService mailVerificationService) + IMailVerificationService mailVerificationService, IRepository trialSiteUserRepository) { _trialSiteSurveyRepository = trialSiteSurveyRepository; _trialSiteUserSurveyRepository = trialSiteUserSurveyRepository; @@ -46,6 +50,7 @@ namespace IRaCIS.Core.Application.Contracts _trialSiteRepository = trialSiteRepository; _tokenService = tokenService; _mailVerificationService = mailVerificationService; + _trialSiteUserRepository = trialSiteUserRepository; } private object lockObj { get; set; } = new object(); @@ -225,6 +230,9 @@ namespace IRaCIS.Core.Application.Contracts 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) { @@ -235,8 +243,13 @@ namespace IRaCIS.Core.Application.Contracts //没有记录 new一份 if (dbEntityList.Count == 0) { + var addSurvey = _mapper.Map(userInfo); - currentEntity = await _repository.AddAsync(_mapper.Map(userInfo)); + + //从项目site 中找到已存在的 加到历史人员中 + addSurvey.TrialSiteUserSurveyList = userList; + + currentEntity = await _repository.AddAsync(addSurvey); } else @@ -254,6 +267,16 @@ namespace IRaCIS.Core.Application.Contracts currentEntity = currentLatest; + + if (currentEntity.State != TrialSiteSurveyEnum.PMCreatedAndLock) + { + + + await UnlockSyncSiteUserAsync(userInfo.TrialId, userInfo.SiteId, currentEntity.Id, userList); + + } + + } @@ -306,14 +329,19 @@ namespace IRaCIS.Core.Application.Contracts copy.TrialSiteEquipmentSurveyList = currentLatest.TrialSiteEquipmentSurveyList.Clone(); - copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty;t.CreateTime = DateTime.Now; }); + copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty; t.CreateTime = DateTime.Now; }); - copy.TrialSiteUserSurveyList = currentLatest.TrialSiteUserSurveyList.Clone(); + 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); - + } @@ -343,6 +371,29 @@ namespace IRaCIS.Core.Application.Contracts #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 + { + item.IsHistoryUserOriginDeleted = find.IsHistoryUserOriginDeleted; + + } + } + + await _trialSiteUserSurveyRepository.SaveChangesAsync(); + } + /// /// 直接查询相关所有数据 @@ -351,9 +402,22 @@ namespace IRaCIS.Core.Application.Contracts [HttpGet("{trialId:guid}/{trialSiteSurveyId:guid}")] public async Task GetSiteSurveyInfo(Guid trialSiteSurveyId, Guid trialId) { + + //有可能填表人提交了,但是此时PM手动对人员信息进行了更改,此时需要将数据同步下(选择在这里同步是因为 不想改动 中心人员哪里的两个接口的逻辑) + var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId); + + 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; } @@ -440,7 +504,7 @@ namespace IRaCIS.Core.Application.Contracts public async Task> GetTrialSiteSurveySelectList(TrialSiteSurveySelectquery inQuery) { var trialSiteSurveyQueryable = _trialSiteSurveyRepository - .Where(t=>t.Id!=inQuery.TrialSiteSurveyId) + .Where(t => t.Id != inQuery.TrialSiteSurveyId) .Where(t => t.TrialId == inQuery.TrialId && t.SiteId == inQuery.SiteId).IgnoreQueryFilters() .ProjectTo(_mapper.ConfigurationProvider); @@ -667,18 +731,25 @@ namespace IRaCIS.Core.Application.Contracts else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) { + 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(); - + 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 }); - await DealSiteUserQuitSiteAsync(trialId, trialSiteSurvey.SiteId, 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.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id != trialSiteSurveyId, z => new TrialSiteSurvey() { IsDeleted = true }); } await _trialSiteSurveyRepository.SaveChangesAsync(); @@ -689,13 +760,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) { @@ -720,7 +792,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; @@ -736,7 +807,6 @@ namespace IRaCIS.Core.Application.Contracts } - // //发送邮件的时候需要用到该字段 item.SystemUserId = sysUserInfo.Id; @@ -775,12 +845,30 @@ namespace IRaCIS.Core.Application.Contracts await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } + else + { + await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser() + { + IsDeleted = false, + DeletedTime = null, + JoinTime = DateTime.Now, + }); + } + if (!await _repository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true)) { await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } + else + { + await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, c => new TrialSiteUser() + { + IsDeleted = false, + DeletedTime = null, + }); + } await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); @@ -789,7 +877,7 @@ namespace IRaCIS.Core.Application.Contracts } 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(); @@ -800,23 +888,139 @@ namespace IRaCIS.Core.Application.Contracts private async Task DealSiteUserQuitSiteAsync(Guid trialId, Guid siteId, List list) { - //跟踪查询该site下的所有的用户 - var siteUserList = await _repository.Where(t => t.TrialId == trialId && t.SiteId == siteId, true).ToListAsync(); - foreach (var siteUser in siteUserList) + 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() { - //当前中心用户 不在调研表存在,就将该人退出 - if (!list.Any(t => t.SystemUserId == siteUser.UserId)) - { - siteUser.IsDeleted = true; - siteUser.DeletedTime = DateTime.Now; - } + IsDeleted = true, + DeletedTime = DateTime.Now, + }); + + //var siteUserList = await _repository.Where(t => t.TrialId == trialId && t.SiteId == siteId && userIdList.Contains(t.UserId), true,true).ToListAsync(); + + + //foreach (var siteUser in siteUserList) + //{ + + // var find= list.FirstOrDefault(t => t.SystemUserId == siteUser.UserId); + // if(find != null) + // { + // siteUser.IsDeleted =(bool) find.IsHistoryUserDeleted; + // siteUser.DeletedTime = find.IsHistoryUserDeleted==true? DateTime.Now:null; + // } + //} + + + #region MyRegion + ////跟踪查询该site下的所有的用户 + //var siteUserList = await _repository.Where(t => t.TrialId == trialId && t.SiteId == siteId, true).ToListAsync(); + + //foreach (var siteUser in siteUserList) + //{ + // //当前中心用户 不在调研表存在,就将该人退出 + // if (!list.Any(t => t.SystemUserId == siteUser.UserId)) + // { + // siteUser.IsDeleted = true; + // siteUser.DeletedTime = DateTime.Now; + // } + + //} + #endregion - } await _repository.SaveChangesAsync(); } + + public async Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, 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) + { + + lock (lockObj) + { + 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; + + + if (!await _trialUserRepository.AnyAsync(t=>t.TrialId==trialId && t.UserId== userId, true)) + { + await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); + } + else + { + await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser() + { + IsDeleted = false, + DeletedTime = null, + JoinTime = DateTime.Now, + }); + } + + + if (!await _repository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true)) + { + await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); + + await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); + } + else + { + await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, c => new TrialSiteUser() + { + IsDeleted = false, + DeletedTime = null, + }); + } + + } + + //判断是否加入到项目 + + + } + + } } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 9d4bce551..326be7ed0 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -26,19 +26,19 @@ namespace IRaCIS.Core.Application.Contracts _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) { diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs index 974ecbfd3..ea2453623 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/_MapConfig.cs @@ -21,6 +21,23 @@ namespace IRaCIS.Core.Application.AutoMapper CreateMap().ForMember(d => d.Email, t => t.MapFrom(t => t.EmailOrPhone)); + CreateMap() + .ForMember(d => d.Id, u => u.Ignore()) + .ForMember(d => d.Phone, u => u.MapFrom(c => c.User.Phone)) + .ForMember(d => d.Email, u => u.MapFrom(c => c.User.EMail)) + .ForMember(d => d.OrganizationName, u => u.MapFrom(c => c.User.OrganizationName)) + .ForMember(d => d.UserTypeId, u => u.MapFrom(c => c.User.UserTypeId)) + .ForMember(d => d.IsHistoryUser, u => u.MapFrom(c => true)) + .ForMember(d => d.IsHistoryUserOriginDeleted, u => u.MapFrom(c => c.IsDeleted)) + .ForMember(d => d.IsHistoryUserDeleted, u => u.MapFrom(c => c.IsDeleted)) + .ForMember(d => d.FirstName, u => u.MapFrom(c => c.User.FirstName)) + .ForMember(d => d.LastName, u => u.MapFrom(c => c.User.LastName)) + .ForMember(d => d.IsGenerateAccount, u => u.MapFrom(c => true)) + .ForMember(d => d.IsGenerateSuccess, u => u.MapFrom(c => true)) + .ForMember(d => d.SystemUserId, u => u.MapFrom(c => c.UserId)) + .ForMember(d => d.IsJoin, u => u.MapFrom(c => !c.IsDeleted)); + + //列表 CreateMap() @@ -60,6 +77,10 @@ namespace IRaCIS.Core.Application.AutoMapper CreateMap(); + CreateMap() + .ForMember(d => d.EMail, u => u.MapFrom(s => s.Email)); + + CreateMap(); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs index 065aeea98..b3e671035 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/Interface/ITrialExternalUserService.cs @@ -21,7 +21,6 @@ namespace IRaCIS.Core.Application.Interfaces Task DeleteTrialExternalUser(Guid trialExternalUserId, bool isSystemUser, Guid systemUserId); - Task UserConfirmJoinTrial(Guid trialId, Guid trialExternalUserId); } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs index 94bb318c3..6bf00a16e 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialExternalUserService.cs @@ -281,535 +281,5 @@ namespace IRaCIS.Core.Application.Service - - - - #region 老版本流程 现在废弃 - - /// - /// 勾选用户 批量发送邮件 - /// - /// - [HttpPost] - public async Task SendInviteEmail(TrialExternalUserSendEmail sendEmail) - { - - var trialInfo = await _repository.FirstOrDefaultAsync(t => t.Id == sendEmail.TrialId); - - foreach (var userInfo in sendEmail.SendUsers) - { - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com")); - //收件地址 - messageToSend.To.Add(new MailboxAddress(String.Empty, userInfo.Email)); - //主题 - messageToSend.Subject = $"[{trialInfo.ResearchProgramNo}] 邀请"; - - //var baseApiUrl = sendEmail.BaseUrl.Remove(sendEmail.BaseUrl.IndexOf("#")) + "api"; - - var builder = new BodyBuilder(); - - var sysUserInfo = (await _userRepository.Where(t => t.Id == userInfo.SystemUserId).FirstOrDefaultAsync()).IfNullThrowException(); - - - builder.HtmlBody = @$" -
-
-
- {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}: -
-
- { - //您好,展影医疗作为 实验方案号:{trialInfo.ResearchProgramNo} 项目的IRC供应商,诚邀您参加该项目IRC相关工作,欢迎您提供指导和建议,非常感谢! - _localizer["TrialExternalUser_IRCInvitation", trialInfo.ResearchProgramNo] - } - -
- - - - - 查看并确认 - -
櫭 -
- "; - - - //< form action = '#' method = 'post' > - - // < button type = 'submit' style = 'margin-left:60px;font-size:14px;text-decoration: none;display: inline-block;height: 40px;width: 140px;background: #00D1B2;color:#fff;border-radius: 5px;line-height: 40px;text-align: center;border:none;margin-bottom: 100px;cursor: pointer' > 查看并确认 - - // - messageToSend.Body = builder.ToMessageBody(); - - using (var smtp = new MailKit.Net.Smtp.SmtpClient()) - { - smtp.MessageSent += (sender, args) => - { - - _ = _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => t.Id == userInfo.Id, u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.HasSend, ConfirmTime = null, RejectReason = String.Empty, ExpireTime = DateTime.Now.AddDays(7) }).Result; - - }; - - smtp.ServerCertificateValidationCallback = (s, c, h, e) => true; - - await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls); - - await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH"); - - await smtp.SendAsync(messageToSend); - - await smtp.DisconnectAsync(true); - } - - - } - - return ResponseOutput.Ok(); - - } - - - - - /// - /// 不带Token 访问 用户选择 参与 不参与 Id: TrialExternalUserId 加入发送邮件 - /// - /// - /// - [AllowAnonymous] - public async Task TrialExternalUserJoinTrial(TrialExternalUserConfirm editTrialUserPreparation) - { - - var needUpdate = await _trialExternalUseRepository.FirstOrDefaultAsync(t => t.Id == editTrialUserPreparation.Id); - - if (DateTime.Now > needUpdate.ExpireTime) - { - //---邀请加入时间已过期,重新被邀请后才可以进行确认操作 - return ResponseOutput.NotOk(_localizer["TrialExternalUser_InvitationExpired"]); - } - - _mapper.Map(editTrialUserPreparation, needUpdate); - - needUpdate.InviteState = editTrialUserPreparation.IsJoin == true ? TrialExternalUserStateEnum.UserConfirmed : TrialExternalUserStateEnum.UserReject; - - - var trialId = needUpdate.TrialId; - var userId = needUpdate.SystemUserId; - - //判断TrialUser中是否存在 不存在就插入 - if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId)) - { - - await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); - - } - - var success = await _trialExternalUseRepository.SaveChangesAsync(); - - - if (editTrialUserPreparation.IsJoin == true) - { - var trialInfo = await _repository.FirstOrDefaultAsync(t => t.Id == needUpdate.TrialId); - - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com")); - //收件地址 - messageToSend.To.Add(new MailboxAddress(String.Empty, needUpdate.Email)); - //主题 - //$"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 账户信息"; - messageToSend.Subject = _localizer["TrialExternalUser_AccountInfo", trialInfo.ResearchProgramNo]; - - var builder = new BodyBuilder(); - - - var sysUserInfo = (await _userRepository.Where(t => t.Id == needUpdate.SystemUserId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException(); - - int verificationCode = new Random().Next(100000, 1000000); - - if (sysUserInfo.IsFirstAdd) - { - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, - u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) }); - } - - builder.HtmlBody = @$" -
-
-
- {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}: -
-
-{ - // 您好,欢迎您参加项目 实验方案号:{trialInfo.ResearchProgramNo}IRC相关工作。该项目采用电子化工作流,系统及您的账号信息如下: - _localizer["TrialExternalUser_Welcome", trialInfo.ResearchProgramNo] - } - -
-
-
- -{ - // 项目编号: {trialInfo.TrialCode} - _localizer["TrialExternalUser_ProjectNumber", trialInfo.TrialCode] - } -
-
- -{ - // 试验方案号: {trialInfo.ResearchProgramNo} - _localizer["TrialExternalUser_ExperimentPlanNumber", trialInfo.ResearchProgramNo] - } -
-
- -{ - // 试验名称: {trialInfo.ExperimentName} - _localizer["TrialExternalUser_ExperimentName", trialInfo.ExperimentName] - } -
-
- -{ - // 用户名: {sysUserInfo.UserName} - _localizer["TrialExternalUser_Username", sysUserInfo.UserName] - } -
-
- - -{ - // 密码: {(sysUserInfo.IsFirstAdd ? verificationCode.ToString() + "(请在登录后进行修改)" : "***(您已有账号, 若忘记密码, 请通过邮箱找回)")} - _localizer["TrialExternalUser_Password", verificationCode.ToString()] - } -
-
- -{ - // 角色: {sysUserInfo.UserTypeRole.UserTypeShortName} - _localizer["TrialExternalUser_Role", sysUserInfo.UserTypeRole.UserTypeShortName] - } -
-
- 系统登录地址: {editTrialUserPreparation.BaseUrl} -{ - // 系统登录地址: {editTrialUserPreparation.BaseUrl} - _localizer["TrialExternalUser_LoginUrl", editTrialUserPreparation.BaseUrl] - } -
-
- -
-
- "; - - messageToSend.Body = builder.ToMessageBody(); - - using (var smtp = new MailKit.Net.Smtp.SmtpClient()) - { - - smtp.ServerCertificateValidationCallback = (s, c, h, e) => true; - - await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls); - - await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH"); - - await smtp.SendAsync(messageToSend); - - await smtp.DisconnectAsync(true); - } - - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); - - - } - return ResponseOutput.Ok(); - - //else - //{ - // builder.HtmlBody = @$" - //
- //
- //
- // {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}: - //
- //
- // 您好,您拒绝了参加 {trialInfo.ResearchProgramNo} 项目IRC相关工作的邀请。详细信息如下: - //
- //
- //
- // 项目编号: {trialInfo.TrialCode} - //
- //
- // 试验方案号: {trialInfo.ResearchProgramNo} - //
- //
- // 试验名称: {trialInfo.ExperimentName} - //
- //
- // 用户名: {sysUserInfo.UserName} - //
- //
- // 角色: {sysUserInfo.UserTypeRole.UserTypeShortName} - //
- //
- //
- //
- // "; - //} - - - - - - - } - - /// - /// 不带Token 访问 Site调研用户 加入项目 Id: TrialSiteSurveyUserId - /// - /// - /// - [AllowAnonymous] - public async Task TrialSiteSurveyUserJoinTrial(TrialExternalUserConfirm editInfo) - { - - var needUpdate = (await _trialSiteSurveyUserRepository.Where(t => t.Id == editInfo.Id, true).Include(t => t.TrialSiteSurvey).FirstOrDefaultAsync()).IfNullThrowException(); - - var revieweUser = await _userRepository.FirstOrDefaultAsync(t => t.Id == needUpdate.TrialSiteSurvey.ReviewerUserId); - - - if (DateTime.Now > needUpdate.ExpireTime) - { - //---邀请加入时间已过期,重新被邀请后才可以进行确认操作 - return ResponseOutput.NotOk(_localizer["TrialExternalUser_InvitationExpired"]); - } - - _mapper.Map(editInfo, needUpdate); - - needUpdate.InviteState = editInfo.IsJoin == true ? TrialSiteUserStateEnum.UserConfirmed : TrialSiteUserStateEnum.UserReject; - - - if (needUpdate.SystemUserId == null) - { - //---调研表系统用户Id 存储有问题 - return ResponseOutput.NotOk(_localizer["TrialExternalUser_UserIdStorageProblem"]); - } - - var trialId = needUpdate.TrialSiteSurvey.TrialId; - var siteId = needUpdate.TrialSiteSurvey.SiteId; - var userId = (Guid)needUpdate.SystemUserId; - - - if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId)) - { - await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); - - await _trialSiteUserRepository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); - - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == needUpdate.SystemUserId, u => new User() { Status = UserStateEnum.Enable }); - - - } - - var success = await _trialExternalUseRepository.SaveChangesAsync(); - - var trialInfo = await _repository.FirstOrDefaultAsync(t => t.Id == needUpdate.TrialSiteSurvey.TrialId); - - - var messageToSend = new MimeMessage(); - //发件地址 - messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com")); - //收件地址 - messageToSend.To.Add(new MailboxAddress(String.Empty, editInfo.IsJoin == true ? needUpdate.Email : revieweUser.EMail)); - //主题 - // $"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 账户信息"; - messageToSend.Subject = _localizer["TrialExternalUser_IRCAccountInfo", trialInfo.ResearchProgramNo]; - - - var builder = new BodyBuilder(); - - - var sysUserInfo = await _userRepository.Where(t => t.Id == needUpdate.SystemUserId).Include(t => t.UserTypeRole).FirstOrDefaultAsync(); - - int verificationCode = new Random().Next(100000, 1000000); - - if (sysUserInfo.IsFirstAdd) - { - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, - u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) }); - } - - if (editInfo.IsJoin == true) - { - builder.HtmlBody = @$" -
-
-
- {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}: -
-
- 您好,欢迎您参加项目 实验方案号: {trialInfo.ResearchProgramNo} IRC相关工作。该项目采用电子化工作流,系统及您的账号信息如下: -
-
-
- 项目编号: {trialInfo.TrialCode} -
-
- 试验方案号: {trialInfo.ResearchProgramNo} -
-
- 试验名称: {trialInfo.ExperimentName} -
-
- 用户名: {sysUserInfo.UserName} -
-
- 密码: {(sysUserInfo.IsFirstAdd ? verificationCode.ToString() + "(请在登录后进行修改)" : "***(您已有账号, 若忘记密码, 请通过邮箱找回)")} -
-
- 角色: {sysUserInfo.UserTypeRole.UserTypeShortName} -
-
- 系统登录地址: {editInfo.BaseUrl} -
-
- -
-
- "; - - messageToSend.Body = builder.ToMessageBody(); - - using (var smtp = new MailKit.Net.Smtp.SmtpClient()) - { - - smtp.ServerCertificateValidationCallback = (s, c, h, e) => true; - - await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls); - - await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH"); - - await smtp.SendAsync(messageToSend); - - await smtp.DisconnectAsync(true); - } - } - //else - //{ - - // builder.HtmlBody = @$" - //
- //
- //
- // {revieweUser.LastName + "/" + revieweUser.FirstName}: - //
- //
- // 您好,{sysUserInfo.LastName + "/" + sysUserInfo.FirstName} 拒绝了参加 {trialInfo.ResearchProgramNo} 项目IRC相关工作的邀请。详细信息如下: - //
- //
- //
- // 项目编号: {trialInfo.TrialCode} - //
- //
- // 试验方案号: {trialInfo.ResearchProgramNo} - //
- //
- // 试验名称: {trialInfo.ExperimentName} - //
- //
- // 用户名: {sysUserInfo.UserName} - //
- //
- // 角色: {sysUserInfo.UserTypeRole.UserTypeShortName} - //
- //
- // 拒绝原因: {editInfo.RejectReason} - //
- //
- //
- //
- // "; - - //} - - - - - - return ResponseOutput.Ok(); - - } - - - /// - /// 不带Token 访问 页面获取项目基本信息 和参与情况 (已经确认了 就不允许再次确认) Id: TrialExternalUserId/TrialSiteSurveyUserId - /// - /// - /// - /// - [AllowAnonymous] - public async Task JoinBasicInfo(Guid id, bool isExternalUser) - { - if (isExternalUser) - { - return (await _trialExternalUseRepository.Where(t => t.Id == id) - .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - } - else - { - return (await _trialSiteSurveyUserRepository.Where(t => t.Id == id) - .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException(); - } - - } - - - - - - /// - /// 加入项目 - /// - /// - /// - /// - [HttpGet("{trialId:guid}/{trialExternalUserId:guid}")] - [NonDynamicMethod] - public async Task UserConfirmJoinTrial(Guid trialId, Guid trialExternalUserId) - { - - var externalUser = await _trialExternalUseRepository.FirstOrDefaultAsync(t => t.Id == trialExternalUserId); - - - //判断TrialUser中是否存在 不存在就插入 - if (!await _repository.AnyAsync(t => t.TrialId == trialId && t.UserId == externalUser.SystemUserId)) - { - await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = (Guid)externalUser.SystemUserId, JoinTime = DateTime.Now }); - - await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialExternalUserId, - u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.UserConfirmed }); - - await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == externalUser.SystemUserId, u => new User() { Status = UserStateEnum.Enable }); - - await _userRepository.SaveChangesAsync(); - } - - - - return ResponseOutput.Ok(); - - - } - - #endregion - - - - - } } diff --git a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs index 78ebde226..b82f4f698 100644 --- a/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs +++ b/IRaCIS.Core.Domain/SiteSurvey/TrialSiteUserSurvey.cs @@ -59,7 +59,6 @@ namespace IRaCIS.Core.Domain.Models [Required] public Guid UpdateUserId { get; set; } - public string UserName { get; set; } = string.Empty; /// /// Phone @@ -97,16 +96,15 @@ namespace IRaCIS.Core.Domain.Models public TrialSiteUserStateEnum InviteState { get; set; } = TrialSiteUserStateEnum.WaitSent; - - #region 废弃 - public DateTime? ExpireTime { get; set; } - public bool IsJoin { get; set; } - public DateTime? ConfirmTime { get; set; } - public string RejectReason { get; set; } = string.Empty; - #endregion + public bool IsHistoryUser { get; set; } + + public bool? IsHistoryUserDeleted { get; set; } + + public bool? IsHistoryUserOriginDeleted { get; set; } + diff --git a/IRaCIS.Core.Domain/_Config/_StaticData.cs b/IRaCIS.Core.Domain/_Config/_StaticData.cs index daf810d2b..68298ec64 100644 --- a/IRaCIS.Core.Domain/_Config/_StaticData.cs +++ b/IRaCIS.Core.Domain/_Config/_StaticData.cs @@ -104,6 +104,8 @@ public static class StaticData public static readonly string UploadEDCData = "UploadEDCData"; + + public static readonly string UploadSiteSurveyData = "SiteSurveyData"; public static readonly string UploadFileFolder = "UploadFile"; } From 5e743b162de911f9743956a559f99b56a969df1e Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 14:54:44 +0800 Subject: [PATCH 28/43] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/UploadDownLoadController.cs | 184 +++++++++--------- .../DTO/TrialSiteUserSurveyViewModel.cs | 12 +- .../Interface/ITrialSiteSurveyService.cs | 2 +- .../SiteSurvey/TrialSiteSurveyService.cs | 33 ++-- .../Service/TrialSiteUser/TrialService.cs | 84 +------- 5 files changed, 124 insertions(+), 191 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 7e2bd5d35..6117602a2 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -938,96 +938,6 @@ namespace IRaCIS.Core.API.Controllers } - - [HttpPost] - [UnitOfWork] - public async Task UploadTrialSiteSurveyUser(Guid trialId, - [FromServices] IRepository _trialSiteRepository, - [FromServices] IRepository _usertypeRepository, - [FromServices] ITrialSiteSurveyService _trialSiteSurveyService) - { - var (serverFilePath, relativePath, fileName) = (string.Empty, string.Empty, string.Empty); - await FileUploadAsync(async (realFileName) => - { - fileName = realFileName; - - if (!fileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase)) - { - throw new BusinessValidationFailedException("请用提供格式的模板excel上传需要处理的数据"); - } - - (serverFilePath, relativePath) = FileStoreHelper.GetTrialSiteSurveyFilePath(_hostEnvironment, fileName, trialId); - - return serverFilePath; - }); - - //去掉空白行 - var excelList = MiniExcel.Query(serverFilePath).ToList() - .Where(t => !(string.IsNullOrWhiteSpace(t.TrialSiteCode) && string.IsNullOrWhiteSpace(t.FirstName) && string.IsNullOrWhiteSpace(t.LastName)) && string.IsNullOrWhiteSpace(t.Email) - && string.IsNullOrWhiteSpace(t.Phone) && string.IsNullOrWhiteSpace(t.UserTypeStr) && string.IsNullOrWhiteSpace(t.OrganizationName)); - - if (excelList.Any(t => string.IsNullOrWhiteSpace(t.TrialSiteCode) || string.IsNullOrWhiteSpace(t.FirstName) || string.IsNullOrWhiteSpace(t.LastName) || string.IsNullOrWhiteSpace(t.Email) || string.IsNullOrWhiteSpace(t.UserTypeStr))) - { - throw new BusinessValidationFailedException("请确保Excel中 每一行的 中心编号,姓名,邮箱,用户类型数据记录完整再进行上传"); - } - - var siteCodeList = excelList.Select(t => t.TrialSiteCode.Trim()).Distinct().ToList(); - - if (_trialSiteRepository.Where(t => siteCodeList.Contains(t.TrialSiteCode)).Count() != siteCodeList.Count) - { - throw new BusinessValidationFailedException("在项目中未找到该Excel中部分或全部中心"); - } - - if (excelList.GroupBy(t => new { t.UserTypeStr, t.Email }).Any(g => g.Count() > 1)) - { - throw new BusinessValidationFailedException("同一邮箱,同一用户类型,只能生成一个账户,请核查Excel数据"); - } - - if (excelList.Any(t => t.Email.Contains("@"))) - { - throw new BusinessValidationFailedException("有邮箱不符合邮箱格式,请核查Excel数据"); - } - var generateUserTypeList = new List() { "CRC", "SR", "CRA" }; - - if (excelList.Any(t => !generateUserTypeList.Contains(t.UserTypeStr.ToUpper()))) - { - throw new BusinessValidationFailedException("用户类型仅能为 CRC,SR,CRA 请核查Excel数据"); - } - - //处理好 用户类型 和用户类型枚举 - var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.SR).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList(); - var siteList= _trialSiteRepository.Where(t=>t.TrialId==trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t=>new {t.TrialSiteCode,t.SiteId}).ToList(); - - foreach (var item in excelList) - { - switch (item.UserTypeStr.ToUpper()) - { - case "CRC": - - item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).UserTypeId; - item.UserTypeEnum = UserTypeEnum.ClinicalResearchCoordinator; - break; - - case "CRA": - item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.CRA).UserTypeId; - item.UserTypeEnum = UserTypeEnum.CRA; - break; - - case "SR": - item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.SR).UserTypeId; - item.UserTypeEnum = UserTypeEnum.SR; - break; - - } - - item.SiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).SiteId; - } - - await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, excelList.ToList()); - - return ResponseOutput.Ok(); - - } } @@ -1123,6 +1033,100 @@ namespace IRaCIS.Core.API.Controllers _userInfo = userInfo; } + + [HttpPost, Route("TrialSiteSurvey/UploadTrialSiteSurveyUser")] + [DisableFormValueModelBinding] + [UnitOfWork] + public async Task UploadTrialSiteSurveyUser(Guid trialId, string baseUrl, string routeUrl, + [FromServices] IRepository _trialSiteRepository, + [FromServices] IRepository _usertypeRepository, + [FromServices] ITrialSiteSurveyService _trialSiteSurveyService) + { + var (serverFilePath, relativePath, fileName) = (string.Empty, string.Empty, string.Empty); + await FileUploadAsync(async (realFileName) => + { + fileName = realFileName; + + if (!fileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase)) + { + throw new BusinessValidationFailedException("请用提供格式的模板excel上传需要处理的数据"); + } + + (serverFilePath, relativePath) = FileStoreHelper.GetTrialSiteSurveyFilePath(_hostEnvironment, fileName, trialId); + + return serverFilePath; + }); + + //去掉空白行 + var excelList = MiniExcel.Query(serverFilePath).ToList() + .Where(t => !(string.IsNullOrWhiteSpace(t.TrialSiteCode) && string.IsNullOrWhiteSpace(t.FirstName) && string.IsNullOrWhiteSpace(t.LastName) && string.IsNullOrWhiteSpace(t.Email) + && string.IsNullOrWhiteSpace(t.Phone) && string.IsNullOrWhiteSpace(t.UserTypeStr) && string.IsNullOrWhiteSpace(t.OrganizationName))).ToList(); + + if (excelList.Any(t => string.IsNullOrWhiteSpace(t.TrialSiteCode) || string.IsNullOrWhiteSpace(t.FirstName) || string.IsNullOrWhiteSpace(t.LastName) || string.IsNullOrWhiteSpace(t.Email) || string.IsNullOrWhiteSpace(t.UserTypeStr))) + { + throw new BusinessValidationFailedException("请确保Excel中 每一行的 中心编号,姓名,邮箱,用户类型数据记录完整再进行上传"); + } + + var siteCodeList = excelList.Select(t => t.TrialSiteCode.Trim().ToUpper()).Distinct().ToList(); + + if (_trialSiteRepository.Where(t => t.TrialId==trialId && siteCodeList.Contains(t.TrialSiteCode.ToUpper())).Count() != siteCodeList.Count) + { + throw new BusinessValidationFailedException("在项目中未找到该Excel中部分或全部中心"); + } + + if (excelList.GroupBy(t => new { t.UserTypeStr, t.Email }).Any(g => g.Count() > 1)) + { + throw new BusinessValidationFailedException("同一邮箱,同一用户类型,只能生成一个账户,请核查Excel数据"); + } + + if (excelList.Any(t => !t.Email.Contains("@"))) + { + throw new BusinessValidationFailedException("有邮箱不符合邮箱格式,请核查Excel数据"); + } + var generateUserTypeList = new List() { "CRC", "SR", "CRA" }; + + if (excelList.Any(t => !generateUserTypeList.Contains(t.UserTypeStr.ToUpper()))) + { + throw new BusinessValidationFailedException("用户类型仅能为 CRC,SR,CRA 请核查Excel数据"); + } + + //处理好 用户类型 和用户类型枚举 + var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.SR).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList(); + var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, t.SiteId }).ToList(); + + foreach (var item in excelList) + { + switch (item.UserTypeStr.ToUpper()) + { + case "CRC": + + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).UserTypeId; + item.UserTypeEnum = UserTypeEnum.ClinicalResearchCoordinator; + break; + + case "CRA": + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.CRA).UserTypeId; + item.UserTypeEnum = UserTypeEnum.CRA; + break; + + case "SR": + item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.SR).UserTypeId; + item.UserTypeEnum = UserTypeEnum.SR; + break; + + } + + item.SiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).SiteId; + } + + await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, baseUrl, routeUrl, excelList.ToList()); + + return ResponseOutput.Ok(); + + } + + + /// 缩略图 [AllowAnonymous] [HttpGet("Common/LocalFilePreview")] diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs index d2959bb4f..d272c3cba 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteUserSurveyViewModel.cs @@ -137,12 +137,12 @@ namespace IRaCIS.Core.Application.Contracts public class SiteSurveyUserImportDto { - public string TrialSiteCode { get;set; } - public string FirstName { get; set; } - public string LastName { get; set; } - public string Email { get; set; } - public string Phone { get; set; } - public string OrganizationName { get; set; } + 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; } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs index 61ee8a14e..52a6ba09a 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/Interface/ITrialSiteSurveyService.cs @@ -21,6 +21,6 @@ namespace IRaCIS.Core.Application.Contracts //IResponseOutput TrialSurveySubmmit(Guid trialId, Guid trialSiteSurveyId); Task VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService); - Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, List list); + Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, string baseUrl,string rootUrl, List list); } } \ No newline at end of file diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index ac7241796..3e680e5a2 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -838,14 +838,16 @@ 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 _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } - else + else if(findTrialUser.IsDeleted==true) { await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser() { @@ -853,13 +855,14 @@ namespace IRaCIS.Core.Application.Contracts DeletedTime = null, 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)) { await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); - await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } else { @@ -935,7 +938,7 @@ namespace IRaCIS.Core.Application.Contracts - public async Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, List list) + public async Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, string baseUrl, string routeUrl, List list) { @@ -977,18 +980,22 @@ namespace IRaCIS.Core.Application.Contracts } item.IsGeneratedAccount = true; - - + } var userId = sysUserInfo.Id; + var siteId = item.SiteId; - - 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 _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl); + } - else + else if (findTrialUser.IsDeleted == true) { await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser() { @@ -996,6 +1003,8 @@ namespace IRaCIS.Core.Application.Contracts DeletedTime = null, JoinTime = DateTime.Now, }); + + await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl); } @@ -1003,7 +1012,6 @@ namespace IRaCIS.Core.Application.Contracts { await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId }); - await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } else { @@ -1014,9 +1022,12 @@ namespace IRaCIS.Core.Application.Contracts }); } + await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); + + await _trialSiteUserRepository.SaveChangesAsync(); + } - //判断是否加入到项目 } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs index 493e04861..0806cb981 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialService.cs @@ -280,52 +280,9 @@ namespace IRaCIS.Application.Services public async Task DeleteTrial(Guid trialId) { - - var trial = (await _trialRepository.FirstOrDefaultAsync(u => u.Id == trialId, true)).IfNullThrowException(); - - if (_verifyConfig.CurrentValue.OpenTrialRelationDelete) { - - #region 项目真删除废弃 - - //if (trial.VisitPlanConfirmed) - //{ - // return ResponseOutput.NotOk("Trial访视计划已经确认,无法删除"); - //} - - //if (await _repository.AnyAsync(u => u.TrialId == trialId)) - //{ - // return ResponseOutput.NotOk("该Trial有医生入组或在入组流程中,无法删除"); - //} - - //if (await _repository.AnyAsync(u => u.TrialId == trialId)) - //{ - // return ResponseOutput.NotOk("该Trial下面有Site,无法删除"); - //} - - ////PM 可以删除项目 仅仅在没有site 参与者只有他自己的时候 - //if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager) - //{ - // //参与者仅有他自己时,可以删除 - // if (await _trialUserRepository.CountAsync(t => t.TrialId == trialId) == 1) - // { - - // var success1 = await _repository.BatchDeleteAsync(o => o.Id == trialId) || - // await _repository.BatchDeleteAsync(t => t.TrialId == trialId) || - // await _repository.BatchDeleteAsync(t => t.TrialId == trialId); - - // return ResponseOutput.Result(success1); - // } - //} - - //if (await _repository.AnyAsync(u => u.TrialId == trialId)) - //{ - // return ResponseOutput.NotOk("该Trial下面有参与者,无法删除"); - //} - #endregion - - + await _repository.BatchDeleteAsync(o => o.SubjectVisit.TrialId == trialId); await _repository.BatchDeleteAsync(o => o.TrialId == trialId); @@ -344,9 +301,6 @@ namespace IRaCIS.Application.Services - - - await _repository.BatchDeleteAsync(t => t.SubjectVisit.TrialId == trialId); await _repository.BatchDeleteAsync(t => t.SubjectVisit.TrialId == trialId); await _repository.BatchDeleteAsync(t => t.SubjectVisit.TrialId == trialId); @@ -438,7 +392,6 @@ namespace IRaCIS.Application.Services await _repository.BatchDeleteAsync(t => t.OriginalReReadingTask.TrialId == trialId); await _repository.BatchDeleteAsync(t => t.TrialId == trialId); - await _repository.BatchDeleteAsync(t => t.TrialId == trialId); await _repository.BatchDeleteAsync(t => t.TrialId == trialId) ; return ResponseOutput.Ok(); @@ -454,41 +407,6 @@ namespace IRaCIS.Application.Services } - [AllowAnonymous] - [HttpDelete, Route("{trialId:guid}")] - public async Task DeleteTrialTaskData(Guid trialId) - { - - //await _repository.BatchDeleteAsync(t => t.TrialId == trialId) || - // await _repository.BatchDeleteAsync(t => t.TrialId == trialId) || - // await _repository.BatchDeleteAsync(t => t.TrialId == trialId) || - - - - - //await _repository.BatchDeleteAsync(t => t.TrialId == trialId); - // await _repository.BatchDeleteAsync(t => t.TrialId == trialId); - - - // await _repository.BatchDeleteAsync(t => t.TaskMedicalReview.TrialId == trialId); - // await _repository.BatchDeleteAsync(t => t.TaskMedicalReview.TrialId == trialId); - - - // await _repository.BatchDeleteAsync(t => t.VisitTask.TrialId == trialId); - - // await _repository.BatchDeleteAsync(t => t.TrialId == trialId); - - // await _repository.BatchDeleteAsync(t => t.TrialId == trialId); - // await _repository.BatchDeleteAsync(t => t.TrialId == trialId) ; - - // await _repository.BatchDeleteAsync(t => t.VisitTask.TrialId == trialId); - // await _repository.BatchDeleteAsync(t => t.TrialId == trialId); - - // await _repository.BatchDeleteAsync(t => t.OriginalReReadingTask.TrialId == trialId); - // await _repository.BatchDeleteAsync(t => t.TrialId == trialId); - - return ResponseOutput.Ok(); - } From 8ffe69d38e636301bb9c0914fab7d46c2497741c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 15:03:40 +0800 Subject: [PATCH 29/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E6=97=B6=E9=97=B4=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/TestService.cs | 84 +------------------------- 1 file changed, 3 insertions(+), 81 deletions(-) diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index a2b12a4da..f0ccc199f 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -65,90 +65,12 @@ namespace IRaCIS.Application.Services return ResponseOutput.Ok(); } - + [AllowAnonymous] [UnitOfWork] public async Task Get() { - - //Expression> visitTaskLambda = x => x.TrialId == Guid.Empty && x.SubjectId == Guid.Empty && x.TrialReadingCriterionId == Guid.Empty; - - //var visitTaskIdQueryable = _visitTaskRepositoryy.Where(visitTaskLambda).Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum)).Select(t => t.Id); - - //await _visitTaskRepositoryy.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable.Contains(t.Id), u => new VisitTask() - //{ - // IsFrontTaskNeedSignButNotSign = true - //}); - - - //var a = ((Decimal)1.00).ToString().TrimEnd(new char[] { '.', '0' }); - //var b = ((Decimal)1.01).ToString().TrimEnd(new char[] { '.', '0' }); - //var c = ((Decimal)100).ToString().TrimEnd(new char[] { '.', '0' }); - //var subject1 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693"); - //var subject2 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694"); - - // var subjectList = new List() { Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693") , - // Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694") , - // Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391695") - // }; - - //string[] citys = new string[] { "广州", "深圳", "上海", "北京" }; - //foreach (var item in subjectList) - //{ - // Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][N:[CN:{item}]/0000000]")); - //} - //foreach (var item in subjectList) - //{ - // Console.WriteLine(await BNRFactory.Default.Create($"[N:[CN:{item}]/0000000]")); - //} - - //foreach (var item in subjectList) - //{ - // Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][redis:city/0000000]")); - //} - - //var needAddVisitList = await _repository.Where(t => t.TrialId == Guid.Empty).DistinctBy(t => t.VisitTaskNum).ToListAsync(); - - - //await _repository.BatchUpdateAsync(t => t.Id == Guid.Empty, u => new VisitTask() - //{ - // SuggesteFinishedTime = u.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7), - - // Code = u.Code + 1 - //}); - - //var query = from item1 in _repository.Where() - // join item2 in _repository.Where() on item1.ValueType equals item2.ValueType - // select new - // { - // item1.ValueType, - // dd = item2.ValueType - // }; - - //var list2 = query.ToList(); - - //await Task.CompletedTask; - - //var list = await _repository.Where(t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74")).ToListAsync(); - - ////await _repository.BatchDeleteAsync(t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74")); - - //await _repository.AddRangeAsync(list, true); - - //await _repository.SaveChangesAsync(); - - //await _repository.BatchUpdateAsync(t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74") && t.EntityName== "ClinicalDataTrialSet", t => new DataInspection() { CreateTime= DateTime.Now.AddMonths(-2) } ); - - //await _visitTaskRepositoryy.UpdatePartialFromQueryAsync( Guid.Parse("78360000-3E2C-0016-9B53-08DA6A002040"), c => new VisitTask() { UpdateTime = DateTime.Now }); - - //await _visitTaskRepositoryy.UpdatePartialFromQueryAsync( Guid.Parse("78360000-3E2C-0016-9B53-08DA6A002040"), c => new VisitTask() { UpdateTime = DateTime.Now.AddMinutes(1) }); - - //var a = _userInfo.IsTestUser; - - //var list1 = await _repository.Where().Select(t => t.TranslateValue(t.Value, t.ValueCN, true)).ToListAsync(); - //var list2 = await _repository.Where().Select(t => t.TranslateValue(t.Value, t.ValueCN, false)).ToListAsync(); - - await _repository.SaveChangesAsync(); - return _userInfo.LocalIp; + + return "修改服务器时间自动发布测试"; } From 585b665b535bed31c2476f42ad39b531e7f54f0a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 15:17:06 +0800 Subject: [PATCH 30/43] =?UTF-8?q?=E7=BB=A7=E7=BB=ADtest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/TestService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index f0ccc199f..fb175609a 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -70,7 +70,7 @@ namespace IRaCIS.Application.Services public async Task Get() { - return "修改服务器时间自动发布测试"; + return "修改服务器时间自动发布测试--我又修改了"; } From d575d8ac7365a1477afbad289852e3973ee31436 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 15:59:11 +0800 Subject: [PATCH 31/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94=E6=8B=B7=E8=B4=9D=E6=95=B0=E6=8D=AE=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 3e680e5a2..ffa1e5876 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -331,9 +331,13 @@ namespace IRaCIS.Core.Application.Contracts copy.TrialSiteEquipmentSurveyList = currentLatest.TrialSiteEquipmentSurveyList.Clone(); copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty; t.CreateTime = DateTime.Now; }); - 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; }); - + //锁定了的话,就不拷贝 + 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 中找到已存在的 加到历史人员中 From c85bb7f22bcbfe11faa9f1597e8a5c8022c0335a Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 16:21:34 +0800 Subject: [PATCH 32/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index ffa1e5876..0cb4dc7af 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -715,10 +715,10 @@ namespace IRaCIS.Core.Application.Contracts var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); - if (!currentUserList.Any(t => t.TrialRoleCode == 1) || !currentUserList.Any(t => t.TrialRoleCode == 5)) - { - throw new BusinessValidationFailedException("本次提交,必须有CRC和影像阅片人信息"); - } + //if (!currentUserList.Any(t => t.TrialRoleCode == 1) || !currentUserList.Any(t => t.TrialRoleCode == 5)) + //{ + // throw new BusinessValidationFailedException("本次提交,必须有CRC和影像阅片人信息"); + //} if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator) || From d200f12fa85a03b4478761f959299214f7e0d805 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 16:42:05 +0800 Subject: [PATCH 33/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 0cb4dc7af..3931be3c6 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -390,8 +390,7 @@ namespace IRaCIS.Core.Application.Contracts } else { - item.IsHistoryUserOriginDeleted = find.IsHistoryUserOriginDeleted; - + find.IsHistoryUserOriginDeleted = item.IsHistoryUserOriginDeleted; } } From 536e9ef262d1cd887f10e13c6ebf9c3db5b59fc0 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 16:44:55 +0800 Subject: [PATCH 34/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 3931be3c6..dc8e1846c 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -391,6 +391,7 @@ namespace IRaCIS.Core.Application.Contracts else { find.IsHistoryUserOriginDeleted = item.IsHistoryUserOriginDeleted; + find.IsHistoryUserDeleted = item.IsHistoryUserOriginDeleted; } } From aa343ade2ec92e53ce8d84cd18e1e3c512e4ff10 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 17:11:02 +0800 Subject: [PATCH 35/43] xx --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index dc8e1846c..f03880787 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -287,7 +287,7 @@ namespace IRaCIS.Core.Application.Contracts { //找到最新的调研表 - var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, true) + 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) @@ -408,7 +408,7 @@ namespace IRaCIS.Core.Application.Contracts { //有可能填表人提交了,但是此时PM手动对人员信息进行了更改,此时需要将数据同步下(选择在这里同步是因为 不想改动 中心人员哪里的两个接口的逻辑) - var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId); + var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId,true); if (find.State != TrialSiteSurveyEnum.PMCreatedAndLock && find.IsDeleted != true) { From ea157cdb711e6239bb230818009d545e310ac75f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 17 Aug 2023 18:07:34 +0800 Subject: [PATCH 36/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E5=92=8C=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 11 ++++++++++- .../Service/SiteSurvey/TrialSiteUserSurveyService.cs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index f03880787..a42337612 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -20,6 +20,7 @@ using Microsoft.VisualBasic; using DocumentFormat.OpenXml.Spreadsheet; using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Application.ViewModel; +using Dicom; namespace IRaCIS.Core.Application.Contracts { @@ -410,6 +411,7 @@ namespace IRaCIS.Core.Application.Contracts //有可能填表人提交了,但是此时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(); @@ -418,6 +420,7 @@ namespace IRaCIS.Core.Application.Contracts await UnlockSyncSiteUserAsync(find.TrialId, find.SiteId, find.Id, userList); } + var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters() @@ -695,7 +698,13 @@ namespace IRaCIS.Core.Application.Contracts var trialId = siteSurvyeSubmit.TrialId; var trialSiteSurveyId = siteSurvyeSubmit.TrialSiteSurveyId; - var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).FirstOrDefaultAsync()).IfNullThrowException(); + var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId,false,true).FirstOrDefaultAsync()).IfNullThrowException(); + + + if (trialSiteSurvey.IsDeleted == true || trialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock) + { + throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许提交"); + } var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.SiteId == trialSiteSurvey.SiteId && t.TrialSiteSurvey.IsDeleted == false).Select(t => new diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 326be7ed0..131ba5efa 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -52,7 +52,7 @@ namespace IRaCIS.Core.Application.Contracts if (addOrEditTrialSiteUserSurvey.IsGenerateAccount ) { - var trialId= _trialSiteSurveyRepository.Where(t=>t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId).Select(t=>t.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(); From 00cb2fc67c629e545261458bf5bfe8666c6e8931 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 18 Aug 2023 08:56:44 +0800 Subject: [PATCH 37/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E8=A1=A8=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/TrialSiteEquipmentSurveyService.cs | 15 +++++++-------- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- .../SiteSurvey/TrialSiteUserSurveyService.cs | 5 +++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs index 5a1de2dff..16486d477 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; } @@ -38,17 +40,14 @@ namespace IRaCIS.Core.Application.Contracts [HttpPost("{trialId:guid}")] public async Task AddOrUpdateTrialSiteEquipmentSurvey(TrialSiteEquipmentSurveyAddOrEdit addOrEditTrialSiteEquipmentSurvey) { - - if (addOrEditTrialSiteEquipmentSurvey.Id != null) + + if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteEquipmentSurvey.TrialSiteSurveyId && (t.IsDeleted == true ||t.State==TrialSiteSurveyEnum.PMCreatedAndLock), true)) { - if (await _trialSiteEquipmentSurveyRepository.Where(t => t.Id == addOrEditTrialSiteEquipmentSurvey.Id).AnyAsync(t => t.TrialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock)) - { - //---已锁定,不允许操作 - return ResponseOutput.NotOk(_localizer["TrialSiteEquipment_Locked"]); - } + return ResponseOutput.NotOk("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } + var entity = await _trialSiteEquipmentSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteEquipmentSurvey, true); return ResponseOutput.Ok(entity.Id.ToString()); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index a42337612..6c6df23da 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -703,7 +703,7 @@ namespace IRaCIS.Core.Application.Contracts if (trialSiteSurvey.IsDeleted == true || trialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock) { - throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许提交"); + throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.SiteId == trialSiteSurvey.SiteId && t.TrialSiteSurvey.IsDeleted == false).Select(t => diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 131ba5efa..ead243037 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -48,6 +48,11 @@ namespace IRaCIS.Core.Application.Contracts //---已锁定,不允许操作 return ResponseOutput.NotOk(_localizer["TrialSiteUser_Locked"]); } + + if(await _trialSiteSurveyRepository.AnyAsync(t=>t.Id==addOrEditTrialSiteUserSurvey.TrialSiteSurveyId && t.IsDeleted == true, true)) + { + return ResponseOutput.NotOk("当前调研表已废除,不允许操作"); + } if (addOrEditTrialSiteUserSurvey.IsGenerateAccount ) From bd8123af59aceb00d699967e06ad0bdf0ec1c884 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 18 Aug 2023 08:56:44 +0800 Subject: [PATCH 38/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E8=A1=A8=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/TrialSiteEquipmentSurveyService.cs | 15 +++++++-------- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 2 +- .../SiteSurvey/TrialSiteUserSurveyService.cs | 10 ++++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteEquipmentSurveyService.cs index 5a1de2dff..16486d477 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; } @@ -38,17 +40,14 @@ namespace IRaCIS.Core.Application.Contracts [HttpPost("{trialId:guid}")] public async Task AddOrUpdateTrialSiteEquipmentSurvey(TrialSiteEquipmentSurveyAddOrEdit addOrEditTrialSiteEquipmentSurvey) { - - if (addOrEditTrialSiteEquipmentSurvey.Id != null) + + if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteEquipmentSurvey.TrialSiteSurveyId && (t.IsDeleted == true ||t.State==TrialSiteSurveyEnum.PMCreatedAndLock), true)) { - if (await _trialSiteEquipmentSurveyRepository.Where(t => t.Id == addOrEditTrialSiteEquipmentSurvey.Id).AnyAsync(t => t.TrialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock)) - { - //---已锁定,不允许操作 - return ResponseOutput.NotOk(_localizer["TrialSiteEquipment_Locked"]); - } + return ResponseOutput.NotOk("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } + var entity = await _trialSiteEquipmentSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteEquipmentSurvey, true); return ResponseOutput.Ok(entity.Id.ToString()); diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index a42337612..6c6df23da 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -703,7 +703,7 @@ namespace IRaCIS.Core.Application.Contracts if (trialSiteSurvey.IsDeleted == true || trialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock) { - throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许提交"); + throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.SiteId == trialSiteSurvey.SiteId && t.TrialSiteSurvey.IsDeleted == false).Select(t => diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs index 131ba5efa..a518b0ff5 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteUserSurveyService.cs @@ -43,12 +43,14 @@ namespace IRaCIS.Core.Application.Contracts 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"]); + //当前调研表已废除,或者调研表状态已锁定,不允许操作 + return ResponseOutput.NotOk("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } - + if (addOrEditTrialSiteUserSurvey.IsGenerateAccount ) { From 1a5cfa8bbd2f99e562b2fb57930d766b7b397a71 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 18 Aug 2023 09:23:35 +0800 Subject: [PATCH 39/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=9F=E9=99=A4?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 6c6df23da..47be74d4b 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -268,7 +268,6 @@ namespace IRaCIS.Core.Application.Contracts currentEntity = currentLatest; - if (currentEntity.State != TrialSiteSurveyEnum.PMCreatedAndLock) { @@ -277,7 +276,6 @@ namespace IRaCIS.Core.Application.Contracts } - } @@ -302,6 +300,8 @@ namespace IRaCIS.Core.Application.Contracts return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoRecordToUpdate"]); } + + //未锁定的状态 就改为废除 if (currentLatest.State != TrialSiteSurveyEnum.PMCreatedAndLock) { @@ -312,10 +312,10 @@ namespace IRaCIS.Core.Application.Contracts { } - var copy = currentLatest.Clone(); copy.State = TrialSiteSurveyEnum.ToSubmit; + copy.IsDeleted = false; copy.Email = userInfo.EmailOrPhone; copy.Id = Guid.Empty; From 4200daa1b9a850d9ab1f99ed15007dfac76aedf0 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 18 Aug 2023 10:27:49 +0800 Subject: [PATCH 40/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B0=83=E7=A0=94?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 47be74d4b..e5f7b13d2 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -392,7 +392,6 @@ namespace IRaCIS.Core.Application.Contracts else { find.IsHistoryUserOriginDeleted = item.IsHistoryUserOriginDeleted; - find.IsHistoryUserDeleted = item.IsHistoryUserOriginDeleted; } } From 8c5cca7ba583edc68f02a072a83da3210a8822e3 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 18 Aug 2023 13:19:51 +0800 Subject: [PATCH 41/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94=E9=99=90=E5=88=B6=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index e5f7b13d2..6d371447a 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -705,7 +705,9 @@ namespace IRaCIS.Core.Application.Contracts throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } - var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.SiteId == trialSiteSurvey.SiteId && t.TrialSiteSurvey.IsDeleted == false).Select(t => + var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId) + .Where(t=>!(t.IsHistoryUser && t.IsHistoryUserDeleted==true)) + .Select(t => new { t.TrialSiteSurveyId, @@ -714,8 +716,8 @@ namespace IRaCIS.Core.Application.Contracts t.UserTypeId, UserTypeEnum = (UserTypeEnum?)t.UserTypeRole.UserTypeEnum, t.TrialRoleCode, - t.Email - }).ToListAsync(); + t.Email, + }). ToListAsync(); if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined) @@ -723,11 +725,6 @@ namespace IRaCIS.Core.Application.Contracts var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); - //if (!currentUserList.Any(t => t.TrialRoleCode == 1) || !currentUserList.Any(t => t.TrialRoleCode == 5)) - //{ - // throw new BusinessValidationFailedException("本次提交,必须有CRC和影像阅片人信息"); - //} - if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator) || !currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.SR)) From b6403580deb9e87bda91b6d5149793ab6f00ef8d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 18 Aug 2023 14:44:36 +0800 Subject: [PATCH 42/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=80=80=E5=87=BA?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=8A=A0=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiteSurvey/TrialSiteSurveyService.cs | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 6d371447a..84dde1322 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -286,7 +286,7 @@ namespace IRaCIS.Core.Application.Contracts { //找到最新的调研表 - var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId,true) + 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) @@ -333,12 +333,12 @@ namespace IRaCIS.Core.Application.Contracts copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty; t.CreateTime = DateTime.Now; }); //锁定了的话,就不拷贝 - if(currentLatest.State!= TrialSiteSurveyEnum.PMCreatedAndLock) + 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 中找到已存在的 加到历史人员中 @@ -408,9 +408,9 @@ namespace IRaCIS.Core.Application.Contracts { //有可能填表人提交了,但是此时PM手动对人员信息进行了更改,此时需要将数据同步下(选择在这里同步是因为 不想改动 中心人员哪里的两个接口的逻辑) - var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId,true); + 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(); @@ -419,7 +419,7 @@ namespace IRaCIS.Core.Application.Contracts await UnlockSyncSiteUserAsync(find.TrialId, find.SiteId, find.Id, userList); } - + var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters() @@ -697,16 +697,16 @@ namespace IRaCIS.Core.Application.Contracts var trialId = siteSurvyeSubmit.TrialId; var trialSiteSurveyId = siteSurvyeSubmit.TrialSiteSurveyId; - var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId,false,true).FirstOrDefaultAsync()).IfNullThrowException(); + var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId, false, true).FirstOrDefaultAsync()).IfNullThrowException(); - if (trialSiteSurvey.IsDeleted == true || trialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock) + if (trialSiteSurvey.IsDeleted == true || trialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock) { throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId) - .Where(t=>!(t.IsHistoryUser && t.IsHistoryUserDeleted==true)) + .Where(t => !(t.IsHistoryUser && t.IsHistoryUserDeleted == true)) .Select(t => new { @@ -717,7 +717,7 @@ namespace IRaCIS.Core.Application.Contracts UserTypeEnum = (UserTypeEnum?)t.UserTypeRole.UserTypeEnum, t.TrialRoleCode, t.Email, - }). ToListAsync(); + }).ToListAsync(); if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined) @@ -849,14 +849,14 @@ namespace IRaCIS.Core.Application.Contracts //判断TrialUser中是否存在 不存在就插入 var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true); - if (findTrialUser==null) + if (findTrialUser == null) { await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now }); await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } - else if(findTrialUser.IsDeleted==true) + else if (findTrialUser.IsDeleted == true) { await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser() { @@ -868,18 +868,17 @@ namespace IRaCIS.Core.Application.Contracts await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl); } - if (!await _repository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true)) + 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 { - await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, c => new TrialSiteUser() - { - IsDeleted = false, - DeletedTime = null, - }); + findTrialSiteUser.IsDeleted = false; + findTrialSiteUser.DeletedTime = null; } await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); @@ -989,7 +988,7 @@ namespace IRaCIS.Core.Application.Contracts } item.IsGeneratedAccount = true; - + } var userId = sysUserInfo.Id; @@ -1017,18 +1016,17 @@ namespace IRaCIS.Core.Application.Contracts } - if (!await _repository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true)) + 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 { - await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, c => new TrialSiteUser() - { - IsDeleted = false, - DeletedTime = null, - }); + findTrialSiteUser.IsDeleted = false; + findTrialSiteUser.DeletedTime = null; } await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable }); From 96e1a2c39373710a0ecf4b004e82b1c3bda42f09 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 18 Aug 2023 17:55:43 +0800 Subject: [PATCH 43/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E8=B0=83=E7=A0=94=EF=BC=8C=E5=BC=95=E5=85=A5hangfire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/UploadDownLoadController.cs | 798 ++++++++++-------- IRaCIS.Core.API/IRaCIS.Core.API.csproj | 3 + IRaCIS.Core.API/IRaCIS.Core.API.xml | 100 +-- IRaCIS.Core.API/Startup.cs | 5 +- .../LogDashBoardAuthFilter.cs | 0 .../Dashboard/hangfireAuthorizationFilter.cs | 17 + .../_PipelineExtensions/HangfireConfig.cs | 60 ++ .../_ServiceExtensions/LogDashboardSetup.cs | 2 + .../_ServiceExtensions/hangfireSetup.cs | 40 + IRaCIS.Core.API/appsettings.Test_Study.json | 3 +- IRaCIS.Core.API/appsettings.Uat_Study.json | 3 +- .../Helper/FileStoreHelper.cs | 22 + .../SiteSurvey/TrialSiteSurveyService.cs | 29 +- IRaCIS.Core.Domain/_Config/_StaticData.cs | 2 + 14 files changed, 601 insertions(+), 483 deletions(-) rename IRaCIS.Core.API/_PipelineExtensions/{LogDashboard => Dashboard}/LogDashBoardAuthFilter.cs (100%) create mode 100644 IRaCIS.Core.API/_PipelineExtensions/Dashboard/hangfireAuthorizationFilter.cs create mode 100644 IRaCIS.Core.API/_PipelineExtensions/HangfireConfig.cs create mode 100644 IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 6117602a2..7371c790a 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -438,312 +438,314 @@ namespace IRaCIS.Core.API.Controllers + #region 废弃 + - /// - /// 上传临床数据 多文件 - /// - /// - /// - [HttpPost("ClinicalData/UploadVisitClinicalData/{trialId:guid}/{subjectVisitId:guid}")] - [DisableRequestSizeLimit] - //[Authorize(Policy = IRaCISPolicy.CRC)] - [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - - public async Task UploadVisitClinicalData(Guid subjectVisitId) - { - await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId); - var sv = _repository.Where(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefault().IfNullThrowException(); - - await FileUploadAsync(async (fileName) => - { - var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId, sv.SiteId, sv.SubjectId, subjectVisitId); - //插入临床pdf 路径 - await _repository.AddAsync(new PreviousPDF() - { - SubjectVisitId = subjectVisitId, - - IsVisist = true, - DataType = ClinicalDataType.MedicalHistory, - UploadType = ClinicalUploadType.PDF, - SubjectId = sv.SubjectId, - TrialId = sv.TrialId, - ClinicalLevel = ClinicalLevel.Subject, - Path = relativePath, - FileName = fileRealName - }); - return serverFilePath; - }); - await _repository.SaveChangesAsync(); - return ResponseOutput.Ok(); - - } - - /// - /// 上传临床数据模板 - /// - /// - /// - [HttpPost("ClinicalData/UploadClinicalTemplate")] - [DisableRequestSizeLimit] - [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })] - - - public async Task>> UploadClinicalTemplate(Guid? trialId) - { - if (trialId == null) - trialId = default(Guid); - - var filerelativePath = string.Empty; - List fileDtos = new List(); - await FileUploadAsync(async (fileName) => - { - var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalTemplatePath(_hostEnvironment, fileName, trialId.Value); - //插入临床pdf 路径 - filerelativePath = relativePath; - - fileDtos.Add(new FileDto() - { - FileName = fileName, - Path = relativePath - - }); - await Task.CompletedTask; - return serverFilePath; - }); - - return ResponseOutput.Ok(fileDtos); - } - - - - /// - /// 上传阅片临床数据 - /// - /// - /// - /// - /// - [HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")] - [DisableRequestSizeLimit] - [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - - public async Task>> UploadReadClinicalData(Guid trialId, Guid subjectId, Guid readingId) - { - var filerelativePath = string.Empty; - List fileDtos = new List(); - - var siteid = await _repository.Where(x => x.Id == subjectId).Select(x => x.SiteId).FirstOrDefaultAsync(); - - await FileUploadAsync(async (fileName) => - { - var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId); - //插入临床pdf 路径 - filerelativePath = relativePath; - - fileDtos.Add(new FileDto() - { - FileName = fileName, - Path = relativePath - - }); - await Task.CompletedTask; - return serverFilePath; - }); - - return ResponseOutput.Ok(fileDtos); - - } - - - /// - /// 上传截图 - /// - /// - /// - [HttpPost("Printscreen/UploadPrintscreen/{subjectId:guid}")] - [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - public async Task> UploadPrintscreen(Guid subjectId) - { - - var subjectInfo = await this._repository.Where(x => x.Id == subjectId).FirstNotNullAsync(); - - FileDto fileDto = new FileDto(); - await FileUploadAsync(async (fileName) => - { - var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetUploadPrintscreenFilePath(_hostEnvironment, fileName, subjectInfo.TrialId, subjectInfo.SiteId, subjectInfo.Id); - fileDto.Path = relativePath; - fileDto.FileName = fileName; - await Task.CompletedTask; - return serverFilePath; - }); - - - return ResponseOutput.Ok(fileDto); - } - - - /// - /// 上传Reading问题的图像 - /// - /// - /// - /// - [HttpPost("VisitTask/UploadReadingAnswerImage/{trialId:guid}/{visitTaskId:guid}")] - [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - public async Task> UploadReadingAnswerImage(Guid trialId, Guid visitTaskId) - { - - FileDto fileDto = new FileDto(); - await FileUploadAsync(async (fileName) => - { - var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask); - fileDto.Path = relativePath; - fileDto.FileName = fileName; - await Task.CompletedTask; - return serverFilePath; - }); - - - return ResponseOutput.Ok(fileDto); - } - - /// - /// 上传裁判任务的图像 - /// - /// - /// - /// - [HttpPost("VisitTask/UploadJudgeTaskImage/{trialId:guid}/{visitTaskId:guid}")] - [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - public async Task> UploadJudgeTaskImage(Guid trialId, Guid visitTaskId) - { - - FileDto fileDto = new FileDto(); - await FileUploadAsync(async (fileName) => - { - var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask); - fileDto.Path = relativePath; - fileDto.FileName = fileName; - - await Task.CompletedTask; - - return serverFilePath; - }); - - return ResponseOutput.Ok(fileDto); - } - - - - /// - /// 上传医学审核图片 - /// - /// - /// - /// - [HttpPost("TaskMedicalReview/UploadMedicalReviewImage/{trialId:guid}/{taskMedicalReviewId:guid}")] - [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - public async Task> UploadMedicalReviewImage(Guid trialId, Guid taskMedicalReviewId) - { - string path = string.Empty; - FileDto fileDto = new FileDto(); - await FileUploadAsync(async (fileName) => - { - - var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetMedicalReviewImage(_hostEnvironment, fileName, trialId, taskMedicalReviewId); - - - //await _repository.UpdatePartialFromQueryAsync(x => x.Id == taskMedicalReviewId, x => new TaskMedicalReview() - //{ - // ImagePath = relativePath, - // FileName = fileName, - //}); - - path = relativePath; - fileDto.Path = relativePath; - fileDto.FileName = fileName; - return serverFilePath; - }); - - await _repository.SaveChangesAsync(); - return ResponseOutput.Ok(fileDto); - } - - - - public class UploadNoneDicomFileCommand - { - public Guid TrialId { get; set; } - public Guid SubjectVisitId { get; set; } - public Guid NoneDicomStudyId { get; set; } - public Guid StudyMonitorId { get; set; } - - - public List UploadedFileList { get; set; } = new List(); - - - public class OSSFileDTO - { - public string FilePath { get; set; } - public string FileName { get; set; } - public int FileFize { get; set; } - } - } - - /// - /// 上传非Dicom 文件 支持压缩包 多文件上传 - /// - /// - /// + ///// + ///// 上传临床数据 多文件 + ///// + ///// + ///// + //[HttpPost("ClinicalData/UploadVisitClinicalData/{trialId:guid}/{subjectVisitId:guid}")] //[DisableRequestSizeLimit] - [HttpPost("NoneDicomStudy/UploadNoneDicomFile")] - [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - //[Authorize(Policy = IRaCISPolicy.CRC)] - public async Task UploadNoneDicomFile(UploadNoneDicomFileCommand incommand, - [FromServices] IRepository _noneDicomStudyRepository, [FromServices] IRepository _studyMonitorRepository) - { + ////[Authorize(Policy = IRaCISPolicy.CRC)] + //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] - var subjectVisitId = incommand.SubjectVisitId; - var studyMonitorId = incommand.StudyMonitorId; - var noneDicomStudyId = incommand.NoneDicomStudyId; + //public async Task UploadVisitClinicalData(Guid subjectVisitId) + //{ + // await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId); + // var sv = _repository.Where(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefault().IfNullThrowException(); + + // await FileUploadAsync(async (fileName) => + // { + // var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId, sv.SiteId, sv.SubjectId, subjectVisitId); + // //插入临床pdf 路径 + // await _repository.AddAsync(new PreviousPDF() + // { + // SubjectVisitId = subjectVisitId, + + // IsVisist = true, + // DataType = ClinicalDataType.MedicalHistory, + // UploadType = ClinicalUploadType.PDF, + // SubjectId = sv.SubjectId, + // TrialId = sv.TrialId, + // ClinicalLevel = ClinicalLevel.Subject, + // Path = relativePath, + // FileName = fileRealName + // }); + // return serverFilePath; + // }); + // await _repository.SaveChangesAsync(); + // return ResponseOutput.Ok(); + + //} + + ///// + ///// 上传临床数据模板 + ///// + ///// + ///// + //[HttpPost("ClinicalData/UploadClinicalTemplate")] + //[DisableRequestSizeLimit] + //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })] - await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId); + //public async Task>> UploadClinicalTemplate(Guid? trialId) + //{ + // if (trialId == null) + // trialId = default(Guid); - var sv = (await _repository.Where(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefaultAsync()).IfNullThrowConvertException(); + // var filerelativePath = string.Empty; + // List fileDtos = new List(); + // await FileUploadAsync(async (fileName) => + // { + // var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalTemplatePath(_hostEnvironment, fileName, trialId.Value); + // //插入临床pdf 路径 + // filerelativePath = relativePath; - var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == studyMonitorId); + // fileDtos.Add(new FileDto() + // { + // FileName = fileName, + // Path = relativePath - studyMonitor.UploadFinishedTime = DateTime.Now; + // }); + // await Task.CompletedTask; + // return serverFilePath; + // }); - foreach (var item in incommand.UploadedFileList) - { - await _repository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, NoneDicomStudyId = noneDicomStudyId }); - - } - var uploadFinishedTime = DateTime.Now; - - var noneDicomStudy = await _noneDicomStudyRepository.FirstOrDefaultAsync((t => t.Id == noneDicomStudyId)); - - noneDicomStudy.FileCount = noneDicomStudy.FileCount + incommand.UploadedFileList.Count; - - studyMonitor.FileCount = incommand.UploadedFileList.Count; - studyMonitor.FileSize = incommand.UploadedFileList.Sum(t => t.FileFize); - studyMonitor.IsDicom = false; - studyMonitor.IsDicomReUpload = false; - studyMonitor.StudyId = noneDicomStudyId; - studyMonitor.StudyCode = noneDicomStudy.StudyCode; - studyMonitor.ArchiveFinishedTime = DateTime.Now; - studyMonitor.IP = _userInfo.IP; - - await _repository.SaveChangesAsync(); - - return ResponseOutput.Ok(); - } + // return ResponseOutput.Ok(fileDtos); + //} + ///// + ///// 上传阅片临床数据 + ///// + ///// + ///// + ///// + ///// + //[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")] + //[DisableRequestSizeLimit] + //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + + //public async Task>> UploadReadClinicalData(Guid trialId, Guid subjectId, Guid readingId) + //{ + // var filerelativePath = string.Empty; + // List fileDtos = new List(); + + // var siteid = await _repository.Where(x => x.Id == subjectId).Select(x => x.SiteId).FirstOrDefaultAsync(); + + // await FileUploadAsync(async (fileName) => + // { + // var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId); + // //插入临床pdf 路径 + // filerelativePath = relativePath; + + // fileDtos.Add(new FileDto() + // { + // FileName = fileName, + // Path = relativePath + + // }); + // await Task.CompletedTask; + // return serverFilePath; + // }); + + // return ResponseOutput.Ok(fileDtos); + + //} + + + ///// + ///// 上传截图 + ///// + ///// + ///// + //[HttpPost("Printscreen/UploadPrintscreen/{subjectId:guid}")] + //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + //public async Task> UploadPrintscreen(Guid subjectId) + //{ + + // var subjectInfo = await this._repository.Where(x => x.Id == subjectId).FirstNotNullAsync(); + + // FileDto fileDto = new FileDto(); + // await FileUploadAsync(async (fileName) => + // { + // var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetUploadPrintscreenFilePath(_hostEnvironment, fileName, subjectInfo.TrialId, subjectInfo.SiteId, subjectInfo.Id); + // fileDto.Path = relativePath; + // fileDto.FileName = fileName; + // await Task.CompletedTask; + // return serverFilePath; + // }); + + + // return ResponseOutput.Ok(fileDto); + //} + + + ///// + ///// 上传Reading问题的图像 + ///// + ///// + ///// + ///// + //[HttpPost("VisitTask/UploadReadingAnswerImage/{trialId:guid}/{visitTaskId:guid}")] + //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + //public async Task> UploadReadingAnswerImage(Guid trialId, Guid visitTaskId) + //{ + + // FileDto fileDto = new FileDto(); + // await FileUploadAsync(async (fileName) => + // { + // var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask); + // fileDto.Path = relativePath; + // fileDto.FileName = fileName; + // await Task.CompletedTask; + // return serverFilePath; + // }); + + + // return ResponseOutput.Ok(fileDto); + //} + + ///// + ///// 上传裁判任务的图像 + ///// + ///// + ///// + ///// + //[HttpPost("VisitTask/UploadJudgeTaskImage/{trialId:guid}/{visitTaskId:guid}")] + //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + //public async Task> UploadJudgeTaskImage(Guid trialId, Guid visitTaskId) + //{ + + // FileDto fileDto = new FileDto(); + // await FileUploadAsync(async (fileName) => + // { + // var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask); + // fileDto.Path = relativePath; + // fileDto.FileName = fileName; + + // await Task.CompletedTask; + + // return serverFilePath; + // }); + + // return ResponseOutput.Ok(fileDto); + //} + + + + ///// + ///// 上传医学审核图片 + ///// + ///// + ///// + ///// + //[HttpPost("TaskMedicalReview/UploadMedicalReviewImage/{trialId:guid}/{taskMedicalReviewId:guid}")] + //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + //public async Task> UploadMedicalReviewImage(Guid trialId, Guid taskMedicalReviewId) + //{ + // string path = string.Empty; + // FileDto fileDto = new FileDto(); + // await FileUploadAsync(async (fileName) => + // { + + // var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetMedicalReviewImage(_hostEnvironment, fileName, trialId, taskMedicalReviewId); + + + // //await _repository.UpdatePartialFromQueryAsync(x => x.Id == taskMedicalReviewId, x => new TaskMedicalReview() + // //{ + // // ImagePath = relativePath, + // // FileName = fileName, + // //}); + + // path = relativePath; + // fileDto.Path = relativePath; + // fileDto.FileName = fileName; + // return serverFilePath; + // }); + + // await _repository.SaveChangesAsync(); + // return ResponseOutput.Ok(fileDto); + //} + + + + //public class UploadNoneDicomFileCommand + //{ + // public Guid TrialId { get; set; } + // public Guid SubjectVisitId { get; set; } + // public Guid NoneDicomStudyId { get; set; } + // public Guid StudyMonitorId { get; set; } + + + // public List UploadedFileList { get; set; } = new List(); + + + // public class OSSFileDTO + // { + // public string FilePath { get; set; } + // public string FileName { get; set; } + // public int FileFize { get; set; } + // } + //} + + ///// + ///// 上传非Dicom 文件 支持压缩包 多文件上传 + ///// + ///// + ///// + ////[DisableRequestSizeLimit] + //[HttpPost("NoneDicomStudy/UploadNoneDicomFile")] + //[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + ////[Authorize(Policy = IRaCISPolicy.CRC)] + //public async Task UploadNoneDicomFile(UploadNoneDicomFileCommand incommand, + // [FromServices] IRepository _noneDicomStudyRepository, [FromServices] IRepository _studyMonitorRepository) + //{ + + // var subjectVisitId = incommand.SubjectVisitId; + // var studyMonitorId = incommand.StudyMonitorId; + // var noneDicomStudyId = incommand.NoneDicomStudyId; + + + // await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId); + + // var sv = (await _repository.Where(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefaultAsync()).IfNullThrowConvertException(); + + // var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == studyMonitorId); + + // studyMonitor.UploadFinishedTime = DateTime.Now; + + // foreach (var item in incommand.UploadedFileList) + // { + // await _repository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, NoneDicomStudyId = noneDicomStudyId }); + + // } + // var uploadFinishedTime = DateTime.Now; + + // var noneDicomStudy = await _noneDicomStudyRepository.FirstOrDefaultAsync((t => t.Id == noneDicomStudyId)); + + // noneDicomStudy.FileCount = noneDicomStudy.FileCount + incommand.UploadedFileList.Count; + + // studyMonitor.FileCount = incommand.UploadedFileList.Count; + // studyMonitor.FileSize = incommand.UploadedFileList.Sum(t => t.FileFize); + // studyMonitor.IsDicom = false; + // studyMonitor.IsDicomReUpload = false; + // studyMonitor.StudyId = noneDicomStudyId; + // studyMonitor.StudyCode = noneDicomStudy.StudyCode; + // studyMonitor.ArchiveFinishedTime = DateTime.Now; + // studyMonitor.IP = _userInfo.IP; + + // await _repository.SaveChangesAsync(); + + // return ResponseOutput.Ok(); + //} + + #endregion + /// /// 一致性核查 excel上传 支持三种格式 @@ -1126,105 +1128,121 @@ namespace IRaCIS.Core.API.Controllers } + #region 废弃 - /// 缩略图 - [AllowAnonymous] - [HttpGet("Common/LocalFilePreview")] - public async Task LocalFilePreview(string relativePath) - { + ///// 缩略图 + //[AllowAnonymous] + //[HttpGet("Common/LocalFilePreview")] + //public async Task LocalFilePreview(string relativePath) + //{ - var _fileStorePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, relativePath); + // var _fileStorePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, relativePath); - var storePreviewPath = _fileStorePath + ".preview.jpeg"; + // var storePreviewPath = _fileStorePath + ".preview.jpeg"; - if (!System.IO.File.Exists(storePreviewPath)) - { - ImageHelper.ResizeSave(_fileStorePath, storePreviewPath); - } + // if (!System.IO.File.Exists(storePreviewPath)) + // { + // ImageHelper.ResizeSave(_fileStorePath, storePreviewPath); + // } - return new FileContentResult(await System.IO.File.ReadAllBytesAsync(storePreviewPath), "image/jpeg"); + // return new FileContentResult(await System.IO.File.ReadAllBytesAsync(storePreviewPath), "image/jpeg"); - } + //} - /// 通用文件下载 - [AllowAnonymous] - [HttpGet("CommonDocument/DownloadCommonDoc")] - public async Task DownloadCommonFile(string code, [FromServices] IRepository _commonDocumentRepository) - { - var (filePath, fileName) = await FileStoreHelper.GetCommonDocPhysicalFilePathAsync(_hostEnvironment, _commonDocumentRepository, code); + ///// 通用文件下载 + //[AllowAnonymous] + //[HttpGet("CommonDocument/DownloadCommonDoc")] + //public async Task DownloadCommonFile(string code, [FromServices] IRepository _commonDocumentRepository) + //{ + // var (filePath, fileName) = await FileStoreHelper.GetCommonDocPhysicalFilePathAsync(_hostEnvironment, _commonDocumentRepository, code); - new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType); + // new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType); - return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName); + // return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName); - } + //} - /// - /// 下载项目临床数据文件 - /// - /// - /// - /// - [AllowAnonymous] - [HttpGet("CommonDocument/DownloadTrialClinicalFile")] - public async Task DownloadTrialClinicalFile(Guid clinicalDataTrialSetId, [FromServices] IRepository _clinicalDataTrialSetRepository) - { - var (filePath, fileName) = await FileStoreHelper.GetTrialClinicalPathAsync(_hostEnvironment, _clinicalDataTrialSetRepository, clinicalDataTrialSetId); + ///// + ///// 下载项目临床数据文件 + ///// + ///// + ///// + ///// + //[AllowAnonymous] + //[HttpGet("CommonDocument/DownloadTrialClinicalFile")] + //public async Task DownloadTrialClinicalFile(Guid clinicalDataTrialSetId, [FromServices] IRepository _clinicalDataTrialSetRepository) + //{ + // var (filePath, fileName) = await FileStoreHelper.GetTrialClinicalPathAsync(_hostEnvironment, _clinicalDataTrialSetRepository, clinicalDataTrialSetId); - new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType); + // new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType); - return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName); + // return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName); - } + //} - /// - /// 下载系统临床数据文件 - /// - /// - /// - /// - [AllowAnonymous] - [HttpGet("CommonDocument/DownloadSystemClinicalFile")] - public async Task DownloadSystemClinicalFile(Guid clinicalDataSystemSetId, [FromServices] IRepository _clinicalDataSystemSetRepository) - { - var (filePath, fileName) = await FileStoreHelper.GetSystemClinicalPathAsync(_hostEnvironment, _clinicalDataSystemSetRepository, clinicalDataSystemSetId); + ///// + ///// 下载系统临床数据文件 + ///// + ///// + ///// + ///// + //[AllowAnonymous] + //[HttpGet("CommonDocument/DownloadSystemClinicalFile")] + //public async Task DownloadSystemClinicalFile(Guid clinicalDataSystemSetId, [FromServices] IRepository _clinicalDataSystemSetRepository) + //{ + // var (filePath, fileName) = await FileStoreHelper.GetSystemClinicalPathAsync(_hostEnvironment, _clinicalDataSystemSetRepository, clinicalDataSystemSetId); - new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType); + // new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType); - return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName); + // return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName); - } + //} - /// - ///上传项目签名文档 - /// - /// - /// - [HttpPost("TrialDocument/UploadTrialDoc/{trialId:guid}")] - [DisableRequestSizeLimit] - [DisableFormValueModelBinding] - public async Task UploadTrialDoc(Guid trialId) - { + ///// + /////上传项目签名文档 + ///// + ///// + ///// + //[HttpPost("TrialDocument/UploadTrialDoc/{trialId:guid}")] + //[DisableRequestSizeLimit] + //[DisableFormValueModelBinding] + //public async Task UploadTrialDoc(Guid trialId) + //{ - return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetTrialSignDocPath(_hostEnvironment, trialId, fileName)); + // return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetTrialSignDocPath(_hostEnvironment, trialId, fileName)); - } + //} - /// - /// 上传系统签名文档 - /// - /// - [HttpPost("TrialDocument/UploadSystemDoc")] - [DisableRequestSizeLimit] - [DisableFormValueModelBinding] - public async Task UploadSysTemDoc() - { + ///// + ///// 上传系统签名文档 + ///// + ///// + //[HttpPost("TrialDocument/UploadSystemDoc")] + //[DisableRequestSizeLimit] + //[DisableFormValueModelBinding] + //public async Task UploadSysTemDoc() + //{ - return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemSignDocPath(_hostEnvironment, fileName)); + // return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemSignDocPath(_hostEnvironment, fileName)); + + //} + ///// + ///// 上传系统通知文档 + ///// + ///// + //[HttpPost("SystemNotice/UploadSystemNoticeDoc")] + //[DisableRequestSizeLimit] + //[DisableFormValueModelBinding] + //public async Task UploadSystemNoticeDoc() + //{ + + // return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemNoticePath(_hostEnvironment, fileName)); + + //} + #endregion - } /// @@ -1236,25 +1254,63 @@ namespace IRaCIS.Core.API.Controllers [DisableFormValueModelBinding] public async Task UploadCommonDoc() { - return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetCommonDocPath(_hostEnvironment, fileName)); } + + + public enum UploadFileType + { + DataUpload=1, + + DataDownload=2, + + EmailAttachment=3, + + EmailBodyHtml=4, + } + /// - /// 上传系统通知文档 + /// 数据上传、导出、 邮件附件 、邮件Html 通过 ----new /// /// - [HttpPost("SystemNotice/UploadSystemNoticeDoc")] + [HttpPost("SystemFile/Upload")] [DisableRequestSizeLimit] [DisableFormValueModelBinding] - public async Task UploadSystemNoticeDoc() + public async Task Upload(UploadFileType fileType) { + IResponseOutput result = null; - return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemNoticePath(_hostEnvironment, fileName)); + switch (fileType) + { + case UploadFileType.DataUpload: + result= await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.DataTemplate,fileName)); + + break; + case UploadFileType.DataDownload: + result= await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.DataTemplate,fileName)); + + break; + case UploadFileType.EmailAttachment: + result = await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.DataTemplate, fileName)); + + break; + + case UploadFileType.EmailBodyHtml: + result = await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.EmailHtmlTemplate, fileName)); + break; + + default: + break; + } + + return result; } + + } #endregion diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index 171f527da..74b76b158 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -72,6 +72,9 @@ + + + diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 430c4af5f..e5067df29 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -212,67 +212,6 @@ Dicom 归档 - - - 上传临床数据 多文件 - - - - - - - 上传临床数据模板 - - - - - - - 上传阅片临床数据 - - - - - - - - - 上传截图 - - - - - - - 上传Reading问题的图像 - - - - - - - - 上传裁判任务的图像 - - - - - - - - 上传医学审核图片 - - - - - - - - 上传非Dicom 文件 支持压缩包 多文件上传 - - - - 一致性核查 excel上传 支持三种格式 @@ -299,50 +238,15 @@ 文件类型 - - 缩略图 - - - 通用文件下载 - - - - 下载项目临床数据文件 - - - - - - - - 下载系统临床数据文件 - - - - - - - - 上传项目签名文档 - - - - - - - 上传系统签名文档 - - - 上传通用文档 比如一致性核查的 比如导出的excel 模板 - + - 上传系统通知文档 + 数据上传、导出、 邮件附件 、邮件Html 通过 ----new diff --git a/IRaCIS.Core.API/Startup.cs b/IRaCIS.Core.API/Startup.cs index 886e443fc..3300796eb 100644 --- a/IRaCIS.Core.API/Startup.cs +++ b/IRaCIS.Core.API/Startup.cs @@ -114,7 +114,8 @@ namespace IRaCIS.Core.API //services.AddDistributedMemoryCache(); // hangfire ʱ н棬Ѻ~ - //services.AddhangfireSetup(_configuration); + services.AddhangfireSetup(_configuration); + // QuartZ ʱ ʹhangfire ʱãҪԴ򿪣Ѿ services.AddQuartZSetup(_configuration); @@ -181,7 +182,7 @@ namespace IRaCIS.Core.API app.UseLogDashboard("/LogDashboard"); //hangfire - //app.UseHangfireConfig(env); + app.UseHangfireConfig(env); ////ʱ //app.UseHttpReports(); diff --git a/IRaCIS.Core.API/_PipelineExtensions/LogDashboard/LogDashBoardAuthFilter.cs b/IRaCIS.Core.API/_PipelineExtensions/Dashboard/LogDashBoardAuthFilter.cs similarity index 100% rename from IRaCIS.Core.API/_PipelineExtensions/LogDashboard/LogDashBoardAuthFilter.cs rename to IRaCIS.Core.API/_PipelineExtensions/Dashboard/LogDashBoardAuthFilter.cs diff --git a/IRaCIS.Core.API/_PipelineExtensions/Dashboard/hangfireAuthorizationFilter.cs b/IRaCIS.Core.API/_PipelineExtensions/Dashboard/hangfireAuthorizationFilter.cs new file mode 100644 index 000000000..3dc3a3bb1 --- /dev/null +++ b/IRaCIS.Core.API/_PipelineExtensions/Dashboard/hangfireAuthorizationFilter.cs @@ -0,0 +1,17 @@ +using Hangfire.Dashboard; + +namespace IRaCIS.Core.API.Filter +{ + public class hangfireAuthorizationFilter : IDashboardAuthorizationFilter + { + public bool Authorize(DashboardContext context) + { + var httpContext = context.GetHttpContext(); + + // Allow all authenticated users to see the Dashboard (potentially dangerous). + //return httpContext.User.Identity.IsAuthenticated; + + return true; + } + } +} diff --git a/IRaCIS.Core.API/_PipelineExtensions/HangfireConfig.cs b/IRaCIS.Core.API/_PipelineExtensions/HangfireConfig.cs new file mode 100644 index 000000000..f0834570d --- /dev/null +++ b/IRaCIS.Core.API/_PipelineExtensions/HangfireConfig.cs @@ -0,0 +1,60 @@ +using Hangfire; +using Hangfire.Dashboard; +using Hangfire.Dashboard.BasicAuthorization; +using IRaCIS.Application.Services.BackGroundJob; +using IRaCIS.Core.API.Filter; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; + +namespace IRaCIS.Core.API +{ + + + public static class HangfireConfig + { + + public static void UseHangfireConfig(this IApplicationBuilder app, IWebHostEnvironment env) + { + + + app.UseHangfireDashboard("/api/hangfire", new DashboardOptions() + { + //直接访问,没有带token 获取不到用户身份信息,所以这种自定义授权暂时没法使用 + //Authorization = new[] { new hangfireAuthorizationFilter() } + + //本地请求 才能看 + //Authorization = new[] { new LocalRequestsOnlyAuthorizationFilter() } + + Authorization = new BasicAuthAuthorizationFilter[] { + new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions(){ + SslRedirect=false, + RequireSsl=false, + Users=new BasicAuthAuthorizationUser[]{ + new BasicAuthAuthorizationUser(){ + Login="admin", + PasswordClear="test", + + } + } + + }) + } + + }); + + #region hangfire + + //// 延迟任务执行 1秒之后执行 有时启动没运行 换成添加到队列中 + //BackgroundJob.Schedule(t => t.MemoryCacheTrialStatus(), TimeSpan.FromSeconds(1)); + ////添加到后台任务队列, + //BackgroundJob.Enqueue(t => t.MemoryCacheTrialStatus()); + + //周期性任务,1天执行一次 + + //RecurringJob.AddOrUpdate(t => t.ProjectStartCache(), Cron.Daily); + + #endregion + + } + } +} \ No newline at end of file diff --git a/IRaCIS.Core.API/_ServiceExtensions/LogDashboardSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/LogDashboardSetup.cs index 4042dfefe..cf067db5f 100644 --- a/IRaCIS.Core.API/_ServiceExtensions/LogDashboardSetup.cs +++ b/IRaCIS.Core.API/_ServiceExtensions/LogDashboardSetup.cs @@ -19,6 +19,8 @@ namespace IRaCIS.Core.API //opt.AddAuthorizationFilter(new LogDashBoardAuthFilter()); + + }); } diff --git a/IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs new file mode 100644 index 000000000..b3b02c3f9 --- /dev/null +++ b/IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs @@ -0,0 +1,40 @@ +using Hangfire; +using Hangfire.SqlServer; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using System; + +namespace IRaCIS.Core.API +{ + public static class hangfireSetup + { + public static void AddhangfireSetup(this IServiceCollection services, IConfiguration configuration) + { + var hangFireConnStr = configuration.GetSection("ConnectionStrings:Hangfire").Value; + + services.AddHangfire(hangFireConfig => + { + + //hangFireConfig.UseInMemoryStorage(); + + //指定存储介质 + hangFireConfig.UseSqlServerStorage(hangFireConnStr, new SqlServerStorageOptions() + { + SchemaName = "hangfire", + CommandBatchMaxTimeout = TimeSpan.FromMinutes(5), + SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5), + QueuePollInterval = TimeSpan.Zero, + UseRecommendedIsolationLevel = true, + DisableGlobalLocks = true + }); + + //hangFireConfig.UseTagsWithSql(); //nuget引入Hangfire.Tags.SqlServer + //.UseHangfireHttpJob(); + + }); + + services.AddHangfireServer(); + + } + } +} diff --git a/IRaCIS.Core.API/appsettings.Test_Study.json b/IRaCIS.Core.API/appsettings.Test_Study.json index 9e82384b7..0e06899ff 100644 --- a/IRaCIS.Core.API/appsettings.Test_Study.json +++ b/IRaCIS.Core.API/appsettings.Test_Study.json @@ -7,7 +7,8 @@ } }, "ConnectionStrings": { - "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" + "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true", + "Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study.hangfire;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" }, "BasicSystemConfig": { diff --git a/IRaCIS.Core.API/appsettings.Uat_Study.json b/IRaCIS.Core.API/appsettings.Uat_Study.json index ba0d344bc..e3d31bacb 100644 --- a/IRaCIS.Core.API/appsettings.Uat_Study.json +++ b/IRaCIS.Core.API/appsettings.Uat_Study.json @@ -7,7 +7,8 @@ } }, "ConnectionStrings": { - "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" + "RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true", + "Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study.hangfire;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" }, "BasicSystemConfig": { diff --git a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs index cd9090ffb..68bb2b970 100644 --- a/IRaCIS.Core.Application/Helper/FileStoreHelper.cs +++ b/IRaCIS.Core.Application/Helper/FileStoreHelper.cs @@ -227,6 +227,28 @@ public static class FileStoreHelper return (serverFilePath, relativePath); } + + public static (string PhysicalPath, string RelativePath) GetSystemFileUploadPath(IWebHostEnvironment _hostEnvironment, string templateFolderName, string fileName) + { + var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); + + //文件类型路径处理 + var uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.SystemDataFolder, templateFolderName); + if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); + + + var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName); + + + var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.SystemDataFolder}/{templateFolderName}/{trustedFileNameForFileStorage}"; + + var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); + + return (serverFilePath, relativePath); + } + + + // 获取通用文档存放路径(excel模板 ) public static (string PhysicalPath, string RelativePath) GetCommonDocPath(IWebHostEnvironment _hostEnvironment, string fileName) diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 84dde1322..83a311319 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -705,6 +705,9 @@ namespace IRaCIS.Core.Application.Contracts throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许操作"); } + + + var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId) .Where(t => !(t.IsHistoryUser && t.IsHistoryUserDeleted == true)) .Select(t => @@ -719,19 +722,25 @@ namespace IRaCIS.Core.Application.Contracts 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("本次提交,生成账号必须要有CRC和SR"); + } + + if(currentUserList.GroupBy(t=>new {t.UserTypeId,t.Email}) + .Any(g => g.Count() > 1)) + { + throw new BusinessValidationFailedException("同一邮箱同一用户类型,生成账号的数据只允许存在一条!"); + } + + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined) { - 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("本次提交,生成账号必须要有CRC和SR"); - } - await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved }); diff --git a/IRaCIS.Core.Domain/_Config/_StaticData.cs b/IRaCIS.Core.Domain/_Config/_StaticData.cs index 68298ec64..b95189eae 100644 --- a/IRaCIS.Core.Domain/_Config/_StaticData.cs +++ b/IRaCIS.Core.Domain/_Config/_StaticData.cs @@ -88,6 +88,8 @@ public static class StaticData public static readonly string DataTemplate = "DataTemplate"; + public static readonly string EmailHtmlTemplate = "EmailHtml"; + public static readonly string NoticeAttachment = "NoticeAttachment"; public static readonly string DicomFolder = "Dicom";