修改课题组删除操作
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-08-29 17:47:11 +08:00
parent 87c22f1033
commit 5d1499025b
1 changed files with 13 additions and 3 deletions

View File

@ -858,7 +858,7 @@ namespace IRaCIS.Application.Services
{
foreach (var hospitalGroupId in incommand.HospitalGroupIdList)
{
if (_studySubjectVisitRepository.Any(t => t.SCPStudy.HospitalGroupList.Any(c => c.HospitalGroupId == hospitalGroupId)))
if (_studySubjectVisitRepository.Where(t => t.SCPStudyId == item).Any(t => t.SCPStudy.HospitalGroupList.Any(c => c.HospitalGroupId == hospitalGroupId)))
{
//已经添加到项目,不允许删除课题组
return ResponseOutput.NotOk(_localizer["Patient_StudyHospitalGroupBinded"]);
@ -876,6 +876,16 @@ namespace IRaCIS.Application.Services
//更新
foreach (var item in incommand.SCPstudyIdList)
{
var existList = _SCPStudyHospitalGroupRepository.Where(t => t.SCPStudyId == item).Select(t => t.HospitalGroupId).ToList();
var deleteIdList = existList.Except(incommand.HospitalGroupIdList);
if (_studySubjectVisitRepository.Where(t => t.SCPStudyId == item).Any(t => t.SCPStudy.HospitalGroupList.Any(c => deleteIdList.Contains(c.HospitalGroupId))))
{
//已经添加到项目,不允许删除课题组
return ResponseOutput.NotOk(_localizer["Patient_StudyHospitalGroupBinded"]);
}
await _SCPStudyHospitalGroupRepository.BatchDeleteNoTrackingAsync(t => t.SCPStudyId == item);
foreach (var hospitalGroupId in incommand.HospitalGroupIdList)