Merge branch 'Test_IRC_Net8' into Uat_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
5d269b699c
|
@ -275,7 +275,7 @@ namespace IRaCIS.Core.SCP.Service
|
|||
var _distributedLockProvider = _serviceProvider.GetService<IDistributedLockProvider>();
|
||||
|
||||
var storeRelativePath = string.Empty;
|
||||
var ossFolderPath = $"{_trialId}/Image/PACS/{_trialSiteId}{studyInstanceUid}";
|
||||
var ossFolderPath = $"{_trialId}/Image/PACS/{_trialSiteId}/{studyInstanceUid}";
|
||||
|
||||
|
||||
long fileSize = 0;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using Amazon.Auth.AccessControlPolicy;
|
||||
using Amazon.SecurityToken;
|
||||
using AutoMapper;
|
||||
using Azure.Core;
|
||||
using IdentityModel.Client;
|
||||
using IdentityModel.OidcClient;
|
||||
|
@ -105,196 +106,6 @@ namespace IRaCIS.Api.Controllers
|
|||
|
||||
|
||||
|
||||
/// <summary> 系统用户登录接口[New] </summary>
|
||||
[HttpPost, Route("user/login")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> Login(UserLoginDTO loginUser,
|
||||
[FromServices] IFusionCache _fusionCache,
|
||||
[FromServices] IUserService _userService,
|
||||
[FromServices] ITokenService _tokenService,
|
||||
[FromServices] IReadingImageTaskService readingImageTaskService,
|
||||
[FromServices] IOptionsMonitor<ServiceVerifyConfigOption> _verifyConfig,
|
||||
[FromServices] IOptionsMonitor<SystemEmailSendConfig> _emailConfig,
|
||||
|
||||
[FromServices] IMailVerificationService _mailVerificationService)
|
||||
{
|
||||
var emailConfig = _emailConfig.CurrentValue;
|
||||
var companyInfo = new SystemEmailSendConfigView() { CompanyName = emailConfig.CompanyName, CompanyNameCN = emailConfig.CompanyNameCN, CompanyShortName = emailConfig.CompanyShortName, CompanyShortNameCN = emailConfig.CompanyShortNameCN };
|
||||
|
||||
//MFA 邮箱验证 前端传递用户Id 和MFACode
|
||||
if (loginUser.UserId != null && _verifyConfig.CurrentValue.OpenLoginMFA)
|
||||
{
|
||||
Guid userId = (Guid)loginUser.UserId;
|
||||
|
||||
//验证MFA 编码是否有问题 ,前端要拆开,自己调用验证的逻辑
|
||||
//await _userService.VerifyMFACodeAsync(userId, loginUser.MFACode);
|
||||
|
||||
//var loginUser = await _userRepository.Where(u => u.UserName.Equals(userName) && u.Password == password).ProjectTo<UserBasicInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
|
||||
var basicInfo = await _userService.GetUserBasicInfo(userId, loginUser.Password);
|
||||
|
||||
var loginReturn = new LoginReturnDTO() { BasicInfo = basicInfo };
|
||||
|
||||
loginReturn.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(loginReturn.BasicInfo));
|
||||
|
||||
|
||||
// 创建一个 CookieOptions 对象,用于设置 Cookie 的属性
|
||||
var option = new CookieOptions
|
||||
{
|
||||
Expires = DateTime.Now.AddMonths(1), // 设置过期时间为 30 分钟之后
|
||||
HttpOnly = false, // 确保 cookie 只能通过 HTTP 访问
|
||||
SameSite = Microsoft.AspNetCore.Http.SameSiteMode.None, // 设置 SameSite 属性
|
||||
Secure = false // 确保 cookie 只能通过 HTTPS 访问
|
||||
};
|
||||
|
||||
HttpContext.Response.Cookies.Append("access_token", loginReturn.JWTStr, option);
|
||||
|
||||
// 验证阅片休息时间
|
||||
await readingImageTaskService.ResetReadingRestTime(userId);
|
||||
|
||||
await _fusionCache.SetAsync(CacheKeys.UserToken(userId), loginReturn.JWTStr, TimeSpan.FromDays(7));
|
||||
|
||||
await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(userId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(_verifyConfig.CurrentValue.AutoLoginOutMinutes));
|
||||
|
||||
loginReturn.CompanyInfo = companyInfo;
|
||||
return ResponseOutput.Ok(loginReturn);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var returnModel = await _userService.Login(loginUser.UserName, loginUser.Password);
|
||||
|
||||
if (returnModel.IsSuccess)
|
||||
{
|
||||
#region GRPC 调用鉴权中心,因为服务器IIS问题 http/2 故而没法使用
|
||||
|
||||
////重试策略
|
||||
//var defaultMethodConfig = new MethodConfig
|
||||
//{
|
||||
// Names = { MethodName.Default },
|
||||
// RetryPolicy = new RetryPolicy
|
||||
// {
|
||||
// MaxAttempts = 3,
|
||||
// InitialBackoff = TimeSpan.FromSeconds(1),
|
||||
// MaxBackoff = TimeSpan.FromSeconds(5),
|
||||
// BackoffMultiplier = 1.5,
|
||||
// RetryableStatusCodes = { Grpc.Core.StatusCode.Unavailable }
|
||||
// }
|
||||
//};
|
||||
|
||||
//#region unable to trust the certificate then the gRPC client can be configured to ignore the invalid certificate
|
||||
|
||||
//var httpHandler = new HttpClientHandler();
|
||||
//// Return `true` to allow certificates that are untrusted/invalid
|
||||
//httpHandler.ServerCertificateCustomValidationCallback =
|
||||
// HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
|
||||
|
||||
|
||||
//////这一句是让grpc支持本地 http 如果本地访问部署在服务器上,那么是访问不成功的
|
||||
//AppContext.SetSwitch(
|
||||
// "System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
|
||||
//var grpcAdress = configuration.GetValue<string>("GrpcAddress");
|
||||
////var grpcAdress = "http://localhost:7200";
|
||||
|
||||
//var channel = GrpcChannel.ForAddress(grpcAdress, new GrpcChannelOptions
|
||||
//{
|
||||
// HttpHandler = httpHandler,
|
||||
// ServiceConfig = new ServiceConfig { MethodConfigs = { defaultMethodConfig } }
|
||||
|
||||
//});
|
||||
////var channel = GrpcChannel.ForAddress(grpcAdress);
|
||||
//var grpcClient = new TokenGrpcService.TokenGrpcServiceClient(channel);
|
||||
|
||||
//var userInfo = returnModel.Data.BasicInfo;
|
||||
|
||||
//var tokenResponse = grpcClient.GetUserToken(new GetTokenReuqest()
|
||||
//{
|
||||
// Id = userInfo.Id.ToString(),
|
||||
// ReviewerCode = userInfo.ReviewerCode,
|
||||
// IsAdmin = userInfo.IsAdmin,
|
||||
// RealName = userInfo.RealName,
|
||||
// UserTypeEnumInt = (int)userInfo.UserTypeEnum,
|
||||
// UserTypeShortName = userInfo.UserTypeShortName,
|
||||
// UserName = userInfo.UserName
|
||||
//});
|
||||
|
||||
//returnModel.Data.JWTStr = tokenResponse.Token;
|
||||
|
||||
#endregion
|
||||
|
||||
var userId = returnModel.Data.BasicInfo.Id;
|
||||
|
||||
if (_verifyConfig.CurrentValue.OpenLoginMFA)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
//MFA 发送邮件
|
||||
|
||||
returnModel.Data.IsMFA = true;
|
||||
|
||||
var email = returnModel.Data.BasicInfo.EMail;
|
||||
|
||||
var hiddenEmail = IRCEmailPasswordHelper.MaskEmail(email);
|
||||
|
||||
returnModel.Data.BasicInfo.EMail = hiddenEmail;
|
||||
|
||||
//修改密码
|
||||
if (returnModel.Data.BasicInfo.IsFirstAdd || returnModel.Data.BasicInfo.LoginState == 1)
|
||||
{
|
||||
returnModel.Data.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(returnModel.Data.BasicInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
//正常登录才发送邮件
|
||||
await _userService.SendMFAEmail(userId);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
returnModel.Data.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(returnModel.Data.BasicInfo));
|
||||
|
||||
// 创建一个 CookieOptions 对象,用于设置 Cookie 的属性
|
||||
var option = new CookieOptions
|
||||
{
|
||||
Expires = DateTime.Now.AddMonths(1), // 设置过期时间为 30 分钟之后
|
||||
HttpOnly = false, // 确保 cookie 只能通过 HTTP 访问
|
||||
SameSite = Microsoft.AspNetCore.Http.SameSiteMode.None, // 设置 SameSite 属性
|
||||
Secure = false // 确保 cookie 只能通过 HTTPS 访问
|
||||
};
|
||||
|
||||
HttpContext.Response.Cookies.Append("access_token", returnModel.Data.JWTStr, option);
|
||||
|
||||
|
||||
|
||||
// 验证阅片休息时间
|
||||
await readingImageTaskService.ResetReadingRestTime(returnModel.Data.BasicInfo.Id);
|
||||
|
||||
await _fusionCache.SetAsync(CacheKeys.UserToken(userId), returnModel.Data.JWTStr, TimeSpan.FromDays(7));
|
||||
|
||||
await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(userId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(_verifyConfig.CurrentValue.AutoLoginOutMinutes));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
returnModel.Data.CompanyInfo = companyInfo;
|
||||
return returnModel;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet, Route("user/getPublicKey")]
|
||||
public IResponseOutput GetPublicKey([FromServices] IOptionsMonitor<IRCEncreptOption> _IRCEncreptOption)
|
||||
|
@ -309,18 +120,13 @@ namespace IRaCIS.Api.Controllers
|
|||
[AllowAnonymous]
|
||||
public IResponseOutput ShareImage([FromServices] ITokenService _tokenService)
|
||||
{
|
||||
var token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo()
|
||||
var token = _tokenService.GetToken(new UserTokenInfo()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
IsReviewer = false,
|
||||
IsAdmin = false,
|
||||
RealName = "Share001",
|
||||
UserRoleId = Guid.NewGuid(),
|
||||
UserName = "Share001",
|
||||
Sex = 0,
|
||||
//UserType = "ShareType",
|
||||
UserTypeEnum = UserTypeEnum.ShareImage,
|
||||
Code = "ShareCode001",
|
||||
}));
|
||||
|
||||
});
|
||||
return ResponseOutput.Ok("/showdicom?studyId=f7b67793-8155-0223-2f15-118f2642efb8&type=Share&token=" + token);
|
||||
}
|
||||
|
||||
|
@ -379,7 +185,7 @@ namespace IRaCIS.Api.Controllers
|
|||
|
||||
[HttpGet("User/UserRedirect")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> UserRedirect([FromServices] IRepository<User> _userRepository, string url, [FromServices] ILogger<ExtraController> _logger)
|
||||
public async Task<IActionResult> UserRedirect([FromServices] IRepository<IdentityUser> _useRepository, string url, [FromServices] ILogger<ExtraController> _logger)
|
||||
{
|
||||
|
||||
var decodeUrl = System.Web.HttpUtility.UrlDecode(url);
|
||||
|
@ -395,7 +201,7 @@ namespace IRaCIS.Api.Controllers
|
|||
var errorUrl = domainStrList[0] + "//" + domainStrList[2] + "/error";
|
||||
|
||||
|
||||
if (!await _userRepository.AnyAsync(t => t.Id == Guid.Parse(userId) && t.EmailToken == token && t.IsFirstAdd))
|
||||
if (!await _useRepository.AnyAsync(t => t.Id == Guid.Parse(userId) && t.EmailToken == token && t.IsFirstAdd))
|
||||
{
|
||||
decodeUrl = errorUrl + $"?lang={lang}&ErrorMessage={System.Web.HttpUtility.UrlEncode(lang == "zh" ? "您的初始化链接已过期" : "Error!The initialization link has expired. Return")} ";
|
||||
}
|
||||
|
|
|
@ -51,30 +51,30 @@ namespace IRaCIS.Core.API.Controllers.Special
|
|||
[TrialGlobalLimit( "AddOrUpdateTrial", "BeforeOngoingCantOpt", "AfterStopCannNotOpt" )]
|
||||
public async Task<IResponseOutput<Trial>> AddOrUpdateTrial(TrialCommand param)
|
||||
{
|
||||
var userId = Guid.Parse(User.FindFirst("id").Value);
|
||||
//var userId = Guid.Parse(User.FindFirst("id").Value);
|
||||
var result = await _trialService.AddOrUpdateTrial(param);
|
||||
|
||||
if (_trialService.TrialExpeditedChange)
|
||||
{
|
||||
var needCalReviewerIds = await _trialService.GetTrialEnrollmentReviewerIds(param.Id.Value);
|
||||
var calcList = await _calculateService.GetNeedCalculateReviewerList(Guid.Empty, string.Empty);
|
||||
//if (_trialService.TrialExpeditedChange)
|
||||
//{
|
||||
// var needCalReviewerIds = await _trialService.GetTrialEnrollmentReviewerIds(param.Id.Value);
|
||||
// var calcList = await _calculateService.GetNeedCalculateReviewerList(Guid.Empty, string.Empty);
|
||||
|
||||
calcList.ForEach(t =>
|
||||
{
|
||||
if (needCalReviewerIds.Contains(t.DoctorId))
|
||||
{
|
||||
_calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
|
||||
{
|
||||
NeedCalculateReviewers = new List<Guid>()
|
||||
{
|
||||
t.DoctorId
|
||||
},
|
||||
CalculateMonth = DateTime.Parse(t.YearMonth)
|
||||
}, User.FindFirst("id").Value);
|
||||
// calcList.ForEach(t =>
|
||||
// {
|
||||
// if (needCalReviewerIds.Contains(t.DoctorId))
|
||||
// {
|
||||
// _calculateService.CalculateMonthlyPayment(new CalculateDoctorAndMonthDTO()
|
||||
// {
|
||||
// NeedCalculateReviewers = new List<Guid>()
|
||||
// {
|
||||
// t.DoctorId
|
||||
// },
|
||||
// CalculateMonth = DateTime.Parse(t.YearMonth)
|
||||
// }, User.FindFirst("id").Value);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -522,10 +522,10 @@ namespace IRaCIS.Core.API.Controllers
|
|||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[UnitOfWork]
|
||||
|
||||
public async Task<IResponseOutput> ConfirmReReading(DataInspectionDto<ConfirmReReadingCommand> opt, [FromServices] IVisitTaskHelpeService _visitTaskCommonService, [FromServices] IVisitTaskService _visitTaskService)
|
||||
public async Task<IResponseOutput> ConfirmReReading(DataInspectionDto<ConfirmReReadingCommand> opt, [FromServices] IVisitTaskService _visitTaskService)
|
||||
{
|
||||
var singId = await _inspectionService.RecordSing(opt.SignInfo);
|
||||
var result = await _visitTaskService.ConfirmReReading(opt.Data, _visitTaskCommonService);
|
||||
var result = await _visitTaskService.ConfirmReReading(opt.Data);
|
||||
await _inspectionService.CompletedSign(singId, result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
[HttpPost, Route("Study/ArchiveStudy")]
|
||||
[DisableFormValueModelBinding]
|
||||
[DisableRequestSizeLimit]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> ArchiveStudyNew(Guid trialId, Guid subjectVisitId, string studyInstanceUid, Guid? abandonStudyId, Guid studyMonitorId,
|
||||
[FromServices] ILogger<UploadDownLoadController> _logger,
|
||||
[FromServices] IStudyService _studyService,
|
||||
|
@ -370,7 +370,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
//await _uploadHub.Clients.All.ReceivProgressAsync(archiveStudyCommand.StudyInstanceUid, receivedCount);
|
||||
|
||||
|
||||
await _uploadHub.Clients.User(_userInfo.Id.ToString()).ReceivProgressAsync(archiveStudyCommand.StudyInstanceUid, receivedCount);
|
||||
await _uploadHub.Clients.User(_userInfo.UserRoleId.ToString()).ReceivProgressAsync(archiveStudyCommand.StudyInstanceUid, receivedCount);
|
||||
|
||||
archiveResult.ReceivedFileCount = receivedCount;
|
||||
|
||||
|
@ -452,7 +452,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
/// <param name="_studyMonitorRepository"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("Study/PreArchiveStudy")]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> PreArchiveStudy(PreArchiveStudyCommand preArchiveStudyCommand,
|
||||
[FromServices] IStudyService _studyService,
|
||||
[FromServices] IRepository<StudyMonitor> _studyMonitorRepository)
|
||||
|
@ -488,7 +488,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
/// <param name="_noneDicomStudyFileRepository"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("NoneDicomStudy/UploadNoneDicomFile")]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> UploadNoneDicomFile(UploadNoneDicomFileCommand incommand,
|
||||
[FromServices] IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||
[FromServices] IRepository<StudyMonitor> _studyMonitorRepository,
|
||||
|
@ -560,7 +560,7 @@ namespace IRaCIS.Core.API.Controllers
|
|||
/// <returns></returns>
|
||||
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||
[HttpPost("QCOperation/UploadVisitCheckExcel/{trialId:guid}")]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
|
||||
public async Task<IResponseOutput> UploadVisitCheckExcel(Guid trialId, [FromServices] IOSSService oSSService, [FromServices] IRepository<InspectionFile> _inspectionFileRepository)
|
||||
{
|
||||
|
@ -850,11 +850,18 @@ namespace IRaCIS.Core.API.Controllers
|
|||
throw new BusinessValidationFailedException(_localizer["UploadDownLoad_InvalidCenters"]);
|
||||
}
|
||||
|
||||
if (excelList.GroupBy(t => new { t.TrialSiteCode, t.UserTypeStr, t.Email }).Any(g => g.Count() > 1))
|
||||
foreach (var item in excelList.GroupBy(t => t.Email))
|
||||
{
|
||||
// 同一邮箱,同一用户类型,只能生成一个账户,请核查Excel数据
|
||||
var itemList = item.ToList();
|
||||
|
||||
throw new BusinessValidationFailedException(_localizer["UploadDownLoad_CheckDuplicateAccounts"]);
|
||||
var first = item.First();
|
||||
|
||||
if (itemList.Any(t => t.Email != first.Email || t.Phone != first.Phone || t.OrganizationName != first.OrganizationName || t.FirstName != first.FirstName || t.LastName != first.LastName))
|
||||
{
|
||||
//同一邮箱,用户信息应该保持一致!
|
||||
|
||||
throw new BusinessValidationFailedException(_localizer["UploadDownLoad_CheckDuplicateAccounts"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (excelList.Any(t => !t.Email.Contains("@")))
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
<param name="doctorId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Api.Controllers.ExtraController.Login(IRaCIS.Application.Contracts.UserLoginDTO,ZiggyCreatures.Caching.Fusion.IFusionCache,IRaCIS.Core.Application.Service.IUserService,IRaCIS.Core.Application.Auth.ITokenService,IRaCIS.Core.Application.Contracts.IReadingImageTaskService,Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig},IRaCIS.Core.Application.Service.IMailVerificationService)">
|
||||
<summary> 系统用户登录接口[New] </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Api.Controllers.ExtraController.OAuthCallBack(System.String,System.String)">
|
||||
<summary>
|
||||
回调到前端,前端调用后端的接口
|
||||
|
@ -284,7 +281,7 @@
|
|||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.InspectionController.ConfirmReReading(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionDto{IRaCIS.Core.Application.ViewModel.ConfirmReReadingCommand},IRaCIS.Core.Application.Service.IVisitTaskHelpeService,IRaCIS.Core.Application.Service.IVisitTaskService)">
|
||||
<member name="M:IRaCIS.Core.API.Controllers.InspectionController.ConfirmReReading(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionDto{IRaCIS.Core.Application.ViewModel.ConfirmReReadingCommand},IRaCIS.Core.Application.Service.IVisitTaskService)">
|
||||
<summary>
|
||||
重阅同意
|
||||
</summary>
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace IRaCIS.Core.API
|
|||
{
|
||||
public virtual string GetUserId(HubConnectionContext connection)
|
||||
{
|
||||
return connection.User?.FindFirst(JwtIRaCISClaimType.Id)?.Value!;
|
||||
return connection.User?.FindFirst(JwtIRaCISClaimType.IdentityUserId)?.Value!;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace IRaCIS.Core.API
|
|||
diagnosticContext.Set("QueryString", request.QueryString.Value);
|
||||
}
|
||||
|
||||
diagnosticContext.Set("FullName", httpContext?.User?.FindFirst(JwtIRaCISClaimType.RealName)?.Value);
|
||||
diagnosticContext.Set("FullName", httpContext?.User?.FindFirst(JwtIRaCISClaimType.FullName)?.Value);
|
||||
|
||||
diagnosticContext.Set("UserType", httpContext?.User?.FindFirst(JwtIRaCISClaimType.UserTypeShortName)?.Value);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using EntityFramework.Exceptions.SqlServer;
|
||||
using IRaCIS.Core.Application.Triggers;
|
||||
using IRaCIS.Core.Application.Triggers.AfterSaveTrigger;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using IRaCIS.Core.Infra.EFCore.Interceptor;
|
||||
|
@ -80,6 +81,11 @@ namespace IRaCIS.Core.API
|
|||
triggerOptions.AddTrigger<UserLogTrigger>();
|
||||
|
||||
triggerOptions.AddTrigger<UserAddTrigger>();
|
||||
|
||||
triggerOptions.AddTrigger<UserLogAfterTrigger>();
|
||||
|
||||
triggerOptions.AddTrigger<IdenttiyUserRoleInfoTrigger>();
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -268,12 +268,12 @@ var abp = abp || {};
|
|||
}
|
||||
|
||||
function loginUserInternal(tenantId, callback) {
|
||||
|
||||
|
||||
var usernameOrEmailAddress = document.getElementById('userName').value;
|
||||
if (!usernameOrEmailAddress) {
|
||||
alert('UserName Can Not Be Null');
|
||||
return false;
|
||||
}
|
||||
// if (!usernameOrEmailAddress) {
|
||||
// alert('UserName Can Not Be Null');
|
||||
// return false;
|
||||
// }
|
||||
|
||||
var password = document.getElementById('password').value;
|
||||
var pwdMd5 = document.getElementById('pwdMd5').value;
|
||||
|
@ -286,12 +286,12 @@ var abp = abp || {};
|
|||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
|
||||
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
debugger;
|
||||
// debugger;
|
||||
if (xhr.status === 200) {
|
||||
debugger;
|
||||
|
||||
// debugger;
|
||||
|
||||
var resultdata = JSON.parse(xhr.responseText);
|
||||
if (resultdata.ErrorMessage != '') {
|
||||
alert(resultdata.ErrorMessage);
|
||||
|
@ -303,18 +303,23 @@ var abp = abp || {};
|
|||
else {
|
||||
var responseJSON = JSON.parse(xhr.responseText);
|
||||
var result = responseJSON;
|
||||
var expireDate = new Date(Date.now() + (60*60*24 * 1000));
|
||||
var expireDate = new Date(Date.now() + (60 * 60 * 24 * 1000));
|
||||
abp.auth.setToken(result.Result.JWTStr, expireDate);
|
||||
callback();
|
||||
let selectDom = document.getElementById("roleSelect")
|
||||
selectDom.options.length = 0;
|
||||
result.Result.BasicInfo.AccountList.forEach(item => {
|
||||
selectDom.options.add(new Option(item.UserTypeShortName, item.Id));
|
||||
})
|
||||
// callback();
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
alert('Login failed !');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.open('POST', '/user/login', true);
|
||||
|
||||
xhr.open('POST', '/User/getUserLoginRoleList', true);
|
||||
xhr.setRequestHeader('Abp.TenantId', tenantId);
|
||||
xhr.setRequestHeader('Content-type', 'application/json');
|
||||
var parm = {
|
||||
|
@ -330,7 +335,63 @@ var abp = abp || {};
|
|||
//xhr.send("{" + "userName:'" + usernameOrEmailAddress + "'," + "passWord:'" + password + "'}");
|
||||
|
||||
};
|
||||
function loginUserInternalRole(tenantId, callback) {
|
||||
|
||||
var usernameOrEmailAddress = document.getElementById('roleSelect').value;
|
||||
//if (!usernameOrEmailAddress) {
|
||||
// alert('UserName Can Not Be Null');
|
||||
// return false;
|
||||
//}
|
||||
|
||||
var password = document.getElementById('password').value;
|
||||
var pwdMd5 = document.getElementById('pwdMd5').value;
|
||||
console.log(pwdMd5);
|
||||
if (!password && !pwdMd5) {
|
||||
alert('PassWord And Md5 Can Not Be Null');
|
||||
return false;
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
// debugger;
|
||||
if (xhr.status === 200) {
|
||||
// debugger;
|
||||
|
||||
var resultdata = JSON.parse(xhr.responseText);
|
||||
if (resultdata.ErrorMessage != '') {
|
||||
alert(resultdata.ErrorMessage);
|
||||
return false;
|
||||
}
|
||||
if (resultdata.code == 300) {
|
||||
alert(resultdata.message);
|
||||
}
|
||||
else {
|
||||
var responseJSON = JSON.parse(xhr.responseText);
|
||||
var result = responseJSON;
|
||||
var expireDate = new Date(Date.now() + (60 * 60 * 24 * 1000));
|
||||
abp.auth.setToken(result.Result, expireDate);
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
} else {
|
||||
alert('Login failed !');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.open('get', `/User/loginSelectUserRole?userRoleId=${usernameOrEmailAddress}`, true);
|
||||
xhr.setRequestHeader('Abp.TenantId', tenantId);
|
||||
xhr.setRequestHeader('Content-type', 'application/json');
|
||||
var authToken = abp.auth.getToken();
|
||||
xhr.setRequestHeader('Authorization', `Bearer ${authToken}`);
|
||||
xhr.send();
|
||||
//xhr.send("{" + "userName:'" + usernameOrEmailAddress + "'," + "passWord:'" + password + "'}");
|
||||
|
||||
};
|
||||
abp.swagger.login = function (callback) {
|
||||
//Get TenantId first
|
||||
var tenancyName = document.getElementById('tenancyName').value;
|
||||
|
@ -356,6 +417,31 @@ var abp = abp || {};
|
|||
loginUserInternal(null, callback); // Login for host
|
||||
}
|
||||
};
|
||||
abp.swagger.loginRole = function (callback) {
|
||||
//Get TenantId first
|
||||
var tenancyName = document.getElementById('tenancyName').value;
|
||||
|
||||
if (tenancyName) {
|
||||
var xhrTenancyName = new XMLHttpRequest();
|
||||
xhrTenancyName.onreadystatechange = function () {
|
||||
if (xhrTenancyName.readyState === XMLHttpRequest.DONE && xhrTenancyName.status === 200) {
|
||||
var responseJSON = JSON.parse(xhrTenancyName.responseText);
|
||||
var result = responseJSON.result;
|
||||
if (result.state === 1) { // Tenant exists and active.
|
||||
loginUserInternalRole(result.tenantId, callback); // Login for tenant
|
||||
} else {
|
||||
alert('There is no such tenant or tenant is not active !');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhrTenancyName.open('POST', '/api/services/app/Account/IsTenantAvailable', true);
|
||||
xhrTenancyName.setRequestHeader('Content-type', 'application/json');
|
||||
xhrTenancyName.send("{" + "tenancyName:'" + tenancyName + "'}");
|
||||
} else {
|
||||
loginUserInternalRole(null, callback); // Login for host
|
||||
}
|
||||
};
|
||||
|
||||
abp.swagger.logout = function () {
|
||||
abp.auth.clearToken();
|
||||
|
@ -419,9 +505,10 @@ var abp = abp || {};
|
|||
|
||||
//Inputs
|
||||
createInput(modalUxContent, 'tenancyName', 'Tenancy Name (Leave empty for Host)');
|
||||
createInput(modalUxContent, 'userName', 'Username or email address','text','cyldev');
|
||||
createInput(modalUxContent, 'userName', 'Username or email address', 'text', 'cyldev');
|
||||
createInput(modalUxContent, 'password', 'Password', 'password', '123456');
|
||||
createInput(modalUxContent, 'pwdMd5', 'PwdMd5', 'text', '');
|
||||
createSelect(modalUxContent, 'roleSelect', 'role', [])
|
||||
|
||||
//Buttons
|
||||
var authBtnWrapper = document.createElement('div');
|
||||
|
@ -444,9 +531,18 @@ var abp = abp || {};
|
|||
abp.swagger.login(loginCallback);
|
||||
};
|
||||
authBtnWrapper.appendChild(authorizeButton);
|
||||
|
||||
// login role
|
||||
var authorizeButton = document.createElement('button');
|
||||
authorizeButton.className = 'btn modal-btn auth authorize button';
|
||||
authorizeButton.innerText = 'LoginRole';
|
||||
authorizeButton.onclick = function () {
|
||||
abp.swagger.loginRole(loginCallback);
|
||||
};
|
||||
authBtnWrapper.appendChild(authorizeButton);
|
||||
}
|
||||
|
||||
function createInput(container, id, title, type, value="") {
|
||||
function createInput(container, id, title, type, value = "") {
|
||||
var wrapper = document.createElement('div');
|
||||
wrapper.className = 'wrapper';
|
||||
if (id == "tenancyName") {
|
||||
|
@ -470,6 +566,31 @@ var abp = abp || {};
|
|||
input.autocomplete = "off";
|
||||
|
||||
|
||||
section.appendChild(input);
|
||||
}
|
||||
function createSelect(container, id, title, option = []) {
|
||||
var wrapper = document.createElement('div');
|
||||
wrapper.className = 'wrapper';
|
||||
if (id == "tenancyName") {
|
||||
wrapper.style.display = 'none';
|
||||
}
|
||||
container.appendChild(wrapper);
|
||||
|
||||
var label = document.createElement('label');
|
||||
label.innerText = title;
|
||||
wrapper.appendChild(label);
|
||||
|
||||
var section = document.createElement('section');
|
||||
section.className = 'block-tablet col-10-tablet block-desktop col-10-desktop';
|
||||
wrapper.appendChild(section);
|
||||
|
||||
var input = document.createElement('select');
|
||||
input.id = id;
|
||||
input.style.width = '100%';
|
||||
option.forEach(item => {
|
||||
input.options.add(new Option(item.UserTypeShortName, item.Id));
|
||||
})
|
||||
|
||||
section.appendChild(input);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
|
||||
namespace IRaCIS.Core.Application.Auth
|
||||
{
|
||||
public class IRaCISClaims
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string FullName { get; set; } = String.Empty;
|
||||
public string Code { get; set; } = String.Empty;
|
||||
public string RealName { get; set; } = String.Empty;
|
||||
|
||||
public string UserTypeShortName { get; set; } = String.Empty;
|
||||
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
|
||||
public string PermissionStr { get; set; } = String.Empty;
|
||||
|
||||
public Guid UserTypeId { get; set; }
|
||||
|
||||
public int IsAdmin { get; }
|
||||
|
||||
public bool IsTestUser { get; set; }
|
||||
|
||||
public bool IsZhiZhun { get; set; }
|
||||
|
||||
public string Phone { get; set; } = String.Empty;
|
||||
|
||||
public static IRaCISClaims Create(UserBasicInfo user)
|
||||
{
|
||||
return new IRaCISClaims
|
||||
{
|
||||
Id = user.Id,
|
||||
FullName = user.UserName,
|
||||
RealName = user.RealName,
|
||||
UserTypeEnum = user.UserTypeEnum,
|
||||
UserTypeId = user.UserTypeId,
|
||||
IsTestUser = user.IsTestUser,
|
||||
Code = user.Code,
|
||||
PermissionStr = user.PermissionStr,
|
||||
IsZhiZhun = user.IsZhiZhun,
|
||||
UserTypeShortName = user.UserTypeShortName
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ namespace IRaCIS.Core.Application.Auth
|
|||
|
||||
public interface ITokenService
|
||||
{
|
||||
string GetToken(IRaCISClaims user);
|
||||
string GetToken(UserTokenInfo user);
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,16 +21,16 @@ namespace IRaCIS.Core.Application.Auth
|
|||
_jwtSetting = option.Value;
|
||||
}
|
||||
|
||||
public string GetToken(IRaCISClaims user)
|
||||
public string GetToken(UserTokenInfo user)
|
||||
{
|
||||
//创建用户身份标识,可按需要添加更多信息
|
||||
var claims = new Claim[]
|
||||
{
|
||||
new Claim(Microsoft.IdentityModel.JsonWebTokens.JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
|
||||
new Claim(JwtIRaCISClaimType.Id, user.Id.ToString()),
|
||||
new Claim(JwtIRaCISClaimType.Name, user.FullName),
|
||||
new Claim(JwtIRaCISClaimType.RealName, user.RealName),
|
||||
new Claim(JwtIRaCISClaimType.Code,user.Code),
|
||||
new Claim(JwtIRaCISClaimType.IdentityUserId, user.IdentityUserId.ToString()),
|
||||
new Claim(JwtIRaCISClaimType.UserRoleId, user.UserRoleId.ToString()),
|
||||
new Claim(JwtIRaCISClaimType.UserName, user.UserName),
|
||||
new Claim(JwtIRaCISClaimType.FullName, user.FullName),
|
||||
new Claim(JwtIRaCISClaimType.UserTypeId,user.UserTypeId.ToString()),
|
||||
new Claim(JwtIRaCISClaimType.UserTypeEnum,user.UserTypeEnum.ToString()),
|
||||
new Claim(JwtIRaCISClaimType.UserTypeEnumInt,((int)user.UserTypeEnum).ToString()),
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
|
||||
namespace IRaCIS.Core.Application.Auth
|
||||
{
|
||||
public class UserTokenInfo
|
||||
{
|
||||
public Guid IdentityUserId { get; set; }
|
||||
|
||||
public Guid UserRoleId { get; set; }
|
||||
|
||||
public Guid UserTypeId { get; set; }
|
||||
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
public string PermissionStr { get; set; } = string.Empty;
|
||||
|
||||
public bool IsTestUser { get; set; }
|
||||
|
||||
public bool IsZhiZhun { get; set; }
|
||||
|
||||
public string UserTypeShortName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
|
@ -48,7 +48,7 @@ public class LimitUserRequestAuthorization(
|
|||
|
||||
|
||||
//2、在这里取缓存 进行比较 看是否有其他人进行了登陆,如果其他人登陆了,就把之前用户挤掉
|
||||
var cacheUserToken = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.UserToken(_userInfo.Id));
|
||||
var cacheUserToken = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.UserToken(_userInfo.IdentityUserId));
|
||||
|
||||
|
||||
|
||||
|
@ -58,17 +58,17 @@ public class LimitUserRequestAuthorization(
|
|||
cacheUserToken = _userInfo.UserToken;
|
||||
|
||||
//设置当前用户最新Token
|
||||
await _fusionCache.SetAsync(CacheKeys.UserToken(_userInfo.Id), _userInfo.UserToken, TimeSpan.FromDays(7));
|
||||
await _fusionCache.SetAsync(CacheKeys.UserToken(_userInfo.IdentityUserId), _userInfo.UserToken, TimeSpan.FromDays(7));
|
||||
|
||||
//重启应用程序,所有人续期,不一下子踢出所有人
|
||||
await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes));
|
||||
await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.IdentityUserId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes));
|
||||
|
||||
}
|
||||
//是同一个人
|
||||
else if (cacheUserToken == _userInfo.UserToken)
|
||||
{
|
||||
|
||||
var cacheTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.UserAutoLoginOut(_userInfo.Id));
|
||||
var cacheTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.UserAutoLoginOut(_userInfo.IdentityUserId));
|
||||
|
||||
//过期了 需要自动退出
|
||||
if (string.IsNullOrEmpty(cacheTime))
|
||||
|
@ -80,7 +80,7 @@ public class LimitUserRequestAuthorization(
|
|||
}
|
||||
else
|
||||
{
|
||||
await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes));
|
||||
await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.IdentityUserId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -93,6 +93,21 @@ public class LimitUserRequestAuthorization(
|
|||
|
||||
}
|
||||
|
||||
//用户或者角色禁用,那么操作的人退出
|
||||
|
||||
var isDisable = await _fusionCache.GetOrDefaultAsync<bool>(CacheKeys.UserDisable(_userInfo.IdentityUserId),false);
|
||||
|
||||
var isRoleDisable = await _fusionCache.GetOrDefaultAsync<bool>(CacheKeys.UserRoleDisable(_userInfo.UserRoleId),false);
|
||||
|
||||
if (isDisable == true || isRoleDisable == true)
|
||||
{
|
||||
context.HttpContext.Response.ContentType = "application/json";
|
||||
context.HttpContext.Response.StatusCode = StatusCodes.Status403Forbidden;
|
||||
// 用户或者角色被禁用。
|
||||
|
||||
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["LimitUser_AccountOrRoleDisable"], ApiResponseCodeEnum.AutoLoginOut));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,19 +41,19 @@ public class LimitUserRequestAuthorizationEndpointFilter(
|
|||
}
|
||||
|
||||
// 获取缓存中的用户 token
|
||||
var cacheUserToken = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.UserToken(_userInfo.Id));
|
||||
var cacheUserToken = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.UserToken(_userInfo.IdentityUserId));
|
||||
|
||||
// 缓存中没有取到 token
|
||||
if (string.IsNullOrWhiteSpace(cacheUserToken))
|
||||
{
|
||||
// 设置当前用户最新 token
|
||||
await _fusionCache.SetAsync(CacheKeys.UserToken(_userInfo.Id), _userInfo.UserToken, TimeSpan.FromDays(7));
|
||||
await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes));
|
||||
await _fusionCache.SetAsync(CacheKeys.UserToken(_userInfo.IdentityUserId), _userInfo.UserToken, TimeSpan.FromDays(7));
|
||||
await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.IdentityUserId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes));
|
||||
}
|
||||
// 如果是同一个用户
|
||||
else if (cacheUserToken == _userInfo.UserToken)
|
||||
{
|
||||
var cacheTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.UserAutoLoginOut(_userInfo.Id));
|
||||
var cacheTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.UserAutoLoginOut(_userInfo.IdentityUserId));
|
||||
|
||||
// 如果过期,自动登出
|
||||
if (string.IsNullOrEmpty(cacheTime))
|
||||
|
@ -63,7 +63,7 @@ public class LimitUserRequestAuthorizationEndpointFilter(
|
|||
}
|
||||
else
|
||||
{
|
||||
await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes));
|
||||
await _fusionCache.SetAsync(CacheKeys.UserAutoLoginOut(_userInfo.IdentityUserId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -140,7 +140,7 @@ public static class AppSettings
|
|||
case nameof(Doctor):
|
||||
return IRaCISBasicConfig.DoctorCodePrefix + codeInt.ToString("D4");
|
||||
|
||||
case nameof(User):
|
||||
case nameof(IdentityUser):
|
||||
return IRaCISBasicConfig.UserCodePrefix + codeInt.ToString("D4");
|
||||
|
||||
case nameof(QCChallenge):
|
||||
|
|
|
@ -10,5 +10,6 @@ global using Microsoft.Extensions.Localization;
|
|||
global using AutoMapper;
|
||||
global using IRaCIS.Core.Domain.Share;
|
||||
global using IRaCIS.Core.Application.BusinessFilter;
|
||||
global using IdentityUser = IRaCIS.Core.Domain.Models.IdentityUser;
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,11 @@ public static class CacheKeys
|
|||
//超时没请求接口自动退出
|
||||
public static string UserAutoLoginOut(Guid userId) => $"UserAutoLoginOut:{userId}";
|
||||
|
||||
|
||||
public static string UserDisable(Guid userId) => $"UserDisable:{userId}";
|
||||
|
||||
public static string UserRoleDisable(Guid userRoleId) => $"UserRoleDisable:{userRoleId}";
|
||||
|
||||
/// <summary>
|
||||
/// 用户登录错误 限制登录
|
||||
/// </summary>
|
||||
|
|
|
@ -64,7 +64,7 @@ public static class ExcelExportHelper
|
|||
foreach (var key in dic.Keys)
|
||||
{
|
||||
//是数组 那么找到对应的属性 进行翻译
|
||||
if (dic[key]!=null && dic[key].GetType().GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IList<>)))
|
||||
if (dic[key] != null && dic[key].GetType().GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IList<>)))
|
||||
{
|
||||
|
||||
var newObjList = new List<object>();
|
||||
|
@ -255,9 +255,13 @@ public static class ExcelExportHelper
|
|||
/// </summary>
|
||||
public int AutoColumnTitleRowIndex { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 模板列最后的索引
|
||||
/// </summary>
|
||||
public int TempalteLastColumnIndex { get; set; }
|
||||
|
||||
public List<string> CDISCList { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 动态的列名
|
||||
/// </summary>
|
||||
|
@ -421,7 +425,7 @@ public static class ExcelExportHelper
|
|||
workbook.RemoveSheetAt(1);
|
||||
}
|
||||
|
||||
//中文替换项目术语
|
||||
#region 中文替换项目术语
|
||||
if (data.TrialObjectNameList?.Count > 0)
|
||||
{
|
||||
var replaceObjectList = data.TrialObjectNameList;
|
||||
|
@ -457,6 +461,9 @@ public static class ExcelExportHelper
|
|||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
if (dynamicColumnConfig != null)
|
||||
{
|
||||
|
@ -468,6 +475,7 @@ public static class ExcelExportHelper
|
|||
//动态移除列的数量
|
||||
var dynamicRemoveColunmCount = dynamicColumnConfig.RemoveColunmIndexList.Count();
|
||||
|
||||
//在动态列开始前移除的数量
|
||||
var beforeDynamicRemoveCount = dynamicColumnConfig.RemoveColunmIndexList.Where(t => t < dynamicColumnConfig.AutoColumnStartIndex).Count();
|
||||
|
||||
//动态添加列的数量
|
||||
|
@ -635,6 +643,311 @@ public static class ExcelExportHelper
|
|||
}
|
||||
|
||||
|
||||
public static async Task<(MemoryStream, string)> CDISC_DataExport_Async(string code, ExcelExportInfo data, IRepository<CommonDocument> _commonDocumentRepository, IWebHostEnvironment _hostEnvironment, IDictionaryService? _dictionaryService = null, Type? translateType = null, CriterionType? criterionType = null, DynamicColumnConfig? dynamicColumnConfig = null)
|
||||
{
|
||||
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
|
||||
//判断是否有字典翻译
|
||||
|
||||
object translateData = data;
|
||||
|
||||
Dictionary<string, object> translatedDic = default;
|
||||
|
||||
if (_dictionaryService != null && translateType != null)
|
||||
{
|
||||
|
||||
//一个值 对应不同的字典翻译
|
||||
var needTranslatePropertyList = translateType.GetProperties().Where(t => t.IsDefined(typeof(DictionaryTranslateAttribute), true))
|
||||
.SelectMany(c =>
|
||||
c.GetCustomAttributes(typeof(DictionaryTranslateAttribute), false).Select(f => (DictionaryTranslateAttribute?)f).Where(t => t.CriterionType == criterionType || t.CriterionType == null)
|
||||
.Select(k => new { c.Name, k.DicParentCode, k.IsTranslateDenpendOtherProperty, k.DependPropertyName, k.DependPropertyValueStr })
|
||||
).ToList();
|
||||
|
||||
|
||||
|
||||
//字典表查询出所有需要翻译的数据
|
||||
|
||||
var translateDataList = await _dictionaryService.GetBasicDataSelect(needTranslatePropertyList.Select(t => t.DicParentCode).Distinct().ToArray());
|
||||
|
||||
var dic = data.ConvertToDictionary();
|
||||
//var dic = (JsonConvert.DeserializeObject<IDictionary<string, object>>(data.ToJsonNotIgnoreNull())).IfNullThrowException();
|
||||
|
||||
foreach (var key in dic.Keys)
|
||||
{
|
||||
//是数组 那么找到对应的属性 进行翻译
|
||||
if (dic[key] != null && dic[key].GetType().GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IList<>)))
|
||||
//if (dic[key].GetType().IsAssignableFrom(typeof(JArray)))
|
||||
{
|
||||
|
||||
var newObjList = new List<object>();
|
||||
var no = 1;
|
||||
foreach (var item in dic[key] as IList)
|
||||
//foreach (var item in dic[key] as JArray)
|
||||
{
|
||||
//var itemDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(item.ToJsonNotIgnoreNull());
|
||||
var itemDic = item.ConvertToDictionary();
|
||||
|
||||
foreach (var needTranslateProperty in needTranslatePropertyList)
|
||||
{
|
||||
if (itemDic.Keys.Any(t => t == needTranslateProperty.Name))
|
||||
{
|
||||
//翻译的属性依赖其他属性
|
||||
if (needTranslateProperty.IsTranslateDenpendOtherProperty)
|
||||
{
|
||||
if (itemDic[needTranslateProperty.DependPropertyName]?.ToString().ToLower() == needTranslateProperty.DependPropertyValueStr.ToLower())
|
||||
{
|
||||
var beforeValue = itemDic[needTranslateProperty.Name]?.ToString();
|
||||
|
||||
itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
|
||||
}
|
||||
}
|
||||
//普通翻译 或者某一标准翻译
|
||||
else
|
||||
{
|
||||
var beforeValue = itemDic[needTranslateProperty.Name]?.ToString();
|
||||
|
||||
|
||||
itemDic[needTranslateProperty.Name] = translateDataList[needTranslateProperty.DicParentCode].Where(t => t.Code.ToLower() == beforeValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
itemDic.Add("No", no++);
|
||||
newObjList.Add(itemDic);
|
||||
}
|
||||
|
||||
dic[key] = newObjList;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//data = dic;
|
||||
translateData = dic;
|
||||
translatedDic = dic;
|
||||
|
||||
}
|
||||
|
||||
|
||||
var (physicalPath, fileName) = await FileStoreHelper.GetCommonDocPhysicalFilePathAsync(_hostEnvironment, _commonDocumentRepository, code);
|
||||
|
||||
|
||||
//模板路径
|
||||
var tplPath = physicalPath;
|
||||
|
||||
#region 根据中英文 删除模板sheet
|
||||
|
||||
// 打开模板文件
|
||||
var templateFile = new FileStream(tplPath, FileMode.Open, FileAccess.Read);
|
||||
|
||||
// 获取文件流
|
||||
var templateStream = new MemoryStream();
|
||||
templateFile.CopyTo(templateStream);
|
||||
templateStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
var workbook = new XSSFWorkbook(templateStream);
|
||||
|
||||
int sheetCount = workbook.NumberOfSheets;
|
||||
|
||||
if (sheetCount == 2)
|
||||
{
|
||||
if (isEn_US)
|
||||
{
|
||||
workbook.RemoveSheetAt(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
workbook.RemoveSheetAt(1);
|
||||
}
|
||||
|
||||
if (dynamicColumnConfig != null)
|
||||
{
|
||||
var sheet = workbook.GetSheetAt(0);
|
||||
|
||||
|
||||
var cdicsRow = sheet.GetRow(dynamicColumnConfig.AutoColumnTitleRowIndex - 1);
|
||||
var titelRow = sheet.GetRow(dynamicColumnConfig.AutoColumnTitleRowIndex);
|
||||
var templateRow = sheet.GetRow(dynamicColumnConfig.AutoColumnTitleRowIndex + 1);
|
||||
|
||||
//动态移除列的数量
|
||||
var dynamicRemoveColunmCount = dynamicColumnConfig.RemoveColunmIndexList.Count();
|
||||
|
||||
//在动态列开始前移除的数量
|
||||
var beforeDynamicRemoveCount = dynamicColumnConfig.RemoveColunmIndexList.Where(t => t < dynamicColumnConfig.AutoColumnStartIndex).Count();
|
||||
|
||||
//动态添加列的数量
|
||||
var needAddCount = dynamicColumnConfig.ColumnNameList.Count;
|
||||
|
||||
//原始表 最终索引
|
||||
var originTotalEndIndex = dynamicColumnConfig.TempalteLastColumnIndex;
|
||||
|
||||
//减去动态移除后原始结束索引
|
||||
var originRemoveEndIndex = originTotalEndIndex - dynamicRemoveColunmCount;
|
||||
|
||||
//最终表 动态列开始索引
|
||||
var dynamicColunmStartIndex = dynamicColumnConfig.AutoColumnStartIndex - beforeDynamicRemoveCount;
|
||||
|
||||
//最终表 动态列的终止索引
|
||||
var dynamicColunmEndIndex = dynamicColunmStartIndex + needAddCount - 1;
|
||||
|
||||
//最终表 最终索引
|
||||
var totalColunmEndIndex = originTotalEndIndex + needAddCount - dynamicRemoveColunmCount;
|
||||
|
||||
|
||||
//动态列后需要移动的数量
|
||||
var backMoveCount = totalColunmEndIndex - dynamicColunmEndIndex;
|
||||
|
||||
//删除需要动态删除的列 从大到小移除,否则索引会变
|
||||
foreach (var removeIndex in dynamicColumnConfig.RemoveColunmIndexList.OrderByDescending(t => t))
|
||||
{
|
||||
//将后面的列向前移动
|
||||
for (var i = 0; i < originTotalEndIndex - removeIndex; i++)
|
||||
{
|
||||
Console.WriteLine(titelRow.GetCell(removeIndex + i + 1).StringCellValue);
|
||||
titelRow.GetCell(removeIndex + i).SetCellValue(titelRow.GetCell(removeIndex + i + 1).StringCellValue);
|
||||
templateRow.GetCell(removeIndex + i).SetCellValue(templateRow.GetCell(removeIndex + i + 1).StringCellValue);
|
||||
|
||||
//后面的数据要清空
|
||||
titelRow.GetCell(removeIndex + i + 1).SetCellValue("");
|
||||
templateRow.GetCell(removeIndex + i + 1).SetCellValue("");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//创建新的列
|
||||
for (int i = originTotalEndIndex; i < originTotalEndIndex + needAddCount; i++)
|
||||
{
|
||||
cdicsRow.CreateCell(i + 1);
|
||||
titelRow.CreateCell(i + 1);
|
||||
templateRow.CreateCell(i + 1);
|
||||
}
|
||||
//移动Title 和下面的模板标识
|
||||
|
||||
var gap = totalColunmEndIndex - originRemoveEndIndex;
|
||||
|
||||
for (int i = totalColunmEndIndex; i > dynamicColunmEndIndex; i--)
|
||||
{
|
||||
|
||||
titelRow.GetCell(i).SetCellValue(titelRow.GetCell(i - gap).StringCellValue);
|
||||
|
||||
templateRow.GetCell(i).SetCellValue(templateRow.GetCell(i - gap).StringCellValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//设置动态Tilte
|
||||
|
||||
for (int i = dynamicColunmStartIndex; i < dynamicColunmStartIndex + needAddCount; i++)
|
||||
{
|
||||
var name = dynamicColumnConfig.ColumnNameList[i - dynamicColunmStartIndex];
|
||||
|
||||
var cdicsCode= dynamicColumnConfig.CDISCList[i - dynamicColunmStartIndex];
|
||||
|
||||
cdicsRow.GetCell(i).SetCellValue(cdicsCode);
|
||||
titelRow.GetCell(i).SetCellValue(name);
|
||||
templateRow.GetCell(i).SetCellValue("");
|
||||
}
|
||||
}
|
||||
|
||||
using (var memoryStream2 = new MemoryStream())
|
||||
{
|
||||
workbook.Write(memoryStream2, true);
|
||||
|
||||
memoryStream2.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
templateStream = memoryStream2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MiniExcel
|
||||
|
||||
var memoryStream = new MemoryStream();
|
||||
|
||||
var config = new OpenXmlConfiguration()
|
||||
{
|
||||
IgnoreTemplateParameterMissing = true,
|
||||
};
|
||||
|
||||
await MiniExcel.SaveAsByTemplateAsync(memoryStream, templateStream.ToArray(), translateData, config);
|
||||
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
if (dynamicColumnConfig != null)
|
||||
{
|
||||
var dynamicTranslateDataList = await _dictionaryService.GetBasicDataSelect(dynamicColumnConfig.TranslateDicNameList.ToArray());
|
||||
|
||||
// 使用NPOI 进行二次处理
|
||||
var wb = new XSSFWorkbook(memoryStream);
|
||||
var sheet = wb.GetSheetAt(0);
|
||||
|
||||
var list = translatedDic["List"] as IList;
|
||||
|
||||
foreach (var itemResult in list)
|
||||
{
|
||||
var index = list.IndexOf(itemResult);
|
||||
|
||||
//从第四行开始处理动态列
|
||||
var row = sheet.GetRow(index + dynamicColumnConfig.AutoColumnTitleRowIndex + 1);
|
||||
|
||||
var itemDic = itemResult.ToDictionary();
|
||||
|
||||
var itemList = itemDic[dynamicColumnConfig.DynamicListName] as IList;
|
||||
|
||||
//这个数组是动态的,有的多,有的少,所以在此对比Title 一致才赋值
|
||||
foreach (var itemObj in itemList)
|
||||
{
|
||||
|
||||
var iteObjDic = itemObj.ToDictionary();
|
||||
|
||||
var itemDicName = iteObjDic[dynamicColumnConfig.DynamicItemDicName]?.ToString();
|
||||
var itemValue = iteObjDic[dynamicColumnConfig.DynamicItemValueName]?.ToString();
|
||||
|
||||
//var writeIndex = itemList.IndexOf(itemObj) + dynamicColumnConfig.AutoColumnStartIndex;
|
||||
|
||||
var writeIndex = dynamicColumnConfig.ColumnNameList.IndexOf(iteObjDic[dynamicColumnConfig.DynamicItemTitleName].ToString()) + dynamicColumnConfig.AutoColumnStartIndex;
|
||||
|
||||
if (itemDicName.IsNotNullOrEmpty())
|
||||
{
|
||||
|
||||
var translatedItemData = dynamicTranslateDataList[itemDicName].Where(t => t.Code.ToLower() == itemValue?.ToLower()).Select(t => isEn_US ? t.Value : t.ValueCN).FirstOrDefault() ?? String.Empty;
|
||||
|
||||
row.GetCell(writeIndex).SetCellValue(translatedItemData);
|
||||
}
|
||||
else
|
||||
{
|
||||
row.GetCell(writeIndex).SetCellValue(itemValue);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var memoryStream2 = new MemoryStream();
|
||||
wb.Write(memoryStream2, true);
|
||||
memoryStream2.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
memoryStream = memoryStream2;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return (memoryStream, fileName);
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导出文件模板
|
||||
/// </summary>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -191,7 +191,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer
|
|||
|
||||
// dialogMsg.AppendLine(@$"<br>说明:为高效解决/处理以上全部质疑问题,麻烦您准确核实实际影像检查情况。请注意影像日期与实际检查的日期可能会不一致,部分检查(如PET -CT)可能同时存在多种模态影像。准确核实后,请回复该访视正确的影像检查情况。");
|
||||
dbSV.CheckState = CheckStateEnum.CVPassed;
|
||||
dbSV.CheckUserId = _userInfo.Id;
|
||||
dbSV.CheckUserId = _userInfo.UserRoleId;
|
||||
dbSV.CheckPassedTime = DateTime.Now;
|
||||
dbSV.CheckChallengeState = CheckChanllengeTypeEnum.Closed;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer;
|
|||
/// 加急的医学反馈任务 通知MIM
|
||||
/// </summary>
|
||||
public class UrgentMedicalReviewAddedEventConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TaskMedicalReview> _taskMedicalReviewRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
|
@ -58,7 +58,7 @@ public class UrgentMedicalReviewAddedEventConsumer(
|
|||
return;
|
||||
}
|
||||
var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId);
|
||||
var userinfo = await _userRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync();
|
||||
var userinfo = await _userRoleRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync();
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x=>x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync();
|
||||
|
||||
|
@ -128,7 +128,7 @@ public class UrgentMedicalReviewAddedEventConsumer(
|
|||
|
||||
//IR 回复医学反馈通知MIM
|
||||
public class UrgentIRRepliedMedicalReviewConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TaskMedicalReview> _taskMedicalReviewRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
|
@ -159,7 +159,7 @@ public class UrgentIRRepliedMedicalReviewConsumer(
|
|||
return;
|
||||
}
|
||||
var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId);
|
||||
var userinfo = await _userRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync();
|
||||
var userinfo = await _userRoleRepository.Where(x => x.Id == medicalReview.MedicalManagerUserId).FirstOrDefaultAsync();
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x => x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync();
|
||||
|
||||
|
@ -231,7 +231,7 @@ public class UrgentIRRepliedMedicalReviewConsumer(
|
|||
/// MIM 回复医学返回通知IR
|
||||
/// </summary>
|
||||
public class UrgentMIMRepliedMedicalReviewConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TaskMedicalReview> _taskMedicalReviewRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
|
@ -268,7 +268,7 @@ public class UrgentMIMRepliedMedicalReviewConsumer(
|
|||
var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == medicalReview.VisitTask.TrialReadingCriterionId);
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == medicalReview.VisitTaskId).Include(x => x.SourceSubjectVisit).Include(x => x.ReadModule).Include(x => x.Subject).FirstNotNullAsync();
|
||||
|
||||
var userinfo = await _userRepository.Where(x => x.Id == taskInfo.DoctorUserId).FirstOrDefaultAsync();
|
||||
var userinfo = await _userRoleRepository.Where(x => x.Id == taskInfo.DoctorUserId).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
|
||||
|
@ -346,8 +346,8 @@ public class UrgentMIMRepliedMedicalReviewConsumer(
|
|||
/// 加急阅片 IR 申请重阅 或者PM 申请重阅
|
||||
/// </summary>
|
||||
public class UrgentIRApplyedReReadingConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<TrialUser> _trialUseRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUserRole> _trialUseRoleRepository,
|
||||
IRepository<TaskMedicalReview> _taskMedicalReviewRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
|
@ -370,9 +370,9 @@ public class UrgentIRApplyedReReadingConsumer(
|
|||
var criterion = await _readingQuestionCriterionTrialRepository.FirstOrDefaultAsync(x => x.Id == taskInfo.TrialReadingCriterionId);
|
||||
|
||||
|
||||
var doctorInfo = await _userRepository.Where(x => x.Id == taskInfo.DoctorUserId).FirstOrDefaultAsync();
|
||||
var doctorInfo = await _userRoleRepository.Where(x => x.Id == taskInfo.DoctorUserId).FirstOrDefaultAsync();
|
||||
|
||||
var trialUser = await _trialUseRepository.Where(x => x.TrialId == taskInfo.TrialId).Include(x => x.User).Select(x=>x.User).ToListAsync();
|
||||
var trialUser = await _trialUseRoleRepository.Where(x => x.TrialId == taskInfo.TrialId).Include(x => x.UserRole).Select(x=>x.UserRole).ToListAsync();
|
||||
|
||||
var userinfoList = trialUser.Where(x => x.UserTypeEnum == UserTypeEnum.ProjectManager||x.UserTypeEnum==UserTypeEnum.APM).ToList();
|
||||
if (context.Message.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed)
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer;
|
|||
public class UserSiteSurveySubmitedEventConsumer(
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<TrialSiteSurvey> _trialSiteSurveyRepository,
|
||||
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig
|
||||
|
@ -47,9 +47,9 @@ public class UserSiteSurveySubmitedEventConsumer(
|
|||
|
||||
var trialId = siteSurveyInfo.TrialId;
|
||||
|
||||
var trialUserList = await _trialUserRepository.Where(t => t.TrialId == siteSurveyInfo.TrialId)
|
||||
.Where(t => t.User.UserTypeEnum == UserTypeEnum.SPM || t.User.UserTypeEnum == UserTypeEnum.CPM || t.User.UserTypeEnum == UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM)
|
||||
.Select(t => new { t.User.FullName, t.User.EMail, t.User.UserTypeEnum }).ToListAsync();
|
||||
var trialUserList = await _trialUserRoleRepository.Where(t => t.TrialId == siteSurveyInfo.TrialId)
|
||||
.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM)
|
||||
.Select(t => new { t.UserRole.FullName, t.UserRole.IdentityUser.EMail, t.UserRole.UserTypeEnum }).ToListAsync();
|
||||
|
||||
var sPMOrCPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.SPM || t.UserTypeEnum == UserTypeEnum.CPM).ToList();
|
||||
var pmAndAPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserTypeEnum == UserTypeEnum.APM).ToList();
|
||||
|
@ -125,7 +125,7 @@ public class UserSiteSurveySubmitedEventConsumer(
|
|||
/// </summary>
|
||||
public class SiteSurveySPMSubmitedEventConsumer(
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<TrialSiteSurvey> _trialSiteSurveyRepository,
|
||||
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
|
||||
|
@ -145,9 +145,9 @@ public class SiteSurveySPMSubmitedEventConsumer(
|
|||
|
||||
var messageToSend = new MimeMessage();
|
||||
|
||||
var trialUserList = _trialUserRepository.Where(t => t.TrialId == trialId)
|
||||
.Where(t => t.User.UserTypeEnum == UserTypeEnum.SPM || t.User.UserTypeEnum == UserTypeEnum.CPM || t.User.UserTypeEnum == UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM)
|
||||
.Select(t => new { t.User.EMail, t.User.FullName, t.User.UserTypeEnum }).ToList();
|
||||
var trialUserList = _trialUserRoleRepository.Where(t => t.TrialId == trialId)
|
||||
.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM || t.UserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserRole.UserTypeEnum == UserTypeEnum.APM)
|
||||
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToList();
|
||||
|
||||
var sPMOrCPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.SPM || t.UserTypeEnum == UserTypeEnum.CPM).ToList();
|
||||
var pmAndAPMList = trialUserList.Where(t => t.UserTypeEnum == UserTypeEnum.ProjectManager || t.UserTypeEnum == UserTypeEnum.APM).ToList();
|
||||
|
@ -200,7 +200,7 @@ public class SiteSurveySPMSubmitedEventConsumer(
|
|||
/// 调研表驳回发送邮件 之前已有,需要迁移过来
|
||||
/// </summary>
|
||||
public class SiteSurverRejectedEventConsumer(
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<TrialSiteSurvey> _trialSiteSurveyRepository,
|
||||
|
@ -229,13 +229,13 @@ public class SiteSurverRejectedEventConsumer(
|
|||
//PM 驳回到SPM
|
||||
if (siteSurveyInfo.State == TrialSiteSurveyEnum.CRCSubmitted)
|
||||
{
|
||||
//var user = await _userRepository.FirstOrDefaultAsync(t => t.Id == siteSurveyInfo.PreliminaryUserId);
|
||||
//var user = await _userRoleRepository.FirstOrDefaultAsync(t => t.Id == siteSurveyInfo.PreliminaryUserId);
|
||||
|
||||
//name = user.FullName;
|
||||
|
||||
var sPMOrCPMList = _trialUserRepository.Where(t => t.TrialId == trialId)
|
||||
.Where(t => t.User.UserTypeEnum == UserTypeEnum.SPM || t.User.UserTypeEnum == UserTypeEnum.CPM)
|
||||
.Select(t => new { t.User.EMail, t.User.FullName, t.User.UserTypeEnum }).ToList();
|
||||
var sPMOrCPMList = _trialUserRoleRepository.Where(t => t.TrialId == trialId)
|
||||
.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)
|
||||
.Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToList();
|
||||
|
||||
|
||||
foreach (var user in sPMOrCPMList)
|
||||
|
|
|
@ -23,8 +23,8 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer;
|
|||
/// CRC 提交了 通知QC进行质控 Code005,006
|
||||
/// </summary>
|
||||
public class CRCSubmitedAndQCToAuditEventConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<TrialUser> _trialUseRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUserRole> _trialUseRoleRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
||||
|
@ -43,7 +43,7 @@ public class CRCSubmitedAndQCToAuditEventConsumer(
|
|||
|
||||
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.Subject).FirstOrDefaultAsync();
|
||||
|
||||
var trialUser = await _trialUseRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.User).Select(x => x.User).ToListAsync();
|
||||
var trialUser = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
|
||||
|
||||
var userinfoList = trialUser.Where(x => x.UserTypeEnum == UserTypeEnum.IQC).ToList();
|
||||
|
||||
|
@ -127,8 +127,8 @@ public class CRCSubmitedAndQCToAuditEventConsumer(
|
|||
/// CRC 回复质控质疑 通知QC Code012,013
|
||||
/// </summary>
|
||||
public class CRCRepliedQCChallengeEventConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<TrialUser> _trialUseRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUserRole> _trialUseRoleRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<QCChallenge> _qCChallengeRepository,
|
||||
|
@ -153,7 +153,7 @@ public class CRCRepliedQCChallengeEventConsumer(
|
|||
|
||||
|
||||
|
||||
var trialUser = await _trialUseRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.User).Select(x => x.User).ToListAsync();
|
||||
var trialUser = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
|
||||
|
||||
|
||||
|
||||
|
@ -224,8 +224,8 @@ public class CRCRepliedQCChallengeEventConsumer(
|
|||
/// QC回复 质控质疑,通知CRC (014,015)
|
||||
/// </summary>
|
||||
public class QCRepliedQCChallengeEventConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<TrialUser> _trialUseRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUserRole> _trialUseRoleRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<QCChallenge> _qCChallengeRepository,
|
||||
|
@ -259,7 +259,7 @@ public class QCRepliedQCChallengeEventConsumer(
|
|||
|
||||
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.Subject).FirstNotNullAsync();
|
||||
|
||||
var trialUser = await _trialUseRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.User).Select(x => x.User).ToListAsync();
|
||||
var trialUser = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
|
||||
|
||||
var userinfoList = trialUser.Where(x => x.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).ToList();
|
||||
|
||||
|
@ -333,8 +333,8 @@ public class QCRepliedQCChallengeEventConsumer(
|
|||
/// CRC 回复一致性核查质疑 通知PM (019,020)
|
||||
/// </summary>
|
||||
public class CRCRepliedCheckChallengeEventConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<TrialUser> _trialUseRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUserRole> _trialUseRoleRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<QCChallenge> _qCChallengeRepository,
|
||||
|
@ -354,7 +354,7 @@ public class CRCRepliedCheckChallengeEventConsumer(
|
|||
|
||||
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.Subject).FirstNotNullAsync();
|
||||
|
||||
var trialUser = await _trialUseRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.User).Select(x => x.User).ToListAsync();
|
||||
var trialUser = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
|
||||
|
||||
var userinfoList = trialUser.Where(x => x.UserTypeEnum == UserTypeEnum.APM || x.UserTypeEnum == UserTypeEnum.ProjectManager).ToList();
|
||||
|
||||
|
@ -425,8 +425,8 @@ public class CRCRepliedCheckChallengeEventConsumer(
|
|||
|
||||
/// </summary>
|
||||
public class PMRepliedCheckChallengeEventConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<TrialUser> _trialUseRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUserRole> _trialUseRoleRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<CheckChallengeDialog> _checkChallengeDialogRepository,
|
||||
|
@ -446,7 +446,7 @@ public class PMRepliedCheckChallengeEventConsumer(
|
|||
|
||||
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.NoneDicomStudyList).Include(x => x.StudyList).Include(x => x.Subject).FirstNotNullAsync();
|
||||
|
||||
var trialUser = await _trialUseRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.User).Select(x => x.User).ToListAsync();
|
||||
var trialUser = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
|
||||
|
||||
var userinfoList = trialUser.Where(x => x.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).ToList();
|
||||
|
||||
|
@ -524,8 +524,8 @@ public class PMRepliedCheckChallengeEventConsumer(
|
|||
/// 通知PM 进行一致性核查 (018,030)
|
||||
/// </summary>
|
||||
public class CheckStateChangedToAuditEventConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<TrialUser> _trialUseRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUserRole> _trialUseRoleRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<QCChallenge> _qCChallengeRepository,
|
||||
|
@ -544,7 +544,7 @@ public class CheckStateChangedToAuditEventConsumer(
|
|||
|
||||
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.Subject).FirstNotNullAsync();
|
||||
|
||||
var trialUser = await _trialUseRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.User).Select(x => x.User).ToListAsync();
|
||||
var trialUser = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
|
||||
|
||||
var userinfoList = trialUser.Where(x => x.UserTypeEnum == UserTypeEnum.APM || x.UserTypeEnum == UserTypeEnum.ProjectManager).ToList();
|
||||
|
||||
|
@ -612,8 +612,8 @@ public class CheckStateChangedToAuditEventConsumer(
|
|||
/// QC 领取了质控任务 (007,008)
|
||||
/// </summary>
|
||||
public class QCClaimTaskEventConsumer(
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<TrialUser> _trialUseRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialUserRole> _trialUseRoleRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<QCChallenge> _qCChallengeRepository,
|
||||
|
@ -639,7 +639,7 @@ public class QCClaimTaskEventConsumer(
|
|||
|
||||
|
||||
|
||||
var trialUser = await _trialUseRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.User).Select(x => x.User).ToListAsync();
|
||||
var trialUser = await _trialUseRoleRepository.Where(x => x.TrialId == subjectVisit.TrialId).Include(x => x.UserRole).Select(x => x.UserRole).ToListAsync();
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@ public class MasstransiTestCommand
|
|||
/// publish 请求流不会先到消费者,发布后,直接执行后续代码
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="_userRepository"></param>
|
||||
public class MasstransitTestConsumer(IRepository<User> _userRepository) : IConsumer<MasstransiTestCommand>
|
||||
/// <param name="_userRoleRepository"></param>
|
||||
public class MasstransitTestConsumer(IRepository<UserRole> _userRoleRepository) : IConsumer<MasstransiTestCommand>
|
||||
{
|
||||
public async Task Consume(ConsumeContext<MasstransiTestCommand> context)
|
||||
{
|
||||
|
||||
Console.WriteLine(_userRepository._dbContext.GetHashCode());
|
||||
Console.WriteLine(_userRoleRepository._dbContext.GetHashCode());
|
||||
Console.WriteLine("Now is " + DateTime.Now.ToString());
|
||||
Console.WriteLine($"MassTransit.Consumer :{context.Message.value}");
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
|||
IRepository<ReadingQuestionCriterionTrial> _trialReadingCriterionRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<Dictionary> _dictionaryRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig) : IConsumer<UrgentIRUnReadTaskRecurringEvent>
|
||||
{
|
||||
|
@ -52,12 +52,12 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
|||
|
||||
Expression<Func<VisitTask, bool>> comonTaskFilter = t => t.TrialId == trialId && t.TaskState == TaskState.Effect && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskAllocationState == TaskAllocationState.Allocated;
|
||||
|
||||
var trialUserList = _trialUserRepository.Where(t => t.TrialId == trialId).Select(t => new
|
||||
var trialUserList = _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialUser.JoinTime != null).Select(t => new
|
||||
{
|
||||
t.UserId,
|
||||
t.User.FullName,
|
||||
t.User.EMail,
|
||||
t.User.UserName,
|
||||
t.UserRole.FullName,
|
||||
t.UserRole.IdentityUser.EMail,
|
||||
t.UserRole.IdentityUser.UserName,
|
||||
t.Trial.TrialCode,
|
||||
t.Trial.ResearchProgramNo
|
||||
//TrialReadingCriterionList = t.Trial.TrialReadingCriterionList.Select(t => new { t.CriterionName, TrialReadingCriterionId = t.Id }).ToList()
|
||||
|
@ -69,7 +69,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring
|
|||
|
||||
var userId = trialUser.UserId;
|
||||
|
||||
var doctorCriterionList = await _trialReadingCriterionRepository.Where(t => t.IsSigned && t.IsConfirm && t.TrialId == trialId && t.Trial.TrialUserList.Any(t => t.UserId == userId))
|
||||
var doctorCriterionList = await _trialReadingCriterionRepository.Where(t => t.IsSigned && t.IsConfirm && t.TrialId == trialId && t.Trial.TrialUserRoleList.Any(t => t.UserId == userId))
|
||||
.Select(c => new
|
||||
{
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ public static class OldRecurringEmailHelper
|
|||
public static async Task SendTrialEmailAsync(
|
||||
IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialSiteUser> _trialSiteUserRepository,
|
||||
IRepository<TrialSiteUserRole> _trialSiteUserRoleRepository,
|
||||
|
||||
Guid trialId, EmailBusinessScenario businessScenario,
|
||||
Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc,
|
||||
|
@ -59,7 +59,7 @@ public static class OldRecurringEmailHelper
|
|||
|
||||
var allUserTypeEnumList = toUserTypeEnumList.Union(copyUserTypeEnumList).Distinct().ToList();
|
||||
|
||||
var allUserList = await _trialUserRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.User.UserTypeEnum)).Select(t => new { t.UserId, t.User.EMail, t.User.FullName, t.User.UserTypeEnum }).ToListAsync();
|
||||
var allUserList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.UserRole.UserTypeEnum)).Select(t => new { t.UserId, t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToListAsync();
|
||||
|
||||
|
||||
var toUserList = allUserList.Where(t => toUserTypeEnumList.Contains(t.UserTypeEnum))
|
||||
|
@ -72,7 +72,7 @@ public static class OldRecurringEmailHelper
|
|||
}
|
||||
if (trialSiteId != null && toUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA))
|
||||
{
|
||||
var curentSiteUserIdList = _trialSiteUserRepository.Where(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId).Select(t => t.UserId).ToList();
|
||||
var curentSiteUserIdList = _trialSiteUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId).Select(t => t.UserId).ToList();
|
||||
|
||||
toUserList = toUserList.Where(t => (t.UserTypeEnum != UserTypeEnum.CRA && t.UserTypeEnum != UserTypeEnum.ClinicalResearchCoordinator) || curentSiteUserIdList.Contains(t.UserId)).ToList();
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public static class OldRecurringEmailHelper
|
|||
|
||||
if (trialSiteId != null && copyUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA))
|
||||
{
|
||||
var curentSiteUserIdList = _trialSiteUserRepository.Where(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId).Select(t => t.UserId).ToList();
|
||||
var curentSiteUserIdList = _trialSiteUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId).Select(t => t.UserId).ToList();
|
||||
|
||||
copyUserList = copyUserList.Where(t => (t.UserTypeEnum != UserTypeEnum.CRA && t.UserTypeEnum != UserTypeEnum.ClinicalResearchCoordinator) || curentSiteUserIdList.Contains(t.UserId)).ToList();
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer;
|
|||
|
||||
public class QCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialSiteUser> _trialSiteUserRepository,
|
||||
IRepository<TrialSiteUserRole> _trialSiteUserRoleRepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> _SystemEmailSendConfig) : IConsumer<QCImageQuestionRecurringEvent>
|
||||
{
|
||||
public async Task Consume(ConsumeContext<QCImageQuestionRecurringEvent> context)
|
||||
|
@ -37,7 +37,7 @@ public class QCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRepo
|
|||
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr }).FirstNotNullAsync();
|
||||
|
||||
//找到 该项目的CRC 用户Id
|
||||
var userList = await _trialUserRepository.Where(t => t.TrialId == trialId).Where(t => t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Select(t => new { t.UserId, t.User.FullName }).ToListAsync();
|
||||
var userList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Select(t => new { t.UserId, t.UserRole.FullName }).ToListAsync();
|
||||
|
||||
//判断是否任务可以领取 ,可以的话 发送邮件
|
||||
|
||||
|
@ -73,9 +73,9 @@ public class QCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRepo
|
|||
await OldRecurringEmailHelper.SendTrialEmailAsync(
|
||||
_trialEmailNoticeConfigRepository,
|
||||
_trialRepository,
|
||||
_trialUserRepository,
|
||||
_trialUserRoleRepository,
|
||||
_visitTaskRepository,
|
||||
_trialSiteUserRepository,
|
||||
_trialSiteUserRoleRepository,
|
||||
trialId, EmailBusinessScenario.QCToCRCImageQuestion, topicAndHtmlFunc);
|
||||
}
|
||||
}
|
||||
|
@ -88,9 +88,9 @@ public class QCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRepo
|
|||
/// </summary>
|
||||
public class CRCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialSiteUser> _trialSiteUserRepository,
|
||||
IRepository<TrialSiteUserRole> _trialSiteUserRoleRepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> _SystemEmailSendConfig) : IConsumer<CRCImageQuestionRecurringEvent>
|
||||
{
|
||||
public async Task Consume(ConsumeContext<CRCImageQuestionRecurringEvent> context)
|
||||
|
@ -101,7 +101,7 @@ public class CRCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRep
|
|||
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr, t.DeclarationTypeEnumList }).FirstNotNullAsync();
|
||||
|
||||
//找到 该项目的IQC 用户Id
|
||||
var userList = await _trialUserRepository.Where(t => t.TrialId == trialId).Where(t => t.User.UserTypeEnum == UserTypeEnum.IQC).Select(t => new { t.UserId, t.User.FullName }).ToListAsync();
|
||||
var userList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.IQC).Select(t => new { t.UserId, t.UserRole.FullName }).ToListAsync();
|
||||
|
||||
//判断是否任务可以领取 ,可以的话 发送邮件
|
||||
|
||||
|
@ -141,9 +141,9 @@ public class CRCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRep
|
|||
|
||||
await OldRecurringEmailHelper.SendTrialEmailAsync(_trialEmailNoticeConfigRepository,
|
||||
_trialRepository,
|
||||
_trialUserRepository,
|
||||
_trialUserRoleRepository,
|
||||
_visitTaskRepository,
|
||||
_trialSiteUserRepository,
|
||||
_trialSiteUserRoleRepository,
|
||||
trialId, EmailBusinessScenario.CRCToQCQuestion, topicAndHtmlFunc);
|
||||
}
|
||||
}
|
||||
|
@ -155,9 +155,9 @@ public class CRCImageQuestionRecurringEventConsumer(IRepository<Trial> _trialRep
|
|||
/// </summary>
|
||||
public class ImageQCRecurringEventConsumer(IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialSiteUser> _trialSiteUserRepository,
|
||||
IRepository<TrialSiteUserRole> _trialSiteUserRoleRepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> _SystemEmailSendConfig) : IConsumer<ImageQCRecurringEvent>
|
||||
{
|
||||
public async Task Consume(ConsumeContext<ImageQCRecurringEvent> context)
|
||||
|
@ -169,7 +169,7 @@ public class ImageQCRecurringEventConsumer(IRepository<Trial> _trialRepository,
|
|||
var trialInfo = await _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.ResearchProgramNo, t.ExperimentName, t.TrialCode, t.TrialStatusStr }).FirstNotNullAsync();
|
||||
|
||||
//找到 该项目的IQC 用户Id
|
||||
var userList = await _trialUserRepository.Where(t => t.TrialId == trialId).Where(t => t.User.UserTypeEnum == UserTypeEnum.IQC).Select(t => new { t.UserId, t.User.FullName }).ToListAsync();
|
||||
var userList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId).Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.IQC).Select(t => new { t.UserId, t.UserRole.FullName }).ToListAsync();
|
||||
|
||||
//判断是否任务可以领取 ,可以的话 发送邮件
|
||||
var userIdList = userList.Select(t => t.UserId).ToList();
|
||||
|
@ -209,9 +209,9 @@ public class ImageQCRecurringEventConsumer(IRepository<Trial> _trialRepository,
|
|||
await OldRecurringEmailHelper.SendTrialEmailAsync(
|
||||
_trialEmailNoticeConfigRepository,
|
||||
_trialRepository,
|
||||
_trialUserRepository,
|
||||
_trialUserRoleRepository,
|
||||
_visitTaskRepository,
|
||||
_trialSiteUserRepository,
|
||||
_trialSiteUserRoleRepository,
|
||||
trialId, EmailBusinessScenario.QCTask, topicAndHtmlFunc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
Task<IResponseOutput> ApplyReReading(ApplyReReadingCommand applyReReadingCommand);
|
||||
|
||||
Task<IResponseOutput> ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService);
|
||||
Task<IResponseOutput> ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand);
|
||||
|
||||
Task<PageOutput<IRUnReadSubjectView>> GetSubjectReadingIQueryable(GetReadingIQueryableInDto inDto);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class TaskAllocationRuleService(IRepository<TaskAllocationRule> _taskAllocationRuleRepository,
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<Enroll> _enrollRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
||||
IRepository<SubjectCanceDoctor> _subjectCanceDoctorRepository,
|
||||
|
@ -124,15 +124,15 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<List<TrialDoctorUserSelectView>> GetDoctorUserSelectList(Guid trialId, [FromServices] IRepository<Enroll> _enrollRepository)
|
||||
{
|
||||
var query = from enroll in _enrollRepository.Where(t => t.TrialId == trialId && t.EnrollStatus >= EnrollStatus.ConfirmIntoGroup)
|
||||
join user in _userRepository.AsQueryable() on enroll.DoctorId equals user.DoctorId
|
||||
join user in _userRoleRepository.AsQueryable() on enroll.DoctorId equals user.DoctorId
|
||||
select new TrialDoctorUserSelectView()
|
||||
{
|
||||
TrialId = enroll.TrialId,
|
||||
//ReadingType = enroll.Trial.ReadingType,
|
||||
DoctorUserId = user.Id,
|
||||
FullName = user.FullName,
|
||||
UserCode = user.UserCode,
|
||||
UserName = user.UserName,
|
||||
FullName = user.IdentityUser.FullName,
|
||||
UserCode = user.IdentityUser.UserCode,
|
||||
UserName = user.IdentityUser.UserName,
|
||||
UserTypeEnum = user.UserTypeRole.UserTypeEnum,
|
||||
ReadingCategoryList = enroll.EnrollReadingCategoryList.Select(t => t.ReadingCategory).ToList()
|
||||
|
||||
|
@ -151,14 +151,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
.WhereIf(selectQuery.TrialReadingCriterionId != null && selectQuery.ReadingCategory == null, t => t.Enroll.EnrollReadingCategoryList.Any(t => t.TrialReadingCriterionId == selectQuery.TrialReadingCriterionId))
|
||||
.WhereIf(selectQuery.TrialReadingCriterionId != null && selectQuery.ReadingCategory != null,
|
||||
t => t.Enroll.EnrollReadingCategoryList.Any(t => t.TrialReadingCriterionId == selectQuery.TrialReadingCriterionId && t.ReadingCategory == selectQuery.ReadingCategory))
|
||||
join user in _userRepository.AsQueryable() on allocationRule.DoctorUserId equals user.Id
|
||||
join user in _userRoleRepository.AsQueryable() on allocationRule.DoctorUserId equals user.Id
|
||||
select new TrialDoctorUserSelectView()
|
||||
{
|
||||
TrialId = allocationRule.TrialId,
|
||||
DoctorUserId = user.Id,
|
||||
FullName = user.FullName,
|
||||
UserCode = user.UserCode,
|
||||
UserName = user.UserName,
|
||||
FullName = user.IdentityUser.FullName,
|
||||
UserCode = user.IdentityUser.UserCode,
|
||||
UserName = user.IdentityUser.UserName,
|
||||
UserTypeEnum = user.UserTypeRole.UserTypeEnum,
|
||||
|
||||
ReadingCategoryList = selectQuery.TrialReadingCriterionId == null ?
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<Enroll> _enrollRepository,
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialVirtualSiteCodeUpdate> _trialVirtualSiteCodeUpdateRepository,
|
||||
IVisitTaskHelpeService _visitTaskCommonService, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITaskConsistentRuleService
|
||||
{
|
||||
|
@ -369,7 +369,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var doctorUserIdQuery = from enroll in _enrollRepository.Where(t => t.TrialId == trialId).Where(t => t.EnrollReadingCategoryList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).Any(c => c.ReadingCategory == ReadingCategory.Global || c.ReadingCategory == ReadingCategory.Visit))
|
||||
.Where(t => t.EnrollReadingCriteriaList.Any(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.IsJoinAnalysis == true))
|
||||
join user in _userRepository.Where() on enroll.DoctorId equals user.DoctorId
|
||||
join user in _userRoleRepository.Where() on enroll.DoctorId equals user.DoctorId
|
||||
select user.Id;
|
||||
|
||||
var configDoctorUserIdList = await doctorUserIdQuery.ToListAsync();
|
||||
|
@ -707,9 +707,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
DoctorUserList = t.SubjectDoctorList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.IsConfirmed && t.ArmEnum <= Arm.DoubleReadingArm2).Select(t => new UserSimpleInfo()
|
||||
{
|
||||
UserId = t.Id,
|
||||
FullName = t.DoctorUser.FullName,
|
||||
UserCode = t.DoctorUser.UserCode,
|
||||
UserName = t.DoctorUser.UserName
|
||||
FullName = t.DoctorUser.IdentityUser.FullName,
|
||||
UserCode = t.DoctorUser.IdentityUser.UserCode,
|
||||
UserName = t.DoctorUser.IdentityUser.UserName
|
||||
}).ToList(),
|
||||
|
||||
ValidVisitCount = t.SubjectVisitTaskList.AsQueryable().Where(visitTaskFilter).GroupBy(t => new { t.SubjectId, t.VisitTaskNum }).Where(g => g.Count() == 2).Count(),
|
||||
|
@ -784,7 +784,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var taskConsistentRuleQueryable = from enroll in _enrollRepository.Where(t => t.TrialId == trialId && t.EnrollStatus == EnrollStatus.ConfirmIntoGroup
|
||||
&& t.EnrollReadingCriteriaList.Any(c => c.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && c.IsJoinAnalysis))
|
||||
join user in _userRepository.Where() on enroll.DoctorUserId equals user.Id
|
||||
join user in _userRoleRepository.Where() on enroll.DoctorUserId equals user.Id
|
||||
join taskConsistentRule in _taskConsistentRuleRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.IsSelfAnalysis) on enroll.TrialId equals taskConsistentRule.TrialId
|
||||
select new TaskConsistentRuleView()
|
||||
{
|
||||
|
@ -830,9 +830,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
AnalysisDoctorUser = new UserSimpleInfo()
|
||||
{
|
||||
UserId = user.Id,
|
||||
UserCode = user.UserCode,
|
||||
FullName = user.FullName,
|
||||
UserName = user.UserName
|
||||
UserCode = user.IdentityUser.UserCode,
|
||||
FullName = user.IdentityUser.FullName,
|
||||
UserName = user.IdentityUser.UserName
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class TaskMedicalReviewRuleService(IRepository<TaskMedicalReviewRule> _taskMedicalReviewRuleRepository,
|
||||
IRepository<TrialUser> _trialUserRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITaskMedicalReviewRuleService
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITaskMedicalReviewRuleService
|
||||
{
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
var taskTaskMedicalReviewRuleQueryable = _taskMedicalReviewRuleRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.ProjectTo<TaskMedicalReviewRuleView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var isHaveMIM = await _trialUserRepository.AnyAsync(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == inQuery.TrialId);
|
||||
var isHaveMIM = await _trialUserRoleRepository.AnyAsync(t => t.UserRole.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == inQuery.TrialId);
|
||||
|
||||
return (await taskTaskMedicalReviewRuleQueryable.ToListAsync(), new { IsHaveMIM = isHaveMIM });
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class TaskMedicalReviewService(IRepository<TaskMedicalReview> _taskMedicalReviewRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITaskMedicalReviewService
|
||||
{
|
||||
|
@ -196,7 +196,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<IResponseOutput<PageOutput<TaskMedicalReviewView>>> GetMIMMedicalReviewTaskList(TaskMedicalReviewQuery inQuery)
|
||||
{
|
||||
|
||||
var taskMedicalReviewQueryable = _taskMedicalReviewRepository.Where(t => t.VisitTask.TrialId == inQuery.TrialId && t.MedicalManagerUserId == _userInfo.Id && t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
|
||||
var taskMedicalReviewQueryable = _taskMedicalReviewRepository.Where(t => t.VisitTask.TrialId == inQuery.TrialId && t.MedicalManagerUserId == _userInfo.UserRoleId && t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
|
||||
|
||||
.WhereIf(inQuery.IsGetNextMedicalReviewTask,
|
||||
x => (
|
||||
|
@ -328,7 +328,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<List<UserSimpleInfo>> GetMIMUserList(Guid trialId)
|
||||
{
|
||||
var query = _trialUserRepository.Where(t => (t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM || t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MC) && t.TrialId == trialId).Select(t => t.User).ProjectTo<UserSimpleInfo>(_mapper.ConfigurationProvider);
|
||||
var query = _trialUserRoleRepository.Where(t => (t.UserRole.UserTypeEnum == Domain.Share.UserTypeEnum.MIM || t.UserRole.UserTypeEnum == Domain.Share.UserTypeEnum.MC) && t.TrialId == trialId).Select(t => t.UserRole).ProjectTo<UserSimpleInfo>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,9 +17,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
CreateMap<TaskAllocationRule, TaskAllocationRuleView>()
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.FullName))
|
||||
.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName));
|
||||
|
||||
List<Guid> subjectIdList = new List<Guid>();
|
||||
|
@ -27,9 +27,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
CreateMap<TaskAllocationRule, DoctorVisitTaskStatView>()
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.FullName))
|
||||
.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName))
|
||||
//.ForMember(o => o.ArmList, t => t.MapFrom(u => u.DoctorVisitTaskList.Where(c => c.TrialId == u.TrialId).Select(t => t.ArmEnum).Distinct()))
|
||||
.ForMember(o => o.TotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count()))
|
||||
|
@ -127,9 +127,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindSubjectCode :*/ u.Subject.Code))
|
||||
.ForMember(o => o.MedicalNo, t => t.MapFrom(u => u.Subject.MedicalNo))
|
||||
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.FullName))
|
||||
.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName))
|
||||
//.ForMember(o => o.IsClinicalDataSigned, t => t.MapFrom(u => u.Subject.ClinicalDataList.Any(c => c.IsSign && (c.ReadingId == u.SouceReadModuleId || c.ReadingId == u.SourceSubjectVisitId))))
|
||||
;
|
||||
|
@ -176,9 +176,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
CreateMap<VisitTask, HistoryReadingDoctorUser>()
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.FullName))
|
||||
.ForMember(o => o.JudgeTaskCode, t => t.MapFrom(u => u.TaskCode))
|
||||
.ForMember(o => o.DoctorUserId, t => t.MapFrom(u => u.DoctorUser.Id));
|
||||
|
||||
|
@ -195,9 +195,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<SubjectUser, AssignDoctorView>()
|
||||
//.ForMember(o => o.AssignTime, t => t.MapFrom(u => u.AssignTime))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.FullName))
|
||||
.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName));
|
||||
|
||||
|
||||
|
@ -205,7 +205,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<TaskAllocationRuleAddOrEdit, TaskAllocationRule>();
|
||||
|
||||
|
||||
CreateMap<User, TrialDoctorUserSelectView>()
|
||||
CreateMap<UserRole, TrialDoctorUserSelectView>()
|
||||
.ForMember(o => o.DoctorUserId, t => t.MapFrom(u => u.Id))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.FullName));
|
||||
|
||||
|
@ -250,12 +250,12 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
CreateMap<User, UserSimpleInfo>()
|
||||
CreateMap<UserRole, UserSimpleInfo>()
|
||||
|
||||
.ForMember(o => o.UserId, t => t.MapFrom(u => u.Id))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.FullName));
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.IdentityUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.IdentityUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.IdentityUser.FullName));
|
||||
//.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.UserTypeRole.UserTypeShortName));
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.WhereIf(queryCommonDocument.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == queryCommonDocument.BusinessScenarioEnum)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Code), t => t.Code.Contains(queryCommonDocument.Code))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryCommonDocument.Name), t => t.Name.Contains(queryCommonDocument.Name) || t.NameCN.Contains(queryCommonDocument.Name))
|
||||
.ProjectTo<CommonDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id });
|
||||
.ProjectTo<CommonDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.UserRoleId });
|
||||
|
||||
return await commonDocumentQueryable.ToPagedListAsync(queryCommonDocument);
|
||||
}
|
||||
|
|
|
@ -110,6 +110,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public string Module { get; set; } = string.Empty;
|
||||
|
||||
public int? State { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class BatchAddInternationalizationDto : BatchInternationalizationDto
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,7 +18,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Common")]
|
||||
public class InternationalizationService(IRepository<Internationalization> _internationalizationRepository,
|
||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IInternationalizationService
|
||||
IMapper _mapper, IRepository<PublishLog> _publishLogRepository, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IInternationalizationService
|
||||
{
|
||||
|
||||
|
||||
|
@ -61,6 +61,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> BatchAddOrUpdateFrontInternationalization(List<BatchInternationalizationDto> batchList)
|
||||
{
|
||||
var result = (await _publishLogRepository.Where(t => t.IsCurrentVersion == true).ProjectTo<PublishLogView>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
foreach (var item in batchList)
|
||||
{
|
||||
var find = await _internationalizationRepository.FirstOrDefaultAsync(t => t.Code == item.Code && t.Description == item.Description && t.InternationalizationType == 0);
|
||||
|
@ -71,13 +73,21 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
var frontState = item.State == null ? 0 : (int)item.State;
|
||||
|
||||
var mapItem = _mapper.Map<Internationalization>(item);
|
||||
mapItem.InternationalizationType = 0;
|
||||
|
||||
// 0 是预翻译 1是已确认 2是后端废弃
|
||||
mapItem.State = 0;
|
||||
mapItem.State = frontState;
|
||||
|
||||
await _internationalizationRepository.AddAsync(mapItem);
|
||||
find = await _internationalizationRepository.AddAsync(mapItem);
|
||||
}
|
||||
|
||||
if (find.PublishLogId == null || find.PublishLogId == Guid.Empty)
|
||||
{
|
||||
find.PublishLogId = result.Id;
|
||||
}
|
||||
}
|
||||
await _internationalizationRepository.SaveChangesAsync();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Auth;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MailKit;
|
||||
|
@ -29,11 +30,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
Task AdminResetPwdSendEmailAsync(Guid userId, string pwdNotMd5 = "123456");
|
||||
|
||||
Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl);
|
||||
Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string userTypes, string baseUrl, string rootUrl);
|
||||
|
||||
Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl);
|
||||
Task ExternalUserJoinEmail(Guid trialId, Guid userId, string userTypes, string baseUrl, string rootUrl);
|
||||
|
||||
Task<Guid> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl);
|
||||
Task<(Guid identityUserId, Guid userRoleId)> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl);
|
||||
|
||||
Task UserFeedBackMail(Guid feedBackId);
|
||||
}
|
||||
|
@ -42,7 +43,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
IRepository<SystemBasicData> _systemBasicDatarepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<UserLog> _userLogRepository,
|
||||
IRepository<IdentityUser> _identityUserRepository,
|
||||
IRepository<UserFeedBack> _userFeedBackRepository,
|
||||
ITokenService _tokenService,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
|
@ -169,83 +172,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||
}
|
||||
|
||||
//用户重置邮箱
|
||||
public async Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode)
|
||||
{
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
|
||||
//收件地址
|
||||
messageToSend.To.Add(new MailboxAddress(userName, emailAddress));
|
||||
//主题
|
||||
//---[来自展影IRC] 关于重置邮箱的提醒
|
||||
|
||||
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
|
||||
|
||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||
{
|
||||
var topicStr = string.Format(input.topicStr, companyName);
|
||||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
|
||||
userName,
|
||||
//---您正在进行邮箱重置操作
|
||||
verificationCode
|
||||
);
|
||||
|
||||
return (topicStr, htmlBodyStr);
|
||||
};
|
||||
|
||||
|
||||
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UserResetEmail, messageToSend, emailConfigFunc);
|
||||
|
||||
|
||||
var sucessHandle = GetEmailSuccessHandle(userId, verificationCode, emailAddress);
|
||||
|
||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//不登录 通过邮箱重置密码
|
||||
public async Task AnolymousSendEmailForResetAccount(string emailAddress, int verificationCode)
|
||||
{
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
|
||||
//收件地址
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, emailAddress));
|
||||
|
||||
|
||||
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
|
||||
|
||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||
{
|
||||
var topicStr = string.Format(input.topicStr, companyName);
|
||||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
|
||||
"Sir/Madam",
|
||||
//---您正在进行邮箱重置密码操作
|
||||
verificationCode
|
||||
);
|
||||
|
||||
return (topicStr, htmlBodyStr);
|
||||
};
|
||||
|
||||
|
||||
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UnloginUseEmailResetPassword, messageToSend, emailConfigFunc);
|
||||
|
||||
////此时不知道用户
|
||||
var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode, emailAddress);
|
||||
|
||||
|
||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reviewer简历录入 发送验证码
|
||||
/// </summary>
|
||||
|
@ -333,12 +264,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
}
|
||||
|
||||
#region 邮件已修改
|
||||
|
||||
//添加用户发送邮件
|
||||
public async Task AddUserSendEmailAsync(Guid userId, string baseUrl, string routeUrl)
|
||||
{
|
||||
|
||||
var sysUserInfo = (await _userRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).Include(t => t.UserRoleList).ThenInclude(c => c.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
|
@ -350,11 +282,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
//---[来自展影IRC] 关于创建账户的提醒
|
||||
|
||||
|
||||
var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map<UserBasicInfo>(sysUserInfo)));
|
||||
var token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = sysUserInfo.Id });
|
||||
|
||||
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token });
|
||||
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new IdentityUser() { EmailToken = token });
|
||||
|
||||
routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
routeUrl = routeUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
|
||||
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
|
||||
|
||||
|
@ -370,8 +302,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
|
||||
sysUserInfo.FullName,
|
||||
sysUserInfo.UserName,
|
||||
sysUserInfo.UserTypeRole.UserTypeShortName,
|
||||
sysUserInfo.EMail,
|
||||
//string.Join(',', sysUserInfo.UserRoleList.Select(t => t.UserTypeRole.UserTypeShortName)),
|
||||
redirectUrl
|
||||
);
|
||||
|
||||
|
@ -388,7 +320,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//管理员重置密码发送邮件
|
||||
public async Task AdminResetPwdSendEmailAsync(Guid userId, string pwdNotMd5 = "123456")
|
||||
{
|
||||
var sysUserInfo = (await _userRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).Include(t => t.UserRoleList).ThenInclude(c => c.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
|
@ -408,7 +340,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
sysUserInfo.FullName,
|
||||
sysUserInfo.UserName,
|
||||
sysUserInfo.UserTypeRole.UserTypeShortName,
|
||||
//string.Join(',', sysUserInfo.UserRoleList.Select(t => t.UserTypeRole.UserTypeShortName)),
|
||||
pwdNotMd5
|
||||
);
|
||||
|
||||
|
@ -421,11 +353,148 @@ namespace IRaCIS.Core.Application.Service
|
|||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
|
||||
}
|
||||
|
||||
//用户重置邮箱
|
||||
public async Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode)
|
||||
{
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
|
||||
//收件地址
|
||||
messageToSend.To.Add(new MailboxAddress(userName, emailAddress));
|
||||
//主题
|
||||
//---[来自展影IRC] 关于重置邮箱的提醒
|
||||
|
||||
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
|
||||
|
||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||
{
|
||||
var topicStr = string.Format(input.topicStr, companyName);
|
||||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
|
||||
userName,
|
||||
//---您正在进行邮箱重置操作
|
||||
verificationCode
|
||||
);
|
||||
|
||||
return (topicStr, htmlBodyStr);
|
||||
};
|
||||
|
||||
|
||||
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UserResetEmail, messageToSend, emailConfigFunc);
|
||||
|
||||
|
||||
var sucessHandle = GetEmailSuccessHandle(userId, verificationCode, emailAddress);
|
||||
|
||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//不登录 通过邮箱重置密码
|
||||
public async Task AnolymousSendEmailForResetAccount(string emailAddress, int verificationCode)
|
||||
{
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
|
||||
//收件地址
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, emailAddress));
|
||||
|
||||
|
||||
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
|
||||
|
||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||
{
|
||||
var topicStr = string.Format(input.topicStr, companyName);
|
||||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
|
||||
"Sir/Madam",
|
||||
//---您正在进行邮箱重置密码操作
|
||||
verificationCode
|
||||
);
|
||||
|
||||
return (topicStr, htmlBodyStr);
|
||||
};
|
||||
|
||||
|
||||
await GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario.UnloginUseEmailResetPassword, messageToSend, emailConfigFunc);
|
||||
|
||||
////此时不知道用户
|
||||
var sucessHandle = GetEmailSuccessHandle(Guid.Empty, verificationCode, emailAddress);
|
||||
|
||||
|
||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||
}
|
||||
|
||||
//外部用户 加入项目
|
||||
public async Task ExternalUserJoinEmail(Guid trialId, Guid userId, string userTypes, string baseUrl, string rootUrl)
|
||||
{
|
||||
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId)).IfNullThrowException();
|
||||
|
||||
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
|
||||
//收件地址
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, sysUserInfo.EMail));
|
||||
//主题
|
||||
// $"[来自展影IRC] [{trialInfo.ResearchProgramNo}]邀请信";
|
||||
|
||||
|
||||
|
||||
var token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = sysUserInfo.Id });
|
||||
if (sysUserInfo.IsFirstAdd)
|
||||
{
|
||||
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new Domain.Models.IdentityUser() { EmailToken = token });
|
||||
}
|
||||
|
||||
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
|
||||
|
||||
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
|
||||
var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}";
|
||||
|
||||
|
||||
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
|
||||
|
||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||
{
|
||||
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
|
||||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
|
||||
sysUserInfo.FullName,
|
||||
trialInfo.ExperimentName,
|
||||
trialInfo.ResearchProgramNo,
|
||||
trialInfo.TrialCode,
|
||||
sysUserInfo.IsFirstAdd ? sysUserInfo.EMail : sysUserInfo.UserName,
|
||||
userTypes,
|
||||
sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl
|
||||
);
|
||||
|
||||
return (topicStr, htmlBodyStr);
|
||||
};
|
||||
|
||||
|
||||
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.SiteUseOrExternalUserFirstrJoinTrial : EmailBusinessScenario.SiteUserOrExternalUserExistJoinTrial, messageToSend, emailConfigFunc);
|
||||
|
||||
|
||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null);
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = userId, OptType = UserOptType.UpdateUserRole }, true);
|
||||
|
||||
}
|
||||
|
||||
//Site调研 用户加入项目
|
||||
public async Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl)
|
||||
public async Task SiteSurveyUserJoinEmail(Guid trialId, Guid userId, string userTypes, string baseUrl, string rootUrl)
|
||||
{
|
||||
var sysUserInfo = (await _userRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
var sysUserInfo = (await _identityUserRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
|
||||
var trialInfo = await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId);
|
||||
|
||||
|
@ -438,14 +507,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
// $"[来自展影IRC] [{trialInfo.ResearchProgramNo}]邀请信";
|
||||
|
||||
|
||||
var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map<UserBasicInfo>(sysUserInfo)));
|
||||
var token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = sysUserInfo.Id });
|
||||
|
||||
if (sysUserInfo.IsFirstAdd)
|
||||
{
|
||||
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token });
|
||||
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new Domain.Models.IdentityUser() { EmailToken = token });
|
||||
}
|
||||
|
||||
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
|
||||
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
|
||||
|
||||
|
@ -464,8 +533,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
trialInfo.ExperimentName,
|
||||
trialInfo.ResearchProgramNo,
|
||||
trialInfo.TrialCode,
|
||||
sysUserInfo.UserName,
|
||||
sysUserInfo.UserTypeRole.UserTypeShortName,
|
||||
sysUserInfo.IsFirstAdd ? sysUserInfo.EMail : sysUserInfo.UserName,
|
||||
userTypes,
|
||||
sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl
|
||||
);
|
||||
|
||||
|
@ -478,74 +547,19 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig);
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = userId, OptType = UserOptType.UpdateUserRole }, true);
|
||||
|
||||
}
|
||||
|
||||
//外部用户 加入项目
|
||||
public async Task ExternalUserJoinEmail(Guid trialId, Guid userId, string baseUrl, string rootUrl)
|
||||
{
|
||||
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialId)).IfNullThrowException();
|
||||
|
||||
var sysUserInfo = (await _userRepository.Where(t => t.Id == userId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
|
||||
//收件地址
|
||||
messageToSend.To.Add(new MailboxAddress(String.Empty, sysUserInfo.EMail));
|
||||
//主题
|
||||
// $"[来自展影IRC] [{trialInfo.ResearchProgramNo}]邀请信";
|
||||
|
||||
|
||||
|
||||
var token = _tokenService.GetToken(IRaCISClaims.Create(_mapper.Map<UserBasicInfo>(sysUserInfo)));
|
||||
if (sysUserInfo.IsFirstAdd)
|
||||
{
|
||||
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token });
|
||||
}
|
||||
|
||||
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
|
||||
|
||||
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + sysUserInfo.UserTypeRole.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
|
||||
var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}";
|
||||
|
||||
|
||||
var companyName = _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN;
|
||||
|
||||
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailConfigFunc = input =>
|
||||
{
|
||||
var topicStr = string.Format(input.topicStr, companyName, trialInfo.ResearchProgramNo);
|
||||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
|
||||
sysUserInfo.FullName,
|
||||
trialInfo.ExperimentName,
|
||||
trialInfo.ResearchProgramNo,
|
||||
trialInfo.TrialCode,
|
||||
sysUserInfo.UserName,
|
||||
sysUserInfo.UserTypeRole.UserTypeShortName,
|
||||
sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl
|
||||
);
|
||||
|
||||
return (topicStr, htmlBodyStr);
|
||||
};
|
||||
|
||||
|
||||
await GetEmailSubejctAndHtmlInfoAndBuildAsync(sysUserInfo.IsFirstAdd ? EmailBusinessScenario.SiteUseOrExternalUserFirstrJoinTrial : EmailBusinessScenario.SiteUserOrExternalUserExistJoinTrial, messageToSend, emailConfigFunc);
|
||||
|
||||
|
||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
//医生生成账号加入 或者已存在账号加入到项目中
|
||||
public async Task<Guid> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl)
|
||||
public async Task<(Guid identityUserId, Guid userRoleId)> DoctorJoinTrialEmail(Guid trialId, Guid doctorId, string baseUrl, string rootUrl)
|
||||
{
|
||||
var doctor = await _doctorTypeRepository.FindAsync(doctorId);
|
||||
User sysUserInfo = new User();
|
||||
var sysUserInfo = new IdentityUser();
|
||||
|
||||
var userType = await _userTypeRepository.FirstAsync(t => t.UserTypeEnum == UserTypeEnum.IndependentReviewer);
|
||||
|
||||
|
@ -553,13 +567,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
using (await @lock.AcquireAsync())
|
||||
{
|
||||
var isDoctorHaveAccount = await _userRepository.AnyAsync(t => t.DoctorId == doctorId);
|
||||
var isDoctorHaveAccount = await _userRoleRepository.AnyAsync(t => t.DoctorId == doctorId || t.IdentityUser.EMail == doctor.EMail);
|
||||
|
||||
|
||||
if (!isDoctorHaveAccount)
|
||||
{
|
||||
|
||||
var saveItem = new User() { FirstName = doctor.FirstName, LastName = doctor.LastName, EMail = doctor.EMail };
|
||||
var saveItem = new IdentityUser() { FirstName = doctor.FirstName, LastName = doctor.LastName, EMail = doctor.EMail };
|
||||
|
||||
var trialType = await _trialRepository.Where(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefaultAsync();
|
||||
|
||||
|
@ -569,31 +583,40 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1;
|
||||
saveItem.Code = _identityUserRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1;
|
||||
|
||||
saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User));
|
||||
saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(IdentityUser));
|
||||
|
||||
saveItem.UserName = saveItem.UserCode;
|
||||
saveItem.UserRoleList = new List<UserRole>() { new UserRole() { DoctorId = doctorId, UserTypeEnum = UserTypeEnum.IndependentReviewer, UserTypeId = userType.Id } };
|
||||
|
||||
saveItem.UserTypeEnum = UserTypeEnum.IndependentReviewer;
|
||||
|
||||
saveItem.DoctorId = doctorId;
|
||||
saveItem.UserTypeId = userType.Id;
|
||||
|
||||
var savedUser = await _userRepository.AddAsync(saveItem);
|
||||
var savedUser = await _identityUserRepository.AddAsync(saveItem);
|
||||
|
||||
//下面获取Token 需要这部分信息
|
||||
sysUserInfo = savedUser.Clone();
|
||||
|
||||
sysUserInfo.UserTypeRole = userType;
|
||||
|
||||
await _userRepository.SaveChangesAsync();
|
||||
sysUserInfo = savedUser;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sysUserInfo = (await _userRepository.Where(t => t.DoctorId == doctorId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
sysUserInfo = (await _identityUserRepository.Where(t => t.UserRoleList.Any(t => t.DoctorId == doctorId || t.IdentityUser.EMail == doctor.EMail), true).Include(t => t.UserRoleList).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
var findRole = sysUserInfo.UserRoleList.FirstOrDefault(t => t.UserTypeId == userType.Id);
|
||||
//不存在该角色,那么就加入该角色
|
||||
if (findRole == null)
|
||||
{
|
||||
sysUserInfo.UserRoleList.Add(new UserRole() { DoctorId = doctorId, UserTypeEnum = UserTypeEnum.IndependentReviewer, UserTypeId = userType.Id });
|
||||
}
|
||||
else
|
||||
{
|
||||
findRole.IsUserRoleDisabled = false;
|
||||
}
|
||||
|
||||
sysUserInfo.Status = UserStateEnum.Enable;
|
||||
|
||||
}
|
||||
|
||||
//保证能有userRoleId
|
||||
await _userRoleRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
@ -607,20 +630,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
var basicInfo = IRaCISClaims.Create(_mapper.Map<UserBasicInfo>(sysUserInfo));
|
||||
|
||||
////第一次添加的时候 注意赋值
|
||||
//basicInfo.PermissionStr = userType.PermissionStr;
|
||||
//basicInfo.UserTypeShortName = userType.UserTypeShortName;
|
||||
|
||||
var token = _tokenService.GetToken(basicInfo);
|
||||
var token = _tokenService.GetToken(new UserTokenInfo() { IdentityUserId = sysUserInfo.Id });
|
||||
|
||||
if (sysUserInfo.IsFirstAdd)
|
||||
{
|
||||
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new User() { EmailToken = token });
|
||||
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id, u => new Domain.Models.IdentityUser() { EmailToken = token });
|
||||
}
|
||||
|
||||
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&UserName=" + sysUserInfo.UserName + "&UserType=" + userType.UserTypeShortName + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
var routeUrl = rootUrl + "?UserId=" + sysUserInfo.Id + "&Email=" + sysUserInfo.EMail + "&lang=" + (_userInfo.IsEn_Us ? "en" : "zh") + "&access_token=" + token;
|
||||
|
||||
var domain = baseUrl.Substring(0, baseUrl.IndexOf("/login"));
|
||||
|
||||
|
@ -642,8 +659,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
trialInfo.ExperimentName,
|
||||
trialInfo.ResearchProgramNo,
|
||||
trialInfo.TrialCode,
|
||||
sysUserInfo.UserName,
|
||||
userType.UserTypeShortName,
|
||||
sysUserInfo.IsFirstAdd ? sysUserInfo.EMail : sysUserInfo.UserName,
|
||||
$"{userType.UserTypeShortName} ({userType.UserTypeName})",
|
||||
sysUserInfo.IsFirstAdd ? redirectUrl : baseUrl
|
||||
);
|
||||
|
||||
|
@ -656,7 +673,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, null);
|
||||
|
||||
return sysUserInfo.Id;
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = sysUserInfo.Id, OptType = UserOptType.UpdateUserRole }, true);
|
||||
|
||||
|
||||
return (sysUserInfo.Id, sysUserInfo.UserRoleList.First(t => t.UserTypeEnum == UserTypeEnum.IndependentReviewer).Id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -664,7 +684,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
public async Task UserFeedBackMail(Guid feedBackId)
|
||||
{
|
||||
var feedBack = await _userFeedBackRepository.Where(t => t.Id == feedBackId).Include(t => t.CreateUser).ThenInclude(t => t.UserTypeRole).FirstNotNullAsync();
|
||||
var feedBack = await _userFeedBackRepository.Where(t => t.Id == feedBackId).Include(t => t.CreateUserRole.UserTypeRole).Include(t => t.CreateUserRole.IdentityUser).FirstNotNullAsync();
|
||||
|
||||
var messageToSend = new MimeMessage();
|
||||
//发件地址
|
||||
|
@ -680,8 +700,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var userTypeEnumList = emailConfigInfo.EmailNoticeUserTypeList.Where(t => t.EmailUserType == EmailUserType.To).Select(t => t.UserType).ToList();
|
||||
|
||||
var emailList = await _userRepository.Where(t => userTypeEnumList.Contains(t.UserTypeEnum) &&
|
||||
(isHaveTrialId ? t.UserTrials.Any(t => t.TrialId == feedBack.TrialId) : true)).Select(t => new { t.EMail, t.UserTypeEnum, t.FullName }).ToListAsync();
|
||||
var emailList = await _userRoleRepository.Where(t => userTypeEnumList.Contains(t.UserTypeEnum) && t.IsUserRoleDisabled == false && t.IdentityUser.Status == UserStateEnum.Enable &&
|
||||
(isHaveTrialId ? t.IdentityUser.UserTrialList.Any(t => t.TrialId == feedBack.TrialId && t.TrialUserRoleList.Any(c => userTypeEnumList.Contains(c.UserRole.UserTypeEnum))) : true)).Select(t => new { t.IdentityUser.EMail, t.UserTypeEnum, t.IdentityUser.FullName }).ToListAsync();
|
||||
|
||||
|
||||
foreach (var email in emailList)
|
||||
|
@ -709,8 +729,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
info.TrialCode,
|
||||
info.SubejctCode,
|
||||
info.VisitName,
|
||||
feedBack.CreateUser.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUser.FullName,
|
||||
feedBack.CreateUserRole.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUserRole.IdentityUser.FullName,
|
||||
emailType,
|
||||
feedBack.QuestionDescription,
|
||||
_systemEmailConfig.SiteUrl
|
||||
|
@ -739,8 +759,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
info.TrialCode,
|
||||
info.SubejctCode,
|
||||
info.VisitName,
|
||||
feedBack.CreateUser.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUser.FullName,
|
||||
feedBack.CreateUserRole.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUserRole.IdentityUser.FullName,
|
||||
emailType,
|
||||
feedBack.QuestionDescription,
|
||||
_systemEmailConfig.SiteUrl
|
||||
|
@ -768,8 +788,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
userNames,
|
||||
info.TrialCode,
|
||||
feedBack.CreateUser.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUser.FullName,
|
||||
feedBack.CreateUserRole.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUserRole.IdentityUser.FullName,
|
||||
emailType,
|
||||
feedBack.QuestionDescription,
|
||||
_systemEmailConfig.SiteUrl
|
||||
|
@ -793,8 +813,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var htmlBodyStr = string.Format(ReplaceCompanyName(input.htmlBodyStr),
|
||||
userNames,
|
||||
feedBack.CreateUser.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUser.FullName,
|
||||
feedBack.CreateUserRole.UserTypeRole.UserTypeShortName,
|
||||
feedBack.CreateUserRole.IdentityUser.FullName,
|
||||
feedBack.QuestionDescription,
|
||||
_systemEmailConfig.SiteUrl
|
||||
);
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
Version version;
|
||||
|
||||
if (!Version.TryParse(addOrEditPublishLog.Version, out version)|| !Version.TryParse(addOrEditPublishLog.Version_US, out version))
|
||||
if (!Version.TryParse(addOrEditPublishLog.Version, out version))
|
||||
{
|
||||
//"版本号不符合要求"
|
||||
return ResponseOutput.NotOk(_localizer["PublishLog_NotValidVersion"]);
|
||||
|
@ -50,7 +50,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var verifyExp1 = new EntityVerifyExp<PublishLog>()
|
||||
{
|
||||
VerifyExp = u => u.Version == addOrEditPublishLog.Version || u.Version_US == addOrEditPublishLog.Version_US,
|
||||
VerifyExp = u => u.Version == addOrEditPublishLog.Version ,
|
||||
|
||||
//"发布编号不能重复"
|
||||
VerifyMsg = _localizer["PublishLog_RepeatVersion"]
|
||||
|
|
|
@ -98,9 +98,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
CreateMap<TrialImageDownload, TrialImageDownloadExportDto>()
|
||||
.ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUser.FullName))
|
||||
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUser.UserTypeEnum))
|
||||
.ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUser.UserName))
|
||||
.ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUserRole.FullName))
|
||||
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUserRole.UserTypeEnum))
|
||||
.ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName))
|
||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode));
|
||||
|
||||
|
||||
|
|
|
@ -322,6 +322,35 @@ namespace IRaCIS.Application.Contracts
|
|||
/// </summary>
|
||||
public string WorkPartTimeEn { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 大学
|
||||
/// </summary>
|
||||
public string UniversityAffiliated { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 大学
|
||||
/// </summary>
|
||||
public string UniversityAffiliatedCN { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string City { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string CityCN { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 医院
|
||||
/// </summary>
|
||||
public string HospitalName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 医院
|
||||
/// </summary>
|
||||
public string HospitalNameCN { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
|
@ -666,6 +695,55 @@ namespace IRaCIS.Application.Contracts
|
|||
/// </summary>
|
||||
public string WorkPartTimeEn { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 大学
|
||||
/// </summary>
|
||||
public string University { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 大学
|
||||
/// </summary>
|
||||
public string UniversityCN { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string City { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 城市
|
||||
/// </summary>
|
||||
public string CityCN { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 医院
|
||||
/// </summary>
|
||||
public string HospitalEn { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 医院
|
||||
/// </summary>
|
||||
public string HospitalCN { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 大学
|
||||
/// </summary>
|
||||
public string UniversityAffiliated { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 大学
|
||||
/// </summary>
|
||||
public string UniversityAffiliatedCN { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 医院
|
||||
/// </summary>
|
||||
public string HospitalName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 医院
|
||||
/// </summary>
|
||||
public string HospitalNameCN { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
}
|
||||
public class PostgraduateCommand
|
||||
{
|
||||
|
||||
public Guid? Id { get; set; }
|
||||
public Guid DoctorId { get; set; }
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
IRepository<DoctorDictionary> _doctorDictionaryRepository,
|
||||
IRepository<DoctorSummarize> _doctorSummarizeRepository,
|
||||
IRepository<Enroll> _enrollRepository,
|
||||
IRepository<Hospital> _hospitalRepository,
|
||||
IRepository<Dictionary> _dictionaryRepository,
|
||||
IRepository<Attachment> _attachmentRepository,
|
||||
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
|
||||
|
@ -229,7 +230,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<DoctorSummarize> AddOrUpdateGneralSituation(SummarizeInfoDto inDto)
|
||||
public async Task<(DoctorSummarize,bool)> AddOrUpdateGneralSituation(SummarizeInfoDto inDto)
|
||||
{
|
||||
if (inDto.TrialId != null&&inDto.Id==null)
|
||||
{
|
||||
|
@ -261,6 +262,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
inDto.IndicationEn = "Default";
|
||||
}
|
||||
var exists = await _doctorSummarizeRepository
|
||||
.Where(x=> x.IndicationEn!=string.Empty && x.Indication!=string.Empty)
|
||||
.Where( x => x.IndicationEn == inDto.IndicationEn|| x.Indication == inDto.Indication)
|
||||
|
||||
.AnyAsync(x => x.DoctorId == inDto.DoctorId && x.TrialId == null&&x.Id!=inDto.Id);
|
||||
|
@ -319,7 +321,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
var entity = await _doctorSummarizeRepository.InsertOrUpdateAsync(inDto, true);
|
||||
return entity;
|
||||
return (entity,true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -581,7 +583,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
[HttpPost]
|
||||
|
||||
public async Task<IResponseOutput> UpdateEmploymentInfo(EmploymentCommand doctorWorkInfoModel)
|
||||
public async Task<IResponseOutput> UpdateEmploymentInfo(EmploymentCommand inDto)
|
||||
{
|
||||
#region 废弃
|
||||
//var success = _doctorRepository.Update(d => d.Id == doctorWorkInfoModel.Id, u => new Doctor()
|
||||
|
@ -611,8 +613,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//var success = _doctorRepository.SaveChanges();
|
||||
#endregion
|
||||
|
||||
|
||||
var entity = await _doctorRepository.InsertOrUpdateAsync(doctorWorkInfoModel, true);
|
||||
var entity = await _doctorRepository.InsertOrUpdateAsync(inDto, true);
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
@ -721,7 +722,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpPost]
|
||||
public async Task<IResponseOutput> UpdateAuditResume(ResumeConfirmCommand auditResumeParam)
|
||||
{
|
||||
var userId = _userInfo.Id;
|
||||
var userId = _userInfo.UserRoleId;
|
||||
//判断 合作协议、正式简历 是否有。如果没有,显示提示信息,并且不能保存
|
||||
var attachmentList = await _attachmentRepository.Where(u => u.DoctorId == auditResumeParam.Id)
|
||||
.Select(u => u.Type).ToListAsync();
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
[ApiExplorerSettings(GroupName = "Reviewer")]
|
||||
public class EducationService(IRepository<Postgraduate> _postgraduateRepository,
|
||||
IRepository<Hospital> _hospitalRepository,
|
||||
IRepository<Education> _educationRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IEducationService
|
||||
{
|
||||
|
||||
|
@ -88,7 +89,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <summary> 添加/更新医生继续学习经历</summary>
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddOrUpdatePostgraduateInfo(PostgraduateCommand postgraduateViewModel)
|
||||
public async Task<IResponseOutput> AddOrUpdatePostgraduateInfo(PostgraduateCommand inDto)
|
||||
{
|
||||
#region 封装前
|
||||
|
||||
|
@ -109,8 +110,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
//}
|
||||
#endregion
|
||||
|
||||
var entity = await _postgraduateRepository.InsertOrUpdateAsync(postgraduateViewModel, true);
|
||||
var entity = await _postgraduateRepository.InsertOrUpdateAsync(inDto, true);
|
||||
return ResponseOutput.Ok(entity.Id);
|
||||
}
|
||||
/// <summary>
|
||||
|
|
|
@ -67,9 +67,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<Vacation, VacationCommand>();
|
||||
CreateMap<ResearchPublication, ResearchPublicationDTO>();
|
||||
CreateMap<Postgraduate, PostgraduateViewModel>()
|
||||
.ForMember(t => t.Hospital, c => c.MapFrom(d => d.HospitalEnt.HospitalName))
|
||||
.ForMember(t => t.HospitalCN, c => c.MapFrom(d => d.HospitalEnt.HospitalNameCN));
|
||||
CreateMap<Postgraduate, PostgraduateViewModel>();
|
||||
// .ForMember(t => t.Hospital, c => c.MapFrom(d => d.HospitalEnt.HospitalName))
|
||||
//.ForMember(t => t.HospitalCN, c => c.MapFrom(d => d.HospitalEnt.HospitalNameCN));
|
||||
CreateMap<Attachment, AttachmentDTO>();
|
||||
CreateMap<Doctor, ResumeConfirmDTO>();
|
||||
|
||||
|
@ -99,11 +99,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<DoctorDTO, SelectionReviewerDTO>()
|
||||
;
|
||||
|
||||
CreateMap<User, UserBasicInfo>()
|
||||
.ForMember(d => d.UserTypeShortName, u => u.MapFrom(t => t.UserTypeRole.UserTypeShortName))
|
||||
.ForMember(d => d.Code, u => u.MapFrom(t => t.UserCode))
|
||||
.ForMember(d => d.PermissionStr, u => u.MapFrom(t => t.UserTypeRole.PermissionStr))
|
||||
.ForMember(d => d.RealName, u => u.MapFrom(user => string.IsNullOrEmpty(user.FirstName) ? user.LastName : user.LastName + " / " + user.FirstName));
|
||||
CreateMap<UserRole, UserBasicInfo>();
|
||||
|
||||
CreateMap<TrialExperience, TrialExperienceListDTO>()
|
||||
.ForMember(x=>x.VisitReadingCount, u => u.MapFrom(t => (t.ExperienceDataType==ExperienceDataType.TrialAuto||t.ExperienceDataType==ExperienceDataType.SystemAuto)?
|
||||
|
@ -116,15 +112,17 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.EvaluationCriteriaList, u => u.MapFrom(t => t.ExperienceCriteriaList.Select(t => t.EvaluationCriteria.Value)))
|
||||
.ForMember(d => d.EvaluationCriteriaIdList, u => u.MapFrom(t => t.ExperienceCriteriaList.Select(t => t.EvaluationCriteriaId)));
|
||||
|
||||
CreateMap<Doctor, UserBasicInfo>()
|
||||
.ForMember(d => d.Code, u => u.MapFrom(t => t.ReviewerCode))
|
||||
.ForMember(d => d.RealName, u => u.MapFrom(t => t.ChineseName))
|
||||
.ForMember(d => d.IsReviewer, u => u.MapFrom(t => true))
|
||||
.ForMember(d => d.UserName, u => u.MapFrom(doctor => doctor.LastName + " / " + doctor.FirstName));
|
||||
//CreateMap<Doctor, UserBasicInfo>()
|
||||
// .ForMember(d => d.Code, u => u.MapFrom(t => t.ReviewerCode))
|
||||
// .ForMember(d => d.RealName, u => u.MapFrom(t => t.ChineseName))
|
||||
// .ForMember(d => d.IsReviewer, u => u.MapFrom(t => true))
|
||||
// .ForMember(d => d.UserName, u => u.MapFrom(doctor => doctor.LastName + " / " + doctor.FirstName));
|
||||
|
||||
#region 医生基本信息
|
||||
CreateMap<Doctor, SelectionReviewerDTO>()
|
||||
.ForMember(d => d.DoctorUserName, u => u.MapFrom(t => t.User.UserName));
|
||||
.ForMember(d => d.DoctorUserName, u => u.MapFrom(t => t.UserRole.IdentityUser.UserName));
|
||||
|
||||
|
||||
CreateMap<Doctor, DoctorDTO>().IncludeMembers(t => t.Hospital).Include<Doctor, SelectionReviewerDTO>()
|
||||
.ForMember(d => d.AccountUserName, u => u.MapFrom(s => s.EnrollList.Where(t => t.DoctorUserId != null).Select(c => c.DoctorUser.UserName).FirstOrDefault()))
|
||||
.ForMember(d => d.Department, u => u.MapFrom(s => s.Department.Value))
|
||||
|
@ -182,7 +180,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<EnrollDetail, DoctorStateModelDTO>()
|
||||
.ForMember(d => d.IntoGroupState, u => u.MapFrom(s => s.EnrollStatus))
|
||||
.ForMember(d => d.OptTime, u => u.MapFrom(s => s.CreateTime))
|
||||
.ForMember(d => d.OptUserName, u => u.MapFrom(s => s.CreateUser.UserName));
|
||||
.ForMember(d => d.OptUserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName));
|
||||
|
||||
CreateMap<Enroll, ConfirmationReviewerDTO>().IncludeMembers(t => t.Doctor, t => t.Doctor.Hospital)
|
||||
.ForMember(o => o.DictionaryList, t => t.MapFrom(u => u.Doctor.DoctorDicRelationList.Where(t => t.KeyName == StaticData.ReadingType || t.KeyName == StaticData.Subspeciality).Select(t => t.Dictionary).OrderBy(t => t.ShowOrder)))
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// 生成时间 2022-01-05 09:17:10
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace IRaCIS.Core.Application.Contracts
|
||||
|
@ -38,6 +39,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public string ExperimentName { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,8 +58,14 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string RealName { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public Guid UserTypeId { get; set; }
|
||||
public string UserTypeShortName { get; set; } = string.Empty;
|
||||
public string DocTypeCode { get; set; }
|
||||
|
||||
public List<string> UserConfirmedUserTypeList => (DocNeedSignUserTypeList != null && IdentityUserTypeList != null) ? IdentityUserTypeList.Intersect(DocNeedSignUserTypeList).ToList() : new List<string>();
|
||||
|
||||
|
||||
public IEnumerable<string> IdentityUserTypeList { get; set; }
|
||||
public IEnumerable<string> DocNeedSignUserTypeList { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
public class EmailSendService(IRepository<TrialEmailNoticeConfig> _trialEmailNoticeConfigRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialSiteUser> _trialSiteUserRepository,
|
||||
IRepository<TrialSiteUserRole> _trialSiteUserRoleRepository,
|
||||
IOptionsMonitor<SystemEmailSendConfig> _SystemEmailSendConfig, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IEmailSendService
|
||||
{
|
||||
|
||||
|
@ -144,7 +144,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var allUserTypeEnumList = toUserTypeEnumList.Union(copyUserTypeEnumList).Distinct().ToList();
|
||||
|
||||
var allUserList = await _trialUserRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.User.UserTypeEnum)).Select(t => new { t.UserId, t.User.EMail, t.User.FullName, t.User.UserTypeEnum }).ToListAsync();
|
||||
var allUserList = await _trialUserRoleRepository.Where(t => t.TrialId == trialId && allUserTypeEnumList.Contains(t.UserRole.UserTypeEnum)).Select(t => new { t.UserId, t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum }).ToListAsync();
|
||||
|
||||
|
||||
var toUserList = allUserList.Where(t => toUserTypeEnumList.Contains(t.UserTypeEnum))
|
||||
|
@ -157,7 +157,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
if (trialSiteId != null && toUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA))
|
||||
{
|
||||
var curentSiteUserIdList = _trialSiteUserRepository.Where(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId).Select(t => t.UserId).ToList();
|
||||
var curentSiteUserIdList = _trialSiteUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId).Select(t => t.UserId).ToList();
|
||||
|
||||
toUserList = toUserList.Where(t => (t.UserTypeEnum != UserTypeEnum.CRA && t.UserTypeEnum != UserTypeEnum.ClinicalResearchCoordinator) || curentSiteUserIdList.Contains(t.UserId)).ToList();
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
if (trialSiteId != null && copyUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA))
|
||||
{
|
||||
var curentSiteUserIdList = _trialSiteUserRepository.Where(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId).Select(t => t.UserId).ToList();
|
||||
var curentSiteUserIdList = _trialSiteUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId).Select(t => t.UserId).ToList();
|
||||
|
||||
copyUserList = copyUserList.Where(t => (t.UserTypeEnum != UserTypeEnum.CRA && t.UserTypeEnum != UserTypeEnum.ClinicalResearchCoordinator) || curentSiteUserIdList.Contains(t.UserId)).ToList();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
Task<List<TrialUserDto>> GetTrialUserSelect(Guid trialId);
|
||||
|
||||
|
||||
Task<PageOutput<DocumentUnionWithUserStatView>> GetTrialSystemDocumentList(DocumentTrialUnionQuery querySystemDocument);
|
||||
List<TrialUserUnionDocumentView> GetTrialUserDocumentList(Guid trialId);
|
||||
//Task<PageOutput<DocumentUnionWithUserStatView>> GetTrialSystemDocumentList(DocumentTrialUnionQuery querySystemDocument);
|
||||
//List<TrialUserUnionDocumentView> GetTrialUserDocumentList(Guid trialId);
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using User = IRaCIS.Core.Domain.Models.User;
|
||||
using UserRole = IRaCIS.Core.Domain.Models.UserRole;
|
||||
|
||||
namespace IRaCIS.Core.Application.Services
|
||||
{
|
||||
|
@ -15,8 +15,9 @@ namespace IRaCIS.Core.Application.Services
|
|||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class SystemDocumentService(IRepository<SystemDocument> _systemDocumentRepository,
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<SystemDocConfirmedUser> _systemDocConfirmedUserRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISystemDocumentService
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<IdentityUser> _identityUserRepository,
|
||||
IRepository<SystemDocConfirmedIdentityUser> _systemDocConfirmedUserRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISystemDocumentService
|
||||
{
|
||||
|
||||
|
||||
|
@ -35,7 +36,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
||||
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
||||
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
|
||||
.ProjectTo<SystemDocumentView>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us, userId = _userInfo.Id });
|
||||
.ProjectTo<SystemDocumentView>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us, userId = _userInfo.UserRoleId });
|
||||
|
||||
return await systemDocumentQueryable.ToPagedListAsync(inQuery);
|
||||
}
|
||||
|
@ -109,7 +110,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
await _systemDocumentRepository.UpdatePartialFromQueryAsync(systemDocumentId, u => new SystemDocument() { IsDeleted = true });
|
||||
|
||||
await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == systemDocumentId, x => new SystemDocConfirmedUser()
|
||||
await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == systemDocumentId, x => new SystemDocConfirmedIdentityUser()
|
||||
{
|
||||
IsDeleted = true
|
||||
});
|
||||
|
@ -146,15 +147,16 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
var isInternal = _userInfo.IsZhiZhun;
|
||||
|
||||
var query = from sysDoc in _systemDocumentRepository.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
var query = from sysDoc in _systemDocumentRepository.AsQueryable(true)
|
||||
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
||||
//外部人员 只签署 文档类型枚举值有值的
|
||||
//外部人员 只签署 外部需要签署的
|
||||
.WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter)
|
||||
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
||||
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = _userInfo.Id, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = _userInfo.IdentityUserId, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
|
||||
join user in _userRepository.Where() on _userInfo.Id equals user.Id
|
||||
join user in _identityUserRepository.Where() on _userInfo.IdentityUserId equals user.Id
|
||||
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
|
@ -173,15 +175,24 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = user.LastName + " / " + user.FirstName,
|
||||
RealName = user.FullName,
|
||||
UserName = user.UserName,
|
||||
UserTypeId = user.UserTypeId,
|
||||
UserTypeShortName = user.UserTypeRole.UserTypeShortName
|
||||
|
||||
DocTypeCode=sysDoc.FileType.Code
|
||||
|
||||
//UserTypeId = user.UserTypeId,
|
||||
//UserTypeShortName = user.UserTypeRole.UserTypeShortName
|
||||
};
|
||||
|
||||
return await query.WhereIf(inQuery.IsSigned == true, t => t.ConfirmTime != null)
|
||||
var list = await query
|
||||
//过滤掉删除的,并且没有签名的
|
||||
.Where(t => !(t.IsDeleted == true && t.ConfirmTime == null))
|
||||
.WhereIf(inQuery.IsSigned == true, t => t.ConfirmTime != null)
|
||||
.WhereIf(inQuery.IsSigned == false, t => t.ConfirmTime == null)
|
||||
.ToPagedListAsync(inQuery);
|
||||
.ToPagedListAsync(inQuery,nameof(UnionDocumentWithConfirmInfoView.DocTypeCode));
|
||||
|
||||
|
||||
return list;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,8 +6,13 @@
|
|||
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System.Linq;
|
||||
using System.Linq.Dynamic.Core;
|
||||
|
||||
namespace IRaCIS.Core.Application.Services
|
||||
{
|
||||
|
@ -16,15 +21,15 @@ namespace IRaCIS.Core.Application.Services
|
|||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class TrialDocumentService(IRepository<TrialDocument> _trialDocumentRepository,
|
||||
IRepository<TrialDocConfirmedUser> _trialDocUserTypeConfirmedUserRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
ISystemDocumentService _systemDocumentService,
|
||||
IRepository<SystemDocConfirmedUser> _systemDocConfirmedUserRepository,
|
||||
IRepository<SystemDocConfirmedIdentityUser> _systemDocConfirmedUserRepository,
|
||||
IRepository<SystemDocNeedConfirmedUserType> _systemDocNeedConfirmedUserTypeRepository,
|
||||
IRepository<TrialDocNeedConfirmedUserType> _trialDocNeedConfirmedUserTypeRepository,
|
||||
IRepository<SystemDocument> _systemDocumentRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialDocConfirmedUser> _trialDocConfirmedUserRepository,
|
||||
IRepository<TrialIdentityUser> _trialIdentityUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<TrialDocConfirmedIdentityUser> _trialDocConfirmedUserRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ITrialDocumentService
|
||||
{
|
||||
|
||||
|
@ -57,9 +62,9 @@ namespace IRaCIS.Core.Application.Services
|
|||
.WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId)
|
||||
.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
|
||||
join trialUser in _trialUserRepository.Where(t => t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId
|
||||
join trialUser in _trialIdentityUserRepository.Where(t => t.IdentityUserId == _userInfo.IdentityUserId) on trialDoc.TrialId equals trialUser.TrialId
|
||||
join confirm in _trialDocConfirmedUserRepository.Where() on
|
||||
new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
new { trialUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new TrialSignDocView()
|
||||
|
@ -82,11 +87,12 @@ namespace IRaCIS.Core.Application.Services
|
|||
//IsConfirmed = confirm.ConfirmTime != null,
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName
|
||||
RealName = trialUser.IdentityUser.FullName,
|
||||
UserName = trialUser.IdentityUser.UserName,
|
||||
|
||||
IdentityUserTypeList = trialUser.TrialUserRoleList.Select(t => t.UserRole.UserTypeRole.UserTypeShortName).ToList(),
|
||||
|
||||
DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeShortName).ToList(),
|
||||
};
|
||||
|
||||
trialDocQueryable = trialDocQueryable.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
||||
|
@ -218,75 +224,180 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
var trialInfo = await (_trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
|
||||
|
||||
//系统文档查询
|
||||
var systemDocumentQueryable = from needConfirmedUserType in _systemDocNeedConfirmedUserTypeRepository.Where(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId, ignoreQueryFilters: true)
|
||||
.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.SystemDocument.IsDeleted == false || (t.SystemDocument.IsDeleted == true && t.SystemDocument.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
|
||||
|
||||
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id)
|
||||
on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
IsSystemDoc = true,
|
||||
#region 统一用户修改
|
||||
|
||||
Id = needConfirmedUserType.SystemDocument.Id,
|
||||
CreateTime = needConfirmedUserType.SystemDocument.CreateTime,
|
||||
IsDeleted = needConfirmedUserType.SystemDocument.IsDeleted,
|
||||
SignViewMinimumMinutes = needConfirmedUserType.SystemDocument.SignViewMinimumMinutes,
|
||||
Name = needConfirmedUserType.SystemDocument.Name,
|
||||
Path = needConfirmedUserType.SystemDocument.Path,
|
||||
FileTypeId = needConfirmedUserType.SystemDocument.FileTypeId,
|
||||
FileType = _userInfo.IsEn_Us ? needConfirmedUserType.SystemDocument.FileType.Value : needConfirmedUserType.SystemDocument.FileType.ValueCN,
|
||||
UpdateTime = needConfirmedUserType.SystemDocument.UpdateTime,
|
||||
var systemDocQuery =
|
||||
from sysDoc in _systemDocumentRepository.AsQueryable(true).Where(t => t.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
from trialUser in _trialIdentityUserRepository.AsQueryable(false)
|
||||
.Where(t => t.TrialId == inQuery.TrialId && t.IdentityUserId == _userInfo.IdentityUserId
|
||||
&& t.TrialUserRoleList.Any(t => sysDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId)))
|
||||
|
||||
FullFilePath = needConfirmedUserType.SystemDocument.Path,
|
||||
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.IdentityUserId, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
IsSystemDoc = true,
|
||||
|
||||
Id = sysDoc.Id,
|
||||
CreateTime = sysDoc.CreateTime,
|
||||
IsDeleted = sysDoc.IsDeleted,
|
||||
SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes,
|
||||
Name = sysDoc.Name,
|
||||
Path = sysDoc.Path,
|
||||
FileType = _userInfo.IsEn_Us ? sysDoc.FileType.Value : sysDoc.FileType.ValueCN,
|
||||
FileTypeId = sysDoc.FileTypeId,
|
||||
UpdateTime = sysDoc.UpdateTime,
|
||||
//IsConfirmed = confirm.ConfirmTime != null,
|
||||
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
|
||||
RealName = trialUser.IdentityUser.FullName,
|
||||
UserName = trialUser.IdentityUser.UserName,
|
||||
|
||||
//UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
//DocNeedSignUserTypeList = sysDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeName),
|
||||
|
||||
FullFilePath = sysDoc.Path
|
||||
};
|
||||
|
||||
//IsConfirmed = confirm.ConfirmTime != null,
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName
|
||||
};
|
||||
|
||||
//项目文档查询
|
||||
var trialDocQueryable = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
|
||||
var trialDocQuery =
|
||||
from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId).Where(t => t.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
from trialUser in _trialIdentityUserRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId && t.IdentityUserId == _userInfo.IdentityUserId
|
||||
&& t.TrialUserRoleList.Any(t => trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId)))
|
||||
|
||||
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId
|
||||
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
||||
new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
Id = trialDoc.Id,
|
||||
IsSystemDoc = false,
|
||||
CreateTime = trialDoc.CreateTime,
|
||||
FullFilePath = trialDoc.Path,
|
||||
IsDeleted = trialDoc.IsDeleted,
|
||||
Name = trialDoc.Name,
|
||||
Path = trialDoc.Path,
|
||||
FileTypeId = trialDoc.FileTypeId,
|
||||
FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN,
|
||||
UpdateTime = trialDoc.UpdateTime,
|
||||
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
||||
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
||||
new { trialUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
IsSystemDoc = false,
|
||||
|
||||
//IsConfirmed = confirm.ConfirmTime != null,
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName
|
||||
Id = trialDoc.Id,
|
||||
CreateTime = trialDoc.CreateTime,
|
||||
IsDeleted = trialDoc.IsDeleted,
|
||||
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
||||
Name = trialDoc.Name,
|
||||
Path = trialDoc.Path,
|
||||
FileTypeId = trialDoc.FileTypeId,
|
||||
FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN,
|
||||
UpdateTime = trialDoc.UpdateTime,
|
||||
//IsConfirmed= confirm.ConfirmTime!=null,
|
||||
|
||||
};
|
||||
|
||||
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.IdentityUser.FullName,
|
||||
UserName = trialUser.IdentityUser.UserName,
|
||||
|
||||
//DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeName),
|
||||
|
||||
//UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
|
||||
FullFilePath = trialDoc.Path
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 废弃
|
||||
|
||||
////系统文档查询
|
||||
//var systemDocQuery = from needConfirmedUserType in _systemDocNeedConfirmedUserTypeRepository.Where(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId, ignoreQueryFilters: true)
|
||||
// .WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
|
||||
// .WhereIf(!_userInfo.IsAdmin, t => t.SystemDocument.IsDeleted == false || (t.SystemDocument.IsDeleted == true && t.SystemDocument.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId)))
|
||||
|
||||
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserRole.IdentityUserId == _userInfo.IdentityUserId)
|
||||
// on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
||||
// join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
// from confirm in cc.DefaultIfEmpty()
|
||||
// select new UnionDocumentWithConfirmInfoView()
|
||||
// {
|
||||
// IsSystemDoc = true,
|
||||
|
||||
// Id = needConfirmedUserType.SystemDocument.Id,
|
||||
// CreateTime = needConfirmedUserType.SystemDocument.CreateTime,
|
||||
// IsDeleted = needConfirmedUserType.SystemDocument.IsDeleted,
|
||||
// SignViewMinimumMinutes = needConfirmedUserType.SystemDocument.SignViewMinimumMinutes,
|
||||
// Name = needConfirmedUserType.SystemDocument.Name,
|
||||
// Path = needConfirmedUserType.SystemDocument.Path,
|
||||
// FileTypeId = needConfirmedUserType.SystemDocument.FileTypeId,
|
||||
// FileType = _userInfo.IsEn_Us ? needConfirmedUserType.SystemDocument.FileType.Value : needConfirmedUserType.SystemDocument.FileType.ValueCN,
|
||||
// UpdateTime = needConfirmedUserType.SystemDocument.UpdateTime,
|
||||
|
||||
// FullFilePath = needConfirmedUserType.SystemDocument.Path,
|
||||
|
||||
// //IsConfirmed = confirm.ConfirmTime != null,
|
||||
// ConfirmUserId = confirm.ConfirmUserId,
|
||||
// ConfirmTime = confirm.ConfirmTime,
|
||||
// RealName = trialUser.UserRole.FullName,
|
||||
// UserName = trialUser.UserRole.IdentityUser.UserName,
|
||||
|
||||
|
||||
|
||||
// //IdentityUserTypeList = trialUser.TrialUser.TrialUserRoleList.Select(t => t.UserRole.UserTypeRole.UserTypeShortName),
|
||||
|
||||
// //DocNeedSignUserTypeList = needConfirmedUserType.SystemDocument.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeShortName).ToList(),
|
||||
|
||||
// //UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
// //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName
|
||||
// };
|
||||
|
||||
////项目文档查询
|
||||
//var trialDocQuery = from trialDoc in _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId)
|
||||
// .WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
// .WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId)))
|
||||
|
||||
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId && t.UserRole.IdentityUserId == _userInfo.IdentityUserId) on trialDoc.TrialId equals trialUser.TrialId
|
||||
// join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
||||
// new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
// from confirm in cc.DefaultIfEmpty()
|
||||
// select new UnionDocumentWithConfirmInfoView()
|
||||
// {
|
||||
// Id = trialDoc.Id,
|
||||
// IsSystemDoc = false,
|
||||
// CreateTime = trialDoc.CreateTime,
|
||||
// FullFilePath = trialDoc.Path,
|
||||
// IsDeleted = trialDoc.IsDeleted,
|
||||
// Name = trialDoc.Name,
|
||||
// Path = trialDoc.Path,
|
||||
// FileTypeId = trialDoc.FileTypeId,
|
||||
// FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN,
|
||||
// UpdateTime = trialDoc.UpdateTime,
|
||||
// SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
||||
|
||||
// //IsConfirmed = confirm.ConfirmTime != null,
|
||||
// ConfirmUserId = confirm.ConfirmUserId,
|
||||
// ConfirmTime = confirm.ConfirmTime,
|
||||
// RealName = trialUser.UserRole.FullName,
|
||||
// UserName = trialUser.UserRole.IdentityUser.UserName,
|
||||
|
||||
// //UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
// //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName
|
||||
|
||||
|
||||
// //IdentityUserTypeList = trialUser.TrialUser.TrialUserRoleList.Select(t => t.UserRole.UserTypeRole.UserTypeShortName).ToList(),
|
||||
|
||||
// //DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeShortName).ToList(),
|
||||
// };
|
||||
|
||||
#endregion
|
||||
|
||||
#region 报错 奇怪的bug
|
||||
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
|
||||
|
||||
|
||||
var unionQuery = systemDocQuery.Concat(trialDocQuery)
|
||||
//过滤掉删除的,并且没有签名的
|
||||
.Where(t=>!(t.IsDeleted == true && t.ConfirmTime==null))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
||||
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
||||
.WhereIf(inQuery.IsSign == true, t => t.ConfirmTime != null)
|
||||
|
@ -318,16 +429,14 @@ namespace IRaCIS.Core.Application.Services
|
|||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == inQuery.TrialId && t.Trial.TrialStatusStr != StaticData.TrialState.TrialStopped)
|
||||
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == _userInfo.UserTypeId)))
|
||||
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.CountAsync();
|
||||
|
||||
|
||||
var needSignSystemDocCount = await _systemDocumentRepository
|
||||
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
var needSignSystemDocCount = await _systemDocumentRepository.AsQueryable(true)
|
||||
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.CountAsync();
|
||||
|
||||
var trialTaskConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).ProjectTo<TrialProcessConfigDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
|
||||
|
@ -338,7 +447,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
var isAdditionalAssessment = _readingQuestionCriterionTrialRepository.Where(t => t.TrialId == trialId && t.IsSigned && t.IsAdditionalAssessment == true
|
||||
&& t.TrialCriterionAdditionalAssessmentTypeList.Any(c =>/*c.AdditionalAssessmentType==Domain.Share.Reading.AdditionalAssessmentType.BrainMetastasis &&*/ c.IsSelected == true)).Any();
|
||||
|
||||
return ResponseOutput.Ok<PageOutput<UnionDocumentWithConfirmInfoView>>(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, IsAdditionalAssessment = isAdditionalAssessment && isManualGenerateTask, TrialStatusStr = trialInfo.TrialStatusStr, TrialConfig = trialTaskConfig });
|
||||
return ResponseOutput.Ok(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, IsAdditionalAssessment = isAdditionalAssessment && isManualGenerateTask, TrialStatusStr = trialInfo.TrialStatusStr, TrialConfig = trialTaskConfig });
|
||||
}
|
||||
|
||||
|
||||
|
@ -353,10 +462,151 @@ namespace IRaCIS.Core.Application.Services
|
|||
public async Task<IResponseOutput<PageOutput<UnionDocumentWithConfirmInfoView>>> GetDocumentConfirmList(DocumentTrialUnionQuery inQuery)
|
||||
{
|
||||
|
||||
#region 测试
|
||||
|
||||
var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
|
||||
|
||||
var trialDocQuery =
|
||||
from trialDoc in _trialDocumentRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId)
|
||||
.Where(t => inQuery.UserTypeId != null ? t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId) : true)
|
||||
from trialUser in _trialIdentityUserRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId
|
||||
&& t.TrialUserRoleList.AsQueryable().Any(t => trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId))
|
||||
)
|
||||
.Where(t => inQuery.UserId != null ? t.IdentityUserId == inQuery.UserId : true)
|
||||
|
||||
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
||||
new { trialUser.IdentityUserId, TrialDocumentId = trialDoc.Id } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
IsSystemDoc = false,
|
||||
|
||||
Id = trialDoc.Id,
|
||||
CreateTime = trialDoc.CreateTime,
|
||||
IsDeleted = trialDoc.IsDeleted,
|
||||
SignViewMinimumMinutes = trialDoc.SignViewMinimumMinutes,
|
||||
Name = trialDoc.Name,
|
||||
Path = trialDoc.Path,
|
||||
FileTypeId = trialDoc.FileTypeId,
|
||||
FileType = _userInfo.IsEn_Us ? trialDoc.FileType.Value : trialDoc.FileType.ValueCN,
|
||||
UpdateTime = trialDoc.UpdateTime,
|
||||
//IsConfirmed= confirm.ConfirmTime!=null,
|
||||
|
||||
|
||||
|
||||
ConfirmUserId = trialUser.IdentityUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.IdentityUser.FullName,
|
||||
UserName = trialUser.IdentityUser.UserName,
|
||||
|
||||
//UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
//DocNeedSignUserTypeList = trialDoc.NeedConfirmedUserTypeList.Select(t => t.UserTypeRole.UserTypeName),
|
||||
|
||||
FullFilePath = trialDoc.Path
|
||||
};
|
||||
|
||||
|
||||
|
||||
var systemDocQuery =
|
||||
from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(u => trialInfo.TrialFinishedTime != null ? u.CreateTime < trialInfo.TrialFinishedTime : true)
|
||||
from trialUser in _trialIdentityUserRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId
|
||||
&& t.TrialUserRoleList.Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId)))
|
||||
.Where(t => inQuery.UserId != null ? t.IdentityUserId == inQuery.UserId : true)
|
||||
|
||||
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.IdentityUserId, SystemDocumentId = sysDoc.Id } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
IsSystemDoc = true,
|
||||
|
||||
Id = sysDoc.Id,
|
||||
CreateTime = sysDoc.CreateTime,
|
||||
IsDeleted = sysDoc.IsDeleted,
|
||||
SignViewMinimumMinutes = sysDoc.SignViewMinimumMinutes,
|
||||
Name = sysDoc.Name,
|
||||
Path = sysDoc.Path,
|
||||
FileType = _userInfo.IsEn_Us ? sysDoc.FileType.Value : sysDoc.FileType.ValueCN,
|
||||
FileTypeId = sysDoc.FileTypeId,
|
||||
UpdateTime = sysDoc.UpdateTime,
|
||||
//IsConfirmed = confirm.ConfirmTime != null,
|
||||
|
||||
ConfirmUserId = trialUser.IdentityUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
|
||||
RealName = trialUser.IdentityUser.FullName,
|
||||
UserName = trialUser.IdentityUser.UserName,
|
||||
|
||||
//UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
//UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
|
||||
FullFilePath = sysDoc.Path
|
||||
};
|
||||
|
||||
//var tt = await trialDocQuery.ToPagedListAsync(inQuery);
|
||||
|
||||
var unionQuery = trialDocQuery.Union(systemDocQuery).IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmTime == null))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
||||
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
||||
.WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null)
|
||||
.WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null)
|
||||
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted);
|
||||
|
||||
var result = await unionQuery.ToPagedListAsync(inQuery);
|
||||
|
||||
#region 处理文档 需要签署的角色类型 和每个人的角色信息
|
||||
|
||||
var trialDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == false).Select(t => t.Id).ToList();
|
||||
|
||||
var sysDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList();
|
||||
|
||||
var trialIdentityUserIdList = result.CurrentPageData.Select(t => t.ConfirmUserId).Distinct().ToList();
|
||||
|
||||
var trialDocUserTypeList = _trialDocNeedConfirmedUserTypeRepository.Where(t => trialDocIdList.Contains(t.TrialDocumentId)).Select(t => new { t.TrialDocumentId, t.UserTypeRole.UserTypeShortName }).ToList();
|
||||
|
||||
var sysDocUserTypeList = _systemDocNeedConfirmedUserTypeRepository.Where(t => sysDocIdList.Contains(t.SystemDocumentId)).Select(t => new { t.SystemDocumentId, t.UserTypeRole.UserTypeShortName }).ToList();
|
||||
|
||||
var trialUserUserTypeList = _trialIdentityUserRepository.Where(t => t.TrialId==inQuery.TrialId && trialIdentityUserIdList.Contains(t.IdentityUserId)).IgnoreQueryFilters().Select(t => new { t.IdentityUserId, UserTypeList = t.TrialUserRoleList.Select(c => c.UserRole.UserTypeRole.UserTypeShortName).ToList() });
|
||||
|
||||
|
||||
foreach (var item in result.CurrentPageData)
|
||||
{
|
||||
if (item.IsSystemDoc)
|
||||
{
|
||||
item.DocNeedSignUserTypeList = sysDocUserTypeList.Where(t => t.SystemDocumentId == item.Id).Select(t => t.UserTypeShortName).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
item.DocNeedSignUserTypeList = trialDocUserTypeList.Where(t => t.TrialDocumentId == item.Id).Select(t => t.UserTypeShortName).ToList();
|
||||
}
|
||||
|
||||
item.IdentityUserTypeList = trialUserUserTypeList.Where(t => t.IdentityUserId == item.ConfirmUserId).SelectMany(c => c.UserTypeList).ToList();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true)
|
||||
.Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.TrialUserRoleList.Any(t => t.UserRole.UserTypeId == _userInfo.UserTypeId)))
|
||||
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.CountAsync();
|
||||
|
||||
|
||||
var needSignSystemDocCount = await _systemDocumentRepository
|
||||
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.CountAsync();
|
||||
|
||||
|
||||
return ResponseOutput.Ok(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, TrialStatusStr = trialInfo.TrialStatusStr });
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region linq join 方式
|
||||
//var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocumentNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == querySystemDocument.TrialId)
|
||||
// join trialUser in _trialUserRepository.Where(t => t.TrialId == querySystemDocument.TrialId)
|
||||
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == querySystemDocument.TrialId)
|
||||
// .WhereIf(querySystemDocument.UserId != null, t => t.UserId == querySystemDocument.UserId)
|
||||
// on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
|
||||
|
@ -387,100 +637,106 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
#endregion
|
||||
|
||||
var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
|
||||
#region 废弃
|
||||
//var trialInfo = (await _trialRepository.Where(t => t.Id == inQuery.TrialId, ignoreQueryFilters: true).Select(t => new { t.TrialFinishedTime, t.TrialStatusStr }).FirstNotNullAsync());
|
||||
|
||||
var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId)
|
||||
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.User.UserTypeId == inQuery.UserTypeId)
|
||||
on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
//var trialDocQuery = from trialDocumentNeedConfirmedUserType in _trialDocNeedConfirmedUserTypeRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId)
|
||||
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
// .WhereIf(inQuery.UserId != null, t => t.UserRole.IdentityUserId == inQuery.UserId)
|
||||
// .WhereIf(inQuery.UserTypeId != null, t => t.UserRole.UserTypeId == inQuery.UserTypeId)
|
||||
// on trialDocumentNeedConfirmedUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
||||
|
||||
join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
||||
new { trialUser.UserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
IsSystemDoc = false,
|
||||
// join confirm in _trialDocConfirmedUserRepository.Where(t => t.TrialDocument.TrialId == inQuery.TrialId) on
|
||||
// new { trialUser.UserRole.IdentityUserId, TrialDocumentId = trialDocumentNeedConfirmedUserType.TrialDocumentId } equals new { IdentityUserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
// from confirm in cc.DefaultIfEmpty()
|
||||
// select new UnionDocumentWithConfirmInfoView()
|
||||
// {
|
||||
// IsSystemDoc = false,
|
||||
|
||||
Id = trialDocumentNeedConfirmedUserType.TrialDocument.Id,
|
||||
CreateTime = trialDocumentNeedConfirmedUserType.TrialDocument.CreateTime,
|
||||
IsDeleted = trialDocumentNeedConfirmedUserType.TrialDocument.IsDeleted,
|
||||
SignViewMinimumMinutes = trialDocumentNeedConfirmedUserType.TrialDocument.SignViewMinimumMinutes,
|
||||
Name = trialDocumentNeedConfirmedUserType.TrialDocument.Name,
|
||||
Path = trialDocumentNeedConfirmedUserType.TrialDocument.Path,
|
||||
FileTypeId = trialDocumentNeedConfirmedUserType.TrialDocument.FileTypeId,
|
||||
FileType = _userInfo.IsEn_Us ? trialDocumentNeedConfirmedUserType.TrialDocument.FileType.Value : trialDocumentNeedConfirmedUserType.TrialDocument.FileType.ValueCN,
|
||||
UpdateTime = trialDocumentNeedConfirmedUserType.TrialDocument.UpdateTime,
|
||||
//IsConfirmed= confirm.ConfirmTime!=null,
|
||||
// Id = trialDocumentNeedConfirmedUserType.TrialDocument.Id,
|
||||
// CreateTime = trialDocumentNeedConfirmedUserType.TrialDocument.CreateTime,
|
||||
// IsDeleted = trialDocumentNeedConfirmedUserType.TrialDocument.IsDeleted,
|
||||
// SignViewMinimumMinutes = trialDocumentNeedConfirmedUserType.TrialDocument.SignViewMinimumMinutes,
|
||||
// Name = trialDocumentNeedConfirmedUserType.TrialDocument.Name,
|
||||
// Path = trialDocumentNeedConfirmedUserType.TrialDocument.Path,
|
||||
// FileTypeId = trialDocumentNeedConfirmedUserType.TrialDocument.FileTypeId,
|
||||
// FileType = _userInfo.IsEn_Us ? trialDocumentNeedConfirmedUserType.TrialDocument.FileType.Value : trialDocumentNeedConfirmedUserType.TrialDocument.FileType.ValueCN,
|
||||
// UpdateTime = trialDocumentNeedConfirmedUserType.TrialDocument.UpdateTime,
|
||||
// //IsConfirmed= confirm.ConfirmTime!=null,
|
||||
|
||||
|
||||
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName,
|
||||
// ConfirmUserId = confirm.ConfirmUserId,
|
||||
// ConfirmTime = confirm.ConfirmTime,
|
||||
// RealName = trialUser.UserRole.FullName,
|
||||
// UserName = trialUser.UserRole.IdentityUser.UserName,
|
||||
|
||||
FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
|
||||
};
|
||||
// //UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
// //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
|
||||
// FullFilePath = trialDocumentNeedConfirmedUserType.TrialDocument.Path
|
||||
// };
|
||||
|
||||
|
||||
|
||||
var systemDocQuery = from needConfirmEdUserType in _systemDocNeedConfirmedUserTypeRepository.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
|
||||
//var systemDocQuery = from needConfirmEdUserType in _systemDocNeedConfirmedUserTypeRepository.WhereIf(trialInfo.TrialFinishedTime != null, u => u.SystemDocument.CreateTime < trialInfo.TrialFinishedTime)
|
||||
|
||||
join trialUser in _trialUserRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.UserId != null, t => t.UserId == inQuery.UserId)
|
||||
on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new UnionDocumentWithConfirmInfoView()
|
||||
{
|
||||
IsSystemDoc = true,
|
||||
// join trialUser in _trialUserRoleRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
// .WhereIf(inQuery.UserId != null, t => t.UserRole.IdentityUserId == inQuery.UserId)
|
||||
// on needConfirmEdUserType.NeedConfirmUserTypeId equals trialUser.UserRole.UserTypeId
|
||||
// join confirm in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmEdUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
// from confirm in cc.DefaultIfEmpty()
|
||||
// select new UnionDocumentWithConfirmInfoView()
|
||||
// {
|
||||
// IsSystemDoc = true,
|
||||
|
||||
Id = needConfirmEdUserType.SystemDocument.Id,
|
||||
CreateTime = needConfirmEdUserType.SystemDocument.CreateTime,
|
||||
IsDeleted = needConfirmEdUserType.SystemDocument.IsDeleted,
|
||||
SignViewMinimumMinutes = needConfirmEdUserType.SystemDocument.SignViewMinimumMinutes,
|
||||
Name = needConfirmEdUserType.SystemDocument.Name,
|
||||
Path = needConfirmEdUserType.SystemDocument.Path,
|
||||
FileType = _userInfo.IsEn_Us ? needConfirmEdUserType.SystemDocument.FileType.Value : needConfirmEdUserType.SystemDocument.FileType.ValueCN,
|
||||
FileTypeId = needConfirmEdUserType.SystemDocument.FileTypeId,
|
||||
UpdateTime = needConfirmEdUserType.SystemDocument.UpdateTime,
|
||||
//IsConfirmed = confirm.ConfirmTime != null,
|
||||
// Id = needConfirmEdUserType.SystemDocument.Id,
|
||||
// CreateTime = needConfirmEdUserType.SystemDocument.CreateTime,
|
||||
// IsDeleted = needConfirmEdUserType.SystemDocument.IsDeleted,
|
||||
// SignViewMinimumMinutes = needConfirmEdUserType.SystemDocument.SignViewMinimumMinutes,
|
||||
// Name = needConfirmEdUserType.SystemDocument.Name,
|
||||
// Path = needConfirmEdUserType.SystemDocument.Path,
|
||||
// FileType = _userInfo.IsEn_Us ? needConfirmEdUserType.SystemDocument.FileType.Value : needConfirmEdUserType.SystemDocument.FileType.ValueCN,
|
||||
// FileTypeId = needConfirmEdUserType.SystemDocument.FileTypeId,
|
||||
// UpdateTime = needConfirmEdUserType.SystemDocument.UpdateTime,
|
||||
// //IsConfirmed = confirm.ConfirmTime != null,
|
||||
|
||||
ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
RealName = trialUser.User.FullName,
|
||||
UserName = trialUser.User.UserName,
|
||||
UserTypeId = trialUser.User.UserTypeId,
|
||||
UserTypeShortName = trialUser.User.UserTypeRole.UserTypeShortName,
|
||||
// ConfirmUserId = confirm.ConfirmUserId,
|
||||
// ConfirmTime = confirm.ConfirmTime,
|
||||
// RealName = trialUser.UserRole.FullName,
|
||||
// UserName = trialUser.UserRole.IdentityUser.UserName,
|
||||
|
||||
FullFilePath = needConfirmEdUserType.SystemDocument.Path
|
||||
};
|
||||
// //UserTypeId = trialUser.UserRole.UserTypeId,
|
||||
// //UserTypeShortName = trialUser.UserRole.UserTypeRole.UserTypeShortName,
|
||||
|
||||
var unionQuery = trialDocQuery.Union(systemDocQuery).IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmUserId == null))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
||||
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
||||
.WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null)
|
||||
.WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null)
|
||||
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.UserTypeId == inQuery.UserTypeId);
|
||||
// FullFilePath = needConfirmEdUserType.SystemDocument.Path
|
||||
// };
|
||||
|
||||
var result = await unionQuery.ToPagedListAsync(inQuery);
|
||||
//var unionQuery = trialDocQuery.Union(systemDocQuery).IgnoreQueryFilters().Where(t => !(t.IsDeleted == true && t.ConfirmUserId == null))
|
||||
// .WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
||||
// .WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId)
|
||||
// .WhereIf(inQuery.IsConfirmed == true, t => t.ConfirmTime != null)
|
||||
// .WhereIf(inQuery.IsConfirmed == false, t => t.ConfirmTime == null)
|
||||
// .WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
|
||||
// /*.Distinct()*/;
|
||||
|
||||
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true)
|
||||
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.CountAsync();
|
||||
//var result = await unionQuery.ToPagedListAsync(inQuery);
|
||||
|
||||
//var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true)
|
||||
// .Where(t => t.Trial.TrialIdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId))
|
||||
// .Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
// .CountAsync();
|
||||
|
||||
|
||||
var needSignSystemDocCount = await _systemDocumentRepository
|
||||
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.CountAsync();
|
||||
//var needSignSystemDocCount = await _systemDocumentRepository
|
||||
// .Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.IdentityUserId) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
// .CountAsync();
|
||||
|
||||
|
||||
return ResponseOutput.Ok(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, TrialStatusStr = trialInfo.TrialStatusStr });
|
||||
//return ResponseOutput.Ok(result, new { NeedSignCount = needSignTrialDocCount + needSignSystemDocCount, NeedSignTrialDocCount = needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount, TrialStatusStr = trialInfo.TrialStatusStr });
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -492,8 +748,8 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<List<TrialUserDto>> GetTrialUserSelect(Guid trialId)
|
||||
{
|
||||
return await _trialUserRepository.Where(t => t.TrialId == trialId)
|
||||
.Select(t => new TrialUserDto() { UserId = t.UserId, RealName = t.User.FullName, UserName = t.User.UserName })
|
||||
return await _trialIdentityUserRepository.Where(t => t.TrialId == trialId)
|
||||
.Select(t => new TrialUserDto() { UserId = t.IdentityUserId, RealName = t.IdentityUser.FullName, UserName = t.IdentityUser.UserName })
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
@ -513,7 +769,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
|
||||
[TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("BeforeOngoingCantOpt", "AfterStopCannNotOpt")]
|
||||
//[Authorize(Policy = IRaCISPolicy.PM)]
|
||||
public async Task<IResponseOutput> AddOrUpdateTrialDocument(AddOrEditTrialDocument addOrEditTrialDocument)
|
||||
{
|
||||
|
@ -585,7 +841,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
/// <returns></returns>
|
||||
[HttpDelete("{trialId:guid}/{trialDocumentId:guid}")]
|
||||
//[Authorize(Policy = IRaCISPolicy.PM)]
|
||||
[TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("BeforeOngoingCantOpt", "AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> DeleteTrialDocument(Guid trialDocumentId, Guid trialId)
|
||||
{
|
||||
if (await _trialDocumentRepository.AsQueryable(true).Where(t => t.Id == trialDocumentId).AnyAsync(t => t.TrialDocConfirmedUserList.Any()))
|
||||
|
@ -614,9 +870,9 @@ namespace IRaCIS.Core.Application.Services
|
|||
var success = false;
|
||||
if (isSystemDoc)
|
||||
{
|
||||
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.Id))
|
||||
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.IdentityUserId))
|
||||
{
|
||||
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
||||
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedIdentityUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.IdentityUserId, SignFirstViewTime = DateTime.Now });
|
||||
|
||||
}
|
||||
|
||||
|
@ -624,10 +880,10 @@ namespace IRaCIS.Core.Application.Services
|
|||
else
|
||||
{
|
||||
|
||||
if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.Id))
|
||||
if (!await _trialDocConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.IdentityUserId))
|
||||
{
|
||||
|
||||
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
||||
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedIdentityUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.IdentityUserId, SignFirstViewTime = DateTime.Now });
|
||||
|
||||
}
|
||||
|
||||
|
@ -642,9 +898,9 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpPut("{documentId:guid}")]
|
||||
public async Task<IResponseOutput> SetSystemDocFirstViewTime(Guid documentId)
|
||||
{
|
||||
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.Id))
|
||||
if (!await _systemDocConfirmedUserRepository.AnyAsync(t => t.SystemDocumentId == documentId && t.ConfirmUserId == _userInfo.IdentityUserId))
|
||||
{
|
||||
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
||||
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedIdentityUser() { SystemDocumentId = documentId, ConfirmUserId = _userInfo.IdentityUserId, SignFirstViewTime = DateTime.Now });
|
||||
|
||||
}
|
||||
|
||||
|
@ -656,10 +912,10 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpPut("{trialId:guid}/{documentId:guid}")]
|
||||
public async Task<IResponseOutput> SetTrialDocFirstViewTime(Guid documentId)
|
||||
{
|
||||
if (!await _trialDocUserTypeConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.Id))
|
||||
if (!await _trialDocConfirmedUserRepository.AnyAsync(t => t.TrialDocumentId == documentId && t.ConfirmUserId == _userInfo.IdentityUserId))
|
||||
{
|
||||
|
||||
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.Id, SignFirstViewTime = DateTime.Now });
|
||||
await _trialDocConfirmedUserRepository.AddAsync(new TrialDocConfirmedIdentityUser() { TrialDocumentId = documentId, ConfirmUserId = _userInfo.IdentityUserId, SignFirstViewTime = DateTime.Now });
|
||||
|
||||
}
|
||||
var success = await _trialDocConfirmedUserRepository.SaveChangesAsync();
|
||||
|
@ -671,14 +927,14 @@ namespace IRaCIS.Core.Application.Services
|
|||
/// 用户 签名某个文档 可能是系统的,也可能是项目的
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("BeforeOngoingCantOpt", "AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> UserConfirm(UserConfirmCommand userConfirmCommand)
|
||||
{
|
||||
|
||||
if (userConfirmCommand.isSystemDoc)
|
||||
{
|
||||
|
||||
var sysDocConfirm = await _systemDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.SystemDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.Id, true);
|
||||
var sysDocConfirm = await _systemDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.SystemDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.IdentityUserId, true);
|
||||
|
||||
if (sysDocConfirm.ConfirmTime != null)
|
||||
{
|
||||
|
@ -705,7 +961,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
else
|
||||
{
|
||||
|
||||
var trialDocConfirm = await _trialDocUserTypeConfirmedUserRepository.FirstOrDefaultAsync(t => t.TrialDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.Id, true);
|
||||
var trialDocConfirm = await _trialDocConfirmedUserRepository.FirstOrDefaultAsync(t => t.TrialDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.IdentityUserId, true);
|
||||
|
||||
if (trialDocConfirm.ConfirmTime != null)
|
||||
{
|
||||
|
@ -722,7 +978,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
trialDocConfirm.ConfirmTime = DateTime.Now;
|
||||
trialDocConfirm.SignText = userConfirmCommand.SignText;
|
||||
|
||||
await _trialDocUserTypeConfirmedUserRepository.SaveChangesAsync();
|
||||
await _trialDocConfirmedUserRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
|
@ -738,13 +994,13 @@ namespace IRaCIS.Core.Application.Services
|
|||
/// <param name="isSystemDoc"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("{documentId:guid}/{isSystemDoc:bool}")]
|
||||
[TrialGlobalLimit( "BeforeOngoingCantOpt", "AfterStopCannNotOpt", "SignSystemDocNoTrialId" )]
|
||||
[TrialGlobalLimit("BeforeOngoingCantOpt", "AfterStopCannNotOpt", "SignSystemDocNoTrialId")]
|
||||
public async Task<IResponseOutput> UserAbandonDoc(Guid documentId, bool isSystemDoc)
|
||||
{
|
||||
if (isSystemDoc)
|
||||
{
|
||||
await _systemDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new SystemDocument() { IsDeleted = true });
|
||||
await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == documentId, x => new SystemDocConfirmedUser()
|
||||
await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == documentId, x => new SystemDocConfirmedIdentityUser()
|
||||
{
|
||||
IsDeleted = true
|
||||
});
|
||||
|
@ -752,7 +1008,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
else
|
||||
{
|
||||
await _trialDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new TrialDocument() { IsDeleted = true });
|
||||
await _trialDocUserTypeConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.TrialDocumentId == documentId, x => new TrialDocConfirmedUser()
|
||||
await _trialDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.TrialDocumentId == documentId, x => new TrialDocConfirmedIdentityUser()
|
||||
{
|
||||
IsDeleted = true
|
||||
});
|
||||
|
@ -762,93 +1018,8 @@ namespace IRaCIS.Core.Application.Services
|
|||
}
|
||||
|
||||
|
||||
#region 废弃
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 从项目下参与者的维度 先看人员列表(展示统计数字) 点击数字 再看人员具体签署的 系统文档+项目文档(共用上面与人相关的具体文档列表)
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{trialId:guid}")]
|
||||
[Obsolete]
|
||||
public List<TrialUserUnionDocumentView> GetTrialUserDocumentList(Guid trialId)
|
||||
{
|
||||
var query = _trialUserRepository.Where(t => t.TrialId == trialId)
|
||||
.Select(t => new TrialUserUnionDocumentView()
|
||||
{
|
||||
UserId = t.UserId,
|
||||
UserName = t.User.UserName,
|
||||
RealName = t.User.FullName,
|
||||
UserTypeShortName = t.User.UserTypeRole.UserTypeShortName,
|
||||
TrialDocumentCount = t.Trial.TrialDocumentList.Count(u => u.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == t.User.UserTypeId)),
|
||||
TrialDocumentConfirmedCount = t.Trial.TrialDocumentList.SelectMany(u => u.TrialDocConfirmedUserList).Count(k => k.ConfirmUserId == t.UserId),
|
||||
SystemDocumentConfirmedCount = t.User.SystemDocConfirmedList.Count(),
|
||||
//这样写不行
|
||||
//SystemDocumentCount = _systemDocumentRepository.Where(s => s.NeedConfirmedUserTypeList.Any(kk => kk.NeedConfirmUserTypeId == t.User.UserTypeId))
|
||||
// .WhereIf(!_userInfo.IsAdmin, s => s.IsAbandon == false || (s.IsAbandon == true && s.SystemDocConfirmedUserList.Any(uu => uu.ConfirmUserId == t.UserId))).Count()
|
||||
SystemDocumentCount = t.User.UserTypeRole.SystemDocNeedConfirmedUserTypeList.Where(cc => cc.NeedConfirmUserTypeId == t.User.UserTypeId).Select(y => y.SystemDocument).Count()
|
||||
});
|
||||
|
||||
return query.ToList();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 从 文档的维度 先看到文档列表(系统文档+项目文档 以及需要确认的人数 和已经确认人数) 点击数字查看某文档下面人确认情况
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Obsolete]
|
||||
public async Task<PageOutput<DocumentUnionWithUserStatView>> GetTrialSystemDocumentList(DocumentTrialUnionQuery inQuery)
|
||||
{
|
||||
var systemDocumentQueryable = _systemDocumentRepository
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false)
|
||||
.Select(t => new DocumentUnionWithUserStatView()
|
||||
{
|
||||
Id = t.Id,
|
||||
IsSystemDoc = true,
|
||||
CreateTime = t.CreateTime,
|
||||
FullFilePath = t.Path,
|
||||
IsDeleted = t.IsDeleted,
|
||||
Name = t.Name,
|
||||
Path = t.Path,
|
||||
FileType = t.FileType.Value,
|
||||
UpdateTime = t.UpdateTime,
|
||||
SignViewMinimumMinutes = t.SignViewMinimumMinutes,
|
||||
DocumentConfirmedUserCount = t.SystemDocConfirmedUserList.Count(),
|
||||
|
||||
//DocumentUserCount= _trialUserRepository.Where(tu=>tu.TrialId== querySystemDocument.TrialId).Count(u=>t.NeedConfirmedUserTypeList.Any(cc=>cc.NeedConfirmUserTypeId== u.User.UserTypeId ))
|
||||
DocumentUserCount = t.NeedConfirmedUserTypeList.SelectMany(u => u.UserTypeRole.UserList.SelectMany(b => b.UserTrials.Where(r => r.TrialId == inQuery.TrialId))).Count()
|
||||
});
|
||||
|
||||
var trialDocQueryable = _trialDocumentRepository.Where(t => t.TrialId == inQuery.TrialId).Select(t => new DocumentUnionWithUserStatView()
|
||||
{
|
||||
Id = t.Id,
|
||||
IsSystemDoc = false,
|
||||
CreateTime = t.CreateTime,
|
||||
FullFilePath = t.Path,
|
||||
IsDeleted = t.IsDeleted,
|
||||
Name = t.Name,
|
||||
Path = t.Path,
|
||||
FileType = t.FileType.Value,
|
||||
UpdateTime = t.UpdateTime,
|
||||
SignViewMinimumMinutes = t.SignViewMinimumMinutes,
|
||||
|
||||
DocumentConfirmedUserCount = t.TrialDocConfirmedUserList.Count(),
|
||||
DocumentUserCount = t.Trial.TrialUserList.Count(cc => t.NeedConfirmedUserTypeList.Any(k => k.NeedConfirmUserTypeId == cc.User.UserTypeId))
|
||||
|
||||
});
|
||||
|
||||
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.Name), t => t.Name.Contains(inQuery.Name))
|
||||
.WhereIf(inQuery.FileTypeId != null, t => t.FileTypeId == inQuery.FileTypeId);
|
||||
|
||||
return await unionQuery.ToPagedListAsync(inQuery);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
IRepository<TaskMedicalReview> _taskMedicalReviewRepository,
|
||||
IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<TrialEmailNoticeUser> _trialEmailNoticeUserRepository,
|
||||
IRepository<Subject> _subjectRepository,
|
||||
IRepository<ReadModule> _readModuleRepository,
|
||||
|
@ -300,7 +300,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var answer = "否";
|
||||
var isNeedSend = true;
|
||||
var minUserIdList = _trialUserRepository.Where(t => t.User.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == taskInfo.TrialId).Select(t => t.UserId).ToList();
|
||||
var minUserIdList = _trialUserRoleRepository.Where(t => t.UserRole.UserTypeEnum == Domain.Share.UserTypeEnum.MIM && t.TrialId == taskInfo.TrialId).Select(t => t.UserId).ToList();
|
||||
|
||||
|
||||
|
||||
|
@ -1199,7 +1199,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<List<TrialUserType>> GetTrialUserTypeSelectList(Guid trialId)
|
||||
{
|
||||
|
||||
var query = _trialUserRepository.Where(t => t.TrialId == trialId, false, true).IgnoreQueryFilters().Select(t => t.User.UserTypeRole).Distinct()
|
||||
var query = _trialUserRoleRepository.Where(t => t.TrialId == trialId, false, true).IgnoreQueryFilters().Select(t => t.UserRole.UserTypeRole).Distinct()
|
||||
|
||||
.ProjectTo<TrialUserType>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
@ -1222,13 +1222,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
var userTypeList = trialEmailNoticeConfig.TrialEmailNoticeUserList.Select(t => t.UserType).ToList();
|
||||
|
||||
|
||||
var query = _trialUserRepository.Where(t => t.TrialId == trialId && userTypeList.Contains(t.User.UserTypeEnum), false, true).IgnoreQueryFilters()
|
||||
var query = _trialUserRoleRepository.Where(t => t.TrialId == trialId && userTypeList.Contains(t.UserRole.UserTypeEnum), false, true).IgnoreQueryFilters()
|
||||
.Select(t => new TrialSelectUser()
|
||||
{
|
||||
UserId = t.UserId,
|
||||
UserName = t.User.UserName,
|
||||
RealName = t.User.FullName,
|
||||
UserTypeEnum = t.User.UserTypeEnum
|
||||
UserName = t.UserRole.IdentityUser.UserName,
|
||||
RealName = t.UserRole.FullName,
|
||||
UserTypeEnum = t.UserRole.UserTypeEnum
|
||||
}).Distinct();
|
||||
|
||||
return await query.ToListAsync();
|
||||
|
@ -1525,7 +1525,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
#region 人员还未加入,可以先配置邮件 历史废弃
|
||||
|
||||
//var toUserList = await _trialUserRepository.Where(t => t.TrialId == config.TrialId)
|
||||
//var toUserList = await _trialUserRoleRepository.Where(t => t.TrialId == config.TrialId)
|
||||
// .WhereIf(config.ToUserTypeList != null, t => config.ToUserTypeList.Contains(t.User.UserTypeEnum))
|
||||
// .Select(t => new { t.User.EMail, t.User.FullName }).ToListAsync();
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
// .ForMember(t => t.UserConfirmInfo, c => c.MapFrom(t => t.TrialDocConfirmedUserList.Where(u => u.ConfirmUserId == userId).FirstOrDefault()))
|
||||
// .ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token)); ;
|
||||
|
||||
CreateMap<TrialDocConfirmedUser, TrialDocumentUserConfirmView>()
|
||||
CreateMap<TrialDocConfirmedIdentityUser, TrialDocumentUserConfirmView>()
|
||||
.ForMember(d => d.UserName, c => c.MapFrom(t => t.User.UserName))
|
||||
.ForMember(d => d.RealName, c => c.MapFrom(t => t.User.FullName));
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
// .ForMember(d => d.RealName, c => c.MapFrom(t => t.User.LastName + " / " + t.User.FirstName));
|
||||
|
||||
|
||||
CreateMap<TrialUser, TrialDocumentUserConfirmView>();
|
||||
CreateMap<TrialUserRole, TrialDocumentUserConfirmView>();
|
||||
|
||||
CreateMap<BatchAddTrialEmailNoticeConfig, TrialEmailNoticeConfig>();
|
||||
|
||||
|
@ -78,11 +78,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<TrialEmailNoticeConfigAddOrEdit, TrialEmailNoticeConfig>();
|
||||
|
||||
CreateMap<TrialUser, TrialUserSelct>()
|
||||
.ForMember(d => d.Phone, c => c.MapFrom(t => t.User.Phone))
|
||||
.ForMember(d => d.Email, c => c.MapFrom(t => t.User.EMail))
|
||||
.ForMember(d => d.RealName, c => c.MapFrom(t => t.User.FullName))
|
||||
.ForMember(d => d.UserName, c => c.MapFrom(t => t.User.UserName));
|
||||
CreateMap<TrialUserRole, TrialUserSelct>()
|
||||
.ForMember(d => d.Phone, c => c.MapFrom(t => t.UserRole.IdentityUser.Phone))
|
||||
.ForMember(d => d.Email, c => c.MapFrom(t => t.UserRole.IdentityUser.EMail))
|
||||
.ForMember(d => d.RealName, c => c.MapFrom(t => t.UserRole.IdentityUser.FullName))
|
||||
.ForMember(d => d.UserName, c => c.MapFrom(t => t.UserRole.IdentityUser.UserName));
|
||||
|
||||
|
||||
CreateMap<TrialEmailNoticeUser, EmailUserInfoDto>();
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
SowPath = "",
|
||||
SowName = "",
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateUserId = _userInfo.Id
|
||||
UpdateUserId = _userInfo.UserRoleId
|
||||
});
|
||||
|
||||
return ResponseOutput.Result(success);
|
||||
|
|
|
@ -65,19 +65,19 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
(t.TrialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.Random && t.TrialReadingCriterion.ImageUploadEnum != ReadingImageUpload.None))))
|
||||
{
|
||||
//找到 非一致性分析,未签名,状态正常的 并且任务名称是TimePoint的 任务
|
||||
var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id
|
||||
var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId
|
||||
&& t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskBlindName == "Timepoint" && t.ReadingCategory == ReadingCategory.Visit
|
||||
&& (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze), true).ToListAsync();
|
||||
|
||||
if (needDealTaskList.Count > 0)
|
||||
{
|
||||
//已完成的访视任务数量(包含重阅的)
|
||||
var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id
|
||||
var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId
|
||||
&& t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit);
|
||||
|
||||
//已经处理过的任务名称的数量
|
||||
|
||||
var haveDealedTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id
|
||||
var haveDealedTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId
|
||||
&& t.ReadingTaskState != ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit && t.TaskBlindName != "Timepoint").Select(t => new { t.TaskBlindName, t.SourceSubjectVisitId, t.SouceReadModuleId }).ToListAsync();
|
||||
|
||||
|
||||
|
@ -153,7 +153,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
|
||||
var query = _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId && t.SourceSubjectVisitId != null
|
||||
&& t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect)
|
||||
&& t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect)
|
||||
//满足 有序,或者随机只看到当前任务的dicom 非dicom检查
|
||||
.WhereIf(criterionInfo.IsReadingTaskViewInOrder != ReadingOrder.SubjectRandom && inQuery.VisitTaskId != null, t => t.Id == inQuery.VisitTaskId)
|
||||
.Select(u => new SubjectImageUploadDTO()
|
||||
|
@ -402,7 +402,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
else
|
||||
{
|
||||
//在事务未完成前 防止前端重复提交
|
||||
await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidDBLock(incommand.TrialId, incommand.VisitTaskId, incommand.Study.StudyInstanceUid), _userInfo.Id, TimeSpan.FromMinutes(1));
|
||||
await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidDBLock(incommand.TrialId, incommand.VisitTaskId, incommand.Study.StudyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromMinutes(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -653,7 +653,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
{
|
||||
var subjectCode = inQuery.SubjectCode;
|
||||
var subjectId = inQuery.SubjectId;
|
||||
var doctorUserId = _userInfo.Id;
|
||||
var doctorUserId = _userInfo.UserRoleId;
|
||||
|
||||
if (inQuery.VisitTaskId != null)
|
||||
{
|
||||
|
@ -839,7 +839,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
public async Task<List<SubjectCRCImageUploadedStudyDto>> GetSubjectImageDownloadSelectList(IRReadingDownloadQuery inQuery)
|
||||
{
|
||||
|
||||
var doctorUserId = _userInfo.Id;
|
||||
var doctorUserId = _userInfo.UserRoleId;
|
||||
var isAnalysisCreate = false;
|
||||
|
||||
//要根据标准阅片顺序,确定是否查询单个任务的,还是查询所有的
|
||||
|
@ -1129,9 +1129,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
var query = _trialImageDownloadRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.SubjectCode.IsNotNullOrEmpty(), t => t.SubjectCode.Contains(inQuery.SubjectCode))
|
||||
.WhereIf(inQuery.IP.IsNotNullOrEmpty(), t => t.IP.Contains(inQuery.IP))
|
||||
.WhereIf(inQuery.Name.IsNotNullOrEmpty(), t => t.CreateUser.UserName.Contains(inQuery.Name) || t.CreateUser.FullName.Contains(inQuery.Name))
|
||||
.WhereIf(inQuery.Name.IsNotNullOrEmpty(), t => t.CreateUserRole.IdentityUser.UserName.Contains(inQuery.Name) || t.CreateUserRole.FullName.Contains(inQuery.Name))
|
||||
.WhereIf(inQuery.ImageType != null, t => t.ImageType == inQuery.ImageType)
|
||||
.WhereIf(inQuery.UserType != null, t => t.CreateUser.UserTypeEnum == inQuery.UserType)
|
||||
.WhereIf(inQuery.UserType != null, t => t.CreateUserRole.UserTypeEnum == inQuery.UserType)
|
||||
.WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess)
|
||||
.WhereIf(inQuery.DownloadStartTime != null, t => t.DownloadStartTime >= inQuery.DownloadStartTime)
|
||||
.WhereIf(inQuery.DownloadEndTime != null, t => t.DownloadEndTime <= inQuery.DownloadEndTime)
|
||||
|
@ -1538,7 +1538,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
public async Task<List<SubjectUploadTaskInfo>> GetIRUploadTaskList_Old(CRCUploadTaskQuery inQuery)
|
||||
{
|
||||
var query = _visitTaskRepository.Where(t => t.SubjectId == inQuery.SubjectId && t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId
|
||||
&& t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect)
|
||||
&& t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.UserRoleId && t.TaskState == TaskState.Effect)
|
||||
.ProjectTo<SubjectUploadTaskInfo>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
||||
|
|
|
@ -102,18 +102,13 @@ namespace IRaCIS.Core.Application.Services
|
|||
var resource = new ResourceInfo()
|
||||
{
|
||||
StudyId = imageShare.StudyId,
|
||||
Token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo()
|
||||
Token = _tokenService.GetToken(new UserTokenInfo()
|
||||
{
|
||||
Id = Guid.Empty,
|
||||
IsReviewer = false,
|
||||
IsAdmin = false,
|
||||
RealName = "Share001",
|
||||
UserRoleId = Guid.NewGuid(),
|
||||
FullName = "Share001",
|
||||
UserName = "Share001",
|
||||
Sex = 0,
|
||||
//UserType = "ShareType",
|
||||
UserTypeEnum = UserTypeEnum.ShareImage,
|
||||
Code = "ShareCode001",
|
||||
}))
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Medallion.Threading;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -58,7 +59,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
|
||||
[UnitOfWork]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput<NoneDicomStudyAddReturnDto>> AddOrUpdateNoneDicomStudy(NoneDicomStudyAddOrEdit addOrEditNoneDicomStudy)
|
||||
{
|
||||
|
||||
|
@ -70,6 +71,8 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
NoneDicomStudy? optEntity = null;
|
||||
var @lock = _distributedLockProvider.CreateLock($"NoneDicomCode");
|
||||
|
||||
|
@ -85,6 +88,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
optEntity = await _noneDicomStudyRepository.InsertFromDTOAsync(addOrEditNoneDicomStudy);
|
||||
|
||||
optEntity.StudyCode = AppSettings.GetCodeStr(optEntity.Code, nameof(NoneDicomStudy));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -105,7 +109,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
}
|
||||
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
[HttpDelete("{trialId:guid}/{subjectVisitId:guid}/{noneDicomStudyId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteNoneDicomStudy(Guid noneDicomStudyId, Guid subjectVisitId)
|
||||
{
|
||||
|
@ -128,7 +132,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
|
||||
[HttpDelete("{trialId:guid}/{subjectVisitId:guid}/{noneDicomStudyFileId:guid}")]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> DeleteNoneDicomStudyFile(Guid noneDicomStudyFileId, Guid subjectVisitId)
|
||||
{
|
||||
//提交了 但是IQC同意的时候 是可以删除的 | 普通提交后也不能删除
|
||||
|
@ -155,7 +159,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public async Task<List<NoneDicomStudyFileView>> GetNoneDicomStudyFileList(Guid noneDicomStudyId)
|
||||
{
|
||||
return await _noneDicomStudyFileRepository.Where(t => t.NoneDicomStudyId == noneDicomStudyId)
|
||||
.ProjectTo<NoneDicomStudyFileView>(_mapper.ConfigurationProvider).OrderBy(t=>t.CreateTime).ToListAsync();
|
||||
.ProjectTo<NoneDicomStudyFileView>(_mapper.ConfigurationProvider).OrderBy(t => t.CreateTime).ToListAsync();
|
||||
}
|
||||
|
||||
[HttpGet("{subjectVisitId:guid}")]
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpGet, Route("{studyId:guid}")]
|
||||
public async Task<IResponseOutput<List<DicomSeriesDTO>>> List(Guid studyId)
|
||||
{
|
||||
|
||||
//断点
|
||||
var seriesList = await _seriesRepository.Where(s => s.StudyId == studyId).OrderBy(s => s.SeriesNumber).
|
||||
ThenBy(s => s.SeriesTime).ThenBy(s => s.CreateTime)
|
||||
.ProjectTo<DicomSeriesDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
}
|
||||
|
||||
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
|
||||
public async Task<IResponseOutput> PreArchiveDicomStudy(PreArchiveDicomStudyCommand preArchiveStudyCommand)
|
||||
{
|
||||
|
@ -99,20 +99,20 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
if (visitTaskId != null)
|
||||
{
|
||||
var cacheValue = _fusionCache.GetOrDefault<Guid>(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid));
|
||||
if (cacheValue != Guid.Empty && cacheValue != _userInfo.Id)
|
||||
if (cacheValue != Guid.Empty && cacheValue != _userInfo.UserRoleId)
|
||||
{
|
||||
//---当前已有人正在上传和归档该检查!
|
||||
return ResponseOutput.NotOk(I18n.T("UploadDownLoad_ArchiveInProgress"));
|
||||
}
|
||||
else
|
||||
{
|
||||
await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid), _userInfo.Id, TimeSpan.FromSeconds(15));
|
||||
await _fusionCache.SetAsync(CacheKeys.TrialTaskStudyUidUploading(trialId, visitTaskId.Value, studyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromSeconds(15));
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await _fusionCache.SetAsync(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.Id, TimeSpan.FromSeconds(15));
|
||||
await _fusionCache.SetAsync(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromSeconds(15));
|
||||
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
|
||||
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand)
|
||||
{
|
||||
|
||||
|
@ -139,7 +139,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
else
|
||||
{
|
||||
//在事务未完成前 防止前端重复提交
|
||||
await _fusionCache.SetAsync(CacheKeys.TrialStudyUidDBLock(incommand.TrialId, incommand.Study.StudyInstanceUid), _userInfo.Id, TimeSpan.FromMinutes(3));
|
||||
await _fusionCache.SetAsync(CacheKeys.TrialStudyUidDBLock(incommand.TrialId, incommand.Study.StudyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromMinutes(3));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,6 +254,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
}
|
||||
}
|
||||
|
||||
findStudy = addStudy;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -321,6 +323,20 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
}
|
||||
|
||||
#region 只配置单个部位自动赋值
|
||||
//项目配置的影像部位
|
||||
var trialBodyParts = _trialRepository.Where(t => t.Id == trialId).Select(t => t.BodyPartTypes).FirstOrDefault();
|
||||
|
||||
var trialBodyPartList = trialBodyParts.Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (trialBodyPartList.Count() == 1)
|
||||
{
|
||||
var first = trialBodyPartList.First();
|
||||
findStudy.BodyPartForEdit = first;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
var @lock2 = _distributedLockProvider.CreateLock($"StudyCommit");
|
||||
|
||||
using (await @lock2.AcquireAsync())
|
||||
|
@ -357,7 +373,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
var svExpression = QCCommon.GetDicomStudySubjectVisitFilter(inQuery.VisitPlanArray);
|
||||
|
||||
var dicomStudyQuery = _dicomStudyRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))
|
||||
//.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||
.WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo))
|
||||
|
@ -394,7 +410,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
TrialSiteCode = t.Subject.TrialSite.TrialSiteCode,
|
||||
|
||||
Uploader = t.CreateUser.UserName,
|
||||
Uploader = t.CreateUserRole.IdentityUser.UserName,
|
||||
|
||||
UploadTime = t.CreateTime
|
||||
|
||||
|
@ -406,7 +422,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
|
||||
var nodeDicomStudyQuery = _noneDicomStudyRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))
|
||||
//.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||
.WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression2)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo))
|
||||
|
@ -444,7 +460,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
TrialSiteCode = t.Subject.TrialSite.TrialSiteCode,
|
||||
|
||||
Uploader = t.CreateUser.UserName,
|
||||
Uploader = t.CreateUserRole.IdentityUser.UserName,
|
||||
|
||||
UploadTime = t.CreateTime
|
||||
|
||||
|
@ -468,7 +484,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
{
|
||||
var svExpression = QCCommon.GetStudyMonitorSubjectVisitFilter(inQuery.VisitPlanArray);
|
||||
var StudyMonitorQuery = _studyMonitorRepository.Where(t => t.TrialId == inQuery.TrialId, ignoreQueryFilters: true)
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))
|
||||
//.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||
.WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo))
|
||||
|
@ -476,7 +492,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
.WhereIf(inQuery.SubjectVisitId != null, t => t.SubjectId == inQuery.SubjectVisitId)
|
||||
.WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId)
|
||||
.WhereIf(inQuery.IsDicom != null, t => t.IsDicom == inQuery.IsDicom)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Uploader), t => t.CreateUser.UserName.Contains(inQuery.Uploader))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Uploader), t => t.CreateUserRole.IdentityUser.UserName.Contains(inQuery.Uploader))
|
||||
.WhereIf(inQuery.IsSuccess != null, t => t.IsSuccess == inQuery.IsSuccess)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.StudyCode), t => t.StudyCode.Contains(inQuery.StudyCode))
|
||||
.WhereIf(inQuery.UploadStartTime != null, t => t.UploadStartTime >= inQuery.UploadStartTime)
|
||||
|
@ -499,7 +515,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
TrialSiteCode = t.Subject.TrialSite.TrialSiteCode,
|
||||
|
||||
Uploader = t.CreateUser.UserName,
|
||||
Uploader = t.CreateUserRole.IdentityUser.UserName,
|
||||
|
||||
UploadTime = t.CreateTime,
|
||||
|
||||
|
@ -615,7 +631,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
public async Task<IResponseOutput<List<VerifyStudyUploadResult>>> VerifyTaskStudyAllowUploadAsync(VerifyTaskUploadOrReupload verifyInfo)
|
||||
{
|
||||
|
||||
var queryStudy = _visitTaskRepository.Where(t => t.SubjectId == verifyInfo.SubjectId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id).Select(u => new
|
||||
var queryStudy = _visitTaskRepository.Where(t => t.SubjectId == verifyInfo.SubjectId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.UserRoleId).Select(u => new
|
||||
{
|
||||
VisitTaskId = u.Id,
|
||||
SourceSubjectVisitId = u.SourceSubjectVisitId,
|
||||
|
@ -654,7 +670,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
var result = new VerifyStudyUploadResult();
|
||||
|
||||
if (_fusionCache.GetOrDefault<Guid>($"StudyUid_{trialId}_{studyInstanceUid}") != _userInfo.Id)
|
||||
if (_fusionCache.GetOrDefault<Guid>($"StudyUid_{trialId}_{studyInstanceUid}") != _userInfo.UserRoleId)
|
||||
{
|
||||
|
||||
result.AllowUpload = false;
|
||||
|
@ -704,7 +720,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
{
|
||||
if (result.AllowReUpload || result.AllowUpload)
|
||||
{
|
||||
await _fusionCache.SetAsync($"StudyUid_{trialId}_{studyInstanceUid}", _userInfo.Id, TimeSpan.FromSeconds(30));
|
||||
await _fusionCache.SetAsync($"StudyUid_{trialId}_{studyInstanceUid}", _userInfo.UserRoleId, TimeSpan.FromSeconds(30));
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -800,7 +816,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
var result = new VerifyStudyUploadResult();
|
||||
|
||||
if (cacheUserId.GetValueOrDefault() != _userInfo.Id && cacheUserId.HasValue)
|
||||
if (cacheUserId.GetValueOrDefault() != _userInfo.UserRoleId && cacheUserId.HasValue)
|
||||
{
|
||||
|
||||
result.AllowUpload = false;
|
||||
|
@ -869,7 +885,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
{
|
||||
if (result.AllowReUpload || result.AllowUpload)
|
||||
{
|
||||
_fusionCache.Set(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.Id, TimeSpan.FromSeconds(30));
|
||||
_fusionCache.Set(CacheKeys.TrialStudyUidUploading(trialId, studyInstanceUid), _userInfo.UserRoleId, TimeSpan.FromSeconds(30));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -40,8 +40,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<DicomStudy, StudyDTO>().IncludeMembers(t => t.Subject, u => u.SubjectVisit)
|
||||
.ForMember(d => d.SiteName, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteName))
|
||||
.ForMember(d => d.UploaderFirstName, u => u.MapFrom(s => s.CreateUser.FirstName))
|
||||
.ForMember(d => d.UploaderLastName, u => u.MapFrom(s => s.CreateUser.LastName))
|
||||
.ForMember(d => d.UploaderFirstName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.FirstName))
|
||||
.ForMember(d => d.UploaderLastName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.LastName))
|
||||
.ForMember(d => d.UploadedTime, u => u.MapFrom(s => s.CreateTime));
|
||||
|
||||
CreateMap<Subject, StudyDTO>();
|
||||
|
@ -66,7 +66,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<DicomStudy, QAStudyInfoDTO>()
|
||||
.ForMember(o => o.IsCompleteClinicalData, t => t.MapFrom(u => !u.ReadingClinicalDataList.Any(x => x.ReadingClinicalDataPDFList.Count() == 0)))
|
||||
.ForMember(o => o.UploadedTime, t => t.MapFrom(u => u.CreateTime))
|
||||
.ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUser.LastName + " / " + u.CreateUser.FirstName))
|
||||
.ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUserRole.IdentityUser.FullName))
|
||||
.ForMember(o => o.StudyId, t => t.MapFrom(u => u.Id))
|
||||
.ForMember(o => o.IsHaveUploadFailed, t => t.MapFrom(u => u.DicomStudyMonitorList.Any(t => t.FailedFileCount > 0)))
|
||||
.ForMember(o => o.Modalities, t => t.MapFrom(u => string.Join('、', u.SeriesList.Select(t => t.Modality).Distinct())));
|
||||
|
@ -141,9 +141,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
;
|
||||
|
||||
CreateMap<TrialImageDownload, TrialImageDownloadView>()
|
||||
.ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUser.FullName))
|
||||
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUser.UserTypeEnum))
|
||||
.ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUser.UserName))
|
||||
.ForMember(d => d.UserFullName, u => u.MapFrom(s => s.CreateUserRole.FullName))
|
||||
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.CreateUserRole.UserTypeEnum))
|
||||
.ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName))
|
||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode))
|
||||
;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
IRepository<QCChallenge> _qCChallengeRepository,
|
||||
IRepository<Dictionary> _dictionaryRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
|
||||
IRepository<CheckChallengeDialog> _checkChallengeDialogRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IFrontAuditConfigService
|
||||
{
|
||||
|
@ -60,19 +60,19 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
case AccessToDialogueEnum.Question:
|
||||
|
||||
AccessToDialogueOutDto title = (await _qCChallengeRepository.Where(x => x.Id == inDto.Id).Include(x => x.CreateUser).Select(x => new AccessToDialogueOutDto()
|
||||
AccessToDialogueOutDto title = (await _qCChallengeRepository.Where(x => x.Id == inDto.Id).Include(x => x.CreateUserRole).Select(x => new AccessToDialogueOutDto()
|
||||
{
|
||||
CreateTime = x.CreateTime,
|
||||
CreateUserName = x.CreateUser.UserName,
|
||||
CreateUserName = x.CreateUserRole.IdentityUser.UserName,
|
||||
TalkContent = x.Content,
|
||||
IsTitle = true,
|
||||
}).FirstOrDefaultAsync()) ?? new AccessToDialogueOutDto();
|
||||
|
||||
data = await _qCChallengeDialogRepository.Where(x => x.QCChallengeId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUser).Select(
|
||||
data = await _qCChallengeDialogRepository.Where(x => x.QCChallengeId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUserRole).Select(
|
||||
x => new AccessToDialogueOutDto()
|
||||
{
|
||||
CreateTime = x.CreateTime,
|
||||
CreateUserName = x.CreateUser.UserName,
|
||||
CreateUserName = x.CreateUserRole.IdentityUser.UserName,
|
||||
TalkContent = x.TalkContent
|
||||
}
|
||||
).OrderBy(x => x.CreateTime).ToListAsync();
|
||||
|
@ -81,11 +81,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
break;
|
||||
case AccessToDialogueEnum.Consistency:
|
||||
data = await _checkChallengeDialogRepository.Where(x => x.SubjectVisitId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUser).Select(
|
||||
data = await _checkChallengeDialogRepository.Where(x => x.SubjectVisitId == inDto.Id && x.CreateTime <= inDto.Createtime).Include(x => x.CreateUserRole).Select(
|
||||
x => new AccessToDialogueOutDto()
|
||||
{
|
||||
CreateTime = x.CreateTime,
|
||||
CreateUserName = x.CreateUser.UserName,
|
||||
CreateUserName = x.CreateUserRole.IdentityUser.UserName,
|
||||
TalkContent = x.TalkContent
|
||||
}
|
||||
).OrderBy(x => x.CreateTime).ToListAsync();
|
||||
|
@ -389,8 +389,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
objectLsit.Add(newNamepDic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId3, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
|
||||
|
@ -401,7 +399,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//用户的数据稽查没有 临时处理
|
||||
|
||||
|
||||
var userObj = await _userRepository.Where(t => t.Id == objectRelationParentId).Select(t => new { UserRealName = t.FullName, t.Phone, t.UserName, UserType = t.UserTypeRole.UserTypeShortName, t.EMail, t.OrganizationName }).FirstOrDefaultAsync();
|
||||
var userObj = await _userRoleRepository.Where(t => t.Id == objectRelationParentId).Select(t => new { UserRealName = t.IdentityUser.FullName, t.IdentityUser.Phone, t.IdentityUser.UserName, UserType = t.UserTypeRole.UserTypeShortName, t.IdentityUser.EMail, t.IdentityUser.OrganizationName }).FirstOrDefaultAsync();
|
||||
|
||||
if (userObj != null)
|
||||
{
|
||||
|
@ -1074,14 +1072,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
//IsConfig = lst.Select(x => x.IsConfig).FirstOrDefault(),
|
||||
IsShowParent = lst.Select(x => x.IsShowParent).FirstOrDefault(),
|
||||
ParentId = item.AddItemGuid,
|
||||
CreateUserId = _userInfo.Id,
|
||||
CreateUserId = _userInfo.UserRoleId,
|
||||
IsEnable = lst.Select(x => x.IsEnable).FirstOrDefault(),
|
||||
DictionaryKey = lst.Select(x => x.DictionaryKey).FirstOrDefault(),
|
||||
EnumType = lst.Select(x => x.EnumType).FirstOrDefault(),
|
||||
UpdateTime = DateTime.Now,
|
||||
ValueCN = lst.Select(x => x.ValueCN).FirstOrDefault(),
|
||||
Value = lst.Max(x => x.Value),
|
||||
UpdateUserId = _userInfo.Id,
|
||||
UpdateUserId = _userInfo.UserRoleId,
|
||||
ChildrenTypeId = additem?.ChildrenTypeId,
|
||||
ModuleTypeId = additem?.ModuleTypeId,
|
||||
ObjectTypeId = additem?.ObjectTypeId,
|
||||
|
|
|
@ -12,7 +12,8 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
public class InspectionService(IRepository<DataInspection> _dataInspectionRepository,
|
||||
IRepository<Dictionary> _dictionaryRepository,
|
||||
IRepository<TrialSign> _trialSignRepository,
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<IdentityUser> _identityUserRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<Subject> _subjectRepository,
|
||||
|
@ -53,7 +54,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
from leftsubjectVisit in subjectVisittemp.DefaultIfEmpty()
|
||||
join parent in _dataInspectionRepository.Where() on data.ParentId equals parent.Id into parenttemp
|
||||
from leftparent in parenttemp.DefaultIfEmpty()
|
||||
join user in _userRepository.Where().IgnoreQueryFilters() on data.CreateUserId equals user.Id into usertemp
|
||||
join user in _userRoleRepository.Where().IgnoreQueryFilters() on data.CreateUserId equals user.Id into usertemp
|
||||
from leftuser in usertemp.DefaultIfEmpty()
|
||||
join usertype in _userTypeRepository.Where().IgnoreQueryFilters() on leftuser.UserTypeId equals usertype.Id into usertypetemp
|
||||
from leftusertype in usertypetemp.DefaultIfEmpty()
|
||||
|
@ -105,7 +106,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
//OptType = data.OptType,
|
||||
IP = data.IP,
|
||||
Reason = data.Reason,
|
||||
IsSign = leftfrontAuditConfig.IsHaveSign,
|
||||
IsSign = leftfrontAuditConfig.IsHaveSign && lefttrialSign.SignText!=null&& lefttrialSign.SignText!=string.Empty,
|
||||
SignId = data.SignId,
|
||||
ParentId = data.ParentId,
|
||||
ChildrenTypeId = data.ChildrenTypeId,
|
||||
|
@ -257,7 +258,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
/// <summary> 验证用户签名信息 </summary> ///
|
||||
public async Task<IResponseOutput> VerifySignatureAsync(SignDTO signDTO)
|
||||
{
|
||||
var user = await _userRepository.FirstOrDefaultAsync(u => u.UserName == signDTO.UserName && u.Password == signDTO.PassWord);
|
||||
var user = await _identityUserRepository.FirstOrDefaultAsync(u => u.UserName == signDTO.UserName && u.Password == signDTO.PassWord);
|
||||
if (user == null)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["User_CheckNameOrPw"]);
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
//---该CRO已经参与项目,不能被删除。
|
||||
return ResponseOutput.NotOk(_localizer["CRO_InProject"]);
|
||||
}
|
||||
//if (_userRepository.Find().Any(t => t.OrganizationId == cROCompanyId))
|
||||
//if (_userRoleRepository.Find().Any(t => t.OrganizationId == cROCompanyId))
|
||||
//{
|
||||
// return ResponseOutput.NotOk("该CRO下存在用户,暂时无法删除。");
|
||||
//}
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
[ApiExplorerSettings(GroupName = "Institution")]
|
||||
public class SiteService(IRepository<Site> _siteRepository,
|
||||
IRepository<TrialSiteUser> _trialSiteUserRepository,
|
||||
IRepository<TrialSiteUserRole> _trialSiteUserRoleRepository,
|
||||
IDistributedLockProvider _distributedLockProvider,
|
||||
IRepository<TrialSite> _trialSiteRepository,
|
||||
IRepository<Hospital> _hospitalRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ISiteService
|
||||
|
@ -114,7 +114,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<IResponseOutput> DeleteSite(Guid siteId)
|
||||
{
|
||||
|
||||
if (await _trialSiteUserRepository.AnyAsync(t => t.TrialSite.SiteId == siteId))
|
||||
if (await _trialSiteUserRoleRepository.AnyAsync(t => t.TrialSite.SiteId == siteId))
|
||||
{
|
||||
//---该中心已经加入项目,不可以被删除。
|
||||
return ResponseOutput.NotOk(_localizer["Site_InProject"]);
|
||||
|
|
|
@ -12,30 +12,33 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
public Guid? Id { get; set; }
|
||||
public string IP { get; set; }
|
||||
|
||||
public string LoginFaildName { get; set; }
|
||||
public string ActionUserType { get; set; }
|
||||
public int OptType { get; set; }
|
||||
|
||||
public string? ActionUserName { get; set; }
|
||||
|
||||
public string? LoginUserName { get; set; }
|
||||
|
||||
public UserTypeEnum? LoginUserTypeEnum { get; set; }
|
||||
//public string ActionUserRoleShortName { get; set; }
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
||||
public string TargetIdentityUserName { get; set; }
|
||||
|
||||
public bool IsLoginUncommonly { get; set; }
|
||||
|
||||
public string? OptUserName { get; set; }
|
||||
|
||||
public UserTypeEnum? OptUserTypeEnum { get; set; }
|
||||
|
||||
public Guid? LoginUserId { get; set; }
|
||||
|
||||
public Guid? OptUserId { get; set; }
|
||||
|
||||
public string JsonObj { get; set; }
|
||||
|
||||
public string IPRegion { get; set; }
|
||||
}
|
||||
|
||||
public class SendMfaCommand
|
||||
{
|
||||
public Guid IdentityUserId { get; set; }
|
||||
|
||||
public UserMFAType MFAType { get; set; } = UserMFAType.Login;
|
||||
}
|
||||
|
||||
///<summary>UserLogQuery 列表查询参数模型</summary>
|
||||
public class UserLogQuery : PageInput
|
||||
{
|
||||
|
@ -57,7 +60,9 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public Guid? UserTypeId { get; set; }
|
||||
|
||||
public Guid? UserId { get; set; }
|
||||
public Guid? IdentityUserId { get; set; }
|
||||
|
||||
public bool? IsLoginUncommonly { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,41 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public Guid? UserId { get; set; }
|
||||
}
|
||||
public class IRCLoginDto
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
public class LoginSelectRoleReturn
|
||||
{
|
||||
public string JwtStr { get; set; }
|
||||
|
||||
public bool IsMutiAccount => AccountList.Count > 1;
|
||||
|
||||
public List<UserAccountInfo> AccountList { get; set; } = new List<UserAccountInfo>();
|
||||
}
|
||||
|
||||
public class UserAccountInfo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid IdentityUserId { get; set; }
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string EMail { get; set; } = string.Empty;
|
||||
|
||||
public Guid UserTypeId { get; set; }
|
||||
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
|
||||
public string UserTypeShortName { get; set; }
|
||||
|
||||
public bool IsUserRoleDisabled { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
public class LoginReturnDTO
|
||||
{
|
||||
public UserBasicInfo BasicInfo { get; set; } = new UserBasicInfo();
|
||||
|
@ -33,43 +67,51 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
}
|
||||
|
||||
public class IRCLoginReturnDTO
|
||||
{
|
||||
public UserBasicInfo BasicInfo { get; set; } = new UserBasicInfo();
|
||||
public string JWTStr { get; set; } = string.Empty;
|
||||
|
||||
public bool IsMFA { get; set; } = false;
|
||||
|
||||
public SystemEmailSendConfigView CompanyInfo { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class UserBasicInfo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid IdentityUserId { get; set; }
|
||||
|
||||
public Guid UserRoleId { get; set; }
|
||||
|
||||
public bool IsMutiAccount => AccountList?.Count > 1;
|
||||
public List<UserAccountInfo> AccountList { get; set; }
|
||||
|
||||
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string RealName { get; set; } = string.Empty;
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
public int? Sex { get; set; } // 1-男 2-女
|
||||
public string UserCode { get; set; }
|
||||
public string EMail { get; set; }
|
||||
|
||||
public int Status { get; set; }
|
||||
public bool IsTestUser { get; set; }
|
||||
public bool IsZhiZhun { get; set; }
|
||||
public bool IsFirstAdd { get; set; }
|
||||
|
||||
public bool NeedChangePassWord { get; set; } = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// LastLoginIP
|
||||
/// </summary>
|
||||
public bool PasswordChanged { get; set; }
|
||||
|
||||
public int LoginState { get; set; } = 0;
|
||||
public string LastLoginIP { get; set; } = string.Empty;
|
||||
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
|
||||
public DateTime? LastLoginTime { get; set; }
|
||||
/// <summary>
|
||||
/// 上一次修改密码的时间
|
||||
/// </summary>
|
||||
public DateTime? LastChangePassWordTime { get; set; }
|
||||
public bool IsTestUser { get; set; }
|
||||
public bool IsAdmin { get; set; } = false;
|
||||
public string UserTypeShortName { get; set; } = string.Empty;
|
||||
public bool PasswordChanged { get; set; }
|
||||
public int Status { get; set; }
|
||||
public Guid UserTypeId { get; set; }
|
||||
|
||||
public string Code { get; set; } = String.Empty;
|
||||
|
||||
public string PermissionStr { get; set; } = String.Empty;
|
||||
|
||||
public string EMail { get; set; } = string.Empty;
|
||||
public bool IsFirstAdd { get; set; }
|
||||
|
||||
public bool IsZhiZhun { get; set; }
|
||||
public bool IsReviewer { get; set; } = false;
|
||||
|
||||
public int LoginState { get; set; } = 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -119,16 +161,18 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public class UserDetailDTO : UserInfo
|
||||
{
|
||||
public bool CanEditUserType { get; set; }
|
||||
//public bool CanEditUserType { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public List<UserAccountInfo> AccountList { get; set; }
|
||||
}
|
||||
|
||||
public class UserInfo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string RealName { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
|
||||
|
@ -139,34 +183,19 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
public string EMail { get; set; } = string.Empty;
|
||||
public Guid UserTypeId { get; set; } = Guid.Empty;
|
||||
|
||||
public string UserCode { get; set; } = string.Empty;
|
||||
|
||||
public bool IsZhiZhun { get; set; }
|
||||
|
||||
public string UserType { get; set; } = string.Empty;
|
||||
|
||||
public string UserTypeShortName { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
|
||||
|
||||
|
||||
//public Guid OrganizationTypeId { get; set; } = Guid.Empty;
|
||||
//public string OrganizationType { get; set; } = String.Empty;
|
||||
//public Guid OrganizationId { get; set; }
|
||||
public string OrganizationName { get; set; } = string.Empty;
|
||||
|
||||
|
||||
|
||||
public string DepartmentName { get; set; } = String.Empty;
|
||||
public string PositionName { get; set; } = String.Empty;
|
||||
|
||||
public bool IsTestUser { get; set; }
|
||||
|
||||
public DateTime? LastLoginTime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -179,13 +208,59 @@ namespace IRaCIS.Application.Contracts
|
|||
}
|
||||
|
||||
|
||||
public class UserBasicInfoCommand : UserInfo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateUserRolesDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public List<UserAddUserType> UserRoleList { get; set; }
|
||||
}
|
||||
|
||||
public class UserCommand : UserInfo
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
public List<UserAddUserType> UserRoleList { get; set; }
|
||||
|
||||
|
||||
public string BaseUrl { get; set; } = string.Empty;
|
||||
public string RouteUrl { get; set; } = string.Empty;
|
||||
|
||||
//public string FirstName { get; set; }
|
||||
//public string LastName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class NewUserSendEmailCommand
|
||||
{
|
||||
public Guid IdentityUserId { get; set; }
|
||||
public string BaseUrl { get; set; } = string.Empty;
|
||||
public string RouteUrl { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
public class IdentityUserTypeDTO : UserAddUserType
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string UserTypeShortName { get; set; }
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
|
||||
public class UserAddUserType
|
||||
{
|
||||
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
|
||||
public Guid UserTypeId { get; set; }
|
||||
|
||||
public bool IsUserRoleDisabled { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class EditPasswordCommand
|
||||
|
@ -200,7 +275,7 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public class UserAccountDto
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
|
@ -231,6 +306,11 @@ namespace IRaCIS.Application.Contracts
|
|||
public DateTime? BeginLastLoginTime { get; set; }
|
||||
|
||||
public DateTime? EndLastLoginTime { get; set; }
|
||||
|
||||
|
||||
public DateTime? BeginLastChangePassWordTime { get; set; }
|
||||
|
||||
public DateTime? EndLastChangePassWordTime { get; set; }
|
||||
}
|
||||
|
||||
public class UserRoleInfoDTO
|
||||
|
@ -241,26 +321,25 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public class UserListDTO : UserInfo
|
||||
{
|
||||
[JsonIgnore]
|
||||
public Guid testGuid { get; set; }
|
||||
public bool CanEditUserType { get; set; }
|
||||
//public bool CanEditUserType { get; set; }
|
||||
|
||||
public bool IsFirstAdd { get; set; }
|
||||
|
||||
public DateTime? LastLoginTime { get; set; }
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
public List<string> RoleNameArray { get; set; } = new List<string>();
|
||||
public IEnumerable<RoleDTO> RoleNameList { get; set; } = new List<RoleDTO>();
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
|
||||
public DateTime? LastChangePassWordTime { get; set; }
|
||||
|
||||
public List<IdentityUserTypeDTO> UserRoleList { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class UserIdRoleName : RoleDTO
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
}
|
||||
public class UserIdRoleNameList
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public IEnumerable<RoleDTO> RoleList { get; set; } = new List<RoleDTO>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class AllowAnonymousResetPasswordCommand
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
|
@ -6,19 +7,19 @@ namespace IRaCIS.Core.Application.Service
|
|||
public interface IUserService
|
||||
{
|
||||
Task<IResponseOutput<UserAddedReturnDTO>> AddUser(UserCommand userAddModel);
|
||||
Task<IResponseOutput> DeleteUser(Guid userId);
|
||||
Task<UserDetailDTO> GetUser(Guid id);
|
||||
//Task<IResponseOutput> DeleteUser(Guid userId);
|
||||
//Task<UserDetailDTO> GetUser(Guid id);
|
||||
Task<PageOutput<UserListDTO>> GetUserList(UserListQueryDTO param);
|
||||
Task<IResponseOutput<LoginReturnDTO>> Login(string userName, string password);
|
||||
Task<IResponseOutput> VerifyMFACodeAsync(Guid userId, string Code);
|
||||
Task<IResponseOutput> VerifyMFACodeAsync(string Code);
|
||||
|
||||
Task<IResponseOutput> SendMFAEmail(Guid userId, int mfaType = 0);
|
||||
Task<IResponseOutput> SendMFAEmail(SendMfaCommand sendMfa);
|
||||
Task<UserBasicInfo> GetUserBasicInfo(Guid userId, string pwd);
|
||||
Task<IResponseOutput> ModifyPassword(EditPasswordCommand editPwModel);
|
||||
Task<IResponseOutput> ResetPassword(Guid userId);
|
||||
|
||||
Task<IResponseOutput> UpdateUser(UserCommand model);
|
||||
Task<IResponseOutput> UpdateUserState(Guid userId, UserStateEnum state);
|
||||
//Task<IResponseOutput> UpdateUserState(Guid userId, UserStateEnum state);
|
||||
|
||||
//Task<IResponseOutput> SendVerificationCode(string emailOrPhone, VerifyType verificationType, bool isReviewer = false);
|
||||
//Task<IResponseOutput> SetNewPassword(ResetPasswordCommand resetPwdModel);
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
if (entity.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished)
|
||||
{
|
||||
entity.PublishedUserId = _userInfo.Id;
|
||||
entity.PublishedUserId = _userInfo.UserRoleId;
|
||||
entity.PublishedTime = DateTime.Now;
|
||||
}
|
||||
await _systemNoticeRepository.SaveChangesAsync();
|
||||
|
@ -61,7 +61,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
if (addOrEditSystemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished && systemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.NotPublish)
|
||||
{
|
||||
systemNotice.PublishedUserId = _userInfo.Id;
|
||||
systemNotice.PublishedUserId = _userInfo.UserRoleId;
|
||||
systemNotice.PublishedTime = DateTime.Now;
|
||||
}
|
||||
else if (addOrEditSystemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.NotPublish && systemNotice.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished)
|
||||
|
@ -125,7 +125,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.WhereIf(inQuery.NoticeTypeEnum != null, t => t.NoticeTypeEnum == inQuery.NoticeTypeEnum)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.FileName), t => t.FileName.Contains(inQuery.FileName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.NoticeContent), t => t.NoticeContent.Contains(inQuery.NoticeContent))
|
||||
.ProjectTo<SystemNoticeReadDTO>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id });
|
||||
.ProjectTo<SystemNoticeReadDTO>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.UserRoleId });
|
||||
|
||||
return await systemNoticeQueryable.ToPagedListAsync(inQuery);
|
||||
}
|
||||
|
@ -137,9 +137,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
var appDateTimeNow = DateTime.Now;
|
||||
|
||||
var query = _systemNoticeRepository
|
||||
.Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished && !t.NoticeUserReadList.Any(t => t.CreateUserId == _userInfo.Id))
|
||||
.Where(t => t.NoticeUserTypeList.Any(t => t.UserTypeId == _userInfo.UserTypeId) && t.NoticeStateEnum == Domain.Share.SystemNotice_NoticeStateEnum.HavePublished && !t.NoticeUserReadList.Any(t => t.CreateUserId == _userInfo.UserRoleId))
|
||||
.Where(t => t.EndDate == null || t.EndDate != null && t.EndDate > appDateTimeNow)
|
||||
.ProjectTo<SystemNoticeView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.Id });
|
||||
.ProjectTo<SystemNoticeView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, userId = _userInfo.UserRoleId });
|
||||
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
|
|
|
@ -32,15 +32,15 @@ namespace IRaCIS.Core.Application.Service
|
|||
var isCRCOrIR = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer;
|
||||
|
||||
var userFeedBackQueryable = _userFeedBackRepository
|
||||
.WhereIf(isCRCOrIR, t => t.CreateUserId == _userInfo.Id)
|
||||
.WhereIf(isCRCOrIR, t => t.CreateUserId == _userInfo.UserRoleId)
|
||||
.WhereIf(inQuery.State != null, t => t.State == inQuery.State)
|
||||
.WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.QuestionType != null, t => t.QuestionType == inQuery.QuestionType)
|
||||
.WhereIf(inQuery.BeginCreatime != null, t => t.CreateTime >= inQuery.BeginCreatime)
|
||||
|
||||
.WhereIf(inQuery.EndCreatime != null, t => t.CreateTime == inQuery.EndCreatime)
|
||||
.WhereIf(inQuery.UserTypeEnum != null, t => t.CreateUser.UserTypeEnum == inQuery.UserTypeEnum)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.FeedBackUserKeyInfo), t => t.CreateUser.FullName.Contains(inQuery.FeedBackUserKeyInfo) || t.CreateUser.UserName.Contains(inQuery.FeedBackUserKeyInfo))
|
||||
.WhereIf(inQuery.UserTypeEnum != null, t => t.CreateUserRole.UserTypeEnum == inQuery.UserTypeEnum)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.FeedBackUserKeyInfo), t => t.CreateUserRole.FullName.Contains(inQuery.FeedBackUserKeyInfo) || t.CreateUserRole.IdentityUser.UserName.Contains(inQuery.FeedBackUserKeyInfo))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.QuestionDescription), t => t.QuestionDescription.Contains(inQuery.QuestionDescription))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TrialKeyInfo), t => t.Trial.ExperimentName.Contains(inQuery.TrialKeyInfo) || t.Trial.TrialCode.Contains(inQuery.TrialKeyInfo))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.SubejctAndVisitKeyInfo), t => t.Subject.Code.Contains(inQuery.SubejctAndVisitKeyInfo) || t.SubjectVisit.VisitName.Contains(inQuery.SubejctAndVisitKeyInfo))
|
||||
|
@ -61,8 +61,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
throw new BusinessValidationFailedException("Id 或者VisitTaskId 必传一个");
|
||||
}
|
||||
|
||||
var result = await _userFeedBackRepository.WhereIf(inQuery.Id == null, t => t.VisitTaskId == inQuery.VisitTaskId)
|
||||
.WhereIf(inQuery.VisitTaskId == null, t => t.Id == inQuery.Id).ProjectTo<UserFeedBackView>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
var result = await _userFeedBackRepository
|
||||
.WhereIf(inQuery.Id != null, t => t.Id == inQuery.Id)
|
||||
.WhereIf(inQuery.VisitTaskId != null, t => t.VisitTaskId == inQuery.VisitTaskId)
|
||||
.ProjectTo<UserFeedBackView>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,7 +12,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
/// UserTypeRoleService
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Management")]
|
||||
public class UserTypeRoleService(IRepository<UserType> _userTypeRepository, IRepository<User> _userRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IUserTypeService
|
||||
public class UserTypeRoleService(IRepository<UserType> _userTypeRepository, IRepository<UserRole> _userRoleRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IUserTypeService
|
||||
{
|
||||
|
||||
[HttpPost]
|
||||
|
@ -79,7 +79,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
[HttpDelete("{userTypeId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteUserTypeRole(Guid userTypeId)
|
||||
{
|
||||
if (await _userRepository.AnyAsync(t => t.UserTypeId == userTypeId))
|
||||
if (await _userRoleRepository.AnyAsync(t => t.UserTypeId == userTypeId))
|
||||
{
|
||||
//---该用户类型中已存在用户,不能删除
|
||||
return ResponseOutput.NotOk(_localizer["UserType_InUse"]);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using AutoMapper;
|
||||
using AutoMapper.EquivalencyExpression;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Auth;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
|
@ -16,7 +18,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
|
||||
CreateMap<UserCommand, User>().ForMember(d => d.UserCode, x => x.Ignore());
|
||||
CreateMap<UserCommand, IdentityUser>()
|
||||
.ForMember(d => d.UserCode, x => x.Ignore())
|
||||
.ForMember(d => d.UserRoleList, x => x.Ignore());
|
||||
|
||||
CreateMap<UserType, UserTypeMenuAddOrEdit>().ReverseMap()
|
||||
.ForMember(t => t.UserTypeMenuList, u => u.MapFrom(c => c.MenuIds))
|
||||
.ForMember(t => t.UserTypeGroupList, u => u.MapFrom(c => c.UserTypeGroupIdList));
|
||||
|
@ -73,24 +78,26 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<UserType, TrialUserType>()
|
||||
.ForMember(d => d.UserType, u => u.MapFrom(t => t.UserTypeName));
|
||||
|
||||
CreateMap<User, UserDetailDTO>()
|
||||
.ForMember(d => d.RealName, u => u.MapFrom(s => s.FullName))
|
||||
.ForMember(d => d.UserTypeId, u => u.MapFrom(s => s.UserTypeRole.Id))
|
||||
.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeName))
|
||||
.ForMember(d => d.UserTypeShortName, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
||||
.ForMember(d => d.CanEditUserType, u => u.MapFrom(s => !s.UserTrials.Any()));
|
||||
// CreateMap<User, UserDetailDTO>()
|
||||
//.ForMember(d => d.RealName, u => u.MapFrom(s => s.FullName))
|
||||
//.ForMember(d => d.UserTypeId, u => u.MapFrom(s => s.UserTypeRole.Id))
|
||||
//.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeName))
|
||||
//.ForMember(d => d.UserTypeShortName, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
||||
//.ForMember(d => d.CanEditUserType, u => u.MapFrom(s => !s.UserTrials.Any()));
|
||||
|
||||
CreateMap<User, UserListDTO>()
|
||||
.ForMember(d => d.RealName, u => u.MapFrom(s => s.FullName))
|
||||
.ForMember(d => d.UserTypeId, u => u.MapFrom(s => s.UserTypeRole.Id))
|
||||
.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
||||
.ForMember(d => d.CanEditUserType, u => u.MapFrom(s => !s.UserTrials.Any()));
|
||||
// CreateMap<User, UserListDTO>()
|
||||
// .ForMember(d => d.RealName, u => u.MapFrom(s => s.FullName))
|
||||
// .ForMember(d => d.UserTypeId, u => u.MapFrom(s => s.UserTypeRole.Id))
|
||||
// .ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
||||
// .ForMember(d => d.CanEditUserType, u => u.MapFrom(s => !s.UserTrials.Any()));
|
||||
|
||||
CreateMap<IdentityUser, UserDetailDTO>();
|
||||
|
||||
var token = string.Empty;
|
||||
var userId = Guid.Empty;
|
||||
CreateMap<SystemNotice, SystemNoticeView>()
|
||||
.ForMember(t => t.PublishUserName, d => d.MapFrom(t => t.PublishedUser.UserName))
|
||||
.ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUser.UserName))
|
||||
.ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUserRole.IdentityUser.UserName))
|
||||
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token));
|
||||
|
||||
|
||||
|
@ -98,7 +105,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<SystemNotice, SystemNoticeReadDTO>()
|
||||
.ForMember(t => t.PublishUserName, d => d.MapFrom(t => t.PublishedUser.UserName))
|
||||
.ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUser.UserName))
|
||||
.ForMember(t => t.CreateUserName, d => d.MapFrom(t => t.CreateUserRole.IdentityUser.UserName))
|
||||
.ForMember(t => t.IsRead, d => d.MapFrom(t => t.NoticeUserReadList.Any(t => t.CreateUserId == userId)))
|
||||
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path + "?access_token=" + token));
|
||||
|
||||
|
@ -116,11 +123,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
CreateMap<UserLog, UserLogView>()
|
||||
.ForMember(d => d.LoginUserName, c => c.MapFrom(t => t.LoginUser.UserName))
|
||||
.ForMember(d => d.LoginUserTypeEnum, c => c.MapFrom(t => t.LoginUser.UserTypeEnum))
|
||||
.ForMember(d => d.OptUserName, c => c.MapFrom(t => t.OptUser.UserName))
|
||||
.ForMember(d => d.OptUserTypeEnum, c => c.MapFrom(t => t.OptUser.UserTypeEnum))
|
||||
;
|
||||
//.ForMember(d => d.ActionUserRoleShortName, c => c.MapFrom(t => t.CreateUserRole.UserTypeRole.UserTypeShortName))
|
||||
.ForMember(d => d.TargetIdentityUserName, c => c.MapFrom(t => t.TargetIdentityUser.UserName));
|
||||
|
||||
|
||||
CreateMap<UserFeedBack, UserFeedBackView>()
|
||||
|
@ -129,13 +133,48 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.SubjectCode, c => c.MapFrom(t => t.Subject.Code))
|
||||
.ForMember(d => d.TrialSiteCode, c => c.MapFrom(t => t.VisitTask.IsAnalysisCreate ? t.VisitTask.BlindTrialSiteCode : t.TrialSite.TrialSiteCode))
|
||||
.ForMember(d => d.SubjectVisitName, c => c.MapFrom(t => t.SubjectVisit.VisitName))
|
||||
.ForMember(d => d.FeedBackUserName, c => c.MapFrom(t => t.CreateUser.UserName))
|
||||
.ForMember(d => d.FeedBackFullName, c => c.MapFrom(t => t.CreateUser.FullName))
|
||||
.ForMember(d => d.UserTypeEnum, c => c.MapFrom(t => t.CreateUser.UserTypeEnum))
|
||||
.ForMember(d => d.FeedBackUserName, c => c.MapFrom(t => t.CreateUserRole.IdentityUser.UserName))
|
||||
.ForMember(d => d.FeedBackFullName, c => c.MapFrom(t => t.CreateUserRole.IdentityUser.FullName))
|
||||
.ForMember(d => d.UserTypeEnum, c => c.MapFrom(t => t.CreateUserRole.UserTypeEnum))
|
||||
.ForMember(d => d.ScreenshotList, c => c.MapFrom(t => t.FeedBackScreenshotList))
|
||||
;
|
||||
|
||||
CreateMap<UserFeedBackAddOrEdit, UserFeedBack>().ReverseMap();
|
||||
|
||||
CreateMap<UserBasicInfo, UserTokenInfo>();
|
||||
|
||||
CreateMap<UserRole, UserAccountInfo>()
|
||||
.ForMember(d => d.UserTypeShortName, c => c.MapFrom(t => t.UserTypeRole.UserTypeShortName));
|
||||
|
||||
|
||||
|
||||
CreateMap<UserRole, IdentityUser>();
|
||||
|
||||
CreateMap<IdentityUser, UserBasicInfo>()
|
||||
.ForMember(d => d.IdentityUserId, c => c.MapFrom(t => t.Id));
|
||||
CreateMap<IdentityUser, UserListDTO>();
|
||||
|
||||
CreateMap<UserAddUserType, UserRole>().ReverseMap();
|
||||
|
||||
|
||||
CreateMap<UserRole, IdentityUserTypeDTO>()
|
||||
.ForMember(d => d.UserTypeShortName, c => c.MapFrom(t => t.UserTypeRole.UserTypeShortName));
|
||||
|
||||
CreateMap<UserBasicInfoCommand, IdentityUser>();
|
||||
|
||||
CreateMap<UserRole, IdentityUser>().ReverseMap();
|
||||
|
||||
CreateMap<UserCommand, UserRole>();
|
||||
|
||||
|
||||
CreateMap<TrialExternalUser, IdentityUser>();
|
||||
|
||||
CreateMap<UpdateTrialUserCommand, TrialIdentityUser>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,9 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public bool IsPacsConnectConfiged { get; set; }
|
||||
|
||||
[Comment("阅片任务产生之前 采集影像")]
|
||||
public CollectImagesType CollectImagesEnum { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -179,23 +182,31 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
[DictionaryTranslateAttribute("IsSystemDoc")]
|
||||
public bool IsSystemDoc { get; set; }
|
||||
|
||||
[DictionaryTranslateAttribute("YesOrNo")]
|
||||
[DictionaryTranslateAttribute("TrainingStatus")]
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
//上传时间
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
[DictionaryTranslateAttribute("YesOrNo")]
|
||||
[DictionaryTranslateAttribute("TrainingStatusEnum")]
|
||||
public bool IsConfirmed => ConfirmTime != null;
|
||||
|
||||
public string RealName { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
public string UserTypeShortName { get; set; }
|
||||
|
||||
public Guid ConfirmUserId { get; set; }
|
||||
|
||||
public DateTime? ConfirmTime { get; set; }
|
||||
|
||||
|
||||
public string UserTypes => string.Join(',', UserConfirmedUserTypeList);
|
||||
|
||||
public List<string> UserConfirmedUserTypeList => (DocNeedSignUserTypeList != null && IdentityUserTypeList != null) ? IdentityUserTypeList.Intersect(DocNeedSignUserTypeList).ToList() : new List<string>();
|
||||
|
||||
|
||||
public IEnumerable<string> IdentityUserTypeList { get; set; }
|
||||
public IEnumerable<string> DocNeedSignUserTypeList { get; set; }
|
||||
}
|
||||
|
||||
public class CRCVisitExportDTO
|
||||
|
@ -299,18 +310,20 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string LatestReplyUserName { get; set; } = String.Empty;
|
||||
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public string ContentReplaced {
|
||||
public string ContentReplaced
|
||||
{
|
||||
|
||||
get {
|
||||
|
||||
var msg= Content.Replace("<div style='margin-left:20px'>", "").Replace("</div>", "");
|
||||
get
|
||||
{
|
||||
|
||||
var msg = Content.Replace("<div style='margin-left:20px'>", "").Replace("</div>", "");
|
||||
|
||||
string[] substrings = msg.Split(new string[] { "<br>", "<br/>" }, StringSplitOptions.None);
|
||||
|
||||
return string.Join("\n\n", substrings);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[DictionaryTranslateAttribute("ChallengeIsClosed")]
|
||||
public bool IsClosed { get; set; }
|
||||
|
@ -1155,16 +1168,31 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string TranslateDicName { get; set; }
|
||||
}
|
||||
|
||||
public class ExportQuestionBasicInfo
|
||||
{
|
||||
public QuestionType? QuestionType { get; set; }
|
||||
public string TableName { get; set; }
|
||||
public Guid QuestionId { get; set; }
|
||||
public string QuestionName { get; set; }
|
||||
public string TranslateDicName { get; set; }
|
||||
public string CDISCCode { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class CommonQuesionInfo
|
||||
{
|
||||
|
||||
//问题标识,肿瘤评估用于区分是什么问题
|
||||
public QuestionType? QuestionType { get; set; }
|
||||
|
||||
|
||||
public Guid QuestionId { get; set; }
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
public string QuestionValue { get; set; }
|
||||
|
||||
public string TranslateDicName { get; set; }
|
||||
|
||||
public string CDISCCode { get; set; }
|
||||
}
|
||||
public class CommonEvaluationExport
|
||||
{
|
||||
|
@ -1212,15 +1240,29 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string JudgeNote { get; set; } = string.Empty;
|
||||
|
||||
public string VisitNote { get; set; }
|
||||
|
||||
#region CDISC_阅片结果表
|
||||
|
||||
public string ResearchProgramNo { get; set; } = string.Empty;
|
||||
|
||||
public string VisitName { get; set; }
|
||||
|
||||
|
||||
public string TrialSiteSubjectCode => ResearchProgramNo + SubjectCode;
|
||||
|
||||
//最晚拍片日期
|
||||
public DateTime? LatestScanDate { get; set; }
|
||||
|
||||
public string LatestScanDateStr => LatestScanDate?.ToString("yyyy-MM-dd");
|
||||
|
||||
//阅片完成时间
|
||||
public DateTime? SignTime { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class CommonLessionExport : CommonEvaluationExport
|
||||
{
|
||||
/// <summary>
|
||||
/// 最终导出的病灶信息
|
||||
/// </summary>
|
||||
public List<CommonLessionQuestionAnswerInfo> LessionAnswerList { get; set; }
|
||||
|
||||
|
||||
[JsonIgnore]
|
||||
public List<CommonLessionInfo> LesionList { get; set; } = new List<CommonLessionInfo>();
|
||||
|
@ -1240,18 +1282,34 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public class CommonLessionQuestionAnswerInfo
|
||||
{
|
||||
public string LessionCode { get; set; }
|
||||
|
||||
public string LessionType { get; set; }
|
||||
|
||||
#region 肿瘤评估标准的时候需要
|
||||
|
||||
public QuestionMark? QuestionMark { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region CDISC导出
|
||||
|
||||
public string CDISCCode { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 自定义表格名 特殊处理
|
||||
|
||||
public string TableName { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
public Guid TableQuesionId { get; set; }
|
||||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
public string QuestionValue { get; set; }
|
||||
|
||||
public string TranslateDicName { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1717,6 +1775,8 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
||||
public string CreateUserFullName { get; set; } = String.Empty;
|
||||
|
||||
public string CreateUserName { get; set; } = String.Empty;
|
||||
|
||||
//public bool NeedReUpload { get; set; }
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
Task<List<QCQuestionAnswerItemDto>> GetQCQuestionAnswerList(Guid subjectVisitId, Guid trialId, [FromRoute] TrialQCProcess trialQCProcess, [FromRoute] CurrentQC currentQCType);
|
||||
|
||||
Task<List<SubjectVisitSelectItem>> GetSubjectVisitSelectList(Guid subjectId);
|
||||
Task<(List<QAStudyInfoDTO>, object)> GetSubjectVisitUploadedStudyList(Guid subjectVisitId);
|
||||
Task<IResponseOutput< List<QAStudyInfoDTO>>> GetSubjectVisitUploadedStudyList(Guid subjectVisitId);
|
||||
Task<UploadViewInitDto> GetUploadInitInfo(Guid subjectVisitId);
|
||||
Task<TrialVisitQADTO> GetVisitQCInfo(Guid subjectVisitId, [FromRoute] TrialQCProcess trialQCProcess, [FromRoute] CurrentQC currentQCType);
|
||||
Task<QAStudySeriesInfo> GetVisitQCStudyAndSeriesList(Guid subjectVisitId);
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
subjectVisit = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == subjectVisitId)).IfNullThrowException();
|
||||
}
|
||||
if (subjectVisit!.CurrentActionUserId != _userInfo.Id)
|
||||
if (subjectVisit!.CurrentActionUserId != _userInfo.UserRoleId)
|
||||
{
|
||||
//---您不是该质控任务当前领取人,没有操作权限!
|
||||
throw new BusinessValidationFailedException(_localizer["QCCommon_NoPermission"]);
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
IRepository<TrialQCQuestionAnswer> _trialQCQuestionAnswerRepository,
|
||||
IRepository<TrialQCQuestion> _trialQCQuestionRepository,
|
||||
IRepository<DicomStudy> _dicomStudyRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<DicomSeries> _dicomSeriesRepository,
|
||||
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||
IRepository<QCChallenge> _qcChallengeRepository,
|
||||
|
@ -52,7 +52,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
.WhereIf(inQuery.SubmitState != null, t => t.SubmitState == inQuery.SubmitState)
|
||||
.WhereIf(inQuery.ChallengeState != null, t => t.ChallengeState == inQuery.ChallengeState)
|
||||
.WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent)
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))
|
||||
.ProjectTo<QCCRCVisitViewModel>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
.WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == true, t => t.IsClosed ? t.ClosedTime > t.DeadlineTime : DateTime.Now > t.DeadlineTime)
|
||||
.WhereIf(inQuery.IsOverTime != null && inQuery.IsOverTime == false, t => t.IsClosed ? t.ClosedTime < t.DeadlineTime : DateTime.Now < t.DeadlineTime)
|
||||
.WhereIf(inQuery.IsUrgent != null, t => t.SubjectVisit.IsUrgent == inQuery.IsUrgent)
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.SubjectVisit.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))
|
||||
.ProjectTo<QCCRCChallengeViewModel>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList = await query.ToPagedListAsync(inQuery, new string[] { nameof(QCCRCChallengeViewModel.IsUrgent) + " desc", nameof(QCCRCChallengeViewModel.CreateTime) });
|
||||
|
@ -209,7 +209,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
var result = await GetQCVisitList(new QCVisitSearchDTO()
|
||||
{
|
||||
TrialId = inDto.TrialId,
|
||||
CurrentActionUserId = _userInfo.Id,
|
||||
CurrentActionUserId = _userInfo.UserRoleId,
|
||||
VisitId = inDto.VisitId,
|
||||
PageIndex = 1,
|
||||
PageSize = 1,
|
||||
|
@ -291,7 +291,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectInfo), t => t.Subject.Code.Contains(inQuery.SubjectInfo))
|
||||
.WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||
//.WhereIf(!string.IsNullOrEmpty(checkQuery.VisitPlanInfo), checkQuery.VisitPlanInfo.Contains('.') ? t => t.InPlan == false : t => t.VisitNum == decimal.Parse(checkQuery.VisitPlanInfo))
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))//CRC 过滤负责的site
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.UserRoleId))//CRC 过滤负责的site
|
||||
.ProjectTo<QCCheckWithModalityView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList = await query.ToPagedListAsync(inQuery);
|
||||
|
@ -313,7 +313,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
var sv = (await _subjectVisitRepository.Where(t => t.Id == subjectVisitId)
|
||||
.ProjectTo<CheckDialogDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
sv.DialogList.ForEach(t => t.IsCurrentUser = _userInfo.Id == t.CreateUserId);
|
||||
sv.DialogList.ForEach(t => t.IsCurrentUser = _userInfo.UserRoleId == t.CreateUserId);
|
||||
|
||||
return sv;
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
/// <param name="subjectVisitId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{subjectVisitId:guid}")]
|
||||
public async Task<(List<QAStudyInfoDTO>, object)> GetSubjectVisitUploadedStudyList(Guid subjectVisitId)
|
||||
public async Task<IResponseOutput<List<QAStudyInfoDTO>>> GetSubjectVisitUploadedStudyList(Guid subjectVisitId)
|
||||
{
|
||||
|
||||
var visit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).FirstNotNullAsync();
|
||||
|
@ -530,7 +530,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
config.IsPacsConnectConfiged = await _subjectVisitRepository.Where(t => t.Id == subjectVisitId).AnyAsync(t => t.Trial.IsPACSConnect && t.Subject.TrialSite.TrialSiteDicomAEList.Any());
|
||||
|
||||
return (list, config);
|
||||
return ResponseOutput.Ok (list, config);
|
||||
}
|
||||
|
||||
|
||||
|
@ -544,7 +544,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
{
|
||||
|
||||
var list = await _qcChallengeRepository.Where(t => t.Id == qaChallengeId)
|
||||
.ProjectTo<ChallengeAndDialog>(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.Id }).ToListAsync();
|
||||
.ProjectTo<ChallengeAndDialog>(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.UserRoleId }).ToListAsync();
|
||||
|
||||
//利用automapper 运行时映射
|
||||
//list.ForEach(t => t.IsCurrentUser = _userInfo.Id == t.CreateUserId);
|
||||
|
@ -566,7 +566,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
{
|
||||
|
||||
var qaChallengeQuery = _qcChallengeRepository.Where(t => t.SubjectVisitId == subjectVisitId && t.QCProcessEnum == trialQCProcess)
|
||||
.ProjectTo<ChallengeAndDialog>(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.Id });
|
||||
.ProjectTo<ChallengeAndDialog>(_mapper.ConfigurationProvider, new { currentUserId = _userInfo.UserRoleId });
|
||||
|
||||
var list = await qaChallengeQuery.ToListAsync();
|
||||
|
||||
|
@ -584,10 +584,10 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
public async Task<List<QCChanllengeCreatorDto>> GetQCChallengeCreatorList(Guid trialId)
|
||||
{
|
||||
|
||||
return await _trialUserRepository.Where(t => t.TrialId == trialId && t.User.UserTypeEnum == UserTypeEnum.IQC).Select(t => new QCChanllengeCreatorDto()
|
||||
return await _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.UserRole.UserTypeEnum == UserTypeEnum.IQC).Select(t => new QCChanllengeCreatorDto()
|
||||
{
|
||||
CreatorRealName = t.User.FullName,
|
||||
Creator = t.User.UserName,
|
||||
CreatorRealName = t.UserRole.FullName,
|
||||
Creator = t.UserRole.IdentityUser.UserName,
|
||||
CreateUserId = t.UserId
|
||||
}).ToListAsync();
|
||||
|
||||
|
@ -601,10 +601,10 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<List<ParticipantDTO>> GetQCParticipantList(Guid trialId)
|
||||
{
|
||||
return await _trialUserRepository.Where(t => t.TrialId == trialId && (t.User.UserTypeEnum == UserTypeEnum.IQC || t.User.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)).Select(t => new ParticipantDTO()
|
||||
return await _trialUserRoleRepository.Where(t => t.TrialId == trialId && (t.UserRole.UserTypeEnum == UserTypeEnum.IQC || t.UserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)).Select(t => new ParticipantDTO()
|
||||
{
|
||||
HandleUserRealName = t.User.FullName,
|
||||
HandleUser = t.User.UserName,
|
||||
HandleUserRealName = t.UserRole.FullName,
|
||||
HandleUser = t.UserRole.IdentityUser.UserName,
|
||||
HandleUserId = t.UserId
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<SCPPatient> _scpPatientRepository,
|
||||
IRepository<SCPStudy> _scpStudyRepository,
|
||||
IRepository<TrialUser> _trialUserRepository,
|
||||
IRepository<TrialUserRole> _trialUserRoleRepository,
|
||||
IRepository<ReadModule> _readModuleRepository,
|
||||
IRepository<DicomInstance> _dicomInstanceRepository,
|
||||
IRepository<TrialQCQuestionAnswer> _trialQCQuestionAnswerRepository,
|
||||
|
@ -224,7 +224,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
dbQCChallenge.LatestMsgTime = DateTime.Now;
|
||||
|
||||
|
||||
dbQCChallenge.LatestReplyUserId = _userInfo.Id;
|
||||
dbQCChallenge.LatestReplyUserId = _userInfo.UserRoleId;
|
||||
|
||||
|
||||
var success = await _qCChallengeDialogrepository.SaveChangesAsync();
|
||||
|
@ -345,7 +345,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
ResponseOutput.NotOk(_localizer["QCOperation_PassAfterClose"]);
|
||||
}
|
||||
|
||||
sv.CheckUserId = _userInfo.Id;
|
||||
sv.CheckUserId = _userInfo.UserRoleId;
|
||||
sv.CheckState = CheckStateEnum.CVPassed;
|
||||
|
||||
sv.ReadingStatus = ReadingStatusEnum.TaskAllocate;
|
||||
|
@ -835,7 +835,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
subjectVisit = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == sujectVisitId)).IfNullThrowException();
|
||||
}
|
||||
|
||||
if (subjectVisit!.CurrentActionUserId != _userInfo.Id)
|
||||
if (subjectVisit!.CurrentActionUserId != _userInfo.UserRoleId)
|
||||
{
|
||||
//---您不是该质控任务当前领取人,没有操作权限!
|
||||
throw new BusinessValidationFailedException(_localizer["QCOperation_NoRecipient"]);
|
||||
|
@ -863,7 +863,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
dbSubjectVisit.IsTake = true;
|
||||
|
||||
dbSubjectVisit.CurrentActionUserId = _userInfo.Id;
|
||||
dbSubjectVisit.CurrentActionUserId = _userInfo.UserRoleId;
|
||||
|
||||
dbSubjectVisit.CurrentActionUserExpireTime = DateTime.Now.AddHours(1);
|
||||
|
||||
|
@ -919,8 +919,8 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
break;
|
||||
case TrialQCProcess.SingleAudit:
|
||||
visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted
|
||||
&& x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId != _userInfo.Id && (x.CurrentActionUserId == _userInfo.Id || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake)))
|
||||
.Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.Id)
|
||||
&& x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId != _userInfo.UserRoleId && (x.CurrentActionUserId == _userInfo.UserRoleId || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake)))
|
||||
.Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId)
|
||||
.Include(x => x.Subject).ToListAsync();
|
||||
|
||||
subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId)
|
||||
|
@ -953,9 +953,9 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
case TrialQCProcess.DoubleAudit:
|
||||
|
||||
visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.TrialId == inDto.TrialId &&
|
||||
((x.CurrentActionUserId == _userInfo.Id) || (!x.IsTake && x.AuditState != AuditStateEnum.QCPassed && (x.PreliminaryAuditUserId != _userInfo.Id)))
|
||||
((x.CurrentActionUserId == _userInfo.UserRoleId) || (!x.IsTake && x.AuditState != AuditStateEnum.QCPassed && (x.PreliminaryAuditUserId != _userInfo.UserRoleId)))
|
||||
)
|
||||
.Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.Id)
|
||||
.Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.UserRoleId)
|
||||
.Include(x => x.Subject).ToListAsync();
|
||||
if (subjectVisit != null)
|
||||
{
|
||||
|
@ -1046,7 +1046,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
}
|
||||
else if (trialConfig.QCProcessEnum == TrialQCProcess.SingleAudit)
|
||||
{
|
||||
if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.Id)
|
||||
if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.UserRoleId)
|
||||
{
|
||||
//---初审已通过,不能继续领取
|
||||
return ResponseOutput.NotOk(_localizer["QCOperation_InitialAuditPassed"]);
|
||||
|
@ -1068,7 +1068,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
}
|
||||
else if (trialConfig.QCProcessEnum == TrialQCProcess.DoubleAudit)
|
||||
{
|
||||
if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.Id)
|
||||
if (dbSubjectVisit.PreliminaryAuditUserId == _userInfo.UserRoleId)
|
||||
{
|
||||
//---复审不能和初审是同一个人
|
||||
return ResponseOutput.NotOk(_localizer["QCOperation_NoSameReviewer"]);
|
||||
|
@ -1099,7 +1099,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
dbSubjectVisit.IsTake = true;
|
||||
|
||||
dbSubjectVisit.CurrentActionUserId = _userInfo.Id;
|
||||
dbSubjectVisit.CurrentActionUserId = _userInfo.UserRoleId;
|
||||
|
||||
dbSubjectVisit.CurrentActionUserExpireTime = DateTime.Now.AddHours(1);
|
||||
|
||||
|
@ -1109,7 +1109,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
}
|
||||
else
|
||||
{
|
||||
if (dbSubjectVisit!.CurrentActionUserId != _userInfo.Id)
|
||||
if (dbSubjectVisit!.CurrentActionUserId != _userInfo.UserRoleId)
|
||||
{
|
||||
//---您不是该质控任务当前领取人,没有操作权限!
|
||||
return ResponseOutput.NotOk(_localizer["QCOperation_NoRecipient"], ApiResponseCodeEnum.NeedTips);
|
||||
|
@ -1414,7 +1414,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
{
|
||||
dbSubjectVisit.SubmitState = SubmitStateEnum.Submitted;
|
||||
dbSubjectVisit.SubmitTime = DateTime.Now;
|
||||
dbSubjectVisit.SubmitUserId = _userInfo.Id;
|
||||
dbSubjectVisit.SubmitUserId = _userInfo.UserRoleId;
|
||||
|
||||
//维护统一状态
|
||||
dbSubjectVisit.ReadingStatus = ReadingStatusEnum.ImageQuality;
|
||||
|
@ -1513,7 +1513,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
public async Task<IResponseOutput> QCPassedOrFailed(Guid trialId, Guid subjectVisitId, [FromRoute] AuditStateEnum auditState)
|
||||
{
|
||||
|
||||
if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == _userInfo.Id))
|
||||
if (!await _trialUserRoleRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == _userInfo.UserRoleId))
|
||||
{
|
||||
//---您已经被移出项目,没有操作权限。
|
||||
return ResponseOutput.NotOk(_localizer["QCOperation_RemoveItem"]);
|
||||
|
@ -1574,7 +1574,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
dbSubjectVisit.AuditState = AuditStateEnum.QCPassed;
|
||||
dbSubjectVisit.CheckState = trialConfig.IsImageConsistencyVerification ? CheckStateEnum.ToCheck : CheckStateEnum.CVPassed;
|
||||
dbSubjectVisit.ForwardState = trialConfig.IsImageConsistencyVerification ? ForwardStateEnum.None : ForwardStateEnum.ToForward;
|
||||
dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id;
|
||||
dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId;
|
||||
dbSubjectVisit.PreliminaryAuditTime = DateTime.Now;
|
||||
|
||||
|
||||
|
@ -1618,7 +1618,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
}
|
||||
|
||||
dbSubjectVisit.AuditState = AuditStateEnum.PrimaryQCPassed;
|
||||
dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id;
|
||||
dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId;
|
||||
dbSubjectVisit.PreliminaryAuditTime = DateTime.Now;
|
||||
|
||||
|
||||
|
@ -1638,7 +1638,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
dbSubjectVisit.ForwardState = trialConfig.IsImageConsistencyVerification ? ForwardStateEnum.None : ForwardStateEnum.ToForward;
|
||||
|
||||
dbSubjectVisit.ReviewAuditUserId = _userInfo.Id;
|
||||
dbSubjectVisit.ReviewAuditUserId = _userInfo.UserRoleId;
|
||||
|
||||
dbSubjectVisit.ReviewAuditTime = DateTime.Now;
|
||||
|
||||
|
@ -1682,7 +1682,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
if (dbSubjectVisit.AuditState == AuditStateEnum.InPrimaryQC)
|
||||
{
|
||||
dbSubjectVisit.AuditState = AuditStateEnum.QCFailed;
|
||||
dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id;
|
||||
dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId;
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -1697,12 +1697,12 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
if (dbSubjectVisit.AuditState == AuditStateEnum.InPrimaryQC)
|
||||
{
|
||||
dbSubjectVisit.AuditState = AuditStateEnum.QCFailed;
|
||||
dbSubjectVisit.PreliminaryAuditUserId = _userInfo.Id;
|
||||
dbSubjectVisit.PreliminaryAuditUserId = _userInfo.UserRoleId;
|
||||
}
|
||||
else if (dbSubjectVisit.AuditState == AuditStateEnum.InSecondaryQC)
|
||||
{
|
||||
dbSubjectVisit.AuditState = AuditStateEnum.QCFailed;
|
||||
dbSubjectVisit.ReviewAuditUserId = _userInfo.Id;
|
||||
dbSubjectVisit.ReviewAuditUserId = _userInfo.UserRoleId;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1717,7 +1717,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
|
||||
}
|
||||
dbSubjectVisit.Auditor = _userInfo.Id;
|
||||
dbSubjectVisit.Auditor = _userInfo.UserRoleId;
|
||||
dbSubjectVisit.IsTake = false;
|
||||
dbSubjectVisit.CurrentActionUserId = null;
|
||||
dbSubjectVisit.CurrentActionUserExpireTime = null;
|
||||
|
@ -1818,7 +1818,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
qcChallenge.ReuploadEnum = QCChanllengeReuploadEnum.QCAgreeUpload;
|
||||
qcChallenge.LatestMsgTime = DateTime.Now;
|
||||
qcChallenge.LatestReplyUserId = _userInfo.Id;
|
||||
qcChallenge.LatestReplyUserId = _userInfo.UserRoleId;
|
||||
|
||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == qcChallenge.SubjectVisitId, c => new SubjectVisit() { IsQCConfirmedReupload = true });
|
||||
|
||||
|
@ -1845,7 +1845,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
sv.AuditState = AuditStateEnum.InPrimaryQC;
|
||||
|
||||
sv.CurrentActionUserExpireTime = DateTime.Now.AddHours(1);
|
||||
sv.CurrentActionUserId = _userInfo.Id;
|
||||
sv.CurrentActionUserId = _userInfo.UserRoleId;
|
||||
|
||||
//BackgroundJob.Schedule<IObtainTaskAutoCancelJob>(t => t.CancelQCObtaion(qcChallenge.SubjectVisitId, DateTime.Now), TimeSpan.FromHours(1));
|
||||
sv.IsTake = true;
|
||||
|
@ -1936,13 +1936,13 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
qcChallenge.ReUploadedTime = DateTime.Now;
|
||||
|
||||
qcChallenge.ReUploadUserId = _userInfo.Id;
|
||||
qcChallenge.ReUploadUserId = _userInfo.UserRoleId;
|
||||
|
||||
qcChallenge.ReUploader = _userInfo.RealName;
|
||||
qcChallenge.ReUploader = _userInfo.FullName;
|
||||
|
||||
qcChallenge.LatestMsgTime = DateTime.Now;
|
||||
|
||||
qcChallenge.LatestReplyUserId = _userInfo.Id;
|
||||
qcChallenge.LatestReplyUserId = _userInfo.UserRoleId;
|
||||
|
||||
var dbSubjectVisit = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == qcChallenge.SubjectVisitId).IfNullThrowException();
|
||||
|
||||
|
@ -2013,7 +2013,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
}
|
||||
|
||||
qcChallenge.LatestMsgTime = DateTime.Now;
|
||||
qcChallenge.LatestReplyUserId = _userInfo.Id;
|
||||
qcChallenge.LatestReplyUserId = _userInfo.UserRoleId;
|
||||
qcChallenge.ReuploadEnum = QCChanllengeReuploadEnum.CRCRequestReupload;
|
||||
|
||||
qcChallenge.DialogList.Add(new QCChallengeDialog()
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum))
|
||||
.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code))
|
||||
.ForMember(d => d.SubjectStatus, u => u.MapFrom(s => s.Subject.Status))
|
||||
|
||||
|
||||
.ForMember(d => d.SubmitUserName, u => u.MapFrom(s => s.SubmitUser.FullName))
|
||||
.ForMember(d => d.ClinicalInformationTransmissionEnum, u => u.MapFrom(s => s.Trial.ClinicalInformationTransmissionEnum))
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<QCChallengeDialog, DialogInfo>()
|
||||
.ForMember(d => d.CreateTime, u => u.MapFrom(s => s.CreateTime))
|
||||
.ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUser.FullName))
|
||||
.ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.FullName))
|
||||
.ForMember(d => d.Content, u => u.MapFrom(s => s.TalkContent));
|
||||
|
||||
CreateMap<QCChallenge, QCChanllengeExportDto>()
|
||||
|
@ -58,7 +58,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.SubjectVisit.TrialSite.TrialSiteCode))
|
||||
.ForMember(d => d.VisitName, u => u.MapFrom(s => s.SubjectVisit.VisitName))
|
||||
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUser.UserName))
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName))
|
||||
.ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.UserName))
|
||||
.ForMember(d => d.LatestReplyUserFullName, u => u.MapFrom(t => t.LatestReplyUser.FullName))
|
||||
.ForMember(d => d.DialogList, u => u.MapFrom(t => t.DialogList))
|
||||
|
@ -89,8 +89,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.RadiologyClinicalDataCount, u => u.MapFrom(s => s.ClinicalDataList.Count(t => t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.ImageRead)))
|
||||
.ForMember(d => d.OncologyClinicalDataCount, u => u.MapFrom(s => s.ClinicalDataList.Count(t => t.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.OncologyRead)))
|
||||
|
||||
.ForMember(d => d.ChallengeWaitReplyCount, u => u.MapFrom(s => s.SubjectVisitList.SelectMany(c => c.QCChallengeList).Count(t => t.IsClosed == false && !t.DialogList.Any(t => t.CreateUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator))))
|
||||
.ForMember(d => d.CheckWaitReplyCount, u => u.MapFrom(s => s.SubjectVisitList.Count(t => t.CheckState == CheckStateEnum.CVIng && t.CheckChallengeState != CheckChanllengeTypeEnum.Closed && !t.CheckChallengeDialogList.Any(t => t.CreateUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator))))
|
||||
.ForMember(d => d.ChallengeWaitReplyCount, u => u.MapFrom(s => s.SubjectVisitList.SelectMany(c => c.QCChallengeList).Count(t => t.IsClosed == false && !t.DialogList.Any(t => t.CreateUserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator))))
|
||||
.ForMember(d => d.CheckWaitReplyCount, u => u.MapFrom(s => s.SubjectVisitList.Count(t => t.CheckState == CheckStateEnum.CVIng && t.CheckChallengeState != CheckChanllengeTypeEnum.Closed && !t.CheckChallengeDialogList.Any(t => t.CreateUserRole.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator))))
|
||||
;
|
||||
|
||||
CreateMap<Subject, SubjectProgressDto>()
|
||||
|
@ -124,7 +124,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<CheckChallengeDialog, DialogInfo>()
|
||||
.ForMember(d => d.CreateTime, u => u.MapFrom(s => s.CreateTime))
|
||||
.ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUser.FullName))
|
||||
.ForMember(d => d.UserName, u => u.MapFrom(s => s.CreateUserRole.FullName))
|
||||
.ForMember(d => d.Content, u => u.MapFrom(s => s.TalkContent));
|
||||
|
||||
CreateMap<SubjectVisit, PMKCheckEXportDTO>()
|
||||
|
@ -145,9 +145,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(o => o.TrialReadingCriterionName, t => t.MapFrom(u => u.TrialReadingCriterion.CriterionName))
|
||||
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.IsSelfAnalysis == true ? u.BlindTrialSiteCode : u.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.IsSelfAnalysis == true ? u.BlindSubjectCode : u.Subject.Code))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.FullName))
|
||||
.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName))
|
||||
.ForMember(o => o.SubjectStatus, t => t.MapFrom(u => u.Subject.Status));
|
||||
|
||||
|
@ -161,9 +161,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(o => o.TrialReadingCriterionName, t => t.MapFrom(u => u.TrialReadingCriterion.CriterionName))
|
||||
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.IsSelfAnalysis == true ? u.BlindTrialSiteCode : u.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.IsSelfAnalysis == true ? u.BlindSubjectCode : u.Subject.Code))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.FullName))
|
||||
.ForMember(o => o.UserCode, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserCode))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.UserName))
|
||||
.ForMember(o => o.FullName, t => t.MapFrom(u => u.DoctorUser.IdentityUser.FullName))
|
||||
.ForMember(o => o.UserTypeShortName, t => t.MapFrom(u => u.DoctorUser.UserTypeRole.UserTypeShortName))
|
||||
.ForMember(o => o.SubjectStatus, t => t.MapFrom(u => u.Subject.Status));
|
||||
|
||||
|
@ -242,7 +242,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
QuestionType = c.ReadingQuestionTrial.QuestionType,
|
||||
QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName,
|
||||
QuestionValue = c.IsGlobalChange ? c.GlobalChangeAnswer : c.Answer,
|
||||
TranslateDicName = c.ReadingQuestionTrial.DictionaryCode
|
||||
QuestionId = c.ReadingQuestionTrial.Id,
|
||||
TranslateDicName = c.ReadingQuestionTrial.DictionaryCode,
|
||||
CDISCCode = c.ReadingQuestionTrial.CDISCCode
|
||||
})))
|
||||
;
|
||||
|
||||
|
@ -255,15 +257,19 @@ namespace IRaCIS.Core.Application.Service
|
|||
(arbitrationRule == ArbitrationRule.Reading ?
|
||||
u.Subject.SubjectVisitTaskList.Any(t => t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && t.ReadingCategory == ReadingCategory.Judge && t.TrialReadingCriterionId == trialReadingCriterionId && u.VisitTaskNum < t.VisitTaskNum) :
|
||||
false)))
|
||||
.ForMember(o => o.JudgeNote, t => t.MapFrom(u => u.ReadingCategory==ReadingCategory.Judge? u.JudgeResultRemark : u.JudgeVisitTask.JudgeResultRemark))
|
||||
.ForMember(o => o.JudgeNote, t => t.MapFrom(u => u.ReadingCategory == ReadingCategory.Judge ? u.JudgeResultRemark : u.JudgeVisitTask.JudgeResultRemark))
|
||||
.ForMember(o => o.VisitNote, t => t.MapFrom(u => u.ReadingTaskQuestionAnswerList.Where(c => c.ReadingQuestionTrial.QuestionType == QuestionType.AdjustReason).FirstOrDefault()!.Answer))
|
||||
//.ForMember(o => o.IsSubjectHaveReadingPeriod, t => t.MapFrom(u => arbitrationRule == ArbitrationRule.Reading ?
|
||||
//u.Subject.ReadModuleList.Any(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.ReadingSetType == ReadingSetType.ImageReading) : false))
|
||||
|
||||
|
||||
.ForMember(o => o.SubjectCriterionReadingPeriodVisitNumList, t => t.MapFrom(u =>
|
||||
u.Subject.ReadModuleList.Where(t=>t.TrialReadingCriterionId == trialReadingCriterionId && t.ReadingSetType == ReadingSetType.ImageReading).Select(c=>c.SubjectVisit.VisitNum)))
|
||||
|
||||
.ForMember(o => o.SubjectCriterionReadingPeriodVisitNumList, t => t.MapFrom(u =>
|
||||
u.Subject.ReadModuleList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.ReadingSetType == ReadingSetType.ImageReading).Select(c => c.SubjectVisit.VisitNum)))
|
||||
|
||||
.ForMember(o => o.ResearchProgramNo, t => t.MapFrom(u => u.Trial.ResearchProgramNo))
|
||||
.ForMember(o => o.VisitName, t => t.MapFrom(u => u.SourceSubjectVisit.VisitName))
|
||||
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(o => o.LatestScanDate, t => t.MapFrom(u => u.SourceSubjectVisit.LatestScanDate))
|
||||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code))
|
||||
.ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName))
|
||||
.ForMember(o => o.QuestionAnswerList, t => t.MapFrom(u => u.ReadingTaskQuestionAnswerList
|
||||
|
@ -272,14 +278,17 @@ namespace IRaCIS.Core.Application.Service
|
|||
.Select(c => new CommonQuesionInfo()
|
||||
{
|
||||
QuestionType = c.ReadingQuestionTrial.QuestionType,
|
||||
QuestionId = c.ReadingQuestionTrial.Id,
|
||||
QuestionName = isEn_Us ? c.ReadingQuestionTrial.QuestionEnName : c.ReadingQuestionTrial.QuestionName,
|
||||
QuestionValue = c.IsGlobalChange?c.GlobalChangeAnswer: c.Answer,
|
||||
TranslateDicName = c.ReadingQuestionTrial.DictionaryCode
|
||||
QuestionValue = c.IsGlobalChange ? c.GlobalChangeAnswer : c.Answer,
|
||||
TranslateDicName = c.ReadingQuestionTrial.DictionaryCode,
|
||||
CDISCCode = c.ReadingQuestionTrial.CDISCCode
|
||||
})))
|
||||
;
|
||||
|
||||
CreateMap<VisitTask, CommonLessionExport>().IncludeBase<VisitTask, CommonEvaluationExport>()
|
||||
.ForMember(o => o.LesionList, t => t.MapFrom(u => u.LesionList));
|
||||
CreateMap<VisitTask, CommonLessionExport>()
|
||||
.IncludeBase<VisitTask, CommonEvaluationExport>()
|
||||
.ForMember(o => o.LesionList, t => t.MapFrom(u => u.LesionList/*.Where(c => c.ReadingQuestionTrial.ExportResultStr.Contains(((int)readingExportType).ToString()))*/ ));
|
||||
|
||||
CreateMap<ReadingTableAnswerRowInfo, CommonLessionInfo>()
|
||||
.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.RowMark))
|
||||
|
@ -287,11 +296,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(o => o.LessionAnswerList, t => t.MapFrom(u => u.LesionAnswerList.Where(c => c.ReadingTableQuestionTrial.ExportResultStr.Contains(((int)readingExportType).ToString()))));
|
||||
|
||||
CreateMap<ReadingTableQuestionAnswer, CommonLessionQuestionAnswerInfo>()
|
||||
.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.Lesion.RowMark))
|
||||
.ForMember(o => o.LessionType, t => t.MapFrom(u => (int?)u.ReadingQuestionTrial.LesionType))
|
||||
//.ForMember(o => o.LessionCode, t => t.MapFrom(u => u.Lesion.RowMark))
|
||||
//.ForMember(o => o.LessionType, t => t.MapFrom(u => (int?)u.ReadingQuestionTrial.LesionType))
|
||||
.ForMember(o => o.QuestionMark, t => t.MapFrom(u => u.ReadingTableQuestionTrial.QuestionMark))
|
||||
.ForMember(o => o.TableQuesionId, t => t.MapFrom(u => u.ReadingTableQuestionTrial.Id))
|
||||
.ForMember(o => o.QuestionName, t => t.MapFrom(u => isEn_Us ? u.ReadingTableQuestionTrial.QuestionEnName : u.ReadingTableQuestionTrial.QuestionName))
|
||||
.ForMember(o => o.QuestionValue, t => t.MapFrom(u => u.Answer))
|
||||
.ForMember(o => o.CDISCCode, t => t.MapFrom(u => u.ReadingTableQuestionTrial.CDISCCode))
|
||||
.ForMember(o => o.TableName, t => t.MapFrom(u => isEn_Us ? u.ReadingQuestionTrial.QuestionEnName : u.ReadingQuestionTrial.QuestionName))
|
||||
.ForMember(o => o.TranslateDicName, t => t.MapFrom(u => u.ReadingTableQuestionTrial.DictionaryCode))
|
||||
;
|
||||
|
||||
|
@ -554,8 +566,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
//一致性核查 质疑对话
|
||||
CreateMap<CheckChallengeDialog, CheckChanllengeDialogDTO>()
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.UserName))
|
||||
.ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUser.FullName));
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.IdentityUser.UserName))
|
||||
.ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUserRole.IdentityUser.FullName));
|
||||
|
||||
CreateMap<SubjectVisit, CheckDialogDTO>()
|
||||
.ForMember(d => d.SubjectVisitCheck, u => u.MapFrom(t => t))
|
||||
|
@ -586,13 +598,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
// 临床数据上传 路径拼接返回
|
||||
|
||||
CreateMap<PreviousHistory, PreviousHistoryView>()
|
||||
.ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUser.FullName))
|
||||
.ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.FullName))
|
||||
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path));
|
||||
CreateMap<PreviousOther, PreviousOtherView>()
|
||||
.ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUser.FullName))
|
||||
.ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.FullName))
|
||||
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path));
|
||||
CreateMap<PreviousSurgery, PreviousSurgeryView>()
|
||||
.ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUser.FullName))
|
||||
.ForMember(d => d.CreateUser, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.FullName))
|
||||
.ForMember(d => d.FullFilePath, u => u.MapFrom(s => s.Path));
|
||||
|
||||
|
||||
|
@ -602,14 +614,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
//QC 质疑对话
|
||||
var currentUserId = Guid.Empty;
|
||||
CreateMap<QCChallengeDialog, QCChanllengeDialogDTO>()
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.UserName))
|
||||
.ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUser.FullName))
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.IdentityUser.UserName))
|
||||
.ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUserRole.FullName))
|
||||
|
||||
.ForMember(d => d.IsCurrentUser, u => u.MapFrom(s => s.CreateUserId == currentUserId));
|
||||
//质疑编号
|
||||
CreateMap<QCChallenge, QCChallengeWithUser>()
|
||||
.ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.FullName))
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.FullName))
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.FullName))
|
||||
.ForMember(d => d.CurrentActionUserId, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUserId))
|
||||
.ForMember(d => d.CurrentActionUserName, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUser.FullName))
|
||||
|
||||
|
@ -624,7 +636,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<QCChallenge, ChallengeAndDialog>()
|
||||
.ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.FullName))
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.FullName))
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.UserName))
|
||||
.ForMember(d => d.CreateUserFullName, u => u.MapFrom(t => t.CreateUserRole.FullName))
|
||||
.ForMember(d => d.CurrentActionUserId, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUserId))
|
||||
.ForMember(d => d.CurrentActionUserName, u => u.MapFrom(t => t.SubjectVisit.CurrentActionUser.FullName))
|
||||
|
||||
|
@ -641,7 +654,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
// 一致性核查文件
|
||||
CreateMap<InspectionFile, GetUserUploadFileDto>()
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUser.FullName));
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.FullName));
|
||||
|
||||
|
||||
//CRC 质疑列表
|
||||
|
@ -666,10 +679,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.BlindName, u => u.MapFrom(s => s.SubjectVisit.BlindName))
|
||||
//.ForMember(d => d.ClosedUserUserName, u => u.MapFrom(s => s.ClosedUser.UserName))
|
||||
.ForMember(d => d.IsQCConfirmedReupload, u => u.MapFrom(s => s.SubjectVisit.IsQCConfirmedReupload))
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUser.UserName))
|
||||
.ForMember(d => d.CreateUserFullName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.FullName))
|
||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(s => s.CreateUserRole.IdentityUser.UserName))
|
||||
.ForMember(d => d.LatestReplyUserName, u => u.MapFrom(t => t.LatestReplyUser.UserName))
|
||||
.ForMember(d => d.LatestReplyUserFullName, u => u.MapFrom(t => t.LatestReplyUser.FullName))
|
||||
|
||||
|
||||
.ForMember(d => d.ChallengeCode, u => u.MapFrom(s => s.ChallengeCode)); //排序的时候有坑 把这个带到sql 中去了
|
||||
//.AfterMap((src, dest) => dest.ChallengeCode = "Q" + src.ChallengeCode.ToString("D5"));//实测没有效果
|
||||
|
||||
|
@ -707,7 +721,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
Guid? visiTaskId = null;
|
||||
CreateMap<NoneDicomStudy, TaskDicomStudyView>()
|
||||
.ForMember(d => d.NoneDicomStudyFileList, u => u.MapFrom(s => isFilterZip ?
|
||||
s.TaskNoneDicomFileList.Where(t => visiTaskId != null ? t.VisitTaskId == visiTaskId : true).Where(t => !t.FileType.Contains(StaticData.FileType.Zip)).OrderBy(t => t.CreateTime).ThenBy(t=>t.FileName)
|
||||
s.TaskNoneDicomFileList.Where(t => visiTaskId != null ? t.VisitTaskId == visiTaskId : true).Where(t => !t.FileType.Contains(StaticData.FileType.Zip)).OrderBy(t => t.CreateTime).ThenBy(t => t.FileName)
|
||||
: s.TaskNoneDicomFileList.Where(t => visiTaskId != null ? t.VisitTaskId == visiTaskId : true).OrderBy(t => t.CreateTime).ThenBy(t => t.FileName)))
|
||||
.ForMember(d => d.CodeView, u => u.MapFrom(s => s.StudyCode));
|
||||
|
||||
|
|
|
@ -394,6 +394,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public class TableRowInfo
|
||||
{
|
||||
public Guid RowId { get; set; }
|
||||
|
||||
public decimal RowIndex { get; set; }
|
||||
|
||||
public decimal FristAddTaskNum { get; set; }
|
||||
|
|
|
@ -446,6 +446,78 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
}
|
||||
|
||||
public class DeleteSingleTableQuestionMarkInDto
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
|
||||
public class DeleteTableQuestionMarkInDto
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid RowId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存表格问题标记
|
||||
/// </summary>
|
||||
public class SaveTableQuestionMarkInDto
|
||||
{
|
||||
public string Answer { get; set; }
|
||||
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public Guid? InstanceId { get; set; }
|
||||
|
||||
public Guid? SeriesId { get; set; }
|
||||
public Guid? StudyId { get; set; }
|
||||
|
||||
public string MarkTool { get; set; } = string.Empty;
|
||||
|
||||
public string PicturePath { get; set; } = string.Empty;
|
||||
|
||||
public int? NumberOfFrames { get; set; }
|
||||
|
||||
public string MeasureData { get; set; } = string.Empty;
|
||||
public Guid? FristAddTaskId { get; set; }
|
||||
|
||||
public QuestionType? QuestionType { get; set; }
|
||||
public string OrderMarkName { get; set; } = string.Empty;
|
||||
|
||||
public Guid? OtherInstanceId { get; set; }
|
||||
|
||||
public Guid? OtherSeriesId { get; set; }
|
||||
|
||||
public Guid? OtherStudyId { get; set; }
|
||||
|
||||
public Guid? RowId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid TableQuestionId { get; set; }
|
||||
[NotDefault]
|
||||
public decimal RowIndex { get; set; }
|
||||
|
||||
public string OtherMarkTool { get; set; } = string.Empty;
|
||||
|
||||
public string OtherPicturePath { get; set; } = string.Empty;
|
||||
|
||||
public int? OtherNumberOfFrames { get; set; }
|
||||
|
||||
public string OtherMeasureData { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public class TableQuestionMark: SaveTableQuestionMarkInDto
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
public new Guid? TableQuestionId { get; set; }
|
||||
|
||||
public new decimal? RowIndex { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class GetPreviousOtherPicturePathInDto
|
||||
{
|
||||
|
@ -991,6 +1063,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public Guid? TableQuestionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序号标记
|
||||
/// </summary>
|
||||
|
@ -1134,7 +1208,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public class QuestionMarkInfo
|
||||
{
|
||||
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 问题Id
|
||||
|
@ -1177,7 +1251,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public string? MeasureData { get; set; }
|
||||
|
||||
|
||||
public Guid? FirstAddTaskId { get; set; }
|
||||
public Guid? FristAddTaskId { get; set; }
|
||||
|
||||
public QuestionType? QuestionType { get; set; }
|
||||
|
||||
|
@ -2765,10 +2839,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
}
|
||||
|
||||
|
||||
[Comment("导出标识")]
|
||||
public ExportIdentification? ExportIdentification { get; set; }
|
||||
|
||||
[Comment("导出结果")]
|
||||
public string ExportResultStr { get; set; } = "[]";
|
||||
|
||||
|
|
|
@ -465,6 +465,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// </summary>
|
||||
public QuestionMark? QuestionMark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认值
|
||||
/// </summary>
|
||||
public string DefaultValue { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 问题英文名称
|
||||
/// </summary>
|
||||
|
@ -475,8 +480,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public List<string> ParentTriggerValueList { get; set; } = new List<string>();
|
||||
public List<string> RelevanceValueList { get; set; } = new List<string>();
|
||||
|
||||
[Comment("导出标识")]
|
||||
public ExportIdentification? ExportIdentification { get; set; }
|
||||
|
||||
[Comment("导出结果")]
|
||||
public string ExportResultStr { get; set; } = "[]";
|
||||
|
@ -603,14 +606,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// </summary>
|
||||
public QuestionMark? QuestionMark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认值
|
||||
/// </summary>
|
||||
public string DefaultValue { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 问题英文名称
|
||||
/// </summary>
|
||||
public string QuestionEnName { get; set; } = string.Empty;
|
||||
|
||||
[Comment("导出标识")]
|
||||
public ExportIdentification? ExportIdentification { get; set; }
|
||||
|
||||
[Comment("导出结果")]
|
||||
public string ExportResultStr { get; set; } = "[]";
|
||||
|
||||
|
@ -750,6 +755,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准分组
|
||||
/// </summary>
|
||||
public CriterionGroup CriterionGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
|
@ -795,6 +805,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
{
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准分组
|
||||
/// </summary>
|
||||
public CriterionGroup CriterionGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// eCRF报告是否显示在图像页面
|
||||
/// </summary>
|
||||
|
@ -844,6 +859,13 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public class ReadingQuestionCriterionSystemViewInDto : PageInput
|
||||
{
|
||||
public string CriterionName { get; set; } = String.Empty;
|
||||
|
||||
public bool? IsCompleteConfig { get; set; }
|
||||
public bool? IsEnable { get; set; }
|
||||
public CriterionGroup? CriterionGroup { get; set; }
|
||||
public CriterionType? CriterionType { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class CriterionList
|
||||
|
@ -899,11 +921,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导出标识
|
||||
/// </summary>
|
||||
public ExportIdentification? ExportIdentification { get; set; }
|
||||
|
||||
[Comment("导出结果")]
|
||||
public string ExportResultStr { get; set; } = "[]";
|
||||
|
||||
|
@ -1205,13 +1222,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
public class ReadingQuestionSystemView
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 导出标识
|
||||
/// </summary>
|
||||
[Comment("导出标识")]
|
||||
public ExportIdentification? ExportIdentification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类问题类型
|
||||
/// </summary>
|
||||
|
@ -1735,6 +1745,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
[Comment("问题标识")]
|
||||
public QuestionMark? QuestionMark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认值
|
||||
/// </summary>
|
||||
public string DefaultValue { get; set; } = string.Empty;
|
||||
|
||||
[Comment("字典code")]
|
||||
public string DictionaryCode { get; set; } = string.Empty;
|
||||
[Comment("数值类型")]
|
||||
|
@ -1783,9 +1798,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
[Comment("分类算法")]
|
||||
public string ClassifyAlgorithms { get; set; } = string.Empty;
|
||||
|
||||
[Comment("导出标识")]
|
||||
public ExportIdentification? ExportIdentification { get; set; }
|
||||
|
||||
[Comment("导出结果")]
|
||||
public string ExportResultStr { get; set; } = "[]";
|
||||
|
||||
|
@ -1822,6 +1834,91 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
}
|
||||
|
||||
public class SetTrialQuestionExportResultInDto
|
||||
{
|
||||
|
||||
public ExportType ExportType { get; set; }
|
||||
|
||||
public List<SetTrialQuestionExport> QuestionList = new List<SetTrialQuestionExport>();
|
||||
|
||||
public List<SetTrialQuestionExport> TableQuestionList = new List<SetTrialQuestionExport>();
|
||||
}
|
||||
|
||||
|
||||
public class SetTrialQuestionExport
|
||||
{
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public Guid? TableQuestionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导出的CDISCName
|
||||
/// </summary>
|
||||
public string CDISCCode { get; set; } = string.Empty;
|
||||
|
||||
public List<ExportResult> ExportResult { get; set; }
|
||||
}
|
||||
|
||||
public class GetTrialQuestionExportResultInDto
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
|
||||
public ExportType ExportType { get; set; }
|
||||
}
|
||||
|
||||
public enum ExportType
|
||||
{
|
||||
Basic=0,
|
||||
|
||||
CDISC=1,
|
||||
}
|
||||
|
||||
|
||||
public class GetTrialQuestionExportResultOutDto
|
||||
{
|
||||
public CriterionType CriterionType { get; set; }
|
||||
public CriterionGroup CriterionGroup { get; set; }
|
||||
|
||||
public List<TrialQuestionExport> QuestionList = new List<TrialQuestionExport>();
|
||||
|
||||
public List<TrialQuestionExportDic> DicList = new List<TrialQuestionExportDic>();
|
||||
}
|
||||
|
||||
public class TrialQuestionExport
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public Guid? TableQuestionId { get; set; }
|
||||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
public List<ExportResult> ExportResult { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导出的CDISCName
|
||||
/// </summary>
|
||||
public string CDISCCode { get; set; } = string.Empty;
|
||||
|
||||
public int ShowOrder { get; set; }
|
||||
|
||||
public bool IsTableQuestion { get; set; }
|
||||
|
||||
public bool HasChildren => Children.Count() > 0;
|
||||
|
||||
public List<TrialQuestionExport> Children { get; set; } = new List<TrialQuestionExport>();
|
||||
}
|
||||
|
||||
public class TrialQuestionExportDic
|
||||
{
|
||||
public int Code { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public string ValueCN { get; set; }
|
||||
}
|
||||
|
||||
public class GetCustomQuestionPreviewInDto
|
||||
{
|
||||
[NotDefault]
|
||||
|
@ -2006,11 +2103,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// </summary>
|
||||
public ClassifyShowType? ClassifyShowType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导出标识
|
||||
/// </summary>
|
||||
public ExportIdentification? ExportIdentification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导出结果
|
||||
/// </summary>
|
||||
|
@ -2262,11 +2354,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// </summary>
|
||||
public ClassifyShowType? ClassifyShowType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 导出标识
|
||||
/// </summary>
|
||||
public ExportIdentification? ExportIdentification { get; set; }
|
||||
|
||||
[Comment("导出结果")]
|
||||
public string ExportResultStr { get; set; } = "[]";
|
||||
|
||||
|
@ -2542,6 +2629,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准分组
|
||||
/// </summary>
|
||||
public CriterionGroup CriterionGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准ID
|
||||
/// </summary>
|
||||
|
@ -2593,6 +2685,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准分组
|
||||
/// </summary>
|
||||
public CriterionGroup CriterionGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统标准ID
|
||||
/// </summary>
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
medicalReviewInfo.ArmEnum = taskInfo.ArmEnum;
|
||||
medicalReviewInfo.SubjectCode = taskInfo.IsAnalysisCreate ? taskInfo.BlindSubjectCode : taskInfo.Subject.Code;
|
||||
medicalReviewInfo.TaskBlindName = taskInfo.TaskBlindName;
|
||||
medicalReviewInfo.ReadingUser = taskInfo.DoctorUser.FirstName + taskInfo.DoctorUser.LastName;
|
||||
medicalReviewInfo.ReadingUser = taskInfo.DoctorUser.FullName;
|
||||
medicalReviewInfo.SubjectId = taskInfo.SubjectId;
|
||||
medicalReviewInfo.IsClosedDialog = medicalReviewInfo.MedicalReviewInfo.IsClosedDialog;
|
||||
medicalReviewInfo.AuditState = medicalReviewInfo.MedicalReviewInfo.AuditState;
|
||||
|
@ -428,7 +428,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview()
|
||||
{
|
||||
|
||||
LatestReplyUserId = (inDto.IsSendDialog && !medicalReview.IsSendMessage && inDto.IsHaveQuestion) ? _userInfo.Id : null,
|
||||
LatestReplyUserId = (inDto.IsSendDialog && !medicalReview.IsSendMessage && inDto.IsHaveQuestion) ? _userInfo.UserRoleId : null,
|
||||
IsHaveQuestion = inDto.IsHaveQuestion,
|
||||
Questioning = inDto.Questioning,
|
||||
IsSendMessage = inDto.IsSendDialog && inDto.IsHaveQuestion,
|
||||
|
@ -471,7 +471,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview()
|
||||
{
|
||||
LatestReplyUserId = _userInfo.Id,
|
||||
LatestReplyUserId = _userInfo.UserRoleId,
|
||||
IsClosedDialog = inDto.IsClosedDialog,
|
||||
MedicalDialogCloseEnum = inDto.MedicalDialogCloseEnum,
|
||||
DialogCloseReason = inDto.DialogCloseReason,
|
||||
|
@ -510,7 +510,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview()
|
||||
{
|
||||
LatestReplyUserId = _userInfo.Id,
|
||||
LatestReplyUserId = _userInfo.UserRoleId,
|
||||
});
|
||||
|
||||
var visitTaskId = await _taskMedicalReviewRepository.Where(x => x.Id == inDto.TaskMedicalReviewId).Select(x => x.VisitTaskId).FirstOrDefaultAsync();
|
||||
|
@ -566,7 +566,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(x => !x.IsClosedDialog && x.Id == inDto.TaskMedicalReviewId, x => new TaskMedicalReview()
|
||||
{
|
||||
LatestReplyUserId = _userInfo.Id,
|
||||
LatestReplyUserId = _userInfo.UserRoleId,
|
||||
IsClosedDialog = true,
|
||||
MedicalDialogCloseEnum = MedicalDialogClose.IRApplyReReading,
|
||||
|
||||
|
@ -580,7 +580,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview()
|
||||
{
|
||||
LatestReplyUserId = _userInfo.Id,
|
||||
LatestReplyUserId = _userInfo.UserRoleId,
|
||||
DoctorUserIdeaEnum = inDto.DoctorUserIdeaEnum,
|
||||
});
|
||||
ReadingMedicalReviewDialog dialog = new ReadingMedicalReviewDialog()
|
||||
|
@ -617,7 +617,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.OrderBy(x => x.CreateTime).ToListAsync();
|
||||
result.ForEach(x =>
|
||||
{
|
||||
x.IsCurrentUser = x.CreateUserId == _userInfo.Id;
|
||||
x.IsCurrentUser = x.CreateUserId == _userInfo.UserRoleId;
|
||||
});
|
||||
return (result, new
|
||||
{
|
||||
|
@ -710,7 +710,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(inDto.TaskMedicalReviewId, x => new TaskMedicalReview()
|
||||
{
|
||||
LatestReplyUserId = _userInfo.Id,
|
||||
LatestReplyUserId = _userInfo.UserRoleId,
|
||||
DoctorUserIdeaEnum = inDto.DoctorUserIdeaEnum,
|
||||
DisagreeReason = inDto.DisagreeReason,
|
||||
IsApplyHeavyReading = inDto.IsApplyHeavyReading,
|
||||
|
@ -784,7 +784,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<PageOutput<GetIRMedicalFeedbackListOutDto>> GetIRMedicalFeedbackList(GetIRMedicalFeedbackListInDto inDto)
|
||||
{
|
||||
var taskMedicalReviewquery = _taskMedicalReviewRepository.Where(x => x.TrialId == inDto.TrialId).Include(x => x.VisitTask)
|
||||
.Where(x => x.VisitTask.DoctorUserId == _userInfo.Id)
|
||||
.Where(x => x.VisitTask.DoctorUserId == _userInfo.UserRoleId)
|
||||
.Where(x => x.IsHaveQuestion)
|
||||
.WhereIf(!inDto.TaskBlindName.IsNullOrEmpty(), x => x.VisitTask.TaskBlindName == inDto.TaskBlindName)
|
||||
.WhereIf(inDto.SubjectId != null, x => x.VisitTask.SubjectId == inDto.SubjectId!)
|
||||
|
|
|
@ -230,6 +230,10 @@ namespace IRaCIS.Core.Application.Service.RC
|
|||
//await AddSystemQuestionCriterion();
|
||||
var query = _readingQuestionCriterionSystemRepository.AsQueryable()
|
||||
.WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName))
|
||||
.WhereIf(inDto.IsEnable!=null, x => x.IsEnable== inDto.IsEnable)
|
||||
.WhereIf(inDto.IsCompleteConfig != null, x => x.IsCompleteConfig == inDto.IsCompleteConfig)
|
||||
.WhereIf(inDto.CriterionGroup != null, x => x.CriterionGroup == inDto.CriterionGroup)
|
||||
.WhereIf(inDto.CriterionType != null, x => x.CriterionType == inDto.CriterionType)
|
||||
.ProjectTo<ReadingQuestionCriterionSystemView>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await query.ToPagedListAsync(inDto, nameof(ReadingQuestionCriterionSystemView.ShowOrder));
|
||||
|
|
|
@ -48,7 +48,136 @@ namespace IRaCIS.Core.Application.Service
|
|||
// return (await _iReadingImageTaskService.GetReadingQuestion(inDto.TrialReadingCriterionId, null),true);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 设置项目问题导出
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<bool> SetTrialQuestionExportResult(SetTrialQuestionExportResultInDto inDto)
|
||||
{
|
||||
|
||||
var cDISCCodeList = inDto.QuestionList.Where(x => x.CDISCCode.IsNotNullOrEmpty()).Select(x => x.CDISCCode).ToList();
|
||||
|
||||
cDISCCodeList.AddRange(inDto.TableQuestionList.Where(x => x.CDISCCode.IsNotNullOrEmpty()).Select(x => x.CDISCCode).ToList());
|
||||
|
||||
if (cDISCCodeList.Distinct().Count() != cDISCCodeList.Count)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingQuestion_CDISCCodeRepeat"]);
|
||||
}
|
||||
|
||||
if(inDto.QuestionList.Any(x=>x.ExportResult.Contains(ExportResult.CDISC)&&x.CDISCCode.IsNullOrEmpty())
|
||||
|| inDto.TableQuestionList.Any(x => x.ExportResult.Contains(ExportResult.CDISC) && x.CDISCCode.IsNullOrEmpty())
|
||||
)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingQuestion_CDISCCodeCannotEmpty"]);
|
||||
}
|
||||
|
||||
List<ExportResult> needAdd = new List<ExportResult>()
|
||||
{
|
||||
ExportResult.DetailedTableOfAdjudicationResults,
|
||||
ExportResult.DetailedTableOfIntraReaderAnalysisResults,
|
||||
ExportResult.DetailedTableOfInterReaderAnalysisResults
|
||||
};
|
||||
foreach (var item in inDto.QuestionList)
|
||||
{
|
||||
item.ExportResult= item.ExportResult.Except(needAdd).ToList();
|
||||
if (item.ExportResult.Contains(ExportResult.TableOfAssessmentResults))
|
||||
{
|
||||
item.ExportResult.AddRange(needAdd);
|
||||
}
|
||||
var ExportResultStr=JsonConvert.SerializeObject(item.ExportResult);
|
||||
await _readingQuestionTrialRepository.UpdatePartialFromQueryAsync(x => x.Id == item.QuestionId, x => new ReadingQuestionTrial()
|
||||
{
|
||||
ExportResultStr = ExportResultStr,
|
||||
CDISCCode = item.CDISCCode,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
foreach (var item in inDto.TableQuestionList)
|
||||
{
|
||||
item.ExportResult = item.ExportResult.Except(needAdd).ToList();
|
||||
if (item.ExportResult.Contains(ExportResult.TableOfAssessmentResults))
|
||||
{
|
||||
item.ExportResult.AddRange(needAdd);
|
||||
}
|
||||
|
||||
var ExportResultStr = JsonConvert.SerializeObject(item.ExportResult);
|
||||
|
||||
|
||||
await _readingTableQuestionTrialRepository.UpdatePartialFromQueryAsync(x => x.Id == item.TableQuestionId, x => new ReadingTableQuestionTrial()
|
||||
{
|
||||
ExportResultStr = ExportResultStr,
|
||||
CDISCCode = item.CDISCCode,
|
||||
});
|
||||
}
|
||||
|
||||
return await _readingTableQuestionTrialRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目的导出信息
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<GetTrialQuestionExportResultOutDto> GetTrialQuestionExportResult(GetTrialQuestionExportResultInDto inDto)
|
||||
{
|
||||
List<string> notShowType=new List<string>() { ReadingQestionType.Group, ReadingQestionType.Screenshot, ReadingQestionType.Summary, ReadingQestionType.Upload };
|
||||
|
||||
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
var questionList = await _readingQuestionTrialRepository.Where(x => !notShowType.Contains(x.Type) && x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId)
|
||||
.OrderBy(x => x.ShowOrder).Select(x => new TrialQuestionExport()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
QuestionName = _userInfo.IsEn_Us ? x.QuestionEnName : x.QuestionName,
|
||||
ExportResult = x.ExportResult,
|
||||
ShowOrder = x.ShowOrder,
|
||||
IsTableQuestion=false,
|
||||
CDISCCode = x.CDISCCode,
|
||||
}).ToListAsync();
|
||||
|
||||
var questionid = questionList.Select(x => x.QuestionId).ToList();
|
||||
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => questionid.Contains(x.ReadingQuestionId))
|
||||
.Where(x => !notShowType.Contains(x.Type))
|
||||
.OrderBy(x => x.ShowOrder).Select(x => new TrialQuestionExport()
|
||||
{
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
QuestionName = _userInfo.IsEn_Us ? x.QuestionEnName : x.QuestionName,
|
||||
ExportResult = x.ExportResult,
|
||||
ShowOrder = x.ShowOrder,
|
||||
IsTableQuestion=true,
|
||||
CDISCCode = x.CDISCCode,
|
||||
}).ToListAsync();
|
||||
|
||||
questionList.ForEach(x =>
|
||||
{
|
||||
x.Children = tableQuestionList.Where(y => y.QuestionId == x.QuestionId).OrderBy(y => y.ShowOrder).ToList();
|
||||
});
|
||||
|
||||
List<string> dicCode = new List<string>() { "1","2","8" };
|
||||
var dicList = await _dictionaryRepository.Where(x => x.Parent.Code == "ExportResult")
|
||||
.Where(x=> dicCode.Contains(x.Code))
|
||||
.OrderBy(x => x.ShowOrder)
|
||||
.Select(x => new TrialQuestionExportDic()
|
||||
{
|
||||
|
||||
Code = int.Parse(x.Code),
|
||||
Value = _userInfo.IsEn_Us ? x.Value : x.ValueCN,
|
||||
ValueCN = _userInfo.IsEn_Us ? x.Value : x.ValueCN,
|
||||
}).ToListAsync();
|
||||
|
||||
return new GetTrialQuestionExportResultOutDto()
|
||||
{
|
||||
CriterionType = criterionInfo.CriterionType,
|
||||
CriterionGroup = criterionInfo.CriterionGroup,
|
||||
DicList = dicList,
|
||||
QuestionList = questionList
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1027,6 +1156,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
SynchronizeTime = DateTime.Now,
|
||||
IsMustGlobalReading = systemCriterion.IsMustGlobalReading,
|
||||
IseCRFShowInDicomReading = systemCriterion.IseCRFShowInDicomReading,
|
||||
CriterionGroup = systemCriterion.CriterionGroup,
|
||||
IsGlobalReading = systemCriterion.IsMustGlobalReading ? true : trialCriterion.IsGlobalReading,
|
||||
IsReadingPeriod = systemCriterion.IsMustGlobalReading ? true : trialCriterion.IsReadingPeriod,
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@ using IRaCIS.Core.Application.Filter;
|
|||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.Service.ImageAndDoc;
|
||||
using IRaCIS.Core.Application.Service.OAuth;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.Service.ReadingCalculate.Interface;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
|
@ -15,6 +16,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using NPOI.POIFS.Properties;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
|
@ -30,6 +32,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<UserLog> _userLogRepository,
|
||||
IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository,
|
||||
IRepository<ReadingOncologyTaskInfo> _readingOncologyTaskInfoRepository,
|
||||
IVisitTaskHelpeService _visitTaskHelpeService,
|
||||
|
@ -83,6 +86,126 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除单个表格问题标记
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("/DeleteSingleTableQuestionMark/{param}")]
|
||||
public async Task<bool> DeleteSingleTableQuestionMark(DeleteSingleTableQuestionMarkInDto inDto, string param)
|
||||
{
|
||||
var mark = await _readingTaskQuestionMarkRepository.Where(x => x.Id == inDto.Id).FirstNotNullAsync();
|
||||
|
||||
var taskid = mark.VisitTaskId;
|
||||
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.RowId == mark.RowId && x.TableQuestionId == mark.TableQuestionId);
|
||||
await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.Id, x => new ReadingTaskQuestionMark()
|
||||
{
|
||||
InstanceId = null,
|
||||
SeriesId = null,
|
||||
StudyId = null,
|
||||
MarkTool = string.Empty,
|
||||
// PicturePath = string.Empty, 稽查需要显示截图
|
||||
NumberOfFrames = null,
|
||||
MeasureData = string.Empty,
|
||||
OrderMarkName = string.Empty,
|
||||
OtherInstanceId = null,
|
||||
OtherSeriesId = null,
|
||||
OtherStudyId = null,
|
||||
OtherMarkTool = string.Empty,
|
||||
OtherPicturePath = string.Empty,
|
||||
OtherNumberOfFrames = null,
|
||||
OtherMeasureData = string.Empty,
|
||||
});
|
||||
var result = await _readingTaskQuestionMarkRepository.SaveChangesAsync();
|
||||
|
||||
await _readingCalculateService.CalculateTask(new CalculateTaskInDto()
|
||||
{
|
||||
IsChangeOtherTask = false,
|
||||
VisitTaskId = taskid,
|
||||
ComputationTrigger = (ComputationTrigger)int.Parse(param),
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除表格问题标记
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("/DeleteTableQuestionMark/{param}")]
|
||||
public async Task<bool> DeleteTableQuestionMark(DeleteTableQuestionMarkInDto inDto, string param)
|
||||
{
|
||||
await _readingTaskQuestionMarkRepository.UpdatePartialFromQueryAsync(x => x.RowId == inDto.RowId, x => new ReadingTaskQuestionMark()
|
||||
{
|
||||
InstanceId = null,
|
||||
SeriesId = null,
|
||||
StudyId = null,
|
||||
MarkTool = string.Empty,
|
||||
// PicturePath = string.Empty, 稽查需要显示截图
|
||||
NumberOfFrames = null,
|
||||
MeasureData = string.Empty,
|
||||
OrderMarkName = string.Empty,
|
||||
OtherInstanceId = null,
|
||||
OtherSeriesId = null,
|
||||
OtherStudyId = null,
|
||||
OtherMarkTool = string.Empty,
|
||||
OtherPicturePath = string.Empty,
|
||||
OtherNumberOfFrames = null,
|
||||
OtherMeasureData = string.Empty,
|
||||
});
|
||||
return await _readingTaskQuestionMarkRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存表格问题标记
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("/SaveTableQuestionMark/{param}")]
|
||||
public async Task<SaveTableQuestionMarkInDto> SaveTableQuestionMark(SaveTableQuestionMarkInDto inDto, string param)
|
||||
{
|
||||
inDto.FristAddTaskId = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.TableQuestionId == inDto.TableQuestionId && x.RowId == inDto.RowId).Select(x => x.FristAddTaskId).FirstOrDefaultAsync();
|
||||
inDto.FristAddTaskId = inDto.FristAddTaskId == null ? inDto.VisitTaskId : inDto.FristAddTaskId;
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.RowId == inDto.RowId.Value && x.TableQuestionId == inDto.TableQuestionId);
|
||||
await _readingTableQuestionAnswerRepository.AddAsync(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = inDto.Answer,
|
||||
QuestionId = inDto.QuestionId,
|
||||
TableQuestionId = inDto.TableQuestionId,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
TrialId = visitTaskInfo.TrialId,
|
||||
RowIndex = inDto.RowIndex,
|
||||
RowId = inDto.RowId.Value,
|
||||
|
||||
});
|
||||
|
||||
await _readingTaskQuestionMarkRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == inDto.QuestionId && x.RowId == inDto.RowId.Value && x.TableQuestionId == inDto.TableQuestionId);
|
||||
|
||||
var readingTaskQuestionMark = _mapper.Map<ReadingTaskQuestionMark>(inDto);
|
||||
|
||||
await _readingTaskQuestionMarkRepository.AddAsync(readingTaskQuestionMark);
|
||||
await _readingTaskQuestionMarkRepository.SaveChangesAsync();
|
||||
|
||||
await _readingCalculateService.CalculateTask(new CalculateTaskInDto()
|
||||
{
|
||||
IsChangeOtherTask = false,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
ComputationTrigger = (ComputationTrigger)int.Parse(param),
|
||||
});
|
||||
|
||||
return inDto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取既往病灶的OtherPicture
|
||||
/// </summary>
|
||||
|
@ -99,7 +222,6 @@ namespace IRaCIS.Core.Application.Service
|
|||
var taskInfoList = await _generalCalculateService.GetReadingReportTaskList(rowinfo.VisitTaskId);
|
||||
var visitTaskIds = taskInfoList.Where(x => x.VisitTaskId != rowinfo.VisitTaskId).Select(x => x.VisitTaskId).ToList();
|
||||
result = await _readingTableAnswerRowInfoRepository.Where(x => x.QuestionId == rowinfo.QuestionId && x.RowIndex == rowinfo.RowIndex && visitTaskIds.Contains(x.VisitTaskId))
|
||||
|
||||
.OrderBy(x => x.VisitTask.VisitTaskNum).Select(x => new GetPreviousOtherPicturePathOutDto()
|
||||
{
|
||||
VisitTaskId = x.VisitTaskId,
|
||||
|
@ -181,7 +303,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
};
|
||||
|
||||
return await _trialDocumentRepository.Where(x => x.TrialId == inDto.TrialId
|
||||
&& x.TrialDocConfirmedUserList.Any(y => y.ConfirmUserId == _userInfo.Id && y.ConfirmTime != null)
|
||||
&& x.TrialDocConfirmedUserList.Any(y => y.ConfirmUserId == _userInfo.UserRoleId && y.ConfirmTime != null)
|
||||
&& x.NeedConfirmedUserTypeList.Any(y => y.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.WhereIf(userType == UserTypeEnum.IndependentReviewer, t => t.FileType.Code == "2" || t.FileType.Code == "6")
|
||||
.WhereIf(userType == UserTypeEnum.IQC, t => t.FileType.Code == "4" || t.FileType.Code == "5")
|
||||
|
@ -331,7 +453,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task ChangeCalculationAnswer(ChangeCalculationAnswerInDto inDto)
|
||||
{
|
||||
var visitTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
|
||||
|
@ -407,7 +529,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task ReadClinicalData(ReadClinicalDataInDto inDto)
|
||||
{
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask
|
||||
|
@ -784,7 +906,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
var criterionIdInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == trialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
|
||||
var groupIds = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId &&( x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.BasicTable)).Select(x => x.GroupId).Distinct().ToListAsync();
|
||||
var groupIds = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && (x.Type == ReadingQestionType.Table || x.Type == ReadingQestionType.BasicTable)).Select(x => x.GroupId).Distinct().ToListAsync();
|
||||
|
||||
var questionIds = await _readingQuestionTrialRepository
|
||||
.Where(x => x.IsShowInDicom)
|
||||
|
@ -934,7 +1056,12 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ToListAsync();
|
||||
|
||||
|
||||
//var tableQuestionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
||||
|
||||
//result.ForEach(x =>
|
||||
//{
|
||||
// x.TableQuestionMarkList = tableQuestionMarkList.Where(y => y.RowId == x.RowId).ToList();
|
||||
//});
|
||||
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
||||
|
@ -963,6 +1090,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
x.IsFirstChangeTask = x.VisitTaskId == inDto.VisitTaskId;
|
||||
});
|
||||
result.AddRange(questionMark);
|
||||
result = result.OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).ThenBy(x => x.OrderMarkName).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1085,6 +1213,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
var tableQuestionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.TaskId).ProjectTo<TableQuestionMark>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var qusetionList = await _readingQuestionTrialRepository
|
||||
.Where(x => x.IsShowInDicom)
|
||||
.WhereIf(inDto.QuestionClassify != null, x => x.QuestionClassify == inDto.QuestionClassify)
|
||||
|
@ -1260,7 +1389,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
var pageGroupList = newPageQusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
|
||||
pageGroupList.ForEach(x =>
|
||||
{
|
||||
FindChildQuestion(x, newPageQusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, inDto.TaskId);
|
||||
FindChildQuestion(x, newPageQusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, tableQuestionMarkList, inDto.TaskId);
|
||||
});
|
||||
|
||||
page.Childrens = pageGroupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count == 0)).ToList();
|
||||
|
@ -1277,7 +1406,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
groupList = qusetionList.Where(x => x.Type == ReadingQestionType.Group).ToList();
|
||||
groupList.ForEach(x =>
|
||||
{
|
||||
FindChildQuestion(x, qusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, inDto.TaskId);
|
||||
FindChildQuestion(x, qusetionList, tableQuestionList, inDto.TableAnswers, inDto.TableAnsweRowInfos, inDto.OrganInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, tableQuestionMarkList, inDto.TaskId);
|
||||
});
|
||||
|
||||
groupList = groupList.Where(x => !(x.Type == ReadingQestionType.Group && x.Childrens.Count == 0)).ToList();
|
||||
|
@ -1304,7 +1433,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="isFirstChangeTask"></param>
|
||||
/// <param name="lastTaskTableAnswer"></param>
|
||||
/// <param name="TaskId"></param>
|
||||
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer, bool isFirstChangeTask, List<ReadingTableQuestionAnswer> lastTaskTableAnswer, Guid? TaskId)
|
||||
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer, bool isFirstChangeTask, List<ReadingTableQuestionAnswer> lastTaskTableAnswer, List<TableQuestionMark> TableQuestionMarkList, Guid? TaskId)
|
||||
{
|
||||
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (x.GroupId == item.Id && x.ParentId == null)).ToList();
|
||||
item.TableQuestions = new TrialReadTableQuestion();
|
||||
|
@ -1312,7 +1441,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
item.TableQuestions.Questions = tableQuestionLists.Where(x => x.ReadingQuestionId == item.Id).OrderBy(x => x.ShowOrder).ToList();
|
||||
item.TableQuestions.Questions.ForEach(x =>
|
||||
{
|
||||
x.RelationQuestions= _mapper.Map<List<GetTrialReadingQuestionOutDto>>(tableQuestionLists.Where(z => (z.DependParentId ?? default(Guid)) == x.Id));
|
||||
x.RelationQuestions = _mapper.Map<List<GetTrialReadingQuestionOutDto>>(tableQuestionLists.Where(z => (z.DependParentId ?? default(Guid)) == x.Id));
|
||||
x.RelationQuestions.ForEach(y =>
|
||||
{
|
||||
y.Childrens = new List<GetTrialReadingQuestionOutDto>();
|
||||
|
@ -1322,7 +1451,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
y.LesionType = item.LesionType;
|
||||
y.RelationQuestions = new List<GetTrialReadingQuestionOutDto>();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
var thisAnswer = tableAnswers.Where(x => x.QuestionId == item.Id).ToList();
|
||||
|
@ -1428,6 +1557,12 @@ namespace IRaCIS.Core.Application.Service
|
|||
answers.Add("OtherNumberOfFrames", rowInfo == null || rowInfo.OtherNumberOfFrames == null ? string.Empty : rowInfo.OtherNumberOfFrames.ToString());
|
||||
answers.Add("OtherMarkTool", rowInfo == null || rowInfo.OtherMarkTool == null ? string.Empty : rowInfo.OtherMarkTool.ToString());
|
||||
answers.Add("RowIndex", x.ToString());
|
||||
|
||||
JsonSerializerSettings settings = new JsonSerializerSettings
|
||||
{
|
||||
FloatParseHandling = FloatParseHandling.Double,
|
||||
};
|
||||
answers.Add("TableQuestionMarkList", rowInfo == null ? "[]" : JsonConvert.SerializeObject(TableQuestionMarkList.Where(x => x.RowId == rowInfo.Id).ToList(), settings));
|
||||
answers.Add("RowId", rowInfo == null ? string.Empty : rowInfo.Id.ToString());
|
||||
answers.Add("MarkTool", rowInfo.MarkTool);
|
||||
answers.Add("StudyId", rowInfo.StudyId.ToString());
|
||||
|
@ -1459,7 +1594,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
item.Childrens.ForEach(x =>
|
||||
{
|
||||
FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos, organInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, TaskId);
|
||||
FindChildQuestion(x, questionlists, tableQuestionLists, tableAnswers, tableAnsweRowInfos, organInfos, baseLineTableAnswer, isFirstChangeTask, lastTaskTableAnswer, TableQuestionMarkList, TaskId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1476,7 +1611,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task SplitLesion(SplitLesionInDto inDto)
|
||||
{
|
||||
await VerifyTaskIsSign(inDto.VisitTaskId);
|
||||
|
@ -1714,7 +1849,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> SaveImageQuality(ChangeDicomReadingQuestionAnswerInDto inDto)
|
||||
{
|
||||
inDto.UpdateMark = true;
|
||||
|
@ -1773,7 +1908,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> ChangeDicomReadingQuestionAnswer(ChangeDicomReadingQuestionAnswerInDto inDto)
|
||||
{
|
||||
await VerifyTaskIsSign(inDto.VisitTaskId);
|
||||
|
@ -1833,7 +1968,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
var questionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).Select(x => new
|
||||
{
|
||||
x.QuestionId,
|
||||
x.FirstAddTaskId,
|
||||
x.FristAddTaskId,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
|
@ -1869,7 +2004,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
x.Id = NewId.NextGuid();
|
||||
x.VisitTaskId = inDto.VisitTaskId;
|
||||
x.CreateTime = datetime;
|
||||
x.FirstAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FirstAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId;
|
||||
x.FristAddTaskId = questionMarkList.Where(y => y.QuestionId == x.QuestionId).Select(x => x.FristAddTaskId).FirstOrDefault() ?? inDto.VisitTaskId;
|
||||
});
|
||||
await _readingTaskQuestionMarkRepository.AddRangeAsync(markList);
|
||||
}
|
||||
|
@ -1890,7 +2025,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> DeleteReadingRowAnswer(DeleteReadingRowAnswerInDto inDto)
|
||||
{
|
||||
await VerifyTaskIsSign(inDto.VisitTaskId);
|
||||
|
@ -2071,13 +2206,29 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提交表格行信息
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("/SubmitTaskRowInfo/{param}")]
|
||||
public async Task<SubmitTableQuestionOutDto> SubmitTaskRowInfo(SubmitTableQuestionInDto inDto, string param)
|
||||
{
|
||||
inDto.ComputationTrigger = (ComputationTrigger)int.Parse(param);
|
||||
|
||||
return await SubmitTableQuestion(inDto);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提交表格问题答案 提交病灶 保存病灶
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<SubmitTableQuestionOutDto> SubmitTableQuestion(SubmitTableQuestionInDto inDto)
|
||||
{
|
||||
SubmitTableQuestionOutDto result = new SubmitTableQuestionOutDto();
|
||||
|
@ -2264,7 +2415,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
&& x.QuestionId == inDto.QuestionId
|
||||
).CountAsync()) + 1))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_MaxQuestion", _userInfo.IsEn_Us? questionInfo.QuestionEnName:questionInfo.QuestionName, questionInfo.MaxQuestionCount]);
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_MaxQuestion", _userInfo.IsEn_Us ? questionInfo.QuestionEnName : questionInfo.QuestionName, questionInfo.MaxQuestionCount]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2476,7 +2627,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task<IResponseOutput> SubmitDicomVisitTask(SubmitDicomVisitTaskInDto inDto)
|
||||
{
|
||||
|
||||
|
@ -2561,7 +2712,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
var criterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskInfo.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
var readingQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId&&x.Type != "group")
|
||||
var readingQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskInfo.TrialReadingCriterionId && x.Type != "group")
|
||||
.WhereIf(taskInfo.SourceSubjectVisit.IsBaseLine, x => ((x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show) && (x.LimitEdit == LimitEdit.None || x.LimitEdit == LimitEdit.OnlyBaseLine)))
|
||||
.WhereIf(!taskInfo.SourceSubjectVisit.IsBaseLine, x => ((x.IsRequired == IsRequired.Required && x.ShowQuestion == ShowQuestion.Show) && (x.LimitEdit == LimitEdit.None || x.LimitEdit == LimitEdit.OnlyVisit)))
|
||||
.WhereIf(taskInfo.TrialReadingCriterion.CriterionType == CriterionType.PCWG3, x => x.QuestionType != QuestionType.SiteVisitForTumorEvaluation)
|
||||
|
@ -2676,7 +2827,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<bool> ClearSkipReadingCache()
|
||||
{
|
||||
|
||||
await _fusionCache.RemoveAsync(CacheKeys.SkipReadingCacheKey(_userInfo.Id));
|
||||
await _fusionCache.RemoveAsync(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2689,18 +2840,18 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpPost]
|
||||
public async Task<bool> SetSkipReadingCache(SetSkipReadingCacheInDto inDto)
|
||||
{
|
||||
var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.Id));
|
||||
var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId));
|
||||
if (clearSkipReadingCache == null || clearSkipReadingCache == string.Empty)
|
||||
{
|
||||
List<Guid> cacheIds = new List<Guid>();
|
||||
cacheIds.Add(inDto.VisitTaskId);
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.Id), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24));
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24));
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Guid>? cacheIds = JsonConvert.DeserializeObject<List<Guid>>(clearSkipReadingCache);
|
||||
cacheIds.Add(inDto.VisitTaskId);
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.Id), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24));
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId), JsonConvert.SerializeObject(cacheIds), TimeSpan.FromHours(24));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2731,7 +2882,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
#region 跳过阅片
|
||||
var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.Id));
|
||||
var clearSkipReadingCache = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.SkipReadingCacheKey(_userInfo.UserRoleId));
|
||||
|
||||
|
||||
List<Guid> cacheSkipIds = new List<Guid>();
|
||||
|
@ -2839,7 +2990,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
List<Guid> remainingItems = taskList.Select(x => x.Id).Except(cacheSkipIds).ToList();
|
||||
|
||||
//受试者随机固定排序
|
||||
taskList = taskList.Where(x => remainingItems.Contains(x.Id)).OrderBy(t=>t.TaskBlindName).ToList();
|
||||
taskList = taskList.Where(x => remainingItems.Contains(x.Id)).OrderBy(t => t.TaskBlindName).ToList();
|
||||
|
||||
// 当前受试者没有就找其他受试者
|
||||
if (taskList.Count() == 0)
|
||||
|
@ -2896,10 +3047,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
else
|
||||
{
|
||||
var query = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.Id
|
||||
var query = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.UserRoleId
|
||||
&& x.TrialReadingCriterionId == trialReadingCriterionId
|
||||
&& x.TaskState == TaskState.Effect)
|
||||
.Where(x=> !cacheSkipIds.Contains(x.Id));
|
||||
.Where(x => !cacheSkipIds.Contains(x.Id));
|
||||
var count = await query.CountAsync();
|
||||
if (count == 0)
|
||||
{
|
||||
|
@ -3071,17 +3222,17 @@ namespace IRaCIS.Core.Application.Service
|
|||
{
|
||||
return true;
|
||||
}
|
||||
var startReadingTimeKey = _userInfo.Id.ToString() + "StartReadingTime";
|
||||
var startRestTimeKey = _userInfo.Id.ToString() + "StartRestTime";
|
||||
var startReadingTimeKey = _userInfo.UserRoleId.ToString() + "StartReadingTime";
|
||||
var startRestTimeKey = _userInfo.UserRoleId.ToString() + "StartRestTime";
|
||||
|
||||
int readingMinute = _verifyConfig.CurrentValue.ContinuousReadingTimeMin; // 为60整数
|
||||
int restMinute = _verifyConfig.CurrentValue.ReadingRestTimeMin; //
|
||||
var startReadingTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.StartReadingTimeKey(_userInfo.Id));
|
||||
var startRestTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.StartRestTime(_userInfo.Id));
|
||||
var startReadingTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId));
|
||||
var startRestTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.StartRestTime(_userInfo.UserRoleId));
|
||||
|
||||
if (startReadingTime == null && startRestTime == null)
|
||||
{
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.StartReadingTimeKey(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48));
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48));
|
||||
}
|
||||
else if (startRestTime != null)
|
||||
{
|
||||
|
@ -3094,8 +3245,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
else
|
||||
{
|
||||
// 休息时间>10分钟 删除休息时间的缓存 记录开始阅片时间
|
||||
await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.Id));
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.StartReadingTimeKey(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48));
|
||||
await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.UserRoleId));
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3107,8 +3258,8 @@ namespace IRaCIS.Core.Application.Service
|
|||
int timespanMin = (DateTime.Now - cacheDate).Minutes;
|
||||
if (timespanMin > readingMinute)
|
||||
{
|
||||
await _fusionCache.RemoveAsync(CacheKeys.StartReadingTimeKey(_userInfo.Id));
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.StartRestTime(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48));
|
||||
await _fusionCache.RemoveAsync(CacheKeys.StartReadingTimeKey(_userInfo.UserRoleId));
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.StartRestTime(_userInfo.UserRoleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48));
|
||||
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_NeedRest", readingMinute / 60m, restMinute]);
|
||||
}
|
||||
|
@ -3124,31 +3275,36 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<bool> ResetReadingRestTime(Guid? userID)
|
||||
public async Task<bool> ResetReadingRestTime(Guid? userRoleId)
|
||||
{
|
||||
if (userID == null)
|
||||
{
|
||||
userID = _userInfo.Id;
|
||||
}
|
||||
var roleId = (userRoleId != null && userRoleId != Guid.Empty) ? (Guid) userRoleId : _userInfo.UserRoleId;
|
||||
|
||||
//int readingMinute = 120; // 为60整数
|
||||
int restMinute = 10; //
|
||||
|
||||
var startReadingTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.StartReadingTimeKey(_userInfo.Id));
|
||||
var startRestTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.StartRestTime(_userInfo.Id));
|
||||
var startReadingTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.StartReadingTimeKey(roleId));
|
||||
var startRestTime = await _fusionCache.GetOrDefaultAsync<string>(CacheKeys.StartRestTime(roleId));
|
||||
if (startRestTime != null)
|
||||
{
|
||||
var cacheStartRestTime = DateTime.Parse(startRestTime!.ToString());
|
||||
int timespanMin = (DateTime.Now - cacheStartRestTime).Minutes;
|
||||
if (timespanMin > restMinute)
|
||||
{
|
||||
await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(_userInfo.Id));
|
||||
await _fusionCache.RemoveAsync(CacheKeys.StartRestTime(roleId));
|
||||
}
|
||||
}
|
||||
else if (startReadingTime != null)
|
||||
{
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.StartReadingTimeKey(_userInfo.Id), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48));
|
||||
await _fusionCache.SetAsync<string>(CacheKeys.StartReadingTimeKey(roleId), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromHours(48));
|
||||
}
|
||||
|
||||
//前端屏幕解锁才调用
|
||||
if (userRoleId == null)
|
||||
{
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.WebUnlock }, true);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3376,7 +3532,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
|
||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||
public async Task AddReadingTask(Guid visitTaskId, Guid? trialId = null)
|
||||
{
|
||||
// ****** 先生成阅片期 阅片期任务阅片完成之后生成肿瘤学的 如果没有阅片期 直接生成肿瘤学 *********////
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
[ApiExplorerSettings(GroupName = "Reading")]
|
||||
public class ReadModuleService(IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
IRepository<Subject> _subjectRepository,
|
||||
IRepository<User> _userRepository,
|
||||
IRepository<UserRole> _userRoleRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IVisitTaskHelpeService _visitTaskHelpeService,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
|
@ -860,7 +860,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
};
|
||||
|
||||
readModule.StakeholderIds = stakeholderIds.Distinct().ToList();
|
||||
readModule.StakeholderNames = await _userRepository.Where(x => readModule.StakeholderIds.Contains(x.Id)).Select(x => x.FirstName + "/" + x.LastName).ToListAsync();
|
||||
readModule.StakeholderNames = await _userRoleRepository.Where(x => readModule.StakeholderIds.Contains(x.Id)).Select(x => x.IdentityUser.FullName).ToListAsync();
|
||||
|
||||
return readModule;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<List<DefaultShortcutKeyView>> GetDoctorShortcutKey(DefaultShortcutKeyQuery inQuery)
|
||||
{
|
||||
var shortcutKeyList = await _shortcutKeyRepository.Where(x => x.ImageToolType == inQuery.ImageToolType)
|
||||
.Where(x => x.UserId == _userInfo.Id)
|
||||
.Where(x => x.UserId == _userInfo.UserRoleId)
|
||||
.ToListAsync();
|
||||
|
||||
var defaultshortcutKeyList = this.GetDefaultShortcutKey();
|
||||
|
@ -302,17 +302,17 @@ namespace IRaCIS.Core.Application.Service
|
|||
var shortcutKeys = GetDefaultShortcutKey();
|
||||
shortcutKeys.ForEach(x =>
|
||||
{
|
||||
x.UserId = _userInfo.Id;
|
||||
x.UserId = _userInfo.UserRoleId;
|
||||
});
|
||||
|
||||
await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.Id);
|
||||
await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.UserRoleId);
|
||||
|
||||
await _shortcutKeyRepository.AddRangeAsync(shortcutKeys.Select(x => new ShortcutKey()
|
||||
{
|
||||
ImageToolType = inDto.ImageToolType,
|
||||
Keyboardkey = x.Keyboardkey,
|
||||
ShortcutKeyEnum = x.ShortcutKeyEnum,
|
||||
UserId = _userInfo.Id,
|
||||
UserId = _userInfo.UserRoleId,
|
||||
AltKey = x.AltKey,
|
||||
CtrlKey = x.CtrlKey,
|
||||
MetaKey = x.MetaKey,
|
||||
|
@ -332,14 +332,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpPost]
|
||||
public async Task<bool> SetShortcutKey(SetDefaultShortcutKey inDto)
|
||||
{
|
||||
await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.Id);
|
||||
await _shortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType && x.UserId == _userInfo.UserRoleId);
|
||||
|
||||
await _shortcutKeyRepository.AddRangeAsync(inDto.ShortcutKeyList.Select(x => new ShortcutKey()
|
||||
{
|
||||
ImageToolType = inDto.ImageToolType,
|
||||
Keyboardkey = x.Keyboardkey,
|
||||
ShortcutKeyEnum = x.ShortcutKeyEnum,
|
||||
UserId = _userInfo.Id,
|
||||
UserId = _userInfo.UserRoleId,
|
||||
AltKey = x.AltKey,
|
||||
CtrlKey = x.CtrlKey,
|
||||
MetaKey = x.MetaKey,
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Reading")]
|
||||
public class UserWLTemplateService(IRepository<UserWLTemplate> _userWLTemplateRepository,
|
||||
IRepository<User> _userRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService
|
||||
IRepository<UserRole> _userRoleRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService
|
||||
{
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<List<UserWLTemplateView>> GetUserWLTemplateList(UserWLTemplateQuery inQuery)
|
||||
{
|
||||
var userWLTemplateQueryable = _userWLTemplateRepository
|
||||
.Where(x => x.UserId == _userInfo.Id)
|
||||
.Where(x => x.UserId == _userInfo.UserRoleId)
|
||||
.ProjectTo<UserWLTemplateView>(_mapper.ConfigurationProvider);
|
||||
return await userWLTemplateQueryable.ToListAsync();
|
||||
}
|
||||
|
@ -40,10 +40,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> AddOrUpdateUserWLTemplate(UserWLTemplateAddOrEdit addOrEditUserWLTemplate)
|
||||
{
|
||||
addOrEditUserWLTemplate.UserId = _userInfo.Id;
|
||||
addOrEditUserWLTemplate.UserId = _userInfo.UserRoleId;
|
||||
if (addOrEditUserWLTemplate.Id == null)
|
||||
{
|
||||
var count = await _userWLTemplateRepository.Where(x => x.UserId == _userInfo.Id).CountAsync();
|
||||
var count = await _userWLTemplateRepository.Where(x => x.UserId == _userInfo.UserRoleId).CountAsync();
|
||||
if (count >= 10)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["UserWLTS_MaxTemplate"]);
|
||||
|
@ -51,12 +51,12 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
}
|
||||
|
||||
if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.Id && x.TemplateName == addOrEditUserWLTemplate.TemplateName && x.Id != addOrEditUserWLTemplate.Id))
|
||||
if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.UserRoleId && x.TemplateName == addOrEditUserWLTemplate.TemplateName && x.Id != addOrEditUserWLTemplate.Id))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["UserWLTS_NameRepeated"]);
|
||||
}
|
||||
|
||||
if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.Id && x.WW == addOrEditUserWLTemplate.WW && x.WL == addOrEditUserWLTemplate.WL && x.Id != addOrEditUserWLTemplate.Id))
|
||||
if (await _userWLTemplateRepository.AnyAsync(x => x.UserId == _userInfo.UserRoleId && x.WW == addOrEditUserWLTemplate.WW && x.WL == addOrEditUserWLTemplate.WL && x.Id != addOrEditUserWLTemplate.Id))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["UserWLTS_ContentRepeated"]);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
public async Task<object> GetAutoCutNextTask()
|
||||
{
|
||||
|
||||
return await _userRepository.Where(x => x.Id == _userInfo.Id).Select(x => new
|
||||
return await _userRoleRepository.Where(x => x.Id == _userInfo.UserRoleId).Select(x => new
|
||||
{
|
||||
AutoCutNextTask = x.AutoCutNextTask
|
||||
}).FirstNotNullAsync();
|
||||
|
@ -100,13 +100,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
[HttpPost]
|
||||
public async Task<IResponseOutput> SetAutoCutNextTask(SetAutoCutNextTaskInDto inDto)
|
||||
{
|
||||
await _userRepository.UpdatePartialFromQueryAsync(_userInfo.Id, x => new User()
|
||||
await _userRoleRepository.UpdatePartialFromQueryAsync(_userInfo.UserRoleId, x => new UserRole()
|
||||
{
|
||||
|
||||
AutoCutNextTask = inDto.AutoCutNextTask
|
||||
});
|
||||
|
||||
await _userRepository.SaveChangesAsync();
|
||||
await _userRoleRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
|
|
@ -38,21 +38,21 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<TrialClinicalTableQuestionDto, TrialClinicalTableQuestion>();
|
||||
|
||||
CreateMap<SystemClinicalQuestion, TrialClinicalQuestion>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.SystemClinicalQuestionId, opt => opt.MapFrom(src => src.Id));
|
||||
|
||||
CreateMap<SystemClinicalQuestion, TrialClinicalQuestionSynchronize>()
|
||||
.ForMember(d => d.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(d => d.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.SystemClinicalQuestionId, opt => opt.MapFrom(src => src.Id));
|
||||
|
||||
|
||||
CreateMap<SystemClinicalTableQuestion, TrialClinicalTableQuestion>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.SystemTableQuestionId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<SystemClinicalTableQuestion, TrialClinicalTableQuestionSynchronize>()
|
||||
.ForMember(d => d.SystemTableQuestionId, opt => opt.MapFrom(src => src.Id))
|
||||
.ForMember(d => d.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(d => d.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
|
||||
// 预览
|
||||
|
@ -64,25 +64,28 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<SystemClinicalTableQuestion, ClinicalTablePreviewDto>();
|
||||
CreateMap<TrialClinicalTableQuestion, ClinicalTablePreviewDto>();
|
||||
#endregion
|
||||
|
||||
CreateMap<TableMarkInfo, ReadingTaskQuestionMark>();
|
||||
CreateMap<ReadingTaskQuestionMark, TableMarkInfo>();
|
||||
CreateMap<VisitTask, VisitTaskDto>();
|
||||
CreateMap<SaveTableQuestionMarkInDto, ReadingTaskQuestionMark>();
|
||||
CreateMap<ReadingTaskQuestionMark, TableQuestionMark>();
|
||||
CreateMap<SubmitTableQuestionInDto, ReadingTableAnswerRowInfo>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForAllMembers(opts => opts.Condition((src, dest, srcMember) => srcMember != null));
|
||||
|
||||
CreateMap<ShortcutKey, DefaultShortcutKeyView>();
|
||||
CreateMap<TrialDataFromSystem, ReadingMedicineTrialQuestion>().ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
CreateMap<TrialDataFromSystem, ReadingMedicineTrialQuestion>().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<ReadingCustomTag, ReadingCustomTagDto>();
|
||||
CreateMap<ReadingCustomTagDto, ReadingCustomTag>().ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
CreateMap<ReadingCustomTagDto, ReadingCustomTag>().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<UserWLTemplate, UserWLTemplateView>();
|
||||
CreateMap<UserWLTemplate, UserWLTemplateAddOrEdit>().ReverseMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
CreateMap<UserWLTemplate, UserWLTemplateAddOrEdit>().ReverseMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<ReadingPeriodSetAddOrEdit, ReadingPeriodSet>().ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
CreateMap<ReadingPeriodSetAddOrEdit, ReadingPeriodSet>().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
CreateMap<ReadingTableQuestionAnswer, TableQuestionAnswerInfo>().ReverseMap()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<ReadingTableQuestionAnswer, TableQuestionAnswerInfo>()
|
||||
|
||||
|
@ -115,7 +118,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.ValueCN, u => u.MapFrom(s => s.Dictionary.ValueCN));
|
||||
|
||||
CreateMap<ReadingTaskQuestionMark, GetTableAnswerRowInfoOutDto>()
|
||||
.ForMember(d => d.FristAddTaskId, u => u.MapFrom(s => s.FirstAddTaskId!.Value));
|
||||
.ForMember(d => d.FristAddTaskId, u => u.MapFrom(s => s.FristAddTaskId!.Value));
|
||||
CreateMap<ReadingTaskQuestionMark, QuestionMarkInfo>();
|
||||
CreateMap<QuestionMarkInfo, ReadingTaskQuestionMark>();
|
||||
//CreateMap<ReadingClinicalDataView, GetReadingClinicalDataListOutDto>();
|
||||
|
@ -149,16 +152,16 @@ namespace IRaCIS.Core.Application.Service
|
|||
//.ForMember(t=>t.SystemCriterionNameList,u=>u.MapFrom(c=>c.SystemClinicalDataCriterionList.Select(t=>t.SystemReadingCriterion.CriterionName)))
|
||||
//.ForMember(t => t.SystemCriterionIdList, u => u.MapFrom(c => c.SystemClinicalDataCriterionList.Select(t => t.SystemReadingCriterion.Id)));
|
||||
|
||||
CreateMap<PreviousPDF, PreviousPDFAddOrEdit>().ReverseMap().ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
CreateMap<PreviousPDF, PreviousPDFAddOrEdit>().ReverseMap().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<PreviousPDF, PreviousPDFView>();
|
||||
|
||||
CreateMap<ReadModuleAddOrEdit, ReadModule>().ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
CreateMap<ReadModuleAddOrEdit, ReadModule>().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<TumorAssessment_RECIST1Point1, TumorAssessmentView>();
|
||||
|
||||
|
||||
CreateMap<CopyTableAnswerRowInfo, ReadingTableAnswerRowInfo>().ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
CreateMap<CopyTableAnswerRowInfo, ReadingTableAnswerRowInfo>().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<ReadingTableAnswerRowInfo, CopyTableAnswerRowInfo>()
|
||||
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
|
||||
|
@ -174,7 +177,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.QuestionName, u => u.MapFrom(s => isEn_Us ? s.QuestionEnName : s.QuestionName))
|
||||
.ForMember(d => d.GroupName, u => u.MapFrom(s => isEn_Us ? s.GroupEnName : s.GroupName))
|
||||
.ForMember(dest => dest.ReadingCriterionPage, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.ParentReadingQuestionTrial, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.RelevanceReadingQuestionTrial, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.ReadingQuestionCriterionTrial, opt => opt.Ignore());
|
||||
|
@ -192,20 +195,20 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
CreateMap<ReadingTableQuestionTrial, TableQuestionTrial>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.QuestionName, u => u.MapFrom(s => isEn_Us ? s.QuestionEnName : s.QuestionName));
|
||||
CreateMap<ReadingTableQuestionAnswer, ReadingTableQuestionAnswerInfo>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.ShowOrder, u => u.MapFrom(s => s.ReadingQuestionTrial.ShowOrder))
|
||||
.ForMember(d => d.QuestionMark, u => u.MapFrom(s => s.ReadingTableQuestionTrial.QuestionMark));
|
||||
|
||||
CreateMap<ReadingQuestionTrial, TrialReadQuestionData>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.QuestionName, u => u.MapFrom(s => isEn_Us ? s.QuestionEnName : s.QuestionName))
|
||||
.ForMember(d => d.GroupName, u => u.MapFrom(s => isEn_Us ? s.GroupEnName : s.GroupName))
|
||||
.ForMember(d => d.PageShowOrder, u => u.MapFrom(s => s.ReadingCriterionPage.ShowOrder))
|
||||
.ForMember(d => d.PageName, u => u.MapFrom(s => s.ReadingCriterionPage.PageName))
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.IsPublicPage, u => u.MapFrom(s => s.ReadingCriterionPage.IsPublicPage));
|
||||
|
||||
CreateMap<ReadingQuestionSystem, GetSystemReadingQuestionOutDto>()
|
||||
|
@ -218,13 +221,13 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.QuestionName, u => u.MapFrom(s => isEn_Us ? s.QuestionEnName : s.QuestionName));
|
||||
|
||||
CreateMap<ReadingTableQuestionSystem, ReadingTableQuestionSystemView>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder));
|
||||
|
||||
|
||||
|
||||
CreateMap<ReadingTableQuestionTrial, ReadingTableQuestionSystemView>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder));
|
||||
|
||||
CreateMap<ReadingQuestionTrial, GetCalculateQuestionsOutDto>();
|
||||
|
@ -243,66 +246,66 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
CreateMap<ReadingTableQuestionTrial, ReadingTableQuestionTrialView>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder))
|
||||
.ForMember(d => d.CreateUser, u => u.Ignore());
|
||||
CreateMap<ReadingTableQuestionSystemAddOrEdit, ReadingTableQuestionSystem>().ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(d => d.CreateUserRole, u => u.Ignore());
|
||||
CreateMap<ReadingTableQuestionSystemAddOrEdit, ReadingTableQuestionSystem>().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<ReadingTableQuestionTrialAddOrEdit, ReadingTableQuestionTrial>().ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
CreateMap<ReadingTableQuestionTrialAddOrEdit, ReadingTableQuestionTrial>().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
|
||||
CreateMap<ReadingCriterionPageAddOrEdit, ReadingCriterionPage>().ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
CreateMap<ReadingCriterionPageAddOrEdit, ReadingCriterionPage>().ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<ReadingQuestionTrial, ReadingQuestionSystem>()
|
||||
.ForMember(d => d.CreateUser, u => u.Ignore());
|
||||
.ForMember(d => d.CreateUserRole, u => u.Ignore());
|
||||
|
||||
CreateMap<Dictionary, OrganDictionary>()
|
||||
;
|
||||
|
||||
CreateMap<ReadingQuestionSystem, ReadingQuestionSystemData>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ReadingTableQuestionSystem, ReadingTableQuestionSystemData>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ReadingQuestionSystem, ReadingQuestionTrial>()
|
||||
.ForMember(d => d.CreateUser, u => u.Ignore())
|
||||
.ForMember(d => d.CreateUserRole, u => u.Ignore())
|
||||
.ForMember(d => d.ReadingTableQuestionTrialList, u => u.Ignore())
|
||||
.ForMember(d => d.ReadingQuestionSystemId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ReadingTableAnswerRowInfo, TableAnsweRowInfo>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.MergeName, u => u.MapFrom(s => s.MergeRow == null ? string.Empty : s.MergeRow.ReadingQuestionTrial.OrderMark + s.MergeRow.RowIndex.GetLesionMark()))
|
||||
.ForMember(d => d.SplitName, u => u.MapFrom(s => s.SplitRow == null ? string.Empty : s.SplitRow.ReadingQuestionTrial.OrderMark + s.SplitRow.RowIndex.GetLesionMark()))
|
||||
.ForMember(d => d.LesionType, u => u.MapFrom(s => s.ReadingQuestionTrial == null ? null : s.ReadingQuestionTrial.LesionType));
|
||||
|
||||
|
||||
CreateMap<ReadingTableQuestionSystem, ReadingTrialTableQuestionData>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.DependParentQuestion, opt => opt.Ignore())
|
||||
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id))
|
||||
.ForMember(d => d.SystemTableQuestionId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ReadingTableQuestionTrial, ReadingTrialTableQuestionData>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
CreateMap<ReadingTrialTableQuestionData, ReadingTableQuestionTrial>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
;
|
||||
|
||||
|
||||
CreateMap<ReadingQuestionCriterionSystem, ReadingQuestionCriterionTrial>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.ReadingQuestionTrialList, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore())
|
||||
.ForMember(d => d.ReadingQuestionCriterionSystemId, u => u.MapFrom(s => s.Id));
|
||||
|
||||
|
||||
CreateMap<AddOrUpdateReadingQuestionCriterionSystemInDto, ReadingQuestionCriterionSystem>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
CreateMap<ReadingQuestionCriterionSystem, ReadingQuestionCriterionSystemView>()
|
||||
|
||||
.ForMember(d => d.QuestionCount, u => u.MapFrom(s => s.ReadingQuestionSystemList.Count()));
|
||||
|
@ -312,7 +315,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<ReadingQuestionSystem, AddOrUpdateReadingQuestionSystemInDto>();
|
||||
|
||||
CreateMap<AddOrUpdateReadingQuestionSystemInDto, ReadingQuestionSystem>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
CreateMap<ReadingQuestionSystem, ReadingQuestionSystemView>()
|
||||
|
||||
.ForMember(d => d.GroupName, u => u.MapFrom(s => s.GroupInfo == null ? s.GroupName : s.GroupInfo.GroupName))
|
||||
|
@ -326,14 +329,14 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
|
||||
CreateMap<AddOrUpdateReadingQuestionCriterionTrialInDto, ReadingQuestionCriterionTrial>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
CreateMap<ReadingQuestionCriterionTrial, ReadingQuestionCriterionTrialView>()
|
||||
|
||||
.ForMember(d => d.QuestionCount, u => u.MapFrom(s => s.ReadingQuestionTrialList.Count()));
|
||||
|
||||
|
||||
CreateMap<AddOrUpdateReadingQuestionTrialInDto, ReadingQuestionTrial>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
CreateMap<ReadingQuestionTrial, ReadingQuestionTrialView>()
|
||||
|
||||
.ForMember(d => d.GroupName, u => u.MapFrom(s => s.GroupInfo == null ? s.GroupName : s.GroupInfo.GroupName))
|
||||
|
@ -363,17 +366,17 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
#region 医学审核
|
||||
CreateMap<ReadingMedicineSystemQuestionAddOrEdit, ReadingMedicineSystemQuestion>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
CreateMap<ReadingMedicineSystemQuestion, ReadingMedicineSystemQuestionView>()
|
||||
|
||||
.ForMember(x => x.ParentShowOrder, y => y.MapFrom(n => n.ParentQuestion.ShowOrder));
|
||||
|
||||
|
||||
CreateMap<TrialDataFromSystem, ReadingMedicineTrialQuestion>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<ReadingMedicineTrialQuestionAddOrEdit, ReadingMedicineTrialQuestion>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
CreateMap<ReadingMedicineTrialQuestion, ReadingMedicineTrialQuestionView>()
|
||||
|
||||
.ForMember(x => x.ParentShowOrder, y => y.MapFrom(n => n.ParentQuestion.ShowOrder));
|
||||
|
@ -386,7 +389,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<ReadingMedicalReviewDialog, GetMedicalReviewDialogOutDto>()
|
||||
//.ForMember(x => x.FileList, y => y.MapFrom(n => n.FileList))
|
||||
.ForMember(x => x.CreateUserName, y => y.MapFrom(n => n.CreateUser.UserName));
|
||||
.ForMember(x => x.CreateUserName, y => y.MapFrom(n => n.CreateUserRole.IdentityUser.UserName));
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -395,10 +398,10 @@ namespace IRaCIS.Core.Application.Service
|
|||
CreateMap<CriterionNidusTrial, CriterionNidusView>();
|
||||
CreateMap<CriterionNidusSystem, CriterionNidusView>();
|
||||
CreateMap<CriterionNidusSystem, CriterionNidusAddOrEdit>().ReverseMap()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<OrganInfoAddOrEdit, OrganInfo>()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
CreateMap<OrganInfo, OrganInfoView>();
|
||||
#endregion
|
||||
|
||||
|
@ -411,15 +414,15 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
CreateMap<SubjectCriteriaEvaluationAddOrEdit, SubjectCriteriaEvaluation>().ReverseMap();
|
||||
CreateMap<SubjectCriteriaEvaluation, SubjectCriteriaEvaluationView>().ReverseMap()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
CreateMap<SubjectCriteriaEvaluationVisitFilter, SubjectCriteriaEvaluationVisitFilterAddOrEdit>().ReverseMap()
|
||||
.ForMember(dest => dest.CreateUser, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.CreateUserRole, opt => opt.Ignore());
|
||||
|
||||
CreateMap<SubjectCriteriaEvaluationVisitStudyFilterAddOrEdit, SubjectCriteriaEvaluationVisitStudyFilter>().ReverseMap();
|
||||
|
||||
CreateMap<DicomStudy, SelectStudyView>()
|
||||
.ForMember(o => o.UploadedTime, t => t.MapFrom(u => u.CreateTime))
|
||||
.ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUser.LastName + " / " + u.CreateUser.FirstName))
|
||||
.ForMember(o => o.Uploader, t => t.MapFrom(u => u.CreateUserRole.IdentityUser.FullName))
|
||||
.ForMember(o => o.StudyId, t => t.MapFrom(u => u.Id));
|
||||
|
||||
CreateMap<VisitTask, HaveGeneratedTaskDto>()
|
||||
|
|
|
@ -106,6 +106,30 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
}
|
||||
|
||||
public class TableMarkInfo
|
||||
{
|
||||
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public Guid? FristAddTaskId { get; set; }
|
||||
|
||||
public QuestionType? QuestionType { get; set; }
|
||||
public string OrderMarkName { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 表格问题标记
|
||||
/// </summary>
|
||||
public Guid? RowId { get; set; }
|
||||
|
||||
public Guid? TableQuestionId { get; set; }
|
||||
|
||||
public decimal? RowIndex { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class AddTaskLesionAnswerFromLastTaskOutDto
|
||||
{
|
||||
public bool IsBaseLine { get; set; }
|
||||
|
|
|
@ -141,7 +141,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
builder.AppendLine($"【标准Id】:【{criterionInfo.Id}】");
|
||||
builder.AppendLine($"【受试者】:【{taskInfo.Subject.ShortName}】");
|
||||
builder.AppendLine($"【受试者Id】:【{taskInfo.Subject.Id}】");
|
||||
builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FirstName}】");
|
||||
builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FullName}】");
|
||||
builder.AppendLine($"【阅片人Id】:【{taskInfo.DoctorUser.Id}】");
|
||||
builder.AppendLine($"【任务】:【{taskInfo.TaskBlindName}】");
|
||||
builder.AppendLine($"【任务Id】:【{taskInfo.Id}】");
|
||||
|
@ -224,6 +224,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
item.TableRowInfoList = thisItemRowInfo.Select(x => new TableRowInfo()
|
||||
{
|
||||
RowId = x.Id,
|
||||
RowIndex = x.RowIndex,
|
||||
MeasureData = x.MeasureData,
|
||||
OtherMeasureData = x.OtherMeasureData,
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
{CriterionType.Lugano2014,typeof(LuganoCalculateService) },
|
||||
{CriterionType.IVUS,typeof(IVUSCalculateService) },
|
||||
{CriterionType.OCT,typeof(OCTCalculateService) },
|
||||
{CriterionType.MRIPDFF,typeof(MRIPDFFCalculateService) },
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2707,7 +2707,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
builder.AppendLine($"【标准Id】:【{criterionInfo.Id}】");
|
||||
builder.AppendLine($"【受试者】:【{taskInfo.Subject.ShortName}】");
|
||||
builder.AppendLine($"【受试者Id】:【{taskInfo.Subject.Id}】");
|
||||
builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FirstName}】");
|
||||
builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FullName}】");
|
||||
builder.AppendLine($"【阅片人Id】:【{taskInfo.DoctorUser.Id}】");
|
||||
builder.AppendLine($"【任务】:【{taskInfo.TaskBlindName}】");
|
||||
builder.AppendLine($"【任务Id】:【{taskInfo.Id}】");
|
||||
|
@ -3100,7 +3100,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
builder.AppendLine($"【标准Id】:【{criterionInfo.Id}】");
|
||||
builder.AppendLine($"【受试者】:【{taskInfo.Subject.ShortName}】");
|
||||
builder.AppendLine($"【受试者Id】:【{taskInfo.Subject.Id}】");
|
||||
builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FirstName}】");
|
||||
builder.AppendLine($"【阅片人】:【{taskInfo.DoctorUser.FullName}】");
|
||||
builder.AppendLine($"【阅片人Id】:【{taskInfo.DoctorUser.Id}】");
|
||||
builder.AppendLine($"【任务】:【{taskInfo.TaskBlindName}】");
|
||||
builder.AppendLine($"【任务Id】:【{taskInfo.Id}】");
|
||||
|
|
|
@ -1413,7 +1413,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var questionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == LastVisitTaskId).Select(x => new ReadingTaskQuestionMark()
|
||||
{
|
||||
VisitTaskId = visitTaskId,
|
||||
FirstAddTaskId = x.FirstAddTaskId,
|
||||
FristAddTaskId = x.FristAddTaskId,
|
||||
QuestionId = x.QuestionId,
|
||||
QuestionType = x.QuestionType,
|
||||
OrderMarkName = x.OrderMarkName,
|
||||
|
|
|
@ -1412,7 +1412,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
var questionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == LastVisitTaskId).Select(x => new ReadingTaskQuestionMark()
|
||||
{
|
||||
VisitTaskId = visitTaskId,
|
||||
FirstAddTaskId = x.FirstAddTaskId,
|
||||
FristAddTaskId = x.FristAddTaskId,
|
||||
QuestionId = x.QuestionId,
|
||||
QuestionType = x.QuestionType,
|
||||
OrderMarkName = x.OrderMarkName,
|
||||
|
|
|
@ -0,0 +1,745 @@
|
|||
using DocumentFormat.OpenXml.EMMA;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||
{
|
||||
[ApiExplorerSettings(GroupName = "Reading")]
|
||||
public class MRIPDFFCalculateService(IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository,
|
||||
IRepository<VisitTask> _visitTaskRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
||||
IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository,
|
||||
IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository,
|
||||
IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository,
|
||||
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
|
||||
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||
IRepository<OrganInfo> _organInfoRepository,
|
||||
IRepository<Dictionary> _dictionaryRepository,
|
||||
IRepository<ReadingTaskQuestionMark> _readingTaskQuestionMarkRepository,
|
||||
IRepository<DicomStudy> _dicomStudyRepository,
|
||||
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||
IRepository<TumorAssessment_RECIST1Point1> _tumorAssessmentRepository,
|
||||
IGeneralCalculateService _generalCalculateService,
|
||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, ICriterionCalculateService
|
||||
{
|
||||
|
||||
|
||||
private List<SiteVisitForTumor> siteVisitForTumorList = new List<SiteVisitForTumor>();
|
||||
|
||||
/// <summary>
|
||||
/// 获取阅片的计算数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> GetReadingCalculationData(GetReadingCalculationDataInDto inDto)
|
||||
{
|
||||
return new
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
#region 删除病灶获取起始病灶序号
|
||||
/// <summary>
|
||||
/// 删除病灶获取起始病灶序号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<int> GetDeleteLesionStatrIndex(DeleteReadingRowAnswerInDto inDto)
|
||||
{
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取阅片报告
|
||||
/// <summary>
|
||||
/// 获取阅片报告
|
||||
/// </summary>
|
||||
/// <param name="indto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<GetReadingReportEvaluationOutDto> GetReadingReportEvaluation(GetReadingReportEvaluationInDto indto)
|
||||
{
|
||||
GetReadingReportEvaluationOutDto result = new GetReadingReportEvaluationOutDto();
|
||||
|
||||
result.CalculateResult = await this.GetReportVerify(new GetReportVerifyInDto()
|
||||
{
|
||||
VisitTaskId = indto.VisitTaskId
|
||||
});
|
||||
|
||||
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
|
||||
|
||||
|
||||
result.ReadingTaskState = visitTaskInfo.ReadingTaskState;
|
||||
var taskInfoList = await _generalCalculateService.GetReadingReportTaskList(indto.VisitTaskId);
|
||||
|
||||
result.VisitTaskList = taskInfoList;
|
||||
|
||||
var visitTaskIds = taskInfoList.Select(x => x.VisitTaskId).ToList();
|
||||
|
||||
var criterionId = visitTaskInfo.TrialReadingCriterionId;
|
||||
var questionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == criterionId && x.ShowQuestion != ShowQuestion.Hide).ToListAsync();
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == criterionId).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
var lesionsIndexs = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).GroupBy(x => new { x.QuestionId }).Select(x => new lesionsIndexDto()
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
Rowindexs = x.Select(x => x.RowIndex).Distinct().OrderBy(x => x).ToList()
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
var tableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId).ProjectTo<TableAnsweRowInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
var answers = await _readingTaskQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var tableAnswers = await _readingTableQuestionAnswerRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var globalanswerList = await _readingGlobalTaskInfoRepository.Where(x => visitTaskIds.Contains(x.TaskId) && x.GlobalVisitTask.TaskState == TaskState.Effect && x.Answer != string.Empty).Select(x => new
|
||||
{
|
||||
x.TaskId,
|
||||
x.GlobalVisitTask.VisitTaskNum,
|
||||
x.QuestionId,
|
||||
x.Answer
|
||||
}).ToListAsync();
|
||||
var alltableAnsweRowInfos = await _readingTableAnswerRowInfoRepository.Where(x => visitTaskIds.Contains(x.VisitTaskId)).ToListAsync();
|
||||
var organIds = alltableAnsweRowInfos.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
|
||||
var organInfos = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
|
||||
|
||||
var needChangeType = new List<QuestionMark?>() {
|
||||
QuestionMark.Organ,
|
||||
QuestionMark.Location,
|
||||
QuestionMark.Part,
|
||||
};
|
||||
|
||||
// 第一级
|
||||
|
||||
#region 构造问题
|
||||
List<ReadingReportDto> questions = questionList.Where(x => x.Type == ReadingQestionType.Group).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionId = x.Id,
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
Type = x.Type,
|
||||
GroupId = x.GroupId,
|
||||
GroupEnName = x.GroupEnName,
|
||||
QuestionType = x.QuestionType,
|
||||
DataSource = x.DataSource,
|
||||
LesionType = x.LesionType,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
TypeValue = x.TypeValue,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Group,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 分组
|
||||
foreach (var item in questions)
|
||||
{
|
||||
item.Childrens = questionList.Where(x => x.GroupId == item.QuestionId).OrderBy(x => x.ShowOrder).Select(x => new ReadingReportDto()
|
||||
{
|
||||
GroupName = x.GroupName.LanguageName(x.GroupEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.Id,
|
||||
IsShowInDicom = x.IsShowInDicom,
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
LesionType = x.LesionType,
|
||||
DataSource = x.DataSource,
|
||||
QuestionGenre = x.QuestionGenre,
|
||||
GroupEnName = x.GroupEnName,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
Type = x.Type,
|
||||
QuestionType = x.QuestionType,
|
||||
TypeValue = x.TypeValue,
|
||||
ShowOrder = x.ShowOrder,
|
||||
OrderMark = x.OrderMark,
|
||||
ValueType = x.ValueType,
|
||||
Unit = x.Unit,
|
||||
CustomUnit = x.CustomUnit,
|
||||
ReportLayType = ReportLayType.Question,
|
||||
HighlightAnswer = x.HighlightAnswer,
|
||||
HighlightAnswerList = x.HighlightAnswerList,
|
||||
}).ToList();
|
||||
|
||||
// 问题
|
||||
foreach (var question in item.Childrens)
|
||||
{
|
||||
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var globalAnswer = globalanswerList.Where(x => x.TaskId == task.VisitTaskId && x.QuestionId == question.QuestionId).OrderByDescending(x => x.VisitTaskNum).FirstOrDefault();
|
||||
|
||||
var answer = answers.Where(x => x.VisitTaskId == task.VisitTaskId && x.ReadingQuestionTrialId == question.QuestionId).FirstOrDefault();
|
||||
question.Answer.Add(new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = answer == null ? string.Empty : answer.Answer,
|
||||
IsGlobalChange = globalAnswer == null ? false : true,
|
||||
GlobalChangeAnswer = globalAnswer == null ? string.Empty : globalAnswer.Answer,
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// 构造表格行数据
|
||||
|
||||
|
||||
var rowlist = tableAnsweRowInfos.Where(x => x.QuestionId == question.QuestionId).OrderBy(x => x.RowIndex).ToList();
|
||||
|
||||
question.Childrens = new List<ReadingReportDto>();
|
||||
|
||||
var rowoindexs = lesionsIndexs.Where(x => x.QuestionId == question.QuestionId).Select(x => x.Rowindexs.OrderBy(y => y).ToList()).FirstOrDefault();
|
||||
rowoindexs = rowoindexs == null ? new List<decimal>() : rowoindexs;
|
||||
foreach (var rowoindex in rowoindexs)
|
||||
{
|
||||
var rowinfo = rowlist.Where(x => x.RowIndex == rowoindex).FirstOrDefault();
|
||||
question.Childrens.Add(new ReadingReportDto()
|
||||
{
|
||||
QuestionName = question.OrderMark + rowoindex.GetLesionMark(),
|
||||
RowId = rowinfo?.Id,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
SplitOrMergeLesionName = rowinfo != null ? (rowinfo.MergeName.IsNullOrEmpty() ? rowinfo.SplitName : rowinfo.MergeName) : string.Empty,
|
||||
SplitOrMergeType = rowinfo != null ? (rowinfo.SplitOrMergeType) : null,
|
||||
LesionType = question.LesionType,
|
||||
IsCanEditPosition = rowinfo != null ? (rowinfo.IsCanEditPosition) : false,
|
||||
RowIndex = rowoindex,
|
||||
BlindName = rowinfo != null ? rowinfo.BlindName : string.Empty,
|
||||
ReportLayType = ReportLayType.Lesions,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var row in question.Childrens)
|
||||
{
|
||||
// tableQuestion
|
||||
row.Childrens = tableQuestionList.Where(x => x.ReadingQuestionId == question.QuestionId).Select(x => new ReadingReportDto()
|
||||
{
|
||||
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionId = x.ReadingQuestionId,
|
||||
TableQuestionId = x.Id,
|
||||
Type = x.Type,
|
||||
IsShowInDicom = question.IsShowInDicom,
|
||||
DataSource = x.DataSource,
|
||||
LimitEdit = x.LimitEdit,
|
||||
MaxAnswerLength = x.MaxAnswerLength,
|
||||
FileType = x.FileType,
|
||||
LesionType = question.LesionType,
|
||||
TableQuestionType = x.TableQuestionType,
|
||||
DictionaryCode = x.DictionaryCode,
|
||||
QuestionMark = x.QuestionMark,
|
||||
TypeValue = x.TypeValue,
|
||||
RowIndex = row.RowIndex,
|
||||
RowId = row.RowId,
|
||||
ShowOrder = x.ShowOrder,
|
||||
ValueType = x.ValueType,
|
||||
CustomUnit = x.CustomUnit,
|
||||
Unit = x.Unit,
|
||||
ReportLayType = ReportLayType.TableQuestion,
|
||||
}).ToList();
|
||||
|
||||
|
||||
foreach (var tableQuestion in row.Childrens)
|
||||
{
|
||||
foreach (var task in taskInfoList)
|
||||
{
|
||||
var rowinfo = alltableAnsweRowInfos.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex).FirstOrDefault();
|
||||
var taskQuestionAnswer = new TaskQuestionAnswer()
|
||||
{
|
||||
Answer = tableAnswers.Where(x => x.VisitTaskId == task.VisitTaskId && x.QuestionId == tableQuestion.QuestionId && x.RowIndex == tableQuestion.RowIndex && x.TableQuestionId == tableQuestion.TableQuestionId).Select(x => x.Answer).FirstIsNullReturnEmpty(),
|
||||
TaskName = task.TaskName,
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
};
|
||||
if (rowinfo != null && rowinfo.OrganInfoId != null)
|
||||
{
|
||||
var organInfo = organInfos.Where(x => x.Id == rowinfo.OrganInfoId).FirstOrDefault();
|
||||
|
||||
|
||||
if (organInfo != null && needChangeType.Contains(tableQuestion.QuestionMark))
|
||||
{
|
||||
if (_userInfo.IsEn_Us)
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOCEN;
|
||||
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULATEN;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
|
||||
taskQuestionAnswer.Answer = organInfo.PartEN;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tableQuestion.QuestionMark)
|
||||
{
|
||||
case QuestionMark.Organ:
|
||||
taskQuestionAnswer.Answer = organInfo.TULOC;
|
||||
break;
|
||||
case QuestionMark.Location:
|
||||
if (organInfo.IsCanEditPosition)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
taskQuestionAnswer.Answer = organInfo.TULAT;
|
||||
|
||||
}
|
||||
break;
|
||||
case QuestionMark.Part:
|
||||
taskQuestionAnswer.Answer = organInfo.Part;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
tableQuestion.Answer.Add(taskQuestionAnswer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
result.TaskQuestions = questions;
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 将上一次的访视病灶添加到这一次
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AddTaskLesionAnswerFromLastTaskOutDto> AddTaskLesionAnswerFromLastTask(AddTaskLesionAnswerFromLastTaskInDto inDto)
|
||||
{
|
||||
var visitTaskId = inDto.VisitTaskId;
|
||||
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
|
||||
var isReadingTaskViewInOrder = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == taskinfo.TrialReadingCriterionId).Select(x => x.IsReadingTaskViewInOrder).FirstOrDefaultAsync();
|
||||
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskinfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
if (!(await _readingTableQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId)))
|
||||
{
|
||||
|
||||
|
||||
|
||||
var dictionList = await _dictionaryRepository.Where(x => x.Parent.Code == "LiverSegmentation").OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
|
||||
var tableQuestion = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.FatFraction).FirstNotNullAsync();
|
||||
|
||||
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == tableQuestion.Id).ToListAsync();
|
||||
var LastVisitTaskId = await _visitTaskRepository.Where(x => x.ReadingCategory == ReadingCategory.Visit &&
|
||||
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
|
||||
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
|
||||
x.DoctorUserId == taskinfo.DoctorUserId &&
|
||||
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
|
||||
x.SubjectId == taskinfo.SubjectId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.VisitTaskNum < taskinfo.VisitTaskNum && x.TaskState == TaskState.Effect && x.ArmEnum == taskinfo.ArmEnum
|
||||
).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
List<TableMarkInfo> marks = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == LastVisitTaskId && x.RowId != null).ProjectTo<TableMarkInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
|
||||
marks.ForEach(x => {
|
||||
|
||||
x.VisitTaskId = visitTaskId;
|
||||
});
|
||||
|
||||
List<ReadingTableAnswerRowInfo> rowlist = new List<ReadingTableAnswerRowInfo>();
|
||||
List<ReadingTableQuestionAnswer> tableAnswerList = new List<ReadingTableQuestionAnswer>();
|
||||
|
||||
decimal num = 1;
|
||||
foreach (var item in dictionList)
|
||||
{
|
||||
var guid = NewId.NextGuid();
|
||||
marks.ForEach(x => {
|
||||
x.RowId = x.RowIndex == num ? guid : x.RowId;
|
||||
});
|
||||
rowlist.Add(new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
FristAddTaskId = visitTaskId,
|
||||
FristAddTaskNum = taskinfo.VisitTaskNum,
|
||||
IsCurrentTaskAdd = true,
|
||||
BlindName = taskinfo.TaskBlindName,
|
||||
OrderMark = tableQuestion.OrderMark + num.GetLesionMark(),
|
||||
VisitTaskId = visitTaskId,
|
||||
TrialId = taskinfo.TrialId,
|
||||
QuestionId = tableQuestion.Id,
|
||||
RowIndex = num,
|
||||
Id = guid,
|
||||
});
|
||||
|
||||
tableAnswerList.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
QuestionId = tableQuestion.Id,
|
||||
Answer = item.Code,
|
||||
TableQuestionId = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.liverSegmentation).Select(x => x.Id).FirstOrDefault(),
|
||||
VisitTaskId = visitTaskId,
|
||||
TrialId = taskinfo.TrialId,
|
||||
RowIndex = num,
|
||||
RowId = guid,
|
||||
});
|
||||
|
||||
foreach (var otherQuestion in tableQuestionList.Where(x => !tableAnswerList.Any(y => y.RowId == guid && y.TableQuestionId == x.Id)))
|
||||
{
|
||||
tableAnswerList.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = otherQuestion.DefaultValue,
|
||||
QuestionId = tableQuestion.Id,
|
||||
TrialId = taskinfo.TrialId,
|
||||
VisitTaskId = taskinfo.Id,
|
||||
RowId = guid,
|
||||
RowIndex = num,
|
||||
TableQuestionId = otherQuestion.Id,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
num++;
|
||||
}
|
||||
await _readingTableAnswerRowInfoRepository.AddRangeAsync(rowlist);
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswerList);
|
||||
|
||||
await _readingTaskQuestionMarkRepository.AddRangeAsync(_mapper.Map<List<ReadingTaskQuestionMark>>(marks));
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
return new AddTaskLesionAnswerFromLastTaskOutDto()
|
||||
{
|
||||
IsBaseLine = taskinfo.SourceSubjectVisitId == baseLineVisitId,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试计算
|
||||
/// </summary>
|
||||
/// <param name="visitTaskId"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task TestCalculate(Guid visitTaskId, QuestionType type)
|
||||
{
|
||||
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(visitTaskId);
|
||||
await ReadingCalculate(readingData, new List<QuestionType>() { type });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算任务
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task CalculateTask(CalculateTaskInDto inDto)
|
||||
{
|
||||
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||
readingData.IsChangeOtherTask = inDto.IsChangeOtherTask;
|
||||
await ReadingCalculate(readingData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 自动计算
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <param name="calculateType"></param>
|
||||
/// <returns></returns>
|
||||
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
|
||||
{
|
||||
|
||||
await this.CalculateAvg(inDto);
|
||||
inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||
var needAddList = new List<ReadingTaskQuestionAnswer>();
|
||||
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
|
||||
{
|
||||
// 脂肪平均
|
||||
new ReadingCalculateData (){QuestionType=QuestionType.TotalMeanFraction,GetStringFun=GetFatFractionAvg},
|
||||
|
||||
// 脂肪分级
|
||||
new ReadingCalculateData (){QuestionType=QuestionType.FattyLiverGrading,GetStringFun=GetFattyLiverGrading},
|
||||
};
|
||||
|
||||
|
||||
if (calculateType != null)
|
||||
{
|
||||
calculateList = calculateList.Where(x => calculateType.Contains(x.QuestionType)).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach (var calculate in calculateList)
|
||||
{
|
||||
var item = inDto.QuestionInfo.FirstOrDefault(x => x.QuestionType == calculate.QuestionType);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
//计算答案
|
||||
|
||||
|
||||
#region 计算答案
|
||||
if (calculate.GetDecimalFun != null)
|
||||
{
|
||||
item.Answer = (await calculate.GetDecimalFun(inDto)).ToString();
|
||||
|
||||
}
|
||||
else if (calculate.GetDecimalNullFun != null)
|
||||
{
|
||||
var value = await calculate.GetDecimalNullFun(inDto);
|
||||
item.Answer = value == null ? "NA" : value.Value.ToString();
|
||||
}
|
||||
else if (calculate.GetStringFun != null)
|
||||
{
|
||||
item.Answer = await calculate.GetStringFun(inDto);
|
||||
}
|
||||
#endregion
|
||||
// 修改修约小数位数
|
||||
|
||||
List<ValueOfType?> valueOfTypes = new List<ValueOfType?>() {
|
||||
|
||||
ValueOfType.Decimals,
|
||||
ValueOfType.Percentage
|
||||
};
|
||||
|
||||
if (inDto.DigitPlaces != -1 && calculate.GetDecimalFun != null && calculate.GetDecimalNullFun != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (valueOfTypes.Contains(item.ValueType))
|
||||
{
|
||||
item.Answer = decimal.Round(decimal.Parse(item.Answer ?? "0"), inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
needAddList.Add(new ReadingTaskQuestionAnswer()
|
||||
{
|
||||
Answer = item.Answer,
|
||||
ReadingQuestionTrialId = item.QuestionId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var questionIds = needAddList.Select(x => x.ReadingQuestionTrialId).ToList();
|
||||
|
||||
await _readingTaskQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => questionIds.Contains(x.ReadingQuestionTrialId) && x.VisitTaskId == inDto.VisitTaskId);
|
||||
needAddList.ForEach(x =>
|
||||
{
|
||||
x.SubjectId = inDto.SubjectId;
|
||||
x.ReadingQuestionCriterionTrialId = inDto.CriterionId;
|
||||
x.VisitTaskId = inDto.VisitTaskId;
|
||||
x.TrialId = inDto.TrialId;
|
||||
x.SubjectId = inDto.SubjectId;
|
||||
});
|
||||
|
||||
await _readingTaskQuestionAnswerRepository.AddRangeAsync(needAddList);
|
||||
|
||||
await _readingTaskQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取脂肪分数平均值
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetFatFractionAvg(ReadingCalculateDto inDto)
|
||||
{
|
||||
decimal result = 0;
|
||||
|
||||
var rowInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction)
|
||||
.SelectMany(x => x.TableRowInfoList).ToList();
|
||||
|
||||
var tableQuestionList = rowInfo.Where(x=>x.TableQuestionList.Any(x=>x.QuestionMark== QuestionMark.IsMeasurable && x.Answer.EqEnum(YesOrNoOrNa.Yes))).SelectMany(x => x.TableQuestionList).ToList();
|
||||
|
||||
if (rowInfo.Any(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.AverageValue && x.Answer.IsNullOrEmpty())))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if (tableQuestionList.Count() == 0)
|
||||
{
|
||||
return "NE";
|
||||
}
|
||||
result = tableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).Average(x => x.Answer.IsNullOrEmptyReturn0());
|
||||
return decimal.Round(result, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString()); ;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取脂肪肝分级
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetFattyLiverGrading(ReadingCalculateDto inDto)
|
||||
{
|
||||
var answer = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.TotalMeanFraction).Select(x => x.Answer).FirstIsNullReturnEmpty();
|
||||
if (answer == "NE")
|
||||
{
|
||||
return FattyLiverClassification.NE.GetEnumInt();
|
||||
}
|
||||
else if(answer == string.Empty)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (decimal.TryParse(answer, out var value))
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
< 5 => FattyLiverClassification.Level0.GetEnumInt(),
|
||||
< 10 => FattyLiverClassification.Level1.GetEnumInt(),
|
||||
< 25 => FattyLiverClassification.Level2.GetEnumInt(),
|
||||
_ => FattyLiverClassification.Level3.GetEnumInt()
|
||||
};
|
||||
}
|
||||
|
||||
return FattyLiverClassification.NE.GetEnumInt();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算平均值
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task CalculateAvg(ReadingCalculateDto inDto)
|
||||
{
|
||||
// 脂肪分数的表格问题Id
|
||||
var questionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction).FirstOrDefault();
|
||||
|
||||
List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
|
||||
|
||||
|
||||
foreach (var item in questionInfo.TableRowInfoList)
|
||||
{
|
||||
var avg = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AverageValue).FirstOrDefault();
|
||||
var avgAnswer = string.Empty;
|
||||
List<QuestionMark?> questionMarks = new List<QuestionMark?>()
|
||||
{
|
||||
QuestionMark.FirstMeasurement,
|
||||
QuestionMark.SecondMeasurement,
|
||||
QuestionMark.ThirdMeasurement,
|
||||
};
|
||||
var answers = item.TableQuestionList.Where(x => questionMarks.Contains(x.QuestionMark)).Select(x=>x.Answer).ToList();
|
||||
if (answers.Count() == 3 && !answers.Any(x => x.IsNullOrEmpty()))
|
||||
{
|
||||
var avgAnswernum= answers.Select(x=>x.IsNullOrEmptyReturn0()).Average(x=>x);
|
||||
avgAnswer = decimal.Round(avgAnswernum, inDto.DigitPlaces, MidpointRounding.AwayFromZero).ToString("F" + inDto.DigitPlaces.ToString());
|
||||
}
|
||||
if(item.TableQuestionList.Where(x => x.QuestionMark== QuestionMark.IsMeasurable).Select(x => x.Answer).FirstOrDefault().EqEnum(YesOrNoOrNa.No))
|
||||
{
|
||||
avgAnswer = "NE";
|
||||
}
|
||||
tableAnswers.Add(new ReadingTableQuestionAnswer()
|
||||
{
|
||||
Answer = avgAnswer,
|
||||
VisitTaskId = inDto.VisitTaskId,
|
||||
QuestionId = avg.QuestionId,
|
||||
TableQuestionId = avg.TableQuestionId,
|
||||
TrialId = inDto.TrialId,
|
||||
RowIndex = avg.RowIndex,
|
||||
RowId = avg.RowId,
|
||||
|
||||
});
|
||||
|
||||
await _readingTableQuestionAnswerRepository.BatchDeleteNoTrackingAsync(x => x.VisitTaskId == inDto.VisitTaskId && x.RowId == item.RowId && x.TableQuestionId == avg.TableQuestionId);
|
||||
}
|
||||
|
||||
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
|
||||
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<GetReportVerifyOutDto> GetReportVerify(GetReportVerifyInDto inDto)
|
||||
{
|
||||
return new GetReportVerifyOutDto()
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public async Task VerifyVisitTaskQuestions(VerifyVisitTaskQuestionsInDto inDto)
|
||||
{
|
||||
ReadingCalculateDto readingData = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
|
||||
|
||||
var markList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToListAsync();
|
||||
var rowInfo = readingData.QuestionInfo.Where(x => x.LesionType == LesionType.FatFraction)
|
||||
.SelectMany(x => x.TableRowInfoList).ToList();
|
||||
|
||||
var tableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.AverageValue && x.Answer.IsNotNullOrEmpty())).ToList();
|
||||
|
||||
if (tableQuestionList.Count() != 8)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["MRIPDFF_AllNeedToBeMark"]);
|
||||
}
|
||||
|
||||
var notableQuestionList = rowInfo.Where(x => x.TableQuestionList.Any(x => x.QuestionMark == QuestionMark.IsMeasurable && x.Answer.EqEnum(YesOrNoOrNa.No))).ToList();
|
||||
|
||||
|
||||
foreach (var item in notableQuestionList)
|
||||
{
|
||||
if (markList.Any(x => x.RowId == item.RowId && x.MeasureData.IsNotNullOrEmpty()))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["MRIPDFF_NeedClearMark"]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -146,7 +146,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public string Phone { get; set; } = string.Empty;
|
||||
public string OrganizationName { get; set; } = string.Empty;
|
||||
|
||||
[ExcelColumnName("UserType")]
|
||||
[ExcelColumnName("Role")]
|
||||
public string UserTypeStr { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public interface ITrialSiteSurveyService
|
||||
{
|
||||
Task<IResponseOutput> AddOrUpdateTrialSiteSurvey(TrialSiteSurveyAddOrEdit addOrEditTrialSiteSurvey);
|
||||
Task<IResponseOutput> DeleteTrialSiteSurvey(Guid trialSiteSurveyId);
|
||||
//Task<IResponseOutput> DeleteTrialSiteSurvey(Guid trialSiteSurveyId);
|
||||
Task<LoginReturnDTO> GetSiteSurveyInfo(Guid trialSiteSurveyId, Guid trialId);
|
||||
Task<PageOutput<TrialSiteSurveyView>> GetTrialSiteSurveyList(TrialSiteSurveyQueryDTO surveyQueryDTO);
|
||||
Task<TrialSurveyInitInfo> GetTrialSurveyInitInfo(Guid trialId);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue