Compare commits

..

No commits in common. "Test_IRC_Net8" and "EICS-V2.0.0" have entirely different histories.

139 changed files with 779 additions and 226804 deletions

View File

@ -231,8 +231,8 @@ public class OSSService : IOSSService
//提供awsEndPoint域名进行访问配置
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
RegionEndpoint = RegionEndpoint.USEast1,
UseHttp = true,
};
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
@ -320,8 +320,8 @@ public class OSSService : IOSSService
//提供awsEndPoint域名进行访问配置
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
RegionEndpoint = RegionEndpoint.USEast1,
UseHttp = true,
};
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
@ -397,8 +397,8 @@ public class OSSService : IOSSService
//提供awsEndPoint域名进行访问配置
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
RegionEndpoint = RegionEndpoint.USEast1,
UseHttp = true,
};
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
@ -493,8 +493,8 @@ public class OSSService : IOSSService
//提供awsEndPoint域名进行访问配置
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
RegionEndpoint = RegionEndpoint.USEast1,
UseHttp = true,
};
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
@ -625,8 +625,8 @@ public class OSSService : IOSSService
//提供awsEndPoint域名进行访问配置
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
RegionEndpoint = RegionEndpoint.USEast1,
UseHttp = true,
};
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);

View File

@ -1,168 +0,0 @@
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Service;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.SCP.Service;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace IRaCIS.Core.SCP;
public class SyncFileRecoveryService(IServiceScopeFactory _scopeFactory, FileSyncQueue _fileSyncQueue) : BackgroundService
{
private readonly int _pageSize = 500;
/// <summary>
/// 多个程序如果恢复同一份数据造成重复同步SCP服务不恢复任务
/// </summary>
/// <param name="stoppingToken"></param>
/// <returns></returns>
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await Task.CompletedTask;
//using var scope = _scopeFactory.CreateScope();
//var fileUploadRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<FileUploadRecord>>();
//// 延迟启动,保证主机快速启动
//await Task.Delay(5000, stoppingToken);
//int page = 0;
//while (!stoppingToken.IsCancellationRequested)
//{
// // 分页获取未入队任务
// var pending = await fileUploadRecordRepository
// .Where(x => x.IsNeedSync == true && (x.IsSync == false || x.IsSync == null))
// .OrderByDescending(x => x.Priority)
// .Select(t => new { t.Id, t.Priority })
// .Skip(page * _pageSize)
// .Take(_pageSize)
// .ToListAsync(stoppingToken);
// if (!pending.Any())
// break; // 扫描完毕,退出循环
// foreach (var file in pending)
// {
// //file.IsQueued = true; // 避免重复入队
// _fileSyncQueue.Enqueue(file.Id, file.Priority ?? 0); // 放入队列
// }
// page++; // 下一页
// await Task.Delay(200, stoppingToken); // 缓解数据库压力
//}
}
}
public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSyncWorker> _logger, FileSyncQueue _fileSyncQueue) : BackgroundService
{
// ⭐ 自动根据服务器CPU
private readonly int _workerCount = Math.Max(1, Environment.ProcessorCount - 1);
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
for (int i = 0; i < _workerCount; i++)
Task.Run(() => WorkerLoop(stoppingToken));
return Task.CompletedTask;
}
private async Task WorkerLoop(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
var id = await _fileSyncQueue.DequeueAsync(stoppingToken);
try
{
using var scope = _scopeFactory.CreateScope();
var _fileUploadRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<FileUploadRecord>>();
var _uploadFileSyncRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<UploadFileSyncRecord>>();
var syncConfig = (scope.ServiceProvider.GetRequiredService<IOptionsMonitor<ObjectStoreServiceOptions>>()).CurrentValue;
var oss = scope.ServiceProvider.GetRequiredService<IOSSService>();
var file = await _fileUploadRecordRepository.FirstOrDefaultAsync(t => t.Id == id);
// ✅ 不要 return
if (file == null || file.IsNeedSync != true || syncConfig.IsOpenStoreSync == false)
{
continue;
}
if (syncConfig.SyncConfigList.Any(t => t.UploadRegion == file.UploadRegion && t.IsOpenSync == false))
{
continue;
}
//如果发现系统配置某一边同步进行了关闭,那么就直接返回,不执行任务
if (syncConfig.SyncConfigList.Any(t => t.UploadRegion == file.UploadRegion && t.IsOpenSync == false))
{
return;
}
var log = new UploadFileSyncRecord
{
FileUploadRecordId = id,
StartTime = DateTime.Now,
JobState = jobState.RUNNING
};
await _uploadFileSyncRecordRepository.AddAsync(log);
await _uploadFileSyncRecordRepository.SaveChangesAsync(stoppingToken);
try
{
await oss.SyncFileAsync(file.Path.TrimStart('/'), file.UploadRegion == "CN" ? ObjectStoreUse.AliyunOSS : ObjectStoreUse.AWS, file.UploadRegion == "CN" ? ObjectStoreUse.AWS : ObjectStoreUse.AliyunOSS);
file.IsSync = true;
file.SyncFinishedTime = DateTime.Now;
log.JobState = jobState.SUCCESS;
}
catch (Exception ex)
{
log.JobState = jobState.FAILED;
log.Msg = ex.Message[..300];
}
log.EndTime = DateTime.Now;
await _uploadFileSyncRecordRepository.SaveChangesAsync(stoppingToken);
}
catch (Exception ex)
{
_logger.LogError(ex, "Sync failed {Id}", id);
}
finally
{
// ⭐⭐⭐ 永远执行
_fileSyncQueue.Complete(id);
}
}
}
}

View File

@ -63,10 +63,6 @@ builder.Host
#region 配置服务
var _configuration = builder.Configuration;
builder.Services.AddSingleton<FileSyncQueue>();
builder.Services.AddHostedService<SyncFileRecoveryService>();
builder.Services.AddHostedService<FileSyncWorker>();
//健康检查
builder.Services.AddHealthChecks();

View File

@ -644,7 +644,7 @@ namespace IRaCIS.Core.SCP.Service
ms.Position = 0;
//irc 从路径最后一截取Guid
storeRelativePath = await ossService.UploadToOSSAsync(ms, ossFolderPath, instanceId.ToString(), false, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = _trialId, BatchDataType = BatchDataType.PACSReceive });
storeRelativePath = await ossService.UploadToOSSAsync(ms, ossFolderPath, instanceId.ToString(), false);
fileSize = ms.Length;
@ -674,7 +674,7 @@ namespace IRaCIS.Core.SCP.Service
// 上传缩略图到 OSS
var seriesPath = await ossService.UploadToOSSAsync(memoryStream, ossFolderPath, $"{seriesId.ToString()}_{instanceId.ToString()}.preview.jpg", false,uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = _trialId, BatchDataType = BatchDataType.PACSReceive });
var seriesPath = await ossService.UploadToOSSAsync(memoryStream, ossFolderPath, $"{seriesId.ToString()}_{instanceId.ToString()}.preview.jpg", false);
series.ImageResizePath = seriesPath;

View File

@ -69,8 +69,6 @@ public static class CacheKeys
public static string UserMFAVerifyPass(Guid userId, string browserFingerprint) => $"UserMFAVerifyPass:{userId}:{browserFingerprint}";
public static string TrialSiteInfo(Guid trialSiteId) => $"{trialSiteId}TrialSiteInfo";
public static string TrialDataStoreType(Guid trialId) => $"TrialDataStoreType:{trialId}";
}
public static class CacheHelper

View File

@ -1,317 +0,0 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2026-03-10 06:15:17Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using AutoMapper;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure.Extention;
using IRaCIS.Core.SCP;
using IRaCIS.Core.SCP.Service;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using System.Drawing;
using System.Threading.Channels;
using System.Threading.Tasks;
using ZiggyCreatures.Caching.Fusion;
namespace IRaCIS.Core.SCP.Service;
public class FileUploadRecordAddOrEdit
{
public Guid? Id { get; set; }
public string FileName { get; set; }
public long FileSize { get; set; }
public string FileType { get; set; }
public string Path { get; set; }
public string UploadBatchId { get; set; }
public BatchDataType BatchDataType { get; set; }
public string StudyCode { get; set; }
public Guid? TrialId { get; set; }
public Guid? SubjectId { get; set; }
public Guid? SubjectVisitId { get; set; }
public Guid? DicomStudyId { get; set; }
public Guid? NoneDicomStudyId { get; set; }
public string FileMarkId { get; set; }
public int? Priority { get; set; }
public string IP { get; set; }
public bool? IsNeedSync { get; set; }
public string UploadRegion { get; set; }
public string TargetRegion { get; set; }
}
public interface IFileUploadRecordService
{
Task<IResponseOutput> AddOrUpdateFileUploadRecord(FileUploadRecordAddOrEdit addOrEditFileUploadRecord);
}
[ApiExplorerSettings(GroupName = "Common")]
public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRecordRepository,
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IOptionsMonitor<ObjectStoreServiceOptions> options,
IFusionCache _fusionCache, IRepository<Trial> _trialRepository, FileSyncQueue _fileSyncQueue) : BaseService, IFileUploadRecordService
{
ObjectStoreServiceOptions ObjectStoreServiceConfig = options.CurrentValue;
public async Task<IResponseOutput> AddOrUpdateFileUploadRecord(FileUploadRecordAddOrEdit addOrEditFileUploadRecord)
{
addOrEditFileUploadRecord.IP = _userInfo.IP;
if (ObjectStoreServiceConfig.IsOpenStoreSync && _userInfo.Domain.IsNotNullOrEmpty())
{
var find = ObjectStoreServiceConfig.SyncConfigList.FirstOrDefault(t => t.Domain == _userInfo.Domain);
if (find != null)
{
addOrEditFileUploadRecord.UploadRegion = find.UploadRegion;
addOrEditFileUploadRecord.TargetRegion = find.TargetRegion;
}
else
{
//前后端调试的时候,上传的时候域名不对应,自动按照后端配置设置上传区域和同步区域
var apiDefalut = ObjectStoreServiceConfig.SyncConfigList.FirstOrDefault(t => t.UploadRegion == ObjectStoreServiceConfig.ApiDeployRegion);
if (apiDefalut != null)
{
addOrEditFileUploadRecord.UploadRegion = apiDefalut.UploadRegion;
addOrEditFileUploadRecord.TargetRegion = apiDefalut.TargetRegion;
}
}
}
if (addOrEditFileUploadRecord.TrialId != null)
{
var trialDataStore = await _fusionCache.GetOrSetAsync(CacheKeys.TrialDataStoreType(addOrEditFileUploadRecord.TrialId.Value), async _ =>
{
return await _trialRepository.Where(t => t.Id == addOrEditFileUploadRecord.TrialId).Select(t => t.TrialDataStoreType)
.FirstOrDefaultAsync();
},
TimeSpan.FromDays(7)
);
//项目配置了,那么就设置需要同步
if (trialDataStore == TrialDataStore.MUtiCenter)
{
addOrEditFileUploadRecord.IsNeedSync = true;
addOrEditFileUploadRecord.Priority = 0;
}
else
{
addOrEditFileUploadRecord.IsNeedSync = false;
//addOrEditFileUploadRecord.TargetRegion = "";
}
}
else
{
//系统文件,默认同步
addOrEditFileUploadRecord.IsNeedSync = true;
addOrEditFileUploadRecord.Priority = 0;
}
var entity = await _fileUploadRecordRepository.InsertOrUpdateAsync(addOrEditFileUploadRecord, true);
if (addOrEditFileUploadRecord.IsNeedSync == true)
{
_fileSyncQueue.Enqueue(entity.Id, addOrEditFileUploadRecord.Priority ?? 0);
}
return ResponseOutput.Ok(entity.Id.ToString());
}
}
public sealed class FileSyncQueue
{
/// <summary>
/// 优先级队列(仅负责排序)
/// </summary>
private readonly PriorityQueue<Guid, int> _queue = new();
/// <summary>
/// 当前等待中的任务(唯一真实数据)
/// key = Guid
/// value = 最新 priority
/// </summary>
private readonly Dictionary<Guid, int> _waiting = new();
/// <summary>
/// 正在执行的任务(防止重复执行)
/// </summary>
private readonly HashSet<Guid> _running = new();
/// <summary>
/// worker 等待信号
/// </summary>
private readonly SemaphoreSlim _signal = new(0);
private readonly object _lock = new();
// ============================================================
// Enqueue
// ============================================================
/// <summary>
/// 入队(同 Guid 会覆盖优先级)
/// </summary>
public void Enqueue(Guid id, int priority)
{
bool needSignal = false;
lock (_lock)
{
// 如果正在执行,忽略(防止重复)
if (_running.Contains(id))
return;
// 是否新任务(用于减少 signal 风暴)
if (!_waiting.ContainsKey(id))
needSignal = true;
// 更新为最新优先级(最后一次为准)
_waiting[id] = priority; //等价于添加或者更新
// PriorityQueue 无法更新节点
// 允许旧节点存在Dequeue 时过滤
_queue.Enqueue(id, -priority);
}
// 只有新增任务才唤醒 worker
if (needSignal)
_signal.Release();
}
// ============================================================
// Dequeue
// ============================================================
/// <summary>
/// 获取一个待执行任务(无任务时自动等待)
/// </summary>
public async Task<Guid> DequeueAsync(CancellationToken ct)
{
while (true)
{
await _signal.WaitAsync(ct);
lock (_lock)
{
while (_queue.Count > 0)
{
var id = _queue.Dequeue();
// 已被覆盖或取消
if (!_waiting.TryGetValue(id, out _))
continue;
// 标记为运行中
_waiting.Remove(id);
_running.Add(id);
return id;
}
}
}
}
// ============================================================
// Complete
// ============================================================
/// <summary>
/// 任务执行完成(必须调用)
/// </summary>
public void Complete(Guid id)
{
lock (_lock)
{
_running.Remove(id);
}
}
// ============================================================
// Snapshot
// ============================================================
/// <summary>
/// 当前等待中的任务快照
/// </summary>
public Guid[] Snapshot()
{
lock (_lock)
{
return _waiting.Keys.ToArray();
}
}
// ============================================================
// 状态信息(调试用)
// ============================================================
public int WaitingCount
{
get
{
lock (_lock)
return _waiting.Count;
}
}
public int RunningCount
{
get
{
lock (_lock)
return _running.Count;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS",
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
"EndPoint": "https://oss-cn-shanghai.aliyuncs.com",
"AccessKeyId": "LTAI5tFUCCmz5TwghZHsj45Y",
"AccessKeySecret": "8evrBy1fVfzJG25i67Jm0xqn9Xcw2T",
"RoleArn": "acs:ram::1078130221702011:role/uat-oss-access",
"BucketName": "tl-med-irc-event-store",
"ViewEndpoint": "https://tl-med-irc-event-store.oss-cn-shanghai.aliyuncs.com",
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
}
},
"ConnectionStrings": {
"RemoteNew": "Server=101.132.253.119,1435;Database=irc_Prpd_bak;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
"Hangfire": "Server=101.132.253.119,1435;Database=irc_Hangfire_bak;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
},
"DicomSCPServiceConfig": {
"CalledAEList": [
"STORESCP"
],
"ServerPort": 11112
}
}

View File

@ -25,7 +25,6 @@ using Microsoft.Extensions.Options;
using Org.BouncyCastle.Tls;
using RestSharp;
using RestSharp.Authenticators;
using Serilog;
using System;
using System.Collections.Generic;
using System.Globalization;
@ -138,14 +137,9 @@ namespace IRaCIS.Api.Controllers
public async Task<IResponseOutput> GetObjectStoreTokenAsync([FromServices] IOptionsMonitor<ObjectStoreServiceOptions> options, [FromServices] IOSSService _oSSService)
{
var domain = HttpContext.Request.Host.Host;
var result = _oSSService.GetObjectStoreTempToken();
var result = _oSSService.GetObjectStoreTempToken(domain);
Log.Logger.Information($"使用域名:{domain}请求token.返回{result.ToJsonStr()}");
//result.AWS = await GetAWSTemToken(options.CurrentValue);
return ResponseOutput.Ok(result);

View File

@ -155,19 +155,10 @@ namespace IRaCIS.Core.API.Controllers
[TrialGlobalLimit("AfterStopCannNotOpt")]
[UnitOfWork]
public async Task<IResponseOutput> FinishMedicalReview(DataInspectionDto<CloseAndFinishMedicalReview> opt)
public async Task<IResponseOutput> FinishMedicalReview(DataInspectionDto<FinishMedicalReviewInDto> opt)
{
var singid = await _inspectionService.RecordSing(opt.SignInfo);
await _readingMedicalReviewService.ClosedMedicalReviewDialog(new ClosedMedicalReviewDialogInDto() {
DialogCloseReason=opt.Data.DialogCloseReason,
IsClosedDialog=opt.Data.IsClosedDialog,
MedicalDialogCloseEnum=opt.Data.MedicalDialogCloseEnum,
TaskMedicalReviewId=opt.Data.TaskMedicalReviewId
});
var result = await _readingMedicalReviewService.FinishMedicalReview(new FinishMedicalReviewInDto() {
TaskMedicalReviewId=opt.Data.TaskMedicalReviewId
});
var result = await _readingMedicalReviewService.FinishMedicalReview(opt.Data);
await _inspectionService.CompletedSign(singid, result);
return result;
}

View File

@ -9,7 +9,6 @@ using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.MassTransit.Command;
using IRaCIS.Core.Application.Service;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore;
@ -599,7 +598,7 @@ namespace IRaCIS.Core.API.Controllers
templateFileStream.Seek(0, SeekOrigin.Begin);
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId.ToString()}/InspectionUpload/DataReconciliation", realFileName, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = trialId, BatchDataType = BatchDataType.DataReconciliation });
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId.ToString()}/InspectionUpload/DataReconciliation", realFileName);
var addEntity = await _inspectionFileRepository.AddAsync(new InspectionFile() { FileName = realFileName, RelativePath = ossRelativePath, TrialId = trialId }, true);
@ -857,7 +856,7 @@ namespace IRaCIS.Core.API.Controllers
throw new BusinessValidationFailedException(_localizer["UploadDownLoad_TemplateUploadData"]);
}
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId.ToString()}/InspectionUpload/SiteSurvey", realFileName, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = trialId ,BatchDataType=BatchDataType.SiteUserSurvey});
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId.ToString()}/InspectionUpload/SiteSurvey", realFileName);
await _inspectionFileRepository.AddAsync(new InspectionFile() { FileName = realFileName, RelativePath = ossRelativePath, TrialId = trialId }, true);
@ -1009,7 +1008,7 @@ namespace IRaCIS.Core.API.Controllers
Other = 6,
}
/// <summary>

View File

@ -1,161 +0,0 @@
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Service;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Infra.EFCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace IRaCIS.Core.API.HostService;
public class SyncFileRecoveryService(IServiceScopeFactory _scopeFactory, FileSyncQueue _fileSyncQueue) : BackgroundService
{
private readonly int _pageSize = 500;
/// <summary>
/// 多个程序如果恢复同一份数据造成重复同步SCP服务不恢复任务
/// </summary>
/// <param name="stoppingToken"></param>
/// <returns></returns>
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
using var scope = _scopeFactory.CreateScope();
var fileUploadRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<FileUploadRecord>>();
// 延迟启动,保证主机快速启动
await Task.Delay(5000, stoppingToken);
int page = 0;
while (!stoppingToken.IsCancellationRequested)
{
// 分页获取未入队任务
var pending = await fileUploadRecordRepository
.Where(x => x.IsNeedSync == true && (x.IsSync == false || x.IsSync == null))
.OrderByDescending(x => x.Priority)
.Select(t => new { t.Id, t.Priority })
.Skip(page * _pageSize)
.Take(_pageSize)
.ToListAsync(stoppingToken);
if (!pending.Any())
break; // 扫描完毕,退出循环
foreach (var file in pending)
{
//file.IsQueued = true; // 避免重复入队
_fileSyncQueue.Enqueue(file.Id, file.Priority ?? 0); // 放入队列
}
page++; // 下一页
await Task.Delay(200, stoppingToken); // 缓解数据库压力
}
}
}
public class FileSyncWorker(IServiceScopeFactory _scopeFactory, ILogger<FileSyncWorker> _logger, FileSyncQueue _fileSyncQueue) : BackgroundService
{
// ⭐ 自动根据服务器CPU
private readonly int _workerCount = Math.Max(1, Environment.ProcessorCount - 1);
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
for (int i = 0; i < _workerCount; i++)
Task.Run(() => WorkerLoop(stoppingToken));
return Task.CompletedTask;
}
private async Task WorkerLoop(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
var id = await _fileSyncQueue.DequeueAsync(stoppingToken);
try
{
using var scope = _scopeFactory.CreateScope();
var _fileUploadRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<FileUploadRecord>>();
var _uploadFileSyncRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<UploadFileSyncRecord>>();
var syncConfig = (scope.ServiceProvider.GetRequiredService<IOptionsMonitor<ObjectStoreServiceOptions>>()).CurrentValue;
var oss = scope.ServiceProvider.GetRequiredService<IOSSService>();
var file = await _fileUploadRecordRepository.FirstOrDefaultAsync(t => t.Id == id);
// ✅ 不要 return
if (file == null || file.IsNeedSync != true || syncConfig.IsOpenStoreSync == false)
{
continue;
}
if (syncConfig.SyncConfigList.Any(t => t.UploadRegion == file.UploadRegion && t.IsOpenSync == false))
{
continue;
}
//如果发现系统配置某一边同步进行了关闭,那么就直接返回,不执行任务
if (syncConfig.SyncConfigList.Any(t => t.UploadRegion == file.UploadRegion && t.IsOpenSync == false))
{
return;
}
var log = new UploadFileSyncRecord
{
FileUploadRecordId = id,
StartTime = DateTime.Now,
JobState = jobState.RUNNING
};
await _uploadFileSyncRecordRepository.AddAsync(log);
await _uploadFileSyncRecordRepository.SaveChangesAsync(stoppingToken);
try
{
await oss.SyncFileAsync(file.Path.TrimStart('/'), file.UploadRegion == "CN" ? ObjectStoreUse.AliyunOSS : ObjectStoreUse.AWS, file.UploadRegion == "CN" ? ObjectStoreUse.AWS : ObjectStoreUse.AliyunOSS);
file.IsSync = true;
file.SyncFinishedTime = DateTime.Now;
log.JobState = jobState.SUCCESS;
}
catch (Exception ex)
{
log.JobState = jobState.FAILED;
log.Msg = ex.Message[..300];
}
log.EndTime = DateTime.Now;
await _uploadFileSyncRecordRepository.SaveChangesAsync(stoppingToken);
}
catch (Exception ex)
{
_logger.LogError(ex, "Sync failed {Id}", id);
}
finally
{
// ⭐⭐⭐ 永远执行
_fileSyncQueue.Complete(id);
}
}
}
}

View File

@ -136,7 +136,7 @@
<param name="opt"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.InspectionController.FinishMedicalReview(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionDto{IRaCIS.Core.Application.Service.Reading.Dto.CloseAndFinishMedicalReview})">
<member name="M:IRaCIS.Core.API.Controllers.InspectionController.FinishMedicalReview(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionDto{IRaCIS.Core.Application.Service.Reading.Dto.FinishMedicalReviewInDto})">
<summary>
医学审核完成
</summary>

View File

@ -14,7 +14,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@ -89,10 +88,6 @@ builder.Services.ConfigureServices(_configuration);
builder.Services.AddHostedService<HangfireHostService>();
builder.Services.AddSingleton<FileSyncQueue>();
builder.Services.AddHostedService<SyncFileRecoveryService>();
builder.Services.AddHostedService<FileSyncWorker>();
//minimal api 异常处理
builder.Services.AddExceptionHandler<GlobalExceptionHandler>();
//builder.Services.AddProblemDetails();

View File

@ -40,12 +40,12 @@ namespace IRaCIS.Core.API
var dbType = configuration.GetSection("ConnectionStrings:Db_Type").Value;
if (!string.IsNullOrWhiteSpace(dbType) && dbType == "pgsql")
{
options.UseNpgsql(configuration.GetSection("ConnectionStrings:RemoteNew").Value, contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure().CommandTimeout(90));
options.UseNpgsql(configuration.GetSection("ConnectionStrings:RemoteNew").Value, contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure());
}
else
{
options.UseSqlServer(configuration.GetSection("ConnectionStrings:RemoteNew").Value, contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure().CommandTimeout(90));
options.UseSqlServer(configuration.GetSection("ConnectionStrings:RemoteNew").Value, contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure()/*.CommandTimeout(60)*/);
}

View File

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
@ -116,9 +116,6 @@ public static class SwaggerSetup
//DocExpansion设置为none可折叠所有方法
options.DocExpansion(DocExpansion.None);
// 开启Swagger UI的搜索/过滤功能
options.EnableFilter();
//DefaultModelsExpandDepth设置为 - 1 可不显示models
options.DefaultModelsExpandDepth(-1);
});

View File

@ -10,16 +10,8 @@
"RemoteNew": "Server=101.132.253.119,1435;Database=irc_Prpd_bak;User ID=sa;Password=xc@123456;TrustServerCertificate=true",
"Hangfire": "Server=101.132.253.119,1435;Database=irc_Hangfire_bak;User ID=sa;Password=xc@123456;TrustServerCertificate=true"
},
"WeComNoticeConfig": {
"IsOpenWeComNotice": true,
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
"APINoticeUserList": [ "u", "wait..." ],
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621b97b96f74e6f3d" ]
},
"ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS",
"AliyunOSS": {
"RegionId": "cn-shanghai",
"InternalEndpoint": "https://oss-cn-shanghai-internal.aliyuncs.com",
@ -32,30 +24,13 @@
"Region": "oss-cn-shanghai",
"DurationSeconds": 7200
},
"MinIO": {
"endPoint": "hir-oss.uat.extimaging.com",
"port": "80",
"endpoint": "http://192.168.3.68",
"port": "8001",
"useSSL": false,
"viewEndpoint": "http://hir-oss.uat.extimaging.com/irc-uat",
//"port": "443",
//"useSSL": true,
//"viewEndpoint": "https://hir-oss.uat.extimaging.com/irc-uat",
"accessKey": "b9Ul0e98xPzt6PwRXA1Q",
"secretKey": "DzMaU2L4OXl90uytwOmDXF2encN0Jf4Nxu2XkYqQ",
"bucketName": "irc-uat"
},
"AWS": {
"Region": "us-east-1",
"EndPoint": "s3.us-east-1.amazonaws.com",
"UseSSL": true,
"RoleArn": "arn:aws:iam::471112624751:role/sts_s3_upload",
"AccessKeyId": "AKIAW3MEAFJXWRCGSX5Z",
"SecretAccessKey": "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",
"BucketName": "ei-med-s3-lili-uat-store",
"ViewEndpoint": "https://ei-med-s3-lili-uat-store.s3.amazonaws.com/",
"DurationSeconds": 7200
"accessKey": "IDFkwEpWej0b4DtiuThL",
"secretKey": "Lhuu83yMhVwu7c1SnjvGY6lq74jzpYqifK6Qtj4h",
"bucketName": "test"
}
},
@ -63,26 +38,27 @@
//
"QCRiskControl": true,
"OpenUserComplexPassword": true,
"OpenSignDocumentBeforeWork": true,
"OpenLoginLimit": true,
"LoginMaxFailCount": 5,
"LoginFailLockMinutes": 30,
"AutoLoginOutMinutes": 120,
"OpenLoginMFA": false,
"AutoLoginOutMinutes": 60,
"ContinuousReadingTimeMin": 120,
"ReadingRestTimeMin": 10,
"IsNeedChangePassWord": true,
"ChangePassWordDays": 90,
// 1 Elevate 2 Extensive
"TemplateType": 2,
//MFA
"UserMFAVerifyMinutes": 1440
"UserMFAVerifyMinutes": 1440
},
"SystemEmailSendConfig": {
"Port": 465,
@ -90,29 +66,14 @@
"Imap": "imap.qiye.aliyun.com",
"ImapPort": 993,
"FromEmail": "uat@extimaging.com",
"FromName": "Uat IRC Imaging System",
"FromName": "UAT_IRC",
"AuthorizationCode": "SHzyyl2021",
"SiteUrl": "http://irc.uat.extimaging.com/login",
"PlatformName": "EICS",
"PlatformNameCN": "展影云平台",
"SystemShortName": "IRC",
"OrganizationName": "ExtImaging",
"OrganizationNameCN": "ExtImaging",
"SiteUrl": "http://irc.event.extimaging.com/login",
"CompanyName": "Extensive Imaging",
"CompanyNameCN": "上海展影医疗科技有限公司",
"CompanyShortName": "Extensive Imaging",
"CompanyShortNameCN": "展影医疗",
"IsEnv_US": false,
"IsOpenErrorNoticeEmail": false,
"EmailRegexStr": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
"CronEmailDefaultCulture": "zh-CN",
"ErrorNoticeEmailList": [ "872297557@qq.com" ]
},
"SystemPacsConfig": {
"Port": "11116",
"IP": "101.132.253.119"
"IsEnv_US": false
},
"RequestDuplicationOptions": {
"IsEnabled": true,

View File

@ -16,7 +16,7 @@
"IsOpenWeComNotice": true,
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
"APINoticeUserList": [ "u", "wait..." ],
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621b97b96f74e6f3d" ]
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
},
"ObjectStoreService": {
"ObjectStoreUse": "AliyunOSS",

View File

@ -22,32 +22,12 @@
"IsOpenWeComNotice": true,
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
"APINoticeUserList": [ "u", "wait..." ],
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621b97b96f74e6f3d" ]
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
},
//
"ObjectStoreService": {
// 使
"ObjectStoreUse": "AliyunOSS",
"IsOpenStoreSync": true,
"ApiDeployRegion": "CN",
"SyncConfigList": [
{
"Domain": "irc.test.extimaging.com",
"Primary": "AliyunOSS",
"Target": "AWS",
"UploadRegion": "CN",
"TargetRegion": "US",
"IsOpenSync": true
},
{
"Domain": "lili.test.extimaging.com",
"Primary": "AWS",
"Target": "AliyunOSS",
"UploadRegion": "US",
"TargetRegion": "CN",
"IsOpenSync": true
}
],
//
"AliyunOSS": {
// OSS Region ID

View File

@ -16,7 +16,7 @@
"IsOpenWeComNotice": true,
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
"APINoticeUserList": [ "u", "wait..." ],
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621b97b96f74e6f3d" ]
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
},
"ObjectStoreService": {
"ObjectStoreUse": "AWS",

View File

@ -17,7 +17,7 @@
"IsOpenWeComNotice": true,
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
"APINoticeUserList": [ "u", "wait..." ],
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621b97b96f74e6f3d" ]
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
},
"ObjectStoreService": {

View File

@ -14,7 +14,7 @@
"IsOpenWeComNotice": true,
"WebhookUrl": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4355b98e-1e72-4678-8dfb-2fc6ad0bf449", //4355b98e-1e72-4678-8dfb-2fc6ad0bf449 //cdd97aab-d256-4f07-9145-a0a2b1555322
"APINoticeUserList": [ "u", "wait..." ],
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621b97b96f74e6f3d" ]
"VueNoticeUserList": [ "wangxiaoshuang", "6b7717a31647293621697b96f74e6f3d" ]
},
"ObjectStoreService": {

View File

@ -1,4 +1,4 @@
<!-- HTML for static distribution bundle build -->
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
@ -112,23 +112,8 @@
}, info: function () {
return null;
}
},
fn: {
opsFilter: function (taggedOps, phrase) {
var normalPhrase = phrase.toLowerCase();
return taggedOps.map(function (tagObj, tag) {
var operations = tagObj.get("operations").filter(function (op) {
var summary = op.getIn(["operation", "summary"]) || "";
var path = op.get("path") || "";
var tagMatch = tag.toLowerCase().indexOf(normalPhrase) !== -1;
return tagMatch || summary.toLowerCase().indexOf(normalPhrase) !== -1 || path.toLowerCase().indexOf(normalPhrase) !== -1;
});
return tagObj.set("operations", operations);
}).filter(function (tagObj) {
return tagObj.get("operations").size > 0;
});
}
}
}
}
];

