From 01b61f8fb6051243eaa9d13bce2d651e87398d26 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 21 Aug 2025 14:30:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Visit/PatientService.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Visit/PatientService.cs b/IRaCIS.Core.Application/Service/Visit/PatientService.cs index ac3eceb09..e7945cfad 100644 --- a/IRaCIS.Core.Application/Service/Visit/PatientService.cs +++ b/IRaCIS.Core.Application/Service/Visit/PatientService.cs @@ -139,7 +139,7 @@ namespace IRaCIS.Application.Services { var exp = new EntityVerifyExp() { - VerifyExp = h => h.IsDefault.Equals(addOrEditHIRHospital.IsDefault), + VerifyExp = h => h.IsDefault.Equals(addOrEditHIRHospital.IsDefault) && addOrEditHIRHospital.IsDefault = true, //"默认医院只允许一个" VerifyMsg = _localizer["Patient_OnlyOneDefaultHospital"] @@ -662,7 +662,7 @@ namespace IRaCIS.Application.Services }; - var allHospitalGroupList = _hospitalGroupRepository.Where(t => t.IsEnable).Select(t => t.Name).ToList(); + var allHospitalGroupList = _hospitalGroupRepository.Where(t => t.IsEnable).Select(t => t.Name).ToList(); var pageList = await resultQuery.ToPagedListAsync(inQuery, nameof(PatientQueryView.PatientIdStr)); @@ -794,7 +794,7 @@ namespace IRaCIS.Application.Services var pageList = await query.ToPagedListAsync(inQuery, nameof(PatientStudySimpleView.StudyTime)); - var allHospitalGroupList= _hospitalGroupRepository.Where(t=>t.IsEnable).Select(t=> new HospitalGroupInfo() { Id = t.Id, Code = t.Code, Name = t.Name }).ToList(); + var allHospitalGroupList = _hospitalGroupRepository.Where(t => t.IsEnable).Select(t => new HospitalGroupInfo() { Id = t.Id, Code = t.Code, Name = t.Name }).ToList(); foreach (var item in pageList.CurrentPageData) { @@ -828,7 +828,10 @@ namespace IRaCIS.Application.Services { foreach (var hospitalGroupId in incommand.HospitalGroupIdList) { - await _SCPStudyHospitalGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = item, HospitalGroupId = hospitalGroupId }); + if (!_SCPStudyHospitalGroupRepository.Any(t => t.SCPStudyId == item && hospitalGroupId == t.HospitalGroupId)) + { + await _SCPStudyHospitalGroupRepository.AddAsync(new SCPStudyHospitalGroup() { SCPStudyId = item, HospitalGroupId = hospitalGroupId }); + } } @@ -844,7 +847,6 @@ namespace IRaCIS.Application.Services { await _SCPStudyHospitalGroupRepository.DeleteFromQueryAsync(t => t.HospitalGroupId == hospitalGroupId && t.SCPStudyId == item); - }