diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index d848555a1..aa9be20bd 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -19588,6 +19588,20 @@ + + + 调研表基本信息 + + + + + + + SPM 是否参与流程 + + + + TrialSiteUserSurveyService diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs index 842444f73..c653b9082 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs @@ -488,19 +488,27 @@ namespace IRaCIS.Core.Application.Contracts public string TrialSiteAliasName { get; set; } = String.Empty; } - public class SiteSurveyEquipmentQuery + public class SiteSurveyEquipmentQuery : PageInput { [NotDefault] public Guid TrialId { get; set; } + + public Guid? TrialSiteId { get; set; } public string? TrialSiteCode { get; set; } public string? TrialSiteName { get; set; } } - public class SiteSurveyInfoQuery + public class SiteSurveyInfoQuery : PageInput { [NotDefault] public Guid TrialId { get; set; } + + public Guid? TrialSiteId { get; set; } + + public string? TrialSiteCode { get; set; } + + public string? TrialSiteName { get; set; } } public class SiteSurveyInfoDto diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index deeb0691f..512f01876 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -1190,12 +1190,19 @@ namespace IRaCIS.Core.Application.Contracts var queitUserTypeIdList = needQuitUserList.Select(t => t.UserTypeId).ToList(); - - await _trialSiteUserRoleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId && queitUserTypeIdList.Contains(t.UserRole.UserTypeId), c => new TrialSiteUserRole() + foreach (var item in needQuitUserList) { - IsDeleted = true, - DeletedTime = DateTime.Now, - }); + await _trialSiteUserRoleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId + && t.UserRole.UserTypeId == item.UserTypeId + && t.UserRole.IdentityUserId == item.SystemUserId, c => new TrialSiteUserRole() + { + IsDeleted = true, + DeletedTime = DateTime.Now, + }); + } + + + await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.UserRoleId, ReviewerTime = DateTime.Now }); @@ -1458,17 +1465,18 @@ namespace IRaCIS.Core.Application.Contracts [HttpPost] public async Task GetSiteSurveyEquipmentList(SiteSurveyEquipmentQuery inQuery) { - var list = _trialSiteEquipmentSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == inQuery.TrialId) + var pageList = await _trialSiteEquipmentSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == inQuery.TrialId) + .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteSurvey.TrialSiteId==inQuery.TrialSiteId) .WhereIf(inQuery.TrialSiteCode.IsNotNullOrEmpty(), t => t.TrialSiteSurvey.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode)) .WhereIf(inQuery.TrialSiteName.IsNotNullOrEmpty(), t => t.TrialSiteSurvey.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteName) || t.TrialSiteSurvey.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteName)) - .ProjectTo(_mapper.ConfigurationProvider).ToList(); + .ProjectTo(_mapper.ConfigurationProvider).ToPagedListAsync(inQuery); var siteSurveryConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => t.TrialExtraConfigJsonStr).FirstOrDefault() ?? string.Empty; var config = JsonConvert.DeserializeObject(siteSurveryConfig) ?? new TrialExtraConfig(); - return ResponseOutput.Ok(list, config); + return ResponseOutput.Ok(pageList, config); } /// @@ -1479,16 +1487,20 @@ namespace IRaCIS.Core.Application.Contracts [HttpPost] public async Task GetSiteSurveyInfoList(SiteSurveyInfoQuery inQuery) { - var list = _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId) + var pageList = await _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId) + .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) + .WhereIf(inQuery.TrialSiteCode.IsNotNullOrEmpty(), t => t.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode)) + .WhereIf(inQuery.TrialSiteName.IsNotNullOrEmpty(), t => t.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteName) || + t.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteName)) - .ProjectTo(_mapper.ConfigurationProvider).ToList(); + .ProjectTo(_mapper.ConfigurationProvider).ToPagedListAsync(inQuery); var siteSurveryConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => t.TrialExtraConfigJsonStr).FirstOrDefault() ?? string.Empty; var config = JsonConvert.DeserializeObject(siteSurveryConfig) ?? new TrialExtraConfig(); - return ResponseOutput.Ok(list, config); + return ResponseOutput.Ok(pageList, config); } ///