修改裁判标价判定
continuous-integration/drone/push Build is passing Details

IRC_NewDev
hang 2024-08-09 13:12:05 +08:00
parent 202a3c26d1
commit cebcf908f9
8 changed files with 157 additions and 65 deletions

View File

@ -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

View File

@ -63,10 +63,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
<PackageReference Include="DocX" Version="3.0.1" />
<PackageReference Include="FreeSpire.Doc" Version="12.2.0" />
<PackageReference Include="Hangfire.Core" Version="1.8.12" />
<PackageReference Include="BeetleX.BNR" Version="1.0.1" />
<PackageReference Include="Hangfire.Core" Version="1.8.14" />
<PackageReference Include="Castle.Core.AsyncInterceptor" Version="2.1.0" />
<PackageReference Include="EasyCaching.Redis" Version="1.9.2" />
<PackageReference Include="EasyCaching.InMemory" Version="1.9.2" />
@ -74,22 +74,22 @@
<PackageReference Include="ExcelDataReader.DataSet" Version="3.6.0" />
<PackageReference Include="DistributedLock.Redis" Version="1.0.3" />
<PackageReference Include="DistributedLock.SqlServer" Version="1.0.4" />
<PackageReference Include="fo-dicom" Version="5.1.2" />
<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.1.2" />
<PackageReference Include="fo-dicom.Codecs" Version="5.12.0" />
<PackageReference Include="fo-dicom" Version="5.1.3" />
<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.1.3" />
<PackageReference Include="fo-dicom.Codecs" Version="5.14.4" />
<PackageReference Include="IP2Region.Net" Version="2.0.2" />
<PackageReference Include="MailKit" Version="4.2.0" />
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="MimeKit" Version="4.2.0" />
<PackageReference Include="MiniExcel" Version="1.32.0" />
<PackageReference Include="Minio" Version="6.0.2" />
<PackageReference Include="Minio" Version="6.0.3" />
<PackageReference Include="MiniWord" Version="0.8.0" />
<PackageReference Include="My.Extensions.Localization.Json" Version="3.3.0">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="NPOI" Version="2.7.0" />
<PackageReference Include="NPOI" Version="2.7.1" />
<PackageReference Include="Panda.DynamicWebApi" Version="1.2.2" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
<PackageReference Include="WinSCP" Version="6.3.3" />
</ItemGroup>

View File

@ -543,9 +543,19 @@
<returns></returns>
<exception cref="T:System.Exception"></exception>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetTrialList_Export(IRaCIS.Core.Application.Contracts.TrialToBeDoneQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},IRaCIS.Application.Interfaces.IDictionaryService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial})">
<summary>
项目列表导出---new
</summary>
<param name="inQuery"></param>
<param name="_commonDocumentRepository"></param>
<param name="_dictionaryService"></param>
<param name="_trialRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.PMTrainingRecordList_Export(IRaCIS.Core.Application.Contracts.DocumentTrialUnionQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},IRaCIS.Application.Interfaces.IDictionaryService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial})">
<summary>
getDocumentConfirmList 培训记录导出
getDocumentConfirmList 培训记录导出--new
</summary>
<param name="inQuery"></param>
<param name="_commonDocumentRepository"></param>

View File

@ -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<SubjectExportDTO>(_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<Trial> _trialRepository)
{
var list = await _repository.Where<VisitTask>(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<CommonDocument>(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<CommonDocument>(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<T> DealJudgeMark<T>(ArbitrationRule arbitrationRule, IEnumerable<T> 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<VisitTask>(t => t.TrialId == queryVisitTask.TrialId && t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && t.ReadingTaskState == ReadingTaskState.HaveSigned)
var list = await _repository.Where<VisitTask>(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<VisitTask>(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)

View File

@ -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;

View File

@ -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<GlobalAnswerInfo> GlobalTaskAnswerList { get; set; }
//public List<GlobalAnswerInfo> GlobalTaskAnswerList { get; set; }
}

View File

@ -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})))
;

View File

@ -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