全量一致性核查初次提交
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
95e0239e42
commit
f1fb2068de
|
|
@ -557,6 +557,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
/// 一致性核查 excel上传 支持三种格式
|
/// 一致性核查 excel上传 支持三种格式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="trialId"></param>
|
/// <param name="trialId"></param>
|
||||||
|
/// <param name="isFullCheck"></param>
|
||||||
/// <param name="oSSService"></param>
|
/// <param name="oSSService"></param>
|
||||||
/// <param name="_inspectionFileRepository"></param>
|
/// <param name="_inspectionFileRepository"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
@ -564,12 +565,14 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
[HttpPost("QCOperation/UploadVisitCheckExcel/{trialId:guid}")]
|
[HttpPost("QCOperation/UploadVisitCheckExcel/{trialId:guid}")]
|
||||||
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
[TrialGlobalLimit("AfterStopCannNotOpt")]
|
||||||
|
|
||||||
public async Task<IResponseOutput> UploadVisitCheckExcel(Guid trialId, [FromServices] IOSSService oSSService, [FromServices] IRepository<InspectionFile> _inspectionFileRepository)
|
public async Task<IResponseOutput> UploadVisitCheckExcel(Guid trialId, bool isFullCheck, [FromServices] IOSSService oSSService, [FromServices] IRepository<InspectionFile> _inspectionFileRepository)
|
||||||
{
|
{
|
||||||
|
|
||||||
var fileName = string.Empty;
|
var fileName = string.Empty;
|
||||||
var templateFileStream = new MemoryStream();
|
var templateFileStream = new MemoryStream();
|
||||||
|
|
||||||
|
var inspectionFileId = Guid.Empty;
|
||||||
|
|
||||||
await FileUploadToOSSAsync(async (realFileName, fileStream) =>
|
await FileUploadToOSSAsync(async (realFileName, fileStream) =>
|
||||||
{
|
{
|
||||||
fileName = realFileName;
|
fileName = realFileName;
|
||||||
|
|
@ -586,7 +589,9 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
|
|
||||||
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId.ToString()}/InspectionUpload/DataReconciliation", realFileName);
|
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId.ToString()}/InspectionUpload/DataReconciliation", realFileName);
|
||||||
|
|
||||||
await _inspectionFileRepository.AddAsync(new InspectionFile() { FileName = realFileName, RelativePath = ossRelativePath, TrialId = trialId }, true);
|
var addEntity = await _inspectionFileRepository.AddAsync(new InspectionFile() { FileName = realFileName, RelativePath = ossRelativePath, TrialId = trialId }, true);
|
||||||
|
|
||||||
|
inspectionFileId = addEntity.Id;
|
||||||
|
|
||||||
return ossRelativePath;
|
return ossRelativePath;
|
||||||
|
|
||||||
|
|
@ -732,8 +737,11 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
|
|
||||||
if (etcCheckList == null || etcCheckList.Count == 0)
|
if (etcCheckList == null || etcCheckList.Count == 0)
|
||||||
{
|
{
|
||||||
|
await _inspectionFileRepository.BatchUpdateNoTrackingAsync(t => t.Id == inspectionFileId, u => new InspectionFile() { CheckState = EDCCheckState.Failed });
|
||||||
|
|
||||||
//---请保证上传数据符合模板文件中的样式,且存在有效数据。
|
//---请保证上传数据符合模板文件中的样式,且存在有效数据。
|
||||||
return ResponseOutput.NotOk(_localizer["UploadDownLoad_InvalidData"]);
|
return ResponseOutput.NotOk(_localizer["UploadDownLoad_InvalidData"]);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -753,6 +761,8 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
|
|
||||||
if (etcCheckList.Count == 0)
|
if (etcCheckList.Count == 0)
|
||||||
{
|
{
|
||||||
|
await _inspectionFileRepository.BatchUpdateNoTrackingAsync(t => t.Id == inspectionFileId, u => new InspectionFile() { CheckState = EDCCheckState.Failed });
|
||||||
|
|
||||||
//---请保证上传数据符合模板文件中的样式,且存在有效数据。
|
//---请保证上传数据符合模板文件中的样式,且存在有效数据。
|
||||||
return ResponseOutput.NotOk(_localizer["UploadDownLoad_InvalidData"]);
|
return ResponseOutput.NotOk(_localizer["UploadDownLoad_InvalidData"]);
|
||||||
}
|
}
|
||||||
|
|
@ -764,8 +774,19 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
//var client = _mediator.CreateRequestClient<ConsistenCheckCommand>();
|
//var client = _mediator.CreateRequestClient<ConsistenCheckCommand>();
|
||||||
//await client.GetResponse<ConsistenCheckResult>(new ConsistenCheckCommand() { ETCList = etcCheckList, TrialId = trialId });
|
//await client.GetResponse<ConsistenCheckResult>(new ConsistenCheckCommand() { ETCList = etcCheckList, TrialId = trialId });
|
||||||
|
|
||||||
//不获取结果,不用定义返回类型
|
if (isFullCheck)
|
||||||
await _mediator.Send(new ConsistenCheckCommand() { ETCList = etcCheckList, TrialId = trialId });
|
{
|
||||||
|
await _mediator.Send(new ConsistenFullCheckCommand() { ETCList = etcCheckList, TrialId = trialId, InspectionFileId = inspectionFileId });
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
//不获取结果,不用定义返回类型
|
||||||
|
await _mediator.Send(new ConsistenCheckCommand() { ETCList = etcCheckList, TrialId = trialId });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -318,11 +318,12 @@
|
||||||
<param name="_noneDicomStudyFileRepository"></param>
|
<param name="_noneDicomStudyFileRepository"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadVisitCheckExcel(System.Guid,IRaCIS.Core.Application.Helper.IOSSService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.InspectionFile})">
|
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadVisitCheckExcel(System.Guid,System.Boolean,IRaCIS.Core.Application.Helper.IOSSService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.InspectionFile})">
|
||||||
<summary>
|
<summary>
|
||||||
一致性核查 excel上传 支持三种格式
|
一致性核查 excel上传 支持三种格式
|
||||||
</summary>
|
</summary>
|
||||||
<param name="trialId"></param>
|
<param name="trialId"></param>
|
||||||
|
<param name="isFullCheck"></param>
|
||||||
<param name="oSSService"></param>
|
<param name="oSSService"></param>
|
||||||
<param name="_inspectionFileRepository"></param>
|
<param name="_inspectionFileRepository"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
|
|
|
||||||
|
|
@ -14614,6 +14614,11 @@
|
||||||
接口请求参考文档:https://www.koudingke.cn/docs/zh-Hans/net-lib-docs/latest/RestSharp/Usage/Usage
|
接口请求参考文档:https://www.koudingke.cn/docs/zh-Hans/net-lib-docs/latest/RestSharp/Usage/Usage
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:IRaCIS.Core.Application.MassTransit.Command.ConsistenFullCheckCommand">
|
||||||
|
<summary>
|
||||||
|
全量一致性核查
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(IRaCIS.Core.Domain.Models.EmailNoticeConfig,MimeKit.MimeMessage,System.Func{System.ValueTuple{System.String,System.String},System.ValueTuple{System.String,System.String}})">
|
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(IRaCIS.Core.Domain.Models.EmailNoticeConfig,MimeKit.MimeMessage,System.Func{System.ValueTuple{System.String,System.String},System.ValueTuple{System.String,System.String}})">
|
||||||
<summary>
|
<summary>
|
||||||
系统默认邮件 + 项目默认邮件 (不用添加到项目邮件配置中,才发送)
|
系统默认邮件 + 项目默认邮件 (不用添加到项目邮件配置中,才发送)
|
||||||
|
|
@ -14696,11 +14701,6 @@
|
||||||
返回
|
返回
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.MassTransit.Consumer.ConsistencyCheckConsumer.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomStudy},IRaCIS.Core.Domain.Share.IUserInfo,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},AutoMapper.IMapper,Microsoft.Extensions.Localization.IStringLocalizer,Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Dictionary})">
|
|
||||||
<summary>
|
|
||||||
构造函数注入
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:IRaCIS.Core.Application.MassTransit.Consumer.ImageConsumer">
|
<member name="T:IRaCIS.Core.Application.MassTransit.Consumer.ImageConsumer">
|
||||||
<summary>
|
<summary>
|
||||||
影像重传和阅片人筛选相关邮件发送
|
影像重传和阅片人筛选相关邮件发送
|
||||||
|
|
@ -16781,41 +16781,6 @@
|
||||||
受试者ID
|
受试者ID
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:IRaCIS.Core.Application.Contracts.DTO.GetUserUploadFileDto.FileName">
|
|
||||||
<summary>
|
|
||||||
文件名称
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:IRaCIS.Core.Application.Contracts.DTO.GetUserUploadFileDto.FilePath">
|
|
||||||
<summary>
|
|
||||||
文件路径
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:IRaCIS.Core.Application.Contracts.DTO.GetUserUploadFileDto.RelativePath">
|
|
||||||
<summary>
|
|
||||||
相对路径
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:IRaCIS.Core.Application.Contracts.DTO.GetUserUploadFileDto.CreateUserId">
|
|
||||||
<summary>
|
|
||||||
创建人
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:IRaCIS.Core.Application.Contracts.DTO.GetUserUploadFileDto.CreateTime">
|
|
||||||
<summary>
|
|
||||||
创建时间
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:IRaCIS.Core.Application.Contracts.DTO.GetUserUploadFileDto.TrialId">
|
|
||||||
<summary>
|
|
||||||
项目ID
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:IRaCIS.Core.Application.Contracts.DTO.GetUserUploadFileDto.CreateUserName">
|
|
||||||
<summary>
|
|
||||||
创建者名称
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:IRaCIS.Core.Application.Contracts.DTO.CloseCheckChallengeDto">
|
<member name="T:IRaCIS.Core.Application.Contracts.DTO.CloseCheckChallengeDto">
|
||||||
<summary>
|
<summary>
|
||||||
关闭一致性质疑Dto
|
关闭一致性质疑Dto
|
||||||
|
|
@ -18144,7 +18109,7 @@
|
||||||
<param name="trialId"></param>
|
<param name="trialId"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Image.QA.QCListService.GetConsistencyCheckFile(IRaCIS.Core.Application.Contracts.DTO.GetConsistencyCheckFileInDto,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.InspectionFile})">
|
<member name="M:IRaCIS.Core.Application.Image.QA.QCListService.GetConsistencyCheckFileList(IRaCIS.Core.Application.Contracts.DTO.GetConsistencyCheckFileInDto,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.InspectionFile})">
|
||||||
<summary>
|
<summary>
|
||||||
获取一致性核查文件上传记录
|
获取一致性核查文件上传记录
|
||||||
</summary>
|
</summary>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,18 @@ using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.MassTransit.Command
|
namespace IRaCIS.Core.Application.MassTransit.Command
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 全量一致性核查
|
||||||
|
/// </summary>
|
||||||
|
public record ConsistenFullCheckCommand
|
||||||
|
{
|
||||||
|
public List<CheckViewModel> ETCList { get; set; } = new List<CheckViewModel>();
|
||||||
|
|
||||||
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
|
public Guid InspectionFileId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public record ConsistenCheckCommand
|
public record ConsistenCheckCommand
|
||||||
{
|
{
|
||||||
public List<CheckViewModel> ETCList { get; set; } = new List<CheckViewModel>();
|
public List<CheckViewModel> ETCList { get; set; } = new List<CheckViewModel>();
|
||||||
|
|
@ -17,13 +29,19 @@ namespace IRaCIS.Core.Application.MassTransit.Command
|
||||||
|
|
||||||
public class CheckDBModel : CheckViewModel
|
public class CheckDBModel : CheckViewModel
|
||||||
{
|
{
|
||||||
|
|
||||||
public Guid SubjectVisitId { get; set; }
|
public Guid SubjectVisitId { get; set; }
|
||||||
|
|
||||||
public Guid StudyId { get; set; }
|
public Guid StudyId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class FullCheckResult: CheckViewModel
|
||||||
|
{
|
||||||
|
|
||||||
|
public DateTime CheckTime { get; set; }
|
||||||
|
|
||||||
|
public string CheckResult { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//[ExcelImporter(/*ImportResultFilter = typeof(ImportResultFilteTest),*/ IsLabelingError = true)]
|
//[ExcelImporter(/*ImportResultFilter = typeof(ImportResultFilteTest),*/ IsLabelingError = true)]
|
||||||
|
|
@ -62,8 +80,12 @@ namespace IRaCIS.Core.Application.MassTransit.Command
|
||||||
[ExcelColumnName("Modality")]
|
[ExcelColumnName("Modality")]
|
||||||
public string Modality { get; set; } = string.Empty;
|
public string Modality { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
#region 全量一致性核查加入
|
||||||
|
public SubjectStatus SubjectStatus { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
public override bool Equals(object? obj)
|
public override bool Equals(object? obj)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,53 +1,48 @@
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
|
using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Application.Interfaces;
|
using IRaCIS.Application.Interfaces;
|
||||||
|
using IRaCIS.Core.API._ServiceExtensions.NewtonsoftJson;
|
||||||
|
using IRaCIS.Core.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Contracts.DTO;
|
using IRaCIS.Core.Application.Contracts.DTO;
|
||||||
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Application.MassTransit.Command;
|
using IRaCIS.Core.Application.MassTransit.Command;
|
||||||
|
using IRaCIS.Core.Domain.Models;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using MassTransit;
|
using MassTransit;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.MassTransit.Consumer
|
namespace IRaCIS.Core.Application.MassTransit.Consumer
|
||||||
{
|
{
|
||||||
public class ConsistencyCheckConsumer : IConsumer<ConsistenCheckCommand>
|
public class ConsistencyCheckConsumer(
|
||||||
|
IRepository<DicomStudy> _studyRepository,
|
||||||
|
IUserInfo _userInfo,
|
||||||
|
IRepository<Subject> _subjectRepository,
|
||||||
|
IRepository<NoneDicomStudy> _noneDicomStudyRepository,
|
||||||
|
IRepository<SubjectVisit> _subjectVisitRepository,
|
||||||
|
IRepository<Dictionary> _dictionaryRepository,
|
||||||
|
IOSSService _oSSService,
|
||||||
|
IMapper _mapper,
|
||||||
|
IDictionaryService _dictionaryService,
|
||||||
|
IRepository<CommonDocument> _commonDocumentRepository,
|
||||||
|
IStringLocalizer _localizer,
|
||||||
|
IWebHostEnvironment _hostEnvironment,
|
||||||
|
IRepository<InspectionFile> _inspectionFileRepository
|
||||||
|
) : IConsumer<ConsistenCheckCommand>, IConsumer<ConsistenFullCheckCommand>
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly IRepository<DicomStudy> _studyRepository;
|
|
||||||
private readonly IUserInfo _userInfo;
|
|
||||||
private readonly IRepository<Subject> _subjectRepository;
|
|
||||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
|
||||||
private readonly IRepository<TrialSite> _trialSiteRepository;
|
|
||||||
private readonly IMapper _mapper;
|
|
||||||
private readonly IRepository<NoneDicomStudy> _noneDicomStudyRepository;
|
|
||||||
public IStringLocalizer _localizer { get; set; }
|
|
||||||
|
|
||||||
private readonly SystemEmailSendConfig _systemEmailConfig;
|
private readonly SystemEmailSendConfig _systemEmailConfig;
|
||||||
|
|
||||||
private readonly IRepository<Dictionary> _dictionaryRepository;
|
|
||||||
/// <summary>
|
|
||||||
/// 构造函数注入
|
|
||||||
/// </summary>
|
|
||||||
|
|
||||||
public ConsistencyCheckConsumer(IRepository<DicomStudy> studyRepository, IUserInfo userInfo,
|
|
||||||
IRepository<Subject> subjectRepository, IRepository<SubjectVisit> subjectVisitRepository,
|
|
||||||
IRepository<TrialSite> trialSiteRepository, IRepository<NoneDicomStudy> noneDicomStudyRepository,
|
|
||||||
IMapper mapper, IStringLocalizer localizer, IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig, IRepository<Dictionary> dictionaryRepository)
|
|
||||||
{
|
|
||||||
_noneDicomStudyRepository = noneDicomStudyRepository;
|
|
||||||
_studyRepository = studyRepository;
|
|
||||||
_userInfo = userInfo;
|
|
||||||
_subjectRepository = subjectRepository;
|
|
||||||
_subjectVisitRepository = subjectVisitRepository;
|
|
||||||
_trialSiteRepository = trialSiteRepository;
|
|
||||||
_mapper = mapper;
|
|
||||||
_localizer = localizer;
|
|
||||||
|
|
||||||
_systemEmailConfig = systemEmailConfig.CurrentValue;
|
|
||||||
_dictionaryRepository = dictionaryRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -67,8 +62,8 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer
|
||||||
|
|
||||||
//subjectVisitLambda2= subjectVisitLambda2.And(x => x.CheckState == CheckStateEnum.ToCheck && x.AuditState == AuditStateEnum.QCPassed || (x.CheckState == CheckStateEnum.CVIng && x.AuditState == AuditStateEnum.QCPassed));
|
//subjectVisitLambda2= subjectVisitLambda2.And(x => x.CheckState == CheckStateEnum.ToCheck && x.AuditState == AuditStateEnum.QCPassed || (x.CheckState == CheckStateEnum.CVIng && x.AuditState == AuditStateEnum.QCPassed));
|
||||||
|
|
||||||
Expression<Func<SubjectVisit, bool>> subjectVisitLambda = x => x.TrialId == trialId && x.Subject.IsSubjectQuit == false &&
|
Expression<Func<SubjectVisit, bool>> subjectVisitLambda = x => x.TrialId == trialId && x.Subject.IsSubjectQuit == false && x.AuditState == AuditStateEnum.QCPassed &&
|
||||||
(x.CheckState == CheckStateEnum.ToCheck && x.AuditState == AuditStateEnum.QCPassed || (x.CheckState == CheckStateEnum.CVIng && x.AuditState == AuditStateEnum.QCPassed));
|
(x.CheckState == CheckStateEnum.ToCheck || x.CheckState == CheckStateEnum.CVIng);
|
||||||
|
|
||||||
var dicomQuery = from sv in _subjectVisitRepository.Where(subjectVisitLambda)
|
var dicomQuery = from sv in _subjectVisitRepository.Where(subjectVisitLambda)
|
||||||
join subject in _subjectRepository.AsQueryable() on sv.SubjectId equals subject.Id
|
join subject in _subjectRepository.AsQueryable() on sv.SubjectId equals subject.Id
|
||||||
|
|
@ -301,12 +296,159 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer
|
||||||
}
|
}
|
||||||
await _subjectVisitRepository.SaveChangesAsync();
|
await _subjectVisitRepository.SaveChangesAsync();
|
||||||
|
|
||||||
//await context.RespondAsync<ConsistenCheckResult>(new
|
|
||||||
//{
|
|
||||||
|
|
||||||
//});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task Consume(ConsumeContext<ConsistenFullCheckCommand> context)
|
||||||
|
{
|
||||||
|
var inspectionFileId = context.Message.InspectionFileId;
|
||||||
|
var trialId = context.Message.TrialId;
|
||||||
|
|
||||||
|
//系统定义MRI 到底是MR 还是MRI
|
||||||
|
var mriModality = await _dictionaryRepository.Where(t => t.Parent.Code == "Modality").Where(t => t.Code == "MRI").Select(t => t.Value).FirstNotNullAsync();
|
||||||
|
|
||||||
|
//处理Excel大小写
|
||||||
|
context.Message.ETCList.ForEach(t => { t.Modality = t.Modality.ToUpper().Trim(); t.StudyDate = Convert.ToDateTime(t.StudyDate).ToString("yyyy-MM-dd"); t.SiteCode = t.SiteCode.ToUpper().Trim(); t.VisitName = t.VisitName.ToUpper().Trim(); t.SubjectCode = t.SubjectCode.ToUpper().Trim(); });
|
||||||
|
var etcList = context.Message.ETCList;
|
||||||
|
|
||||||
|
|
||||||
|
Expression<Func<SubjectVisit, bool>> subjectVisitLambda = x => x.TrialId == trialId /*&& x.Subject.IsSubjectQuit == false*/ && x.AuditState == AuditStateEnum.QCPassed &&
|
||||||
|
(x.CheckState == CheckStateEnum.CVPassed);
|
||||||
|
|
||||||
|
var dicomQuery = from sv in _subjectVisitRepository.Where(subjectVisitLambda)
|
||||||
|
join subject in _subjectRepository.AsQueryable() on sv.SubjectId equals subject.Id
|
||||||
|
join study in _studyRepository.AsQueryable() on sv.Id equals study.SubjectVisitId
|
||||||
|
select new CheckDBModel()
|
||||||
|
{
|
||||||
|
SubjectStatus = sv.Subject.Status,
|
||||||
|
SubjectVisitId = sv.Id,
|
||||||
|
SiteCode = sv.TrialSite.TrialSiteCode,
|
||||||
|
StudyDate = study.StudyTime == null ? string.Empty : ((DateTime)study.StudyTime).ToString("yyyy-MM-dd"),
|
||||||
|
StudyId = study.Id,
|
||||||
|
Modality = study.ModalityForEdit,
|
||||||
|
SubjectCode = subject.Code,
|
||||||
|
VisitName = sv.VisitName,
|
||||||
|
};
|
||||||
|
|
||||||
|
var noneDicomQuey = from sv in _subjectVisitRepository.Where(subjectVisitLambda)
|
||||||
|
join subject in _subjectRepository.AsQueryable() on sv.SubjectId equals subject.Id
|
||||||
|
join noneDicomStudy in _noneDicomStudyRepository.AsQueryable() on sv.Id equals noneDicomStudy.SubjectVisitId
|
||||||
|
select new CheckDBModel()
|
||||||
|
{
|
||||||
|
SubjectStatus = sv.Subject.Status,
|
||||||
|
SubjectVisitId = sv.Id,
|
||||||
|
SiteCode = sv.TrialSite.TrialSiteCode,
|
||||||
|
StudyDate = noneDicomStudy.ImageDate.ToString("yyyy-MM-dd"),
|
||||||
|
StudyId = noneDicomStudy.Id,
|
||||||
|
Modality = noneDicomStudy.Modality,
|
||||||
|
SubjectCode = subject.Code,
|
||||||
|
VisitName = sv.VisitName,
|
||||||
|
};
|
||||||
|
|
||||||
|
var dbList = (await dicomQuery.ToListAsync()).Union(await noneDicomQuey.ToListAsync()).ToList();
|
||||||
|
|
||||||
|
//处理数据库 大小写
|
||||||
|
dbList.ForEach(t => { t.Modality = t.Modality.ToUpper().Trim(); t.SiteCode = t.SiteCode.ToUpper().Trim(); t.VisitName = t.VisitName.ToUpper().Trim(); t.SubjectCode = t.SubjectCode.ToUpper().Trim(); });
|
||||||
|
|
||||||
|
var dbCheckList = _mapper.Map<List<CheckViewModel>>(dbList);
|
||||||
|
|
||||||
|
|
||||||
|
//按照Excel数据访视分组 按照数据库的数据 一个个的访视对比
|
||||||
|
var svExcelGroup = etcList.GroupBy(t => new { t.SiteCode, t.SubjectCode, t.VisitName })
|
||||||
|
.Select(g => new { g.Key.SubjectCode, g.Key.VisitName, g.Key.SiteCode, ExcelStudyList = g.ToList() }).ToList();
|
||||||
|
|
||||||
|
var fullCheckResultList = new List<FullCheckResult>();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var sv in svExcelGroup)
|
||||||
|
{
|
||||||
|
|
||||||
|
//Excel 的数据 在IRC 中可以找到该访视(一致性核查中,或者待核查)
|
||||||
|
if (dbCheckList.Any(t => t.SubjectCode == sv.SubjectCode && t.SiteCode == sv.SiteCode && t.VisitName == sv.VisitName))
|
||||||
|
{
|
||||||
|
|
||||||
|
var dbVisitStudyList = dbList.Where(t => t.SubjectCode == sv.SubjectCode && t.SiteCode == sv.SiteCode && t.VisitName == sv.VisitName).ToList();
|
||||||
|
|
||||||
|
//找到etc 当前visit site 和subject 一致的检查列表
|
||||||
|
var etcVisitStudyList = etcList.Where(t => t.SubjectCode == sv.SubjectCode && t.SiteCode == sv.SiteCode && t.VisitName == sv.VisitName).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
//以我们系统数据库为准 ,判断是MR 还是MRI, 把Excel 里的MR 或者MRI 处理成一致,MR MRI 是一致的
|
||||||
|
foreach (var item in etcVisitStudyList)
|
||||||
|
{
|
||||||
|
if (item.Modality == "MR" || item.Modality == "MRI")
|
||||||
|
{
|
||||||
|
item.Modality = mriModality;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//etc 和数据库 并集
|
||||||
|
var unionList = dbVisitStudyList.Union(etcVisitStudyList);
|
||||||
|
// 数据库存在
|
||||||
|
var dbExceptExcel = dbVisitStudyList.Except(etcVisitStudyList);
|
||||||
|
|
||||||
|
// excel 存在
|
||||||
|
var excelExceptDB = etcVisitStudyList.Except(dbCheckList);
|
||||||
|
|
||||||
|
var dbCurrentVisitFirst = dbCheckList.First();
|
||||||
|
|
||||||
|
//ETC 和系统的完全一致 两者没有差别
|
||||||
|
if (dbExceptExcel.Count() == 0 && excelExceptDB.Count() == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
//每个受试者每个访视加一条记录
|
||||||
|
fullCheckResultList.Add(new FullCheckResult()
|
||||||
|
{
|
||||||
|
SubjectStatus = dbCurrentVisitFirst.SubjectStatus,
|
||||||
|
CheckTime = DateTime.Now,
|
||||||
|
SiteCode = dbCurrentVisitFirst.SiteCode,
|
||||||
|
SubjectCode = dbCurrentVisitFirst.SubjectCode,
|
||||||
|
VisitName = dbCurrentVisitFirst.VisitName,
|
||||||
|
Modality = string.Join('、', dbVisitStudyList.Select(t => t.Modality)),
|
||||||
|
StudyDate = dbVisitStudyList.Select(t => t.StudyDate).MaxBy(d => DateTime.Parse(d)) ?? ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var checkResult =
|
||||||
|
String.Join(" | ", dbExceptExcel.Select(t => $"{_localizer["ConsistencyVerification_EdcL", t.StudyDate, t.Modality/*, _systemEmailConfig.SystemShortName*/]}")) + " | "
|
||||||
|
+ String.Join(" | ", excelExceptDB.Select(t => $"{_localizer["ConsistencyVerification_IrcLi", t.StudyDate, t.Modality, _systemEmailConfig.SystemShortName]}"));
|
||||||
|
|
||||||
|
//每个受试者每个访视加一条记录
|
||||||
|
fullCheckResultList.Add(new FullCheckResult()
|
||||||
|
{
|
||||||
|
SubjectStatus = dbCurrentVisitFirst.SubjectStatus,
|
||||||
|
CheckTime = DateTime.Now,
|
||||||
|
SiteCode = dbCurrentVisitFirst.SiteCode,
|
||||||
|
SubjectCode = dbCurrentVisitFirst.SubjectCode,
|
||||||
|
VisitName = dbCurrentVisitFirst.VisitName,
|
||||||
|
Modality = string.Join('、', dbVisitStudyList.Select(t => t.Modality)),
|
||||||
|
StudyDate = dbVisitStudyList.Select(t => t.StudyDate).MaxBy(d => DateTime.Parse(d)) ?? "",
|
||||||
|
CheckResult = checkResult
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//导到Excel 上传oss 回更记录状态
|
||||||
|
|
||||||
|
var list = fullCheckResultList;
|
||||||
|
|
||||||
|
var exportInfo = new ExcelExportInfo();
|
||||||
|
|
||||||
|
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId);
|
||||||
|
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
|
||||||
|
|
||||||
|
var fileStreamResult = (FileStreamResult)await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialConsistentFUllCheckList_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(FullCheckResult));
|
||||||
|
|
||||||
|
var ossRelativePath = await _oSSService.UploadToOSSAsync(fileStreamResult.FileStream, $"{trialId.ToString()}/InspectionUpload/DataReconciliation", "DataReconciliation");
|
||||||
|
|
||||||
|
await _inspectionFileRepository.BatchUpdateNoTrackingAsync(t => t.Id == inspectionFileId, u => new InspectionFile() { CheckState = EDCCheckState.Success, ResultPath = ossRelativePath });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
await _subjectVisitRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,44 +146,25 @@ namespace IRaCIS.Core.Application.Contracts.DTO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class GetUserUploadFileDto/*: ConsistencyCheckFile*/
|
public class GetUserUploadFileDto
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 文件名称
|
|
||||||
/// </summary>
|
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件路径
|
|
||||||
/// </summary>
|
|
||||||
public string FilePath { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 相对路径
|
|
||||||
/// </summary>
|
|
||||||
public string RelativePath { get; set; }
|
public string RelativePath { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建人
|
|
||||||
/// </summary>
|
|
||||||
public Guid CreateUserId { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime CreateTime { get; set; }
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 项目ID
|
|
||||||
/// </summary>
|
|
||||||
public Guid TrialId { get; set; }
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建者名称
|
#region 一致性核查额外增加字段
|
||||||
/// </summary>
|
|
||||||
public string CreateUserName { get; set; }
|
public EDCCheckState? CheckState { get; set; }
|
||||||
|
|
||||||
|
public string ResultPath { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -767,9 +767,9 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<PageOutput<GetUserUploadFileDto>> GetConsistencyCheckFile(GetConsistencyCheckFileInDto inQuery, [FromServices] IRepository<InspectionFile> _inspectionFileRepository)
|
public async Task<PageOutput<GetUserUploadFileDto>> GetConsistencyCheckFileList(GetConsistencyCheckFileInDto inQuery, [FromServices] IRepository<InspectionFile> _inspectionFileRepository)
|
||||||
{
|
{
|
||||||
var query = _inspectionFileRepository.Where(t => t.TrialId == inQuery.TrialId)
|
var query = _inspectionFileRepository.Where(t => t.TrialId == inQuery.TrialId && (t.CheckState == EDCCheckState.Success || t.CheckState == EDCCheckState.Failed))
|
||||||
.ProjectTo<GetUserUploadFileDto>(_mapper.ConfigurationProvider);
|
.ProjectTo<GetUserUploadFileDto>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
return await query.ToPagedListAsync(inQuery);
|
return await query.ToPagedListAsync(inQuery);
|
||||||
|
|
|
||||||
|
|
@ -679,8 +679,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
;
|
;
|
||||||
|
|
||||||
// 一致性核查文件
|
// 一致性核查文件
|
||||||
CreateMap<InspectionFile, GetUserUploadFileDto>()
|
CreateMap<InspectionFile, GetUserUploadFileDto>();
|
||||||
.ForMember(d => d.CreateUserName, u => u.MapFrom(t => t.CreateUserRole.FullName));
|
|
||||||
|
|
||||||
|
|
||||||
//CRC 质疑列表
|
//CRC 质疑列表
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,32 @@ public class InspectionFile : BaseAddAuditEntity
|
||||||
{
|
{
|
||||||
#region 导航属性
|
#region 导航属性
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public string FileName { get; set; } = string.Empty;
|
public string FileName { get; set; } = string.Empty;
|
||||||
public string RelativePath { get; set; } = string.Empty;
|
public string RelativePath { get; set; } = string.Empty;
|
||||||
|
|
||||||
public Guid TrialId { get; set; }
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
|
#region 一致性核查额外增加字段
|
||||||
|
|
||||||
|
|
||||||
|
public EDCCheckState? CheckState { get; set; }
|
||||||
|
|
||||||
|
public string ResultPath { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum EDCCheckState
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Success = 1,
|
||||||
|
|
||||||
|
Failed = 2,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20425
IRaCIS.Core.Infra.EFCore/Migrations/20251020084808_fullCheck.Designer.cs
generated
Normal file
20425
IRaCIS.Core.Infra.EFCore/Migrations/20251020084808_fullCheck.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,40 @@
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class fullCheck : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "CheckState",
|
||||||
|
table: "InspectionFile",
|
||||||
|
type: "int",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "ResultPath",
|
||||||
|
table: "InspectionFile",
|
||||||
|
type: "nvarchar(400)",
|
||||||
|
maxLength: 400,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "CheckState",
|
||||||
|
table: "InspectionFile");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ResultPath",
|
||||||
|
table: "InspectionFile");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3189,6 +3189,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<int?>("CheckState")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<DateTime>("CreateTime")
|
b.Property<DateTime>("CreateTime")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
|
@ -3205,6 +3208,11 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.HasMaxLength(400)
|
.HasMaxLength(400)
|
||||||
.HasColumnType("nvarchar(400)");
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
|
b.Property<string>("ResultPath")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
b.Property<Guid>("TrialId")
|
b.Property<Guid>("TrialId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,9 @@ public static class StaticData
|
||||||
|
|
||||||
public const string SystenMedicalQCQuestionsList_Export = "SystenMedicalQCQuestionsList_Export";
|
public const string SystenMedicalQCQuestionsList_Export = "SystenMedicalQCQuestionsList_Export";
|
||||||
|
|
||||||
|
//一致性全量核查导出
|
||||||
|
public const string TrialConsistentFUllCheckList_Export = "TrialConsistentFUllCheckList_Export";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue