修改一版
parent
494d0c53ae
commit
104c899a32
|
@ -162,7 +162,9 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
//public String TrialSiteCode { get; set; } = String.Empty;
|
//public String TrialSiteCode { get; set; } = String.Empty;
|
||||||
//public Guid TrialId { get; set; }
|
//public Guid TrialId { get; set; }
|
||||||
|
|
||||||
public Guid? SubjectId { get; set; }
|
public int Index { get; set; } = 0;
|
||||||
|
|
||||||
|
public Guid SubjectId { get; set; }
|
||||||
public string SubjectCode { get; set; } = String.Empty;
|
public string SubjectCode { get; set; } = String.Empty;
|
||||||
|
|
||||||
public bool IsUrgent => UnReadTaskList.Any(t => t.IsUrgent);
|
public bool IsUrgent => UnReadTaskList.Any(t => t.IsUrgent);
|
||||||
|
@ -180,7 +182,15 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public ReadingCategory ReadingCategory { get; set; }
|
||||||
public bool IsUrgent { get; set; }
|
public bool IsUrgent { get; set; }
|
||||||
|
|
||||||
|
public decimal VisitNum { get; set; }
|
||||||
|
|
||||||
|
public string TaskBlindName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public Guid? VisistId { get; set; }
|
||||||
public DateTime? SuggesteFinishedTime { get; set; }
|
public DateTime? SuggesteFinishedTime { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
Task<IResponseOutput> ApplyReReading(ApplyReReadingCommand applyReReadingCommand);
|
Task<IResponseOutput> ApplyReReading(ApplyReReadingCommand applyReReadingCommand);
|
||||||
|
|
||||||
Task<IResponseOutput> ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService);
|
Task<IResponseOutput> ConfirmReReading(ConfirmReReadingCommand agreeReReadingCommand, [FromServices] IVisitTaskHelpeService _visitTaskCommonService);
|
||||||
|
|
||||||
|
(int, IOrderedQueryable<IRUnReadSubjectView>) GetOrderReadingIQueryable(Guid trialId);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -987,7 +987,7 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="trialId"></param>
|
/// <param name="trialId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public (int,IOrderedQueryable<IRUnReadSubjectView>?) GetOrderReadingIQueryable(Guid trialId)
|
public (int,IOrderedQueryable<IRUnReadSubjectView>) GetOrderReadingIQueryable(Guid trialId)
|
||||||
{
|
{
|
||||||
var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id)
|
var visitGroupQuery = _visitTaskRepository.Where(x => x.TrialId == trialId && x.DoctorUserId == _userInfo.Id)
|
||||||
.Where(x => !x.Subject.IsDeleted)
|
.Where(x => !x.Subject.IsDeleted)
|
||||||
|
@ -1001,8 +1001,16 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||||
UnReadTaskCount = x.Where(y => y.ReReadingApplyState != ReReadingApplyState.HaveApplyed).Count(),
|
UnReadTaskCount = x.Where(y => y.ReReadingApplyState != ReReadingApplyState.HaveApplyed).Count(),
|
||||||
ExistReadingApply = x.Any(y => y.ReReadingApplyState == ReReadingApplyState.HaveApplyed),
|
ExistReadingApply = x.Any(y => y.ReReadingApplyState == ReReadingApplyState.HaveApplyed),
|
||||||
UnReadTaskList = x.Where(y => y.ReReadingApplyState != ReReadingApplyState.HaveApplyed).OrderBy(x=>x.VisitTaskNum)
|
UnReadTaskList = x.Where(y => y.ReReadingApplyState != ReReadingApplyState.HaveApplyed).OrderBy(x=>x.VisitTaskNum)
|
||||||
.Select(u => new IRUnreadTaskView() { Id = u.Id, IsUrgent = u.IsUrgent, SuggesteFinishedTime = u.SuggesteFinishedTime }).ToList(),
|
.Select(u => new IRUnreadTaskView() {
|
||||||
}).Where(x => x.UnReadTaskCount > 0).OrderBy(x => x.SubjectId);
|
Id = u.Id,
|
||||||
|
IsUrgent = u.IsUrgent,
|
||||||
|
VisitNum=u.VisitTaskNum,
|
||||||
|
TaskBlindName =u.TaskBlindName,
|
||||||
|
VisistId=u.SourceSubjectVisitId,
|
||||||
|
SuggesteFinishedTime = u.SuggesteFinishedTime,
|
||||||
|
ReadingCategory=u.ReadingCategory,
|
||||||
|
}).ToList(),
|
||||||
|
}).OrderBy(x => x.SubjectId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace IRaCIS.Application.Services
|
||||||
private readonly IRepository<VisitTask> _visitTaskRepository;
|
private readonly IRepository<VisitTask> _visitTaskRepository;
|
||||||
private readonly IRepository<Trial> _trialRepository;
|
private readonly IRepository<Trial> _trialRepository;
|
||||||
private readonly IVisitTaskHelpeService _visitTaskHelpeService;
|
private readonly IVisitTaskHelpeService _visitTaskHelpeService;
|
||||||
|
private readonly IVisitTaskService _visitTaskService;
|
||||||
private readonly IReadingClinicalDataService _readingClinicalDataService;
|
private readonly IReadingClinicalDataService _readingClinicalDataService;
|
||||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||||
private readonly IRepository<Subject> _subjectRepository;
|
private readonly IRepository<Subject> _subjectRepository;
|
||||||
|
@ -49,6 +50,7 @@ namespace IRaCIS.Application.Services
|
||||||
IRepository<VisitTask> visitTaskRepository,
|
IRepository<VisitTask> visitTaskRepository,
|
||||||
IRepository<Trial> TrialRepository,
|
IRepository<Trial> TrialRepository,
|
||||||
IVisitTaskHelpeService visitTaskHelpeService,
|
IVisitTaskHelpeService visitTaskHelpeService,
|
||||||
|
IVisitTaskService visitTaskService,
|
||||||
IReadingClinicalDataService readingClinicalDataService,
|
IReadingClinicalDataService readingClinicalDataService,
|
||||||
IRepository<SubjectVisit> subjectVisitRepository,
|
IRepository<SubjectVisit> subjectVisitRepository,
|
||||||
IRepository<Subject> subjectRepository,
|
IRepository<Subject> subjectRepository,
|
||||||
|
@ -66,6 +68,7 @@ namespace IRaCIS.Application.Services
|
||||||
this._visitTaskRepository = visitTaskRepository;
|
this._visitTaskRepository = visitTaskRepository;
|
||||||
this._trialRepository = TrialRepository;
|
this._trialRepository = TrialRepository;
|
||||||
this._visitTaskHelpeService = visitTaskHelpeService;
|
this._visitTaskHelpeService = visitTaskHelpeService;
|
||||||
|
this._visitTaskService = visitTaskService;
|
||||||
this._readingClinicalDataService = readingClinicalDataService;
|
this._readingClinicalDataService = readingClinicalDataService;
|
||||||
this._subjectVisitRepository = subjectVisitRepository;
|
this._subjectVisitRepository = subjectVisitRepository;
|
||||||
this._subjectRepository = subjectRepository;
|
this._subjectRepository = subjectRepository;
|
||||||
|
@ -253,39 +256,65 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
else if (inDto.SubjectId != null)
|
else if (inDto.SubjectId != null)
|
||||||
{
|
{
|
||||||
var subjectList = await _subjectRepository.Where(t => t.TrialId == inDto.TrialId)
|
|
||||||
|
|
||||||
.Select(s => new SubjectTask()
|
#region 之前的
|
||||||
|
//var subjectList = await _subjectRepository.Where(t => t.TrialId == inDto.TrialId)
|
||||||
|
|
||||||
|
//.Select(s => new SubjectTask()
|
||||||
|
//{
|
||||||
|
// SubjectId = s.Id,
|
||||||
|
// UnReadTaskCount = s.SubjectVisitTaskList.Count(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect),
|
||||||
|
//}).OrderBy(x => x.SubjectId).ToListAsync();
|
||||||
|
//subjectList = subjectList.Select((x, index) => new SubjectTask()
|
||||||
|
//{
|
||||||
|
// Index = index,
|
||||||
|
// SubjectId = x.SubjectId,
|
||||||
|
// UnReadTaskCount = x.UnReadTaskCount,
|
||||||
|
//}).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
//var subjectIndex = subjectList.Where(x => x.SubjectId == inDto.SubjectId).Select(x => x.Index).FirstOrDefault();
|
||||||
|
//var newSubjectId = subjectList.Where(x => x.Index >= subjectIndex && x.UnReadTaskCount != 0).Select(x => x.SubjectId).FirstOrDefault();
|
||||||
|
|
||||||
|
//var taskquery = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.SubjectId == newSubjectId && x.DoctorUserId == _userInfo.Id && x.TaskState == TaskState.Effect).Select(x => new GetReadingTaskDto()
|
||||||
|
//{
|
||||||
|
// VisitTaskId = x.Id,
|
||||||
|
// TaskBlindName = x.TaskBlindName,
|
||||||
|
// ReadingCategory = x.ReadingCategory,
|
||||||
|
// VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
||||||
|
// VisitNum = x.VisitTaskNum,
|
||||||
|
//}).OrderBy(x => x.VisitNum).ThenBy(x => x.ReadingCategory);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
var subjectTaskList = await _visitTaskService.GetOrderReadingIQueryable(inDto.TrialId).Item2.ToListAsync();
|
||||||
|
|
||||||
|
var index = 0;
|
||||||
|
subjectTaskList.ForEach(x =>
|
||||||
{
|
{
|
||||||
SubjectId = s.Id,
|
x.Index = index;
|
||||||
UnReadTaskCount = s.SubjectVisitTaskList.Count(t => t.ReadingTaskState != ReadingTaskState.HaveSigned && t.DoctorUserId == _userInfo.Id && t.TaskState == TaskState.Effect),
|
index++;
|
||||||
}).OrderBy(x => x.SubjectId).ToListAsync();
|
});
|
||||||
subjectList = subjectList.Select((x, index) => new SubjectTask()
|
|
||||||
{
|
|
||||||
Index = index,
|
|
||||||
SubjectId = x.SubjectId,
|
|
||||||
UnReadTaskCount = x.UnReadTaskCount,
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
|
var subjectIndex = subjectTaskList.Where(x => x.SubjectId == inDto.SubjectId).Select(x => x.Index).FirstOrDefault();
|
||||||
|
|
||||||
var subjectIndex = subjectList.Where(x => x.SubjectId == inDto.SubjectId).Select(x => x.Index).FirstOrDefault();
|
var currentSubject = subjectTaskList.Where(x => x.Index >= 0).OrderBy(x => x.Index).FirstOrDefault();
|
||||||
var newSubjectId = subjectList.Where(x => x.Index >= subjectIndex && x.UnReadTaskCount != 0).Select(x => x.SubjectId).FirstOrDefault();
|
|
||||||
|
|
||||||
var taskquery = _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.SubjectId == newSubjectId && x.DoctorUserId == _userInfo.Id&&x.TaskState==TaskState.Effect).Select(x => new GetReadingTaskDto()
|
if (currentSubject == null)
|
||||||
{
|
|
||||||
VisitTaskId = x.Id,
|
|
||||||
TaskBlindName = x.TaskBlindName,
|
|
||||||
ReadingCategory = x.ReadingCategory,
|
|
||||||
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule == null ? default(Guid) : x.ReadModule.SubjectVisitId,
|
|
||||||
VisitNum = x.VisitTaskNum,
|
|
||||||
}).OrderBy(x => x.VisitNum).ThenBy(x => x.ReadingCategory);
|
|
||||||
|
|
||||||
task = await taskquery.FirstOrDefaultAsync();
|
|
||||||
if (task == null)
|
|
||||||
{
|
{
|
||||||
throw new BusinessValidationFailedException("任务都已经完成");
|
throw new BusinessValidationFailedException("任务都已经完成");
|
||||||
}
|
}
|
||||||
task.SubjectId = inDto.SubjectId.Value;
|
|
||||||
|
task = currentSubject.UnReadTaskList.Select(x => new GetReadingTaskDto()
|
||||||
|
{
|
||||||
|
ReadingCategory = x.ReadingCategory,
|
||||||
|
SubjectCode = currentSubject.SubjectCode,
|
||||||
|
SubjectId = currentSubject.SubjectId,
|
||||||
|
TaskBlindName = x.TaskBlindName,
|
||||||
|
VisitNum = x.VisitNum,
|
||||||
|
VisistId = x.VisistId ?? default(Guid),
|
||||||
|
VisitTaskId = x.Id
|
||||||
|
}).FirstOrDefault();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue