diff --git a/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs b/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs index 11159c5cd..eaa357c55 100644 --- a/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs +++ b/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using static BeetleX.Redis.Commands.HSCAN; using static IRaCIS.Core.Application.Service.Common.SystemMonitor; namespace IRaCIS.Core.Application.Helper diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index 72dc549f8..ab2113cba 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -63,10 +63,10 @@ - + + - - + @@ -74,22 +74,22 @@ - - - + + + - + true - + - + diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index ef44e414d..2b89f02a7 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -543,9 +543,19 @@ + + + 项目列表导出---new + + + + + + + - getDocumentConfirmList 培训记录导出 + getDocumentConfirmList 培训记录导出--new diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index e038ae84c..f3c6f7f5b 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -16,6 +16,7 @@ using MiniExcelLibs; using MiniExcelLibs.OpenXml; using NPOI.HPSF; using NPOI.HSSF.UserModel; +using NPOI.SS.Formula.Functions; using NPOI.XSSF.UserModel; using System; using System.Collections.Generic; @@ -615,9 +616,9 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId) // CRC 只负责他管理site的受试者 - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id)) .ProjectTo(_mapper.ConfigurationProvider) - .WhereIf(inQuery.IsMissingImages == true, t => t.MissingSubmmitCount> 0) + .WhereIf(inQuery.IsMissingImages == true, t => t.MissingSubmmitCount > 0) .WhereIf(inQuery.IsMissingImages == false, t => t.MissingSubmmitCount == 0) ; @@ -1041,7 +1042,7 @@ namespace IRaCIS.Core.Application.Service.Common [FromServices] IRepository _trialRepository) { var list = await _repository.Where(t => t.TrialId == queryVisitTask.TrialId && t.IsAnalysisCreate == false) - //.Where(t => t.IsAnalysisCreate == false && t.DoctorUserId != null) + //.Where(t => t.IsAnalysisCreate == false && t.DoctorUserId != null) .WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) .WhereIf(queryVisitTask.ArmEnum != null, t => t.ArmEnum == queryVisitTask.ArmEnum) @@ -1440,7 +1441,7 @@ namespace IRaCIS.Core.Application.Service.Common list.Add(new ExportDocumentDes() { Code = StaticData.Export.PCWG3Point1DetailedOfEvaluatedLesion_Export, ExportCatogory = ExportCatogory.DetailedOfEvaluatedLesion }); } - var result = _repository.Where(t => list.Select(c => c.Code).Contains(t.Code)).Select(c => new ExportDocumentDes() { Code = c.Code, FileName =_userInfo.IsEn_Us?c.Name:c.NameCN }).ToList(); + var result = _repository.Where(t => list.Select(c => c.Code).Contains(t.Code)).Select(c => new ExportDocumentDes() { Code = c.Code, FileName = _userInfo.IsEn_Us ? c.Name : c.NameCN }).ToList(); foreach (var item in list) { @@ -1451,73 +1452,156 @@ namespace IRaCIS.Core.Application.Service.Common public List DealJudgeMark(ArbitrationRule arbitrationRule, IEnumerable list) where T : OverallTumorEvaluationExport { - //处理裁判标记 - - var resultList = list.Where(t => t.ReadingCategory != ReadingCategory.Judge).ToList(); + //处理访视任务的裁判标记 + var resultExceptJudgeList = list.Where(t => t.ReadingCategory != ReadingCategory.Judge).ToList(); + var judegeList = list.Where(t => t.ReadingCategory == ReadingCategory.Judge).ToList(); if (arbitrationRule == ArbitrationRule.Visit) { - foreach (var item in resultList) + foreach (var item in resultExceptJudgeList) { - item.IsGenerateJudge = list.FirstOrDefault(t => t.ReadingCategory == ReadingCategory.Judge && t.SubjectCode == item.SubjectCode + item.IsGenerateJudge = judegeList.FirstOrDefault(t => t.SubjectCode == item.SubjectCode && (t.VisitTaskNum - ReadingCommon.TaskNumDic[ReadingCategory.Judge]) == item.VisitTaskNum)?.JudgeArmEnum == item.ArmEnum ? true : false; } + //如果没有产生裁判,默认选择R1 + + //找到没有裁判的访视任务 + var notJudgeList = resultExceptJudgeList.GroupBy(t => new { t.SubjectCode, t.VisitTaskNum }).Where(g => g.All(t => t.IsGenerateJudge == false)).Select(g => new { g.Key.SubjectCode, g.Key.VisitTaskNum }).ToList(); + + foreach (var item in resultExceptJudgeList) + { + if (notJudgeList.Any(t => t.SubjectCode == item.SubjectCode && t.VisitTaskNum == item.VisitTaskNum) && item.ArmEnum == Arm.DoubleReadingArm1) + { + item.IsGenerateJudge = true; + } + } + } if (arbitrationRule == ArbitrationRule.Reading) { - //先确定裁判选定的是谁 - foreach (var item in resultList) + //处理访视裁判标记 + foreach (var visitItem in resultExceptJudgeList.Where(t => t.ReadingCategory == ReadingCategory.Visit)) { - //以最后一次裁判为准 找到最大的裁判的裁判选择的Arm,相同就设置裁判标记 - item.IsGenerateJudge = list.Where(t => t.ReadingCategory == ReadingCategory.Judge && t.SubjectCode == item.SubjectCode && t.VisitTaskNum > item.VisitTaskNum - ).OrderByDescending(t => t.VisitTaskNum).FirstOrDefault()?.JudgeArmEnum == item.ArmEnum ? true : false; + //默认设置为false 只处理为true 和 空的情况 + visitItem.IsGenerateJudge = false; - } - - //访视、全局列表中过滤出访视进行处理 - foreach (var item in resultList.Where(t => t.ReadingCategory == ReadingCategory.Visit)) - { - //全局裁判了,选择了那个全局,那么对应全局下面的访视 设置裁判标记 - - var selectJudegeGlobalList = resultList.Where(t => t.ReadingCategory == ReadingCategory.Global && t.IsGenerateJudge == true).ToList(); - - if (selectJudegeGlobalList.Count == 0) + if (judegeList.Count > 0) { - //生成了裁判,但是裁判没有做 - item.IsGenerateJudge = null; + var maxFinishedJudge = judegeList.Where(t => t.ReadingTaskState == ReadingTaskState.HaveSigned).FirstOrDefault(); + + var maxNotFinishedJudge = judegeList.Where(t => t.ReadingTaskState != ReadingTaskState.HaveSigned).FirstOrDefault(); + + if (maxFinishedJudge == null && maxNotFinishedJudge != null) + { + //仅有一个未完成的全局裁判,那么都是null + if (visitItem.VisitTaskNum < maxNotFinishedJudge.VisitTaskNum) + { + visitItem.IsGenerateJudge = null; + } + } + else if (maxFinishedJudge != null && maxNotFinishedJudge == null) + { + //全局裁判都完成了,那么以最后一次裁判选择的为准 + + if (visitItem.ArmEnum == maxFinishedJudge.JudgeArmEnum && visitItem.VisitTaskNum < maxFinishedJudge.VisitTaskNum) + { + visitItem.IsGenerateJudge = true; + } + + else if (visitItem.ArmEnum == Arm.DoubleReadingArm1) + { + visitItem.IsGenerateJudge = true; + } + } + else + { + //两个都不为null 肯定是不同的裁判 + + //在完成裁判之后的,和未完成裁判之前的 + if (visitItem.VisitTaskNum < maxNotFinishedJudge.VisitTaskNum && visitItem.VisitTaskNum > maxFinishedJudge.VisitTaskNum) + { + visitItem.IsGenerateJudge = null; + } + + else if (visitItem.ArmEnum == maxFinishedJudge.JudgeArmEnum && visitItem.VisitTaskNum < maxFinishedJudge.VisitTaskNum) + { + visitItem.IsGenerateJudge = true; + } + + else if (visitItem.ArmEnum == Arm.DoubleReadingArm1) + { + visitItem.IsGenerateJudge = true; + } + + } } else { - - if(selectJudegeGlobalList.Where(t => t.SubjectCode == item.SubjectCode).SelectMany(t => t.GlobalTaskAnswerList).Any(t => t.VisitTaskId == item.Id)) + //不存在裁判 将R1设置 + if (visitItem.ArmEnum == Arm.DoubleReadingArm1) { - item.IsGenerateJudge = true; + visitItem.IsGenerateJudge = true; } - - } - } + } + #region 全局的维度考虑 - } + //// 该阅片人 subject 已完成的最大的全局(全局都是已完成的任务,裁判可能完成了,可能没完成) + //var subjectMaxGlobal = resultExceptJudgeList.Where(t => t.ReadingCategory == ReadingCategory.Global && t.SubjectCode == item.SubjectCode && t.ArmEnum == item.ArmEnum).OrderByDescending(t => t.VisitTaskNum).FirstOrDefault(); - //如果没有产生裁判,默认选择R1 + ////没有全局 + //if (subjectMaxGlobal == null) + //{ + // //这个时候肯定没有裁判 默认选择R1 - //找到没有裁判的访视任务 - var notJudgeList = resultList.GroupBy(t => new { t.SubjectCode, t.VisitTaskNum }).Where(g => g.All(t => t.IsGenerateJudge == false)).Select(g => new { g.Key.SubjectCode, g.Key.VisitTaskNum }).ToList(); + // if (item.ArmEnum == Arm.DoubleReadingArm1) + // { + // item.IsGenerateJudge = true; + // } - foreach (var item in resultList) - { - if (notJudgeList.Any(t => t.SubjectCode == item.SubjectCode && t.VisitTaskNum == item.VisitTaskNum) && item.ArmEnum == Arm.DoubleReadingArm1) - { - item.IsGenerateJudge = true; + + //} + ////有全局 + //else + //{ + // //判断当前受试者已完成的最大的全局是否有裁判 + // var existSubjectMaxGlobalJudge = judegeList.Where(t => t.SubjectCode == item.SubjectCode && t.VisitTaskNum - ReadingCommon.TaskNumDic[ReadingCategory.Judge] == subjectMaxGlobal.VisitTaskNum).FirstOrDefault(); + + // //最大的全局没有裁判(有一个做完了,有一个没做,或者都做完了,没产生裁判) + // if (existSubjectMaxGlobalJudge == null) + // { + // //找到最大的全局裁判 + // var maxJudgedGlobal= judegeList.Where(t => t.SubjectCode == item.SubjectCode ).OrderByDescending(t => t.VisitTaskNum).FirstOrDefault(); + + + // } + // else + // { + // //将该裁判选择的全局的阅片人之前的裁判标记都设置为是 + + // //是否是裁判选择的 + // if (item.ArmEnum == existSubjectMaxGlobalJudge.JudgeArmEnum) + // { + // //是否是裁判选择之前的 + // if (item.VisitTaskNum < existSubjectMaxGlobalJudge.VisitTaskNum) + // { + // item.IsGenerateJudge = true; + + // } + // } + + // } + + //} + + #endregion } } - - return resultList; + return resultExceptJudgeList; } @@ -1549,8 +1633,10 @@ namespace IRaCIS.Core.Application.Service.Common throw new Exception(_localizer["ExcelExport_UnsupportedExport"]); } - var list = await _repository.Where(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && t.ReadingTaskState == ReadingTaskState.HaveSigned) + var list = await _repository.Where(t => t.TrialId == queryVisitTask.TrialId && t.IsAnalysisCreate == false && t.TaskState == TaskState.Effect) + //访视和全局查询已签名完成的,裁判可以是未签名,未完成的 + .Where(t => (t.ReadingTaskState == ReadingTaskState.HaveSigned && (t.ReadingCategory == ReadingCategory.Visit || t.ReadingCategory == ReadingCategory.Global)) || (t.ReadingCategory == ReadingCategory.Judge)) //.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) //.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) //.WhereIf(queryVisitTask.IsSelfAnalysis != null, t => t.IsSelfAnalysis == queryVisitTask.IsSelfAnalysis) @@ -1677,10 +1763,6 @@ namespace IRaCIS.Core.Application.Service.Common var query = _repository.Where(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && t.ReadingTaskState == ReadingTaskState.HaveSigned) - //.WhereIf(queryVisitTask.SubjectId != null, t => t.SubjectId == queryVisitTask.SubjectId) - //.WhereIf(queryVisitTask.TaskState != null, t => t.TaskState == queryVisitTask.TaskState) - //.WhereIf(queryVisitTask.IsSelfAnalysis != null, t => t.IsSelfAnalysis == queryVisitTask.IsSelfAnalysis) - .WhereIf(queryVisitTask.TrialReadingCriterionId != null, t => t.TrialReadingCriterionId == queryVisitTask.TrialReadingCriterionId) .WhereIf(queryVisitTask.TrialSiteId != null, t => t.Subject.TrialSiteId == queryVisitTask.TrialSiteId) diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 759578cd3..795cb8553 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -16,7 +16,6 @@ using EasyCaching.Core; using IRaCIS.Core.Application.Contracts; using LoginReturnDTO = IRaCIS.Application.Contracts.LoginReturnDTO; using IRaCIS.Core.Application.Auth; -using BeetleX.Redis.Commands; using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Application.Helper; diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index e011609f2..d5981a4a3 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -950,6 +950,8 @@ namespace IRaCIS.Core.Application.Contracts public Arm ArmEnum { get; set; } public string UserName { get; set; } + public ReadingTaskState ReadingTaskState { get; set; } + public ReadingCategory ReadingCategory { get; set; } [DictionaryTranslateAttribute("ExistDisease", CriterionType.RECIST1Point1, nameof(OverallTumorEvaluationExport.IsBaseline), "true")] @@ -964,15 +966,17 @@ namespace IRaCIS.Core.Application.Contracts public Arm? JudgeArmEnum { get; set; } + //public Guid? JudgeResultTaskId { get; set; } + //根据裁判的任务结果 设置访视任务的这个字段 该字段表示 裁判认同该任务的结果 [DictionaryTranslateAttribute("YesOrNo")] public bool? IsGenerateJudge { get; set; } - [JsonIgnore] + //[JsonIgnore] - public List GlobalTaskAnswerList { get; set; } + //public List GlobalTaskAnswerList { get; set; } } diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index 71f380b62..b1bfd53c1 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -199,8 +199,7 @@ namespace IRaCIS.Core.Application.Service .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.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)) - .ForMember(o => o.GlobalTaskAnswerList, t => t.MapFrom(u => u.GlobalVisitResultList.Where(t=>t.GlobalAnswerType== GlobalAnswerType.Question) - .Select(c=>new GlobalAnswerInfo() { GlobalTaskVisitNum=c.VisitTask.VisitTaskNum,VisitTaskId=c.TaskId ,Answer=c.Answer}))) + //.ForMember(o => o.GlobalTaskAnswerList, t => t.MapFrom(u => u.GlobalVisitResultList.Where(t=>t.GlobalAnswerType== GlobalAnswerType.Question).Select(c=>new GlobalAnswerInfo() { GlobalTaskVisitNum=c.VisitTask.VisitTaskNum,VisitTaskId=c.TaskId ,Answer=c.Answer}))) ; diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs index f33e41df5..aa9c99440 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs @@ -12,7 +12,6 @@ using System.Linq.Dynamic.Core; using Microsoft.Extensions.Logging; using IRaCIS.Core.Infrastructure.Extention; using System.Linq; -using BeetleX.Redis.Commands; using NPOI.SS.Formula.Functions; namespace IRaCIS.Application.Services