Compare commits
231 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f6612286d9 | |||
| c21845c60d | |||
| 867ef0ef97 | |||
| f27bee83b7 | |||
| e3b6feb4da | |||
| d727703075 | |||
| c49cf0ed12 | |||
| f324d207dd | |||
| c9bda275f5 | |||
| 62ed1a408d | |||
| 25efb34f1f | |||
| eb0f13c075 | |||
| 7ca92a7675 | |||
| e313f88bca | |||
| 4823eb29d5 | |||
| 43ec332f61 | |||
| cac0652120 | |||
| cc088900b6 | |||
| 824b165723 | |||
| 443b94b332 | |||
| dc116d3a6f | |||
| bbc8859a16 | |||
| 09e388b01a | |||
| e5fcb75b9f | |||
| 8e104e133f | |||
| e2a77537f0 | |||
| a73a79b627 | |||
| e79c3a8f37 | |||
| ca9a2dad18 | |||
| cd03f5f31d | |||
| 33e25de801 | |||
| 9cd60e9575 | |||
| 4da4a4de89 | |||
| ec0a88a5ec | |||
| a52a00e58c | |||
| 0a6ffbba07 | |||
| 8cb5423b0b | |||
| 5a6411c6c3 | |||
| b97a8b5a68 | |||
| 91794266e7 | |||
| 2f86e2dae1 | |||
| fb76c5af6c | |||
| 3f6ec5b7ea | |||
| c95ea8c547 | |||
| facd9e0e5f | |||
| 9d0c3d3fc5 | |||
| 907d0d39a1 | |||
| 4d689100ee | |||
| 818d9d6f62 | |||
| 9a2059726f | |||
| 8bcac405e5 | |||
| 19661c5e82 | |||
| 9875d9622d | |||
| 7573ffe941 | |||
| 47166ab2eb | |||
| 0295b7d919 | |||
| 3653072497 | |||
| 0e7f203a1b | |||
| ab99265c88 | |||
| f774d95f5c | |||
| 9e1e32f16d | |||
| 0accb453e5 | |||
| e2b285c792 | |||
| 935f95fa3b | |||
| a4d20d9f08 | |||
| 0e23719c7b | |||
| eb1f06658d | |||
| 1e177a2530 | |||
| 49031b0e48 | |||
| ca5bbb3064 | |||
| b338188c5f | |||
| 9cbe4cc36e | |||
| 6f5f521803 | |||
| a6db30280b | |||
| 4db3860ade | |||
| 57837cfe1d | |||
| b51fdc5769 | |||
| 5038d7ad53 | |||
| c1d618326b | |||
| db1a0195fe | |||
| 238def8089 | |||
| 59e969c2a8 | |||
| 029a288be2 | |||
| 11e5448acf | |||
| 71577d0346 | |||
| 681e559cb4 | |||
| 862390ae78 | |||
| f210799c4d | |||
| d7700c3c77 | |||
| 44fa4d3fc4 | |||
| f0c57c643b | |||
| 5e48ed1e23 | |||
| a3f12b2a53 | |||
| cc00cce704 | |||
| 9c244c6750 | |||
| ffb5d46ca3 | |||
| 7376732b1a | |||
| 1caf4ff8e6 | |||
| 22147483c1 | |||
| c7dbf7ba92 | |||
| fd3f76d35c | |||
| e10bca6892 | |||
| 4a01960426 | |||
| 318364e70b | |||
| 383064a7b7 | |||
| 78bbfb5f41 | |||
| 9aec1f5f50 | |||
| 66beb43daf | |||
| b02589a957 | |||
| d4a1d83851 | |||
| 53aee1020d | |||
| 010c106879 | |||
| fb43e38c7d | |||
| ca96c67e96 | |||
| 1fbf635582 | |||
| 44d62b187f | |||
| 57600cbad1 | |||
| 311d6507ce | |||
| 8e520ce579 | |||
| 5a97e15885 | |||
| bb36c67159 | |||
| 7a33edc7a6 | |||
| a7d6303da4 | |||
| 704c201c33 | |||
| c69d3eec36 | |||
| 6e5a3a0078 | |||
| ed62de9135 | |||
| a8b218ce95 | |||
| f6d2b1e7f1 | |||
| 85439213b2 | |||
| 2933d100f7 | |||
| ac799688d3 | |||
| a4b9c44cfa | |||
| af282d2bb8 | |||
| a93bbebb61 | |||
| 4552a24caa | |||
| fc22ec0672 | |||
| 963fbcb5e8 | |||
| 3da3b9de45 | |||
| a055d1c668 | |||
| 0b130bbc01 | |||
| 9f9bc9c747 | |||
| 75367ae727 | |||
| bd9d78622f | |||
| 6b807f419b | |||
| f58ee6f63a | |||
| 7510d86a52 | |||
| 65fba6ca41 | |||
| 3e2198b7ba | |||
| 535c0fc419 | |||
| 1c5d30b673 | |||
| 3bf26dbbef | |||
| 329437411d | |||
| 090cdaf2e4 | |||
| 7c257f261c | |||
| 477bc7baf7 | |||
| 32d6ebef9c | |||
| 51e0676ce5 | |||
| 53156e210f | |||
| 84f76c09f7 | |||
| 74e0765d7a | |||
| 51cfadbc77 | |||
| 01e047f639 | |||
| 4050d7e4a3 | |||
| adab66172d | |||
| 7c850c969e | |||
| f55fa98dec | |||
| 7f28c984e1 | |||
| 6220e53d8f | |||
| 5bb0231354 | |||
| 58eec48af7 | |||
| 65545dd3e5 | |||
| 5b92015c98 | |||
| 64c97b22d5 | |||
| 87adbe9bed | |||
| c6ed8b8318 | |||
| 4d2890976a | |||
| 9cfddf1327 | |||
| 84203d5aa2 | |||
| 4d19fffc5f | |||
| 18683390b7 | |||
| fb137ae840 | |||
| c8bc0c4a32 | |||
| 8ded82fa81 | |||
| acd1f47f4a | |||
| 054827bbae | |||
| a5ebe97dc5 | |||
| 02b2d8f754 | |||
| cf5da8f55a | |||
| 40947de05a | |||
| 662648691d | |||
| 29836a9c62 | |||
| a2b1a0d64b | |||
| 87fbd2cb59 | |||
| c91e21c23a | |||
| 0f25c7db0e | |||
| e5b5cbb8d8 | |||
| 9c1af1b8dc | |||
| 0da09da45e | |||
| 87aaefadf6 | |||
| b5b739a5cb | |||
| 1315d5dc29 | |||
| 72b70f5311 | |||
| fd15a62148 | |||
| e9bd625195 | |||
| c37fcf588c | |||
| 3f8d5027c8 | |||
| 972fc32eeb | |||
| 1ba9efe894 | |||
| f85ac8a813 | |||
| 7bf097c127 | |||
| fc579d9cf4 | |||
| b1c0933428 | |||
| bd7dd906fb | |||
| 3a8e400f33 | |||
| c6dd323b80 | |||
| dfb45d8391 | |||
| 0b0df00525 | |||
| 96fc5ae78c | |||
| a4b2d68995 | |||
| 70ababc2d9 | |||
| e57887eba5 | |||
| aef7fded18 | |||
| e0613c1f2d | |||
| f6d323cc31 | |||
| aa85562076 | |||
| 0165688799 | |||
| c2aefebedc | |||
| 1c5e4454da | |||
| 65e2a45d74 | |||
| 99026d6483 |
@@ -30,6 +30,8 @@ using IRaCIS.Core.Application.Helper;
|
||||
using Microsoft.Extensions.Options;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using LoginReturnDTO = IRaCIS.Application.Contracts.LoginReturnDTO;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using AutoMapper.QueryableExtensions;
|
||||
|
||||
namespace IRaCIS.Api.Controllers
|
||||
{
|
||||
@@ -53,8 +55,8 @@ namespace IRaCIS.Api.Controllers
|
||||
/// <param name="doctorId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet, Route("doctor/getDetail/{doctorId:guid}")]
|
||||
|
||||
public async Task<IResponseOutput<DoctorDetailDTO>> GetDoctorDetail([FromServices] IAttachmentService attachmentService, [FromServices] IDoctorService _doctorService,
|
||||
|
||||
public async Task<IResponseOutput<DoctorDetailDTO>> GetDoctorDetail([FromServices] IAttachmentService attachmentService, [FromServices] IDoctorService _doctorService,
|
||||
[FromServices] IEducationService _educationService, [FromServices] ITrialExperienceService _trialExperienceService,
|
||||
|
||||
[FromServices] IResearchPublicationService _researchPublicationService, [FromServices] IVacationService _vacationService, Guid doctorId)
|
||||
@@ -66,7 +68,7 @@ namespace IRaCIS.Api.Controllers
|
||||
|
||||
var doctorDetail = new DoctorDetailDTO
|
||||
{
|
||||
AuditView =await _doctorService.GetAuditState(doctorId),
|
||||
AuditView = await _doctorService.GetAuditState(doctorId),
|
||||
BasicInfoView = await _doctorService.GetBasicInfo(doctorId),
|
||||
EmploymentView = await _doctorService.GetEmploymentInfo(doctorId),
|
||||
AttachmentList = await attachmentService.GetAttachments(doctorId),
|
||||
@@ -77,7 +79,7 @@ namespace IRaCIS.Api.Controllers
|
||||
TrialExperienceView = await _trialExperienceService.GetTrialExperience(doctorId),
|
||||
ResearchPublicationView = await _researchPublicationService.GetResearchPublication(doctorId),
|
||||
|
||||
SpecialtyView =await _doctorService.GetSpecialtyInfo(doctorId),
|
||||
SpecialtyView = await _doctorService.GetSpecialtyInfo(doctorId),
|
||||
InHoliday = (await _vacationService.OnVacation(doctorId)).IsSuccess,
|
||||
IntoGroupInfo = _doctorService.GetDoctorIntoGroupInfo(doctorId),
|
||||
SowList = sowList,
|
||||
@@ -96,80 +98,31 @@ namespace IRaCIS.Api.Controllers
|
||||
/// <summary> 系统用户登录接口[New] </summary>
|
||||
[HttpPost, Route("user/login")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput<LoginReturnDTO>> Login(UserLoginDTO loginUser, [FromServices] IEasyCachingProvider provider, [FromServices] IUserService _userService,
|
||||
[FromServices] ITokenService _tokenService,
|
||||
|
||||
[FromServices] IReadingImageTaskService readingImageTaskService,
|
||||
[FromServices] IConfiguration configuration)
|
||||
public async Task<IResponseOutput> Login(UserLoginDTO loginUser,
|
||||
[FromServices] IEasyCachingProvider provider,
|
||||
[FromServices] IUserService _userService,
|
||||
[FromServices] ITokenService _tokenService,
|
||||
[FromServices] IReadingImageTaskService readingImageTaskService,
|
||||
IOptionsMonitor<ServiceVerifyConfigOption> _verifyConfig,
|
||||
IMailVerificationService _mailVerificationService)
|
||||
{
|
||||
|
||||
|
||||
var returnModel = await _userService.Login(loginUser.UserName, loginUser.Password);
|
||||
|
||||
if (returnModel.IsSuccess)
|
||||
//MFA 邮箱验证 前端传递用户Id 和MFACode
|
||||
if (loginUser.UserId != null && _verifyConfig.CurrentValue.OpenLoginMFA)
|
||||
{
|
||||
#region GRPC 调用鉴权中心,因为服务器IIS问题 http/2 故而没法使用
|
||||
Guid userId = (Guid)loginUser.UserId;
|
||||
|
||||
////重试策略
|
||||
//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 }
|
||||
// }
|
||||
//};
|
||||
//验证MFA 编码是否有问题 ,前端要拆开,自己调用验证的逻辑
|
||||
//await _userService.VerifyMFACodeAsync(userId, loginUser.MFACode);
|
||||
|
||||
//#region unable to trust the certificate then the gRPC client can be configured to ignore the invalid certificate
|
||||
//var loginUser = await _userRepository.Where(u => u.UserName.Equals(userName) && u.Password == password).ProjectTo<UserBasicInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
|
||||
|
||||
//var httpHandler = new HttpClientHandler();
|
||||
//// Return `true` to allow certificates that are untrusted/invalid
|
||||
//httpHandler.ServerCertificateCustomValidationCallback =
|
||||
// HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
|
||||
var basicInfo = await _userService.GetUserBasicInfo(userId, loginUser.Password);
|
||||
|
||||
var loginReturn = new LoginReturnDTO() { BasicInfo = basicInfo };
|
||||
|
||||
//////这一句是让grpc支持本地 http 如果本地访问部署在服务器上,那么是访问不成功的
|
||||
//AppContext.SetSwitch(
|
||||
// "System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
|
||||
loginReturn.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(loginReturn.BasicInfo));
|
||||
|
||||
//#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
|
||||
|
||||
returnModel.Data.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(returnModel.Data.BasicInfo));
|
||||
|
||||
// 创建一个 CookieOptions 对象,用于设置 Cookie 的属性
|
||||
var option = new CookieOptions
|
||||
@@ -180,20 +133,161 @@ namespace IRaCIS.Api.Controllers
|
||||
Secure = false // 确保 cookie 只能通过 HTTPS 访问
|
||||
};
|
||||
|
||||
HttpContext.Response.Cookies.Append("access_token", returnModel.Data.JWTStr, option);
|
||||
HttpContext.Response.Cookies.Append("access_token", loginReturn.JWTStr, option);
|
||||
|
||||
// 验证阅片休息时间
|
||||
await readingImageTaskService.ResetReadingRestTime(userId);
|
||||
|
||||
await provider.SetAsync(userId.ToString(), loginReturn.JWTStr, TimeSpan.FromDays(7));
|
||||
|
||||
await provider.SetAsync($"{userId.ToString()}_Online", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(_verifyConfig.CurrentValue.AutoLoginOutMinutes));
|
||||
|
||||
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)
|
||||
{
|
||||
//发版屏蔽
|
||||
|
||||
returnModel.Data.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(returnModel.Data.BasicInfo));
|
||||
|
||||
//MFA 发送邮件
|
||||
|
||||
returnModel.Data.IsMFA = true;
|
||||
|
||||
var email = returnModel.Data.BasicInfo.EMail;
|
||||
|
||||
#region 隐藏Email
|
||||
// 找到 "@" 符号的位置
|
||||
int atIndex = email.IndexOf('@');
|
||||
|
||||
// 替换 "@" 符号前的中间两位为星号
|
||||
string visiblePart = email.Substring(0, atIndex);
|
||||
|
||||
int startIndex = (visiblePart.Length - 2) / 2;
|
||||
|
||||
// 替换中间两位字符为星号
|
||||
string hiddenPartBeforeAt = visiblePart.Substring(0, startIndex) + "**" + visiblePart.Substring(startIndex + 2);
|
||||
|
||||
string afterAt = email.Substring(atIndex + 1);
|
||||
|
||||
// 组合隐藏和可见部分
|
||||
string hiddenEmail = hiddenPartBeforeAt + "@" + afterAt;
|
||||
#endregion
|
||||
|
||||
returnModel.Data.BasicInfo.EMail = hiddenEmail;
|
||||
|
||||
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 provider.SetAsync(userId.ToString(), returnModel.Data.JWTStr, TimeSpan.FromDays(7));
|
||||
|
||||
await provider.SetAsync($"{userId.ToString()}_Online", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(_verifyConfig.CurrentValue.AutoLoginOutMinutes));
|
||||
}
|
||||
|
||||
}
|
||||
return returnModel;
|
||||
|
||||
}
|
||||
|
||||
var userId = returnModel.Data.BasicInfo.Id.ToString();
|
||||
//provider.Set(userId, userId, TimeSpan.FromMinutes(AppSettings.LoginExpiredTimeSpan));
|
||||
// 验证阅片休息时间
|
||||
await readingImageTaskService.ResetReadingRestTime(returnModel.Data.BasicInfo.Id);
|
||||
await provider.SetAsync(userId.ToString(), returnModel.Data.JWTStr, TimeSpan.FromDays(7));
|
||||
return returnModel;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet, Route("imageShare/ShareImage")]
|
||||
[AllowAnonymous]
|
||||
public IResponseOutput ShareImage([FromServices] ITokenService _tokenService)
|
||||
@@ -223,7 +317,7 @@ namespace IRaCIS.Api.Controllers
|
||||
|
||||
var ossOptions = serviceOption.AliyunOSS;
|
||||
|
||||
return ResponseOutput.Ok(new ObjectStoreDTO() { ObjectStoreUse = serviceOption.ObjectStoreUse, MinIO = serviceOption.MinIO ,AliyunOSS= serviceOption.AliyunOSS,AWS=serviceOption.AWS });
|
||||
return ResponseOutput.Ok(new ObjectStoreDTO() { ObjectStoreUse = serviceOption.ObjectStoreUse, MinIO = serviceOption.MinIO, AliyunOSS = serviceOption.AliyunOSS, AWS = serviceOption.AWS });
|
||||
|
||||
#region 临时token 屏蔽
|
||||
//IClientProfile profile = DefaultProfile.GetProfile(ossOptions.RegionId, ossOptions.AccessKeyId, ossOptions.AccessKeySecret);
|
||||
@@ -264,19 +358,19 @@ namespace IRaCIS.Api.Controllers
|
||||
#endregion
|
||||
|
||||
}
|
||||
else if(Enum.TryParse<ObjectStoreUse>(serviceOption.ObjectStoreUse, out var parsedValue) && parsedValue == ObjectStoreUse.MinIO)
|
||||
else if (Enum.TryParse<ObjectStoreUse>(serviceOption.ObjectStoreUse, out var parsedValue) && parsedValue == ObjectStoreUse.MinIO)
|
||||
{
|
||||
return ResponseOutput.Ok(new ObjectStoreDTO() { ObjectStoreUse=serviceOption.ObjectStoreUse,MinIO=serviceOption.MinIO, AWS = serviceOption.AWS });
|
||||
return ResponseOutput.Ok(new ObjectStoreDTO() { ObjectStoreUse = serviceOption.ObjectStoreUse, MinIO = serviceOption.MinIO, AWS = serviceOption.AWS });
|
||||
}
|
||||
else
|
||||
{
|
||||
return ResponseOutput.Ok(new ObjectStoreDTO() { ObjectStoreUse = serviceOption.ObjectStoreUse, MinIO = serviceOption.MinIO, AWS = serviceOption.AWS });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpGet("user/GenerateSTS")]
|
||||
public IResponseOutput GenerateSTS([FromServices]IOptionsMonitor<AliyunOSSOptions> options )
|
||||
[HttpGet("user/GenerateSTS")]
|
||||
public IResponseOutput GenerateSTS([FromServices] IOptionsMonitor<AliyunOSSOptions> options)
|
||||
{
|
||||
var ossOptions = options.CurrentValue;
|
||||
|
||||
@@ -304,9 +398,9 @@ namespace IRaCIS.Api.Controllers
|
||||
SecurityToken = response.Credentials.SecurityToken,
|
||||
Expiration = response.Credentials.Expiration,
|
||||
|
||||
Region = ossOptions.region ,
|
||||
BucketName = ossOptions.bucketName ,
|
||||
ViewEndpoint = ossOptions.viewEndpoint ,
|
||||
Region = ossOptions.region,
|
||||
BucketName = ossOptions.bucketName,
|
||||
ViewEndpoint = ossOptions.viewEndpoint,
|
||||
|
||||
};
|
||||
|
||||
@@ -318,12 +412,12 @@ 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<User> _userRepository, string url, [FromServices] ILogger<ExtraController> _logger)
|
||||
{
|
||||
|
||||
var decodeUrl = System.Web.HttpUtility.UrlDecode(url);
|
||||
|
||||
var userId = decodeUrl.Substring(decodeUrl.IndexOf("UserId=") + "UserId=".Length , 36) ;
|
||||
var userId = decodeUrl.Substring(decodeUrl.IndexOf("UserId=") + "UserId=".Length, 36);
|
||||
|
||||
var token = decodeUrl.Substring(decodeUrl.IndexOf("access_token=") + "access_token=".Length);
|
||||
|
||||
@@ -331,12 +425,12 @@ namespace IRaCIS.Api.Controllers
|
||||
|
||||
var domainStrList = decodeUrl.Split("/").ToList().Take(3).ToList();
|
||||
|
||||
var errorUrl = domainStrList[0]+"//"+ domainStrList[2]+ "/error";
|
||||
var errorUrl = domainStrList[0] + "//" + domainStrList[2] + "/error";
|
||||
|
||||
|
||||
if (!await _userRepository.AnyAsync(t => t.Id == Guid.Parse(userId) && t.EmailToken == token && t.IsFirstAdd))
|
||||
if (!await _userRepository.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")} ";
|
||||
decodeUrl = errorUrl + $"?lang={lang}&ErrorMessage={System.Web.HttpUtility.UrlEncode(lang == "zh" ? "您的初始化链接已过期" : "Error!The initialization link has expired. Return")} ";
|
||||
}
|
||||
|
||||
return Redirect(decodeUrl);
|
||||
|
||||
@@ -20,7 +20,6 @@ using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using Magicodes.ExporterAndImporter.Excel;
|
||||
using MassTransit;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@@ -39,7 +38,6 @@ using Microsoft.Net.Http.Headers;
|
||||
using MiniExcelLibs;
|
||||
using Newtonsoft.Json;
|
||||
using SharpCompress.Archives;
|
||||
using SkiaSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -237,10 +235,10 @@ namespace IRaCIS.Core.API.Controllers
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
|
||||
public IStringLocalizer _localizer { get; set; }
|
||||
public IStringLocalizer _localizer { get; set; }
|
||||
|
||||
|
||||
private readonly IWebHostEnvironment _hostEnvironment;
|
||||
private readonly IWebHostEnvironment _hostEnvironment;
|
||||
|
||||
private readonly IRepository _repository;
|
||||
|
||||
@@ -255,7 +253,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||
_hostEnvironment = hostEnvironment;
|
||||
_mediator = mediator;
|
||||
_localizer = localizer;
|
||||
_mapper = mapper;
|
||||
_mapper = mapper;
|
||||
_userInfo = userInfo;
|
||||
_repository = repository;
|
||||
}
|
||||
@@ -278,7 +276,6 @@ namespace IRaCIS.Core.API.Controllers
|
||||
var studyMonitor = new StudyMonitor()
|
||||
{
|
||||
TrialId = savedInfo.TrialId,
|
||||
SiteId = savedInfo.SiteId,
|
||||
SubjectId = savedInfo.SubjectId,
|
||||
SubjectVisitId = savedInfo.SubjectVisitId,
|
||||
|
||||
@@ -407,7 +404,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||
|
||||
|
||||
}
|
||||
catch (Exception )
|
||||
catch (Exception)
|
||||
{
|
||||
_provider.Remove($"StudyUid_{trialId}_{archiveStudyCommand.StudyInstanceUid}");
|
||||
|
||||
@@ -506,7 +503,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||
|
||||
await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
||||
|
||||
var sv = (await _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefaultAsync()).IfNullThrowConvertException();
|
||||
var sv = (await _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.TrialSiteId, t.SubjectId }).FirstOrDefaultAsync()).IfNullThrowConvertException();
|
||||
|
||||
var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == studyMonitorId);
|
||||
|
||||
@@ -587,6 +584,20 @@ namespace IRaCIS.Core.API.Controllers
|
||||
|
||||
#region MiniExcel 需要自己验证数据格式规范
|
||||
|
||||
|
||||
if (fileName.EndsWith(".xlsx"))
|
||||
{
|
||||
etcCheckList = MiniExcel.Query<CheckViewModel>(templateFileStream, excelType: ExcelType.XLSX).ToList();
|
||||
}
|
||||
else if (fileName.EndsWith(".csv"))
|
||||
{
|
||||
//因为csv 需要加配置文件 不然都是null
|
||||
etcCheckList = MiniExcel.Query<CheckViewModel>(templateFileStream, null, configuration: new MiniExcelLibs.Csv.CsvConfiguration()
|
||||
{
|
||||
StreamReaderFunc = (stream) => new StreamReader(stream, Encoding.GetEncoding("gb2312"))
|
||||
}).ToList();
|
||||
|
||||
}
|
||||
//if (fileName.EndsWith(".csv"))
|
||||
//{
|
||||
// //因为csv 需要加配置文件 不然都是null
|
||||
@@ -602,67 +613,72 @@ namespace IRaCIS.Core.API.Controllers
|
||||
|
||||
#endregion
|
||||
|
||||
#region 升级net8 导入有问题
|
||||
|
||||
|
||||
//Magicodes 支持自定义特性验证
|
||||
if (fileName.EndsWith(".xlsx"))
|
||||
{
|
||||
var Importer = new ExcelImporter();
|
||||
// if (fileName.EndsWith(".xlsx"))
|
||||
//{
|
||||
// var Importer = new ExcelImporter();
|
||||
|
||||
var import = await Importer.Import<CheckViewModel>(templateFileStream);
|
||||
// var import = await Importer.Import<CheckViewModel>(templateFileStream);
|
||||
|
||||
if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString());
|
||||
// if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString());
|
||||
|
||||
//if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors));
|
||||
// //if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors));
|
||||
|
||||
if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(_localizer["UploadDownLoad_TemplateErrors"]);
|
||||
// if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(_localizer["UploadDownLoad_TemplateErrors"]);
|
||||
|
||||
etcCheckList = import.Data.ToList();
|
||||
}
|
||||
else if (fileName.EndsWith(".csv"))
|
||||
{
|
||||
#region 临时方案 MiniExcel读取 然后保存为xlsx 再用 Magicodes验证数据
|
||||
// etcCheckList = import.Data.ToList();
|
||||
//}
|
||||
//else if (fileName.EndsWith(".csv"))
|
||||
//{
|
||||
// #region 临时方案 MiniExcel读取 然后保存为xlsx 再用 Magicodes验证数据
|
||||
|
||||
//因为csv 需要加配置文件 不然都是null
|
||||
etcCheckList = MiniExcel.Query<CheckViewModel>(templateFileStream, null, configuration: new MiniExcelLibs.Csv.CsvConfiguration()
|
||||
{
|
||||
StreamReaderFunc = (stream) => new StreamReader(stream, Encoding.GetEncoding("gb2312"))
|
||||
}).ToList();
|
||||
// //因为csv 需要加配置文件 不然都是null
|
||||
// etcCheckList = MiniExcel.Query<CheckViewModel>(templateFileStream, null, configuration: new MiniExcelLibs.Csv.CsvConfiguration()
|
||||
// {
|
||||
// StreamReaderFunc = (stream) => new StreamReader(stream, Encoding.GetEncoding("gb2312"))
|
||||
// }).ToList();
|
||||
|
||||
var (csVToXlsxPath, csVToXlsxRelativePath) = FileStoreHelper.GetTrialCheckFilePath(_hostEnvironment, Path.GetFileNameWithoutExtension(fileName) + ".xlsx", trialId);
|
||||
// var (csVToXlsxPath, csVToXlsxRelativePath) = FileStoreHelper.GetTrialCheckFilePath(_hostEnvironment, Path.GetFileNameWithoutExtension(fileName) + ".xlsx", trialId);
|
||||
|
||||
|
||||
await MiniExcel.SaveAsAsync(csVToXlsxPath, etcCheckList, excelType: ExcelType.XLSX);
|
||||
// await MiniExcel.SaveAsAsync(csVToXlsxPath, etcCheckList, excelType: ExcelType.XLSX);
|
||||
|
||||
|
||||
var Importer = new ExcelImporter();
|
||||
// var Importer = new ExcelImporter();
|
||||
|
||||
var import = await Importer.Import<CheckViewModel>(System.IO.File.OpenRead(csVToXlsxPath));
|
||||
// var import = await Importer.Import<CheckViewModel>(System.IO.File.OpenRead(csVToXlsxPath));
|
||||
|
||||
if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString());
|
||||
// if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString());
|
||||
|
||||
//if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors));
|
||||
// //if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors));
|
||||
|
||||
if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.TemplateErrors));
|
||||
// if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.TemplateErrors));
|
||||
|
||||
etcCheckList = import.Data.ToList();
|
||||
// etcCheckList = import.Data.ToList();
|
||||
|
||||
#endregion
|
||||
// #endregion
|
||||
|
||||
|
||||
#region 导入组件有问题 excel编码格式
|
||||
//var Importer = new CsvImporter();
|
||||
// #region 导入组件有问题 excel编码格式
|
||||
// //var Importer = new CsvImporter();
|
||||
|
||||
//var import = await Importer.Import<CheckViewModel>(File.OpenRead(filePath));
|
||||
// //var import = await Importer.Import<CheckViewModel>(File.OpenRead(filePath));
|
||||
|
||||
//if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString());
|
||||
// //if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString());
|
||||
|
||||
//if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors));
|
||||
// //if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors));
|
||||
|
||||
//if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.TemplateErrors));
|
||||
// //if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.TemplateErrors));
|
||||
|
||||
//etcCheckList = import.Data.ToList();
|
||||
#endregion
|
||||
// //etcCheckList = import.Data.ToList();
|
||||
// #endregion
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
#endregion
|
||||
//ExcelReaderFactory 需要自己验证数据 并且从固定列取数据
|
||||
else
|
||||
{
|
||||
@@ -966,14 +982,14 @@ namespace IRaCIS.Core.API.Controllers
|
||||
public IMapper _mapper { get; set; }
|
||||
public IUserInfo _userInfo { get; set; }
|
||||
private readonly IMediator _mediator;
|
||||
public IStringLocalizer _localizer { get; set; }
|
||||
private readonly IWebHostEnvironment _hostEnvironment;
|
||||
public IStringLocalizer _localizer { get; set; }
|
||||
private readonly IWebHostEnvironment _hostEnvironment;
|
||||
|
||||
public UploadDownLoadController(IMapper mapper, IUserInfo userInfo, IStringLocalizer localizer, IMediator mediator, IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_hostEnvironment = hostEnvironment;
|
||||
_localizer = localizer;
|
||||
_mediator = mediator;
|
||||
_mediator = mediator;
|
||||
_mapper = mapper;
|
||||
_userInfo = userInfo;
|
||||
}
|
||||
@@ -1056,7 +1072,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||
}
|
||||
//处理好 用户类型 和用户类型枚举
|
||||
var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList();
|
||||
var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, t.SiteId }).ToList();
|
||||
var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, TrialSiteId= t.Id }).ToList();
|
||||
|
||||
foreach (var item in excelList)
|
||||
{
|
||||
@@ -1077,7 +1093,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||
|
||||
}
|
||||
|
||||
item.SiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).SiteId;
|
||||
item.TrialSiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).TrialSiteId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,19 +69,19 @@
|
||||
<PackageReference Include="EasyCaching.Serialization.MessagePack" Version="1.9.2">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.11" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.12" />
|
||||
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
||||
<PackageReference Include="Hangfire.SqlServer" Version="1.8.11" />
|
||||
<PackageReference Include="Hangfire.SqlServer" Version="1.8.12" />
|
||||
<PackageReference Include="Invio.Extensions.Authentication.JwtBearer" Version="2.0.1" />
|
||||
<PackageReference Include="LogDashboard" Version="1.4.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
|
||||
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="2.0.3" />
|
||||
<PackageReference Include="Serilog.Sinks.Email" Version="3.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.5.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.6.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<param name="doctorId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Api.Controllers.ExtraController.Login(IRaCIS.Application.Contracts.UserLoginDTO,EasyCaching.Core.IEasyCachingProvider,IRaCIS.Application.Services.IUserService,IRaCIS.Core.Application.Auth.ITokenService,IRaCIS.Core.Application.Contracts.IReadingImageTaskService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<member name="M:IRaCIS.Api.Controllers.ExtraController.Login(IRaCIS.Application.Contracts.UserLoginDTO,EasyCaching.Core.IEasyCachingProvider,IRaCIS.Application.Services.IUserService,IRaCIS.Core.Application.Auth.ITokenService,IRaCIS.Core.Application.Contracts.IReadingImageTaskService,Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption},IRaCIS.Application.Services.IMailVerificationService)">
|
||||
<summary> 系统用户登录接口[New] </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.Special.FinancialChangeController.AddOrUpdateTrialInspection(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionDto{IRaCIS.Application.Contracts.TrialCommand})">
|
||||
|
||||
@@ -24,9 +24,10 @@ using IRaCIS.Core.Application.Filter;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using IRaCIS.Application.Services.BackGroundJob;
|
||||
using LogDashboard;
|
||||
using OfficeOpenXml.Utils;
|
||||
using FellowOakDicom.Network;
|
||||
using IRaCIS.Core.Application.Service.ImageAndDoc;
|
||||
using IP2Region.Net.Abstractions;
|
||||
using IP2Region.Net.XDB;
|
||||
|
||||
|
||||
#region 获取环境变量
|
||||
@@ -160,7 +161,7 @@ builder.Services.AddSignalR();
|
||||
builder.Services.AddSingleton<IUserIdProvider, IRaCISUserIdProvider>();
|
||||
|
||||
|
||||
|
||||
builder.Services.AddSingleton<ISearcher>(new Searcher(CachePolicy.Content, Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, "ip2region.xdb")));
|
||||
|
||||
|
||||
#region 历史废弃配置
|
||||
|
||||
@@ -50,8 +50,8 @@ namespace IRaCIS.Core.API
|
||||
//triggerOptions.AddTrigger<AddlTrialUserTrigger>();
|
||||
triggerOptions.AddTrigger<VisitTaskIsFrontTaskNeedSignButNotSignTrigger>();
|
||||
triggerOptions.AddTrigger<VisitTaskIbeforeTrigger>();
|
||||
|
||||
|
||||
triggerOptions.AddTrigger<UserLogTrigger>();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
"OpenLoginLimit": true,
|
||||
"LoginMaxFailCount": 5,
|
||||
|
||||
"LoginFailLockMinutes": 30
|
||||
"LoginFailLockMinutes": 30,
|
||||
"AutoLoginOutMinutes": 60
|
||||
|
||||
},
|
||||
"SystemEmailSendConfig": {
|
||||
|
||||
@@ -42,7 +42,8 @@
|
||||
"OpenLoginLimit": true,
|
||||
"LoginMaxFailCount": 5,
|
||||
|
||||
"LoginFailLockMinutes": 30
|
||||
"LoginFailLockMinutes": 30,
|
||||
"AutoLoginOutMinutes": 60
|
||||
},
|
||||
|
||||
"SystemEmailSendConfig": {
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"RemoteNew": "Server=123.56.94.154,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
||||
"Hangfire": "Server=123.56.94.154,1435;Database=Test_IRC_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
|
||||
"RemoteNew": "Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
|
||||
"Hangfire": "Server=106.14.89.110,1435;Database=Test_IRC_Hangfire;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
|
||||
|
||||
},
|
||||
|
||||
@@ -59,7 +59,11 @@
|
||||
|
||||
"LoginMaxFailCount": 5,
|
||||
|
||||
"LoginFailLockMinutes": 1
|
||||
"LoginFailLockMinutes": 1,
|
||||
|
||||
"AutoLoginOutMinutes": 1,
|
||||
|
||||
"OpenLoginMFA": false
|
||||
},
|
||||
|
||||
"SystemEmailSendConfig": {
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
|
||||
"LoginMaxFailCount": 5,
|
||||
|
||||
"LoginFailLockMinutes": 30
|
||||
"LoginFailLockMinutes": 30,
|
||||
"AutoLoginOutMinutes": 60
|
||||
},
|
||||
|
||||
"SystemEmailSendConfig": {
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
"OpenLoginLimit": true,
|
||||
"LoginMaxFailCount": 5,
|
||||
|
||||
"LoginFailLockMinutes": 30
|
||||
"LoginFailLockMinutes": 30,
|
||||
"AutoLoginOutMinutes": 60
|
||||
|
||||
},
|
||||
"SystemEmailSendConfig": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"JwtSetting": {
|
||||
"SecurityKey": "SecurityKey_SHzyyl@2021",
|
||||
"SecurityKey": "ShangHaiZhanYing_SecurityKey_SHzyyl@2021",
|
||||
"Issuer": "Extimaging",
|
||||
"Audience": "EICS",
|
||||
"TokenExpireDays": "7"
|
||||
|
||||
Binary file not shown.
@@ -35,6 +35,8 @@ public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter
|
||||
|
||||
public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
|
||||
{
|
||||
var minutes = _verifyConfig.CurrentValue.AutoLoginOutMinutes;
|
||||
|
||||
if (_verifyConfig.CurrentValue.OpenLoginLimit)
|
||||
{
|
||||
if (context.ActionDescriptor.EndpointMetadata.Any(item => item is IAllowAnonymous))
|
||||
@@ -58,22 +60,45 @@ public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter
|
||||
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["LimitUser_AuthTokenMissing"]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//2、在这里取缓存 进行比较 看是否有其他人进行了登陆,如果其他人登陆了,就把之前用户挤掉
|
||||
var cacheUserToken = (await _provider.GetAsync<string>(_userInfo.Id.ToString())).Value;
|
||||
|
||||
|
||||
|
||||
//缓存中没有取到Token
|
||||
if (string.IsNullOrWhiteSpace(cacheUserToken))
|
||||
{
|
||||
cacheUserToken = _userInfo.UserToken;
|
||||
|
||||
//设置当前用户最新Token
|
||||
await _provider.SetAsync(_userInfo.Id.ToString(), _userInfo.UserToken, TimeSpan.FromDays(7));
|
||||
|
||||
cacheUserToken = _userInfo.UserToken;
|
||||
//重启应用程序,所有人续期,不一下子踢出所有人
|
||||
await _provider.SetAsync($"{_userInfo.Id.ToString()}_Online", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes));
|
||||
|
||||
}
|
||||
//是同一个人
|
||||
else if (cacheUserToken == _userInfo.UserToken)
|
||||
{
|
||||
|
||||
var cacheTime = (await _provider.GetAsync<string>($"{_userInfo.Id.ToString()}_Online")).Value;
|
||||
|
||||
//过期了 需要自动退出
|
||||
if (string.IsNullOrEmpty(cacheTime))
|
||||
{
|
||||
context.HttpContext.Response.ContentType = "application/json";
|
||||
context.HttpContext.Response.StatusCode = StatusCodes.Status403Forbidden;
|
||||
|
||||
context.Result = new JsonResult(ResponseOutput.NotOk(_localizer["LimitUser_AccountAuto_LoginOut"], ApiResponseCodeEnum.AutoLoginOut));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
await _provider.SetAsync($"{_userInfo.Id.ToString()}_Online", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), TimeSpan.FromMinutes(minutes));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
@@ -5,7 +5,6 @@ using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Magicodes.ExporterAndImporter.Excel;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MiniExcelLibs;
|
||||
@@ -14,7 +13,6 @@ using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using SkiaSharp;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
|
||||
@@ -515,18 +515,18 @@ public static class FileStoreHelper
|
||||
|
||||
// 获取 入组确认 PD 进展发送邮件Word|PDF 存放路径
|
||||
|
||||
public static (string PhysicalPath, string RelativePath, string FileRealName) GetSubjectEnrollConfirmOrPDEmailPath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid siteId, Guid subjectId,bool isChangeToPdfFormat=false)
|
||||
public static (string PhysicalPath, string RelativePath, string FileRealName) GetSubjectEnrollConfirmOrPDEmailPath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId, Guid trialSiteId, Guid subjectId,bool isChangeToPdfFormat=false)
|
||||
{
|
||||
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
|
||||
|
||||
string uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), siteId.ToString(), subjectId.ToString());
|
||||
string uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), trialSiteId.ToString(), subjectId.ToString());
|
||||
|
||||
if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath);
|
||||
|
||||
var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName, isChangeToPdfFormat);
|
||||
|
||||
|
||||
var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{siteId}/{subjectId}/{trustedFileNameForFileStorage}";
|
||||
var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{trialSiteId}/{subjectId}/{trustedFileNameForFileStorage}";
|
||||
|
||||
var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
|
||||
|
||||
@@ -541,7 +541,7 @@ public static class FileStoreHelper
|
||||
return Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), siteId.ToString(), subjectId.ToString(), subjectVisitId.ToString(), StaticData.Folder.DicomFolder);
|
||||
}
|
||||
|
||||
public static (string PhysicalPath, string RelativePath) GetDicomInstanceFilePath(IWebHostEnvironment _hostEnvironment, Guid trialId, Guid siteId, Guid subjectId, Guid subjectVisitId, Guid studyId, Guid instanceId)
|
||||
public static (string PhysicalPath, string RelativePath) GetDicomInstanceFilePath(IWebHostEnvironment _hostEnvironment, Guid trialId, Guid subjectId, Guid subjectVisitId, Guid studyId, Guid instanceId)
|
||||
{
|
||||
#region 切换存储前
|
||||
//var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
|
||||
@@ -552,7 +552,7 @@ public static class FileStoreHelper
|
||||
|
||||
//加入访视层级 和Data
|
||||
var path = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(),
|
||||
siteId.ToString(), subjectId.ToString(), subjectVisitId.ToString(), StaticData.Folder.DicomFolder, studyId.ToString());
|
||||
subjectId.ToString(), subjectVisitId.ToString(), StaticData.Folder.DicomFolder, studyId.ToString());
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
@@ -561,7 +561,7 @@ public static class FileStoreHelper
|
||||
|
||||
var physicalPath = Path.Combine(path, instanceId.ToString() );
|
||||
|
||||
var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{siteId}/{subjectId}/{subjectVisitId}/{StaticData.Folder.DicomFolder}/{studyId}/{instanceId}";
|
||||
var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{subjectId}/{subjectVisitId}/{StaticData.Folder.DicomFolder}/{studyId}/{instanceId}";
|
||||
|
||||
//var physicalPath = Path.Combine(path, instanceId.ToString() + ".dcm");
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace IRaCIS.Core.Application.Helper
|
||||
{
|
||||
@@ -96,8 +95,8 @@ namespace IRaCIS.Core.Application.Helper
|
||||
|
||||
public interface IOSSService
|
||||
{
|
||||
public Task<string> UploadToOSSAsync(Stream fileStream, string oosFolderPath, string fileRealName);
|
||||
public Task<string> UploadToOSSAsync(string localFilePath, string oosFolderPath);
|
||||
public Task<string> UploadToOSSAsync(Stream fileStream, string oosFolderPath, string fileRealName, bool isFileNameAddGuid = true);
|
||||
public Task<string> UploadToOSSAsync(string localFilePath, string oosFolderPath, bool isFileNameAddGuid = true);
|
||||
|
||||
public Task DownLoadFromOSSAsync(string ossRelativePath, string localFilePath);
|
||||
|
||||
@@ -124,12 +123,12 @@ namespace IRaCIS.Core.Application.Helper
|
||||
/// <param name="fileStream"></param>
|
||||
/// <param name="oosFolderPath"></param>
|
||||
/// <param name="fileRealName"></param>
|
||||
/// <param name="isFileNameAddGuid"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> UploadToOSSAsync(Stream fileStream, string oosFolderPath, string fileRealName)
|
||||
public async Task<string> UploadToOSSAsync(Stream fileStream, string oosFolderPath, string fileRealName, bool isFileNameAddGuid = true)
|
||||
{
|
||||
|
||||
|
||||
var ossRelativePath = $"{oosFolderPath}/{Guid.NewGuid()}_{fileRealName}";
|
||||
var ossRelativePath = isFileNameAddGuid ? $"{oosFolderPath}/{Guid.NewGuid()}_{fileRealName}" : $"{oosFolderPath}/{fileRealName}";
|
||||
//var ossRelativePath = $"{oosFolderPath}/{Guid.NewGuid()}_{fileRealName}";
|
||||
//var ossRelativePath = oosFolderPath + "/" + fileRealName;
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
@@ -207,11 +206,12 @@ namespace IRaCIS.Core.Application.Helper
|
||||
/// <param name="oosFolderPath"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||
public async Task<string> UploadToOSSAsync(string localFilePath, string oosFolderPath)
|
||||
public async Task<string> UploadToOSSAsync(string localFilePath, string oosFolderPath, bool isFileNameAddGuid = true)
|
||||
{
|
||||
var localFileName = Path.GetFileName(localFilePath);
|
||||
|
||||
var ossRelativePath = $"{oosFolderPath}/{Guid.NewGuid()}_{localFileName}";
|
||||
var ossRelativePath = isFileNameAddGuid ? $"{oosFolderPath}/{Guid.NewGuid()}_{localFileName}" : $"{oosFolderPath}/{localFileName}";
|
||||
|
||||
|
||||
//var ossRelativePath = oosFolderPath + "/" + localFileName;
|
||||
|
||||
@@ -266,6 +266,7 @@ namespace IRaCIS.Core.Application.Helper
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task DownLoadFromOSSAsync(string ossRelativePath, string localFilePath)
|
||||
{
|
||||
|
||||
|
||||
@@ -65,44 +65,43 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
|
||||
<PackageReference Include="FreeSpire.Doc" Version="12.2.0" />
|
||||
<PackageReference Include="Hangfire.Core" Version="1.8.11" />
|
||||
<PackageReference Include="Hangfire.Core" Version="1.8.12" />
|
||||
<PackageReference Include="BeetleX.BNR" Version="1.0.1" />
|
||||
<PackageReference Include="Castle.Core.AsyncInterceptor" Version="2.1.0" />
|
||||
<PackageReference Include="EasyCaching.Redis" Version="1.9.2" />
|
||||
<PackageReference Include="EasyCaching.InMemory" Version="1.9.2" />
|
||||
<PackageReference Include="ExcelDataReader" Version="3.6.0" />
|
||||
<PackageReference Include="ExcelDataReader.DataSet" Version="3.6.0" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.2" />
|
||||
<PackageReference Include="DistributedLock.SqlServer" Version="1.0.3" />
|
||||
<PackageReference Include="DistributedLock.Redis" Version="1.0.3" />
|
||||
<PackageReference Include="DistributedLock.SqlServer" Version="1.0.4" />
|
||||
<PackageReference Include="fo-dicom" Version="5.1.2" />
|
||||
<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.1.2" />
|
||||
<PackageReference Include="fo-dicom.Codecs" Version="5.12.0" />
|
||||
<PackageReference Include="Magicodes.IE.Core" Version="2.7.5.1" />
|
||||
<PackageReference Include="Magicodes.IE.Csv" Version="2.7.5.1">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Magicodes.IE.Excel" Version="2.7.5.1">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Magicodes.IE.Excel.AspNetCore" Version="2.7.5.1" />
|
||||
<PackageReference Include="MailKit" Version="4.4.0" />
|
||||
<PackageReference Include="IP2Region.Net" Version="2.0.2" />
|
||||
<PackageReference Include="MailKit" Version="4.5.0" />
|
||||
<PackageReference Include="MediatR" Version="12.2.0" />
|
||||
<PackageReference Include="MimeKit" Version="4.4.0" />
|
||||
<PackageReference Include="MiniExcel" Version="1.31.3" />
|
||||
<PackageReference Include="MimeKit" Version="4.5.0" />
|
||||
<PackageReference Include="MiniExcel" Version="1.32.0" />
|
||||
<PackageReference Include="Minio" Version="6.0.2" />
|
||||
<PackageReference Include="MiniWord" Version="0.8.0" />
|
||||
<PackageReference Include="My.Extensions.Localization.Json" Version="3.2.0">
|
||||
<PackageReference Include="My.Extensions.Localization.Json" Version="3.3.0">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NPOI" Version="2.6.2" />
|
||||
<PackageReference Include="Panda.DynamicWebApi" Version="1.2.1" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.1" />
|
||||
<PackageReference Include="WinSCP" Version="6.3.2" />
|
||||
<PackageReference Include="NPOI" Version="2.7.0" />
|
||||
<PackageReference Include="Panda.DynamicWebApi" Version="1.2.2" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
|
||||
<PackageReference Include="WinSCP" Version="6.3.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\IRaCIS.Core.Infra.EFCore\IRaCIS.Core.Infra.EFCore.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Resources\ip2region.xdb">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -84,16 +84,17 @@
|
||||
<param name="type"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Helper.OSSService.UploadToOSSAsync(System.IO.Stream,System.String,System.String)">
|
||||
<member name="M:IRaCIS.Core.Application.Helper.OSSService.UploadToOSSAsync(System.IO.Stream,System.String,System.String,System.Boolean)">
|
||||
<summary>
|
||||
oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder
|
||||
</summary>
|
||||
<param name="fileStream"></param>
|
||||
<param name="oosFolderPath"></param>
|
||||
<param name="fileRealName"></param>
|
||||
<param name="isFileNameAddGuid"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Helper.OSSService.UploadToOSSAsync(System.String,System.String)">
|
||||
<member name="M:IRaCIS.Core.Application.Helper.OSSService.UploadToOSSAsync(System.String,System.String,System.Boolean)">
|
||||
<summary>
|
||||
oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder
|
||||
</summary>
|
||||
@@ -852,6 +853,42 @@
|
||||
后台托管服务的方式运行
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.DownloadAndUploadService.SubejctRandomReadingTaskNameDeal(System.Guid,System.Guid)">
|
||||
<summary>
|
||||
受试者随机阅片,任务进行随机编号
|
||||
进入阅片任务前,随机挑选出该受试者的一个任务,然后给该任务一个编号,编号给的逻辑是:TimePoint Ran+ 已阅任务数量+1
|
||||
根据当前受试者该标准已阅任务数量(生效失效的任务都算,考虑重阅,最后编号不重复) 第一个就是TimePoint Ran1,后面依次随机挑选出来的阅片序号依次递增
|
||||
</summary>
|
||||
<param name="subjectId"></param>
|
||||
<param name="trialReadingCriterionId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.DownloadAndUploadService.GetSubjectImageUploadList(System.Guid,System.Guid)">
|
||||
<summary>
|
||||
获取该受试者任务上传列表(展示已上传情况)
|
||||
</summary>
|
||||
<param name="subjectId"></param>
|
||||
<param name="trialReadingCriterionId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.DownloadAndUploadService.RequestPackageAndAnonymizImage(System.Guid,System.Guid,System.Boolean)">
|
||||
<summary>
|
||||
打包和匿名化影像 默认是匿名化打包,也可以不匿名化打包
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<param name="subjectVisitId"></param>
|
||||
<param name="isAnonymize"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.DownloadAndUploadService.PackageAndAnonymizImage(System.Guid,System.Guid,System.Boolean)">
|
||||
<summary>
|
||||
后台任务调用,前端忽略该接口
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<param name="subjectVisitId"></param>
|
||||
<param name="isAnonymize"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.Preview(System.Guid)">
|
||||
<summary> 指定资源Id,渲染Dicom检查的Jpeg预览图像 </summary>
|
||||
<param name="studyId"> Dicom检查的Id </param>
|
||||
@@ -1010,7 +1047,7 @@
|
||||
项目iD
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.SiteId">
|
||||
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.TrialSiteId">
|
||||
<summary>
|
||||
中心
|
||||
</summary>
|
||||
@@ -1144,7 +1181,7 @@
|
||||
<param name="currentInspectionId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.FrontAuditConfigService.SetDataInspectionDateType(System.Collections.Generic.List{System.String},System.String)">
|
||||
<member name="M:IRaCIS.Core.Application.Service.FrontAuditConfigService.SetDataInspectionDateType(System.Collections.Generic.List{System.String},System.String,System.String)">
|
||||
<summary>
|
||||
格式化日期和时间
|
||||
</summary>
|
||||
@@ -1152,7 +1189,7 @@
|
||||
<param name="jsonStr"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.FrontAuditConfigService.GetInspectionEnumValue(System.Collections.Generic.List{System.String},System.String)">
|
||||
<member name="M:IRaCIS.Core.Application.Service.FrontAuditConfigService.GetInspectionEnumValue(System.Collections.Generic.List{System.String},System.String,System.String)">
|
||||
<summary>
|
||||
获取外键表数据
|
||||
</summary>
|
||||
@@ -1160,7 +1197,7 @@
|
||||
<param name="jsonStr"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.FrontAuditConfigService.SetEnum(System.Guid,System.Collections.Generic.List{System.String},System.String)">
|
||||
<member name="M:IRaCIS.Core.Application.Service.FrontAuditConfigService.SetEnum(System.Guid,System.Collections.Generic.List{System.String},System.String,System.String)">
|
||||
<summary>
|
||||
获取枚举
|
||||
</summary>
|
||||
@@ -3200,6 +3237,20 @@
|
||||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ClinicalAnswerService.DeleteStudyClinical(IRaCIS.Core.Application.Service.Reading.Dto.DeleteStudyClinicalInDto)">
|
||||
<summary>
|
||||
删除检查级别临床数据
|
||||
</summary>
|
||||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ClinicalAnswerService.AddStudyClinical(IRaCIS.Core.Application.Service.Reading.Dto.AddStudyClinicalInDto)">
|
||||
<summary>
|
||||
添加检查级别临床数据
|
||||
</summary>
|
||||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ClinicalAnswerService.AutoAddCRCClinical(IRaCIS.Core.Application.Service.Reading.Dto.AutoAddClinicalInDto)">
|
||||
<summary>
|
||||
自动添加CRC临床数据 (不包括检查级别)
|
||||
@@ -5591,6 +5642,16 @@
|
||||
是否是转变的任务(转为IRECIST)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GlobalQuestionInfo.JudgeDifferenceValue">
|
||||
<summary>
|
||||
裁判百分比或绝对值的相差值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GlobalQuestionInfo.JudgeDifferenceType">
|
||||
<summary>
|
||||
裁判百分比或绝对值的相差值匹配规则
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GlobalQuestionInfo.QuestionType">
|
||||
<summary>
|
||||
问题类型
|
||||
@@ -5696,6 +5757,31 @@
|
||||
标准
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SetTrialCriterionJudgeQuestionAnswerGroupInDto.JudgeDifferenceValue">
|
||||
<summary>
|
||||
裁判百分比或绝对值的相差值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SetTrialCriterionJudgeQuestionAnswerGroupInDto.JudgeDifferenceType">
|
||||
<summary>
|
||||
裁判百分比或绝对值的相差值匹配规则
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetTrialCriterionJudgeQuestionListOutDto.JudgeDifferenceValue">
|
||||
<summary>
|
||||
裁判百分比或绝对值的相差值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetTrialCriterionJudgeQuestionListOutDto.Type">
|
||||
<summary>
|
||||
类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetTrialCriterionJudgeQuestionListOutDto.JudgeDifferenceType">
|
||||
<summary>
|
||||
裁判百分比或绝对值的相差值匹配规则
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GetTrialCriterionJudgeQuestionListOutDto.QuestionGenre">
|
||||
<summary>
|
||||
问题类型
|
||||
@@ -5806,6 +5892,26 @@
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GroupTaskAnswerDto.JudgeDifferenceValue">
|
||||
<summary>
|
||||
裁判百分比或绝对值的相差值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.GroupTaskAnswerDto.JudgeDifferenceType">
|
||||
<summary>
|
||||
裁判百分比或绝对值的相差值匹配规则
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TaskAnswerDto.JudgeDifferenceValue">
|
||||
<summary>
|
||||
裁判百分比或绝对值的相差值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TaskAnswerDto.JudgeDifferenceType">
|
||||
<summary>
|
||||
裁判百分比或绝对值的相差值匹配规则
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TableQuestionDataInfo.Id">
|
||||
<summary>
|
||||
|
||||
@@ -6976,6 +7082,11 @@
|
||||
自定义计算标记
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionTrialAddOrEdit.TrialId">
|
||||
<summary>
|
||||
TrialId
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionTrialAddOrEdit.IsDepend">
|
||||
<summary>
|
||||
IsDepend
|
||||
@@ -10820,22 +10931,6 @@
|
||||
<param name="trialId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Contracts.LesionInformation.TUTESTCD">
|
||||
<summary>
|
||||
检查项目
|
||||
TUMIDENT (Tumor Identification )
|
||||
TUSPLIT (Tumor Split )
|
||||
TUMERGE (Tumor Merged)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Contracts.IReportService.AddLesion(System.Collections.Generic.List{IRaCIS.Core.Application.Contracts.LesionInformation},IRaCIS.Core.Application.Contracts.ReportDTO)">
|
||||
<summary> 添加基线期病灶标识及测量信息 </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Contracts.IReportService.GetVisitLineLesion(System.String,System.String,System.Decimal,System.String)">
|
||||
<summary>
|
||||
获取访视病灶信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Core.Application.Contracts.TrialSiteEquipmentSurveyView">
|
||||
<summary> TrialSiteEquipmentSurveyView 列表视图模型 </summary>
|
||||
</member>
|
||||
@@ -12520,6 +12615,12 @@
|
||||
<param name="addOrEditBasic"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.DictionaryService.GetAllDictionaryKey">
|
||||
<summary>
|
||||
获取所有字典的Key
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.DictionaryService.AddBasicDicAndChild(IRaCIS.Application.Contracts.AddBasicDicAndChild)">
|
||||
<summary>
|
||||
添加字典 的同时 一起添加子项 --New
|
||||
@@ -13005,7 +13106,7 @@
|
||||
<member name="M:IRaCIS.Application.Services.CroService.GetCroList(IRaCIS.Application.Contracts.CROCompanyQueryDTO)">
|
||||
<summary> 分页获取CRO列表 </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.CroService.GetAllCROList">
|
||||
<member name="M:IRaCIS.Application.Services.CroService.GetAllCROList(System.Nullable{System.Guid})">
|
||||
<summary> 根据CRO 名称查询所有CRO 列表 </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.CroService.AddOrUpdateCro(IRaCIS.Application.Contracts.CROCompanyDTO)">
|
||||
@@ -13038,7 +13139,7 @@
|
||||
<member name="M:IRaCIS.Application.Services.SponsorService.GetSponsorList(IRaCIS.Application.Contracts.SponsorQueryDTO)">
|
||||
<summary> 分页获取申办方列表 </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.SponsorService.GetAllSponsorList">
|
||||
<member name="M:IRaCIS.Application.Services.SponsorService.GetAllSponsorList(System.Nullable{System.Guid})">
|
||||
<summary> 分页获取申办方列表 </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.SponsorService.AddOrUpdateSponsor(IRaCIS.Application.Contracts.SponsorCommand)">
|
||||
@@ -13164,6 +13265,22 @@
|
||||
<param name="state"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.UserService.SendMFAEmail(System.Guid)">
|
||||
<summary>
|
||||
发送MFA 验证邮件
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.UserService.VerifyMFACodeAsync(System.Guid,System.String)">
|
||||
<summary>
|
||||
验证MFA 邮件
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<param name="Code"></param>
|
||||
<returns></returns>
|
||||
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.UserService.Login(System.String,System.String)">
|
||||
<summary>
|
||||
用户登陆
|
||||
@@ -13260,6 +13377,13 @@
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ReadingClinicalDataService.GetStudyClinicalData(IRaCIS.Core.Application.Service.Reading.Dto.GetStudyClinicalDataInDto)">
|
||||
<summary>
|
||||
获取检查类型临床数据
|
||||
</summary>
|
||||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ReadingClinicalDataService.GetCRCClinicalData(IRaCIS.Core.Application.Service.Reading.Dto.GetCRCClinicalDataInDto)">
|
||||
<summary>
|
||||
获取CRC上传的文件
|
||||
@@ -14499,6 +14623,16 @@
|
||||
标准类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Application.Contracts.UserBasicInfo.LastLoginIP">
|
||||
<summary>
|
||||
LastLoginIP
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Application.Contracts.UserBasicInfo.LastChangePassWordTime">
|
||||
<summary>
|
||||
上一次修改密码的时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Application.Contracts.UserAddedReturnDTO">
|
||||
<summary>
|
||||
添加用户是的返回模型
|
||||
|
||||
Binary file not shown.
@@ -1,37 +0,0 @@
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ViewModel
|
||||
{
|
||||
public class AllocationVisitViewModel
|
||||
{
|
||||
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public string BlindName { get; set; } = string.Empty;
|
||||
|
||||
public decimal VisitNum { get; set; }
|
||||
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
public String TrialSiteCode { get; set; } = String.Empty;
|
||||
public string SubjectCode { get; set; } = String.Empty;
|
||||
|
||||
public string VisitName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? CheckPassedTime { get; set; }
|
||||
|
||||
public bool IsUrgent { get; set; }
|
||||
|
||||
|
||||
public ReadingCategory ReadingCategoryEnum { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public class ConsistentCommonView
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public String TrialSiteCode { get; set; }
|
||||
public string SubjectCode { get; set; }
|
||||
@@ -200,31 +200,12 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
}
|
||||
|
||||
|
||||
//public class DoctorConsistentRuleSubjectView
|
||||
//{
|
||||
// public Guid TrialId => VisitTaskList.Select(t => t.TrialId).First();
|
||||
// public Guid SiteId => VisitTaskList.Select(t => t.SiteId).First();
|
||||
|
||||
// public String TrialSiteCode => VisitTaskList.Select(t => t.TrialSiteCode).First();
|
||||
// public string SubjectCode => VisitTaskList.Select(t => t.SubjectCode).First();
|
||||
|
||||
// public Guid SubjectId { get; set; }
|
||||
|
||||
// public bool IsHaveGeneratedTask { get; set; }
|
||||
// public int? ValidTaskCount { get; set; }
|
||||
|
||||
// public int? ValidVisitCount => VisitTaskList.Select(t => t.TaskName).Distinct().Count();
|
||||
|
||||
// public List<VisitTaskSimpleView> VisitTaskList { get; set; }
|
||||
|
||||
// //public List<UserSimpleInfo> HistoryDoctorUserList => VisitTaskList.SelectMany(t => t.RelationDoctorUserList).DistinctBy(t=>t.UserId).ToList();
|
||||
//}
|
||||
|
||||
public class InfluenceTaskInfo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
@@ -267,7 +248,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
|
||||
public Guid VisitTaskId { get; set; }
|
||||
public string MedicalNo { get; set; } = string.Empty;
|
||||
|
||||
public int AuditState { get; set; }
|
||||
public DateTime? AuditSignTime { get; set; }
|
||||
@@ -54,7 +53,6 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
//开始读片时间
|
||||
public DateTime? FirstReadingTime { get; set; }
|
||||
|
||||
public string MedicalNo { get; set; } = string.Empty;
|
||||
|
||||
//读片时间差
|
||||
public TimeSpan? ReadingDurationTimeSpan { get; set; }
|
||||
@@ -95,7 +93,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public class TaskMedicalReviewQuery : PageInput
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 传了Id
|
||||
@@ -136,7 +134,19 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public Guid? TrialReadingCriterionId { get; set; }
|
||||
|
||||
public MedicalReviewDoctorUserIdea? DoctorUserIdeaEnum { get; set; }
|
||||
}
|
||||
|
||||
public Arm? ArmEnum { get; set; }
|
||||
|
||||
public DateTime? BeginAuditSignTime { get; set; }
|
||||
public DateTime? EndAuditSignTime { get; set; }
|
||||
|
||||
public bool? IsEffect { get; set; }
|
||||
public bool? IsHaveQuestion { get; set; }
|
||||
|
||||
|
||||
public DateTime? BeginAllocateDate { get; set; }
|
||||
public DateTime? EndAllocateDate { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class SetMedicalReviewInvalidCommand
|
||||
|
||||
@@ -54,10 +54,16 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public Guid UpdateUserId { get; set; }
|
||||
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public string BlindTrialSiteCode { get; set; }
|
||||
public String TrialSiteCode { get; set; } = String.Empty;
|
||||
public string SubjectCode { get; set; } = String.Empty;
|
||||
|
||||
public string MedicalNo { get; set; } = string.Empty;
|
||||
|
||||
public string BlindSubjectCode { get; set; } = string.Empty;
|
||||
|
||||
public bool IsPMSetBack { get; set; }
|
||||
|
||||
#region 标准配置
|
||||
@@ -86,7 +92,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
/// <summary>
|
||||
/// 任务展示访视 读片任务显示是否顺序
|
||||
/// </summary>
|
||||
public bool IsReadingTaskViewInOrder { get; set; } = true;
|
||||
public ReadingOrder IsReadingTaskViewInOrder { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -150,7 +156,18 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
|
||||
public bool IsCanEditUrgentState { get; set; }
|
||||
|
||||
public DateTime? FirstReadingTime { get;set; }
|
||||
|
||||
public string ReadingDuration
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!SignTime.HasValue)
|
||||
return "";
|
||||
else return string.Format("{0}h:{1}m:{2}s", (SignTime - FirstReadingTime)?.Hours, (SignTime - FirstReadingTime)?.Minutes, (SignTime - FirstReadingTime)?.Seconds)
|
||||
/*string.Format("{0}分钟", (ReadingDurationTimeSpan)?.TotalMinutes)*/;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UserSimpleInfo
|
||||
@@ -356,8 +373,10 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public class GetOrderReadingIQueryableInDto
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
|
||||
public string? SubjectCode { get; set; } = null;
|
||||
|
||||
@@ -371,7 +390,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
@@ -393,11 +412,16 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
|
||||
public DateTime? EndAllocateDate { get; set; }
|
||||
|
||||
public DateTime? BeginSignTime { get; set; }
|
||||
|
||||
|
||||
public DateTime? BeginSignTime { get; set; }
|
||||
|
||||
public DateTime? EndSignTime { get; set; }
|
||||
|
||||
public Guid? RootReReadingTaskId { get; set; }
|
||||
public DateTime? BeginRequestReReadingTime { get; set; }
|
||||
public DateTime? EndRequestReReadingTime { get; set; }
|
||||
|
||||
public Guid? RootReReadingTaskId { get; set; }
|
||||
|
||||
public string? TaskCode { get; set; }
|
||||
|
||||
@@ -418,6 +442,10 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
|
||||
public RequestReReadingResult? RequestReReadingResultEnum { get; set; }
|
||||
|
||||
|
||||
public bool? IsEffect { get; set; }
|
||||
|
||||
public string? RequestReReadingReason { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -473,7 +501,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
@@ -495,7 +523,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
@@ -538,7 +566,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public class SubjectAssignStat
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
@@ -618,7 +646,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public class SubjectAssignView
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
|
||||
@@ -116,9 +116,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
// return ResponseOutput.Ok();
|
||||
//}
|
||||
|
||||
public async Task<List<SubjectCancelDoctorView>> GetSubjectCancelDoctorHistoryList(Guid subjectId)
|
||||
public async Task<List<SubjectCancelDoctorView>> GetSubjectCancelDoctorHistoryList(Guid subjectId,Guid trialReadingCriterionId)
|
||||
{
|
||||
var list = await _subjectCanceDoctorRepository.Where(t => t.SubjectId == subjectId).ProjectTo<SubjectCancelDoctorView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var list = await _subjectCanceDoctorRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId==trialReadingCriterionId).ProjectTo<SubjectCancelDoctorView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -87,14 +87,14 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <param name="queryVisitTask"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput<PageOutput<AnalysisTaskView>>> GetAnalysisTaskList(VisitTaskQuery queryVisitTask)
|
||||
public async Task<IResponseOutput<PageOutput<AnalysisTaskView>>> GetAnalysisTaskList(VisitTaskQuery queryVisitTask )
|
||||
{
|
||||
var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId)
|
||||
.Where(t => t.IsAnalysisCreate)
|
||||
|
||||
.WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId)
|
||||
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
@@ -104,11 +104,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
||||
.WhereIf(queryVisitTask.IsSelfAnalysis != null, t => t.IsSelfAnalysis == queryVisitTask.IsSelfAnalysis)
|
||||
.WhereIf(queryVisitTask.ArmEnum != null, t => t.ArmEnum == queryVisitTask.ArmEnum)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) || (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate == false))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => /*(t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.IsAnalysisCreate) ||*/ (t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) /*&& t.IsAnalysisCreate == false*/))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate))
|
||||
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
|
||||
.WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => ((t.Subject.Code.Contains(queryVisitTask.SubjectCode)||t.Subject.MedicalNo.Contains(queryVisitTask.SubjectCode)) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate))
|
||||
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime >= queryVisitTask.BeginAllocateDate)
|
||||
.WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime <= queryVisitTask.EndAllocateDate)
|
||||
.WhereIf(queryVisitTask.BeginSignTime != null, t => t.SignTime >= queryVisitTask.BeginSignTime)
|
||||
.WhereIf(queryVisitTask.EndSignTime != null, t => t.SignTime <= queryVisitTask.EndSignTime)
|
||||
.ProjectTo<AnalysisTaskView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId), nameof(VisitTask.VisitTaskNum) };
|
||||
@@ -558,7 +560,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
var query = subjectQuery.Select(t => new DoctorSelfConsistentSubjectView()
|
||||
{
|
||||
TrialId = t.TrialId,
|
||||
SiteId = t.SiteId,
|
||||
TrialSiteId = t.TrialSiteId,
|
||||
SubjectCode = t.Code,
|
||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
SubjectId = t.Id,
|
||||
@@ -685,7 +687,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
var query = subjectQuery.Select(t => new DoctorGroupConsistentSubjectView()
|
||||
{
|
||||
TrialId = t.TrialId,
|
||||
SiteId = t.SiteId,
|
||||
TrialSiteId = t.TrialSiteId,
|
||||
SubjectCode = t.Code,
|
||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
SubjectId = t.Id,
|
||||
|
||||
@@ -55,28 +55,39 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
var taskMedicalReviewQueryable = _taskMedicalReviewRepository.Where(t => t.VisitTask.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.SiteId != null, t => t.VisitTask.Subject.SiteId == inQuery.SiteId)
|
||||
|
||||
.WhereIf(inQuery.IsEffect == true, t => t.VisitTask.TaskState == TaskState.Effect || t.VisitTask.TaskState == TaskState.Freeze)
|
||||
.WhereIf(inQuery.IsEffect == false, t => t.VisitTask.TaskState == TaskState.Adbandon || t.VisitTask.TaskState == TaskState.HaveReturned)
|
||||
|
||||
.WhereIf(inQuery.TrialSiteId != null, t => t.VisitTask.Subject.TrialSiteId == inQuery.TrialSiteId)
|
||||
.WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId)
|
||||
.WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode) || t.VisitTask.Subject.MedicalNo.Contains(inQuery.SubjectCode))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName))
|
||||
.WhereIf(inQuery.IsUrgent != null, t => t.VisitTask.IsUrgent == inQuery.IsUrgent)
|
||||
.WhereIf(inQuery.DoctorUserId != null, t => t.VisitTask.DoctorUserId == inQuery.DoctorUserId)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteCode), t => (t.VisitTask.BlindTrialSiteCode.Contains(inQuery.TrialSiteCode) && t.VisitTask.IsAnalysisCreate) || (t.VisitTask.Subject.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode) && t.VisitTask.IsAnalysisCreate == false))
|
||||
.WhereIf(inQuery.ReadingCategory != null, t => t.VisitTask.ReadingCategory == inQuery.ReadingCategory)
|
||||
.WhereIf(inQuery.TaskState != null, t => t.VisitTask.TaskState == inQuery.TaskState)
|
||||
.WhereIf(inQuery.ArmEnum != null, t => t.VisitTask.ArmEnum == inQuery.ArmEnum)
|
||||
.WhereIf(inQuery.AuditState != null, t => t.AuditState == inQuery.AuditState)
|
||||
.WhereIf(inQuery.MedicalManagerUserId != null, t => t.MedicalManagerUserId == inQuery.MedicalManagerUserId)
|
||||
.WhereIf(inQuery.BeginSignTime != null, t => t.VisitTask.SignTime > inQuery.BeginSignTime)
|
||||
.WhereIf(inQuery.EndSignTime != null, t => t.VisitTask.SignTime < inQuery.EndSignTime!.Value.AddDays(1))
|
||||
.WhereIf(inQuery.AuditAdviceEnum != null, t => t.AuditAdviceEnum == inQuery.AuditAdviceEnum)
|
||||
.WhereIf(inQuery.MedicalManagerUserId != null, t => t.MedicalManagerUserId == inQuery.MedicalManagerUserId)
|
||||
.WhereIf(inQuery.BeginSignTime != null, t => t.VisitTask.SignTime > inQuery.BeginSignTime)
|
||||
.WhereIf(inQuery.EndSignTime != null, t => t.VisitTask.SignTime < inQuery.EndSignTime)
|
||||
.WhereIf(inQuery.AuditAdviceEnum != null, t => t.AuditAdviceEnum == inQuery.AuditAdviceEnum)
|
||||
|
||||
.WhereIf(inQuery.DoctorUserIdeaEnum != null, t => t.DoctorUserIdeaEnum == inQuery.DoctorUserIdeaEnum)
|
||||
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
|
||||
.OrderBy(x => x.AuditState).ThenBy(x => x.VisitTask.SubjectId).ThenBy(x => x.VisitTask.ArmEnum).ThenBy(x => x.VisitTask.VisitTaskNum)
|
||||
.WhereIf(inQuery.DoctorUserIdeaEnum != null, t => t.DoctorUserIdeaEnum == inQuery.DoctorUserIdeaEnum)
|
||||
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
|
||||
.WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid)
|
||||
.WhereIf(inQuery.IsHaveQuestion != null, t => t.IsHaveQuestion == inQuery.IsHaveQuestion)
|
||||
|
||||
.WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime >= inQuery.BeginAllocateDate)
|
||||
.WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime <= inQuery.EndAllocateDate)
|
||||
.WhereIf(inQuery.BeginAuditSignTime != null, t => t.AuditSignTime >= inQuery.BeginAuditSignTime)
|
||||
.WhereIf(inQuery.EndAuditSignTime != null, t => t.AuditSignTime <= inQuery.EndAuditSignTime)
|
||||
.ProjectTo<TaskMedicalReviewView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, new string[] { });
|
||||
var defalutSortArray = new string[] { nameof(TaskMedicalReviewView.AuditState), nameof(TaskMedicalReviewView.SubjectId), nameof(TaskMedicalReviewView.ArmEnum) , nameof(TaskMedicalReviewView.VisitTaskNum) };
|
||||
var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
@@ -93,22 +104,25 @@ namespace IRaCIS.Core.Application.Service
|
||||
var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId)
|
||||
.Where(t => t.IsAnalysisCreate == false && (t.TaskState == TaskState.Effect||t.TaskState==TaskState.Freeze) && t.ReadingTaskState == ReadingTaskState.HaveSigned)
|
||||
|
||||
.WhereIf(inQuery.SiteId != null, t => t.Subject.SiteId == inQuery.SiteId)
|
||||
.WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId)
|
||||
.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId)
|
||||
.WhereIf(inQuery.IsUrgent != null, t => t.IsUrgent == inQuery.IsUrgent)
|
||||
.WhereIf(inQuery.DoctorUserId != null, t => t.DoctorUserId == inQuery.DoctorUserId)
|
||||
.WhereIf(inQuery.ReadingCategory != null, t => t.ReadingCategory == inQuery.ReadingCategory)
|
||||
.WhereIf(inQuery.ReadingTaskState != null, t => t.ReadingTaskState == inQuery.ReadingTaskState)
|
||||
.WhereIf(inQuery.IsGeneratedJudge != null, t => t.JudgeVisitTaskId != null)
|
||||
.WhereIf(inQuery.IsGlobalHaveUpdate != null, t => t.IsGlobalHaveUpdate == inQuery.IsGlobalHaveUpdate)
|
||||
.WhereIf(inQuery.IsGlobalHaveUpdate != null, t => t.IsGlobalHaveUpdate == inQuery.IsGlobalHaveUpdate)
|
||||
.WhereIf(inQuery.ArmEnum != null, t => t.ArmEnum == inQuery.ArmEnum)
|
||||
|
||||
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.TaskName.Contains(inQuery.TaskName) || t.TaskBlindName.Contains(inQuery.TaskName))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode))
|
||||
|
||||
.WhereIf(inQuery.BeginSignTime != null, t => t.SignTime > inQuery.BeginSignTime)
|
||||
.WhereIf(inQuery.EndSignTime != null, t => t.SignTime < inQuery.EndSignTime)
|
||||
.ProjectTo<GenerateMedicalReviewTaskView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var defalutSortArray = new string[] { nameof(TaskMedicalReviewView.IsUrgent) + " desc", nameof(TaskMedicalReviewView.SubjectId) };
|
||||
var defalutSortArray = new string[] { nameof(GenerateMedicalReviewTaskView.IsUrgent) + " desc", nameof(GenerateMedicalReviewTaskView.SubjectId) };
|
||||
var pageList = await visitTaskQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray);
|
||||
|
||||
|
||||
@@ -218,23 +232,35 @@ namespace IRaCIS.Core.Application.Service
|
||||
||x.Id == inQuery.Id // 这里必须找传入id 因为要找到这条的索引 获取下一条
|
||||
)
|
||||
.WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId)
|
||||
.WhereIf(inQuery.SiteId != null, t => t.VisitTask.Subject.SiteId == inQuery.SiteId)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode))
|
||||
.WhereIf(inQuery.TrialSiteId != null, t => t.VisitTask.Subject.TrialSiteId == inQuery.TrialSiteId)
|
||||
.WhereIf(inQuery.IsUrgent != null, t => t.VisitTask.IsUrgent == inQuery.IsUrgent)
|
||||
.WhereIf(inQuery.AuditState != null, t => t.AuditState == inQuery.AuditState)
|
||||
.WhereIf(inQuery.DoctorUserIdeaEnum != null, t => t.DoctorUserIdeaEnum == inQuery.DoctorUserIdeaEnum)
|
||||
.WhereIf(inQuery.TaskState != null, t => t.VisitTask.TaskState == inQuery.TaskState)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode) || t.VisitTask.Subject.MedicalNo.Contains(inQuery.SubjectCode))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName))
|
||||
.WhereIf(inQuery.DoctorUserId != null, t => t.VisitTask.DoctorUserId == inQuery.DoctorUserId)
|
||||
.WhereIf(inQuery.ReadingCategory != null, t => t.VisitTask.ReadingCategory == inQuery.ReadingCategory)
|
||||
.WhereIf(inQuery.ReadingTaskState != null, t => t.VisitTask.ReadingTaskState == inQuery.ReadingTaskState)
|
||||
.WhereIf(inQuery.IsInvalid != null, t => t.IsInvalid == inQuery.IsInvalid)
|
||||
.WhereIf(inQuery.IsGetBeRead,x=>!x.IsInvalid&&x.AuditState!= MedicalReviewAuditState.HaveSigned)
|
||||
.WhereIf(inQuery.TrialReadingCriterionId != null, t => t.VisitTask.TrialReadingCriterionId == inQuery.TrialReadingCriterionId)
|
||||
.OrderBy(x=>x.VisitTask.SubjectId).ThenBy(x=>x.VisitTask.ArmEnum).ThenBy(x=>x.VisitTask.VisitTaskNum)
|
||||
.ProjectTo<TaskMedicalReviewView>(_mapper.ConfigurationProvider);
|
||||
|
||||
.WhereIf(inQuery.BeginAuditSignTime != null, t => t.AuditSignTime >= inQuery.BeginAuditSignTime)
|
||||
.WhereIf(inQuery.EndAuditSignTime != null, t => t.AuditSignTime <= inQuery.EndAuditSignTime)
|
||||
.WhereIf(inQuery.BeginAllocateDate != null, t => t.AllocateTime >= inQuery.BeginAllocateDate)
|
||||
.WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime <= inQuery.EndAllocateDate)
|
||||
|
||||
var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize,new string[] { } );
|
||||
.WhereIf(inQuery.ArmEnum != null, t => t.VisitTask.ArmEnum == inQuery.ArmEnum)
|
||||
.WhereIf(inQuery.MedicalManagerUserId != null, t => t.MedicalManagerUserId == inQuery.MedicalManagerUserId)
|
||||
.WhereIf(inQuery.BeginSignTime != null, t => t.VisitTask.SignTime > inQuery.BeginSignTime)
|
||||
.WhereIf(inQuery.EndSignTime != null, t => t.VisitTask.SignTime < inQuery.EndSignTime)
|
||||
.WhereIf(inQuery.AuditAdviceEnum != null, t => t.AuditAdviceEnum == inQuery.AuditAdviceEnum)
|
||||
.WhereIf(inQuery.IsHaveQuestion != null, t => t.IsHaveQuestion == inQuery.IsHaveQuestion)
|
||||
.ProjectTo<TaskMedicalReviewView>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
||||
var defalutSortArray = new string[] { nameof(TaskMedicalReviewView.AuditState), nameof(TaskMedicalReviewView.SubjectId), nameof(TaskMedicalReviewView.ArmEnum), nameof(TaskMedicalReviewView.VisitTaskNum) };
|
||||
var pageList = await taskMedicalReviewQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc, string.IsNullOrWhiteSpace(inQuery.SortField), defalutSortArray);
|
||||
|
||||
return ResponseOutput.Ok(pageList, new
|
||||
{
|
||||
|
||||
@@ -40,8 +40,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
private readonly IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository;
|
||||
private readonly IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository;
|
||||
private readonly IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository;
|
||||
private readonly IRepository<ReadingOncologyTaskInfo> _readingOncologyTaskInfoRepository;
|
||||
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
|
||||
private readonly IRepository<ReadingOncologyTaskInfo> _readingOncologyTaskInfoRepository;
|
||||
private readonly IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository;
|
||||
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IUserInfo _userInfo;
|
||||
@@ -61,8 +61,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository,
|
||||
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
|
||||
IRepository<ReadingTableQuestionAnswer> readingTableQuestionAnswerRepository,
|
||||
IRepository<ReadingOncologyTaskInfo> ReadingOncologyTaskInfoRepository,
|
||||
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
|
||||
IRepository<ReadingOncologyTaskInfo> ReadingOncologyTaskInfoRepository,
|
||||
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,
|
||||
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository,
|
||||
IRepository<ReadingJudgeInfo> readingJudgeInfoRepository,
|
||||
IRepository<TaskAllocationRule> taskAllocationRuleRepository, IMapper mapper, IUserInfo userInfo, IRepository<VisitTaskReReading> visitTaskReReadingRepository,
|
||||
@@ -78,8 +78,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
this._readingTaskQuestionAnswerRepository = readingTaskQuestionAnswerRepository;
|
||||
this._readingTableAnswerRowInfoRepository = readingTableAnswerRowInfoRepository;
|
||||
this._readingTableQuestionAnswerRepository = readingTableQuestionAnswerRepository;
|
||||
_readingOncologyTaskInfoRepository = ReadingOncologyTaskInfoRepository;
|
||||
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
|
||||
_readingOncologyTaskInfoRepository = ReadingOncologyTaskInfoRepository;
|
||||
this._readingTableQuestionTrialRepository = readingTableQuestionTrialRepository;
|
||||
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
|
||||
_provider = provider;
|
||||
_subjectVisitRepository = subjectVisitRepository;
|
||||
@@ -155,6 +155,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//基于标准签名 产生任务 (或者手动选择某些访视生成该标准的任务)
|
||||
public async Task BaseCritrionGenerateVisitTask(Guid trialId, Guid confirmedTrialReadingCriterionId, bool? isManualSelectVisit = null, List<Guid>? subjectVisitIdList = null)
|
||||
{
|
||||
@@ -197,26 +199,29 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
foreach (var subjectVisit in subjectGroup.SubjectVisitList)
|
||||
{
|
||||
var blindTaskName = string.Empty;
|
||||
|
||||
var isNeedClinicalDataSign = IsNeedClinicalDataSign(ReadingCategory.Visit, subjectVisit.IsBaseLine, trialReadingCriterionConfig.TrialReadingCriterionId, clinicalDataConfirmList);
|
||||
var isClinicalDataSign = IsClinicalDataSign(ReadingCategory.Visit, subjectVisit.IsBaseLine, trialReadingCriterionConfig.TrialReadingCriterionId, clinicalDataConfirmList, subjectVisit.Id, trialId);
|
||||
|
||||
if (visitNumList.IndexOf(subjectVisit.VisitNum) == 0)
|
||||
var blindTaskName = string.Empty;
|
||||
|
||||
if (trialReadingCriterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
blindTaskName = visitBlindConfig.BlindBaseLineName;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (trialReadingCriterionConfig.IsReadingTaskViewInOrder)
|
||||
if (visitNumList.IndexOf(subjectVisit.VisitNum) == 0 && subjectVisit.VisitNum==0)
|
||||
{
|
||||
blindTaskName = visitBlindConfig.BlindFollowUpPrefix + " " + visitNumList.IndexOf(subjectVisit.VisitNum);
|
||||
blindTaskName = visitBlindConfig.BlindBaseLineName;
|
||||
}
|
||||
else
|
||||
{
|
||||
blindTaskName = visitBlindConfig.BlindFollowUpPrefix;
|
||||
blindTaskName = visitBlindConfig.BlindFollowUpPrefix + " " + visitNumList.IndexOf(subjectVisit.VisitNum);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blindTaskName ="Timepoint";
|
||||
}
|
||||
|
||||
|
||||
//每个访视 根据项目配置生成任务 双审生成两个
|
||||
|
||||
@@ -392,13 +397,14 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
|
||||
}
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -463,11 +469,11 @@ namespace IRaCIS.Core.Application.Service
|
||||
.Where(t => t.TrialId == trialId && t.IsSign && t.ReadingClinicalDataState == ReadingClinicalDataStatus.HaveSigned && t.ReadingId == readingId && t.ClinicalDataTrialSet.UploadRole == UploadRole.PM).Count();
|
||||
|
||||
|
||||
var readModule = _readModuleRepository.Where(t => t.Id == readingId).FirstOrDefault();
|
||||
var readModule = _readModuleRepository.Where(t => t.Id == readingId).FirstOrDefault();
|
||||
//CRC 阅片期自定义结构化录入是否签名
|
||||
bool crcReadModuleSign = true;
|
||||
|
||||
|
||||
|
||||
|
||||
//访视
|
||||
if (readingCategory == ReadingCategory.Visit)
|
||||
@@ -508,7 +514,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
// 肿瘤学
|
||||
else if (readingCategory == ReadingCategory.Oncology)
|
||||
{
|
||||
needSignCount= trialClinicalDataSetList.Where(t => t.TrialClinicalDataSetCriteriaList.Any(c => c.TrialReadingCriterionId == trialReadingCriterionId) && t.ClinicalDataLevel == ClinicalLevel.OncologyRead && t.UploadRole == UploadRole.PM).Count();
|
||||
needSignCount = trialClinicalDataSetList.Where(t => t.TrialClinicalDataSetCriteriaList.Any(c => c.TrialReadingCriterionId == trialReadingCriterionId) && t.ClinicalDataLevel == ClinicalLevel.OncologyRead && t.UploadRole == UploadRole.PM).Count();
|
||||
if (readModule != null)
|
||||
{
|
||||
// 不存在需要CRC上传的临床数据 或者 PM已确认
|
||||
@@ -526,7 +532,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
|
||||
//可能仅仅CRC 基线 没有PM
|
||||
if (needSignCount == haveSignedCount && crcReadModuleSign )
|
||||
if (needSignCount == haveSignedCount && crcReadModuleSign)
|
||||
{
|
||||
isClinicalDataSign = true;
|
||||
|
||||
@@ -660,29 +666,29 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
var assignConfigList = await _subjectUserRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionConfig.TrialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.OrignalSubjectUserId == null && t.IsConfirmed).Select(u => new { u.DoctorUserId, u.ArmEnum }).ToListAsync();
|
||||
|
||||
|
||||
var blindTaskName = string.Empty;
|
||||
|
||||
var isNeedClinicalDataSign = IsNeedClinicalDataSign(ReadingCategory.Visit, subjectVisit.IsBaseLine, trialReadingCriterionConfig.TrialReadingCriterionId, clinicalDataConfirmList);
|
||||
var isClinicalDataSign = IsClinicalDataSign(ReadingCategory.Visit, subjectVisit.IsBaseLine, trialReadingCriterionConfig.TrialReadingCriterionId, clinicalDataConfirmList, subjectVisit.Id, trialId);
|
||||
|
||||
var isFrontTaskNeedSignButNotSign = await _visitTaskRepository.AnyAsync(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.SubjectId == subjectVisit.SubjectId && t.TaskState == TaskState.Effect && t.VisitTaskNum < subjectVisit.VisitNum && t.IsNeedClinicalDataSign == true && t.IsClinicalDataSign == false);
|
||||
|
||||
if (visitNumList.IndexOf(subjectVisit.VisitNum) == 0)
|
||||
var blindTaskName = string.Empty;
|
||||
|
||||
if (trialReadingCriterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
blindTaskName = visitBlindConfig.BlindBaseLineName;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (trialReadingCriterionConfig.IsReadingTaskViewInOrder)
|
||||
if (visitNumList.IndexOf(subjectVisit.VisitNum) == 0 && subjectVisit.VisitNum == 0)
|
||||
{
|
||||
blindTaskName = visitBlindConfig.BlindFollowUpPrefix + " " + visitNumList.IndexOf(subjectVisit.VisitNum);
|
||||
blindTaskName = visitBlindConfig.BlindBaseLineName;
|
||||
}
|
||||
else
|
||||
{
|
||||
blindTaskName = visitBlindConfig.BlindFollowUpPrefix;
|
||||
blindTaskName = visitBlindConfig.BlindFollowUpPrefix + " " + visitNumList.IndexOf(subjectVisit.VisitNum);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
blindTaskName = "Timepoint";
|
||||
}
|
||||
|
||||
|
||||
//每个访视 根据项目配置生成任务 双审生成两个
|
||||
@@ -784,7 +790,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
#region 后续访视 未分配的进行再次分配,重置的或者失效的 需要重新生成新的任务 (PM 有序退回 或者PM 有序 申请重阅)
|
||||
|
||||
|
||||
if (trialReadingCriterionConfig.IsReadingTaskViewInOrder)
|
||||
if (trialReadingCriterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
//之前有回退到影像上传的访视 那么当前访视一致性核查通过的时候,当前访视生成但是不分配出去(排除失访的)
|
||||
|
||||
@@ -1075,7 +1081,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
TrialReadingCriterionId = trialReadingCriterionConfig.TrialReadingCriterionId,
|
||||
IsNeedClinicalDataSign = isNeedClinicalDataSign,
|
||||
IsClinicalDataSign = isClinicalDataSign,
|
||||
IsFrontTaskNeedSignButNotSign= isFrontTaskNeedSignButNotSign
|
||||
IsFrontTaskNeedSignButNotSign = isFrontTaskNeedSignButNotSign
|
||||
});
|
||||
|
||||
|
||||
@@ -1114,7 +1120,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
#region 重阅/退回的时候,需要将取消分配的访视类型的 任务重新分配
|
||||
|
||||
if (trialReadingCriterionConfig.IsReadingTaskViewInOrder)
|
||||
if (trialReadingCriterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
//之前有回退到影像上传的访视 那么当前访视一致性核查通过的时候,当前访视生成但是不分配出去(排除失访的)
|
||||
var beforeBackVisitTask = await _visitTaskRepository.Where(t => t.TrialId == trialId && t.SubjectId == subjectVisit.SubjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.VisitTaskNum < subjectVisit.VisitNum && t.ReadingCategory == ReadingCategory.Visit && t.SourceSubjectVisit.CheckState != CheckStateEnum.CVPassed && t.SourceSubjectVisit.IsLostVisit == false).OrderBy(t => t.VisitTaskNum).FirstOrDefaultAsync();
|
||||
@@ -1609,12 +1615,12 @@ namespace IRaCIS.Core.Application.Service
|
||||
var oncologySubjectUser = await _subjectUserRepository.Where(x => x.SubjectId == item.SubjectId && x.ArmEnum == Arm.TumorArm && x.IsConfirmed && x.TrialReadingCriterionId == originalTaskInfo.TrialReadingCriterionId).FirstOrDefaultAsync();
|
||||
|
||||
item.VisitNum = await _readModuleRepository.Where(x => x.Id == item.ReadModuleId).Select(x => x.SubjectVisit.VisitNum).FirstOrDefaultAsync();
|
||||
var id= NewId.NextGuid();
|
||||
var id = NewId.NextGuid();
|
||||
|
||||
var singleTask = await _visitTaskRepository.AddAsync(new VisitTask()
|
||||
var singleTask = await _visitTaskRepository.AddAsync(new VisitTask()
|
||||
{
|
||||
Id= id,
|
||||
TrialId = trialId,
|
||||
Id = id,
|
||||
TrialId = trialId,
|
||||
SubjectId = item.SubjectId,
|
||||
IsUrgent = originalTaskInfo.IsUrgent,
|
||||
TaskName = item.ReadingName,
|
||||
@@ -1648,20 +1654,20 @@ namespace IRaCIS.Core.Application.Service
|
||||
// 生成肿瘤学需要 肿瘤学阅片结果中基线,统一显示为NA
|
||||
// 找到基线任务ID
|
||||
var baseLineTaskId = await _visitTaskRepository.Where(x => x.TaskState == TaskState.Effect
|
||||
&& x.ArmEnum == originalTaskInfo.ArmEnum && x.VisitTaskNum == 0
|
||||
&& x.SubjectId== originalTaskInfo.SubjectId
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned && x.TrialReadingCriterionId == originalTaskInfo.TrialReadingCriterionId).Select(x => x.Id).FirstNotNullAsync();
|
||||
&& x.ArmEnum == originalTaskInfo.ArmEnum && x.VisitTaskNum == 0
|
||||
&& x.SubjectId == originalTaskInfo.SubjectId
|
||||
&& x.ReadingTaskState == ReadingTaskState.HaveSigned && x.TrialReadingCriterionId == originalTaskInfo.TrialReadingCriterionId).Select(x => x.Id).FirstNotNullAsync();
|
||||
await _readingOncologyTaskInfoRepository.AddAsync(new ReadingOncologyTaskInfo()
|
||||
{
|
||||
EvaluationResult = "-1",
|
||||
EvaluationReason=string.Empty,
|
||||
EvaluationReason = string.Empty,
|
||||
OncologyTaskId = id,
|
||||
VisitTaskId = baseLineTaskId,
|
||||
SubjectId = originalTaskInfo.SubjectId,
|
||||
TrialId = originalTaskInfo.TrialId
|
||||
});
|
||||
|
||||
_provider.Set<int>($"{trialId}_{StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt, TimeSpan.FromMinutes(30));
|
||||
_provider.Set<int>($"{trialId}_{StaticData.CacheKey.TaskMaxCode}", currentMaxCodeInt, TimeSpan.FromMinutes(30));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,23 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
var list = await _repository.Where<ReadingQuestionCriterionTrial>(t => t.TrialId == trialId && t.IsConfirm)
|
||||
|
||||
.OrderBy(t => t.ShowOrder)
|
||||
.Select(t => new TrialReadingCriterionDto() { TrialReadingCriterionId = t.Id, IsAutoCreate = t.IsAutoCreate, IsAdditionalAssessment = t.IsAdditionalAssessment, TrialReadingCriterionName = t.CriterionName, CriterionType = t.CriterionType, ReadingType = t.ReadingType, ReadingInfoSignTime = t.ReadingInfoSignTime , IsReadingPeriod= t.IsReadingPeriod })
|
||||
.Select(t => new TrialReadingCriterionDto()
|
||||
{
|
||||
TrialReadingCriterionId = t.Id,
|
||||
IsAutoCreate = t.IsAutoCreate,
|
||||
IsAdditionalAssessment = t.IsAdditionalAssessment,
|
||||
TrialReadingCriterionName = t.CriterionName,
|
||||
CriterionType = t.CriterionType,
|
||||
ReadingType = t.ReadingType,
|
||||
ReadingInfoSignTime = t.ReadingInfoSignTime,
|
||||
IsReadingPeriod = t.IsReadingPeriod,
|
||||
IsArbitrationReading = t.IsArbitrationReading,
|
||||
IsGlobalReading = t.IsGlobalReading,
|
||||
IsOncologyReading = t.IsOncologyReading,
|
||||
ImageDownloadEnum = t.ImageDownloadEnum,
|
||||
ImageUploadEnum = t.ImageUploadEnum,
|
||||
IsReadingTaskViewInOrder = t.IsReadingTaskViewInOrder
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
//if (list.Count == 0)
|
||||
@@ -134,17 +150,17 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
var isAddtinoarlCriterion = await _trialReadingCriterionRepository.AnyAsync(t => t.Id == querySubjectAssign.TrialReadingCriterionId && t.IsAutoCreate == false);
|
||||
|
||||
var subjectQuery = _subjectRepository.Where(t => t.TrialId == querySubjectAssign.TrialId && t.SubjectVisitTaskList.Any())
|
||||
.WhereIf(querySubjectAssign.SiteId != null, t => t.SiteId == querySubjectAssign.SiteId)
|
||||
.WhereIf(querySubjectAssign.TrialSiteId != null, t => t.TrialSiteId == querySubjectAssign.TrialSiteId)
|
||||
.WhereIf(querySubjectAssign.SubjectId != null, t => t.Id == querySubjectAssign.SubjectId)
|
||||
.WhereIf(querySubjectAssign.DoctorUserId != null, t => t.SubjectDoctorList.Any(t => t.DoctorUserId == querySubjectAssign.DoctorUserId && t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId))
|
||||
.WhereIf(!string.IsNullOrEmpty(querySubjectAssign.SubjectCode), t => t.Code.Contains(querySubjectAssign.SubjectCode))
|
||||
//未分配
|
||||
.WhereIf(querySubjectAssign.SubjectAllocateState == 0, t => !t.SubjectDoctorList.Any(t => t.AssignTime!=null && t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId))
|
||||
//已分配
|
||||
.WhereIf(querySubjectAssign.SubjectAllocateState == 0, t => !t.SubjectDoctorList.Any(t => t.AssignTime != null && t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId))
|
||||
//已分配
|
||||
.WhereIf(querySubjectAssign.SubjectAllocateState == 1, t => t.SubjectDoctorList.Any(t => t.AssignTime != null && t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId))
|
||||
|
||||
.WhereIf(querySubjectAssign.ArmList.Count >0 , t => !querySubjectAssign.ArmList.Except(t.SubjectDoctorList.Where(t => t.AssignTime != null && t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId).Select(c => c.ArmEnum)).Any() )
|
||||
|
||||
.WhereIf(querySubjectAssign.ArmList.Count > 0, t => !querySubjectAssign.ArmList.Except(t.SubjectDoctorList.Where(t => t.AssignTime != null && t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId).Select(c => c.ArmEnum)).Any())
|
||||
|
||||
|
||||
.WhereIf(isAddtinoarlCriterion, t => t.SubjectCriteriaEvaluationList.Where(t => t.TrialReadingCriterionId == querySubjectAssign.TrialReadingCriterionId).Any(t => t.IsJoinEvaluation))
|
||||
|
||||
@@ -158,7 +174,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
|
||||
var criterionConfig = (await _trialReadingCriterionRepository.Where(x => x.Id == querySubjectAssign.TrialReadingCriterionId).Select(x => new { x.ReadingTool, x.IsReadingTaskViewInOrder, x.ReadingType, x.IsArbitrationReading, x.IsOncologyReading, x.IsGlobalReading }).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
return ResponseOutput.Ok (pageList, criterionConfig);
|
||||
return ResponseOutput.Ok(pageList, criterionConfig);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -292,7 +308,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
|
||||
var subjectId = cancelCommand.CancelList.First().SubjectId;
|
||||
|
||||
await _repository.AddAsync(new SubjectCanceDoctor() { SubjectId = subjectId, Note = cancelCommand.Note });
|
||||
await _repository.AddAsync(new SubjectCanceDoctor() { SubjectId = subjectId, Note = cancelCommand.Note, TrialReadingCriterionId = cancelCommand.TrialReadingCriterionId });
|
||||
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
|
||||
@@ -407,7 +423,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
.WhereIf(querySubjectAssign.IsJudgeDoctor == false, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum != Arm.JudgeArm).Any())
|
||||
.WhereIf(querySubjectAssign.IsJudgeDoctor, t => t.SubjectVisitTaskList.Where(t => t.ArmEnum == Arm.JudgeArm).Any())
|
||||
|
||||
.WhereIf(querySubjectAssign.SiteId != null, t => t.SiteId == querySubjectAssign.SiteId)
|
||||
.WhereIf(querySubjectAssign.TrialSiteId != null, t => t.TrialSiteId == querySubjectAssign.TrialSiteId)
|
||||
.WhereIf(querySubjectAssign.SubjectId != null, t => t.Id == querySubjectAssign.SubjectId)
|
||||
|
||||
.WhereIf(querySubjectAssign.IsHaveAssigned != null && querySubjectAssign.IsHaveAssigned == true && querySubjectAssign.IsJudgeDoctor == false, t => t.SubjectDoctorList.Where(t => t.ArmEnum != Arm.JudgeArm).Any())
|
||||
@@ -670,7 +686,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
.WhereIf(queryVisitTask.ReadingCategory == null, t => t.ReadingCategory != ReadingCategory.Judge)
|
||||
|
||||
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
@@ -710,7 +726,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
|
||||
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
||||
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
@@ -742,13 +758,16 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
/// <param name="queryVisitTask"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<(PageOutput<ReadingTaskView>, object?)> GetReadingTaskList(VisitTaskQuery queryVisitTask)
|
||||
public async Task<IResponseOutput<PageOutput<ReadingTaskView>>> GetReadingTaskList(VisitTaskQuery queryVisitTask)
|
||||
{
|
||||
var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == queryVisitTask.TrialId && t.IsAnalysisCreate == false)
|
||||
//.Where(t => t.IsAnalysisCreate == false && t.DoctorUserId != null)
|
||||
//.Where(t => t.IsAnalysisCreate == false && t.DoctorUserId != null)
|
||||
|
||||
.WhereIf(queryVisitTask.IsEffect == true, t => t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze)
|
||||
.WhereIf(queryVisitTask.IsEffect == false, t => t.TaskState == TaskState.Adbandon || t.TaskState == TaskState.HaveReturned)
|
||||
|
||||
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
@@ -765,10 +784,10 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.IsAnalysisCreate))
|
||||
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate)
|
||||
.WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1))
|
||||
.WhereIf(queryVisitTask.BeginSignTime != null, t => t.SignTime > queryVisitTask.BeginSignTime)
|
||||
.WhereIf(queryVisitTask.EndSignTime != null, t => t.SignTime < queryVisitTask.EndSignTime!.Value.AddDays(1))
|
||||
.ProjectTo<ReadingTaskView>(_mapper.ConfigurationProvider);
|
||||
.WhereIf(queryVisitTask.EndAllocateDate != null, t => t.AllocateTime < queryVisitTask.EndAllocateDate)
|
||||
.WhereIf(queryVisitTask.BeginSignTime != null, t => t.SignTime > queryVisitTask.BeginSignTime)
|
||||
.WhereIf(queryVisitTask.EndSignTime != null, t => t.SignTime < queryVisitTask.EndSignTime)
|
||||
.ProjectTo<ReadingTaskView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var defalutSortArray = new string[] { nameof(VisitTask.IsUrgent) + " desc", nameof(VisitTask.SubjectId), nameof(VisitTask.VisitTaskNum) };
|
||||
|
||||
@@ -776,7 +795,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
|
||||
var trialTaskConfig = _trialRepository.Where(t => t.Id == queryVisitTask.TrialId).ProjectTo<TrialUrgentConfig>(_mapper.ConfigurationProvider).FirstOrDefault();
|
||||
|
||||
return (pageList, trialTaskConfig);
|
||||
return ResponseOutput.Ok(pageList, trialTaskConfig);
|
||||
}
|
||||
|
||||
|
||||
@@ -794,26 +813,33 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
.Where(t => t.OriginalReReadingTask.TrialId == queryVisitTask.TrialId /*&& t.OriginalReReadingTask.IsAnalysisCreate == false*/)
|
||||
.WhereIf(queryVisitTask.RootReReadingTaskId != null, t => t.RootReReadingTaskId == queryVisitTask.RootReReadingTaskId || t.OriginalReReadingTaskId == queryVisitTask.RootReReadingTaskId)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskCode), t => t.OriginalReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!) || t.RootReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!))
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.OriginalReReadingTask.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.OriginalReReadingTask.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
.WhereIf(queryVisitTask.TaskState != null, t => t.OriginalReReadingTask.TaskState == queryVisitTask.TaskState)
|
||||
.WhereIf(queryVisitTask.ReReadingApplyState != null, t => t.OriginalReReadingTask.ReReadingApplyState == queryVisitTask.ReReadingApplyState)
|
||||
.WhereIf(queryVisitTask.RequestReReadingType != null, t => t.RequestReReadingType == queryVisitTask.RequestReReadingType)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.OriginalReReadingTask.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.OriginalReReadingTask.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
.WhereIf(queryVisitTask.ArmEnum != null, t => t.OriginalReReadingTask.ArmEnum == queryVisitTask.ArmEnum)
|
||||
.WhereIf(queryVisitTask.ReadingTaskState != null, t => t.OriginalReReadingTask.ReadingTaskState == queryVisitTask.ReadingTaskState)
|
||||
.WhereIf(queryVisitTask.TaskAllocationState != null, t => t.OriginalReReadingTask.TaskAllocationState == queryVisitTask.TaskAllocationState)
|
||||
.WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.OriginalReReadingTask.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId)
|
||||
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.OriginalReReadingTask.ReadingCategory == queryVisitTask.ReadingCategory)
|
||||
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.RequestReReadingReason), t => t.RequestReReadingReason.Contains(queryVisitTask.RequestReReadingReason))
|
||||
|
||||
.WhereIf(queryVisitTask.RequestReReadingResultEnum != null, t => t.RequestReReadingResultEnum == queryVisitTask.RequestReReadingResultEnum)
|
||||
|
||||
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => (t.OriginalReReadingTask.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.OriginalReReadingTask.IsAnalysisCreate) || (t.OriginalReReadingTask.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode!) && t.OriginalReReadingTask.IsAnalysisCreate == false))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.OriginalReReadingTask.TaskName.Contains(queryVisitTask.TaskName) || t.OriginalReReadingTask.TaskBlindName.Contains(queryVisitTask.TaskName))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => (t.OriginalReReadingTask.Subject.Code.Contains(queryVisitTask.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate == false) || (t.OriginalReReadingTask.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => ((t.OriginalReReadingTask.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.OriginalReReadingTask.Subject.MedicalNo.Contains(queryVisitTask.SubjectCode)) && t.OriginalReReadingTask.IsAnalysisCreate == false) || (t.OriginalReReadingTask.BlindSubjectCode.Contains(queryVisitTask.SubjectCode) && t.OriginalReReadingTask.IsAnalysisCreate))
|
||||
.WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime > queryVisitTask.BeginAllocateDate)
|
||||
.WhereIf(queryVisitTask.EndAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime < queryVisitTask.EndAllocateDate!.Value.AddDays(1))
|
||||
|
||||
.WhereIf(queryVisitTask.BeginRequestReReadingTime != null, t => t.RequestReReadingTime >= queryVisitTask.BeginRequestReReadingTime)
|
||||
.WhereIf(queryVisitTask.EndRequestReReadingTime != null, t => t.RequestReReadingTime <= queryVisitTask.EndRequestReReadingTime!.Value.AddDays(1))
|
||||
|
||||
.ProjectTo<ReReadingTaskView>(_mapper.ConfigurationProvider);
|
||||
|
||||
//var defalutSortArray = new string[] { nameof(ReReadingTaskView.OriginalReReadingTask) + "." + nameof(ReReadingTaskView.OriginalReReadingTask.IsUrgent) + " desc", nameof(ReReadingTaskView.OriginalReReadingTask) + "." + nameof(ReReadingTaskView.OriginalReReadingTask.SubjectId), nameof(ReReadingTaskView.OriginalReReadingTask) + "." + nameof(ReReadingTaskView.OriginalReReadingTask.VisitTaskNum) };
|
||||
@@ -845,13 +871,13 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
.Where(t => t.RequestReReadingType == RequestReReadingType.DocotorApply)
|
||||
.Where(t => t.OriginalReReadingTask.DoctorUserId == _userInfo.Id)
|
||||
.Where(t => t.OriginalReReadingTask.TrialId == queryVisitTask.TrialId)
|
||||
.WhereIf(queryVisitTask.RequestReReadingResultEnum != null, t => t.RequestReReadingResultEnum == queryVisitTask.RequestReReadingResultEnum)
|
||||
.WhereIf(queryVisitTask.RootReReadingTaskId != null, t => t.RootReReadingTaskId == queryVisitTask.RootReReadingTaskId || t.OriginalReReadingTaskId == queryVisitTask.RootReReadingTaskId)
|
||||
.WhereIf(queryVisitTask.RequestReReadingResultEnum != null, t => t.RequestReReadingResultEnum == queryVisitTask.RequestReReadingResultEnum)
|
||||
.WhereIf(queryVisitTask.RootReReadingTaskId != null, t => t.RootReReadingTaskId == queryVisitTask.RootReReadingTaskId || t.OriginalReReadingTaskId == queryVisitTask.RootReReadingTaskId)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskCode), t => t.OriginalReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!) || t.RootReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!))
|
||||
.WhereIf(queryVisitTask.TaskState != null, t => t.OriginalReReadingTask.TaskState == queryVisitTask.TaskState)
|
||||
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.OriginalReReadingTask.ReadingCategory == queryVisitTask.ReadingCategory)
|
||||
.WhereIf(queryVisitTask.ReReadingApplyState != null, t => t.OriginalReReadingTask.ReReadingApplyState == queryVisitTask.ReReadingApplyState)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.OriginalReReadingTask.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.OriginalReReadingTask.ReadingCategory == queryVisitTask.ReadingCategory)
|
||||
.WhereIf(queryVisitTask.ReReadingApplyState != null, t => t.OriginalReReadingTask.ReReadingApplyState == queryVisitTask.ReReadingApplyState)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.OriginalReReadingTask.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.OriginalReReadingTask.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.OriginalReReadingTask.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
@@ -886,7 +912,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
.WhereIf(queryVisitTask.RootReReadingTaskId != null, t => t.RootReReadingTaskId == queryVisitTask.RootReReadingTaskId || t.OriginalReReadingTaskId == queryVisitTask.RootReReadingTaskId)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskCode), t => t.OriginalReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!) || t.RootReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!))
|
||||
.WhereIf(queryVisitTask.TaskState != null, t => t.OriginalReReadingTask.TaskState == queryVisitTask.TaskState)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.OriginalReReadingTask.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.OriginalReReadingTask.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.OriginalReReadingTask.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.OriginalReReadingTask.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
@@ -918,20 +944,21 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<(PageOutput<IRUnReadSubjectView>, object)> GetIRUnReadSubjectTaskList(IRUnReadSubjectQuery iRUnReadSubjectQuery)
|
||||
public async Task<IResponseOutput<PageOutput<IRUnReadSubjectView>>> GetIRUnReadSubjectTaskList(IRUnReadSubjectQuery inQuery)
|
||||
{
|
||||
|
||||
var trialId = iRUnReadSubjectQuery.TrialId;
|
||||
var trialId = inQuery.TrialId;
|
||||
var subjectCode = inQuery.SubjectCode;
|
||||
|
||||
var trialReadingCriterionId = iRUnReadSubjectQuery.TrialReadingCriterionId;
|
||||
var trialReadingCriterionId = inQuery.TrialReadingCriterionId;
|
||||
|
||||
var criterionConfig = await _trialReadingCriterionRepository.Where(x => x.Id == iRUnReadSubjectQuery.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
var criterionConfig = await _trialReadingCriterionRepository.Where(x => x.Id == inQuery.TrialReadingCriterionId).FirstNotNullAsync();
|
||||
|
||||
var readingTool = criterionConfig.ReadingTool;
|
||||
var isReadingTaskViewInOrder = criterionConfig.IsReadingTaskViewInOrder;
|
||||
|
||||
#region 按照Subject 维度
|
||||
if (isReadingTaskViewInOrder)
|
||||
if (isReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
|
||||
|
||||
@@ -939,13 +966,13 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
{
|
||||
TrialId = trialId,
|
||||
TrialReadingCriterionId = trialReadingCriterionId,
|
||||
SubjectCode = iRUnReadSubjectQuery.SubjectCode,
|
||||
SubjectCode = inQuery.SubjectCode,
|
||||
Page = new PageInput()
|
||||
{
|
||||
PageIndex = iRUnReadSubjectQuery.PageIndex,
|
||||
PageSize = iRUnReadSubjectQuery.PageSize,
|
||||
Asc = iRUnReadSubjectQuery.Asc,
|
||||
SortField = iRUnReadSubjectQuery.SortField,
|
||||
PageIndex = inQuery.PageIndex,
|
||||
PageSize = inQuery.PageSize,
|
||||
Asc = inQuery.Asc,
|
||||
SortField = inQuery.SortField,
|
||||
|
||||
}
|
||||
|
||||
@@ -959,15 +986,15 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
|
||||
var result = new PageOutput<IRUnReadSubjectView>()
|
||||
{
|
||||
PageSize = iRUnReadSubjectQuery.PageSize,
|
||||
PageIndex = iRUnReadSubjectQuery.PageIndex,
|
||||
PageSize = inQuery.PageSize,
|
||||
PageIndex = inQuery.PageIndex,
|
||||
TotalCount = totalCount,
|
||||
CurrentPageData = currentPageData,
|
||||
};
|
||||
|
||||
// 封装的方法有问题
|
||||
//var result = await visitQuery.ToPagedListAsync(iRUnReadSubjectQuery.PageIndex, iRUnReadSubjectQuery.PageSize, String.IsNullOrEmpty(iRUnReadSubjectQuery.SortField) ? nameof(IRUnReadSubjectView.SubjectId) : iRUnReadSubjectQuery.SortField, iRUnReadSubjectQuery.Asc);
|
||||
return (result, new
|
||||
return ResponseOutput.Ok(result, new
|
||||
{
|
||||
RandomReadInfo = new IRUnReadOutDto(),
|
||||
IsReadingTaskViewInOrder = isReadingTaskViewInOrder,
|
||||
@@ -979,26 +1006,15 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
CriterionType = criterionConfig.CriterionType,
|
||||
});
|
||||
}
|
||||
else
|
||||
else if(isReadingTaskViewInOrder == ReadingOrder.SubjectRandom)
|
||||
{
|
||||
var taskQuery = _visitTaskRepository.Where(x => x.TrialId == iRUnReadSubjectQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId)
|
||||
// .Where(x=>x.Subject.ClinicalDataList.Any(c => c.IsSign && (c.ReadingId == x.SouceReadModuleId || c.ReadingId == x.SourceSubjectVisitId)))
|
||||
.Where(x => !x.Subject.IsDeleted).Where(x => (x.IsNeedClinicalDataSign && x.IsClinicalDataSign) || !x.IsNeedClinicalDataSign);
|
||||
|
||||
IRUnReadOutDto iRUnReadOut = new IRUnReadOutDto()
|
||||
{
|
||||
FinishJudgeTaskCount = await taskQuery.Where(x => x.ReadingCategory == ReadingCategory.Judge && x.ReadingTaskState == ReadingTaskState.HaveSigned).CountAsync(),
|
||||
FinishTaskCount = await taskQuery.Where(x => x.ReadingCategory != ReadingCategory.Judge && x.ReadingTaskState == ReadingTaskState.HaveSigned).CountAsync(),
|
||||
SuggesteFinishedTime = await taskQuery.Where(x => x.ReadingTaskState != ReadingTaskState.HaveSigned).MaxAsync(x => x.SuggesteFinishedTime),
|
||||
UnReadJudgeTaskCount = await taskQuery.Where(x => x.ReadingCategory == ReadingCategory.Judge && x.ReadingTaskState != ReadingTaskState.HaveSigned).CountAsync(),
|
||||
UnReadTaskCount = await taskQuery.Where(x => x.ReadingCategory != ReadingCategory.Judge && x.ReadingTaskState != ReadingTaskState.HaveSigned).CountAsync(),
|
||||
};
|
||||
|
||||
|
||||
|
||||
var visitGroupQuery = taskQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode });
|
||||
var critrion = await _trialReadingCriterionRepository.FindAsync(trialReadingCriterionId);
|
||||
|
||||
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect)
|
||||
|
||||
.WhereIf(!string.IsNullOrEmpty(subjectCode), t => (t.Subject.Code.Contains(subjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(subjectCode!) && t.IsAnalysisCreate));
|
||||
|
||||
var visitGroupQuery = visitQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode });
|
||||
|
||||
var visitTaskQuery = visitGroupQuery.Select(x => new IRUnReadSubjectView()
|
||||
{
|
||||
@@ -1008,22 +1024,17 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
SuggesteFinishedTime = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Min(x => x.SuggesteFinishedTime),
|
||||
|
||||
//未读任务量
|
||||
UnReadTaskCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Count(),
|
||||
|
||||
//未读 里可读任务量
|
||||
UnReadCanReadTaskCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned && y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)
|
||||
//不能对包含聚合或子查询的表达式执行聚合函数
|
||||
//&& !x.Any(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.IsNeedClinicalDataSign == true && t.IsClinicalDataSign == false && t.VisitTaskNum<y.VisitTaskNum )
|
||||
).Count(),
|
||||
UnReadCanReadTaskCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Count(),
|
||||
|
||||
UrgentCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Where(x => x.IsUrgent).Count(),
|
||||
|
||||
//已读任务量
|
||||
HaveReadTaskCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState == ReadingTaskState.HaveSigned).Count(),
|
||||
|
||||
ExistReadingApply = x.Any(y => (y.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed && y.TrialReadingCriterionId == trialReadingCriterionId) || y.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed),
|
||||
|
||||
//查出所有未读的 未读的可读的 在这个列表基础上 过滤下 y.IsFrontTaskNeedSignButNotSign==false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true) 这样容易排错 确认这三个字段是否维护有误
|
||||
UnReadTaskList = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).OrderBy(x => x.VisitTaskNum)
|
||||
|
||||
UnReadCanReadTaskList = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||
.OrderBy(x => x.VisitTaskNum)
|
||||
.Select(u => new IRUnreadTaskView()
|
||||
{
|
||||
Id = u.Id,
|
||||
@@ -1040,22 +1051,48 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
IsClinicalDataSign = u.IsClinicalDataSign,
|
||||
IsFrontTaskNeedSignButNotSign = u.IsFrontTaskNeedSignButNotSign
|
||||
})
|
||||
.ToList(),
|
||||
.ToList()
|
||||
}).Where(x => x.UnReadCanReadTaskCount > 0);
|
||||
|
||||
var pageList = await visitTaskQuery.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField)? nameof(IRUnReadSubjectView.UnReadCanReadTaskCount) : inQuery.SortField, inQuery.Asc );
|
||||
|
||||
var totalCount = await visitGroupQuery.CountAsync();
|
||||
var currentPageData = await visitTaskQuery.ToListAsync();
|
||||
|
||||
return ResponseOutput.Ok(pageList, new
|
||||
{
|
||||
RandomReadInfo = new IRUnReadOutDto(),
|
||||
IsReadingTaskViewInOrder = isReadingTaskViewInOrder,
|
||||
ReadingTool = readingTool,
|
||||
IseCRFShowInDicomReading = criterionConfig.IseCRFShowInDicomReading,
|
||||
IsReadingShowSubjectInfo = criterionConfig.IsReadingShowSubjectInfo,
|
||||
IsReadingShowPreviousResults = criterionConfig.IsReadingShowPreviousResults,
|
||||
DigitPlaces = criterionConfig.DigitPlaces,
|
||||
CriterionType = criterionConfig.CriterionType,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var taskQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId)
|
||||
// .Where(x=>x.Subject.ClinicalDataList.Any(c => c.IsSign && (c.ReadingId == x.SouceReadModuleId || c.ReadingId == x.SourceSubjectVisitId)))
|
||||
.Where(x => !x.Subject.IsDeleted).Where(x => (x.IsNeedClinicalDataSign && x.IsClinicalDataSign) || !x.IsNeedClinicalDataSign);
|
||||
|
||||
IRUnReadOutDto iRUnReadOut = new IRUnReadOutDto()
|
||||
{
|
||||
FinishJudgeTaskCount = await taskQuery.Where(x => x.ReadingCategory == ReadingCategory.Judge && x.ReadingTaskState == ReadingTaskState.HaveSigned).CountAsync(),
|
||||
FinishTaskCount = await taskQuery.Where(x => x.ReadingCategory != ReadingCategory.Judge && x.ReadingTaskState == ReadingTaskState.HaveSigned).CountAsync(),
|
||||
SuggesteFinishedTime = await taskQuery.Where(x => x.ReadingTaskState != ReadingTaskState.HaveSigned).MaxAsync(x => x.SuggesteFinishedTime),
|
||||
UnReadJudgeTaskCount = await taskQuery.Where(x => x.ReadingCategory == ReadingCategory.Judge && x.ReadingTaskState != ReadingTaskState.HaveSigned).CountAsync(),
|
||||
UnReadTaskCount = await taskQuery.Where(x => x.ReadingCategory != ReadingCategory.Judge && x.ReadingTaskState != ReadingTaskState.HaveSigned).CountAsync(),
|
||||
};
|
||||
|
||||
var result = new PageOutput<IRUnReadSubjectView>()
|
||||
{
|
||||
PageSize = iRUnReadSubjectQuery.PageSize,
|
||||
PageIndex = iRUnReadSubjectQuery.PageIndex,
|
||||
TotalCount = totalCount,
|
||||
CurrentPageData = currentPageData,
|
||||
PageSize = inQuery.PageSize,
|
||||
PageIndex = inQuery.PageIndex,
|
||||
TotalCount = 0,
|
||||
CurrentPageData = null,
|
||||
};
|
||||
|
||||
return (result, new
|
||||
return ResponseOutput.Ok(result, new
|
||||
{
|
||||
IsReadingTaskViewInOrder = isReadingTaskViewInOrder,
|
||||
RandomReadInfo = iRUnReadOut,
|
||||
@@ -1089,9 +1126,9 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
var critrion = await _trialReadingCriterionRepository.FindAsync(trialReadingCriterionId);
|
||||
|
||||
|
||||
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.DoctorUserId == _userInfo.Id
|
||||
&& x.TaskState == TaskState.Effect /*&& x.TrialReadingCriterionId== inDto.TrialReadingCriterionId*/)
|
||||
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect)
|
||||
|
||||
.WhereIf(inDto.SubjectId!=null,x=>x.SubjectId==inDto.SubjectId)
|
||||
//前序 不存在 未生成任务的访视
|
||||
.WhereIf(critrion.IsAutoCreate == false, t => !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum))
|
||||
|
||||
@@ -1125,34 +1162,34 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
).Count(),
|
||||
|
||||
|
||||
UnReadCanReadTaskList= x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||
.Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true))
|
||||
.OrderBy(x => x.VisitTaskNum)
|
||||
.Select(u => new IRUnreadTaskView()
|
||||
{
|
||||
Id = u.Id,
|
||||
IsUrgent = u.IsUrgent,
|
||||
VisitNum = u.VisitTaskNum,
|
||||
TaskBlindName = u.TaskBlindName,
|
||||
VisistId = u.SourceSubjectVisitId,
|
||||
SuggesteFinishedTime = u.SuggesteFinishedTime,
|
||||
ReadingCategory = u.ReadingCategory,
|
||||
IsAnalysisCreate = u.IsAnalysisCreate,
|
||||
ArmEnum = u.ArmEnum,
|
||||
TrialReadingCriterionId = u.TrialReadingCriterionId,
|
||||
IsNeedClinicalDataSign = u.IsNeedClinicalDataSign,
|
||||
IsClinicalDataSign = u.IsClinicalDataSign,
|
||||
IsFrontTaskNeedSignButNotSign = u.IsFrontTaskNeedSignButNotSign
|
||||
})
|
||||
.ToList(),
|
||||
UnReadCanReadTaskList = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||
.Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true))
|
||||
.OrderBy(x => x.VisitTaskNum)
|
||||
.Select(u => new IRUnreadTaskView()
|
||||
{
|
||||
Id = u.Id,
|
||||
IsUrgent = u.IsUrgent,
|
||||
VisitNum = u.VisitTaskNum,
|
||||
TaskBlindName = u.TaskBlindName,
|
||||
VisistId = u.SourceSubjectVisitId,
|
||||
SuggesteFinishedTime = u.SuggesteFinishedTime,
|
||||
ReadingCategory = u.ReadingCategory,
|
||||
IsAnalysisCreate = u.IsAnalysisCreate,
|
||||
ArmEnum = u.ArmEnum,
|
||||
TrialReadingCriterionId = u.TrialReadingCriterionId,
|
||||
IsNeedClinicalDataSign = u.IsNeedClinicalDataSign,
|
||||
IsClinicalDataSign = u.IsClinicalDataSign,
|
||||
IsFrontTaskNeedSignButNotSign = u.IsFrontTaskNeedSignButNotSign
|
||||
})
|
||||
.ToList(),
|
||||
|
||||
|
||||
UrgentCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||
.Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true))
|
||||
.Where(x=>x.IsUrgent).Count(),
|
||||
UrgentCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned)
|
||||
.Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true))
|
||||
.Where(x => x.IsUrgent).Count(),
|
||||
|
||||
//已读任务量
|
||||
HaveReadTaskCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState == ReadingTaskState.HaveSigned).Count(),
|
||||
//已读任务量
|
||||
HaveReadTaskCount = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState == ReadingTaskState.HaveSigned).Count(),
|
||||
|
||||
ExistReadingApply = x.Any(y => (y.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed && y.TrialReadingCriterionId == trialReadingCriterionId) || y.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed),
|
||||
|
||||
@@ -1185,7 +1222,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
|
||||
var result = new List<IRUnReadSubjectView>();
|
||||
|
||||
var propName = string.IsNullOrWhiteSpace(inDto.Page!.SortField) ? "UnReadCanReadTaskCount" : inDto.Page.SortField;
|
||||
var propName = string.IsNullOrWhiteSpace(inDto.Page!.SortField) ? nameof(IRUnReadSubjectView.UnReadCanReadTaskCount) : inDto.Page.SortField;
|
||||
|
||||
var visitTaskOrderQuery = inDto.Page.Asc ? visitTaskQuery.OrderBy(propName) : visitTaskQuery.OrderBy(propName + " desc");
|
||||
if (inDto.Page != null)
|
||||
@@ -1218,7 +1255,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState == ReadingTaskState.HaveSigned)//该医生 已经签名的数据
|
||||
|
||||
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory)
|
||||
@@ -1250,14 +1287,14 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
var baseLineTaskList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id
|
||||
&& t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.SourceSubjectVisit.IsBaseLine == true).ToListAsync();
|
||||
|
||||
var judegeList= await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id
|
||||
var judegeList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id
|
||||
&& t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Judge && t.ReadingTaskState == ReadingTaskState.HaveSigned).ToListAsync();
|
||||
|
||||
foreach (var item in judegeList)
|
||||
{
|
||||
if (!baseLineTaskList.Any(t => t.SubjectId == item.SubjectId))
|
||||
{
|
||||
baseLineTaskList.Add(item);
|
||||
baseLineTaskList.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1361,7 +1398,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
|
||||
|
||||
// 有序 一个受试者访视重阅未处理完,不能申请其他的
|
||||
if (criterionConfig.IsReadingTaskViewInOrder)
|
||||
if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
if (await _visitTaskReReadingRepository.AnyAsync(t => t.OriginalReReadingTask.TrialId == task.TrialId && t.OriginalReReadingTask.SubjectId == task.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect
|
||||
&& t.OriginalReReadingTask.TrialReadingCriterionId == task.TrialReadingCriterionId
|
||||
@@ -1382,7 +1419,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
task.ReReadingApplyState = ReReadingApplyState.DocotorHaveApplyed;
|
||||
|
||||
// 有序
|
||||
if (criterionConfig.IsReadingTaskViewInOrder)
|
||||
if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
// 针对同一个subject 不同阅片人 针对同一个访视申请重阅,是允许的,所以同一阅片人,针对同一suject 有访视申请重阅还未处理,不允许申请重阅
|
||||
if (await _visitTaskReReadingRepository.AnyAsync(t => t.OriginalReReadingTask.TrialId == task.TrialId && t.OriginalReReadingTask.SubjectId == task.SubjectId && t.OriginalReReadingTask.TaskState == TaskState.Effect
|
||||
@@ -1648,7 +1685,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
}
|
||||
|
||||
//有序阅片
|
||||
if (criterionConfig.IsReadingTaskViewInOrder)
|
||||
if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
|
||||
|
||||
@@ -1757,7 +1794,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
|
||||
|
||||
//有序阅片
|
||||
if (criterionConfig.IsReadingTaskViewInOrder)
|
||||
if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
#region 有序 IR 申请 重阅 影响的其他访视查询
|
||||
|
||||
@@ -2165,8 +2202,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
foreach (var item in readingTableAnswerRowInfoList)
|
||||
{
|
||||
|
||||
var originalVisitTaskId= item.VisitTaskId;
|
||||
var originalFristAddTaskId= item.FristAddTaskId;
|
||||
var originalVisitTaskId = item.VisitTaskId;
|
||||
var originalFristAddTaskId = item.FristAddTaskId;
|
||||
|
||||
item.Id = NewId.NextSequentialGuid();
|
||||
item.VisitTaskId = newTask.Id;
|
||||
@@ -2270,7 +2307,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
|
||||
|
||||
//有序
|
||||
if (criterionConfig.IsReadingTaskViewInOrder)
|
||||
if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
|
||||
//Expression<Func<VisitTask, bool>> filterExpression = t => t.TrialId == trialId && t.SubjectId == task.SubjectId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && t.TaskAllocationState == TaskAllocationState.Allocated;
|
||||
@@ -2602,7 +2639,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
//当前任务及其之后的所有访视任务、全局任务、裁判任务、肿瘤学阅片任务
|
||||
|
||||
//有序
|
||||
if (criterionConfig.IsReadingTaskViewInOrder)
|
||||
if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
|
||||
switch (filterObj.ReadingCategory)
|
||||
@@ -2721,7 +2758,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
|
||||
|
||||
//有序
|
||||
if (criterionConfig.IsReadingTaskViewInOrder)
|
||||
if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
switch (filterObj.ReadingCategory)
|
||||
{
|
||||
@@ -2780,7 +2817,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||
if (filterObj.ReadingCategory == ReadingCategory.Visit && _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
||||
{
|
||||
//有序
|
||||
if (criterionConfig.IsReadingTaskViewInOrder)
|
||||
if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
// 当前任务及其之后的所有访视任务 两个阅片人的
|
||||
|
||||
|
||||
@@ -124,9 +124,11 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<VisitTask, VisitTaskView>().IncludeBase<VisitTask, VisitTaskViewBasic>()
|
||||
|
||||
|
||||
.ForMember(o => o.SiteId, t => t.MapFrom(u => u.Subject.SiteId))
|
||||
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.IsAnalysisCreate == true ? u.BlindTrialSiteCode : u.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.IsAnalysisCreate == true ? u.BlindSubjectCode : u.Subject.Code))
|
||||
.ForMember(o => o.TrialSiteId, t => t.MapFrom(u => u.Subject.TrialSiteId))
|
||||
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindTrialSiteCode :*/ u.Subject.TrialSite.TrialSiteCode))
|
||||
.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))
|
||||
@@ -167,7 +169,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
|
||||
CreateMap<VisitTask, IRHaveReadView>().IncludeBase<VisitTask, VisitTaskViewBasic>()
|
||||
.ForMember(o => o.SiteId, t => t.MapFrom(u => u.Subject.SiteId))
|
||||
.ForMember(o => o.TrialSiteId, t => t.MapFrom(u => u.Subject.TrialSiteId))
|
||||
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.IsAnalysisCreate == true ? u.BlindTrialSiteCode : u.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.IsAnalysisCreate == true ? u.BlindSubjectCode : u.Subject.Code));
|
||||
|
||||
@@ -223,17 +225,19 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(o => o.Id, t => t.MapFrom(u => u.Id))
|
||||
.ForMember(o => o.MedicalNo, t => t.MapFrom(u => u.VisitTask.Subject.MedicalNo))
|
||||
.ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.VisitTask.DoctorUser))
|
||||
.ForMember(o => o.MedicalManagerUser, t => t.MapFrom(u => u.MedicalManagerUser));
|
||||
.ForMember(o => o.MedicalManagerUser, t => t.MapFrom(u => u.MedicalManagerUser))
|
||||
.ForMember(o => o.AllocateTime, t => t.MapFrom(u => u.AllocateTime))
|
||||
;
|
||||
|
||||
CreateMap<VisitTask, TaskMedicalReviewView>()
|
||||
.ForMember(o => o.TrialReadingCriterionName, t => t.MapFrom(u => u.TrialReadingCriterion.CriterionName))
|
||||
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.IsAnalysisCreate == true ? u.BlindTrialSiteCode : u.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.IsAnalysisCreate == true ? u.BlindSubjectCode : u.Subject.Code));
|
||||
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u =>/* u.IsAnalysisCreate == true ? u.BlindTrialSiteCode :*/ u.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindSubjectCode :*/ u.Subject.Code));
|
||||
|
||||
CreateMap<VisitTask, GenerateMedicalReviewTaskView>()
|
||||
.ForMember(o => o.TrialReadingCriterionName, t => t.MapFrom(u => u.TrialReadingCriterion.CriterionName))
|
||||
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.IsAnalysisCreate == true ? u.BlindTrialSiteCode : u.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.IsAnalysisCreate == true ? u.BlindSubjectCode : u.Subject.Code))
|
||||
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindTrialSiteCode :*/ u.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => /*u.IsAnalysisCreate == true ? u.BlindSubjectCode :*/ u.Subject.Code))
|
||||
.ForMember(o => o.GeneratedMedicalReviewCount, t => t.MapFrom(u => u.TaskMedicalReviewList.Count()))
|
||||
.ForMember(o => o.MedicalNo, t => t.MapFrom(u => u.Subject.MedicalNo))
|
||||
.ForMember(o => o.IsGeneratedJudge, t => t.MapFrom(u => u.JudgeVisitTaskId != null))
|
||||
|
||||
@@ -87,6 +87,18 @@ namespace IRaCIS.Application.Services
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有字典的Key
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<string>> GetAllDictionaryKey()
|
||||
{
|
||||
var result =await _dicRepository.Where(t => t.ParentId == null).OrderBy(x=>x.Code).Select(x => x.Code).ToListAsync();
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加字典 的同时 一起添加子项 --New
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
var list = await _trialSiteUserRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters()
|
||||
.WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.SiteName), t => t.Site.SiteName.Contains(param.SiteName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.SiteName), t => t.TrialSite.TrialSiteName.Contains(param.SiteName) || t.TrialSite.TrialSiteAliasName.Contains(param.SiteName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteAliasName),
|
||||
t => t.TrialSite.TrialSiteAliasName.Contains(param.TrialSiteAliasName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode),
|
||||
@@ -153,9 +153,9 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
var groupSelectIdQuery =
|
||||
_trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId)
|
||||
.WhereIf(queryParam.SiteId != null, t => t.SiteId == queryParam.SiteId)
|
||||
.WhereIf(queryParam.TrialSiteId != null, t => t.TrialSiteId == queryParam.TrialSiteId)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.UserName).Contains(queryParam.FormWriterKeyInfo) || t.Email.Contains(queryParam.FormWriterKeyInfo) || t.Phone.Contains(queryParam.FormWriterKeyInfo))
|
||||
.GroupBy(t => t.SiteId)
|
||||
.GroupBy(t => t.TrialSiteId)
|
||||
.Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First());
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
var list = await _subjectVisitRepository.Where(x => x.TrialId == visitSearchDTO.TrialId)
|
||||
.Where(t => t.Subject.FinalSubjectVisitId != null ? t.VisitNum <= t.Subject.FinalSubjectVisit.VisitNum : true)
|
||||
.WhereIf(visitSearchDTO.SiteId != null, t => t.SiteId == visitSearchDTO.SiteId)
|
||||
.WhereIf(visitSearchDTO.TrialSiteId != null, t => t.TrialSiteId == visitSearchDTO.TrialSiteId)
|
||||
.WhereIf(visitSearchDTO.SubjectId != null, t => t.Subject.Id == visitSearchDTO.SubjectId)
|
||||
.WhereIf(!string.IsNullOrEmpty(visitSearchDTO.SubjectInfo), t => t.Subject.Code.Contains(visitSearchDTO.SubjectInfo))
|
||||
|
||||
@@ -275,7 +275,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
//.WhereIf(challengeQuery.ChallengeState != null, t => t.SubjectVisit.ChallengeState == challengeQuery.ChallengeState)
|
||||
.WhereIf(challengeQuery.ReuploadEnum != null, t => t.ReuploadEnum == challengeQuery.ReuploadEnum)
|
||||
.WhereIf(challengeQuery.IsClosed != null, t => t.IsClosed == challengeQuery.IsClosed)
|
||||
.WhereIf(challengeQuery.SiteId != null, t => t.SubjectVisit.SiteId == challengeQuery.SiteId)
|
||||
.WhereIf(challengeQuery.TrialSiteId != null, t => t.SubjectVisit.TrialSiteId == challengeQuery.TrialSiteId)
|
||||
.WhereIf(challengeQuery.SubjectId != null, t => t.SubjectVisit.SubjectId == challengeQuery.SubjectId)
|
||||
.WhereIf(challengeQuery.CreateUserId != null, t => t.CreateUserId == challengeQuery.CreateUserId)
|
||||
.WhereIf(!string.IsNullOrEmpty(challengeQuery.SubjectCode), t => t.SubjectVisit.Subject.Code.Contains(challengeQuery.SubjectCode))
|
||||
@@ -318,7 +318,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.Name), t => t.ShortName.Contains(param.Name))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.Sex), t => t.Sex.Contains(param.Sex))
|
||||
.WhereIf(param.Status != null, t => t.Status == param.Status)
|
||||
.WhereIf(param.SiteId != null, t => t.SiteId == param.SiteId)
|
||||
.WhereIf(param.TrialSiteId != null, t => t.TrialSiteId == param.TrialSiteId)
|
||||
// CRC 只负责他管理site的受试者
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.ProjectTo<SubjectExportDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
@@ -532,16 +532,16 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
var svExpression = QCCommon.GetStudyMonitorSubjectVisitFilter(studyQuery.VisitPlanArray);
|
||||
var StudyMonitorQuery = _repository.Where<StudyMonitor>(t => t.TrialId == studyQuery.TrialId)
|
||||
.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.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||
.WhereIf(studyQuery.SubjectId != null, t => t.SubjectId == studyQuery.SubjectId)
|
||||
.WhereIf(studyQuery.SubjectVisitId != null, t => t.SubjectId == studyQuery.SubjectVisitId)
|
||||
.WhereIf(studyQuery.SiteId != null, t => t.SiteId == studyQuery.SiteId)
|
||||
.WhereIf(studyQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == studyQuery.TrialSiteId)
|
||||
.Select(t => new UnionStudyMonitorExportDto()
|
||||
{
|
||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
TrialSiteAliasName = t.TrialSite.TrialSiteAliasName,
|
||||
TrialSiteCode = t.Subject.TrialSite.TrialSiteCode,
|
||||
TrialSiteAliasName = t.Subject.TrialSite.TrialSiteAliasName,
|
||||
|
||||
SubjectCode = t.Subject.Code,
|
||||
|
||||
@@ -642,7 +642,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
var svExpression = QCCommon.GetDicomStudySubjectVisitFilter(studyQuery.VisitPlanArray);
|
||||
|
||||
var dicomStudyQuery = _repository.Where<DicomStudy>(t => t.TrialId == studyQuery.TrialId)
|
||||
.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.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||
.Where(x => x.SubjectVisit.AuditState == AuditStateEnum.QCPassed)
|
||||
@@ -656,9 +656,9 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
StudyCode = t.StudyCode,
|
||||
StudyTime = t.StudyTime,
|
||||
|
||||
TrialSiteAliasName = t.TrialSite.TrialSiteAliasName,
|
||||
TrialSiteAliasName = t.Subject.TrialSite.TrialSiteAliasName,
|
||||
|
||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
TrialSiteCode = t.Subject.TrialSite.TrialSiteCode,
|
||||
|
||||
CheckState = t.SubjectVisit.CheckState,
|
||||
//Uploader = t.Uploader.UserName,
|
||||
@@ -670,7 +670,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
|
||||
|
||||
var nodeDicomStudyQuery = _repository.Where<NoneDicomStudy>(t => t.TrialId == studyQuery.TrialId)
|
||||
.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.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression2)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||
.Where(x => x.SubjectVisit.AuditState == AuditStateEnum.QCPassed)
|
||||
@@ -685,9 +685,9 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
StudyCode = t.StudyCode,
|
||||
StudyTime = t.ImageDate,
|
||||
|
||||
TrialSiteAliasName = t.TrialSite.TrialSiteAliasName,
|
||||
TrialSiteAliasName = t.Subject.TrialSite.TrialSiteAliasName,
|
||||
|
||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
TrialSiteCode = t.Subject.TrialSite.TrialSiteCode,
|
||||
|
||||
CheckState = t.SubjectVisit.CheckState,
|
||||
|
||||
@@ -735,7 +735,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
var list = await _subjectVisitRepository.Where(x => x.TrialId == checkQuery.TrialId)
|
||||
.Where(x => x.AuditState == AuditStateEnum.QCPassed) //一致性核查中的,或者还没一致性核查的
|
||||
.WhereIf(checkQuery.CheckState != null, t => t.CheckState == checkQuery.CheckState)
|
||||
.WhereIf(checkQuery.SiteId != null, t => t.SiteId == checkQuery.SiteId)
|
||||
.WhereIf(checkQuery.TrialSiteId != null, t => t.TrialSiteId == checkQuery.TrialSiteId)
|
||||
.WhereIf(!string.IsNullOrEmpty(checkQuery.SubjectInfo), t => t.Subject.Code.Contains(checkQuery.SubjectInfo))
|
||||
.WhereIf(checkQuery.VisitPlanArray != null && checkQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))//CRC 过滤负责的site
|
||||
@@ -773,7 +773,8 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
//.Where(t => t.IsAnalysisCreate == false && t.DoctorUserId != null)
|
||||
|
||||
.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.ArmEnum != null, t => t.ArmEnum == queryVisitTask.ArmEnum)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId)
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
@@ -826,7 +827,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
var list = await _repository.Where<VisitTaskReReading>(t => t.OriginalReReadingTask.TrialId == queryVisitTask.TrialId /*&& t.OriginalReReadingTask.IsAnalysisCreate == false*/)
|
||||
.WhereIf(queryVisitTask.RootReReadingTaskId != null, t => t.RootReReadingTaskId == queryVisitTask.RootReReadingTaskId || t.OriginalReReadingTaskId == queryVisitTask.RootReReadingTaskId)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskCode), t => t.OriginalReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!) || t.RootReReadingTask.TaskCode.Contains(queryVisitTask.TaskCode!))
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.OriginalReReadingTask.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.OriginalReReadingTask.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
.WhereIf(queryVisitTask.TaskState != null, t => t.OriginalReReadingTask.TaskState == queryVisitTask.TaskState)
|
||||
.WhereIf(queryVisitTask.ReReadingApplyState != null, t => t.OriginalReReadingTask.ReReadingApplyState == queryVisitTask.ReReadingApplyState)
|
||||
.WhereIf(queryVisitTask.SubjectId != null, t => t.OriginalReReadingTask.SubjectId == queryVisitTask.SubjectId)
|
||||
@@ -874,7 +875,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
{
|
||||
|
||||
var list = await _repository.Where<TaskMedicalReview>(t => t.VisitTask.TrialId == inQuery.TrialId)
|
||||
.WhereIf(inQuery.SiteId != null, t => t.VisitTask.Subject.SiteId == inQuery.SiteId)
|
||||
.WhereIf(inQuery.TrialSiteId != null, t => t.VisitTask.Subject.TrialSiteId == inQuery.TrialSiteId)
|
||||
.WhereIf(inQuery.SubjectId != null, t => t.VisitTask.SubjectId == inQuery.SubjectId)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.VisitTask.Subject.Code.Contains(inQuery.SubjectCode))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TaskName), t => t.VisitTask.TaskName.Contains(inQuery.TaskName) || t.VisitTask.TaskBlindName.Contains(inQuery.TaskName))
|
||||
@@ -935,7 +936,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
//.WhereIf(queryVisitTask.IsSelfAnalysis != null, t => t.IsSelfAnalysis == queryVisitTask.IsSelfAnalysis)
|
||||
|
||||
.WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
@@ -1019,7 +1020,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
//.WhereIf(queryVisitTask.IsSelfAnalysis != null, t => t.IsSelfAnalysis == queryVisitTask.IsSelfAnalysis)
|
||||
|
||||
.WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
@@ -1223,7 +1224,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
//.WhereIf(queryVisitTask.IsSelfAnalysis != null, t => t.IsSelfAnalysis == queryVisitTask.IsSelfAnalysis)
|
||||
|
||||
.WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
@@ -1280,7 +1281,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
//.WhereIf(queryVisitTask.IsSelfAnalysis != null, t => t.IsSelfAnalysis == queryVisitTask.IsSelfAnalysis)
|
||||
|
||||
.WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
@@ -1349,7 +1350,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||
//.WhereIf(queryVisitTask.IsSelfAnalysis != null, t => t.IsSelfAnalysis == queryVisitTask.IsSelfAnalysis)
|
||||
|
||||
.WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId)
|
||||
.WhereIf(queryVisitTask.SiteId != null, t => t.Subject.SiteId == queryVisitTask.SiteId)
|
||||
.WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId)
|
||||
|
||||
.WhereIf(queryVisitTask.IsUrgent != null, t => t.IsUrgent == queryVisitTask.IsUrgent)
|
||||
.WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId)
|
||||
|
||||
@@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using EasyCaching.Core;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using OfficeOpenXml.FormulaParsing.Utilities;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
@@ -41,11 +40,11 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
var cacheList= _provider.Get<List<InternationalizationSimpleDto>>(StaticData.InternationalData.Front).Value;
|
||||
|
||||
if(cacheList != null && cacheList.Count!=0)
|
||||
{
|
||||
return cacheList;
|
||||
}
|
||||
else
|
||||
//if(cacheList != null && cacheList.Count!=0)
|
||||
//{
|
||||
// return cacheList;
|
||||
//}
|
||||
//else
|
||||
{
|
||||
var list = await _internationalizationRepository.Where(t => t.InternationalizationType == 0).Select(t => new InternationalizationSimpleDto()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
Task SiteSurveyRejectEmail(MimeMessage messageToSend);
|
||||
|
||||
Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode);
|
||||
|
||||
Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode);
|
||||
|
||||
Task AnolymousSendEmailForResetAccount(string emailAddress, int verificationCode);
|
||||
@@ -91,6 +93,66 @@ namespace IRaCIS.Application.Services
|
||||
return str;
|
||||
}
|
||||
|
||||
//MFA
|
||||
public async Task SenMFAVerifyEmail(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));
|
||||
//主题
|
||||
//---[来自{0}] 关于MFA邮箱验证的提醒
|
||||
messageToSend.Subject = _localizer["Mail_EmailMFATopic", _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN];
|
||||
|
||||
var builder = new BodyBuilder();
|
||||
|
||||
|
||||
var pathToFile = _hostEnvironment.WebRootPath
|
||||
+ Path.DirectorySeparatorChar.ToString()
|
||||
+ "EmailTemplate"
|
||||
+ Path.DirectorySeparatorChar.ToString()
|
||||
//+ "UserOptCommon.html";
|
||||
+ (_userInfo.IsEn_Us ? "UserOptCommon_US.html" : "UserOptCommon.html");
|
||||
|
||||
using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
|
||||
{
|
||||
var templateInfo = SourceReader.ReadToEnd();
|
||||
|
||||
|
||||
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
|
||||
|
||||
userName,
|
||||
_localizer["Mail_MFAEmail"],
|
||||
verificationCode
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
messageToSend.Body = builder.ToMessageBody();
|
||||
|
||||
|
||||
|
||||
EventHandler<MessageSentEventArgs> sucessHandle = (sender, args) =>
|
||||
{
|
||||
// args.Response
|
||||
var code = verificationCode.ToString();
|
||||
_ = _verificationCodeRepository.AddAsync(new VerificationCode()
|
||||
{
|
||||
CodeType = 0,
|
||||
HasSend = true,
|
||||
Code = code,
|
||||
UserId = userId,
|
||||
ExpirationTime = DateTime.Now.AddMinutes(3)
|
||||
}).Result;
|
||||
_ = _verificationCodeRepository.SaveChangesAsync().Result;
|
||||
|
||||
};
|
||||
|
||||
|
||||
await SendEmailHelper.SendEmailAsync(messageToSend, _systemEmailConfig, sucessHandle);
|
||||
}
|
||||
|
||||
//重置邮箱
|
||||
public async Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode)
|
||||
{
|
||||
|
||||
@@ -182,6 +182,9 @@ namespace IRaCIS.Application.Contracts
|
||||
public string OptUserName { get; set; } = string.Empty;
|
||||
public DateTime? OptTime { get; set; }
|
||||
public string? OptTimeStr => OptTime?.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
|
||||
public string DoctorUserName { get; set; }
|
||||
}
|
||||
|
||||
public class DoctorOptDTO
|
||||
|
||||
@@ -60,7 +60,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<AddOrUpdateDicDTO, Dictionary>().ReverseMap();
|
||||
|
||||
//医生列表、项目显示列表模型转换
|
||||
CreateMap<DoctorDTO, SelectionReviewerDTO>();
|
||||
CreateMap<DoctorDTO, SelectionReviewerDTO>()
|
||||
;
|
||||
|
||||
CreateMap<User, UserBasicInfo>()
|
||||
.ForMember(d => d.UserTypeShortName, u => u.MapFrom(t => t.UserTypeRole.UserTypeShortName))
|
||||
@@ -80,7 +81,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(d => d.UserName, u => u.MapFrom(doctor => doctor.LastName + " / " + doctor.FirstName));
|
||||
|
||||
#region 医生基本信息
|
||||
CreateMap<Doctor, SelectionReviewerDTO>();
|
||||
CreateMap<Doctor, SelectionReviewerDTO>()
|
||||
.ForMember(d => d.DoctorUserName, u => u.MapFrom(t => t.User.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))
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public bool? IsDeleted { get; set; }
|
||||
public Guid? FileTypeId { get; set; }
|
||||
|
||||
public Guid? UserTypeId { get; set; }
|
||||
|
||||
public string Name { get; set; } = String.Empty;
|
||||
|
||||
[NotDefault]
|
||||
|
||||
@@ -108,6 +108,9 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
|
||||
public bool IsDistinguishCriteria { get; set; }
|
||||
|
||||
public string SortField { get; set; } = string.Empty;
|
||||
|
||||
public bool Asc { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
var taskInfo = await _repository.Where<VisitTask>(t => t.Id == visitTaskId).Select(t => new
|
||||
{
|
||||
t.Subject.SiteId,
|
||||
t.Subject.TrialSiteId,
|
||||
t.Trial.ResearchProgramNo,
|
||||
t.Subject.TrialSite.TrialSiteCode,
|
||||
SubjectCode = t.Subject.Code,
|
||||
@@ -102,7 +102,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
return (topicStr, htmlBodyStr, isEn_us, null);
|
||||
};
|
||||
|
||||
await SendTrialEmailAsync(taskInfo.TrialId, businessScenarioEnum, topicAndHtmlFunc, taskInfo.SiteId);
|
||||
await SendTrialEmailAsync(taskInfo.TrialId, businessScenarioEnum, topicAndHtmlFunc, taskInfo.TrialSiteId);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -117,7 +117,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
return (topicStr, htmlBodyStr, isEn_us, null);
|
||||
};
|
||||
|
||||
await SendTrialEmailAsync(taskInfo.TrialId, businessScenarioEnum, topicAndHtmlFunc, taskInfo.SiteId);
|
||||
await SendTrialEmailAsync(taskInfo.TrialId, businessScenarioEnum, topicAndHtmlFunc, taskInfo.TrialSiteId);
|
||||
}
|
||||
|
||||
|
||||
@@ -283,9 +283,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
|
||||
|
||||
public async Task SendTrialEmailAsync(Guid trialId, EmailBusinessScenario businessScenario, Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc, Guid? siteId = null, Guid? trialReadingCriterionId = null, Func<TrialEmailNoticeConfig, SMTPEmailConfig, SMTPEmailConfig> emailAttachFunc=null)
|
||||
public async Task SendTrialEmailAsync(Guid trialId, EmailBusinessScenario businessScenario, Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc, Guid? trialSiteId = null, Guid? trialReadingCriterionId = null, Func<TrialEmailNoticeConfig, SMTPEmailConfig, SMTPEmailConfig> emailAttachFunc=null)
|
||||
{
|
||||
var (trialEmailConfig, sendEmailConfig) = await BuildEmailConfig(trialId, businessScenario, topicAndHtmlFunc, siteId, trialReadingCriterionId);
|
||||
var (trialEmailConfig, sendEmailConfig) = await BuildEmailConfig(trialId, businessScenario, topicAndHtmlFunc, trialSiteId, trialReadingCriterionId);
|
||||
|
||||
if (sendEmailConfig != null)
|
||||
{
|
||||
@@ -295,7 +295,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
|
||||
|
||||
public async Task<(TrialEmailNoticeConfig?, SMTPEmailConfig?)> BuildEmailConfig(Guid trialId, EmailBusinessScenario businessScenario, Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc, Guid? siteId = null, Guid? trialReadingCriterionId = null)
|
||||
public async Task<(TrialEmailNoticeConfig?, SMTPEmailConfig?)> BuildEmailConfig(Guid trialId, EmailBusinessScenario businessScenario, Func<TrialEmailNoticeConfig, (string topicStr, string htmlBodyStr, bool isEn_us, Guid? onlyToUserId)> topicAndHtmlFunc, Guid? trialSiteId = null, Guid? trialReadingCriterionId = null)
|
||||
{
|
||||
//找到配置
|
||||
var trialEmailConfig = await _trialEmailNoticeConfigRepository.Where(t => t.TrialId == trialId && t.TrialReadingCriterionId == trialReadingCriterionId && t.BusinessScenarioEnum == businessScenario, ignoreQueryFilters: true)
|
||||
@@ -333,13 +333,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ToList();
|
||||
|
||||
//收件人 有CRC CRA , CRC CRA的账户要按照中心发送
|
||||
if (siteId == null && toUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA) && onlyToUserId == null)
|
||||
if (trialSiteId == null && toUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA) && onlyToUserId == null)
|
||||
{
|
||||
throw new BusinessValidationFailedException("当前场景收件人包含CRC CRA,但是没有siteId,请联系后端开发");
|
||||
}
|
||||
if (siteId != null && toUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA))
|
||||
if (trialSiteId != null && toUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA))
|
||||
{
|
||||
var curentSiteUserIdList = _repository.Where<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId == siteId).Select(t => t.UserId).ToList();
|
||||
var curentSiteUserIdList = _repository.Where<TrialSiteUser>(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();
|
||||
}
|
||||
@@ -351,9 +351,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
var copyUserList = allUserList.Where(t => copyUserTypeEnumList.Contains(t.UserTypeEnum))
|
||||
.Where(t => !blackUserIdList.Contains(t.UserId)).ToList();
|
||||
|
||||
if (siteId != null && copyUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA))
|
||||
if (trialSiteId != null && copyUserTypeEnumList.Any(t => t == UserTypeEnum.ClinicalResearchCoordinator || t == UserTypeEnum.CRA))
|
||||
{
|
||||
var curentSiteUserIdList = _repository.Where<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId == siteId).Select(t => t.UserId).ToList();
|
||||
var curentSiteUserIdList = _repository.Where<TrialSiteUser>(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();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using IRaCIS.Core.Application.Auth;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using System.Linq;
|
||||
|
||||
namespace IRaCIS.Core.Application.Services
|
||||
{
|
||||
@@ -63,6 +64,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
var trialDocumentQueryable = _trialDocumentRepository.AsQueryable(true).Where(t => t.TrialId == queryTrialDocument.TrialId)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryTrialDocument.Name), t => t.Name.Contains(queryTrialDocument.Name))
|
||||
.WhereIf(queryTrialDocument.FileTypeId != null, t => t.FileTypeId == queryTrialDocument.FileTypeId)
|
||||
.WhereIf(queryTrialDocument.UserTypeId != null, t => t.NeedConfirmedUserTypeList.Any(t=>t.NeedConfirmUserTypeId== queryTrialDocument.UserTypeId) )
|
||||
.WhereIf(queryTrialDocument.IsDeleted != null, t => t.IsDeleted == queryTrialDocument.IsDeleted)
|
||||
.ProjectTo<TrialDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken, isEn_Us = _userInfo.IsEn_Us });
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using SharpCompress.Common;
|
||||
using SkiaSharp;
|
||||
using DocumentFormat.OpenXml.Bibliography;
|
||||
using System.Linq.Dynamic.Core;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
@@ -235,7 +236,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
t.SourceSubjectVisitId,
|
||||
t.SouceReadModuleId,
|
||||
t.SubjectId,
|
||||
t.Subject.SiteId,
|
||||
t.Subject.TrialSiteId,
|
||||
|
||||
t.DoctorUserId,
|
||||
t.ReadingTaskState,
|
||||
@@ -316,13 +317,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
};
|
||||
|
||||
|
||||
var (trialEmailConfig, sendEmailConfig) = await _emailSendService.BuildEmailConfig(taskInfo.TrialId, businessScenarioEnum, topicAndHtmlFunc, taskInfo.SiteId,taskInfo.TrialReadingCriterionId);
|
||||
var (trialEmailConfig, sendEmailConfig) = await _emailSendService.BuildEmailConfig(taskInfo.TrialId, businessScenarioEnum, topicAndHtmlFunc, taskInfo.TrialSiteId, taskInfo.TrialReadingCriterionId);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//自动发送
|
||||
if (sendEmailConfig != null && trialEmailConfig !=null)
|
||||
if (sendEmailConfig != null && trialEmailConfig != null)
|
||||
{
|
||||
#region 不同标准 不同项目配置 发送邮件的时机 处理具体逻辑
|
||||
|
||||
@@ -380,7 +381,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
//有序
|
||||
|
||||
if (taskInfo.IsReadingTaskViewInOrder)
|
||||
if (taskInfo.IsReadingTaskViewInOrder==ReadingOrder.InOrder)
|
||||
{
|
||||
|
||||
|
||||
@@ -658,7 +659,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
var path = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, _userInfo.IsEn_Us ? trialEmailConfig.AttachPath : trialEmailConfig.AttachCNPath);
|
||||
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetSubjectEnrollConfirmOrPDEmailPath(_hostEnvironment, Path.GetFileName(path), taskInfo.TrialId, taskInfo.SiteId, taskInfo.SubjectId, true);
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetSubjectEnrollConfirmOrPDEmailPath(_hostEnvironment, Path.GetFileName(path), taskInfo.TrialId, taskInfo.TrialSiteId, taskInfo.SubjectId, true);
|
||||
|
||||
if (emailStoreMode == EmailStoreSendMode.StoreLocalSend || emailStoreMode == EmailStoreSendMode.OnlyStoreLocalNotSentEmail)
|
||||
{
|
||||
@@ -679,8 +680,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
}
|
||||
else
|
||||
{
|
||||
var wordStoreServerPath = Path.Combine(Path.GetDirectoryName(serverFilePath), Path.GetFileNameWithoutExtension(serverFilePath)+".docx");
|
||||
|
||||
var wordStoreServerPath = Path.Combine(Path.GetDirectoryName(serverFilePath), Path.GetFileNameWithoutExtension(serverFilePath) + ".docx");
|
||||
|
||||
using (FileStream fileStream = new FileStream(wordStoreServerPath, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
wordMemoryStream.WriteTo(fileStream);
|
||||
@@ -718,7 +719,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
Document document = new Document();
|
||||
document.LoadFromStream(wordMemoryStream, FileFormat.Docx);
|
||||
document.SaveToStream(pdfMemoryStream, FileFormat.PDF);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -887,7 +888,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
{ TrialReadingCriterionId = t.Id, t.ReadingType, t.IsReadingTaskViewInOrder, t.CriterionType, t.ArbitrationRule }).FirstNotNullAsync();
|
||||
|
||||
// 项目双重
|
||||
if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Double && trialReadingCriterionConfig.IsReadingTaskViewInOrder)
|
||||
if (trialReadingCriterionConfig.ReadingType == ReadingMethod.Double && trialReadingCriterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
//仲裁在访视上面
|
||||
if (trialReadingCriterionConfig.ArbitrationRule == ArbitrationRule.Visit)
|
||||
@@ -1355,7 +1356,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
.WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum)
|
||||
.ProjectTo<TrialEmailNoticeConfigView>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await trialEmailNoticeConfigQueryable.ToListAsync();
|
||||
var sortField = string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TrialEmailNoticeConfigView.Code) : inQuery.SortField;
|
||||
var orderQuery = inQuery.Asc ? trialEmailNoticeConfigQueryable.OrderBy(sortField) : trialEmailNoticeConfigQueryable.OrderBy(sortField + " desc");
|
||||
return await orderQuery.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public int SliceLocation { get; set; }
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
@@ -30,6 +29,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public bool IsDeleted { get; set; }
|
||||
public bool IsReading { get; set; } = true;
|
||||
|
||||
public string SliceThickness { get; set; } = String.Empty;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +52,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public string VisitName { get; set; } = string.Empty;
|
||||
public string Sponsor { get; set; } = string.Empty;
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
|
||||
{
|
||||
public class DicomSeriesDTO
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
public bool IsDicom { get; set; } = true;
|
||||
|
||||
public bool IsBeMark { get; set; } = false;
|
||||
@@ -21,7 +27,7 @@
|
||||
public string SliceThickness { get; set; } = String.Empty;
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
@@ -33,11 +39,11 @@
|
||||
public bool IsDeleted { get; set; }
|
||||
public bool IsReading { get; set; } = true;
|
||||
|
||||
public List<Guid> InstanceList { get; set; } = new List<Guid>();
|
||||
|
||||
public List<string> InstancePathList { get; set; } = new List<string>();
|
||||
public List<InstanceBasicInfo> InstanceInfoList { get; set; }=new List<InstanceBasicInfo>();
|
||||
|
||||
public bool IsExistMutiFrames => InstanceInfoList.Any(t => t.NumberOfFrames > 1);
|
||||
|
||||
public List<string> InstanceHtmlPathList { get; set; }
|
||||
|
||||
//存放在instance 上面
|
||||
public string WindowCenter { get; set; } = string.Empty;
|
||||
@@ -46,6 +52,24 @@
|
||||
public string ImageResizePath { get; set; }
|
||||
}
|
||||
|
||||
public class InstanceBasicInfo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string Path { get; set; }
|
||||
|
||||
public string HtmlPath { get; set; }
|
||||
|
||||
public int NumberOfFrames { get; set; }
|
||||
|
||||
public int InstanceNumber { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int ShowOrder { get; set; }
|
||||
[JsonIgnore]
|
||||
public decimal RowIndex { get; set; }
|
||||
}
|
||||
|
||||
public class DicomSeriesWithLabelDTO : DicomSeriesDTO
|
||||
{
|
||||
public bool HasLabel { get; set; } = false;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
@@ -18,7 +18,7 @@
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
@@ -74,7 +74,7 @@
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
//public string SubjectName { get; set; }
|
||||
|
||||
public string SubjectCode { get; set; } = string.Empty;
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO
|
||||
{
|
||||
public class SubjectImageUploadDTO
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid SubejctId { get; set; }
|
||||
|
||||
public string SubjectCode { get; set; }
|
||||
|
||||
public string TaskBlindName { get; set; }
|
||||
|
||||
public string TaskName { get; set; }
|
||||
|
||||
public bool IsImageFilter { get; set; }
|
||||
public string CriterionModalitys { get; set; }
|
||||
|
||||
public Guid? SourceSubjectVisitId { get; set; }
|
||||
public PackState PackState { get; set; }
|
||||
|
||||
public List<StudyBasicInfo> OrginalStudyList { get; set; }
|
||||
|
||||
public List<StudyBasicInfo> UploadStudyList { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class StudyBasicInfo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string StudyInstanceUid { get; set; }
|
||||
|
||||
public string StudyCode { get; set; }
|
||||
|
||||
public string ModalityForEdit { get; set; }
|
||||
|
||||
public string BodyPartExamined { get; set; }
|
||||
|
||||
|
||||
public string BodyPartForEdit { get; set; }
|
||||
|
||||
public DateTime? StudyTime { get; set; }
|
||||
|
||||
public string Modalities { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
public int SeriesCount { get; set; }
|
||||
public int InstanceCount { get; set; }
|
||||
|
||||
public List<string> SopInstanceUidList { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
|
||||
public class ImageShareCommand
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid? StudyId { get; set; }
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
@@ -91,25 +91,6 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
return $" {uploadTimeSpan?.Hours}:{uploadTimeSpan?.Minutes}:{uploadTimeSpan?.Seconds}.{uploadTimeSpan?.Milliseconds}";
|
||||
|
||||
#region 废弃
|
||||
//if (uploadTimeSpan.Seconds == 0 && uploadTimeSpan.Minutes==0 && uploadTimeSpan.Hours == 0)
|
||||
//{
|
||||
// return $"{uploadTimeSpan.Milliseconds}毫秒";
|
||||
//}
|
||||
//else if (uploadTimeSpan.Minutes == 0 && uploadTimeSpan.Hours == 0)
|
||||
//{
|
||||
// return $"{uploadTimeSpan.Seconds}秒";
|
||||
//}
|
||||
//else if (uploadTimeSpan.Hours == 0)
|
||||
//{
|
||||
// return $"{uploadTimeSpan.Minutes} 分钟 {uploadTimeSpan.Seconds} 秒";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// return $" {uploadTimeSpan.Hours} 小时 {uploadTimeSpan.Minutes} 分钟 {uploadTimeSpan.Seconds} 秒 {uploadTimeSpan.Milliseconds}毫秒";
|
||||
//}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +147,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
public Guid? SubjectVisitId { get; set; }
|
||||
|
||||
public string SubjectInfo { get; set; } = String.Empty;
|
||||
@@ -176,30 +157,28 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
||||
public bool? IsDicom { get; set; }
|
||||
public bool? IsDicom { get; set; }
|
||||
|
||||
public string? Uploader { get; set; }
|
||||
public string? Uploader { get; set; }
|
||||
|
||||
public bool? IsSuccess { get; set; }
|
||||
public bool? IsSuccess { get; set; }
|
||||
|
||||
public string? StudyCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class PreArchiveDicomStudyCommand
|
||||
public class PriArchiveTaskStudyCommand
|
||||
{
|
||||
//public string StudyInstanceUid { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid SiteId { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
|
||||
public decimal FileSize { get; set; }
|
||||
|
||||
public bool IsDicomReUpload { get; set; }
|
||||
@@ -208,34 +187,73 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public int FileCount { get; set; }
|
||||
}
|
||||
|
||||
public class NewArchiveStudyCommand
|
||||
public class PreArchiveDicomStudyCommand
|
||||
{
|
||||
|
||||
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid SubjectId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
|
||||
public decimal FileSize { get; set; }
|
||||
|
||||
public bool IsDicomReUpload { get; set; }
|
||||
|
||||
|
||||
public int FileCount { get; set; }
|
||||
}
|
||||
|
||||
public class TaskArchiveStudyCommand
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid StudyMonitorId { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid StudyMonitorId { get; set; }
|
||||
|
||||
public int FailedFileCount { get; set; }
|
||||
|
||||
public string RecordPath { get; set; } = string.Empty;
|
||||
|
||||
public AddOrUpdateStudyDto Study { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public class NewArchiveStudyCommand
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid TrialSiteId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid SubjectId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
[NotDefault]
|
||||
public Guid StudyMonitorId { get; set; }
|
||||
|
||||
public int FailedFileCount { get; set; }
|
||||
|
||||
public string RecordPath { get; set; } = string.Empty;
|
||||
|
||||
public AddOrUpdateStudyDto Study { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class AddOrUpdateStudyDto
|
||||
{
|
||||
|
||||
|
||||
public string StudyId { get; set; } = string.Empty;
|
||||
|
||||
|
||||
//public int Code { get; set; } = 0;
|
||||
|
||||
//public string StudyCode { get; set; } = string.Empty;
|
||||
@@ -290,7 +308,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public string AcquisitionNumber { get; set; } = string.Empty;
|
||||
public string TriggerTime { get; set; } = string.Empty;
|
||||
|
||||
public string ImageResizePath { get; set; }=string.Empty;
|
||||
public string ImageResizePath { get; set; } = string.Empty;
|
||||
public List<AddInstanceDto> InstanceList { get; set; }
|
||||
|
||||
public Guid? VisitTaskId { get; set; }
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
}
|
||||
|
||||
|
||||
var (physicalPath, relativePath) = FileStoreHelper.GetDicomInstanceFilePath(_hostEnvironment, dicomStudy.TrialId, dicomStudy.SiteId, dicomStudy.SubjectId, dicomStudy.SubjectVisitId, dicomStudy.Id, dicomInstance.Id);
|
||||
var (physicalPath, relativePath) = FileStoreHelper.GetDicomInstanceFilePath(_hostEnvironment, dicomStudy.TrialId, dicomStudy.SubjectId, dicomStudy.SubjectVisitId, dicomStudy.Id, dicomInstance.Id);
|
||||
|
||||
dicomInstance.Path = relativePath;
|
||||
|
||||
@@ -270,7 +270,6 @@ namespace IRaCIS.Core.Application.Services
|
||||
TriggerTime = dataset.GetSingleValueOrDefault(DicomTag.TriggerTime, string.Empty),
|
||||
|
||||
|
||||
SiteId = addtionalInfo.SiteId,
|
||||
TrialId = addtionalInfo.TrialId,
|
||||
SubjectId = addtionalInfo.SubjectId,
|
||||
SubjectVisitId = addtionalInfo.SubjectVisitId,
|
||||
@@ -400,7 +399,6 @@ namespace IRaCIS.Core.Application.Services
|
||||
AcquisitionNumber = dataset.GetSingleValueOrDefault(DicomTag.AcquisitionNumber, string.Empty),
|
||||
TriggerTime = dataset.GetSingleValueOrDefault(DicomTag.TriggerTime, string.Empty),
|
||||
|
||||
SiteId = dicomStudy.SiteId,
|
||||
TrialId = dicomStudy.TrialId,
|
||||
SubjectId = dicomStudy.SubjectId,
|
||||
SubjectVisitId = dicomStudy.SubjectVisitId,
|
||||
@@ -433,7 +431,6 @@ namespace IRaCIS.Core.Application.Services
|
||||
StudyId = dicomStudy.Id,
|
||||
SeriesId = dicomSeries.Id,
|
||||
|
||||
SiteId = dicomStudy.SiteId,
|
||||
TrialId = dicomStudy.TrialId,
|
||||
SubjectId = dicomStudy.SubjectId,
|
||||
SubjectVisitId = dicomStudy.SubjectVisitId,
|
||||
@@ -536,7 +533,6 @@ namespace IRaCIS.Core.Application.Services
|
||||
TriggerTime = dataset.GetSingleValueOrDefault(DicomTag.TriggerTime, string.Empty),
|
||||
|
||||
|
||||
SiteId = Guid.Empty,
|
||||
TrialId = Guid.Empty,
|
||||
SubjectId = Guid.Empty,
|
||||
SubjectVisitId = Guid.Empty,
|
||||
@@ -607,7 +603,6 @@ namespace IRaCIS.Core.Application.Services
|
||||
AcquisitionNumber = dataset.GetSingleValueOrDefault(DicomTag.AcquisitionNumber, string.Empty),
|
||||
TriggerTime = dataset.GetSingleValueOrDefault(DicomTag.TriggerTime, string.Empty),
|
||||
|
||||
SiteId = Guid.Empty,
|
||||
TrialId = Guid.Empty,
|
||||
SubjectId = Guid.Empty,
|
||||
SubjectVisitId = Guid.Empty,
|
||||
@@ -630,7 +625,6 @@ namespace IRaCIS.Core.Application.Services
|
||||
StudyInstanceUid = findStudy.StudyInstanceUid,
|
||||
SeriesInstanceUid = findSerice.SeriesInstanceUid,
|
||||
|
||||
SiteId = Guid.Empty,
|
||||
TrialId = Guid.Empty,
|
||||
SubjectId = Guid.Empty,
|
||||
SubjectVisitId = Guid.Empty,
|
||||
|
||||
@@ -0,0 +1,680 @@
|
||||
using EasyCaching.Core;
|
||||
using FellowOakDicom;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.Service.ImageAndDoc.DTO;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using MassTransit;
|
||||
using MathNet.Numerics;
|
||||
using Medallion.Threading;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
{
|
||||
public interface IDownloadAndUploadService
|
||||
{
|
||||
Task PackageAndAnonymizImage(Guid trialId, Guid subjectVisitId, bool isAnonymize = true);
|
||||
}
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class DownloadAndUploadService : BaseService, IDownloadAndUploadService
|
||||
{
|
||||
private readonly IEasyCachingProvider _provider;
|
||||
private readonly IRepository<SystemAnonymization> _systemAnonymizationRepository;
|
||||
private readonly IRepository<VisitTask> _visitTaskRepository;
|
||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
private readonly IOSSService _oSSService;
|
||||
private readonly IRepository<StudyMonitor> _studyMonitorRepository;
|
||||
private readonly IDistributedLockProvider _distributedLockProvider;
|
||||
public DownloadAndUploadService(IEasyCachingProvider provider, IRepository<SystemAnonymization> systemAnonymizationRepository, IRepository<SubjectVisit> subjectVisitRepository, IOSSService oSSService,
|
||||
IRepository<StudyMonitor> studyMonitorRepository, IDistributedLockProvider distributedLockProvider, IRepository<VisitTask> visitTaskRepository)
|
||||
{
|
||||
_systemAnonymizationRepository = systemAnonymizationRepository;
|
||||
|
||||
_subjectVisitRepository = subjectVisitRepository;
|
||||
|
||||
_oSSService = oSSService;
|
||||
_studyMonitorRepository = studyMonitorRepository;
|
||||
_distributedLockProvider = distributedLockProvider;
|
||||
_provider = provider;
|
||||
_visitTaskRepository = visitTaskRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 受试者随机阅片,任务进行随机编号
|
||||
/// 进入阅片任务前,随机挑选出该受试者的一个任务,然后给该任务一个编号,编号给的逻辑是:TimePoint Ran+ 已阅任务数量+1
|
||||
/// 根据当前受试者该标准已阅任务数量(生效失效的任务都算,考虑重阅,最后编号不重复) 第一个就是TimePoint Ran1,后面依次随机挑选出来的阅片序号依次递增
|
||||
/// </summary>
|
||||
/// <param name="subjectId"></param>
|
||||
/// <param name="trialReadingCriterionId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> SubejctRandomReadingTaskNameDeal(Guid subjectId, Guid trialReadingCriterionId)
|
||||
{
|
||||
//subject 随机阅片 才处理任务编号
|
||||
if (_visitTaskRepository.Any(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.TrialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.SubjectRandom))
|
||||
{
|
||||
//找到 非一致性分析,未签名,状态正常的 并且任务名称是TimePoint的 任务
|
||||
var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId==_userInfo.Id
|
||||
&& 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.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit);
|
||||
|
||||
//随机赋值编号 比如要处理5个任务,实例化一个包含1-5的数组,每次随机取出一个
|
||||
|
||||
List<int> availableNumbers = Enumerable.Range(haveFinishedTaskCount + 1, needDealTaskList.Count).ToList();
|
||||
Random rng = new Random();
|
||||
foreach (var visitTask in needDealTaskList)
|
||||
{
|
||||
int randomIndex = rng.Next(availableNumbers.Count);
|
||||
|
||||
visitTask.TaskBlindName = $"Timepoint Ran {availableNumbers[randomIndex]}";
|
||||
|
||||
availableNumbers.RemoveAt(randomIndex);
|
||||
}
|
||||
await _visitTaskRepository.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取该受试者任务上传列表(展示已上传情况)
|
||||
/// </summary>
|
||||
/// <param name="subjectId"></param>
|
||||
/// <param name="trialReadingCriterionId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput<List<SubjectImageUploadDTO>>> GetSubjectImageUploadList(Guid subjectId,Guid trialReadingCriterionId)
|
||||
{
|
||||
await SubejctRandomReadingTaskNameDeal(subjectId, trialReadingCriterionId);
|
||||
|
||||
var query = _repository.Where<VisitTask>(t => t.SubjectId == subjectId &&t.TrialReadingCriterionId== trialReadingCriterionId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id)
|
||||
.Select(u => new SubjectImageUploadDTO()
|
||||
{
|
||||
VisitTaskId = u.Id,
|
||||
|
||||
SubejctId = u.SubjectId,
|
||||
|
||||
|
||||
|
||||
TrialSiteId = u.Subject.TrialSiteId,
|
||||
|
||||
IsImageFilter = u.TrialReadingCriterion.IsImageFilter,
|
||||
|
||||
CriterionModalitys = u.TrialReadingCriterion.CriterionModalitys,
|
||||
|
||||
SubjectCode = u.IsSelfAnalysis == true ? u.BlindSubjectCode : u.Subject.Code,
|
||||
TaskBlindName = u.TaskBlindName,
|
||||
TaskName = u.TaskName,
|
||||
|
||||
SourceSubjectVisitId = u.SourceSubjectVisitId,
|
||||
PackState = u.SourceSubjectVisit.PackState,
|
||||
|
||||
OrginalStudyList = u.SourceSubjectVisit.StudyList.Select(t => new StudyBasicInfo()
|
||||
{
|
||||
Id = t.Id,
|
||||
StudyInstanceUid = t.StudyInstanceUid,
|
||||
ModalityForEdit = t.ModalityForEdit,
|
||||
BodyPartExamined = t.BodyPartExamined,
|
||||
BodyPartForEdit = t.BodyPartForEdit,
|
||||
|
||||
StudyCode = t.StudyCode,
|
||||
StudyTime = t.StudyTime,
|
||||
Description = t.Description,
|
||||
InstanceCount = t.InstanceCount,
|
||||
Modalities = t.Modalities,
|
||||
SeriesCount = t.SeriesCount,
|
||||
}).ToList(),
|
||||
|
||||
UploadStudyList = u.TaskStudyList.Select(t => new StudyBasicInfo()
|
||||
{
|
||||
Id = t.Id,
|
||||
StudyInstanceUid = t.StudyInstanceUid,
|
||||
ModalityForEdit = t.ModalityForEdit,
|
||||
BodyPartExamined = t.BodyPartExamined,
|
||||
BodyPartForEdit = t.BodyPartForEdit,
|
||||
|
||||
StudyCode = t.StudyCode,
|
||||
StudyTime = t.StudyTime,
|
||||
Description = t.Description,
|
||||
InstanceCount = t.InstanceCount,
|
||||
Modalities = t.Modalities,
|
||||
SeriesCount = t.SeriesCount,
|
||||
|
||||
SopInstanceUidList = t.InstanceList.Select(t => t.SopInstanceUid).ToList(),
|
||||
|
||||
}).ToList()
|
||||
})
|
||||
;
|
||||
|
||||
var list = await query.ToListAsync();
|
||||
|
||||
return ResponseOutput.Ok(list);
|
||||
}
|
||||
|
||||
private void SpecialArchiveStudyDeal(TaskStudy study)
|
||||
{
|
||||
#region 特殊逻辑
|
||||
|
||||
|
||||
if (study.PatientBirthDate.Length == 8)
|
||||
{
|
||||
study.PatientBirthDate = $"{study.PatientBirthDate[0]}{study.PatientBirthDate[1]}{study.PatientBirthDate[2]}{study.PatientBirthDate[3]}-{study.PatientBirthDate[4]}{study.PatientBirthDate[5]}-{study.PatientBirthDate[6]}{study.PatientBirthDate[7]}";
|
||||
}
|
||||
|
||||
var dicModalityList = _repository.Where<Dictionary>(t => t.Code == "Modality").SelectMany(t => t.ChildList.Select(c => c.Value)).ToList();
|
||||
|
||||
|
||||
var modality = study.Modalities;
|
||||
|
||||
var modalityForEdit = dicModalityList.Contains(modality) ? modality : String.Empty;
|
||||
|
||||
if (modality == "MR")
|
||||
{
|
||||
modalityForEdit = "MRI";
|
||||
}
|
||||
|
||||
if (modality == "PT")
|
||||
{
|
||||
modalityForEdit = "PET";
|
||||
}
|
||||
if (modality == "PT、CT")
|
||||
{
|
||||
modalityForEdit = "PET-CT";
|
||||
}
|
||||
|
||||
study.ModalityForEdit = modalityForEdit;
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
|
||||
public async Task<IResponseOutput> PreArchiveDicomStudy(PriArchiveTaskStudyCommand preArchiveStudyCommand)
|
||||
{
|
||||
|
||||
var studyMonitor = new StudyMonitor()
|
||||
{
|
||||
TrialId = preArchiveStudyCommand.TrialId,
|
||||
SubjectId = preArchiveStudyCommand.SubjectId,
|
||||
SubjectVisitId = preArchiveStudyCommand.SubjectVisitId,
|
||||
|
||||
IsSuccess = false,
|
||||
UploadStartTime = DateTime.Now,
|
||||
IsDicom = true,
|
||||
IP = _userInfo.IP,
|
||||
|
||||
IsDicomReUpload = preArchiveStudyCommand.IsDicomReUpload,
|
||||
FileSize = preArchiveStudyCommand.FileSize,
|
||||
FileCount = preArchiveStudyCommand.FileCount,
|
||||
|
||||
};
|
||||
|
||||
|
||||
var addEntity = await _studyMonitorRepository.AddAsync(studyMonitor, true);
|
||||
|
||||
return ResponseOutput.Ok(addEntity.Id);
|
||||
|
||||
}
|
||||
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput> AddOrUpdateArchiveTaskStudy(TaskArchiveStudyCommand incommand)
|
||||
{
|
||||
#region 获取该subject 已生成任务的访视的检查
|
||||
|
||||
var queryStudy = _repository.Where<VisitTask>(t => t.SubjectId == incommand.SubjectId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id).Select(u => new
|
||||
{
|
||||
VisitTaskId = u.Id,
|
||||
SourceSubjectVisitId = u.SourceSubjectVisitId,
|
||||
OrginalStudyList = u.SourceSubjectVisit.StudyList.Select(t => new StudyBasicInfo()
|
||||
{
|
||||
Id = t.Id,
|
||||
StudyInstanceUid = t.StudyInstanceUid
|
||||
}).ToList(),
|
||||
});
|
||||
|
||||
var studyList = await queryStudy.ToListAsync();
|
||||
|
||||
|
||||
var findOriginStudy = studyList.FirstOrDefault(c => c.OrginalStudyList.Any(t => t.StudyInstanceUid == incommand.Study.StudyInstanceUid));
|
||||
|
||||
if (findOriginStudy == null)
|
||||
{
|
||||
return ResponseOutput.NotOk("该检查不属于该受试者,请核查");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
var modalitys = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
var trialId = incommand.TrialId;
|
||||
|
||||
|
||||
var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == incommand.StudyMonitorId);
|
||||
studyMonitor.UploadFinishedTime = DateTime.Now;
|
||||
studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
||||
studyMonitor.FailedFileCount = incommand.FailedFileCount;
|
||||
studyMonitor.IsSuccess = incommand.FailedFileCount == 0;
|
||||
studyMonitor.RecordPath = incommand.RecordPath;
|
||||
|
||||
//上传
|
||||
if (studyMonitor.IsDicomReUpload == false)
|
||||
{
|
||||
var study = _mapper.Map<TaskStudy>(incommand.Study);
|
||||
|
||||
var @lock = _distributedLockProvider.CreateLock($"StudyCode");
|
||||
|
||||
using (await @lock.AcquireAsync())
|
||||
{
|
||||
//查询数据库获取最大的Code 没有记录则为0
|
||||
var dbStudyCodeIntMax = _repository.Where<TaskStudy>(s => s.TrialId == trialId).Select(t => t.Code).DefaultIfEmpty().Max();
|
||||
|
||||
//获取缓存中的值 并发的时候,需要记录,已被占用的值 这样其他线程在此占用的最大的值上递增
|
||||
var cacheMaxCodeInt = _provider.Get<int>($"{trialId}_{StaticData.CacheKey.StudyMaxCode}").Value;
|
||||
|
||||
int currentNextCodeInt = cacheMaxCodeInt > dbStudyCodeIntMax ? cacheMaxCodeInt + 1 : dbStudyCodeIntMax + 1;
|
||||
study.Code = currentNextCodeInt;
|
||||
|
||||
study.StudyCode = AppSettings.GetCodeStr(currentNextCodeInt, nameof(DicomStudy));
|
||||
|
||||
_provider.Set<int>($"{trialId}_{StaticData.CacheKey.StudyMaxCode}", study.Code, TimeSpan.FromMinutes(30));
|
||||
|
||||
}
|
||||
|
||||
|
||||
study.Id = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString(), findOriginStudy.VisitTaskId.ToString());
|
||||
study.TrialId = incommand.TrialId;
|
||||
study.SubjectId = incommand.SubjectId;
|
||||
study.VisitTaskId = findOriginStudy.VisitTaskId;
|
||||
//study.SubjectVisitId = incommand.SubjectVisitId;
|
||||
|
||||
|
||||
//特殊处理逻辑
|
||||
study.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Distinct());
|
||||
SpecialArchiveStudyDeal(study);
|
||||
modalitys = study.Modalities;
|
||||
|
||||
await _repository.AddAsync(study);
|
||||
|
||||
|
||||
studyMonitor.StudyId = study.Id;
|
||||
studyMonitor.StudyCode = study.StudyCode;
|
||||
|
||||
|
||||
foreach (var seriesItem in incommand.Study.SeriesList)
|
||||
{
|
||||
var series = _mapper.Map<TaskSeries>(seriesItem);
|
||||
|
||||
series.Id = IdentifierHelper.CreateGuid(seriesItem.StudyInstanceUid, seriesItem.SeriesInstanceUid, incommand.TrialId.ToString(), findOriginStudy.VisitTaskId.ToString());
|
||||
series.StudyId = study.Id;
|
||||
|
||||
series.TrialId = incommand.TrialId;
|
||||
series.SubjectId = incommand.SubjectId;
|
||||
//series.SubjectVisitId = incommand.SubjectVisitId;
|
||||
series.VisitTaskId = findOriginStudy.VisitTaskId;
|
||||
|
||||
//前端传递的数量不准,上传的时候,把失败的也加进来了,以实际数组的数字为准
|
||||
series.InstanceCount = seriesItem.InstanceList.Count;
|
||||
|
||||
await _repository.AddAsync(series);
|
||||
|
||||
foreach (var instanceItem in seriesItem.InstanceList)
|
||||
{
|
||||
var isntance = _mapper.Map<TaskInstance>(instanceItem);
|
||||
|
||||
Guid instanceId = IdentifierHelper.CreateGuid(study.StudyInstanceUid, series.SeriesInstanceUid, isntance.SopInstanceUid, study.TrialId.ToString(), findOriginStudy.VisitTaskId.ToString());
|
||||
|
||||
isntance.Id = instanceId;
|
||||
isntance.StudyId = study.Id;
|
||||
isntance.SeriesId = series.Id;
|
||||
|
||||
isntance.TrialId = incommand.TrialId;
|
||||
isntance.SubjectId = incommand.SubjectId;
|
||||
//isntance.SubjectVisitId = incommand.SubjectVisitId;
|
||||
isntance.VisitTaskId = findOriginStudy.VisitTaskId;
|
||||
|
||||
await _repository.AddAsync(isntance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var studyId = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString(), findOriginStudy.VisitTaskId.ToString());
|
||||
|
||||
var study = await _repository.FirstOrDefaultAsync<TaskStudy>(t => t.Id == studyId);
|
||||
|
||||
//重传的时候也要赋值检查Id
|
||||
studyMonitor.StudyId = study.Id;
|
||||
studyMonitor.StudyCode = study.StudyCode;
|
||||
|
||||
//特殊处理逻辑
|
||||
study.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Union(study.Modalities.Split("、", StringSplitOptions.RemoveEmptyEntries)).Distinct());
|
||||
SpecialArchiveStudyDeal(study);
|
||||
modalitys = study.Modalities;
|
||||
|
||||
|
||||
// 少了整个序列
|
||||
|
||||
//某个序列下少了instance
|
||||
foreach (var seriesItem in incommand.Study.SeriesList)
|
||||
{
|
||||
var seriesId = IdentifierHelper.CreateGuid(seriesItem.StudyInstanceUid, seriesItem.SeriesInstanceUid, trialId.ToString(), findOriginStudy.VisitTaskId.ToString());
|
||||
|
||||
TaskSeries dicomSeries = await _repository.FirstOrDefaultAsync<TaskSeries>(t => t.Id == seriesId);
|
||||
|
||||
//判断重复
|
||||
if (dicomSeries == null)
|
||||
{
|
||||
var series = _mapper.Map<TaskSeries>(seriesItem);
|
||||
|
||||
series.Id = seriesId;
|
||||
series.StudyId = study.Id;
|
||||
|
||||
series.TrialId = incommand.TrialId;
|
||||
series.SubjectId = incommand.SubjectId;
|
||||
series.VisitTaskId = findOriginStudy.VisitTaskId;
|
||||
//series.SubjectVisitId = incommand.SubjectVisitId;
|
||||
|
||||
|
||||
dicomSeries = await _repository.AddAsync(series);
|
||||
|
||||
//新的序列 那么 检查的序列数量+1
|
||||
study.SeriesCount += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//该序列掉了instance
|
||||
dicomSeries.InstanceCount += seriesItem.InstanceList.Count;
|
||||
}
|
||||
|
||||
foreach (var instanceItem in seriesItem.InstanceList)
|
||||
{
|
||||
var insntance = _mapper.Map<TaskInstance>(instanceItem);
|
||||
insntance.Id = IdentifierHelper.CreateGuid(insntance.StudyInstanceUid, insntance.SeriesInstanceUid, insntance.SopInstanceUid, trialId.ToString(), findOriginStudy.VisitTaskId.ToString());
|
||||
insntance.StudyId = study.Id;
|
||||
insntance.SeriesId = dicomSeries.Id;
|
||||
|
||||
insntance.TrialId = incommand.TrialId;
|
||||
insntance.SubjectId = incommand.SubjectId;
|
||||
insntance.VisitTaskId = findOriginStudy.VisitTaskId;
|
||||
|
||||
await _repository.AddAsync(insntance);
|
||||
}
|
||||
|
||||
|
||||
// 不管是新的序列 还是 该序列 掉了Instance 重传的时候 检查的instance 数量都会增加
|
||||
study.InstanceCount += seriesItem.InstanceList.Count;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
var @lock2 = _distributedLockProvider.CreateLock($"StudyCommit");
|
||||
|
||||
using (await @lock2.AcquireAsync())
|
||||
{
|
||||
await _repository.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
return ResponseOutput.NotOk(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_provider.Remove($"StudyUid_{incommand.TrialId}_{incommand.Study.StudyInstanceUid}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok(modalitys);
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete]
|
||||
public async Task<IResponseOutput> DeleteTaskStudy(Guid visitTaskId)
|
||||
{
|
||||
|
||||
await _repository.BatchDeleteAsync<TaskStudy>(t => t.VisitTaskId == visitTaskId);
|
||||
await _repository.BatchDeleteAsync<TaskSeries>(t => t.VisitTaskId == visitTaskId);
|
||||
await _repository.BatchDeleteAsync<TaskInstance>(t => t.VisitTaskId == visitTaskId);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
/// <summary>
|
||||
/// 打包和匿名化影像 默认是匿名化打包,也可以不匿名化打包
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <param name="subjectVisitId"></param>
|
||||
/// <param name="isAnonymize"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<IResponseOutput> RequestPackageAndAnonymizImage(Guid trialId, Guid subjectVisitId, bool isAnonymize = true)
|
||||
{
|
||||
var subjectVisit = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == subjectVisitId);
|
||||
|
||||
if (subjectVisit.PackState == PackState.WaitPack)
|
||||
{
|
||||
HangfireJobHelper.NotImmediatelyOnceOnlyJob<IDownloadAndUploadService>(t => t.PackageAndAnonymizImage(trialId, subjectVisitId, isAnonymize), TimeSpan.FromSeconds(1));
|
||||
|
||||
subjectVisit.PackState = PackState.Packing;
|
||||
|
||||
await _subjectVisitRepository.SaveChangesAsync();
|
||||
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok(subjectVisit.VisitImageZipPath);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 后台任务调用,前端忽略该接口
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <param name="subjectVisitId"></param>
|
||||
/// <param name="isAnonymize"></param>
|
||||
/// <returns></returns>
|
||||
public async Task PackageAndAnonymizImage(Guid trialId, Guid subjectVisitId, bool isAnonymize = true)
|
||||
{
|
||||
|
||||
var subjectVisit = await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == subjectVisitId);
|
||||
|
||||
try
|
||||
{
|
||||
var addOrUpdateFixedFieldList = new List<SystemAnonymization>();
|
||||
|
||||
var ircFieldList = new List<SystemAnonymization>();
|
||||
|
||||
if (isAnonymize)
|
||||
{
|
||||
var systemAnonymizationList = _systemAnonymizationRepository.Where(t => t.IsEnable).ToList();
|
||||
|
||||
addOrUpdateFixedFieldList = systemAnonymizationList.Where(t => t.IsFixed).ToList();
|
||||
|
||||
ircFieldList = systemAnonymizationList.Where(t => t.IsFixed == false).ToList();
|
||||
}
|
||||
|
||||
var subjectAndVisitInfo = _subjectVisitRepository.Where(t => t.Id == subjectVisitId).Select(t => new { SubjectCode = t.Subject.Code, t.Trial.TrialCode, t.VisitNum }).FirstOrDefault();
|
||||
|
||||
var query = from sv in _subjectVisitRepository.Where(t => t.Id == subjectVisitId)
|
||||
|
||||
select new
|
||||
{
|
||||
SubjectCode = sv.Subject.Code,
|
||||
VisitName = sv.VisitName,
|
||||
StudyList = sv.StudyList.Select(u => new
|
||||
{
|
||||
u.PatientId,
|
||||
u.StudyTime,
|
||||
u.StudyCode,
|
||||
|
||||
SeriesList = u.SeriesList.Select(z => new
|
||||
{
|
||||
z.Modality,
|
||||
|
||||
InstancePathList = z.DicomInstanceList.Select(k => new
|
||||
{
|
||||
k.Path
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
};
|
||||
|
||||
var info = query.FirstOrDefault();
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
// 创建一个临时文件夹来存放文件
|
||||
string tempFolderPath = Path.Combine(Directory.GetCurrentDirectory(), $"DownloadTemp_{NewId.NextGuid()}");
|
||||
Directory.CreateDirectory(tempFolderPath);
|
||||
|
||||
// 遍历查询结果
|
||||
foreach (var studyInfo in info.StudyList)
|
||||
{
|
||||
// 遍历 Series
|
||||
foreach (var seriesInfo in studyInfo.SeriesList)
|
||||
{
|
||||
string studyFolderPath = Path.Combine(tempFolderPath, $"{info.SubjectCode}_{info.VisitName}", $"{studyInfo.StudyCode}_{studyInfo.StudyTime?.ToString("yyyy-MM-dd")}_{seriesInfo.Modality}");
|
||||
|
||||
// 创建 影像 文件夹
|
||||
Directory.CreateDirectory(studyFolderPath);
|
||||
|
||||
// 遍历 InstancePathList
|
||||
foreach (var instanceInfo in seriesInfo.InstancePathList)
|
||||
{
|
||||
// 复制文件到相应的文件夹
|
||||
string destinationPath = Path.Combine(studyFolderPath, Path.GetFileName(instanceInfo.Path));
|
||||
|
||||
//下载到当前目录
|
||||
await _oSSService.DownLoadFromOSSAsync(instanceInfo.Path, destinationPath);
|
||||
|
||||
#region 匿名化逻辑
|
||||
|
||||
|
||||
if (isAnonymize)
|
||||
{
|
||||
//受试者随机阅片,需要匿名化检查时间
|
||||
DicomFile dicomFile = await DicomFile.OpenAsync(destinationPath, Encoding.Default);
|
||||
DicomDataset dataset = dicomFile.Dataset;
|
||||
dataset.AddOrUpdate(DicomTag.StudyDate, string.Empty);
|
||||
dataset.AddOrUpdate(DicomTag.StudyTime, string.Empty);
|
||||
|
||||
#region 前端已经匿名化,不需要做相关tag匿名化
|
||||
//DicomFile dicomFile = await DicomFile.OpenAsync(destinationPath, Encoding.Default);
|
||||
|
||||
//DicomDataset dataset = dicomFile.Dataset;
|
||||
|
||||
//foreach (var item in addOrUpdateFixedFieldList)
|
||||
//{
|
||||
|
||||
// var dicomTag = new DicomTag(Convert.ToUInt16(item.Group, 16), Convert.ToUInt16(item.Element, 16));
|
||||
|
||||
// dataset.AddOrUpdate(dicomTag, item.ReplaceValue);
|
||||
//}
|
||||
|
||||
//foreach (var item in ircFieldList)
|
||||
//{
|
||||
|
||||
// var dicomTag = new DicomTag(Convert.ToUInt16(item.Group, 16), Convert.ToUInt16(item.Element, 16));
|
||||
|
||||
// if (dicomTag == DicomTag.ClinicalTrialProtocolID)
|
||||
// {
|
||||
// dataset.AddOrUpdate(dicomTag, subjectAndVisitInfo.TrialCode);
|
||||
|
||||
// }
|
||||
// if (dicomTag == DicomTag.ClinicalTrialSiteID)
|
||||
// {
|
||||
// //dataset.AddOrUpdate(dicomTag, subjectAndVisitInfo.TrialSiteCode);
|
||||
|
||||
// }
|
||||
// if (dicomTag == DicomTag.ClinicalTrialSubjectID)
|
||||
// {
|
||||
// dataset.AddOrUpdate(dicomTag, subjectAndVisitInfo.SubjectCode);
|
||||
|
||||
// }
|
||||
// if (dicomTag == DicomTag.ClinicalTrialTimePointID)
|
||||
// {
|
||||
// dataset.AddOrUpdate(dicomTag, subjectAndVisitInfo.VisitNum.ToString());
|
||||
|
||||
// }
|
||||
// if (dicomTag == DicomTag.PatientID)
|
||||
// {
|
||||
// dataset.AddOrUpdate(dicomTag, subjectAndVisitInfo.TrialCode + "_" + subjectAndVisitInfo.SubjectCode);
|
||||
|
||||
// }
|
||||
|
||||
//}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var zipPath = Path.Combine(Directory.GetCurrentDirectory(), $"{info.SubjectCode}_{info.VisitName}_ImageStudy.zip");
|
||||
|
||||
ZipFile.CreateFromDirectory(tempFolderPath, zipPath);
|
||||
|
||||
//上传到Oss
|
||||
var relativePath = await _oSSService.UploadToOSSAsync(zipPath, $"download_zip", false);
|
||||
|
||||
|
||||
//subjectVisit.PackState = PackState.Packed;
|
||||
//subjectVisit.VisitImageZipPath = relativePath;
|
||||
//await _subjectVisitRepository.SaveChangesAsync();
|
||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectVisitId, u => new SubjectVisit() { PackState = PackState.Packed, VisitImageZipPath = relativePath });
|
||||
|
||||
|
||||
//清理文件夹
|
||||
Directory.Delete(tempFolderPath, true);
|
||||
File.Delete(zipPath);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectVisitId, u => new SubjectVisit() { PackState = PackState.WaitPack });
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -49,8 +49,8 @@ namespace IRaCIS.Core.Application.Services
|
||||
#endregion
|
||||
|
||||
var studyIds = await _studyRepository.AsQueryable()
|
||||
.Where(t => t.TrialId == imageShareCommand.TrialId && t.SubjectId == imageShareCommand.SubjectId &&
|
||||
t.SiteId == imageShareCommand.SiteId)
|
||||
.Where(t => t.TrialId == imageShareCommand.TrialId && t.SubjectId == imageShareCommand.SubjectId
|
||||
)
|
||||
.Select(u => u.Id).ToListAsync();
|
||||
|
||||
if (!studyIds.Any())
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using System.Linq.Dynamic.Core;
|
||||
|
||||
namespace IRaCIS.Core.Application.Services
|
||||
{
|
||||
@@ -26,7 +27,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
[HttpGet("{seriesId:guid}")]
|
||||
public async Task<IResponseOutput<List<DicomInstanceDTO>>> List(Guid seriesId)
|
||||
{
|
||||
var list = await _instanceRepository.Where(s => s.SeriesId == seriesId).OrderBy(s => s.InstanceNumber).
|
||||
var list = await _instanceRepository.Where(s => s.SeriesId == seriesId)/*.OrderBy(s => s.SliceLocation)*/.OrderBy(s => s.InstanceNumber).
|
||||
ThenBy(s => s.InstanceTime).ThenBy(s => s.CreateTime)
|
||||
.ProjectTo<DicomInstanceDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
@@ -59,12 +60,6 @@ namespace IRaCIS.Core.Application.Services
|
||||
|
||||
path = (await _instanceRepository.Where(s => s.Id == instanceId).Select(t => t.Path).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
//DicomInstance dicomInstance = await _instanceRepository.FirstOrDefaultAsync(s => s.Id == instanceId).IfNullThrowException();
|
||||
|
||||
//DicomStudy dicomStudy = await _studyRepository.FirstOrDefaultAsync(s => s.Id == dicomInstance.StudyId).IfNullThrowException();
|
||||
|
||||
//var (physicalPath, relativePath) = FileStoreHelper.GetDicomInstanceFilePath(_hostEnvironment, dicomStudy.TrialId, dicomStudy.SiteId, dicomStudy.SubjectId, dicomStudy.SubjectVisitId, dicomStudy.Id, dicomInstance.Id);
|
||||
|
||||
var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path);
|
||||
|
||||
using (var sw = ImageHelper.RenderPreviewJpeg(physicalPath))
|
||||
@@ -85,16 +80,6 @@ namespace IRaCIS.Core.Application.Services
|
||||
var filePath = string.Empty;
|
||||
var path = (await _instanceRepository.Where(s => s.Id == instanceId).Select(t=>t.Path).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
//DicomStudy dicomStudy = await _studyRepository.FirstOrDefaultAsync(s => s.Id == dicomInstance.StudyId).IfNullThrowException();
|
||||
|
||||
////if (dicomInstance.Anonymize) //被匿名化
|
||||
////{
|
||||
//// filePath = _dicomFileStoreHelper.GetInstanceFilePath(dicomStudy, dicomInstance.SeriesId, dicomInstance.Id + ".Anonymize");
|
||||
////}
|
||||
|
||||
////else
|
||||
//var (physicalPath, relativePath) = FileStoreHelper.GetDicomInstanceFilePath(_hostEnvironment, dicomStudy.TrialId, dicomStudy.SiteId, dicomStudy.SubjectId, dicomStudy.SubjectVisitId, dicomStudy.Id, dicomInstance.Id);
|
||||
|
||||
|
||||
var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path);
|
||||
|
||||
|
||||
@@ -39,36 +39,23 @@ namespace IRaCIS.Core.Application.Services
|
||||
ThenBy(s => s.SeriesTime).ThenBy(s => s.CreateTime)
|
||||
.ProjectTo<DicomSeriesDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
var idList = await _instanceRepository.Where(s => s.StudyId == studyId).OrderBy(t => t.SeriesId).ThenBy(t => t.InstanceNumber)
|
||||
var instanceList = await _instanceRepository.Where(s => s.StudyId == studyId).OrderBy(t => t.SeriesId).ThenBy(t => t.InstanceNumber)
|
||||
.ThenBy(s => s.InstanceTime).ThenBy(s => s.CreateTime)
|
||||
.Select(t => new { t.SeriesId, t.Id, t.Path, t.NumberOfFrames,t.InstanceNumber }).ToListAsync();//.GroupBy(u => u.SeriesId);
|
||||
.Select(t => new { t.SeriesId, t.Id, t.Path, t.NumberOfFrames,t.InstanceNumber,t.HtmlPath }).ToListAsync();//.GroupBy(u => u.SeriesId);
|
||||
|
||||
foreach (var item in seriesList)
|
||||
foreach (var series in seriesList)
|
||||
{
|
||||
item.InstanceList = idList.Where(s => s.SeriesId == item.Id).Select(u => u.Id).ToList();
|
||||
|
||||
//处理多帧
|
||||
item.InstancePathList = idList.Where(s => s.SeriesId == item.Id).OrderBy(t => t.InstanceNumber)
|
||||
.SelectMany(u =>
|
||||
{
|
||||
series.InstanceInfoList = instanceList.Where(t => t.SeriesId == series.Id).OrderBy(t => t.InstanceNumber).Select(k =>
|
||||
new InstanceBasicInfo()
|
||||
{
|
||||
Id = k.Id,
|
||||
NumberOfFrames = k.NumberOfFrames,
|
||||
HtmlPath = k.HtmlPath,
|
||||
Path = k.Path,
|
||||
InstanceNumber = k.InstanceNumber,
|
||||
|
||||
if (u.NumberOfFrames > 1)
|
||||
{
|
||||
var pathList = new List<string>();
|
||||
|
||||
for (int i = 1; i <= u.NumberOfFrames; i++)
|
||||
{
|
||||
pathList.Add(u.Path + "?frame=" + (i - 1));
|
||||
}
|
||||
return pathList;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<string> { u.Path };
|
||||
|
||||
}
|
||||
})
|
||||
.ToList();
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
#region 暂时废弃
|
||||
|
||||
@@ -15,6 +15,9 @@ using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using System.Threading;
|
||||
using Medallion.Threading;
|
||||
using System.Reactive.Subjects;
|
||||
using DocumentFormat.OpenXml.Drawing.Diagrams;
|
||||
using IRaCIS.Core.Application.Service.ImageAndDoc.DTO;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
{
|
||||
@@ -107,7 +110,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
var studyMonitor = new StudyMonitor()
|
||||
{
|
||||
TrialId = preArchiveStudyCommand.TrialId,
|
||||
SiteId = preArchiveStudyCommand.SiteId,
|
||||
SubjectId = preArchiveStudyCommand.SubjectId,
|
||||
SubjectVisitId = preArchiveStudyCommand.SubjectVisitId,
|
||||
|
||||
@@ -139,11 +141,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传临床数据
|
||||
/// </summary>
|
||||
/// <param name="incommand"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput> AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand)
|
||||
{
|
||||
@@ -158,8 +156,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
studyMonitor.UploadFinishedTime = DateTime.Now;
|
||||
studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
||||
studyMonitor.FailedFileCount = incommand.FailedFileCount;
|
||||
studyMonitor.IsSuccess = incommand.FailedFileCount==0;
|
||||
studyMonitor.RecordPath=incommand.RecordPath;
|
||||
studyMonitor.IsSuccess = incommand.FailedFileCount == 0;
|
||||
studyMonitor.RecordPath = incommand.RecordPath;
|
||||
|
||||
//上传
|
||||
if (studyMonitor.IsDicomReUpload == false)
|
||||
@@ -189,10 +187,19 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
study.Id = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString());
|
||||
study.TrialId = incommand.TrialId;
|
||||
study.SiteId = incommand.SiteId;
|
||||
study.SubjectId = incommand.SubjectId;
|
||||
study.SubjectVisitId = incommand.SubjectVisitId;
|
||||
|
||||
//如果因为意外情况,连续点击两次,导致第一次插入了,第二次进来也会插入,在此判断一下
|
||||
var findStudy = await _dicomstudyRepository.FirstOrDefaultAsync(t => t.Id == study.Id);
|
||||
|
||||
if (findStudy != null)
|
||||
{
|
||||
//直接返回
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//特殊处理逻辑
|
||||
study.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Distinct());
|
||||
@@ -214,7 +221,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
series.StudyId = study.Id;
|
||||
|
||||
series.TrialId = incommand.TrialId;
|
||||
series.SiteId = incommand.SiteId;
|
||||
series.SubjectId = incommand.SubjectId;
|
||||
series.SubjectVisitId = incommand.SubjectVisitId;
|
||||
|
||||
@@ -234,7 +240,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
isntance.SeriesId = series.Id;
|
||||
|
||||
isntance.TrialId = incommand.TrialId;
|
||||
isntance.SiteId = incommand.SiteId;
|
||||
isntance.SubjectId = incommand.SubjectId;
|
||||
isntance.SubjectVisitId = incommand.SubjectVisitId;
|
||||
|
||||
@@ -281,7 +286,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
series.StudyId = study.Id;
|
||||
|
||||
series.TrialId = incommand.TrialId;
|
||||
series.SiteId = incommand.SiteId;
|
||||
series.SubjectId = incommand.SubjectId;
|
||||
series.SubjectVisitId = incommand.SubjectVisitId;
|
||||
|
||||
@@ -305,7 +309,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
insntance.SeriesId = dicomSeries.Id;
|
||||
|
||||
insntance.TrialId = incommand.TrialId;
|
||||
insntance.SiteId = incommand.SiteId;
|
||||
insntance.SubjectId = incommand.SubjectId;
|
||||
insntance.SubjectVisitId = incommand.SubjectVisitId;
|
||||
|
||||
@@ -355,14 +358,14 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
var svExpression = QCCommon.GetDicomStudySubjectVisitFilter(studyQuery.VisitPlanArray);
|
||||
|
||||
var dicomStudyQuery = _repository.Where<DicomStudy>(t => t.TrialId == studyQuery.TrialId)
|
||||
.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.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
//.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||
.WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||
.Select(t => new UnionStudyViewModel()
|
||||
{
|
||||
TrialId = t.TrialId,
|
||||
SiteId = t.SiteId,
|
||||
TrialSiteId = t.Subject.TrialSiteId,
|
||||
SubjectId = t.SubjectId,
|
||||
SubjectVisitId = t.SubjectVisitId,
|
||||
VisitName = t.SubjectVisit.VisitName,
|
||||
@@ -387,9 +390,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
StudyTime = t.StudyTime,
|
||||
|
||||
TrialSiteAliasName = t.TrialSite.TrialSiteAliasName,
|
||||
TrialSiteAliasName = t.Subject.TrialSite.TrialSiteAliasName,
|
||||
|
||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
TrialSiteCode = t.Subject.TrialSite.TrialSiteCode,
|
||||
|
||||
Uploader = t.Uploader.UserName,
|
||||
|
||||
@@ -403,7 +406,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
|
||||
var nodeDicomStudyQuery = _repository.Where<NoneDicomStudy>(t => t.TrialId == studyQuery.TrialId)
|
||||
.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.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
//.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||
.WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression2)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||
@@ -411,7 +414,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
.Select(t => new UnionStudyViewModel()
|
||||
{
|
||||
TrialId = t.TrialId,
|
||||
SiteId = t.SiteId,
|
||||
TrialSiteId = t.Subject.TrialSiteId,
|
||||
SubjectId = t.SubjectId,
|
||||
SubjectVisitId = t.SubjectVisitId,
|
||||
VisitName = t.SubjectVisit.VisitName,
|
||||
@@ -436,9 +439,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
StudyTime = t.ImageDate,
|
||||
|
||||
TrialSiteAliasName = t.TrialSite.TrialSiteAliasName,
|
||||
TrialSiteAliasName = t.Subject.TrialSite.TrialSiteAliasName,
|
||||
|
||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
TrialSiteCode = t.Subject.TrialSite.TrialSiteCode,
|
||||
|
||||
Uploader = t.CreateUser.UserName,
|
||||
|
||||
@@ -452,7 +455,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
var unionQuery = dicomStudyQuery.Union(nodeDicomStudyQuery)
|
||||
.WhereIf(studyQuery.SubjectId != null, t => t.SubjectId == studyQuery.SubjectId)
|
||||
.WhereIf(studyQuery.SubjectVisitId != null, t => t.SubjectId == studyQuery.SubjectVisitId)
|
||||
.WhereIf(studyQuery.SiteId != null, t => t.SiteId == studyQuery.SiteId);
|
||||
.WhereIf(studyQuery.TrialSiteId != null, t => t.TrialSiteId == studyQuery.TrialSiteId);
|
||||
|
||||
return await unionQuery.ToPagedListAsync(studyQuery.PageIndex, studyQuery.PageSize, studyQuery.SortField, studyQuery.Asc);
|
||||
}
|
||||
@@ -463,21 +466,21 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
{
|
||||
var svExpression = QCCommon.GetStudyMonitorSubjectVisitFilter(studyQuery.VisitPlanArray);
|
||||
var StudyMonitorQuery = _repository.Where<StudyMonitor>(t => t.TrialId == studyQuery.TrialId, ignoreQueryFilters: true)
|
||||
.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.Subject.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
//.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||
.WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||
.WhereIf(studyQuery.SubjectId != null, t => t.SubjectId == studyQuery.SubjectId)
|
||||
.WhereIf(studyQuery.SubjectVisitId != null, t => t.SubjectId == studyQuery.SubjectVisitId)
|
||||
.WhereIf(studyQuery.SiteId != null, t => t.SiteId == studyQuery.SiteId)
|
||||
.WhereIf(studyQuery.IsDicom != null, t => t.IsDicom == studyQuery.IsDicom )
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.Uploader), t => t.Uploader.UserName.Contains(studyQuery.Uploader))
|
||||
.WhereIf(studyQuery.IsSuccess != null, t => t.IsSuccess == studyQuery.IsSuccess)
|
||||
.WhereIf(studyQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == studyQuery.TrialSiteId)
|
||||
.WhereIf(studyQuery.IsDicom != null, t => t.IsDicom == studyQuery.IsDicom)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.Uploader), t => t.Uploader.UserName.Contains(studyQuery.Uploader))
|
||||
.WhereIf(studyQuery.IsSuccess != null, t => t.IsSuccess == studyQuery.IsSuccess)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.StudyCode), t => t.StudyCode.Contains(studyQuery.StudyCode))
|
||||
.Select(t => new UnionStudyMonitorModel()
|
||||
{
|
||||
TrialId = t.TrialId,
|
||||
SiteId = t.SiteId,
|
||||
TrialSiteId = t.Subject.TrialSiteId,
|
||||
SubjectId = t.SubjectId,
|
||||
SubjectVisitId = t.SubjectVisitId,
|
||||
VisitName = t.SubjectVisit.VisitName,
|
||||
@@ -488,9 +491,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
SubjectCode = t.Subject.Code,
|
||||
|
||||
|
||||
TrialSiteAliasName = t.TrialSite.TrialSiteAliasName,
|
||||
TrialSiteAliasName = t.Subject.TrialSite.TrialSiteAliasName,
|
||||
|
||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
TrialSiteCode = t.Subject.TrialSite.TrialSiteCode,
|
||||
|
||||
Uploader = t.Uploader.UserName,
|
||||
|
||||
@@ -506,7 +509,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
ArchiveFinishedTime = t.ArchiveFinishedTime,
|
||||
|
||||
|
||||
RecordPath=t.RecordPath,
|
||||
RecordPath = t.RecordPath,
|
||||
|
||||
IsDicomReUpload = t.IsDicomReUpload,
|
||||
StudyId = t.Id,
|
||||
@@ -521,108 +524,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
|
||||
|
||||
#region 冗余查询
|
||||
//var dicomStudyQuery = _repository.Where<StudyMonitor>(t => t.TrialId == studyQuery.TrialId && t.IsDicom)
|
||||
// .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
// .WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||
// .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||
// .Select(t => new UnionStudyMonitorModel()
|
||||
// {
|
||||
// TrialId = t.TrialId,
|
||||
// SiteId = t.SiteId,
|
||||
// SubjectId = t.SubjectId,
|
||||
// SubjectVisitId = t.SubjectVisitId,
|
||||
// VisitName = t.SubjectVisit.VisitName,
|
||||
// VisitNum = t.SubjectVisit.VisitNum,
|
||||
|
||||
|
||||
|
||||
// SubjectCode = t.Subject.Code,
|
||||
|
||||
|
||||
// TrialSiteAliasName = t.TrialSite.TrialSiteAliasName,
|
||||
|
||||
// TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
|
||||
// Uploader = t.Uploader.FullName,
|
||||
|
||||
// UploadTime = t.CreateTime,
|
||||
|
||||
|
||||
// IP = t.IP,
|
||||
// FileCount = t.FileCount,
|
||||
// FileSize = t.FileSize,
|
||||
// UploadFinishedTime = t.UploadFinishedTime,
|
||||
// UploadStartTime = t.UploadStartTime,
|
||||
|
||||
// TotalMillisecondsInterval = t.TotalMillisecondsInterval,
|
||||
|
||||
// IsDicomReUpload = t.IsDicomReUpload,
|
||||
// StudyId = t.Id,
|
||||
// IsDicom = t.IsDicom,
|
||||
|
||||
// StudyCode = t.DicomStudy.StudyCode
|
||||
// //DicomStudyCode = t.DicomStudy.StudyCode,
|
||||
// //NoneDicomCode = 0,
|
||||
|
||||
// });
|
||||
|
||||
////.ProjectTo<UnionStudyViewDodel>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
||||
|
||||
//var nodeDicomStudyQuery = _repository.Where<StudyMonitor>(t => t.TrialId == studyQuery.TrialId && t.IsDicom == false)
|
||||
// .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
// .WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||
// .WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||
|
||||
// .Select(t => new UnionStudyMonitorModel()
|
||||
// {
|
||||
|
||||
// TrialId = t.TrialId,
|
||||
// SiteId = t.SiteId,
|
||||
// SubjectId = t.SubjectId,
|
||||
// SubjectVisitId = t.SubjectVisitId,
|
||||
// VisitName = t.SubjectVisit.VisitName,
|
||||
// VisitNum = t.SubjectVisit.VisitNum,
|
||||
// SubjectCode = t.Subject.Code,
|
||||
// TrialSiteAliasName = t.TrialSite.TrialSiteAliasName,
|
||||
// TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||
// Uploader = t.Uploader.FullName,
|
||||
// UploadTime = t.CreateTime,
|
||||
|
||||
// IP = t.IP,
|
||||
// FileCount = t.FileCount,
|
||||
// FileSize = t.FileSize,
|
||||
// UploadFinishedTime = t.UploadFinishedTime,
|
||||
// UploadStartTime = t.UploadStartTime,
|
||||
|
||||
// TotalMillisecondsInterval = t.TotalMillisecondsInterval,
|
||||
|
||||
// IsDicomReUpload = t.IsDicomReUpload,
|
||||
// StudyId = t.Id,
|
||||
// IsDicom = t.IsDicom,
|
||||
|
||||
// StudyCode = t.NoneDicomStudy.StudyCode
|
||||
|
||||
// //DicomStudyCode = string.Empty,
|
||||
// //NoneDicomCode = t.NoneDicomStudy.Code,
|
||||
|
||||
// });
|
||||
|
||||
////.ProjectTo<UnionStudyViewDodel>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
||||
//var unionQuery = dicomStudyQuery.Union(nodeDicomStudyQuery)
|
||||
// .WhereIf(studyQuery.SubjectId != null, t => t.SubjectId == studyQuery.SubjectId)
|
||||
// .WhereIf(studyQuery.SubjectVisitId != null, t => t.SubjectId == studyQuery.SubjectVisitId)
|
||||
// .WhereIf(studyQuery.SiteId != null, t => t.SiteId == studyQuery.SiteId);
|
||||
|
||||
//return await unionQuery.ToPagedListAsync(studyQuery.PageIndex, studyQuery.PageSize, string.IsNullOrEmpty(studyQuery.SortField) ? "UploadTime" : studyQuery.SortField, studyQuery.Asc);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -636,18 +540,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
path = (await _dicomInstanceRepository.Where(s => s.StudyId == studyId).Select(t => t.Path).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
//DicomInstance dicomInstance = await _repository.FirstOrDefaultAsync<DicomInstance>(s => s.StudyId == studyId);
|
||||
|
||||
//if (dicomInstance != null)
|
||||
//{
|
||||
// DicomStudy dicomStudy = await _repository.FirstOrDefaultAsync<DicomStudy>(s => s.Id == dicomInstance.StudyId);
|
||||
// if (dicomStudy != null)
|
||||
// {
|
||||
// var( physicalPath ,relativePath )= FileStoreHelper.GetDicomInstanceFilePath(_hostEnvironment, dicomStudy.TrialId, dicomStudy.SiteId, dicomStudy.SubjectId, dicomStudy.SubjectVisitId, dicomStudy.Id, dicomInstance.Id);
|
||||
|
||||
// path = physicalPath;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
using (var sw = ImageHelper.RenderPreviewJpeg(path))
|
||||
{
|
||||
@@ -714,6 +607,124 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput<List<VerifyStudyUploadResult>>> VerifyTaskStudyAllowUploadAsync(VerifyTaskUploadOrReupload verifyInfo)
|
||||
{
|
||||
|
||||
var queryStudy = _repository.Where<VisitTask>(t => t.SubjectId == verifyInfo.SubjectId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id).Select(u => new
|
||||
{
|
||||
VisitTaskId = u.Id,
|
||||
SourceSubjectVisitId = u.SourceSubjectVisitId,
|
||||
OrginalStudyList = u.SourceSubjectVisit.StudyList.Select(t => new StudyBasicInfo()
|
||||
{
|
||||
Id = t.Id,
|
||||
StudyInstanceUid = t.StudyInstanceUid
|
||||
}).ToList(),
|
||||
|
||||
UploadStudyList = u.TaskStudyList.Select(t => new
|
||||
{
|
||||
Id = t.Id,
|
||||
StudyInstanceUid = t.StudyInstanceUid,
|
||||
|
||||
SeriesList = t.SeriesList.Select(t => new UploadedSeries()
|
||||
{ SeriesId = t.Id, SeriesInstanceUid = t.SeriesInstanceUid, SOPInstanceUIDList = t.InstanceList.Select(c => c.SopInstanceUid).ToList() }).ToList()
|
||||
|
||||
|
||||
}).ToList()
|
||||
});
|
||||
|
||||
var studyList = await queryStudy.ToListAsync();
|
||||
|
||||
var resultList = new List<VerifyStudyUploadResult>();
|
||||
|
||||
var trialId = verifyInfo.TrialId;
|
||||
|
||||
var subjectId = verifyInfo.SubjectId;
|
||||
|
||||
var visitList = _repository.Where<SubjectVisit>(t => t.SubjectId == verifyInfo.SubjectId).Select(t => new { t.VisitNum, t.EarliestScanDate, t.LatestScanDate, t.Id }).ToList();
|
||||
|
||||
foreach (var waitUploadItem in verifyInfo.StudyInstanceUidList)
|
||||
{
|
||||
|
||||
var studyInstanceUid = waitUploadItem.StudyInstanceUid;
|
||||
|
||||
var result = new VerifyStudyUploadResult();
|
||||
|
||||
if (_provider.Exists($"StudyUid_{trialId}_{studyInstanceUid}") && _provider.Get<Guid>($"StudyUid_{trialId}_{studyInstanceUid}").Value != _userInfo.Id)
|
||||
{
|
||||
|
||||
result.AllowUpload = false;
|
||||
|
||||
result.AllowReUpload = false;
|
||||
result.StudyInstanceUid = studyInstanceUid;
|
||||
//---当前有人正在上传归档该检查!
|
||||
result.ErrorMesseage = _localizer["Study_UploadArchiving"];
|
||||
|
||||
resultList.Add(result);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var findOriginStudy = studyList.FirstOrDefault(c => c.OrginalStudyList.Any(t => t.StudyInstanceUid == studyInstanceUid));
|
||||
|
||||
|
||||
if (findOriginStudy == null)
|
||||
{
|
||||
throw new BusinessValidationFailedException("该检查不属于该受试者,请核查");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (findOriginStudy.UploadStudyList.Any(t => t.StudyInstanceUid == studyInstanceUid))
|
||||
{
|
||||
result.AllowReUpload = true;
|
||||
result.AllowUpload = false;
|
||||
|
||||
result.UploadedSeriesList = findOriginStudy.UploadStudyList.Where(t => t.StudyInstanceUid == studyInstanceUid).SelectMany(t => t.SeriesList).ToList();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result.AllowUpload = true;
|
||||
|
||||
result.AllowReUpload = false;
|
||||
}
|
||||
}
|
||||
|
||||
result.StudyInstanceUid = studyInstanceUid;
|
||||
|
||||
var @lock = _distributedLockProvider.CreateLock($"StudyUpload");
|
||||
|
||||
using (@lock.Acquire())
|
||||
{
|
||||
if (result.AllowReUpload || result.AllowUpload)
|
||||
{
|
||||
_provider.Set($"StudyUid_{trialId}_{studyInstanceUid}", _userInfo.Id, TimeSpan.FromSeconds(30));
|
||||
}
|
||||
else
|
||||
{
|
||||
_provider.Remove($"StudyUid_{trialId}_{studyInstanceUid}");
|
||||
}
|
||||
}
|
||||
resultList.Add(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var systemAnonymizationList = _repository.Where<SystemAnonymization>(t => t.IsEnable).ToList();
|
||||
|
||||
return ResponseOutput.Ok<List<VerifyStudyUploadResult>>(resultList, new
|
||||
{
|
||||
AnonymizeFixedList = systemAnonymizationList.Where(t => t.IsFixed).ToList(),
|
||||
AnonymizeNotFixedList = systemAnonymizationList.Where(t => t.IsFixed == false).ToList()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 批量验证 检查是否可以上传 并告知原因
|
||||
/// </summary>
|
||||
@@ -780,7 +791,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
|
||||
var result = new VerifyStudyUploadResult();
|
||||
|
||||
if (_provider.Exists($"StudyUid_{trialId}_{studyInstanceUid}") && _provider.Get<Guid>($"StudyUid_{trialId}_{studyInstanceUid}").Value!=_userInfo.Id)
|
||||
if (_provider.Exists($"StudyUid_{trialId}_{studyInstanceUid}") && _provider.Get<Guid>($"StudyUid_{trialId}_{studyInstanceUid}").Value != _userInfo.Id)
|
||||
{
|
||||
|
||||
result.AllowUpload = false;
|
||||
@@ -793,7 +804,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
return result;
|
||||
}
|
||||
|
||||
if (_repository.Where<Subject>(t => t.Id == SubjectId).Select(t => t.Status).FirstOrDefault() == SubjectStatus.EndOfVisit)
|
||||
if (_repository.Where<Domain.Models.Subject>(t => t.Id == SubjectId).Select(t => t.Status).FirstOrDefault() == SubjectStatus.EndOfVisit)
|
||||
{
|
||||
result.AllowUpload = false;
|
||||
|
||||
|
||||
@@ -17,8 +17,15 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<AddOrUpdateSeriesDto, DicomSeries>()
|
||||
.ForMember(d => d.DicomInstanceList, u => u.Ignore());
|
||||
|
||||
CreateMap<AddOrUpdateStudyDto, TaskStudy>()
|
||||
.ForMember(d => d.SeriesList, u => u.Ignore());
|
||||
CreateMap<AddOrUpdateSeriesDto, TaskSeries>()
|
||||
.ForMember(d => d.InstanceList, u => u.Ignore());
|
||||
|
||||
CreateMap<AddInstanceDto, DicomInstance>();
|
||||
|
||||
CreateMap<AddInstanceDto, TaskInstance>();
|
||||
|
||||
|
||||
CreateMap<DicomSeries, DicomSeriesWithLabelDTO>();
|
||||
|
||||
@@ -33,8 +40,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
|
||||
CreateMap<DicomStudy, StudyDTO>().IncludeMembers(t => t.Subject, u => u.SubjectVisit)
|
||||
.ForMember(d => d.UploaderFirstName, u => u.MapFrom(s => s.Site.SiteName))
|
||||
.ForMember(d => d.SiteName, u => u.MapFrom(s => s.Site.SiteName))
|
||||
.ForMember(d => d.SiteName, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteName))
|
||||
.ForMember(d => d.UploaderFirstName, u => u.MapFrom(s => s.Uploader.FirstName))
|
||||
.ForMember(d => d.UploaderLastName, u => u.MapFrom(s => s.Uploader.LastName))
|
||||
.ForMember(d => d.UploadedTime, u => u.MapFrom(s => s.CreateTime));
|
||||
@@ -80,6 +86,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
CreateMap<DicomInstance, DicomInstanceDTO>()
|
||||
.ForMember(o => o.IsDeleted, t => t.MapFrom(u => u.DicomSerie.IsDeleted))
|
||||
.ForMember(o => o.SliceThickness, t => t.MapFrom(u => u.DicomSerie.SliceThickness))
|
||||
.ForMember(o => o.IsReading, t => t.MapFrom(u => u.DicomSerie.IsReading));
|
||||
CreateMap<DicomStudy, DicomStudyDTO>();
|
||||
CreateMap<DicomSeries, DicomSeriesDTO>();
|
||||
@@ -97,8 +104,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
//.ForMember(d => d.Modality, u => u.MapFrom(s => s.Modalities))
|
||||
.ForMember(d => d.Bodypart, u => u.MapFrom(s => s.BodyPartExamined))
|
||||
.ForMember(d => d.StudyTime, u => u.MapFrom(s => s.StudyTime))
|
||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode))
|
||||
.ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.TrialSite.TrialSiteAliasName))
|
||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteAliasName))
|
||||
.ForMember(d => d.IsDicom, u => u.MapFrom(s => true))
|
||||
.ForMember(d => d.Count, u => u.MapFrom(s => s.SeriesCount))
|
||||
.ForMember(d => d.VisitNum, u => u.MapFrom(s => s.SubjectVisit.VisitNum))
|
||||
@@ -109,8 +116,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
//.ForMember(d => d.Modality, u => u.MapFrom(s => s.Modalities))
|
||||
.ForMember(d => d.Bodypart, u => u.MapFrom(s => s.BodyPart))
|
||||
.ForMember(d => d.StudyTime, u => u.MapFrom(s => s.ImageDate))
|
||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode))
|
||||
.ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.TrialSite.TrialSiteAliasName))
|
||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode))
|
||||
.ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteAliasName))
|
||||
.ForMember(d => d.IsDicom, u => u.MapFrom(s => false))
|
||||
.ForMember(d => d.Count, u => u.MapFrom(s => s.NoneDicomFileList.Count()))
|
||||
.ForMember(d => d.VisitNum, u => u.MapFrom(s => s.SubjectVisit.VisitNum))
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
|
||||
{
|
||||
|
||||
public Guid? TrialId { get; set; }
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
public Guid? SubjectId { get; set; }
|
||||
public Guid? SubjectVisitId { get; set; }
|
||||
|
||||
@@ -336,7 +336,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public string Code { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -441,7 +441,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
|
||||
/// <summary>
|
||||
/// 中心
|
||||
/// </summary>
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 受试者
|
||||
@@ -480,6 +480,8 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
|
||||
/// </summary>
|
||||
public string OpByUserName { get; set; } = string.Empty;
|
||||
|
||||
public string? CreateUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 阅读片人
|
||||
/// </summary>
|
||||
@@ -509,6 +511,7 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
|
||||
public Guid? TrialReadingCriterionId { get; set; }
|
||||
|
||||
|
||||
public string? TaskName { get; set; }
|
||||
}
|
||||
|
||||
public class InspectionBase
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,10 +41,9 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
|
||||
join trial in _repository.GetQueryable<Trial>().IgnoreQueryFilters() on data.TrialId equals trial.Id into trialtemp
|
||||
from leftrial in trialtemp.DefaultIfEmpty()
|
||||
join site in _repository.GetQueryable<Site>().IgnoreQueryFilters() on data.SiteId equals site.Id into sitetemp
|
||||
from leftsite in sitetemp.DefaultIfEmpty()
|
||||
|
||||
join trialSite in _repository.GetQueryable<TrialSite>().IgnoreQueryFilters() on new { SiteId = leftsite.Id, Trialid = leftrial.Id } equals new { SiteId = trialSite.SiteId, Trialid = trialSite.TrialId } into trialSitetemp
|
||||
|
||||
join trialSite in _repository.GetQueryable<TrialSite>().IgnoreQueryFilters() on data.TrialSiteId equals trialSite.Id into trialSitetemp
|
||||
from lefttrialSite in trialSitetemp.DefaultIfEmpty()
|
||||
|
||||
|
||||
@@ -97,7 +96,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
BlindName = data.VisitTask.TaskBlindName,
|
||||
TaskName = data.VisitTask.TaskName,
|
||||
TrialId = data.TrialId,
|
||||
SiteId = data.SiteId,
|
||||
TrialSiteId = data.TrialSiteId,
|
||||
SubjectId = data.SubjectId,
|
||||
SubjectVisitId = data.SubjectVisitId,
|
||||
//OptType = data.OptType,
|
||||
@@ -161,7 +160,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
TrialReadingCriterionName = data.TrialReadingCriterion.CriterionName
|
||||
};
|
||||
|
||||
query = query.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId)
|
||||
query = query.WhereIf(dto.TrialSiteId != null, x => x.TrialSiteId == dto.TrialSiteId)
|
||||
//.Where(x => (x.TrialId == dto.TrialId) || (x.TrialId == null && x.CreateTime >= trialData.CreateTime && x.CreateTime <= trialData.TrialFinishTime))
|
||||
.Where(x => x.TrialId == dto.TrialId )
|
||||
|
||||
@@ -183,8 +182,9 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
.WhereIf(dto.BatchId != null, x => x.BatchId == dto.BatchId)
|
||||
.WhereIf(dto.BatchId == null && dto.GeneralId != null, x => x.GeneralId == dto.GeneralId)
|
||||
.WhereIf(dto.TrialReadingCriterionId != null, x => x.TrialReadingCriterionId == dto.TrialReadingCriterionId)
|
||||
|
||||
|
||||
|
||||
.WhereIf(!dto.TaskName.IsNullOrEmpty(), x => x.TaskName.Contains(dto.TaskName) || x.BlindName.Contains(dto.TaskName))
|
||||
.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo))
|
||||
.WhereIf(!dto.RoleName.IsNullOrEmpty(), x => x.RoleName.Contains(dto.RoleName))
|
||||
//.WhereIf(dto.VisitPlanInfo != null&& dto.VisitPlanInfo!=(decimal) 1.11, x => x.VisitNum == dto.VisitPlanInfo)
|
||||
@@ -194,6 +194,8 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
||||
.WhereIf(dto.ModuleType != null, x => x.ModuleTypeId == dto.ModuleType)
|
||||
.WhereIf(!dto.Description.IsNullOrEmpty(), x => x.Description.Contains(dto.Description)|| x.DescriptionCN.Contains(dto.Description))
|
||||
.WhereIf(!dto.OpByUserName.IsNullOrEmpty(), x => x.CreateUserName.Contains(dto.OpByUserName))
|
||||
.WhereIf(!dto.CreateUserName.IsNullOrEmpty(), x => x.CreateUserName.Contains(dto.CreateUserName) || x.CreateUserRealName.Contains(dto.CreateUserName))
|
||||
|
||||
//.WhereIf(!dto.SubjectInfo.IsNullOrEmpty(), x => x.SubjectCode.Contains(dto.SubjectInfo))
|
||||
.WhereIf(dto.IsSign != null, x => x.IsSign == dto.IsSign);
|
||||
#endregion
|
||||
|
||||
@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
[ ApiExplorerSettings(GroupName = "Institution")]
|
||||
[ApiExplorerSettings(GroupName = "Institution")]
|
||||
public class CroService : BaseService, ICroService
|
||||
{
|
||||
private readonly IRepository<CRO> _croRepository;
|
||||
@@ -20,50 +20,53 @@ namespace IRaCIS.Application.Services
|
||||
/// <summary> 分页获取CRO列表 </summary>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<CROCompanyDTO>> GetCroList(CROCompanyQueryDTO croCompanySearchModel)
|
||||
{
|
||||
{
|
||||
var croQueryable = _croRepository
|
||||
.WhereIf(!string.IsNullOrEmpty(croCompanySearchModel.CROName), t => t.CROName.Contains(croCompanySearchModel.CROName) || t.CRONameCN.Contains(croCompanySearchModel.CROName))
|
||||
.WhereIf(!string.IsNullOrEmpty(croCompanySearchModel.CROCode), t => t.CROCode.Contains(croCompanySearchModel.CROCode) )
|
||||
.WhereIf(!string.IsNullOrEmpty(croCompanySearchModel.CROCode), t => t.CROCode.Contains(croCompanySearchModel.CROCode))
|
||||
.ProjectTo<CROCompanyDTO>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await croQueryable.ToPagedListAsync(croCompanySearchModel.PageIndex, croCompanySearchModel.PageSize,
|
||||
string.IsNullOrWhiteSpace(croCompanySearchModel.SortField) ? "CROName": croCompanySearchModel.SortField, croCompanySearchModel.Asc);
|
||||
return await croQueryable.ToPagedListAsync(croCompanySearchModel.PageIndex, croCompanySearchModel.PageSize,
|
||||
string.IsNullOrWhiteSpace(croCompanySearchModel.SortField) ? "CROName" : croCompanySearchModel.SortField, croCompanySearchModel.Asc);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary> 根据CRO 名称查询所有CRO 列表 </summary>
|
||||
public async Task<IEnumerable<CroSelectDTO>> GetAllCROList()
|
||||
public async Task<IEnumerable<CroSelectDTO>> GetAllCROList(Guid? trialId)
|
||||
{
|
||||
return await _croRepository.ProjectTo<CroSelectDTO>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }).ToListAsync();
|
||||
return await _croRepository
|
||||
.WhereIf(trialId == null, t => t.IsTrialLevel == false)
|
||||
.WhereIf(trialId != null, t => t.IsTrialLevel == false || t.TrialId == trialId)
|
||||
.ProjectTo<CroSelectDTO>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }).ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary> 添加CRO信息 </summary>
|
||||
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateCro(CROCompanyDTO addCroCompanyCommand)
|
||||
{
|
||||
|
||||
var exp = new EntityVerifyExp<CRO>()
|
||||
{
|
||||
VerifyExp = cro => cro.CROName.Equals(addCroCompanyCommand.CROName) ,
|
||||
VerifyExp = cro => (cro.CROName.Equals(addCroCompanyCommand.CROName) || cro.CRONameCN.Equals(addCroCompanyCommand.CRONameCN)) && cro.IsTrialLevel == false,
|
||||
//---已经存在同名的CRO,请确认。
|
||||
VerifyMsg = _localizer["CRO_DupName"]
|
||||
};
|
||||
|
||||
var cro = await _croRepository.InsertOrUpdateAsync(addCroCompanyCommand, true, exp);
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok( cro.Id.ToString());
|
||||
|
||||
|
||||
return ResponseOutput.Ok(cro.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
/// <summary> 删除CRO信息 </summary>
|
||||
|
||||
|
||||
[HttpDelete("{croCompanyId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteCro(Guid cROCompanyId)
|
||||
public async Task<IResponseOutput> DeleteCro(Guid cROCompanyId)
|
||||
{
|
||||
if (await _trialRepository.AnyAsync(t => t.CROId == cROCompanyId))
|
||||
{
|
||||
@@ -74,7 +77,7 @@ namespace IRaCIS.Application.Services
|
||||
//{
|
||||
// return ResponseOutput.NotOk("该CRO下存在用户,暂时无法删除。");
|
||||
//}
|
||||
var success = await _croRepository.BatchDeleteNoTrackingAsync(x=>x.Id== cROCompanyId);
|
||||
var success = await _croRepository.BatchDeleteNoTrackingAsync(x => x.Id == cROCompanyId);
|
||||
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@ namespace IRaCIS.Application.Contracts
|
||||
|
||||
public string CRONameCN { get; set; } = string.Empty;
|
||||
|
||||
public bool IsTrialLevel { get; set; }
|
||||
|
||||
public Guid? TrialId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class CroSelectDTO
|
||||
@@ -18,8 +22,6 @@ namespace IRaCIS.Application.Contracts
|
||||
public Guid Id { get; set; }
|
||||
public string CROName { get; set; } = string.Empty;
|
||||
public string CROCode { get; set; } = string.Empty;
|
||||
|
||||
public string CRONameCN { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class CROCompanyQueryDTO : PageInput
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace IRaCIS.Application.Contracts
|
||||
{
|
||||
public class SiteDTO: SiteCommand
|
||||
{
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
|
||||
public class SiteCommand
|
||||
@@ -29,6 +29,8 @@ namespace IRaCIS.Application.Contracts
|
||||
public string DirectorPhone { get; set; } = string.Empty;
|
||||
public string ContactName { get; set; } = string.Empty;
|
||||
public string ContactPhone { get; set; } = string.Empty;
|
||||
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
}
|
||||
|
||||
public class SiteSelectionDTO
|
||||
@@ -44,6 +46,24 @@ namespace IRaCIS.Application.Contracts
|
||||
public string Country { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
|
||||
public class TrialSiteInQuery:PageInput
|
||||
{
|
||||
public string? TrialSiteName { get; set; }
|
||||
|
||||
public string? TrialCode { get; set; }
|
||||
}
|
||||
|
||||
public class TrialSiteAddView
|
||||
{
|
||||
public Guid TrialSiteId { get; set; }
|
||||
public string TrialCode { get; set; }
|
||||
|
||||
public string TrialSiteName { get; set; }
|
||||
|
||||
public string TrialSiteAliasName { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
public class SiteSelectDTO : SiteDTO
|
||||
{
|
||||
public string HospitalName { get; set; } = String.Empty;
|
||||
|
||||
@@ -17,6 +17,10 @@ namespace IRaCIS.Application.Contracts
|
||||
|
||||
public string SponsorCode { get; set; } = String.Empty;
|
||||
|
||||
public bool IsTrialLevel { get; set; }
|
||||
|
||||
public Guid? TrialId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class SponsorQueryDTO : PageInput
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace IRaCIS.Application.Interfaces
|
||||
public interface ICroService
|
||||
{
|
||||
Task<PageOutput<CROCompanyDTO>> GetCroList(CROCompanyQueryDTO queryModel);
|
||||
Task<IEnumerable<CroSelectDTO>> GetAllCROList();
|
||||
Task<IEnumerable<CroSelectDTO>> GetAllCROList(Guid? croId);
|
||||
Task<IResponseOutput> AddOrUpdateCro(CROCompanyDTO addCroCompanyViewModel);
|
||||
Task<IResponseOutput> DeleteCro(Guid croCompanyId);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace IRaCIS.Application.Interfaces
|
||||
public interface ISponsorService
|
||||
{
|
||||
Task<PageOutput<SponsorDTO>> GetSponsorList(SponsorQueryDTO queryParam);
|
||||
Task<IEnumerable<SponsorSelectDTO>> GetAllSponsorList();
|
||||
Task<IEnumerable<SponsorSelectDTO>> GetAllSponsorList(Guid? sponsorId);
|
||||
Task<IResponseOutput> AddOrUpdateSponsor(SponsorCommand model);
|
||||
Task<IResponseOutput> DeleteSponsor(Guid sponsorId);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Medallion.Threading;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using System.Security.Policy;
|
||||
using Site = IRaCIS.Core.Domain.Models.Site;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
@@ -21,7 +23,7 @@ namespace IRaCIS.Application.Services
|
||||
_siteRepository = siteRepository;
|
||||
_trialSiteUserRepository = trialSiteUserRepository;
|
||||
_distributedLockProvider = distributedLockProvider;
|
||||
_hospitalRepository= hospitalRepository;
|
||||
_hospitalRepository = hospitalRepository;
|
||||
}
|
||||
|
||||
/// <summary> 分页获取研究中心列表 </summary>
|
||||
@@ -35,7 +37,7 @@ namespace IRaCIS.Application.Services
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(searchModel.City), t => t.City.Contains(searchModel.City))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(searchModel.Country), t => t.Country.Contains(searchModel.Country))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(searchModel.Province), t => t.Province.Contains(searchModel.Province))
|
||||
.ProjectTo<SiteSelectDTO>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us });
|
||||
.ProjectTo<SiteSelectDTO>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us });
|
||||
|
||||
|
||||
return await siteQueryable.ToPagedListAsync(searchModel.PageIndex, searchModel.PageSize, string.IsNullOrWhiteSpace(searchModel.SortField) ? "SiteName" : searchModel.SortField, searchModel.Asc);
|
||||
@@ -48,6 +50,22 @@ namespace IRaCIS.Application.Services
|
||||
return await _siteRepository.ProjectTo<SiteSelectionDTO>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<TrialSiteAddView>> GetTrialSiteList(TrialSiteInQuery inQuery)
|
||||
{
|
||||
var query = _repository.Where<TrialSite>(t => t.SiteId == null)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TrialSiteName), t => t.TrialSiteName.Contains(inQuery.TrialSiteName) || t.TrialSiteAliasName.Contains(inQuery.TrialSiteName))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.TrialCode), t => t.Trial.TrialCode.Contains(inQuery.TrialCode))
|
||||
.Select(t => new TrialSiteAddView()
|
||||
{
|
||||
TrialCode = t.Trial.TrialCode,
|
||||
TrialSiteAliasName = t.TrialSiteAliasName,
|
||||
TrialSiteId = t.Id,
|
||||
TrialSiteName = t.TrialSiteName
|
||||
});
|
||||
|
||||
return await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TrialSiteAddView.TrialCode) : inQuery.SortField, inQuery.Asc);
|
||||
}
|
||||
|
||||
/// <summary> 添加研究中心 </summary>
|
||||
|
||||
@@ -56,7 +74,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
var exp = new EntityVerifyExp<Site>()
|
||||
{
|
||||
VerifyExp = h => h.SiteName.Equals(siteCommand.SiteName) || h.SiteCode.Equals(siteCommand.SiteCode),
|
||||
VerifyExp = h => h.SiteName.Equals(siteCommand.SiteName) || h.SiteNameCN.Equals(siteCommand.SiteNameCN),
|
||||
//---已经存在同名的中心,请确认。
|
||||
VerifyMsg = _localizer["Site_DupName"]
|
||||
};
|
||||
@@ -82,15 +100,22 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
|
||||
//手动绑
|
||||
if(siteCommand.HospitalId != null)
|
||||
if (siteCommand.HospitalId != null)
|
||||
{
|
||||
await _hospitalRepository.BatchUpdateNoTrackingAsync(t => t.Id == siteCommand.HospitalId, u => new Hospital() { SiteId = site.Id });
|
||||
}
|
||||
|
||||
if (siteCommand.TrialSiteId != null)
|
||||
{
|
||||
await _repository.BatchUpdateAsync<TrialSite>(t => t.Id == siteCommand.TrialSiteId, u => new TrialSite() { SiteId = site.Id });
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok(site.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary> 删除研究中心 </summary>
|
||||
@@ -99,7 +124,7 @@ namespace IRaCIS.Application.Services
|
||||
public async Task<IResponseOutput> DeleteSite(Guid siteId)
|
||||
{
|
||||
|
||||
if (await _trialSiteUserRepository.AnyAsync(t => t.SiteId == siteId))
|
||||
if (await _trialSiteUserRepository.AnyAsync(t => t.TrialSite.SiteId == siteId))
|
||||
{
|
||||
//---该中心已经加入项目,不可以被删除。
|
||||
return ResponseOutput.NotOk(_localizer["Site_InProject"]);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
@@ -33,14 +34,13 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
|
||||
/// <summary> 分页获取申办方列表 </summary>
|
||||
public async Task<IEnumerable<SponsorSelectDTO>> GetAllSponsorList()
|
||||
public async Task<IEnumerable<SponsorSelectDTO>> GetAllSponsorList(Guid? trialId)
|
||||
{
|
||||
//Expression<Func<Sponsor, bool>> sponsorLambda = x => true;
|
||||
//if (!string.IsNullOrWhiteSpace(sponsorSearchModel.SponsorName))
|
||||
//{
|
||||
// sponsorLambda = sponsorLambda.And(t => t.SponsorName.Contains(sponsorSearchModel.SponsorName.Trim()));
|
||||
//}
|
||||
var sponsorQueryable = _sponsorRepository.ProjectTo<SponsorSelectDTO>(_mapper.ConfigurationProvider,new { isEn_Us= _userInfo.IsEn_Us});
|
||||
|
||||
var sponsorQueryable = _sponsorRepository
|
||||
.WhereIf(trialId == null, t => t.IsTrialLevel == false)
|
||||
.WhereIf(trialId != null, t => t.IsTrialLevel == false || t.TrialId == trialId)
|
||||
.ProjectTo<SponsorSelectDTO>(_mapper.ConfigurationProvider,new { isEn_Us= _userInfo.IsEn_Us});
|
||||
return await sponsorQueryable.ToListAsync();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
var exp = new EntityVerifyExp<Sponsor>()
|
||||
{
|
||||
VerifyExp = h => h.SponsorName.Equals(sponsorCommand.SponsorName),
|
||||
VerifyExp = h => (h.SponsorName.Equals(sponsorCommand.SponsorName)|| h.SponsorNameCN.Equals(sponsorCommand.SponsorNameCN)) && h.IsTrialLevel == false,
|
||||
//---已经存在同名的申办方,请确认。
|
||||
VerifyMsg = _localizer["Sponsor_DupName"]
|
||||
};
|
||||
@@ -67,16 +67,11 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
public async Task<IResponseOutput> DeleteSponsor(Guid sponsorId)
|
||||
{
|
||||
if (await _trialRepository.AnyAsync(t => t.CROId == sponsorId))
|
||||
if (await _trialRepository.AnyAsync(t => t.SponsorId == sponsorId))
|
||||
{
|
||||
//---该申办方已经加入项目,不允许删除。
|
||||
return ResponseOutput.NotOk(_localizer["Sponsor_InProject"]);
|
||||
}
|
||||
//if (_userRepository.Find().Any(t => t.OrganizationId == sponsorId))
|
||||
//{
|
||||
// return ResponseOutput.NotOk("该申办方下存在用户,暂时无法删除。");
|
||||
//}
|
||||
|
||||
|
||||
var success = await _sponsorRepository.BatchDeleteNoTrackingAsync(x => x.Id == sponsorId);
|
||||
return ResponseOutput.Result(success);
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public Guid? LoginUserId { get; set; }
|
||||
|
||||
public Guid? OptUserId { get; set; }
|
||||
|
||||
public string IPRegion { get; set; }
|
||||
}
|
||||
|
||||
///<summary>UserLogQuery 列表查询参数模型</summary>
|
||||
@@ -47,10 +49,17 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
|
||||
public string? LoginFaildName { get; set; }
|
||||
|
||||
public string? LoginUserName { get; set; }
|
||||
|
||||
public DateTime? BeginDate { get; set; }
|
||||
|
||||
public DateTime? EndDate { get; set; }
|
||||
|
||||
public UserTypeEnum? LoginUserTypeEnum { get; set; }
|
||||
|
||||
public Guid? UserTypeId { get; set; }
|
||||
|
||||
public Guid? UserId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace IRaCIS.Application.Contracts
|
||||
{
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
public Guid? UserId { get; set; }
|
||||
}
|
||||
|
||||
public class LoginReturnDTO
|
||||
@@ -28,6 +30,8 @@ namespace IRaCIS.Application.Contracts
|
||||
public UserBasicInfo BasicInfo { get; set; } = new UserBasicInfo();
|
||||
public string JWTStr { get; set; }=string.Empty;
|
||||
|
||||
public bool IsMFA { get; set; } = false;
|
||||
|
||||
}
|
||||
|
||||
public class UserBasicInfo
|
||||
@@ -37,10 +41,18 @@ namespace IRaCIS.Application.Contracts
|
||||
public string RealName { get; set; } = string.Empty;
|
||||
public int Sex { get; set; } // 1-男 2-女
|
||||
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
/// <summary>
|
||||
/// LastLoginIP
|
||||
/// </summary>
|
||||
public string LastLoginIP { get; set; } = string.Empty;
|
||||
|
||||
public UserTypeEnum UserTypeEnum { get; set; }
|
||||
|
||||
public bool IsTestUser { 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; }
|
||||
@@ -51,11 +63,13 @@ namespace IRaCIS.Application.Contracts
|
||||
|
||||
public string PermissionStr { get; set; } = String.Empty;
|
||||
|
||||
|
||||
public string EMail { get; set; } = string.Empty;
|
||||
public bool IsFirstAdd { get; set; }
|
||||
public bool IsReviewer { get; set; } = false;
|
||||
|
||||
}
|
||||
public int LoginState { get; set; } = 0;
|
||||
|
||||
}
|
||||
|
||||
public class MenuFuncTreeNodeView
|
||||
{
|
||||
@@ -203,6 +217,12 @@ namespace IRaCIS.Application.Contracts
|
||||
|
||||
public bool ? IsZhiZhun { get; set; }
|
||||
public UserStateEnum? UserState { get; set; }
|
||||
|
||||
public DateTime? BeginCreateTime { get; set; }
|
||||
|
||||
public DateTime? EndCreateTime { get; set; }
|
||||
|
||||
public string? EMail { get; set; }
|
||||
}
|
||||
|
||||
public class UserRoleInfoDTO
|
||||
@@ -217,6 +237,8 @@ namespace IRaCIS.Application.Contracts
|
||||
public Guid testGuid { get; set; }
|
||||
public bool CanEditUserType { 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>();
|
||||
}
|
||||
|
||||
@@ -10,12 +10,16 @@ namespace IRaCIS.Application.Services
|
||||
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> SendMFAEmail(Guid userId);
|
||||
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> SendVerificationCode(string emailOrPhone, VerifyType verificationType, bool isReviewer = false);
|
||||
//Task<IResponseOutput> SetNewPassword(ResetPasswordCommand resetPwdModel);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ using Medallion.Threading;
|
||||
using EasyCaching.Core;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using LoginReturnDTO = IRaCIS.Application.Contracts.LoginReturnDTO;
|
||||
using IRaCIS.Core.Application.Auth;
|
||||
using BeetleX.Redis.Commands;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
@@ -22,16 +25,17 @@ namespace IRaCIS.Application.Services
|
||||
public class UserService : BaseService, IUserService
|
||||
{
|
||||
private readonly IRepository<User> _userRepository;
|
||||
|
||||
private readonly IMailVerificationService _mailVerificationService;
|
||||
private readonly IRepository<VerificationCode> _verificationCodeRepository;
|
||||
private readonly IRepository<Doctor> _doctorRepository;
|
||||
private readonly IRepository<TrialUser> _userTrialRepository;
|
||||
private readonly IRepository<UserLog> _userLogRepository;
|
||||
|
||||
private readonly IRepository<UserPassWordLog> _userPassWordLogRepository;
|
||||
private readonly IDistributedLockProvider _distributedLockProvider;
|
||||
private readonly IEasyCachingProvider _cache;
|
||||
private readonly IReadingImageTaskService _readingImageTaskService;
|
||||
private readonly IOptionsMonitor<ServiceVerifyConfigOption> _verifyConfig;
|
||||
private readonly IReadingImageTaskService _readingImageTaskService;
|
||||
private readonly IOptionsMonitor<ServiceVerifyConfigOption> _verifyConfig;
|
||||
|
||||
|
||||
public UserService(IRepository<User> userRepository,
|
||||
@@ -40,19 +44,20 @@ namespace IRaCIS.Application.Services
|
||||
IRepository<VerificationCode> verificationCodeRepository,
|
||||
IRepository<Doctor> doctorRepository,
|
||||
IEasyCachingProvider cache,
|
||||
IReadingImageTaskService readingImageTaskService,
|
||||
IRepository<TrialUser> userTrialRepository,
|
||||
IReadingImageTaskService readingImageTaskService,
|
||||
IRepository<TrialUser> userTrialRepository,
|
||||
IOptionsMonitor<ServiceVerifyConfigOption> verifyConfig,
|
||||
IRepository<UserLog> userLogRepository
|
||||
IRepository<UserLog> userLogRepository,
|
||||
IRepository<UserPassWordLog> userPassWordLogRepository
|
||||
,
|
||||
IDistributedLockProvider distributedLockProvider)
|
||||
{
|
||||
_userLogRepository = userLogRepository;
|
||||
|
||||
this._userPassWordLogRepository = userPassWordLogRepository;
|
||||
_verifyConfig = verifyConfig;
|
||||
_cache = cache;
|
||||
this._readingImageTaskService = readingImageTaskService;
|
||||
_userRepository = userRepository;
|
||||
this._readingImageTaskService = readingImageTaskService;
|
||||
_userRepository = userRepository;
|
||||
_mailVerificationService = mailVerificationService;
|
||||
_verificationCodeRepository = verificationCodeRepository;
|
||||
_doctorRepository = doctorRepository;
|
||||
@@ -95,33 +100,51 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
//var dbUser = (await _userRepository.FirstOrDefaultAsync(t => t.Id == userId)).IfNullThrowException();
|
||||
|
||||
if (_verifyConfig.CurrentValue.OpenUserComplexPassword)
|
||||
if (oldPwd != null && oldPwd == newPwd)
|
||||
{
|
||||
|
||||
if (oldPwd != null && oldPwd == newPwd)
|
||||
{
|
||||
//---新密码与旧密码相同。
|
||||
throw new BusinessValidationFailedException(_localizer["User_NewOldPwdSame"]);
|
||||
}
|
||||
|
||||
|
||||
var dbUser = (await _userRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
if (oldPwd != null && dbUser.Password != oldPwd)
|
||||
{
|
||||
//---旧密码验证失败。
|
||||
throw new BusinessValidationFailedException(_localizer["User_OldPwdInvalid"]);
|
||||
}
|
||||
|
||||
if (dbUser.Password == newPwd)
|
||||
{
|
||||
//---新密码与旧密码相同。
|
||||
throw new BusinessValidationFailedException(_localizer["User_NewOldPwdSame"]);
|
||||
}
|
||||
|
||||
|
||||
//---新密码与旧密码相同。
|
||||
throw new BusinessValidationFailedException(_localizer["User_NewOldPwdSame"]);
|
||||
}
|
||||
|
||||
|
||||
var dbUser = (await _userRepository.Where(t => t.Id == userId).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
if (oldPwd != null && dbUser.Password != oldPwd)
|
||||
{
|
||||
//---旧密码验证失败。
|
||||
throw new BusinessValidationFailedException(_localizer["User_OldPwdInvalid"]);
|
||||
}
|
||||
|
||||
if (dbUser.Password == newPwd)
|
||||
{
|
||||
//---新密码与旧密码相同。
|
||||
throw new BusinessValidationFailedException(_localizer["User_NewOldPwdSame"]);
|
||||
}
|
||||
|
||||
var passWordList = await _userPassWordLogRepository.Where(x => x.UserId == userId).OrderByDescending(x => x.CreateTime).Take(2).ToListAsync();
|
||||
if (passWordList.Any(x => x.PassWord == newPwd))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["User_PassWordRepeat"]);
|
||||
}
|
||||
if (oldPwd != null)
|
||||
{
|
||||
await _userPassWordLogRepository.AddAsync(new UserPassWordLog()
|
||||
{
|
||||
|
||||
CreateTime = DateTime.Now,
|
||||
PassWord = oldPwd,
|
||||
UserId = userId,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == userId, x => new User()
|
||||
{
|
||||
LastChangePassWordTime = DateTime.Now,
|
||||
});
|
||||
await _userPassWordLogRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
await Task.CompletedTask;
|
||||
|
||||
|
||||
@@ -135,7 +158,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
|
||||
//检查手机或者邮箱是否有效
|
||||
if (!Regex.IsMatch(email, @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$"))
|
||||
if (!Regex.IsMatch(email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"))
|
||||
{
|
||||
//---Please input a legal email
|
||||
return ResponseOutput.NotOk(_localizer["User_LegalEmail"]);
|
||||
@@ -286,7 +309,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
await _mailVerificationService.AdminResetPwdSendEmailAsync(userId, pwd);
|
||||
}
|
||||
catch (Exception )
|
||||
catch (Exception)
|
||||
{
|
||||
//---请检查邮箱地址或者联系维护人员, 邮件发送失败, 未能创建账户成功
|
||||
throw new BusinessValidationFailedException(_localizer["User_CreateFailed"]);
|
||||
@@ -299,7 +322,7 @@ namespace IRaCIS.Application.Services
|
||||
IsFirstAdd = true
|
||||
});
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId=userId, OptType = UserOptType.ResetPassword }, true);
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = UserOptType.ResetPassword }, true);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
@@ -317,7 +340,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
|
||||
//检查手机或者邮箱是否有效
|
||||
if (!Regex.IsMatch(email, @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$"))
|
||||
if (!Regex.IsMatch(email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"))
|
||||
{
|
||||
|
||||
//---请输入一个正确的邮箱。
|
||||
@@ -383,7 +406,7 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
}
|
||||
|
||||
var list = await _userRepository.Where(t => t.EMail == email && t.Status== UserStateEnum.Enable).Select(t => new UserAccountDto() { UserId = t.Id, UserName = t.UserName, UserRealName = t.FullName, UserType = t.UserTypeRole.UserTypeShortName }).ToListAsync();
|
||||
var list = await _userRepository.Where(t => t.EMail == email && t.Status == UserStateEnum.Enable).Select(t => new UserAccountDto() { UserId = t.Id, UserName = t.UserName, UserRealName = t.FullName, UserType = t.UserTypeRole.UserTypeShortName }).ToListAsync();
|
||||
|
||||
|
||||
|
||||
@@ -411,7 +434,7 @@ namespace IRaCIS.Application.Services
|
||||
IsFirstAdd = false
|
||||
});
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = Guid.Empty, OptUserId = userId,LoginPassword=newPwd, OptType = UserOptType.UnloginModifyPasswoed }, true);
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, LoginPassword = newPwd, OptType = UserOptType.UnloginModifyPasswoed }, true);
|
||||
|
||||
return ResponseOutput.Result(success);
|
||||
|
||||
@@ -447,7 +470,7 @@ namespace IRaCIS.Application.Services
|
||||
IsFirstAdd = false
|
||||
});
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId= _userInfo.Id, OptType = UserOptType.LoginModifyPassword }, true);
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.LoginModifyPassword }, true);
|
||||
|
||||
return ResponseOutput.Result(success);
|
||||
|
||||
@@ -470,6 +493,9 @@ namespace IRaCIS.Application.Services
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.RealName), t => t.FullName.Contains(param.RealName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.Phone), t => t.Phone.Contains(param.Phone))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName), t => t.OrganizationName.Contains(param.OrganizationName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.EMail), t => t.EMail.Contains(param.EMail))
|
||||
.WhereIf(param.BeginCreateTime != null, t => t.CreateTime >= param.BeginCreateTime)
|
||||
.WhereIf(param.EndCreateTime != null, t => t.CreateTime <= param.EndCreateTime)
|
||||
.WhereIf(param.UserType != null, t => t.UserTypeId == param.UserType)
|
||||
.WhereIf(param.UserState != null, t => t.Status == param.UserState)
|
||||
.WhereIf(param.IsTestUser != null, t => t.IsTestUser == param.IsTestUser)
|
||||
@@ -532,11 +558,11 @@ namespace IRaCIS.Application.Services
|
||||
var success = await _userRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
await _mailVerificationService.AddUserSendEmailAsync(saveItem.Id, userAddModel.BaseUrl, userAddModel.RouteUrl);
|
||||
|
||||
|
||||
return ResponseOutput.Ok( new UserAddedReturnDTO { Id = saveItem.Id, UserCode = saveItem.UserCode });
|
||||
return ResponseOutput.Ok(new UserAddedReturnDTO { Id = saveItem.Id, UserCode = saveItem.UserCode });
|
||||
|
||||
}
|
||||
|
||||
@@ -566,7 +592,7 @@ namespace IRaCIS.Application.Services
|
||||
user.OrganizationName = AppSettings.DefaultInternalOrganizationName;
|
||||
}
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId= model.Id , OptType = UserOptType.UpdateUser }, true);
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = model.Id, OptType = UserOptType.UpdateUser }, true);
|
||||
|
||||
var success = await _userRepository.SaveChangesAsync();
|
||||
|
||||
@@ -588,7 +614,7 @@ namespace IRaCIS.Application.Services
|
||||
return ResponseOutput.NotOk(_localizer["User_InProject"]);
|
||||
}
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId= userId, OptType = UserOptType.DeleteUser }, true);
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = UserOptType.DeleteUser }, true);
|
||||
|
||||
var success = await _userRepository.BatchDeleteNoTrackingAsync(t => t.Id == userId);
|
||||
|
||||
@@ -606,7 +632,7 @@ namespace IRaCIS.Application.Services
|
||||
public async Task<IResponseOutput> UpdateUserState(Guid userId, UserStateEnum state)
|
||||
{
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = state==UserStateEnum.Enable? UserOptType.AccountEnable: UserOptType.AccountLocked }, true);
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = state == UserStateEnum.Enable ? UserOptType.AccountEnable : UserOptType.AccountLocked }, true);
|
||||
|
||||
var success = await _userRepository.BatchUpdateNoTrackingAsync(u => u.Id == userId, t => new User
|
||||
{
|
||||
@@ -616,7 +642,70 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
|
||||
|
||||
public async Task<UserBasicInfo> GetUserBasicInfo(Guid userId, string pwd)
|
||||
{
|
||||
var info = await _userRepository.Where(u => u.Id == userId && u.Password==pwd).ProjectTo<UserBasicInfo>(_mapper.ConfigurationProvider).FirstNotNullAsync();
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送MFA 验证邮件
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> SendMFAEmail(Guid userId)
|
||||
{
|
||||
var userInfo = await _userRepository.Where(u => u.Id == userId).Select(t => new { t.FullName, t.EMail }).FirstOrDefaultAsync();
|
||||
|
||||
int verificationCode = new Random().Next(100000, 1000000);
|
||||
|
||||
await _mailVerificationService.SenMFAVerifyEmail(userId, userInfo.FullName, userInfo.EMail, verificationCode);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证MFA 邮件
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="Code"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> VerifyMFACodeAsync(Guid userId, string Code)
|
||||
{
|
||||
var verificationRecord = await _repository.GetQueryable<VerificationCode>().OrderByDescending(x => x.ExpirationTime).Where(t => t.UserId == userId && t.Code == Code && t.CodeType == VerifyType.Email).FirstOrDefaultAsync();
|
||||
VerifyEmialGetDoctorInfoOutDto result = new VerifyEmialGetDoctorInfoOutDto();
|
||||
|
||||
//检查数据库是否存在该验证码
|
||||
if (verificationRecord == null)
|
||||
{
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, OptType = UserOptType.MFALoginFail }, true);
|
||||
//---验证码错误。
|
||||
throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_WrongVerificationCode"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
//检查验证码是否失效
|
||||
if (verificationRecord.ExpirationTime < DateTime.Now)
|
||||
{
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, OptType = UserOptType.MFALoginFail }, true);
|
||||
//---验证码已经过期。
|
||||
throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]);
|
||||
|
||||
|
||||
}
|
||||
else //验证码正确 并且 没有超时
|
||||
{
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, OptType = UserOptType.MFALogin }, true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户登陆
|
||||
@@ -649,7 +738,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
if (failCount >= maxFailures)
|
||||
{
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = Guid.Empty, OptUserId = Guid.Empty, LoginFaildName = userName,LoginPassword=password, OptType = UserOptType.AccountLocked }, true);
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = Guid.Empty, OptUserId = Guid.Empty, LoginFaildName = userName, LoginPassword = password, OptType = UserOptType.AccountLocked }, true);
|
||||
|
||||
//$"密码连续错误{maxFailures}次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。"
|
||||
throw new BusinessValidationFailedException(_localizer["User_ErrorLimit", maxFailures, lockoutMinutes]);
|
||||
@@ -667,12 +756,12 @@ namespace IRaCIS.Application.Services
|
||||
failCount++;
|
||||
_cache.Set(cacheKey, failCount, TimeSpan.FromMinutes(lockoutMinutes));
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = Guid.Empty, OptUserId=Guid.Empty, LoginFaildName = userName, LoginPassword = password, OptType = UserOptType.AccountOrPasswordError }, true);
|
||||
var errorPwdUserId = await _userRepository.Where(u => u.UserName == userName).Select(t => t.Id).FirstOrDefaultAsync();
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = errorPwdUserId, OptUserId = errorPwdUserId, LoginFaildName = userName, LoginPassword = password, OptType = UserOptType.AccountOrPasswordError }, true);
|
||||
|
||||
return ResponseOutput.NotOk(_localizer["User_CheckNameOrPw"], new LoginReturnDTO());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (loginUser.Status == 0)
|
||||
@@ -683,18 +772,49 @@ namespace IRaCIS.Application.Services
|
||||
return ResponseOutput.NotOk(_localizer["User_Disabled"], new LoginReturnDTO());
|
||||
}
|
||||
|
||||
//超过90天没修改密码
|
||||
if (loginUser.LastChangePassWordTime != null && DateTime.Now.AddDays(-90) > loginUser.LastChangePassWordTime.Value)
|
||||
{
|
||||
loginUser.LoginState = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//登录成功 清除缓存
|
||||
_cache.Set(cacheKey, 0, TimeSpan.FromMinutes(lockoutMinutes));
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = loginUser.Id, OptUserId = loginUser.Id, OptType = UserOptType.Login }, true);
|
||||
|
||||
if (loginUser.LastLoginIP != string.Empty)
|
||||
{
|
||||
// 与上一次IP不一致
|
||||
if (loginUser.LastLoginIP != _userInfo.IP)
|
||||
{
|
||||
loginUser.LoginState = 2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = loginUser.Id, OptUserId = loginUser.Id, OptType = UserOptType.Login }, true);
|
||||
|
||||
userLoginReturnModel.BasicInfo = loginUser;
|
||||
|
||||
// 登录 清除缓存
|
||||
_cache.Remove(userLoginReturnModel.BasicInfo.Id.ToString());
|
||||
if (loginUser.LastChangePassWordTime == null)
|
||||
{
|
||||
await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.Id, x => new User()
|
||||
{
|
||||
LastChangePassWordTime = DateTime.Now
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.Id, x => new User()
|
||||
{
|
||||
LastLoginIP = _userInfo.IP
|
||||
|
||||
});
|
||||
|
||||
|
||||
return ResponseOutput.Ok(userLoginReturnModel);
|
||||
|
||||
}
|
||||
@@ -702,15 +822,22 @@ namespace IRaCIS.Application.Services
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<UserLogView>> GetUserLogList(UserLogQuery inQuery)
|
||||
{
|
||||
DateTime? trialCreateTime = inQuery.TrialId != null ? _repository.Where<Trial>(t => t.Id == inQuery.TrialId).Select(t => t.CreateTime).FirstOrDefault() : null;
|
||||
|
||||
var userLogQueryable =
|
||||
_userLogRepository
|
||||
.WhereIf(inQuery.TrialId != null, t => t.LoginUser.UserTrials.Any(c => c.TrialId == inQuery.TrialId && c.UserId == t.LoginUserId))
|
||||
.WhereIf(inQuery.TrialId != null, t => t.LoginUser.UserTrials.Any(c => c.TrialId == inQuery.TrialId && (c.UserId == t.LoginUserId || c.UserId == t.OptUserId)))
|
||||
.WhereIf(trialCreateTime != null, t => t.CreateTime >= trialCreateTime)
|
||||
.WhereIf(inQuery.OptType != null, t => t.OptType == inQuery.OptType)
|
||||
.WhereIf(inQuery.UserId != null, t => t.LoginUserId == inQuery.UserId)
|
||||
.WhereIf(inQuery.BeginDate != null, t => t.CreateTime >= inQuery.BeginDate)
|
||||
.WhereIf(inQuery.EndDate != null, t => t.CreateTime <= inQuery.EndDate)
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.LoginUser.UserName.Contains(inQuery.LoginUserName!))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginFaildName), t => t.LoginFaildName.Contains(inQuery.LoginFaildName!))
|
||||
.WhereIf(!string.IsNullOrEmpty(inQuery.IP), t => t.IP.Contains(inQuery.IP!))
|
||||
.WhereIf(inQuery.LoginUserTypeEnum != null, t => t.LoginUser.UserTypeEnum == inQuery.LoginUserTypeEnum)
|
||||
.WhereIf(inQuery.UserTypeId != null, t => t.LoginUser.UserTypeId == inQuery.UserTypeId)
|
||||
|
||||
.ProjectTo<UserLogView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList = await userLogQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? "Id" : inQuery.SortField, inQuery.Asc);
|
||||
@@ -718,10 +845,11 @@ namespace IRaCIS.Application.Services
|
||||
return pageList;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet]
|
||||
public async Task<IResponseOutput> LoginOut()
|
||||
public async Task<IResponseOutput> LoginOut(Guid userId)
|
||||
{
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = _userInfo.Id, OptType = UserOptType.LoginOut },true);
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = _userInfo.Id, OptType = UserOptType.LoginOut }, true);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
@@ -165,6 +165,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
/// <returns></returns>
|
||||
public async Task<List<TrialUserType>> GetTrialUserTypeList()
|
||||
{
|
||||
//排除其他组的用户
|
||||
var query = _userTypeRepository.Where(x => x.UserTypeEnum != UserTypeEnum.SuperAdmin)
|
||||
.Where(t => !t.UserTypeGroupList.Any(t=> t.Group.Code=="3"))
|
||||
.OrderBy(t => t.UserTypeShortName).ProjectTo<TrialUserType>(_mapper.ConfigurationProvider);
|
||||
|
||||
@@ -56,33 +56,6 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
return clinicalObj;
|
||||
|
||||
#region 老方式 linq join 而且需要映射
|
||||
|
||||
|
||||
//var query = from sv in _subjectVisitRepository.GetAll()
|
||||
// join subject in _subjectRepository.GetAll() on sv.SubjectId equals subject.Id
|
||||
// join trialSite in _trialSiteRepository.Find(t => t.TrialId == subjectClinicalDataQuery.TrialId) on sv.SiteId equals trialSite.SiteId
|
||||
// select new SubjectClinicalDataDto()
|
||||
// {
|
||||
// SubjectId = sv.SubjectId,
|
||||
// SubjectCode = subject.Code,
|
||||
// SubjectVisitId = sv.Id,
|
||||
// VisitName = sv.VisitName,
|
||||
// VisitNum = sv.VisitNum,
|
||||
// TrialSiteCode = trialSite.TrialSiteCode
|
||||
// };
|
||||
|
||||
//var clinicalObj = query.FirstOrDefault(t => t.SubjectVisitId == subjectClinicalDataQuery.SubjectVisitId);
|
||||
|
||||
//clinicalObj.PreviousHistoryList = _previousHistoryRepository.Find(t => t.SubjectVisitId == subjectClinicalDataQuery.SubjectVisitId)
|
||||
// .ProjectTo<PreviousHistoryView>(_mapper.ConfigurationProvider).ToList();
|
||||
//clinicalObj.PreviousOtherList = _previousOtherRepository.Find(t => t.SubjectVisitId == subjectClinicalDataQuery.SubjectVisitId)
|
||||
// .ProjectTo<PreviousOtherView>(_mapper.ConfigurationProvider).ToList();
|
||||
//clinicalObj.PreviousSurgeryList = _previousSurgeryRepository.Find(t => t.SubjectVisitId == subjectClinicalDataQuery.SubjectVisitId)
|
||||
// .ProjectTo<PreviousSurgeryView>(_mapper.ConfigurationProvider).ToList();
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
public string BodyPart { get; set; } = string.Empty;
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace IRaCIS.Core.Application.Contracts.DTO
|
||||
//public string LastName { get; set; }
|
||||
//public string Modalities { get; set; }
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
public string SiteName { get; set; } = String.Empty;
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
public bool? IsUrgent { get; set; }
|
||||
@@ -51,7 +51,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public bool? IsUrgent { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
|
||||
public Guid? VisitId { get; set; }
|
||||
public Guid? SubjectId { get; set; }
|
||||
@@ -263,7 +263,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
//public int? Age { get; set; }
|
||||
//public string Sex { get; set; } = string.Empty;
|
||||
//public Guid SiteId { get; set; }
|
||||
//public Guid TrialSiteId { get; set; }
|
||||
//public Guid TrialId { get; set; }
|
||||
//public string MedicalNo { get; set; } = string.Empty;
|
||||
//public string ShortName { get; set; } = string.Empty;
|
||||
@@ -353,10 +353,6 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public ReadingMethod ReadingType { get; set; }
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 任务展示访视 读片任务显示是否顺序
|
||||
///// </summary>
|
||||
//public bool IsReadingTaskViewInOrder { get; set; } = true;
|
||||
}
|
||||
|
||||
public class ReadingPeriodOrVisitInfo
|
||||
@@ -498,6 +494,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public string ArchiveFinishedTimeStr => ArchiveFinishedTime?.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
|
||||
|
||||
public string UploadIntervalStr
|
||||
{
|
||||
get
|
||||
@@ -519,6 +516,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string TimeInterval
|
||||
{
|
||||
get
|
||||
@@ -527,6 +525,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
var uploadTimeSpan = ArchiveFinishedTime - UploadStartTime;
|
||||
|
||||
return $" {uploadTimeSpan?.Hours}:{uploadTimeSpan?.Minutes}:{uploadTimeSpan?.Seconds}.{uploadTimeSpan?.Milliseconds}";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,7 +610,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public string VisitName { get; set; } = string.Empty;
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
[DictionaryTranslateAttribute("RequestBackState")]
|
||||
public RequestBackStateEnum RequestBackState { get; set; }
|
||||
@@ -1122,7 +1121,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public bool? IsUrgent { get; set; }
|
||||
public Guid? SubjectId { get; set; }
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
public bool? IsClosed { get; set; }
|
||||
public bool? IsOverTime { get; set; }
|
||||
public Guid? CreateUserId { get; set; }
|
||||
@@ -1185,7 +1184,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public QCChanllengeReuploadEnum ReuploadEnum { get; set; }
|
||||
public DateTime? DeadlineTime { get; set; }
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
public AuditStateEnum AuditState { get; set; }
|
||||
public CurrentQC CurrentQCEnum { get; set; }
|
||||
public TrialQCProcess QCProcessEnum { get; set; }
|
||||
@@ -1235,7 +1234,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
public string SubjectInfo { get; set; } = String.Empty;
|
||||
|
||||
|
||||
@@ -1278,7 +1277,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
public string SubjectInfo { get; set; } = String.Empty;
|
||||
|
||||
public string[]? VisitPlanArray { get; set; }
|
||||
@@ -1351,7 +1350,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public string VisitName { get; set; } = string.Empty;
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
//public string Modality { get; set; }
|
||||
|
||||
@@ -1439,7 +1438,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
public Guid? Id { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SubjectId { get; set; }
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
public bool InPlan { get; set; } = true;
|
||||
public int VisitExecuted { get; set; }
|
||||
public decimal VisitNum { get; set; }
|
||||
@@ -1471,6 +1470,10 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
public bool IsLostVisit { get; set; }
|
||||
|
||||
public string VisitImageZipPath { get; set; }
|
||||
|
||||
public PackState PackState { get; set; }
|
||||
|
||||
//public Guid? ClinicalDataSignUserId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -57,13 +57,13 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
/// <param name="visitSearchDTO"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<(PageOutput<QCCRCVisitViewModel>, TrialSubjectAndSVConfig)> GetCRCVisitList(CRCVisitSearchDTO visitSearchDTO)
|
||||
public async Task<IResponseOutput< PageOutput<QCCRCVisitViewModel>>> GetCRCVisitList(CRCVisitSearchDTO visitSearchDTO)
|
||||
{
|
||||
var svExpression = QCCommon.GetSubjectVisitFilter(visitSearchDTO.VisitPlanArray);
|
||||
|
||||
var query = _subjectVisitRepository.Where(x => x.TrialId == visitSearchDTO.TrialId)
|
||||
.Where(t => t.Subject.FinalSubjectVisitId != null ? t.VisitNum <= t.Subject.FinalSubjectVisit.VisitNum : true)
|
||||
.WhereIf(visitSearchDTO.SiteId != null, t => t.SiteId == visitSearchDTO.SiteId)
|
||||
.WhereIf(visitSearchDTO.TrialSiteId != null, t => t.TrialSiteId == visitSearchDTO.TrialSiteId)
|
||||
.WhereIf(visitSearchDTO.SubjectId != null, t => t.Subject.Id == visitSearchDTO.SubjectId)
|
||||
.WhereIf(!string.IsNullOrEmpty(visitSearchDTO.SubjectInfo), t => t.Subject.Code.Contains(visitSearchDTO.SubjectInfo))
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
var config = await _repository.Where<Trial>(t => t.Id == visitSearchDTO.TrialId).ProjectTo<TrialSubjectAndSVConfig>(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException();
|
||||
config.IsHaveSubjectClinicalData = await _clinicalDataTrialSet.AnyAsync(x => x.TrialId == visitSearchDTO.TrialId && x.IsConfirm && (x.ClinicalDataLevel == ClinicalLevel.Subject ) && x.UploadRole == UploadRole.CRC);
|
||||
config.IsHaveVisitClinicalData = await _clinicalDataTrialSet.AnyAsync(x => x.TrialId == visitSearchDTO.TrialId && x.IsConfirm && (x.ClinicalDataLevel == ClinicalLevel.SubjectVisit) && x.UploadRole == UploadRole.CRC);
|
||||
return (pageList, config);
|
||||
return ResponseOutput.Ok (pageList, config);
|
||||
|
||||
}
|
||||
|
||||
@@ -98,39 +98,6 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
public async Task<(PageOutput<QCCRCChallengeViewModel>, TrialSubjectAndSVConfig)> GetCRCChallengeList(ChallengeQuery challengeQuery)
|
||||
{
|
||||
|
||||
#region CRC 质疑列表 join连表方式
|
||||
//var query = from qcChanllenge in _qcChallengeRepository.Find(qcChallengeLambda)
|
||||
// join subjectVisit in _subjectVisitRepository.Find() on qcChanllenge.SubjectVisitId equals subjectVisit.Id
|
||||
// join trialSite in _trialSiteRepository.Find(t => t.TrialId == challengeQuery.TrialId) on subjectVisit.SiteId equals trialSite.SiteId
|
||||
// join subject in _subjectRepository.Find() on subjectVisit.SubjectId equals subject.Id
|
||||
// select new QCCRCChallengeViewModel()
|
||||
// {
|
||||
// Id = qcChanllenge.Id,
|
||||
// SubjectVisitId = qcChanllenge.SubjectVisitId,
|
||||
// ChallengeCode = qcChanllenge.ChallengeCode,
|
||||
// ChallengeType = qcChanllenge.ChallengeType,
|
||||
// Note = qcChanllenge.Note,
|
||||
// Content = qcChanllenge.Content,
|
||||
// UserTypeEnum = qcChanllenge.UserTypeEnum,
|
||||
// CreateTime = qcChanllenge.CreateTime,
|
||||
// CreateUser = qcChanllenge.CreateUser,
|
||||
// CreateUserId = qcChanllenge.CreateUserId,
|
||||
|
||||
// DeadlineTime = qcChanllenge.DeadlineTime,
|
||||
// IsClosed = qcChanllenge.IsClosed,
|
||||
// ClosedTime = qcChanllenge.ClosedTime,
|
||||
// ClosedUser = qcChanllenge.ClosedUser,
|
||||
// NeedReUpload = qcChanllenge.NeedReUpload,
|
||||
|
||||
// VisitName = subjectVisit.VisitName,
|
||||
// VisitNum = subjectVisit.VisitNum,
|
||||
// SubjectCode = subject.Code,
|
||||
// TrialSiteCode = trialSite.TrialSiteCode,
|
||||
|
||||
// LatestMsgTime = qcChanllenge.LatestMsgTime,
|
||||
// LatestReplyUser = qcChanllenge.LatestReplyUser,
|
||||
// };
|
||||
#endregion
|
||||
|
||||
var svExpression = QCCommon.GetQCChallengeFilter(challengeQuery.VisitPlanArray);
|
||||
|
||||
@@ -138,7 +105,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
//.WhereIf(challengeQuery.ChallengeState != null, t => t.SubjectVisit.ChallengeState == challengeQuery.ChallengeState)
|
||||
.WhereIf(challengeQuery.ReuploadEnum != null, t => t.ReuploadEnum == challengeQuery.ReuploadEnum)
|
||||
.WhereIf(challengeQuery.IsClosed != null, t => t.IsClosed == challengeQuery.IsClosed)
|
||||
.WhereIf(challengeQuery.SiteId != null, t => t.SubjectVisit.SiteId == challengeQuery.SiteId)
|
||||
.WhereIf(challengeQuery.TrialSiteId != null, t => t.SubjectVisit.TrialSiteId == challengeQuery.TrialSiteId)
|
||||
.WhereIf(challengeQuery.SubjectId != null, t => t.SubjectVisit.SubjectId == challengeQuery.SubjectId)
|
||||
.WhereIf(challengeQuery.CreateUserId != null, t => t.CreateUserId == challengeQuery.CreateUserId)
|
||||
.WhereIf(challengeQuery.SubjectCode != null, t => t.SubjectVisit.Subject.Code.Contains(challengeQuery.SubjectCode!))
|
||||
@@ -170,57 +137,6 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
[HttpPost]
|
||||
public async Task<(PageOutput<QCCRCChallengeViewModel>, TrialSubjectAndSVConfig)> GetQCChallengeList(ChallengeQuery challengeQuery)
|
||||
{
|
||||
#region linq方式 + Expression 拼接
|
||||
|
||||
//Expression<Func<QCChallenge, bool>> qcChallengeLambda = x => x.TrialId == challengeQuery.TrialId;
|
||||
|
||||
//if (challengeQuery.ReuploadEnum != null)
|
||||
//{
|
||||
// qcChallengeLambda = qcChallengeLambda.And(t => t.ReuploadEnum == challengeQuery.ReuploadEnum);
|
||||
//}
|
||||
//if (challengeQuery.IsClosed != null)
|
||||
//{
|
||||
// qcChallengeLambda = qcChallengeLambda.And(t => t.IsClosed == challengeQuery.IsClosed);
|
||||
//}
|
||||
//if (challengeQuery.SiteId != null)
|
||||
//{
|
||||
// qcChallengeLambda = qcChallengeLambda.And(t => t.SubjectVisit.SiteId == challengeQuery.SiteId.Value);
|
||||
//}
|
||||
//if (challengeQuery.SubjectId != null)
|
||||
//{
|
||||
// qcChallengeLambda = qcChallengeLambda.And(t => t.SubjectVisit.Subject.Id == challengeQuery.SubjectId.Value);
|
||||
//}
|
||||
|
||||
//var query = from qcChanllenge in _qcChallengeRepository.Find(qcChallengeLambda)
|
||||
// join subjectVisit in _subjectVisitRepository.Find(subjectVisitLambda) on qcChanllenge.SubjectVisitId equals subjectVisit.Id
|
||||
// join trialSite in _trialSiteRepository.Find(t => t.TrialId == challengeQuery.TrialId) on subjectVisit.SiteId equals trialSite.SiteId
|
||||
// join subject in _subjectRepository.Find() on subjectVisit.SubjectId equals subject.Id
|
||||
// select new QCChallengeViewModel()
|
||||
// {
|
||||
// Id = qcChanllenge.Id,
|
||||
// SubjectVisitId = qcChanllenge.SubjectVisitId,
|
||||
// ChallengeCode = qcChanllenge.ChallengeCode.ToString(),
|
||||
// ChallengeType = qcChanllenge.ChallengeType,
|
||||
// Note = qcChanllenge.Note,
|
||||
// UserTypeEnum = qcChanllenge.UserTypeEnum,
|
||||
// Content = qcChanllenge.Content,
|
||||
// CreateTime = qcChanllenge.CreateTime,
|
||||
// CreateUserId = qcChanllenge.CreateUserId,
|
||||
// CreateUser = qcChanllenge.CreateUser,
|
||||
// SubjectCode = subject.Code,
|
||||
// TrialSiteCode = trialSite.TrialSiteCode,
|
||||
// DeadlineTime = qcChanllenge.DeadlineTime,
|
||||
// IsClosed = qcChanllenge.IsClosed,
|
||||
// ClosedTime = qcChanllenge.ClosedTime,
|
||||
// ClosedUser = qcChanllenge.ClosedUser,
|
||||
// NeedReUpload = qcChanllenge.NeedReUpload,
|
||||
// VisitName = subjectVisit.VisitName,
|
||||
// VisitNum = subjectVisit.VisitNum,
|
||||
// LatestMsgTime = qcChanllenge.LatestMsgTime,
|
||||
// LatestReplyUser = qcChanllenge.LatestReplyUser,
|
||||
|
||||
// };
|
||||
#endregion
|
||||
|
||||
var svExpression = QCCommon.GetQCChallengeFilter(challengeQuery.VisitPlanArray);
|
||||
|
||||
@@ -228,7 +144,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
//.WhereIf(challengeQuery.ChallengeState != null, t => t.SubjectVisit.ChallengeState == challengeQuery.ChallengeState)
|
||||
.WhereIf(challengeQuery.ReuploadEnum != null, t => t.ReuploadEnum == challengeQuery.ReuploadEnum)
|
||||
.WhereIf(challengeQuery.IsClosed != null, t => t.IsClosed == challengeQuery.IsClosed)
|
||||
.WhereIf(challengeQuery.SiteId != null, t => t.SubjectVisit.SiteId == challengeQuery.SiteId)
|
||||
.WhereIf(challengeQuery.TrialSiteId != null, t => t.SubjectVisit.TrialSiteId == challengeQuery.TrialSiteId)
|
||||
.WhereIf(challengeQuery.SubjectId != null, t => t.SubjectVisit.SubjectId == challengeQuery.SubjectId)
|
||||
.WhereIf(challengeQuery.CreateUserId != null, t => t.CreateUserId == challengeQuery.CreateUserId)
|
||||
.WhereIf(!string.IsNullOrEmpty(challengeQuery.SubjectCode), t => t.SubjectVisit.Subject.Code.Contains(challengeQuery.SubjectCode))
|
||||
@@ -275,170 +191,12 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
public async Task<(PageOutput<QCVisitViewModel>, TrialSubjectAndSVConfig)> GetQCVisitList(QCVisitSearchDTO visitSearchDTO)
|
||||
{
|
||||
|
||||
#region 经典 linq
|
||||
//Expression<Func<Subject, bool>> subjectLambda = x => true;
|
||||
|
||||
//Expression<Func<SubjectVisit, bool>> subjectVisitLambda = x => x.TrialId == visitSearchDTO.TrialId;
|
||||
//Expression<Func<DicomStudy, bool>> studyLambda = x => x.TrialId == visitSearchDTO.TrialId;
|
||||
////Expression<Func<VisitStage, bool>> visitPlanLambda = x => x.TrialId == subjectVisitSearch.TrialId;
|
||||
|
||||
//if (visitSearchDTO.SiteId != null && visitSearchDTO.SiteId != Guid.Empty)shiwu
|
||||
//{
|
||||
// subjectVisitLambda = subjectVisitLambda.And(t => t.SiteId == visitSearchDTO.SiteId.Value);
|
||||
// studyLambda = studyLambda.And(t => t.SiteId == visitSearchDTO.SiteId.Value);
|
||||
//}
|
||||
|
||||
//if (visitSearchDTO.SubjectId != null && visitSearchDTO.SubjectId != Guid.Empty)
|
||||
//{
|
||||
// subjectLambda = subjectLambda.And(t => t.Id == visitSearchDTO.SubjectId.Value);
|
||||
|
||||
// studyLambda = studyLambda.And(t => t.SubjectId == visitSearchDTO.SubjectId.Value);
|
||||
//}
|
||||
|
||||
//if (!string.IsNullOrEmpty(visitSearchDTO.SubjectInfo))
|
||||
//{
|
||||
// var search = visitSearchDTO.SubjectInfo.Trim();
|
||||
// subjectLambda = subjectLambda.And(t => t.FirstName.Contains(search) || t.LastName.Contains(search) || t.Code.Contains(search));
|
||||
//}
|
||||
|
||||
//if (!string.IsNullOrWhiteSpace(visitSearchDTO.VisitPlanInfo))
|
||||
//{
|
||||
// var visitInfo = visitSearchDTO.VisitPlanInfo.Trim();
|
||||
|
||||
// if (visitInfo.Contains('.')) // 包含小数点的是计划外访视
|
||||
// {
|
||||
// subjectVisitLambda = subjectVisitLambda.And(t => t.VisitNum.ToString().Contains("."));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (int.TryParse(visitInfo, out var visitNum))
|
||||
// {
|
||||
// subjectVisitLambda = subjectVisitLambda.And(t => t.VisitNum == visitNum);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//var query = from subjectVisit in _subjectVisitRepository.Where(subjectVisitLambda)
|
||||
// join subject in _subjectRepository.Where(subjectLambda) on subjectVisit.SubjectId equals subject.Id
|
||||
// join trialSite in _trialSiteRepository.Where(t => t.TrialId == visitSearchDTO.TrialId) on subjectVisit.SiteId equals trialSite.SiteId
|
||||
// join study in _studyRepository.Where(studyLambda).GroupBy(t => t.SubjectVisitId).Select(g => new { SubjectVisitId = g.Key, StudyCount = g.Count() }) on subjectVisit.Id equals study.SubjectVisitId into d
|
||||
// from study in d.DefaultIfEmpty()
|
||||
// join trial in _trialRepository.AsQueryable() on subjectVisit.TrialId equals trial.Id
|
||||
|
||||
// select new QCVisitViewModel()
|
||||
// {
|
||||
// Id = subjectVisit.Id,
|
||||
// //VisitPlanId = visitStage.Id,
|
||||
// SubjectId = subjectVisit.SubjectId,
|
||||
// TrialId = subjectVisit.TrialId,
|
||||
// SiteId = subjectVisit.SiteId,
|
||||
|
||||
// VisitDay = subjectVisit.VisitDay,
|
||||
// VisitNum = subjectVisit.VisitNum,
|
||||
// VisitName = subjectVisit.VisitName,
|
||||
// SVENDTC = subjectVisit.SVENDTC,
|
||||
// SVSTDTC = subjectVisit.SVSTDTC,
|
||||
// SVUPDES = subjectVisit.SVUPDES,
|
||||
// InPlan = subjectVisit.InPlan,
|
||||
// VisitExecuted = subjectVisit.VisitExecuted,
|
||||
|
||||
|
||||
// StudyCount = study.StudyCount,
|
||||
// SubjectStatus = subject.Status,
|
||||
|
||||
// SubjectCode = subject.Code,
|
||||
|
||||
// IsUrgent = subjectVisit.IsUrgent,
|
||||
|
||||
// TrialSiteCode = trialSite.TrialSiteCode,
|
||||
|
||||
// EarliestScanDate = subjectVisit.EarliestScanDate,
|
||||
// LatestScanDate = subjectVisit.LatestScanDate,
|
||||
|
||||
// QCProcessEnum = trial.QCProcessEnum,
|
||||
// CurrentActionUserId = subjectVisit.CurrentActionUserId,
|
||||
// CurrentActionUser = subjectVisit.CurrentActionUser,
|
||||
// CurrentActionUserExpireTime = subjectVisit.CurrentActionUserExpireTime,
|
||||
// PreliminaryAuditTime = subjectVisit.PreliminaryAuditTime,
|
||||
// PreliminaryAuitUser = subjectVisit.PreliminaryAuitUser,
|
||||
// ReviewAuitTime = subjectVisit.ReviewAuitTime,
|
||||
// ReviewAuitUser = subjectVisit.ReviewAuitUser,
|
||||
|
||||
// AuditState = subjectVisit.AuditState,
|
||||
// SubmitTime = subjectVisit.SubmitTime,
|
||||
// IsTake = subjectVisit.IsTake,
|
||||
|
||||
// };
|
||||
#endregion
|
||||
|
||||
#region WhereIf + ling 统计
|
||||
//var query = from subjectVisit in _subjectVisitRepository.Where(x => x.TrialId == visitSearchDTO.TrialId)
|
||||
// .WhereIf(visitSearchDTO.SiteId != null, t => t.SiteId == visitSearchDTO.SiteId)
|
||||
// .WhereIf(visitSearchDTO.SubjectId != null, t => t.Subject.Id == visitSearchDTO.SubjectId)
|
||||
// .WhereIf(!string.IsNullOrEmpty(subjectInfo), t => /*t.Subject.FirstName.Contains(subjectInfo) || t.Subject.LastName.Contains(subjectInfo) ||*/ t.Subject.Code.Contains(subjectInfo))
|
||||
// .WhereIf(!string.IsNullOrEmpty(visitInfo), visitInfo.Contains('.') ? t => t.VisitNum.ToString().Contains(".") : t => t.VisitNum.ToString() == visitInfo)
|
||||
// .WhereIf(visitSearchDTO.AuditState != null, t => t.AuditState == visitSearchDTO.AuditState)
|
||||
// .WhereIf(visitSearchDTO.HandleUser != null, t => t.PreliminaryAuitUser.Contains(visitSearchDTO.HandleUser) || t.ReviewAuitUser.Contains(visitSearchDTO.HandleUser))
|
||||
// .WhereIf(visitSearchDTO.IsUrgent != null, t => t.IsUrgent == visitSearchDTO.IsUrgent)
|
||||
// //.WhereIf(visitSearchDTO.SubmitState != null, t => t.SubmitState == visitSearchDTO.SubmitState)
|
||||
// //.WhereIf(visitSearchDTO.ChallengeState != null, t => t.ChallengeState == visitSearchDTO.ChallengeState)
|
||||
// join subject in _subjectRepository.AsQueryable() on subjectVisit.SubjectId equals subject.Id
|
||||
// join trialSite in _trialSiteRepository.Where(t => t.TrialId == visitSearchDTO.TrialId) on subjectVisit.SiteId equals trialSite.SiteId
|
||||
// join study in _studyRepository.AsQueryable().GroupBy(t => t.SubjectVisitId).Select(g => new { SubjectVisitId = g.Key, StudyCount = g.Count() }) on subjectVisit.Id equals study.SubjectVisitId into d
|
||||
// from study in d.DefaultIfEmpty()
|
||||
// join trial in _trialRepository.AsQueryable() on subjectVisit.TrialId equals trial.Id
|
||||
|
||||
// select new QCVisitViewModel()
|
||||
// {
|
||||
// Id = subjectVisit.Id,
|
||||
// //VisitPlanId = visitStage.Id,
|
||||
// SubjectId = subjectVisit.SubjectId,
|
||||
// TrialId = subjectVisit.TrialId,
|
||||
// SiteId = subjectVisit.SiteId,
|
||||
|
||||
// VisitDay = subjectVisit.VisitDay,
|
||||
// VisitNum = subjectVisit.VisitNum,
|
||||
// VisitName = subjectVisit.VisitName,
|
||||
// SVENDTC = subjectVisit.SVENDTC,
|
||||
// SVSTDTC = subjectVisit.SVSTDTC,
|
||||
// SVUPDES = subjectVisit.SVUPDES,
|
||||
// InPlan = subjectVisit.InPlan,
|
||||
// VisitExecuted = subjectVisit.VisitExecuted,
|
||||
// IsUrgent = subjectVisit.IsUrgent,
|
||||
// EarliestScanDate = subjectVisit.EarliestScanDate,
|
||||
// LatestScanDate = subjectVisit.LatestScanDate,
|
||||
|
||||
// CurrentActionUserId = subjectVisit.CurrentActionUserId,
|
||||
// CurrentActionUser = subjectVisit.CurrentActionUser,
|
||||
// CurrentActionUserExpireTime = subjectVisit.CurrentActionUserExpireTime,
|
||||
// PreliminaryAuditTime = subjectVisit.PreliminaryAuditTime,
|
||||
// PreliminaryAuitUser = subjectVisit.PreliminaryAuitUser,
|
||||
// ReviewAuitTime = subjectVisit.ReviewAuitTime,
|
||||
// ReviewAuitUser = subjectVisit.ReviewAuitUser,
|
||||
|
||||
// AuditState = subjectVisit.AuditState,
|
||||
// SubmitTime = subjectVisit.SubmitTime,
|
||||
// IsTake = subjectVisit.IsTake,
|
||||
|
||||
// QCProcessEnum = trial.QCProcessEnum,
|
||||
|
||||
// TrialSiteCode = trialSite.TrialSiteCode,
|
||||
|
||||
// SubjectStatus = subject.Status,
|
||||
// SubjectCode = subject.Code,
|
||||
|
||||
// StudyCount = study.StudyCount,
|
||||
|
||||
// };
|
||||
|
||||
#endregion
|
||||
|
||||
var svExpression = QCCommon.GetSubjectVisitFilter(visitSearchDTO.VisitPlanArray);
|
||||
var query = _subjectVisitRepository.Where(x => x.TrialId == visitSearchDTO.TrialId)
|
||||
.WhereIf(visitSearchDTO.VisitId != null, t => t.Id == visitSearchDTO.VisitId)
|
||||
.WhereIf(visitSearchDTO.CurrentActionUserId != null, t => t.CurrentActionUserId == visitSearchDTO.CurrentActionUserId)
|
||||
.WhereIf(visitSearchDTO.ChallengeState != null, t => t.ChallengeState == visitSearchDTO.ChallengeState)
|
||||
.WhereIf(visitSearchDTO.SiteId != null, t => t.SiteId == visitSearchDTO.SiteId)
|
||||
.WhereIf(visitSearchDTO.TrialSiteId != null, t => t.TrialSiteId == visitSearchDTO.TrialSiteId)
|
||||
.WhereIf(visitSearchDTO.SubjectId != null, t => t.Subject.Id == visitSearchDTO.SubjectId)
|
||||
.WhereIf(!string.IsNullOrEmpty(visitSearchDTO.SubjectInfo), t => /*t.Subject.FirstName.Contains(subjectInfo) || t.Subject.LastName.Contains(subjectInfo) ||*/ t.Subject.Code.Contains(visitSearchDTO.SubjectInfo))
|
||||
.WhereIf(visitSearchDTO.VisitPlanArray != null && visitSearchDTO.VisitPlanArray?.Length > 0, svExpression)
|
||||
@@ -481,60 +239,13 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
[HttpPost]
|
||||
public async Task<(PageOutput<QCCheckWithModalityView>, TrialSubjectAndSVConfig)> GetConsistencyVerificationList(CheckQuery checkQuery)
|
||||
{
|
||||
#region linq 废弃 byzhouhang 2021 11 30
|
||||
//Expression<Func<Subject, bool>> subjectLambda = x => true;
|
||||
//Expression<Func<SubjectVisit, bool>> subjectVisitLambda = x => x.TrialId == checkQuery.TrialId && x.AuditState == AuditStateEnum.QCPassed;
|
||||
//Expression<Func<DicomStudy, bool>> studyLambda = x => x.TrialId == checkQuery.TrialId;
|
||||
//if (checkQuery.SiteId != null && checkQuery.SiteId != Guid.Empty)
|
||||
//{
|
||||
// subjectVisitLambda = subjectVisitLambda.And(t => t.SiteId == checkQuery.SiteId.Value);
|
||||
//}
|
||||
//if (checkQuery.SubjectId != null && checkQuery.SubjectId != Guid.Empty)
|
||||
//{
|
||||
// subjectLambda = subjectLambda.And(t => t.Id == checkQuery.SubjectId.Value);
|
||||
//}
|
||||
|
||||
//if (_userInfo.UserTypeEnumInt == (int)UserType.ClinicalResearchCoordinator)
|
||||
//{
|
||||
// var siteQuery = _userTrialSiteRepository.Where(t => t.UserId == _userInfo.Id && t.TrialId == checkQuery.TrialId).Select(t => t.SiteId);
|
||||
|
||||
// subjectVisitLambda = subjectVisitLambda.And(t => siteQuery.Contains(t.SiteId));
|
||||
//}
|
||||
|
||||
//var query =
|
||||
// from subjectVisit in _subjectVisitRepository.Where(subjectVisitLambda)
|
||||
// join trialSite in _trialSiteRepository.Where(t => t.TrialId == checkQuery.TrialId) on subjectVisit.SiteId equals trialSite.SiteId
|
||||
// join subject in _subjectRepository.Where() on subjectVisit.SubjectId equals subject.Id
|
||||
|
||||
// select new QCCheckViewModel()
|
||||
// {
|
||||
// Id = subjectVisit.Id,
|
||||
// AuditState = subjectVisit.AuditState,
|
||||
|
||||
// CheckTime = subjectVisit.CheckTime,
|
||||
// CheckState = subjectVisit.CheckState,
|
||||
|
||||
// CheckChallengeState = subjectVisit.CheckChallengeState,
|
||||
|
||||
// CheckResult = subjectVisit.CheckResult,
|
||||
|
||||
// VisitName = subjectVisit.VisitName,
|
||||
// VisitNum = subjectVisit.VisitNum,
|
||||
|
||||
// SubjectCode = subject.Code,
|
||||
|
||||
// //Modality=study.Modalities,
|
||||
// //StudyTime = subjectVisit.sv,
|
||||
// TrialSiteCode = trialSite.TrialSiteCode,
|
||||
// };
|
||||
#endregion
|
||||
|
||||
var svExpression = QCCommon.GetSubjectVisitFilter(checkQuery.VisitPlanArray);
|
||||
|
||||
var query = _subjectVisitRepository.Where(x => x.TrialId == checkQuery.TrialId)
|
||||
.Where(x => x.AuditState == AuditStateEnum.QCPassed) //一致性核查中的,或者还没一致性核查的
|
||||
.WhereIf(checkQuery.CheckState != null, t => t.CheckState == checkQuery.CheckState)
|
||||
.WhereIf(checkQuery.SiteId != null, t => t.SiteId == checkQuery.SiteId)
|
||||
.WhereIf(checkQuery.TrialSiteId != null, t => t.TrialSiteId == checkQuery.TrialSiteId)
|
||||
.WhereIf(!string.IsNullOrEmpty(checkQuery.SubjectInfo), t => t.Subject.Code.Contains(checkQuery.SubjectInfo))
|
||||
.WhereIf(checkQuery.VisitPlanArray != null && checkQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||
//.WhereIf(!string.IsNullOrEmpty(checkQuery.VisitPlanInfo), checkQuery.VisitPlanInfo.Contains('.') ? t => t.InPlan == false : t => t.VisitNum == decimal.Parse(checkQuery.VisitPlanInfo))
|
||||
@@ -580,7 +291,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
var query = _subjectVisitRepository.Where(x => x.TrialId == forwardQuery.TrialId)
|
||||
.Where(t => t.CheckState == CheckStateEnum.CVPassed)
|
||||
.WhereIf(forwardQuery.ForwardState != null, t => t.ForwardState == forwardQuery.ForwardState)
|
||||
.WhereIf(forwardQuery.SiteId != null, t => t.SiteId == forwardQuery.SiteId)
|
||||
.WhereIf(forwardQuery.TrialSiteId != null, t => t.TrialSiteId == forwardQuery.TrialSiteId)
|
||||
.WhereIf(!string.IsNullOrEmpty(forwardQuery.SubjectInfo), t => t.Subject.Code.Contains(forwardQuery.SubjectInfo))
|
||||
.WhereIf(forwardQuery.VisitPlanArray != null && forwardQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||
//.WhereIf(!string.IsNullOrEmpty(forwardQuery.VisitPlanInfo), forwardQuery.VisitPlanInfo.Contains('.') ? t => t.InPlan == false : t => t.VisitNum == decimal.Parse(forwardQuery.VisitPlanInfo))
|
||||
|
||||
@@ -31,7 +31,8 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
private readonly IReadingClinicalDataService _readingClinicalDataService;
|
||||
private readonly IRepository<Subject> _subjectRepository;
|
||||
private readonly IRepository<ReadingClinicalData> _readingClinicalDataRepository;
|
||||
private readonly IRepository<QCChallengeDialog> _qCChallengeDialogrepository;
|
||||
private readonly IRepository<ClinicalDataTrialSet> _clinicalDataTrialSetRepository;
|
||||
private readonly IRepository<QCChallengeDialog> _qCChallengeDialogrepository;
|
||||
private readonly IRepository<CheckChallengeDialog> _checkChallengeDialogrepository;
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
private readonly IRepository<VisitTask> _visitTaskRepository;
|
||||
@@ -47,7 +48,8 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
IReadingClinicalDataService readingClinicalDataService,
|
||||
IRepository<Subject> subjectRepository,
|
||||
IRepository<ReadingClinicalData> readingClinicalDataRepository,
|
||||
IRepository<QCChallengeDialog> qCChallengeDialogrepository,
|
||||
IRepository<ClinicalDataTrialSet> clinicalDataTrialSetRepository,
|
||||
IRepository<QCChallengeDialog> qCChallengeDialogrepository,
|
||||
IRepository<CheckChallengeDialog> checkChallengeDialogrepository,
|
||||
IVisitTaskHelpeService visitTaskHelpeService,
|
||||
IDistributedLockProvider distributedLockProvider
|
||||
@@ -60,7 +62,8 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
this._readingClinicalDataService = readingClinicalDataService;
|
||||
this._subjectRepository = subjectRepository;
|
||||
this._readingClinicalDataRepository = readingClinicalDataRepository;
|
||||
this._qCChallengeDialogrepository = qCChallengeDialogrepository;
|
||||
this._clinicalDataTrialSetRepository = clinicalDataTrialSetRepository;
|
||||
this._qCChallengeDialogrepository = qCChallengeDialogrepository;
|
||||
this._checkChallengeDialogrepository = checkChallengeDialogrepository;
|
||||
_trialRepository = trialRepository;
|
||||
this._visitTaskRepository = visitTaskRepository;
|
||||
@@ -1183,6 +1186,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
{
|
||||
var dbSubjectVisitList = await _subjectVisitRepository.Where(t => cRCRequestToQCCommand.SubjectVisitIds.Contains(t.Id), true).ProjectTo<QCCRCVisitViewModel>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
var trialinfo = await _trialRepository.Where(x => x.Id == dbSubjectVisitList[0].TrialId).FirstNotNullAsync();
|
||||
//普通提交
|
||||
if (dbSubjectVisitList.Count == 1)
|
||||
{
|
||||
@@ -1210,8 +1214,9 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
}
|
||||
|
||||
//同时要根据项目有没有配置Subject 级别临床数据
|
||||
if (dbSubjectVisitList.Any(t => t.IsBaseLine && !t.IsHaveClinicalData))
|
||||
if (dbSubjectVisitList.Any(t => t.IsBaseLine && !t.IsHaveClinicalData)&&trialinfo.ClinicalInformationTransmissionEnum!=0)
|
||||
{
|
||||
|
||||
//---基线没有临床数据,确认提交?
|
||||
return ResponseOutput.NotOk(_localizer["QCOperation_NoBaselineData"], 0, ApiResponseCodeEnum.NeedTips);
|
||||
}
|
||||
@@ -1230,30 +1235,32 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
//[Authorize(Policy = IRaCISPolicy.CRC)]
|
||||
public async Task<IResponseOutput> CRCRequestToQC(CRCRequestToQCCommand cRCRequestToQCCommand)
|
||||
{
|
||||
|
||||
// 验证临床数据 是否有Pet类型
|
||||
#region 验证临床数据 是否有Pet类型
|
||||
foreach (var item in cRCRequestToQCCommand.SubjectVisitIds)
|
||||
{
|
||||
if (await _dicomStudyRepository.AnyAsync(x => x.SubjectVisitId == item && x.Modalities.Contains("PT")))
|
||||
List<string> modalitieTypess = new List<string>() { "PT、CT", "CT、PT", "PET-CT" };
|
||||
// 验证临床数据 是否有Pet类型
|
||||
#region 验证临床数据 是否有Pet类型
|
||||
if (await _clinicalDataTrialSetRepository.AnyAsync(x => x.TrialId == cRCRequestToQCCommand.TrialId && x.IsConfirm && x.ClinicalDataLevel == ClinicalLevel.Study))
|
||||
{
|
||||
foreach (var item in cRCRequestToQCCommand.SubjectVisitIds)
|
||||
{
|
||||
var visit = await _subjectVisitRepository.Where(x => x.Id == item).FirstNotNullAsync();
|
||||
var clinicalData = await this._readingClinicalDataService.GetCRCClinicalData(new Service.Reading.Dto.GetCRCClinicalDataInDto()
|
||||
{
|
||||
IsBaseline = visit.IsBaseLine,
|
||||
SubjectId = visit.SubjectId,
|
||||
SubjectVisitId = item,
|
||||
TrialId = cRCRequestToQCCommand.TrialId,
|
||||
});
|
||||
|
||||
if (clinicalData.Any(x => x.ClinicalDataLevel == ClinicalLevel.Study && x.ClinicalUploadType == ClinicalUploadType.PDF && x.PDFFileList.Count() == 0))
|
||||
if (await _dicomStudyRepository.AnyAsync(x => x.SubjectVisitId == item && modalitieTypess.Contains(x.Modalities)))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["QCOperation_NeedStudyClinical"]);
|
||||
var visit = await _subjectVisitRepository.Where(x => x.Id == item).FirstNotNullAsync();
|
||||
var clinicalData = await this._readingClinicalDataService.GetStudyClinicalData(new Service.Reading.Dto.GetStudyClinicalDataInDto()
|
||||
{
|
||||
SubjectVisitId = item,
|
||||
});
|
||||
|
||||
if (!clinicalData.Any(x => x.ClinicalDataLevel == ClinicalLevel.Study && x.ClinicalUploadType == ClinicalUploadType.PDF && x.PDFFileList.Count() > 0))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["QCOperation_NeedStudyClinical"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1266,11 +1273,11 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
//找到符合配置的标准 确认的并且签名的、双重,有序,阅片期仲裁
|
||||
var trialReadingCriterionIdList = _repository.Where<ReadingQuestionCriterionTrial>(t => t.TrialId == cRCRequestToQCCommand.TrialId && t.IsConfirm && t.ReadingInfoSignTime != null
|
||||
//&& t.ReadingType == ReadingMethod.Double && t.ArbitrationRule == ArbitrationRule.Reading
|
||||
&& t.IsReadingTaskViewInOrder && t.IsReadingPeriod).Select(t => t.Id).ToList();
|
||||
&& t.IsReadingTaskViewInOrder == ReadingOrder.InOrder && t.IsReadingPeriod).Select(t => t.Id).ToList();
|
||||
|
||||
var trialInOrderCriterionIdList = _repository.Where<ReadingQuestionCriterionTrial>(t => t.TrialId == cRCRequestToQCCommand.TrialId && t.IsConfirm && t.ReadingInfoSignTime != null
|
||||
//&& t.ReadingType == ReadingMethod.Double && t.ArbitrationRule == ArbitrationRule.Reading
|
||||
&& t.IsReadingTaskViewInOrder).Select(t => t.Id).ToList();
|
||||
&& t.IsReadingTaskViewInOrder == ReadingOrder.InOrder).Select(t => t.Id).ToList();
|
||||
|
||||
|
||||
var dbSubjectVisitList = await _subjectVisitRepository.Where(t => cRCRequestToQCCommand.SubjectVisitIds.Contains(t.Id), true).Include(t => t.Subject).ToListAsync();
|
||||
@@ -1404,8 +1411,6 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => trialInOrderCriterionIdList.Contains(x.TrialReadingCriterionId)&& x.SubjectId == dbSubjectVisit.SubjectId&&
|
||||
dbSubjectVisit.VisitNum<= x.VisitTaskNum && x.VisitTaskNum < Math.Ceiling(dbSubjectVisit.VisitNum+0.01m) // 当前的访视 全局 裁判 及之前 全都加急
|
||||
&& x.ReadingTaskState != ReadingTaskState.HaveSigned && x.TaskState == TaskState.Effect, x => new VisitTask()
|
||||
@@ -1459,14 +1464,14 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
dbSubjectVisit.IsUrgent = true;
|
||||
|
||||
|
||||
//PD确认的紧急会把前面所有未QC完成的访视均标记为紧急
|
||||
////PD确认的紧急会把前面所有未QC完成的访视均标记为紧急
|
||||
|
||||
var previosSVlist = await _subjectVisitRepository.Where(t => t.SubjectId == dbSubjectVisit.SubjectId && t.VisitNum < dbSubjectVisit.VisitNum && t.IsUrgent == false && t.SubmitState == SubmitStateEnum.Submitted, true).ToListAsync();
|
||||
//var previosSVlist = await _subjectVisitRepository.Where(t => t.SubjectId == dbSubjectVisit.SubjectId && t.VisitNum < dbSubjectVisit.VisitNum && t.IsUrgent == false && t.SubmitState == SubmitStateEnum.Submitted, true).ToListAsync();
|
||||
|
||||
previosSVlist.ForEach(t =>
|
||||
{
|
||||
t.IsUrgent = true;
|
||||
});
|
||||
//previosSVlist.ForEach(t =>
|
||||
//{
|
||||
// t.IsUrgent = true;
|
||||
//});
|
||||
}
|
||||
|
||||
|
||||
@@ -1646,12 +1651,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
{
|
||||
|
||||
var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path);
|
||||
|
||||
//var dicomStudy = new DicomStudy() { Id = t.StudyId, SubjectId = t.SubjectId, TrialId = trialId, SiteId = t.SiteId, SubjectVisitId = subjectVisitId };
|
||||
//var (physicalPath, relativePath) =
|
||||
|
||||
// FileStoreHelper.GetDicomInstanceFilePath(_hostEnvironment, dicomStudy.TrialId, dicomStudy.SiteId, dicomStudy.SubjectId, dicomStudy.SubjectVisitId, dicomStudy.Id, t.InstanceId);
|
||||
|
||||
|
||||
if (System.IO.File.Exists(physicalPath))
|
||||
{
|
||||
File.Delete(physicalPath);
|
||||
@@ -1958,8 +1958,31 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
throw new BusinessValidationFailedException(_localizer["QCOperation_InvalidCompleteResend"]);
|
||||
}
|
||||
|
||||
List<string> modalitieTypess = new List<string>() { "PT、CT", "CT、PT", "PET-CT" };
|
||||
// 验证临床数据 是否有Pet类型
|
||||
#region 验证临床数据 是否有Pet类型
|
||||
if (await _clinicalDataTrialSetRepository.AnyAsync(x => x.TrialId == cRCReuploadFinishedCommand.TrialId && x.IsConfirm && x.ClinicalDataLevel == ClinicalLevel.Study))
|
||||
{
|
||||
var item = qcChallenge.SubjectVisitId;
|
||||
if (await _dicomStudyRepository.AnyAsync(x => x.SubjectVisitId == item && modalitieTypess.Contains(x.Modalities)))
|
||||
{
|
||||
var visit = await _subjectVisitRepository.Where(x => x.Id == item).FirstNotNullAsync();
|
||||
var clinicalData = await this._readingClinicalDataService.GetStudyClinicalData(new Service.Reading.Dto.GetStudyClinicalDataInDto()
|
||||
{
|
||||
SubjectVisitId = item,
|
||||
});
|
||||
|
||||
var subjectVisitId = qcChallenge.SubjectVisitId;
|
||||
if (!clinicalData.Any(x => x.ClinicalDataLevel == ClinicalLevel.Study && x.ClinicalUploadType == ClinicalUploadType.PDF && x.PDFFileList.Count() > 0))
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["QCOperation_NeedStudyClinical"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
var subjectVisitId = qcChallenge.SubjectVisitId;
|
||||
|
||||
if (await _subjectVisitRepository.Where(t => t.Id == subjectVisitId).SelectMany(t => t.StudyList).CountAsync() == 0 &&
|
||||
await _subjectVisitRepository.Where(t => t.Id == subjectVisitId).SelectMany(t => t.NoneDicomStudyList).SelectMany(u => u.NoneDicomFileList).CountAsync() == 0)
|
||||
@@ -2138,7 +2161,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
|
||||
var targetPath = "/IMPORT-IMAGES/" + info.TrialCode + "_" + info.SubjectCode + "_" + info.VisitName;
|
||||
|
||||
var path = FileStoreHelper.GetSubjectVisitDicomFolderPhysicalPath(_hostEnvironment, info.TrialId, info.SiteId, info.SubjectId, info.SubjectVisitId);
|
||||
var path = FileStoreHelper.GetSubjectVisitDicomFolderPhysicalPath(_hostEnvironment, info.TrialId, info.TrialSiteId, info.SubjectId, info.SubjectVisitId);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
|
||||
CreateMap<Subject, SubjectExportDTO>()
|
||||
.ForMember(d => d.SiteName, u => u.MapFrom(s => s.TrialSite.Site.SiteName))
|
||||
.ForMember(d => d.SiteName, u => u.MapFrom(s => s.TrialSite.TrialSiteName))
|
||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode))
|
||||
.ForMember(d => d.LatestBlindName, u => u.MapFrom(s => s.LatestSubjectVisit.BlindName))
|
||||
.ForMember(d => d.LatestVisitName, u => u.MapFrom(s => s.LatestSubjectVisit.VisitName))
|
||||
@@ -104,7 +104,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code))
|
||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode))
|
||||
|
||||
.ForMember(d => d.CheckDialogStr, u => u.MapFrom(t => string.Join(" | ", t.CheckChallengeDialogList.OrderBy(t => t.CreateTime).Select(c => c.CreateUser.UserName + " " + c.CreateTime.ToString("yyyy-mm-dd hh:mm:ss") + " :" + c.TalkContent))))
|
||||
.ForMember(d => d.CheckDialogStr, u => u.MapFrom(t => string.Join(" | ", t.CheckChallengeDialogList.OrderBy(t => t.CreateTime).Select(c => c.CreateUser.UserName + " " + c.CreateTime.ToString("yyyy-MM-dd HH:mm:ss") + " :" + c.TalkContent))))
|
||||
.ForMember(d => d.ModalityList, c => c.MapFrom(s =>
|
||||
(s.NoneDicomStudyList.Select(t => t.Modality)
|
||||
.Union(s.StudyList.Select(k => k.ModalityForEdit))).Distinct()))
|
||||
@@ -439,7 +439,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(d => d.IsHaveFirstGiveMedicineDate, u => u.MapFrom(s => s.Trial.IsHaveFirstGiveMedicineDate))
|
||||
//.ForMember(d => d.ChangeDefalutDays, u => u.MapFrom(s => s.Trial.ChangeDefalutDays))
|
||||
.ForMember(d => d.SubjectFirstGiveMedicineTime, u => u.MapFrom(s => s.Subject.FirstGiveMedicineTime))
|
||||
.ForMember(d => d.SiteName, u => u.MapFrom(s => s.Site.SiteName))
|
||||
.ForMember(d => d.SiteName, u => u.MapFrom(s => s.TrialSite.TrialSiteName))
|
||||
.ForMember(d => d.TotalChallengeCount, u => u.MapFrom(s => s.QCChallengeList.Count()))
|
||||
.ForMember(d => d.NotClosedChallengeCount, u => u.MapFrom(s => s.QCChallengeList.Count(c => c.IsClosed == false)));
|
||||
|
||||
@@ -513,7 +513,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(d => d.SubmitState, u => u.MapFrom(s => s.SubjectVisit.SubmitState))
|
||||
|
||||
|
||||
.ForMember(d => d.SiteId, u => u.MapFrom(s => s.SubjectVisit.SiteId))
|
||||
.ForMember(d => d.TrialSiteId, u => u.MapFrom(s => s.SubjectVisit.TrialSiteId))
|
||||
.ForMember(d => d.AuditState, u => u.MapFrom(s => s.SubjectVisit.AuditState))
|
||||
.ForMember(d => d.IsUrgent, u => u.MapFrom(s => s.SubjectVisit.IsUrgent))
|
||||
.ForMember(d => d.IsBaseLine, u => u.MapFrom(s => s.SubjectVisit.IsBaseLine))
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public string SubjectCode { get; set; }
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
|
||||
+2
-2
@@ -457,7 +457,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
TrialId = subjectVisit.TrialId,
|
||||
SubjectId = subjectVisit.SubjectId,
|
||||
SubjectCode = subjectVisit.Subject.Code,
|
||||
SiteId = subjectVisit.SiteId,
|
||||
TrialSiteId = subjectVisit.TrialSiteId,
|
||||
TrialReadingCriterionId = inQuery.TrialReadingCriterionId,
|
||||
LatestScanDate = subjectVisit.LatestScanDate,
|
||||
EarliestScanDate = subjectVisit.LatestScanDate,
|
||||
@@ -691,7 +691,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
&& t.TrialReadingCriterionId == command.TrialReadingCriterionId;
|
||||
|
||||
//有序
|
||||
if (criterionConfig.IsReadingTaskViewInOrder)
|
||||
if (criterionConfig.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
filterExpression = filterExpression.And(t => t.VisitTaskNum >= subjectVisit.VisitNum);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using IRaCIS.Core.Application.Service.Reading.Interface;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace IRaCIS.Application.Services
|
||||
public IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
|
||||
private readonly IRepository<ClinicalDataTrialSet> _clinicalDataTrialSetRepository;
|
||||
private readonly IRepository<TrialClinicalDataSetCriterion> _trialClinicalDataSetCriterionRepository;
|
||||
private readonly IRepository<ReadingQuestionCriterionTrial> _iReadingQuestionCriterionTrialRepository;
|
||||
private readonly IRepository<ClinicalDataSystemSet> _clinicalDataSystemSetRepository;
|
||||
private readonly IRepository<PreviousPDF> _previousPDFRepository;
|
||||
@@ -34,6 +35,7 @@ namespace IRaCIS.Application.Services
|
||||
public ClinicalDataSetService(IRepository<SubjectVisit> subjectVisitRepository,
|
||||
IClinicalQuestionService iClinicalQuestionService,
|
||||
IRepository<ClinicalDataTrialSet> ClinicalDataTrialSetRepository,
|
||||
IRepository<TrialClinicalDataSetCriterion> trialClinicalDataSetCriterionRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> iReadingQuestionCriterionTrialRepository,
|
||||
IRepository<ClinicalDataSystemSet> ClinicalDataSystemSetRepository,
|
||||
IRepository<PreviousPDF> previousPDFRepository,
|
||||
@@ -51,6 +53,7 @@ namespace IRaCIS.Application.Services
|
||||
_trialClinicalQuestionRepository = trialClinicalQuestionRepository;
|
||||
_systemClinicalQuestionRepository = systemClinicalQuestionRepository;
|
||||
_clinicalDataTrialSetRepository = ClinicalDataTrialSetRepository;
|
||||
this._trialClinicalDataSetCriterionRepository = trialClinicalDataSetCriterionRepository;
|
||||
this._iReadingQuestionCriterionTrialRepository = iReadingQuestionCriterionTrialRepository;
|
||||
_clinicalDataSystemSetRepository = ClinicalDataSystemSetRepository;
|
||||
this._previousPDFRepository = previousPDFRepository;
|
||||
@@ -243,7 +246,10 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
//indto.CriterionEnumListStr = $"|{String.Join('|', indto.CriterionEnumList)}|";
|
||||
|
||||
var entity = await _clinicalDataTrialSetRepository.InsertOrUpdateAsync(indto, true);
|
||||
//var entity = _mapper.Map<TEntity>(from);
|
||||
|
||||
indto.CreateTime = DateTime.Now;
|
||||
var entity = await _clinicalDataTrialSetRepository.InsertOrUpdateAsync(indto);
|
||||
|
||||
entity.TrialClinicalDataSetCriteriaList = indto.TrialCriterionIdList.Select(t => new TrialClinicalDataSetCriterion()
|
||||
{
|
||||
@@ -253,7 +259,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
if (indto.Id != null)
|
||||
{
|
||||
await _repository.BatchDeleteAsync<TrialClinicalDataSetCriterion>(t => t.TrialClinicalDataSetId == entity.Id);
|
||||
await _trialClinicalDataSetCriterionRepository.DeleteFromQueryAsync(t => t.TrialClinicalDataSetId == entity.Id);
|
||||
|
||||
await _repository.AddRangeAsync<TrialClinicalDataSetCriterion>(entity.TrialClinicalDataSetCriteriaList);
|
||||
}
|
||||
|
||||
@@ -179,6 +179,59 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
#region 临床数据CRC 相关
|
||||
|
||||
/// <summary>
|
||||
/// 获取检查类型临床数据
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<GetCRCClinicalDataOutDto>> GetStudyClinicalData(GetStudyClinicalDataInDto inDto)
|
||||
{
|
||||
|
||||
var cRCClinicalDataList = await _readingClinicalDataRepository.Where(x => x.ReadingId == inDto.SubjectVisitId)
|
||||
.Where(x => x.ClinicalDataTrialSet.ClinicalDataLevel == ClinicalLevel.Study).Select(x => new GetCRCClinicalDataOutDto()
|
||||
{
|
||||
Id = x.Id,
|
||||
ClinicalDataSetName = x.ClinicalDataTrialSet.ClinicalDataSetName.LanguageName(x.ClinicalDataTrialSet.ClinicalDataSetEnName, _userInfo.IsEn_Us),
|
||||
ClinicalUploadType = x.ClinicalDataTrialSet.ClinicalUploadType,
|
||||
ClinicalDataLevel = x.ClinicalDataTrialSet.ClinicalDataLevel,
|
||||
ClinicalDataSetEnName = x.ClinicalDataTrialSet.ClinicalDataSetEnName,
|
||||
ClinicalDataTrialSetId = x.ClinicalDataTrialSet.Id,
|
||||
FileName = x.ClinicalDataTrialSet.FileName,
|
||||
UploadRole = x.ClinicalDataTrialSet.UploadRole,
|
||||
Path = x.ClinicalDataTrialSet.Path,
|
||||
IsBlind = x.IsBlind,
|
||||
IsComplete = x.IsComplete,
|
||||
ClinicalFromList = x.Subject.ClinicalFormList.Where(y => y.ReadingId == x.ReadingId && y.ClinicalDataTrialSetId == x.ClinicalDataTrialSetId).Select(y => new ClinicalFromData()
|
||||
{
|
||||
CheckDate = y.CheckDate,
|
||||
ClinicalFormId = y.Id
|
||||
}).ToList(),
|
||||
PDFFileList = x.ReadingClinicalDataPDFList.Select(y => new GetFileDto()
|
||||
{
|
||||
Id = y.Id,
|
||||
FileName = y.FileName,
|
||||
Path = y.Path,
|
||||
CreateTime = y.CreateTime,
|
||||
}).ToList(),
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
var previousHistoryList = await _previousHistoryRepository.Where(x => x.SubjectVisitId == inDto.SubjectVisitId).ProjectTo<PreviousHistoryView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var previousOtherList = await _previousOtherRepository.Where(x => x.SubjectVisitId == inDto.SubjectVisitId).ProjectTo<PreviousOtherView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var previousSurgeryList = await _previousSurgeryRepository.Where(x => x.SubjectVisitId == inDto.SubjectVisitId).ProjectTo<PreviousSurgeryView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
foreach (var item in cRCClinicalDataList)
|
||||
{
|
||||
item.ClinicalTableData = new ClinicalDataTable()
|
||||
{
|
||||
PreviousHistoryList = previousHistoryList.Where(x => x.ClinicalDataTrialSetId == item.ClinicalDataTrialSetId).ToList(),
|
||||
PreviousOtherList = previousOtherList.Where(x => x.ClinicalDataTrialSetId == item.ClinicalDataTrialSetId).ToList(),
|
||||
PreviousSurgeryList = previousSurgeryList.Where(x => x.ClinicalDataTrialSetId == item.ClinicalDataTrialSetId).ToList(),
|
||||
};
|
||||
|
||||
}
|
||||
return cRCClinicalDataList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取CRC上传的文件
|
||||
@@ -318,7 +371,26 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
//await this.iServiceProvider.GetService<IReadingImageTaskService>().AddOncologyTask(readingId);
|
||||
|
||||
await DealVisiTaskClinicalDataSignedAsync(data.TrialId, data.SubjectId, data.ReadingId, data.IsVisit, inDto.TrialReadingCriterionId);
|
||||
//如果先生成了任务,再签名subject级别 PM 临床数据,那么会导致其他标准的任务签名状态无法得到维护
|
||||
|
||||
if (await _repository.AnyAsync<ClinicalDataTrialSet>(t=>t.Id == data.ClinicalDataTrialSetId && t.UploadRole == UploadRole.PM && t.ClinicalDataLevel == ClinicalLevel.Subject))
|
||||
{
|
||||
var needDealTrialReadingCriterionIdList = _repository.Where<ClinicalDataTrialSet>(t => t.Id == data.ClinicalDataTrialSetId)
|
||||
.SelectMany(t => t.TrialClinicalDataSetCriteriaList)
|
||||
.Select(u => u.TrialReadingCriterionId).Distinct().ToList();
|
||||
|
||||
foreach (var trialReadingCriterionId in needDealTrialReadingCriterionIdList)
|
||||
{
|
||||
await DealVisiTaskClinicalDataSignedAsync(data.TrialId, data.SubjectId, data.ReadingId, data.IsVisit, trialReadingCriterionId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await DealVisiTaskClinicalDataSignedAsync(data.TrialId, data.SubjectId, data.ReadingId, data.IsVisit, inDto.TrialReadingCriterionId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Result(result);
|
||||
}
|
||||
@@ -428,12 +500,22 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
|
||||
//有序阅片才维护 IsFrontTaskNeedSignButNotSign 这个状态
|
||||
if (_readingQuestionCriterionTrialRepository.Any(t=>t.Id==trialReadingCritrialId && t.IsReadingTaskViewInOrder == true))
|
||||
if (_readingQuestionCriterionTrialRepository.Any(t=>t.Id==trialReadingCritrialId && t.IsReadingTaskViewInOrder == ReadingOrder.InOrder))
|
||||
{
|
||||
|
||||
|
||||
Expression<Func<VisitTask, bool>> visitTaskLambda = x => x.TrialId == trialId && x.SubjectId == subjectId && x.TrialReadingCriterionId == trialReadingCritrialId;
|
||||
|
||||
if (isVisit)
|
||||
{
|
||||
//访视类型的任务 不影响肿瘤学任务的临床数据状态
|
||||
visitTaskLambda = visitTaskLambda.And(x => x.ArmEnum != Arm.TumorArm);
|
||||
}
|
||||
else
|
||||
{
|
||||
visitTaskLambda = visitTaskLambda.And(x => x.ArmEnum == Arm.TumorArm);
|
||||
}
|
||||
|
||||
|
||||
//维护 IsFrontTaskNeedSignButNotSign 在添加任务哪里用触发器也维护了
|
||||
var visitTaskIdQueryable = _visitTaskRepository.Where(visitTaskLambda) //该Subject 该标准的任务
|
||||
|
||||
@@ -44,10 +44,12 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public UploadRole UploadRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool IsEnable { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool IsEnable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目ID
|
||||
|
||||
@@ -265,7 +265,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public string? SiteCode { get; set; }
|
||||
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
|
||||
public Guid? SubjectId { get; set; }
|
||||
|
||||
@@ -283,7 +283,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public string SiteCode { get; set; }
|
||||
|
||||
public Guid SiteId { get; set; }
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
@@ -359,7 +359,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public string OutPlanPreviousVisitName { get; set; }
|
||||
|
||||
public Guid? SiteId { get; set; }
|
||||
public Guid? TrialSiteId { get; set; }
|
||||
|
||||
public bool IsVisit { get; set; } = true;
|
||||
|
||||
|
||||
@@ -141,7 +141,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class GetStudyClinicalDataInDto
|
||||
{
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
}
|
||||
|
||||
public class GetCRCClinicalDataInDto
|
||||
{
|
||||
|
||||
@@ -1573,7 +1573,17 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
{
|
||||
public Guid? QuestionId { get; set; }
|
||||
|
||||
public bool IsHaveChange { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 裁判百分比或绝对值的相差值
|
||||
/// </summary>
|
||||
public decimal? JudgeDifferenceValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 裁判百分比或绝对值的相差值匹配规则
|
||||
/// </summary>
|
||||
public JudgeDifferenceType JudgeDifferenceType { get; set; }
|
||||
|
||||
public bool IsHaveChange { get; set; } = false;
|
||||
|
||||
public string VisitAnswer { get; set; } = string.Empty;
|
||||
|
||||
@@ -1750,7 +1760,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// <summary>
|
||||
/// 任务展示访视 读片任务显示是否顺序
|
||||
/// </summary>
|
||||
public bool IsReadingTaskViewInOrder { get; set; } = true;
|
||||
public ReadingOrder IsReadingTaskViewInOrder { get; set; }
|
||||
|
||||
public Guid TrialReadingCriterionId { get; set; }
|
||||
|
||||
@@ -1810,8 +1820,18 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
|
||||
public List<string> AnswerGroup { get; set; }
|
||||
|
||||
|
||||
public List<AnswerCombinationDto> AnswerCombination { get; set; }
|
||||
/// <summary>
|
||||
/// 裁判百分比或绝对值的相差值
|
||||
/// </summary>
|
||||
public decimal? JudgeDifferenceValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 裁判百分比或绝对值的相差值匹配规则
|
||||
/// </summary>
|
||||
public JudgeDifferenceType JudgeDifferenceType { get; set; }
|
||||
|
||||
|
||||
public List<AnswerCombinationDto> AnswerCombination { get; set; }
|
||||
|
||||
|
||||
|
||||
@@ -1821,8 +1841,23 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
public class GetTrialCriterionJudgeQuestionListOutDto
|
||||
{
|
||||
public Guid ReadingQuestionTrialId { get; set; }
|
||||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 裁判百分比或绝对值的相差值
|
||||
/// </summary>
|
||||
public decimal? JudgeDifferenceValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 裁判百分比或绝对值的相差值匹配规则
|
||||
/// </summary>
|
||||
public JudgeDifferenceType JudgeDifferenceType { get; set; }
|
||||
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
|
||||
public string PageName { get; set; }
|
||||
@@ -1899,9 +1934,13 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
public class GetReadingPastResultListOutDto
|
||||
{
|
||||
public Guid VisitTaskId { get; set; }
|
||||
public string TaskName { get; set; }
|
||||
|
||||
public string TaskBlindName { get; set; }
|
||||
public Guid? ReadModuleVisitId { get; set; }
|
||||
public string TaskName { get; set; }
|
||||
|
||||
public string VisitBlindName { get; set; }
|
||||
|
||||
public string TaskBlindName { get; set; }
|
||||
|
||||
public string VisitName { get; set; }
|
||||
|
||||
@@ -2253,7 +2292,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
{
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public string AnswerGroup { get; set; }
|
||||
/// <summary>
|
||||
/// 裁判百分比或绝对值的相差值
|
||||
/// </summary>
|
||||
public decimal? JudgeDifferenceValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 裁判百分比或绝对值的相差值匹配规则
|
||||
/// </summary>
|
||||
public JudgeDifferenceType JudgeDifferenceType { get; set; }
|
||||
public string AnswerGroup { get; set; }
|
||||
|
||||
|
||||
public string AnswerCombination { get; set; }
|
||||
@@ -2297,7 +2345,17 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
public string AnswerCombination { get; set; }
|
||||
|
||||
public JudgeTypeEnum JudgeType { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 裁判百分比或绝对值的相差值
|
||||
/// </summary>
|
||||
public decimal? JudgeDifferenceValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 裁判百分比或绝对值的相差值匹配规则
|
||||
/// </summary>
|
||||
public JudgeDifferenceType JudgeDifferenceType { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class GetSystemReadingQuestionPageDto
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// <summary>
|
||||
/// 任务展示访视 读片任务显示是否顺序
|
||||
/// </summary>
|
||||
public bool IsReadingTaskViewInOrder { get; set; } = true;
|
||||
public ReadingOrder IsReadingTaskViewInOrder { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -385,7 +385,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
public string ReadingUser { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
public bool IsReadingTaskViewInOrder { get; set; }
|
||||
public ReadingOrder IsReadingTaskViewInOrder { get; set; }
|
||||
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
|
||||
@@ -328,6 +328,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
/// </summary>
|
||||
public CustomCalculateMark? CustomCalculateMark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// TrialId
|
||||
/// </summary>
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IsDepend
|
||||
@@ -586,7 +590,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public bool IsReadingTaskViewInOrder { get; set; }
|
||||
public ReadingOrder IsReadingTaskViewInOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仲裁阅片
|
||||
|
||||
@@ -24,7 +24,9 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
Task<List<GetReadingClinicalDataListOutDto>> GetReadingClinicalList(GetReadingClinicalDataListIndto inDto);
|
||||
|
||||
Task<List<GetCRCClinicalDataOutDto>> GetCRCClinicalData(GetCRCClinicalDataInDto inDto);
|
||||
Task<List<GetCRCClinicalDataOutDto>> GetStudyClinicalData(GetStudyClinicalDataInDto inDto);
|
||||
|
||||
Task<List<GetCRCClinicalDataOutDto>> GetCRCClinicalData(GetCRCClinicalDataInDto inDto);
|
||||
|
||||
|
||||
Task DealVisiTaskClinicalDataSignedAsync(Guid trialId, Guid subjectId, Guid readingId, bool isVisit, Guid trialReadingCritrialId);
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
break;
|
||||
case ReadingCategory.Visit:
|
||||
// 有序
|
||||
if (medicalReviewInfo.IsReadingTaskViewInOrder)
|
||||
if (medicalReviewInfo.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
medicalReviewInfo.TaskList = await _visitTaskRepository
|
||||
|
||||
|
||||
+7
-2
@@ -250,7 +250,9 @@ namespace IRaCIS.Application.Services
|
||||
.Select(y => new GlobalQuestionInfo()
|
||||
{
|
||||
|
||||
QuestionId = y.ReadingQuestionTrialId,
|
||||
JudgeDifferenceValue= y.ReadingQuestionTrial.JudgeDifferenceValue,
|
||||
|
||||
QuestionId = y.ReadingQuestionTrialId,
|
||||
QuestionName = y.ReadingQuestionTrial.QuestionName.LanguageName(y.ReadingQuestionTrial.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionEnName=y.ReadingQuestionTrial.QuestionEnName,
|
||||
AnswerGroup = y.ReadingQuestionTrial.AnswerGroup,
|
||||
@@ -290,6 +292,7 @@ namespace IRaCIS.Application.Services
|
||||
x.BeforeQuestionList.Add(new GlobalQuestionInfo()
|
||||
{
|
||||
QuestionId = y.Id,
|
||||
JudgeDifferenceValue=y.JudgeDifferenceValue,
|
||||
QuestionName = y.QuestionName.LanguageName(y.QuestionEnName, _userInfo.IsEn_Us),
|
||||
QuestionEnName = y.QuestionEnName,
|
||||
AnswerGroup = y.AnswerGroup,
|
||||
@@ -373,7 +376,8 @@ namespace IRaCIS.Application.Services
|
||||
(lr.global.Select(x => x.Answer).FirstOrDefault().IsNullOrEmpty() && inDto.UsingOriginalData ?
|
||||
lr.question.Answer : lr.global.Select(x => x.Answer).FirstOrDefault()
|
||||
),
|
||||
VisitAnswer = lr.question.Answer,
|
||||
JudgeDifferenceValue= lr.question.JudgeDifferenceValue,
|
||||
VisitAnswer = lr.question.Answer,
|
||||
IsHaveChange = lr.global.Any(x=>x.QuestionId!=null&&!x.Answer.IsNullOrEmpty()) ? true : false,
|
||||
QuestionId = lr.question.QuestionId,
|
||||
QuestionName = lr.question.QuestionName.LanguageName(lr.question.QuestionEnName, _userInfo.IsEn_Us),
|
||||
@@ -507,6 +511,7 @@ namespace IRaCIS.Application.Services
|
||||
.Select(x => new CriterionDictionaryInfo()
|
||||
{
|
||||
Id = x.Id,
|
||||
|
||||
DictionaryId = x.DictionaryId,
|
||||
ChildGroup = x.Dictionary.ChildGroup,
|
||||
IsBaseLineUse=x.IsBaseLineUse,
|
||||
|
||||
+65
-17
@@ -608,7 +608,7 @@ namespace IRaCIS.Application.Services
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
if (!taskInfo.TrialReadingCriterion.IsReadingTaskViewInOrder)
|
||||
if (taskInfo.TrialReadingCriterion.IsReadingTaskViewInOrder != ReadingOrder.InOrder)
|
||||
{
|
||||
result = result.Where(x => x.VisitTaskId == inDto.VisitTaskId).ToList();
|
||||
}
|
||||
@@ -689,15 +689,30 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
var readingPastResultList = await taskQuery.OrderBy(x => x.VisitTaskNum).ThenBy(x => x.TaskState).Select(x => new GetReadingPastResultListOutDto()
|
||||
{
|
||||
|
||||
VisitTaskId = x.Id,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
TaskName = x.TaskName,
|
||||
ReadModuleVisitId= x.ReadModule!=null?x.ReadModule.SubjectVisitId:null,
|
||||
VisitName = x.SourceSubjectVisit!=null? x.SourceSubjectVisit.VisitName: x.ReadModule==null?string.Empty: x.ReadModule.SubjectVisit.VisitName,
|
||||
|
||||
VisitBlindName = x.TaskBlindName,
|
||||
VisitTaskNum = x.VisitTaskNum,
|
||||
JudgeResultArm = x.JudgeResultTask == null ? null : x.JudgeResultTask.ArmEnum,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
foreach (var item in readingPastResultList)
|
||||
{
|
||||
if (item.ReadModuleVisitId != null)
|
||||
{
|
||||
item.VisitBlindName = (await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == item.ReadModuleVisitId && x.IsSelfAnalysis == taskInfo.IsSelfAnalysis &&
|
||||
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate ).Select(x => x.TaskBlindName).FirstOrDefaultAsync())??string.Empty;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return readingPastResultList;
|
||||
}
|
||||
|
||||
@@ -1233,7 +1248,7 @@ namespace IRaCIS.Application.Services
|
||||
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
|
||||
&& x.ReadingCategory == ReadingCategory.Visit)||x.Id==taskInfo.BeforeConvertedTaskId
|
||||
).OrderByDescending(x=>x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
|
||||
if (!criterionInfo.IsReadingTaskViewInOrder)
|
||||
if (criterionInfo.IsReadingTaskViewInOrder != ReadingOrder.InOrder)
|
||||
{
|
||||
// 无序的话 不要查
|
||||
laskTaskId = Guid.NewGuid();
|
||||
@@ -1947,7 +1962,7 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
|
||||
|
||||
await _readingTableAnswerRowInfoRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.RowId, x => new ReadingTableAnswerRowInfo()
|
||||
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.RowId, x => new ReadingTableAnswerRowInfo()
|
||||
{
|
||||
|
||||
IsDeleted = true
|
||||
@@ -2724,7 +2739,7 @@ namespace IRaCIS.Application.Services
|
||||
trialReadingCriterionId = task.TrialReadingCriterionId;
|
||||
|
||||
}
|
||||
else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder)
|
||||
else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
var subjectTaskList = (await _visitTaskService.GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto()
|
||||
{
|
||||
@@ -2769,6 +2784,39 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
|
||||
}
|
||||
else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.SubjectRandom)
|
||||
{
|
||||
var subjectTaskList = (await _visitTaskService.GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto()
|
||||
{
|
||||
TrialId = inDto.TrialId,
|
||||
SubjectId=inDto.SubjectId,
|
||||
TrialReadingCriterionId = trialReadingCriterionId!.Value,
|
||||
Page = new PageInput()
|
||||
{
|
||||
PageIndex = 1,
|
||||
PageSize = 99999,
|
||||
}
|
||||
})).Item2;
|
||||
|
||||
if (subjectTaskList.Count() == 0)
|
||||
{
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
|
||||
}
|
||||
|
||||
var taskList = subjectTaskList.FirstOrDefault()!.UnReadCanReadTaskList;
|
||||
var count = taskList.Count();
|
||||
Random random = new Random();
|
||||
var skipcount = 0;
|
||||
if (count >= 2)
|
||||
{
|
||||
skipcount = random.Next(0, count - 1);
|
||||
}
|
||||
|
||||
var visitTaskId= taskList.Skip(skipcount).FirstOrDefault();
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var query = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.TrialReadingCriterionId == trialReadingCriterionId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.Id
|
||||
@@ -2787,17 +2835,17 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
task = await query
|
||||
.Select(x => new GetReadingTaskDto()
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
ArmEnum = x.ArmEnum,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
||||
VisitNum = x.VisitTaskNum,
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectCode = x.Subject.Code,
|
||||
TrialReadingCriterionId = x.TrialReadingCriterionId,
|
||||
}).Skip(skipcount).FirstOrDefaultAsync();
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
ArmEnum = x.ArmEnum,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
||||
VisitNum = x.VisitTaskNum,
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectCode = x.Subject.Code,
|
||||
TrialReadingCriterionId = x.TrialReadingCriterionId,
|
||||
}).Skip(skipcount).FirstOrDefaultAsync();
|
||||
|
||||
}
|
||||
|
||||
@@ -3074,7 +3122,7 @@ namespace IRaCIS.Application.Services
|
||||
List<Guid> reportRelatedTaskIdList = new List<Guid>();
|
||||
|
||||
|
||||
if (isReadingTaskViewInOrder)
|
||||
if (isReadingTaskViewInOrder == ReadingOrder.InOrder)
|
||||
{
|
||||
|
||||
|
||||
|
||||
+102
-15
@@ -46,7 +46,10 @@ namespace IRaCIS.Application.Services
|
||||
QuestionGenre=x.QuestionGenre,
|
||||
DictionaryCode=x.DictionaryCode,
|
||||
JudgeType = x.JudgeType,
|
||||
ReadingQuestionTrialId = x.Id
|
||||
Type=x.Type,
|
||||
ReadingQuestionTrialId = x.Id,
|
||||
JudgeDifferenceValue= x.JudgeDifferenceValue,
|
||||
JudgeDifferenceType=x.JudgeDifferenceType,
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
@@ -70,7 +73,9 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
AnswerGroup = JsonConvert.SerializeObject(inDto.AnswerGroup),
|
||||
AnswerCombination = JsonConvert.SerializeObject(inDto.AnswerCombination),
|
||||
JudgeType = inDto.JudgeType,
|
||||
JudgeDifferenceValue= inDto.JudgeDifferenceValue,
|
||||
JudgeDifferenceType=inDto.JudgeDifferenceType,
|
||||
JudgeType = inDto.JudgeType,
|
||||
});
|
||||
|
||||
var result = await _readingQuestionTrialRepository.SaveChangesAsync();
|
||||
@@ -613,6 +618,8 @@ namespace IRaCIS.Application.Services
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
JudgeDifferenceValue=question.JudgeDifferenceValue,
|
||||
JudgeDifferenceType=question.JudgeDifferenceType,
|
||||
VisitTaskId = questionAnswer.VisitTaskId,
|
||||
};
|
||||
var globalVisitAnswerlist = await globalVisitQuestionQuery.ToListAsync();
|
||||
@@ -621,13 +628,15 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
foreach (var item in taskNums)
|
||||
{
|
||||
List<GroupTaskAnswerDto> groupTasks = globalVisitAnswerlist.Where(x => x.VisitTaskNum == item).GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
List<GroupTaskAnswerDto> groupTasks = globalVisitAnswerlist.Where(x => x.VisitTaskNum == item).GroupBy(x => new {x.JudgeDifferenceValue,x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
JudgeDifferenceValue=x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(groupTasks);
|
||||
}
|
||||
@@ -644,18 +653,22 @@ namespace IRaCIS.Application.Services
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
VisitTaskId = questionAnswet.VisitTaskId,
|
||||
JudgeDifferenceValue=question.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = question.JudgeDifferenceType,
|
||||
VisitTaskId = questionAnswet.VisitTaskId,
|
||||
};
|
||||
var questionAnswerlist = await query.ToListAsync();
|
||||
|
||||
// 将答案进行分组
|
||||
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
List<GroupTaskAnswerDto> groupTasks = questionAnswerlist.GroupBy(x => new {x.JudgeDifferenceValue,x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
JudgeDifferenceValue=x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = ComputeJudgeResult(groupTasks);
|
||||
}
|
||||
@@ -696,14 +709,16 @@ namespace IRaCIS.Application.Services
|
||||
twoItem.AfterQuestionList.Where(x => x.QuestionId != null && x.IsJudgeQuestion).ToList()
|
||||
).ToList();
|
||||
|
||||
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination,x.JudgeDifferenceValue,x.JudgeDifferenceType }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId!.Value,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
JudgeDifferenceValue= x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
|
||||
}
|
||||
|
||||
@@ -746,8 +761,9 @@ namespace IRaCIS.Application.Services
|
||||
AnswerCombination = question.AnswerCombination,
|
||||
JudgeType = question.JudgeType,
|
||||
QuestionId = question.Id,
|
||||
|
||||
};
|
||||
JudgeDifferenceValue=question.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = question.JudgeDifferenceType,
|
||||
};
|
||||
|
||||
var visitTaskQuestions = await query.ToListAsync();
|
||||
|
||||
@@ -755,13 +771,15 @@ namespace IRaCIS.Application.Services
|
||||
lastTask.AfterQuestionList.Where(x => x.QuestionId != null).ToList()
|
||||
).ToList();
|
||||
|
||||
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new { x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
List<GroupTaskAnswerDto> globalGroupTasks = newlist.GroupBy(x => new {x.JudgeDifferenceValue,x.JudgeDifferenceType, x.QuestionId, x.AnswerGroup, x.JudgeType, x.AnswerCombination }).Select(x => new GroupTaskAnswerDto
|
||||
{
|
||||
QuestionId = x.Key.QuestionId!.Value,
|
||||
AnswerGroup = x.Key.AnswerGroup,
|
||||
AnswerCombination = x.Key.AnswerCombination,
|
||||
JudgeType = x.Key.JudgeType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
JudgeDifferenceValue=x.Key.JudgeDifferenceValue,
|
||||
JudgeDifferenceType = x.Key.JudgeDifferenceType,
|
||||
TaskAnswerList = x.Select(y => y.Answer).ToList(),
|
||||
}).ToList();
|
||||
noteEqual = noteEqual || ComputeJudgeResult(globalGroupTasks);
|
||||
}
|
||||
@@ -881,6 +899,10 @@ namespace IRaCIS.Application.Services
|
||||
noteEqual = true;
|
||||
break;
|
||||
}
|
||||
else if (noteEqual)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
var taskAnswer1 = item.TaskAnswerList[0];
|
||||
@@ -921,8 +943,73 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
});
|
||||
break;
|
||||
case JudgeTypeEnum.NotCalculate:
|
||||
noteEqual = false;
|
||||
case JudgeTypeEnum.DifferenceAbsoluteValue:
|
||||
var deffaultValue = taskAnswer1.IsNullOrEmptyReturn0() - taskAnswer2.IsNullOrEmptyReturn0();
|
||||
if (deffaultValue < 0)
|
||||
{
|
||||
deffaultValue = 0 - deffaultValue;
|
||||
|
||||
}
|
||||
|
||||
if (item.JudgeDifferenceType == JudgeDifferenceType.Greater)
|
||||
{
|
||||
if (deffaultValue > item.JudgeDifferenceValue)
|
||||
{
|
||||
noteEqual = true;
|
||||
}
|
||||
}
|
||||
else if (item.JudgeDifferenceType == JudgeDifferenceType.AboveOrEqual)
|
||||
{
|
||||
if (deffaultValue >= item.JudgeDifferenceValue)
|
||||
{
|
||||
noteEqual = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case JudgeTypeEnum.PercentageDifference:
|
||||
var value1 = taskAnswer1.IsNullOrEmptyReturn0();
|
||||
var value2 = taskAnswer2.IsNullOrEmptyReturn0();
|
||||
if (value1 == 0 || value2 == 0)
|
||||
{
|
||||
noteEqual = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (item.JudgeDifferenceType == JudgeDifferenceType.Greater)
|
||||
{
|
||||
if (value1 < value2)
|
||||
{
|
||||
noteEqual = (value2 - value1) * 100 / value1 > item.JudgeDifferenceValue;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
noteEqual = (value1 - value2) * 100 / value2 > item.JudgeDifferenceValue;
|
||||
}
|
||||
}
|
||||
else if (item.JudgeDifferenceType == JudgeDifferenceType.AboveOrEqual)
|
||||
{
|
||||
if (value1 < value2)
|
||||
{
|
||||
noteEqual = (value2 - value1) * 100 / value1 >= item.JudgeDifferenceValue;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
noteEqual = (value1 - value2) * 100 / value2 >= item.JudgeDifferenceValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,20 +157,20 @@ namespace IRaCIS.Application.Services
|
||||
.WhereIf(dto.TrialSiteCode != null && dto.TrialSiteCode != string.Empty, x => x.TrialSiteCode.Contains(dto.TrialSiteCode))
|
||||
.WhereIf(dto.SubjectCode != null && dto.SubjectCode != string.Empty, x => x.SubjectCode.Contains(dto.SubjectCode))
|
||||
.WhereIf(dto.ModuleType != null, x => x.ModuleType == dto.ModuleType)
|
||||
.WhereIf(dto.CompleteClinicalData==CompleteClinicalDataEnum.NA,x=>x.NeedSignClinicalDataCount==0)
|
||||
.WhereIf(dto.CompleteClinicalData == CompleteClinicalDataEnum.NotComplete, x => x.NeedSignClinicalDataCount != x.SignClinicalDataCount)
|
||||
.WhereIf(dto.CompleteClinicalData == CompleteClinicalDataEnum.Complete, x => x.NeedSignClinicalDataCount != 0 && x.NeedSignClinicalDataCount == x.SignClinicalDataCount)
|
||||
.WhereIf(dto.ReadingStatus != null, x => x.ReadingStatus == dto.ReadingStatus)
|
||||
.WhereIf(dto.Name != null, x => x.Name.Contains(dto.Name!)).OrderBy(x => x.SiteCode);
|
||||
.WhereIf(dto.CompleteClinicalData == CompleteClinicalDataEnum.NA, x => x.NeedSignClinicalDataCount == 0)
|
||||
.WhereIf(dto.CompleteClinicalData == CompleteClinicalDataEnum.NotComplete, x => x.NeedSignClinicalDataCount != x.SignClinicalDataCount)
|
||||
.WhereIf(dto.CompleteClinicalData == CompleteClinicalDataEnum.Complete, x => x.NeedSignClinicalDataCount != 0 && x.NeedSignClinicalDataCount == x.SignClinicalDataCount)
|
||||
.WhereIf(dto.ReadingStatus != null, x => x.ReadingStatus == dto.ReadingStatus);
|
||||
//.WhereIf(dto.Name != null, x => x.Name.Contains(dto.Name!)).OrderBy(x => x.SiteCode);
|
||||
|
||||
var subjectIds = await subjectQuery.OrderBy(dto.SortField).Select(x => x.SubjectId).Distinct().Skip((dto.PageIndex - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||
|
||||
List<ReadModuleView> ReadModuleViewList = await subjectQuery.Where(x => subjectIds.Contains(x.SubjectId)).OrderBy(dto.SortField).ToListAsync();
|
||||
List<GetReadModuleDtoOut> getReadList = ReadModuleViewList.GroupBy(x => new { x.SubjectId, x.SiteId, x.TrialSiteCode, x.SubjectCode })
|
||||
List<GetReadModuleDtoOut> getReadList = ReadModuleViewList.GroupBy(x => new { x.SubjectId, x.TrialSiteId, x.TrialSiteCode, x.SubjectCode })
|
||||
.Select(x => new GetReadModuleDtoOut()
|
||||
{
|
||||
TrialSiteCode = x.Key.TrialSiteCode,
|
||||
SiteId = x.Key.SiteId,
|
||||
TrialSiteId = x.Key.TrialSiteId,
|
||||
SubjectCode = x.Key.SubjectCode,
|
||||
SubjectId = x.Key.SubjectId,
|
||||
Data = x.OrderBy(x=>x.ModuleType).ThenBy(x=>x.VisitNum).ToList(),
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
ReadingPeriodSetId = entity.Id,
|
||||
TrialId = entity.TrialId,
|
||||
SiteId = x,
|
||||
TrialSiteId = x,
|
||||
}).ToList();
|
||||
|
||||
entity.ReadingPeriodPlanList = addOrEditReadingPeriodSet.SubjectVisitIds.Select(x => new ReadingPeriodPlan
|
||||
@@ -107,7 +107,7 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
ReadingPeriodSetId = entity.Id,
|
||||
TrialId = entity.TrialId,
|
||||
SiteId = x,
|
||||
TrialSiteId = x,
|
||||
}).ToList();
|
||||
|
||||
entity.ReadingPeriodPlanList = addOrEditReadingPeriodSet.SubjectVisitIds.Select(x => new ReadingPeriodPlan
|
||||
@@ -493,7 +493,7 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
// 当前项目 最晚拍片日期不为null 中心筛选
|
||||
var visitQuery = _subjectVisitRepository.Where(x => x.TrialId == inDto.TrialId && x.LatestScanDate != null && !x.IsLostVisit)
|
||||
.WhereIf(inDto.ReadingScope == ReadingScopeEnum.Site, x => inDto.SiteIds.Contains(x.SiteId))
|
||||
.WhereIf(inDto.ReadingScope == ReadingScopeEnum.Site, x => inDto.SiteIds.Contains(x.TrialSiteId))
|
||||
.Where(x=>!x.IsBaseLine);// 排除基线
|
||||
|
||||
// 已经存在的访视 需要排除
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
CreateMap<ReadingPeriodSet, ReadingPeriodSetView>()
|
||||
.ForMember(d => d.SubjectVisitName, u => u.MapFrom(s => s.VisitStage==null?string.Empty: s.VisitStage.VisitName))
|
||||
.ForMember(d => d.SiteIds, u => u.MapFrom(s => s.ReadingPeriodSites.Select(x => x.SiteId)))
|
||||
.ForMember(d => d.SiteIds, u => u.MapFrom(s => s.ReadingPeriodSites.Select(x => x.TrialSiteId)))
|
||||
.ForMember(d => d.SiteCodes, u => u.MapFrom(s => s.ReadingPeriodSites.Select(x => x.TrialSite.TrialSiteCode)))
|
||||
.ForMember(d => d.PlanCount, u => u.MapFrom(s => s.ReadingPeriodPlanList.Count));
|
||||
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
|
||||
namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
public class HistoryVisitRSDTO
|
||||
{
|
||||
|
||||
public Guid StudyId { get; set; }
|
||||
public string StudyCode { get; set; } = String.Empty;
|
||||
|
||||
public decimal VisitNum { get; set; }
|
||||
|
||||
public string VisitName { get; set; } = String.Empty;
|
||||
|
||||
public string OverallResponse { get; set; } = String.Empty;
|
||||
|
||||
public string TpCode { get; set; } = String.Empty;
|
||||
|
||||
public GlobalRSSelectView GlobalRSSelect { get; set; } = new GlobalRSSelectView();
|
||||
|
||||
}
|
||||
|
||||
public class GlobalRSSelectView
|
||||
{
|
||||
public bool? Agree { get; set; }
|
||||
public string NewRS { get; set; } = String.Empty;
|
||||
public string Note { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
public class HistoryGlobalRsDTO
|
||||
{
|
||||
|
||||
public decimal VisitNum { get; set; }
|
||||
|
||||
public string VisitName { get; set; } = String.Empty;
|
||||
|
||||
public string OverallResponse { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
public class PreviousGlobalReadsView
|
||||
{
|
||||
public string SubjectNote { get; set; } = String.Empty;
|
||||
|
||||
public List<HistoryGlobalRsDTO> PreviousGlobalReadsList { get; set; } = new List<HistoryGlobalRsDTO>();
|
||||
}
|
||||
|
||||
|
||||
public class GlobalTaskReportCommand
|
||||
{
|
||||
public Guid GlobalId { get; set; }
|
||||
public string SubjectNote { get; set; } = String.Empty;
|
||||
public string SubjectCode { get; set; } = String.Empty;
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public List<GlobalReportCommand> GlobalRSReportList { get; set; }=new List<GlobalReportCommand>();
|
||||
}
|
||||
|
||||
public class GlobalReportCommand
|
||||
{
|
||||
public Guid GlobalId { get; set; }
|
||||
public string TpCode { get; set; } = String.Empty;
|
||||
public int VisitNum { get; set; }
|
||||
public bool? Agree { get; set; }
|
||||
public string NewRS { get; set; } = String.Empty;
|
||||
public string Note { get; set; } = String.Empty;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class AdReportDTO
|
||||
{
|
||||
public PreviousGlobalReadsView Global1 { get; set; } = new PreviousGlobalReadsView();
|
||||
public PreviousGlobalReadsView Global2 { get; set; } = new PreviousGlobalReadsView();
|
||||
|
||||
public IEnumerable<HistoryVisitRSDTO> Global1VisitRS { get; set; }=new List<HistoryVisitRSDTO>();
|
||||
public IEnumerable<HistoryVisitRSDTO> Global2VisitRS { get; set; } = new List<HistoryVisitRSDTO>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class ADReportCommand
|
||||
{
|
||||
|
||||
public Guid AdId { get; set; }
|
||||
public Guid SelectGlobalId { get; set; }
|
||||
public string ADNote { get; set; } = String.Empty;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,280 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
public class LesionInformation
|
||||
{
|
||||
public Guid TUId { get; set; }
|
||||
public int LesionType { get; set; } //病灶类型
|
||||
public string STUDYID { get; set; } = string.Empty; // 项目ID
|
||||
public string USUBJID { get; set; } = string.Empty;// 受试者ID
|
||||
public int TUSEQ { get; set; } // 病灶序号
|
||||
|
||||
// 病灶分组,主要是用于将分裂或者结合在一起的已经被标识的肿瘤分类
|
||||
public string TUGRPID { get; set; } = string.Empty;
|
||||
|
||||
//内部或外部的肿瘤/病灶标识。 例如:医学影像 ID
|
||||
public string TUREFID { get; set; } = string.Empty;
|
||||
|
||||
public string TUSPID { get; set; } = string.Empty;// 申办方标识
|
||||
|
||||
// 关联测量结果,及TUGRPID一起,标识分裂及合并
|
||||
public string TULNKID { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 检查项目
|
||||
/// TUMIDENT (Tumor Identification )
|
||||
/// TUSPLIT (Tumor Split )
|
||||
/// TUMERGE (Tumor Merged)
|
||||
/// </summary>
|
||||
public string TUTESTCD { get; set; } = string.Empty;
|
||||
public string TUTEST { get; set; } = string.Empty;
|
||||
|
||||
public string TUORRES { get; set; } = string.Empty;//TARGET, NON-TARGET, NEW
|
||||
|
||||
public string TUSTRESC { get; set; } = string.Empty;//包含从 TUORRES拷贝的所有发现的结果
|
||||
public string TUNAM { get; set; } = string.Empty;//完成肿瘤标识的供应商名称或标识
|
||||
|
||||
public string LocDescription { get; set; } = string.Empty;// 部位描述
|
||||
public string TULOC { get; set; } = string.Empty; // 解剖学部位
|
||||
public string TULAT { get; set; } = string.Empty;//解剖学部位或者样本更详细的偏侧性修饰语,比如,左侧, 右侧,双侧。
|
||||
public string TUDIR { get; set; } = string.Empty;//解剖学部位或者样本更详细的方向性修饰语,比如,上边的 ,里面的。
|
||||
public string TUPORTOT { get; set; } = string.Empty;//解剖学部位或者样本更详细的分布,安排,分配的修饰语, 比如,全部的,单一的,部分的,多数的。
|
||||
|
||||
public string TUMETHOD { get; set; } = string.Empty; //用来标识肿瘤的办法。 例如,核磁共振,CT扫描。
|
||||
|
||||
public string TUEVAL { get; set; } = string.Empty; //评估者的角色。 例如:研究者,独立评估者。
|
||||
public string TUEVALID { get; set; } = string.Empty;//这个特定的评估者变量是与 TUEVAL一起使用来提供更详 细的信息
|
||||
public string TUACPTFL { get; set; } = string.Empty;
|
||||
|
||||
// 访视信息
|
||||
public decimal VISITNUM { get; set; } = 0;
|
||||
public string VISIT { get; set; } = string.Empty;
|
||||
public int VISITDY { get; set; }
|
||||
public string EPOCH { get; set; } = string.Empty;
|
||||
public string TUDTC { get; set; } = string.Empty;
|
||||
public int TUDY { get; set; } = 0;
|
||||
|
||||
//TR
|
||||
|
||||
public string TRTESTCD { get; set; } = string.Empty;
|
||||
public string TRTEST { get; set; } = string.Empty;
|
||||
public string TRORRES { get; set; } = string.Empty;//原始收到或采集的肿瘤测量/评估结
|
||||
public string TRORRESU { get; set; } = string.Empty;//原始单位
|
||||
public string TRSTRESC { get; set; } = string.Empty;//标准化结 果
|
||||
public double TRSTRESN { get; set; }//标准化结 果(N)
|
||||
public string TRSTRESU { get; set; } = string.Empty;// 标准化单位
|
||||
public string TRSTAT { get; set; } = string.Empty; // 未做状态
|
||||
public string TRREASND { get; set; } = string.Empty; // 未做原因
|
||||
public string Note { get; set; } = string.Empty;
|
||||
public string TRGRPID { get; set; } = string.Empty;
|
||||
public string TRDTC { get; set; } = string.Empty;
|
||||
public int TRDY { get; set; } = 0;
|
||||
////RS
|
||||
//public string RSCAT { get; set; } // 类别,用来识别对反应评估中使用的标准,以及适当时提供版本号
|
||||
//public string RSORRES { get; set; } //原始接收、采集或者计算的肿瘤反应评估的结果。
|
||||
//public string RSSTRESC { get; set; } //标准化结果
|
||||
|
||||
public bool CoveredLesion { get; set; }
|
||||
}
|
||||
public class VisitLesion : LesionInformation
|
||||
{
|
||||
public LesionInformation CurrentLesion { get; set; } = new LesionInformation();
|
||||
}
|
||||
|
||||
public class EfficacyAssessment
|
||||
{
|
||||
public string TargetLesion { get; set; } = string.Empty;
|
||||
public string Non_targetLesion { get; set; } = string.Empty;
|
||||
public string OverallAssessment { get; set; } = string.Empty;
|
||||
|
||||
public string TargetLesionNote { get; set; } = string.Empty;
|
||||
public string Non_targetLesionNote { get; set; } = string.Empty;
|
||||
public string OverallAssessmentNote { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class PreviousOverallAssessment
|
||||
{
|
||||
public string VisitName { get; set; } = string.Empty;
|
||||
public string OverallAssessment { get; set; } = string.Empty;
|
||||
}
|
||||
public class VisitLesionInfo
|
||||
{
|
||||
//基线病灶信息及本次访视测量信息
|
||||
public IList<VisitLesion> BLLesionList { get; set; } = new List<VisitLesion>();
|
||||
// public IList<LesionInformation> BLVisitLesionList { get; set; } = new List<LesionInformation>();
|
||||
//public IList<LesionInformation> CurrentVisitLesionList { get; set; } = new List<LesionInformation>();
|
||||
|
||||
// 以往病灶信息
|
||||
public IList<VisitLesion> PreviousNewLesionList { get; set; } = new List<VisitLesion>();
|
||||
//本次疑似新病灶
|
||||
public IList<LesionInformation> EquivocalNewLesionList { get; set; } = new List<LesionInformation>();
|
||||
public IList<LesionInformation> UnequivocalNewLesionList { get; set; } = new List<LesionInformation>();
|
||||
public ReportDTO ReportResult { get; set; } = new ReportDTO();
|
||||
public EfficacyAssessment Efficacy { get; set; } = new EfficacyAssessment();
|
||||
public List<PreviousOverallAssessment> PreviousOverallAssessment { get; set; } = new List<PreviousOverallAssessment>();
|
||||
|
||||
public MinVisit MinVisitInfo { get; set; } = new MinVisit();
|
||||
}
|
||||
|
||||
public class MinVisit
|
||||
{
|
||||
public double MinSum { get; set; } = 0.0;
|
||||
public string MinVistName { get; set; } = string.Empty;
|
||||
}
|
||||
public class ReportCommand
|
||||
{
|
||||
public List<LesionInformation> LesionInformationList { get; set; } = new List<LesionInformation>();
|
||||
|
||||
//RS
|
||||
public string RSCAT { get; set; } = string.Empty;// 类别,用来识别对反应评估中使用的标准,以及适当时提供版本号
|
||||
public string RSORRES { get; set; } = string.Empty; //原始接收、采集或者计算的肿瘤反应评估的结果。
|
||||
public string RSSTRESC { get; set; } = string.Empty; //标准化结果
|
||||
}
|
||||
public class TUDTO
|
||||
{
|
||||
public int LesionType { get; set; }
|
||||
public string STUDYID { get; set; } = string.Empty;
|
||||
public string USUBJID { get; set; } = string.Empty;
|
||||
public int TUSEQ { get; set; }
|
||||
public string TUGRPID { get; set; } = string.Empty;
|
||||
public string TUREFID { get; set; } = string.Empty;//内部或外部的肿瘤/病灶标识。 例如:医学影像 ID
|
||||
public string TUSPID { get; set; } = string.Empty;
|
||||
public string TULNKID { get; set; } = string.Empty;
|
||||
public string TUTESTCD { get; set; } = string.Empty;
|
||||
public string TUTEST { get; set; } = string.Empty;
|
||||
|
||||
public double TUORRES { get; set; } = 0;
|
||||
public string TUSTRESC { get; set; } = string.Empty;
|
||||
public string TUNAM { get; set; } = string.Empty;
|
||||
public string TULOC { get; set; } = string.Empty;
|
||||
public string TULAT { get; set; } = string.Empty;
|
||||
public string TUDIR { get; set; } = string.Empty;
|
||||
public string TUPORTOT { get; set; } = string.Empty;
|
||||
public string TUMETHOD { get; set; } = string.Empty;
|
||||
public string TUEVAL { get; set; } = string.Empty;
|
||||
public string TUEVALID { get; set; } = string.Empty;
|
||||
public string TUACPTFL { get; set; } = string.Empty;
|
||||
public double VISITNUM { get; set; } = 0;
|
||||
public string VISIT { get; set; } = string.Empty;
|
||||
public string VISITDY { get; set; } = string.Empty;
|
||||
public string EPOCH { get; set; } = string.Empty;
|
||||
public string TUDTC { get; set; } = string.Empty;
|
||||
public int TUDY { get; set; } = 0;
|
||||
}
|
||||
public class TRDTO
|
||||
{
|
||||
public string STUDYID { get; set; } = string.Empty;
|
||||
public string DOMAIN { get; set; } = string.Empty;
|
||||
public string USUBJID { get; set; } = string.Empty;
|
||||
public int TRSEQ { get; set; }
|
||||
public string TRGRPID { get; set; } = string.Empty;
|
||||
public string TRREFID { get; set; } = string.Empty;
|
||||
public string TRSPID { get; set; } = string.Empty;
|
||||
public string TRLNKID { get; set; } = string.Empty;
|
||||
public string TRLNKGRP { get; set; } = string.Empty;
|
||||
public string TRTESTCD { get; set; } = string.Empty;
|
||||
public string TRTEST { get; set; } = string.Empty;
|
||||
public string TRORRES { get; set; } = string.Empty;
|
||||
public string TRORRESU { get; set; } = string.Empty;
|
||||
public string TRSTRESC { get; set; } = string.Empty;
|
||||
public double TRSTRESN { get; set; } = 0;
|
||||
public string TRSTRESU { get; set; } = string.Empty;
|
||||
public string TRSTAT { get; set; } = string.Empty;
|
||||
public string TRREASND { get; set; } = string.Empty;
|
||||
public string TRNAM { get; set; } = string.Empty;
|
||||
public string TRMETHOD { get; set; } = string.Empty;
|
||||
public string TREVAL { get; set; } = string.Empty;
|
||||
public string TREVALID { get; set; } = string.Empty;
|
||||
public string TRACPTFL { get; set; } = string.Empty;
|
||||
public decimal VISITNUM { get; set; } = 0;
|
||||
public string VISIT { get; set; } = string.Empty;
|
||||
public int VISITDY { get; set; } = 0;
|
||||
public string EPOCH { get; set; } = string.Empty;
|
||||
public string TRDTC { get; set; } = string.Empty;
|
||||
public int TRDY { get; set; } = 0;
|
||||
public string Note { get; set; } = string.Empty;
|
||||
public bool CoveredLesion { get; set; } = true;
|
||||
}
|
||||
|
||||
public class RSDTO
|
||||
{
|
||||
public string STUDYID { get; set; } = string.Empty;
|
||||
public string DOMAIN { get; set; } = string.Empty;
|
||||
public string USUBJID { get; set; } = string.Empty;
|
||||
public int RSSEQ { get; set; }
|
||||
public string RSGRPID { get; set; } = string.Empty;
|
||||
public string RSREFID { get; set; } = string.Empty;
|
||||
public string RSSPID { get; set; } = string.Empty;
|
||||
public string RSLNKID { get; set; } = string.Empty;
|
||||
public string RSLNKGRP { get; set; } = string.Empty;
|
||||
public string RSTESTCD { get; set; } = string.Empty;
|
||||
public string RSTEST { get; set; } = string.Empty;
|
||||
public string RSCAT { get; set; } = string.Empty;
|
||||
public string RSORRES { get; set; } = string.Empty;
|
||||
public string RSSTRESC { get; set; } = string.Empty;
|
||||
public string RSSTAT { get; set; } = string.Empty;
|
||||
public string RSREASND { get; set; } = string.Empty;
|
||||
public string RSNAM { get; set; } = string.Empty;
|
||||
|
||||
public string RSEVAL { get; set; } = string.Empty;
|
||||
public string RSEVALID { get; set; } = string.Empty;
|
||||
public string RSACPTFL { get; set; } = string.Empty;
|
||||
public decimal VISITNUM { get; set; } = 0;
|
||||
public string VISIT { get; set; } = string.Empty;
|
||||
public int VISITDY { get; set; } = 0;
|
||||
public string EPOCH { get; set; } = string.Empty;
|
||||
public string RSDTC { get; set; } = string.Empty;
|
||||
public int RSDY { get; set; } = 0;
|
||||
public Guid StudyGuid { get; set; } = Guid.Empty;
|
||||
public Guid TrialGuid { get; set; } = Guid.Empty;
|
||||
public Guid SubjectGuid { get; set; } = Guid.Empty;
|
||||
|
||||
public string Note { get; set; } = string.Empty;
|
||||
}
|
||||
public class ReportDTO
|
||||
{
|
||||
public bool Qualified { get; set; } = true;
|
||||
public string DiseaseProgression { get; set; } = string.Empty;
|
||||
public string NotEvaluable { get; set; } = string.Empty;
|
||||
public string Timepoint { get; set; } = string.Empty;
|
||||
public string TrialCode { get; set; } = string.Empty;
|
||||
public string SubjectCode { get; set; } = string.Empty;
|
||||
public decimal? VisitNum { get; set; }
|
||||
public string VisitName { get; set; } = string.Empty;
|
||||
public int? DiseaseSituation { get; set; }
|
||||
public string Comment { get; set; } = String.Empty;
|
||||
public Guid? TPId { get; set; }
|
||||
public Guid? DicomStudyId { get; set; }
|
||||
public string TpCode { get; set; } = string.Empty;
|
||||
|
||||
public bool AffectRead { get; set; }//是否影响读片
|
||||
public string AffectReadNote { get; set; } = String.Empty;//备注说明
|
||||
}
|
||||
|
||||
|
||||
public class VisitReportCommand
|
||||
{
|
||||
public List<LesionInformation> LesionInformation { get; set; } = new List<LesionInformation>();
|
||||
public List<TRDTO> TRList { get; set; } = new List<TRDTO>();
|
||||
public List<RSDTO> RSList { get; set; } = new List<RSDTO>();
|
||||
public ReportDTO ReportResult { get; set; } = new ReportDTO();
|
||||
}
|
||||
|
||||
public class BaseLineReportCommand
|
||||
{
|
||||
//public Guid TimepointId { get; set; }
|
||||
public string SumOfDiameter { get; set; } = String.Empty;
|
||||
public string SumDiameterOfNonLymphNode { get; set; } = String.Empty;
|
||||
public IList<LesionInformation> LesionInformation { get; set; } = new List<LesionInformation>();
|
||||
public ReportDTO ReportResult { get; set; } = new ReportDTO();
|
||||
}
|
||||
|
||||
public class BaseLineReportDTO
|
||||
{
|
||||
public IList<LesionInformation> LesionInformation { get; set; } = new List<LesionInformation>();
|
||||
public ReportDTO ReportResult { get; set; } = new ReportDTO();
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
|
||||
namespace IRaCIS.Application.Contracts
|
||||
{
|
||||
public class WorkloadReadingDTO
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public Guid StudyId { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
public string TrialCode { get; set; } = string.Empty;
|
||||
public string TrialIndication { get; set; } = string.Empty;
|
||||
public string Sponsor { get; set; } = string.Empty;
|
||||
public int Expedited { get; set; }
|
||||
|
||||
public Guid SubjectId { get; set; }
|
||||
public string SubjectCode { get; set; } = string.Empty;
|
||||
|
||||
public string VisitName { get; set; } = string.Empty;
|
||||
public decimal VisitNum { get; set; }
|
||||
|
||||
|
||||
public Guid WorkloadId { get; set; }
|
||||
public string WorkloadCode { get; set; } = string.Empty;
|
||||
public int WorkloadType { get; set; }
|
||||
public int Status { get; set; }
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
|
||||
public class WorkloadQueryParam : PageInput
|
||||
{
|
||||
public Guid? TrialId { get; set; } = Guid.Empty;
|
||||
public string SubjectCode { get; set; } = string.Empty;
|
||||
public int? Status { get; set; }
|
||||
public int WorkloadType { get; set; }
|
||||
public int? Expedited { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,197 +0,0 @@
|
||||
//using IRaCIS.Core.Application.Contracts;
|
||||
//using System.Linq.Dynamic.Core;
|
||||
//using AutoMapper;
|
||||
//using IRaCIS.Application.Contracts;
|
||||
//using IRaCIS.Core.Infra.EFCore;
|
||||
//using IRaCIS.Core.Domain.Models;
|
||||
//using IRaCIS.Core.Infrastructure.Extention;
|
||||
//using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
//namespace IRaCIS.Core.Application.Services
|
||||
//{
|
||||
// [ ApiExplorerSettings(GroupName = "Reading")]
|
||||
// public class GlobalReportService : BaseService, IGlobalService
|
||||
// {
|
||||
// private readonly IRepository<GlobalRS> _globalRsRepository;
|
||||
// private readonly IRepository<GlobalResult> _globalResultRepository;
|
||||
// private readonly IRSRepository _rsRepository;
|
||||
// private readonly IRepository<VisitStage> _visitStageRepository;
|
||||
|
||||
// private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
// private readonly IWorkloadADRepository _workloadAdRepository;
|
||||
// private readonly IWorkloadGlobalRepository _workloadGlobalRepository;
|
||||
// private readonly IRepository<Trial> _trialRepository;
|
||||
// private readonly IRepository<Subject> _subjectRepository;
|
||||
|
||||
// public GlobalReportService(IRepository<GlobalRS> globalRsRepository, IRepository<GlobalResult> globalResultRepository,
|
||||
// IRSRepository rsRepository, IRepository<VisitStage> visitStageRepository, IRepository<SubjectVisit> subjectVisitRepository, IWorkloadADRepository workloadAdRepository,
|
||||
// IWorkloadGlobalRepository workloadGlobalRepository, IRepository<Trial> trialRepository, IRepository<Subject> subjectRepository)
|
||||
// {
|
||||
// _globalRsRepository = globalRsRepository;
|
||||
// _globalResultRepository = globalResultRepository;
|
||||
// _rsRepository = rsRepository;
|
||||
// _visitStageRepository = visitStageRepository;
|
||||
|
||||
// _subjectVisitRepository = subjectVisitRepository;
|
||||
// _workloadAdRepository = workloadAdRepository;
|
||||
// _workloadGlobalRepository = workloadGlobalRepository;
|
||||
// _trialRepository = trialRepository;
|
||||
// _subjectRepository = subjectRepository;
|
||||
// }
|
||||
|
||||
// [HttpGet("{trialId:guid}/{subjectId:guid}/{visitNum:decimal}/{globalId:guid}/{globalCode}")]
|
||||
// public IEnumerable<HistoryVisitRSDTO> GetHistoryVisitRsList(Guid trialId, Guid subjectId, decimal visitNum, Guid globalId, string globalCode)
|
||||
// {
|
||||
|
||||
// var tpGroup = 'T' + globalCode.Trim().Substring(globalCode.Trim().Length - 2);
|
||||
|
||||
|
||||
// var query = from rs in _rsRepository.AsQueryable()
|
||||
// .Where(t => t.SubjectGuid == subjectId && t.TrialGuid == trialId && t.RSTESTCD == "OVRLRESP" && t.VISITNUM <= visitNum && t.TpCode.Contains(tpGroup))
|
||||
|
||||
// join globalRs in _globalRsRepository.Where(t => t.GlobalId == globalId) on new { rs.TpCode, VisitNum = rs.VISITNUM } equals new { globalRs.TpCode, globalRs.VisitNum } into cc
|
||||
// from globalRs in cc.DefaultIfEmpty()
|
||||
|
||||
// join visitStage in _visitStageRepository.Where(t => t.TrialId == trialId) on rs.VISITNUM equals visitStage.VisitNum
|
||||
// select new HistoryVisitRSDTO
|
||||
// {
|
||||
// StudyId = rs.StudyGuid,
|
||||
// StudyCode = rs.STUDYID,
|
||||
// VisitNum = visitStage.VisitNum,
|
||||
// VisitName = visitStage.VisitName,
|
||||
// OverallResponse = rs.RSORRES,
|
||||
// TpCode = rs.TpCode,
|
||||
// GlobalRSSelect = new GlobalRSSelectView()
|
||||
// {
|
||||
// Agree = globalRs.Agree,
|
||||
// NewRS = globalRs.NewRS,
|
||||
// Note = globalRs.Note
|
||||
// }
|
||||
// };
|
||||
|
||||
// var visitRsList = query.OrderBy(t => t.VisitNum).ToList();
|
||||
|
||||
// return visitRsList;
|
||||
|
||||
// }
|
||||
// #pragma warning disable
|
||||
// [HttpGet("{trialId:guid}/{subjectId:guid}/{visitNum:decimal}/{globalId:guid}")]
|
||||
// public PreviousGlobalReadsView GetHistoryGlobalRsList(Guid trialId, Guid subjectId, decimal visitNum,
|
||||
// Guid globalId)
|
||||
// {
|
||||
// //subjectCode = subjectCode.Trim();
|
||||
|
||||
// var query = from globalResult in _globalResultRepository.AsQueryable()
|
||||
// .Where(t => t.SubjectId == subjectId && t.VisitNum < visitNum)
|
||||
// join visitStage in _visitStageRepository.Where(t => t.TrialId == trialId) on globalResult.VisitNum equals visitStage.VisitNum
|
||||
// select new HistoryGlobalRsDTO
|
||||
// {
|
||||
// VisitNum = visitStage.VisitNum,
|
||||
// VisitName = visitStage.VisitName,
|
||||
// OverallResponse = globalResult.Result
|
||||
// };
|
||||
|
||||
// var subjectNote = _globalResultRepository.FirstOrDefault(t => t.GlobalId == globalId)?.SubjectNote;
|
||||
|
||||
// return new PreviousGlobalReadsView()
|
||||
// {
|
||||
// PreviousGlobalReadsList = query.ToList(),
|
||||
// SubjectNote = subjectNote
|
||||
// };
|
||||
|
||||
// }
|
||||
|
||||
// public IResponseOutput AddGlobalReport(GlobalTaskReportCommand globalTaskReportCommand)
|
||||
// {
|
||||
// //删除上一次保存得记录
|
||||
// _globalResultRepository.Delete(t => t.GlobalId == globalTaskReportCommand.GlobalId);
|
||||
// _globalRsRepository.Delete(t => t.GlobalId == globalTaskReportCommand.GlobalId);
|
||||
|
||||
|
||||
// var globalRsList = _mapper.Map<List<GlobalRS>>(globalTaskReportCommand.GlobalRSReportList);
|
||||
|
||||
// _globalRsRepository.AddRange(globalRsList);
|
||||
|
||||
// var first = globalRsList.OrderByDescending(t => t.VisitNum).First();
|
||||
|
||||
// var globalResult = new GlobalResult()
|
||||
// {
|
||||
// VisitNum = first.VisitNum,
|
||||
// SubjectCode = globalTaskReportCommand.SubjectCode,
|
||||
// SubjectNote = globalTaskReportCommand.SubjectNote,
|
||||
// SubjectId = globalTaskReportCommand.SubjectId,
|
||||
|
||||
// GlobalId = first.GlobalId,
|
||||
// Result = first.NewRS
|
||||
// };
|
||||
|
||||
// _globalResultRepository.Add(globalResult);
|
||||
|
||||
// return ResponseOutput.Result(_globalResultRepository.SaveChanges()) ;
|
||||
|
||||
// }
|
||||
|
||||
// //public string GetCommentsForSubject(Guid globalId)
|
||||
// //{
|
||||
// // return _globalResultRepository.FirstOrDefault(t => t.GlobalId == globalId)?.SubjectNote;
|
||||
// //}
|
||||
// [HttpGet("{adId}")]
|
||||
// public AdReportDTO GetAdReport(Guid adId)
|
||||
// {
|
||||
// var adReport = new AdReportDTO();
|
||||
// var ad = _workloadAdRepository.FirstOrDefault(t => t.Id == adId);
|
||||
// var globalId1 = ad.Global1Id;
|
||||
// var globalId2 = ad.Global2Id;
|
||||
|
||||
// var query = from global in _workloadGlobalRepository.Where(t => t.Id == globalId1 || t.Id == globalId2)
|
||||
// join trial in _trialRepository.Where(t => t.Id == ad.TrialId) on global.TrialId equals trial.Id
|
||||
// join subject in _subjectRepository.AsQueryable() on global.SubjectId equals subject.Id
|
||||
// select new WorkloadReadingDTO
|
||||
// {
|
||||
// Id = global.Id,
|
||||
// WorkloadId = global.Id,
|
||||
// WorkloadType = 1,
|
||||
// Status = global.Status,
|
||||
// UpdateTime = global.UpdateTime,
|
||||
// TrialId = global.TrialId,
|
||||
// SubjectId = global.SubjectId,
|
||||
// SubjectCode = subject.Code,
|
||||
// //VisitNum = visit.VisitNum,
|
||||
// //VisitName = visit.VisitName,
|
||||
// VisitNum = global.VisitNum,
|
||||
// VisitName = global.VisitName,
|
||||
|
||||
// Expedited = trial.Expedited,
|
||||
// TrialCode = trial.TrialCode,
|
||||
// TrialIndication = trial.Indication,
|
||||
// WorkloadCode = global.GlobalCode
|
||||
// };
|
||||
|
||||
// var globalList = query.ToList();
|
||||
|
||||
// var global1 = globalList.First(t => t.Id == globalId1);
|
||||
// var global2 = globalList.First(t => t.Id == globalId2);
|
||||
|
||||
// adReport.Global1VisitRS = GetHistoryVisitRsList(global1.TrialId, global1.SubjectId,
|
||||
// global1.VisitNum, global1.Id, global1.WorkloadCode);
|
||||
|
||||
// adReport.Global2VisitRS = GetHistoryVisitRsList(global2.TrialId, global2.SubjectId
|
||||
// ,global2.VisitNum, global2.Id, global2.WorkloadCode);
|
||||
|
||||
// adReport.Global1 = GetHistoryGlobalRsList(global1.TrialId, global1.SubjectId, global1.VisitNum, global1.Id);
|
||||
// adReport.Global2 = GetHistoryGlobalRsList(global2.TrialId, global2.SubjectId, global2.VisitNum, global2.Id);
|
||||
|
||||
// adReport.ADInfo = ad;
|
||||
|
||||
// return adReport;
|
||||
|
||||
// }
|
||||
|
||||
// public IResponseOutput AddAdjudicationReport(ADReportCommand adReportCommand)
|
||||
// {
|
||||
// return ResponseOutput.Result(_workloadAdRepository.Update(t => t.Id == adReportCommand.AdId,
|
||||
// u => new WorkloadAD()
|
||||
// { AdNote = adReportCommand.ADNote, SelectGlobalId = adReportCommand.SelectGlobalId })) ;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user