Compare commits
No commits in common. "67e7eaaa960c7e5838889846ab5f9a69b0bf601a" and "29093e5617d70e78d5c266b6bc98edff05ad0e6e" have entirely different histories.
67e7eaaa96
...
29093e5617
|
|
@ -45,11 +45,9 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
//private IServiceProvider _injectServiceProvider { get; set; }
|
//private IServiceProvider _injectServiceProvider { get; set; }
|
||||||
private IServiceProvider _serviceProvider { get; set; }
|
private IServiceProvider _serviceProvider { get; set; }
|
||||||
|
|
||||||
private List<Guid> _SCPStudyIdList => _ImageUploadList.Where(t => t.SCPStudyId != Guid.Empty).Select(t => t.SCPStudyId).ToList();
|
private List<Guid> _SCPStudyIdList { get; set; } = new List<Guid>();
|
||||||
|
|
||||||
|
private List<string> _StudyInstanceUIdList { get; set; } = new List<string>();
|
||||||
|
|
||||||
private List<ImageUploadInfo> _ImageUploadList { get; set; } = new List<ImageUploadInfo>();
|
|
||||||
|
|
||||||
private SCPImageUpload _upload { get; set; }
|
private SCPImageUpload _upload { get; set; }
|
||||||
|
|
||||||
|
|
@ -171,9 +169,7 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
var _SCPImageUploadRepository = _serviceProvider.GetService<IRepository<SCPImageUpload>>();
|
var _SCPImageUploadRepository = _serviceProvider.GetService<IRepository<SCPImageUpload>>();
|
||||||
|
|
||||||
_upload.EndTime = DateTime.Now;
|
_upload.EndTime = DateTime.Now;
|
||||||
_upload.StudyCount = _ImageUploadList.Count;
|
_upload.StudyCount = _StudyInstanceUIdList.Count;
|
||||||
|
|
||||||
_upload.UploadJsonStr = (new SCPImageLog() { UploadList = _ImageUploadList }).ToJsonStr();
|
|
||||||
|
|
||||||
//可能是测试echo 导致记录了
|
//可能是测试echo 导致记录了
|
||||||
await _SCPImageUploadRepository.AddAsync(_upload, _upload.FileCount > 0 ? true : false);
|
await _SCPImageUploadRepository.AddAsync(_upload, _upload.FileCount > 0 ? true : false);
|
||||||
|
|
@ -264,7 +260,6 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
string studyInstanceUid = request.Dataset.GetSingleValueOrDefault(DicomTag.StudyInstanceUID, string.Empty);
|
string studyInstanceUid = request.Dataset.GetSingleValueOrDefault(DicomTag.StudyInstanceUID, string.Empty);
|
||||||
string seriesInstanceUid = request.Dataset.GetSingleValueOrDefault(DicomTag.SeriesInstanceUID, string.Empty);
|
string seriesInstanceUid = request.Dataset.GetSingleValueOrDefault(DicomTag.SeriesInstanceUID, string.Empty);
|
||||||
string sopInstanceUid = request.Dataset.GetSingleValueOrDefault(DicomTag.SOPInstanceUID, string.Empty);
|
string sopInstanceUid = request.Dataset.GetSingleValueOrDefault(DicomTag.SOPInstanceUID, string.Empty);
|
||||||
string patientIdStr = request.Dataset.GetSingleValueOrDefault(DicomTag.PatientID, string.Empty);
|
|
||||||
|
|
||||||
if (studyInstanceUid.IsNullOrEmpty() || seriesInstanceUid.IsNullOrEmpty() || sopInstanceUid.IsNullOrEmpty())
|
if (studyInstanceUid.IsNullOrEmpty() || seriesInstanceUid.IsNullOrEmpty() || sopInstanceUid.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
|
|
@ -273,10 +268,9 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
return new DicomCStoreResponse(request, DicomStatus.Success);
|
return new DicomCStoreResponse(request, DicomStatus.Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
//确保来了影像集合存在
|
if (!_StudyInstanceUIdList.Contains(studyInstanceUid))
|
||||||
if (!_ImageUploadList.Any(t => t.StudyInstanceUid == studyInstanceUid))
|
|
||||||
{
|
{
|
||||||
_ImageUploadList.Add(new ImageUploadInfo() { StudyInstanceUid = studyInstanceUid });
|
_StudyInstanceUIdList.Add(studyInstanceUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
Guid seriesId = IdentifierHelper.CreateGuid(studyInstanceUid, seriesInstanceUid);
|
Guid seriesId = IdentifierHelper.CreateGuid(studyInstanceUid, seriesInstanceUid);
|
||||||
|
|
@ -389,6 +383,44 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
{
|
{
|
||||||
var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(request.Dataset, storeRelativePath, Association.CallingAE, Association.CalledAE, fileSize);
|
var scpStudyId = await dicomArchiveService.ArchiveDicomFileAsync(request.Dataset, storeRelativePath, Association.CallingAE, Association.CalledAE, fileSize);
|
||||||
|
|
||||||
|
if (!_SCPStudyIdList.Contains(scpStudyId))
|
||||||
|
{
|
||||||
|
_SCPStudyIdList.Add(scpStudyId);
|
||||||
|
|
||||||
|
#region 给检查打课题组标签
|
||||||
|
|
||||||
|
//添加课题组标签
|
||||||
|
if (CurrentHospitalGroup != null)
|
||||||
|
{
|
||||||
|
if (!_studyGroupRepository.Any(t => t.SCPStudyId == scpStudyId && t.HospitalGroupId == CurrentHospitalGroup.Id))
|
||||||
|
{
|
||||||
|
await _studyGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = scpStudyId, HospitalGroupId = CurrentHospitalGroup.Id });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var findCmoveInfo = _cmoveStudyRepository.Where(t => t.StudyInstanceUIDList.Any(c => c == studyInstanceUid)).OrderByDescending(t => t.CreateTime).FirstOrDefault();
|
||||||
|
|
||||||
|
if (findCmoveInfo != null)
|
||||||
|
{
|
||||||
|
foreach (var item in findCmoveInfo.HopitalGroupIdList)
|
||||||
|
{
|
||||||
|
if (!_studyGroupRepository.Any(t => t.SCPStudyId == scpStudyId && t.HospitalGroupId == item))
|
||||||
|
{
|
||||||
|
await _studyGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = scpStudyId, HospitalGroupId = item });
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.Logger.Warning($"未找到{studyInstanceUid}的Cmove记录");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
var series = await _seriesRepository.FirstOrDefaultAsync(t => t.Id == seriesId);
|
var series = await _seriesRepository.FirstOrDefaultAsync(t => t.Id == seriesId);
|
||||||
|
|
||||||
//没有缩略图
|
//没有缩略图
|
||||||
|
|
@ -420,81 +452,22 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
await _seriesRepository.SaveChangesAsync();
|
await _seriesRepository.SaveChangesAsync();
|
||||||
|
|
||||||
if (_ImageUploadList.Any(t => t.StudyInstanceUid == studyInstanceUid))
|
|
||||||
{
|
|
||||||
var find = _ImageUploadList.FirstOrDefault(t => t.StudyInstanceUid.Equals(studyInstanceUid));
|
|
||||||
|
|
||||||
|
|
||||||
find.SuccessImageCount++;
|
|
||||||
|
|
||||||
if (!find.PatientNameList.Any(t => t == patientIdStr) && patientIdStr.IsNotNullOrEmpty())
|
|
||||||
{
|
|
||||||
find.PatientNameList.Add(patientIdStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
//首次 (默认是Guid 空,数据库归档出了Id)
|
|
||||||
if (find.SCPStudyId != scpStudyId)
|
|
||||||
{
|
|
||||||
find.SCPStudyId = scpStudyId;
|
|
||||||
|
|
||||||
#region 给检查打课题组标签
|
|
||||||
|
|
||||||
//添加课题组标签
|
|
||||||
if (CurrentHospitalGroup != null)
|
|
||||||
{
|
|
||||||
if (!_studyGroupRepository.Any(t => t.SCPStudyId == scpStudyId && t.HospitalGroupId == CurrentHospitalGroup.Id))
|
|
||||||
{
|
|
||||||
await _studyGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = scpStudyId, HospitalGroupId = CurrentHospitalGroup.Id });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var findCmoveInfo = _cmoveStudyRepository.Where(t => t.StudyInstanceUIDList.Any(c => c == studyInstanceUid)).OrderByDescending(t => t.CreateTime).FirstOrDefault();
|
|
||||||
|
|
||||||
if (findCmoveInfo != null)
|
|
||||||
{
|
|
||||||
foreach (var item in findCmoveInfo.HopitalGroupIdList)
|
|
||||||
{
|
|
||||||
if (!_studyGroupRepository.Any(t => t.SCPStudyId == scpStudyId && t.HospitalGroupId == item))
|
|
||||||
{
|
|
||||||
await _studyGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = scpStudyId, HospitalGroupId = item });
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log.Logger.Warning($"未找到{studyInstanceUid}的Cmove记录");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
||||||
Log.Logger.Warning($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} 传输处理异常:{ex.ToString()}");
|
Log.Logger.Warning($"CallingAE:{Association.CallingAE} CalledAE:{Association.CalledAE} 传输处理异常:{ex.ToString()}");
|
||||||
|
|
||||||
if (_ImageUploadList.Any(t => t.StudyInstanceUid == studyInstanceUid))
|
|
||||||
{
|
|
||||||
var find = _ImageUploadList.FirstOrDefault(t => t.StudyInstanceUid.Equals(studyInstanceUid));
|
|
||||||
|
|
||||||
find.FailedImageCount++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//监控信息设置
|
|
||||||
_upload.FileCount++;
|
|
||||||
_upload.FileSize = _upload.FileSize + fileSize;
|
|
||||||
return new DicomCStoreResponse(request, DicomStatus.Success);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//监控信息设置
|
||||||
|
_upload.FileCount++;
|
||||||
|
_upload.FileSize = _upload.FileSize + fileSize;
|
||||||
|
return new DicomCStoreResponse(request, DicomStatus.Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,6 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
findStudy.PatientName = dataset.GetSingleValueOrDefault(DicomTag.PatientName, string.Empty);
|
findStudy.PatientName = dataset.GetSingleValueOrDefault(DicomTag.PatientName, string.Empty);
|
||||||
findStudy.PatientSex = dataset.GetSingleValueOrDefault(DicomTag.PatientSex, string.Empty);
|
findStudy.PatientSex = dataset.GetSingleValueOrDefault(DicomTag.PatientSex, string.Empty);
|
||||||
findStudy.PatientAge = dataset.GetSingleValueOrDefault(DicomTag.PatientAge, string.Empty);
|
findStudy.PatientAge = dataset.GetSingleValueOrDefault(DicomTag.PatientAge, string.Empty);
|
||||||
findStudy.UpdateTime = DateTime.Now;
|
|
||||||
|
|
||||||
await _patientRepository.BatchUpdateNoTrackingAsync(t => t.Id == findStudy.PatientId, u => new SCPPatient() { LatestPushTime = DateTime.Now });
|
await _patientRepository.BatchUpdateNoTrackingAsync(t => t.Id == findStudy.PatientId, u => new SCPPatient() { LatestPushTime = DateTime.Now });
|
||||||
}
|
}
|
||||||
|
|
@ -272,7 +271,6 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
{
|
{
|
||||||
findSerice.DicomSeriesDate = dataset.GetSingleValueOrDefault(DicomTag.SeriesDate, string.Empty);
|
findSerice.DicomSeriesDate = dataset.GetSingleValueOrDefault(DicomTag.SeriesDate, string.Empty);
|
||||||
findSerice.DicomSeriesTime = dataset.GetSingleValueOrDefault(DicomTag.SeriesTime, string.Empty);
|
findSerice.DicomSeriesTime = dataset.GetSingleValueOrDefault(DicomTag.SeriesTime, string.Empty);
|
||||||
findSerice.UpdateTime=DateTime.Now;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var transferSyntaxUID = dataset.GetSingleValueOrDefault(DicomTag.TransferSyntaxUID, string.Empty);
|
var transferSyntaxUID = dataset.GetSingleValueOrDefault(DicomTag.TransferSyntaxUID, string.Empty);
|
||||||
|
|
@ -334,7 +332,6 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
findInstance.TransferSyntaxUID = transferSyntaxUID;
|
findInstance.TransferSyntaxUID = transferSyntaxUID;
|
||||||
findInstance.MediaStorageSOPInstanceUID = dataset.GetSingleValueOrDefault(DicomTag.MediaStorageSOPInstanceUID, string.Empty);
|
findInstance.MediaStorageSOPInstanceUID = dataset.GetSingleValueOrDefault(DicomTag.MediaStorageSOPInstanceUID, string.Empty);
|
||||||
findInstance.IsEncapsulated = isEncapsulated;
|
findInstance.IsEncapsulated = isEncapsulated;
|
||||||
findInstance.UpdateTime = DateTime.Now;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPatientNeedAdd)
|
if (isPatientNeedAdd)
|
||||||
|
|
|
||||||
|
|
@ -1042,8 +1042,6 @@ namespace IRaCIS.Application.Contracts
|
||||||
|
|
||||||
public int StudyCount { get; set; }
|
public int StudyCount { get; set; }
|
||||||
|
|
||||||
public string UploadJsonStr { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public class VisitPatientStudyView : PatientStudySelectDto
|
public class VisitPatientStudyView : PatientStudySelectDto
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.Domain.Models;
|
namespace IRaCIS.Core.Domain.Models;
|
||||||
|
|
||||||
[Comment("项目中心 - 影像推送记录")]
|
[Comment("项目中心 - 影像推送记录")]
|
||||||
|
|
@ -16,36 +14,4 @@ public class SCPImageUpload : BaseAddAuditEntity
|
||||||
public long FileSize { get; set; }
|
public long FileSize { get; set; }
|
||||||
public int StudyCount { get; set; }
|
public int StudyCount { get; set; }
|
||||||
|
|
||||||
[MaxLength]
|
|
||||||
public string UploadJsonStr { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class SCPImageLog
|
|
||||||
{
|
|
||||||
////当前传输 检查患者名字,一个检查可能患者名字不同 记录去重的,然后,拼接
|
|
||||||
//public string PatientNames => string.Join(",", UploadList.SelectMany(t => t.PatientNameList).ToList());
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 归档到数据库的检查Id
|
|
||||||
/// </summary>
|
|
||||||
public List<Guid> SCPStudyIdList => UploadList.Select(t => t.SCPStudyId).ToList();
|
|
||||||
|
|
||||||
|
|
||||||
public List<ImageUploadInfo> UploadList { get; set; } = new List<ImageUploadInfo>();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ImageUploadInfo
|
|
||||||
{
|
|
||||||
public List<string> PatientNameList { get; set; } = new List<string>();
|
|
||||||
|
|
||||||
public Guid SCPStudyId { get; set; }
|
|
||||||
|
|
||||||
public string StudyInstanceUid { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public int FailedImageCount { get; set; }
|
|
||||||
|
|
||||||
public int SuccessImageCount { get; set; }
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,29 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class scpImageUploadModify : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "UploadJsonStr",
|
|
||||||
table: "SCPImageUpload",
|
|
||||||
type: "nvarchar(max)",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "UploadJsonStr",
|
|
||||||
table: "SCPImageUpload");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -7748,10 +7748,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.Property<int>("StudyCount")
|
b.Property<int>("StudyCount")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("UploadJsonStr")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("CreateUserId");
|
b.HasIndex("CreateUserId");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue