修改一版
parent
5a9a6d74d4
commit
f7963eebd8
|
@ -1444,6 +1444,61 @@
|
|||
答案
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingMedicineQuestion.Answer">
|
||||
<summary>
|
||||
答案
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingMedicineQuestion.Type">
|
||||
<summary>
|
||||
类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingMedicineQuestion.ParentTriggerValue">
|
||||
<summary>
|
||||
父问题触发值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingMedicineQuestion.QuestionName">
|
||||
<summary>
|
||||
问题名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingMedicineQuestion.TypeValue">
|
||||
<summary>
|
||||
类型值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingMedicineQuestion.IsEnable">
|
||||
<summary>
|
||||
是否启用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingMedicineQuestion.IsRequired">
|
||||
<summary>
|
||||
是否必须
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingMedicineQuestion.ShowOrder">
|
||||
<summary>
|
||||
排序
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingMedicineQuestion.ParentId">
|
||||
<summary>
|
||||
父问题
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingMedicineQuestion.IsConfirm">
|
||||
<summary>
|
||||
是否确认
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TaskInfo.IsCurrentTask">
|
||||
<summary>
|
||||
是否是当前任务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.TaskInfo.TaskName">
|
||||
<summary>
|
||||
任务名称
|
||||
|
@ -2161,7 +2216,7 @@
|
|||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.ReadingMedicalReviewService.GetMedicalReviewReadingTask(IRaCIS.Core.Application.Service.Reading.Dto.GetMedicalReviewReadingTaskInDto)">
|
||||
<summary>
|
||||
获取
|
||||
获取医学审核任务信息
|
||||
</summary>
|
||||
<param name="inDto"></param>
|
||||
<returns></returns>
|
||||
|
|
|
@ -29,12 +29,79 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public List<TaskInfo> TaskList { get; set; } = new List<TaskInfo>();
|
||||
|
||||
public List<TaskInfo> OtherDoctorTaskList { get; set; } = new List<TaskInfo>();
|
||||
|
||||
|
||||
public List<ReadingMedicineQuestion> QuestionAnswerList { get; set; } = new List<ReadingMedicineQuestion>();
|
||||
|
||||
}
|
||||
|
||||
public class ReadingMedicineQuestion
|
||||
{
|
||||
/// <summary>
|
||||
/// 答案
|
||||
/// </summary>
|
||||
public string Answer { get; set; }
|
||||
|
||||
public Guid MedicineQuestionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父问题触发值
|
||||
/// </summary>
|
||||
public string ParentTriggerValue { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 问题名称
|
||||
/// </summary>
|
||||
public string QuestionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型值
|
||||
/// </summary>
|
||||
public string TypeValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
public bool IsEnable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否必须
|
||||
/// </summary>
|
||||
public bool IsRequired { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int ShowOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父问题
|
||||
/// </summary>
|
||||
public Guid? ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否确认
|
||||
/// </summary>
|
||||
public bool? IsConfirm { get; set; }
|
||||
|
||||
|
||||
public List<ReadingMedicineQuestion> Childrens { get; set; }
|
||||
}
|
||||
|
||||
public class TaskInfo
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否是当前任务
|
||||
/// </summary>
|
||||
public bool IsCurrentTask { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 任务名称
|
||||
/// </summary>
|
||||
|
@ -46,6 +113,8 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
/// </summary>
|
||||
public string TaskBlindName { get; set; }
|
||||
|
||||
public Arm ArmEnum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 评估结果
|
||||
/// </summary>
|
||||
|
|
|
@ -157,8 +157,8 @@ namespace IRaCIS.Application.Services
|
|||
dto.SortField = dto.Asc ? dto.SortField : dto.SortField + " desc";
|
||||
var subjectQuery = _readModuleViewRepository.WhereIf(dto.TrialId != null, x => x.TrialId == dto.TrialId)
|
||||
.WhereIf(dto.SubjectId != null, x => x.SubjectId == dto.SubjectId)
|
||||
.WhereIf(dto.TrialSiteCode != null && dto.TrialSiteCode != String.Empty, x => x.TrialSiteCode == dto.TrialSiteCode)
|
||||
.WhereIf(dto.SubjectCode != null && dto.SubjectCode != String.Empty, x => x.SubjectCode == dto.SubjectCode)
|
||||
.WhereIf(dto.TrialSiteCode != null && dto.TrialSiteCode != string.Empty, x => x.TrialSiteCode == dto.TrialSiteCode)
|
||||
.WhereIf(dto.SubjectCode != null && dto.SubjectCode != string.Empty, x => x.SubjectCode == dto.SubjectCode)
|
||||
.WhereIf(dto.ModuleType != null, x => x.ModuleType == dto.ModuleType)
|
||||
.WhereIf(dto.ReadingStatus != null, x => x.ReadingStatus == dto.ReadingStatus)
|
||||
.WhereIf(dto.Name != null, x => x.Name.Contains(dto.Name)).OrderBy(x => x.SiteCode);
|
||||
|
@ -336,7 +336,7 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
else
|
||||
{
|
||||
return ResponseOutput.NotOk("No qualified visit was found ");
|
||||
return ResponseOutput.NotOk("未找到符合要求的访视");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,64 +21,161 @@ namespace IRaCIS.Core.Application.Service
|
|||
private readonly IRepository<ReadingMedicineTrialQuestion> _readingMedicineTrialQuestionRepository;
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
private readonly IRepository<VisitTask> _visitTaskRepository;
|
||||
private readonly IRepository<TaskMedicalReview> _taskMedicalReviewRepository;
|
||||
private readonly IRepository<ReadingMedicineQuestionAnswer> _readingMedicineQuestionAnswerRepository;
|
||||
private readonly IRepository<ReadingMedicineSystemQuestion> _readingMedicineSystemQuestionRepository;
|
||||
|
||||
public ReadingMedicalReviewService(
|
||||
IRepository<ReadingMedicineTrialQuestion> readingMedicineTrialQuestionRepository,
|
||||
IRepository<Trial> trialRepository,
|
||||
IRepository<VisitTask> visitTaskRepository,
|
||||
IRepository<ReadingMedicineSystemQuestion> readingMedicineSystemQuestionRepository
|
||||
IRepository<TaskMedicalReview> taskMedicalReviewRepository,
|
||||
IRepository<ReadingMedicineQuestionAnswer> readingMedicineQuestionAnswerRepository,
|
||||
IRepository<ReadingMedicineSystemQuestion> readingMedicineSystemQuestionRepository
|
||||
)
|
||||
{
|
||||
this._readingMedicineTrialQuestionRepository = readingMedicineTrialQuestionRepository;
|
||||
this._trialRepository = trialRepository;
|
||||
this._visitTaskRepository = visitTaskRepository;
|
||||
this._taskMedicalReviewRepository = taskMedicalReviewRepository;
|
||||
this._readingMedicineQuestionAnswerRepository = readingMedicineQuestionAnswerRepository;
|
||||
this._readingMedicineSystemQuestionRepository = readingMedicineSystemQuestionRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取
|
||||
/// 获取医学审核任务信息
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<GetMedicalReviewReadingTaskOutDto> GetMedicalReviewReadingTask(GetMedicalReviewReadingTaskInDto inDto)
|
||||
{
|
||||
var medicalReviewInfo = await _trialRepository.Where(x => x.Id == inDto.TrialId).Select(x => new GetMedicalReviewReadingTaskOutDto()
|
||||
{
|
||||
ReadingType=x.ReadingType,
|
||||
IsReadingTaskViewInOrder=x.IsReadingTaskViewInOrder
|
||||
}).FirstOrDefaultAsync();
|
||||
}).FirstNotNullAsync();
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.TrialId).FirstOrDefaultAsync();
|
||||
var taskMedicalReview = await _taskMedicalReviewRepository.Where(x => x.Id == inDto.TaskMedicalReviewId).FirstNotNullAsync();
|
||||
|
||||
var taskInfo = await _visitTaskRepository.Where(x => x.Id == taskMedicalReview.VisitTaskId).FirstNotNullAsync();
|
||||
|
||||
// 单审有序
|
||||
#region 取任务
|
||||
if (medicalReviewInfo.IsReadingTaskViewInOrder)
|
||||
{
|
||||
medicalReviewInfo.TaskList = await _visitTaskRepository.Where(x => x.SouceReadModuleId == taskInfo.SouceReadModuleId && x.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId
|
||||
medicalReviewInfo.TaskList = await _visitTaskRepository
|
||||
.WhereIf(taskInfo.ArmEnum == Arm.JudgeArm, x => x.ArmEnum == Arm.JudgeArm)
|
||||
.WhereIf(taskInfo.ArmEnum != Arm.JudgeArm, x => x.ArmEnum != Arm.JudgeArm)
|
||||
.Where(x => x.SubjectId == taskInfo.SubjectId
|
||||
&& x.DoctorUserId == taskInfo.DoctorUserId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ReReadingApplyState != ReReadingApplyState.Agree
|
||||
).OrderBy(x => x.VisitTaskNum).Select(x => new TaskInfo()
|
||||
{
|
||||
Id = x.Id,
|
||||
IsCurrentTask = x.Id == taskInfo.Id,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ArmEnum=x.ArmEnum,
|
||||
TaskName = x.TaskName
|
||||
}).ToListAsync();
|
||||
if (medicalReviewInfo.ReadingType == ReadingMethod.Double)
|
||||
{
|
||||
if (taskInfo.ArmEnum != Arm.JudgeArm)
|
||||
{
|
||||
medicalReviewInfo.OtherDoctorTaskList = await _visitTaskRepository.Where(x => x.ArmEnum != Arm.JudgeArm && x.SubjectId == taskInfo.SubjectId
|
||||
&& x.DoctorUserId != taskInfo.DoctorUserId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ReReadingApplyState != ReReadingApplyState.Agree
|
||||
).OrderBy(x => x.VisitTaskNum).Select(x => new TaskInfo()
|
||||
{
|
||||
Id = x.Id,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ArmEnum=x.ArmEnum,
|
||||
TaskName = x.TaskName
|
||||
}).ToListAsync();
|
||||
if (medicalReviewInfo.ReadingType == ReadingMethod.Double)
|
||||
{
|
||||
//medicalReviewInfo.OtherDoctorTaskList=
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
medicalReviewInfo.TaskList = await _visitTaskRepository.Where(x => x.Id == taskInfo.Id).Select(x => new TaskInfo()
|
||||
{
|
||||
Id = x.Id,
|
||||
IsCurrentTask = x.Id == taskInfo.Id,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
ArmEnum=x.ArmEnum,
|
||||
TaskName = x.TaskName
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
if (medicalReviewInfo.ReadingType == ReadingMethod.Double)
|
||||
{
|
||||
if (taskInfo.ArmEnum != Arm.JudgeArm)
|
||||
{
|
||||
medicalReviewInfo.OtherDoctorTaskList = await _visitTaskRepository.Where(x => x.ArmEnum != Arm.JudgeArm && x.SouceReadModuleId == taskInfo.SouceReadModuleId && x.SourceSubjectVisitId == taskInfo.SourceSubjectVisitId
|
||||
&& x.DoctorUserId != taskInfo.DoctorUserId && x.ReadingTaskState == ReadingTaskState.HaveSigned && x.ReReadingApplyState != ReReadingApplyState.Agree
|
||||
).OrderBy(x => x.VisitTaskNum).Select(x => new TaskInfo()
|
||||
{
|
||||
Id = x.Id,
|
||||
ReadingCategory = x.ReadingCategory,
|
||||
TaskBlindName = x.TaskBlindName,
|
||||
TaskName = x.TaskName,
|
||||
ArmEnum=x.ArmEnum,
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
medicalReviewInfo.QuestionAnswerList = await this.GetMedicalQuestionAnswer(inDto);
|
||||
return medicalReviewInfo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private async Task<List<ReadingMedicineQuestion>> GetMedicalQuestionAnswer(GetMedicalReviewReadingTaskInDto inDto)
|
||||
{
|
||||
var questionQuery = from data in _readingMedicineTrialQuestionRepository.Where(x => x.TrialId == inDto.TrialId&&x.IsConfirm&&x.IsEnable)
|
||||
join questionAnswer in _readingMedicineQuestionAnswerRepository.Where(x => x.TaskMedicalReviewId == inDto.TaskMedicalReviewId) on data.Id equals questionAnswer.ReadingMedicineQuestionId into questionAnswerTemp
|
||||
from leftquestionAnswer in questionAnswerTemp.DefaultIfEmpty()
|
||||
select new ReadingMedicineQuestion()
|
||||
{
|
||||
MedicineQuestionId = data.Id,
|
||||
Type = data.Type,
|
||||
ParentTriggerValue = data.ParentTriggerValue,
|
||||
IsEnable=data.IsEnable,
|
||||
IsConfirm=data.IsConfirm,
|
||||
QuestionName = data.QuestionName,
|
||||
IsRequired = data.IsRequired,
|
||||
ShowOrder = data.ShowOrder,
|
||||
ParentId = data.ParentId,
|
||||
TypeValue = data.TypeValue,
|
||||
Answer = leftquestionAnswer.Answer
|
||||
};
|
||||
|
||||
}
|
||||
var questionList = await questionQuery.ToListAsync();
|
||||
|
||||
List < ReadingMedicineQuestion > medicineQuestionList = questionList.Where(x => x.ParentId == null).ToList();
|
||||
medicineQuestionList.ForEach(x =>
|
||||
{
|
||||
FindChildQuestion(x, questionList);
|
||||
});
|
||||
|
||||
return medicineQuestionList;
|
||||
}
|
||||
|
||||
|
||||
private void FindChildQuestion(ReadingMedicineQuestion medicineQuestionList, List<ReadingMedicineQuestion> questionlists)
|
||||
{
|
||||
medicineQuestionList.Childrens = questionlists.Where(x => x.ParentId == medicineQuestionList.MedicineQuestionId).ToList();
|
||||
if (medicineQuestionList.Childrens != null && medicineQuestionList.Childrens.Count != 0)
|
||||
{
|
||||
medicineQuestionList.Childrens.ForEach(x =>
|
||||
{
|
||||
this.FindChildQuestion(x, questionlists);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,14 @@ namespace IRaCIS.Core.Domain.Models
|
|||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 医学审核问题Id
|
||||
/// </summary>
|
||||
public Guid ReadingMedicineQuestionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 医学审核Id
|
||||
/// </summary>
|
||||
/// 医学审核Id
|
||||
/// </summary>
|
||||
|
||||
public Guid TaskMedicalReviewId { get; set; }
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// <summary>
|
||||
/// 是否确认
|
||||
/// </summary>
|
||||
public bool? IsConfirm { get; set; }
|
||||
public bool IsConfirm { get; set; }
|
||||
|
||||
[ForeignKey("ParentId")]
|
||||
public ReadingMedicineTrialQuestion ParentQuestion { get; set; }
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Linq.Dynamic.Core;
|
||||
|
||||
namespace IRaCIS.Core.Infrastructure.Extention
|
||||
{
|
||||
public static class IQueryableExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取第一条 null提示
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="QueryBusinessObjectNotExistException"></exception>
|
||||
public static async Task<TSource> FirstNotNullAsync<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
var result =await source.FirstOrDefaultAsync();
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new QueryBusinessObjectNotExistException($"The query object does not exist in database, Please check the query parameters");
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue