修改拦截

This commit is contained in:
2023-01-05 15:20:36 +08:00
parent 6fcd163988
commit 225cd8c949
17 changed files with 159 additions and 77 deletions
@@ -10,6 +10,7 @@ using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Application.Filter;
namespace IRaCIS.Core.Application.Service
{
@@ -59,6 +60,7 @@ namespace IRaCIS.Core.Application.Service
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AddOrUpdateTaskAllocationRule(TaskAllocationRuleAddOrEdit addOrEditTaskAllocationRule)
{
@@ -87,6 +89,7 @@ namespace IRaCIS.Core.Application.Service
}
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[HttpDelete("{taskAllocationRuleId:guid}")]
public async Task<IResponseOutput> DeleteTaskAllocationRule(Guid taskAllocationRuleId)
@@ -125,6 +125,8 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns>
[HttpPost]
[UnitOfWork]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ConfirmGenerateSelfConsistentTask(ConsistentConfirmGenerateCommand inCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService)
{
@@ -269,6 +271,8 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns>
[HttpPost]
[UnitOfWork]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ConfirmGenerateGroupConsistentTask(GroupConsistentConfirmGenrateCommand inCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService)
{
var trialId = inCommand.TrialId;
@@ -709,6 +713,7 @@ namespace IRaCIS.Core.Application.Service
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AddOrUpdateTaskConsistentRule(TaskConsistentRuleAddOrEdit addOrEditTaskConsistentRule)
{
@@ -730,6 +735,7 @@ namespace IRaCIS.Core.Application.Service
}
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[HttpDelete("{taskConsistentRuleId:guid}")]
public async Task<IResponseOutput> DeleteTaskConsistentRule(Guid taskConsistentRuleId)
@@ -40,6 +40,8 @@ namespace IRaCIS.Core.Application.Service
}
[HttpPost]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AddOrUpdateTaskMedicalReviewRule(TaskMedicalReviewRuleAddOrEdit addOrEditTaskTaskMedicalReviewRule)
{
var verifyExp1 = new EntityVerifyExp<TaskMedicalReviewRule>()
@@ -56,6 +58,8 @@ namespace IRaCIS.Core.Application.Service
[HttpDelete("{taskMedicalReviewRuleId:guid}")]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> DeleteTaskMedicalReviewRule(Guid taskMedicalReviewRuleId)
{
@@ -10,6 +10,7 @@ using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Application.Filter;
namespace IRaCIS.Core.Application.Service
{
@@ -111,6 +112,7 @@ namespace IRaCIS.Core.Application.Service
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ManuallyGeneratedAndAssignedMedicalReview(ManuallyGeneratedAndAssignedMedicalReviewCommand command)
{
@@ -223,6 +225,8 @@ namespace IRaCIS.Core.Application.Service
/// <returns></returns>
[UnitOfWork]
[HttpPost]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AssignMedicalReviewTask(AssignMedicalReviewTaskCommand command)
{
@@ -14,6 +14,7 @@ using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Infra.EFCore.Common;
using System.Linq.Expressions;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Filter;
namespace IRaCIS.Core.Application.Service.Allocation
{
@@ -112,6 +113,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> BatchAssignDoctorToSubject(BatchAssignDoctorToSubjectCommand command)
{
//var inOrder = _trialRepository.Where(t => t.Id == command.TrialId).Select(t => t.IsReadingTaskViewInOrder).FirstOrDefault();
@@ -213,6 +215,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <returns></returns>
/// <exception cref="BusinessValidationFailedException"></exception>
[HttpPost]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> CancelSubjectAssignedDoctor(CancelSubjectDoctorCommand cancelCommand)
{
foreach (var command in cancelCommand.CancelList.Where(t => t.IsCancelAssign))
@@ -252,6 +255,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <returns></returns>
[HttpPost]
[UnitOfWork]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AssignSubjectTaskToDoctor(AssignSubjectTaskToDoctorCommand assignSubjectTaskToDoctorCommand)
{
var visitTask = await _visitTaskRepository.FirstOrDefaultAsync(t => t.Id == assignSubjectTaskToDoctorCommand.Id);
@@ -377,6 +381,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <returns></returns>
[HttpPost]
[UnitOfWork]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AssignSubjectDoctor(AssginSubjectDoctorCommand assginSubjectDoctorCommand)
{
var trialId = assginSubjectDoctorCommand.TrialId;
@@ -453,6 +458,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// </summary>
/// <returns></returns> 数量
[HttpPost]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> CancelSubjectAssignDoctor(CancelSubjectAssignCommand cancelSubjectAssignCommand)
{
if (cancelSubjectAssignCommand.IsJudgeDoctor)
@@ -493,6 +499,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <returns></returns>
[HttpPost]
[UnitOfWork]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ManualAssignDoctorApplyTask(AssignConfirmCommand assignConfirmCommand)
{
var trialId = assignConfirmCommand.TrialId;
@@ -1045,6 +1052,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <returns></returns>
[HttpPost]
[UnitOfWork]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ApplyReReading(ApplyReReadingCommand applyReReadingCommand)
{
@@ -1261,6 +1270,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <returns></returns>
[HttpPost]
[UnitOfWork]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService)
{
@@ -1839,6 +1850,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
/// <returns></returns>
[HttpPut("{trialId:guid}/{taskId:guid}")]
[UnitOfWork]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> PMSetTaskBack(Guid trialId, Guid taskId)
{
@@ -48,6 +48,8 @@ namespace IRaCIS.Core.Application.Contracts
public string RealName { get; set; } = string.Empty;
public Guid UserTypeId { get; set; }
public string UserTypeShortName { get; set; } = string.Empty;
}
@@ -157,6 +157,7 @@ namespace IRaCIS.Core.Application.Services
ConfirmTime = confirm.ConfirmTime,
RealName = user.LastName + " / " + user.FirstName,
UserName = user.UserName,
UserTypeId = user.UserTypeId,
UserTypeShortName = user.UserTypeRole.UserTypeShortName
};
@@ -160,6 +160,7 @@ namespace IRaCIS.Core.Application.Services
ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.User.FullName,
UserName = trialUser.User.UserName,
UserTypeId = trialUser.User.UserTypeId,
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName
};
@@ -190,6 +191,7 @@ namespace IRaCIS.Core.Application.Services
ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.User.FullName,
UserName = trialUser.User.UserName,
UserTypeId = trialUser.User.UserTypeId,
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName
};
@@ -296,6 +298,7 @@ namespace IRaCIS.Core.Application.Services
ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.User.FullName,
UserName = trialUser.User.UserName,
UserTypeId = trialUser.User.UserTypeId,
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName,
FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
@@ -329,6 +332,7 @@ namespace IRaCIS.Core.Application.Services
ConfirmTime = confirm.ConfirmTime,
RealName = trialUser.User.FullName,
UserName = trialUser.User.UserName,
UserTypeId = trialUser.User.UserTypeId,
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName,
FullFilePath = needConfirmEdUserType.SystemDocument.Path
@@ -336,7 +340,8 @@ namespace IRaCIS.Core.Application.Services
var unionQuery = trialDocQuery.Union(systemDocQuery)
.WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name))
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId);
.WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId)
.WhereIf(querySystemDocument.UserTypeId != null, t => t.UserTypeId == querySystemDocument.UserTypeId);
var result = await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
@@ -539,6 +544,7 @@ namespace IRaCIS.Core.Application.Services
/// 用户 签名某个文档 可能是系统的,也可能是项目的
/// </summary>
/// <returns></returns>
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> UserConfirm(UserConfirmCommand userConfirmCommand)
{
@@ -14,6 +14,7 @@ using IRaCIS.Core.Application.Helper;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Filter;
namespace IRaCIS.Core.Application.Service
{
@@ -755,7 +756,7 @@ namespace IRaCIS.Core.Application.Service
return await trialEmailNoticeConfigQueryable.ToListAsync();
}
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AddOrUpdateTrialEmailNoticeConfig(TrialEmailNoticeConfigAddOrEdit addOrEditTrialEmailNoticeConfig)
{
await TestEmailConfigAsync(addOrEditTrialEmailNoticeConfig);
@@ -822,7 +823,6 @@ namespace IRaCIS.Core.Application.Service
}
private async Task TestEmailConfigAsync(TrialEmailNoticeConfigAddOrEdit config)
{
var toUserList = await _repository.Where<TrialUser>(t => t.TrialId == config.TrialId && config.ToUserTypeList.Contains(t.User.UserTypeEnum)).Select(t => new { t.User.EMail, t.User.FullName }).ToListAsync();
@@ -885,7 +885,7 @@ namespace IRaCIS.Core.Application.Service
}
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[HttpDelete("{trialEmailNoticeConfigId:guid}")]
public async Task<IResponseOutput> DeleteTrialEmailNoticeConfig(Guid trialEmailNoticeConfigId)
{
@@ -135,6 +135,7 @@ namespace IRaCIS.Core.Application.Contracts
/// <returns></returns>
[HttpPost("{trialId:guid}")]
[Authorize(Policy = IRaCISPolicy.IQC)]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> BatchAddTrialQCQuestionConfigure(List<TrialQCQuestionConfigureBatchAdd> batchList, Guid trialId)
{
@@ -180,7 +181,7 @@ namespace IRaCIS.Core.Application.Contracts
//遍历父层级的问题
var batchConfigList = _mapper.Map<List<TrialQCQuestion>>(batchList.Where(t => t.ParentId == null));
foreach (var item in batchConfigList.Where(t=>t.ParentId==null).OrderBy(t => t.ShowOrder))
foreach (var item in batchConfigList.Where(t => t.ParentId == null).OrderBy(t => t.ShowOrder))
{
var oldParentId = item.Id;
item.Id = NewId.NextGuid();
@@ -241,6 +242,7 @@ namespace IRaCIS.Core.Application.Contracts
}
[Authorize(Policy = IRaCISPolicy.IQC)]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AddOrUpdateTrialQCQuestionConfigure(TrialQCQuestionAddOrEdit addOrEditTrialQCQuestionConfigure)
{
@@ -264,6 +266,7 @@ namespace IRaCIS.Core.Application.Contracts
[HttpDelete("{trialId:guid}/{trialQCQuestionConfigureId:guid}")]
[Authorize(Policy = IRaCISPolicy.IQC)]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> DeleteTrialQCQuestionConfigure(Guid trialQCQuestionConfigureId, Guid trialId)
{
await VerifyIsQCConfirmedAsync(trialId);
@@ -221,6 +221,7 @@ namespace IRaCIS.Core.Application
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> SetGlobalReadingInfo(SetGlobalReadingInfoInDto inDto)
{
@@ -306,6 +307,7 @@ namespace IRaCIS.Core.Application
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> SetOncologySet(SetOncologySetInDto inDto)
{
@@ -407,12 +409,13 @@ namespace IRaCIS.Core.Application
}
/// <summary>
/// 设置项目阅片标准
/// </summary>
/// <returns></returns>
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> SetTrialReadingCriterion(SetTrialReadingCriterionInDto inDto)
{
if (inDto.IsSignSave)
@@ -448,6 +451,7 @@ namespace IRaCIS.Core.Application
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> SetCriterionReadingInfo(SetCriterionReadingInfoInDto inDto)
{
ArbitrationRule arbitration = ArbitrationRule.NA;
@@ -653,7 +657,7 @@ namespace IRaCIS.Core.Application
/// <returns></returns>
[HttpPut]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ConfigTrialBasicInfo(BasicTrialConfig trialConfig)
{
await VerifyOnlyInOngoingOrInitialIzingOptAsync(trialConfig.TrialId);
@@ -677,7 +681,7 @@ namespace IRaCIS.Core.Application
/// <returns></returns>
[HttpPut]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ConfigTrialProcessInfo(TrialProcessConfig trialConfig)
{
if (!await _trialRepository.Where(t => t.Id == trialConfig.TrialId).IgnoreQueryFilters().AnyAsync(t => t.TrialStatusStr == StaticData.TrialState.TrialInitializing))
@@ -751,6 +755,7 @@ namespace IRaCIS.Core.Application
/// <returns></returns>
[HttpPut]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ConfigTrialUrgentInfo(TrialUrgentConfig trialConfig)
{
@@ -798,6 +803,7 @@ namespace IRaCIS.Core.Application
[HttpPut("{trialId:guid}/{trialStatusStr}/{reason?}")]
[UnitOfWork]
[Authorize(Policy = IRaCISPolicy.PM)]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> UpdateTrialState(Guid trialId, string trialStatusStr, string? reason)
{
@@ -870,6 +876,7 @@ namespace IRaCIS.Core.Application
/// <returns></returns>
[HttpPut("{trialId:guid}/{isAbandon:bool}")]
[Authorize(Policy = IRaCISPolicy.PM)]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AbandonTrial(Guid trialId, /*Guid? signId,*/ bool isAbandon)
{
@@ -905,6 +912,7 @@ namespace IRaCIS.Core.Application
/// <returns></returns>
[HttpPut]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ConfigTrialTaskInfo(TrialTaskConfig trialConfig)
{
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialConfig.TrialId)).IfNullThrowException();
@@ -922,6 +930,7 @@ namespace IRaCIS.Core.Application
/// <returns></returns>
[HttpPut]
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "BeforeOngoingCantOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ConfigTrialReadingTaskViewRule(TrialReadingTaskViewConfig trialConfig)
{
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialConfig.TrialId)).IfNullThrowException();
@@ -90,7 +90,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)
.WhereIf(param.UserTypeId != null, t => t.User.UserTypeId == param.UserTypeId)
.WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), t => (t.User.FullName).Contains(param.UserRealName))
.ProjectTo<AssginSiteCRCListDTO>(_mapper.ConfigurationProvider, new { siteId = param.SiteId });
@@ -110,15 +110,15 @@ namespace IRaCIS.Application.Services
//之前已经选择的用户 不放在列表中,现在又要改回去 废弃
var query = _repository.Where<User>(t => t.UserTypeEnum != UserTypeEnum.SuperAdmin)
//正式或者培训的项目不能允许测试用户
.WhereIf( trialType==TrialType.OfficialTrial||trialType==TrialType.Training, t => t.IsTestUser==false)
//正式或者培训的项目不能允许测试用户
.WhereIf(trialType == TrialType.OfficialTrial || trialType == TrialType.Training, t => t.IsTestUser == false)
.WhereIf(!string.IsNullOrWhiteSpace(trialUserQuery.UserRealName), t => (t.FullName).Contains(trialUserQuery.UserRealName))
.WhereIf(!string.IsNullOrWhiteSpace(trialUserQuery.UserName), t => t.UserName.Contains(trialUserQuery.UserName))
//.WhereIf(!string.IsNullOrWhiteSpace(trialUserQuery.OrganizationName), t => t.OrganizationName.Contains(trialUserQuery.OrganizationName))
//.WhereIf(!string.IsNullOrWhiteSpace(trialUserQuery.OrganizationName), t => t.OrganizationName.Contains(trialUserQuery.OrganizationName))
.WhereIf(trialUserQuery.UserTypeEnum != null, t => t.UserTypeEnum == trialUserQuery.UserTypeEnum)
//.WhereIf(_userInfo.IsAdmin, t => t.UserTypeRole.Type == UserTypeGroup.TrialUser)
//.WhereIf(!_userInfo.IsAdmin, t => t.UserTypeRole.Type == UserTypeGroup.TrialUser || t.UserTypeEnum != UserTypeEnum.ProjectManager)
//.WhereIf(_userInfo.IsAdmin, t => t.UserTypeRole.Type == UserTypeGroup.TrialUser)
//.WhereIf(!_userInfo.IsAdmin, t => t.UserTypeRole.Type == UserTypeGroup.TrialUser || t.UserTypeEnum != UserTypeEnum.ProjectManager)
.ProjectTo<TrialUserScreeningDTO>(_mapper.ConfigurationProvider, new { trialId = trialUserQuery.TrialId });
return await query.ToPagedListAsync(trialUserQuery.PageIndex,
@@ -134,11 +134,11 @@ namespace IRaCIS.Application.Services
/// <returns></returns>
//[TrialAudit(AuditType.TrialAudit, AuditOptType.AddTrialStaff)]
[HttpPost]
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
public async Task<IResponseOutput> AddTrialUsers(TrialUserAddCommand[] userTrialCommands)
{
var addArray = _mapper.Map<TrialUser[]>(userTrialCommands);
var trialUsers = await _trialUseRepository.AddRangeAsync(addArray);
@@ -156,7 +156,7 @@ namespace IRaCIS.Application.Services
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
[HttpPut]
public async Task<IResponseOutput> UpdateTrialUser(UpdateTrialUserCommand updateTrialUserCommand)
@@ -193,7 +193,7 @@ namespace IRaCIS.Application.Services
/// <summary> 项目参与人员退出 其中IQC退出 回去释放工作量 </summary>
//[TrialAudit(AuditType.TrialAudit, AuditOptType.DeleteTrailStaff)]
[HttpDelete, Route("{id:guid}/{trialId:guid}/{isDelete:bool}")]
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[UnitOfWork]
[Obsolete]
public async Task<IResponseOutput> DeleteMaintenanceUser(Guid id, bool isDelete)
@@ -107,7 +107,7 @@ namespace IRaCIS.Core.Application.Services
data.TrialSiteUserList = await query.ToListAsync();
var exportInfo = data;
@@ -115,12 +115,12 @@ namespace IRaCIS.Core.Application.Services
var no = 1;
exportInfo.TrialSiteUserList.ForEach(t => t.No = no++);
return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteUserSummary_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment);
return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteUserSummary_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment);
}
#endregion
@@ -183,7 +183,7 @@ namespace IRaCIS.Core.Application.Services
{
var query = _trialSiteUserRepository.Where(t => t.TrialId == trialId && t.SiteId == siteId).IgnoreQueryFilters()
.ProjectTo<UserTrialDTO>(_mapper.ConfigurationProvider);
return await query.ToListAsync();
}
@@ -215,7 +215,7 @@ namespace IRaCIS.Core.Application.Services
[HttpPost]
[UnitOfWork]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AddTrialSites(List<TrialSiteCommand> trialSites)
{
var addArray = _mapper.Map<List<TrialSite>>(trialSites);
@@ -286,7 +286,7 @@ namespace IRaCIS.Core.Application.Services
/// <summary> 批量添加Site下 CRC的负责人 </summary>
[HttpPost]
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
public async Task<IResponseOutput> AssignSiteCRC(List<AssginSiteCRCCommand> trialSiteCRCList)
{
@@ -300,13 +300,13 @@ namespace IRaCIS.Core.Application.Services
/// <summary> 删除CRC人员</summary>
[HttpDelete, Route("{id:guid}/{trialId:guid}/{isDelete:bool}")]
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
public async Task<IResponseOutput> DeleteSiteCRC(Guid id, bool isDelete)
{
await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t=>t.Id==id, u => new TrialSiteUser(){ IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null },true,true);
await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.Id == id, u => new TrialSiteUser() { IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null }, true, true);
return ResponseOutput.Ok();
}
@@ -330,24 +330,24 @@ namespace IRaCIS.Core.Application.Services
}
public async Task<IEnumerable<string>> GetTrialSiteCodeSelect(Guid trialId,bool isIncludeVirtualSite=true)
public async Task<IEnumerable<string>> GetTrialSiteCodeSelect(Guid trialId, bool isIncludeVirtualSite = true)
{
//CRC只看到他负责的
var list = await _trialSiteRepository.Where(t => t.TrialId == trialId)
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.CRCUserList.Any(t => t.UserId == _userInfo.Id))
.Select(t=> t.TrialSiteCode).ToListAsync();
.Select(t => t.TrialSiteCode).ToListAsync();
var virtualList = await _repository.Where<VisitTask>(t => t.IsSelfAnalysis==true && t.TrialId==trialId).Select(t => t.BlindTrialSiteCode).Distinct().ToListAsync();
var virtualList = await _repository.Where<VisitTask>(t => t.IsSelfAnalysis == true && t.TrialId == trialId).Select(t => t.BlindTrialSiteCode).Distinct().ToListAsync();
return isIncludeVirtualSite? list.Concat(virtualList): list;
return isIncludeVirtualSite ? list.Concat(virtualList) : list;
}
/// <summary>删除 项目 下某一site </summary>
[HttpDelete("{id:guid}/{trialId:guid}")]
[TrialAudit(AuditType.TrialAudit, AuditOptType.DeleteTrialSite)]
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
[Obsolete]
public async Task<IResponseOutput> DeleteTrialSite(Guid id)
{
@@ -74,7 +74,7 @@ namespace IRaCIS.Application.Services
};
}
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> UpdateVisitBlindName(VisitBlindNameCommand command)
{
@@ -105,6 +105,7 @@ namespace IRaCIS.Application.Services
[HttpPost]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> AddOrUpdateVisitStage(VisitPlanCommand visitPlan)
{
@@ -207,6 +208,7 @@ namespace IRaCIS.Application.Services
[HttpPost("{trialId:guid}")]
[Authorize(Policy = IRaCISPolicy.PM_APM)]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt" })]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput> ConfirmTrialVisitPlan(Guid trialId)
{
if (!await _trialRepository.AnyAsync(t => t.Id == trialId && (t.TrialStatusStr == StaticData.TrialState.TrialInitializing || t.TrialStatusStr == StaticData.TrialState.TrialOngoing)))