diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index 08f00f072..de3d78b2c 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -93,6 +93,7 @@ namespace IRaCIS.Api.Controllers [FromServices] ITokenService _tokenService, [FromServices] IConfiguration configuration) { + var returnModel = await _userService.Login(loginUser.UserName, loginUser.Password); if (returnModel.IsSuccess) @@ -160,6 +161,17 @@ namespace IRaCIS.Api.Controllers 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); + } var userId = returnModel.Data.BasicInfo.Id.ToString(); @@ -205,6 +217,8 @@ namespace IRaCIS.Api.Controllers var token = decodeUrl.Substring(decodeUrl.IndexOf("access_token=") + "access_token=".Length); + var lang = decodeUrl.Substring(decodeUrl.IndexOf("lang=") + "lang=".Length, 2); + var domainStrList = decodeUrl.Split("/").ToList().Take(3).ToList(); var errorUrl = domainStrList[0]+"//"+ domainStrList[2]+ "/error"; @@ -212,7 +226,7 @@ namespace IRaCIS.Api.Controllers if (!await _userRepository.AnyAsync(t => t.Id == Guid.Parse(userId) && t.EmailToken == token && t.IsFirstAdd)) { - decodeUrl = errorUrl+ $"?ErrorMessage={System.Web.HttpUtility.UrlEncode("您的初始化链接已过期")} "; + decodeUrl = errorUrl+ $"?lang={lang}&ErrorMessage={System.Web.HttpUtility.UrlEncode(lang=="zh"? "您的初始化链接已过期": "Error!The initialization link has expired. Return")} "; } return Redirect(decodeUrl); diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser.html index 9191707f8..ba530acb4 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser.html @@ -32,7 +32,7 @@
祝您顺利!/Best Regards
-
上海展影医疗科技有限公司
+
展影医疗
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser_US.html index 0cfd47bf6..81f3aa200 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminAddUser_US.html @@ -4,35 +4,35 @@ Title - -
+ +
-
+
Dear {0} ,
-
- Extimaging has added an account for you. The account information is as follows: +
+ Extensive Imaging has generated a user account for you.
The account information is as follows:
-
+
- User name: {1} + User ID: {1}
Role: {2}
-
-
Best Regards
-
Shanghai Extensive Imaging Medical Technology Co., LTD
+
+
Best regards,
+
Extensive Imaging
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser.html index e81216184..ad1130293 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser.html @@ -29,7 +29,7 @@
祝您顺利!/Best Regards
-
上海展影医疗科技有限公司
+
展影医疗
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser_US.html index 274ee9053..37b035715 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/AdminResetUser_US.html @@ -4,19 +4,19 @@ Title - -
+ +
-
+
Dear {0} ,
-
- Extimaging has reset your account password, and the account information is as follows: +
+ Extensive Imaging has reset your password.
The account information is as follows:
-
+
- User name: {1} + User ID: {1}
Role: {2} @@ -27,9 +27,9 @@
-
-
Best Regards
-
Shanghai Extensive Imaging Medical Technology Co., LTD
+
+
Best regards,
+
Extensive Imaging
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress.html index 0d184d0a3..368b1884c 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress.html @@ -19,7 +19,7 @@
祝您顺利!/Best Regards
-
上海展影医疗科技有限公司
+
展影医疗
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress_US.html index aaf96e71f..4607c5af2 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/SubjectEnrollConfirmOrPDProgress_US.html @@ -4,22 +4,22 @@ Title - -
+ +
-
- Dear: +
+ Dear Sir or Madam:
-
- Thank you for using Extensive Imaging Cloud System. +
+ Thank you for using our IRC imaging system.
-
+
{0}。
-
-
Best Regards
-
Shanghai Extensive Imaging Medical Technology Co., LTD
+
+
Best regards,
+
Extensive Imaging
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html index 99d20f468..5e154e16f 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin.html @@ -11,7 +11,7 @@ 尊敬的 {0} ,您好:
- 展影医疗作为 [{1} (试验方案号:{2 })] 项目的IRC供应商,诚邀您参加该项目IRC阅片相关工作,欢迎您提供指导和建议,非常感谢! + 展影医疗作为 [{1} (试验方案号:{2 })] 项目的IRC供应商,诚邀您参加该项目IRC阅片相关工作。
该项目采用电子化工作流,系统及您的账号信息如下: @@ -41,7 +41,7 @@
祝您顺利!/Best Regards
-
上海展影医疗科技有限公司
+
展影医疗
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html index 572e2a5df..af5a32a3e 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorExistJoin_US.html @@ -4,20 +4,20 @@ Title - +
-
+
Dear {0},
-
- Hello, as the IRC supplier of [ {1} (Protocol ID is {2}) ] project,Extiming sincerely invites you to participate in the IRC related work of this project. Your guidance and suggestions are welcome. +
+ As the IRC service provider of {1} trial(Protocol ID is {2}), Extensive Imaging invites you to participate in the independent assessment work of this trial.
-
- This project adopts electronic workflow. The system and your account information are as follows: +
+ Digital workflow is implemented for this trial, and your account information is as follows:
-
+
Trial ID: {3}
@@ -25,23 +25,22 @@ Protocol ID: {2}
- Study name: {1} + Study Name: {1}
- User name: {4} + User Name: {4}
Role: {5}
- System login address:{6} + Login URL: {6}
- -
-
Best Regards
-
Shanghai Extensive Imaging Medical Technology Co., LTD
+
+
Best regards,
+
Extensive Imaging
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html index 4bfce0de5..cb7f00034 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin.html @@ -44,7 +44,7 @@
祝您顺利!/Best Regards
-
上海展影医疗科技有限公司
+
展影医疗
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html index ba80405ee..83d919950 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialDoctorFirstJoin_US.html @@ -4,20 +4,21 @@ Title - +
-
+
Dear {0},
-
- Hello, as the IRC supplier of [ {1} (Protocol ID is {2}) ] project,Extiming sincerely invites you to participate in the IRC related work of this project. Your guidance and suggestions are welcome. +
+ As the IRC service provider of {1}trial (Protocol ID is {2}), Extensive Imaging invites you to participate in the independent assessment work of this trial.
-
- This project adopts electronic workflow. The system and your account information are as follows: +
+
+ Digital workflow is implemented for this trial, and your account information is as follows:
-
+
Trial ID: {3}
@@ -25,26 +26,26 @@ Protocol ID: {2}
- Study name: {1} + Study Name: {1}
- User name: {4} + User ID: {4}
Role: {5}
-
-
Best Regards
-
Shanghai Extensive Imaging Medical Technology Co., LTD
+
+
Best regards,
+
Extensive Imaging
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject.html index 29b84eedc..a2b8f771c 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject.html @@ -41,7 +41,7 @@
祝您顺利!/Best Regards
-
上海展影医疗科技有限公司
+
展影医疗
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject_US.html index 0deb87dad..caa38e3b7 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialSiteSurveyReject_US.html @@ -4,17 +4,17 @@ Title - -
-
-
+ +
+
+
Dear {0} ,
-
- Hello, the center survey form you filled in has been rejected. The details are as follows: +
+ The site survey questionnaire you filled in has been rejected. Details are as follows:
-
+
Trial ID: {1}
@@ -22,26 +22,26 @@ Protocol ID: {2}
- Study name: {3} + Study Name: {3}
Site ID: {4}
- Site name: {5} + Site Name: {5}
Reason for rejection: {6}
- - Login and view + + Login & View -
-
Best Regards
-
Shanghai Extensive Imaging Medical Technology Co., LTD
+
+
Best regards,
+
Extensive Imaging
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html index 14cbda11e..260ad6bba 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin.html @@ -41,7 +41,7 @@
祝您顺利!/Best Regards
-
上海展影医疗科技有限公司
+
展影医疗
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html index 572e2a5df..5e33fc801 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserExistJoin_US.html @@ -4,20 +4,20 @@ Title - -
-
-
+ +
+
+
Dear {0},
-
- Hello, as the IRC supplier of [ {1} (Protocol ID is {2}) ] project,Extiming sincerely invites you to participate in the IRC related work of this project. Your guidance and suggestions are welcome. +
+ As the IRC service provider of {1} trial (Protocol ID is {2}), Extensive Imaging invites you to participate in IRC-related work of this trial.
-
- This project adopts electronic workflow. The system and your account information are as follows: +
+ Digital workflow is implemented for this trial, and your account information is as follows:
-
+
Trial ID: {3}
@@ -25,23 +25,23 @@ Protocol ID: {2}
- Study name: {1} + Study Name: {1}
- User name: {4} + User Name: {4}
Role: {5}
- System login address:{6} + Login URL: {6}
-
-
Best Regards
-
Shanghai Extensive Imaging Medical Technology Co., LTD
+
+
Best regards,
+
Extensive Imaging
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html index 83cb9d4be..48019299e 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin.html @@ -11,7 +11,7 @@ 尊敬的 {0} ,您好:
- 展影医疗作为 [{1} (试验方案号:{2 })] 项目的IRC供应商,诚邀您参加该项目IRC相关工作,欢迎您提供指导和建议,非常感谢! + 展影医疗作为 [{1} (试验方案号:{2 })] 项目的IRC供应商,诚邀您参加该项目IRC相关工作。
该项目采用电子化工作流,系统及您的账号信息如下: @@ -44,7 +44,7 @@
祝您顺利!/Best Regards
-
上海展影医疗科技有限公司
+
展影医疗
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html index ba80405ee..e402530d6 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/TrialUserFirstJoin_US.html @@ -4,20 +4,20 @@ Title - +
-
+
Dear {0},
-
- Hello, as the IRC supplier of [ {1} (Protocol ID is {2}) ] project,Extiming sincerely invites you to participate in the IRC related work of this project. Your guidance and suggestions are welcome. +
+ As the IRC service provider of {1} trial (Protocol ID is {2}), Extensive Imaging invites you to participate in IRC-related work of this trial.
- This project adopts electronic workflow. The system and your account information are as follows: + Digital workflow is implemented for this trial, and your account information is as follows:
-
+
Trial ID: {3}
@@ -25,26 +25,26 @@ Protocol ID: {2}
- Study name: {1} + Study Name: {1}
- User name: {4} + User Name: {4}
Role: {5}
-
-
Best Regards
-
Shanghai Extensive Imaging Medical Technology Co., LTD
+
+
Best regards,
+
Extensive Imaging
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon.html index e114d9fa9..d6bfd963e 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon.html @@ -8,18 +8,18 @@
- Dear {0}, + 亲爱的用户 ,
感谢您使用展影云平台。
- {1},验证码是: {2},请在3分钟内输入该验证码,进行后续操作。如非本人操作,请忽略该邮件。 + {0},验证码是: {1},请在3分钟内输入该验证码,进行后续操作。如非本人操作,请忽略该邮件。
祝您顺利!/Best Regards
-
上海展影医疗科技有限公司
+
展影医疗
diff --git a/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html b/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html index f9bc2f21b..e828eb2ea 100644 --- a/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html +++ b/IRaCIS.Core.API/wwwroot/EmailTemplate/UserOptCommon_US.html @@ -4,23 +4,25 @@ Title - +
-
- Dear {0}, +
+ Dear Sir or Madam:
-
- Thank you for using Extensive Imaging Cloud System. +
+ Thank you for using our IRC imaging system.
-
- {1}, the verification code is {2}. Enter the verification code within 3 minutes for subsequent operations. Please ignore this email if not by yourself. +
+ {0}, the verification code is {1}. Please enter this code within 3 minutes for follow-up operations. +
+
+ If you are not the intended person, please ignore this email.
- -
-
Best Regards
-
Shanghai Extensive Imaging Medical Technology Co., LTD
+
+
Best regards,
+
Extensive Imaging
diff --git a/IRaCIS.Core.Application/BusinessFilter/LimitUserRequestAuthorization.cs b/IRaCIS.Core.Application/BusinessFilter/LimitUserRequestAuthorization.cs index 4bdcc0761..dda88370f 100644 --- a/IRaCIS.Core.Application/BusinessFilter/LimitUserRequestAuthorization.cs +++ b/IRaCIS.Core.Application/BusinessFilter/LimitUserRequestAuthorization.cs @@ -3,6 +3,7 @@ using IRaCIS.Core.Domain.Share; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.Localization; using Microsoft.Extensions.Options; using Newtonsoft.Json; @@ -11,9 +12,9 @@ namespace IRaCIS.Core.Application.Filter; -public class LimitUserRequestAuthorization :BaseService, IAsyncAuthorizationFilter +public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter { - + public IStringLocalizer _localizer { get; set; } private readonly IEasyCachingProvider _provider; @@ -21,11 +22,12 @@ public class LimitUserRequestAuthorization :BaseService, IAsyncAuthorizationFilt private readonly IOptionsMonitor _verifyConfig; - public LimitUserRequestAuthorization(IEasyCachingProvider provider, IUserInfo userInfo, IOptionsMonitor verifyConfig) + public LimitUserRequestAuthorization(IEasyCachingProvider provider, IUserInfo userInfo, IStringLocalizer localizer ,IOptionsMonitor verifyConfig) { _provider = provider; _userInfo = userInfo; _verifyConfig = verifyConfig; + _localizer = localizer; } diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index ecee6e76d..dcda22ad5 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -9922,6 +9922,7 @@ + @@ -9929,6 +9930,8 @@ 重阅申请待审核 + + @@ -9936,6 +9939,8 @@ 阅片人筛选 + + vvv @@ -9943,6 +9948,8 @@ 重阅审批 + + @@ -9959,6 +9966,7 @@ + @@ -10001,12 +10009,13 @@ - + - IR 影像阅片 待阅量 复杂 --未完成 + IR 影像阅片 待阅量 + diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 3d43b495d..cd1501d3f 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -1081,11 +1081,15 @@ namespace IRaCIS.Core.Application.Service.Allocation var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect /*&& x.TrialReadingCriterionId== inDto.TrialReadingCriterionId*/) - .WhereIf(critrion.IsAutoCreate == false, t => t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).Any(t => t.IsGeneratedTask == false) ? - t.VisitTaskNum <= t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.IsGeneratedTask == false).Min(t => t.SubjectVisit.VisitNum) : true) + //前序 不存在 未生成任务的访视 + .WhereIf(critrion.IsAutoCreate == false, t => !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum) ) - .Where(t => t.Subject.SubjectVisitList.Any(t => t.CheckState != CheckStateEnum.CVPassed) ? t.VisitTaskNum <= t.Subject.SubjectVisitList.Where(t => t.CheckState != CheckStateEnum.CVPassed).Min(t => t.VisitNum) : true) + // 前序 不存在 未一致性核查未通过的 + .Where( t=>! t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) + //.WhereIf(critrion.IsAutoCreate == false, t => t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).Any(t => t.IsGeneratedTask == false) ? + //t.VisitTaskNum <= t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId && t.IsGeneratedTask == false).Min(t => t.SubjectVisit.VisitNum) : true) + //.Where(t => t.Subject.SubjectVisitList.Any(t => t.CheckState != CheckStateEnum.CVPassed) ? t.VisitTaskNum <= t.Subject.SubjectVisitList.Where(t => t.CheckState != CheckStateEnum.CVPassed).Min(t => t.VisitNum) : true) //满足前序访视不存在 需要签署但是未签署 sql 相当复杂 同时想查询所有未读的统计数字 就无法统计 byzhouhang //但是加字段 IsFrontTaskNeedSignButNotSign 那么签名临床数据的时候,要对该subject 该标准的有效的任务 这个字段需要在签名的时候维护 采取这种方式 统计数字灵活 //.Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum)) @@ -1412,7 +1416,7 @@ namespace IRaCIS.Core.Application.Service.Allocation //添加申请记录 var visitTaskReReading = await _visitTaskReReadingRepository.AddAsync(new VisitTaskReReading() { - + TrialId=applyReReadingCommand.TrialId, RootReReadingTaskId = rootReReadingTaskId == Guid.Empty ? task.Id : rootReReadingTaskId, OriginalReReadingTaskId = task.Id, RequestReReadingTime = DateTime.Now, diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index f784e4c89..5f6e58120 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -186,7 +186,6 @@ namespace IRaCIS.Application.Services builder.HtmlBody = string.Format(templateInfo, - "", //---您正在进行邮箱重置密码操作 _localizer["Mail_ResettingPassword "], verificationCode @@ -254,7 +253,6 @@ namespace IRaCIS.Application.Services builder.HtmlBody = string.Format(templateInfo, - "", //---您正在参与展影医疗IRC项目 _localizer["Mail_IRCProject"], verificationCode @@ -321,7 +319,6 @@ namespace IRaCIS.Application.Services builder.HtmlBody = string.Format(templateInfo, - "", //---您正在参与展影医疗IRC项目中心调研工作 _localizer["Mail_CenterResearchReminder"], verificationCode diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs index ff4e9f236..0c072ec28 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs @@ -383,35 +383,55 @@ namespace IRaCIS.Application.Services } - Expression> visitTaskLambda = x => x.TrialId == trialId && x.SubjectId == subjectId && x.TrialReadingCriterionId == trialReadingCritrialId; - - - - - //维护 IsFrontTaskNeedSignButNotSign 在添加任务哪里用触发器也维护了 - var visitTaskIdQueryable = _visitTaskRepository.Where(visitTaskLambda) //该Subject 该标准的任务 - //小于自己任务号的任务 存在需要签名 但是没签名 - .Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum) - && t.IsFrontTaskNeedSignButNotSign == false ) - .Select(t => t.Id); - - await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable.Contains(t.Id), u => new VisitTask() + //有序阅片才维护 IsFrontTaskNeedSignButNotSign 这个状态 + if (_readingQuestionCriterionTrialRepository.Any(t=>t.Id==trialReadingCritrialId && t.IsReadingTaskViewInOrder == true)) { - IsFrontTaskNeedSignButNotSign = true - }); + + + Expression> visitTaskLambda = x => x.TrialId == trialId && x.SubjectId == subjectId && x.TrialReadingCriterionId == trialReadingCritrialId; + + + //维护 IsFrontTaskNeedSignButNotSign 在添加任务哪里用触发器也维护了 + var visitTaskIdQueryable = _visitTaskRepository.Where(visitTaskLambda) //该Subject 该标准的任务 + //小于自己任务号的任务 存在需要签名 但是没签名 + .Where(t => t.IsFrontTaskNeedSignButNotSign == false && + + (t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum) + + // 前序存在 未一致性核查未通过的 + || t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum>sv.VisitNum) + + )) + .Select(t => t.Id); + + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable.Contains(t.Id), u => new VisitTask() + { + IsFrontTaskNeedSignButNotSign = true + }); - var visitTaskIdQueryable2 = _visitTaskRepository.Where(visitTaskLambda) //该Subject 该标准的任务 - //小于自己任务号的任务 存在需要签名 但是没签名 - .Where(t => !t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum) - && t.IsFrontTaskNeedSignButNotSign == true ) - .Select(t => t.Id); + var visitTaskIdQueryable2 = _visitTaskRepository.Where(visitTaskLambda) //该Subject 该标准的任务 + + .Where(t => t.IsFrontTaskNeedSignButNotSign == true && - await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable2.Contains(t.Id), u => new VisitTask() - { - IsFrontTaskNeedSignButNotSign = false - }); + //前序任务 不存在需要签名 但是没签名 + !t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum) + + // 前序 不存在 未一致性核查未通过的 + && !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum) + ) + .Select(t => t.Id); + + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable2.Contains(t.Id), u => new VisitTask() + { + IsFrontTaskNeedSignButNotSign = false + }); + + + } + + } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs index 863b85a5b..6976ac903 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs @@ -149,6 +149,10 @@ namespace IRaCIS.Core.Application.Contracts public class IRImageReadingToBeDoneDto : TrialBaseInfoDto { + public Guid TrialReadingCriterionId { get; set; } + public string CriterionName { get; set; } + + public int? UrgentCount { get; set; } public int? UnReadCount { get; set; } @@ -167,11 +171,11 @@ namespace IRaCIS.Core.Application.Contracts public class MedicalCommentsToBeDoneDto : TrialBaseInfoDto { - + public Guid TrialReadingCriterionId { get; set; } public string CriterionName { get; set; } public int? UrgentCount { get; set; } - public int? ToBeDealedCount { get; set; } + public int? ToBeReplyedCount { get; set; } } public class ImageCheckQuestionToBeDoneQuery : PageInput @@ -183,7 +187,7 @@ namespace IRaCIS.Core.Application.Contracts { public int? UrgentCount { get; set; } - public int? ToBeDealedCount { get; set; } + public int? ToBeReplyedCount { get; set; } } public class ImageSubmittedToBeDoneQuery : PageInput @@ -224,7 +228,7 @@ namespace IRaCIS.Core.Application.Contracts { public int? UrgentCount { get; set; } - public int? ToBeDealedCount { get; set; } + public int? ToBeReUploadCount { get; set; } } public class ImageClinicalDataToBeDoneQuery : PageInput @@ -239,7 +243,52 @@ namespace IRaCIS.Core.Application.Contracts public int? ToBeDealedCount { get; set; } } + public class TrialToBeDoneQuery : PageInput + { + public string ExperimentName { get; set; } = string.Empty; + public string Code { get; set; } = string.Empty; + + public string ResearchProgramNo { get; set; } = string.Empty; + + public Guid? SponsorId { get; set; } + + + } + + public class TrialToBeDoneDto : TrialBaseInfoDto + { + + public Guid Id => TrialId; + + public DateTime? CreateTime { get; set; } + + public string Sponsor { get; set; } + + public string TrialStatusStr { get; set; } + + + public int? ExpetiedTaskCount { get; set; } + + + public int? ReReadingApprovalCount { get; set; } + + + public int? PendingReconciliationCount { get; set; } + + public int? PendingResponseCount { get; set; } + + public bool IsIQCHaveToBeDone { get; set; } + public bool IsCRCHaveToBeDone { get; set; } + + public bool IsMIMHaveToBeDone { get; set; } + + + public bool IsIRHaveToBeDone { get; set; } + + public bool IsSPMOrCPMHaveToBeDone { get; set; } + + } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 7a77d8697..d96ae367b 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -1,5 +1,8 @@ -using IRaCIS.Core.Application.Contracts; +using IRaCIS.Application.Contracts; +using IRaCIS.Core.Application.Contracts; +using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Share; +using IRaCIS.Core.Infrastructure.Extention; using Microsoft.AspNetCore.Mvc; namespace IRaCIS.Core.Application @@ -163,19 +166,22 @@ namespace IRaCIS.Core.Application #region PM APM 待办 + /// /// 一致性核查待处理 /// /// /// + /// /// [HttpPost] - public async Task> GetCheckToBeDoneList(CheckToBeDoneQuery inQuery, + public async Task>> GetCheckToBeDoneList(CheckToBeDoneQuery inQuery, [FromServices] IRepository _subjectVisitRepository, [FromServices] IRepository _trialRepository) { var query = _trialRepository + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new CheckToBeDoneDto() { TrialId = t.Id, @@ -183,14 +189,25 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, UrgentCount = t.SubjectVisitList.Where(u => (u.CheckState == CheckStateEnum.ToCheck || u.CheckState == CheckStateEnum.CVIng) && u.IsUrgent).Count(), + ToBeCheckedCount = t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.ToCheck).Count(), + ToBeRepliedCount = t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.ToCheck && u.CheckChallengeDialogList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)).Count(), }); + + var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var totalToBeCheckedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(u => u.CheckState == CheckStateEnum.ToCheck).CountAsync(); + + var totalToBeRepliedCount = await _subjectVisitRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(u => u.CheckState == CheckStateEnum.ToCheck && + u.CheckChallengeDialogList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator)).CountAsync(); + + return ResponseOutput.Ok(result, new { TotalToBeCheckedCount = totalToBeCheckedCount, TotalToBeRepliedCount = totalToBeRepliedCount }); } @@ -198,14 +215,18 @@ namespace IRaCIS.Core.Application /// 重阅申请待审核 /// /// + /// + /// /// [HttpPost] - public async Task> GetReReadingApplyToBeDoneList(ReReadingApplyToBeDoneQuery inQuery, + public async Task>> GetReReadingApplyToBeDoneList(ReReadingApplyToBeDoneQuery inQuery, [FromServices] IRepository _visitTaskReReadingRepository, [FromServices] IRepository _trialRepository) { - var query = _visitTaskReReadingRepository.Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed) + var query = _visitTaskReReadingRepository + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed) .GroupBy(t => new { t.OriginalReReadingTask.Trial.ExperimentName, t.OriginalReReadingTask.Trial.ResearchProgramNo, t.OriginalReReadingTask.Trial.TrialCode, t.OriginalReReadingTask.TrialId }) .Select(g => new ReReadingApplyToBeDoneDto() { @@ -221,11 +242,17 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + + var toBeApprovalCount = _visitTaskReReadingRepository + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed).Count(); + + return ResponseOutput.Ok(result, new { TotalToBeApprovalCount = toBeApprovalCount }); } + #endregion @@ -235,13 +262,16 @@ namespace IRaCIS.Core.Application /// 阅片人筛选 /// /// + /// + /// /// vvv [HttpPost] - public async Task> GetReviewerSelectToBeDoneList(ReviewerSelectToBeDoneQuery inQuery + public async Task>> GetReviewerSelectToBeDoneList(ReviewerSelectToBeDoneQuery inQuery , [FromServices] IRepository _enrollRepository, [FromServices] IRepository _trialRepository) { var query = _trialRepository + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ReviewerSelectToBeDoneDto() { TrialId = t.Id, @@ -255,7 +285,10 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var toBeApprovalCount = await _enrollRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(u => u.EnrollStatus == EnrollStatus.HasCommittedToCRO).CountAsync(); + + return ResponseOutput.Ok(result, new { ToBeApprovalCount = toBeApprovalCount }); ; } @@ -263,14 +296,18 @@ namespace IRaCIS.Core.Application /// 重阅审批 /// /// + /// + /// /// [HttpPost] - public async Task> GetReReadingApprovalToBeDoneToBeDoneList(ReReadingApprovalToBeDoneQuery inQuery, + public async Task>> GetReReadingApprovalToBeDoneToBeDoneList(ReReadingApprovalToBeDoneQuery inQuery, [FromServices] IRepository _visitTaskReReadingRepository, [FromServices] IRepository _trialRepository) { - var query = _visitTaskReReadingRepository.Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) + var query = _visitTaskReReadingRepository + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) .GroupBy(t => new { t.OriginalReReadingTask.Trial.ExperimentName, t.OriginalReReadingTask.Trial.ResearchProgramNo, t.OriginalReReadingTask.Trial.TrialCode, t.OriginalReReadingTask.TrialId }) .Select(g => new ReReadingApprovalToBeDoneDto() { @@ -286,7 +323,11 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var toBeApprovalCount = _visitTaskReReadingRepository + .Where(t => t.OriginalReReadingTask.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.OriginalReReadingTask.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed).Count(); + + return ResponseOutput.Ok(result, new { TotalToBeApprovalCount = toBeApprovalCount }); } @@ -303,27 +344,32 @@ namespace IRaCIS.Core.Application /// /// [HttpPost] - public async Task> GetImageClinicalDataToBeDoneList(ImageClinicalDataToBeDoneQuery inQuery, + public async Task>> GetImageClinicalDataToBeDoneList(ImageClinicalDataToBeDoneQuery inQuery, [FromServices] IRepository _subjectVisitRepository, [FromServices] IRepository _trialRepository) { var query = _trialRepository - .Where(t=>t.clinicalDataTrialSets.Any(t=>t.ClinicalDataLevel==ClinicalLevel.Subject && t.IsConfirm)) + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) .Select(t => new ImageClinicalDataToBeDoneDto() { TrialId = t.Id, ResearchProgramNo = t.ResearchProgramNo, ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, - UrgentCount = t.SubjectVisitList.Where(u => u.IsBaseLine&& u.SubmitState != SubmitStateEnum.Submitted && u.IsUrgent ).Count(), + UrgentCount = t.SubjectVisitList.Where(u => u.IsBaseLine && u.SubmitState != SubmitStateEnum.Submitted && u.IsUrgent).Count(), ToBeDealedCount = t.SubjectVisitList.Where(u => u.IsBaseLine && u.SubmitState != SubmitStateEnum.Submitted).Count(), }); var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var toBeDealedCount = _subjectVisitRepository + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id) && t.Trial.clinicalDataTrialSets.Any(t => t.ClinicalDataLevel == ClinicalLevel.Subject && t.IsConfirm)) + .Where(u => u.IsBaseLine && u.SubmitState != SubmitStateEnum.Submitted).Count(); + + return ResponseOutput.Ok(result, new { TotalToBeDealedCount = toBeDealedCount }); } @@ -336,31 +382,39 @@ namespace IRaCIS.Core.Application /// /// /// + /// /// [HttpPost] - public async Task> GetCRCImageQuestionToBeDoneList(ImageQuestionToBeDoneQuery inQuery, + public async Task>> GetCRCImageQuestionToBeDoneList(ImageQuestionToBeDoneQuery inQuery, [FromServices] IRepository _subjectVisitRepository, [FromServices] IRepository _trialRepository) { var query = _trialRepository + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ImageQuestionToBeDoneDto() { TrialId = t.Id, ResearchProgramNo = t.ResearchProgramNo, ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, - UrgentCount = t.SubjectVisitList.SelectMany(c=>c.QCChallengeList) - .Where(u => u.IsClosed==false && u.LatestReplyUser.UserTypeEnum==UserTypeEnum.IQC && u.SubjectVisit.IsUrgent).Count(), + UrgentCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList) + .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC && u.SubjectVisit.IsUrgent).Count(), + ToBeDealedCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC ).Count(), - + .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC).Count(), + }); var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var toBeDealedCount = _subjectVisitRepository + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .SelectMany(c => c.QCChallengeList) + .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.IQC).Count(); + + return ResponseOutput.Ok(result, new { TotalToBeDealedCount = toBeDealedCount }); } @@ -371,26 +425,35 @@ namespace IRaCIS.Core.Application /// /// [HttpPost] - public async Task> GetImageCheckQuestionToBeDoneList(ImageCheckQuestionToBeDoneQuery inQuery, + public async Task>> GetImageCheckQuestionToBeDoneList(ImageCheckQuestionToBeDoneQuery inQuery, [FromServices] IRepository _subjectVisitRepository, [FromServices] IRepository _trialRepository) { var query = _trialRepository + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ImageCheckQuestionToBeDoneDto() { TrialId = t.Id, ResearchProgramNo = t.ResearchProgramNo, ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, - UrgentCount = t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState==CheckChanllengeTypeEnum.PMWaitCRCReply && u.IsUrgent).Count(), - ToBeDealedCount = t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply ).Count() - + UrgentCount = t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply && u.IsUrgent).Count(), + ToBeReplyedCount = t.SubjectVisitList.Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count() + }); + + + var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var toBeDealedCount = _subjectVisitRepository + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(u => u.CheckState == CheckStateEnum.CVIng && u.CheckChallengeState == CheckChanllengeTypeEnum.PMWaitCRCReply).Count(); + + return ResponseOutput.Ok(result, new { TotalToBeReplyedCount = toBeDealedCount }); + } @@ -402,12 +465,13 @@ namespace IRaCIS.Core.Application /// /// [HttpPost] - public async Task> GetImageReUploadToBeDoneList(ImageReUploadToBeDoneQuery inQuery, + public async Task>> GetImageReUploadToBeDoneList(ImageReUploadToBeDoneQuery inQuery, [FromServices] IRepository _subjectVisitRepository, [FromServices] IRepository _trialRepository) { var query = _trialRepository + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ImageReUploadToBeDoneDto() { TrialId = t.Id, @@ -415,17 +479,21 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, UrgentCount = t.SubjectVisitList.Where(u => u.SubmitState == SubmitStateEnum.ToSubmit && u.IsUrgent && u.IsPMBackOrReReading).Count(), - ToBeDealedCount = t.SubjectVisitList.Where(u => u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading).Count(), + ToBeReUploadCount = t.SubjectVisitList.Where(u => u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading).Count(), }); - + var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var toBeDealedCount = _subjectVisitRepository + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit && u.IsPMBackOrReReading).Count(); + + return ResponseOutput.Ok(result, new { TotalToBeReUploadCount = toBeDealedCount }); } - + /// @@ -435,26 +503,31 @@ namespace IRaCIS.Core.Application /// /// [HttpPost] - public async Task> GetImageSubmittedToBeDoneList(ImageSubmittedToBeDoneQuery inQuery, + public async Task>> GetImageSubmittedToBeDoneList(ImageSubmittedToBeDoneQuery inQuery, [FromServices] IRepository _subjectVisitRepository, [FromServices] IRepository _trialRepository) { var query = _trialRepository + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ImageSubmittedToBeDoneDto() { TrialId = t.Id, ResearchProgramNo = t.ResearchProgramNo, ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, - UrgentCount = t.SubjectVisitList.Where(u => u.SubmitState ==SubmitStateEnum.ToSubmit && u.IsUrgent).Count(), - ToBeDealedCount = t.SubjectVisitList.Where(u => u.SubmitState == SubmitStateEnum.ToSubmit ).Count(), + UrgentCount = t.SubjectVisitList.Where(u => u.SubmitState == SubmitStateEnum.ToSubmit && u.IsUrgent).Count(), + ToBeDealedCount = t.SubjectVisitList.Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count(), }); var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var toBeDealedCount = _subjectVisitRepository + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count(); + + return ResponseOutput.Ok(result, new { TotalToBeReUploadCount = toBeDealedCount }); } @@ -473,12 +546,14 @@ namespace IRaCIS.Core.Application /// /// [HttpPost] - public async Task> GetImageQualityToBeDoneList(ImageQualityToBeDoneQuery inQuery, + public async Task>> GetImageQualityToBeDoneList(ImageQualityToBeDoneQuery inQuery, [FromServices] IRepository _subjectVisitRepository, [FromServices] IRepository _trialRepository) { - var query = _trialRepository.Where(t=>t.QCProcessEnum != TrialQCProcess.NotAudit) + var query = _trialRepository + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.QCProcessEnum != TrialQCProcess.NotAudit) .Select(t => new ImageQualityToBeDoneDto() { TrialId = t.Id, @@ -486,21 +561,31 @@ namespace IRaCIS.Core.Application ExperimentName = t.ExperimentName, TrialCode = t.TrialCode, - // 待审核 加急的(待领取 已领取)-- 领取了 还没做 就是待审核 - UrgentCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId==_userInfo.Id && u.IsUrgent).Count(), + // 待审核 加急的(待领取 已领取)-- 领取了 还没做完 就是待审核 + UrgentCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id && u.IsUrgent).Count(), //待领取量 - ToBeClaimedCount = t.SubjectVisitList.Where(u => u.SubmitState == SubmitStateEnum.ToSubmit).Count(), + ToBeClaimedCount = t.SubjectVisitList.Where(u =>u.CurrentActionUserId==null &&(u.PreliminaryAuditUserId==null ||(u.PreliminaryAuditUserId!=_userInfo.Id && u.ReviewAuditUserId==null)) ).Count(), - //已领取 待审核 审核中 (审核完成 领取人就会清理 所以只用查询当前领取人是自己的就好了) - ToBeReviewedCount= t.SubjectVisitList.Where(u => u.CurrentActionUserId==_userInfo.Id ).Count() + //待审核通过,统计从已领取到QC提交之间的 已领取 待审核 审核中 (审核完成 领取人就会清理 所以只用查询当前领取人是自己的就好了) + ToBeReviewedCount = t.SubjectVisitList.Where(u => u.CurrentActionUserId == _userInfo.Id).Count() }); var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + + var toBeClaimedCount = _subjectVisitRepository + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count(); + + + var toBeReviwedCount = _subjectVisitRepository.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(u => u.CurrentActionUserId == _userInfo.Id).Count(); + + + return ResponseOutput.Ok(result, new { TotalToBeClaimedCount = toBeClaimedCount, TotalToBeReviewedCount= toBeReviwedCount }); } @@ -512,12 +597,13 @@ namespace IRaCIS.Core.Application /// /// [HttpPost] - public async Task> GetQCImageQuestionToBeDoneList(ImageQuestionToBeDoneQuery inQuery, + public async Task>> GetQCImageQuestionToBeDoneList(ImageQuestionToBeDoneQuery inQuery, [FromServices] IRepository _subjectVisitRepository, [FromServices] IRepository _trialRepository) { var query = _trialRepository + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Select(t => new ImageQuestionToBeDoneDto() { TrialId = t.Id, @@ -533,7 +619,12 @@ namespace IRaCIS.Core.Application var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var toBeDealedCount = _subjectVisitRepository + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .SelectMany(c => c.QCChallengeList) + .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(); + + return ResponseOutput.Ok(result, new { TotalToBeReUploadCount = toBeDealedCount }); } @@ -543,61 +634,142 @@ namespace IRaCIS.Core.Application #region IR待办 /// - /// IR 影像阅片 待阅量 复杂 --未完成 + /// IR 影像阅片 待阅量 /// /// /// + /// /// /// [HttpPost] - public async Task> GetIRImageReadingToBeDoneList(IRImageReadingToBeDoneQuery inQuery, + public async Task>> GetIRImageReadingToBeDoneList(IRImageReadingToBeDoneQuery inQuery, [FromServices] IRepository _visitTaskRepository, - [FromServices] IRepository _trialRepository) + [FromServices] IRepository _trialReadingCriterionRepository, + [FromServices] IRepository _trialRepository) { - var query = _trialRepository - .Select(t => new IRImageReadingToBeDoneDto() - { - TrialId = t.Id, - ResearchProgramNo = t.ResearchProgramNo, - ExperimentName = t.ExperimentName, - TrialCode = t.TrialCode, + + var newQuery = _trialReadingCriterionRepository.Where(t => t.IsConfirm == true && t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Select(c => new IRImageReadingToBeDoneDto() + { + TrialId = c.TrialId, + ResearchProgramNo = c.Trial.ResearchProgramNo, + ExperimentName = c.Trial.ExperimentName, + TrialCode = c.Trial.TrialCode, + CriterionName = c.CriterionName, + TrialReadingCriterionId = c.Id, + + UrgentCount = c.VisitTaskList.AsQueryable().Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + // 前序 不存在 未一致性核查未通过的 + .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) + //前序 不存在 未生成任务的访视 + .Where(t => c.IsAutoCreate ? !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum) : true) + + .Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)) + .Count(t => t.IsUrgent), - UrgentCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && u.SubjectVisit.IsUrgent).Count(), + UnReadCount = c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + // 前序 不存在 未一致性核查未通过的 + .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) + //前序 不存在 未生成任务的访视 + //.WhereIf(g.Key.IsAutoCreate == false, t => !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum)) + .Where(t => c.IsAutoCreate ? !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum) : true) - UnReadCount=t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze)) - .Where(y=>y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)) + .Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)) + .Count(), - .Count(), - HaveSignedCount = t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id - && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) - && t.ReadingTaskState==ReadingTaskState.HaveSigned).Count() + HaveSignedCount = c.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) + && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count(), + }) - }); + ; + + #region 废弃 + //var query = _trialRepository + // .Select(t => new IRImageReadingToBeDoneDto() + // { + // TrialId = t.Id, + // ResearchProgramNo = t.ResearchProgramNo, + // ExperimentName = t.ExperimentName, + // TrialCode = t.TrialCode, - //var query = _visitTaskRepository.Where(t=>t.DoctorUserId==_userInfo.Id && (t.TaskState == TaskState.Effect ||t.TaskState==TaskState.Freeze)) - // .GroupBy(t=>new {t.SubjectId,t.TrialId,t.Subject.Code,t.Trial.ResearchProgramNo,t.Trial.ExperimentName, t.BlindSubjectCode}) - // .Select(t => new IRImageReadingToBeDoneDto() + // UrgentCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList) + // .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && u.SubjectVisit.IsUrgent).Count(), + + // UnReadCount=t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + // // 前序 不存在 未一致性核查未通过的 + // .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) + // //前序 不存在 未生成任务的访视 + // .Where(t=>t.TrialReadingCriterion.IsAutoCreate == false? !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum):true) + + // .Where(y=>y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)) + // .Count(), + + // HaveSignedCount = t.VisitTaskList.Where(t => t.DoctorUserId == _userInfo.Id + // && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) + // && t.ReadingTaskState==ReadingTaskState.HaveSigned).Count() + + // }); + + // 不能对包含聚合或子查询的表达式执行聚合函数 + + //var query = _visitTaskRepository.Where(t => t.DoctorUserId == _userInfo.Id && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze)) + // .GroupBy(t => new { t.TrialId, t.Trial.ResearchProgramNo, t.Trial.TrialCode, t.Trial.ExperimentName, t.TrialReadingCriterionId, t.TrialReadingCriterion.CriterionName, t.TrialReadingCriterion.IsAutoCreate }) + // .Select(g => new IRImageReadingToBeDoneDto() // { - // TrialId = t.Id, - // ResearchProgramNo = t.ResearchProgramNo, - // ExperimentName = t.ExperimentName, - // TrialCode = t.TrialCode, - // UrgentCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - // .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator && u.SubjectVisit.IsUrgent).Count(), - // ToBeDealedCount = t.SubjectVisitList.SelectMany(c => c.QCChallengeList) - // .Where(u => u.IsClosed == false && u.LatestReplyUser.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).Count(), + // TrialId = g.Key.TrialId, + // ResearchProgramNo = g.Key.ResearchProgramNo, + // ExperimentName = g.Key.ExperimentName, + // TrialCode = g.Key.TrialCode, + // CriterionName = g.Key.CriterionName, + // TrialReadingCriterionId = g.Key.TrialReadingCriterionId, + + // //UrgentCount = g.AsQueryable().Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + // // // 前序 不存在 未一致性核查未通过的 + // // .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) + // // //前序 不存在 未生成任务的访视 + // // .Where( t => g.Key.IsAutoCreate ? !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum):true) + + // // .Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)) + // // .Count(t=>t.IsUrgent), + + // UnReadCount = g.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + // // 前序 不存在 未一致性核查未通过的 + // .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) + // //前序 不存在 未生成任务的访视 + // //.WhereIf(g.Key.IsAutoCreate == false, t => !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum)) + // //.Where(t => g.Key.IsAutoCreate ? !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum) : true) + + // .Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)) + // .Count(), + + // HaveSignedCount = g.Where(t => t.DoctorUserId == _userInfo.Id && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze) + // && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count(), // }); + #endregion - var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + + var result = await newQuery.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrEmpty(inQuery.SortField) ? nameof(IRImageReadingToBeDoneDto.TrialId) : inQuery.SortField, inQuery.Asc); + + var toBeDealedCount = _trialRepository + .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .SelectMany(t => t.VisitTaskList) + .Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect) + // 前序 不存在 未一致性核查未通过的 + .Where(t => !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum)) + //前序 不存在 未生成任务的访视 + .Where(t => t.TrialReadingCriterion.IsAutoCreate == false ? !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(d => d.TrialReadingCriterionId == t.TrialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum) : true) + + .Where(y => y.IsFrontTaskNeedSignButNotSign == false && (y.IsNeedClinicalDataSign == false || y.IsClinicalDataSign == true)) + .Count(); + + return ResponseOutput.Ok(result, new { TotalUnReadCount = toBeDealedCount }); } @@ -609,33 +781,46 @@ namespace IRaCIS.Core.Application /// [HttpPost] - public async Task> GetIRMedicalCommentsToBeDoneList(MedicalCommentsToBeDoneQuery inQuery, + public async Task>> GetIRMedicalCommentsToBeDoneList(MedicalCommentsToBeDoneQuery inQuery, [FromServices] IRepository _taskMedicalReviewRepository) { var query = _taskMedicalReviewRepository - .Where(t=>t.IsClosedDialog==false) - .GroupBy(t=>new {t.TrialId, t.Trial.ResearchProgramNo, t.Trial.ExperimentName, t.Trial.TrialCode , - t.VisitTask.TrialReadingCriterionId,t.VisitTask.TrialReadingCriterion.CriterionName}) + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.IsClosedDialog == false) + .GroupBy(t => new + { + t.TrialId, + t.Trial.ResearchProgramNo, + t.Trial.ExperimentName, + t.Trial.TrialCode, + t.VisitTask.TrialReadingCriterionId, + t.VisitTask.TrialReadingCriterion.CriterionName + }) .Select(g => new MedicalCommentsToBeDoneDto() { TrialId = g.Key.TrialId, ResearchProgramNo = g.Key.ResearchProgramNo, ExperimentName = g.Key.ExperimentName, TrialCode = g.Key.TrialCode, - CriterionName=g.Key.CriterionName, + CriterionName = g.Key.CriterionName, + TrialReadingCriterionId = g.Key.TrialReadingCriterionId, + UrgentCount = g.Where(u => u.VisitTask.IsUrgent + && u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.MIM).Count(), - UrgentCount = g.Where(u => u.VisitTask.IsUrgent - && u.ReadingMedicalReviewDialogList.OrderByDescending(l=>l.CreateTime).First().UserTypeEnumInt==(int) UserTypeEnum.MIM).Count(), - - ToBeDealedCount = g.Where(u => + ToBeReplyedCount = g.Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.MIM).Count(), }); var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var toBeDealedCount = _taskMedicalReviewRepository + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.IsClosedDialog == false) + .Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.MIM).Count(); + + return ResponseOutput.Ok(result, new { TotalToBeReUploadCount = toBeDealedCount }); } @@ -653,13 +838,15 @@ namespace IRaCIS.Core.Application /// [HttpPost] - public async Task> GetMIMMedicalCommentsToBeDoneList(MedicalCommentsToBeDoneQuery inQuery, + public async Task>> GetMIMMedicalCommentsToBeDoneList(MedicalCommentsToBeDoneQuery inQuery, [FromServices] IRepository _taskMedicalReviewRepository) { var query = _taskMedicalReviewRepository + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .Where(t => t.IsClosedDialog == false) - .GroupBy(t => new { + .GroupBy(t => new + { t.TrialId, t.Trial.ResearchProgramNo, t.Trial.ExperimentName, @@ -678,15 +865,73 @@ namespace IRaCIS.Core.Application UrgentCount = g.Where(u => u.VisitTask.IsUrgent && u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer).Count(), - ToBeDealedCount = g.Where(u => + ToBeReplyedCount = g.Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer).Count(), }); var result = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField, inQuery.Asc); - return result; + var toBeDealedCount = _taskMedicalReviewRepository + .Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id)) + .Where(t => t.IsClosedDialog == false) + .Where(u => u.ReadingMedicalReviewDialogList.OrderByDescending(l => l.CreateTime).First().UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer).Count(); + return ResponseOutput.Ok(result, new { TotalToBeReUploadCount = toBeDealedCount }); + + } + + #endregion + + + #region 项目列表查询 + + + [HttpPost] + public async Task>> GetTrialToBeDoneList(TrialToBeDoneQuery inQuery, + [FromServices] IRepository _taskMedicalReviewRepository) + { + + var isPM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager; + var isCRC = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator; + var isIQC = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC; + var isMIM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.MIM; + var isSPMOrCPM = _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM; + + + var query = _trialRepository.AsQueryable().IgnoreQueryFilters() + + .WhereIf(inQuery.SponsorId != null, o => o.SponsorId == inQuery.SponsorId) + .WhereIf(!string.IsNullOrEmpty(inQuery.Code), o => o.TrialCode.Contains(inQuery.Code)) + .WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.ResearchProgramNo.Contains(inQuery.ResearchProgramNo)) + .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), o => o.ExperimentName.Contains(inQuery.ExperimentName)) + .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) + .Select(t => new TrialToBeDoneDto() + { + TrialId = t.Id, + ResearchProgramNo = t.ResearchProgramNo, + ExperimentName = t.ExperimentName, + TrialCode = t.TrialCode, + CreateTime=t.CreateTime, + Sponsor= _userInfo.IsEn_Us? t.Sponsor.SponsorName:t.Sponsor.SponsorNameCN, + TrialStatusStr=t.TrialStatusStr, + + ExpetiedTaskCount= isPM ? t.VisitTaskList.Where(t=>t.IsUrgent).Count():0, + ReReadingApprovalCount= isPM? t.VisitTaskReReadingList.Where(t=>t.OriginalReReadingTask.ReReadingApplyState==ReReadingApplyState.DocotorHaveApplyed).Count():0, + PendingReconciliationCount=isPM? t.SubjectVisitList.Where(t=>t.CheckState==CheckStateEnum.ToCheck).Count():0, + + + + + }); + + + + //.ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id }); + + var result= await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? "CreateTime" : inQuery.SortField, inQuery.Asc); + + return ResponseOutput.Ok(result, new { TotalToBeReUploadCount = 0 }); } #endregion diff --git a/IRaCIS.Core.Application/Triggers/VisitTaskIsFrontTaskNeedSignButNotSignTrigger.cs b/IRaCIS.Core.Application/Triggers/VisitTaskIsFrontTaskNeedSignButNotSignTrigger.cs index f528dbd6c..481420b17 100644 --- a/IRaCIS.Core.Application/Triggers/VisitTaskIsFrontTaskNeedSignButNotSignTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/VisitTaskIsFrontTaskNeedSignButNotSignTrigger.cs @@ -50,33 +50,53 @@ namespace IRaCIS.Core.Application.Triggers Expression> visitTaskLambda = x => x.TrialId == visitTask.TrialId && x.SubjectId == visitTask.SubjectId && x.TrialReadingCriterionId == visitTask.TrialReadingCriterionId; if (context.ChangeType == ChangeType.Added) { - + + //判断是否需要临床数据签名 不需要 就不用维护 if (visitTask.IsNeedClinicalDataSign) { - var visitTaskIdQueryable = _visitTaskRepository.Where(visitTaskLambda) //该Subject 该标准的任务 - //小于自己任务号的任务 存在需要签名 但是没签名 - .Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum) - && t.IsFrontTaskNeedSignButNotSign == false) - .Select(t => t.Id); - - await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable.Contains(t.Id), u => new VisitTask() + //有序阅片 IsFrontTaskNeedSignButNotSign 维护才有意义 + if (_trialReadingCriterionRepository.Any(t => t.Id == visitTask.TrialReadingCriterionId && t.IsReadingTaskViewInOrder == true)) { - IsFrontTaskNeedSignButNotSign = true - }); + var visitTaskIdQueryable = _visitTaskRepository.Where(visitTaskLambda) //该Subject 该标准的任务 + //小于自己任务号的任务 存在需要签名 但是没签名 + .Where(t => t.IsFrontTaskNeedSignButNotSign == false && + + (t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum) + + // 前序存在 未一致性核查未通过的 + || t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum) + + )) + .Select(t => t.Id); + + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable.Contains(t.Id), u => new VisitTask() + { + IsFrontTaskNeedSignButNotSign = true + }); - var visitTaskIdQueryable2 = _visitTaskRepository.Where(visitTaskLambda) //该Subject 该标准的任务 - //小于自己任务号的任务 存在需要签名 但是没签名 - .Where(t => !t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum) - && t.IsFrontTaskNeedSignButNotSign == true) - .Select(t => t.Id); + var visitTaskIdQueryable2 = _visitTaskRepository.Where(visitTaskLambda) //该Subject 该标准的任务 + + .Where(t => t.IsFrontTaskNeedSignButNotSign == true && + + //前序任务 不存在需要签名 但是没签名 + !t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum) + + // 前序 不存在 未一致性核查未通过的 + && !t.Subject.SubjectVisitList.Any(sv => sv.CheckState != CheckStateEnum.CVPassed && t.VisitTaskNum > sv.VisitNum) + ) + .Select(t => t.Id); + + await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable2.Contains(t.Id), u => new VisitTask() + { + IsFrontTaskNeedSignButNotSign = false + }); + } + + - await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable2.Contains(t.Id), u => new VisitTask() - { - IsFrontTaskNeedSignButNotSign = false - }); } } diff --git a/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs b/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs index f33650584..55e949d0c 100644 --- a/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs +++ b/IRaCIS.Core.Domain/Allocation/VisitTaskReReading.cs @@ -17,7 +17,7 @@ namespace IRaCIS.Core.Domain.Models [Table("VisitTaskReReading")] public class VisitTaskReReading : Entity, IAuditUpdate, IAuditAdd { - + public Guid TrialId { get; set; } //重阅原始任务Id 重阅会产生新的任务 public Guid OriginalReReadingTaskId { get; set; } diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs index 3a80b6293..c2b745161 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs @@ -261,6 +261,11 @@ namespace IRaCIS.Core.Domain.Models [JsonIgnore] public List TrialCriterionAdditionalAssessmentTypeList { get; set; } = new List(); + + + [JsonIgnore] + + public List VisitTaskList { get; set; } } diff --git a/IRaCIS.Core.Domain/SQLFile/20230613.sql b/IRaCIS.Core.Domain/SQLFile/20230613.sql new file mode 100644 index 000000000..0eafb3ce4 --- /dev/null +++ b/IRaCIS.Core.Domain/SQLFile/20230613.sql @@ -0,0 +1,8 @@ +--同步重阅申请表结构后,再维护该字段 + +UPDATE VisitTaskReReading +SET TrialId = VisitTask.TrialId +FROM VisitTaskReReading +INNER JOIN VisitTask ON VisitTaskReReading.OriginalReReadingTaskId = VisitTask.Id; + +delete VisitTaskReReading where TrialId is NULL \ No newline at end of file diff --git a/IRaCIS.Core.Domain/Trial/Trial.cs b/IRaCIS.Core.Domain/Trial/Trial.cs index ad71a19eb..86afacb29 100644 --- a/IRaCIS.Core.Domain/Trial/Trial.cs +++ b/IRaCIS.Core.Domain/Trial/Trial.cs @@ -27,6 +27,9 @@ namespace IRaCIS.Core.Domain.Models public List SubjectDoctorUserList { get; set; } = new List(); [JsonIgnore] public List VisitTaskList { get; set; } = new List() { }; + + [JsonIgnore] + public List VisitTaskReReadingList { get; set; } [JsonIgnore] public List TrialSiteSurveyList { get; set; } = new List();