diff --git a/IRaCIS.Core.API/appsettings.json b/IRaCIS.Core.API/appsettings.json index 05fb3c082..d9c500e4b 100644 --- a/IRaCIS.Core.API/appsettings.json +++ b/IRaCIS.Core.API/appsettings.json @@ -4,10 +4,10 @@ "Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Hangfire_IRaCIS;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true" }, "JwtSetting": { - "SecurityKey": "3e6dbfa227234a03977a2f421bdb7f4f", // 密钥 - "Issuer": "IRaCIS", // 颁发者 - "Audience": "ZhiZhun", // 接收者 - "TokenExpireDays": "7" // 过期时间(7day) + "SecurityKey": "3e6dbfa227234a03977a2f421bdb7f4f", // 锟斤拷钥 + "Issuer": "IRaCIS", // 锟戒发锟斤拷 + "Audience": "ZhiZhun", // 锟斤拷锟斤拷锟斤拷 + "TokenExpireDays": "7" // 锟斤拷锟斤拷时锟戒(7day锟斤拷 }, "IpRateLimiting": { "EnableEndpointRateLimiting": true, //False: globally executed, true: executed for each @@ -80,7 +80,7 @@ "DefaultPassword": "123456" } - //网站根地址,为了访问文件 dicom 和上传的文档... 实测发现不用将域名拼接返回,浏览器会自动加上当前ip,避免了多环境读取环境配置文件 + //锟斤拷站锟斤拷锟斤拷址锟斤拷为锟剿凤拷锟斤拷锟侥硷拷 dicom 锟斤拷锟较达拷锟斤拷锟侥碉拷... 实锟解发锟街诧拷锟矫斤拷锟斤拷锟斤拷拼锟接凤拷锟截o拷锟斤拷锟斤拷锟斤拷锟斤拷远锟斤拷锟斤拷系锟角癷p锟斤拷锟斤拷锟斤拷锟剿多环锟斤拷锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟侥硷拷 diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs index 67b991764..180987ae5 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/TaskConsistentRuleViewModel.cs @@ -205,19 +205,7 @@ namespace IRaCIS.Core.Application.ViewModel public ReReadingOrBackOptType OptType { get; set; } } - public enum ReReadingOrBackOptType - { - //鍙栨秷鍒嗛厤 - CancelAssign=0, - //澶辨晥 - Abandon=1, - - //閲嶉槄閲嶇疆 - - Return=2, - - } public class VisitTaskSimpleView { public Guid Id { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs index 73575daa0..d0e172aa4 100644 --- a/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Allocation/DTO/VisitTaskViewModel.cs @@ -240,6 +240,8 @@ namespace IRaCIS.Core.Application.ViewModel public string? TaskCode { get; set; } + public String? TrialSiteCode { get; set; } + public ReReadingApplyState? ReReadingApplyState { get; set; } diff --git a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs index 76d5fffe2..58a12f996 100644 --- a/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs +++ b/IRaCIS.Core.Application/Service/Allocation/VisitTaskService.cs @@ -688,6 +688,8 @@ namespace IRaCIS.Core.Application.Service.Allocation .WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId) .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory) .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState) + + .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode) || t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode)) .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate) @@ -724,6 +726,8 @@ namespace IRaCIS.Core.Application.Service.Allocation .WhereIf(queryVisitTask.DoctorUserId != null, t => t.DoctorUserId == queryVisitTask.DoctorUserId) .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState) .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState) + + .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode) || t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode)) .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate) @@ -763,6 +767,7 @@ namespace IRaCIS.Core.Application.Service.Allocation .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory) .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.ReadingTaskState == queryVisitTask.ReadingTaskState) .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState) + .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode) || t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode)) .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate) @@ -803,6 +808,7 @@ namespace IRaCIS.Core.Application.Service.Allocation .WhereIf(queryVisitTask.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == queryVisitTask.DoctorUserId) .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.OriginalReReadingTask.ReadingTaskState == queryVisitTask.ReadingTaskState) .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.OriginalReReadingTask.TaskAllocationState == queryVisitTask.TaskAllocationState) + .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => t.OriginalReReadingTask.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode) || t.OriginalReReadingTask.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.OriginalReReadingTask.TaskName.Contains(queryVisitTask.TaskName) || t.OriginalReReadingTask.TaskBlindName.Contains(queryVisitTask.TaskName)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.OriginalReReadingTask.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.OriginalReReadingTask.BlindSubjectCode.Contains(queryVisitTask.SubjectCode)) .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime > queryVisitTask.BeginAllocateDate) @@ -841,6 +847,7 @@ namespace IRaCIS.Core.Application.Service.Allocation .WhereIf(queryVisitTask.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == queryVisitTask.DoctorUserId) .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.OriginalReReadingTask.ReadingTaskState == queryVisitTask.ReadingTaskState) .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.OriginalReReadingTask.TaskAllocationState == queryVisitTask.TaskAllocationState) + .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => t.OriginalReReadingTask.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode) || t.OriginalReReadingTask.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.OriginalReReadingTask.TaskName.Contains(queryVisitTask.TaskName) || t.NewReReadingTask.TaskBlindName.Contains(queryVisitTask.TaskName)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.OriginalReReadingTask.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.OriginalReReadingTask.BlindSubjectCode.Contains(queryVisitTask.SubjectCode)) .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime > queryVisitTask.BeginAllocateDate) @@ -872,6 +879,7 @@ namespace IRaCIS.Core.Application.Service.Allocation .WhereIf(queryVisitTask.DoctorUserId != null, t => t.OriginalReReadingTask.DoctorUserId == queryVisitTask.DoctorUserId) .WhereIf(queryVisitTask.ReadingTaskState != null, t => t.OriginalReReadingTask.ReadingTaskState == queryVisitTask.ReadingTaskState) .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.OriginalReReadingTask.TaskAllocationState == queryVisitTask.TaskAllocationState) + .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => t.OriginalReReadingTask.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode) || t.OriginalReReadingTask.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.OriginalReReadingTask.TaskName.Contains(queryVisitTask.TaskName) || t.NewReReadingTask.TaskBlindName.Contains(queryVisitTask.TaskName)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.OriginalReReadingTask.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.OriginalReReadingTask.BlindSubjectCode.Contains(queryVisitTask.SubjectCode)) .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.OriginalReReadingTask.AllocateTime > queryVisitTask.BeginAllocateDate) @@ -1046,6 +1054,7 @@ namespace IRaCIS.Core.Application.Service.Allocation .WhereIf(queryVisitTask.ReadingCategory != null, t => t.ReadingCategory == queryVisitTask.ReadingCategory) .WhereIf(queryVisitTask.TaskAllocationState != null, t => t.TaskAllocationState == queryVisitTask.TaskAllocationState) .WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) + .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TrialSiteCode), t => t.BlindTrialSiteCode.Contains(queryVisitTask.TrialSiteCode) || t.Subject.TrialSite.TrialSiteCode.Contains(queryVisitTask.TrialSiteCode)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.TaskName), t => t.TaskName.Contains(queryVisitTask.TaskName) || t.TaskBlindName.Contains(queryVisitTask.TaskName)) .WhereIf(!string.IsNullOrEmpty(queryVisitTask.SubjectCode), t => t.Subject.Code.Contains(queryVisitTask.SubjectCode) || t.BlindSubjectCode.Contains(queryVisitTask.SubjectCode)) .WhereIf(queryVisitTask.BeginAllocateDate != null, t => t.AllocateTime > queryVisitTask.BeginAllocateDate) @@ -1296,8 +1305,12 @@ namespace IRaCIS.Core.Application.Service.Allocation #region 褰卞搷鐨勪换鍔 + + var influenceTaskList = await _visitTaskRepository.Where(filterExpression, true).ToListAsync(); + var trakingOrigenalTask = influenceTaskList.Where(t => t.Id == origenalTask.Id).First(); + foreach (var influenceTask in influenceTaskList) { //澶勭悊鐢宠鐨勪换鍔 @@ -1305,18 +1318,17 @@ namespace IRaCIS.Core.Application.Service.Allocation { ReReadingTaskTrackingDeal(influenceTask, agreeReReadingCommand); - influenceTaskList.ForEach(t => - { - //璁板綍瀹為檯褰卞儚鐨勪换鍔 + //influenceTaskList.ForEach(t => + //{ + // //璁板綍瀹為檯褰卞儚鐨勪换鍔 + + // influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + //}); - influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); - }); //灏嗗尰瀛﹀鏍歌缃负澶辨晥 - var taskIdList = influenceTaskList.Select(t => t.Id).ToList(); - - await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.VisitTaskId) && t.AuditState != MedicalReviewAuditState.HaveSigned, u => new TaskMedicalReview() { IsInvalid = false }); + await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.VisitTaskId) && t.AuditState == MedicalReviewAuditState.WaitAudit, u => new TaskMedicalReview() { IsInvalid = false }); } //鐢宠鐨勮瑙 瑕佷笉鏄噸闃呴噸缃紝瑕佷笉灏辨槸澶辨晥 涓嶄細瀛樺湪鍙栨秷鍒嗛厤 @@ -1325,10 +1337,13 @@ namespace IRaCIS.Core.Application.Service.Allocation if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) { influenceTask.TaskState = TaskState.HaveReturned; + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } else if (influenceTask.ReadingTaskState == ReadingTaskState.Reading) { influenceTask.TaskState = TaskState.Adbandon; + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Abandon }); } else { @@ -1336,6 +1351,8 @@ namespace IRaCIS.Core.Application.Service.Allocation influenceTask.AllocateTime = null; influenceTask.SuggesteFinishedTime = null; influenceTask.TaskAllocationState = TaskAllocationState.NotAllocate; + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.CancelAssign }); } } //褰撳墠璁胯 @@ -1344,10 +1361,14 @@ namespace IRaCIS.Core.Application.Service.Allocation if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) { influenceTask.TaskState = TaskState.HaveReturned; + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } else { influenceTask.TaskState = TaskState.Adbandon; + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Abandon }); } } @@ -1411,6 +1432,8 @@ namespace IRaCIS.Core.Application.Service.Allocation var influenceTaskList = await _visitTaskRepository.Where(filterExpression, true).ToListAsync(); + var trakingOrigenalTask = influenceTaskList.Where(t => t.Id == origenalTask.Id).First(); + foreach (var influenceTask in influenceTaskList) { //澶勭悊鐢宠鐨勪换鍔 @@ -1418,22 +1441,28 @@ namespace IRaCIS.Core.Application.Service.Allocation { ReReadingTaskTrackingDeal(influenceTask, agreeReReadingCommand); - influenceTaskList.ForEach(t => - { - //璁板綍瀹為檯褰卞儚鐨勪换鍔 + //influenceTaskList.ForEach(t => + //{ + // //璁板綍瀹為檯褰卞儚鐨勪换鍔 - influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); - }); + // influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + //}); + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } else { if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) { influenceTask.TaskState = TaskState.HaveReturned; + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } else { influenceTask.TaskState = TaskState.Adbandon; + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Abandon }); } } } @@ -1504,6 +1533,8 @@ namespace IRaCIS.Core.Application.Service.Allocation var influenceTaskList = await _visitTaskRepository.Where(filterExpression, true).ToListAsync(); + var trakingOrigenalTask = influenceTaskList.Where(t => t.Id == origenalTask.Id).First(); + foreach (var influenceTask in influenceTaskList) { @@ -1512,12 +1543,18 @@ namespace IRaCIS.Core.Application.Service.Allocation { ReReadingTaskTrackingDeal(influenceTask, agreeReReadingCommand); - influenceTaskList.ForEach(t => - { - //璁板綍瀹為檯褰卞儚鐨勪换鍔 + //influenceTaskList.ForEach(t => + //{ + // //璁板綍瀹為檯褰卞儚鐨勪换鍔 - influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); - }); + // influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + //}); + + //灏嗗尰瀛﹀鏍歌缃负澶辨晥 + var taskIdList = influenceTaskList.Select(t => t.Id).ToList(); + await _taskMedicalReviewRepository.UpdatePartialFromQueryAsync(t => taskIdList.Contains(t.VisitTaskId) && t.AuditState == MedicalReviewAuditState.WaitAudit, u => new TaskMedicalReview() { IsInvalid = false }); + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } //澶勭悊鍏朵粬浠诲姟 else @@ -1525,10 +1562,14 @@ namespace IRaCIS.Core.Application.Service.Allocation if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) { influenceTask.TaskState = TaskState.HaveReturned; + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } else { influenceTask.TaskState = TaskState.Adbandon; + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Abandon }); } @@ -1594,6 +1635,8 @@ namespace IRaCIS.Core.Application.Service.Allocation var influenceTaskList = await _visitTaskRepository.Where(filterExpression, true).ToListAsync(); + var trakingOrigenalTask = influenceTaskList.Where(t => t.Id == origenalTask.Id).First(); + foreach (var influenceTask in influenceTaskList) { //鐢宠鍘熶换鍔″鐞 @@ -1601,23 +1644,28 @@ namespace IRaCIS.Core.Application.Service.Allocation { ReReadingTaskTrackingDeal(influenceTask, agreeReReadingCommand); - influenceTaskList.ForEach(t => - { - //璁板綍瀹為檯褰卞儚鐨勪换鍔 + //influenceTaskList.ForEach(t => + //{ + // //璁板綍瀹為檯褰卞儚鐨勪换鍔 - influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); - }); + // influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + //}); + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } else { if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) { influenceTask.TaskState = TaskState.HaveReturned; + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } else { influenceTask.TaskState = TaskState.Adbandon; + + trakingOrigenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Abandon }); } } @@ -1874,18 +1922,21 @@ namespace IRaCIS.Core.Application.Service.Allocation #region 鏂瑰紡浜 + var origenalTask = influenceTaskList.Where(t => t.Id == task.Id).First(); + foreach (var influenceTask in influenceTaskList) { - //鍚屾剰鐨勮瑙 - if (influenceTask.Id == task.Id) - { - influenceTaskList.ForEach(t => - { - //璁板綍瀹為檯褰卞儚鐨勪换鍔 + + ////鍚屾剰鐨勮瑙 鍥犱负瑕佽褰曞叿浣撶殑鎿嶄綔锛屾墍浠ュ簾寮 + //if (influenceTask.Id == task.Id) + //{ + // influenceTaskList.ForEach(t => + // { + // //璁板綍瀹為檯褰卞儚鐨勪换鍔 - influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); - }); - } + // influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + // }); + //} //鐢宠鐨勮瑙 瑕佷笉鏄噸闃呴噸缃紝瑕佷笉灏辨槸澶辨晥 涓嶄細瀛樺湪鍙栨秷鍒嗛厤 if (influenceTask.ReadingCategory == ReadingCategory.Visit && influenceTask.VisitTaskNum != task.VisitTaskNum) @@ -1894,10 +1945,13 @@ namespace IRaCIS.Core.Application.Service.Allocation if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) { influenceTask.TaskState = TaskState.HaveReturned; + + origenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id,OptType=ReReadingOrBackOptType.Return }); } else if (influenceTask.ReadingTaskState == ReadingTaskState.Reading) { influenceTask.TaskState = TaskState.Adbandon; + origenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Abandon }); } else { @@ -1905,6 +1959,8 @@ namespace IRaCIS.Core.Application.Service.Allocation influenceTask.AllocateTime = null; influenceTask.SuggesteFinishedTime = null; influenceTask.TaskAllocationState = TaskAllocationState.NotAllocate; + + origenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.CancelAssign }); } } else @@ -1914,10 +1970,12 @@ namespace IRaCIS.Core.Application.Service.Allocation if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) { influenceTask.TaskState = TaskState.HaveReturned; + origenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } else { influenceTask.TaskState = TaskState.Adbandon; + origenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Abandon }); } } @@ -1956,28 +2014,34 @@ namespace IRaCIS.Core.Application.Service.Allocation var currentVisitList = await _visitTaskRepository.Where(t => t.SourceSubjectVisitId == task.SourceSubjectVisitId && t.ReadingCategory == ReadingCategory.Visit && t.TaskState == TaskState.Effect && t.VisitTaskNum == task.VisitTaskNum, true).ToListAsync(); - foreach (var visitTask in currentVisitList) + var origenalTask = currentVisitList.Where(t => t.Id == task.Id).First(); + + foreach (var influenceTask in currentVisitList) { - if (visitTask.ReadingTaskState == ReadingTaskState.HaveSigned) + if (influenceTask.ReadingTaskState == ReadingTaskState.HaveSigned) { //鍙﹀闃呯墖浜哄畬鎴愰槄鐗囦簡 灏辫缃负閲嶉槄閲嶇疆 - visitTask.TaskState = TaskState.HaveReturned; + influenceTask.TaskState = TaskState.HaveReturned; + + origenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Return }); } else { - visitTask.TaskState = TaskState.Adbandon; + influenceTask.TaskState = TaskState.Adbandon; + + origenalTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = influenceTask.Id, OptType = ReReadingOrBackOptType.Abandon }); } - //鍚屾剰鐨勮瑙 - if (visitTask.Id == task.Id) - { - currentVisitList.ForEach(t => - { - //璁板綍瀹為檯褰卞儚鐨勪换鍔 + ////鍚屾剰鐨勮瑙 + //if (influenceTask.Id == task.Id) + //{ + // currentVisitList.ForEach(t => + // { + // //璁板綍瀹為檯褰卞儚鐨勪换鍔 - visitTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); - }); - } + // influenceTask.TaskInfluenceList.Add(new TaskInfluence() { InfluenceTaskId = t.Id }); + // }); + //} } } @@ -2365,7 +2429,7 @@ namespace IRaCIS.Core.Application.Service.Allocation /// public async Task> GetInfluencedTaskList(Guid taskId) { - var list = await _repository.Where(t => t.OriginalTaskId == taskId).Select(t => t.InfluenceTask).ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + var list = await _repository.Where(t => t.OriginalTaskId == taskId)/*.Select(t => t.InfluenceTask)*/.ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); return list; } diff --git a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs index cd99dcc3d..92e36de18 100644 --- a/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs @@ -71,8 +71,8 @@ namespace IRaCIS.Core.Application.Service CreateMap().IncludeBase() .ForMember(o => o.AssignedSubjectCount, t => t.MapFrom(u => u.Enroll.DoctorTrialVisitTaskList.Select(t=>t.SubjectId).Distinct().Count())) - .ForMember(o => o.WaitDealAllTaskCount, t => t.MapFrom(u => u.Enroll.DoctorTrialVisitTaskList.Where(t=>t.ReadingTaskState!=ReadingTaskState.HaveSigned && t.TaskState==TaskState.Effect).Count())) - .ForMember(o => o.WaitDealTrialTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect).Count())); + .ForMember(o => o.WaitDealTrialTaskCount, t => t.MapFrom(u => u.Enroll.DoctorTrialVisitTaskList.Where(t=>t.ReadingTaskState!=ReadingTaskState.HaveSigned && t.TaskState==TaskState.Effect).Count())) + .ForMember(o => o.WaitDealAllTaskCount, t => t.MapFrom(u => u.DoctorUser.VisitTaskList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskState == TaskState.Effect).Count())); @@ -244,8 +244,17 @@ namespace IRaCIS.Core.Application.Service CreateMap() //.ForMember(o => o.DoctorUser, t => t.MapFrom(u => u.DoctorUser)) .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode)) - .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code)); - + .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code)) + .ForMember(o => o.OptType, t => t.Ignore()); + + + CreateMap().IncludeMembers(c => c.InfluenceTask) + .ForMember(o => o.OptType, t => t.MapFrom(u => u.OptType)) + .ForMember(o => o.Id, t => t.MapFrom(u => u.InfluenceTask.Id)); + + + + } } diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs index 95f71c2c9..3b7c447f5 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/DTO/TrialSiteSurveyViewModel.cs @@ -49,6 +49,14 @@ namespace IRaCIS.Core.Application.Contracts public bool IsHaveSiteSurveyRecord { get; set; } } + + public class TrialSiteSimpleSelect + { + + public string TrialSiteCode { get; set; } = string.Empty; + + } + public class LoginReturnDTO { public TrialSurveyInitInfo TrialInfo { get; set; } = new TrialSurveyInitInfo(); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs index e57c2d2d7..4bbcb5f72 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs @@ -328,6 +328,20 @@ namespace IRaCIS.Core.Application.Services } + public async Task> GetTrialSiteCodeSelect(Guid trialId,bool isIncludeVirtualSite) + { + //CRC鍙湅鍒颁粬璐熻矗鐨 + + var list = await _trialSiteRepository.Where(t => t.TrialId == trialId) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .Select(t=> t.TrialSiteCode).ToListAsync(); + + var virtualList = await _repository.Where(t => t.IsSelfAnalysis==true).Select(t => t.BlindTrialSiteCode).Distinct().ToListAsync(); + + return isIncludeVirtualSite? list.Concat(virtualList): list; + } + + /// 鍒犻櫎 椤圭洰 涓嬫煇涓site [HttpDelete("{id:guid}/{trialId:guid}")] [TrialAudit(AuditType.TrialAudit, AuditOptType.DeleteTrialSite)] diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 1dc59989b..f53467bed 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -19,7 +19,7 @@ namespace IRaCIS.Application.Services //_cache = cache; } - public async Task Get() + public async Task Get() { //var subject1 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693"); @@ -45,7 +45,11 @@ namespace IRaCIS.Application.Services // Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][redis:city/0000000]")); //} - var needAddVisitList = await _repository.Where(t => t.TrialId == Guid.Empty).DistinctBy(t => t.VisitTaskNum).ToListAsync(); + //var needAddVisitList = await _repository.Where(t => t.TrialId == Guid.Empty).DistinctBy(t => t.VisitTaskNum).ToListAsync(); + + await _repository.BatchUpdateAsync(t => t.InfluenceTask.TaskState == Core.Domain.Share.TaskState.HaveReturned, u => new TaskInfluence() { OptType = ReReadingOrBackOptType.Return }); + + await _repository.BatchUpdateAsync(t => t.InfluenceTask.TaskState == Core.Domain.Share.TaskState.Adbandon, u => new TaskInfluence() { OptType = ReReadingOrBackOptType.Abandon }); return _userInfo.LocalIp; } diff --git a/IRaCIS.Core.Domain/Allocation/TaskInfluence.cs b/IRaCIS.Core.Domain/Allocation/TaskInfluence.cs index 5a5d9dc10..2b2e393ea 100644 --- a/IRaCIS.Core.Domain/Allocation/TaskInfluence.cs +++ b/IRaCIS.Core.Domain/Allocation/TaskInfluence.cs @@ -9,30 +9,50 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { - /// - ///TaskInfluence - /// - [Table("TaskInfluence")] - public class TaskInfluence : Entity, IAuditAdd - { - + /// + ///TaskInfluence + /// + [Table("TaskInfluence")] + public class TaskInfluence : Entity, IAuditAdd + { - public Guid CreateUserId { get; set; } - - public DateTime CreateTime { get; set; } - - - public Guid OriginalTaskId { get; set; } - - public VisitTask OriginalTask { get; set; } - - public VisitTask InfluenceTask { get; set; } + public Guid CreateUserId { get; set; } - public Guid InfluenceTaskId { get; set; } - - } + public DateTime CreateTime { get; set; } -} + + public Guid OriginalTaskId { get; set; } + + public VisitTask OriginalTask { get; set; } + + public VisitTask InfluenceTask { get; set; } + + + public Guid InfluenceTaskId { get; set; } + + + + //瀵瑰奖鍝嶄换鍔¤繘琛岀殑鎿嶄綔 + public ReReadingOrBackOptType OptType { get; set; } + + } + + + public enum ReReadingOrBackOptType + { + //鍙栨秷鍒嗛厤 + CancelAssign = 0, + + //澶辨晥 + Abandon = 1, + + //閲嶉槄閲嶇疆 + + Return = 2, + + } + +} diff --git a/IRaCIS.Core.Domain/Dcotor/Doctor.cs b/IRaCIS.Core.Domain/Dcotor/Doctor.cs index 10e83375f..51751ab24 100644 --- a/IRaCIS.Core.Domain/Dcotor/Doctor.cs +++ b/IRaCIS.Core.Domain/Dcotor/Doctor.cs @@ -16,6 +16,7 @@ namespace IRaCIS.Core.Domain.Models public List TrialExperienceCriteriaList { get; set; } + // UserDoctor表关联 一个医生 可被多个用户管理 public List UserList { get; set; } diff --git a/IRaCIS.Core.Domain/Management/User.cs b/IRaCIS.Core.Domain/Management/User.cs index cb19102bb..dba284318 100644 --- a/IRaCIS.Core.Domain/Management/User.cs +++ b/IRaCIS.Core.Domain/Management/User.cs @@ -19,6 +19,8 @@ namespace IRaCIS.Core.Domain.Models public List UserRoleList { get; set; } = new List(); public List UserTrials { get; set; } = new List(); + public List VisitTaskList { get; set; } + [StringLength(255)] public string UserName { get; set; } = String.Empty; diff --git a/IRaCIS.Core.Domain/Trial/Enroll.cs b/IRaCIS.Core.Domain/Trial/Enroll.cs index ea25b09bc..611031f58 100644 --- a/IRaCIS.Core.Domain/Trial/Enroll.cs +++ b/IRaCIS.Core.Domain/Trial/Enroll.cs @@ -71,6 +71,8 @@ namespace IRaCIS.Core.Domain.Models + + public List EnrollReadingCategoryList { get; set; } } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 7f1109c3c..8b267cefb 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -90,8 +90,9 @@ namespace IRaCIS.Core.Infra.EFCore + modelBuilder.Entity().HasMany(t => t.VisitTaskList).WithOne(t => t.DoctorUser).HasForeignKey(t => t.DoctorUserId); - modelBuilder.Entity().HasMany(t => t.DoctorTrialVisitTaskList).WithOne(t => t.Enroll).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }); + modelBuilder.Entity().HasOne(t => t.Enroll).WithMany(t => t.DoctorTrialVisitTaskList).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId }); //modelBuilder.Entity().HasMany(t => t.DoctorVisitTaskList).WithOne(t => t.DoctorTaskAllocationRule).HasForeignKey(t => new { t.DoctorUserId, t.TrialId }).HasPrincipalKey(u => new { u.DoctorUserId, u.TrialId });