Uat_Study
parent
88bdeff571
commit
9ae1cb5fe1
|
@ -40,7 +40,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
{
|
||||
public Guid? QuestionId { get; set; }
|
||||
|
||||
public Guid visitTaskId { get; set; }
|
||||
public Guid VisitTaskId { get; set; }
|
||||
|
||||
public string Answer { get; set; }
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace IRaCIS.Application.Services
|
|||
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
|
||||
}
|
||||
|
||||
#region 全局阅片相关
|
||||
/// <summary>
|
||||
/// 获取全局阅片历史记录
|
||||
/// </summary>
|
||||
|
@ -111,12 +112,12 @@ namespace IRaCIS.Application.Services
|
|||
await _readingGlobalTaskInfoRepository.BatchDeleteNoTrackingAsync(x => x.GlobalTaskId == inDto.GlobalTaskId);
|
||||
await _readingGlobalTaskInfoRepository.AddRangeAsync(inDto.QuestionList.Select(x => new ReadingGlobalTaskInfo()
|
||||
{
|
||||
Answer=x.Answer,
|
||||
QuestionId=x.QuestionId,
|
||||
SubjectId=inDto.SubjectId,
|
||||
GlobalTaskId=inDto.GlobalTaskId,
|
||||
TaskId=x.visitTaskId,
|
||||
TrialId=inDto.TrialId,
|
||||
Answer = x.Answer,
|
||||
QuestionId = x.QuestionId,
|
||||
SubjectId = inDto.SubjectId,
|
||||
GlobalTaskId = inDto.GlobalTaskId,
|
||||
TaskId = x.VisitTaskId,
|
||||
TrialId = inDto.TrialId,
|
||||
}).ToList());
|
||||
|
||||
var result = await _readingGlobalTaskInfoRepository.SaveChangesAsync();
|
||||
|
@ -138,7 +139,8 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
throw new BusinessValidationFailedException("当前任务不是全局阅片任务");
|
||||
}
|
||||
GetGlobalReadingInfoOutDto result = new GetGlobalReadingInfoOutDto() {
|
||||
GetGlobalReadingInfoOutDto result = new GetGlobalReadingInfoOutDto()
|
||||
{
|
||||
GlobalTaskId = inDto.VisitTaskId,
|
||||
};
|
||||
|
||||
|
@ -154,8 +156,8 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
QuestionId = y.ReadingQuestionTrialId,
|
||||
QuestionName = y.ReadingQuestionTrial.QuestionName,
|
||||
Type=y.ReadingQuestionTrial.Type,
|
||||
TypeValue=y.ReadingQuestionTrial.TypeValue,
|
||||
Type = y.ReadingQuestionTrial.Type,
|
||||
TypeValue = y.ReadingQuestionTrial.TypeValue,
|
||||
Answer = y.Answer
|
||||
}).ToList()
|
||||
}).ToListAsync();
|
||||
|
@ -169,12 +171,12 @@ namespace IRaCIS.Application.Services
|
|||
globalReadingQuestion
|
||||
, l => new { a = l.QuestionId, b = x.VisitTaskId }
|
||||
, r => new { a = r.QuestionId, b = r.TaskId }
|
||||
, (l, r) => new { question=l, global=r })
|
||||
, (l, r) => new { question = l, global = r })
|
||||
.SelectMany(lr => lr.global.DefaultIfEmpty(), (lr, r) => new GlobalQuestionInfo
|
||||
{
|
||||
Answer = lr.global == null ? string.Empty : lr.global.Select(x=>x.Answer).FirstOrDefault(),
|
||||
QuestionId =lr.question.QuestionId,
|
||||
QuestionName=lr.question.QuestionName,
|
||||
Answer = lr.global == null ? string.Empty : lr.global.Select(x => x.Answer).FirstOrDefault(),
|
||||
QuestionId = lr.question.QuestionId,
|
||||
QuestionName = lr.question.QuestionName,
|
||||
Type = lr.question.Type,
|
||||
TypeValue = lr.question.TypeValue,
|
||||
|
||||
|
@ -182,9 +184,9 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
var reason = new GlobalQuestionInfo()
|
||||
{
|
||||
Answer = globalReadingQuestion.Where(y => y.TaskId == x.VisitTaskId && y.QuestionId == null).Select(x => x.Answer).FirstOrDefault()??String.Empty,
|
||||
QuestionName="原因",
|
||||
Type="input",
|
||||
Answer = globalReadingQuestion.Where(y => y.TaskId == x.VisitTaskId && y.QuestionId == null).Select(x => x.Answer).FirstOrDefault() ?? String.Empty,
|
||||
QuestionName = "原因",
|
||||
Type = "input",
|
||||
|
||||
};
|
||||
|
||||
|
@ -195,8 +197,9 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取下一个阅片任务
|
||||
/// <summary>
|
||||
/// 获取下一个阅片任务
|
||||
/// </summary>
|
||||
|
@ -209,27 +212,27 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
if (inDto.VisistTaskId != null)
|
||||
{
|
||||
task = await _visitTaskRepository.Where(x => x.Id== inDto.VisistTaskId).Select(x => new GetReadingTaskDto()
|
||||
task = await _visitTaskRepository.Where(x => x.Id == inDto.VisistTaskId).Select(x => new GetReadingTaskDto()
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
SubjectId=x.SubjectId,
|
||||
SubjectId = x.SubjectId,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule.SubjectVisitId,
|
||||
VisitNum = x.VisitTaskNum,
|
||||
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
|
||||
}
|
||||
else if (inDto.SubjectId != null)
|
||||
{
|
||||
var subjectList =await _subjectRepository.Where(t => t.TrialId == inDto.TrialId)
|
||||
|
||||
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();
|
||||
}).OrderBy(x => x.SubjectId).ToListAsync();
|
||||
subjectList = subjectList.Select((x, index) => new SubjectTask()
|
||||
{
|
||||
Index = index,
|
||||
|
@ -238,19 +241,19 @@ namespace IRaCIS.Application.Services
|
|||
}).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 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).Select(x => new GetReadingTaskDto()
|
||||
{
|
||||
VisitTaskId = x.Id,
|
||||
TaskBlindName=x.TaskBlindName,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
VisistId = x.SourceSubjectVisitId != null ? x.SourceSubjectVisitId.Value : x.ReadModule==null? default(Guid) : x.ReadModule.SubjectVisitId,
|
||||
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();
|
||||
task = await taskquery.FirstOrDefaultAsync();
|
||||
if (task == null)
|
||||
{
|
||||
throw new BusinessValidationFailedException("任务都已经完成");
|
||||
|
@ -261,15 +264,15 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
else
|
||||
{
|
||||
task = await _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.ReadingTaskState != ReadingTaskState.HaveSigned && x.DoctorUserId == _userInfo.Id&&x.TaskState==TaskState.Effect).Select(x => new GetReadingTaskDto()
|
||||
task = await _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.ReadingTaskState != ReadingTaskState.HaveSigned && 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,
|
||||
SubjectId =x.SubjectId,
|
||||
SubjectCode=x.Subject.Code,
|
||||
SubjectId = x.SubjectId,
|
||||
SubjectCode = x.Subject.Code,
|
||||
}).FirstOrDefaultAsync();
|
||||
if (task == null)
|
||||
{
|
||||
|
@ -289,19 +292,22 @@ namespace IRaCIS.Application.Services
|
|||
await _visitTaskRepository.SaveChangesAsync();
|
||||
return task;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取阅片非Dicom文件
|
||||
/// <summary>
|
||||
/// 获取阅片非Dicom文件
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<(List<NoneDicomStudyView>,object)> GetReadingImageFile(GetReadingImgInDto inDto)
|
||||
public async Task<(List<NoneDicomStudyView>, object)> GetReadingImageFile(GetReadingImgInDto inDto)
|
||||
{
|
||||
var task=await GetNextTask( new GetNextTaskInDto() {
|
||||
TrialId=inDto.TrialId,
|
||||
SubjectId=inDto.SubjectId,
|
||||
VisistTaskId=inDto.VisistTaskId,
|
||||
var task = await GetNextTask(new GetNextTaskInDto()
|
||||
{
|
||||
TrialId = inDto.TrialId,
|
||||
SubjectId = inDto.SubjectId,
|
||||
VisistTaskId = inDto.VisistTaskId,
|
||||
});
|
||||
List<Guid> visitIds = new List<Guid>();
|
||||
if (task.ReadingCategory == ReadingCategory.Visit)
|
||||
|
@ -313,7 +319,7 @@ namespace IRaCIS.Application.Services
|
|||
// 阅片期取前面所有的图像
|
||||
visitIds.AddRange(await _subjectVisitRepository.Where(x => x.VisitNum <= task.VisitNum && x.SubjectId == task.SubjectId).Select(x => x.Id).ToListAsync());
|
||||
}
|
||||
List<NoneDicomStudyView> result=await _noneDicomStudyRepository.Where(t => visitIds.Contains(t.SubjectVisitId))
|
||||
List<NoneDicomStudyView> result = await _noneDicomStudyRepository.Where(t => visitIds.Contains(t.SubjectVisitId))
|
||||
.ProjectTo<NoneDicomStudyView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken }).ToListAsync();
|
||||
|
||||
var trialInfo = await _trialRepository.Where(x => x.Id == inDto.TrialId).Select(x => new
|
||||
|
@ -337,22 +343,25 @@ namespace IRaCIS.Application.Services
|
|||
VisitTaskId = task.VisitTaskId,
|
||||
})).Count() > 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return (result, new {
|
||||
VisitTaskId= task.VisitTaskId,
|
||||
SubjectId=task.SubjectId,
|
||||
SubjectCode=task.SubjectCode,
|
||||
ReadingCategory= task.ReadingCategory,
|
||||
TaskBlindName=task.TaskBlindName,
|
||||
IsReadingShowPreviousResults = trialInfo.IsReadingShowPreviousResults,
|
||||
IsReadingShowSubjectInfo=trialInfo.IsReadingShowSubjectInfo,
|
||||
IsExistsClinicalData= isExistsClinicalData,
|
||||
|
||||
|
||||
return (result, new
|
||||
{
|
||||
VisitTaskId = task.VisitTaskId,
|
||||
SubjectId = task.SubjectId,
|
||||
SubjectCode = task.SubjectCode,
|
||||
ReadingCategory = task.ReadingCategory,
|
||||
TaskBlindName = task.TaskBlindName,
|
||||
IsReadingShowPreviousResults = trialInfo.IsReadingShowPreviousResults,
|
||||
IsReadingShowSubjectInfo = trialInfo.IsReadingShowSubjectInfo,
|
||||
IsExistsClinicalData = isExistsClinicalData,
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取项目已确认的标准
|
||||
/// <summary>
|
||||
/// 获取项目已确认的标准
|
||||
/// </summary>
|
||||
|
@ -361,7 +370,7 @@ namespace IRaCIS.Application.Services
|
|||
[HttpPost]
|
||||
public async Task<List<GetTrialConfirmCriterionListOutDto>> GetTrialConfirmCriterionList(GetConfirmCriterionInDto inDto)
|
||||
{
|
||||
var result= await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId&&x.IsConfirm&&x.IsCompleteConfig)
|
||||
var result = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId && x.IsConfirm && x.IsCompleteConfig)
|
||||
.Select(x => new GetTrialConfirmCriterionListOutDto()
|
||||
{
|
||||
ReadingQuestionCriterionTrialId = x.Id,
|
||||
|
@ -369,6 +378,9 @@ namespace IRaCIS.Application.Services
|
|||
}).ToListAsync();
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 配置裁判问题相关
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目标准的裁判问题
|
||||
|
@ -376,7 +388,7 @@ namespace IRaCIS.Application.Services
|
|||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<(List<GetTrialCriterionJudgeQuestionListOutDto>,object)> GetTrialCriterionJudgeQuestionList(GetTrialCriterionJudgeQuestionListInDto inDto)
|
||||
public async Task<(List<GetTrialCriterionJudgeQuestionListOutDto>, object)> GetTrialCriterionJudgeQuestionList(GetTrialCriterionJudgeQuestionListInDto inDto)
|
||||
{
|
||||
var trialCriterion = await _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == inDto.TrialId && x.IsConfirm).FirstOrDefaultAsync();
|
||||
|
||||
|
@ -385,12 +397,12 @@ namespace IRaCIS.Application.Services
|
|||
.WhereIf(trialCriterion.FormType == FormType.MultiplePage, x => x.ReadingCriterionPageId != null)
|
||||
.Select(x => new GetTrialCriterionJudgeQuestionListOutDto()
|
||||
{
|
||||
AnswerGroup = JsonConvert.DeserializeObject<List<string>>(x.AnswerGroup.IsNullOrEmpty()?"[]": x.AnswerGroup),
|
||||
AnswerGroup = JsonConvert.DeserializeObject<List<string>>(x.AnswerGroup.IsNullOrEmpty() ? "[]" : x.AnswerGroup),
|
||||
AnswerCombination = JsonConvert.DeserializeObject<List<AnswerCombinationDto>>(x.AnswerCombination.IsNullOrEmpty() ? "[]" : x.AnswerCombination),
|
||||
QuestionName = x.QuestionName,
|
||||
PageName=x.ReadingCriterionPage.PageName,
|
||||
TypeValue =x.TypeValue,
|
||||
JudgeType=x.JudgeType,
|
||||
PageName = x.ReadingCriterionPage.PageName,
|
||||
TypeValue = x.TypeValue,
|
||||
JudgeType = x.JudgeType,
|
||||
ReadingQuestionTrialId = x.Id
|
||||
}).ToListAsync();
|
||||
|
||||
|
@ -400,7 +412,7 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
IsSign = signTime != null,
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -415,14 +427,16 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
AnswerGroup = JsonConvert.SerializeObject(inDto.AnswerGroup),
|
||||
AnswerCombination = JsonConvert.SerializeObject(inDto.AnswerCombination),
|
||||
JudgeType= inDto.JudgeType,
|
||||
}) ;
|
||||
JudgeType = inDto.JudgeType,
|
||||
});
|
||||
|
||||
var result = await _readingQuestionTrialRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取项目的阅片问题
|
||||
/// <summary>
|
||||
/// 获取项目的阅片问题
|
||||
/// </summary>
|
||||
|
@ -438,36 +452,36 @@ namespace IRaCIS.Application.Services
|
|||
[HttpPost]
|
||||
public async Task<(GetTrialReadingQuestionPageDto, object)> GetTrialReadingQuestion(GetTrialReadingQuestionInDto inDto)
|
||||
{
|
||||
var result = new GetTrialReadingQuestionPageDto();
|
||||
var readingTaskState = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.ReadingTaskState).FirstOrDefaultAsync();
|
||||
var query= from data in _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId==inDto.ReadingQuestionCriterionTrialId)
|
||||
var result = new GetTrialReadingQuestionPageDto();
|
||||
var readingTaskState = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).Select(x => x.ReadingTaskState).FirstOrDefaultAsync();
|
||||
var query = from data in _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrialId == inDto.ReadingQuestionCriterionTrialId)
|
||||
|
||||
join page in _readingCriterionPageRepository.AsQueryable() on data.ReadingCriterionPageId??default(Guid) equals page.Id into pageTemp
|
||||
from leftpage in pageTemp.DefaultIfEmpty()
|
||||
join page in _readingCriterionPageRepository.AsQueryable() on data.ReadingCriterionPageId ?? default(Guid) equals page.Id into pageTemp
|
||||
from leftpage in pageTemp.DefaultIfEmpty()
|
||||
|
||||
join questionAnswer in _readingTaskQuestionAnswerRepository.Where(x=>x.VisitTaskId==inDto.VisitTaskId) on data.Id equals questionAnswer.ReadingQuestionTrialId into questionAnswerTemp
|
||||
from leftquestionAnswer in questionAnswerTemp.DefaultIfEmpty()
|
||||
select new GetTrialReadingQuestionOutDto()
|
||||
{
|
||||
ReadingQuestionTrialId=data.Id,
|
||||
ReadingQuestionCriterionTrialId=data.ReadingQuestionCriterionTrialId,
|
||||
TrialId=data.TrialId,
|
||||
Type=data.Type,
|
||||
ParentTriggerValue=data.ParentTriggerValue,
|
||||
GroupName=data.GroupName,
|
||||
QuestionName=data.QuestionName,
|
||||
IsRequired=data.IsRequired,
|
||||
ShowOrder=data.ShowOrder,
|
||||
ParentId=data.ParentId,
|
||||
TypeValue=data.TypeValue,
|
||||
Answer= leftquestionAnswer.Answer,
|
||||
ReadingCriterionPageId=data.ReadingCriterionPageId,
|
||||
PageName= leftpage.PageName,
|
||||
PageShowOrder = leftpage.ShowOrder,
|
||||
IsPublicPage=leftpage.IsPublicPage,
|
||||
};
|
||||
join questionAnswer in _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == inDto.VisitTaskId) on data.Id equals questionAnswer.ReadingQuestionTrialId into questionAnswerTemp
|
||||
from leftquestionAnswer in questionAnswerTemp.DefaultIfEmpty()
|
||||
select new GetTrialReadingQuestionOutDto()
|
||||
{
|
||||
ReadingQuestionTrialId = data.Id,
|
||||
ReadingQuestionCriterionTrialId = data.ReadingQuestionCriterionTrialId,
|
||||
TrialId = data.TrialId,
|
||||
Type = data.Type,
|
||||
ParentTriggerValue = data.ParentTriggerValue,
|
||||
GroupName = data.GroupName,
|
||||
QuestionName = data.QuestionName,
|
||||
IsRequired = data.IsRequired,
|
||||
ShowOrder = data.ShowOrder,
|
||||
ParentId = data.ParentId,
|
||||
TypeValue = data.TypeValue,
|
||||
Answer = leftquestionAnswer.Answer,
|
||||
ReadingCriterionPageId = data.ReadingCriterionPageId,
|
||||
PageName = leftpage.PageName,
|
||||
PageShowOrder = leftpage.ShowOrder,
|
||||
IsPublicPage = leftpage.IsPublicPage,
|
||||
};
|
||||
|
||||
var qusetionList =await query.OrderBy(x=>x.ShowOrder).ToListAsync();
|
||||
var qusetionList = await query.OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
var formType = await _readingQuestionCriterionTrialRepository.Where(x => x.Id == inDto.ReadingQuestionCriterionTrialId).Select(x => x.FormType).FirstOrDefaultAsync();
|
||||
var groupList = new List<GetTrialReadingQuestionOutDto>();
|
||||
|
@ -479,7 +493,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
if (formType == FormType.MultiplePage)
|
||||
{
|
||||
qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId != null).ToList();
|
||||
qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId != null).ToList();
|
||||
var readingCriterionPageIds = qusetionList.OrderBy(x => x.PageShowOrder).Select(x => x.ReadingCriterionPageId).Distinct().ToList();
|
||||
foreach (var item in readingCriterionPageIds)
|
||||
{
|
||||
|
@ -491,37 +505,37 @@ namespace IRaCIS.Application.Services
|
|||
IsPage = true,
|
||||
IsPublicPage = firstData.IsPublicPage,
|
||||
};
|
||||
|
||||
var pageGroupList = newPageQusetionList.Where(x =>x.Type =="group"|| (x.ParentId == null&&x.GroupName.IsNullOrEmpty())).ToList();
|
||||
pageGroupList.ForEach(x =>
|
||||
{
|
||||
this.FindChildQuestion(x, newPageQusetionList);
|
||||
});
|
||||
|
||||
page.Childrens = pageGroupList.Where(x=> !(x.Type == "group"&&x.Childrens.Count()==0)).ToList();
|
||||
|
||||
var pageGroupList = newPageQusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
|
||||
pageGroupList.ForEach(x =>
|
||||
{
|
||||
this.FindChildQuestion(x, newPageQusetionList);
|
||||
});
|
||||
|
||||
page.Childrens = pageGroupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList();
|
||||
groupList.Add(page);
|
||||
}
|
||||
|
||||
result.PublicPage = groupList.Where(x => x.IsPublicPage.Value).ToList();
|
||||
result.MultiPage= groupList.Where(x => !x.IsPublicPage.Value).ToList();
|
||||
result.MultiPage = groupList.Where(x => !x.IsPublicPage.Value).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
qusetionList = qusetionList.Where(x => x.ReadingCriterionPageId == null).ToList();
|
||||
|
||||
groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
|
||||
groupList.ForEach(x =>
|
||||
{
|
||||
this.FindChildQuestion(x, qusetionList);
|
||||
});
|
||||
|
||||
groupList= groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList();
|
||||
groupList = qusetionList.Where(x => x.Type == "group" || (x.ParentId == null && x.GroupName.IsNullOrEmpty())).ToList();
|
||||
groupList.ForEach(x =>
|
||||
{
|
||||
this.FindChildQuestion(x, qusetionList);
|
||||
});
|
||||
|
||||
groupList = groupList.Where(x => !(x.Type == "group" && x.Childrens.Count() == 0)).ToList();
|
||||
|
||||
result.SinglePage = groupList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -536,34 +550,36 @@ namespace IRaCIS.Application.Services
|
|||
return (result, new
|
||||
{
|
||||
readingTaskState = readingTaskState,
|
||||
FormType= formType
|
||||
FormType = formType
|
||||
|
||||
}); ;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取阅片任务和答案
|
||||
/// <summary>
|
||||
/// 获取阅片任务和答案
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task<List<GetTrialReadingQuestionOutDto>> GetTaskAndAnswer(Guid visitTaskId)
|
||||
{
|
||||
var taskQuery=from questionAnswer in _readingTaskQuestionAnswerRepository.Where(x=>x.VisitTaskId== visitTaskId)
|
||||
join trialQuestion in _readingQuestionTrialRepository.AsQueryable() on questionAnswer.ReadingQuestionTrialId equals trialQuestion.Id
|
||||
select new GetTrialReadingQuestionOutDto()
|
||||
{
|
||||
ReadingQuestionTrialId = trialQuestion.Id,
|
||||
ReadingQuestionCriterionTrialId = trialQuestion.ReadingQuestionCriterionTrialId,
|
||||
TrialId = trialQuestion.TrialId,
|
||||
Type = trialQuestion.Type,
|
||||
ParentTriggerValue = trialQuestion.ParentTriggerValue,
|
||||
GroupName = trialQuestion.GroupName,
|
||||
QuestionName = trialQuestion.QuestionName,
|
||||
IsRequired = trialQuestion.IsRequired,
|
||||
ShowOrder = trialQuestion.ShowOrder,
|
||||
ParentId = trialQuestion.ParentId,
|
||||
TypeValue = trialQuestion.TypeValue,
|
||||
Answer = questionAnswer.Answer
|
||||
};
|
||||
var taskQuery = from questionAnswer in _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId)
|
||||
join trialQuestion in _readingQuestionTrialRepository.AsQueryable() on questionAnswer.ReadingQuestionTrialId equals trialQuestion.Id
|
||||
select new GetTrialReadingQuestionOutDto()
|
||||
{
|
||||
ReadingQuestionTrialId = trialQuestion.Id,
|
||||
ReadingQuestionCriterionTrialId = trialQuestion.ReadingQuestionCriterionTrialId,
|
||||
TrialId = trialQuestion.TrialId,
|
||||
Type = trialQuestion.Type,
|
||||
ParentTriggerValue = trialQuestion.ParentTriggerValue,
|
||||
GroupName = trialQuestion.GroupName,
|
||||
QuestionName = trialQuestion.QuestionName,
|
||||
IsRequired = trialQuestion.IsRequired,
|
||||
ShowOrder = trialQuestion.ShowOrder,
|
||||
ParentId = trialQuestion.ParentId,
|
||||
TypeValue = trialQuestion.TypeValue,
|
||||
Answer = questionAnswer.Answer
|
||||
};
|
||||
var qusetionList = await taskQuery.OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
List<GetTrialReadingQuestionOutDto> groupList = qusetionList.Where(x => x.ParentId == null).ToList();
|
||||
groupList.ForEach(x =>
|
||||
|
@ -573,7 +589,9 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
return groupList;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取裁判阅片任务信息
|
||||
/// <summary>
|
||||
/// 获取裁判阅片任务信息
|
||||
/// </summary>
|
||||
|
@ -592,14 +610,14 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
ReadingTaskState = visitTask.ReadingTaskState,
|
||||
JudgeResultTaskId = visitTask.JudgeResultTaskId,
|
||||
JudgeResultRemark=visitTask.JudgeResultRemark,
|
||||
JudgeResultImagePath= visitTask.JudgeResultImagePath,
|
||||
JudgeResultRemark = visitTask.JudgeResultRemark,
|
||||
JudgeResultImagePath = visitTask.JudgeResultImagePath,
|
||||
VisitTaskInfoList = new List<JudgeReadingInfoDto>()
|
||||
};
|
||||
var visitIds = await _visitTaskRepository.Where(x => x.JudgeVisitTaskId == inDto.VisitTaskId).Select(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.ArmEnum,
|
||||
var visitIds = await _visitTaskRepository.Where(x => x.JudgeVisitTaskId == inDto.VisitTaskId).Select(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.ArmEnum,
|
||||
}).ToListAsync();
|
||||
foreach (var item in visitIds)
|
||||
{
|
||||
|
@ -607,18 +625,21 @@ namespace IRaCIS.Application.Services
|
|||
judgeInfo.VisitTaskInfoList.Add(
|
||||
new JudgeReadingInfoDto()
|
||||
{
|
||||
JudgeQuestionAnswerInfoList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == item.Id&&x.ReadingQuestionTrial.IsJudgeQuestion).Select(x => new JudgeQuestionAnswerInfo {
|
||||
JudgeQuestionAnswerInfoList = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == item.Id && x.ReadingQuestionTrial.IsJudgeQuestion).Select(x => new JudgeQuestionAnswerInfo
|
||||
{
|
||||
Answer = x.Answer,
|
||||
QuestionName = x.ReadingQuestionTrial.QuestionName,
|
||||
}).ToListAsync(),
|
||||
VisitTaskId = item.Id,
|
||||
ArmEnum = item.ArmEnum,
|
||||
TaskReadingQuestionList = taskReadingQuestionList,
|
||||
});
|
||||
});
|
||||
}
|
||||
return judgeInfo;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存裁判问题
|
||||
/// <summary>
|
||||
/// 保存裁判问题
|
||||
/// </summary>
|
||||
|
@ -631,33 +652,15 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
JudgeResultTaskId = inDto.JudgeResultTaskId,
|
||||
JudgeResultRemark = inDto.JudgeResultRemark,
|
||||
JudgeResultImagePath=inDto.JudgeResultImagePath,
|
||||
JudgeResultImagePath = inDto.JudgeResultImagePath,
|
||||
|
||||
});
|
||||
var result=await _visitTaskRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提交裁判问题
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[NonDynamicMethod]
|
||||
public async Task<IResponseOutput> SubmitJudgeVisitTaskResult(SaveJudgeVisitTaskResult inDto)
|
||||
{
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask()
|
||||
{
|
||||
JudgeResultTaskId = inDto.JudgeResultTaskId,
|
||||
ReadingTaskState = ReadingTaskState.HaveSigned,
|
||||
JudgeResultRemark = inDto.JudgeResultRemark,
|
||||
SignTime = DateTime.Now,
|
||||
JudgeResultImagePath=inDto.JudgeResultImagePath,
|
||||
});
|
||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取既往结果
|
||||
/// <summary>
|
||||
/// 获取既往结果
|
||||
/// </summary>
|
||||
|
@ -665,11 +668,13 @@ namespace IRaCIS.Application.Services
|
|||
[HttpPost]
|
||||
public async Task<List<GetReadingPastResultListOutDto>> GetReadingPastResultList(GetReadingPastResultListInDto inDto)
|
||||
{
|
||||
var readingPastResultList =await _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId&&x.SubjectId==inDto.SubjectId && x.DoctorUserId == _userInfo.Id
|
||||
&&x.Id!=inDto.VisitTaskId&&x.ReadingTaskState== ReadingTaskState.HaveSigned).ProjectTo<GetReadingPastResultListOutDto>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
return readingPastResultList;
|
||||
var readingPastResultList = await _visitTaskRepository.Where(x => x.TrialId == inDto.TrialId && x.SubjectId == inDto.SubjectId && x.DoctorUserId == _userInfo.Id
|
||||
&& x.Id != inDto.VisitTaskId && x.ReadingTaskState == ReadingTaskState.HaveSigned).ProjectTo<GetReadingPastResultListOutDto>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
return readingPastResultList;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 找子问题
|
||||
/// <summary>
|
||||
/// 找子问题
|
||||
/// </summary>
|
||||
|
@ -678,7 +683,7 @@ namespace IRaCIS.Application.Services
|
|||
[NonDynamicMethod]
|
||||
public void FindChildQuestion(GetTrialReadingQuestionOutDto trialReadingQuestion, List<GetTrialReadingQuestionOutDto> questionlists)
|
||||
{
|
||||
trialReadingQuestion.Childrens = questionlists.Where(x => x.ParentId == trialReadingQuestion.ReadingQuestionTrialId||(trialReadingQuestion.Type == "group"&&x.Type != "group" && x.ParentId==null&&x.GroupName==trialReadingQuestion.GroupName)).ToList();
|
||||
trialReadingQuestion.Childrens = questionlists.Where(x => x.ParentId == trialReadingQuestion.ReadingQuestionTrialId || (trialReadingQuestion.Type == "group" && x.Type != "group" && x.ParentId == null && x.GroupName == trialReadingQuestion.GroupName)).ToList();
|
||||
if (trialReadingQuestion.Childrens != null && trialReadingQuestion.Childrens.Count != 0)
|
||||
{
|
||||
trialReadingQuestion.Childrens.ForEach(x =>
|
||||
|
@ -687,7 +692,9 @@ namespace IRaCIS.Application.Services
|
|||
});
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存任务问题
|
||||
/// <summary>
|
||||
/// 保存任务问题
|
||||
/// </summary>
|
||||
|
@ -712,17 +719,19 @@ namespace IRaCIS.Application.Services
|
|||
await _visitTaskRepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.VisitTaskId, x => new VisitTask()
|
||||
{
|
||||
ReadingTaskState = ReadingTaskState.Reading,
|
||||
|
||||
|
||||
});
|
||||
await _readingTaskQuestionAnswerRepository.AddRangeAsync(readingTaskAnswerList);
|
||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 提交问题
|
||||
|
||||
/// <summary>
|
||||
/// 提交问题
|
||||
/// 提交访视阅片问题
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
|
@ -733,8 +742,9 @@ namespace IRaCIS.Application.Services
|
|||
await _visitTaskRepository.BatchUpdateNoTrackingAsync(x => x.Id == inDto.VisitTaskId, x => new VisitTask()
|
||||
{
|
||||
ReadingTaskState = ReadingTaskState.HaveSigned,
|
||||
SignTime=DateTime.Now,
|
||||
SignTime = DateTime.Now,
|
||||
});
|
||||
|
||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||
// 触裁判任务
|
||||
await this.TriggerJudgeQuestion(inDto.VisitTaskId);
|
||||
|
@ -745,6 +755,53 @@ namespace IRaCIS.Application.Services
|
|||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提交裁判问题
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[NonDynamicMethod]
|
||||
public async Task<IResponseOutput> SubmitJudgeVisitTaskResult(SaveJudgeVisitTaskResult inDto)
|
||||
{
|
||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(inDto.VisitTaskId, x => new VisitTask()
|
||||
{
|
||||
JudgeResultTaskId = inDto.JudgeResultTaskId,
|
||||
ReadingTaskState = ReadingTaskState.HaveSigned,
|
||||
JudgeResultRemark = inDto.JudgeResultRemark,
|
||||
SignTime = DateTime.Now,
|
||||
JudgeResultImagePath = inDto.JudgeResultImagePath,
|
||||
});
|
||||
var result = await _visitTaskRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提交全局阅片结果
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[NonDynamicMethod]
|
||||
public async Task<IResponseOutput> SubmitGlobalReadingInfo(SaveGlobalReadingInfoInDto inDto)
|
||||
{
|
||||
var result = await this.SaveGlobalReadingInfo(inDto);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//public async Task<IResponseOutput> SubmitTaskChangeState()
|
||||
//{
|
||||
|
||||
//}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 完成阅片修改状态
|
||||
/// </summary>
|
||||
|
|
|
@ -267,7 +267,7 @@ namespace IRaCIS.Application.Services
|
|||
[HttpPost]
|
||||
public async Task<List<GetReadingVisitListOutDto>> GetReadingVisitList(GetReadingVisitListInDto inDto)
|
||||
{
|
||||
var maxVisitNum = await _readingPeriodSetRepository.Where(x => x.TrialId == inDto.TrialId && x.ReadingSetType == inDto.ReadingSetType&&(x.IsTakeEffect== ReadingPeriodStatus.TakeEffect||x.IsTakeEffect==ReadingPeriodStatus.Revocation)).MaxAsync(x => x.ExpirationVisitNum)??0;
|
||||
var maxVisitNum = await _readingPeriodSetRepository.Where(x => x.TrialId == inDto.TrialId && x.ReadingSetType == inDto.ReadingSetType&&x.IsTakeEffect== ReadingPeriodStatus.TakeEffect).MaxAsync(x => x.ExpirationVisitNum)??0;
|
||||
var thisVisitNum = await _readingPeriodSetRepository.Where(x => x.Id == inDto.ReadingPeriodSetId).Select(x => x.ExpirationVisitNum).FirstOrDefaultAsync() ?? -1;
|
||||
List <GetReadingVisitListOutDto> result = await _visitStageRepository.Where(x => x.TrialId == inDto.TrialId ).Where(x=>x.VisitNum== thisVisitNum || x.VisitNum >= maxVisitNum).Select(x => new GetReadingVisitListOutDto()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue