修改项目绑定检查课题组
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-09-09 14:41:04 +08:00
parent 563be56d27
commit 758e0aedcb
1 changed files with 9 additions and 0 deletions

View File

@ -1378,9 +1378,12 @@ namespace IRaCIS.Application.Services
[TrialGlobalLimit("AfterStopCannNotOpt")]
public async Task<IResponseOutput> 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
@ -1543,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();
@ -1606,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();