|
|
|
@@ -843,7 +843,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
|
|
|
|
|
var visitTaskQueryable = _visitTaskReReadingRepository
|
|
|
|
|
.Where(t => t.RequestReReadingType == RequestReReadingType.DocotorApply)
|
|
|
|
|
.Where(t => t.OriginalReReadingTask.DoctorUserId == _userInfo.Id)
|
|
|
|
|
.Where(t => t.OriginalReReadingTask.DoctorUserId == _userInfo.UserRoleId)
|
|
|
|
|
.Where(t => t.OriginalReReadingTask.TrialId == inQuery.TrialId)
|
|
|
|
|
.WhereIf(inQuery.RequestReReadingResultEnum != null, t => t.RequestReReadingResultEnum == inQuery.RequestReReadingResultEnum)
|
|
|
|
|
.WhereIf(inQuery.RootReReadingTaskId != null, t => t.RootReReadingTaskId == inQuery.RootReReadingTaskId || t.OriginalReReadingTaskId == inQuery.RootReReadingTaskId)
|
|
|
|
@@ -961,7 +961,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
//随机阅片
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var taskQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId)
|
|
|
|
|
var taskQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.UserRoleId && x.TaskState == TaskState.Effect && x.TrialReadingCriterionId == trialReadingCriterionId)
|
|
|
|
|
.Where(x => !x.Subject.IsDeleted).Where(x => (x.IsNeedClinicalDataSign && x.IsClinicalDataSign) || !x.IsNeedClinicalDataSign);
|
|
|
|
|
|
|
|
|
|
iRUnReadOut = new IRUnReadOutDto()
|
|
|
|
@@ -1005,7 +1005,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
|
|
|
|
|
if (critrion.IsReadingTaskViewInOrder == ReadingOrder.InOrder)
|
|
|
|
|
{
|
|
|
|
|
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect)
|
|
|
|
|
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == inQuery.TrialId && x.DoctorUserId == _userInfo.UserRoleId && x.TaskState == TaskState.Effect)
|
|
|
|
|
|
|
|
|
|
.WhereIf(inQuery.SubjectId != null, x => x.SubjectId == inQuery.SubjectId)
|
|
|
|
|
//前序 不存在 未生成任务的访视
|
|
|
|
@@ -1126,19 +1126,19 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
if (subjectId != null)
|
|
|
|
|
{
|
|
|
|
|
//找到 非一致性分析,未签名,状态正常的 并且任务名称是TimePoint的 任务
|
|
|
|
|
var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id
|
|
|
|
|
var needDealTaskList = await _visitTaskRepository.Where(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId
|
|
|
|
|
&& t.ReadingTaskState != ReadingTaskState.HaveSigned && t.TaskBlindName == "Timepoint" && t.ReadingCategory == ReadingCategory.Visit
|
|
|
|
|
&& (t.TaskState == TaskState.Effect || t.TaskState == TaskState.Freeze), true).ToListAsync();
|
|
|
|
|
|
|
|
|
|
if (needDealTaskList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
//已完成的访视任务数量(包含重阅的)
|
|
|
|
|
var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id
|
|
|
|
|
var haveFinishedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId
|
|
|
|
|
&& t.ReadingTaskState == ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit);
|
|
|
|
|
|
|
|
|
|
//已经处理过的任务名称的数量
|
|
|
|
|
|
|
|
|
|
var haveDealedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.Id
|
|
|
|
|
var haveDealedTaskCount = await _visitTaskRepository.CountAsync(t => t.SubjectId == subjectId && t.TrialReadingCriterionId == trialReadingCriterionId && t.IsAnalysisCreate == false && t.DoctorUserId == _userInfo.UserRoleId
|
|
|
|
|
&& t.ReadingTaskState != ReadingTaskState.HaveSigned && t.ReadingCategory == ReadingCategory.Visit && t.TaskBlindName != "Timepoint");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1158,7 +1158,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect)
|
|
|
|
|
var visitQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.UserRoleId && x.TaskState == TaskState.Effect)
|
|
|
|
|
.WhereIf(inQuery.SubjectId != null, x => x.SubjectId == inQuery.SubjectId)
|
|
|
|
|
.WhereIf(!string.IsNullOrEmpty(subjectCode), t => (t.Subject.Code.Contains(subjectCode!) && t.IsAnalysisCreate == false) || (t.BlindSubjectCode.Contains(subjectCode!) && t.IsAnalysisCreate));
|
|
|
|
|
|
|
|
|
@@ -1221,7 +1221,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var visitTaskQueryable = _visitTaskRepository.Where(t => t.TrialId == inQuery.TrialId)
|
|
|
|
|
.Where(t => t.DoctorUserId == _userInfo.Id && t.ReadingTaskState == ReadingTaskState.HaveSigned)//该医生 已经签名的数据
|
|
|
|
|
.Where(t => t.DoctorUserId == _userInfo.UserRoleId && t.ReadingTaskState == ReadingTaskState.HaveSigned)//该医生 已经签名的数据
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.WhereIf(inQuery.TrialSiteId != null, t => t.Subject.TrialSiteId == inQuery.TrialSiteId)
|
|
|
|
@@ -1253,10 +1253,10 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
[UnitOfWork]
|
|
|
|
|
public async Task<IResponseOutput> AIRReReading(AIRReReadingCommand command)
|
|
|
|
|
{
|
|
|
|
|
var baseLineTaskList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id
|
|
|
|
|
var baseLineTaskList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.UserRoleId
|
|
|
|
|
&& t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState == ReadingTaskState.HaveSigned && t.SourceSubjectVisit.IsBaseLine == true).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var judegeList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.Id
|
|
|
|
|
var judegeList = await _visitTaskRepository.Where(t => t.TrialId == command.TrialId && t.TrialReadingCriterionId == command.TrialReadingCriterionId && t.DoctorUserId == _userInfo.UserRoleId
|
|
|
|
|
&& t.TaskState == TaskState.Effect && t.ReadingCategory == ReadingCategory.Judge && t.ReadingTaskState == ReadingTaskState.HaveSigned).ToListAsync();
|
|
|
|
|
|
|
|
|
|
foreach (var item in judegeList)
|
|
|
|
@@ -1284,7 +1284,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var requestRecordList = await _visitTaskReReadingRepository.Where(t => baseLineTaskIdList.Contains(t.OriginalReReadingTaskId) && t.RequestReReadingUserId == _userInfo.Id && t.RequestReReadingReason == "AIR自动重阅基线").ToListAsync();
|
|
|
|
|
var requestRecordList = await _visitTaskReReadingRepository.Where(t => baseLineTaskIdList.Contains(t.OriginalReReadingTaskId) && t.RequestReReadingUserId == _userInfo.UserRoleId && t.RequestReReadingReason == "AIR自动重阅基线").ToListAsync();
|
|
|
|
|
|
|
|
|
|
if (requestRecordList.Count != baseLineTaskIdList.Count)
|
|
|
|
|
{
|
|
|
|
@@ -1496,7 +1496,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
RootReReadingTaskId = rootReReadingTaskId == Guid.Empty ? task.Id : rootReReadingTaskId,
|
|
|
|
|
OriginalReReadingTaskId = task.Id,
|
|
|
|
|
RequestReReadingTime = DateTime.Now,
|
|
|
|
|
RequestReReadingUserId = _userInfo.Id,
|
|
|
|
|
RequestReReadingUserId = _userInfo.UserRoleId,
|
|
|
|
|
IsCopyOrigenalForms = applyReReadingCommand.IsCopyOrigenalForms,
|
|
|
|
|
IsCopyFollowForms = applyReReadingCommand.IsCopyFollowForms,
|
|
|
|
|
RequestReReadingReason = applyReReadingCommand.RequestReReadingReason,
|
|
|
|
@@ -1518,7 +1518,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
|
|
|
|
|
if (!isSPMjoin && IsPMOrAPm())
|
|
|
|
|
{
|
|
|
|
|
var requestRecordList = await _visitTaskReReadingRepository.Where(t => applyReReadingCommand.TaskIdList.Contains(t.OriginalReReadingTaskId) && t.RequestReReadingUserId == _userInfo.Id).ToListAsync();
|
|
|
|
|
var requestRecordList = await _visitTaskReReadingRepository.Where(t => applyReReadingCommand.TaskIdList.Contains(t.OriginalReReadingTaskId) && t.RequestReReadingUserId == _userInfo.UserRoleId).ToListAsync();
|
|
|
|
|
|
|
|
|
|
await ConfirmReReading(new ConfirmReReadingCommand()
|
|
|
|
|
{
|
|
|
|
@@ -1623,7 +1623,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
|
|
|
|
|
if ((origenalTask.TaskState != TaskState.Effect && origenalTask.TaskState != TaskState.Freeze))
|
|
|
|
|
{
|
|
|
|
|
await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new VisitTaskReReading() { RequestReReadingConfirmUserId = _userInfo.Id, RequestReReadingResultEnum = RequestReReadingResult.Invalid });
|
|
|
|
|
await _visitTaskReReadingRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new VisitTaskReReading() { RequestReReadingConfirmUserId = _userInfo.UserRoleId, RequestReReadingResultEnum = RequestReReadingResult.Invalid });
|
|
|
|
|
|
|
|
|
|
//---当前申请重阅任务的状态,已被其他任务重阅已影响,不允许对该状态下的任务进行重阅同意与否操作
|
|
|
|
|
return ResponseOutput.Ok(string.Empty, msg: _localizer["VisitTask_ReapplyStatusConflict"]);
|
|
|
|
@@ -1634,7 +1634,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
|
|
|
|
|
//更新申请信息
|
|
|
|
|
var visitTaskReReadingAppply = await _visitTaskReReadingRepository.FirstOrDefaultAsync(t => t.Id == item.Id);
|
|
|
|
|
visitTaskReReadingAppply.RequestReReadingConfirmUserId = _userInfo.Id;
|
|
|
|
|
visitTaskReReadingAppply.RequestReReadingConfirmUserId = _userInfo.UserRoleId;
|
|
|
|
|
visitTaskReReadingAppply.RequestReReadingResultEnum = agreeReReadingCommand.RequestReReadingResultEnum;
|
|
|
|
|
visitTaskReReadingAppply.RequestReReadingRejectReason = agreeReReadingCommand.RequestReReadingRejectReason;
|
|
|
|
|
|
|
|
|
@@ -2616,7 +2616,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// IR 申请 PM 同意
|
|
|
|
|
if (((IsPMOrAPm() && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.IndependentReviewer))
|
|
|
|
|
if (((IsPMOrAPm() && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUserRole.UserTypeEnum == UserTypeEnum.IndependentReviewer))
|
|
|
|
|
|| (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null)))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@@ -2659,7 +2659,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
|
|
|
|
|
//IR 申请 PM 同意 仅仅影响自己
|
|
|
|
|
|
|
|
|
|
if ((IsPMOrAPm() && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUser.UserTypeEnum == UserTypeEnum.IndependentReviewer))
|
|
|
|
|
if ((IsPMOrAPm() && applyId != null && await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && t.CreateUserRole.UserTypeEnum == UserTypeEnum.IndependentReviewer))
|
|
|
|
|
|| (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer && applyId == null))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@@ -2778,7 +2778,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
//PM 影响所有阅片人 仅仅针对访视 SPM CPM 调用
|
|
|
|
|
|
|
|
|
|
else if (((IsSpmOrCPM()) && applyId != null &&
|
|
|
|
|
await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && (t.CreateUser.UserTypeEnum == UserTypeEnum.ProjectManager || t.CreateUser.UserTypeEnum == UserTypeEnum.APM)) && filterObj.IsAnalysisCreate == false && filterObj.ReadingCategory == ReadingCategory.Visit)
|
|
|
|
|
await _visitTaskReReadingRepository.AnyAsync(t => t.Id == applyId && (t.CreateUserRole.UserTypeEnum == UserTypeEnum.ProjectManager || t.CreateUserRole.UserTypeEnum == UserTypeEnum.APM)) && filterObj.IsAnalysisCreate == false && filterObj.ReadingCategory == ReadingCategory.Visit)
|
|
|
|
|
|| (IsPMOrAPm() && applyId == null))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@@ -2876,7 +2876,7 @@ public class VisitTaskService(IRepository<VisitTask> _visitTaskRepository,
|
|
|
|
|
|
|
|
|
|
var list = await _visitTaskRepository.Where(filterExpression)
|
|
|
|
|
//IR 申请的时候,仅仅看到影响自己的
|
|
|
|
|
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer, t => t.DoctorUserId == _userInfo.Id)
|
|
|
|
|
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IndependentReviewer, t => t.DoctorUserId == _userInfo.UserRoleId)
|
|
|
|
|
.OrderBy(t => t.VisitTaskNum).ProjectTo<InfluenceTaskInfo>(_mapper.ConfigurationProvider).ToListAsync();
|
|
|
|
|
|
|
|
|
|
#region 影响后的操作
|
|
|
|
|