课题组打标签
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
75f0f5e3a5
commit
806f829e08
|
|
@ -46,6 +46,10 @@ namespace IRaCIS.Core.SCP.Service
|
|||
|
||||
private SCPImageUpload _upload { get; set; }
|
||||
|
||||
public HospitalGroup CurrentHospitalGroup { get; set; }
|
||||
|
||||
private List<Guid> HospitalGroupIdList { get; set; }
|
||||
|
||||
|
||||
private static readonly DicomTransferSyntax[] _acceptedTransferSyntaxes = new DicomTransferSyntax[]
|
||||
{
|
||||
|
|
@ -99,11 +103,19 @@ namespace IRaCIS.Core.SCP.Service
|
|||
|
||||
|
||||
|
||||
var _hospitalGroupRepository = _serviceProvider.GetService<IRepository<HospitalGroup>>();
|
||||
|
||||
|
||||
var list = _hospitalGroupRepository.Where(t => t.IsEnable).ToList();
|
||||
|
||||
CurrentHospitalGroup = list.FirstOrDefault(t => t.CallingAE == Association.CallingAE);
|
||||
|
||||
|
||||
|
||||
|
||||
var calledAEList = option.CalledAEList;
|
||||
|
||||
if (!calledAEList.Contains(association.CalledAE))
|
||||
|
||||
//if (association.CalledAE != "STORESCP")
|
||||
{
|
||||
|
||||
Log.Logger.Warning($"拒绝CalledAE:{association.CalledAE}的连接");
|
||||
|
|
@ -169,11 +181,14 @@ namespace IRaCIS.Core.SCP.Service
|
|||
var _dictionaryRepository = _serviceProvider.GetService<IRepository<Dictionary>>();
|
||||
var _seriesRepository = _serviceProvider.GetService<IRepository<SCPSeries>>();
|
||||
var _studyRepository = _serviceProvider.GetService<IRepository<SCPStudy>>();
|
||||
var _studyGroupRepository = _serviceProvider.GetService<IRepository<SCPStudyHospitalGroup>>();
|
||||
|
||||
var _cmoveStudyRepository = _serviceProvider.GetService<IRepository<CmoveStudy>>();
|
||||
|
||||
var dicModalityList = _dictionaryRepository.Where(t => t.Code == "Modality").SelectMany(t => t.ChildList.Select(c => c.Value)).ToList();
|
||||
var seriesModalityList = _seriesRepository.Where(t => _SCPStudyIdList.Contains(t.StudyId)).Select(t => new { SCPStudyId = t.StudyId, t.Modality }).ToList();
|
||||
var seriesModalityList = _seriesRepository.Where(t => _SCPStudyIdList.Contains(t.StudyId)).Select(t => new { SCPStudyId = t.StudyId, t.Modality, t.StudyInstanceUid }).ToList();
|
||||
|
||||
foreach (var g in seriesModalityList.GroupBy(t => t.SCPStudyId))
|
||||
foreach (var g in seriesModalityList.GroupBy(t => new { t.SCPStudyId, t.StudyInstanceUid }))
|
||||
{
|
||||
var modality = string.Join('、', g.Select(t => t.Modality).Distinct().ToList());
|
||||
|
||||
|
|
@ -194,7 +209,32 @@ namespace IRaCIS.Core.SCP.Service
|
|||
modalityForEdit = "PET-CT";
|
||||
}
|
||||
|
||||
await _studyRepository.BatchUpdateNoTrackingAsync(t => t.Id == g.Key, u => new SCPStudy() { Modalities = modality, ModalityForEdit = modalityForEdit });
|
||||
await _studyRepository.BatchUpdateNoTrackingAsync(t => t.Id == g.Key.SCPStudyId, u => new SCPStudy() { Modalities = modality, ModalityForEdit = modalityForEdit });
|
||||
|
||||
//添加课题组标签
|
||||
if (CurrentHospitalGroup != null)
|
||||
{
|
||||
if (!_studyGroupRepository.Any(t => t.SCPStudyId == g.Key.SCPStudyId && t.HospitalGroupId == CurrentHospitalGroup.Id))
|
||||
{
|
||||
await _studyGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = g.Key.SCPStudyId, HospitalGroupId = CurrentHospitalGroup.Id });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var findCmoveInfo = _cmoveStudyRepository.Where(t => t.StudyInstanceUIDList.Any(c => c == g.Key.StudyInstanceUid)).OrderByDescending(t => t.CreateTime).FirstOrDefault();
|
||||
|
||||
if (findCmoveInfo != null)
|
||||
{
|
||||
foreach (var item in findCmoveInfo.HopitalGroupIdList)
|
||||
{
|
||||
await _studyGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = g.Key.SCPStudyId, HospitalGroupId = item });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Logger.Error($"未找到{g.Key.StudyInstanceUid}的Cmove记录");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ namespace IRaCIS.Application.Contracts
|
|||
public Guid PacsDicomAEId { get; set; }
|
||||
|
||||
public List<string> StudyInstanceUIDList { get; set; }
|
||||
|
||||
public List<Guid> HospitalGroupIdList { get; set; }
|
||||
}
|
||||
|
||||
public class SCUStudyView : SCUBasicInfo
|
||||
|
|
|
|||
|
|
@ -126,7 +126,15 @@ public class HospitalGroupService(IRepository<HospitalGroup> _hospitalGroupRepos
|
|||
[HttpDelete("{hospitalGroupId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteHospitalGroup(Guid hospitalGroupId)
|
||||
{
|
||||
var success = await _hospitalGroupRepository.DeleteFromQueryAsync(t => t.Id == hospitalGroupId, true);
|
||||
if (_hospitalGroupIdentityUserRepository.Any(t => t.HospitalGroupId == hospitalGroupId && t.IsManager == false))
|
||||
{
|
||||
return ResponseOutput.NotOk(_localizer["HospitalGroup_ExistUser"]);
|
||||
}
|
||||
|
||||
var success = await _hospitalGroupRepository.DeleteFromQueryAsync(t => t.Id == hospitalGroupId);
|
||||
|
||||
await _hospitalGroupIdentityUserRepository.DeleteFromQueryAsync(t => t.Id == hospitalGroupId && t.IsManager, true);
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ namespace IRaCIS.Application.Services
|
|||
public class PatientService(IRepository<SCPStudySubjectVisit> _studySubjectVisitRepository,
|
||||
IRepository<SubjectPatient> _subjectPatientRepository, IRepository<SCPStudyHospitalGroup> _SCPStudyHospitalGroupRepository,
|
||||
IRepository<Trial> _trialRepository,
|
||||
IRepository<CmoveStudy> _cmoveStudyRepository,
|
||||
IRepository<SCPPatient> _patientRepository,
|
||||
IRepository<HospitalGroup> _hospitalGroupRepository,
|
||||
IRepository<SCPStudy> _studyRepository,
|
||||
|
|
@ -3503,6 +3504,8 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
var cmoveRequestList = new List<DicomCMoveRequest>();
|
||||
|
||||
var cmoveStudyUIdList = new List<string>();
|
||||
|
||||
foreach (var item in inCommand.StudyInstanceUIDList)
|
||||
{
|
||||
|
||||
|
|
@ -3516,6 +3519,8 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
await _fusionCache.SetAsync(CacheKeys.CmoveStudyId(item), item, TimeSpan.FromMinutes(cmoveConfig.CmoveIntervalMinutes));
|
||||
|
||||
cmoveStudyUIdList.Add(item);
|
||||
|
||||
var cmoveRequest = new DicomCMoveRequest(hirServer.CalledAE, item);
|
||||
|
||||
cmoveRequest.OnResponseReceived += responseDelegate;
|
||||
|
|
@ -3533,8 +3538,15 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
}
|
||||
|
||||
await client.AddRequestsAsync(cmoveRequestList);
|
||||
await client.SendAsync();
|
||||
if (cmoveRequestList.Count > 0)
|
||||
{
|
||||
await _cmoveStudyRepository.AddAsync(new CmoveStudy() { CallingAE = hirClient.CalledAE, CalledAE = find.CalledAE, StudyInstanceUIDList = cmoveStudyUIdList, HopitalGroupIdList = inCommand.HospitalGroupIdList }, true);
|
||||
|
||||
await client.AddRequestsAsync(cmoveRequestList);
|
||||
await client.SendAsync();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
//await task;
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public class CmoveStudy : BaseFullAuditEntity
|
||||
{
|
||||
public List<string> StudyInstanceUID { get; set; }
|
||||
public List<string> StudyInstanceUIDList { get; set; }
|
||||
|
||||
public string CallingAE { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -589,6 +589,8 @@ public class IRaCISDBContext : DbContext
|
|||
|
||||
public virtual DbSet<TrialIdentityUser> TrialIdentityUser { get; set; }
|
||||
|
||||
public virtual DbSet<CmoveStudy> CmoveStudy { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class TestLength : Entity
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class cmoveadd : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CmoveStudy",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
StudyInstanceUIDList = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CallingAE = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||
CalledAE = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||
HopitalGroupIdList = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CmoveStudy", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CmoveStudy_User_CreateUserId",
|
||||
column: x => x.CreateUserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CmoveStudy_CreateUserId",
|
||||
table: "CmoveStudy",
|
||||
column: "CreateUserId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CmoveStudy");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -493,6 +493,48 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.CmoveStudy", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("CalledAE")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("CallingAE")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("CreateUserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("HopitalGroupIdList")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("StudyInstanceUIDList")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("UpdateUserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreateUserId");
|
||||
|
||||
b.ToTable("CmoveStudy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.CommonDocument", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -14552,6 +14594,17 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.Navigation("CreateUserRole");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.CmoveStudy", b =>
|
||||
{
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreateUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CreateUserRole");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.CommonDocument", b =>
|
||||
{
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||
|
|
|
|||
Loading…
Reference in New Issue