View File

@ -29,11 +29,11 @@ public class TrialGlobalLimitActionFilter(IFusionCache _fusionCache, IUserInfo _
var requestHost = context.HttpContext.Request.Host;
// 检查请求是否来自 localhost:6100
if (requestHost.Host == "localhost" && (requestHost.Port == 6100 || requestHost.Port == 3305))
{
await next();
return;
}
//if (requestHost.Host == "localhost" && (requestHost.Port == 6100 || requestHost.Port == 3305))
//{
// await next();
// return;
//}
#region 特殊用户类型拦截
// 用户类型检查

View File

@ -1,6 +1,4 @@
using DocumentFormat.OpenXml.Spreadsheet;
namespace IRaCIS.Core.Application.Helper;
namespace IRaCIS.Core.Application.Helper;
public static class CacheKeys
@ -68,9 +66,6 @@ public static class CacheKeys
public static string UserMFATag(Guid userId) => $"UserMFAVerifyPass:{userId}";
public static string TrialDataStoreType(Guid trialId) => $"TrialDataStoreType:{trialId}";
}
public static class CacheHelper
@ -82,9 +77,6 @@ public static class CacheHelper
return statusStr;
}
public static async Task<List<SystemAnonymization>> GetSystemAnonymizationListAsync(IRepository<SystemAnonymization> _systemAnonymizationRepository)
{
var list = await _systemAnonymizationRepository.Where(t => t.IsEnable).ToListAsync();

View File

@ -1,8 +1,6 @@
using DocumentFormat.OpenXml.Office.CustomUI;
using FellowOakDicom;
using FellowOakDicom.Media;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using System;
using System.Collections.Generic;
using System.Data;
@ -60,11 +58,7 @@ namespace IRaCIS.Core.Application.Helper
var mappings = new List<string>();
int index = 1;
var trialId = Guid.Empty;
Guid.TryParse(ossFolder.Split('/', StringSplitOptions.RemoveEmptyEntries)[0], out trialId);
var studyUid = list.FirstOrDefault()?.StudyInstanceUid;
var studyUid=list.FirstOrDefault()?.StudyInstanceUid;
var dicomDir = new DicomDirectory();
@ -136,9 +130,9 @@ namespace IRaCIS.Core.Application.Helper
// 重置流位置
memoryStream.Position = 0;
var relativePath = await _oSSService.UploadToOSSAsync(memoryStream, ossFolder, "DICOMDIR", true, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = trialId, BatchDataType = BatchDataType.DICOMDIR });
var relativePath= await _oSSService.UploadToOSSAsync(memoryStream, ossFolder, "DICOMDIR", true);
dic.Add($"{studyUid}_DICOMDIR", relativePath.Split('/').Last());
dic.Add($"{studyUid}_DICOMDIR" , relativePath.Split('/').Last());
}
//清理临时文件
@ -152,7 +146,7 @@ namespace IRaCIS.Core.Application.Helper
var mappingText = string.Join(Environment.NewLine, mappings);
await using var mappingStream = new MemoryStream(Encoding.UTF8.GetBytes(mappingText));
await _oSSService.UploadToOSSAsync(mappingStream, ossFolder, $"Download_{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}", false, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = trialId, BatchDataType = BatchDataType.DICOMDIR });
await _oSSService.UploadToOSSAsync(mappingStream, ossFolder, $"Download_{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}", false);
#endregion
}

View File

@ -7,10 +7,6 @@ using Amazon.S3;
using Amazon.S3.Model;
using Amazon.SecurityToken;
using Amazon.SecurityToken.Model;
using DocumentFormat.OpenXml.Bibliography;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.NewtonsoftJson;
using MassTransit;
@ -20,8 +16,6 @@ using Minio;
using Minio.DataModel;
using Minio.DataModel.Args;
using Minio.Exceptions;
using Serilog.Parsing;
using SkiaSharp;
using System.IO;
using System.Reactive.Linq;
using System.Runtime.InteropServices;
@ -86,28 +80,6 @@ public class ObjectStoreServiceOptions
public AWSOptions AWS { get; set; }
public bool IsOpenStoreSync { get; set; }
public string ApiDeployRegion { get; set; }
public List<SyncStoreConfig> SyncConfigList { get; set; } = new List<SyncStoreConfig>();
}
public class SyncStoreConfig
{
public string Domain { get; set; }
public string UploadRegion { get; set; }
public string TargetRegion { get; set; }
public string Primary { get; set; }
public string Target { get; set; }
public bool IsOpenSync { get; set; }
}
public class ObjectStoreDTO
@ -121,10 +93,6 @@ public class ObjectStoreDTO
public AWSTempToken AWS { get; set; }
public bool IsOpenStoreSync { get; set; }
public List<SyncStoreConfig> SyncConfigList { get; set; }
}
[LowerCamelCaseJson]
@ -169,7 +137,6 @@ public enum ObjectStoreUse
AWS = 2,
}
#endregion
// aws 参考链接 https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv3/S3/S3_Basics
@ -180,8 +147,8 @@ public interface IOSSService
public Task RestoreFilesByPrefixAsync(string prefix, int restoreDays = 3, int batchSize = 100);
public Task<string> UploadToOSSAsync(Stream fileStream, string oosFolderPath, string fileRealName, bool isFileNameAddGuid = true, FileUploadRecordAddOrEdit? uploadInfo = null);
public Task<string> UploadToOSSAsync(string localFilePath, string oosFolderPath, bool isFileNameAddGuid = true, bool randomFileName = false, FileUploadRecordAddOrEdit? uploadInfo = null);
public Task<string> UploadToOSSAsync(Stream fileStream, string oosFolderPath, string fileRealName, bool isFileNameAddGuid = true);
public Task<string> UploadToOSSAsync(string localFilePath, string oosFolderPath, bool isFileNameAddGuid = true, bool randomFileName = false);
public Task DownLoadFromOSSAsync(string ossRelativePath, string localFilePath);
@ -197,27 +164,28 @@ public interface IOSSService
List<string> GetRootFolderNames();
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null, string? objectUse = null);
public ObjectStoreDTO GetObjectStoreTempToken();
public Task MoveObject(string sourcePath, string destPath, bool overwrite = true);
public Task<long> GetObjectSizeAsync(string sourcePath);
public Task SyncFileAsync(string objectKey, ObjectStoreUse source, ObjectStoreUse destination, CancellationToken ct = default);
}
public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
IFileUploadRecordService _fileUploadRecordService) : IOSSService
public class OSSService : IOSSService
{
public ObjectStoreServiceOptions ObjectStoreServiceOptions { get; set; } = options.CurrentValue;
public ObjectStoreServiceOptions ObjectStoreServiceOptions { get; set; }
private AliyunOSSTempToken AliyunOSSTempToken { get; set; }
private AWSTempToken AWSTempToken { get; set; }
public OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options)
{
ObjectStoreServiceOptions = options.CurrentValue;
}
/// <summary>
/// 将指定前缀下的所有现有文件立即转为目标存储类型
@ -538,8 +506,8 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region),
UseHttp = true,
};
using var client = new AmazonS3Client(credentials, clientConfig);
@ -718,8 +686,8 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
//提供awsEndPoint域名进行访问配置
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
RegionEndpoint = RegionEndpoint.USEast1,
UseHttp = true,
};
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
@ -732,9 +700,6 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
}
}
/// <summary>
/// oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder
/// </summary>
@ -742,9 +707,8 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
/// <param name="oosFolderPath"></param>
/// <param name="fileRealName"></param>
/// <param name="isFileNameAddGuid"></param>
/// <param name="uploadInfo"> 只用赋值业务参数Id 和批次信息即可,其他信息不用传递</param>
/// <returns></returns>
public async Task<string> UploadToOSSAsync(Stream fileStream, string oosFolderPath, string fileRealName, bool isFileNameAddGuid = true, FileUploadRecordAddOrEdit? uploadInfo = null)
public async Task<string> UploadToOSSAsync(Stream fileStream, string oosFolderPath, string fileRealName, bool isFileNameAddGuid = true)
{
BackBatchGetToken();
@ -752,68 +716,74 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
try
{
if (fileStream.CanSeek)
using (var memoryStream = new MemoryStream())
{
fileStream.Seek(0, SeekOrigin.Begin);
fileStream.CopyTo(memoryStream);
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
{
var aliConfig = ObjectStoreServiceOptions.AliyunOSS;
var _ossClient = new OssClient(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? aliConfig.EndPoint : aliConfig.InternalEndpoint, AliyunOSSTempToken.AccessKeyId, AliyunOSSTempToken.AccessKeySecret, AliyunOSSTempToken.SecurityToken);
memoryStream.Seek(0, SeekOrigin.Begin);
// 上传文件
var result = _ossClient.PutObject(aliConfig.BucketName, ossRelativePath, fileStream);
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{
var minIOConfig = ObjectStoreServiceOptions.MinIO;
var minioClient = new MinioClient().WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}")
.WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey).WithSSL(minIOConfig.UseSSL)
.Build();
var putObjectArgs = new PutObjectArgs()
.WithBucket(minIOConfig.BucketName)
.WithObject(ossRelativePath)
.WithStreamData(fileStream)
.WithObjectSize(fileStream.Length);
await minioClient.PutObjectAsync(putObjectArgs);
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
{
var awsConfig = ObjectStoreServiceOptions.AWS;
var credentials = new SessionAWSCredentials(AWSTempToken.AccessKeyId, AWSTempToken.SecretAccessKey, AWSTempToken.SessionToken);
//提供awsEndPoint域名进行访问配置
var clientConfig = new AmazonS3Config
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
};
var aliConfig = ObjectStoreServiceOptions.AliyunOSS;
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
var _ossClient = new OssClient(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? aliConfig.EndPoint : aliConfig.InternalEndpoint, AliyunOSSTempToken.AccessKeyId, AliyunOSSTempToken.AccessKeySecret, AliyunOSSTempToken.SecurityToken);
var putObjectRequest = new Amazon.S3.Model.PutObjectRequest()
// 上传文件
var result = _ossClient.PutObject(aliConfig.BucketName, ossRelativePath, memoryStream);
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{
BucketName = awsConfig.BucketName,
InputStream = fileStream,
Key = ossRelativePath,
};
var minIOConfig = ObjectStoreServiceOptions.MinIO;
await amazonS3Client.PutObjectAsync(putObjectRequest);
}
else
{
throw new BusinessValidationFailedException("未定义的存储介质类型");
var minioClient = new MinioClient().WithEndpoint($"{minIOConfig.EndPoint}:{minIOConfig.Port}")
.WithCredentials(minIOConfig.AccessKeyId, minIOConfig.SecretAccessKey).WithSSL(minIOConfig.UseSSL)
.Build();
var putObjectArgs = new PutObjectArgs()
.WithBucket(minIOConfig.BucketName)
.WithObject(ossRelativePath)
.WithStreamData(memoryStream)
.WithObjectSize(memoryStream.Length);
await minioClient.PutObjectAsync(putObjectArgs);
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
{
var awsConfig = ObjectStoreServiceOptions.AWS;
var credentials = new SessionAWSCredentials(AWSTempToken.AccessKeyId, AWSTempToken.SecretAccessKey, AWSTempToken.SessionToken);
//提供awsEndPoint域名进行访问配置
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
};
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
var putObjectRequest = new Amazon.S3.Model.PutObjectRequest()
{
BucketName = awsConfig.BucketName,
InputStream = memoryStream,
Key = ossRelativePath,
};
await amazonS3Client.PutObjectAsync(putObjectRequest);
}
else
{
throw new BusinessValidationFailedException("未定义的存储介质类型");
}
}
}
catch (Exception ex)
@ -823,27 +793,13 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
}
var returnPath = "/" + ossRelativePath;
if (ObjectStoreServiceOptions.IsOpenStoreSync && uploadInfo != null)
{
uploadInfo.FileSize = fileStream.CanSeek ? fileStream.Length : 0;
uploadInfo.Path = returnPath;
uploadInfo.FileName = fileRealName;
uploadInfo.FileType = Path.GetExtension(returnPath);
await _fileUploadRecordService.AddOrUpdateFileUploadRecord(uploadInfo);
}
return returnPath;
return "/" + ossRelativePath;
}
//后端批量上传 或者下载不每个文件获取临时token
private void BackBatchGetToken()
{
@ -885,12 +841,10 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
/// <param name="randomFileName">随机文件名</param>
/// <returns></returns>
/// <exception cref="BusinessValidationFailedException"></exception>
public async Task<string> UploadToOSSAsync(string localFilePath, string oosFolderPath, bool isFileNameAddGuid = true, bool randomFileName = false, FileUploadRecordAddOrEdit? uploadInfo = null)
public async Task<string> UploadToOSSAsync(string localFilePath, string oosFolderPath, bool isFileNameAddGuid = true, bool randomFileName = false)
{
BackBatchGetToken();
long fileSize = 0;
var localFileName = Path.GetFileName(localFilePath);
var ossRelativePath = isFileNameAddGuid ? $"{oosFolderPath}/{Guid.NewGuid()}_{localFileName}" : $"{oosFolderPath}/{localFileName}";
@ -910,8 +864,6 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
// 上传文件
var result = _ossClient.PutObject(aliConfig.BucketName, ossRelativePath, localFilePath);
fileSize = result.ContentLength;
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{
@ -927,9 +879,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
.WithObject(ossRelativePath)
.WithFileName(localFilePath);
var result = await minioClient.PutObjectAsync(putObjectArgs);
fileSize = result.Size;
await minioClient.PutObjectAsync(putObjectArgs);
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
{
@ -954,30 +904,14 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
Key = ossRelativePath,
};
var result = await amazonS3Client.PutObjectAsync(putObjectRequest);
fileSize = result.ContentLength;
await amazonS3Client.PutObjectAsync(putObjectRequest);
}
else
{
throw new BusinessValidationFailedException("未定义的存储介质类型");
}
var returnPath = "/" + ossRelativePath;
if (ObjectStoreServiceOptions.IsOpenStoreSync && uploadInfo != null)
{
uploadInfo.FileSize = fileSize;
uploadInfo.Path = returnPath;
uploadInfo.FileName = Path.GetFileName(localFilePath);
uploadInfo.FileType = Path.GetExtension(returnPath);
await _fileUploadRecordService.AddOrUpdateFileUploadRecord(uploadInfo);
}
return returnPath;
return "/" + ossRelativePath;
}
@ -1089,6 +1023,11 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
// 直接返回流
return result.Content;
//// 将OSS返回的流复制到内存流中并返回
//var memoryStream = new MemoryStream();
//await result.Content.CopyToAsync(memoryStream);
//memoryStream.Position = 0; // 重置位置以便读取
//return memoryStream;
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{
@ -1137,8 +1076,8 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
RegionEndpoint = RegionEndpoint.USEast1,
UseHttp = true,
};
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
@ -1154,6 +1093,10 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
// ⭐ 直接返回流
return response.ResponseStream;
//var memoryStream = new MemoryStream();
//await response.ResponseStream.CopyToAsync(memoryStream);
//memoryStream.Position = 0;
//return memoryStream;
}
else
{
@ -1394,8 +1337,8 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
//,UseHttp = true,
RegionEndpoint = RegionEndpoint.USEast1,
UseHttp = true,
};
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
@ -1497,32 +1440,9 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
/// <returns></returns>
public async Task DeleteFromPrefix(string prefix, bool isCache = false)
{
GetObjectStoreTempToken();
//打开了同步的,删除的时候,一起删除
if (ObjectStoreServiceOptions.IsOpenStoreSync && ObjectStoreServiceOptions.SyncConfigList.Any(t => t.IsOpenSync))
{
foreach (var config in ObjectStoreServiceOptions.SyncConfigList.Where(t => t.IsOpenSync))
{
GetObjectStoreTempToken(objectUse: config.Primary);
await DeleteFromPrefixInternal(config.Primary,prefix, isCache);
}
}
else
{
GetObjectStoreTempToken();
await DeleteFromPrefixInternal(ObjectStoreServiceOptions.ObjectStoreUse,prefix, isCache);
}
}
private async Task DeleteFromPrefixInternal(string objectUse ,string prefix, bool isCache = false)
{
if (objectUse == "AliyunOSS")
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
{
var aliConfig = ObjectStoreServiceOptions.AliyunOSS;
@ -1578,7 +1498,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
}
else if (objectUse == "MinIO")
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{
var minIOConfig = ObjectStoreServiceOptions.MinIO;
@ -1615,7 +1535,7 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
}
else if (objectUse == "AWS")
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
{
var awsConfig = ObjectStoreServiceOptions.AWS;
@ -1671,31 +1591,8 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
}
}
public async Task DeleteObjects(List<string> objectKeys, bool isCache = false)
{
//打开了同步的,删除的时候,一起删除
if (ObjectStoreServiceOptions.IsOpenStoreSync && ObjectStoreServiceOptions.SyncConfigList.Any(t => t.IsOpenSync))
{
foreach (var config in ObjectStoreServiceOptions.SyncConfigList.Where(t => t.IsOpenSync))
{
GetObjectStoreTempToken(objectUse: config.Primary);
await DeleteObjectsInternal(objectKeys, isCache);
}
}
else
{
GetObjectStoreTempToken();
await DeleteObjectsInternal(objectKeys, isCache);
}
}
public async Task DeleteObjectsInternal(List<string> objectKeys, bool isCache = false)
{
GetObjectStoreTempToken();
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
@ -1858,42 +1755,13 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null, bool? isGetAllTempToken = null, string? objectUse = null)
public ObjectStoreDTO GetObjectStoreTempToken()
{
string objectStoreUse = string.Empty;
//使用指定配置
if (objectUse != null)
var ossOptions = ObjectStoreServiceOptions.AliyunOSS;
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
{
objectStoreUse = objectUse?.Trim() ?? string.Empty;
}
//根据域名动态判断
else
{
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty() && ObjectStoreServiceOptions.SyncConfigList.Any(t => t.Domain == domain))
{
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == domain);
if (find != null)
{
objectStoreUse = find.Primary;
}
}
else
{
//兜底,如果是本地测试环境,那就使用部署默认配置
objectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse;
}
}
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse = objectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync, SyncConfigList = ObjectStoreServiceOptions.SyncConfigList };
if (objectStoreUse == "AliyunOSS" || isGetAllTempToken == true)
{
var ossOptions = ObjectStoreServiceOptions.AliyunOSS;
var client = new Client(new AlibabaCloud.OpenApiClient.Models.Config()
{
AccessKeyId = ossOptions.AccessKeyId,
@ -1935,14 +1803,13 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
AliyunOSSTempToken = tempToken;
objectStoreDTO.AliyunOSS = tempToken;
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, AliyunOSS = tempToken };
}
if (objectStoreUse == "MinIO")
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{
objectStoreDTO.MinIO = ObjectStoreServiceOptions.MinIO;
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, MinIO = ObjectStoreServiceOptions.MinIO };
}
if (objectStoreUse == "AWS" || isGetAllTempToken == true)
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
{
var awsOptions = ObjectStoreServiceOptions.AWS;
@ -1984,111 +1851,12 @@ public class OSSService(IOptionsMonitor<ObjectStoreServiceOptions> options,
};
AWSTempToken = tempToken;
objectStoreDTO.AWS = tempToken;
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, AWS = tempToken };
}
if (objectStoreUse.IsNullOrEmpty())
else
{
throw new BusinessValidationFailedException("未定义的存储介质类型");
}
return objectStoreDTO;
}
public async Task SyncFileAsync(string objectKey, ObjectStoreUse source, ObjectStoreUse destination, CancellationToken ct = default)
{
var tempConfig = GetObjectStoreTempToken(isGetAllTempToken: true);
var aliConfig = ObjectStoreServiceOptions.AliyunOSS;
var _ossClient = new OssClient(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? aliConfig.EndPoint : aliConfig.InternalEndpoint, AliyunOSSTempToken.AccessKeyId, AliyunOSSTempToken.AccessKeySecret, AliyunOSSTempToken.SecurityToken);
var awsConfig = ObjectStoreServiceOptions.AWS;
var credentials = new SessionAWSCredentials(AWSTempToken.AccessKeyId, AWSTempToken.SecretAccessKey, AWSTempToken.SessionToken);
//提供awsEndPoint域名进行访问配置
var clientConfig = new AmazonS3Config
{
RegionEndpoint = RegionEndpoint.GetBySystemName(awsConfig.Region)
};
var amazonS3Client = new AmazonS3Client(credentials, clientConfig);
// ⭐ 关键变量
IDisposable? owner = null;
Stream sourceStream;
long contentLength;
// ========= 获取流 + 长度 =========
switch (source)
{
case ObjectStoreUse.AliyunOSS:
{
var obj = _ossClient.GetObject(
aliConfig.BucketName,
objectKey);
owner = obj;
sourceStream = obj.Content;
contentLength = obj.ContentLength;
break;
}
case ObjectStoreUse.AWS:
{
var response = await amazonS3Client.GetObjectAsync(
awsConfig.BucketName,
objectKey,
ct);
owner = response;
sourceStream = response.ResponseStream;
contentLength = response.Headers.ContentLength;
break;
}
default:
throw new BusinessValidationFailedException("未定义的同步类型");
}
try
{
// ========= 上传 =========
if (destination == ObjectStoreUse.AWS)
{
var putRequest = new Amazon.S3.Model.PutObjectRequest
{
BucketName = awsConfig.BucketName,
Key = objectKey,
InputStream = sourceStream,
Headers = { ContentLength = contentLength }
};
await amazonS3Client.PutObjectAsync(putRequest, ct);
}
else if (destination == ObjectStoreUse.AliyunOSS)
{
_ossClient.PutObject(
aliConfig.BucketName,
objectKey,
sourceStream);
}
else
{
throw new BusinessValidationFailedException("未定义的同步类型");
}
}
finally
{
// ⭐⭐⭐ 真正释放 HTTP 连接
owner?.Dispose();
}
}
}

View File

@ -1,193 +0,0 @@

using FellowOakDicom.Imaging;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Jpeg;
using SixLabors.ImageSharp.Processing;
namespace IRaCIS.Core.Application.Helper;
public static class DicomSliceSorterFast
{
public static List<T> Sort<T>(
IEnumerable<T> source,
Func<T, string?> ippSelector,
Func<T, string?> iopSelector,
Func<T, int?> instanceSelector)
{
var items = source.ToList();
if (items.Count < 2)
return items;
var refIPP = Parse(ippSelector(items[0]));
var refIOP = Parse(iopSelector(items[0]));
if (refIPP == null || refIOP == null || refIOP.Length != 6)
return items.OrderBy(instanceSelector).ToList();
// normal
var nx = refIOP[1] * refIOP[5] - refIOP[2] * refIOP[4];
var ny = refIOP[2] * refIOP[3] - refIOP[0] * refIOP[5];
var nz = refIOP[0] * refIOP[4] - refIOP[1] * refIOP[3];
var projections = new (T item, double dist)[items.Count];
double min = double.MaxValue;
double max = double.MinValue;
// ---------- projection pass ----------
for (int i = 0; i < items.Count; i++)
{
var ipp = Parse(ippSelector(items[i]));
if (ipp == null)
return items.OrderBy(instanceSelector).ToList();
var dx = refIPP[0] - ipp[0];
var dy = refIPP[1] - ipp[1];
var dz = refIPP[2] - ipp[2];
var dist = dx * nx + dy * ny + dz * nz;
projections[i] = (items[i], dist);
if (dist < min) min = dist;
if (dist > max) max = dist;
}
// ---------- estimate spacing ----------
var spacing = (max - min) / (items.Count - 1);
if (Math.Abs(spacing) < 1e-6)
return items.OrderBy(instanceSelector).ToList();
var result = new T[items.Count];
// ---------- O(n) placement ----------
foreach (var p in projections)
{
var index = (int)Math.Round((p.dist - min) / spacing);
index = Math.Clamp(index, 0, items.Count - 1);
// collision fallback极少发生
while (result[index] != null!)
index = Math.Min(index + 1, items.Count - 1);
result[index] = p.item;
}
return result.ToList();
}
private static double[]? Parse(string? value)
{
if (string.IsNullOrWhiteSpace(value))
return null;
var s = value.Split('\\');
var r = new double[s.Length];
for (int i = 0; i < s.Length; i++)
if (!double.TryParse(s[i], out r[i]))
return null;
return r;
}
}
public static class DicomSortHelper
{
/// <summary>
/// DICOM Slice 排序IPP + IOP
/// 自动 fallback InstanceNumber
/// </summary>
public static List<T> SortSlices<T>(
IEnumerable<T> source,
Func<T, string?> ippSelector,
Func<T, string?> iopSelector,
Func<T, int?> instanceNumberSelector)
{
var list = source.ToList();
if (list.Count < 2)
return list;
var first = list[0];
var reference = ParseVector(ippSelector(first));
var iop = ParseVector(iopSelector(first));
// ===== fallback 条件 =====
if (reference == null || iop == null || iop.Length != 6)
return list.OrderBy(instanceNumberSelector).ToList();
// row / column direction
var row = new[] { iop[0], iop[1], iop[2] };
var col = new[] { iop[3], iop[4], iop[5] };
// normal = row × col
var normal = new[]
{
row[1]*col[2] - row[2]*col[1],
row[2]*col[0] - row[0]*col[2],
row[0]*col[1] - row[1]*col[0]
};
// 如果法向量异常 → fallback
if (IsZeroVector(normal))
return list.OrderBy(instanceNumberSelector).ToList();
// ===== 计算距离 =====
var sorted = list
.Select(item =>
{
var ipp = ParseVector(ippSelector(item));
if (ipp == null)
return (item, distance: double.MinValue);
var vec0 = reference[0] - ipp[0];
var vec1 = reference[1] - ipp[1];
var vec2 = reference[2] - ipp[2];
var distance =
vec0 * normal[0] +
vec1 * normal[1] +
vec2 * normal[2];
return (item, distance);
})
.OrderByDescending(x => x.distance)
.Select(x => x.item)
.ToList();
return sorted;
}
// ---------------- helpers ----------------
private static double[]? ParseVector(string? value)
{
if (string.IsNullOrWhiteSpace(value))
return null;
var parts = value.Split('\\');
var result = new double[parts.Length];
for (int i = 0; i < parts.Length; i++)
{
if (!double.TryParse(parts[i], out result[i]))
return null;
}
return result;
}
private static bool IsZeroVector(double[] v)
{
const double eps = 1e-6;
return Math.Abs(v[0]) < eps &&
Math.Abs(v[1]) < eps &&
Math.Abs(v[2]) < eps;
}
}

View File

@ -47,11 +47,11 @@
<PackageReference Include="fo-dicom.Imaging.ImageSharp" Version="5.2.2" />
<PackageReference Include="fo-dicom.Codecs" Version="5.16.4" />
<PackageReference Include="IP2Region.Net" Version="2.0.2" />
<PackageReference Include="MailKit" Version="4.15.1" />
<PackageReference Include="MailKit" Version="4.11.0" />
<PackageReference Include="Masa.Contrib.Service.MinimalAPIs" Version="1.0.0" />
<PackageReference Include="MaxMind.GeoIP2" Version="5.3.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
<PackageReference Include="MimeKit" Version="4.15.1" />
<PackageReference Include="MimeKit" Version="4.11.0" />
<PackageReference Include="MiniExcel" Version="1.41.2" />
<PackageReference Include="Minio" Version="6.0.3" />
<PackageReference Include="MiniWord" Version="0.9.2" />

