diff --git a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs index 68ecb45ec..64760c043 100644 --- a/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadDownLoadController.cs @@ -20,7 +20,6 @@ using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infra.EFCore; using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Infrastructure.Extention; -using Magicodes.ExporterAndImporter.Excel; using MassTransit; using MediatR; using Microsoft.AspNetCore.Authorization; @@ -39,7 +38,6 @@ using Microsoft.Net.Http.Headers; using MiniExcelLibs; using Newtonsoft.Json; using SharpCompress.Archives; -using SkiaSharp; using System; using System.Collections.Generic; using System.Data; @@ -237,10 +235,10 @@ namespace IRaCIS.Core.API.Controllers private readonly IMediator _mediator; - public IStringLocalizer _localizer { get; set; } + public IStringLocalizer _localizer { get; set; } - private readonly IWebHostEnvironment _hostEnvironment; + private readonly IWebHostEnvironment _hostEnvironment; private readonly IRepository _repository; @@ -255,7 +253,7 @@ namespace IRaCIS.Core.API.Controllers _hostEnvironment = hostEnvironment; _mediator = mediator; _localizer = localizer; - _mapper = mapper; + _mapper = mapper; _userInfo = userInfo; _repository = repository; } @@ -407,7 +405,7 @@ namespace IRaCIS.Core.API.Controllers } - catch (Exception ) + catch (Exception) { _provider.Remove($"StudyUid_{trialId}_{archiveStudyCommand.StudyInstanceUid}"); @@ -587,6 +585,20 @@ namespace IRaCIS.Core.API.Controllers #region MiniExcel 需要自己验证数据格式规范 + + if (fileName.EndsWith(".xlsx")) + { + etcCheckList = MiniExcel.Query(templateFileStream, excelType: ExcelType.XLSX).ToList(); + } + else if (fileName.EndsWith(".csv")) + { + //因为csv 需要加配置文件 不然都是null + etcCheckList = MiniExcel.Query(templateFileStream, null, configuration: new MiniExcelLibs.Csv.CsvConfiguration() + { + StreamReaderFunc = (stream) => new StreamReader(stream, Encoding.GetEncoding("gb2312")) + }).ToList(); + + } //if (fileName.EndsWith(".csv")) //{ // //因为csv 需要加配置文件 不然都是null @@ -602,67 +614,72 @@ namespace IRaCIS.Core.API.Controllers #endregion + #region 升级net8 导入有问题 + + //Magicodes 支持自定义特性验证 - if (fileName.EndsWith(".xlsx")) - { - var Importer = new ExcelImporter(); + // if (fileName.EndsWith(".xlsx")) + //{ + // var Importer = new ExcelImporter(); - var import = await Importer.Import(templateFileStream); + // var import = await Importer.Import(templateFileStream); - if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString()); + // if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString()); - //if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors)); + // //if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors)); - if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(_localizer["UploadDownLoad_TemplateErrors"]); + // if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(_localizer["UploadDownLoad_TemplateErrors"]); - etcCheckList = import.Data.ToList(); - } - else if (fileName.EndsWith(".csv")) - { - #region 临时方案 MiniExcel读取 然后保存为xlsx 再用 Magicodes验证数据 + // etcCheckList = import.Data.ToList(); + //} + //else if (fileName.EndsWith(".csv")) + //{ + // #region 临时方案 MiniExcel读取 然后保存为xlsx 再用 Magicodes验证数据 - //因为csv 需要加配置文件 不然都是null - etcCheckList = MiniExcel.Query(templateFileStream, null, configuration: new MiniExcelLibs.Csv.CsvConfiguration() - { - StreamReaderFunc = (stream) => new StreamReader(stream, Encoding.GetEncoding("gb2312")) - }).ToList(); + // //因为csv 需要加配置文件 不然都是null + // etcCheckList = MiniExcel.Query(templateFileStream, null, configuration: new MiniExcelLibs.Csv.CsvConfiguration() + // { + // StreamReaderFunc = (stream) => new StreamReader(stream, Encoding.GetEncoding("gb2312")) + // }).ToList(); - var (csVToXlsxPath, csVToXlsxRelativePath) = FileStoreHelper.GetTrialCheckFilePath(_hostEnvironment, Path.GetFileNameWithoutExtension(fileName) + ".xlsx", trialId); + // var (csVToXlsxPath, csVToXlsxRelativePath) = FileStoreHelper.GetTrialCheckFilePath(_hostEnvironment, Path.GetFileNameWithoutExtension(fileName) + ".xlsx", trialId); - await MiniExcel.SaveAsAsync(csVToXlsxPath, etcCheckList, excelType: ExcelType.XLSX); + // await MiniExcel.SaveAsAsync(csVToXlsxPath, etcCheckList, excelType: ExcelType.XLSX); - var Importer = new ExcelImporter(); + // var Importer = new ExcelImporter(); - var import = await Importer.Import(System.IO.File.OpenRead(csVToXlsxPath)); + // var import = await Importer.Import(System.IO.File.OpenRead(csVToXlsxPath)); - if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString()); + // if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString()); - //if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors)); + // //if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors)); - if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.TemplateErrors)); + // if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.TemplateErrors)); - etcCheckList = import.Data.ToList(); + // etcCheckList = import.Data.ToList(); - #endregion + // #endregion - #region 导入组件有问题 excel编码格式 - //var Importer = new CsvImporter(); + // #region 导入组件有问题 excel编码格式 + // //var Importer = new CsvImporter(); - //var import = await Importer.Import(File.OpenRead(filePath)); + // //var import = await Importer.Import(File.OpenRead(filePath)); - //if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString()); + // //if (import.Exception != null) return ResponseOutput.NotOk(import.Exception.ToString()); - //if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors)); + // //if (import.RowErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.RowErrors)); - //if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.TemplateErrors)); + // //if (import.TemplateErrors.Count > 0) return ResponseOutput.NotOk(JsonConvert.SerializeObject(import.TemplateErrors)); - //etcCheckList = import.Data.ToList(); - #endregion + // //etcCheckList = import.Data.ToList(); + // #endregion - } + //} + + #endregion //ExcelReaderFactory 需要自己验证数据 并且从固定列取数据 else { @@ -966,14 +983,14 @@ namespace IRaCIS.Core.API.Controllers public IMapper _mapper { get; set; } public IUserInfo _userInfo { get; set; } private readonly IMediator _mediator; - public IStringLocalizer _localizer { get; set; } - private readonly IWebHostEnvironment _hostEnvironment; + public IStringLocalizer _localizer { get; set; } + private readonly IWebHostEnvironment _hostEnvironment; public UploadDownLoadController(IMapper mapper, IUserInfo userInfo, IStringLocalizer localizer, IMediator mediator, IWebHostEnvironment hostEnvironment) { _hostEnvironment = hostEnvironment; _localizer = localizer; - _mediator = mediator; + _mediator = mediator; _mapper = mapper; _userInfo = userInfo; } diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj index 739349a2b..4f364beff 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj +++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj @@ -74,14 +74,14 @@ - + - + diff --git a/IRaCIS.Core.API/Progranm.cs b/IRaCIS.Core.API/Progranm.cs index 641d973d7..885b11f66 100644 --- a/IRaCIS.Core.API/Progranm.cs +++ b/IRaCIS.Core.API/Progranm.cs @@ -24,7 +24,6 @@ using IRaCIS.Core.Application.Filter; using Microsoft.AspNetCore.HttpOverrides; using IRaCIS.Application.Services.BackGroundJob; using LogDashboard; -using OfficeOpenXml.Utils; using FellowOakDicom.Network; using IRaCIS.Core.Application.Service.ImageAndDoc; using IP2Region.Net.Abstractions; diff --git a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs index 3eed41f3b..fb48b1d97 100644 --- a/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs +++ b/IRaCIS.Core.Application/Helper/ExcelExportHelper.cs @@ -5,7 +5,6 @@ using IRaCIS.Application.Contracts; using IRaCIS.Application.Interfaces; using IRaCIS.Core.Application.Helper; using IRaCIS.Core.Domain.Share; -using Magicodes.ExporterAndImporter.Excel; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using MiniExcelLibs; @@ -14,7 +13,6 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using NPOI.HSSF.UserModel; using NPOI.XSSF.UserModel; -using SkiaSharp; using System.Collections; using System.IO; diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index c3431aa33..93c6c62bb 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -15,7 +15,6 @@ using System.Linq; using System.Security.AccessControl; using System.Text; using System.Threading.Tasks; -using SkiaSharp; namespace IRaCIS.Core.Application.Helper { diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index 4cfb38047..0c907fb89 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -78,14 +78,6 @@ - - - true - - - true - - diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index 782678fea..4b080d099 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -13095,7 +13095,7 @@ 分页获取CRO列表 - + 根据CRO 名称查询所有CRO 列表 @@ -13128,7 +13128,7 @@ 分页获取申办方列表 - + 分页获取申办方列表 diff --git a/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs b/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs index 4a0d7c680..7ab34919a 100644 --- a/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs +++ b/IRaCIS.Core.Application/Service/Common/InternationalizationService.cs @@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Authorization; using IRaCIS.Core.Application.Helper; using EasyCaching.Core; using IRaCIS.Core.Domain.Share; -using OfficeOpenXml.FormulaParsing.Utilities; namespace IRaCIS.Core.Application.Service { diff --git a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs index 890447734..62e84fc93 100644 --- a/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs +++ b/IRaCIS.Core.Application/Service/Doctor/DTO/DoctorModel.cs @@ -182,6 +182,9 @@ namespace IRaCIS.Application.Contracts public string OptUserName { get; set; } = string.Empty; public DateTime? OptTime { get; set; } public string? OptTimeStr => OptTime?.ToString("yyyy-MM-dd HH:mm:ss"); + + + public string DoctorUserName { get; set; } } public class DoctorOptDTO diff --git a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs index d61520299..692e9c4f0 100644 --- a/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Doctor/_MapConfig.cs @@ -60,7 +60,8 @@ namespace IRaCIS.Core.Application.Service CreateMap().ReverseMap(); //医生列表、项目显示列表模型转换 - CreateMap(); + CreateMap() + ; CreateMap() .ForMember(d => d.UserTypeShortName, u => u.MapFrom(t => t.UserTypeRole.UserTypeShortName)) @@ -80,7 +81,8 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.UserName, u => u.MapFrom(doctor => doctor.LastName + " / " + doctor.FirstName)); #region 医生基本信息 - CreateMap(); + CreateMap() + .ForMember(d => d.DoctorUserName, u => u.MapFrom(t => t.User.UserName)); CreateMap().IncludeMembers(t => t.Hospital).Include() .ForMember(d => d.AccountUserName, u => u.MapFrom(s => s.EnrollList.Where(t=>t.DoctorUserId!=null).Select(c=>c.DoctorUser.UserName).FirstOrDefault())) .ForMember(d => d.Department, u => u.MapFrom(s => s.Department.Value)) diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index 92bbb0bd7..a86786d42 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -25,7 +25,6 @@ using Microsoft.AspNetCore.Http; using System; using System.Runtime.InteropServices; using SharpCompress.Common; -using SkiaSharp; using DocumentFormat.OpenXml.Bibliography; using System.Linq.Dynamic.Core; diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DownloadAndUploadDTO.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DownloadAndUploadDTO.cs index caa5e5e3a..49786d306 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DownloadAndUploadDTO.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DownloadAndUploadDTO.cs @@ -9,6 +9,10 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO { public class SubjectImageUploadDTO { + public Guid VisitTaskId { get; set; } + + public Guid SiteId { get; set; } + public Guid SubejctId { get; set; } public string SubjectCode { get; set; } @@ -17,6 +21,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO public string TaskName { get; set; } + public string CriterionModalitys { get; set; } + public Guid? SourceSubjectVisitId { get; set; } public PackState PackState { get; set; } @@ -29,14 +35,14 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO public class StudyBasicInfo { public Guid Id { get; set; } - public string StudyInstanceUid { get; set; } + public string StudyInstanceUid { get; set; } public string StudyCode { get; set; } public string ModalityForEdit { get; set; } public string BodyPartExamined { get; set; } - + public string BodyPartForEdit { get; set; } @@ -44,9 +50,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc.DTO public string Modalities { get; set; } - public string Description { get; set; } - public int SeriesCount { get; set; } - public int InstanceCount { get; set; } + public string Description { get; set; } + public int SeriesCount { get; set; } + public int InstanceCount { get; set; } public List SopInstanceUidList { get; set; } } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index 647b1220b..f9a5e6575 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -167,9 +167,29 @@ namespace IRaCIS.Core.Application.Contracts } + public class PriArchiveTaskStudyCommand + { + + [NotDefault] + public Guid TrialId { get; set; } + + [NotDefault] + public Guid SubjectId { get; set; } + + [NotDefault] + public Guid SubjectVisitId { get; set; } + + public decimal FileSize { get; set; } + + public bool IsDicomReUpload { get; set; } + + + public int FileCount { get; set; } + } + public class PreArchiveDicomStudyCommand { - //public string StudyInstanceUid { get; set; } + [NotDefault] public Guid TrialId { get; set; } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index df8f8086e..ab25b257f 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -10,7 +10,6 @@ using MassTransit; using MathNet.Numerics; using Medallion.Threading; using Microsoft.AspNetCore.Mvc; -using OfficeOpenXml.FormulaParsing.Utilities; using System; using System.Collections.Generic; using System.IO.Compression; @@ -56,7 +55,14 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var query = _repository.Where(t => t.SubjectId == subjectId && t.SourceSubjectVisitId != null && t.DoctorUserId == _userInfo.Id) .Select(u => new SubjectImageUploadDTO() { + VisitTaskId = u.Id, + SubejctId = u.SubjectId, + + SiteId=u.Subject.SiteId, + + CriterionModalitys= u.TrialReadingCriterion.CriterionModalitys, + SubjectCode = u.IsSelfAnalysis == true ? u.Subject.Code : u.BlindSubjectCode, TaskBlindName = u.TaskBlindName, TaskName = u.TaskName, @@ -95,7 +101,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc Modalities = t.Modalities, SeriesCount = t.SeriesCount, - SopInstanceUidList=t.InstanceList.Select(t=>t.SopInstanceUid).ToList(), + SopInstanceUidList = t.InstanceList.Select(t => t.SopInstanceUid).ToList(), }).ToList() }) @@ -141,6 +147,39 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc #endregion } + + + + + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] + + public async Task PreArchiveDicomStudy(PriArchiveTaskStudyCommand preArchiveStudyCommand) + { + + var studyMonitor = new StudyMonitor() + { + TrialId = preArchiveStudyCommand.TrialId, + SubjectId = preArchiveStudyCommand.SubjectId, + SubjectVisitId = preArchiveStudyCommand.SubjectVisitId, + + IsSuccess = false, + UploadStartTime = DateTime.Now, + IsDicom = true, + IP = _userInfo.IP, + + IsDicomReUpload = preArchiveStudyCommand.IsDicomReUpload, + FileSize = preArchiveStudyCommand.FileSize, + FileCount = preArchiveStudyCommand.FileCount, + + }; + + + var addEntity = await _studyMonitorRepository.AddAsync(studyMonitor, true); + + return ResponseOutput.Ok(addEntity.Id); + + } + [TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })] public async Task AddOrUpdateArchiveTaskStudy(TaskArchiveStudyCommand incommand) { @@ -162,7 +201,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var findOriginStudy = studyList.FirstOrDefault(c => c.OrginalStudyList.Any(t => t.StudyInstanceUid == incommand.Study.StudyInstanceUid)); - if (findOriginStudy==null) + if (findOriginStudy == null) { return ResponseOutput.NotOk("该检查不属于该受试者,请核查"); } @@ -210,7 +249,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc } - study.Id = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString(),findOriginStudy.VisitTaskId.ToString()); + study.Id = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString(), findOriginStudy.VisitTaskId.ToString()); study.TrialId = incommand.TrialId; //study.SiteId = incommand.SiteId; study.SubjectId = incommand.SubjectId; @@ -286,7 +325,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc //特殊处理逻辑 study.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Union(study.Modalities.Split("、", StringSplitOptions.RemoveEmptyEntries)).Distinct()); SpecialArchiveStudyDeal(study); - modalitys = study.Modalities; + modalitys = study.Modalities; // 少了整个序列 @@ -374,6 +413,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc } + [HttpDelete] + public async Task DeleteTaskStudy(Guid visitTaskId) + { + + await _repository.BatchDeleteAsync(t => t.VisitTaskId == visitTaskId); + await _repository.BatchDeleteAsync(t => t.VisitTaskId == visitTaskId); + await _repository.BatchDeleteAsync(t => t.VisitTaskId == visitTaskId); + + return ResponseOutput.Ok(); + } /// /// 打包和匿名化影像 默认是匿名化打包,也可以不匿名化打包 /// diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs index abe17f113..f8bb6695a 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/_MapConfig.cs @@ -17,8 +17,15 @@ namespace IRaCIS.Core.Application.Service CreateMap() .ForMember(d => d.DicomInstanceList, u => u.Ignore()); + CreateMap() + .ForMember(d => d.SeriesList, u => u.Ignore()); + CreateMap() + .ForMember(d => d.InstanceList, u => u.Ignore()); + CreateMap(); + CreateMap(); + CreateMap(); diff --git a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs index 1546ff3b0..bc3d7879a 100644 --- a/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/FrontAuditConfigService.cs @@ -18,7 +18,6 @@ using IRaCIS.Core.Domain.Share.Management; using System.Text.Json.Nodes; using IRaCIS.Application.Contracts; using IRaCIS.Core.Infrastructure.Extention; -using OfficeOpenXml.FormulaParsing.Excel.Functions.Information; namespace IRaCIS.Core.Application.Service { diff --git a/IRaCIS.Core.Application/Service/Institution/CROService.cs b/IRaCIS.Core.Application/Service/Institution/CROService.cs index a58ea336a..202811966 100644 --- a/IRaCIS.Core.Application/Service/Institution/CROService.cs +++ b/IRaCIS.Core.Application/Service/Institution/CROService.cs @@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc; namespace IRaCIS.Application.Services { - [ ApiExplorerSettings(GroupName = "Institution")] + [ApiExplorerSettings(GroupName = "Institution")] public class CroService : BaseService, ICroService { private readonly IRepository _croRepository; @@ -20,50 +20,50 @@ namespace IRaCIS.Application.Services /// 分页获取CRO列表 [HttpPost] public async Task> GetCroList(CROCompanyQueryDTO croCompanySearchModel) - { + { var croQueryable = _croRepository .WhereIf(!string.IsNullOrEmpty(croCompanySearchModel.CROName), t => t.CROName.Contains(croCompanySearchModel.CROName) || t.CRONameCN.Contains(croCompanySearchModel.CROName)) - .WhereIf(!string.IsNullOrEmpty(croCompanySearchModel.CROCode), t => t.CROCode.Contains(croCompanySearchModel.CROCode) ) + .WhereIf(!string.IsNullOrEmpty(croCompanySearchModel.CROCode), t => t.CROCode.Contains(croCompanySearchModel.CROCode)) .ProjectTo(_mapper.ConfigurationProvider); - return await croQueryable.ToPagedListAsync(croCompanySearchModel.PageIndex, croCompanySearchModel.PageSize, - string.IsNullOrWhiteSpace(croCompanySearchModel.SortField) ? "CROName": croCompanySearchModel.SortField, croCompanySearchModel.Asc); + return await croQueryable.ToPagedListAsync(croCompanySearchModel.PageIndex, croCompanySearchModel.PageSize, + string.IsNullOrWhiteSpace(croCompanySearchModel.SortField) ? "CROName" : croCompanySearchModel.SortField, croCompanySearchModel.Asc); } /// 根据CRO 名称查询所有CRO 列表 - public async Task> GetAllCROList() + public async Task> GetAllCROList(Guid? croId) { - return await _croRepository.ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }).ToListAsync(); + return await _croRepository.Where(t => t.IsTrialLevel == false || t.Id == croId).ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }).ToListAsync(); } /// 添加CRO信息 - + public async Task AddOrUpdateCro(CROCompanyDTO addCroCompanyCommand) { var exp = new EntityVerifyExp() { - VerifyExp = cro => cro.CROName.Equals(addCroCompanyCommand.CROName) , + VerifyExp = cro => cro.CROName.Equals(addCroCompanyCommand.CROName), //---已经存在同名的CRO,请确认。 VerifyMsg = _localizer["CRO_DupName"] }; var cro = await _croRepository.InsertOrUpdateAsync(addCroCompanyCommand, true, exp); - - return ResponseOutput.Ok( cro.Id.ToString()); - + + return ResponseOutput.Ok(cro.Id.ToString()); + } /// 删除CRO信息 - + [HttpDelete("{croCompanyId:guid}")] - public async Task DeleteCro(Guid cROCompanyId) + public async Task DeleteCro(Guid cROCompanyId) { if (await _trialRepository.AnyAsync(t => t.CROId == cROCompanyId)) { @@ -74,7 +74,7 @@ namespace IRaCIS.Application.Services //{ // return ResponseOutput.NotOk("该CRO下存在用户,暂时无法删除。"); //} - var success = await _croRepository.BatchDeleteNoTrackingAsync(x=>x.Id== cROCompanyId); + var success = await _croRepository.BatchDeleteNoTrackingAsync(x => x.Id == cROCompanyId); return ResponseOutput.Result(success); } diff --git a/IRaCIS.Core.Application/Service/Institution/DTO/CROCompanyModel.cs b/IRaCIS.Core.Application/Service/Institution/DTO/CROCompanyModel.cs index da90775b2..b957f07f5 100644 --- a/IRaCIS.Core.Application/Service/Institution/DTO/CROCompanyModel.cs +++ b/IRaCIS.Core.Application/Service/Institution/DTO/CROCompanyModel.cs @@ -11,6 +11,8 @@ namespace IRaCIS.Application.Contracts public string CRONameCN { get; set; } = string.Empty; + public bool IsTrialLevel { get; set; } + } public class CroSelectDTO @@ -18,8 +20,6 @@ namespace IRaCIS.Application.Contracts public Guid Id { get; set; } public string CROName { get; set; } = string.Empty; public string CROCode { get; set; } = string.Empty; - - public string CRONameCN { get; set; } = string.Empty; } public class CROCompanyQueryDTO : PageInput diff --git a/IRaCIS.Core.Application/Service/Institution/DTO/SponsorModel.cs b/IRaCIS.Core.Application/Service/Institution/DTO/SponsorModel.cs index 7bde8904b..aa5662bc0 100644 --- a/IRaCIS.Core.Application/Service/Institution/DTO/SponsorModel.cs +++ b/IRaCIS.Core.Application/Service/Institution/DTO/SponsorModel.cs @@ -17,6 +17,8 @@ namespace IRaCIS.Application.Contracts public string SponsorCode { get; set; } = String.Empty; + public bool IsTrialLevel { get; set; } + } public class SponsorQueryDTO : PageInput diff --git a/IRaCIS.Core.Application/Service/Institution/Interface/ICROService.cs b/IRaCIS.Core.Application/Service/Institution/Interface/ICROService.cs index 961a70b27..94b1d7c45 100644 --- a/IRaCIS.Core.Application/Service/Institution/Interface/ICROService.cs +++ b/IRaCIS.Core.Application/Service/Institution/Interface/ICROService.cs @@ -8,7 +8,7 @@ namespace IRaCIS.Application.Interfaces public interface ICroService { Task> GetCroList(CROCompanyQueryDTO queryModel); - Task> GetAllCROList(); + Task> GetAllCROList(Guid? croId); Task AddOrUpdateCro(CROCompanyDTO addCroCompanyViewModel); Task DeleteCro(Guid croCompanyId); } diff --git a/IRaCIS.Core.Application/Service/Institution/Interface/ISponsorService.cs b/IRaCIS.Core.Application/Service/Institution/Interface/ISponsorService.cs index 6020d07a8..ae84df631 100644 --- a/IRaCIS.Core.Application/Service/Institution/Interface/ISponsorService.cs +++ b/IRaCIS.Core.Application/Service/Institution/Interface/ISponsorService.cs @@ -8,7 +8,7 @@ namespace IRaCIS.Application.Interfaces public interface ISponsorService { Task> GetSponsorList(SponsorQueryDTO queryParam); - Task> GetAllSponsorList(); + Task> GetAllSponsorList(Guid? sponsorId); Task AddOrUpdateSponsor(SponsorCommand model); Task DeleteSponsor(Guid sponsorId); } diff --git a/IRaCIS.Core.Application/Service/Institution/SponsorService.cs b/IRaCIS.Core.Application/Service/Institution/SponsorService.cs index dd8beb9dd..41412edec 100644 --- a/IRaCIS.Core.Application/Service/Institution/SponsorService.cs +++ b/IRaCIS.Core.Application/Service/Institution/SponsorService.cs @@ -33,14 +33,10 @@ namespace IRaCIS.Application.Services } /// 分页获取申办方列表 - public async Task> GetAllSponsorList() + public async Task> GetAllSponsorList(Guid? sponsorId) { - //Expression> sponsorLambda = x => true; - //if (!string.IsNullOrWhiteSpace(sponsorSearchModel.SponsorName)) - //{ - // sponsorLambda = sponsorLambda.And(t => t.SponsorName.Contains(sponsorSearchModel.SponsorName.Trim())); - //} - var sponsorQueryable = _sponsorRepository.ProjectTo(_mapper.ConfigurationProvider,new { isEn_Us= _userInfo.IsEn_Us}); + + var sponsorQueryable = _sponsorRepository.Where(t => t.IsTrialLevel == false || t.Id == sponsorId).ProjectTo(_mapper.ConfigurationProvider,new { isEn_Us= _userInfo.IsEn_Us}); return await sponsorQueryable.ToListAsync(); } @@ -72,11 +68,6 @@ namespace IRaCIS.Application.Services //---该申办方已经加入项目,不允许删除。 return ResponseOutput.NotOk(_localizer["Sponsor_InProject"]); } - //if (_userRepository.Find().Any(t => t.OrganizationId == sponsorId)) - //{ - // return ResponseOutput.NotOk("该申办方下存在用户,暂时无法删除。"); - //} - var success = await _sponsorRepository.BatchDeleteNoTrackingAsync(x => x.Id == sponsorId); return ResponseOutput.Result(success); diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 77f6fd042..bac3a04ac 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -15,7 +15,6 @@ using Medallion.Threading; using EasyCaching.Core; using IRaCIS.Core.Application.Contracts; using LoginReturnDTO = IRaCIS.Application.Contracts.LoginReturnDTO; -using OfficeOpenXml.FormulaParsing.Utilities; namespace IRaCIS.Application.Services { @@ -124,14 +123,17 @@ namespace IRaCIS.Application.Services { throw new BusinessValidationFailedException(_localizer["User_PassWordRepeat"]); } - - await _userPassWordLogRepository.AddAsync(new UserPassWordLog() + if (oldPwd != null) { + await _userPassWordLogRepository.AddAsync(new UserPassWordLog() + { - CreateTime = DateTime.Now, - PassWord = oldPwd, - UserId = userId, - }); + CreateTime = DateTime.Now, + PassWord = oldPwd, + UserId = userId, + }); + } + await _userRepository.BatchUpdateNoTrackingAsync(x => x.Id == userId, x => new User() { @@ -153,7 +155,7 @@ namespace IRaCIS.Application.Services { //检查手机或者邮箱是否有效 - if (!Regex.IsMatch(email, @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$")) + if (!Regex.IsMatch(email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")) { //---Please input a legal email return ResponseOutput.NotOk(_localizer["User_LegalEmail"]); @@ -335,7 +337,7 @@ namespace IRaCIS.Application.Services { //检查手机或者邮箱是否有效 - if (!Regex.IsMatch(email, @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$")) + if (!Regex.IsMatch(email, @"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")) { //---请输入一个正确的邮箱。 diff --git a/IRaCIS.Core.Application/Service/Management/UserTypeService.cs b/IRaCIS.Core.Application/Service/Management/UserTypeService.cs index 90683cbea..f12c9e3e8 100644 --- a/IRaCIS.Core.Application/Service/Management/UserTypeService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserTypeService.cs @@ -165,6 +165,7 @@ namespace IRaCIS.Core.Application.Contracts /// public async Task> GetTrialUserTypeList() { + //排除其他组的用户 var query = _userTypeRepository.Where(x => x.UserTypeEnum != UserTypeEnum.SuperAdmin) .Where(t => !t.UserTypeGroupList.Any(t=> t.Group.Code=="3")) .OrderBy(t => t.UserTypeShortName).ProjectTo(_mapper.ConfigurationProvider); diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 0841dc3a5..8d0545a1d 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -1411,8 +1411,6 @@ namespace IRaCIS.Core.Application.Image.QA }); - - await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => trialInOrderCriterionIdList.Contains(x.TrialReadingCriterionId)&& x.SubjectId == dbSubjectVisit.SubjectId&& dbSubjectVisit.VisitNum<= x.VisitTaskNum && x.VisitTaskNum < Math.Ceiling(dbSubjectVisit.VisitNum+0.01m) // 当前的访视 全局 裁判 及之前 全都加急 && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.TaskState == TaskState.Effect, x => new VisitTask() @@ -1466,14 +1464,14 @@ namespace IRaCIS.Core.Application.Image.QA dbSubjectVisit.IsUrgent = true; - //PD确认的紧急会把前面所有未QC完成的访视均标记为紧急 + ////PD确认的紧急会把前面所有未QC完成的访视均标记为紧急 - var previosSVlist = await _subjectVisitRepository.Where(t => t.SubjectId == dbSubjectVisit.SubjectId && t.VisitNum < dbSubjectVisit.VisitNum && t.IsUrgent == false && t.SubmitState == SubmitStateEnum.Submitted, true).ToListAsync(); + //var previosSVlist = await _subjectVisitRepository.Where(t => t.SubjectId == dbSubjectVisit.SubjectId && t.VisitNum < dbSubjectVisit.VisitNum && t.IsUrgent == false && t.SubmitState == SubmitStateEnum.Submitted, true).ToListAsync(); - previosSVlist.ForEach(t => - { - t.IsUrgent = true; - }); + //previosSVlist.ForEach(t => + //{ + // t.IsUrgent = true; + //}); } diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index 8bf91f95f..00ed9a7aa 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -104,7 +104,7 @@ namespace IRaCIS.Core.Application.Service .ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code)) .ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode)) - .ForMember(d => d.CheckDialogStr, u => u.MapFrom(t => string.Join(" | ", t.CheckChallengeDialogList.OrderBy(t => t.CreateTime).Select(c => c.CreateUser.UserName + " " + c.CreateTime.ToString("yyyy-MM-dd hh:mm:ss") + " :" + c.TalkContent)))) + .ForMember(d => d.CheckDialogStr, u => u.MapFrom(t => string.Join(" | ", t.CheckChallengeDialogList.OrderBy(t => t.CreateTime).Select(c => c.CreateUser.UserName + " " + c.CreateTime.ToString("yyyy-MM-dd HH:mm:ss") + " :" + c.TalkContent)))) .ForMember(d => d.ModalityList, c => c.MapFrom(s => (s.NoneDicomStudyList.Select(t => t.Modality) .Union(s.StudyList.Select(k => k.ModalityForEdit))).Distinct())) diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs index 1bfd22237..19ca221bf 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ClinicalAnswerService.cs @@ -16,7 +16,6 @@ using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Infrastructure.Extention; using IRaCIS.Core.Application.Service.Reading.Interface; using IRaCIS.Core.Application.Contracts; -using OfficeOpenXml.FormulaParsing.Excel.Functions.Information; namespace IRaCIS.Core.Application.Service { diff --git a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs index a84298297..e3948037c 100644 --- a/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ClinicalData/ReadingClinicalDataService.cs @@ -371,7 +371,26 @@ namespace IRaCIS.Application.Services //await this.iServiceProvider.GetService().AddOncologyTask(readingId); - await DealVisiTaskClinicalDataSignedAsync(data.TrialId, data.SubjectId, data.ReadingId, data.IsVisit, inDto.TrialReadingCriterionId); + //如果先生成了任务,再签名subject级别 PM 临床数据,那么会导致其他标准的任务签名状态无法得到维护 + + if (await _repository.AnyAsync(t=>t.Id == data.ClinicalDataTrialSetId && t.UploadRole == UploadRole.PM && t.ClinicalDataLevel == ClinicalLevel.Subject)) + { + var needDealTrialReadingCriterionIdList = _repository.Where(t => t.Id == data.ClinicalDataTrialSetId) + .SelectMany(t => t.TrialClinicalDataSetCriteriaList) + .Select(u => u.TrialReadingCriterionId).Distinct().ToList(); + + foreach (var trialReadingCriterionId in needDealTrialReadingCriterionIdList) + { + await DealVisiTaskClinicalDataSignedAsync(data.TrialId, data.SubjectId, data.ReadingId, data.IsVisit, trialReadingCriterionId); + } + } + else + { + await DealVisiTaskClinicalDataSignedAsync(data.TrialId, data.SubjectId, data.ReadingId, data.IsVisit, inDto.TrialReadingCriterionId); + + } + + return ResponseOutput.Result(result); } diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs index e4a20aa8d..61597b830 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingImageTaskViewModel.cs @@ -1847,6 +1847,11 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto /// public decimal? JudgeDifferenceValue { get; set; } + /// + /// 类型 + /// + public string Type { get; set; } = string.Empty; + /// /// 裁判百分比或绝对值的相差值匹配规则 /// diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs index 9dda8fac0..cb5c0597f 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingImageTask/ReadingJudgeTaskService.cs @@ -46,6 +46,7 @@ namespace IRaCIS.Application.Services QuestionGenre=x.QuestionGenre, DictionaryCode=x.DictionaryCode, JudgeType = x.JudgeType, + Type=x.Type, ReadingQuestionTrialId = x.Id, JudgeDifferenceValue= x.JudgeDifferenceValue, JudgeDifferenceType=x.JudgeDifferenceType, @@ -898,6 +899,10 @@ namespace IRaCIS.Application.Services noteEqual = true; break; } + else if (noteEqual) + { + break; + } else { var taskAnswer1 = item.TaskAnswerList[0]; @@ -942,9 +947,9 @@ namespace IRaCIS.Application.Services var deffaultValue = taskAnswer1.IsNullOrEmptyReturn0() - taskAnswer2.IsNullOrEmptyReturn0(); if (deffaultValue < 0) { - deffaultValue =0 -deffaultValue; + deffaultValue = 0 - deffaultValue; - } + } if (item.JudgeDifferenceType == JudgeDifferenceType.Greater) { @@ -953,18 +958,18 @@ namespace IRaCIS.Application.Services noteEqual = true; } } - else if(item.JudgeDifferenceType == JudgeDifferenceType.AboveOrEqual) + else if (item.JudgeDifferenceType == JudgeDifferenceType.AboveOrEqual) { - if (deffaultValue >= item.JudgeDifferenceValue) - { - noteEqual = true; - } - } + if (deffaultValue >= item.JudgeDifferenceValue) + { + noteEqual = true; + } + } - - break; - case JudgeTypeEnum.PercentageDifference: + + break; + case JudgeTypeEnum.PercentageDifference: var value1 = taskAnswer1.IsNullOrEmptyReturn0(); var value2 = taskAnswer2.IsNullOrEmptyReturn0(); if (value1 == 0 || value2 == 0) @@ -974,38 +979,37 @@ namespace IRaCIS.Application.Services else { - if (item.JudgeDifferenceType == JudgeDifferenceType.Greater) - { - if (value1 < value2) - { - noteEqual = (value2 - value1) * 100 / value1 > item.JudgeDifferenceValue; + if (item.JudgeDifferenceType == JudgeDifferenceType.Greater) + { + if (value1 < value2) + { + noteEqual = (value2 - value1) * 100 / value1 > item.JudgeDifferenceValue; - } - else - { - noteEqual = (value1 - value2) * 100 / value2 > item.JudgeDifferenceValue; - } - } - else if (item.JudgeDifferenceType == JudgeDifferenceType.AboveOrEqual) - { - if (value1 < value2) - { - noteEqual = (value2 - value1) * 100 / value1 >= item.JudgeDifferenceValue; + } + else + { + noteEqual = (value1 - value2) * 100 / value2 > item.JudgeDifferenceValue; + } + } + else if (item.JudgeDifferenceType == JudgeDifferenceType.AboveOrEqual) + { + if (value1 < value2) + { + noteEqual = (value2 - value1) * 100 / value1 >= item.JudgeDifferenceValue; + + } + else + { + noteEqual = (value1 - value2) * 100 / value2 >= item.JudgeDifferenceValue; + } + } - } - else - { - noteEqual = (value1 - value2) * 100 / value2 >= item.JudgeDifferenceValue; - } - } - } - - break; - default: - noteEqual = false; + + break; + default: break; } } diff --git a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs index d5a9e076c..a33e735cb 100644 --- a/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs +++ b/IRaCIS.Core.Application/Service/Third-partyProject/UltrasonicDicomService.cs @@ -8,7 +8,6 @@ using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Infrastructure; using Medallion.Threading; using Microsoft.AspNetCore.Mvc; -using OfficeOpenXml.FormulaParsing.Utilities; using System; using System.Collections.Generic; using System.Linq; diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs index e1f014663..9426b66dc 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/UserTrialViewModel.cs @@ -1,7 +1,6 @@ using System.ComponentModel.DataAnnotations; using IRaCIS.Core.Infrastructure.Extention; using IRaCIS.Core.Domain.Share; -using Magicodes.ExporterAndImporter.Core; using MiniExcelLibs.Attributes; using Newtonsoft.Json; using IRaCIS.Core.Application.Contracts; @@ -74,28 +73,28 @@ namespace IRaCIS.Application.Contracts public string State => IsDeleted ? "退出" : "加入"; - [ValueMapping(text: "退出", true)] - [ValueMapping(text: "加入", false)] + //[ValueMapping(text: "退出", true)] + //[ValueMapping(text: "加入", false)] [DictionaryTranslateAttribute("IsUserExitTrial")] public bool IsDeleted { get; set; } - [ExporterHeader(Format = "yyyy-mm-DD hh:mm:ss")] + //[ExporterHeader(Format = "yyyy-mm-DD hh:mm:ss")] [ExcelFormat("yyyy-MM-dd hh:mm:ss")] public DateTime? DeletedTime { get; set; } - [ExporterHeader(Format = "yyyy-mm-DD")] + //[ExporterHeader(Format = "yyyy-mm-DD")] [ExcelFormat("yyyy-MM-dd")] public DateTime? RemoveTime { get; set; } - [ExporterHeader(Format = "yyyy-mm-DD")] + //[ExporterHeader(Format = "yyyy-mm-DD")] [ExcelFormat("yyyy-MM-dd")] public DateTime? JoinTime { get; set; } - [ExporterHeader(Format = "yyyy-mm-DD hh:mm:ss")] + //[ExporterHeader(Format = "yyyy-mm-DD hh:mm:ss")] [ExcelFormat("yyyy-MM-dd HH:mm:ss")] public DateTime CreateTime { get; set; } diff --git a/IRaCIS.Core.Application/Service/Visit/Interface/IVisitPlanService.cs b/IRaCIS.Core.Application/Service/Visit/Interface/IVisitPlanService.cs index cad9d1878..772176eda 100644 --- a/IRaCIS.Core.Application/Service/Visit/Interface/IVisitPlanService.cs +++ b/IRaCIS.Core.Application/Service/Visit/Interface/IVisitPlanService.cs @@ -9,7 +9,7 @@ namespace IRaCIS.Application.Interfaces Task AddOrUpdateVisitStage(VisitPlanCommand visitPlan); Task ConfirmTrialVisitPlan(Guid trialId); Task DeleteVisitStage(Guid id); - Task DownloadInflunceStudyList(Guid visitPlanInfluenceStatId); + //Task DownloadInflunceStudyList(Guid visitPlanInfluenceStatId); Task> GetInfluenceHistoryList(Guid trialId, [FromServices] IRepository _influnceStatRepository); Task> GetTrialVisitStageList(VisitPlanQueryDTO param); Task> GetTrialVisitStageSelect(Guid trialId); diff --git a/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs b/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs index 252eb8c2f..d98c37ca5 100644 --- a/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs +++ b/IRaCIS.Core.Application/Service/Visit/VisitPlanService.cs @@ -4,12 +4,10 @@ using IRaCIS.Core.Application.Filter; using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Application.MediatR.CommandAndQueries; -using Magicodes.ExporterAndImporter.Core; -using Magicodes.ExporterAndImporter.Excel; -using Magicodes.ExporterAndImporter.Excel.AspNetCore; using IRaCIS.Core.Infrastructure; using Microsoft.AspNetCore.Authorization; using IRaCIS.Core.Application.Auth; +using MiniExcelLibs; namespace IRaCIS.Application.Services { @@ -488,12 +486,15 @@ namespace IRaCIS.Application.Services var list = _influnceRepository.Where(t => t.VisitPlanInfluenceStatId == visitPlanInfluenceStatId) .ProjectTo(_mapper.ConfigurationProvider).ToList(); - IExporter exporter = new ExcelExporter(); + var memoryStream = new MemoryStream(); + memoryStream.SaveAs(list); + memoryStream.Seek(0, SeekOrigin.Begin); + return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") + { + FileDownloadName = _localizer["VisitPlan_CheckExport", DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")] + }; - var result = await exporter.ExportAsByteArray(list); - - //$"检查导出_{DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")}.xlsx" - return new XlsxFileResult(bytes: result, fileDownloadName: _localizer["VisitPlan_CheckExport", DateTime.Now.ToString("yyyy-MM-dd:hh:mm:ss")]); + } diff --git a/IRaCIS.Core.Application/_MediatR/CommandAndQueries/ConsistencyVerificationRequest.cs b/IRaCIS.Core.Application/_MediatR/CommandAndQueries/ConsistencyVerificationRequest.cs index 06387c87c..3bb3656d0 100644 --- a/IRaCIS.Core.Application/_MediatR/CommandAndQueries/ConsistencyVerificationRequest.cs +++ b/IRaCIS.Core.Application/_MediatR/CommandAndQueries/ConsistencyVerificationRequest.cs @@ -1,8 +1,4 @@ using IRaCIS.Core.Domain.Share; -using Magicodes.ExporterAndImporter.Core; -using Magicodes.ExporterAndImporter.Core.Filters; -using Magicodes.ExporterAndImporter.Core.Models; -using Magicodes.ExporterAndImporter.Excel; using MediatR; using MiniExcelLibs.Attributes; using System.ComponentModel.DataAnnotations; @@ -27,33 +23,33 @@ namespace IRaCIS.Core.Application.MediatR.CommandAndQueries - public class ImportResultFilteTest : IImportResultFilter - { + //public class ImportResultFilteTest : IImportResultFilter + //{ - public ImportResult Filter(ImportResult importResult) where T : class, new() - { - if (typeof(T).IsAssignableFrom(typeof(CheckViewModel))) - { - var data = (List)importResult.Data; + // public ImportResult Filter(ImportResult importResult) where T : class, new() + // { + // if (typeof(T).IsAssignableFrom(typeof(CheckViewModel))) + // { + // var data = (List)importResult.Data; - var dt = DateTime.Now ; + // var dt = DateTime.Now ; - foreach (var item in data) - { + // foreach (var item in data) + // { - var index= data.IndexOf(item); - if ( DateTime.TryParse(item.StudyDate, out dt) == false) - { + // var index= data.IndexOf(item); + // if ( DateTime.TryParse(item.StudyDate, out dt) == false) + // { - importResult.RowErrors.Add(new DataRowErrorInfo() { RowIndex = index, FieldErrors = new Dictionary { { StaticData.International("ConsistencyVerification_Tech") , StaticData.International("ConsistencyVerification_Time") } } }); - } - } - } + // importResult.RowErrors.Add(new DataRowErrorInfo() { RowIndex = index, FieldErrors = new Dictionary { { StaticData.International("ConsistencyVerification_Tech") , StaticData.International("ConsistencyVerification_Time") } } }); + // } + // } + // } - return importResult; - } - } + // return importResult; + // } + //} public class ParamInfoDto @@ -69,23 +65,23 @@ namespace IRaCIS.Core.Application.MediatR.CommandAndQueries } - [ExcelImporter(/*ImportResultFilter = typeof(ImportResultFilteTest),*/ IsLabelingError = true)] + //[ExcelImporter(/*ImportResultFilter = typeof(ImportResultFilteTest),*/ IsLabelingError = true)] public class CheckViewModel { //[Required(ErrorMessage = "中心编号不能为空")] - [ImporterHeader(Name = "Site ID", AutoTrim = true)] - [ExcelColumnIndex("Site ID")] + //[ImporterHeader(Name = "Site ID", AutoTrim = true)] + [ExcelColumnName("Site ID")] public string SiteCode { get; set; } = string.Empty; //[Required(ErrorMessage = "受试者筛选号不能为空")] - [ImporterHeader(Name = "Subject ID", AutoTrim = true)] + //[ImporterHeader(Name = "Subject ID", AutoTrim = true)] [ExcelColumnName("Subject ID")] public string SubjectCode { get; set; } = string.Empty; //[Required(ErrorMessage = "访视名称不能为空")] - [ImporterHeader(Name = "Visit Name", AutoTrim = true)] + //[ImporterHeader(Name = "Visit Name", AutoTrim = true)] [ExcelColumnName("Visit Name")] public string VisitName { get; set; } = string.Empty; @@ -94,14 +90,14 @@ namespace IRaCIS.Core.Application.MediatR.CommandAndQueries //[Required(ErrorMessage = "检查日期不能为空")] [CanConvertToTime(ErrorMessage = "Does not conform to Study Date format")] - [ImporterHeader(Name = "Study Date", AutoTrim = true)] + //[ImporterHeader(Name = "Study Date", AutoTrim = true)] [ExcelColumnName("Study Date")] public string StudyDate { get; set; } = string.Empty; //[Required(ErrorMessage = "Modality不能为空")] - [ImporterHeader(Name = "Modality", AutoTrim = true)] + //[ImporterHeader(Name = "Modality", AutoTrim = true)] [ExcelColumnName("Modality")] public string Modality { get; set; } = string.Empty; @@ -131,48 +127,49 @@ namespace IRaCIS.Core.Application.MediatR.CommandAndQueries public class VisitPlanInfluenceSubjectVisitDTO { - [ExporterHeader(IsIgnore = true)] + [ExcelColumn(Ignore = true)] public Guid StudyId { get; set; } - [ExporterHeader(IsIgnore = true)] + [ExcelColumn(Ignore = true)] public Guid TrialId { get; set; } - [ExporterHeader(IsIgnore = true)] + [ExcelColumn(Ignore = true)] public Guid SubjectVisitId { get; set; } - [ExporterHeader(DisplayName = "中心编号")] + [ExcelColumnName("中心编号")] public string TrialSiteCode { get; set; } = string.Empty; - [ExporterHeader(DisplayName = "受试者")] + [ExcelColumnName("受试者")] public string SubjectCode { get; set; } = string.Empty; - [ExporterHeader(DisplayName = "访视名称")] + [ExcelColumnName("访视名称")] public string VisitName { get; set; } = string.Empty; - [ExporterHeader(DisplayName = "检查时间", Format = "yyyy-mm-dd hh:mm:ss")] + [ExcelColumn(Name = "检查时间", Format = "yyyy-MM-dd HH:mm:ss")] public DateTime StudyTime { get; set; } - [ExporterHeader(DisplayName = "检查技术")] + [ExcelColumnName("检查技术")] public string Modality { get; set; } = string.Empty; - [ExporterHeader(IsIgnore = true)] + [ExcelColumn(Ignore = true)] public bool IsDicomStudy { get; set; } - [ExporterHeader(DisplayName = "影像类型")] + + [ExcelColumnName("影像类型")] public string ImageType => IsDicomStudy ? "Dicom" : "非Dicom"; - [ExporterHeader(DisplayName = "历史窗口")] + [ExcelColumnName("历史窗口")] public string HistoryWindow { get; set; } = string.Empty; - [ExporterHeader(DisplayName = "之前超窗调整后没超窗")] - [ValueMapping(text: "yes", true)] - [ValueMapping(text: "no", false)] + + [ExcelColumnName("之前超窗调整后没超窗")] + public bool IsOverWindowNowNotOverWindow { get; set; } - [ExporterHeader(DisplayName = "目前窗口")] + [ExcelColumnName("目前窗口")] public string NowWindow { get; set; } = string.Empty; - [ExporterHeader(IsIgnore = true)] + [ExcelColumn(Ignore =true)] public DateTime CreateTime { get; set; } } diff --git a/IRaCIS.Core.Application/_MediatR/Handlers/ConsistencyVerificationHandler.cs b/IRaCIS.Core.Application/_MediatR/Handlers/ConsistencyVerificationHandler.cs index 2896d2868..e5df2ff04 100644 --- a/IRaCIS.Core.Application/_MediatR/Handlers/ConsistencyVerificationHandler.cs +++ b/IRaCIS.Core.Application/_MediatR/Handlers/ConsistencyVerificationHandler.cs @@ -191,6 +191,8 @@ namespace IRaCIS.Core.Application.MediatR.Handlers dbSV.CheckState = CheckStateEnum.CVPassed; dbSV.CheckUserId = _userInfo.Id; dbSV.CheckPassedTime = DateTime.Now; + dbSV.CheckChallengeState = CheckChanllengeTypeEnum.Closed; + //---核对EDC数据,完全一致 dbSV.CheckResult = _localizer["ConsistencyVerification_EDCB"]; //---自动核查通过 diff --git a/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs b/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs index 81cb8e983..ce264d3c0 100644 --- a/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs +++ b/IRaCIS.Core.Domain/Image/DicomStudyMonitor.cs @@ -61,7 +61,7 @@ namespace IRaCIS.Core.Domain.Models public Guid TrialId { get; set; } - public Guid SiteId { get; set; } + public Guid SiteId { get; set; }=Guid.Empty; public Guid SubjectId { get; set; } diff --git a/IRaCIS.Core.Domain/Institution/CRO.cs b/IRaCIS.Core.Domain/Institution/CRO.cs index 629364936..aeaf02098 100644 --- a/IRaCIS.Core.Domain/Institution/CRO.cs +++ b/IRaCIS.Core.Domain/Institution/CRO.cs @@ -10,6 +10,9 @@ namespace IRaCIS.Core.Domain.Models public string CRONameCN { get; set; } = string.Empty; public string CROCode { get; set; } + + public bool IsTrialLevel { get; set; } + public DateTime CreateTime { get; set; } public Guid CreateUserId { get; set; } public Guid UpdateUserId { get; set; } diff --git a/IRaCIS.Core.Domain/Institution/Sponsor.cs b/IRaCIS.Core.Domain/Institution/Sponsor.cs index 9d6eb9072..fcc862a89 100644 --- a/IRaCIS.Core.Domain/Institution/Sponsor.cs +++ b/IRaCIS.Core.Domain/Institution/Sponsor.cs @@ -11,6 +11,8 @@ namespace IRaCIS.Core.Domain.Models public string SponsorCode { get; set; } = String.Empty; + public bool IsTrialLevel { get; set; } + public DateTime CreateTime { get; set; } = DateTime.Now; public Guid CreateUserId { get; set; } = Guid.Empty; public DateTime UpdateTime { get; set; } = DateTime.Now;