From b9f9af06f4ec253c85f85a0fdf156fb11d89f104 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 11 Jun 2026 09:44:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BDswager=20=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IRaCIS.Core.Application.xml | 50 +++-- .../MinimalApiService/FileToPDFService.cs | 204 +++++++++--------- IRaCIS.Core.Application/TestService.cs | 114 +++++----- 3 files changed, 186 insertions(+), 182 deletions(-) diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index f7b3bc8aa..22abef2d5 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -3699,29 +3699,6 @@ - - - 上传文件转PDF 或者给url 这边下载然后转PDF - - - - - - - 上传文件转PDF 或者给url 这边下载然后转PDF - - - - - - - - - 测试efcore json 列支持情况 - https://devblogs.microsoft.com/dotnet/array-mapping-in-ef-core-8/ - - - 获取授权码明文信息 @@ -3884,6 +3861,15 @@ The ID token, which can be used to verify the identity of the user. + + + + + 测试efcore json 列支持情况 + https://devblogs.microsoft.com/dotnet/array-mapping-in-ef-core-8/ + + + 验证CRC 是否已提交 已提交 就不允许进行任何操作,如果是IQC 那么还验证是否是当前任务领取人 @@ -9741,6 +9727,11 @@ 任务Id + + + 标记的唯一标识符 + + 任务Id @@ -14836,6 +14827,13 @@ + + + 获取非DICOM标记信息 + + + + 获取手册 @@ -17510,17 +17508,17 @@ - ���� + 质疑 - һ���Ժ˲� + 一致性核查 - ���� + 复制 diff --git a/IRaCIS.Core.Application/Service/MinimalApiService/FileToPDFService.cs b/IRaCIS.Core.Application/Service/MinimalApiService/FileToPDFService.cs index 1a899fbc6..cb3a18f62 100644 --- a/IRaCIS.Core.Application/Service/MinimalApiService/FileToPDFService.cs +++ b/IRaCIS.Core.Application/Service/MinimalApiService/FileToPDFService.cs @@ -1,137 +1,137 @@ -using IRaCIS.Core.Application.Helper; -using MassTransit; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.StaticFiles; -using RestSharp; -using SharpCompress.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +//using IRaCIS.Core.Application.Helper; +//using MassTransit; +//using Microsoft.AspNetCore.Authorization; +//using Microsoft.AspNetCore.Builder; +//using Microsoft.AspNetCore.Hosting; +//using Microsoft.AspNetCore.Http; +//using Microsoft.AspNetCore.Mvc; +//using Microsoft.AspNetCore.StaticFiles; +//using RestSharp; +//using SharpCompress.Common; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Text; +//using System.Threading.Tasks; -namespace IRaCIS.Core.Application.Service.MinimalApiService -{ - /// - /// 上传文件转PDF 或者给url 这边下载然后转PDF - /// - /// - /// - [ApiExplorerSettings(GroupName = "Institution")] - public class FileToPDFService(IWebHostEnvironment _hostEnvironment) : ServiceBase - { +//namespace IRaCIS.Core.Application.Service.MinimalApiService +//{ +// /// +// /// 上传文件转PDF 或者给url 这边下载然后转PDF +// /// +// /// +// /// +// [ApiExplorerSettings(GroupName = "Institution")] +// public class FileToPDFService(IWebHostEnvironment _hostEnvironment) : ServiceBase +// { - [AllowAnonymous] - [RoutePattern(HttpMethod = "Post")] - public async Task UploadFileAsync([FromForm] IFormFile file) - { - var tempFileName = NewId.NextGuid() + file.FileName; - var tempPDFName = Path.GetFileNameWithoutExtension(tempFileName) + ".pdf"; +// [AllowAnonymous] +// [RoutePattern(HttpMethod = "Post")] +// public async Task UploadFileAsync([FromForm] IFormFile file) +// { +// var tempFileName = NewId.NextGuid() + file.FileName; +// var tempPDFName = Path.GetFileNameWithoutExtension(tempFileName) + ".pdf"; - // 获取wwwroot目录 - var wwwRootPath = Path.Combine(FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment), "temp"); +// // 获取wwwroot目录 +// var wwwRootPath = Path.Combine(FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment), "temp"); - // 检查wwwroot/temp目录是否存在,不存在则创建 - if (!Directory.Exists(wwwRootPath)) - { - Directory.CreateDirectory(wwwRootPath); - } +// // 检查wwwroot/temp目录是否存在,不存在则创建 +// if (!Directory.Exists(wwwRootPath)) +// { +// Directory.CreateDirectory(wwwRootPath); +// } - // 文件保存路径 - var pdfFilePath = Path.Combine(wwwRootPath, tempPDFName); - var tempFilePath = Path.Combine(wwwRootPath, tempFileName); +// // 文件保存路径 +// var pdfFilePath = Path.Combine(wwwRootPath, tempPDFName); +// var tempFilePath = Path.Combine(wwwRootPath, tempFileName); - using var stream = File.OpenWrite(tempFilePath); - await file.CopyToAsync(stream); +// using var stream = File.OpenWrite(tempFilePath); +// await file.CopyToAsync(stream); - FileConvertHelper.ConvertWordToPdf(tempFilePath, Path.GetDirectoryName(pdfFilePath)); +// FileConvertHelper.ConvertWordToPdf(tempFilePath, Path.GetDirectoryName(pdfFilePath)); - var fileBytes = await File.ReadAllBytesAsync(pdfFilePath); +// var fileBytes = await File.ReadAllBytesAsync(pdfFilePath); - // 清理临时上传的文件和pdf - if (File.Exists(pdfFilePath)) - { - File.Delete(pdfFilePath); - } - if (File.Exists(tempFilePath)) - { - File.Delete(tempFilePath); - } +// // 清理临时上传的文件和pdf +// if (File.Exists(pdfFilePath)) +// { +// File.Delete(pdfFilePath); +// } +// if (File.Exists(tempFilePath)) +// { +// File.Delete(tempFilePath); +// } - new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(tempPDFName), out var contentType); +// new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(tempPDFName), out var contentType); - return Results.File(fileBytes, contentType); +// return Results.File(fileBytes, contentType); - } +// } - public async Task GetPDFFileAsync(string fileUrl) - { - var tempFileName = NewId.NextGuid() + Path.GetFileName(fileUrl); - var tempPDFName = Path.GetFileNameWithoutExtension(tempFileName) + ".pdf"; +// public async Task GetPDFFileAsync(string fileUrl) +// { +// var tempFileName = NewId.NextGuid() + Path.GetFileName(fileUrl); +// var tempPDFName = Path.GetFileNameWithoutExtension(tempFileName) + ".pdf"; - // 获取wwwroot目录 - var wwwRootPath = Path.Combine(FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment), "temp"); +// // 获取wwwroot目录 +// var wwwRootPath = Path.Combine(FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment), "temp"); - // 检查wwwroot/temp目录是否存在,不存在则创建 - if (!Directory.Exists(wwwRootPath)) - { - Directory.CreateDirectory(wwwRootPath); - } +// // 检查wwwroot/temp目录是否存在,不存在则创建 +// if (!Directory.Exists(wwwRootPath)) +// { +// Directory.CreateDirectory(wwwRootPath); +// } - // 文件保存路径 - var pdfFilePath = Path.Combine(wwwRootPath, tempPDFName); - var tempFilePath = Path.Combine(wwwRootPath, tempFileName); +// // 文件保存路径 +// var pdfFilePath = Path.Combine(wwwRootPath, tempPDFName); +// var tempFilePath = Path.Combine(wwwRootPath, tempFileName); - //请求url获取文件 - var client = new RestClient(fileUrl); +// //请求url获取文件 +// var client = new RestClient(fileUrl); - var request = new RestRequest(fileUrl, Method.Get); +// var request = new RestRequest(fileUrl, Method.Get); - var response = await client.ExecuteAsync(request); +// var response = await client.ExecuteAsync(request); - // 检查响应是否成功 - if (response.IsSuccessful) - { - // 将响应内容写入到本地文件 - await File.WriteAllBytesAsync(tempFilePath, response.RawBytes); +// // 检查响应是否成功 +// if (response.IsSuccessful) +// { +// // 将响应内容写入到本地文件 +// await File.WriteAllBytesAsync(tempFilePath, response.RawBytes); - FileConvertHelper.ConvertWordToPdf(tempFilePath, Path.GetDirectoryName(pdfFilePath)); +// FileConvertHelper.ConvertWordToPdf(tempFilePath, Path.GetDirectoryName(pdfFilePath)); - var fileBytes = await File.ReadAllBytesAsync(pdfFilePath); +// var fileBytes = await File.ReadAllBytesAsync(pdfFilePath); - // 清理临时上传的文件和pdf - if (File.Exists(pdfFilePath)) - { - File.Delete(pdfFilePath); - } - if (File.Exists(tempFilePath)) - { - File.Delete(tempFilePath); - } +// // 清理临时上传的文件和pdf +// if (File.Exists(pdfFilePath)) +// { +// File.Delete(pdfFilePath); +// } +// if (File.Exists(tempFilePath)) +// { +// File.Delete(tempFilePath); +// } - new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(tempPDFName), out var contentType); +// new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(tempPDFName), out var contentType); - return Results.File(fileBytes, contentType); - } - else - { - Console.WriteLine($"下载文件失败: {response.ErrorMessage}"); +// return Results.File(fileBytes, contentType); +// } +// else +// { +// Console.WriteLine($"下载文件失败: {response.ErrorMessage}"); - return Results.Problem("下载文件失败", statusCode: StatusCodes.Status500InternalServerError); +// return Results.Problem("下载文件失败", statusCode: StatusCodes.Status500InternalServerError); - } +// } - } +// } - } -} +// } +//} diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index 3d609a307..470a32ecc 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -49,6 +49,7 @@ namespace IRaCIS.Core.Application.Service IRepository _dicomSeriesRepository, IRepository _userRoleRepository, IRepository _trialBodyPartRepository, + IRepository _subjectVisitRepository, IOSSService _IOSSService, IDistributedLockProvider _distributedLockProvider, ILogger _logger, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService @@ -56,6 +57,7 @@ namespace IRaCIS.Core.Application.Service public static int IntValue = 100; + public class ModelVerifyCommand { public int? IntNUllValue { get; set; } @@ -219,72 +221,72 @@ namespace IRaCIS.Core.Application.Service #region 数据库查询 -// var downloadInfo = _trialRepository.Where(t => t.Id == trialId).Select(t => new -// { -// t.ResearchProgramNo, -// t.TrialCode, + // var downloadInfo = _trialRepository.Where(t => t.Id == trialId).Select(t => new + // { + // t.ResearchProgramNo, + // t.TrialCode, -// VisitList = t.SubjectVisitList.Where(t => t.VisitTaskList.Any(t => t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.SourceSubjectVisitId != null && t.DoctorUserId != null)) -// //.Where(t=>subjectCodeList.Contains(t.Subject.Code)) -// .Select(sv => new -// { -// SubjectVisitId = sv.Id, -// TrialSiteCode = sv.TrialSite.TrialSiteCode, -// SubjectCode = sv.Subject.Code, -// VisitName = sv.VisitName, -// VisitNum = sv.VisitNum, -// StudyList = sv.StudyList.Select(u => new -// { -// StudyId = u.Id, -// u.PatientId, -// u.StudyTime, -// u.StudyCode, -// u.StudyInstanceUid, -// u.StudyDIRPath, + // VisitList = t.SubjectVisitList.Where(t => t.VisitTaskList.Any(t => t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState != ReadingTaskState.HaveSigned && t.SourceSubjectVisitId != null && t.DoctorUserId != null)) + // //.Where(t=>subjectCodeList.Contains(t.Subject.Code)) + // .Select(sv => new + // { + // SubjectVisitId = sv.Id, + // TrialSiteCode = sv.TrialSite.TrialSiteCode, + // SubjectCode = sv.Subject.Code, + // VisitName = sv.VisitName, + // VisitNum = sv.VisitNum, + // StudyList = sv.StudyList.Select(u => new + // { + // StudyId = u.Id, + // u.PatientId, + // u.StudyTime, + // u.StudyCode, + // u.StudyInstanceUid, + // u.StudyDIRPath, -// SeriesList = u.SeriesList.Where(t => t.IsReading).Select(z => new -// { -// z.Modality, + // SeriesList = u.SeriesList.Where(t => t.IsReading).Select(z => new + // { + // z.Modality, -// InstancePathList = z.DicomInstanceList.Where(t => t.IsReading).Select(k => new -// { -// InstanceId = k.Id, -// k.Path, -// k.IsEncapsulated, -// k.NumberOfFrames, -// }).ToList() -// }) + // InstancePathList = z.DicomInstanceList.Where(t => t.IsReading).Select(k => new + // { + // InstanceId = k.Id, + // k.Path, + // k.IsEncapsulated, + // k.NumberOfFrames, + // }).ToList() + // }) -// }).ToList(), + // }).ToList(), -// NoneDicomStudyList = sv.NoneDicomStudyList.Where(t => t.IsReading).Select(nd => new -// { -// nd.Modality, -// nd.StudyCode, -// nd.ImageDate, + // NoneDicomStudyList = sv.NoneDicomStudyList.Where(t => t.IsReading).Select(nd => new + // { + // nd.Modality, + // nd.StudyCode, + // nd.ImageDate, -// FileList = nd.NoneDicomFileList.Where(t => t.IsReading).Select(file => new -// { -// file.FileName, -// file.Path, -// file.FileType -// }).ToList() -// }).ToList() -// }).OrderBy(t => t.SubjectCode).ThenBy(t => t.VisitNum).ToList() + // FileList = nd.NoneDicomFileList.Where(t => t.IsReading).Select(file => new + // { + // file.FileName, + // file.Path, + // file.FileType + // }).ToList() + // }).ToList() + // }).OrderBy(t => t.SubjectCode).ThenBy(t => t.VisitNum).ToList() -// }).FirstOrDefault(); + // }).FirstOrDefault(); -// var acturalDownList = downloadInfo.VisitList.Where(t => !oldVisits.Any(old => old.VisitNum == t.VisitNum && old.SubjectCode == t.SubjectCode && -//old.VisitName.Trim().ToLower() == t.VisitName.Trim().ToLower())).ToList(); + // var acturalDownList = downloadInfo.VisitList.Where(t => !oldVisits.Any(old => old.VisitNum == t.VisitNum && old.SubjectCode == t.SubjectCode && + //old.VisitName.Trim().ToLower() == t.VisitName.Trim().ToLower())).ToList(); -// var diffList = downloadVisit.Where(t => !acturalDownList.Any(old => old.SubjectCode.Trim() == t.SubjectCode.Trim() && -//old.VisitName.Trim().ToLower() == t.VisitName.Trim().ToLower())).ToList(); + // var diffList = downloadVisit.Where(t => !acturalDownList.Any(old => old.SubjectCode.Trim() == t.SubjectCode.Trim() && + //old.VisitName.Trim().ToLower() == t.VisitName.Trim().ToLower())).ToList(); -// string diffPath = @$"C:\Users\PC\Desktop\diff.xlsx"; -// MiniExcel.SaveAs(diffPath, diffList); + // string diffPath = @$"C:\Users\PC\Desktop\diff.xlsx"; + // MiniExcel.SaveAs(diffPath, diffList); #endregion @@ -294,8 +296,12 @@ namespace IRaCIS.Core.Application.Service //创建一个模型验证的方法 [AllowAnonymous] [HttpPost("{email}")] - public async Task PostModelVerify(ModelVerifyCommand modelVerify) + public async Task PostModelVerify(/*ModelVerifyCommand modelVerify,*/ Guid subjectVisitId) { + var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.Subject).Include(x => x.CurrentActionUser).FirstNotNullAsync(); + + var subjectVisit2 = await (_subjectVisitRepository.Where(x => x.Id == subjectVisitId).Include(x => x.Subject).Include(x => x.CurrentActionUser)).FirstNotNullAsync(); + var webhook = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=cdd97aab-d256-4f07-9145-a0a2b1555322"; //await WeComNotifier.SendErrorAsync(webhook, "http://irc.test.extimaging.com/login", new Exception("测试异常"), new[] { "ZhouHang" });