View File

@ -1556,103 +1556,6 @@
<param name="_attachmentrepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.FileUploadRecordService.GetSubjectUploadRecordList(IRaCIS.Core.Application.ViewModel.SubjectFileUploadRecordQuery)">
<summary>
按照 subject visit studyCode 三个维度进行分组的查询列表 subject相关
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.FileUploadRecordService.GetFileUploadRecordList(IRaCIS.Core.Application.ViewModel.FileUploadRecordQuery)">
<summary>
上传记录表--里面包含待同步任务 DataFileType= 0 :代表系统文件 1Subject相关 2:项目相关但是和subject 没关系
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.FileUploadRecordService.GetUploadFileSyncRecordList(IRaCIS.Core.Application.ViewModel.UploadFileSyncRecordQuery)">
<summary>
任务具体执行记录表
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.FileUploadRecordService.BatchAddSyncFileTask(IRaCIS.Core.Application.ViewModel.BatchAddSyncFileCommand)">
<summary>
批量设置为需要同步,并且设置优先级
</summary>
<param name="inComand"></param>
<returns></returns>
</member>
<member name="F:IRaCIS.Core.Application.Service.FileSyncQueue._queue">
<summary>
优先级队列(仅负责排序)
</summary>
</member>
<member name="F:IRaCIS.Core.Application.Service.FileSyncQueue._waiting">
<summary>
当前等待中的任务(唯一真实数据)
key = Guid
value = 最新 priority
</summary>
</member>
<member name="F:IRaCIS.Core.Application.Service.FileSyncQueue._running">
<summary>
正在执行的任务(防止重复执行)
</summary>
</member>
<member name="F:IRaCIS.Core.Application.Service.FileSyncQueue._signal">
<summary>
worker 等待信号
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.FileSyncQueue.Enqueue(System.Guid,System.Int32)">
<summary>
入队(同 Guid 会覆盖优先级)
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.FileSyncQueue.DequeueAsync(System.Threading.CancellationToken)">
<summary>
获取一个待执行任务(无任务时自动等待)
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.FileSyncQueue.Complete(System.Guid)">
<summary>
任务执行完成(必须调用)
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.FileSyncQueue.Snapshot">
<summary>
当前等待中的任务快照
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.SyncQueueUseChannel.Enqueue(System.Guid,System.Int32)">
<summary>
入队任务
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.SyncQueueUseChannel.DequeueAsync(System.Threading.CancellationToken)">
<summary>
Worker 等待并获取任务
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.SyncQueueUseChannel.Count">
<summary>
当前排队数量(调试用)
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.FileSyncScheduler">
<summary>
同步调度器
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.FileSyncScheduler.WaitAsync(System.Threading.CancellationToken)">
<summary>
如果没有任务 → 挂起等待 有任务 → 被唤醒并返回
</summary>
<param name="ct"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.InternationalizationService">
<summary>
InternationalizationService
@ -4504,27 +4407,6 @@
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.IVUSCalculateService.GetEmmSum(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
获取EMM求和
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.IVUSCalculateService.GetEEMLumenSum(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
(EEM-Lumen)求和
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.IVUSCalculateService.GetPAV(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
PAV冠状动脉粥样硬化体积百分比)
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.IVUSCalculateService.AddTaskLesionAnswerFromLastTask(IRaCIS.Core.Application.ViewModel.AddTaskLesionAnswerFromLastTaskInDto)">
<summary>
将上一次的访视病灶添加到这一次
@ -6102,62 +5984,6 @@
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.OCTCalculateService.GetMinFCT(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
匹配动脉段最小FCT (平均值的最小值)
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.OCTCalculateService.GetAvgFCT(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
平均最小FCT (平均值的平均值)
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.OCTCalculateService.GetAvgLipidAngle(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
脂质角度平均值
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.OCTCalculateService.GetMaxLipidAngle(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
脂质角度最大
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.OCTCalculateService.GetMacrophageInfiltration(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
获取巨噬细胞浸润测量
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.OCTCalculateService.GetMacrophageExtensionAngle(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
巨噬细胞浸润角度测量
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.OCTCalculateService.GetMicrochannels(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
获取微通道汇总
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.OCTCalculateService.GetCholesterolCrystallization(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
获取胆固醇结晶汇总
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.OCTCalculateService.VerifyVisitTaskQuestions(IRaCIS.Core.Application.Service.Reading.Dto.VerifyVisitTaskQuestionsInDto)">
<summary>
验证访视提交
@ -7631,13 +7457,6 @@
影像阅片临床数据签名
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingClinicalDataService.UpdateReadModuleClinicalData(IRaCIS.Core.Application.Service.Inspection.DTO.UpdateReadModuleClinicalDataInDto)">
<summary>
修改临床数据后 将签名状态变更为未签名
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingClinicalDataService.GetVisitClinicalDataName(IRaCIS.Core.Application.Service.Reading.Dto.GetVisitClinicalDataNameInDto)">
<summary>
获取访视临床数据名称
@ -8833,9 +8652,9 @@
IVUS测量值导入
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IVUSMeasuredValue.FrameNumber">
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IVUSMeasuredValue.PlaqueNum">
<summary>
帧数
斑块编号
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.IVUSMeasuredValue.Emm">
@ -8853,9 +8672,9 @@
外弹力膜面积- 管腔面积
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.OCTFCTUploadData.FrameNumber">
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.OCTFCTUploadData.PlaqueNum">
<summary>
帧数
斑块编号
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.OCTFCTUploadData.FirstData">
@ -8898,11 +8717,6 @@
官腔面积测量
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.OCTFCTUploadData.LipidAngle">
<summary>
脂质角度
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.OCTInfo.PlaqueNum">
<summary>
斑块编号
@ -10993,21 +10807,6 @@
IR阅片页面是否可以查看既往任务结果
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.CloseAndFinishMedicalReview.IsClosedDialog">
<summary>
是否关闭
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.CloseAndFinishMedicalReview.MedicalDialogCloseEnum">
<summary>
医学审核对话关闭原因
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.CloseAndFinishMedicalReview.DialogCloseReason">
<summary>
对话关闭原因
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.JointMedicalReviewI18n.Msg1">
<summary>
trials:medicalFeedback:message:msg1
@ -11753,11 +11552,6 @@
影像标记
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionTrialAddOrEdit.ImageMarkTypeEnum">
<summary>
影像标记类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingTableQuestionTrialAddOrEdit.IsPreinstall">
<summary>
是否预设
@ -12164,11 +11958,6 @@
影像标记
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingQuestionTrialView.ImageMarkTypeEnum">
<summary>
影像标记类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingQuestionTrialView.ImageTool">
<summary>
影像工具
@ -13109,11 +12898,6 @@
影像标记
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingQuestionTrialInDto.ImageMarkTypeEnum">
<summary>
影像标记类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.AddOrUpdateReadingQuestionTrialInDto.ImageTool">
<summary>
影像工具
@ -14383,20 +14167,6 @@
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingQuestionService.GetReadingQuestionTrialById(System.Guid)">
<summary>
根据项目问题id获取项目问题信息
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingQuestionService.GetReadingTableQuestionTrialById(System.Guid)">
<summary>
根据项目表格问题id获取项目表格问题信息
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.SystemCriterionKeyFileService">
<summary>
系统标准阅片关键点文件服务
@ -14529,7 +14299,7 @@
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMarkBinding},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserLog},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingOncologyTaskInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Segmentation},IRaCIS.Core.Application.Service.IVisitTaskHelpeService,IRaCIS.Core.Application.Service.IVisitTaskService,IRaCIS.Core.Application.Contracts.IReadingClinicalDataService,IRaCIS.Core.Application.Service.IReadingCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserFeedBack},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingGlobalTaskInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingCriterionPage},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskRelation},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingJudgeInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadModule},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganTrialInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocument},IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoCalculateService,IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoWithoutPETCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CriterionKeyFileRead},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialCriterionKeyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Application.Service.IGeneralCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskStudy},IRaCIS.Core.Application.Service.ImageAndDoc.IDownloadAndUploadService,IRaCIS.Core.Application.Interfaces.ITrialEmailNoticeConfigService,AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer,ZiggyCreatures.Caching.Fusion.IFusionCache)">
<member name="M:IRaCIS.Core.Application.Service.ReadingImageTaskService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingNoneDicomMarkBinding},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserLog},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingOncologyTaskInfo},IRaCIS.Core.Application.Service.IVisitTaskHelpeService,IRaCIS.Core.Application.Service.IVisitTaskService,IRaCIS.Core.Application.Contracts.IReadingClinicalDataService,IRaCIS.Core.Application.Service.IReadingCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SubjectVisit},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Subject},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserFeedBack},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.ServiceVerifyConfigOption},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingGlobalTaskInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingCriterionPage},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskRelation},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingJudgeInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadModule},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.DicomInstance},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.OrganTrialInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialDocument},IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoCalculateService,IRaCIS.Core.Application.Service.ReadingCalculate.Interface.ILuganoWithoutPETCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionMark},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTrialCriterionDictionary},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionSystem},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CriterionKeyFileRead},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialCriterionKeyFile},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudyFile},IRaCIS.Core.Application.Service.IGeneralCalculateService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionTrial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TaskStudy},IRaCIS.Core.Application.Service.ImageAndDoc.IDownloadAndUploadService,IRaCIS.Core.Application.Interfaces.ITrialEmailNoticeConfigService,AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer,ZiggyCreatures.Caching.Fusion.IFusionCache)">
<summary>
IR影像阅片
</summary>
@ -15307,109 +15077,6 @@
<param name="readModuleId"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.SegmentationService">
<summary>
分割
</summary>
<param name="_segmentationRepository"></param>
<param name="_mapper"></param>
<param name="_userInfo"></param>
<param name="_localizer"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Segmentation},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SegmentBinding},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTaskQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VisitTask},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableAnswerRowInfo},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingTableQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Segment},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<summary>
分割
</summary>
<param name="_segmentationRepository"></param>
<param name="_mapper"></param>
<param name="_userInfo"></param>
<param name="_localizer"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.GetSegmentationList(IRaCIS.Core.Application.ViewModel.SegmentationQuery)">
<summary>
获取分割组
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.AddOrUpdateSegmentation(IRaCIS.Core.Application.ViewModel.SegmentationAddOrEdit)">
<summary>
新增修改分割组
</summary>
<param name="addOrEditSegmentation"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.DeleteSegmentation(System.Guid)">
<summary>
删除分割组
</summary>
<param name="segmentationId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.ChangeSegmentationSavedStatus(IRaCIS.Core.Application.ViewModel.ChangeSegmentationSavedStatusInDto)">
<summary>
修改分割组的保存状态
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.GetSegmentList(IRaCIS.Core.Application.ViewModel.SegmentQuery)">
<summary>
获取分割
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.AddOrUpdateSegment(IRaCIS.Core.Application.ViewModel.SegmentAddOrEdit)">
<summary>
新增修改分割
</summary>
<param name="addOrEditSegment"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.DeleteSegment(System.Guid)">
<summary>
删除分割
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.GetSegmentBindingList(IRaCIS.Core.Application.ViewModel.SegmentBindingQuery)">
<summary>
获取分割绑定
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.AddOrUpdateSegmentBinding(IRaCIS.Core.Application.ViewModel.SegmentBindingAddOrEdit)">
<summary>
新增修改分割绑定
</summary>
<param name="addOrEditSegmentBinding"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.DeleteSegmentBinding(System.Guid)">
<summary>
删除分割
</summary>
<param name="segmentBindingId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.SaveSegmentBindingAndAnswer(IRaCIS.Core.Application.ViewModel.SaveSegmentBindingAndAnswerInDto)">
<summary>
保存分割绑定和答案
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.SegmentationService.DeleteBindingsAndAnswersAsync(System.Nullable{System.Guid},System.Nullable{System.Guid})">
<summary>
删除分割组和分割时的关联数据删除逻辑
</summary>
<param name="segmentationId"></param>
<param name="segmentId"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Service.ShortcutKeyService">
<summary>
快捷键服务
@ -16096,7 +15763,7 @@
<returns></returns>
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
</member>
<member name="M:IRaCIS.Core.Application.Helper.OSSService.UploadToOSSAsync(System.IO.Stream,System.String,System.String,System.Boolean,IRaCIS.Core.Application.ViewModel.FileUploadRecordAddOrEdit)">
<member name="M:IRaCIS.Core.Application.Helper.OSSService.UploadToOSSAsync(System.IO.Stream,System.String,System.String,System.Boolean)">
<summary>
oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder
</summary>
@ -16104,10 +15771,9 @@
<param name="oosFolderPath"></param>
<param name="fileRealName"></param>
<param name="isFileNameAddGuid"></param>
<param name="uploadInfo"> 只用赋值业务参数Id 和批次信息即可,其他信息不用传递</param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Helper.OSSService.UploadToOSSAsync(System.String,System.String,System.Boolean,System.Boolean,IRaCIS.Core.Application.ViewModel.FileUploadRecordAddOrEdit)">
<member name="M:IRaCIS.Core.Application.Helper.OSSService.UploadToOSSAsync(System.String,System.String,System.Boolean,System.Boolean)">
<summary>
oosFolderPath 不要 "/ "开头 应该: TempFolder/ChildFolder
</summary>
@ -16139,12 +15805,6 @@
<param name="prefix"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Helper.DicomSortHelper.SortSlices``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.String},System.Func{``0,System.String},System.Func{``0,System.Nullable{System.Int32}})">
<summary>
DICOM Slice 排序IPP + IOP
自动 fallback InstanceNumber
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Helper.HolidayHelper._client">
<summary>
github 链接https://github.com/lanceliao/china-holiday-calender?tab=readme-ov-file 
@ -17918,31 +17578,6 @@
任务类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SegmentationView.IsSaved">
<summary>
是否保存
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.ChangeSegmentationSavedStatusInDto.IsSaved">
<summary>
是否保存
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SegmentBindingView.SegmentationName">
<summary>
分割分组名称
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SegmentBindingView.SegmentName">
<summary>
SegmentName
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.SegmentAddOrEdit.SegmentJson">
<summary>
分割的Json
</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.UserWLTemplateView">
<summary> UserWLTemplateView 列表视图模型 </summary>
</member>
@ -18979,11 +18614,6 @@
阅片工具
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Contracts.GetTrialReadingInfoOutDto.SegmentToolList">
<summary>
分割工具
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Contracts.GetTrialReadingInfoOutDto.TrialId">
<summary>
项目ID
@ -19244,11 +18874,6 @@
表单类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Contracts.SetCriterionReadingInfoInDto.SegmentToolList">
<summary>
分割工具
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Contracts.SetCriterionReadingInfoInDto.TrialReadingCriterionId">
<summary>
项目标准ID

View File

@ -6,7 +6,6 @@ using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Contracts.DTO;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.MassTransit.Command;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using MassTransit;
@ -321,7 +320,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer
join study in _studyRepository.AsQueryable() on sv.Id equals study.SubjectVisitId
select new CheckDBModel()
{
SubjectStatus = sv.Subject.Status,
SubjectStatus = sv.Subject.Status,
SubjectVisitId = sv.Id,
SiteCode = sv.TrialSite.TrialSiteCode,
StudyDate = study.StudyTime == null ? string.Empty : ((DateTime)study.StudyTime).ToString("yyyy-MM-dd"),
@ -404,7 +403,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer
{
SubjectStatus = dbCurrentVisitFirst.SubjectStatus,
CheckTime = DateTime.Now,
CheckState = CheckStateEnum.CVPassed,
CheckState=CheckStateEnum.CVPassed,
SiteCode = dbCurrentVisitFirst.SiteCode,
SubjectCode = dbCurrentVisitFirst.SubjectCode,
VisitName = dbCurrentVisitFirst.VisitName,
@ -449,7 +448,7 @@ namespace IRaCIS.Core.Application.MassTransit.Consumer
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", uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = trialId, BatchDataType = BatchDataType.DataReconciliation });
var ossRelativePath = await _oSSService.UploadToOSSAsync(fileStreamResult.FileStream, $"{trialId.ToString()}/InspectionUpload/DataReconciliation", "DataReconciliation");
//var add = await _inspectionFileRepository.FindAsync(inspectionFileId);

View File

@ -703,10 +703,6 @@ public class QCClaimTaskEventConsumer(
var userinfo = subjectVisit.CurrentActionUser;
if (userinfo == null)
{
return;
}
var messageToSend = new MimeMessage();
//发件地址

View File

@ -1,234 +0,0 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2026-03-10 06:15:31Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel;
public class SubjectFileUploadRecordView
{
public string? SubjectCode { get; set; }
public string? VisitName { get; set; }
public string StudyCode { get; set; }
public Guid? SubjectId { get; set; }
public Guid? SubjectVisitId { get; set; }
public int FileCount { get; set; }
public string? UploadRegion { get; set; }
public string? TargetRegion { get; set; }
public DateTime CreateTime { get; set; }
public DateTime? SyncFinishedTime { get; set; }
public bool IsSync { get; set; }
}
public class FileUploadRecordView : FileUploadRecordAddOrEdit
{
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
[Comment("同步结束时间-最后一个任务的时间")]
public DateTime? SyncFinishedTime { get; set; }
public string? SubjectCode { get; set; }
public string? VisitName { get; set; }
}
public class FileUploadRecordAddOrEdit
{
public Guid? Id { get; set; }
public string FileName { get; set; }
public long FileSize { get; set; }
public string FileType { get; set; }
public string Path { get; set; }
public string UploadBatchId { get; set; }
public BatchDataType BatchDataType { get; set; }
public string StudyCode { get; set; }
public Guid? TrialId { get; set; }
public Guid? SubjectId { get; set; }
public Guid? SubjectVisitId { get; set; }
public Guid? DicomStudyId { get; set; }
public Guid? NoneDicomStudyId { get; set; }
public string FileMarkId { get; set; }
public int? Priority { get; set; }
public string IP { get; set; }
public bool? IsNeedSync { get; set; }
public string UploadRegion { get; set; }
public string TargetRegion { get; set; }
public bool? IsSync { get; set; }
}
public class SubjectFileUploadRecordQuery : PageInput
{
public Guid TrialId { get; set; }
public string? SubjectCode { get; set; }
public string? VisitName { get; set; }
public string? StudyCode { get; set; }
public string? UploadRegion { get; set; }
public string? TargetRegion { get; set; }
public bool? IsSync { get; set; }
}
public class FileUploadRecordQuery : PageInput
{
public BatchDataType? BatchDataType { get; set; }
public Guid? TrialId { get; set; }
public int? DataFileType { get; set; }
public string StudyCode { get; set; }
public string? SubjectCode { get; set; }
public string? VisitName { get; set; }
public Guid? SubjectId { get; set; }
public Guid? SubjectVisitId { get; set; }
public string? FileMarkId { get; set; }
public string? FileName { get; set; }
public string? FileType { get; set; }
public string? IP { get; set; }
public bool? IsNeedSync { get; set; }
public bool? IsSync { get; set; }
public string? Path { get; set; }
public int? Priority { get; set; }
public string? TargetRegion { get; set; }
public string? UploadBatchId { get; set; }
public string? UploadRegion { get; set; }
public DateTime? SyncFinishedStartTime { get; set; }
public DateTime? SyncFinishedEndTime { get; set; }
public DateTime? UploadStartTime { get; set; }
public DateTime? UploadEndTime { get; set; }
}
public class UploadFileSyncRecordView
{
public Guid Id { get; set; }
public DateTime? StartTime { get; set; }
public DateTime? EndTime { get; set; }
public jobState JobState { get; set; }
public string Msg { get; set; }
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
public Guid? FileUploadRecordId { get; set; }
public string? FileName { get; set; }
public string? FileType { get; set; }
public string? Path { get; set; }
public string StudyCode { get; set; }
public string? SubjectCode { get; set; }
public string? VisitName { get; set; }
}
public class UploadFileSyncRecordQuery : PageInput
{
public Guid? FileUploadRecordId { get; set; }
public jobState? JobState { get; set; }
public string? SubjectCode { get; set; }
public string? VisitName { get; set; }
public string? StudyCode { get; set; }
}
public class BatchAddSyncFileCommand
{
public List<Guid> FileUploadRecordIdList { get; set; }
public int? Priority { get; set; }
}

View File

@ -155,8 +155,7 @@ public class EmailLogService(IRepository<EmailLog> _emailLogRepository,
fileStream: decodeStream,
oosFolderPath: $"EmailAttachment/{emailInfo.Id}", // OSS 虚拟目录
fileRealName: emaliAttachmentInfo.AttachmentName,
isFileNameAddGuid: true,
uploadInfo: new FileUploadRecordAddOrEdit() {TrialId= inDto.TrialId, BatchDataType = BatchDataType.EmailAttach }); // 让方法自己在文件名前加 Guid
isFileNameAddGuid: true); // 让方法自己在文件名前加 Guid
attachmentInfos.Add(emaliAttachmentInfo);
}

View File

@ -984,7 +984,7 @@ namespace IRaCIS.Core.Application.Service.Common
var query = _subjectVisitRepository.Where(x => x.TrialId == inQuery.TrialId)
.Where(t => t.Subject.IsSubjectQuit == false || t.SubmitState >= SubmitStateEnum.ToSubmit)
.WhereIf(inQuery.SubjectStatus != null, t => t.Subject.Status == inQuery.SubjectStatus)
.Where(t => t.Subject.FinalSubjectVisitId != null ? t.VisitNum <= t.Subject.FinalSubjectVisit.VisitNum : true)
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.SubjectId != null, t => t.Subject.Id == inQuery.SubjectId)
@ -1034,7 +1034,7 @@ namespace IRaCIS.Core.Application.Service.Common
var query = _subjectVisitRepository.Where(x => x.TrialId == inQuery.TrialId)
.Where(t => t.Subject.IsSubjectQuit == false || t.AuditState > AuditStateEnum.ToAudit)
.WhereIf(inQuery.SubjectStatus != null, t => t.Subject.Status == inQuery.SubjectStatus)
.WhereIf(inQuery.VisitId != null, t => t.Id == inQuery.VisitId)
.WhereIf(inQuery.CurrentActionUserId != null, t => t.CurrentActionUserId == inQuery.CurrentActionUserId)
.WhereIf(inQuery.ChallengeState != null, t => t.ChallengeState == inQuery.ChallengeState)
@ -2774,7 +2774,7 @@ namespace IRaCIS.Core.Application.Service.Common
{
list.Add(new ExportDocumentDes() { Code = StaticData.Export.IVUS_CDISC_Export, ExportCatogory = ExportResult.IVUS_CDISC_Export });
}
if (criterion.CriterionGroup != CriterionGroup.Tumor /*&& criterion.CriterionType != CriterionType.OCT && criterion.CriterionType != CriterionType.IVUS*/)
if (criterion.CriterionGroup != CriterionGroup.Tumor && criterion.CriterionType != CriterionType.OCT && criterion.CriterionType != CriterionType.IVUS)
{
list.Add(new ExportDocumentDes() { Code = StaticData.Export.CDISC_Reading_Export, ExportCatogory = ExportResult.NoneTumorCDISC });
}

View File

@ -1,589 +0,0 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2026-03-10 06:15:17Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using DocumentFormat.OpenXml.Office2010.ExcelAc;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure.Extention;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Spire.Doc.Interface;
using System.Drawing;
using System.Threading.Channels;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service;
[ApiExplorerSettings(GroupName = "Common")]
public class FileUploadRecordService(IRepository<FileUploadRecord> _fileUploadRecordRepository, IRepository<UploadFileSyncRecord> _uploadFileSyncRecordRepository,
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IOptionsMonitor<ObjectStoreServiceOptions> options,
IFusionCache _fusionCache, IRepository<Trial> _trialRepository, FileSyncQueue _fileSyncQueue) : BaseService, IFileUploadRecordService
{
ObjectStoreServiceOptions ObjectStoreServiceConfig = options.CurrentValue;
/// <summary>
/// 按照 subject visit studyCode 三个维度进行分组的查询列表 subject相关
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<SubjectFileUploadRecordView>> GetSubjectUploadRecordList(SubjectFileUploadRecordQuery inQuery)
{
var query = _fileUploadRecordRepository.Where(t => t.TrialId == inQuery.TrialId && t.SubjectId != null)
.WhereIf(!string.IsNullOrEmpty(inQuery.VisitName), t => t.SubjectVisit.VisitName.Contains(inQuery.VisitName))
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode))
.WhereIf(!string.IsNullOrEmpty(inQuery.StudyCode), t => t.StudyCode.Contains(inQuery.StudyCode))
.WhereIf(!string.IsNullOrEmpty(inQuery.UploadRegion), t => t.UploadRegion == inQuery.UploadRegion)
.WhereIf(!string.IsNullOrEmpty(inQuery.TargetRegion), t => t.TargetRegion == inQuery.TargetRegion)
.WhereIf(inQuery.IsSync != null, t => t.IsSync == inQuery.IsSync)
.GroupBy(t => new { t.StudyCode, SubjectCode = t.Subject.Code, t.SubjectVisit.VisitName, t.SubjectId, t.SubjectVisitId })
.Select(g => new SubjectFileUploadRecordView()
{
SubjectCode = g.Key.SubjectCode,
VisitName = g.Key.VisitName,
StudyCode = g.Key.StudyCode,
SubjectId = g.Key.SubjectId,
SubjectVisitId = g.Key.SubjectVisitId,
FileCount = g.Count(),
CreateTime = g.Max(t => t.CreateTime),
SyncFinishedTime = g.Max(t => t.SyncFinishedTime),
UploadRegion = g.First().UploadRegion,
TargetRegion = g.First().TargetRegion,
IsSync = !g.Any(t => t.IsSync == false || t.IsSync == null)
});
var pageList = await query.ToPagedListAsync(inQuery);
return pageList;
}
/// <summary>
/// 上传记录表--里面包含待同步任务 DataFileType= 0 :代表系统文件 1Subject相关 2:项目相关但是和subject 没关系
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<FileUploadRecordView>> GetFileUploadRecordList(FileUploadRecordQuery inQuery)
{
var fileUploadRecordQueryable = _fileUploadRecordRepository
.WhereIf(!string.IsNullOrEmpty(inQuery.FileName), t => t.FileName.Contains(inQuery.FileName))
.WhereIf(!string.IsNullOrEmpty(inQuery.FileType), t => t.FileType.Contains(inQuery.FileType))
.WhereIf(inQuery.TrialId != null, t => t.TrialId == inQuery.TrialId)
.WhereIf(inQuery.SubjectId != null, t => t.SubjectId == inQuery.SubjectId)
.WhereIf(inQuery.SubjectVisitId != null, t => t.SubjectVisitId == inQuery.SubjectVisitId)
.WhereIf(!string.IsNullOrEmpty(inQuery.StudyCode), t => t.StudyCode.Contains(inQuery.StudyCode))
.WhereIf(!string.IsNullOrEmpty(inQuery.VisitName), t => t.SubjectVisit.VisitName.Contains(inQuery.VisitName))
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.Subject.Code.Contains(inQuery.SubjectCode))
.WhereIf(inQuery.DataFileType == 1 && inQuery.SubjectId != null && inQuery.SubjectVisitId == null, t => t.SubjectVisitId == null)
.WhereIf(inQuery.DataFileType == 1 && inQuery.SubjectVisitId != null && inQuery.StudyCode == "", t => t.StudyCode == "")
.WhereIf(inQuery.DataFileType == 1 && inQuery.SubjectCode.IsNotNullOrEmpty() && inQuery.VisitName.IsNullOrEmpty(), t => t.SubjectVisitId == null)
.WhereIf(inQuery.DataFileType == 1 && inQuery.VisitName.IsNotNullOrEmpty() && inQuery.StudyCode == "", t => t.StudyCode == "")
.WhereIf(inQuery.DataFileType == 0, t => t.TrialId == null)
.WhereIf(inQuery.DataFileType == 1, t => t.SubjectId != null)
.WhereIf(inQuery.DataFileType == 2, t => t.SubjectId == null)
.WhereIf(inQuery.IsNeedSync != null, t => t.IsNeedSync == inQuery.IsNeedSync)
.WhereIf(inQuery.IsSync != null, t => t.IsSync == inQuery.IsSync)
.WhereIf(inQuery.Priority != null, t => t.Priority == inQuery.Priority)
.WhereIf(inQuery.BatchDataType != null, t => t.BatchDataType == inQuery.BatchDataType)
.WhereIf(!string.IsNullOrEmpty(inQuery.UploadRegion), t => t.UploadRegion == inQuery.UploadRegion)
.WhereIf(!string.IsNullOrEmpty(inQuery.TargetRegion), t => t.TargetRegion == inQuery.TargetRegion)
.WhereIf(!string.IsNullOrEmpty(inQuery.UploadBatchId), t => t.UploadBatchId.Contains(inQuery.UploadBatchId))
.WhereIf(!string.IsNullOrEmpty(inQuery.Path), t => t.Path.Contains(inQuery.Path))
.WhereIf(inQuery.UploadStartTime != null, t => t.CreateTime >= inQuery.UploadStartTime)
.WhereIf(inQuery.UploadEndTime != null, t => t.CreateTime <= inQuery.UploadEndTime)
.WhereIf(inQuery.SyncFinishedStartTime != null, t => t.SyncFinishedTime >= inQuery.SyncFinishedStartTime)
.WhereIf(inQuery.SyncFinishedEndTime != null, t => t.SyncFinishedTime <= inQuery.SyncFinishedEndTime)
.ProjectTo<FileUploadRecordView>(_mapper.ConfigurationProvider);
var pageList = await fileUploadRecordQueryable.ToPagedListAsync(inQuery);
return pageList;
}
/// <summary>
/// 任务具体执行记录表
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<UploadFileSyncRecordView>> GetUploadFileSyncRecordList(UploadFileSyncRecordQuery inQuery)
{
var fileUploadRecordQueryable = _uploadFileSyncRecordRepository
.WhereIf(inQuery.JobState != null, t => t.JobState == inQuery.JobState)
.WhereIf(inQuery.FileUploadRecordId != null, t => t.FileUploadRecordId == inQuery.FileUploadRecordId)
.WhereIf(!string.IsNullOrEmpty(inQuery.StudyCode), t => t.FileUploadRecord.StudyCode.Contains(inQuery.StudyCode))
.WhereIf(!string.IsNullOrEmpty(inQuery.VisitName), t => t.FileUploadRecord.SubjectVisit.VisitName.Contains(inQuery.VisitName))
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectCode), t => t.FileUploadRecord.Subject.Code.Contains(inQuery.SubjectCode))
.ProjectTo<UploadFileSyncRecordView>(_mapper.ConfigurationProvider);
var pageList = await fileUploadRecordQueryable.ToPagedListAsync(inQuery);
return pageList;
}
/// <summary>
/// 批量设置为需要同步,并且设置优先级
/// </summary>
/// <param name="inComand"></param>
/// <returns></returns>
public async Task<IResponseOutput> BatchAddSyncFileTask(BatchAddSyncFileCommand inComand)
{
await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => inComand.FileUploadRecordIdList.Contains(t.Id), u => new FileUploadRecord() { IsNeedSync = true, Priority = inComand.Priority ?? 0 });
foreach (var item in inComand.FileUploadRecordIdList)
{
_fileSyncQueue.Enqueue(item, inComand.Priority ?? 0);
}
await _fileUploadRecordRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
public async Task<IResponseOutput> AddOrUpdateFileUploadRecord(FileUploadRecordAddOrEdit addOrEditFileUploadRecord)
{
addOrEditFileUploadRecord.IP = _userInfo.IP;
if (ObjectStoreServiceConfig.IsOpenStoreSync && _userInfo.Domain.IsNotNullOrEmpty())
{
var find = ObjectStoreServiceConfig.SyncConfigList.FirstOrDefault(t => t.Domain == _userInfo.Domain);
if (find != null)
{
addOrEditFileUploadRecord.UploadRegion = find.UploadRegion;
addOrEditFileUploadRecord.TargetRegion = find.TargetRegion;
}
else
{
//前后端调试的时候,上传的时候域名不对应,自动按照后端配置设置上传区域和同步区域
var apiDefalut = ObjectStoreServiceConfig.SyncConfigList.FirstOrDefault(t => t.UploadRegion == ObjectStoreServiceConfig.ApiDeployRegion);
if (apiDefalut != null)
{
addOrEditFileUploadRecord.UploadRegion = apiDefalut.UploadRegion;
addOrEditFileUploadRecord.TargetRegion = apiDefalut.TargetRegion;
}
}
}
if (addOrEditFileUploadRecord.TrialId != null)
{
var trialDataStore = await _fusionCache.GetOrSetAsync(CacheKeys.TrialDataStoreType(addOrEditFileUploadRecord.TrialId.Value), async _ =>
{
return await _trialRepository.Where(t => t.Id == addOrEditFileUploadRecord.TrialId).Select(t => t.TrialDataStoreType)
.FirstOrDefaultAsync();
},
TimeSpan.FromDays(7)
);
//项目配置了,那么就设置需要同步
if (trialDataStore == TrialDataStore.MUtiCenter)
{
addOrEditFileUploadRecord.IsNeedSync = true;
addOrEditFileUploadRecord.Priority = 0;
addOrEditFileUploadRecord.IsSync = false;
}
else
{
addOrEditFileUploadRecord.IsNeedSync = false;
//addOrEditFileUploadRecord.TargetRegion = "";
}
}
else
{
//系统文件,默认同步
addOrEditFileUploadRecord.IsNeedSync = true;
addOrEditFileUploadRecord.IsSync = false;
addOrEditFileUploadRecord.Priority = 0;
}
var entity = await _fileUploadRecordRepository.InsertOrUpdateAsync(addOrEditFileUploadRecord, true);
if (addOrEditFileUploadRecord.IsNeedSync == true)
{
_fileSyncQueue.Enqueue(entity.Id, addOrEditFileUploadRecord.Priority ?? 0);
}
return ResponseOutput.Ok(entity.Id.ToString());
}
[HttpDelete("{fileUploadRecordId:guid}")]
public async Task<IResponseOutput> DeleteFileUploadRecord(Guid fileUploadRecordId)
{
var success = await _fileUploadRecordRepository.BatchDeleteNoTrackingAsync(t => t.Id == fileUploadRecordId);
return ResponseOutput.Ok();
}
}
#region 同步队列
public sealed class FileSyncQueue
{
/// <summary>
/// 优先级队列(仅负责排序)
/// </summary>
private readonly PriorityQueue<Guid, int> _queue = new();
/// <summary>
/// 当前等待中的任务(唯一真实数据)
/// key = Guid
/// value = 最新 priority
/// </summary>
private readonly Dictionary<Guid, int> _waiting = new();
/// <summary>
/// 正在执行的任务(防止重复执行)
/// </summary>
private readonly HashSet<Guid> _running = new();
/// <summary>
/// worker 等待信号
/// </summary>
private readonly SemaphoreSlim _signal = new(0);
private readonly object _lock = new();
// ============================================================
// Enqueue
// ============================================================
/// <summary>
/// 入队(同 Guid 会覆盖优先级)
/// </summary>
public void Enqueue(Guid id, int priority)
{
bool needSignal = false;
lock (_lock)
{
// 如果正在执行,忽略(防止重复)
if (_running.Contains(id))
return;
// 是否新任务(用于减少 signal 风暴)
if (!_waiting.ContainsKey(id))
needSignal = true;
// 更新为最新优先级(最后一次为准)
_waiting[id] = priority; //等价于添加或者更新
// PriorityQueue 无法更新节点
// 允许旧节点存在Dequeue 时过滤
_queue.Enqueue(id, -priority);
}
// 只有新增任务才唤醒 worker
if (needSignal)
_signal.Release();
}
// ============================================================
// Dequeue
// ============================================================
/// <summary>
/// 获取一个待执行任务(无任务时自动等待)
/// </summary>
public async Task<Guid> DequeueAsync(CancellationToken ct)
{
while (true)
{
await _signal.WaitAsync(ct);
lock (_lock)
{
while (_queue.Count > 0)
{
var id = _queue.Dequeue();
// 已被覆盖或取消 如果这个任务已经不是“当前最新版任务”,那它只是 PriorityQueue 里的垃圾数据,直接跳过。
if (!_waiting.TryGetValue(id, out _)) //能从等待任务中取到,那么就是有效的,不能取到那么就是覆盖的
continue;
// 标记为运行中
_waiting.Remove(id);
_running.Add(id);
return id;
}
}
}
}
// ============================================================
// Complete
// ============================================================
/// <summary>
/// 任务执行完成(必须调用)
/// </summary>
public void Complete(Guid id)
{
lock (_lock)
{
_running.Remove(id);
}
}
// ============================================================
// Snapshot
// ============================================================
/// <summary>
/// 当前等待中的任务快照
/// </summary>
public Guid[] Snapshot()
{
lock (_lock)
{
return _waiting.Keys.ToArray();
}
}
// ============================================================
// 状态信息(调试用)
// ============================================================
public int WaitingCount
{
get
{
lock (_lock)
return _waiting.Count;
}
}
public int RunningCount
{
get
{
lock (_lock)
return _running.Count;
}
}
}
///// <summary>
///// 同步队列 信号量
///// </summary>
//public class FileSyncQueue
//{
// private readonly PriorityQueue<Guid, int> _queue = new();
// private readonly SemaphoreSlim _signal = new(0);
// private readonly object _lock = new();
// public void Enqueue(Guid id, int priority)
// {
// lock (_lock)
// {
// // priority 越大越优先
// _queue.Enqueue(id, -priority);
// }
// //类似于计数器,不会产生通知风暴,可消费资源 +1
// //if (有等待线程) 唤醒一个 else 仅增加计数
// _signal.Release(); // 唤醒一个 worker
// }
// /// <summary>
// /// 如果没有任务 → 挂起等待 有任务 → 被唤醒并返回
// /// </summary>
// /// <param name="ct"></param>
// /// <returns></returns>
// public async Task<Guid> DequeueAsync(CancellationToken ct)
// {
// await _signal.WaitAsync(ct);
// lock (_lock)
// {
// return _queue.Dequeue();
// }
// }
// /// <summary>
// /// 获取队列任务Id
// /// </summary>
// /// <returns></returns>
// public Guid[] Snapshot()
// {
// lock (_lock)
// {
// return _queue.UnorderedItems
// .Select(x => x.Element)
// .ToArray();
// }
// }
//}
#region 这里不用 SyncQueueUseChannel 和调度器 SyncScheduler
public class SyncQueueUseChannel
{
// 优先级队列priority 越大越先执行)
private readonly PriorityQueue<Guid, int> _queue = new();
// Worker 唤醒信号
private readonly Channel<bool> _signal =
Channel.CreateUnbounded<bool>(new UnboundedChannelOptions
{
SingleReader = false,
SingleWriter = false
});
// 队列任务数量不是CPU数量
private int _count = 0;
private readonly object _lock = new();
/// <summary>
/// 入队任务
/// </summary>
public void Enqueue(Guid id, int priority)
{
bool needSignal = false;
lock (_lock)
{
// priority 越大越优先 → 转负数
_queue.Enqueue(id, -priority);
// 只有从 0 → 1 才需要唤醒 worker
if (_count == 0)
needSignal = true;
_count++;
}
// 避免 signal 风暴
if (needSignal)
_signal.Writer.TryWrite(true);
}
/// <summary>
/// Worker 等待并获取任务
/// </summary>
public async Task<Guid> DequeueAsync(CancellationToken ct)
{
// 没任务时挂起不会占CPU
await _signal.Reader.ReadAsync(ct);
lock (_lock)
{
var id = _queue.Dequeue();
_count--;
// 如果还有任务,继续唤醒下一个 worker
if (_count > 0)
_signal.Writer.TryWrite(true);
return id;
}
}
/// <summary>
/// 当前排队数量(调试用)
/// </summary>
public int Count
{
get
{
lock (_lock)
return _count;
}
}
}
/// <summary>
/// 同步调度器
/// </summary>
public class FileSyncScheduler
{
private readonly FileSyncQueue _queue;
public FileSyncScheduler(FileSyncQueue queue)
{
_queue = queue;
}
public void Enqueue(FileUploadRecord file)
{
if (file.IsNeedSync != true)
return;
_queue.Enqueue(file.Id, file.Priority ?? 0);
}
/// <summary>
/// 如果没有任务 → 挂起等待 有任务 → 被唤醒并返回
/// </summary>
/// <param name="ct"></param>
/// <returns></returns>
public Task<Guid> WaitAsync(CancellationToken ct)
=> _queue.DequeueAsync(ct);
}
#endregion
#endregion

View File

@ -1,23 +0,0 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2026-03-10 06:15:31Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using System;
using IRaCIS.Core.Infrastructure.Extention;
using System.Threading.Tasks;
using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Interfaces;
public interface IFileUploadRecordService
{
Task<PageOutput<FileUploadRecordView>> GetFileUploadRecordList(FileUploadRecordQuery inQuery);
Task<IResponseOutput> AddOrUpdateFileUploadRecord(FileUploadRecordAddOrEdit addOrEditFileUploadRecord);
Task<IResponseOutput> DeleteFileUploadRecord(Guid fileUploadRecordId);
}

View File

@ -20,7 +20,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<EmailLog, GetEmailInfoOutDto>()
.ForMember(t => t.RecipientList, u => u.MapFrom(c => c.EmailRecipientLogList))
.ForMember(t => t.AttachmentList, u => u.MapFrom(c => c.AttachmentList));
.ForMember(t => t.AttachmentList, u => u.MapFrom(c => c.AttachmentList));
CreateMap<EmailLog, EmailLogAddOrEdit>().ReverseMap();
@ -41,7 +41,7 @@ namespace IRaCIS.Core.Application.Service
.ForMember(t => t.EmailNoticeUserList, u => u.MapFrom(c => c.EmailNoticeUserTypeList));
CreateMap<EmailNoticeConfig, EmailNoticeConfigExportDto>();
CreateMap<Dictionary, DicView>()
.ForMember(t => t.ParentCode, u => u.MapFrom(c => c.Parent.Code));
@ -89,14 +89,14 @@ namespace IRaCIS.Core.Application.Service
CreateMap<Internationalization, InternationalizationAddOrEdit>().ReverseMap();
CreateMap<InternationalizationAddOrEdit, IRCGlobalInfoDTO>();
CreateMap<Internationalization, BatchInternationalizationDto>().ReverseMap();
CreateMap<Internationalization, IRCGlobalInfoDTO>();
CreateMap<EventStoreRecord, EventStoreRecordView>();
CreateMap<BatchAddInternationalizationDto, InternationalizationAddOrEdit>();
@ -116,7 +116,7 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.Subject.TrialSite.TrialSiteCode));
CreateMap<TumorExportBaseModel, TU_Export>();
CreateMap<TumorExportBaseModel , TU_Export>();
CreateMap<TumorExportBaseModel, TR_Export>();
CreateMap<TumorExportBaseModel, RS_Export>();
CreateMap<TumorExportBaseModel, CO_Export>();
@ -124,21 +124,6 @@ namespace IRaCIS.Core.Application.Service
CreateMap<IVUS_OCTBaseDto, IvusExportDto>();
CreateMap<IVUS_OCTBaseDto, OctExportDto>();
CreateMap<FileUploadRecord, FileUploadRecordView>()
.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.Subject.Code))
.ForMember(d => d.VisitName, u => u.MapFrom(s => s.SubjectVisit.VisitName));
CreateMap<FileUploadRecord, FileUploadRecordAddOrEdit>().ReverseMap();
CreateMap<UploadFileSyncRecord, UploadFileSyncRecordView>()
.ForMember(d => d.FileName, u => u.MapFrom(s => s.FileUploadRecord.FileName))
.ForMember(d => d.FileType, u => u.MapFrom(s => s.FileUploadRecord.FileType))
.ForMember(d => d.Path, u => u.MapFrom(s => s.FileUploadRecord.Path))
.ForMember(d => d.StudyCode, u => u.MapFrom(s => s.FileUploadRecord.StudyCode))
.ForMember(d => d.SubjectCode, u => u.MapFrom(s => s.FileUploadRecord.Subject.Code))
.ForMember(d => d.VisitName, u => u.MapFrom(s => s.FileUploadRecord.SubjectVisit.VisitName));
}
}

View File

@ -234,7 +234,6 @@ namespace IRaCIS.Core.Application.Service
//重新插入新的 Title记录
updateModel.TitleIds.ForEach(titleId => adddata.Add(new DoctorDictionary() { DoctorId = updateModel.Id.Value, KeyName = StaticData.Title, DictionaryId = titleId }));
indto.ReviewerCode = doctor.ReviewerCode;
await _doctorDictionaryRepository.AddRangeAsync(adddata);
_mapper.Map(indto, doctor);

View File

@ -29,9 +29,6 @@
public string SliceThickness { get; set; } = String.Empty;
public string ImagePositionPatient { get; set; }
public string ImageOrientationPatient { get; set; }
}

View File

@ -108,10 +108,6 @@ namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
public string WindowCenter { get; set; }
[JsonIgnore]
public string WindowWidth { get; set; }
[JsonIgnore]
public string ImagePositionPatient { get; set; }
[JsonIgnore]
public string ImageOrientationPatient { get; set; }
public DateTime? RowDate { get; set; }
}

View File

@ -265,11 +265,6 @@ namespace IRaCIS.Core.Application.Contracts
[NotDefault]
public Guid StudyMonitorId { get; set; }
[NotDefault]
public string UploadBatchId { get; set; }
public int FailedFileCount { get; set; }
public string RecordPath { get; set; } = string.Empty;
@ -294,10 +289,6 @@ namespace IRaCIS.Core.Application.Contracts
[NotDefault]
public Guid StudyMonitorId { get; set; }
[NotDefault]
public string UploadBatchId { get; set; }
public int FailedFileCount { get; set; }
public string RecordPath { get; set; } = string.Empty;

View File

@ -41,7 +41,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
IRepository<VisitTask> _visitTaskRepository,
IRepository<SubjectVisit> _subjectVisitRepository,
IOSSService _oSSService,
IRepository<FileUploadRecord> _fileUploadRecordRepository,
IRepository<Dictionary> _dictionaryRepository,
IRepository<Trial> _trialRepository,
IRepository<StudyMonitor> _studyMonitorRepository,
@ -804,8 +803,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
{
await _taskStudyRepository.SaveChangesAsync();
}
await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => t.UploadBatchId == incommand.UploadBatchId, u => new FileUploadRecord() { StudyCode = findStudy.StudyCode });
}
catch (Exception ex)
{
@ -941,9 +938,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
{
//存在ivus 和oct 这两种的项目
if (_readingQuestionCriterionTrialRepository.Where(t => t.TrialId == info.TrialId &&
((t.CriterionType == CriterionType.IVUS || t.CriterionType == CriterionType.OCT) && t.IsConfirm)).Distinct().Count() == 2
&& _noneDicomStudyReposiotry.Where(t => t.SubjectId == inQuery.SubjectId && t.Modality == "IVUS").Count() != _dicomStudyRepository.Where(t => t.SubjectId == inQuery.SubjectId).Select(t => t.SubjectVisitId).Distinct().Count()
)
(t.CriterionType == CriterionType.IVUS || t.CriterionType == CriterionType.OCT)).Distinct().Count() == 2
&& !_noneDicomStudyReposiotry.Any(t => t.SubjectId == inQuery.SubjectId && t.Modality == "IVUS"))
{
#region ivus 自动创建非dicom检查
@ -961,7 +957,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
}).ToListAsync();
var noneDicomStudyVisitIdList = _noneDicomStudyReposiotry.Where(t => t.SubjectId == inQuery.SubjectId && t.Modality == "IVUS").Select(t => t.SubjectVisitId).ToList();
var @lock = _distributedLockProvider.CreateLock($"NoneDicomCode");
@ -972,12 +967,10 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
//默认会是0
var code = await _noneDicomStudyReposiotry.Where(t => t.TrialId == trialId).Select(x => x.Code).DefaultIfEmpty().MaxAsync();
foreach (var g in addList.Where(t => !noneDicomStudyVisitIdList.Contains(t.SubjectVisitId)).GroupBy(t => t.SubjectVisitId))
foreach (var g in addList.GroupBy(t => t.SubjectVisitId))
{
var addOrEditNoneDicomStudy = g.First();
var optEntity = await _noneDicomStudyReposiotry.InsertFromDTOAsync(addOrEditNoneDicomStudy);
optEntity.Code = code + 1;
@ -2585,7 +2578,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
}
/// <summary>
/// 后台任务调用,前端忽略该接口
/// </summary>

View File

@ -29,14 +29,6 @@ namespace IRaCIS.Core.Application.Services
.OrderBy(s => s.InstanceNumber).ThenBy(s => s.InstanceTime).ThenBy(s => s.CreateTime)
.ProjectTo<DicomInstanceDTO>(_mapper.ConfigurationProvider).ToListAsync();
// ⭐ DICOM 空间排序(带兜底)
var sorted = DicomSortHelper.SortSlices(
list,
x => x.ImagePositionPatient,
x => x.ImageOrientationPatient,
x => x.InstanceNumber
);
var seriesInfo = await _instanceRepository.Where(s => s.SeriesId == seriesId).Select(t => new
{
t.DicomSerie.ImageResizePath,
@ -46,7 +38,7 @@ namespace IRaCIS.Core.Application.Services
t.DicomSerie.SubjectVisit.VisitName
}).FirstOrDefaultAsync();
return ResponseOutput.Ok(sorted, seriesInfo);
return ResponseOutput.Ok(list, seriesInfo);
}

View File

@ -8,7 +8,6 @@ using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using Medallion.Threading;
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.Formula.Functions;
@ -78,7 +77,7 @@ namespace IRaCIS.Core.Application.Contracts
//ivus-在访视的时候visitTaskId==null 需要过滤掉空检查 ,但是在靶段标注的查看访视级别的时候不能过滤
if (_subjectVisitRepository.Where(t => t.Id == subjectVisitId).SelectMany(t => t.Trial.TrialReadingCriterionList)
.Where(t => (t.CriterionType == CriterionType.IVUS || t.CriterionType == CriterionType.OCT) && t.IsConfirm).Distinct().Count() == 2
.Where(t => t.CriterionType == CriterionType.IVUS || t.CriterionType == CriterionType.OCT).Distinct().Count() == 2
&& visitTaskId == null)
{
isFilterIVUSNoneDicom = true;
@ -115,7 +114,7 @@ namespace IRaCIS.Core.Application.Contracts
var list = await noneDicomStudyQueryable.Where(t => isFilterIVUSNoneDicom ? t.Modality != "IVUS" : true)
.OrderBy(x => x.ImageDate).ThenBy(x => x.CreateTime).ToListAsync();
var config = await _subjectVisitRepository.Where(t => t.Id == subjectVisitId).Select(t => new { t.Trial.ImageFormatList, t.Trial.StudyNameList, t.Trial.IsShowStudyName, AuditState = qcAuditState, CriterionType = criterionType }).FirstOrDefaultAsync();
var config = await _subjectVisitRepository.Where(t => t.Id == subjectVisitId).Select(t => new { t.Trial.ImageFormatList, t.Trial.StudyNameList, t.Trial.IsShowStudyName, AuditState = qcAuditState, CriterionType=criterionType }).FirstOrDefaultAsync();
return ResponseOutput.Ok(list, config);
}
@ -155,13 +154,6 @@ namespace IRaCIS.Core.Application.Contracts
{
if (addOrEditNoneDicomStudy.Id == Guid.Empty || addOrEditNoneDicomStudy.Id == null)
{
if (_subjectVisitRepository.Where(t => t.Id == addOrEditNoneDicomStudy.SubjectVisitId).SelectMany(t => t.Trial.TrialReadingCriterionList)
.Where(t => (t.CriterionType == CriterionType.IVUS || t.CriterionType == CriterionType.OCT) && t.IsConfirm).Distinct().Count() == 2 && addOrEditNoneDicomStudy.Modality != "OCT")
{
throw new BusinessValidationFailedException(_localizer["NoneDicomStudy_OnlyNeedOCT"]);
}
//默认会是0
var code = await _noneDicomStudyRepository.Where(t => t.TrialId == addOrEditNoneDicomStudy.TrialId).Select(x => x.Code).DefaultIfEmpty().MaxAsync();

View File

@ -46,23 +46,13 @@ namespace IRaCIS.Core.Application.Services
var instanceList = await _scpInstanceRepository.Where(s => s.StudyId == studyId).IgnoreQueryFilters()
.OrderBy(t => t.SeriesId).ThenBy(t => t.InstanceNumber)
.ThenBy(s => s.InstanceTime).ThenBy(s => s.CreateTime)
.Select(t => new { t.SeriesId, t.Id, t.Path, t.NumberOfFrames, t.InstanceNumber, t.FileSize, t.ImagePositionPatient, t.ImageOrientationPatient }).ToListAsync();//.GroupBy(u => u.SeriesId);
.Select(t => new { t.SeriesId, t.Id, t.Path, t.NumberOfFrames, t.InstanceNumber, t.FileSize }).ToListAsync();//.GroupBy(u => u.SeriesId);
foreach (var series in seriesList)
{
var instances = instanceList.Where(x => x.SeriesId == series.Id);
// ⭐ DICOM 空间排序(带兜底)
var sorted = DicomSortHelper.SortSlices(
instances,
x => x.ImagePositionPatient,
x => x.ImageOrientationPatient,
x => x.InstanceNumber
);
series.InstanceInfoList = sorted.Select(k =>
series.InstanceInfoList = instanceList.Where(t => t.SeriesId == series.Id).OrderBy(t => t.InstanceNumber).Select(k =>
new InstanceBasicInfo()
{
Id = k.Id,

View File

@ -20,7 +20,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
IRepository<Trial> _trialRepository,
IRepository<VisitTask> _visitTaskRepository,
IRepository<SCPStudy> _scpStudyRepository,
IRepository<FileUploadRecord> _fileUploadRecordRepository,
IRepository<Subject> _subjectRepository,
IRepository<StudyMonitor> _studyMonitorRepository,
IRepository<SystemAnonymization> _systemAnonymizationRepository,
@ -333,8 +332,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
{
await _dicomInstanceRepository.SaveChangesAsync();
}
await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => t.UploadBatchId == incommand.UploadBatchId, u => new FileUploadRecord() { StudyCode = findStudy.StudyCode });
}
catch (Exception ex)
{

View File

@ -260,11 +260,6 @@ namespace IRaCIS.Core.Application.Service.Inspection.DTO
public bool obtaionOrCancel { get; set; }
}
public class UpdateReadModuleClinicalDataInDto
{
public Guid ReadingClinicalDataId { get; set; }
}
public class ReadingClinicalDataSignIndto
{
/// <summary>

View File

@ -60,8 +60,6 @@ namespace IRaCIS.Core.Application.Contracts
public string[]? VisitPlanArray { get; set; }
public bool? IsSubjectQuit { get; set; }
public SubjectStatus? SubjectStatus { get; set; }
}
public class GetNextQCInfoInDto
@ -100,8 +98,6 @@ namespace IRaCIS.Core.Application.Contracts
public DateTime? EndAuditTime { get; set; }
public SubjectStatus? SubjectStatus { get; set; }
public bool? IsSubjectQuit { get; set; }
}

View File

@ -85,7 +85,6 @@ namespace IRaCIS.Core.Application.Image.QA
var svExpression = QCCommon.GetSubjectVisitFilter(inQuery.VisitPlanArray);
var query = _subjectVisitRepository.Where(x => x.TrialId == inQuery.TrialId)
.WhereIf(inQuery.SubjectStatus != null, t => t.Subject.Status == inQuery.SubjectStatus)
.Where(t => !(t.Subject.Status == SubjectStatus.EndOfVisit && t.SubmitState == SubmitStateEnum.None && !t.Subject.SubjectVisitList.Any(c => c.VisitNum > t.VisitNum && c.SubmitState > SubmitStateEnum.None)))
.Where(t => t.Subject.FinalSubjectVisitId != null ? t.VisitNum <= t.Subject.FinalSubjectVisit.VisitNum : true)
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId)
@ -281,7 +280,6 @@ namespace IRaCIS.Core.Application.Image.QA
.WhereIf(inQuery.ChallengeState != null, t => t.ChallengeState == inQuery.ChallengeState)
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.SubjectId != null, t => t.Subject.Id == inQuery.SubjectId)
.WhereIf(inQuery.SubjectStatus != null, t => t.Subject.Status == inQuery.SubjectStatus)
.WhereIf(inQuery.IsSubjectQuit != null, t => t.Subject.IsSubjectQuit == inQuery.IsSubjectQuit)
.WhereIf(!string.IsNullOrEmpty(inQuery.SubjectInfo), t => /*t.Subject.FirstName.Contains(subjectInfo) || t.Subject.LastName.Contains(subjectInfo) ||*/ t.Subject.Code.Contains(inQuery.SubjectInfo))
.WhereIf(inQuery.VisitPlanArray != null && inQuery.VisitPlanArray?.Length > 0, svExpression)

View File

@ -372,34 +372,6 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.Result(result);
}
/// <summary>
/// 修改临床数据后 将签名状态变更为未签名
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> UpdateReadModuleClinicalData(UpdateReadModuleClinicalDataInDto inDto)
{
var data = await _readingClinicalDataRepository.FirstOrDefaultAsync(t => t.Id == inDto.ReadingClinicalDataId);
await _readingClinicalDataRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.ReadingClinicalDataId, x => new ReadingClinicalData()
{
IsSign = false,
ReadingClinicalDataState = ReadingClinicalDataStatus.HaveUploaded
});
var result = await _readModuleRepository.Where(x=>x.Id== data.ReadingId).Include(x=>x.SubjectVisit).FirstNotNullAsync();
await _visitTaskRepository.UpdatePartialFromQueryAsync(x => x.TrialReadingCriterionId == result.TrialReadingCriterionId && x.VisitTaskNum > result.SubjectVisit.VisitNum, x => new VisitTask()
{
IsFrontTaskNeedSignButNotSign = false,
});
await _visitTaskRepository.SaveChangesAsync();
return ResponseOutput.Result(true);
}
///// <summary>
///// 一致性分析的临床数据
///// </summary>

View File

