diff --git a/IRaCIS.Core.Application/Service/Visit/HospitalGroupService.cs b/IRaCIS.Core.Application/Service/Visit/HospitalGroupService.cs index 96ec3c8b2..bca76026d 100644 --- a/IRaCIS.Core.Application/Service/Visit/HospitalGroupService.cs +++ b/IRaCIS.Core.Application/Service/Visit/HospitalGroupService.cs @@ -81,8 +81,10 @@ public class HospitalGroupService(IRepository _hospitalGroupRepos [HttpPost] public async Task> GetHospitalGroupPageList(HospitalGroupQuery inQuery) { + //GA 只能看到自己是管理员的课题组 var hospitalGroupQueryable = _hospitalGroupRepository + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.GA, t => t.IdentityUserList.Any(t => t.IdentityUserId == _userInfo.IdentityUserId && t.IsManager && t.IsDisabled == false)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Code), t => t.Code.Contains(inQuery.Code)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Name), t => t.Name.Contains(inQuery.Name)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.Affiliation), t => t.Affiliation.Contains(inQuery.Affiliation)) diff --git a/IRaCIS.Core.Application/Service/Visit/PatientService.cs b/IRaCIS.Core.Application/Service/Visit/PatientService.cs index a39dbad3c..67e882fc5 100644 --- a/IRaCIS.Core.Application/Service/Visit/PatientService.cs +++ b/IRaCIS.Core.Application/Service/Visit/PatientService.cs @@ -2593,7 +2593,11 @@ namespace IRaCIS.Application.Services [HttpPost] public async Task> GetPatientOtherStudyList(PatientStudyOtherQuery inQuery) { + + var trialHospitalGroupId = await _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => t.HospitalGroupId).FirstOrDefaultAsync(); + var query = from scpStudy in _studyRepository.Where(t => inQuery.PatientIdList.Contains(t.PatientId) && !t.SCPStudySubjectVisitList.Any(t => (t.SubjectVisitId == inQuery.SujectVisitId || t.SubjectVisit.SubmitState == SubmitStateEnum.Submitted) && t.TrialId == inQuery.TrialId)) + .Where(t => t.HospitalGroupList.Any(t => t.HospitalGroupId == trialHospitalGroupId)) .WhereIf(inQuery.EarliestStudyTime != null, t => t.StudyTime >= inQuery.EarliestStudyTime) .WhereIf(inQuery.LatestStudyTime != null, t => t.StudyTime <= inQuery.LatestStudyTime) .WhereIf(!string.IsNullOrEmpty(inQuery.PatientIdStr), t => t.PatientIdStr.Contains(inQuery.PatientIdStr))