From f7bc32ed90a683833f06a988a7270172db3b7129 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Mon, 18 May 2026 17:13:59 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=91=E5=AE=9A=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 2 +-
.../Service/Visit/PatientService.cs | 29 ++++++++++++++++---
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 657a1f9fc..7b1bf3fa3 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -15963,7 +15963,7 @@
-
+
提交 患者检查和访视的绑定
diff --git a/IRaCIS.Core.Application/Service/Visit/PatientService.cs b/IRaCIS.Core.Application/Service/Visit/PatientService.cs
index dcfcf84a0..c66066eab 100644
--- a/IRaCIS.Core.Application/Service/Visit/PatientService.cs
+++ b/IRaCIS.Core.Application/Service/Visit/PatientService.cs
@@ -5,6 +5,7 @@ using IRaCIS.Core.Application.Contracts.Dicom.DTO;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
+using MassTransit;
using Microsoft.AspNetCore.Mvc;
using Pipelines.Sockets.Unofficial.Arenas;
using System.Linq.Dynamic.Core;
@@ -382,7 +383,8 @@ namespace IRaCIS.Core.Application.Service
public async Task SubmitVisitStudyBinding(SubmitVisitStudyBindingCommand inCommand,
[FromServices] IRepository _dicomstudyRepository,
[FromServices] IRepository _dicomSeriesRepository,
- [FromServices] IRepository _dicomInstanceRepository)
+ [FromServices] IRepository _dicomInstanceRepository,
+ [FromServices] IRepository _fileUploadRecordRepository)
{
//这里要做校验 + 同时验证本地系统里面的影像是否存在pacs推过来的
@@ -403,6 +405,9 @@ namespace IRaCIS.Core.Application.Service
var subjectVisitId = inCommand.SubjectVisitId;
var trialId = inCommand.TrialId;
+ var studyCode = "";
+ var studyUid = "";
+
var @lock = _distributedLockProvider.CreateLock($"StudyCode");
using (await @lock.AcquireAsync())
@@ -430,6 +435,8 @@ namespace IRaCIS.Core.Application.Service
newStuty.SubjectId = subjectId;
newStuty.SubjectVisitId = subjectVisitId;
+ studyCode = newStuty.StudyCode;
+
await _dicomStudyRepository.AddAsync(newStuty);
@@ -457,12 +464,22 @@ namespace IRaCIS.Core.Application.Service
}
await _dicomInstanceRepository.AddRangeAsync(newInstanceList);
+
+
+ //回更StudyCode
+ await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.Path.Contains(newStuty.StudyInstanceUid), u => new FileUploadRecord() { StudyCode = studyCode });
+
+
+ await _scpPatientRepository.BatchUpdateNoTrackingAsync(t => t.Id == find.SCPStudy.PatientId, u => new SCPPatient() { SubjectId = subjectId });
+ await _scpStudyRepository.BatchUpdateNoTrackingAsync(t => t.Id == scpStudyId, u => new SCPStudy() { SubjectVisitId = subjectVisitId });
+
}
+
currentNextCodeInt++;
- await _scpPatientRepository.BatchUpdateNoTrackingAsync(t => t.Id == find.SCPStudy.PatientId, u => new SCPPatient() { SubjectId = subjectId });
- await _scpStudyRepository.BatchUpdateNoTrackingAsync(t => t.Id == scpStudyId, u => new SCPStudy() { SubjectVisitId = subjectVisitId });
+
+
}
@@ -549,6 +566,10 @@ namespace IRaCIS.Core.Application.Service
}
}
+
+ //回更StudyCode
+ await _fileUploadRecordRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.Path.Contains(studyu.StudyInstanceUid), u => new FileUploadRecord() { StudyCode = studyCode });
+
await _scpPatientRepository.BatchUpdateNoTrackingAsync(t => t.Id == scpStudy.PatientId, u => new SCPPatient() { SubjectId = subjectId });
await _scpStudyRepository.BatchUpdateNoTrackingAsync(t => t.Id == scpStudyId, u => new SCPStudy() { SubjectVisitId = subjectVisitId });
}
@@ -557,7 +578,7 @@ namespace IRaCIS.Core.Application.Service
}
-
+
await _scpStudyRepository.SaveChangesAsync();