查询某个项目下患者最新的检查列表初步修改
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-03-18 13:52:57 +08:00
parent 613cf6441b
commit e06b47c8b3
2 changed files with 84 additions and 34 deletions

View File

@ -40,6 +40,9 @@ namespace IRaCIS.Application.Contracts
[NotDefault]
public Guid PacsDicomAEId { get; set; }
public Guid? TrialId { get; set; }
public List<string>? ModalitiesInStudyList { get; set; }
}

View File

@ -51,6 +51,7 @@ using DocumentFormat.OpenXml.Vml.Office;
using IRaCIS.Core.Infra.EFCore.Migrations;
using System.Dynamic;
using System.Threading.Channels;
using NPOI.HSSF.Record.Chart;
namespace IRaCIS.Application.Services
@ -2981,7 +2982,6 @@ namespace IRaCIS.Application.Services
var @lock = _distributedLockProvider.CreateLock($"CFind");
var maxStudyCount = find.MaxStudyCount > 0 ? find.MaxStudyCount : 50;
var client = DicomClientFactory.Create(find.IP, find.Port, false, hirClient.CalledAE, find.CalledAE);
@ -2995,7 +2995,10 @@ namespace IRaCIS.Application.Services
{
using (@lock.Acquire())
{
if (result.Count >= maxStudyCount)
var maxStudyCount = find.MaxStudyCount > 0 ? find.MaxStudyCount : 50;
//查询该项目下的患者,那么不限制总数,否则需要限制总数
if (inQuery.TrialId == null && result.Count >= maxStudyCount)
{
response.Status = DicomStatus.Cancel;
@ -3039,8 +3042,15 @@ namespace IRaCIS.Application.Services
};
//判断前段有没有传递时间
//看当前前端有没有传递modality有的话以前端为准没有的话以配置为准 构造同样数量的请求
var requestModalityList = (inQuery.ModalitiesInStudyList != null && inQuery.ModalitiesInStudyList.Count > 0) ? inQuery.ModalitiesInStudyList : find.ModalityList;
var modality = string.Join($"\\", requestModalityList);
if (inQuery.TrialId == null)
{
//判断前段有没有传递时间
if (find.PacsSearchMaxDays != 0)
{
//0 天 + 前端不传递就是不限制
@ -3048,30 +3058,11 @@ namespace IRaCIS.Application.Services
}
//看当前前端有没有传递modality有的话以前端为准没有的话以配置为准 构造同样数量的请求
var requestModalityList = (inQuery.ModalitiesInStudyList != null && inQuery.ModalitiesInStudyList.Count > 0) ? inQuery.ModalitiesInStudyList : find.ModalityList;
//if (find.IsSupportMutiModality || requestModalityList.Count > 0)
{
var modality = string.Join($"\\", requestModalityList);
var request = CreateStudyRequest(inQuery, modality);
request.OnResponseReceived += responseDelegate;
await client.AddRequestAsync(request);
}
//else
//{
// var request = CreateStudyRequest(inQuery, modality);
// request.OnResponseReceived += responseDelegate;
// await client.AddRequestAsync(request);
//}
await client.SendAsync();
@ -3085,6 +3076,54 @@ namespace IRaCIS.Application.Services
{
item.IsStudyExist = existStudyIdList.Any(t => t == item.StudyInstanceUID);
}
}
else
{
//找到该项目下的患者,以及每个患者最新的检查之后的检查
var list = await _subjectRepository.Where(t => t.TrialId == inQuery.TrialId).SelectMany(t => t.SubjectPatientList).Select(t => new
{
t.Patient.PatientIdStr,
MaxStudyTime = t.Patient.SCPStudyList.Max(t => t.StudyTime)
}).ToListAsync();
foreach (var patient in list)
{
var cloneInQuery = inQuery.Clone();
cloneInQuery.PatientID = patient.PatientIdStr;
cloneInQuery.StudyDate = patient.MaxStudyTime?.ToString("yyyyMMdd") + "-";
cloneInQuery.StudyTime = patient.MaxStudyTime?.ToString("HHmmss") + "-";
var request = CreateStudyRequest(cloneInQuery, modality);
request.OnResponseReceived += responseDelegate;
await client.AddRequestAsync(request);
}
await client.SendAsync();
#region 测试查询出来的数据是否有问题 测试ok后可以删除
var resultInstanceUidList = result.Select(t => t.StudyInstanceUID).ToList();
var existStudyIdList = _studyRepository.Where(t => resultInstanceUidList.Contains(t.StudyInstanceUid))
.Select(t => t.StudyInstanceUid).ToList();
foreach (var item in result)
{
item.IsStudyExist = existStudyIdList.Any(t => t == item.StudyInstanceUID);
}
#endregion
}
}
@ -3094,6 +3133,14 @@ namespace IRaCIS.Application.Services
}
//public async Task<IResponseOutput<List<SCUStudyView>>> GetTrialPatientStudyList(SCUQuery inQuery,
// [FromServices] IRepository<DicomAE> _dicomAEReposiotry,
// [FromServices] ILogger<PatientService> _logger)
//{
//}
/// <summary>
/// 批量验证Cmove 检查在系统存在与否
/// </summary>