diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 0d31f69b6..0b497bc62 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -1601,6 +1601,7 @@ namespace IRaCIS.Core.Application.Service.Common .WhereIf(inQuery.EndAllocateDate != null, t => t.AllocateTime < inQuery.EndAllocateDate); + var list = new List(); var taskList = new List(); diff --git a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs index c9412e436..340b3a327 100644 --- a/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs +++ b/IRaCIS.Core.Application/Service/Management/DTO/UserModel.cs @@ -321,6 +321,8 @@ namespace IRaCIS.Application.Contracts public DateTime? BeginLastChangePassWordTime { get; set; } public DateTime? EndLastChangePassWordTime { get; set; } + + public Guid? HospitalGroupId { get; set; } } public class UserRoleInfoDTO diff --git a/IRaCIS.Core.Application/Service/Management/UserService.cs b/IRaCIS.Core.Application/Service/Management/UserService.cs index 92f12e3bb..ccfe69ac8 100644 --- a/IRaCIS.Core.Application/Service/Management/UserService.cs +++ b/IRaCIS.Core.Application/Service/Management/UserService.cs @@ -479,6 +479,7 @@ namespace IRaCIS.Core.Application.Service .WhereIf(inQuery.UserState != null, t => t.Status == inQuery.UserState) .WhereIf(inQuery.IsTestUser != null, t => t.IsTestUser == inQuery.IsTestUser) .WhereIf(inQuery.IsZhiZhun != null, t => t.IsZhiZhun == inQuery.IsZhiZhun) + .WhereIf(inQuery.HospitalGroupId != null, t => t.IdentityUserHospitalGroupList.Any(t => t.HospitalGroupId == inQuery.HospitalGroupId)) //OA 不能看admin .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.OA, t => !t.UserRoleList.Any(t => t.UserTypeEnum == UserTypeEnum.Admin || t.UserTypeEnum == UserTypeEnum.SuperAdmin)) @@ -597,7 +598,7 @@ namespace IRaCIS.Core.Application.Service }; - await _trialIdentityUserRepository.AddAsync(currentUser,true); + await _trialIdentityUserRepository.AddAsync(currentUser, true); } } @@ -1338,7 +1339,7 @@ namespace IRaCIS.Core.Application.Service UserName = t.IdentityUser.UserName, UserTypeShortName = t.UserTypeRole.UserTypeShortName, - HospitalGroupList = t.IdentityUser.IdentityUserHospitalGroupList.Where(t => t.IsDisabled == false).Select(t => new HospitalGroupInfo() + HospitalGroupList = t.IdentityUser.IdentityUserHospitalGroupList.Where(t => t.IsDisabled == false /*&& t.HospitalGroup.IsEnable == true*/).Select(t => new HospitalGroupInfo() { Id = t.HospitalGroupId, IsManager = t.IsManager, diff --git a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs index fa89c036b..2a9a33da8 100644 --- a/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs +++ b/IRaCIS.Core.Application/Service/QC/DTO/QCListViewModel.cs @@ -1176,7 +1176,7 @@ namespace IRaCIS.Core.Application.Contracts public List SubjectCriterionReadingPeriodVisitNumList { get; set; } - public String TrialSiteCode { get; set; } = String.Empty; + //public String TrialSiteCode { get; set; } = String.Empty; public string SubjectCode { get; set; } = String.Empty; public Guid Id { get; set; } diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index f7075ff93..dc82c05dd 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -267,7 +267,7 @@ namespace IRaCIS.Core.Application.Service //.ForMember(o => o.ResearchProgramNo, t => t.MapFrom(u => u.Trial.ResearchProgramNo)) //.ForMember(o => o.VisitName, t => t.MapFrom(u => u.SourceSubjectVisit.VisitName)) - .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode)) + //.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode)) //.ForMember(o => o.LatestScanDate, t => t.MapFrom(u => u.SourceSubjectVisit.LatestScanDate)) .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code)) .ForMember(o => o.UserName, t => t.MapFrom(u => u.DoctorUser.UserName)) diff --git a/IRaCIS.Core.Application/Service/Visit/HospitalGroupService.cs b/IRaCIS.Core.Application/Service/Visit/HospitalGroupService.cs index 43f8930e4..7eee0cd4e 100644 --- a/IRaCIS.Core.Application/Service/Visit/HospitalGroupService.cs +++ b/IRaCIS.Core.Application/Service/Visit/HospitalGroupService.cs @@ -43,15 +43,16 @@ public class HospitalGroupService(IRepository _hospitalGroupRepos public async Task> GetHospitalGroupList(HospitalGroupQuery inQuery) { - var hospitalGroupQueryable = _hospitalGroupRepository + var hospitalGroupQueryable = _hospitalGroupRepository.Where(t => t.IsEnable == true)//都是查询启用的 .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)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ContactPhone), t => t.ContactPhone.Contains(inQuery.ContactPhone)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.ContactName), t => t.ContactName.Contains(inQuery.ContactName)) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager, t => _userInfo.HospitalGroupIdList.Contains(t.Id)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.GA, t => _userInfo.HospitalGroupAdminIdList.Contains(t.Id)) .WhereIf(!string.IsNullOrWhiteSpace(inQuery.CallingAE), t => t.CallingAE.Contains(inQuery.CallingAE)) - .WhereIf(inQuery.IsEnable != null, t => t.IsEnable == inQuery.IsEnable) + //.WhereIf(inQuery.IsEnable != null, t => t.IsEnable == inQuery.IsEnable) .ProjectTo(_mapper.ConfigurationProvider); var pageList = await hospitalGroupQueryable.SortToListAsync(inQuery); diff --git a/IRaCIS.Core.Application/Service/Visit/PatientService.cs b/IRaCIS.Core.Application/Service/Visit/PatientService.cs index 35531a08c..f66f885dd 100644 --- a/IRaCIS.Core.Application/Service/Visit/PatientService.cs +++ b/IRaCIS.Core.Application/Service/Visit/PatientService.cs @@ -963,7 +963,8 @@ namespace IRaCIS.Application.Services if (_studySubjectVisitRepository.Any(t => t.SCPStudyId == scpStudyId && t.StudyId != null)) { - return ResponseOutput.NotOk("该检查已绑定某项目下受试者访视(不一定是你所创建的项目)并已提交生成任务,不允许删除该检查"); + //"该检查已绑定某项目下受试者访视(不一定是你所创建的项目)并已提交生成任务,不允许删除该检查" + return ResponseOutput.NotOk(_localizer["Patient_SCPStudyVisitBindedSubmit"]); } else { @@ -1377,9 +1378,12 @@ namespace IRaCIS.Application.Services [TrialGlobalLimit("AfterStopCannNotOpt")] public async Task AutoBindingPatientStudyVisit(AutoBindingPatientStudyVisitCommand inCommand) { + var trialHospitalGroupId = await _trialRepository.Where(t => t.Id == inCommand.TrialId).Select(t => t.HospitalGroupId).FirstOrDefaultAsync(); + //找到已绑定患者,但是没绑定检查的 新来的检查->现在换成未提交的 //var query = from scpStudy in _studyRepository.Where(t => !t.SCPStudySubjectVisitList.Any(t => t.TrialId == inCommand.TrialId)) var query = from scpStudy in _studyRepository.Where(t => !t.SCPStudySubjectVisitList.Any(t => t.TrialId == inCommand.TrialId && t.SubjectVisit.SubmitState == SubmitStateEnum.Submitted)) + .Where(t => t.HospitalGroupList.Any(t => t.HospitalGroupId == trialHospitalGroupId)) join subjectPatient in _subjectPatientRepository.Where(t => t.Subject.TrialId == inCommand.TrialId) on scpStudy.PatientId equals subjectPatient.PatientId select new @@ -1542,8 +1546,11 @@ namespace IRaCIS.Application.Services // 预处理4: 处理需要绑定的检查 //获取 该受试者绑定患者已存在的检查,考虑要生成多少个访视,去除已提交的检查 + var trialHospitalGroupId = await _trialRepository.Where(t => t.Id == inCommand.TrialId).Select(t => t.HospitalGroupId).FirstOrDefaultAsync(); + var studyList = await _studyRepository.Where(t => inCommand.PatientIdList.Contains(t.PatientId) && !t.SCPStudySubjectVisitList.Any(t => t.SubjectId == subjectId && t.SubjectVisit.SubmitState == SubmitStateEnum.Submitted)) + .Where(t => t.HospitalGroupList.Any(t => t.HospitalGroupId == trialHospitalGroupId)) .WhereIf(maxStudyTime != null, t => t.StudyTime > maxStudyTime) .Select(t => new AuToBindingStudyInfo { SCPStudyId = t.Id, StudyTime = t.StudyTime }).OrderBy(t => t.StudyTime).Distinct().ToListAsync(); @@ -1605,8 +1612,11 @@ namespace IRaCIS.Application.Services // 预处理4: 处理需要绑定的检查 //获取 该受试者绑定患者已存在的检查,考虑要生成多少个访视,去除已提交的检查 + var trialHospitalGroupId = await _trialRepository.Where(t => t.Id == inCommand.TrialId).Select(t => t.HospitalGroupId).FirstOrDefaultAsync(); + var studyList = await _studyRepository.Where(t => dbPatientIdList.Contains(t.PatientId) && !t.SCPStudySubjectVisitList.Any(t => t.SubjectId == subjectId && t.SubjectVisit.SubmitState == SubmitStateEnum.Submitted)) + .Where(t => t.HospitalGroupList.Any(t => t.HospitalGroupId == trialHospitalGroupId)) .WhereIf(maxStudyTime != null, t => t.StudyTime > maxStudyTime) .Select(t => new AuToBindingStudyInfo { SCPStudyId = t.Id, StudyTime = t.StudyTime }).OrderBy(t => t.StudyTime).Distinct().ToListAsync();