查询某个项目下患者最新的检查列表初步修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
613cf6441b
commit
e06b47c8b3
|
@ -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; }
|
||||
}
|
||||
|
||||
|
|
|
@ -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,52 +3042,88 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
};
|
||||
|
||||
//判断前段有没有传递时间
|
||||
|
||||
if (find.PacsSearchMaxDays != 0)
|
||||
{
|
||||
//0 天 + 前端不传递就是不限制
|
||||
inQuery.StudyDate = inQuery.StudyDate.IsNullOrEmpty() ? $"{DateTime.Now.AddDays(-(find.PacsSearchMaxDays - 1)).ToString("yyyyMMdd")}-{DateTime.Now.ToString("yyyyMMdd")}" : inQuery.StudyDate;
|
||||
|
||||
}
|
||||
|
||||
//看当前前端有没有传递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);
|
||||
|
||||
if (inQuery.TrialId == null)
|
||||
{
|
||||
var modality = string.Join($"\\", requestModalityList);
|
||||
//判断前段有没有传递时间
|
||||
if (find.PacsSearchMaxDays != 0)
|
||||
{
|
||||
//0 天 + 前端不传递就是不限制
|
||||
inQuery.StudyDate = inQuery.StudyDate.IsNullOrEmpty() ? $"{DateTime.Now.AddDays(-(find.PacsSearchMaxDays - 1)).ToString("yyyyMMdd")}-{DateTime.Now.ToString("yyyyMMdd")}" : inQuery.StudyDate;
|
||||
|
||||
}
|
||||
|
||||
var request = CreateStudyRequest(inQuery, modality);
|
||||
|
||||
request.OnResponseReceived += responseDelegate;
|
||||
|
||||
await client.AddRequestAsync(request);
|
||||
|
||||
await client.SendAsync();
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
|
||||
// var request = CreateStudyRequest(inQuery, modality);
|
||||
|
||||
// request.OnResponseReceived += responseDelegate;
|
||||
|
||||
// await client.AddRequestAsync(request);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
await client.SendAsync();
|
||||
|
||||
|
||||
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)
|
||||
else
|
||||
{
|
||||
item.IsStudyExist = existStudyIdList.Any(t => t == item.StudyInstanceUID);
|
||||
//找到该项目下的患者,以及每个患者最新的检查之后的检查
|
||||
|
||||
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>
|
||||
|
|
Loading…
Reference in New Issue