Compare commits

...

57 Commits

Author SHA1 Message Date
hang 8521b0c28c 增加清理跟踪的方法
continuous-integration/drone/push Build is passing
2024-06-20 17:50:17 +08:00
hang 26a62426f0 修改发布方式
continuous-integration/drone/push Build is passing
2024-06-20 15:08:47 +08:00
hang 1246413e30 修改nonedicom过滤
continuous-integration/drone/push Build is passing
2024-06-19 19:38:16 +08:00
hang f50b5819c0 修改过滤规则
continuous-integration/drone/push Build is passing
2024-06-19 18:40:32 +08:00
hang 6db8d61b7c 修改 非dicom 检查过滤
continuous-integration/drone/push Build is passing
2024-06-19 17:57:40 +08:00
hang 58250fe993 非dicom zip过滤
continuous-integration/drone/push Build is passing
2024-06-19 16:57:08 +08:00
hang 6cae7a1ae4 修改非dicom 文件上传 增加文件类型
continuous-integration/drone/push Build is passing
2024-06-19 15:17:55 +08:00
hang 73541efbf4 uat 截图修改配置文件
continuous-integration/drone/push Build is passing
2024-06-19 14:17:35 +08:00
hang f4bd891deb 记录最新登录时间
continuous-integration/drone/push Build is passing
2024-06-19 13:48:59 +08:00
hang a9831657cc 修改Uat IRC 配置
continuous-integration/drone/push Build is passing
2024-06-19 13:11:20 +08:00
hang 500a9fbaca 修改配置文件
continuous-integration/drone/push Build is passing
2024-06-19 09:08:17 +08:00
hang 5f11c3a602 修改site 启用时间逻辑
continuous-integration/drone/push Build is passing
2024-06-18 19:36:57 +08:00
hang 7680e90d65 修改添加trialSite逻辑
continuous-integration/drone/push Build is passing
2024-06-18 19:28:26 +08:00
hang 06a57cd056 修改中心调样cpm bug
continuous-integration/drone/push Build is passing
2024-06-18 15:09:52 +08:00
hang 7626d17540 记录邮件异常
continuous-integration/drone/push Build is passing
2024-06-18 13:28:40 +08:00
hang 344b92c427 修改配置文件
continuous-integration/drone/push Build is passing
2024-06-18 13:16:26 +08:00
hang 4719177009 时间环境配置修改
continuous-integration/drone/push Build is passing
2024-06-18 11:53:17 +08:00
hang c1461633ce 修改中心调研国际化
continuous-integration/drone/push Build is passing
2024-06-18 11:10:18 +08:00
hang 6be7aa1ad9 修改默认值
continuous-integration/drone/push Build is passing
2024-06-18 10:28:10 +08:00
hang 4da7c2f960 irc minio 修改配置文件
continuous-integration/drone/push Build is passing
2024-06-17 11:48:09 +08:00
hang 47a45df610 修改mfa 配置
continuous-integration/drone/push Build is passing
2024-06-17 10:38:42 +08:00
hang 1a44e48b2d 删除备注
continuous-integration/drone/push Build is passing
2024-06-17 08:59:53 +08:00
hang c566a703eb 修改trialSitte Id 问题
continuous-integration/drone/push Build is passing
2024-06-14 16:04:12 +08:00
hang 001c248cb8 中心调研返回项目modality
continuous-integration/drone/push Build is passing
2024-06-14 15:35:08 +08:00
hang 654462fe6b 插入字符串efbug
continuous-integration/drone/push Build is passing
2024-06-14 14:34:18 +08:00
hang ab6642ce33 过滤检查
continuous-integration/drone/push Build is passing
2024-06-14 14:29:55 +08:00
hang 946386ad43 检查技术修改
continuous-integration/drone/push Build is passing
2024-06-14 13:46:30 +08:00
hang cf9c79a928 过滤失效的任务
continuous-integration/drone/push Build is passing
2024-06-14 13:28:42 +08:00
hang 493e4e8dca 枚举不能识别
continuous-integration/drone/push Build is passing
2024-06-14 11:05:07 +08:00
hang ecbe8434f3 修改编译问题
continuous-integration/drone/push Build is passing
2024-06-14 10:55:52 +08:00
he 644fe1bd3c Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is failing
2024-06-14 10:52:02 +08:00
he 870fca2e93 修改 2024-06-14 10:52:01 +08:00
hang 6207fb5006 修改MFA 接口
continuous-integration/drone/push Build is failing
2024-06-14 10:38:58 +08:00
hang ae913d8213 修改中心调研国际化
continuous-integration/drone/push Build is passing
2024-06-14 09:18:06 +08:00
hang ce969822a0 字段名错误
continuous-integration/drone/push Build is passing
2024-06-13 17:42:49 +08:00
hang 4fc311d4a5 Merge branch 'Test_IRC_Net8' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is running
2024-06-13 17:42:05 +08:00
hang 2b424ff45c site 调研增加配置字段 2024-06-13 17:42:04 +08:00
he e5d9cfc50e Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
2024-06-13 17:35:19 +08:00
he ac3552818b 修改 2024-06-13 17:35:18 +08:00
hang c004741f95 上传下载 改为不为空
continuous-integration/drone/push Build is passing
2024-06-13 17:08:09 +08:00
hang 2bdc0c7704 修改siteName 国际化
continuous-integration/drone/push Build is passing
2024-06-13 14:57:38 +08:00
hang 35d90d56dd 修改过滤
continuous-integration/drone/push Build is passing
2024-06-13 09:25:26 +08:00
hang f14525ea95 减少赋值字段
continuous-integration/drone/push Build is failing
2024-06-12 17:24:51 +08:00
hang c2350f1418 影像筛选逻辑增加
continuous-integration/drone/push Build is passing
2024-06-12 17:10:22 +08:00
hang 4b8b02fa55 重构检查列表
continuous-integration/drone/push Build is passing
2024-06-12 16:14:14 +08:00
hang 62102b8b03 重构检查列表
continuous-integration/drone/push Build is failing
2024-06-12 16:10:49 +08:00
hang 0655318d2d Merge branch 'Test_IRC_Net8' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
2024-06-12 15:44:00 +08:00
hang 0bd2a10091 修改受试者无序阅片 2024-06-12 15:44:00 +08:00
he ce11788878 修改
continuous-integration/drone/push Build is passing
2024-06-12 15:32:17 +08:00
he 0cb74296c3 修改
continuous-integration/drone/push Build is passing
2024-06-12 15:01:23 +08:00
hang def08b72ca 修改返回列表
continuous-integration/drone/push Build is passing
2024-06-12 14:22:01 +08:00
hang 1ef8d2913b Merge branch 'Test_IRC_Net8' of http://192.168.3.68:2000/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is failing
2024-06-12 14:11:12 +08:00
hang 7e18b1287e 优化代码 2024-06-12 14:11:11 +08:00
he fdcb6ad12f 修改
continuous-integration/drone/push Build is failing
2024-06-12 14:08:18 +08:00
hang 988bf0e92c 修改任务查询
continuous-integration/drone/push Build is passing
2024-06-12 14:03:38 +08:00
he f6612286d9 Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
2024-06-12 13:45:18 +08:00
he c21845c60d 修改 2024-06-12 13:45:17 +08:00
54 changed files with 1266 additions and 1116 deletions
@@ -218,7 +218,7 @@ namespace IRaCIS.Api.Controllers
{ {
//发版屏蔽 //发版屏蔽
returnModel.Data.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(returnModel.Data.BasicInfo)); //returnModel.Data.JWTStr = _tokenService.GetToken(IRaCISClaims.Create(returnModel.Data.BasicInfo));
//MFA 发送邮件 //MFA 发送邮件
@@ -479,6 +479,8 @@ namespace IRaCIS.Core.API.Controllers
public string FilePath { get; set; } public string FilePath { get; set; }
public string FileName { get; set; } public string FileName { get; set; }
public int FileFize { get; set; } public int FileFize { get; set; }
public string FileType { get; set; }
} }
} }
@@ -511,7 +513,7 @@ namespace IRaCIS.Core.API.Controllers
foreach (var item in incommand.UploadedFileList) foreach (var item in incommand.UploadedFileList)
{ {
await _repository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, NoneDicomStudyId = noneDicomStudyId }); await _repository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, NoneDicomStudyId = noneDicomStudyId,FileType=item.FileType });
} }
var uploadFinishedTime = DateTime.Now; var uploadFinishedTime = DateTime.Now;
@@ -30,7 +30,7 @@
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Event_IRC" "ASPNETCORE_ENVIRONMENT": "Event_IRC"
}, },
"applicationUrl": "http://localhost:6101" "applicationUrl": "http://localhost:6100"
}, },
"Docker": { "Docker": {
"commandName": "Docker", "commandName": "Docker",
+5 -2
View File
@@ -43,7 +43,6 @@
"LoginFailLockMinutes": 30, "LoginFailLockMinutes": 30,
"AutoLoginOutMinutes": 60 "AutoLoginOutMinutes": 60
}, },
"SystemEmailSendConfig": { "SystemEmailSendConfig": {
"Port": 465, "Port": 465,
@@ -51,7 +50,11 @@
"FromEmail": "uat@extimaging.com", "FromEmail": "uat@extimaging.com",
"FromName": "UAT_IRC", "FromName": "UAT_IRC",
"AuthorizationCode": "SHzyyl2021", "AuthorizationCode": "SHzyyl2021",
"SiteUrl": "http://irc.event.extimaging.com/login" "SiteUrl": "http://irc.event.extimaging.com/login",
"CompanyName": "Extensive Imaging",
"CompanyNameCN": "上海展影医疗科技有限公司",
"CompanyShortName": "Extensive Imaging",
"CompanyShortNameCN": "展影医疗"
} }
+7 -5
View File
@@ -7,8 +7,8 @@
} }
}, },
"ConnectionStrings": { "ConnectionStrings": {
// "RemoteNew": "Server=47.117.165.18,1434;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true", //"RemoteNew": "Server=101.132.193.237,1434;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
// "Hangfire": "Server=47.117.165.18,1434;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true" //"Hangfire": "Server=101.132.193.237,1434;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
"RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true", "RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true",
"Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true" "Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true"
}, },
@@ -36,14 +36,16 @@
"BasicSystemConfig": { "BasicSystemConfig": {
"OpenUserComplexPassword": true, "OpenUserComplexPassword": true,
"OpenSignDocumentBeforeWork": true, "OpenSignDocumentBeforeWork": true,
"OpenLoginLimit": true, "OpenLoginLimit": true,
"LoginMaxFailCount": 5, "LoginMaxFailCount": 5,
"LoginFailLockMinutes": 30, "LoginFailLockMinutes": 30,
"AutoLoginOutMinutes": 60
"AutoLoginOutMinutes": 60,
"OpenLoginMFA": false
}, },
"SystemEmailSendConfig": { "SystemEmailSendConfig": {
+7 -8
View File
@@ -26,15 +26,14 @@
"viewEndpoint": "https://zy-irc-test-store.oss-cn-shanghai.aliyuncs.com", "viewEndpoint": "https://zy-irc-test-store.oss-cn-shanghai.aliyuncs.com",
"region": "oss-cn-shanghai" "region": "oss-cn-shanghai"
}, },
"MinIO": { "MinIO": {
"endPoint": "192.168.3.68", "endPoint": "hir-oss.test.extimaging.com",
"port": "8001", "port": "443",
"useSSL": false, "useSSL": true,
"accessKey": "IDFkwEpWej0b4DtiuThL", "accessKey": "fbStsVYCIPKHQneeqMwD",
"secretKey": "Lhuu83yMhVwu7c1SnjvGY6lq74jzpYqifK6Qtj4h", "secretKey": "TzgvyA3zGXMUnpilJNUlyMYHfosl1hBMl6lxPmjy",
"bucketName": "test", "bucketName": "irc-test",
"viewEndpoint": "http://192.168.3.68:8001/test/" "viewEndpoint": "https://hir-oss.test.extimaging.com/irc-test"
}, },
"AWS": { "AWS": {
+13 -7
View File
@@ -12,7 +12,7 @@
}, },
"ObjectStoreService": { "ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS", "ObjectStoreUse": "MinIO",
"AliyunOSS": { "AliyunOSS": {
"regionId": "cn-shanghai", "regionId": "cn-shanghai",
@@ -26,12 +26,17 @@
}, },
"MinIO": { "MinIO": {
"endpoint": "http://192.168.3.68", "endPoint": "hir-oss.uat.extimaging.com",
"port": "8001", "port": "80",
"useSSL": false, "useSSL": false,
"accessKey": "IDFkwEpWej0b4DtiuThL", "viewEndpoint": "http://hir-oss.uat.extimaging.com/irc-uat",
"secretKey": "Lhuu83yMhVwu7c1SnjvGY6lq74jzpYqifK6Qtj4h", //"port": "443",
"bucketName": "test" //"useSSL": true,
//"viewEndpoint": "https://hir-oss.uat.extimaging.com/irc-uat",
"accessKey": "b9Ul0e98xPzt6PwRXA1Q",
"secretKey": "DzMaU2L4OXl90uytwOmDXF2encN0Jf4Nxu2XkYqQ",
"bucketName": "irc-uat"
} }
}, },
@@ -45,7 +50,8 @@
"LoginMaxFailCount": 5, "LoginMaxFailCount": 5,
"LoginFailLockMinutes": 30, "LoginFailLockMinutes": 30,
"AutoLoginOutMinutes": 60 "AutoLoginOutMinutes": 60,
"OpenLoginMFA": false
}, },
"SystemEmailSendConfig": { "SystemEmailSendConfig": {
@@ -40,11 +40,11 @@ public static class SendEmailHelper
} }
} }
catch (Exception ) catch (Exception ex)
{ {
//---邮件发送失败,您进行的操作未能成功,请检查邮箱或联系维护人员 //---邮件发送失败,您进行的操作未能成功,请检查邮箱或联系维护人员
throw new Exception(StaticData.International("SendEmail_SendFail")); throw new Exception(StaticData.International("SendEmail_SendFail"),new Exception(ex.Message));
} }
@@ -424,11 +424,11 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.GetOrderReadingIQueryable(IRaCIS.Core.Application.ViewModel.GetOrderReadingIQueryableInDto)"> <member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.GetSubjectReadingIQueryable(IRaCIS.Core.Application.ViewModel.GetReadingIQueryableInDto)">
<summary> <summary>
获取序阅片IQuery对象 获取subject有序 或者无序阅片IQuery对象
</summary> </summary>
<param name="inDto"></param> <param name="inQuery"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.GetIRHaveReadTaskList(IRaCIS.Core.Application.ViewModel.VisitTaskQuery)"> <member name="M:IRaCIS.Core.Application.Service.Allocation.VisitTaskService.GetIRHaveReadTaskList(IRaCIS.Core.Application.ViewModel.VisitTaskQuery)">
@@ -13265,11 +13265,12 @@
<param name="state"></param> <param name="state"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Application.Services.UserService.SendMFAEmail(System.Guid)"> <member name="M:IRaCIS.Application.Services.UserService.SendMFAEmail(System.Guid,System.Int32)">
<summary> <summary>
发送MFA 验证邮件 发送MFA 验证邮件
</summary> </summary>
<param name="userId"></param> <param name="userId"></param>
<param name="mfaType"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:IRaCIS.Application.Services.UserService.VerifyMFACodeAsync(System.Guid,System.String)"> <member name="M:IRaCIS.Application.Services.UserService.VerifyMFACodeAsync(System.Guid,System.String)">
@@ -370,16 +370,16 @@ namespace IRaCIS.Core.Application.ViewModel
} }
public class GetOrderReadingIQueryableInDto public class GetReadingIQueryableInDto:PageInput
{ {
public Guid TrialId { get; set; } public Guid TrialId { get; set; }
public Guid? SubjectId { get; set; }
public Guid TrialReadingCriterionId { get; set; } public Guid TrialReadingCriterionId { get; set; }
public string? SubjectCode { get; set; } = null; public string? SubjectCode { get; set; } = null;
public PageInput? Page { get; set; } = null;
} }
public class VisitTaskQuery : PageInput public class VisitTaskQuery : PageInput
@@ -16,6 +16,6 @@ namespace IRaCIS.Core.Application.Service
Task<IResponseOutput> ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService); Task<IResponseOutput> ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService);
Task<(int, List<IRUnReadSubjectView>)> GetOrderReadingIQueryable(GetOrderReadingIQueryableInDto inDto); Task<PageOutput<IRUnReadSubjectView>> GetSubjectReadingIQueryable(GetReadingIQueryableInDto inDto);
} }
} }
@@ -117,7 +117,7 @@ namespace IRaCIS.Core.Application.Service
var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray); var pageList = await visitTaskQueryable.ToPagedListAsync(queryVisitTask.PageIndex, queryVisitTask.PageSize, queryVisitTask.SortField, queryVisitTask.Asc, string.IsNullOrWhiteSpace(queryVisitTask.SortField), defalutSortArray);
var trialTaskConfig = _repository.Where<Trial>(t => t.Id == queryVisitTask.TrialId).Select(t => new { IsHaveDoubleReadCriterion=t.ReadingQuestionCriterionTrialList.Any(t=>t.IsSigned && t.IsConfirm && t.ReadingType==ReadingMethod.Double), t.VitrualSiteCode }).FirstOrDefault(); var trialTaskConfig = _repository.Where<Trial>(t => t.Id == queryVisitTask.TrialId).Select(t => new { IsHaveDoubleReadCriterion=t.TrialReadingCriterionList.Any(t=>t.IsSigned && t.IsConfirm && t.ReadingType==ReadingMethod.Double), t.VitrualSiteCode }).FirstOrDefault();
return ResponseOutput.Ok(pageList, trialTaskConfig); return ResponseOutput.Ok(pageList, trialTaskConfig);
} }
@@ -22,6 +22,8 @@ using DocumentFormat.OpenXml.Bibliography;
using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto;
using IRaCIS.Core.Domain.Share.Reading; using IRaCIS.Core.Domain.Share.Reading;
using MassTransit; using MassTransit;
using System.Reactive.Subjects;
using Subject = IRaCIS.Core.Domain.Models.Subject;
namespace IRaCIS.Core.Application.Service.Allocation namespace IRaCIS.Core.Application.Service.Allocation
{ {
@@ -957,132 +959,6 @@ namespace IRaCIS.Core.Application.Service.Allocation
var readingTool = criterionConfig.ReadingTool; var readingTool = criterionConfig.ReadingTool;
var isReadingTaskViewInOrder = criterionConfig.IsReadingTaskViewInOrder; var isReadingTaskViewInOrder = criterionConfig.IsReadingTaskViewInOrder;
#region Subject
if (isReadingTaskViewInOrder == ReadingOrder.InOrder)
{
var visitTaskListInfo = await GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto()
{
TrialId = trialId,
TrialReadingCriterionId = trialReadingCriterionId,
SubjectCode = inQuery.SubjectCode,
Page = new PageInput()
{
PageIndex = inQuery.PageIndex,
PageSize = inQuery.PageSize,
Asc = inQuery.Asc,
SortField = inQuery.SortField,
}
});
var totalCount = visitTaskListInfo.Item1;
var currentPageData = visitTaskListInfo.Item2;
var result = new PageOutput<IRUnReadSubjectView>()
{
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 ResponseOutput.Ok(result, new
{
RandomReadInfo = new IRUnReadOutDto(),
IsReadingTaskViewInOrder = isReadingTaskViewInOrder,
ReadingTool = readingTool,
IseCRFShowInDicomReading = criterionConfig.IseCRFShowInDicomReading,
IsReadingShowSubjectInfo = criterionConfig.IsReadingShowSubjectInfo,
IsReadingShowPreviousResults = criterionConfig.IsReadingShowPreviousResults,
DigitPlaces = criterionConfig.DigitPlaces,
CriterionType = criterionConfig.CriterionType,
});
}
else if(isReadingTaskViewInOrder == ReadingOrder.SubjectRandom)
{
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()
{
SubjectId = x.Key.SubjectId,
SubjectCode = x.Key.BlindSubjectCode == string.Empty ? x.Key.Code : x.Key.BlindSubjectCode,
SuggesteFinishedTime = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Min(x => x.SuggesteFinishedTime),
//未读任务量
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),
UnReadCanReadTaskList = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned)
.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()
}).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 );
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>() var result = new PageOutput<IRUnReadSubjectView>()
{ {
@@ -1092,6 +968,41 @@ namespace IRaCIS.Core.Application.Service.Allocation
CurrentPageData = null, CurrentPageData = null,
}; };
IRUnReadOutDto iRUnReadOut = new IRUnReadOutDto();
//subject 级别 有序 无序查询
if (isReadingTaskViewInOrder == ReadingOrder.InOrder || isReadingTaskViewInOrder == ReadingOrder.SubjectRandom)
{
result = await GetSubjectReadingIQueryable(new GetReadingIQueryableInDto()
{
TrialId = trialId,
TrialReadingCriterionId = trialReadingCriterionId,
SubjectCode = inQuery.SubjectCode,
PageIndex = inQuery.PageIndex,
PageSize = inQuery.PageSize,
Asc = inQuery.Asc,
SortField = inQuery.SortField,
});
}
//随机阅片
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);
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(),
};
}
return ResponseOutput.Ok(result, new return ResponseOutput.Ok(result, new
{ {
IsReadingTaskViewInOrder = isReadingTaskViewInOrder, IsReadingTaskViewInOrder = isReadingTaskViewInOrder,
@@ -1104,30 +1015,28 @@ namespace IRaCIS.Core.Application.Service.Allocation
CriterionType = criterionConfig.CriterionType, CriterionType = criterionConfig.CriterionType,
}); });
}
#endregion
} }
/// <summary> /// <summary>
/// 获取序阅片IQuery对象 /// 获取subject有序 或者无序阅片IQuery对象
/// </summary> /// </summary>
/// <param name="inDto"></param> /// <param name="inQuery"></param>
/// <returns></returns> /// <returns></returns>
public async Task<(int, List<IRUnReadSubjectView>)> GetOrderReadingIQueryable(GetOrderReadingIQueryableInDto inDto) public async Task<PageOutput<IRUnReadSubjectView>> GetSubjectReadingIQueryable(GetReadingIQueryableInDto inQuery)
{ {
var trialReadingCriterionId = inDto.TrialReadingCriterionId; var trialReadingCriterionId = inQuery.TrialReadingCriterionId;
var subjectCode = inQuery.SubjectCode;
var trialId = inQuery.TrialId;
var subjectId = inQuery.SubjectId;
var critrion = await _trialReadingCriterionRepository.FindAsync(trialReadingCriterionId); var critrion = await _trialReadingCriterionRepository.FindAsync(trialReadingCriterionId);
if (critrion.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
{
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect)
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect) .WhereIf(inQuery.SubjectId != null, x => x.SubjectId == inQuery.SubjectId)
//前序 不存在 未生成任务的访视 //前序 不存在 未生成任务的访视
.WhereIf(critrion.IsAutoCreate == false, t => !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum)) .WhereIf(critrion.IsAutoCreate == false, t => !t.Subject.SubjectCriteriaEvaluationVisitFilterList.Where(t => t.TrialReadingCriterionId == trialReadingCriterionId).Any(f => f.IsGeneratedTask == false && t.VisitTaskNum > f.SubjectVisit.VisitNum))
@@ -1139,7 +1048,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
//满足前序访视不存在 需要签署但是未签署 sql 相当复杂 同时想查询所有未读的统计数字 就无法统计 byzhouhang //满足前序访视不存在 需要签署但是未签署 sql 相当复杂 同时想查询所有未读的统计数字 就无法统计 byzhouhang
//但是加字段 IsFrontTaskNeedSignButNotSign 那么签名临床数据的时候,要对该subject 该标准的有效的任务 这个字段需要在签名的时候维护 采取这种方式 统计数字灵活 //但是加字段 IsFrontTaskNeedSignButNotSign 那么签名临床数据的时候,要对该subject 该标准的有效的任务 这个字段需要在签名的时候维护 采取这种方式 统计数字灵活
//.Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum)) //.Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum))
.WhereIf(!string.IsNullOrEmpty(inDto.SubjectCode), t => (t.Subject.Code.Contains(inDto.SubjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inDto.SubjectCode!) && t.IsAnalysisCreate)); .WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => (t.Subject.Code.Contains(inQuery.SubjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(inQuery.SubjectCode!) && t.IsAnalysisCreate));
var visitGroupQuery = visitQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode }); var visitGroupQuery = visitQuery.GroupBy(x => new { x.SubjectId, x.Subject.Code, x.BlindSubjectCode });
@@ -1221,22 +1130,112 @@ namespace IRaCIS.Core.Application.Service.Allocation
var result = new List<IRUnReadSubjectView>(); var result = new List<IRUnReadSubjectView>();
var propName = string.IsNullOrWhiteSpace(inDto.Page!.SortField) ? nameof(IRUnReadSubjectView.UnReadCanReadTaskCount) : inDto.Page.SortField; var propName = string.IsNullOrWhiteSpace(inQuery!.SortField) ? nameof(IRUnReadSubjectView.UnReadCanReadTaskCount) : inQuery.SortField;
var visitTaskOrderQuery = inQuery.Asc ? visitTaskQuery.OrderBy(propName) : visitTaskQuery.OrderBy(propName + " desc");
var visitTaskOrderQuery = inDto.Page.Asc ? visitTaskQuery.OrderBy(propName) : visitTaskQuery.OrderBy(propName + " desc");
if (inDto.Page != null)
{
result = await visitTaskOrderQuery result = await visitTaskOrderQuery
.Skip((inDto.Page.PageIndex - 1) * inDto.Page.PageSize) .Skip((inQuery.PageIndex - 1) * inQuery.PageSize)
.Take(inDto.Page.PageSize).ToListAsync(); .Take(inQuery.PageSize).ToListAsync();
return new PageOutput<IRUnReadSubjectView>()
{
PageSize = inQuery.PageSize,
PageIndex = inQuery.PageIndex,
TotalCount = count,
CurrentPageData = result,
};
} }
else else
{ {
result = await visitTaskOrderQuery.ToListAsync();
if (subjectId != null)
{
//找到 非一致性分析,未签名,状态正常的 并且任务名称是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.DoctorUserId == _userInfo.Id
&& t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit);
//已经处理过的任务名称的数量
var haveDealedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id
&& t.ReadingTaskState != ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit && t.TaskBlindName != "Timepoint");
//随机赋值编号 比如要处理5个任务,实例化一个包含1-5的数组,每次随机取出一个
List<int> availableNumbers = Enumerable.Range(haveDealedTaskCount + 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();
}
} }
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect)
.WhereIf(inQuery.SubjectId != null, x => x.SubjectId == inQuery.SubjectId)
.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()
{
SubjectId = x.Key.SubjectId,
SubjectCode = x.Key.BlindSubjectCode == string.Empty ? x.Key.Code : x.Key.BlindSubjectCode,
SuggesteFinishedTime = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned).Min(x => x.SuggesteFinishedTime),
//未读任务量
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),
UnReadCanReadTaskList = x.Where(y => y.TrialReadingCriterionId == trialReadingCriterionId && y.ReadingTaskState != ReadingTaskState.HaveSigned)
.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()
}).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);
return pageList;
}
return (count, result);
} }
@@ -74,7 +74,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<TaskAllocationRule, TaskAllocationRuleDTO>() CreateMap<TaskAllocationRule, TaskAllocationRuleDTO>()
.ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.Enroll.DoctorUser)) .ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.Enroll.DoctorUser))
.ForMember(o => o.CriterionReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Select(t => new TrialCriterionReadingCategory() { EnrollId = t.EnrollId, ReadingCategory = t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId }))) .ForMember(o => o.CriterionReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Select(t => new TrialCriterionReadingCategory() { EnrollId = t.EnrollId, ReadingCategory = t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId })))
.ForMember(o => o.TrialReadingCriterionList, t => t.MapFrom(u => u.Trial.ReadingQuestionCriterionTrialList.Where(t => t.IsConfirm))) .ForMember(o => o.TrialReadingCriterionList, t => t.MapFrom(u => u.Trial.TrialReadingCriterionList.Where(t => t.IsConfirm)))
.ForMember(o => o.ReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Where(t=>t.TrialReadingCriterionId== trialReadingCriterionId).OrderBy(t => t.ReadingCategory).Select(t => t.ReadingCategory).ToList())) .ForMember(o => o.ReadingCategoryList, t => t.MapFrom(u => u.Enroll.EnrollReadingCategoryList.Where(t=>t.TrialReadingCriterionId== trialReadingCriterionId).OrderBy(t => t.ReadingCategory).Select(t => t.ReadingCategory).ToList()))
; ;
@@ -21,7 +21,7 @@ namespace IRaCIS.Application.Services
Task SiteSurveyRejectEmail(MimeMessage messageToSend); Task SiteSurveyRejectEmail(MimeMessage messageToSend);
Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode); Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode, UserMFAType mfaType = UserMFAType.Login);
Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode); Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode);
@@ -94,7 +94,7 @@ namespace IRaCIS.Application.Services
} }
//MFA //MFA
public async Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode) public async Task SenMFAVerifyEmail(Guid userId, string userName, string emailAddress, int verificationCode, UserMFAType mfaType = UserMFAType.Login)
{ {
var messageToSend = new MimeMessage(); var messageToSend = new MimeMessage();
//发件地址 //发件地址
@@ -103,7 +103,7 @@ namespace IRaCIS.Application.Services
messageToSend.To.Add(new MailboxAddress(userName, emailAddress)); messageToSend.To.Add(new MailboxAddress(userName, emailAddress));
//主题 //主题
//---[来自{0}] 关于MFA邮箱验证的提醒 //---[来自{0}] 关于MFA邮箱验证的提醒
messageToSend.Subject = _localizer["Mail_EmailMFATopic", _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN]; messageToSend.Subject = _localizer[mfaType == UserMFAType.Login? "Mail_EmailMFALoginTopic":"Mail_EmailMFAUnlockTopic", _userInfo.IsEn_Us ? _systemEmailConfig.CompanyShortName : _systemEmailConfig.CompanyShortNameCN];
var builder = new BodyBuilder(); var builder = new BodyBuilder();
@@ -123,7 +123,7 @@ namespace IRaCIS.Application.Services
builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo),
userName, userName,
_localizer["Mail_MFAEmail"], _localizer[mfaType == UserMFAType.Login ? "Mail_EmailMFALoginEmail": "Mail_EmailMFAUnlockEmail"],
verificationCode verificationCode
); );
} }
@@ -46,8 +46,8 @@ namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
//存放在instance 上面 //存放在instance 上面
public string WindowCenter { get; set; } = string.Empty; public string? WindowCenter => InstanceInfoList.FirstOrDefault()?.WindowCenter;
public string WindowWidth { get; set; } = string.Empty; public string? WindowWidth => InstanceInfoList.FirstOrDefault()?.WindowWidth;
public string ImageResizePath { get; set; } public string ImageResizePath { get; set; }
} }
@@ -68,6 +68,10 @@ namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
public int ShowOrder { get; set; } public int ShowOrder { get; set; }
[JsonIgnore] [JsonIgnore]
public decimal RowIndex { get; set; } public decimal RowIndex { get; set; }
[JsonIgnore]
public string WindowCenter { get; set; }
[JsonIgnore]
public string WindowWidth { get; set; }
} }
public class DicomSeriesWithLabelDTO : DicomSeriesDTO public class DicomSeriesWithLabelDTO : DicomSeriesDTO
@@ -6,6 +6,7 @@ using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Service.ImageAndDoc.DTO; using IRaCIS.Core.Application.Service.ImageAndDoc.DTO;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Extention;
using MassTransit; using MassTransit;
using MathNet.Numerics; using MathNet.Numerics;
using Medallion.Threading; using Medallion.Threading;
@@ -62,19 +63,25 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
if (_visitTaskRepository.Any(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.TrialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.SubjectRandom)) if (_visitTaskRepository.Any(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.TrialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.SubjectRandom))
{ {
//找到 非一致性分析,未签名,状态正常的 并且任务名称是TimePoint的 任务 //找到 非一致性分析,未签名,状态正常的 并且任务名称是TimePoint的 任务
var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId==_userInfo.Id var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id
&& t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskBlindName == "Timepoint" && t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskBlindName == "Timepoint" && t.ReadingCategory == ReadingCategory.Visit
&& (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze), true).ToListAsync(); && (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze), true).ToListAsync();
if (needDealTaskList.Count>0) if (needDealTaskList.Count > 0)
{ {
//已完成的访视任务数量(包含重阅的) //已完成的访视任务数量(包含重阅的)
var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id
&& t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit); && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit);
//随机赋值编号 比如要处理5个任务,实例化一个包含1-5的数组,每次随机取出一个 //已经处理过的任务名称的数量
List<int> availableNumbers = Enumerable.Range(haveFinishedTaskCount + 1, needDealTaskList.Count).ToList(); var haveDealedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id
&& t.ReadingTaskState != ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit && t.TaskBlindName != "Timepoint");
//随机赋值编号 比如要处理5个任务,实例化一个包含1-5的数组,每次随机取出一个
List<int> availableNumbers = Enumerable.Range(haveDealedTaskCount + haveFinishedTaskCount + 1, needDealTaskList.Count).ToList();
Random rng = new Random(); Random rng = new Random();
foreach (var visitTask in needDealTaskList) foreach (var visitTask in needDealTaskList)
{ {
@@ -96,19 +103,18 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
/// <param name="subjectId"></param> /// <param name="subjectId"></param>
/// <param name="trialReadingCriterionId"></param> /// <param name="trialReadingCriterionId"></param>
/// <returns></returns> /// <returns></returns>
public async Task<IResponseOutput<List<SubjectImageUploadDTO>>> GetSubjectImageUploadList(Guid subjectId,Guid trialReadingCriterionId) public async Task<IResponseOutput<List<SubjectImageUploadDTO>>> GetSubjectImageUploadList(Guid subjectId, Guid trialReadingCriterionId)
{ {
await SubejctRandomReadingTaskNameDeal(subjectId, trialReadingCriterionId); await SubejctRandomReadingTaskNameDeal(subjectId, trialReadingCriterionId);
var query = _repository.Where<VisitTask>(t => t.SubjectId == subjectId &&t.TrialReadingCriterionId== trialReadingCriterionId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id) var query = _repository.Where<VisitTask>(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.SourceSubjectVisitId != null
&& t.DoctorUserId == _userInfo.Id && t.TaskState==TaskState.Effect)
.Select(u => new SubjectImageUploadDTO() .Select(u => new SubjectImageUploadDTO()
{ {
VisitTaskId = u.Id, VisitTaskId = u.Id,
SubejctId = u.SubjectId, SubejctId = u.SubjectId,
TrialSiteId = u.Subject.TrialSiteId, TrialSiteId = u.Subject.TrialSiteId,
IsImageFilter = u.TrialReadingCriterion.IsImageFilter, IsImageFilter = u.TrialReadingCriterion.IsImageFilter,
@@ -122,7 +128,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
SourceSubjectVisitId = u.SourceSubjectVisitId, SourceSubjectVisitId = u.SourceSubjectVisitId,
PackState = u.SourceSubjectVisit.PackState, PackState = u.SourceSubjectVisit.PackState,
OrginalStudyList = u.SourceSubjectVisit.StudyList.Select(t => new StudyBasicInfo() OrginalStudyList = u.SourceSubjectVisit.StudyList
.Where(t => u.TrialReadingCriterion.IsImageFilter ?("|"+u.TrialReadingCriterion.CriterionModalitys+"|").Contains("|"+t.ModalityForEdit+"|" ) : true)
.Select(t => new StudyBasicInfo()
{ {
Id = t.Id, Id = t.Id,
StudyInstanceUid = t.StudyInstanceUid, StudyInstanceUid = t.StudyInstanceUid,
@@ -12,7 +12,7 @@ namespace IRaCIS.Application.Services
Task<IResponseOutput<LoginReturnDTO>> Login(string userName, string password); Task<IResponseOutput<LoginReturnDTO>> Login(string userName, string password);
Task<IResponseOutput> VerifyMFACodeAsync(Guid userId, string Code); Task<IResponseOutput> VerifyMFACodeAsync(Guid userId, string Code);
Task<IResponseOutput> SendMFAEmail(Guid userId); Task<IResponseOutput> SendMFAEmail(Guid userId, int mfaType=0);
Task<UserBasicInfo> GetUserBasicInfo(Guid userId,string pwd); Task<UserBasicInfo> GetUserBasicInfo(Guid userId,string pwd);
Task<IResponseOutput> ModifyPassword(EditPasswordCommand editPwModel); Task<IResponseOutput> ModifyPassword(EditPasswordCommand editPwModel);
Task<IResponseOutput> ResetPassword(Guid userId); Task<IResponseOutput> ResetPassword(Guid userId);
@@ -653,15 +653,16 @@ namespace IRaCIS.Application.Services
/// 发送MFA 验证邮件 /// 发送MFA 验证邮件
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId"></param>
/// <param name="mfaType"></param>
/// <returns></returns> /// <returns></returns>
[AllowAnonymous] [AllowAnonymous]
public async Task<IResponseOutput> SendMFAEmail(Guid userId) public async Task<IResponseOutput> SendMFAEmail(Guid userId, int mfaType )
{ {
var userInfo = await _userRepository.Where(u => u.Id == userId).Select(t => new { t.FullName, t.EMail }).FirstOrDefaultAsync(); var userInfo = await _userRepository.Where(u => u.Id == userId).Select(t => new { t.FullName, t.EMail }).FirstOrDefaultAsync();
int verificationCode = new Random().Next(100000, 1000000); int verificationCode = new Random().Next(100000, 1000000);
await _mailVerificationService.SenMFAVerifyEmail(userId, userInfo.FullName, userInfo.EMail, verificationCode); await _mailVerificationService.SenMFAVerifyEmail(userId, userInfo.FullName, userInfo.EMail, verificationCode, (UserMFAType)mfaType );
return ResponseOutput.Ok(); return ResponseOutput.Ok();
} }
@@ -811,7 +812,8 @@ namespace IRaCIS.Application.Services
await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.Id, x => new User() await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == loginUser.Id, x => new User()
{ {
LastLoginIP = _userInfo.IP LastLoginIP = _userInfo.IP,
LastLoginTime= DateTime.Now
}); });
@@ -20,7 +20,9 @@ namespace IRaCIS.Core.Application.Contracts
public string FullFilePath => Path; public string FullFilePath => Path;
public string PreviewPath => "/Common/LocalFilePreview?relativePath=" + Path; public string FileType { get; set; }
//public string PreviewPath => "/Common/LocalFilePreview?relativePath=" + Path;
} }
@@ -17,7 +17,7 @@ namespace IRaCIS.Core.Application.Contracts
public List<NoneDicomStudyFileView> NoneDicomStudyFileList { get; set; } = new List<NoneDicomStudyFileView>(); public List<NoneDicomStudyFileView> NoneDicomStudyFileList { get; set; } = new List<NoneDicomStudyFileView>();
public List<string> NoneDicomStudyFilePreviewList => NoneDicomStudyFileList.Select(t=> t.PreviewPath).ToList(); //public List<string> NoneDicomStudyFilePreviewList => NoneDicomStudyFileList.Select(t=> t.PreviewPath).ToList();
} }
@@ -16,7 +16,7 @@ namespace IRaCIS.Core.Application.Contracts
Task<IResponseOutput> DeleteNoneDicomStudy(Guid noneDicomStudyId, Guid subjectVisitId); Task<IResponseOutput> DeleteNoneDicomStudy(Guid noneDicomStudyId, Guid subjectVisitId);
Task<IResponseOutput> DeleteNoneDicomStudyFile(Guid noneDicomStudyFileId, Guid subjectVisitId); Task<IResponseOutput> DeleteNoneDicomStudyFile(Guid noneDicomStudyFileId, Guid subjectVisitId);
Task<List<NoneDicomStudyFileView>> GetNoneDicomStudyFileList(Guid noneDicomStudyId); Task<List<NoneDicomStudyFileView>> GetNoneDicomStudyFileList(Guid noneDicomStudyId);
Task<List<NoneDicomStudyView>> GetNoneDicomStudyList(Guid subjectVisitId, Guid? sujectVisitId = null); Task<List<NoneDicomStudyView>> GetNoneDicomStudyList(Guid subjectVisitId, Guid? sujectVisitId = null, bool isFilterZip=false);
Task<List<NoneDicomStudyFileView>> GetVisitNoneDicomStudyFileList(Guid subjectVisitId); Task<List<NoneDicomStudyFileView>> GetVisitNoneDicomStudyFileList(Guid subjectVisitId);
//Task<IResponseOutput> UploadNoneDicomFile(IFormCollection formCollection, Guid subjectVisitId, Guid noneDicomStudyId); //Task<IResponseOutput> UploadNoneDicomFile(IFormCollection formCollection, Guid subjectVisitId, Guid noneDicomStudyId);
@@ -37,12 +37,12 @@ namespace IRaCIS.Core.Application.Contracts
[HttpGet] [HttpGet]
public async Task<List<NoneDicomStudyView>> GetNoneDicomStudyList([FromQuery, NotDefault] Guid subjectVisitId, Guid? nonedicomStudyId) public async Task<List<NoneDicomStudyView>> GetNoneDicomStudyList([FromQuery, NotDefault] Guid subjectVisitId, [FromQuery] Guid? nonedicomStudyId, [FromQuery] bool isFilterZip)
{ {
var noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId).WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId) var noneDicomStudyQueryable = _noneDicomStudyRepository.Where(t => t.SubjectVisitId == subjectVisitId).WhereIf(nonedicomStudyId != null, t => t.Id == nonedicomStudyId)
.ProjectTo<NoneDicomStudyView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken }); .ProjectTo<NoneDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = isFilterZip });
return await noneDicomStudyQueryable.ToListAsync(); return await noneDicomStudyQueryable.ToListAsync();
} }
@@ -932,23 +932,24 @@ namespace IRaCIS.Core.Application.Image.QA
break; break;
case TrialQCProcess.SingleAudit: case TrialQCProcess.SingleAudit:
visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted
&& x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId!= _userInfo.Id&&(x.CurrentActionUserId == _userInfo.Id || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake))) && x.TrialId == inDto.TrialId && x.PreliminaryAuditUserId != _userInfo.Id && (x.CurrentActionUserId == _userInfo.Id || (x.AuditState != AuditStateEnum.PrimaryQCPassed && !x.IsTake)))
.Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y=>!y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.Id) .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.Id)
.Include(x => x.Subject).ToListAsync(); .Include(x => x.Subject).ToListAsync();
subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId) subjectVisit = visitList.Where(x => x.SubjectId == inDto.SubjectId)
.OrderBy(x=>x.VisitNum).FirstOrDefault(); .OrderBy(x => x.VisitNum).FirstOrDefault();
if(subjectVisit!=null) if (subjectVisit != null)
{ {
return new GetNextIQCQualityOutDto() { return new GetNextIQCQualityOutDto()
SubjectId= subjectVisit.SubjectId, {
VisitId= subjectVisit.Id SubjectId = subjectVisit.SubjectId,
VisitId = subjectVisit.Id
}; };
} }
subjectVisit= visitList.OrderBy(x => x.Subject.Code).ThenBy(x=>x.VisitNum).FirstOrDefault(); subjectVisit = visitList.OrderBy(x => x.Subject.Code).ThenBy(x => x.VisitNum).FirstOrDefault();
if (subjectVisit != null) if (subjectVisit != null)
{ {
return new GetNextIQCQualityOutDto() return new GetNextIQCQualityOutDto()
@@ -965,9 +966,9 @@ namespace IRaCIS.Core.Application.Image.QA
case TrialQCProcess.DoubleAudit: case TrialQCProcess.DoubleAudit:
visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.TrialId == inDto.TrialId && visitList = await _subjectVisitRepository.Where(x => x.SubmitState == SubmitStateEnum.Submitted && x.TrialId == inDto.TrialId &&
((x.CurrentActionUserId == _userInfo.Id)||(!x.IsTake&& x.AuditState != AuditStateEnum.QCPassed&& (x.PreliminaryAuditUserId != _userInfo.Id))) ((x.CurrentActionUserId == _userInfo.Id) || (!x.IsTake && x.AuditState != AuditStateEnum.QCPassed && (x.PreliminaryAuditUserId != _userInfo.Id)))
) )
.Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId !=_userInfo.Id) .Where(x => x.QCChallengeList.Count() == 0 || x.QCChallengeList.Where(y => !y.IsClosed).OrderByDescending(x => x.CreateTime).FirstOrDefault().CreateUserId != _userInfo.Id)
.Include(x => x.Subject).ToListAsync(); .Include(x => x.Subject).ToListAsync();
if (subjectVisit != null) if (subjectVisit != null)
{ {
@@ -1214,7 +1215,7 @@ namespace IRaCIS.Core.Application.Image.QA
} }
//同时要根据项目有没有配置Subject 级别临床数据 //同时要根据项目有没有配置Subject 级别临床数据
if (dbSubjectVisitList.Any(t => t.IsBaseLine && !t.IsHaveClinicalData)&&trialinfo.ClinicalInformationTransmissionEnum!=0) if (dbSubjectVisitList.Any(t => t.IsBaseLine && !t.IsHaveClinicalData) && trialinfo.ClinicalInformationTransmissionEnum != 0)
{ {
//---基线没有临床数据,确认提交? //---基线没有临床数据,确认提交?
@@ -1315,38 +1316,13 @@ namespace IRaCIS.Core.Application.Image.QA
return ResponseOutput.NotOk(_localizer["QCOperation_MissingBaselineDate"]); return ResponseOutput.NotOk(_localizer["QCOperation_MissingBaselineDate"]);
} }
//基线 且配置了临床数据 if (_subjectVisitRepository.Where(t => t.Id == dbSubjectVisit.Id).Any(t => (t.StudyList.Count(t => t.ModalityForEdit == "") > 0 ||t.NoneDicomStudyList.Count(t => t.Modality == "")>0) && t.Trial.TrialReadingCriterionList.Count(t => t.IsImageFilter == true) > 0))
//if (trialConfig.ClinicalInformationTransmissionEnum != 0 /*&& dbSubjectVisit.IsBaseLine*//*&&dbSubjectVisit.ClinicalDataSignUserId==null*/) {
//{ //有标准配置了影像筛选,该受试者有检查未设置检查类型,不允许提交
return ResponseOutput.NotOk(_localizer["QCOperation_MissingModality"]);
}
////找到需要确认的PDF 临床数据 如果没有CRC 没有上传 那么就添加一条没有文件的记录
//var crcNeedConfirmClinicalDataSetList = clinicalDataConfirmList.Where(t => t.UploadRole == UploadRole.CRC && t.ClinicalUploadType == ClinicalUploadType.PDF).ToList();
//// 找到CRC 已经自己添加的临床PDF数据文件
//var crcAddClinicalDataIdList = _readingClinicalDataRepository.Where(t => t.ReadingId == dbSubjectVisit.Id && t.ClinicalDataTrialSet.UploadRole == UploadRole.CRC && t.ClinicalDataTrialSet.ClinicalUploadType == ClinicalUploadType.PDF)
// .Select(t => new { t.ClinicalDataTrialSetId }).ToList();
//foreach (var crcNeedConfirmClinicalDataSet in crcNeedConfirmClinicalDataSetList)
//{
// if (!crcAddClinicalDataIdList.Any(t => t.ClinicalDataTrialSetId == crcNeedConfirmClinicalDataSet.Id))
// {
// await _repository.AddAsync(new ReadingClinicalData()
// {
// TrialId = dbSubjectVisit.TrialId,
// SubjectId = dbSubjectVisit.SubjectId,
// ReadingId = dbSubjectVisit.Id,
// ClinicalDataTrialSetId = crcNeedConfirmClinicalDataSet.Id,
// IsVisit = true,
// IsSign = true,
// ReadingClinicalDataState = ReadingClinicalDataStatus.HaveSigned
// });
// }
//}
//已确认临床数据完整性 //已确认临床数据完整性
dbSubjectVisit.IsConfirmedClinicalData = true; dbSubjectVisit.IsConfirmedClinicalData = true;
@@ -1360,35 +1336,14 @@ namespace IRaCIS.Core.Application.Image.QA
}; };
await _readingClinicalDataRepository.UpdatePartialFromQueryAsync(x => await _readingClinicalDataRepository.UpdatePartialFromQueryAsync(x =>
clinicalneedSign.Contains(x.ClinicalDataTrialSet.ClinicalDataLevel)&& clinicalneedSign.Contains(x.ClinicalDataTrialSet.ClinicalDataLevel) &&
x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC && x.ReadingId == dbSubjectVisit.Id && x.IsSign==false, x => new ReadingClinicalData() x.ClinicalDataTrialSet.UploadRole == UploadRole.CRC && x.ReadingId == dbSubjectVisit.Id && x.IsSign == false, x => new ReadingClinicalData()
{ {
IsSign = true, IsSign = true,
ReadingClinicalDataState = ReadingClinicalDataStatus.HaveSigned ReadingClinicalDataState = ReadingClinicalDataStatus.HaveSigned
}); });
//var signSuccess = await _repository.UpdateFromQueryAsync<TrialSign>(t => t.Id == cRCRequestToQCCommand.SignId, u => new TrialSign() { IsCompleted = true });
////现在修改为 提交时 设置签名信息
//dbSubjectVisit.ClinicalDataSignUserId = _userInfo.Id;
//dbSubjectVisit.ClinicalDataSignTime = DateTime.Now;
//那么没有录入 不允许提交
//if (!await _repository.AnyAsync<SubjectVisit>(t => t.PreviousHistoryList.Any() || t.PreviousOtherList.Any() || t.PreviousSurgeryList.Any()))
//{
// return ResponseOutput.NotOk("没有临床数据,不允许提交");
//}
//return ResponseOutput.NotOk("没有签名临床数据,不允许提交");
//}
var maxVisit = await _subjectVisitRepository.Where(t => t.SubjectId == dbSubjectVisit.SubjectId && t.SubmitState == SubmitStateEnum.Submitted) var maxVisit = await _subjectVisitRepository.Where(t => t.SubjectId == dbSubjectVisit.SubjectId && t.SubmitState == SubmitStateEnum.Submitted)
.OrderByDescending(t => t.VisitNum).Select(t => new { t.Id, t.VisitNum }).FirstOrDefaultAsync(); .OrderByDescending(t => t.VisitNum).Select(t => new { t.Id, t.VisitNum }).FirstOrDefaultAsync();
@@ -1411,14 +1366,14 @@ namespace IRaCIS.Core.Application.Image.QA
}); });
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => trialInOrderCriterionIdList.Contains(x.TrialReadingCriterionId)&& x.SubjectId == dbSubjectVisit.SubjectId&& await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => trialInOrderCriterionIdList.Contains(x.TrialReadingCriterionId) && x.SubjectId == dbSubjectVisit.SubjectId &&
dbSubjectVisit.VisitNum<= x.VisitTaskNum && x.VisitTaskNum < Math.Ceiling(dbSubjectVisit.VisitNum+0.01m) // 当前的访视 全局 裁判 及之前 全都加急 dbSubjectVisit.VisitNum <= x.VisitTaskNum && x.VisitTaskNum < Math.Ceiling(dbSubjectVisit.VisitNum + 0.01m) // 当前的访视 全局 裁判 及之前 全都加急
&& x.ReadingTaskState != ReadingTaskState.HaveSigned && x.TaskState == TaskState.Effect, x => new VisitTask() && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.TaskState == TaskState.Effect, x => new VisitTask()
{ {
IsUrgent = true, IsUrgent = true,
TaskUrgentType = TaskUrgentType.PDProgress, TaskUrgentType = TaskUrgentType.PDProgress,
IsCanEditUrgentState=false, IsCanEditUrgentState = false,
}); });
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => trialInOrderCriterionIdList.Contains(x.TrialReadingCriterionId) && x.SubjectId == dbSubjectVisit.SubjectId await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => trialInOrderCriterionIdList.Contains(x.TrialReadingCriterionId) && x.SubjectId == dbSubjectVisit.SubjectId
@@ -1428,7 +1383,7 @@ namespace IRaCIS.Core.Application.Image.QA
IsUrgent = true, IsUrgent = true,
TaskUrgentType = TaskUrgentType.Other, TaskUrgentType = TaskUrgentType.Other,
TaskUrgentRemake= "后续访视设为pd", TaskUrgentRemake = "后续访视设为pd",
IsCanEditUrgentState = false, IsCanEditUrgentState = false,
}); });
} }
@@ -1440,7 +1395,7 @@ namespace IRaCIS.Core.Application.Image.QA
}); });
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => trialInOrderCriterionIdList.Contains(x.TrialReadingCriterionId) && await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => trialInOrderCriterionIdList.Contains(x.TrialReadingCriterionId) &&
x.VisitTaskNum>= dbSubjectVisit.VisitNum && x.VisitTaskNum < Math.Ceiling(dbSubjectVisit.VisitNum + 0.01m) // 当前的访视 全局 裁判 全都加急 x.VisitTaskNum >= dbSubjectVisit.VisitNum && x.VisitTaskNum < Math.Ceiling(dbSubjectVisit.VisitNum + 0.01m) // 当前的访视 全局 裁判 全都加急
&& x.ReadingTaskState != ReadingTaskState.HaveSigned && x.TaskState == TaskState.Effect, x => new VisitTask() && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.TaskState == TaskState.Effect, x => new VisitTask()
{ {
@@ -1464,14 +1419,7 @@ namespace IRaCIS.Core.Application.Image.QA
dbSubjectVisit.IsUrgent = true; dbSubjectVisit.IsUrgent = true;
////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();
//previosSVlist.ForEach(t =>
//{
// t.IsUrgent = true;
//});
} }
@@ -1522,7 +1470,7 @@ namespace IRaCIS.Core.Application.Image.QA
} }
//非基线设置为PD的话 或者设置为末次访视 根据配置自动生成阅片期 //非基线设置为PD的话 或者设置为末次访视 根据配置自动生成阅片期
if (!dbSubjectVisit.IsBaseLine && (dbSubjectVisit.PDState == PDStateEnum.PDProgress || dbSubjectVisit.IsFinalVisit) ) if (!dbSubjectVisit.IsBaseLine && (dbSubjectVisit.PDState == PDStateEnum.PDProgress || dbSubjectVisit.IsFinalVisit))
{ {
//该标准需要添加阅片期 //该标准需要添加阅片期
@@ -1778,7 +1726,7 @@ namespace IRaCIS.Core.Application.Image.QA
} }
await _qcChallengeRepository.UpdatePartialFromQueryAsync(t => t.IsClosed == false&& t.SubjectVisitId==dbSubjectVisit.Id, u => new QCChallenge() { IsClosed = true, ClosedTime=DateTime.Now, CloseResonEnum = QCChallengeCloseEnum.Unresolvable }); await _qcChallengeRepository.UpdatePartialFromQueryAsync(t => t.IsClosed == false && t.SubjectVisitId == dbSubjectVisit.Id, u => new QCChallenge() { IsClosed = true, ClosedTime = DateTime.Now, CloseResonEnum = QCChallengeCloseEnum.Unresolvable });
} }
@@ -254,6 +254,7 @@ namespace IRaCIS.Core.Application.Service
bool isFilterZip = false;
string token = string.Empty; string token = string.Empty;
//一致性核查 //一致性核查
@@ -560,7 +561,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<NoneDicomStudy, NoneDicomStudyView>() CreateMap<NoneDicomStudy, NoneDicomStudyView>()
//.ForMember(d => d.FileCount, u => u.MapFrom(s => s.NoneDicomFileList.Count)) //.ForMember(d => d.FileCount, u => u.MapFrom(s => s.NoneDicomFileList.Count))
.ForMember(d => d.NoneDicomStudyFileList, u => u.MapFrom(s => s.NoneDicomFileList)) .ForMember(d => d.NoneDicomStudyFileList, u => u.MapFrom(s => isFilterZip? s.NoneDicomFileList.Where(t=>!t.FileType.Contains(StaticData.FileType.Zip)): s.NoneDicomFileList))
.ForMember(d => d.CodeView, u => u.MapFrom(s => s.StudyCode)); .ForMember(d => d.CodeView, u => u.MapFrom(s => s.StudyCode));
@@ -299,6 +299,13 @@ namespace IRaCIS.Application.Services
}; };
} }
if (inDto.FilterNoneForm)
{
cRCClinicalDataList = cRCClinicalDataList.Where(x => !(x.ClinicalFromList.Count() == 0 && x.ClinicalUploadType == ClinicalUploadType.Structuring)).ToList();
}
return cRCClinicalDataList; return cRCClinicalDataList;
} }
@@ -158,6 +158,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid? StudyId { get; set; } public Guid? StudyId { get; set; }
public bool FilterNoneForm { get; set; } = false;
} }
@@ -7,6 +7,7 @@ using Panda.DynamicWebApi.Attributes;
using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure;
using Newtonsoft.Json; using Newtonsoft.Json;
using IRaCIS.Core.Domain.Models;
namespace IRaCIS.Application.Services namespace IRaCIS.Application.Services
{ {
@@ -1093,7 +1094,7 @@ namespace IRaCIS.Application.Services
await _readingTableQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => x.TrialCriterionId == trialCriterion.Id); await _readingTableQuestionTrialRepository.BatchDeleteNoTrackingAsync(x => x.TrialCriterionId == trialCriterion.Id);
await _readingTableQuestionTrialRepository.AddRangeAsync(needAddTableDatas); await _readingTableQuestionTrialRepository.AddRangeAsync(_mapper.Map<List<ReadingTableQuestionTrial>>(needAddTableDatas));
#endregion #endregion
} }
@@ -194,10 +194,10 @@ namespace IRaCIS.Application.Services
TaskBlindName = x.VisitTask.TaskBlindName TaskBlindName = x.VisitTask.TaskBlindName
}).ToListAsync(); }).ToListAsync();
} }
else if(inDto.VisitTaskId!=null&&inDto.QuestionType!=null) else if (inDto.VisitTaskId != null && inDto.QuestionType != null)
{ {
var taskInfoList = await _generalCalculateService.GetReadingReportTaskList(inDto.VisitTaskId.Value); var taskInfoList = await _generalCalculateService.GetReadingReportTaskList(inDto.VisitTaskId.Value);
var visitTaskIds = taskInfoList.Where(x=>x.VisitTaskId!= inDto.VisitTaskId.Value).Select(x => x.VisitTaskId).ToList(); var visitTaskIds = taskInfoList.Where(x => x.VisitTaskId != inDto.VisitTaskId.Value).Select(x => x.VisitTaskId).ToList();
result = await _readingTaskQuestionMarkRepository.Where(x => x.ReadingQuestionTrial.QuestionType == inDto.QuestionType && visitTaskIds.Contains(x.VisitTaskId)) result = await _readingTaskQuestionMarkRepository.Where(x => x.ReadingQuestionTrial.QuestionType == inDto.QuestionType && visitTaskIds.Contains(x.VisitTaskId))
.OrderBy(x => x.VisitTask.VisitTaskNum).Select(x => new GetPreviousOtherPicturePathOutDto() .OrderBy(x => x.VisitTask.VisitTaskNum).Select(x => new GetPreviousOtherPicturePathOutDto()
@@ -245,7 +245,7 @@ namespace IRaCIS.Application.Services
[HttpPost] [HttpPost]
public async Task<List<ReadingCustomTagDto>> GetCustomTag(GetCustomTagInDto inQuery) public async Task<List<ReadingCustomTagDto>> GetCustomTag(GetCustomTagInDto inQuery)
{ {
var result= await _readingCustomTagRepository.Where(x => x.VisitTaskId == inQuery.VisitTaskId).ProjectTo<ReadingCustomTagDto>(_mapper.ConfigurationProvider).ToListAsync(); var result = await _readingCustomTagRepository.Where(x => x.VisitTaskId == inQuery.VisitTaskId).ProjectTo<ReadingCustomTagDto>(_mapper.ConfigurationProvider).ToListAsync();
return result; return result;
} }
@@ -270,9 +270,9 @@ namespace IRaCIS.Application.Services
return await _trialDocumentRepository.Where(x => x.TrialId == inDto.TrialId return await _trialDocumentRepository.Where(x => x.TrialId == inDto.TrialId
&& x.TrialDocConfirmedUserList.Any(y => y.ConfirmUserId == _userInfo.Id && y.ConfirmTime != null) && x.TrialDocConfirmedUserList.Any(y => y.ConfirmUserId == _userInfo.Id && y.ConfirmTime != null)
&& x.NeedConfirmedUserTypeList.Any(y => y.NeedConfirmUserTypeId == _userInfo.UserTypeId)) && x.NeedConfirmedUserTypeList.Any(y => y.NeedConfirmUserTypeId == _userInfo.UserTypeId))
.WhereIf(userType== UserTypeEnum.IndependentReviewer, t => t.FileType.Code == "2" || t.FileType.Code == "6") .WhereIf(userType == UserTypeEnum.IndependentReviewer, t => t.FileType.Code == "2" || t.FileType.Code == "6")
.WhereIf(userType == UserTypeEnum.IQC, t => t.FileType.Code == "4" || t.FileType.Code == "5") .WhereIf(userType == UserTypeEnum.IQC, t => t.FileType.Code == "4" || t.FileType.Code == "5")
.WhereIf(!canViewUserType.Contains(userType),t=>false) .WhereIf(!canViewUserType.Contains(userType), t => false)
.IgnoreQueryFilters() .IgnoreQueryFilters()
.Select(x => new GetManualListOutDto() .Select(x => new GetManualListOutDto()
{ {
@@ -590,20 +590,20 @@ namespace IRaCIS.Application.Services
taskQuery = _visitTaskRepository.Where(x => taskInfo.RelatedVisitTaskIdList.Contains(x.Id) || x.Id == taskInfo.Id); taskQuery = _visitTaskRepository.Where(x => taskInfo.RelatedVisitTaskIdList.Contains(x.Id) || x.Id == taskInfo.Id);
} }
var result = await taskQuery.Include(x=>x.Subject).OrderBy(x => x.VisitTaskNum).ThenBy(x => x.TaskState) var result = await taskQuery.Include(x => x.Subject).OrderBy(x => x.VisitTaskNum).ThenBy(x => x.TaskState)
.Select(x => new GetRelatedVisitTaskOutDto() .Select(x => new GetRelatedVisitTaskOutDto()
{ {
TaskBlindName = x.TaskBlindName, TaskBlindName = x.TaskBlindName,
TaskName = x.TaskName, TaskName = x.TaskName,
ReadingTaskState = x.ReadingTaskState, ReadingTaskState = x.ReadingTaskState,
VisitId = x.SourceSubjectVisitId, VisitId = x.SourceSubjectVisitId,
SubjectCode=x.Subject.Code, SubjectCode = x.Subject.Code,
VisitTaskId = x.Id, VisitTaskId = x.Id,
VisitTaskNum = x.VisitTaskNum, VisitTaskNum = x.VisitTaskNum,
IsBaseLineTask = x.SourceSubjectVisitId == baselineVisitId, IsBaseLineTask = x.SourceSubjectVisitId == baselineVisitId,
IsCurrentTask = x.Id == inDto.VisitTaskId, IsCurrentTask = x.Id == inDto.VisitTaskId,
IsConvertedTask=x.IsConvertedTask, IsConvertedTask = x.IsConvertedTask,
IsFirstChangeTask=x.BeforeConvertedTaskId!=null, IsFirstChangeTask = x.BeforeConvertedTaskId != null,
}).ToListAsync(); }).ToListAsync();
@@ -617,7 +617,7 @@ namespace IRaCIS.Application.Services
var visitaskIds = result.Select(x => x.VisitTaskId).ToList(); var visitaskIds = result.Select(x => x.VisitTaskId).ToList();
var otherStudys = await _readingTableAnswerRowInfoRepository.Where(x => visitaskIds.Contains(x.VisitTaskId)) var otherStudys = await _readingTableAnswerRowInfoRepository.Where(x => visitaskIds.Contains(x.VisitTaskId))
.Where(x=>x.CTSeriesId!=null&&x.PTSeriesId!=null) .Where(x => x.CTSeriesId != null && x.PTSeriesId != null)
.Select(x => new .Select(x => new
{ {
x.OtherStudyId, x.OtherStudyId,
@@ -693,8 +693,8 @@ namespace IRaCIS.Application.Services
VisitTaskId = x.Id, VisitTaskId = x.Id,
TaskBlindName = x.TaskBlindName, TaskBlindName = x.TaskBlindName,
TaskName = x.TaskName, TaskName = x.TaskName,
ReadModuleVisitId= x.ReadModule!=null?x.ReadModule.SubjectVisitId:null, ReadModuleVisitId = x.ReadModule != null ? x.ReadModule.SubjectVisitId : null,
VisitName = x.SourceSubjectVisit!=null? x.SourceSubjectVisit.VisitName: x.ReadModule==null?string.Empty: x.ReadModule.SubjectVisit.VisitName, VisitName = x.SourceSubjectVisit != null ? x.SourceSubjectVisit.VisitName : x.ReadModule == null ? string.Empty : x.ReadModule.SubjectVisit.VisitName,
VisitBlindName = x.TaskBlindName, VisitBlindName = x.TaskBlindName,
VisitTaskNum = x.VisitTaskNum, VisitTaskNum = x.VisitTaskNum,
JudgeResultArm = x.JudgeResultTask == null ? null : x.JudgeResultTask.ArmEnum, JudgeResultArm = x.JudgeResultTask == null ? null : x.JudgeResultTask.ArmEnum,
@@ -707,7 +707,7 @@ namespace IRaCIS.Application.Services
if (item.ReadModuleVisitId != null) if (item.ReadModuleVisitId != null)
{ {
item.VisitBlindName = (await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == item.ReadModuleVisitId && x.IsSelfAnalysis == taskInfo.IsSelfAnalysis && 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; x.IsAnalysisCreate == taskInfo.IsAnalysisCreate).Select(x => x.TaskBlindName).FirstOrDefaultAsync()) ?? string.Empty;
} }
} }
@@ -741,7 +741,7 @@ namespace IRaCIS.Application.Services
{ {
VisitTaskId = visitTask.Id, VisitTaskId = visitTask.Id,
SubjectId = visitTask.SubjectId, SubjectId = visitTask.SubjectId,
SubjectCode = visitTask.BlindSubjectCode.IsNullOrEmpty() ? subjectCode??string.Empty : visitTask.BlindSubjectCode, SubjectCode = visitTask.BlindSubjectCode.IsNullOrEmpty() ? subjectCode ?? string.Empty : visitTask.BlindSubjectCode,
ReadingCategory = visitTask.ReadingCategory, ReadingCategory = visitTask.ReadingCategory,
TaskBlindName = visitTask.TaskBlindName, TaskBlindName = visitTask.TaskBlindName,
IsReadingShowPreviousResults = criterionInfo.IsReadingShowPreviousResults, IsReadingShowPreviousResults = criterionInfo.IsReadingShowPreviousResults,
@@ -795,9 +795,9 @@ namespace IRaCIS.Application.Services
} }
if (await _visitTaskRepository.AnyAsync(x => x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId if (await _visitTaskRepository.AnyAsync(x => x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
&&x.IsAnalysisCreate&&taskInfo.IsAnalysisCreate && x.IsAnalysisCreate && taskInfo.IsAnalysisCreate
&&x.SubjectId== taskInfo.SubjectId&&x.TaskState==TaskState.Effect&& && x.SubjectId == taskInfo.SubjectId && x.TaskState == TaskState.Effect &&
((x.ReReadingApplyState==ReReadingApplyState.DocotorHaveApplyed && x.DoctorUserId == taskInfo.DoctorUserId)|| x.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed) ((x.ReReadingApplyState == ReReadingApplyState.DocotorHaveApplyed && x.DoctorUserId == taskInfo.DoctorUserId) || x.ReReadingApplyState == ReReadingApplyState.TrialGroupHaveApplyed)
)) ))
{ {
@@ -825,7 +825,7 @@ namespace IRaCIS.Application.Services
{ {
//await AddDefaultValueToTask(inDto.VisitTaskId); //await AddDefaultValueToTask(inDto.VisitTaskId);
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync(); var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
var result = await GetReadingQuestion(taskInfo.TrialReadingCriterionId, taskInfo.Id, inDto.QuestionClassify,inDto.GroupClassifyList); var result = await GetReadingQuestion(taskInfo.TrialReadingCriterionId, taskInfo.Id, inDto.QuestionClassify, inDto.GroupClassifyList);
@@ -854,7 +854,7 @@ namespace IRaCIS.Application.Services
//排除表格问题 //排除表格问题
var questions = await _readingQuestionTrialRepository var questions = await _readingQuestionTrialRepository
.WhereIf(questionClassify!=null,x=>x.QuestionClassify== questionClassify) .WhereIf(questionClassify != null, x => x.QuestionClassify == questionClassify)
.WhereIf(criterionIdInfo.IseCRFShowInDicomReading, x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table) .WhereIf(criterionIdInfo.IseCRFShowInDicomReading, x => x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
.WhereIf(!criterionIdInfo.IseCRFShowInDicomReading, x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table) .WhereIf(!criterionIdInfo.IseCRFShowInDicomReading, x => x.IsShowInDicom && x.ReadingQuestionCriterionTrialId == trialReadingCriterionId && x.Type != ReadingQestionType.Table)
@@ -892,7 +892,7 @@ namespace IRaCIS.Application.Services
{ {
questions.ForEach(x => questions.ForEach(x =>
{ {
x.IsFirstChangeTask =true; x.IsFirstChangeTask = true;
}); });
} }
} }
@@ -910,7 +910,7 @@ namespace IRaCIS.Application.Services
var groupids = questions.Where(x => x.Type != ReadingQestionType.Group).Select(x => x.GroupId).ToList(); var groupids = questions.Where(x => x.Type != ReadingQestionType.Group).Select(x => x.GroupId).ToList();
var result = questions.Where(x => x.Type == ReadingQestionType.Group && groupids.Contains(x.Id)) var result = questions.Where(x => x.Type == ReadingQestionType.Group && groupids.Contains(x.Id))
.WhereIf(groupClassifyList!=null,x=>x.GroupClassify!=null&& groupClassifyList!=null&& groupClassifyList.Contains(x.GroupClassify.Value)) .WhereIf(groupClassifyList != null, x => x.GroupClassify != null && groupClassifyList != null && groupClassifyList.Contains(x.GroupClassify.Value))
.ToList(); .ToList();
foreach (var item in result) foreach (var item in result)
@@ -972,7 +972,7 @@ namespace IRaCIS.Application.Services
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync(); var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
if (taskInfo.IsConvertedTask &&taskInfo.BeforeConvertedTaskId!=null) if (taskInfo.IsConvertedTask && taskInfo.BeforeConvertedTaskId != null)
{ {
result.ForEach(x => result.ForEach(x =>
{ {
@@ -990,7 +990,8 @@ namespace IRaCIS.Application.Services
var questionMark = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ProjectTo<GetTableAnswerRowInfoOutDto>(_mapper.ConfigurationProvider).ToListAsync(); var questionMark = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ProjectTo<GetTableAnswerRowInfoOutDto>(_mapper.ConfigurationProvider).ToListAsync();
questionMark.ForEach(x => { questionMark.ForEach(x =>
{
x.IsFirstChangeTask = x.VisitTaskId == inDto.VisitTaskId; x.IsFirstChangeTask = x.VisitTaskId == inDto.VisitTaskId;
}); });
@@ -1040,7 +1041,7 @@ namespace IRaCIS.Application.Services
TableAnswers = tableAnswers, TableAnswers = tableAnswers,
TableAnsweRowInfos = tableAnsweRowInfos, TableAnsweRowInfos = tableAnsweRowInfos,
OrganInfos = organList, OrganInfos = organList,
QuestionClassify=inDto.QuestionClassify, QuestionClassify = inDto.QuestionClassify,
} }
@@ -1051,7 +1052,7 @@ namespace IRaCIS.Application.Services
result.PublicPage = questionPage.PublicPage; result.PublicPage = questionPage.PublicPage;
result.BlindName = visitTaskInfo.TaskBlindName; result.BlindName = visitTaskInfo.TaskBlindName;
result.TaskNum = visitTaskInfo.VisitTaskNum; result.TaskNum = visitTaskInfo.VisitTaskNum;
result.QuestionMarkInfoList=await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ProjectTo<QuestionMarkInfo>(_mapper.ConfigurationProvider) result.QuestionMarkInfoList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId).ProjectTo<QuestionMarkInfo>(_mapper.ConfigurationProvider)
.ToListAsync(); .ToListAsync();
var spleenLength = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefaultAsync(); var spleenLength = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.ReadingQuestionTrial.QuestionType == QuestionType.SpleenLength).Select(x => x.Answer).FirstOrDefaultAsync();
@@ -1060,7 +1061,7 @@ namespace IRaCIS.Application.Services
readingTaskState = visitTaskInfo.ReadingTaskState, readingTaskState = visitTaskInfo.ReadingTaskState,
FormType = criterionInfo.FormType, FormType = criterionInfo.FormType,
TaskNum = visitTaskInfo.VisitTaskNum, TaskNum = visitTaskInfo.VisitTaskNum,
SpleenLength= spleenLength, SpleenLength = spleenLength,
}); ; }); ;
} }
@@ -1096,7 +1097,7 @@ namespace IRaCIS.Application.Services
TableAnsweRowInfos = tableAnsweRowInfos, TableAnsweRowInfos = tableAnsweRowInfos,
IsGetallQuestion = true, IsGetallQuestion = true,
OrganInfos = organList, OrganInfos = organList,
QuestionClassify=inDto.QuestionClassify, QuestionClassify = inDto.QuestionClassify,
} }
), new ), new
@@ -1118,7 +1119,7 @@ namespace IRaCIS.Application.Services
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync(); var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialReadingCriterionId).FirstNotNullAsync();
var qusetionList = await _readingQuestionTrialRepository var qusetionList = await _readingQuestionTrialRepository
.WhereIf(inDto.QuestionClassify!=null,x=>x.QuestionClassify==inDto.QuestionClassify) .WhereIf(inDto.QuestionClassify != null, x => x.QuestionClassify == inDto.QuestionClassify)
.Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).ProjectTo<TrialReadQuestionData>(_mapper.ConfigurationProvider, new .Where(x => x.ReadingQuestionCriterionTrialId == inDto.TrialReadingCriterionId).ProjectTo<TrialReadQuestionData>(_mapper.ConfigurationProvider, new
{ {
@@ -1173,7 +1174,7 @@ namespace IRaCIS.Application.Services
} }
if (inDto.TaskId != null ) if (inDto.TaskId != null)
{ {
if (taskInfo.IsConvertedTask) if (taskInfo.IsConvertedTask)
{ {
@@ -1246,18 +1247,18 @@ namespace IRaCIS.Application.Services
&& x.VisitTaskNum < taskInfo.VisitTaskNum && x.VisitTaskNum < taskInfo.VisitTaskNum
&& x.ArmEnum == taskInfo.ArmEnum && x.ArmEnum == taskInfo.ArmEnum
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
&& x.ReadingCategory == ReadingCategory.Visit)||x.Id==taskInfo.BeforeConvertedTaskId && x.ReadingCategory == ReadingCategory.Visit) || x.Id == taskInfo.BeforeConvertedTaskId
).OrderByDescending(x=>x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync(); ).OrderByDescending(x => x.VisitTaskNum).Select(x => x.Id).FirstOrDefaultAsync();
if (criterionInfo.IsReadingTaskViewInOrder != ReadingOrder.InOrder) if (criterionInfo.IsReadingTaskViewInOrder != ReadingOrder.InOrder)
{ {
// 无序的话 不要查 // 无序的话 不要查
laskTaskId = Guid.NewGuid(); laskTaskId = Guid.NewGuid();
} }
lastTaskTableAnswer= await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == laskTaskId).Include(x => x.ReadingTableQuestionTrial).ToListAsync(); lastTaskTableAnswer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == laskTaskId).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
if (taskInfo.BeforeConvertedTaskId!=null ) if (taskInfo.BeforeConvertedTaskId != null)
{ {
isFirstChangeTask = true; isFirstChangeTask = true;
@@ -1326,7 +1327,7 @@ namespace IRaCIS.Application.Services
/// <param name="isFirstChangeTask"></param> /// <param name="isFirstChangeTask"></param>
/// <param name="lastTaskTableAnswer"></param> /// <param name="lastTaskTableAnswer"></param>
/// <param name="TaskId"></param> /// <param name="TaskId"></param>
private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer,bool isFirstChangeTask, List<ReadingTableQuestionAnswer> lastTaskTableAnswer,Guid? TaskId) private async void FindChildQuestion(TrialReadQuestionData item, List<TrialReadQuestionData> questionlists, List<TableQuestionTrial> tableQuestionLists, List<ReadingTableQuestionAnswerInfo> tableAnswers, List<TableAnsweRowInfo> tableAnsweRowInfos, List<OrganInfo> organInfos, List<ReadingTableQuestionAnswer> baseLineTableAnswer, bool isFirstChangeTask, List<ReadingTableQuestionAnswer> lastTaskTableAnswer, Guid? TaskId)
{ {
item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (x.GroupId == item.Id && x.ParentId == null)).ToList(); item.Childrens = questionlists.Where(x => x.ParentId == item.Id || (x.GroupId == item.Id && x.ParentId == null)).ToList();
item.TableQuestions = new TrialReadTableQuestion(); item.TableQuestions = new TrialReadTableQuestion();
@@ -1458,7 +1459,7 @@ namespace IRaCIS.Application.Services
answers.Add("FromMark", rowInfo.FromMark); answers.Add("FromMark", rowInfo.FromMark);
answers.Add("IsDicomReading", rowInfo.IsDicomReading.ToString()); answers.Add("IsDicomReading", rowInfo.IsDicomReading.ToString());
answers.Add("MeasureData", rowInfo == null ? string.Empty : rowInfo.MeasureData); answers.Add("MeasureData", rowInfo == null ? string.Empty : rowInfo.MeasureData);
answers.Add("OtherMeasureData", rowInfo == null|| rowInfo.OtherMeasureData==null ? string.Empty : rowInfo.OtherMeasureData.ToString()); answers.Add("OtherMeasureData", rowInfo == null || rowInfo.OtherMeasureData == null ? string.Empty : rowInfo.OtherMeasureData.ToString());
answers.Add("OtherStudyId", rowInfo == null || rowInfo.OtherStudyId == null ? string.Empty : rowInfo.OtherStudyId.ToString()); answers.Add("OtherStudyId", rowInfo == null || rowInfo.OtherStudyId == null ? string.Empty : rowInfo.OtherStudyId.ToString());
answers.Add("OtherSeriesId", rowInfo == null || rowInfo.OtherSeriesId == null ? string.Empty : rowInfo.OtherSeriesId.ToString()); answers.Add("OtherSeriesId", rowInfo == null || rowInfo.OtherSeriesId == null ? string.Empty : rowInfo.OtherSeriesId.ToString());
answers.Add("OtherInstanceId", rowInfo == null || rowInfo.OtherInstanceId == null ? string.Empty : rowInfo.OtherInstanceId.ToString()); answers.Add("OtherInstanceId", rowInfo == null || rowInfo.OtherInstanceId == null ? string.Empty : rowInfo.OtherInstanceId.ToString());
@@ -1466,11 +1467,11 @@ namespace IRaCIS.Application.Services
answers.Add("OtherNumberOfFrames", rowInfo == null || rowInfo.OtherNumberOfFrames == null ? string.Empty : rowInfo.OtherNumberOfFrames.ToString()); answers.Add("OtherNumberOfFrames", rowInfo == null || rowInfo.OtherNumberOfFrames == null ? string.Empty : rowInfo.OtherNumberOfFrames.ToString());
answers.Add("OtherMarkTool", rowInfo == null || rowInfo.OtherMarkTool == null ? string.Empty : rowInfo.OtherMarkTool.ToString()); answers.Add("OtherMarkTool", rowInfo == null || rowInfo.OtherMarkTool == null ? string.Empty : rowInfo.OtherMarkTool.ToString());
answers.Add("RowIndex", x.ToString()); answers.Add("RowIndex", x.ToString());
answers.Add("RowId", rowInfo==null?string.Empty: rowInfo.Id.ToString()); answers.Add("RowId", rowInfo == null ? string.Empty : rowInfo.Id.ToString());
answers.Add("MarkTool", rowInfo.MarkTool); answers.Add("MarkTool", rowInfo.MarkTool);
answers.Add("StudyId", rowInfo.StudyId.ToString()); answers.Add("StudyId", rowInfo.StudyId.ToString());
answers.Add("OrganInfoId", rowInfo.OrganInfoId.ToString()); answers.Add("OrganInfoId", rowInfo.OrganInfoId.ToString());
answers.Add("IsFristAdd", (rowInfo.FristAddTaskId== TaskId).ToString()); answers.Add("IsFristAdd", (rowInfo.FristAddTaskId == TaskId).ToString());
answers.Add("IsCanEditPosition", rowInfo.IsCanEditPosition.ToString()); answers.Add("IsCanEditPosition", rowInfo.IsCanEditPosition.ToString());
answers.Add("InstanceId", rowInfo == null ? string.Empty : rowInfo.InstanceId.ToString()); answers.Add("InstanceId", rowInfo == null ? string.Empty : rowInfo.InstanceId.ToString());
answers.Add("PTSeriesId", rowInfo == null ? string.Empty : rowInfo.PTSeriesId.ToString()); answers.Add("PTSeriesId", rowInfo == null ? string.Empty : rowInfo.PTSeriesId.ToString());
@@ -1479,7 +1480,7 @@ namespace IRaCIS.Application.Services
answers.Add("IsCurrentTaskAdd", rowInfo == null ? false.ToString() : rowInfo.IsCurrentTaskAdd.ToString()); answers.Add("IsCurrentTaskAdd", rowInfo == null ? false.ToString() : rowInfo.IsCurrentTaskAdd.ToString());
answers.Add("SplitOrMergeLesionName", rowInfo == null ? string.Empty : rowInfo.SplitName.IsNullOrEmpty() ? rowInfo.MergeName : rowInfo.SplitName); answers.Add("SplitOrMergeLesionName", rowInfo == null ? string.Empty : rowInfo.SplitName.IsNullOrEmpty() ? rowInfo.MergeName : rowInfo.SplitName);
answers.Add("SplitOrMergeType", rowInfo == null ? string.Empty : rowInfo.SplitOrMergeType == null ? string.Empty : ((int)rowInfo.SplitOrMergeType).ToString()); answers.Add("SplitOrMergeType", rowInfo == null ? string.Empty : rowInfo.SplitOrMergeType == null ? string.Empty : ((int)rowInfo.SplitOrMergeType).ToString());
answers.Add("LastTaskState", lastTaskTableAnswer.Where(n=>n.QuestionId== item.Id&&n.ReadingTableQuestionTrial.QuestionMark==QuestionMark.State&&n.RowIndex==x).Select(n=>n.Answer).FirstOrDefault()??string.Empty); answers.Add("LastTaskState", lastTaskTableAnswer.Where(n => n.QuestionId == item.Id && n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.State && n.RowIndex == x).Select(n => n.Answer).FirstOrDefault() ?? string.Empty);
answers.Add("LastTaskMajorAxis", lastTaskTableAnswer.Where(n => n.QuestionId == item.Id && n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis && n.RowIndex == x).Select(n => n.Answer).FirstOrDefault() ?? string.Empty); answers.Add("LastTaskMajorAxis", lastTaskTableAnswer.Where(n => n.QuestionId == item.Id && n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis && n.RowIndex == x).Select(n => n.Answer).FirstOrDefault() ?? string.Empty);
answers.Add("LastTaskShortAxis", lastTaskTableAnswer.Where(n => n.QuestionId == item.Id && n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis && n.RowIndex == x).Select(n => n.Answer).FirstOrDefault() ?? string.Empty); answers.Add("LastTaskShortAxis", lastTaskTableAnswer.Where(n => n.QuestionId == item.Id && n.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis && n.RowIndex == x).Select(n => n.Answer).FirstOrDefault() ?? string.Empty);
if (rowInfo.LesionType == LesionType.BaselineLesions) if (rowInfo.LesionType == LesionType.BaselineLesions)
@@ -1535,7 +1536,7 @@ namespace IRaCIS.Application.Services
rowAnswer.SeriesId = null; rowAnswer.SeriesId = null;
rowAnswer.IsCurrentTaskAdd = true; rowAnswer.IsCurrentTaskAdd = true;
rowAnswer.MeasureData = string.Empty; rowAnswer.MeasureData = string.Empty;
rowAnswer.OtherMeasureData =null; rowAnswer.OtherMeasureData = null;
List<QuestionMark?> needSaveMark = new List<QuestionMark?>() List<QuestionMark?> needSaveMark = new List<QuestionMark?>()
{ {
@@ -1596,7 +1597,7 @@ namespace IRaCIS.Application.Services
}; };
tableAnswers.ForEach(x => tableAnswers.ForEach(x =>
{ {
x.Answer = needSetNa.Contains(x.QuestionMark) ?"NA" :x.Answer; x.Answer = needSetNa.Contains(x.QuestionMark) ? "NA" : x.Answer;
}); });
break; break;
} }
@@ -1630,17 +1631,17 @@ namespace IRaCIS.Application.Services
Answer = TargetState.Loss.GetEnumInt(), Answer = TargetState.Loss.GetEnumInt(),
}); });
await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => inDto.MergeRowIdList.Contains(x.RowId) &&( x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis || x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis), x => new ReadingTableQuestionAnswer() await _readingTableQuestionAnswerRepository.BatchUpdateNoTrackingAsync(x => inDto.MergeRowIdList.Contains(x.RowId) && (x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.MajorAxis || x.ReadingTableQuestionTrial.QuestionMark == QuestionMark.ShortAxis), x => new ReadingTableQuestionAnswer()
{ {
Answer = "0", Answer = "0",
}); });
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(x=> inDto.MergeRowIdList.Contains(x.Id), x => new ReadingTableAnswerRowInfo() await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(x => inDto.MergeRowIdList.Contains(x.Id), x => new ReadingTableAnswerRowInfo()
{ {
MergeRowId=inDto.MergeMainRowId, MergeRowId = inDto.MergeMainRowId,
SplitOrMergeType = SplitOrMergeType.Merge, SplitOrMergeType = SplitOrMergeType.Merge,
}) ; });
await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(inDto.MergeMainRowId, x => new ReadingTableAnswerRowInfo() await _readingTableAnswerRowInfoRepository.UpdatePartialFromQueryAsync(inDto.MergeMainRowId, x => new ReadingTableAnswerRowInfo()
{ {
@@ -1677,7 +1678,7 @@ namespace IRaCIS.Application.Services
[HttpPost] [HttpPost]
public async Task<List<GetCanMergeLesionOutDto>> GetCanMergeLesion(GetCanMergeLesionInDto inDto) public async Task<List<GetCanMergeLesionOutDto>> GetCanMergeLesion(GetCanMergeLesionInDto inDto)
{ {
var rowinfo = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).Include(x=>x.ReadingQuestionTrial).FirstNotNullAsync(); var rowinfo = await _readingTableAnswerRowInfoRepository.Where(x => x.Id == inDto.RowId).Include(x => x.ReadingQuestionTrial).FirstNotNullAsync();
var taskInfo = await _visitTaskRepository.Where(x => x.Id == rowinfo.VisitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync(); var taskInfo = await _visitTaskRepository.Where(x => x.Id == rowinfo.VisitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
// 需要排除的状态 // 需要排除的状态
@@ -1685,7 +1686,7 @@ namespace IRaCIS.Application.Services
var query = _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == rowinfo.VisitTaskId && x.QuestionId == rowinfo.QuestionId && x.Id != rowinfo.Id) var query = _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == rowinfo.VisitTaskId && x.QuestionId == rowinfo.QuestionId && x.Id != rowinfo.Id)
.Where(x => x.SplitOrMergeType != SplitOrMergeType.Split && x.SplitOrMergeType != SplitOrMergeType.SplitMain .Where(x => x.SplitOrMergeType != SplitOrMergeType.Split && x.SplitOrMergeType != SplitOrMergeType.SplitMain
&&x.SplitOrMergeType!=SplitOrMergeType.Merge && x.SplitOrMergeType != SplitOrMergeType.MergeMain && x.SplitOrMergeType != SplitOrMergeType.Merge && x.SplitOrMergeType != SplitOrMergeType.MergeMain
&& x.SplitOrMergeType != SplitOrMergeType.Merged); && x.SplitOrMergeType != SplitOrMergeType.Merged);
switch (taskInfo.TrialReadingCriterion.CriterionType) switch (taskInfo.TrialReadingCriterion.CriterionType)
@@ -1714,7 +1715,7 @@ namespace IRaCIS.Application.Services
RowIndex = x.RowIndex, RowIndex = x.RowIndex,
OrderMarkName = x.ReadingQuestionTrial.OrderMark + x.RowIndex.GetLesionMark(), OrderMarkName = x.ReadingQuestionTrial.OrderMark + x.RowIndex.GetLesionMark(),
OrganInfoId = x.OrganInfoId OrganInfoId = x.OrganInfoId
}).OrderBy(x=>x.RowIndex).ToListAsync(); }).OrderBy(x => x.RowIndex).ToListAsync();
var organIds = result.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList(); var organIds = result.Where(x => x.OrganInfoId != null).Select(x => x.OrganInfoId).Distinct().ToList();
var organList = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync(); var organList = await _organInfoRepository.Where(x => organIds.Contains(x.Id)).ToListAsync();
@@ -1824,10 +1825,11 @@ namespace IRaCIS.Application.Services
if (tumorAnswer != null) if (tumorAnswer != null)
{ {
var isConvertedTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.IsConvertedTask).FirstOrDefaultAsync(); var isConvertedTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.IsConvertedTask).FirstOrDefaultAsync();
var reportVerify = await _readingCalculateService.GetReportVerify(new GetReportVerifyInDto() { var reportVerify = await _readingCalculateService.GetReportVerify(new GetReportVerifyInDto()
BeforeConvertedTaskId= taskInfo.BeforeConvertedTaskId, {
IsConvertTask= isConvertedTask, BeforeConvertedTaskId = taskInfo.BeforeConvertedTaskId,
VisitTaskId=inDto.VisitTaskId IsConvertTask = isConvertedTask,
VisitTaskId = inDto.VisitTaskId
}); });
if (tumorAnswer.Answer == reportVerify.TumorEvaluate) if (tumorAnswer.Answer == reportVerify.TumorEvaluate)
@@ -1883,14 +1885,14 @@ namespace IRaCIS.Application.Services
{ {
PicturePath = string.Empty, PicturePath = string.Empty,
MeasureData = string.Empty, MeasureData = string.Empty,
}) ; });
await _readingTaskQuestionMarkRepository.BatchUpdateNoTrackingAsync(x => await _readingTaskQuestionMarkRepository.BatchUpdateNoTrackingAsync(x =>
(x.QuestionType == QuestionType.LiverSUVmax || x.QuestionType == QuestionType.MediastinumSUVmax) && (x.QuestionType == QuestionType.LiverSUVmax || x.QuestionType == QuestionType.MediastinumSUVmax) &&
x.VisitTaskId == inDto.VisitTaskId && needDeleteMarkQuestonIds.Contains(x.QuestionId), x => new ReadingTaskQuestionMark() x.VisitTaskId == inDto.VisitTaskId && needDeleteMarkQuestonIds.Contains(x.QuestionId), x => new ReadingTaskQuestionMark()
{ {
OtherPicturePath = string.Empty, OtherPicturePath = string.Empty,
OtherMeasureData=string.Empty, OtherMeasureData = string.Empty,
}); });
@@ -1899,7 +1901,8 @@ namespace IRaCIS.Application.Services
var datetime = DateTime.Now; var datetime = DateTime.Now;
var markList = _mapper.Map<List<QuestionMarkInfo>, List<ReadingTaskQuestionMark>>(inDto.QuestionMarkInfoList); var markList = _mapper.Map<List<QuestionMarkInfo>, List<ReadingTaskQuestionMark>>(inDto.QuestionMarkInfoList);
markList.ForEach(x => { markList.ForEach(x =>
{
x.Id = NewId.NextGuid(); x.Id = NewId.NextGuid();
x.VisitTaskId = inDto.VisitTaskId; x.VisitTaskId = inDto.VisitTaskId;
x.CreateTime = datetime; x.CreateTime = datetime;
@@ -2083,7 +2086,7 @@ namespace IRaCIS.Application.Services
{ {
IsChangeOtherTask = false, IsChangeOtherTask = false,
VisitTaskId = inDto.VisitTaskId, VisitTaskId = inDto.VisitTaskId,
ComputationTrigger=ComputationTrigger.RemoveLesion, ComputationTrigger = ComputationTrigger.RemoveLesion,
}); });
@@ -2444,7 +2447,7 @@ namespace IRaCIS.Application.Services
} }
else else
{ {
await _readingTableAnswerRowInfoRepository.UpdateFromDTOAsync(inDto) ; await _readingTableAnswerRowInfoRepository.UpdateFromDTOAsync(inDto);
foreach (var item in inDto.AnswerList) foreach (var item in inDto.AnswerList)
@@ -2629,9 +2632,9 @@ namespace IRaCIS.Application.Services
// 转化后的任务不应该有新病灶 // 转化后的任务不应该有新病灶
var isConvertedTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x=>x.IsConvertedTask).FirstNotNullAsync(); var isConvertedTask = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.IsConvertedTask).FirstNotNullAsync();
if (isConvertedTask&&(await _readingTableAnswerRowInfoRepository.AnyAsync(x => x.ReadingQuestionTrial.LesionType == LesionType.NewLesions && x.VisitTaskId == inDto.VisitTaskId))) if (isConvertedTask && (await _readingTableAnswerRowInfoRepository.AnyAsync(x => x.ReadingQuestionTrial.LesionType == LesionType.NewLesions && x.VisitTaskId == inDto.VisitTaskId)))
{ {
throw new BusinessValidationFailedException(_localizer["ReadingImage_NotNewFocus"]); throw new BusinessValidationFailedException(_localizer["ReadingImage_NotNewFocus"]);
} }
@@ -2741,16 +2744,14 @@ namespace IRaCIS.Application.Services
} }
else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.InOrder) else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
{ {
var subjectTaskList = (await _visitTaskService.GetOrderReadingIQueryable(new GetOrderReadingIQueryableInDto() var subjectTaskList = (await _visitTaskService.GetSubjectReadingIQueryable(new GetReadingIQueryableInDto()
{ {
TrialId = inDto.TrialId, TrialId = inDto.TrialId,
TrialReadingCriterionId = trialReadingCriterionId!.Value, TrialReadingCriterionId = trialReadingCriterionId!.Value,
Page = new PageInput()
{
PageIndex = 1, PageIndex = 1,
PageSize = 99999, PageSize = 99999,
}
})).Item2; })).CurrentPageData;
var index = 0; var index = 0;
subjectTaskList.ForEach(x => subjectTaskList.ForEach(x =>
@@ -2783,6 +2784,46 @@ namespace IRaCIS.Application.Services
}
else if (inDto.SubjectId != null && trialReadingCriterion.IsReadingTaskViewInOrder == ReadingOrder.SubjectRandom)
{
var subjectTaskList = (await _visitTaskService.GetSubjectReadingIQueryable(new GetReadingIQueryableInDto()
{
TrialId = inDto.TrialId,
SubjectId = inDto.SubjectId,
TrialReadingCriterionId = trialReadingCriterionId!.Value,
PageIndex = 1,
PageSize = 99999,
})).CurrentPageData;
if (subjectTaskList.Count() == 0)
{
throw new BusinessValidationFailedException(_localizer["ReadingImage_TaskFinish"], ApiResponseCodeEnum.CloseCurrentWindows);
}
var taskList = subjectTaskList.FirstOrDefault()!.UnReadCanReadTaskList;
Random random = new Random();
//返回的范围是 0- taskList.Count-1
int randomIndex = random.Next(taskList.Count);
var visitTaskId = taskList[randomIndex].Id;
task = await _visitTaskRepository.Where(x=>x.Id== visitTaskId).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,
}).FirstOrDefaultAsync();
} }
else else
{ {
@@ -2918,7 +2959,7 @@ namespace IRaCIS.Application.Services
{ {
return; return;
} }
var startReadingTimeKey = _userInfo.Id.ToString()+ "StartReadingTime"; var startReadingTimeKey = _userInfo.Id.ToString() + "StartReadingTime";
var startRestTimeKey = _userInfo.Id.ToString() + "StartRestTime"; var startRestTimeKey = _userInfo.Id.ToString() + "StartRestTime";
int readingMinute = 120; // 为60整数 int readingMinute = 120; // 为60整数
@@ -2935,7 +2976,7 @@ namespace IRaCIS.Application.Services
int timespanMin = (DateTime.Now - cacheStartRestTime).Minutes; int timespanMin = (DateTime.Now - cacheStartRestTime).Minutes;
if (timespanMin <= restMinute) if (timespanMin <= restMinute)
{ {
throw new BusinessValidationFailedException(_localizer["ReadingImage_NeedRest", readingMinute/60m, restMinute]); throw new BusinessValidationFailedException(_localizer["ReadingImage_NeedRest", readingMinute / 60m, restMinute]);
} }
else else
{ {
@@ -2970,7 +3011,7 @@ namespace IRaCIS.Application.Services
[HttpPost] [HttpPost]
public async Task ResetReadingRestTime(Guid? userID) public async Task ResetReadingRestTime(Guid? userID)
{ {
if(userID == null) if (userID == null)
{ {
userID = _userInfo.Id; userID = _userInfo.Id;
} }
@@ -3015,9 +3056,9 @@ namespace IRaCIS.Application.Services
bool isConverted = false; bool isConverted = false;
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x=>x.TrialReadingCriterion).FirstNotNullAsync(); var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
var isConvertedTask=await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x=>x.IsConvertedTask).FirstNotNullAsync(); var isConvertedTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x => x.IsConvertedTask).FirstNotNullAsync();
switch (taskinfo.TrialReadingCriterion.CriterionType) switch (taskinfo.TrialReadingCriterion.CriterionType)
{ {
case CriterionType.IRECIST1Point1: case CriterionType.IRECIST1Point1:
@@ -3026,7 +3067,7 @@ namespace IRaCIS.Application.Services
if (!isConvertedTask && if (!isConvertedTask &&
(await _readingTaskQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId (await _readingTaskQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId
&& x.ReadingQuestionTrial.QuestionType == QuestionType.Tumor && x.Answer==(((int)OverallAssessment.PD)).ToString())) && x.ReadingQuestionTrial.QuestionType == QuestionType.Tumor && x.Answer == (((int)OverallAssessment.PD)).ToString()))
) )
{ {
@@ -3121,7 +3162,7 @@ namespace IRaCIS.Application.Services
x.DoctorUserId == taskInfo.DoctorUserId && x.DoctorUserId == taskInfo.DoctorUserId &&
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId &&
x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ReadingTaskState == ReadingTaskState.HaveSigned &&
(x.TaskState == TaskState.Effect||x.TaskState==TaskState.Freeze) && (x.TaskState == TaskState.Effect || x.TaskState == TaskState.Freeze) &&
x.IsSelfAnalysis == taskInfo.IsSelfAnalysis && x.IsSelfAnalysis == taskInfo.IsSelfAnalysis &&
x.IsAnalysisCreate == taskInfo.IsAnalysisCreate && x.IsAnalysisCreate == taskInfo.IsAnalysisCreate &&
x.ReadingCategory == taskInfo.ReadingCategory && x.ReadingCategory == taskInfo.ReadingCategory &&
@@ -3224,7 +3265,7 @@ namespace IRaCIS.Application.Services
case ReadingCategory.Visit: case ReadingCategory.Visit:
needReadList = await _readModuleRepository.Where(x => x.SubjectVisitId == taskInfo.SourceSubjectVisitId && needReadList = await _readModuleRepository.Where(x => x.SubjectVisitId == taskInfo.SourceSubjectVisitId &&
x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId ) x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId)
.Select(x => new ReadingGenerataTaskDTO .Select(x => new ReadingGenerataTaskDTO
{ {
IsUrgent = x.IsUrgent ?? false, IsUrgent = x.IsUrgent ?? false,
@@ -3237,7 +3278,7 @@ namespace IRaCIS.Application.Services
if (needReadList.Any(x => x.ReadingCategory == ReadingCategory.Global)&& taskInfo.TrialReadingCriterion.IsGlobalReading) if (needReadList.Any(x => x.ReadingCategory == ReadingCategory.Global) && taskInfo.TrialReadingCriterion.IsGlobalReading)
{ {
needReadList = needReadList.Where(x => x.ReadingCategory != ReadingCategory.Oncology).ToList(); needReadList = needReadList.Where(x => x.ReadingCategory != ReadingCategory.Oncology).ToList();
await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand() await _visitTaskHelpeService.AddTaskAsync(new GenerateTaskCommand()
@@ -3254,7 +3295,7 @@ namespace IRaCIS.Application.Services
// 添加肿瘤学 // 添加肿瘤学
if (await _visitTaskRepository.AnyAsync(x => x.Id == visitTaskId && x.JudgeVisitTaskId == null)) if (await _visitTaskRepository.AnyAsync(x => x.Id == visitTaskId && x.JudgeVisitTaskId == null))
{ {
await AddOncologyTask(needReadList.Where(x=> x.ReadingCategory == ReadingCategory.Oncology).First().ReadModuleId); await AddOncologyTask(needReadList.Where(x => x.ReadingCategory == ReadingCategory.Oncology).First().ReadModuleId);
} }
} }
//needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList(); //needReadList = needReadList.Where(x => _visitTaskRepository.Where(y => y.SouceReadModuleId == x.ReadModuleId).Count() == 0).ToList();
@@ -66,7 +66,7 @@ namespace IRaCIS.Application.Services
/// <param name="inDto"></param> /// <param name="inDto"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public async Task<(List<NoneDicomStudyView>, object)> GetReadingImageFile(GetReadingImgInDto inDto) public async Task<IResponseOutput<List<NoneDicomStudyView>> > GetReadingImageFile(GetReadingImgInDto inDto)
{ {
var task = await GetNextTask(new GetNextTaskInDto() var task = await GetNextTask(new GetNextTaskInDto()
{ {
@@ -84,8 +84,8 @@ namespace IRaCIS.Application.Services
// 阅片期取前面所有的图像 // 阅片期取前面所有的图像
visitIds.AddRange(await _subjectVisitRepository.Where(x => x.VisitNum <= task.VisitNum && x.SubjectId == task.SubjectId).Select(x => x.Id).ToListAsync()); visitIds.AddRange(await _subjectVisitRepository.Where(x => x.VisitNum <= task.VisitNum && x.SubjectId == task.SubjectId).Select(x => x.Id).ToListAsync());
} }
List<NoneDicomStudyView> result = await _noneDicomStudyRepository.Where(t => visitIds.Contains(t.SubjectVisitId)) List<NoneDicomStudyView> result = await _noneDicomStudyRepository.Where(t => visitIds.Contains(t.SubjectVisitId) && t.NoneDicomFileList.Any(t=>!t.FileType.Contains(StaticData.FileType.Zip)))
.ProjectTo<NoneDicomStudyView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken }).ToListAsync(); .ProjectTo<NoneDicomStudyView>(_mapper.ConfigurationProvider, new { isFilterZip = true }).ToListAsync();
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisistTaskId).FirstNotNullAsync(); var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisistTaskId).FirstNotNullAsync();
@@ -121,7 +121,7 @@ namespace IRaCIS.Application.Services
var taskInfo = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).FirstNotNullAsync(); var taskInfo = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).FirstNotNullAsync();
return (result, new return ResponseOutput.Ok (result, new
{ {
VisitTaskId = task.VisitTaskId, VisitTaskId = task.VisitTaskId,
SubjectId = task.SubjectId, SubjectId = task.SubjectId,
@@ -500,7 +500,7 @@ namespace IRaCIS.Application.Services
var existsBubjectVisitsQuery = _readModuleRepository.Where(y => y.ReadingSetType == inDto.ReadingSetType && y.TrialId == inDto.TrialId && y.TrialReadingCriterionId == inDto.TrialReadingCriterionId).Select(x => x.SubjectVisitId); var existsBubjectVisitsQuery = _readModuleRepository.Where(y => y.ReadingSetType == inDto.ReadingSetType && y.TrialId == inDto.TrialId && y.TrialReadingCriterionId == inDto.TrialReadingCriterionId).Select(x => x.SubjectVisitId);
visitQuery = visitQuery.Where(x => !existsBubjectVisitsQuery.Contains(x.Id)) visitQuery = visitQuery.Where(x => !existsBubjectVisitsQuery.Contains(x.Id))
.WhereIf(inDto.ExpirationDate != null, x => x.LatestScanDate <= inDto.ExpirationDate.Value) .WhereIf(inDto.ExpirationDate != null, x => x.LatestScanDate < inDto.ExpirationDate.Value.AddDays(1))
.WhereIf(inDto.ExpirationVisitNum != null, x => x.VisitNum == inDto.ExpirationVisitNum) .WhereIf(inDto.ExpirationVisitNum != null, x => x.VisitNum == inDto.ExpirationVisitNum)
.WhereIf(inDto.ReadingSetType == ReadingSetType.TumorReading, x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.ReadingSetType == ReadingSetType.ImageReading).Count() > 0); .WhereIf(inDto.ReadingSetType == ReadingSetType.TumorReading, x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.ReadingSetType == ReadingSetType.ImageReading).Count() > 0);
@@ -232,6 +232,9 @@ namespace IRaCIS.Core.Application.Service
CreateMap<ReadingTableQuestionTrial, ReadingTrialTableQuestionData>() CreateMap<ReadingTableQuestionTrial, ReadingTrialTableQuestionData>()
.ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id)); .ForMember(d => d.OriginalId, u => u.MapFrom(s => s.Id));
CreateMap<ReadingTrialTableQuestionData, ReadingTableQuestionTrial>();
CreateMap<ReadingQuestionCriterionSystem, ReadingQuestionCriterionTrial>() CreateMap<ReadingQuestionCriterionSystem, ReadingQuestionCriterionTrial>()
.ForMember(dest => dest.ReadingQuestionTrialList, opt => opt.Ignore()) .ForMember(dest => dest.ReadingQuestionTrialList, opt => opt.Ignore())
.ForMember(d => d.ReadingQuestionCriterionSystemId, u => u.MapFrom(s => s.Id)); ; .ForMember(d => d.ReadingQuestionCriterionSystemId, u => u.MapFrom(s => s.Id)); ;
@@ -5,6 +5,7 @@
//-------------------------------------------------------------------- //--------------------------------------------------------------------
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Application.Contracts namespace IRaCIS.Core.Application.Contracts
{ {
@@ -30,6 +31,8 @@ namespace IRaCIS.Core.Application.Contracts
public string TrialSiteSurveyEquipmentType { get; set; } = string.Empty; public string TrialSiteSurveyEquipmentType { get; set; } = string.Empty;
public string Modalitys { get; set; }
public List<TrialSiteForSelect> TrialSiteSelectList { get; set; } = new List<TrialSiteForSelect>(); public List<TrialSiteForSelect> TrialSiteSelectList { get; set; } = new List<TrialSiteForSelect>();
} }
@@ -67,6 +70,9 @@ namespace IRaCIS.Core.Application.Contracts
public List<TrialSiteEquipmentSurveyView> TrialSiteEquipmentSurveyList { get; set; } = new List<TrialSiteEquipmentSurveyView>(); public List<TrialSiteEquipmentSurveyView> TrialSiteEquipmentSurveyList { get; set; } = new List<TrialSiteEquipmentSurveyView>();
public List<TrialSiteUserSurveyView> TrialSiteUserSurveyList { get; set; } = new List<TrialSiteUserSurveyView>(); public List<TrialSiteUserSurveyView> TrialSiteUserSurveyList { get; set; } = new List<TrialSiteUserSurveyView>();
public SiteSurveyFiledConfig SiteSurveyFiledConfig { get; set; }
} }
public class TrialSiteUserSurveyAllDTO : TrialSiteUserSurveyView public class TrialSiteUserSurveyAllDTO : TrialSiteUserSurveyView
@@ -22,6 +22,8 @@ using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Application.ViewModel;
using Medallion.Threading; using Medallion.Threading;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using NPOI.SS.Formula.Functions;
using Newtonsoft.Json;
namespace IRaCIS.Core.Application.Contracts namespace IRaCIS.Core.Application.Contracts
{ {
@@ -115,7 +117,7 @@ namespace IRaCIS.Core.Application.Contracts
} }
else //验证码正确 并且 没有超时 else //验证码正确 并且 没有超时
{ {
var dockerInfo=await _repository.Where<Doctor>(t=>t.EMail==inDto.EmailOrPhone||t.Phone==inDto.EmailOrPhone).FirstOrDefaultAsync(); var dockerInfo = await _repository.Where<Doctor>(t => t.EMail == inDto.EmailOrPhone || t.Phone == inDto.EmailOrPhone).FirstOrDefaultAsync();
if (dockerInfo != null) if (dockerInfo != null)
{ {
@@ -386,10 +388,12 @@ namespace IRaCIS.Core.Application.Contracts
} }
var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters() var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters()
.ProjectTo<LoginReturnDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException(); .ProjectTo<LoginReturnDTO>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }).FirstOrDefaultAsync().IfNullThrowException();
var siteSurveryConfig = _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).Select(t => t.Trial.SiteSurveyConfigJsonStr).FirstOrDefault()??string.Empty;
result.SiteSurveyFiledConfig = JsonConvert.DeserializeObject<SiteSurveyFiledConfig>(siteSurveryConfig) ?? new SiteSurveyFiledConfig();
return result; return result;
} }
@@ -622,7 +626,7 @@ namespace IRaCIS.Core.Application.Contracts
+ Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString()
+ "EmailTemplate" + "EmailTemplate"
+ Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString()
+ (_userInfo.IsEn_Us ? "TrialSiteSurveyReject_US.html" : "TrialSiteSurveyReject.html") ; + (_userInfo.IsEn_Us ? "TrialSiteSurveyReject_US.html" : "TrialSiteSurveyReject.html");
using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile)) using (StreamReader SourceReader = System.IO.File.OpenText(pathToFile))
@@ -725,12 +729,12 @@ namespace IRaCIS.Core.Application.Contracts
var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList(); var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList();
if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator) ) if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator))
{ {
throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_MissingAccount"]); throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_MissingAccount"]);
} }
if (currentUserList.Where(t=>t.IsGenerateAccount && t.UserTypeId!=null).GroupBy(t => new { t.UserTypeId, t.Email }) if (currentUserList.Where(t => t.IsGenerateAccount && t.UserTypeId != null).GroupBy(t => new { t.UserTypeId, t.Email })
.Any(g => g.Count() > 1)) .Any(g => g.Count() > 1))
{ {
throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_DuplicateEmail"]); throw new BusinessValidationFailedException(_localizer["TrialSiteSurvey_DuplicateEmail"]);
@@ -760,7 +764,7 @@ namespace IRaCIS.Core.Application.Contracts
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now }); await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.Id, PreliminaryTime = DateTime.Now });
} }
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM) else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
{ {
var allUserList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ProjectTo<TrialSiteUserSurveyView>(_mapper.ConfigurationProvider).ToList(); var allUserList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ProjectTo<TrialSiteUserSurveyView>(_mapper.ConfigurationProvider).ToList();
@@ -39,10 +39,9 @@ namespace IRaCIS.Core.Application.AutoMapper
.ForMember(d => d.IsJoin, u => u.MapFrom(c => !c.IsDeleted)); .ForMember(d => d.IsJoin, u => u.MapFrom(c => !c.IsDeleted));
//列表 //列表
CreateMap<TrialSiteEquipmentSurvey, TrialSiteEquipmentSurveyView>() CreateMap<TrialSiteEquipmentSurvey, TrialSiteEquipmentSurveyView>()
.ForMember(t => t.EquipmentType, u => u.MapFrom(d => d.EquipmentType.Value)); .ForMember(t => t.EquipmentType, u => u.MapFrom(d => isEn_Us? d.EquipmentType.Value: d.EquipmentType.ValueCN));
@@ -504,7 +504,7 @@ namespace IRaCIS.Core.Application.Contracts
public string CriterionModalitys { get; set; } public string CriterionModalitys { get; set; }
public ReadingImageDownload? ImageDownloadEnum { get; set; } public ReadingImageDownload ImageDownloadEnum { get; set; }
public ReadingImageUpload? ImageUploadEnum { get; set; } public ReadingImageUpload? ImageUploadEnum { get; set; }
@@ -870,9 +870,9 @@ namespace IRaCIS.Core.Application.Contracts
public bool IsImageFilter { get; set; } public bool IsImageFilter { get; set; }
public string CriterionModalitys { get; set; } public string CriterionModalitys { get; set; }
public ReadingImageDownload? ImageDownloadEnum { get; set; } public ReadingImageDownload ImageDownloadEnum { get; set; }
public ReadingImageUpload? ImageUploadEnum { get; set; } public ReadingImageUpload ImageUploadEnum { get; set; }
//是否附加评估 //是否附加评估
@@ -1465,7 +1465,7 @@ namespace IRaCIS.Core.Application
.WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.ResearchProgramNo.Contains(inQuery.ResearchProgramNo)) .WhereIf(!string.IsNullOrEmpty(inQuery.ResearchProgramNo), o => o.ResearchProgramNo.Contains(inQuery.ResearchProgramNo))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), o => o.ExperimentName.Contains(inQuery.ExperimentName)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), o => o.ExperimentName.Contains(inQuery.ExperimentName))
.WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false) .WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OP, t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id && t.IsDeleted == false) && t.IsDeleted == false)
.WhereIf(inQuery.CriterionType != null, o => o.ReadingQuestionCriterionTrialList.Any(t=>t.CriterionType==inQuery.CriterionType && t.IsSigned && t.IsConfirm)) .WhereIf(inQuery.CriterionType != null, o => o.TrialReadingCriterionList.Any(t=>t.CriterionType==inQuery.CriterionType && t.IsSigned && t.IsConfirm))
.WhereIf(!string.IsNullOrEmpty(inQuery.PM_EMail), o => o.TrialUserList.Any(t => t.User.EMail.Contains(inQuery.PM_EMail) && (t.User.UserTypeEnum == UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM))) .WhereIf(!string.IsNullOrEmpty(inQuery.PM_EMail), o => o.TrialUserList.Any(t => t.User.EMail.Contains(inQuery.PM_EMail) && (t.User.UserTypeEnum == UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM)))
.Select(t => new TrialToBeDoneDto() .Select(t => new TrialToBeDoneDto()
{ {
@@ -1525,7 +1525,7 @@ namespace IRaCIS.Core.Application
.Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count() : 0, .Where(u => u.CurrentActionUserId == null && (u.PreliminaryAuditUserId == null || (u.PreliminaryAuditUserId != _userInfo.Id && u.ReviewAuditUserId == null))).Count() : 0,
IR_ReadingCriterionList =isIR ? t.ReadingQuestionCriterionTrialList.Where(t=>t.IsConfirm && t.IsSigned).OrderBy(t => t.CriterionName).Select(t=>t.CriterionName).ToList():null, IR_ReadingCriterionList =isIR ? t.TrialReadingCriterionList.Where(t=>t.IsConfirm && t.IsSigned).OrderBy(t => t.CriterionName).Select(t=>t.CriterionName).ToList():null,
IR_PMEmailList= isIR ? t.TrialUserList.Where(t=>t.User.UserTypeEnum==UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.User.EMail).Select(t => t.User.EMail).ToList() : null, IR_PMEmailList= isIR ? t.TrialUserList.Where(t=>t.User.UserTypeEnum==UserTypeEnum.ProjectManager || t.User.UserTypeEnum == UserTypeEnum.APM).OrderBy(t => t.User.EMail).Select(t => t.User.EMail).ToList() : null,
@@ -115,7 +115,7 @@ namespace IRaCIS.Core.Application.Services
{ {
var list= _siteRepository var list= _siteRepository
.WhereIf(!string.IsNullOrWhiteSpace(siteName), t => t.SiteName.Contains(siteName) || t.SiteNameCN.Contains(siteName) || t.AliasName.Contains(siteName)) .WhereIf(!string.IsNullOrWhiteSpace(siteName), t => t.SiteName.Contains(siteName) || t.SiteNameCN.Contains(siteName) || t.AliasName.Contains(siteName))
.Select(t => new TrialSiteSelect() { SiteId = t.Id, SiteName = t.SiteName, AliasName = t.AliasName }).ToList(); .Select(t => new TrialSiteSelect() { SiteId = t.Id, SiteName = _userInfo.IsEn_Us? t.SiteName:t.SiteNameCN, AliasName = t.AliasName }).ToList();
return list; return list;
} }
@@ -131,6 +131,14 @@ namespace IRaCIS.Core.Application.Services
{ {
var addArray = _mapper.Map<List<TrialSite>>(trialSites); var addArray = _mapper.Map<List<TrialSite>>(trialSites);
foreach (var item in addArray)
{
if (item.IsDeleted==false)
{
item.EnabledTime = DateTime.Now;
}
}
await _repository.AddRangeAsync(addArray); await _repository.AddRangeAsync(addArray);
@@ -197,7 +205,7 @@ namespace IRaCIS.Core.Application.Services
dbEntity.EnabledTime = null; dbEntity.EnabledTime = null;
} }
else else if (editTrialSiteCommand.IsDeleted==false && dbEntity.EnabledTime==null)
{ {
dbEntity.EnabledTime = DateTime.Now; dbEntity.EnabledTime = DateTime.Now;
} }
@@ -25,7 +25,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<Trial, TrialProcessConfigDTO>(); CreateMap<Trial, TrialProcessConfigDTO>();
CreateMap<ReadingQuestionCriterionTrial, TrialTaskConfigView > () CreateMap<ReadingQuestionCriterionTrial, TrialTaskConfigView>()
.ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum)) .ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum))
.ForMember(d => d.IsImageConsistencyVerification, u => u.MapFrom(s => s.Trial.IsImageConsistencyVerification)) .ForMember(d => d.IsImageConsistencyVerification, u => u.MapFrom(s => s.Trial.IsImageConsistencyVerification))
.ReverseMap(); .ReverseMap();
@@ -66,15 +66,15 @@ namespace IRaCIS.Core.Application.Service
var userTypeEnumInt = 0; var userTypeEnumInt = 0;
var isEn_Us = false; var isEn_Us = false;
CreateMap<Trial, TrialDetailDTO>() CreateMap<Trial, TrialDetailDTO>()
.ForMember(x=>x.CriterionList,y=>y.MapFrom(z=>z.ReadingQuestionCriterionTrialList.Where(n=>n.IsConfirm).Select(m=>m.CriterionName))) .ForMember(x => x.CriterionList, y => y.MapFrom(z => z.TrialReadingCriterionList.Where(n => n.IsConfirm).Select(m => m.CriterionName)))
.ForMember(d => d.DictionaryList, u => u.MapFrom(s => s.TrialDicList.Select(t => t.Dictionary).OrderBy(t => t.ShowOrder))) .ForMember(d => d.DictionaryList, u => u.MapFrom(s => s.TrialDicList.Select(t => t.Dictionary).OrderBy(t => t.ShowOrder)))
//.ForMember(d => d.Code, u => u.MapFrom(s => s.TrialCode)) //.ForMember(d => d.Code, u => u.MapFrom(s => s.TrialCode))
.ForMember(d => d.Sponsor, u => u.MapFrom(s => s.Sponsor.SponsorName)) .ForMember(d => d.Sponsor, u => u.MapFrom(s => s.Sponsor.SponsorName))
.ForMember(d => d.Phase, u => u.MapFrom(s => isEn_Us? s.Phase.Value: s.Phase.ValueCN)) .ForMember(d => d.Phase, u => u.MapFrom(s => isEn_Us ? s.Phase.Value : s.Phase.ValueCN))
//.ForMember(d => d.DeclarationType, u => u.MapFrom(s => s.DeclarationType.MappedValue)) //.ForMember(d => d.DeclarationType, u => u.MapFrom(s => s.DeclarationType.MappedValue))
.ForMember(d => d.IndicationType, u => u.MapFrom(s => isEn_Us ? s.IndicationType.Value:s.IndicationType.ValueCN)) .ForMember(d => d.IndicationType, u => u.MapFrom(s => isEn_Us ? s.IndicationType.Value : s.IndicationType.ValueCN))
.ForMember(d => d.CRO, u => u.MapFrom(s => s.CRO.CROName)) .ForMember(d => d.CRO, u => u.MapFrom(s => s.CRO.CROName))
.ForMember(d => d.ReviewMode, u => u.MapFrom(s => isEn_Us ? s.ReviewMode.Value:s.ReviewMode.ValueCN)) .ForMember(d => d.ReviewMode, u => u.MapFrom(s => isEn_Us ? s.ReviewMode.Value : s.ReviewMode.ValueCN))
//.ForMember(d => d.ReviewType, u => u.MapFrom(s => s.ReviewType.Value)) //.ForMember(d => d.ReviewType, u => u.MapFrom(s => s.ReviewType.Value))
.ForMember(d => d.IsLocked, u => u.MapFrom(s => s.WorkloadList.Any(u => u.DataFrom == (int)WorkLoadFromStatus.FinalConfirm))) .ForMember(d => d.IsLocked, u => u.MapFrom(s => s.WorkloadList.Any(u => u.DataFrom == (int)WorkLoadFromStatus.FinalConfirm)))
//.ForMember(d => d.SiteCount, u => u.MapFrom(s => userTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator ? s.TrialSiteUserList.Count(k => k.UserId == userId) : s.TrialSiteList.Count())) //.ForMember(d => d.SiteCount, u => u.MapFrom(s => userTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator ? s.TrialSiteUserList.Count(k => k.UserId == userId) : s.TrialSiteList.Count()))
@@ -108,32 +108,20 @@ namespace IRaCIS.Core.Application.Service
CreateMap<Site, SiteSelectDTO>() CreateMap<Site, SiteSelectDTO>()
.ForMember(d => d.HospitalName, u => u.MapFrom(s => isEn_Us? s.Hospital.HospitalName:s.Hospital.HospitalNameCN)); .ForMember(d => d.HospitalName, u => u.MapFrom(s => isEn_Us ? s.Hospital.HospitalName : s.Hospital.HospitalNameCN));
//trial site 选择列表 subjectVisit pannel 模式添加的时候 //trial site 选择列表 subjectVisit pannel 模式添加的时候
CreateMap<Site, TrialSiteScreeningDTO>() CreateMap<Site, TrialSiteScreeningDTO>()
.ForMember(d => d.IsSelect, u => u.MapFrom(s => s.TrialSiteList.Any(k => k.TrialId == trialId))) .ForMember(d => d.IsSelect, u => u.MapFrom(s => s.TrialSiteList.Any(k => k.TrialId == trialId)))
.ForMember(d => d.SiteName, u => u.MapFrom(c=> isEn_Us?c.SiteName:c.SiteNameCN)); .ForMember(d => d.SiteName, u => u.MapFrom(c => isEn_Us ? c.SiteName : c.SiteNameCN));
#region stie pannel #region stie pannel
#region site country hospital #region site country hospital
CreateMap<TrialSite, SiteStatDTO>() CreateMap<TrialSite, SiteStatDTO>()
//.ForMember(d => d.SiteCode, u => u.MapFrom(s => s.Site.SiteCode))
//.ForMember(d => d.City, u => u.MapFrom(s => s.Site.City))
//.ForMember(d => d.Country, u => u.MapFrom(s => s.Site.Country))
//.ForMember(d => d.Hospital, u => u.MapFrom(s => s.Site.Hospital.HospitalName))
//.ForMember(d => d.DirectorName, u => u.MapFrom(s => s.Site.DirectorName))
//.ForMember(d => d.DirectorPhone, u => u.MapFrom(s => s.Site.DirectorPhone))
//.ForMember(d => d.ContactPhone, u => u.MapFrom(s => s.Site.ContactPhone))
//.ForMember(d => d.Address, u => u.MapFrom(s => s.Site.Address))
//.ForMember(d => d.Site, u => u.MapFrom(s => s.Site.SiteName))
.ForMember(d => d.TrialSiteId, u => u.MapFrom(s => s.Id))
.ForMember(d => d.VisitCount, u => u.MapFrom(s => s.SubjectVisitList.Count())) .ForMember(d => d.VisitCount, u => u.MapFrom(s => s.SubjectVisitList.Count()))
.ForMember(d => d.SubjectCount, u => u.MapFrom(s => s.SubjectList.Count())) .ForMember(d => d.SubjectCount, u => u.MapFrom(s => s.SubjectList.Count()))
.ForMember(d => d.UserCount, u => u.MapFrom(s => s.CRCUserList.Count())) .ForMember(d => d.UserCount, u => u.MapFrom(s => s.CRCUserList.Count()))
@@ -170,10 +158,10 @@ namespace IRaCIS.Core.Application.Service
CreateMap<Domain.Models.Trial, TrialConfigDTO>().ForMember(t => t.TrialId, u => u.MapFrom(c => c.Id)) CreateMap<Domain.Models.Trial, TrialConfigDTO>().ForMember(t => t.TrialId, u => u.MapFrom(c => c.Id))
.ForMember(t => t.TrialCriterionIds, u => u.MapFrom(c => c.ReadingQuestionCriterionTrialList.Where(v =>v.IsConfirm).OrderBy(x=>x.ShowOrder).Select(r => r.Id))) .ForMember(t => t.TrialCriterionIds, u => u.MapFrom(c => c.TrialReadingCriterionList.Where(v => v.IsConfirm).OrderBy(x => x.ShowOrder).Select(r => r.Id)))
.ForMember(t => t.TrialCriterionNames, u => u.MapFrom(c => c.ReadingQuestionCriterionTrialList.Where(v => v.IsConfirm).OrderBy(x => x.ShowOrder).Select(r => r.CriterionName))) .ForMember(t => t.TrialCriterionNames, u => u.MapFrom(c => c.TrialReadingCriterionList.Where(v => v.IsConfirm).OrderBy(x => x.ShowOrder).Select(r => r.CriterionName)))
.ForMember(t => t.ClinicalDataTrialSetIds, u => u.MapFrom(c => c.clinicalDataTrialSets.Where(v => v.IsConfirm).Select(r => r.Id))) .ForMember(t => t.ClinicalDataTrialSetIds, u => u.MapFrom(c => c.clinicalDataTrialSets.Where(v => v.IsConfirm).Select(r => r.Id)))
.ForMember(t => t.ClinicalDataSetNames, u => u.MapFrom(c => c.clinicalDataTrialSets.Where(v => v.IsConfirm).Select(r => isEn_Us ? r.ClinicalDataSetEnName:r.ClinicalDataSetName))) .ForMember(t => t.ClinicalDataSetNames, u => u.MapFrom(c => c.clinicalDataTrialSets.Where(v => v.IsConfirm).Select(r => isEn_Us ? r.ClinicalDataSetEnName : r.ClinicalDataSetName)))
//.ForMember(t => t.CriterionIds, u => u.MapFrom(c => c.TrialDicList.Where(v => v.KeyName == StaticData.Criterion).Select(r => r.DictionaryId))) //.ForMember(t => t.CriterionIds, u => u.MapFrom(c => c.TrialDicList.Where(v => v.KeyName == StaticData.Criterion).Select(r => r.DictionaryId)))
; ;
CreateMap<Domain.Models.Trial, TrialSubjectConfig>(); CreateMap<Domain.Models.Trial, TrialSubjectConfig>();
@@ -191,7 +179,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<Trial, TrialSelectDTO>(); CreateMap<Trial, TrialSelectDTO>();
CreateMap<TrialUrgentConfig, Trial>(); CreateMap<TrialUrgentConfig, Trial>();
CreateMap<Trial, TrialUrgentConfig > ().ForMember(t=>t.TrialId,u=>u.MapFrom(c=>c.Id)); CreateMap<Trial, TrialUrgentConfig>().ForMember(t => t.TrialId, u => u.MapFrom(c => c.Id));
CreateMap<SignDTO, TrialSign>(); CreateMap<SignDTO, TrialSign>();
@@ -317,7 +305,7 @@ namespace IRaCIS.Core.Application.Service
.ForMember(t => t.WaitSignCount, u => .ForMember(t => t.WaitSignCount, u =>
u.MapFrom(c => userTypeEnumInt == (int)UserTypeEnum.SuperAdmin ? 0 u.MapFrom(c => userTypeEnumInt == (int)UserTypeEnum.SuperAdmin ? 0
: c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == userTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == userId && t.ConfirmTime!=null)).Count()) : c.TrialDocumentList.Where(t => t.IsDeleted == false && t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == userTypeId) && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == userId && t.ConfirmTime != null)).Count())
); );
@@ -188,7 +188,7 @@ namespace IRaCIS.Core.Application.Contracts
{ {
public Guid TrialId { get; set; } public Guid TrialId { get; set; }
public Guid SujectVisitId { get; set; } public Guid SujectVisitId { get; set; }
public Guid? VisitTaskId { get; set; } public Guid VisitTaskId { get; set; }
} }
@@ -264,7 +264,7 @@ namespace IRaCIS.Core.Application.Contracts
public bool IsCriticalSequence { get; set; } = false; public bool IsCriticalSequence { get; set; } = false;
public int SeriesCount { get; set; } public int SeriesCount =>SeriesList.Count;
public int InstanceCount { get; set; } public int InstanceCount { get; set; }
public bool IsDicom { get; set; } = true; public bool IsDicom { get; set; } = true;
@@ -382,7 +382,7 @@ namespace IRaCIS.Core.Application.Contracts
public string ErrorMesseage { get; set; } = String.Empty; public string ErrorMesseage { get; set; } = String.Empty;
public List<UploadedSeries> UploadedSeriesList { get; set;} = new List<UploadedSeries>(); public List<UploadedSeries> UploadedSeriesList { get; set; } = new List<UploadedSeries>();
} }
@@ -535,7 +535,7 @@ namespace IRaCIS.Core.Application.Contracts
public Guid TrialId { get; set; } public Guid TrialId { get; set; }
public string SubjectInfo { get; set; } = String.Empty; public string SubjectInfo { get; set; } = String.Empty;
public string VisitPlanInfo { get; set; }=String.Empty; public string VisitPlanInfo { get; set; } = String.Empty;
public Guid? SubjectVisitId { get; set; } public Guid? SubjectVisitId { get; set; }
@@ -15,6 +15,7 @@ using IRaCIS.Application.Services;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using DocumentFormat.OpenXml.Drawing.Charts; using DocumentFormat.OpenXml.Drawing.Charts;
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Models;
using NPOI.SS.Formula.Functions;
namespace IRaCIS.Core.Application.Services namespace IRaCIS.Core.Application.Services
{ {
@@ -263,7 +264,7 @@ namespace IRaCIS.Core.Application.Services
{ {
InstanceCount = k.InstanceCount, InstanceCount = k.InstanceCount,
Modalities = k.Modalities, Modalities = k.Modalities,
SeriesCount = k.SeriesCount, //SeriesCount = k.SeriesCount,
StudyCode = k.StudyCode, StudyCode = k.StudyCode,
StudyId = k.Id StudyId = k.Id
}).ToListAsync(); }).ToListAsync();
@@ -297,7 +298,7 @@ namespace IRaCIS.Core.Application.Services
); );
//设置为阅片与否 不更改数据库检查 的instance数量 和 SeriesCount 所以这里要实时统计 //设置为阅片与否 不更改数据库检查 的instance数量 和 SeriesCount 所以这里要实时统计
t.SeriesCount = t.SeriesList.Count; //t.SeriesCount = t.SeriesList.Count;
t.InstanceCount = t.SeriesList.SelectMany(t => t.InstanceInfoList).Count(); t.InstanceCount = t.SeriesList.SelectMany(t => t.InstanceInfoList).Count();
} }
@@ -338,8 +339,8 @@ namespace IRaCIS.Core.Application.Services
series.WindowWidth = instanceList.FirstOrDefault()!.WindowWidth; //series.WindowWidth = instanceList.FirstOrDefault()!.WindowWidth;
series.WindowCenter = instanceList.FirstOrDefault()!.WindowCenter; //series.WindowCenter = instanceList.FirstOrDefault()!.WindowCenter;
return series; return series;
} }
@@ -445,8 +446,8 @@ namespace IRaCIS.Core.Application.Services
series.WindowWidth = instanceList.FirstOrDefault()!.WindowWidth; //series.WindowWidth = instanceList.FirstOrDefault()!.WindowWidth;
series.WindowCenter = instanceList.FirstOrDefault()!.WindowCenter; //series.WindowCenter = instanceList.FirstOrDefault()!.WindowCenter;
}); });
} }
@@ -480,8 +481,99 @@ namespace IRaCIS.Core.Application.Services
[HttpPost] [HttpPost]
public async Task<List<VisitStudyDTO>> GetReadingVisitStudyList(GetReadingVisitStudyListIndto indto) public async Task<List<VisitStudyDTO>> GetReadingVisitStudyList(GetReadingVisitStudyListIndto indto)
{ {
var result = new List<VisitStudyDTO>();
var studyList = new List<VisitStudyDTO>();
var taskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).Select(t => new { t.TrialReadingCriterionId, t.TrialReadingCriterion.IsImageFilter, t.TrialReadingCriterion.CriterionModalitys, t.ReadingTaskState, TaskStudyCount = t.TaskStudyList.Count }).FirstNotNullAsync();
//影像后处理 上传了新的影像
if (taskInfo.TaskStudyCount > 0)
{
var taskStudyList = await _repository.Where<TaskStudy>(t => t.TrialId == indto.TrialId && t.VisitTaskId == indto.VisitTaskId).ProjectTo<VisitStudyDTO>(_mapper.ConfigurationProvider).ToListAsync();
foreach (var study in taskStudyList)
{
study.SeriesList = study.SeriesList.OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).ToList();
//foreach (var series in study.SeriesList)
//{
// series.WindowCenter = series.InstanceInfoList.FirstOrDefault()!.WindowCenter;
// series.WindowWidth = series.InstanceInfoList.FirstOrDefault()!.WindowWidth;
//}
//study.SeriesCount = study.SeriesList.Count;
study.InstanceCount = study.SeriesList.SelectMany(t => t.InstanceInfoList).Count();
}
studyList.AddRange(taskStudyList);
}
else
{
#region dicom
//如果是手动生成的标准,需要过滤检查和序列数据
var isManualGenerate = await _trialReadingCriterionRepository.AnyAsync(t => t.Id == taskInfo.TrialReadingCriterionId && t.IsAutoCreate == false);
var dicomStudyList = await _repository.Where<DicomStudy>(t => t.TrialId == indto.TrialId && t.SubjectVisitId == indto.SujectVisitId)
.WhereIf(taskInfo.IsImageFilter == true, t => taskInfo.CriterionModalitys.Contains(t.ModalityForEdit))
.WhereIf(isManualGenerate, t => t.SubjectCriteriaEvaluationVisitStudyFilterList.Any(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsConfirmed && t.IsReading))
.Select(k => new VisitStudyDTO()
{
InstanceCount = k.InstanceCount,
Modalities = k.Modalities,
//SeriesCount = k.SeriesCount,
StudyCode = k.StudyCode,
StudyId = k.Id,
}).ToListAsync();
var studyIds = dicomStudyList.Select(t => t.StudyId).ToList();
var instanceList = await _repository.Where<DicomInstance>(t => studyIds.Contains(t.StudyId))
.Select(t => new { t.SeriesId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.WindowCenter, t.WindowWidth, t.HtmlPath }).ToListAsync();
List<DicomSeriesDTO> seriesLists = await _repository.Where<DicomSeries>(s => studyIds.Contains(s.StudyId))
.WhereIf(isManualGenerate == false, t => t.IsReading)
.WhereIf(isManualGenerate, t => t.SubjectCriteriaEvaluationVisitStudyFilterList.Any(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsConfirmed && t.IsReading))
.OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).ProjectTo<DicomSeriesDTO>(_mapper.ConfigurationProvider).ToListAsync();
foreach (var t in dicomStudyList)
{
t.SeriesList = seriesLists.Where(s => s.StudyId == t.StudyId).OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).ToList();
t.SeriesList.ForEach(series =>
{
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,
}).ToList();
//series.WindowWidth = instanceList.FirstOrDefault()!.WindowWidth;
//series.WindowCenter = instanceList.FirstOrDefault()!.WindowCenter;
});
//设置为阅片与否 不更改数据库检查 的instance数量 和 SeriesCount 所以这里要实时统计
//t.SeriesCount = t.SeriesList.Count;
t.InstanceCount = t.SeriesList.SelectMany(t => t.InstanceInfoList).Count();
}
studyList.AddRange(dicomStudyList);
#endregion
#region dicom
//已经签名的任务,加关键序列
if (taskInfo.ReadingTaskState == ReadingTaskState.HaveSigned)
{
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).OrderBy(x => x.ReadingQuestionTrial.ShowOrder).ThenBy(x => x.RowIndex).Select(x => new var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == indto.VisitTaskId && x.StudyId != null).OrderBy(x => x.ReadingQuestionTrial.ShowOrder).ThenBy(x => x.RowIndex).Select(x => new
{ {
x.ReadingQuestionTrial.ShowOrder, x.ReadingQuestionTrial.ShowOrder,
@@ -491,12 +583,6 @@ namespace IRaCIS.Core.Application.Services
x.InstanceId, x.InstanceId,
}).ToListAsync(); }).ToListAsync();
var taskInfo = await _visitTaskRepository.Where(x => x.Id == indto.VisitTaskId).FirstNotNullAsync();
if (taskInfo.ReadingTaskState == ReadingTaskState.HaveSigned)
{
var thisStudyIds = rowInfoList.OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.StudyId).Distinct().ToList(); var thisStudyIds = rowInfoList.OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.StudyId).Distinct().ToList();
var thisSeriesIdIds = rowInfoList.Where(x => x.SeriesId != null).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.SeriesId).Distinct().ToList(); var thisSeriesIdIds = rowInfoList.Where(x => x.SeriesId != null).OrderBy(x => x.ShowOrder).ThenBy(x => x.RowIndex).Select(x => x.SeriesId).Distinct().ToList();
if (rowInfoList.Count > 0) if (rowInfoList.Count > 0)
@@ -505,7 +591,7 @@ namespace IRaCIS.Core.Application.Services
{ {
InstanceCount = k.InstanceCount, InstanceCount = k.InstanceCount,
SeriesCount = k.SeriesCount, //SeriesCount = k.SeriesCount,
StudyId = k.Id, StudyId = k.Id,
IsCriticalSequence = true, IsCriticalSequence = true,
@@ -558,79 +644,38 @@ namespace IRaCIS.Core.Application.Services
var modalityList = await _repository.Where<DicomSeries>(s => thisSeriesIdIds.Contains(s.Id)).OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).Select(x => x.Modality).Distinct().ToListAsync(); ; var modalityList = await _repository.Where<DicomSeries>(s => thisSeriesIdIds.Contains(s.Id)).OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).Select(x => x.Modality).Distinct().ToListAsync(); ;
item.Modality = string.Join(",", modalityList); item.Modality = string.Join(",", modalityList);
thisVisitTaskStudy.SeriesList.Add(item); thisVisitTaskStudy.SeriesList.Add(item);
thisVisitTaskStudy.SeriesCount = thisVisitTaskStudy.SeriesList.Count; //thisVisitTaskStudy.SeriesCount = thisVisitTaskStudy.SeriesList.Count;
}
studyList.Add(thisVisitTaskStudy);
} }
result.Add(thisVisitTaskStudy);
} }
} studyList.ForEach(x =>
}
//如果是手动生成的标准,需要过滤检查和序列数据
var isManualGenerate = await _trialReadingCriterionRepository.AnyAsync(t => t.Id == taskInfo.TrialReadingCriterionId && t.IsAutoCreate == false);
var studyList = await _repository.Where<DicomStudy>(t => t.TrialId == indto.TrialId && t.SubjectVisitId == indto.SujectVisitId)
.WhereIf(isManualGenerate, t => t.SubjectCriteriaEvaluationVisitStudyFilterList.Any(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsConfirmed && t.IsReading))
.Select(k => new VisitStudyDTO()
{ {
InstanceCount = k.InstanceCount, x.SeriesList.ForEach(y =>
Modalities = k.Modalities,
SeriesCount = k.SeriesCount,
StudyCode = k.StudyCode,
StudyId = k.Id,
}).ToListAsync();
var studyIds = studyList.Select(t => t.StudyId).ToList();
var instanceList = await _repository.Where<DicomInstance>(t => studyIds.Contains(t.StudyId))
.Select(t => new { t.SeriesId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.WindowCenter, t.WindowWidth, t.HtmlPath }).ToListAsync();
List<DicomSeriesDTO> seriesLists = await _repository.Where<DicomSeries>(s => studyIds.Contains(s.StudyId) /*&& s.IsReading*/)
.WhereIf(isManualGenerate == false, t => t.IsReading)
.WhereIf(isManualGenerate, t => t.SubjectCriteriaEvaluationVisitStudyFilterList.Any(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsConfirmed && t.IsReading))
.OrderBy(s => s.SeriesNumber). ThenBy(s => s.SeriesTime).ProjectTo<DicomSeriesDTO>(_mapper.ConfigurationProvider).ToListAsync();
foreach (var t in studyList)
{ {
t.SeriesList = seriesLists.Where(s => s.StudyId == t.StudyId).OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).ToList(); y.IsBeMark = rowInfoList.Any(z => z.SeriesId == y.Id);
t.SeriesList.ForEach(series =>
{
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,
}).ToList();
series.WindowWidth = instanceList.FirstOrDefault()!.WindowWidth;
series.WindowCenter = instanceList.FirstOrDefault()!.WindowCenter;
}); });
//设置为阅片与否 不更改数据库检查 的instance数量 和 SeriesCount 所以这里要实时统计 });
t.SeriesCount = t.SeriesList.Count;
t.InstanceCount = t.SeriesList.SelectMany(t => t.InstanceInfoList).Count();
} }
// 非Dicom #endregion
}
var noDicomList = await _noneDicomStudyRepository.Where(x => x.TrialId == indto.TrialId && x.SubjectVisitId == indto.SujectVisitId).ToListAsync();
#region Dicom
var noDicomList = await _noneDicomStudyRepository.Where(x => x.TrialId == indto.TrialId && x.SubjectVisitId == indto.SujectVisitId && x.NoneDicomFileList.Any(t => !t.FileType.Contains(StaticData.FileType.Zip)))
.WhereIf(taskInfo.IsImageFilter == true, t => taskInfo.CriterionModalitys.Contains(t.Modality) ).ToListAsync();
List<VisitStudyDTO> noDicomStudyList = noDicomList.Select(x => new VisitStudyDTO() List<VisitStudyDTO> noDicomStudyList = noDicomList.Select(x => new VisitStudyDTO()
@@ -638,7 +683,7 @@ namespace IRaCIS.Core.Application.Services
InstanceCount = x.FileCount, InstanceCount = x.FileCount,
StudyId = x.Id, StudyId = x.Id,
Modalities = x.Modality, Modalities = x.Modality,
SeriesCount = 1, //SeriesCount = 1,
StudyCode = x.StudyCode, StudyCode = x.StudyCode,
IsDicom = false, IsDicom = false,
@@ -653,7 +698,7 @@ namespace IRaCIS.Core.Application.Services
if (instanceCount == 0) if (instanceCount == 0)
{ {
item.SeriesList = new List<DicomSeriesDTO>(); item.SeriesList = new List<DicomSeriesDTO>();
item.SeriesCount = 0; //item.SeriesCount = 0;
} }
else else
{ {
@@ -669,7 +714,7 @@ namespace IRaCIS.Core.Application.Services
SubjectVisitId=nodicom.SubjectVisitId, SubjectVisitId=nodicom.SubjectVisitId,
SubjectId=nodicom.SubjectId, SubjectId=nodicom.SubjectId,
SeriesNumber=1, SeriesNumber=1,
NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.Where(x=>x.NoneDicomStudyId==item.StudyId).Select(x=>x.Path).FirstOrDefaultAsync(), NoneDicomFileFirstFile=await _noneDicomStudyFileRepository.Where(x=>x.NoneDicomStudyId==item.StudyId && !x.FileType.Contains(StaticData.FileType.Zip)).Select(x=>x.Path).FirstOrDefaultAsync(),
} }
}; };
@@ -677,24 +722,14 @@ namespace IRaCIS.Core.Application.Services
} }
if (studyList == null || studyList.Count == 0)
{
studyList = new List<VisitStudyDTO>();
}
studyList.AddRange(noDicomStudyList); studyList.AddRange(noDicomStudyList);
studyList.ForEach(x => #endregion
{
x.SeriesList.ForEach(y =>
{
y.IsBeMark = rowInfoList.Any(z => z.SeriesId == y.Id); var result = studyList.Where(x => x.SeriesCount > 0).ToList();
});
});
result.AddRange(studyList);
result = result.Where(x => x.SeriesCount > 0).ToList();
return result; return result;
@@ -1,6 +1,7 @@
using AutoMapper; using AutoMapper;
using IRaCIS.Application.Contracts; using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Contracts; using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Contracts.Dicom.DTO;
using IRaCIS.Core.Application.MediatR.CommandAndQueries; using IRaCIS.Core.Application.MediatR.CommandAndQueries;
using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Domain.Share;
@@ -101,6 +102,16 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.SubjectVisit.Subject.Code)) .ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.SubjectVisit.Subject.Code))
.ForMember(d => d.VisitName, u => u.MapFrom(s => s.SubjectVisit.VisitName)) .ForMember(d => d.VisitName, u => u.MapFrom(s => s.SubjectVisit.VisitName))
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.SubjectVisit.TrialSite.TrialSiteCode)); .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.SubjectVisit.TrialSite.TrialSiteCode));
CreateMap<TaskStudy, VisitStudyDTO>()
.ForMember(d => d.StudyId, u => u.MapFrom(s => s.Id))
.ForMember(d => d.SeriesList, u => u.MapFrom(s => s.SeriesList));
CreateMap<TaskSeries, DicomSeriesDTO>()
.ForMember(d => d.InstanceInfoList, u => u.MapFrom(s => s.InstanceList));
CreateMap<TaskInstance, InstanceBasicInfo>();
} }
} }
@@ -377,9 +377,9 @@ namespace IRaCIS.Application.Contracts
public bool IsReadingPeriod { get; set; } public bool IsReadingPeriod { get; set; }
public ReadingImageDownload? ImageDownloadEnum { get; set; } public ReadingImageDownload ImageDownloadEnum { get; set; }
public ReadingImageUpload? ImageUploadEnum { get; set; } public ReadingImageUpload ImageUploadEnum { get; set; }
} }
public class TrialCriterionReadingCategory public class TrialCriterionReadingCategory
@@ -252,7 +252,7 @@ namespace IRaCIS.Application.Services
EnrollId = intoGroup.Id, EnrollId = intoGroup.Id,
IsEnable = allocateRule.IsEnable, IsEnable = allocateRule.IsEnable,
TrialReadingCriterionList = intoGroup.Trial.ReadingQuestionCriterionTrialList.Where(t => t.IsConfirm).Select(t => new TrialReadingCriterionDto() { TrialReadingCriterionId = t.Id, TrialReadingCriterionName = t.CriterionName, CriterionType = t.CriterionType, IsOncologyReading = t.IsOncologyReading, IsArbitrationReading = t.IsArbitrationReading, IsGlobalReading = t.IsGlobalReading, ReadingInfoSignTime = t.ReadingInfoSignTime, ReadingType = t.ReadingType }).ToList(), TrialReadingCriterionList = intoGroup.Trial.TrialReadingCriterionList.Where(t => t.IsConfirm).Select(t => new TrialReadingCriterionDto() { TrialReadingCriterionId = t.Id, TrialReadingCriterionName = t.CriterionName, CriterionType = t.CriterionType, IsOncologyReading = t.IsOncologyReading, IsArbitrationReading = t.IsArbitrationReading, IsGlobalReading = t.IsGlobalReading, ReadingInfoSignTime = t.ReadingInfoSignTime, ReadingType = t.ReadingType }).ToList(),
DoctorCriterionStatusList= intoGroup.EnrollReadingCriteriaList.Select(t=>new DoctorCriterionStatus() DoctorCriterionStatusList= intoGroup.EnrollReadingCriteriaList.Select(t=>new DoctorCriterionStatus()
{ {
@@ -1,11 +1,13 @@
namespace IRaCIS.Core.Domain.Share using System.Collections.Generic;
namespace IRaCIS.Core.Domain.Share
{ {
public enum TrialExpedited public enum TrialExpedited
{ {
All=-1, All = -1,
None=0, None = 0,
ExpeditedIn24H = 1, ExpeditedIn24H = 1,
@@ -29,26 +31,43 @@
{ {
//0全部中国医生 1美国医生 2既有中国医生,也有美国医生 //0全部中国医生 1美国医生 2既有中国医生,也有美国医生
CN=0, CN = 0,
US=1, US = 1,
EU=2, EU = 2,
Other=3 Other = 3
} }
public class SiteSurveyFiledConfig
{
public List<string> NotShowFieldList { get; set; }=new List<string>();
public List<SiteSurveyModifyFiled> ModifyFiledList { get; set; }=new List<SiteSurveyModifyFiled>();
}
public class SiteSurveyModifyFiled
{
public string NeedModifyFiled { get; set; }
public string ReplaceContent { get; set; }
public string ReplaceContentCN { get; set; }
}
public enum DeclarationType public enum DeclarationType
{ {
Other=3, Other = 3,
US=1, US = 1,
CN=0, CN = 0,
EU=2, EU = 2,
JP=4 JP = 4
} }
} }
@@ -90,6 +90,13 @@
EnrollOrPD_EMailCopy=5, EnrollOrPD_EMailCopy=5,
} }
public enum UserMFAType
{
Login=0,
Unlock=1,
}
} }
@@ -36,7 +36,7 @@ namespace IRaCIS.Core.Domain.Models
[Required] [Required]
public Guid CreateUserId { get; set; } public Guid CreateUserId { get; set; }
public string FileType { get; set; }
} }
@@ -276,9 +276,9 @@ namespace IRaCIS.Core.Domain.Models
public List<VisitTask> VisitTaskList { get; set; } public List<VisitTask> VisitTaskList { get; set; }
public ReadingImageDownload? ImageDownloadEnum { get; set; } public ReadingImageDownload ImageDownloadEnum { get; set; }
public ReadingImageUpload? ImageUploadEnum { get; set; } public ReadingImageUpload ImageUploadEnum { get; set; }
public bool IsImageFilter { get; set; } public bool IsImageFilter { get; set; }
} }
@@ -294,7 +294,9 @@ namespace IRaCIS.Core.Domain.Models
{ {
None = 0, None = 0,
IRReadingEnable = 1 IRReadingSubejctEnable = 1,
IRReadingVisitEnable = 2,
} }
+5 -2
View File
@@ -46,7 +46,7 @@ namespace IRaCIS.Core.Domain.Models
[JsonIgnore] [JsonIgnore]
public List<TrialUser> TrialUserList { get; set; } = new List<TrialUser>(); public List<TrialUser> TrialUserList { get; set; } = new List<TrialUser>();
[JsonIgnore] [JsonIgnore]
public List<ReadingQuestionCriterionTrial> ReadingQuestionCriterionTrialList { get; set; } = new List<ReadingQuestionCriterionTrial>(); public List<ReadingQuestionCriterionTrial> TrialReadingCriterionList { get; set; } = new List<ReadingQuestionCriterionTrial>();
[JsonIgnore] [JsonIgnore]
public List<Subject> SubjectList { get; set; } = new List<Subject>(); public List<Subject> SubjectList { get; set; } = new List<Subject>();
[JsonIgnore] [JsonIgnore]
@@ -182,6 +182,9 @@ namespace IRaCIS.Core.Domain.Models
//public List<SiteSurveyFiledConfig>
public string SiteSurveyConfigJsonStr { get; set; } = string.Empty;
public bool VisitPlanConfirmed { get; set; } public bool VisitPlanConfirmed { get; set; }
@@ -271,7 +274,7 @@ namespace IRaCIS.Core.Domain.Models
public string Modalitys { get; set; } = "CT|MRI|Bone Scan|Photograph|PET|X-ray|US"; public string Modalitys { get; set; } = string.Empty;
[NotMapped] [NotMapped]
public List<string> ModalityList => Modalitys.Split('|', StringSplitOptions.RemoveEmptyEntries).Where(t => !string.IsNullOrEmpty(t)).ToList(); public List<string> ModalityList => Modalitys.Split('|', StringSplitOptions.RemoveEmptyEntries).Where(t => !string.IsNullOrEmpty(t)).ToList();
+4 -1
View File
@@ -112,7 +112,10 @@ public static class StaticData
public static readonly string UploadFileFolder = "UploadFile"; public static readonly string UploadFileFolder = "UploadFile";
} }
public static class FileType
{
public static readonly string Zip = "zip";
}
public static class TrialOpt public static class TrialOpt
{ {
@@ -284,6 +284,31 @@ namespace IRaCIS.Core.Infra.EFCore.Common
.Select(t => new { t.AdditionalAssessmentType, t.IsSelected }).ToListAsync(); .Select(t => new { t.AdditionalAssessmentType, t.IsSelected }).ToListAsync();
var oncologyAssessIdsStr = string.Empty;
var allList = new List<ReadingTrialCriterionDictionary>();
if (entitys.Any(x => x.Entity.GetType() == typeof(ReadingTrialCriterionDictionary)))
{
allList = entitys.Where(x => x.Entity.GetType() == typeof(ReadingTrialCriterionDictionary))
.Select(t => t.Entity as ReadingTrialCriterionDictionary).ToList().Where(x=>
x.CriterionId== entity.Id &&
x.ParentCode == ReadingCommon.CriterionDictionary.OncologyAssess).ToList();
}
else
{
allList=await _dbContext.ReadingTrialCriterionDictionary.Where(x =>
x.CriterionId == entity.Id &&
x.ParentCode == ReadingCommon.CriterionDictionary.OncologyAssess).ToListAsync();
}
//查询出字典的Value ValueCN Des 保存
var diclistOncologyAssess = allList.Select(t => t.DictionaryId).ToList();
var selectList = await _dbContext.Dictionary.Where(x => diclistOncologyAssess.Contains(x.Id)).Select(t => t.ValueCN).ToListAsync();
oncologyAssessIdsStr = string.Join(",", selectList);
await InsertInspection<ReadingQuestionCriterionTrial>(entity, type, x => new InspectionConvertDTO() await InsertInspection<ReadingQuestionCriterionTrial>(entity, type, x => new InspectionConvertDTO()
{ {
IsDistinctionInterface = isDistinctionInterface, IsDistinctionInterface = isDistinctionInterface,
@@ -296,6 +321,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
}, new }, new
{ {
OncologyAssessIdsStr= oncologyAssessIdsStr,
EvaluationResultTypes = dicValueList.Count > 0 ? string.Join(",", dicValueList) : string.Empty, EvaluationResultTypes = dicValueList.Count > 0 ? string.Join(",", dicValueList) : string.Empty,
AdditionalAssessmentTypeList = addtionalAssesementList AdditionalAssessmentTypeList = addtionalAssesementList
}); });
@@ -133,6 +133,8 @@ namespace IRaCIS.Core.Infra.EFCore
Task<IEnumerable<TEntity>> AddRangeAsync(IEnumerable<TEntity> entities, bool autoSave = false); Task<IEnumerable<TEntity>> AddRangeAsync(IEnumerable<TEntity> entities, bool autoSave = false);
Task<bool> SaveChangesAsync(CancellationToken cancellationToken = default); Task<bool> SaveChangesAsync(CancellationToken cancellationToken = default);
Task<bool> SaveChangesAndClearAllTrackingAsync(CancellationToken cancellationToken = default);
Task<bool> DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default); Task<bool> DeleteAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
@@ -449,7 +449,12 @@ namespace IRaCIS.Core.Infra.EFCore
return await _dbContext.SaveChangesAsync(cancellationToken) > 0; return await _dbContext.SaveChangesAsync(cancellationToken) > 0;
} }
public async Task<bool> SaveChangesAndClearAllTrackingAsync(CancellationToken cancellationToken = default)
{
var count = await _dbContext.SaveChangesAsync(cancellationToken);
_dbContext.ChangeTracker.Clear();
return count > 0;
}
#endregion #endregion
#region #region
+1 -1
View File
@@ -99,7 +99,7 @@ steps:
- name: publish-test-irc - name: publish-test-irc
commands: commands:
- echo start publish test-irc-api - echo start publish test-irc-api
- cd /opt/1panel/hang/devops/test-irc-net8 - cd /opt/1panel/hang/devops/test-irc
- sh test-irc.sh v${DRONE_BUILD_NUMBER} - sh test-irc.sh v${DRONE_BUILD_NUMBER}
trigger: trigger: