diff --git a/IRaCIS.Core.API/appsettings.Test_IRC.json b/IRaCIS.Core.API/appsettings.Test_IRC.json
index 457e2223f..85d1b7163 100644
--- a/IRaCIS.Core.API/appsettings.Test_IRC.json
+++ b/IRaCIS.Core.API/appsettings.Test_IRC.json
@@ -72,7 +72,9 @@
"ReadingRestTimeMin": 10,
"IsNeedChangePassWord": true,
- "ChangePassWordDays": 90
+ "ChangePassWordDays": 90,
+
+ "ThirdPdfUrl": "http://106.14.89.110:30088/api/v1/convert/file/pdf"
},
"SystemEmailSendConfig": {
diff --git a/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs b/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs
index 885c65dd1..c89c9a803 100644
--- a/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs
+++ b/IRaCIS.Core.Application/BusinessFilter/_Config/_AppSettings.cs
@@ -34,6 +34,8 @@ public class ServiceVerifyConfigOption
[Description("修改密码的天数")]
public int ChangePassWordDays { get; set; }
+ public string ThirdPdfUrl { get; set; }
+
}
public class SystemEmailSendConfig
diff --git a/IRaCIS.Core.Application/Helper/FileConvertHelper.cs b/IRaCIS.Core.Application/Helper/FileConvertHelper.cs
index 5b34f64f3..9034db877 100644
--- a/IRaCIS.Core.Application/Helper/FileConvertHelper.cs
+++ b/IRaCIS.Core.Application/Helper/FileConvertHelper.cs
@@ -1,11 +1,18 @@
-using System.Diagnostics;
+using Microsoft.Extensions.Configuration;
+using RestSharp;
+using SharpCompress.Common;
+using System.Diagnostics;
namespace IRaCIS.Core.Application.Helper;
public class FileConvertHelper
{
-
+ ///
+ /// 镜像里面打入libreoffice 的方案
+ ///
+ ///
+ ///
static public void ConvertWordToPdf(string inputWordFilePath, string outputPdfDir)
{
// 设置 libreoffice 命令行参数
@@ -30,4 +37,88 @@ public class FileConvertHelper
}
+ ///
+ /// 返回文件字节数组
+ /// File.WriteAllBytes(outputFilePath, response.RawBytes); 直接将字节数组写入到本地某个路径
+ /// var stream = new MemoryStream(response.RawBytes); 直接变为内存流,给其他程序用也可以
+ ///
+ ///
+ static public async Task ThirdStirling_PDFWordToPdfAsync(string filePath)
+ {
+
+ var apiUrl = GetApiUrl();
+
+ var client = new RestClient(apiUrl);
+
+ var request = new RestRequest(apiUrl, Method.Post);
+
+ request.AddHeader("accept", "*/*");
+
+ // 直接上传文件,无需生成字节数组
+ request.AddFile("fileInput", filePath);
+
+ return await GetPDFByteArrayAsync(client, request);
+ }
+
+ static public async Task ThirdStirling_PDFWordToPdfAsync(byte[] fileBytes, string fileName)
+ {
+
+ var apiUrl = GetApiUrl();
+ var client = new RestClient(apiUrl);
+
+ var request = new RestRequest(apiUrl, Method.Post);
+
+ request.AddHeader("accept", "*/*");
+
+ // 添加文件流到请求
+ request.AddFile("fileInput", fileBytes, fileName);
+
+ return await GetPDFByteArrayAsync(client, request);
+ }
+
+ static private async Task GetPDFByteArrayAsync(RestClient client, RestRequest request)
+ {
+ try
+ {
+
+
+
+ // 发送请求并获取响应
+ var response = await client.ExecuteAsync(request);
+
+ // 检查请求是否成功
+ if (response.IsSuccessful)
+ {
+ return response.RawBytes ?? new byte[] { };
+ }
+ else
+ {
+ Console.WriteLine($"上传失败,错误代码: {response.StatusCode}, 错误消息: {response.ErrorMessage}");
+
+ return Array.Empty();
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("发生异常: " + ex.Message);
+
+ return Array.Empty();
+ }
+ }
+
+ static private string GetApiUrl()
+ {
+
+ var enviromentName = Environment.GetEnvironmentVariables()["ASPNETCORE_ENVIRONMENT"]?.ToString();
+
+ var configuration = new ConfigurationBuilder().AddJsonFile($"appsettings.{enviromentName}.json", false, false).Build();
+
+ // 手动绑定配置
+ var appSettings = new ServiceVerifyConfigOption();
+ configuration.GetSection("BasicSystemConfig").Bind(appSettings);
+
+ return appSettings.ThirdPdfUrl;
+ }
+
+
}
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 42c3ff56b..ce70222db 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -12762,6 +12762,21 @@
+
+
+ 镜像里面打入libreoffice 的方案
+
+
+
+
+
+
+ 返回文件字节数组
+ File.WriteAllBytes(outputFilePath, response.RawBytes); 直接将字节数组写入到本地某个路径
+ var stream = new MemoryStream(response.RawBytes); 直接变为内存流,给其他程序用也可以
+
+
+
写文件导到磁盘
@@ -12916,6 +12931,11 @@
加急阅片 IR 申请重阅 或者PM 申请重阅
+
+
+ 加急阅片 IR 申请重阅 或者PM 申请重阅
+
+
用户提交 发送邮件 通知SPM 或者PM
@@ -13042,17 +13062,17 @@
影像质控
-
+
QC 影像质疑待处理
-
+
CRC 影像质疑
-
+
影像质控
diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/TestConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/TestConsumer.cs
index ac559acc0..d87654fbd 100644
--- a/IRaCIS.Core.Application/MassTransit/Consumer/TestConsumer.cs
+++ b/IRaCIS.Core.Application/MassTransit/Consumer/TestConsumer.cs
@@ -1,14 +1,18 @@
-using IRaCIS.Core.Domain;
+using IRaCIS.Core.Application.Helper;
+using IRaCIS.Core.Domain;
using IRaCIS.Core.Domain.Share;
using MassTransit;
using MassTransit.Mediator;
using MassTransit.Scheduling;
using Medallion.Threading;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Options;
+using RestSharp;
using System;
using System.Collections.Generic;
using System.Globalization;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -71,11 +75,76 @@ public class TestMasstransitService : BaseService
////发布后,不会立即进入消费者,消费者是另外的线程执行
//await _mediatorScoped.Publish(new MasstransiTestCommand { value = "message at " + DateTime.Now.ToString() });
- await _recurringMessageScheduler.ScheduleRecurringPublish(new QCImageQuestionSchedule() { CronExpression = "0/3 * * * * ? " }, new MasstransiTestCommand { value = "message at " + DateTime.Now.ToString() });
+ await _recurringMessageScheduler.ScheduleRecurringPublish(new QCImageQuestionRecurringSchedule() { CronExpression = "0/3 * * * * ? " }, new MasstransiTestCommand { value = "message at " + DateTime.Now.ToString() });
//await _scheduler.SchedulePublish(DateTime.Now.AddSeconds(10), new MasstransiTestCommand() { value = "message at " + DateTime.Now.ToString() });
return ResponseOutput.Ok();
}
+
+ public async Task TestWordToPdf()
+ {
+
+ var dd = await FileConvertHelper.ThirdStirling_PDFWordToPdfAsync(@"C:\Users\hang\Desktop\test.docx");
+
+ string outputFilePath = @"C:\Users\hang\Desktop\test-byte4-output.pdf"; // 保存路径
+ File.WriteAllBytes(outputFilePath, dd); // 将响应字节数组写入文件
+
+
+
+ //var envName = Environment.GetEnvironmentVariables()["ASPNETCORE_ENVIRONMENT"]?.ToString();
+
+ //// API 地址
+ //string apiUrl = "http://106.14.89.110:30088/api/v1/convert/file/pdf";
+
+ //// 模拟文件路径,假设你有一个内存流的文件,不指定实际文件
+ //string filePath = @"C:\Users\hang\Desktop\test.docx"; // 本地文件路径或者你可以直接使用流
+
+ //var fileBytes = File.ReadAllBytes(@"C:\Users\hang\Desktop\test.docx");
+
+
+ //try
+ //{
+ // // 创建 RestClient
+ // var client = new RestClient(apiUrl);
+
+ // // 创建 RestRequest,使用 POST 方法
+ // var request = new RestRequest(apiUrl, Method.Post);
+ // request.AddHeader("accept", "*/*");
+
+ // //new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
+
+ // // 直接上传文件,无需生成字节数组
+ // //request.AddFile("fileInput", filePath, contentType);
+
+ // // 添加文件流到请求
+ // request.AddFile("fileInput", fileBytes, "test-byte.docx");
+
+ // // 发送请求并获取响应
+ // var response = await client.ExecuteAsync(request);
+
+ // // 检查请求是否成功
+ // if (response.IsSuccessful)
+ // {
+ // // 保存接收到的文件到本地
+ // string outputFilePath = @"C:\Users\hang\Desktop\test-byte3-output.pdf"; // 保存路径
+ // File.WriteAllBytes(outputFilePath, response.RawBytes); // 将响应字节数组写入文件
+
+ // //如果要文件流,就这样
+ // //var stream = new MemoryStream(response.RawBytes);
+
+ // }
+ // else
+ // {
+ // Console.WriteLine($"上传失败,错误代码: {response.StatusCode}, 错误消息: {response.ErrorMessage}");
+ // }
+ //}
+ //catch (Exception ex)
+ //{
+ // Console.WriteLine("发生异常: " + ex.Message);
+ //}
+
+ return ResponseOutput.Ok();
+ }
}
diff --git a/IRaCIS.Core.Application/MassTransit/Recurring/RecurringEmailConsumer.cs b/IRaCIS.Core.Application/MassTransit/Recurring/RecurringEmailConsumer.cs
index 265cd453c..90c1b79c1 100644
--- a/IRaCIS.Core.Application/MassTransit/Recurring/RecurringEmailConsumer.cs
+++ b/IRaCIS.Core.Application/MassTransit/Recurring/RecurringEmailConsumer.cs
@@ -11,9 +11,9 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer;
-public class QCImageQuestionScheduleConsumer : IConsumer
+public class QCImageQuestionScheduleConsumer : IConsumer
{
- public Task Consume(ConsumeContext context)
+ public Task Consume(ConsumeContext context)
{
Console.WriteLine(DateTime.Now);
diff --git a/IRaCIS.Core.Application/MassTransit/Recurring/RecurringEvent.cs b/IRaCIS.Core.Application/MassTransit/Recurring/Schedule/RecurringEvent.cs
similarity index 100%
rename from IRaCIS.Core.Application/MassTransit/Recurring/RecurringEvent.cs
rename to IRaCIS.Core.Application/MassTransit/Recurring/Schedule/RecurringEvent.cs
diff --git a/IRaCIS.Core.Application/MassTransit/Recurring/RecurringSchedule.cs b/IRaCIS.Core.Application/MassTransit/Recurring/Schedule/RecurringSchedule.cs
similarity index 85%
rename from IRaCIS.Core.Application/MassTransit/Recurring/RecurringSchedule.cs
rename to IRaCIS.Core.Application/MassTransit/Recurring/Schedule/RecurringSchedule.cs
index cc7481c25..41cef4508 100644
--- a/IRaCIS.Core.Application/MassTransit/Recurring/RecurringSchedule.cs
+++ b/IRaCIS.Core.Application/MassTransit/Recurring/Schedule/RecurringSchedule.cs
@@ -32,7 +32,7 @@ public abstract class IRCRecurringSchedule :
///
/// QC 影像质疑待处理
///
-public class QCImageQuestionSchedule : IRCRecurringSchedule
+public class QCImageQuestionRecurringSchedule : IRCRecurringSchedule
{
}
@@ -40,7 +40,7 @@ public class QCImageQuestionSchedule : IRCRecurringSchedule
///
/// CRC 影像质疑
///
-public class CRCImageQuestionSchedule : IRCRecurringSchedule
+public class CRCImageQuestionRecurringSchedule : IRCRecurringSchedule
{
}
@@ -48,7 +48,7 @@ public class CRCImageQuestionSchedule : IRCRecurringSchedule
///
/// 影像质控
///
-public class ImageQCSchedule : IRCRecurringSchedule
+public class ImageQCRecurringSchedule : IRCRecurringSchedule
{
}
diff --git a/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj b/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj
index 85d943c69..509c67d57 100644
--- a/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj
+++ b/IRaCIS.Core.Domain/IRaCIS.Core.Domain.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj b/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj
index 684798ebc..dd8788146 100644
--- a/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj
+++ b/IRaCIS.Core.Infra.EFCore/IRaCIS.Core.Infra.EFCore.csproj
@@ -25,9 +25,9 @@
-
-
-
+
+
+