@ -208,30 +208,25 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public class IVUSMeasuredValue
{
///// <summary>
///// 斑块编号
///// </summary>
//public int PlaqueNum { get; set; }
/// <summary>
/// 帧数
/// 斑块编号
/// </summary>
public string FrameNumber { get; set; }
public int PlaqueNum { get; set; }
/// <summary>
/// 外弹力膜面积Emm
/// </summary>
public decimal? Emm { get; set; }
public decimal Emm { get; set; }
/// <summary>
/// 管腔面积Lumen
/// </summary>
public decimal? Lumen { get; set; }
public decimal Lumen { get; set; }
/// <summary>
/// 外弹力膜面积- 管腔面积
/// </summary>
public decimal? EmmSubtractionLumen
public decimal EmmSubtractionLumen
{
get
{
@ -250,24 +245,24 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public class OCTFCTUploadData
{
/// <summary>
/// 帧数
/// 斑块编号
/// </summary>
public string FrameNumber { get; set; }
public int PlaqueNum { get; set; }
/// <summary>
/// 第一次
/// </summary>
public decimal? FirstData { get; set; }
public decimal FirstData { get; set; }
/// <summary>
/// 第二次
/// </summary>
public decimal? SecondData { get; set; }
public decimal SecondData { get; set; }
/// <summary>
/// 第三次
/// </summary>
public decimal? ThirdData { get; set; }
public decimal ThirdData { get; set; }
/// <summary>
/// 巨噬细胞浸润测量
@ -295,27 +290,13 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public decimal? LumenAreaMeasurement { get; set; }
/// <summary>
/// 脂质角度
/// </summary>
public decimal? LipidAngle { get; set; }
public decimal? Avg
{
get
{
var values = new[] { FirstData, SecondData, ThirdData };
var count = values.Count(x => x.HasValue);
if (count == 0)
{
return null;
}
var avg = values.Where(x => x.HasValue).Select(x => x.Value).Average();
return avg;
}
}
public decimal Avg { get {
return ( FirstData + SecondData + ThirdData) / 3;
} }
}

View File

@ -203,27 +203,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public Guid TaskMedicalReviewId { get; set; }
}
public class CloseAndFinishMedicalReview
{
public Guid TaskMedicalReviewId { get; set; }
/// <summary>
/// 是否关闭
/// </summary>
public bool IsClosedDialog { get; set; }
/// <summary>
/// 医学审核对话关闭原因
/// </summary>
public MedicalDialogClose MedicalDialogCloseEnum { get; set; }
/// <summary>
/// 对话关闭原因
/// </summary>
public string DialogCloseReason { get; set; } = string.Empty;
}
public class JointMedicalReviewI18n
{
/// <summary>

View File

@ -324,11 +324,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public ImageMark? ImageMarkEnum { get; set; }
/// <summary>
/// 影像标记类型
/// </summary>
public ImageMarkType? ImageMarkTypeEnum { get; set; }
/// <summary>
/// 是否预设
@ -988,11 +983,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public ImageMark? ImageMarkEnum { get; set; }
/// <summary>
/// 影像标记类型
/// </summary>
public ImageMarkType? ImageMarkTypeEnum { get; set; }
public string QuestionGroupName { get; set; }
public string QuestionGroupEnName { get; set; }
@ -2473,11 +2463,6 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
/// </summary>
public ImageMark? ImageMarkEnum { get; set; }
/// <summary>
/// 影像标记类型
/// </summary>
public ImageMarkType? ImageMarkTypeEnum { get; set; }
/// <summary>
/// 影像工具
/// </summary>

View File

@ -1,92 +0,0 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2026-03-19 07:13:41Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel;
public class SegmentBindingView : SegmentBindingAddOrEdit
{
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
/// <summary>
/// 分割分组名称
/// </summary>
public string SegmentationName { get; set; } = string.Empty;
/// <summary>
/// SegmentName
/// </summary>
public string SegmentName { get; set; } = string.Empty;
}
public class SaveSegmentBindingAndAnswerInDto
{
public Guid VisitTaskId { get; set; }
public List<SaveSegmentBindingDto> BindingList { get; set; }
}
public class SaveSegmentBindingDto
{
public string Answer { get; set; }
public Guid? QuestionId { get; set; }
public Guid? RowId { get; set; }
public Guid? SegmentId { get; set; }
public Guid? SegmentationId { get; set; }
public Guid? TableQuestionId { get; set; }
public Guid VisitTaskId { get; set; }
}
public class SegmentBindingAddOrEdit
{
public Guid? Id { get; set; }
public Guid? QuestionId { get; set; }
public Guid? RowId { get; set; }
public Guid SegmentId { get; set; }
public Guid SegmentationId { get; set; }
public Guid? TableQuestionId { get; set; }
public Guid VisitTaskId { get; set; }
}
public class SegmentBindingQuery:PageInput
{
public Guid? QuestionId { get; set; }
public Guid? Id { get; set; }
public Guid? RowId { get; set; }
public Guid? SegmentId { get; set; }
public Guid? SegmentationId { get; set; }
public Guid? TableQuestionId { get; set; }
public Guid? VisitTaskId { get; set; }
}

View File

@ -1,105 +0,0 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2026-03-10 05:44:27Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using IRaCIS.Core.Domain.Share;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.ViewModel;
public class SegmentView : SegmentAddOrEdit
{
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
}
public class SegmentAddOrEdit
{
public Guid? Id { get; set; }
public decimal? AvgValue { get; set; }
public string ColorRgb { get; set; }
public decimal? MTV { get; set; }
public decimal? MajorAxis { get; set; }
public decimal? MaxValue { get; set; }
public decimal? Median { get; set; }
public decimal? MinValue { get; set; }
public decimal? Peak { get; set; }
public int SegmentNumber { get; set; }
public string SegmentName { get; set; }
public Guid SegmentationId { get; set; }
public decimal? ShortAxis { get; set; }
public decimal? TLG { get; set; }
public decimal? Variance { get; set; }
public decimal? Volume { get; set; }
public Guid VisitTaskId { get; set; }
/// <summary>
/// 分割的Json
/// </summary>
public string SegmentJson { get; set; } = string.Empty;
}
public class SegmentQuery:PageInput
{
public decimal? AvgValue { get; set; }
public string? ColorRgb { get; set; }
public decimal? MTV { get; set; }
public decimal? MajorAxis { get; set; }
public decimal? MaxValue { get; set; }
public decimal? Median { get; set; }
public decimal? MinValue { get; set; }
public decimal? Peak { get; set; }
public int? SegmentNumber { get; set; }
public string? SegmentName { get; set; }
public Guid? SegmentationId { get; set; }
public Guid? Id { get; set; }
public Guid? VisitTaskId { get; set; }
public decimal? ShortAxis { get; set; }
public decimal? TLG { get; set; }
public decimal? Variance { get; set; }
public decimal? Volume { get; set; }
}

View File

@ -1,84 +0,0 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2026-03-10 06:17:31Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel;
public class SegmentationView : SegmentationAddOrEdit
{
/// <summary>
/// 是否保存
/// </summary>
public bool IsSaved { get; set; } = false;
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
}
public class ChangeSegmentationSavedStatusInDto
{
public Guid Id { get; set; }
/// <summary>
/// 是否保存
/// </summary>
public bool IsSaved { get; set; } = false;
}
public class SegmentationAddOrEdit
{
public Guid? Id { get; set; }
public string SEGUrl { get; set; }
public string SegmentationJson { get; set; }
public string SegmentationName { get; set; }
public Guid SeriesId { get; set; }
public Guid StudyId { get; set; }
public Guid SubjectId { get; set; }
public Guid SubjectVisitId { get; set; }
public Guid TrialId { get; set; }
public Guid VisitTaskId { get; set; }
}
public class SegmentationQuery:PageInput
{
public string? SEGUrl { get; set; }
public string? SegmentationJson { get; set; }
public string? SegmentationName { get; set; }
public Guid? Id { get; set; }
public Guid? SeriesId { get; set; }
public Guid? StudyId { get; set; }
public Guid? SubjectId { get; set; }
public Guid? SubjectVisitId { get; set; }
public Guid? TrialId { get; set; }
public Guid? VisitTaskId { get; set; }
}

View File

@ -9,7 +9,5 @@ namespace IRaCIS.Core.Application.Contracts
{
Task<IResponseOutput> FinishMedicalReview(FinishMedicalReviewInDto inDto);
Task<IResponseOutput> ClosedMedicalReviewDialog(ClosedMedicalReviewDialogInDto inDto);
}
}

View File

@ -1,36 +0,0 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2026-03-10 06:17:31Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using System;
using IRaCIS.Core.Infrastructure.Extention;
using System.Threading.Tasks;
using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Interfaces;
public interface ISegmentationService
{
Task<PageOutput<SegmentationView>> GetSegmentationList(SegmentationQuery inQuery);
Task<IResponseOutput> AddOrUpdateSegmentation(SegmentationAddOrEdit addOrEditSegmentation);
Task<IResponseOutput> DeleteSegmentation(Guid segmentationId);
Task<PageOutput<SegmentView>> GetSegmentList(SegmentQuery inQuery);
Task<IResponseOutput> AddOrUpdateSegment(SegmentAddOrEdit addOrEditSegment);
Task<IResponseOutput> DeleteSegment(Guid segmentId);
Task<PageOutput<SegmentBindingView>> GetSegmentBindingList(SegmentBindingQuery inQuery);
Task<IResponseOutput> AddOrUpdateSegmentBinding(SegmentBindingAddOrEdit addOrEditSegmentBinding);
Task<IResponseOutput> DeleteSegmentBinding(Guid segmentBindingId);
}

View File

@ -1,4 +1,4 @@
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
@ -787,7 +787,7 @@ namespace IRaCIS.Core.Application.Service
.Select(x => new GetTrialGroupNameOutDto
{
GroupId = x.Id,
GroupName =_userInfo.IsEn_Us?x.GroupEnName: x.GroupName,
GroupName = x.GroupName,
}).ToListAsync();
return result;
@ -1485,9 +1485,7 @@ namespace IRaCIS.Core.Application.Service
toolList = toolList.Distinct().ToList();
var alltool = trialCriterion.ReadingToolList.Union(trialCriterion.SegmentToolList).ToList();
if (tabletoolList.Except(alltool).Count() > 0)
if (tabletoolList.Except(trialCriterion.ReadingToolList).Count() > 0)
{
//---问题的阅片工具不在标准配置的阅片工具列表中
throw new BusinessValidationFailedException(_localizer["TrialConfig_TableToolNotInStdTool"]);
@ -1782,28 +1780,5 @@ namespace IRaCIS.Core.Application.Service
#endregion
/// <summary>
/// 根据项目问题id获取项目问题信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost]
public async Task<ReadingQuestionTrialView> GetReadingQuestionTrialById(Guid id)
{
var result = await _readingQuestionTrialRepository.Where(x => x.Id == id).ProjectTo<ReadingQuestionTrialView>(_mapper.ConfigurationProvider).FirstNotNullAsync();
return result;
}
/// <summary>
/// 根据项目表格问题id获取项目表格问题信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost]
public async Task<ReadingTableQuestionTrialView> GetReadingTableQuestionTrialById(Guid id)
{
var result = await _readingTableQuestionTrialRepository.Where(x => x.Id == id).ProjectTo<ReadingTableQuestionTrialView>(_mapper.ConfigurationProvider).FirstNotNullAsync();
return result;
}
}
}

View File

@ -44,7 +44,6 @@ namespace IRaCIS.Core.Application.Service
IRepository<UserLog> _userLogRepository,
IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository,
IRepository<ReadingOncologyTaskInfo> _readingOncologyTaskInfoRepository,
IRepository<Segmentation> _segmentationRepository,
IVisitTaskHelpeService _visitTaskHelpeService,
IVisitTaskService _visitTaskService,
IReadingClinicalDataService _readingClinicalDataService,
@ -3372,12 +3371,6 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.NotOk(_localizer["ReadingImage_BackImageNotExist"]);
}
}
if (await _segmentationRepository.AnyAsync(x => !x.IsSaved && x.VisitTaskId == inDto.VisitTaskId))
{
throw new BusinessValidationFailedException(_localizer["ReadingImage_SegmentationNeedSave"]);
}
await VerifyTaskIsSign(inDto.VisitTaskId);
await VerifyDefaultQuestionBeAnswer(inDto);
@ -3414,8 +3407,6 @@ namespace IRaCIS.Core.Application.Service
throw new BusinessValidationFailedException(_localizer["ReadingImage_RequiredQuestion", string.Join(',', readingQuestionList.Select(x => x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us)))]);
}
// 各个标准不同
await _readingCalculateService.VerifyVisitTaskQuestions(inDto);

View File

@ -1,375 +0,0 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2026-03-10 06:17:28Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using IRaCIS.Core.Domain.Models;
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Infrastructure.Extention;
using System.Threading.Tasks;
using IRaCIS.Core.Infra.EFCore;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore;
namespace IRaCIS.Core.Application.Service;
/// <summary>
/// 分割
/// </summary>
/// <param name="_segmentationRepository"></param>
/// <param name="_mapper"></param>
/// <param name="_userInfo"></param>
/// <param name="_localizer"></param>
[ ApiExplorerSettings(GroupName = "Reading")]
public class SegmentationService(IRepository<Segmentation> _segmentationRepository,
IRepository<SegmentBinding> _segmentBindingRepository,
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository,
IRepository<VisitTask> _visitTaskRepository,
IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository,
IRepository<ReadingTableQuestionAnswer> _readingTableQuestionAnswerRepository,
IRepository<Segment> _segmentRepository,
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer): BaseService, ISegmentationService
{
/// <summary>
/// 获取分割组
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<SegmentationView>> GetSegmentationList(SegmentationQuery inQuery)
{
var segmentationQueryable =_segmentationRepository
.WhereIf(inQuery.SegmentationName.IsNotNullOrEmpty(),x=>x.SegmentationName.Contains(inQuery.SegmentationName))
.WhereIf(inQuery.Id != null, x => x.Id == inQuery.Id)
.WhereIf(inQuery.TrialId != null, x => x.TrialId == inQuery.TrialId)
.WhereIf(inQuery.SeriesId != null, x => x.SeriesId == inQuery.SeriesId)
.WhereIf(inQuery.StudyId != null, x => x.StudyId == inQuery.StudyId)
.WhereIf(inQuery.SubjectId != null, x => x.SubjectId == inQuery.SubjectId)
.WhereIf(inQuery.SubjectVisitId != null, x => x.SubjectVisitId == inQuery.SubjectVisitId)
.WhereIf(inQuery.VisitTaskId != null, x => x.VisitTaskId == inQuery.VisitTaskId)
.ProjectTo<SegmentationView>(_mapper.ConfigurationProvider);
var pageList= await segmentationQueryable.ToPagedListAsync(inQuery);
return pageList;
}
/// <summary>
/// 新增修改分割组
/// </summary>
/// <param name="addOrEditSegmentation"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> AddOrUpdateSegmentation(SegmentationAddOrEdit addOrEditSegmentation)
{
var entity = await _segmentationRepository.InsertOrUpdateAsync(addOrEditSegmentation, true);
return ResponseOutput.Ok(entity.Id.ToString());
}
/// <summary>
/// 删除分割组
/// </summary>
/// <param name="segmentationId"></param>
/// <returns></returns>
[HttpDelete("{segmentationId:guid}")]
public async Task<IResponseOutput> DeleteSegmentation(Guid segmentationId)
{
await DeleteBindingsAndAnswersAsync(segmentationId, null);
var success = await _segmentationRepository.DeleteFromQueryAsync(t => t.Id == segmentationId,true);
return ResponseOutput.Ok();
}
/// <summary>
/// 修改分割组的保存状态
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> ChangeSegmentationSavedStatus(ChangeSegmentationSavedStatusInDto inDto)
{
await _segmentationRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.Id, t => new Segmentation
{
IsSaved = inDto.IsSaved
});
await _segmentationRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
/// <summary>
/// 获取分割
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<SegmentView>> GetSegmentList(SegmentQuery inQuery)
{
var segmentQueryable = _segmentRepository
.WhereIf(inQuery.SegmentationId != null, x => x.SegmentationId == inQuery.SegmentationId)
.WhereIf(inQuery.SegmentName.IsNotNullOrEmpty(), x => x.SegmentName.Contains(inQuery.SegmentName))
.WhereIf(inQuery.VisitTaskId != null, x => x.VisitTaskId == inQuery.VisitTaskId)
.WhereIf(inQuery.Id != null, x => x.Id == inQuery.Id)
.ProjectTo<SegmentView>(_mapper.ConfigurationProvider);
var pageList = await segmentQueryable.ToPagedListAsync(inQuery,nameof(SegmentView.SegmentNumber));
return pageList;
}
/// <summary>
/// 新增修改分割
/// </summary>
/// <param name="addOrEditSegment"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> AddOrUpdateSegment(SegmentAddOrEdit addOrEditSegment)
{
var entity = await _segmentRepository.InsertOrUpdateAsync(addOrEditSegment, true);
return ResponseOutput.Ok(entity.Id.ToString());
}
/// <summary>
/// 删除分割
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpDelete("{segmentId:guid}")]
public async Task<IResponseOutput> DeleteSegment(Guid segmentId)
{
await DeleteBindingsAndAnswersAsync(null, segmentId);
var success = await _segmentRepository.DeleteFromQueryAsync(t => t.Id == segmentId, true);
return ResponseOutput.Ok();
}
/// <summary>
/// 获取分割绑定
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<SegmentBindingView>> GetSegmentBindingList(SegmentBindingQuery inQuery)
{
var segmentBindingQueryable = _segmentBindingRepository
.WhereIf(inQuery.Id != null, x => x.Id == inQuery.Id)
.WhereIf(inQuery.QuestionId != null, x => x.QuestionId == inQuery.QuestionId)
.WhereIf(inQuery.RowId != null, x => x.RowId == inQuery.RowId)
.WhereIf(inQuery.SegmentId != null, x => x.SegmentId == inQuery.SegmentId)
.WhereIf(inQuery.SegmentationId != null, x => x.SegmentationId == inQuery.SegmentationId)
.WhereIf(inQuery.TableQuestionId != null, x => x.TableQuestionId == inQuery.TableQuestionId)
.WhereIf(inQuery.VisitTaskId != null, x => x.VisitTaskId == inQuery.VisitTaskId)
.ProjectTo<SegmentBindingView>(_mapper.ConfigurationProvider);
var pageList = await segmentBindingQueryable.ToPagedListAsync(inQuery);
return pageList;
}
/// <summary>
/// 新增修改分割绑定
/// </summary>
/// <param name="addOrEditSegmentBinding"></param>
/// <returns></returns>
public async Task<IResponseOutput> AddOrUpdateSegmentBinding(SegmentBindingAddOrEdit addOrEditSegmentBinding)
{
var entity = await _segmentBindingRepository.InsertOrUpdateAsync(addOrEditSegmentBinding, true);
return ResponseOutput.Ok(entity.Id.ToString());
}
/// <summary>
/// 删除分割
/// </summary>
/// <param name="segmentBindingId"></param>
/// <returns></returns>
[HttpDelete("{segmentBindingId:guid}")]
public async Task<IResponseOutput> DeleteSegmentBinding(Guid segmentBindingId)
{
var success = await _segmentBindingRepository.DeleteFromQueryAsync(t => t.Id == segmentBindingId, true);
return ResponseOutput.Ok();
}
/// <summary>
/// 保存分割绑定和答案
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<IResponseOutput> SaveSegmentBindingAndAnswer(SaveSegmentBindingAndAnswerInDto inDto)
{
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId)
.FirstNotNullAsync();
foreach (var item in inDto.BindingList)
{
// 处理绑定关系
var binding = await _segmentBindingRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId && x.QuestionId == item.QuestionId && x.RowId == item.RowId && x.TableQuestionId == item.TableQuestionId)
.FirstOrDefaultAsync();
if (binding == null)
{
if (item.SegmentationId != null && item.SegmentId != null)
{
await _segmentBindingRepository.InsertFromDTOAsync(new SegmentBinding
{
VisitTaskId = inDto.VisitTaskId,
QuestionId = item.QuestionId,
RowId = item.RowId,
TableQuestionId = item.TableQuestionId,
SegmentId = item.SegmentId.Value,
SegmentationId = item.SegmentationId.Value,
});
}
}
else
{
if (item.SegmentationId != null && item.SegmentId != null)
{
await _segmentBindingRepository.UpdatePartialFromQueryAsync(x => x.Id == binding.Id, t => new SegmentBinding
{
SegmentId = item.SegmentId.Value,
SegmentationId = item.SegmentationId.Value,
});
}
else
{
await _segmentBindingRepository.DeleteFromQueryAsync(x => x.Id == binding.Id);
}
}
// 处理问题
if (item.RowId != null && item.TableQuestionId != null&&item.QuestionId!=null)
{
var answer = await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId&&x.QuestionId==item.QuestionId && x.RowId == item.RowId && x.TableQuestionId == item.TableQuestionId)
.FirstOrDefaultAsync();
var rowinfo= await _readingTableAnswerRowInfoRepository.Where(x => x.Id==item.RowId)
.Include(x=>x.VisitTask)
.FirstNotNullAsync();
if (answer != null)
{
await _readingTableQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => x.Id == answer.Id, t => new ReadingTableQuestionAnswer
{
Answer = item.Answer
});
}
else
{
await _readingTableQuestionAnswerRepository.InsertFromDTOAsync(new ReadingTableQuestionAnswer
{
VisitTaskId = inDto.VisitTaskId,
RowId = item.RowId.Value,
QuestionId=item.QuestionId.Value,
TableQuestionId = item.TableQuestionId.Value,
Answer = item.Answer,
TrialId= rowinfo.VisitTask.TrialId,
RowIndex= rowinfo.RowIndex,
});
}
}
else
{
var answer = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId &&x.ReadingQuestionTrialId==item.QuestionId)
.FirstOrDefaultAsync();
if (answer != null)
{
await _readingTaskQuestionAnswerRepository.UpdatePartialFromQueryAsync(x => x.Id == answer.Id, t => new ReadingTaskQuestionAnswer
{
Answer = item.Answer
});
}
else
{
await _readingTaskQuestionAnswerRepository.InsertFromDTOAsync(new ReadingTaskQuestionAnswer
{
ReadingQuestionTrialId= item.QuestionId.Value,
ReadingQuestionCriterionTrialId=taskinfo.TrialReadingCriterionId,
TrialId= taskinfo.TrialId,
SubjectId= taskinfo.SubjectId,
VisitTaskId = inDto.VisitTaskId,
Answer=item.Answer,
});
}
}
}
await _segmentationRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
/// <summary>
/// 删除分割组和分割时的关联数据删除逻辑
/// </summary>
/// <param name="segmentationId"></param>
/// <param name="segmentId"></param>
/// <returns></returns>
private async Task DeleteBindingsAndAnswersAsync(Guid? segmentationId, Guid? segmentId)
{
var bindingsQuery = _segmentBindingRepository
.WhereIf(segmentationId != null, x => x.SegmentationId == segmentationId)
.WhereIf(segmentId != null, x => x.SegmentId == segmentId);
var bindings = await bindingsQuery.ToListAsync();
foreach (var binding in bindings)
{
// 处理问题
if (binding.RowId != null && binding.TableQuestionId != null)
{
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == binding.VisitTaskId && x.RowId == binding.RowId && x.TableQuestionId == binding.TableQuestionId);
}
else if (binding.QuestionId != null)
{
await _readingTaskQuestionAnswerRepository.DeleteFromQueryAsync(x => x.VisitTaskId == binding.VisitTaskId && x.ReadingQuestionTrialId == binding.QuestionId);
}
}
// 处理绑定关系
if (segmentationId != null)
{
await _segmentBindingRepository.DeleteFromQueryAsync(x => x.SegmentationId == segmentationId);
}
else if (segmentId != null)
{
await _segmentBindingRepository.DeleteFromQueryAsync(x => x.SegmentId == segmentId);
}
}
}

View File

@ -15,23 +15,6 @@ namespace IRaCIS.Core.Application.Service
//是否英文环境
var isEn_Us = false;
// 在此处拷贝automapper 映射
CreateMap<Segment, SegmentView>();
CreateMap<Segment, SegmentAddOrEdit>().ReverseMap();
// 在此处拷贝automapper 映射
CreateMap<Segmentation, SegmentationView>();
CreateMap<Segmentation, SegmentationAddOrEdit>().ReverseMap();
// 在此处拷贝automapper 映射
CreateMap<SegmentBinding, SegmentBindingView>()
.ForMember(d => d.SegmentName, u => u.MapFrom(s => s.Segment.SegmentName))
.ForMember(d => d.SegmentationName, u => u.MapFrom(s => s.Segmentation.SegmentationName));
CreateMap<SegmentBinding, SegmentBindingAddOrEdit>().ReverseMap();
CreateMap<ReadingQuestionTrial, ReadingReportDto>()
.ForMember(d => d.QuestionId, u => u.MapFrom(s => s.Id));

View File

@ -1,7 +1,6 @@
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
@ -48,7 +47,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <param name="needChangeType"></param>
/// <returns></returns>
public async Task<List<ReadingReportDto>> GetReadingReportQuestion(
List<ReadingQuestionTrial>? questionList,
List<ReadingQuestionTrial>? questionList,
List<VisitTaskInfo> taskInfoList,
List<Globalanswer>? globalanswerList,
List<ReadingTaskQuestionAnswer>? answers,
@ -218,7 +217,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// 复制既往新病灶答案
/// </summary>
/// <returns></returns>
public async Task CopyHistoryAnswer(VisitTask taskinfo, List<ReadingTableAnswerRowInfo> tableRowList, List<ReadingTableQuestionAnswer> tableAnswerList)
public async Task CopyHistoryAnswer(VisitTask taskinfo, List<ReadingTableAnswerRowInfo> tableRowList,List<ReadingTableQuestionAnswer> tableAnswerList)
{
if (_userInfo.RequestUrl == "ReadingImageTask/resetReadingTask")
{
@ -227,16 +226,16 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
if (taskinfo.IsCopyLesionAnswer)
{
var historyTaskId = await _visitTaskRepository.Where(x =>
var historyTaskId = await _visitTaskRepository.Where(x =>
x.ReadingCategory == ReadingCategory.Visit &&
x.TrialReadingCriterionId == taskinfo.TrialReadingCriterionId &&
x.IsAnalysisCreate == taskinfo.IsAnalysisCreate &&
x.DoctorUserId == taskinfo.DoctorUserId &&
x.IsSelfAnalysis == taskinfo.IsSelfAnalysis &&
x.SubjectId == taskinfo.SubjectId &&
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
x.VisitTaskNum == taskinfo.VisitTaskNum &&
x.TaskState != TaskState.Effect &&
x.SubjectId == taskinfo.SubjectId &&
x.ReadingTaskState == ReadingTaskState.HaveSigned &&
x.VisitTaskNum == taskinfo.VisitTaskNum &&
x.TaskState != TaskState.Effect &&
x.ArmEnum == taskinfo.ArmEnum)
.OrderByDescending(x => x.SignTime)
.Select(x => x.Id).FirstOrDefaultAsync();
@ -252,9 +251,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var answerList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
var questionMarkList = await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
var noneDicomMarkList = await _readingNoneDicomMarkRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
var noneDicomMarkBindingList = await _readingNoneDicomMarkBindingRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
var questionMarkList=await _readingTaskQuestionMarkRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
var noneDicomMarkList=await _readingNoneDicomMarkRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
var noneDicomMarkBindingList=await _readingNoneDicomMarkBindingRepository.Where(x => x.VisitTaskId == historyTaskId).ToListAsync();
foreach (var item in tableRowList)
{
@ -262,32 +261,32 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
continue;
}
var historyRow = historyTableRowList.Where(x =>
x.QuestionId == item.QuestionId &&
x.RowIndex == item.RowIndex &&
x.IdentityRowId == item.IdentityRowId &&
x.IdentityRowId != null &&
x.OrganInfoId == item.OrganInfoId
var historyRow = historyTableRowList.Where(x =>
x.QuestionId == item.QuestionId &&
x.RowIndex == item.RowIndex &&
x.IdentityRowId==item.IdentityRowId &&
x.IdentityRowId !=null &&
x.OrganInfoId==item.OrganInfoId
).FirstOrDefault();
if (historyRow != null)
{
item.StudyId = historyRow.StudyId;
item.SeriesId = historyRow.SeriesId;
item.InstanceId = historyRow.InstanceId;
item.StudyId= historyRow.StudyId;
item.SeriesId= historyRow.SeriesId;
item.InstanceId= historyRow.InstanceId;
item.OtherStudyId = historyRow.OtherStudyId;
item.OtherSeriesId = historyRow.OtherSeriesId;
item.OtherInstanceId = historyRow.OtherInstanceId;
item.OtherInstanceId= historyRow.OtherInstanceId;
item.MeasureData = historyRow.MeasureData.Replace(historyTaskId.ToString(), taskinfo.Id.ToString());
item.MeasureData= historyRow.MeasureData.Replace(historyTaskId.ToString(),taskinfo.Id.ToString());
item.OtherMeasureData = historyRow.OtherMeasureData.Replace(historyTaskId.ToString(), taskinfo.Id.ToString());
tableAnswerList.Where(x => x.RowId == item.Id).ForEach(x =>
{
x.Answer = x.Answer.IsNullOrEmpty() ?
historyTableAnswerList.Where(y => y.RowId == historyRow.Id && y.TableQuestionId == x.TableQuestionId).Select(x => x.Answer).FirstOrDefault() ?? string.Empty :
historyTableAnswerList.Where(y => y.RowId == historyRow.Id && y.TableQuestionId == x.TableQuestionId).Select(x => x.Answer).FirstOrDefault()??string.Empty :
x.Answer;
});
@ -305,7 +304,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 处理标记
Dictionary<Guid, Guid> dicomKeys = new Dictionary<Guid, Guid>();
Dictionary<Guid,Guid> dicomKeys=new Dictionary<Guid, Guid> ();
foreach (var item in questionMarkList)
{
@ -337,7 +336,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
Dictionary<Guid, Guid> noneKeys = new Dictionary<Guid, Guid>();
foreach (var item in noneDicomMarkList)
{
var newid = NewId.NextGuid();
var newid= NewId.NextGuid();
item.VisitTaskId = taskinfo.Id;
if (item.MarkId != null)
@ -373,7 +372,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
}
}
#endregion
@ -389,17 +388,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
}
}
/// <summary>
/// 从上传文件中获取Datatable
/// </summary>
/// <returns></returns>
public async Task<FileToDataTableDto> GetDataTableFromUpload(IFormFile file, string pathCode, Guid trialId)
public async Task<FileToDataTableDto> GetDataTableFromUpload(IFormFile file,string pathCode,Guid trialId)
{
FileToDataTableDto result = new FileToDataTableDto();
FileToDataTableDto result=new FileToDataTableDto ();
result.DataTable = new DataTable();
var fileFolder = "Upload\\";
@ -420,7 +419,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
file.CopyTo(stream);
await stream.CopyToAsync(fileStream);
result.SheetNames = stream.GetSheetNames();
result.SheetNames= stream.GetSheetNames();
stream.Position = 0;
result.DataTable = stream.QueryAsDataTable(useHeaderRow: false);
}
@ -433,15 +432,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
try
{
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, $"{trialId}/InspectionUpload/" + pathCode, file.FileName, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = trialId, BatchDataType = BatchDataType.ReadingImportTemplete });
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, "InspectionUpload/"+ pathCode, file.FileName);
await _inspectionFileRepository.AddAsync(new InspectionFile() { FileName = file.FileName, RelativePath = ossRelativePath, TrialId = trialId });
}
catch (Exception)
{
}
@ -458,7 +457,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 遍历每一列,检查值
foreach (var item in row.ItemArray)
{
if (item != null && !item.ToString().IsNullOrEmpty())
if (item!=null&&!item.ToString().IsNullOrEmpty())
{
allEmpty = false;
break; // 只要有一个不为空,跳出循环
@ -533,7 +532,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <returns></returns>
public async Task<ReadingCalculateDto> GetReadingCalculateDto(Guid visitTaskId)
{
var visitTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.SourceSubjectVisit).FirstNotNullAsync();
var visitTask = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x=>x.SourceSubjectVisit).FirstNotNullAsync();
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == visitTask.TrialReadingCriterionId).FirstNotNullAsync();
var subjectVisit = await _subjectVisitRepository.Where(x => x.Id == (visitTask.SourceSubjectVisitId ?? default(Guid))).FirstOrDefaultAsync();
@ -541,7 +540,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == visitTask.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstOrDefaultAsync();
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == visitTaskId).Include(x => x.FristAddTask).ToListAsync();
var rowInfoList = await _readingTableAnswerRowInfoRepository.Where(x => x.VisitTaskId == visitTaskId).Include(x=>x.FristAddTask).ToListAsync();
var baseLinetaskId = await _visitTaskRepository.Where(x => x.SourceSubjectVisitId == baseLineVisitId && x.TaskState == TaskState.Effect
&& x.TrialReadingCriterionId == visitTask.TrialReadingCriterionId

View File

@ -51,7 +51,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{CriterionType.RECIST1Pointt1_MB,typeof(RECIST1Point1_BMCalculateService) },
{CriterionType.IRECIST1Point1,typeof(IRECIST1Point1CalculateService) },
{CriterionType.Lugano2014,typeof(LuganoCalculateService) },
{CriterionType.Lugano2014WithoutPET,typeof(LuganoWithoutPETCalculateService) },
{CriterionType.Lugano2014WithoutPET,typeof(LuganoWithoutPETCalculateService) },
{CriterionType.IVUS,typeof(IVUSCalculateService) },
{CriterionType.OCT,typeof(OCTCalculateService) },
{CriterionType.MRIPDFF,typeof(MRIPDFFCalculateService) },
@ -83,7 +83,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
await file.CopyToAsync(streamCopy);
// 重置流的位置,以便后续读取
streamCopy.Position = 0;
var ossRelativePath = await oSSService.UploadToOSSAsync(streamCopy, $"{visitTaskInfo.TrialId.ToString()}/InspectionUpload/ReadingImport", file.FileName, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = visitTaskInfo.TrialId, BatchDataType = BatchDataType.ReadingImportTemplete });
var ossRelativePath = await oSSService.UploadToOSSAsync(streamCopy, $"{visitTaskInfo.TrialId.ToString()}/InspectionUpload/ReadingImport", file.FileName);
await _readingImportFileRepository.AddAsync(new ReadingImportFile()
@ -348,14 +348,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
private async Task<GetReportsChartDataOutDto> GetReportsChartTypeData(GetReportsChartTypeDataInDto inDto)
private async Task<GetReportsChartDataOutDto> GetReportsChartTypeData(GetReportsChartTypeDataInDto inDto)
{
var visitTaskNameList = inDto.Data.VisitTaskList.Select(x => x.BlindName).ToList();
GetReportsChartDataOutDto result = new GetReportsChartDataOutDto()
{
ChartDataList = new List<ReportChartData>() { },
VisitTaskNameList = visitTaskNameList,
GetReportsChartDataOutDto result = new GetReportsChartDataOutDto() {
ChartDataList=new List<ReportChartData>() { },
VisitTaskNameList= visitTaskNameList,
};
switch (inDto.ReportChartTypeEnum)
@ -456,30 +455,30 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<GetReportsChartSummaryOutDto> GetReportsChartSummary(GetReportsChartSummaryInDto inDto)
{
var criterion = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.TrialCriterionId).FirstNotNullAsync();
var result = new GetReportsChartSummaryOutDto();
var result= new GetReportsChartSummaryOutDto();
var r1Data = await GetData(new List<Arm>() { Arm.SingleReadingArm, Arm.DoubleReadingArm1 });
var r2Data = await GetData(new List<Arm>() { Arm.DoubleReadingArm2 });
var alldata = r1Data.VisitTaskList.Count() > r2Data.VisitTaskList.Count() ? r1Data : r2Data;
var alldata = r1Data.VisitTaskList.Count() > r2Data.VisitTaskList.Count() ? r1Data : r2Data;
var visitTaskName = alldata.VisitTaskList.Select(x => x.BlindName).ToList();
var length = alldata.VisitTaskList.Count();
// -1转为空
List<QuestionType?> negativeToString = new List<QuestionType?>()
List<QuestionType?> negativeToString = new List<QuestionType?>()
{
QuestionType.DaysBetween,
};
async Task<GetReadingReportEvaluationOutDto> GetData(List<Arm> arms)
{
var data = new GetReadingReportEvaluationOutDto() { };
var task = await _visitTaskRepository.Where(x =>
x.SubjectId == inDto.SubjectId
&& arms.Contains(x.ArmEnum)
&& x.ReadingCategory == ReadingCategory.Visit
&& x.ReadingCategory== ReadingCategory.Visit
&& x.ReadingTaskState == ReadingTaskState.HaveSigned
&& x.TaskState == TaskState.Effect
&& x.TrialReadingCriterionId == inDto.TrialCriterionId
&& x.TrialReadingCriterionId==inDto.TrialCriterionId
).OrderByDescending(x => x.VisitTaskNum).FirstOrDefaultAsync();
if (task != null)
{
@ -500,13 +499,13 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
Evaluation = new List<List<EvaluationValue>>() { }
};
var baseLineAnswerType = QuestionType.ExistDisease;
var baseLineAnswerType= QuestionType.ExistDisease;
var visitAnswerType = QuestionType.Tumor;
switch (criterion.CriterionType)
{
case CriterionType.PCWG3:
baseLineAnswerType = QuestionType.SiteVisitForTumorEvaluation;
baseLineAnswerType= QuestionType.SiteVisitForTumorEvaluation;
visitAnswerType = QuestionType.SiteVisitForTumorEvaluation;
break;
case CriterionType.Lugano2014WithoutPET:
@ -516,15 +515,14 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
visitAnswerType = QuestionType.ImgOncology;
break;
}
result.Evaluation.Add(visitTaskName.Select(x => new EvaluationValue()
{
Value = x
result.Evaluation.Add(visitTaskName.Select(x=> new EvaluationValue() {
Value=x
}).ToList());
var r1baseLine = r1.TaskQuestions
var r1baseLine= r1.TaskQuestions
.SelectMany(x => x.Childrens)
.Where(x => x.QuestionType == baseLineAnswerType)
.SelectMany(x => x.Answer.Select(a => new EvaluationValue
@ -547,7 +545,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
r1data = r1baseLine.Take(1).Concat(r1data.Skip(1)).ToList();
r1data = r1data.Concat(Enumerable.Repeat(new EvaluationValue() { Value = "" }, length))
r1data= r1data.Concat(Enumerable.Repeat(new EvaluationValue() { Value = "" }, length))
.Take(length)
.ToList();
result.Evaluation.Add(r1data);
@ -583,7 +581,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
.ToList();
result.Evaluation.Add(r2data);
}
return result;
}
@ -599,17 +597,17 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var chartList = new List<ReportChartData>();
foreach (var item in items)
{
var itemdata = data.TaskQuestions.SelectMany(x => x.Childrens)
var itemdata= data.TaskQuestions.SelectMany(x => x.Childrens)
.Where(x => x.QuestionId == item.QuestionId)
.FirstOrDefault();
var cd = new ReportChartData
{
Name = item?.QuestionName ?? string.Empty,
Name = item?.QuestionName??string.Empty,
Value = itemdata?.Answer?.Select(a => a.Answer).ToList() ?? new List<string>()
};
if (negativeToString.Contains(item.QuestionType))
{
cd.Value = cd.Value.Select(item => item == "-1" || item == "-2" ? string.Empty : item).ToList();
cd.Value = cd.Value.Select(item => item == "-1"|| item == "-2" ? string.Empty : item).ToList();
}
chartList.Add(cd);
}

View File

@ -6,13 +6,11 @@ using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure;
using MassTransit;
using MathNet.Numerics;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;
using MiniExcelLibs;
using System;
namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
@ -46,7 +44,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
switch (readingImportType)
{
case ReadingImportType.ROI:
case ReadingImportType.IVUS_MatchingSegment:
await UploadIVUSTemplate();
break;
}
@ -275,7 +273,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <returns></returns>
public async Task ReadingCalculate(ReadingCalculateDto inDto, List<QuestionType>? calculateType = null)
{
#region 计算 这里顺序非常重要 后面计算的值要依赖前面计算的结果
var needAddList = new List<ReadingTaskQuestionAnswer>();
@ -286,34 +284,23 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
ComputationTrigger.SaveEICRFQuestions,
};
//if (!computationTriggers.Contains(inDto.ComputationTrigger))
//{
// // 计算斑块统计数据
// await this.CalculatePatchDataStatisticsAndPVA(inDto);
// inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
//}
if (!computationTriggers.Contains(inDto.ComputationTrigger))
{
// 计算斑块统计数据
await this.CalculatePatchDataStatisticsAndPVA(inDto);
inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
}
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
{
//// 斑块1-PAV
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque1PVA,GetDecimalNullFun=GetPlaque1PVA},
// // 斑块2-PAV
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque2PVA,GetDecimalNullFun=GetPlaque2PVA},
// // 斑块3-PAV
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque3PVA,GetDecimalNullFun=GetPlaque3PVA},
// (EEM-Lumen)求和
new ReadingCalculateData (){QuestionType=QuestionType.EEMSum,GetDecimalNullFun=GetEmmSum},
// 斑块1-PAV
new ReadingCalculateData (){QuestionType=QuestionType.Plaque1PVA,GetDecimalNullFun=GetPlaque1PVA},
// 斑块2-PAV
new ReadingCalculateData (){QuestionType=QuestionType.EEMSubLumenSum,GetDecimalNullFun=GetEEMLumenSum},
// PAV冠状动脉粥样硬化体积百分比)
new ReadingCalculateData (){QuestionType=QuestionType.PAV,GetDecimalNullFun=GetPAV},
new ReadingCalculateData (){QuestionType=QuestionType.Plaque2PVA,GetDecimalNullFun=GetPlaque2PVA},
// 斑块3-PAV
new ReadingCalculateData (){QuestionType=QuestionType.Plaque3PVA,GetDecimalNullFun=GetPlaque3PVA},
@ -474,33 +461,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
return decimal.Parse(decimal.Round(decimal.Parse(value ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString()));
};
decimal? getdecimalEmptyData(string value)
{
if (value == string.Empty)
{
return null;
}
return decimal.Parse(decimal.Round(decimal.Parse(value ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString()));
}
string getStringValue(decimal? value)
{
if (value == null)
{
return string.Empty;
}
if (digitPlaces == -1)
{
return value.Value.ToString();
}
else
{
return decimal.Round(value.Value, digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString());
}
}
List<IVUSMeasuredValue> measuredValueList = new List<IVUSMeasuredValue>();
var errorRow = new List<int> { };
@ -511,10 +471,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
iVUSMeasuredValue = new IVUSMeasuredValue()
{
//PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
FrameNumber = dataTable.Rows[i]["A"].ToString()??string.Empty,
Emm = getdecimalEmptyData(dataTable.Rows[i]["B"].ToString()),
Lumen = getdecimalEmptyData(dataTable.Rows[i]["C"].ToString()),
PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
Emm = getdecimalData(dataTable.Rows[i]["B"].ToString()),
Lumen = getdecimalData(dataTable.Rows[i]["C"].ToString()),
};
}
catch (Exception)
@ -535,15 +494,15 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
var errorRows= string.Join(',', errorRow.Select(i => i.ToString()));
throw new BusinessValidationFailedException(_localizer["Service_TemplateException", errorRows]);
}
//List<int> nums = new List<int>() { 1, 2, 3 };
//if (measuredValueList.Any(x => !nums.Contains(x.PlaqueNum)))
//{
// throw new BusinessValidationFailedException(_localizer["IVUSOCT_PlaqueNum123"]);
//}
//measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
List<int> nums = new List<int>() { 1, 2, 3 };
if (measuredValueList.Any(x => !nums.Contains(x.PlaqueNum)))
{
throw new BusinessValidationFailedException(_localizer["IVUSOCT_PlaqueNum123"]);
}
measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
var questionInfo = await _readingQuestionTrialRepository.Where(x =>x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId&& x.LesionType == LesionType.ROI).FirstNotNullAsync();
var questionInfo = await _readingQuestionTrialRepository.Where(x =>x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId&& x.LesionType == LesionType.MatchValues).FirstNotNullAsync();
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.Id).ToListAsync();
List<ReadingTableAnswerRowInfo> tableAnsweRowInfos = new List<ReadingTableAnswerRowInfo>();
List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
@ -571,35 +530,33 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
});
// 编号
//tableAnswers.Add(new ReadingTableQuestionAnswer()
//{
// Answer = item.PlaqueNum.ToString(),
// QuestionId = questionInfo.Id,
// TrialId = taskinfo.TrialId,
// VisitTaskId = taskinfo.Id,
// RowId = newRowId,
// RowIndex = maxnum,
// TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
//});
// EMM
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.FrameNumber,
Answer = item.PlaqueNum.ToString(),
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
RowId = newRowId,
RowIndex = maxnum,
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.FrameNumber).Select(x => x.Id).FirstOrDefault(),
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
});
var emm = item.Emm.ToString();
var lumen=item.Lumen.ToString();
var emmSubtractionLumen = item.EmmSubtractionLumen.ToString();
if (taskinfo.TrialReadingCriterion.DigitPlaces != -1)
{
emm = decimal.Round(decimal.Parse(emm ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString());
lumen = decimal.Round(decimal.Parse(lumen ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString());
emmSubtractionLumen = decimal.Round(decimal.Parse(emmSubtractionLumen ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString());
}
// EMM
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = getStringValue(item.Emm),
Answer = emm,
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
@ -610,7 +567,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = getStringValue(item.Lumen),
Answer = lumen,
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
@ -621,7 +578,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = getStringValue(item.EmmSubtractionLumen),
Answer = emmSubtractionLumen,
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
@ -676,7 +633,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
// 测量值集合
var matchValuesAnswerList = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).ToList();
var matchValuesAnswerList = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).ToList();
// 获取编号
var nums = matchValuesAnswerList.SelectMany(x => x.TableQuestionList).Where(x => x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => int.Parse(x.Answer)).Distinct().OrderBy(x => x).ToList();
@ -694,7 +651,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
var newRowId = NewId.NextGuid();
var thisnumTableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer == item.ToString())).ToList();
var thisnumTableRows = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.MatchValues).SelectMany(x => x.TableRowInfoList).Where(x => x.TableQuestionList.Any(y => y.QuestionMark == QuestionMark.PlaqueNumber && y.Answer == item.ToString())).ToList();
// 斑块数据统计
tableAnsweRowInfos.Add(new ReadingTableAnswerRowInfo()
@ -877,7 +834,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
var question = await _readingQuestionTrialRepository.Where(x => x.LesionType == LesionType.ROI && x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).FirstNotNullAsync();
var question = await _readingQuestionTrialRepository.Where(x => x.LesionType == LesionType.PAV && x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).FirstNotNullAsync();
var tableQuestions = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == question.Id)
@ -934,52 +891,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
.Where(x => x.QuestionMark == QuestionMark.PAV).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
}
/// <summary>
/// 获取EMM求和
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<decimal?> GetEmmSum(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.ElasticArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
}
/// <summary>
/// (EEM-Lumen)求和
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<decimal?> GetEEMLumenSum(ReadingCalculateDto inDto)
{
var emm = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.ElasticArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
var lumen = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.LumenArea).Select(x => x.Answer.IsNullOrEmptyReturn0()).Sum();
return emm - lumen;
}
/// <summary>
/// PAV冠状动脉粥样硬化体积百分比)
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<decimal?> GetPAV(ReadingCalculateDto inDto)
{
var eEMLumenSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMSubLumenSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
var eEMSum = inDto.QuestionInfo.Where(x => x.QuestionType == QuestionType.EEMSum).Select(x => x.Answer).FirstOrDefault().IsNullOrEmptyReturn0();
decimal pav = 0;
if (eEMSum != 0)
{
pav = eEMLumenSum * 100 / eEMSum;
}
return pav;
}
///// <summary>
///// 计算NTAV的EEM

View File

@ -1,10 +1,6 @@
using DocumentFormat.OpenXml.Drawing.Diagrams;
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
using DocumentFormat.OpenXml.Office.SpreadSheetML.Y2023.MsForms;
using DocumentFormat.OpenXml.Office2010.Excel;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore.Common;
using IRaCIS.Core.Infrastructure;
@ -44,7 +40,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
switch (readingImportType)
{
case ReadingImportType.ROI:
case ReadingImportType.OCT_FCT:
await UploadOCTFCTTemplate();
break;
@ -336,34 +332,21 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
List<OCTFCTUploadData> measuredValueList = new List<OCTFCTUploadData>();
var errorRow = new List<int> { };
string getNone(string value)
{
if (value == string.Empty || value == null)
{
return "无";
}
else
{
return value;
}
}
for (int i = 3; i < dataTable.Rows.Count; i++)
{
try
{
measuredValueList.Add(new OCTFCTUploadData()
{
//PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
FrameNumber = dataTable.Rows[i]["A"].ToString() ?? string.Empty,
FirstData = getdecimalEmptyData(dataTable.Rows[i]["B"].ToString()),
SecondData = getdecimalEmptyData(dataTable.Rows[i]["C"].ToString()),
ThirdData = getdecimalEmptyData(dataTable.Rows[i]["D"].ToString()),
MacrophageInfiltrationMeasurement = getNone(dataTable.Rows[i]["E"].ToString()),
PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
FirstData = getdecimalData(dataTable.Rows[i]["B"].ToString()),
SecondData = getdecimalData(dataTable.Rows[i]["C"].ToString()),
ThirdData = getdecimalData(dataTable.Rows[i]["D"].ToString()),
MacrophageInfiltrationMeasurement = dataTable.Rows[i]["E"].ToString() ?? string.Empty,
MacrophageInfiltrationAngle = getdecimalEmptyData(dataTable.Rows[i]["F"].ToString() ?? string.Empty),
MicrochannelMeasurement = getNone(dataTable.Rows[i]["G"].ToString()),
CholesterolCrystalMeasurement = getNone(dataTable.Rows[i]["H"].ToString()),
LumenAreaMeasurement = getdecimalEmptyData(dataTable.Rows[i]["I"].ToString()),
LipidAngle = getdecimalEmptyData(dataTable.Rows[i]["J"].ToString() ?? string.Empty),
MicrochannelMeasurement =dataTable.Rows[i]["G"].ToString() ?? string.Empty,
CholesterolCrystalMeasurement = dataTable.Rows[i]["H"].ToString() ?? string.Empty,
LumenAreaMeasurement = getdecimalEmptyData(dataTable.Rows[i]["I"].ToString() ?? string.Empty),
});
}
catch (Exception)
@ -373,7 +356,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
}
}
measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
@ -383,6 +366,12 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
throw new BusinessValidationFailedException(_localizer["Service_TemplateException", errorRows]);
}
List<int> nums = new List<int>() { 1, 2, 3 };
if (measuredValueList.Any(x => !nums.Contains(x.PlaqueNum)))
{
throw new BusinessValidationFailedException(_localizer["IVUSOCT_PlaqueNum123"]);
}
Dictionary<string, string> isPresent = new Dictionary<string, string>()
{
{ "有","1"},
@ -424,7 +413,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
throw new BusinessValidationFailedException(_localizer["Service_TemplateException", errorRows]);
}
var questionInfo = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.ROI).FirstNotNullAsync();
var questionInfo = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.FCT).FirstNotNullAsync();
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.Id).ToListAsync();
List<ReadingTableAnswerRowInfo> tableAnsweRowInfos = new List<ReadingTableAnswerRowInfo>();
List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
@ -453,35 +442,30 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
});
// 编号
//tableAnswers.Add(new ReadingTableQuestionAnswer()
//{
// Answer = item.PlaqueNum.ToString(),
// QuestionId = questionInfo.Id,
// TrialId = taskinfo.TrialId,
// VisitTaskId = taskinfo.Id,
// RowId = newRowId,
// RowIndex = maxnum,
// TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
//});
// 帧数
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.FrameNumber,
Answer = item.PlaqueNum.ToString(),
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
RowId = newRowId,
RowIndex = maxnum,
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.FrameNumber).Select(x => x.Id).FirstOrDefault(),
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
});
var avg = item.Avg.ToString();
if (taskinfo.TrialReadingCriterion.DigitPlaces != -1)
{
avg = decimal.Round(decimal.Parse(avg ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString());
}
// 第一次
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.FirstData.DecimalNullToString(digitPlaces),
Answer = item.FirstData.ToString(),
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
@ -492,7 +476,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.SecondData.DecimalNullToString(digitPlaces),
Answer = item.SecondData.ToString(),
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
@ -503,7 +487,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.ThirdData.DecimalNullToString(digitPlaces),
Answer = item.ThirdData.ToString(),
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
@ -514,7 +498,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.Avg.DecimalNullToString(digitPlaces),
Answer = avg,
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
@ -586,18 +570,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.LumenAreaMeasurement).Select(x => x.Id).FirstOrDefault(),
});
// 脂质角度
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.LipidAngle.ToString(),
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
RowId = newRowId,
RowIndex = maxnum,
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.LipidAngle).Select(x => x.Id).FirstOrDefault(),
});
}
catch (Exception)
{
@ -664,176 +636,173 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
[HttpPost]
public async Task UploadOCTLipidAngleTemplate()
{
#region 这个导入没有了 代码全部注释
//var request = httpContext.HttpContext!.Request;
//var file = request.Form.Files[0];
//Guid visitTaskId = Guid.Parse(request.Form["VisitTaskId"]);
//var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.Subject).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
//var uploadInfo = await _generalCalculateService.GetDataTableFromUpload(file, "OCTLipidAngle", taskinfo.TrialId);
//List<string> sheetNames = new List<string>()
//{
// "脂质角度","LipidAngle"
//};
var request = httpContext.HttpContext!.Request;
var file = request.Form.Files[0];
Guid visitTaskId = Guid.Parse(request.Form["VisitTaskId"]);
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x => x.Subject).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
var uploadInfo = await _generalCalculateService.GetDataTableFromUpload(file, "OCTLipidAngle", taskinfo.TrialId);
List<string> sheetNames = new List<string>()
{
"脂质角度","LipidAngle"
};
//if (sheetNames.Intersect(uploadInfo.SheetNames).Count() == 0)
//{
// throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
//}
//var dataTable = uploadInfo.DataTable;
if (sheetNames.Intersect(uploadInfo.SheetNames).Count() == 0)
{
throw new BusinessValidationFailedException(_localizer["IVUS_UplpadDataError"]);
}
var dataTable = uploadInfo.DataTable;
//var values = new TemplateData()
//{
// SubjectID = taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode,
// TaskBlindName = taskinfo.TaskBlindName,
//};
var values = new TemplateData()
{
SubjectID = taskinfo.BlindSubjectCode.IsNullOrEmpty() ? taskinfo.Subject.Code : taskinfo.BlindSubjectCode,
TaskBlindName = taskinfo.TaskBlindName,
};
//if (values.SubjectID != dataTable.Rows[0]["B"].ToString() || values.TaskBlindName != dataTable.Rows[1]["B"].ToString())
//{
// throw new BusinessValidationFailedException(_localizer["IVUS_UploadVisitTaskError"]);
//}
if (values.SubjectID != dataTable.Rows[0]["B"].ToString() || values.TaskBlindName != dataTable.Rows[1]["B"].ToString())
{
throw new BusinessValidationFailedException(_localizer["IVUS_UploadVisitTaskError"]);
}
//var digitPlaces = taskinfo.TrialReadingCriterion.DigitPlaces ?? 0;
//decimal getdecimalData(string value)
//{
// return decimal.Parse(decimal.Round(decimal.Parse(value ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString()));
//}
//;
var digitPlaces = taskinfo.TrialReadingCriterion.DigitPlaces ?? 0;
decimal getdecimalData(string value)
{
return decimal.Parse(decimal.Round(decimal.Parse(value ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString()));
}
;
//List<OCTFCTUploadData> measuredValueList = new List<OCTFCTUploadData>();
//var errorRow = new List<int> { };
List<OCTFCTUploadData> measuredValueList = new List<OCTFCTUploadData>();
var errorRow = new List<int> { };
//for (int i = 3; i < dataTable.Rows.Count; i++)
//{
// try
// {
// measuredValueList.Add(new OCTFCTUploadData()
// {
// PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
// FirstData = getdecimalData(dataTable.Rows[i]["B"].ToString()),
for (int i = 3; i < dataTable.Rows.Count; i++)
{
try
{
measuredValueList.Add(new OCTFCTUploadData()
{
PlaqueNum = int.Parse(dataTable.Rows[i]["A"].ToString()),
FirstData = getdecimalData(dataTable.Rows[i]["B"].ToString()),
// });
// }
// catch (Exception)
// {
});
}
catch (Exception)
{
// errorRow.Add(i + 1);
// }
errorRow.Add(i+1);
}
//}
}
//measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
measuredValueList = measuredValueList.OrderBy(x => x.PlaqueNum).ToList();
//if (errorRow.Count() > 0)
//{
// var errorRows = string.Join(',', errorRow.Select(i => i.ToString()));
// throw new BusinessValidationFailedException(_localizer["Service_TemplateException", errorRows]);
//}
if (errorRow.Count() > 0)
{
var errorRows = string.Join(',', errorRow.Select(i => i.ToString()));
throw new BusinessValidationFailedException(_localizer["Service_TemplateException", errorRows]);
}
//List<int> nums = new List<int>() { 1, 2, 3 };
//if (measuredValueList.Any(x => !nums.Contains(x.PlaqueNum)))
//{
// throw new BusinessValidationFailedException(_localizer["IVUSOCT_PlaqueNum123"]);
//}
List<int> nums = new List<int>() { 1, 2, 3 };
if (measuredValueList.Any(x => !nums.Contains(x.PlaqueNum)))
{
throw new BusinessValidationFailedException(_localizer["IVUSOCT_PlaqueNum123"]);
}
//foreach (var item in measuredValueList)
//{
// if (item.FirstData > 360)
// {
// throw new BusinessValidationFailedException(_localizer["IVUS_LipidAngleLess360"]);
// }
//}
foreach (var item in measuredValueList)
{
if (item.FirstData > 360)
{
throw new BusinessValidationFailedException(_localizer["IVUS_LipidAngleLess360"]);
}
}
//var questionInfo = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.LipidAngle).FirstNotNullAsync();
//var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.Id).ToListAsync();
//List<ReadingTableAnswerRowInfo> tableAnsweRowInfos = new List<ReadingTableAnswerRowInfo>();
//List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
var questionInfo = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId && x.LesionType == LesionType.LipidAngle).FirstNotNullAsync();
var tableQuestionList = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId == questionInfo.Id).ToListAsync();
List<ReadingTableAnswerRowInfo> tableAnsweRowInfos = new List<ReadingTableAnswerRowInfo>();
List<ReadingTableQuestionAnswer> tableAnswers = new List<ReadingTableQuestionAnswer>();
//var maxnum = 0;
var maxnum = 0;
//foreach (var item in measuredValueList)
//{
// maxnum = maxnum + 1;
// var newRowId = NewId.NextGuid();
// // 斑块数据统计
// tableAnsweRowInfos.Add(new ReadingTableAnswerRowInfo()
// {
// Id = newRowId,
// QuestionId = questionInfo.Id,
// VisitTaskId = taskinfo.Id,
// TrialId = taskinfo.TrialId,
// RowIndex = maxnum,
// IsCurrentTaskAdd = true,
// BlindName = taskinfo.TaskBlindName,
// OrderMark = questionInfo.OrderMark,
// FristAddTaskId = taskinfo.Id,
// RowMark = questionInfo.OrderMark + decimal.Parse(maxnum.ToString()).GetLesionMark()
// });
foreach (var item in measuredValueList)
{
maxnum = maxnum + 1;
var newRowId = NewId.NextGuid();
// 斑块数据统计
tableAnsweRowInfos.Add(new ReadingTableAnswerRowInfo()
{
Id = newRowId,
QuestionId = questionInfo.Id,
VisitTaskId = taskinfo.Id,
TrialId = taskinfo.TrialId,
RowIndex = maxnum,
IsCurrentTaskAdd = true,
BlindName = taskinfo.TaskBlindName,
OrderMark = questionInfo.OrderMark,
FristAddTaskId = taskinfo.Id,
RowMark = questionInfo.OrderMark + decimal.Parse(maxnum.ToString()).GetLesionMark()
});
// // 编号
// tableAnswers.Add(new ReadingTableQuestionAnswer()
// {
// Answer = item.PlaqueNum.ToString(),
// QuestionId = questionInfo.Id,
// TrialId = taskinfo.TrialId,
// VisitTaskId = taskinfo.Id,
// RowId = newRowId,
// RowIndex = maxnum,
// TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
// });
// 编号
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.PlaqueNum.ToString(),
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
RowId = newRowId,
RowIndex = maxnum,
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.PlaqueNumber).Select(x => x.Id).FirstOrDefault(),
});
// var avg = item.Avg.ToString();
var avg = item.Avg.ToString();
// if (taskinfo.TrialReadingCriterion.DigitPlaces != -1)
// {
// avg = decimal.Round(decimal.Parse(avg ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString());
if (taskinfo.TrialReadingCriterion.DigitPlaces != -1)
{
avg = decimal.Round(decimal.Parse(avg ?? "0"), digitPlaces, MidpointRounding.AwayFromZero).ToString("F" + digitPlaces.ToString());
// }
}
// // 脂质角度
// tableAnswers.Add(new ReadingTableQuestionAnswer()
// {
// Answer = item.FirstData.ToString(),
// QuestionId = questionInfo.Id,
// TrialId = taskinfo.TrialId,
// VisitTaskId = taskinfo.Id,
// RowId = newRowId,
// RowIndex = maxnum,
// TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.LipidAngle).Select(x => x.Id).FirstOrDefault(),
// });
// 脂质角度
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = item.FirstData.ToString(),
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
RowId = newRowId,
RowIndex = maxnum,
TableQuestionId = tableQuestionList.Where(x => x.ReadingQuestionId == questionInfo.Id && x.QuestionMark == QuestionMark.LipidAngle).Select(x => x.Id).FirstOrDefault(),
});
// // 添加其他问题答案
// foreach (var otherQuestion in tableQuestionList.Where(x => !tableAnswers.Any(y => y.TableQuestionId == x.Id && y.RowId == newRowId)))
// {
// tableAnswers.Add(new ReadingTableQuestionAnswer()
// {
// Answer = string.Empty,
// QuestionId = questionInfo.Id,
// TrialId = taskinfo.TrialId,
// VisitTaskId = taskinfo.Id,
// RowId = newRowId,
// RowIndex = maxnum,
// TableQuestionId = otherQuestion.Id,
// });
// }
//}
//await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
//await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
//await _readingTableQuestionAnswerRepository.SaveChangesAsync();
//await _readingTableAnswerRowInfoRepository.AddRangeAsync(tableAnsweRowInfos);
//await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
//await _readingTableQuestionAnswerRepository.SaveChangesAsync();
// 添加其他问题答案
foreach (var otherQuestion in tableQuestionList.Where(x => !tableAnswers.Any(y => y.TableQuestionId == x.Id && y.RowId == newRowId)))
{
tableAnswers.Add(new ReadingTableQuestionAnswer()
{
Answer = string.Empty,
QuestionId = questionInfo.Id,
TrialId = taskinfo.TrialId,
VisitTaskId = taskinfo.Id,
RowId = newRowId,
RowIndex = maxnum,
TableQuestionId = otherQuestion.Id,
});
}
}
await _readingTableAnswerRowInfoRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
await _readingTableQuestionAnswerRepository.DeleteFromQueryAsync(x => x.QuestionId == questionInfo.Id && x.VisitTaskId == taskinfo.Id);
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
await _readingTableAnswerRowInfoRepository.AddRangeAsync(tableAnsweRowInfos);
await _readingTableQuestionAnswerRepository.AddRangeAsync(tableAnswers);
await _readingTableQuestionAnswerRepository.SaveChangesAsync();
//await this.CalculateTask(new CalculateTaskInDto()
//{
// VisitTaskId = taskinfo.Id,
//});
#endregion
await this.CalculateTask(new CalculateTaskInDto()
{
VisitTaskId = taskinfo.Id,
});
}
@ -855,48 +824,23 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
ComputationTrigger.SaveEICRFQuestions,
};
//if (!computationTriggers.Contains(inDto.ComputationTrigger))
//{
// // 计算斑块统计数据
// await this.CalculatePatchDataStatistics(inDto);
// inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
//}
if (!computationTriggers.Contains(inDto.ComputationTrigger))
{
// 计算斑块统计数据
await this.CalculatePatchDataStatistics(inDto);
inDto = await _generalCalculateService.GetReadingCalculateDto(inDto.VisitTaskId);
}
List<ReadingCalculateData> calculateList = new List<ReadingCalculateData>()
{
//// 斑块1-匹配动脉段最小FCT
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque1MinFCT,GetDecimalNullFun=GetPlaque1MinFCT},
// 斑块1-匹配动脉段最小FCT
new ReadingCalculateData (){QuestionType=QuestionType.Plaque1MinFCT,GetDecimalNullFun=GetPlaque1MinFCT},
// // 斑块2-匹配动脉段最小FCT
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque2MinFCT,GetDecimalNullFun=GetPlaque2MinFCT},
// 斑块2-匹配动脉段最小FCT
new ReadingCalculateData (){QuestionType=QuestionType.Plaque2MinFCT,GetDecimalNullFun=GetPlaque2MinFCT},
// // 斑块3-匹配动脉段最小FCT
//new ReadingCalculateData (){QuestionType=QuestionType.Plaque3MinFCT,GetDecimalNullFun=GetPlaque3MinFCT},
// 匹配动脉段最小FCT
new ReadingCalculateData (){QuestionType=QuestionType.MatchingTheMinimumFCT,GetDecimalNullFun=GetMinFCT},
// 平均最小FCT
new ReadingCalculateData (){QuestionType=QuestionType.AvgMinFCT,GetDecimalNullFun=GetAvgFCT},
// 脂质角度平均值
new ReadingCalculateData (){QuestionType=QuestionType.AvgLipidAngle,GetDecimalNullFun=GetAvgLipidAngle},
// 脂质角度最大值
new ReadingCalculateData (){QuestionType=QuestionType.MaxLipidAngle,GetDecimalNullFun=GetMaxLipidAngle},
//巨噬细胞浸润测量
new ReadingCalculateData (){QuestionType=QuestionType.MacrophageInfiltrationMeasurement,GetStringFun=GetMacrophageInfiltration},
//巨噬细胞浸润角度测量
new ReadingCalculateData (){QuestionType=QuestionType.MacrophageInfiltrationAngle,GetStringFun=GetMacrophageExtensionAngle},
//微通道测量
new ReadingCalculateData (){QuestionType=QuestionType.MicrochannelMeasurement,GetStringFun=GetMicrochannels},
//胆固醇结晶测量
new ReadingCalculateData (){QuestionType=QuestionType.CholesterolCrystalMeasurement,GetStringFun=GetCholesterolCrystallization},
// 斑块3-匹配动脉段最小FCT
new ReadingCalculateData (){QuestionType=QuestionType.Plaque3MinFCT,GetDecimalNullFun=GetPlaque3MinFCT},
};
@ -998,7 +942,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task CalculatePatchDataStatistics(ReadingCalculateDto inDto)
{
// FCT 问题信息
var fCTQuestionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).FirstOrDefault();
var fCTQuestionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FCT).FirstOrDefault();
List<OCTInfo> oCTFCTInfos=new List<OCTInfo> ();
@ -1276,123 +1220,6 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
.Where(x => x.QuestionMark == QuestionMark.MiniMumFCT).Select(x => x.Answer).FirstIsNullReturnEmpty().IsNullOrEmptyReturnNull();
}
/// <summary>
/// 匹配动脉段最小FCT (平均值的最小值)
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<decimal?> GetMinFCT(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.AvgFCT).Select(x => x.Answer.IsNullOrEmptyReturn0()).Where(x => x != 0).MinOrDefault();
}
/// <summary>
/// 平均最小FCT (平均值的平均值)
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<decimal?> GetAvgFCT(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.AvgFCT).Select(x => x.Answer.IsNullOrEmptyReturn0()).Where(x=>x!=0).DefaultIfEmpty(0).Average();
}
/// <summary>
/// 脂质角度平均值
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<decimal?> GetAvgLipidAngle(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.LipidAngle&&x.Answer.IsNotNullOrEmpty()).Select(x => x.Answer.IsNullOrEmptyReturn0()).DefaultIfEmpty(0).Average();
}
/// <summary>
/// 脂质角度最大
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<decimal?> GetMaxLipidAngle(ReadingCalculateDto inDto)
{
return inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.LipidAngle).Select(x => x.Answer.IsNullOrEmptyReturn0()).MaxOrDefault();
}
public async Task<List<OCTInfo>> GetOCTInfo(ReadingCalculateDto inDto)
{
var fCTQuestionInfo = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).FirstOrDefault();
List<OCTInfo> oCTFCTInfos = new List<OCTInfo>();
foreach (var item in fCTQuestionInfo!.TableRowInfoList)
{
oCTFCTInfos.Add(new OCTInfo()
{
// Data = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.AvgFCT).Select(x => decimal.Parse(x.Answer)).FirstOrDefault(),
MacrophageInfiltrationMeasurement = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MacrophageInfiltrationMeasurement).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
MacrophageInfiltrationAngle = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MacrophageInfiltrationAngle).Select(x => x.Answer.IsNullOrEmptyReturnNull()).FirstOrDefault(),
MicrochannelMeasurement = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.MicrochannelMeasurement).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
CholesterolCrystalMeasurement = item.TableQuestionList.Where(x => x.QuestionMark == QuestionMark.CholesterolCrystalMeasurement).Select(x => x.Answer).FirstOrDefault() ?? string.Empty,
});
}
return oCTFCTInfos;
}
/// <summary>
/// 获取巨噬细胞浸润测量
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<string> GetMacrophageInfiltration(ReadingCalculateDto inDto)
{
List<OCTInfo> oCTFCTInfos = await GetOCTInfo(inDto);
return oCTFCTInfos.Any(x => x.MacrophageInfiltrationMeasurement != string.Empty) ?
oCTFCTInfos.Any(x => x.MacrophageInfiltrationMeasurement.EqEnum(IsPresent.Existence)) ? IsPresent.Existence.GetEnumInt() : IsPresent.NonExistence.GetEnumInt()
: IsPresent.NonExistence.GetEnumInt();
}
/// <summary>
/// 巨噬细胞浸润角度测量
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<string> GetMacrophageExtensionAngle(ReadingCalculateDto inDto)
{
List<OCTInfo> oCTFCTInfos = await GetOCTInfo(inDto);
return oCTFCTInfos.Where(x =>x.MacrophageInfiltrationAngle != null).Count() == 0 ? string.Empty : oCTFCTInfos.Max(x => x.MacrophageInfiltrationAngle ?? 0).ToString();
}
/// <summary>
/// 获取微通道汇总
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<string> GetMicrochannels(ReadingCalculateDto inDto)
{
List<OCTInfo> oCTFCTInfos = await GetOCTInfo(inDto);
return oCTFCTInfos.Any(x => x.MicrochannelMeasurement != string.Empty) ?
oCTFCTInfos.Any(x => x.MicrochannelMeasurement.EqEnum(IsPresent.Existence)) ? IsPresent.Existence.GetEnumInt() : IsPresent.NonExistence.GetEnumInt()
: IsPresent.NonExistence.GetEnumInt();
}
/// <summary>
/// 获取胆固醇结晶汇总
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<string> GetCholesterolCrystallization(ReadingCalculateDto inDto)
{
List<OCTInfo> oCTFCTInfos = await GetOCTInfo(inDto);
return oCTFCTInfos.Any(x => x.CholesterolCrystalMeasurement != string.Empty) ?
oCTFCTInfos.Any(x => x.CholesterolCrystalMeasurement.EqEnum(IsPresent.Existence)) ? IsPresent.Existence.GetEnumInt() : IsPresent.NonExistence.GetEnumInt()
: IsPresent.NonExistence.GetEnumInt();
}
/// <summary>
/// 验证访视提交
/// </summary>
@ -1402,7 +1229,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
{
var taskinfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Include(x => x.Subject).Include(x => x.TrialReadingCriterion).FirstNotNullAsync();
var question = await _readingQuestionTrialRepository.Where(x => x.LesionType == LesionType.ROI && x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).FirstNotNullAsync();
var question = await _readingQuestionTrialRepository.Where(x => x.LesionType == LesionType.PatchDataStatistics && x.ReadingQuestionCriterionTrialId == taskinfo.TrialReadingCriterionId).FirstNotNullAsync();
var tableQuestions = await _readingTableQuestionTrialRepository.Where(x => x.ReadingQuestionId== question.Id)
@ -1434,7 +1261,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
public async Task<decimal?> GetAllMinFCT(ReadingCalculateDto inDto)
{
var allMinFCT = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
var allMinFCT = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FCT).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.MinFCT).Select(x => x.Answer.IsNullOrEmptyReturn0()).MinOrDefault();
if (allMinFCT == 0)
{
@ -1450,7 +1277,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
/// <returns></returns>
public async Task<decimal?> GetAvgMinFCT(ReadingCalculateDto inDto)
{
var allMinFCT = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.ROI).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
var allMinFCT = inDto.QuestionInfo.Where(x => x.LesionType == LesionType.FCT).SelectMany(x => x.TableRowInfoList).SelectMany(x => x.TableQuestionList)
.Where(x => x.QuestionMark == QuestionMark.MinFCT).Select(x => x.Answer.IsNullOrEmptyReturn0()).ToList();
if (allMinFCT.Count() == 0)
{

View File

@ -1191,7 +1191,7 @@ namespace IRaCIS.Core.Application.Contracts
var userEmail = item.Key;
var userTypeIdList = item.Select(t => t.UserTypeId).Distinct().ToList();
var userTypeIdList = item.Select(t => t.UserTypeId).ToList();
var existSysUser = await _identityUserRepository.Where(t => t.EMail == userEmail, true).Include(t => t.UserRoleList).FirstOrDefaultAsync();

View File

@ -101,7 +101,6 @@ namespace IRaCIS.Core.Application.Contracts
public class TrialProcessConfig
{
public TrialDataStore TrialDataStoreType { get; set; }
public List<Guid> CriterionIds { get; set; } = new List<Guid>();
@ -405,12 +404,6 @@ namespace IRaCIS.Core.Application.Contracts
/// </summary>
public List<string> ReadingToolList { get; set; }
/// <summary>
/// 分割工具
/// </summary>
public List<string> SegmentToolList { get; set; } = new List<string>();
public string TrialModalitys { get; set; }
public bool IsImageFilter { get; set; }
@ -943,11 +936,6 @@ namespace IRaCIS.Core.Application.Contracts
{
public List<string> ReadingToolList { get; set; } = new List<string>() { };
/// <summary>
/// 分割工具
/// </summary>
public List<string> SegmentToolList { get; set; } = new List<string>();
public List<KeyFile> KeyFileList { get; set; }=new List<KeyFile>() { };
public bool IsImageFilter { get; set; }
@ -1096,8 +1084,6 @@ namespace IRaCIS.Core.Application.Contracts
public class TrialConfigDTO : BasicTrialConfig
{
public TrialDataStore TrialDataStoreType { get; set; }
[Comment("阅片任务产生之前 采集影像")]
public CollectImagesType CollectImagesEnum { get; set; }

View File

@ -341,7 +341,7 @@ namespace IRaCIS.Core.Application
foreach (var item in systemCriterionKeyFile)
{
var path = await _oSSService.UploadToOSSAsync(item.FilePath, $"{trialCriterion.TrialId}/ReadingModule/{trialCriterion.CriterionName}", true, true, uploadInfo: new FileUploadRecordAddOrEdit() { TrialId = trialCriterion.TrialId ,BatchDataType=BatchDataType.ReadingKeyFile });
var path = await _oSSService.UploadToOSSAsync(item.FilePath, $"{trialCriterion.TrialId}/ReadingModule/{trialCriterion.CriterionName}", true, true);
trialCriterionKeyFiles.Add(new TrialCriterionKeyFile
{
@ -610,11 +610,7 @@ namespace IRaCIS.Core.Application
toolList = toolList.Distinct().ToList();
var alltool= trialCriterion.ReadingToolList.Union(trialCriterion.SegmentToolList).ToList();
if (tabletoolList.Except(alltool).Count() > 0)
if (tabletoolList.Except(trialCriterion.ReadingToolList).Count() > 0)
{
//---问题的阅片工具不在标准配置的阅片工具列表中
throw new BusinessValidationFailedException(_localizer["TrialConfig_TableToolNotInStdTool"]);
@ -633,7 +629,6 @@ namespace IRaCIS.Core.Application
await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.TrialReadingCriterionId, x => new ReadingQuestionCriterionTrial()
{
ReadingToolList = inDto.ReadingToolList,
SegmentToolList= inDto.SegmentToolList,
IsImageFilter = inDto.IsImageFilter,
ImageDownloadEnum = inDto.ImageDownloadEnum,
ImageUploadEnum = inDto.ImageUploadEnum,
@ -1564,13 +1559,13 @@ namespace IRaCIS.Core.Application
[AllowAnonymous]
public async Task<TrialConfigInfo> GetTrialExtralConfig(Guid trialId)
{
var extralObj = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.TrialExtraConfigJsonStr, t.IsExternalViewTrialChart, t.TrialObjectNameList, t.CollectImagesEnum, t.IsIQCAutoNextTask, t.IsImageQualityControl }).FirstOrDefault();
var extralObj = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.TrialExtraConfigJsonStr, t.IsExternalViewTrialChart, t.TrialObjectNameList, t.CollectImagesEnum, t.IsIQCAutoNextTask,t.IsImageQualityControl }).FirstOrDefault();
var extralConfig = JsonConvert.DeserializeObject<TrialExtraConfig>(extralObj?.TrialExtraConfigJsonStr) ?? new TrialExtraConfig();
var trialConfig = _mapper.Map<TrialConfigInfo>(extralConfig);
trialConfig.IsImageQualityControl = extralObj.IsImageQualityControl;
trialConfig.IsImageQualityControl= extralObj.IsImageQualityControl;
trialConfig.TrialObjectNameList = extralObj.TrialObjectNameList;
trialConfig.IsExternalViewTrialChart = extralObj.IsExternalViewTrialChart;
trialConfig.CollectImagesEnum = extralObj.CollectImagesEnum;

View File

@ -42,9 +42,9 @@ public class TrialStatService(
{
UploadedCount = t.SubjectVisitList.Where(t => inQuery.TrialSiteId != null ? t.TrialSiteId == inQuery.TrialSiteId : true)
.Where(t => t.SubmitState == SubmitStateEnum.Submitted).Count(),
QCFinishedCount = t.QCProcessEnum == TrialQCProcess.NotAudit ? null : t.SubjectVisitList.Where(t => inQuery.TrialSiteId != null ? t.TrialSiteId == inQuery.TrialSiteId : true)
QCFinishedCount = t.SubjectVisitList.Where(t => inQuery.TrialSiteId != null ? t.TrialSiteId == inQuery.TrialSiteId : true)
.Where(t => t.AuditState == AuditStateEnum.QCPassed || t.AuditState == AuditStateEnum.QCFailed).Count(),
CheckFinishedCount = t.IsImageConsistencyVerification == false ? null : t.SubjectVisitList.Where(t => inQuery.TrialSiteId != null ? t.TrialSiteId == inQuery.TrialSiteId : true)
CheckFinishedCount = t.SubjectVisitList.Where(t => inQuery.TrialSiteId != null ? t.TrialSiteId == inQuery.TrialSiteId : true)
.Where(t => t.CheckState == CheckStateEnum.CVPassed).Count(),
CriterionList = t.TrialReadingCriterionList.Where(t => inQuery.TrialReadingCriterionId != null ? t.Id == inQuery.TrialReadingCriterionId : true)

View File

@ -2,7 +2,6 @@
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Contracts.Dicom.DTO;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.Service.Reading.Dto;
using IRaCIS.Core.Domain.Models;
@ -255,7 +254,7 @@ namespace IRaCIS.Core.Application.Services
.Where(t => isImageFilter ? ("|" + criterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|") : true)
.WhereIf(isReading == 1 || isQCFinished, s => s.IsDeleted == false)
//预览靶段标注上传的影像 影像后处理 上传了新的影像 还要原始dsa
.WhereIf(isImageSegmentLabel == true && isVisitTask && (criterionType == CriterionType.OCT || criterionType == CriterionType.IVUS), t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" || t.ModalityForEdit == "OCT")
.WhereIf(isImageSegmentLabel == true && isVisitTask && (criterionType == CriterionType.OCT || criterionType == CriterionType.IVUS), t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" || t.ModalityForEdit == "OCT")
.Select(k => new VisitStudyDTO()
{
InstanceCount = k.InstanceCount,
@ -270,7 +269,7 @@ namespace IRaCIS.Core.Application.Services
var instanceList = await _dicomInstanceRepository.Where(t => studyIds.Contains(t.StudyId)).IgnoreQueryFilters()
.WhereIf(isReading == 1, s => s.IsReading && s.IsDeleted == false)
.WhereIf(isQCFinished, t => t.IsDeleted == false)
.Select(t => new { t.SeriesId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.HtmlPath, t.IsReading, t.IsDeleted, t.FileSize, t.ImagePositionPatient, t.ImageOrientationPatient }).ToListAsync();
.Select(t => new { t.SeriesId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.HtmlPath, t.IsReading, t.IsDeleted, t.FileSize }).ToListAsync();
foreach (var t in studyList)
{
@ -284,17 +283,7 @@ namespace IRaCIS.Core.Application.Services
t.SeriesList.ForEach(series =>
{
var instances = instanceList.Where(x => x.SeriesId == series.Id);
// ⭐ DICOM 空间排序(带兜底)
var sorted = DicomSortHelper.SortSlices(
instances,
x => x.ImagePositionPatient,
x => x.ImageOrientationPatient,
x => x.InstanceNumber
);
series.InstanceInfoList = sorted.Select(k =>
series.InstanceInfoList = instanceList.Where(t => t.SeriesId == series.Id).OrderBy(t => t.InstanceNumber).Select(k =>
new InstanceBasicInfo()
{
Id = k.Id,
@ -373,7 +362,7 @@ namespace IRaCIS.Core.Application.Services
}
else
{
series = await _taskSeriesRepository.Where(s => s.Id == inDto.SeriesId).ProjectTo<DicomSeriesDTO>(_mapper.ConfigurationProvider).FirstNotNullAsync();
series = await _taskSeriesRepository .Where(s => s.Id == inDto.SeriesId).ProjectTo<DicomSeriesDTO>(_mapper.ConfigurationProvider).FirstNotNullAsync();
var instanceList = await _taskInstanceRepository.Where(t => t.SeriesId == inDto.SeriesId)
.Select(t => new { t.SeriesId, t.StudyId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.WindowCenter, t.WindowWidth, t.HtmlPath, t.SliceLocation, t.FileSize }).ToListAsync();
@ -567,13 +556,13 @@ namespace IRaCIS.Core.Application.Services
.WhereIf(isManualGenerate, t => t.SubjectCriteriaEvaluationVisitStudyFilterList.Any(t => t.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId && t.IsConfirmed && t.IsReading))
//影像后处理 上传了新的影像 还要原始dsa
.WhereIf(taskInfo.IsHaveTaskStudy && taskInfo.CriterionType == CriterionType.OCT,
t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA")
t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" )
.WhereIf(taskInfo.CriterionType == CriterionType.IVUS,
t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" || t.ModalityForEdit == "IVUS")
t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" || t.ModalityForEdit == "IVUS")
.WhereIf(taskInfo.IsHaveTaskStudy == false && taskInfo.CriterionType == CriterionType.OCT,
t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" || t.ModalityForEdit == "OCT")
t => t.ModalityForEdit == "XA" || t.ModalityForEdit == "DSA" || t.ModalityForEdit == "OCT")
//其他 不应该看原始影像
@ -599,7 +588,7 @@ namespace IRaCIS.Core.Application.Services
if (studyIds.Count > 0)
{
var instanceList = await _dicomInstanceRepository.Where(t => studyIds.Contains(t.StudyId) && t.IsReading)
.Select(t => new { t.SeriesId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.WindowCenter, t.WindowWidth, t.HtmlPath, t.IsReading, t.FileSize, t.ImagePositionPatient, t.ImageOrientationPatient }).ToListAsync();
.Select(t => new { t.SeriesId, t.Id, t.InstanceNumber, t.Path, t.NumberOfFrames, t.WindowCenter, t.WindowWidth, t.HtmlPath, t.IsReading, t.FileSize }).ToListAsync();
List<DicomSeriesDTO> seriesLists = await _dicomSeriesRepository.Where(s => studyIds.Contains(s.StudyId))
.WhereIf(isManualGenerate == false, t => t.IsReading)
@ -608,23 +597,11 @@ namespace IRaCIS.Core.Application.Services
foreach (var t in dicomStudyList)
{
t.SeriesList = seriesLists.Where(s => s.StudyId == t.StudyId).OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).ToList();
t.SeriesList.ForEach(series =>
{
var instances = instanceList.Where(x => x.SeriesId == series.Id);
// ⭐ DICOM 空间排序(带兜底)
var sorted = DicomSortHelper.SortSlices(
instances,
x => x.ImagePositionPatient,
x => x.ImageOrientationPatient,
x => x.InstanceNumber
);
series.InstanceInfoList = sorted.Select(k =>
series.InstanceInfoList = instanceList.Where(t => t.SeriesId == series.Id).OrderBy(t => t.InstanceNumber).Select(k =>
new InstanceBasicInfo()
{
Id = k.Id,
@ -665,20 +642,6 @@ namespace IRaCIS.Core.Application.Services
{
study.SeriesList = study.SeriesList.OrderBy(s => s.SeriesNumber).ThenBy(s => s.SeriesTime).ToList();
study.SeriesList.ForEach(series =>
{
// ⭐ DICOM 空间排序(带兜底)
var sorted = DicomSortHelper.SortSlices(
series.InstanceInfoList,
x => x.ImagePositionPatient,
x => x.ImageOrientationPatient,
x => x.InstanceNumber
);
series.InstanceInfoList = sorted;
});
study.InstanceCount = study.SeriesList.SelectMany(t => t.InstanceInfoList).Count();
}
@ -860,7 +823,7 @@ namespace IRaCIS.Core.Application.Services
var instanceCount = await _noneDicomStudyFileRepository.Where(t => t.IsReading)
.WhereIf(taskInfo.IsHaveTaskNoneDicomStudyFile == false && taskInfo.IsMarkNoneDicomStudy == true, x => x.ImageLabelNoneDicomStudyId == item.StudyId)
.WhereIf(taskInfo.IsHaveTaskNoneDicomStudyFile && taskInfo.IsMarkNoneDicomStudy, x => x.OriginNoneDicomStudyId == item.StudyId && x.VisitTaskId == indto.VisitTaskId)
.WhereIf(taskInfo.IsHaveTaskNoneDicomStudyFile && taskInfo.IsMarkNoneDicomStudy, x => x.OriginNoneDicomStudyId == item.StudyId && x.VisitTaskId==indto.VisitTaskId)
.WhereIf(taskInfo.IsHaveTaskNoneDicomStudyFile == false && taskInfo.IsMarkNoneDicomStudy == false, x => x.NoneDicomStudyId == item.StudyId)
.Where(t => !t.FileType.Contains(StaticData.FileType.Zip))
.CountAsync();

View File

@ -289,7 +289,7 @@ namespace IRaCIS.Application.Contracts
public List<TrialCriterionReadingCategory> CriterionReadingCategoryList { get; set; }
//任务阅片状态
public List<DoctorTaskStat> ReadingTaskStateList { get; set; } = new List<DoctorTaskStat>();
public List<DoctorUserTask> ReadingTaskStateList { get; set; } = new List<DoctorUserTask>();
public List<CriterionFile> CriterionFileList { get; set; } = new List<CriterionFile>();
@ -299,17 +299,11 @@ namespace IRaCIS.Application.Contracts
new CriterionReadingCategory()
{
EnrollId = EnrollId,
//PendingCount = ReadingTaskStateList.Where(x => x.ReadingTaskState != ReadingTaskState.HaveSigned && x.TrialReadingCriterionId == t.TrialReadingCriterionId).Count(),
PendingCount = ReadingTaskStateList.Where(x => x.ReadingTaskState != ReadingTaskState.HaveSigned && x.TrialReadingCriterionId == t.TrialReadingCriterionId).Count(),
//ComplectedCount = ReadingTaskStateList.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.TrialReadingCriterionId == t.TrialReadingCriterionId).Count(),
ComplectedCount = ReadingTaskStateList.Where(x => x.ReadingTaskState == ReadingTaskState.HaveSigned && x.TrialReadingCriterionId == t.TrialReadingCriterionId).Count(),
//TotalCount = ReadingTaskStateList.Where(x => x.TrialReadingCriterionId == t.TrialReadingCriterionId).Count(),
PendingCount = ReadingTaskStateList.Where(x => x.TrialReadingCriterionId == t.TrialReadingCriterionId).FirstOrDefault()?.PendingCount,
ComplectedCount = ReadingTaskStateList.Where(x => x.TrialReadingCriterionId == t.TrialReadingCriterionId).FirstOrDefault()?.ComplectedCount,
TotalCount = ReadingTaskStateList.Where(x => x.TrialReadingCriterionId == t.TrialReadingCriterionId).FirstOrDefault()?.TotalCount,
TotalCount = ReadingTaskStateList.Where(x => x.TrialReadingCriterionId == t.TrialReadingCriterionId).Count(),
StatementCriterionFileList = CriterionFileList.Where(x => x.CriterionType == t.CriterionType && x.FileType == CriterionFileType.Statement)
.WhereIf(t.CriterionType == CriterionType.SelfDefine, x => x.TrialReadingCriterionId == t.TrialReadingCriterionId).ToList(),
@ -354,19 +348,6 @@ namespace IRaCIS.Application.Contracts
public Guid TrialReadingCriterionId { get; set; }
}
public class DoctorTaskStat
{
public CriterionType? CriterionType { get; set; }
public Guid TrialReadingCriterionId { get; set; }
public int PendingCount { get; set; }
public int ComplectedCount { get; set; }
public int TotalCount { get; set; }
}
public class TrialReadingCriterionDto
{
public ReadingOrder IsReadingTaskViewInOrder { get; set; }
@ -454,11 +435,11 @@ namespace IRaCIS.Application.Contracts
/// <summary>
/// 待办数量
/// </summary>
public int? PendingCount { get; set; }
public int PendingCount { get; set; }
public int? ComplectedCount { get; set; }
public int ComplectedCount { get; set; }
public int? TotalCount { get; set; }
public int TotalCount { get; set; }
public List<CriterionFile> StatementCriterionFileList { get; set; }

View File

@ -118,7 +118,7 @@ namespace IRaCIS.Core.Application.Service
/// <param name="inDto"></param>
/// <returns></returns>
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
[TrialGlobalLimit("AfterStopCannNotOpt")]
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
public async Task<IResponseOutput> SetEnrollReadingCategory(SetEnrollReadingCategoryInDto inDto)
{
@ -167,7 +167,7 @@ namespace IRaCIS.Core.Application.Service
/// <param name="inCommand"></param>
/// <returns></returns>
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
[TrialGlobalLimit("AfterStopCannNotOpt")]
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
public async Task<IResponseOutput> UpdateTrialReviewerState(SetEnrollEnableCommand inCommand)
{
await _taskAllocationRuleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == inCommand.TrialId && t.EnrollId == inCommand.EnrollId, u => new TaskAllocationRule() { IsEnable = inCommand.IsEnable }, true);
@ -181,7 +181,7 @@ namespace IRaCIS.Core.Application.Service
/// </summary>
/// <returns></returns>
[HttpPost("{trialId}/{doctorId}/{type}")]
[TrialGlobalLimit("AfterStopCannNotOpt")]
[TrialGlobalLimit( "AfterStopCannNotOpt" )]
//[Authorize(Policy = IRaCISPolicy.PM_APM)]
public async Task<IResponseOutput> UpdateReviewerReadingType(Guid trialId, Guid doctorId, int type)
{
@ -218,7 +218,7 @@ namespace IRaCIS.Core.Application.Service
TrialReadingCriterionList = intoGroup.Trial.TrialReadingCriterionList.Where(t => t.IsConfirm).Select(t => new TrialReadingCriterionDto() { TrialReadingCriterionId = t.Id, TrialReadingCriterionName = t.CriterionName, CriterionType = t.CriterionType, IsOncologyReading = t.IsOncologyReading, IsArbitrationReading = t.IsArbitrationReading, IsGlobalReading = t.IsGlobalReading, ReadingInfoSignTime = t.ReadingInfoSignTime, ReadingType = t.ReadingType }).ToList(),
DoctorCriterionStatusList = intoGroup.EnrollReadingCriteriaList.Where(t => t.TrialReadingCriterion.IsConfirm).Select(t => new DoctorCriterionStatus()
DoctorCriterionStatusList = intoGroup.EnrollReadingCriteriaList.Where(t=>t.TrialReadingCriterion.IsConfirm).Select(t => new DoctorCriterionStatus()
{
EnrollId = t.Id,
Id = t.Id,
@ -230,7 +230,7 @@ namespace IRaCIS.Core.Application.Service
CriterionReadingCategoryList = intoGroup.EnrollReadingCategoryList.Where(t => t.TrialReadingCriterion.IsConfirm).Select(t => new TrialCriterionReadingCategory() { EnrollId = t.EnrollId, ReadingCategory = t.ReadingCategory, TrialReadingCriterionId = t.TrialReadingCriterionId }).ToList(),
CriterionFileList = doctor.CriterionFileList.Where(t => t.TrialReadingCriterion.IsConfirm || t.TrialReadingCriterionId == null).Where(x => x.IsEnable && (x.TrialId == null || x.TrialId == trialId)).Select(x => new CriterionFile()
CriterionFileList = doctor.CriterionFileList.Where(t => t.TrialReadingCriterion.IsConfirm || t.TrialReadingCriterionId==null).Where(x => x.IsEnable && (x.TrialId == null || x.TrialId == trialId)).Select(x => new CriterionFile()
{
CriterionType = x.CriterionType,
DoctorId = x.DoctorId,
@ -242,17 +242,13 @@ namespace IRaCIS.Core.Application.Service
Id = x.Id
}).ToList(),
//ReadingTaskStateList = intoGroup.DoctorUser.VisitTaskList.Where(t => t.TrialReadingCriterion.IsConfirm).Where(x => x.TaskState == TaskState.Effect && x.TrialId == trialId).GroupBy(x => new { x.TrialReadingCriterionId, x.TrialReadingCriterion.CriterionType }).Select(g => new DoctorTaskStat()
//{
ReadingTaskStateList = intoGroup.DoctorUser.VisitTaskList.Where(t => t.TrialReadingCriterion.IsConfirm).Where(x => x.TaskState == TaskState.Effect && x.TrialId == trialId).Select(x => new DoctorUserTask()
{
ReadingTaskState = x.ReadingTaskState,
TrialReadingCriterionId = x.TrialReadingCriterionId,
CriterionType = x.TrialReadingCriterion.CriterionType,
// PendingCount = g.Count(x => x.ReadingTaskState != ReadingTaskState.HaveSigned),
// TotalCount = g.Count(),
// ComplectedCount = g.Count(x => x.ReadingTaskState == ReadingTaskState.HaveSigned),
// TrialReadingCriterionId = g.Key.TrialReadingCriterionId,
// CriterionType = g.Key.CriterionType,
//}).ToList(),
}).ToList(),
DoctorId = doctor.Id,
Code = doctor.ReviewerCode,

View File

@ -117,7 +117,7 @@ namespace IRaCIS.Core.Application.Service
//await WeComNotifier.SendErrorAsync(webhook, "http://irc.test.extimaging.com/login", new Exception("测试异常"), new[] { "ZhouHang" });
//throw new Exception("手动测试异常抛出");
return ResponseOutput.Ok(_userInfo.Domain);
return ResponseOutput.Ok(modelVerify);
}

View File

@ -1,7 +1,7 @@
github 项目地址:https://github.com/koenbeuk/EntityFrameworkCore.Triggered
github 项目地址:https://github.com/koenbeuk/EntityFrameworkCore.Triggered
Trigger 使用一般分为两种 IBeforeSaveTrigger IAfterSaveTrigger
Trigger 使用一般分为两种 IBeforeSaveTrigger IAfterSaveTrigger
IBeforeSaveTrigger 在事务保存之前 然后在里面不需要提交事务(避免稽查那里反复进)
IBeforeSaveTrigger 在事务保存之前 然后在里面不需要提交事务(避免稽查那里反复进)
IAfterSaveTrigger 在事务保存之后(比如要维护 访视拍片日期,首先数据要落库后,才能找到最大的和最小的日期赋值给访视)
IAfterSaveTrigger 在事务保存之后(比如要维护 访视拍片日期,首先数据要落库后,才能找到最大的和最小的日期赋值给访视)

View File

@ -54,11 +54,6 @@ namespace IRaCIS.Core.Domain.Share
/// </summary>
OCT_LipidAngle = 2,
/// <summary>
/// ROI
/// </summary>
ROI = 3,
}
@ -504,23 +499,6 @@ namespace IRaCIS.Core.Domain.Share
}
/// <summary>
/// 影像标记类型
/// </summary>
public enum ImageMarkType
{
/// <summary>
/// 普通标记
/// </summary>
Normal = 0,
/// <summary>
/// 分割标记
/// </summary>
Segment = 1,
}
/// <summary>
/// 导出结果
/// </summary>
@ -2060,11 +2038,6 @@ namespace IRaCIS.Core.Domain.Share
/// </summary>
PAV = 103,
/// <summary>
/// ROI测量值
/// </summary>
ROI = 104,
/// <summary>
/// 脂质角度
/// </summary>
@ -2483,12 +2456,7 @@ namespace IRaCIS.Core.Domain.Share
/// <summary>
/// 斑块到血管开口的距离
/// </summary>
PlaqueToOstiumDistance = 1031,
/// <summary>
/// 帧数
/// </summary>
FrameNumber =1032,
PlaqueToOstiumDistance=1031,
/// <summary>
/// 第一次测量
@ -3002,76 +2970,6 @@ namespace IRaCIS.Core.Domain.Share
/// </summary>
TargetSegmentRemarks = 1012,
/// <summary>
/// ROI起始回撤距离
/// </summary>
ROIStart = 1013,
/// <summary>
/// ROI终止回撤距离
/// </summary>
ROIEnd = 1014,
/// <summary>
/// ROI段落总长度
/// </summary>
ROIAllLength = 1015,
/// <summary>
/// PAV冠状动脉粥样硬化体积百分比)
/// </summary>
PAV =1019,
/// <summary>
/// EEM求和
/// </summary>
EEMSum = 1020,
/// <summary>
/// (EEM-Lumen)求和
/// </summary>
EEMSubLumenSum = 1021,
/// <summary>
/// 匹配动脉段最小FCT
/// </summary>
MatchingTheMinimumFCT = 1022,
/// <summary>
/// 平均最小FCT
/// </summary>
AvgMinFCT = 1023,
/// <summary>
/// 脂质角度平均值
/// </summary>
AvgLipidAngle = 1024,
/// <summary>
/// 脂质角度最大值
/// </summary>
MaxLipidAngle = 1025,
/// <summary>
/// 巨噬细胞浸润测量
/// </summary>
MacrophageInfiltrationMeasurement = 1026,
/// <summary>
/// 巨噬细胞浸润角度测量
/// </summary>
MacrophageInfiltrationAngle = 1027,
/// <summary>
/// 微通道测量
/// </summary>
MicrochannelMeasurement = 1028,
/// <summary>
/// 胆固醇结晶测量
/// </summary>
CholesterolCrystalMeasurement = 1029,
/// <summary>
/// 脂肪分数总平均值
/// </summary>

View File

@ -1,11 +1,11 @@
using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Domain.Models;
[Comment("后台 - 字典表(需要同步)")]
[Comment("后台 - 字典表(需要同步)")]
[Table("Dictionary")]
public partial class Dictionary : BaseFullAuditEntity
{
#region 导航属性
#region 导航属性
[JsonIgnore]
public List<DoctorDictionary> DoctorDicRelationList { get; set; } = new List<DoctorDictionary>();
[JsonIgnore]
@ -26,12 +26,12 @@ public partial class Dictionary : BaseFullAuditEntity
public Guid? ConfigTypeId { get; set; }
[Comment("字典类型- 枚举|bool|下拉框")]
[Comment("字典类型- 枚举|bool|下拉框")]
public DicDataTypeEnum DataTypeEnum { get; set; }
public string Description { get; set; } = null!;
[Comment("是否字典类型配置")]
[Comment("是否字典类型配置")]
public bool IsConfig { get; set; }
public bool IsEnable { get; set; }

View File

@ -1,135 +0,0 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("整个系统,上传记录表")]
[Table("FileUploadRecord")]
public class FileUploadRecord : BaseFullAuditEntity
{
#region 导航属性
[JsonIgnore]
public Trial Trial { get; set; }
[JsonIgnore]
public Subject Subject { get; set; }
[JsonIgnore]
public SubjectVisit SubjectVisit { get; set; }
[JsonIgnore]
public DicomStudy DicomStudy { get; set; }
[JsonIgnore]
public NoneDicomStudy NoneDicomStudy { get; set; }
#endregion
public Guid? TrialId { get; set; }
public Guid? SubjectId { get; set; }
public Guid? SubjectVisitId { get; set; }
public Guid? DicomStudyId { get; set; }
public Guid? NoneDicomStudyId { get; set; }
public string StudyCode { get; set; }
[Comment("文件标识ID")]
public string FileMarkId { get; set; }
[Comment("上传批次")]
public string UploadBatchId { get; set; }
[Comment("该批次数据类型")]
public BatchDataType BatchDataType { get; set; }
[Comment("上传区域")]
public string UploadRegion { get; set; }
[Comment("目标区域")]
public string TargetRegion { get; set; }
[Comment("文件类型")]
public string FileType { get; set; }
public string FileName { get; set; }
public long FileSize { get; set; }
[StringLength(1000)]
public string Path { get; set; }
[Comment("是否需要同步")]
public bool? IsNeedSync { get; set; }
[Comment("同步优先级")]
public int? Priority { get; set; }
[Comment("是否已同步-最后一个任务的状态")]
public bool? IsSync { get; set; }
[Comment("同步结束时间-最后一个任务的时间")]
public DateTime? SyncFinishedTime { get; set; }
public string IP { get; set; }
}
[Comment("同步任务记录表")]
[Table("UploadFileSyncRecord")]
public class UploadFileSyncRecord : BaseFullAuditEntity
{
#region 导航属性
[JsonIgnore]
public FileUploadRecord FileUploadRecord { get; set; }
#endregion
public Guid FileUploadRecordId { get; set; }
public DateTime? StartTime { get; set; }
public DateTime? EndTime { get; set; }
public jobState JobState { get; set; }
public string Msg { get; set; }
}
public enum jobState
{
//待启动
PENDING = 0,
//上传中
RUNNING = 1,
SUCCESS = 2,
FAILED = 3,
CANCELLED = 4
}
public enum BatchDataType
{
//前端自定义 1-99
//后端自定义100开始
DataReconciliation=100,
SiteUserSurvey=101,
DICOMDIR = 102,
EmailAttach=103,
ReadingImportTemplete=105,
ReadingKeyFile=106,
PACSReceive = 107
}

View File

@ -2,13 +2,13 @@ using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Domain.Models;
[Comment("医生 - 基础信息表")]
[Comment("医生 - 基础信息表")]
[Table("Doctor")]
public class Doctor : BaseFullAuditEntity
{
#region 导航属性
#region 导航属性
[Comment("导航属性")]
[Comment("导航属性")]
[JsonIgnore]
public List<DoctorDictionary> DoctorDicRelationList { get; set; } = new List<DoctorDictionary>();
[JsonIgnore]
@ -85,12 +85,12 @@ public class Doctor : BaseFullAuditEntity
public int GCP { get; set; }
/// <summary>
/// GCP证书的时间
/// GCP证书的时间
/// </summary>
public DateTime? GCPTime { get; set; }
/// <summary>
/// GCP机构
/// GCP机构
/// </summary>
[MaxLength]
public string GCPAgencies { get; set; }
@ -187,53 +187,53 @@ public class Doctor : BaseFullAuditEntity
public string WeChat { get; set; } = string.Empty;
/// <summary>
/// 工作兼职
/// 工作兼职
/// </summary>
[MaxLength]
public string WorkPartTime { get; set; } = string.Empty;
/// <summary>
/// 工作兼职En
/// 工作兼职En
/// </summary>
[MaxLength]
public string WorkPartTimeEn { get; set; } = string.Empty;
/// <summary>
/// 概述
/// 概述
/// </summary>
[MaxLength]
public string Summarize { get; set; } = string.Empty;
/// <summary>
/// 概述
/// 概述
/// </summary>
[MaxLength]
public string SummarizeEn { get; set; } = string.Empty;
/// <summary>
/// 银行卡号
/// 银行卡号
/// </summary>
public string BankNum { get; set; } = string.Empty;
/// <summary>
/// 银行名称
/// 银行名称
/// </summary>
[MaxLength]
public string BankName { get; set; } = string.Empty;
/// <summary>
/// 开户行
/// 开户行
/// </summary>
public string OpeningBank { get; set; } = string.Empty;
/// <summary>
/// 身份证号
/// 身份证号
/// </summary>
public string IdCard { get; set; } = string.Empty;
/// <summary>
/// 银行手机号
/// 银行手机号
/// </summary>
public string BankPhoneNum { get; set; } = string.Empty;
@ -242,42 +242,42 @@ public class Doctor : BaseFullAuditEntity
public string FullName => LastName + " / " + FirstName;
/// <summary>
/// 医生Id
/// 医生Id
/// </summary>
public Guid? DoctorId { get; set; }
/// <summary>
/// 项目Id
/// 项目Id
/// </summary>
public Guid? TrialId { get; set; }
/// <summary>
/// 大学
/// 大学
/// </summary>
public string UniversityAffiliated { get; set; } = string.Empty;
/// <summary>
/// 大学
/// 大学
/// </summary>
public string UniversityAffiliatedCN { get; set; } = string.Empty;
/// <summary>
/// 城市
/// 城市
/// </summary>
public string City { get; set; } = string.Empty;
/// <summary>
/// 城市
/// 城市
/// </summary>
public string CityCN { get; set; } = string.Empty;
/// <summary>
/// 医院
/// 医院
/// </summary>
public string HospitalName { get; set; } = string.Empty;
/// <summary>
/// 医院
/// 医院
/// </summary>
public string HospitalNameCN { get; set; } = string.Empty;
}

View File

@ -1,10 +1,10 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生 - 医生字典关联表")]
[Comment("医生 - 医生字典关联表")]
[Table("DoctorDictionary")]
public class DoctorDictionary : Entity
{
#region 导航属性
#region 导航属性
[JsonIgnore]
[ForeignKey("DoctorId")]
public Doctor Doctor { get; set; }

View File

@ -2,44 +2,44 @@ using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Domain.Models;
[Comment("医生 - 概述")]
[Comment("医生 - 概述")]
[Table("DoctorSummarize")]
public class DoctorSummarize : BaseFullAuditEntity
{
/// <summary>
/// 医生Id
/// 医生Id
/// </summary>
public Guid DoctorId { get; set; }
/// <summary>
/// 概述
/// 概述
/// </summary>
[MaxLength]
public string Summarize { get; set; } = string.Empty;
/// <summary>
/// 概述
/// 概述
/// </summary>
[MaxLength]
public string SummarizeEn { get; set; } = string.Empty;
/// <summary>
/// 是否是主模板
/// 是否是主模板
/// </summary>
public bool IsMain { get; set; }
/// <summary>
/// 适应症
/// 适应症
/// </summary>
public string Indication { get; set; }
/// <summary>
/// 适应症
/// 适应症
/// </summary>
public string IndicationEn { get; set; }
/// <summary>
/// 项目Id
/// 项目Id
/// </summary>
public Guid? TrialId { get; set; }

View File

@ -1,10 +1,10 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生计费 - 工作量记录表")]
[Comment("医生计费 - 工作量记录表")]
[Table("DoctorWorkload")]
public class Workload : BaseFullAuditEntity
{
#region 导航属性
#region 导航属性
#endregion

View File

@ -1,10 +1,10 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生 - 教育信息")]
[Comment("医生 - 教育信息")]
[Table("Education")]
public class Education : BaseFullAuditEntity
{
#region 导航属性
#region 导航属性
#endregion
public DateOnly? BeginDate { get; set; }

View File

@ -1,10 +1,10 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生 - 继续教育经历")]
[Comment("医生 - 继续教育经历")]
[Table("Postgraduate")]
public class Postgraduate : BaseFullAuditEntity
{
#region 导航属性
#region 导航属性
[JsonIgnore]
[ForeignKey("HospitalId")]
public Hospital HospitalEnt { get; set; }

View File

@ -1,10 +1,10 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生 - 科研学术记录")]
[Comment("医生 - 科研学术记录")]
[Table("ResearchPublication")]
public partial class ResearchPublication : BaseFullAuditEntity
{
#region 导航属性
#region 导航属性
#endregion
public Guid DoctorId { get; set; }

View File

@ -2,7 +2,7 @@ using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Domain.Models;
[Comment("医生 - 项目临床经历")]
[Comment("医生 - 项目临床经历")]
[Table("TrialExperience")]
public partial class TrialExperience : BaseFullAuditEntity
{
@ -10,7 +10,7 @@ public partial class TrialExperience : BaseFullAuditEntity
#region 导航属性
#region 导航属性
[JsonIgnore]
[ForeignKey("TrialId")]
@ -33,37 +33,37 @@ public partial class TrialExperience : BaseFullAuditEntity
public DateTime? EndTime { get; set; }
/// <summary>
/// 其他分期
/// 其他分期
/// </summary>
public string OtherStages { get; set; } = string.Empty;
/// <summary>
/// 其他标准
/// 其他标准
/// </summary>
public string OtherCriterion { get; set; } = string.Empty;
/// <summary>
/// 适应症的枚举
/// 适应症的枚举
/// </summary>
public int IndicationEnum { get; set; } = -1;
/// <summary>
/// 数据类型
/// 数据类型
/// </summary>
public ExperienceDataType ExperienceDataType { get; set; }
/// <summary>
/// 适应症类型ID
/// 适应症类型ID
/// </summary>
public Guid IndicationTypeId { get; set; } = Guid.Empty;
/// <summary>
/// 项目Id
/// 项目Id
/// </summary>
public Guid? TrialId { get; set; }
/// <summary>
/// 阅片标准
/// 阅片标准
/// </summary>
public CriterionType? CriterionType { get; set; }
}
@ -72,22 +72,22 @@ public partial class TrialExperience : BaseFullAuditEntity
public enum ExperienceDataType
{
/// <summary>
/// 系统手动添加
/// 系统手动添加
/// </summary>
System = 0,
/// <summary>
/// 项目手动添加或者同系统复制过来的
/// 项目手动添加或者同系统复制过来的
/// </summary>
Trial=1,
/// <summary>
/// 项目自动添加
/// 项目自动添加
/// </summary>
TrialAuto = 2,
/// <summary>
/// 系统自动添加
/// 系统自动添加
/// </summary>
SystemAuto = 3,
}

View File

@ -1,6 +1,6 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生计费 - 每月支付记录表")]
[Comment("医生计费 - 每月支付记录表")]
[Table("Payment")]
public partial class Payment : BaseFullAuditEntity
{

View File

@ -1,6 +1,6 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生计费 - 每月支付记录表")]
[Comment("医生计费 - 每月支付记录表")]
[Table("PaymentAdjustment")]
public partial class PaymentAdjustment : BaseFullAuditEntity
{

View File

@ -1,6 +1,6 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生计费 - 每月支付详情表")]
[Comment("医生计费 - 每月支付详情表")]
[Table("PaymentDetail")]
public partial class PaymentDetail : BaseFullAuditEntity
{

View File

@ -1,6 +1,6 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生计费 - 不同时间点价格设置")]
[Comment("医生计费 - 不同时间点价格设置")]
[Table("RankPrice")]
public partial class RankPrice : BaseFullAuditEntity
{

View File

@ -1,6 +1,6 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生计费 - 支付信息表")]
[Comment("医生计费 - 支付信息表")]
[Table("DoctorPayInformation")]
public partial class ReviewerPayInformation : BaseFullAuditEntity
{

View File

@ -1,6 +1,6 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生计费 - 项目支付配置")]
[Comment("医生计费 - 项目支付配置")]
[Table("TrialPaymentPrice")]
public partial class TrialPaymentPrice : BaseFullAuditEntity
{
@ -17,6 +17,6 @@ public partial class TrialPaymentPrice : BaseFullAuditEntity
[DecimalPrecision(18, 2)]
public decimal AdjustmentMultiple { get; set; } = 1;
[Comment("是否有 为新项目")]
[Comment("是否有 为新项目")]
public bool? IsNewTrial { get; set; } = false;
}

View File

@ -1,6 +1,6 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("医生计费 - 奖励")]
[Comment("医生计费 - 奖励")]
[Table("VolumeReward")]
public partial class VolumeReward : BaseFullAuditEntity
{

View File

@ -1,10 +1,10 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("机构 - CRO")]
[Comment("机构 - CRO")]
[Table("CROCompany")]
public class CRO : BaseFullAuditEntity
{
#region 导航属性
#region 导航属性
#endregion
@ -14,7 +14,7 @@ public class CRO : BaseFullAuditEntity
public string CRONameCN { get; set; } = null!;
[Comment("是否是项目级别")]
[Comment("是否是项目级别")]
public bool IsTrialLevel { get; set; }
public Guid? TrialId { get; set; }

View File

@ -1,10 +1,10 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("机构 - Site")]
[Comment("机构 - Site")]
[Table("Site")]
public class Site : BaseFullAuditEntity
{
#region 导航属性
#region 导航属性
[JsonIgnore]
[ForeignKey("HospitalId")]
public Hospital Hospital { get; set; }

View File

@ -1,10 +1,10 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("机构 - Sponsor")]
[Comment("机构 - Sponsor")]
[Table("Sponsor")]
public partial class Sponsor : BaseFullAuditEntity
{
#region 导航属性
#region 导航属性
#endregion
public string SponsorName { get; set; } = String.Empty;

View File

@ -3,11 +3,11 @@ using IRaCIS.Core.Domain.Share;
namespace IRaCIS.Core.Domain.Models;
[Comment("后台 - 系统账户角色关系表")]
[Comment("后台 - 系统账户角色关系表")]
[Table("User")]
public class UserRole : BaseFullAuditEntity
{
#region 导航属性
#region 导航属性
[ForeignKey("IdentityUserId")]
[JsonIgnore]
@ -37,24 +37,24 @@ public class UserRole : BaseFullAuditEntity
public string LastName { get; set; }
[Comment("自动切换下一个任务")]
[Comment("自动切换下一个任务")]
public bool AutoCutNextTask { get; set; }
/// <summary>
/// 是否双屏
/// 是否双屏
/// </summary>
public bool IsDoubleScreen { get; set; } = false;
[Comment("医生生成账号后,会有值")]
[Comment("医生生成账号后,会有值")]
public Guid? DoctorId { get; set; }
public UserTypeEnum UserTypeEnum { get; set; }
public Guid UserTypeId { get; set; }
#region 新增字段
#region 新增字段
public Guid IdentityUserId { get; set; }
@ -63,7 +63,7 @@ public class UserRole : BaseFullAuditEntity
#endregion
}
[Comment("后台 - 系统真实账户表")]
[Comment("后台 - 系统真实账户表")]
[Table("IdentityUser")]
public class IdentityUser : BaseFullAuditEntity
{
@ -87,7 +87,7 @@ public class IdentityUser : BaseFullAuditEntity
[Projectable]
public string FullName => LastName + " / " + FirstName;
#region 用户信息
#region 用户信息
public int Code { get; set; }
public string UserCode { get; set; }
@ -117,20 +117,20 @@ public class IdentityUser : BaseFullAuditEntity
public string PositionName { get; set; }
[Comment("这个字段废除,放在用户角色上面,后续删除")]
[Comment("这个字段废除,放在用户角色上面,后续删除")]
public bool AutoCutNextTask { get; set; }
public string DepartmentName { get; set; }
[Comment("首次登录需要修改密码")]
[Comment("首次登录需要修改密码")]
public bool IsFirstAdd { get; set; } = true;
public bool IsTestUser { get; set; }
[Comment("内部用户 外部用户")]
[Comment("内部用户 外部用户")]
public bool IsZhiZhun { get; set; }
[Comment("上一次修改密码的时间")]
[Comment("上一次修改密码的时间")]
public DateTime? LastChangePassWordTime { get; set; }
public string LastLoginIP { get; set; }
@ -140,7 +140,7 @@ public class IdentityUser : BaseFullAuditEntity
#endregion
#region 用户来源
#region 用户来源
public UserCeateSource UserCeateSource { get; set; }
@ -149,12 +149,12 @@ public class IdentityUser : BaseFullAuditEntity
#endregion
/// <summary>
/// 用户协议Id
/// 用户协议Id
/// </summary>
public Guid? UserAgreementId { get; set; }
/// <summary>
/// 隐私政策Id
/// 隐私政策Id
/// </summary>
public Guid? PrivacyPolicyId { get; set; }
}

View File

@ -1,10 +1,10 @@
namespace IRaCIS.Core.Domain.Models;
[Comment("后台 - 系统用户类型菜单中间关系表 (需要同步)")]
[Comment("后台 - 系统用户类型菜单中间关系表 (需要同步)")]
[Table("UserTypeMenu")]
public partial class UserTypeMenu : Entity
{
#region 导航属性
#region 导航属性
[JsonIgnore]
[ForeignKey("UserTypeId")]

View File

@ -180,11 +180,6 @@ public class ReadingQuestionCriterionTrial : BaseAddAuditEntity
/// 阅片工具
/// </summary>
public List<string> ReadingToolList { get; set; } = new List<string>();
/// <summary>
/// 分割工具
/// </summary>
public List<string> SegmentToolList { get; set; } = new List<string>();
}

Some files were not shown because too many files have changed in this diff Show More