修改查询

This commit is contained in:
he
2023-03-30 11:47:49 +08:00
parent 0d49e56efd
commit 59b6be751f
7 changed files with 493 additions and 46 deletions
@@ -0,0 +1,322 @@
using IRaCIS.Core.Domain.Share;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Service.Reading.Dto
{
public class VisitTaskDto
{
public Guid Id { get; set; }
public string TaskName { get; set; } = string.Empty;
public string TaskBlindName { get; set; } = string.Empty;
//任务来源访视Id 方便回更访视读片状态
public Guid? SourceSubjectVisitId { get; set; }
public Guid? SouceReadModuleId { get; set; }
/// <summary>
/// 任务类型
/// </summary>
public ReadingCategory ReadingCategory { get; set; }
public Guid CreateUserId { get; set; }
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
public Guid UpdateUserId { get; set; }
public Guid TrialId { get; set; }
/// <summary>
/// 分配时间
/// </summary>
public DateTime? AllocateTime { get; set; }
public Guid SubjectId { get; set; }
public int Code { get; set; }
public string TaskCode { get; set; } = string.Empty;
public bool IsUrgent { get; set; }
/// <summary>
/// 加急类型
/// </summary>
public TaskUrgentType? TaskUrgentType { get; set; }
/// <summary>
/// 任务加急类型
/// </summary>
public string TaskUrgentRemake { get; set; } = string.Empty;
/// <summary>
/// 是否和编辑加急状态
/// </summary>
public bool IsCanEditUrgentState { get; set; } = true;
/// <summary>
/// 0 代表 单重阅片 产生的任务 否则就是双重 任务 1 任务 2
/// </summary>
[Required]
public Arm ArmEnum { get; set; }
/// <summary>
/// 分配状态
/// </summary>
public TaskAllocationState TaskAllocationState { get; set; }
public TaskState TaskState { get; set; }
/// <summary>
/// 重阅状态
/// </summary>
public ReReadingApplyState ReReadingApplyState { get; set; }
public Guid? DoctorUserId { get; set; }
public Guid TrialReadingCriterionId { get; set; }
//裁判任务的Id
public Guid? JudgeVisitTaskId { get; set; }
//任务阅片状态
public ReadingTaskState ReadingTaskState { get; set; }
//签名时间
public DateTime? SignTime { get; set; }
public DateTime? SuggesteFinishedTime { get; set; }
/// <summary>
/// 是否是重阅产生的,方便过滤数据
/// </summary>
public bool IsReReadingCreate { get; set; }
/// <summary>
/// PM 对该任务进行了回退 影响的任务不设置
/// </summary>
public bool IsPMSetBack { get; set; }
/// <summary> 裁判结果的任务ID </summary>
public Guid? JudgeResultTaskId { get; set; }
//随访任务号 取访视的号 计划外是 访视+0.1 裁判任务在访视任务上+0.002 全局任务在截止访视号上+0.03 肿瘤待定
public decimal VisitTaskNum { get; set; }
/// <summary>
/// 首次阅片时间
/// </summary>
public DateTime? FirstReadingTime { get; set; }
/// <summary>
/// 全局是否有更新
/// </summary>
public bool? IsGlobalHaveUpdate { get; set; }
/// <summary>
/// IR是否阅读临床数据
/// </summary>
public bool IsReadClinicalData { get; set; } = false;
/// <summary>
/// 关联的访视任务ID (当前任务是访视任务的话会有自己)
/// </summary>
public string RelatedVisitTaskIds { get; set; } = "[]";
/// <summary>
/// 关联的访视任务ID (当前任务是访视任务的话会有自己)集合
/// </summary>
[NotMapped]
public List<Guid> RelatedVisitTaskIdList
{
get
{
try
{
return JsonConvert.DeserializeObject<List<Guid>>(this.RelatedVisitTaskIds);
}
catch (Exception)
{
return new List<Guid>();
}
}
}
/// <summary>
/// 既往任务Id 不包括自己
/// </summary>
public string PastResultTaskIds { get; set; } = "[]";
/// <summary>
/// 既往任务Id 不包括自己集合
/// </summary>
[NotMapped]
public List<Guid> PastResultTaskIdList
{
get
{
try
{
return JsonConvert.DeserializeObject<List<Guid>>(this.PastResultTaskIds);
}
catch (Exception)
{
return new List<Guid>();
}
}
}
#region
/// <summary>
/// 裁判结果的备注
/// </summary>
public string JudgeResultRemark { get; set; } = string.Empty;
/// <summary>
/// 裁判结果的图片路径
/// </summary>
public string JudgeResultImagePath { get; set; } = string.Empty;
#endregion
#region
/// <summary>
/// 阅片结果是否和原数据有差异
/// </summary>
public bool? IsAnalysisDiffToOriginalData { get; set; }
/// <summary>
/// 组件一致性和原Arm1是否有差异
/// </summary>
public bool? IsGroupDiffArm1 { get; set; }
/// <summary>
/// 组件一致性和原Arm2是否有差异
/// </summary>
public bool? IsGroupDiffArm2 { get; set; }
/// <summary>
/// 是否是一致性分析产生
/// </summary>
public bool IsAnalysisCreate { get; set; }
/// <summary>
/// 转换之前的任务Id(转化的任务才有该值)
/// </summary>
public Guid? BeforeConvertedTaskId { get; set; }
// [Projectable]
public bool IsConvertedTask { get; set; }
[NotMapped]
public List<CrterionDictionaryGroup> CrterionDictionaryGroup
{
get
{
//try
//{
// if (this.IsConvertedTask)
// {
// return new List<CrterionDictionaryGroup>() { Share.CrterionDictionaryGroup.General, Share.CrterionDictionaryGroup.Converted };
// }
// else
// {
// return new List<CrterionDictionaryGroup>() { Share.CrterionDictionaryGroup.General, Share.CrterionDictionaryGroup.BeforeConvert };
// }
//}
//catch (Exception)
//{
return new List<CrterionDictionaryGroup>();
//}
}
}
public bool? IsSelfAnalysis { get; set; }
public string BlindSubjectCode { get; set; } = string.Empty;
public string BlindTrialSiteCode { get; set; } = string.Empty;
//一致性分析规则Id 用于最后统计
//public Guid? TaskConsistentRuleId { get; set; }
/// <summary>
/// 针对产生的一致性任务而言,这个字段存储的是原始任务
/// </summary>
public Guid? ConsistentAnalysisOriginalTaskId { get; set; }
#endregion
//临床数据
public bool IsNeedClinicalDataSign { get; set; }
public bool IsClinicalDataSign { get; set; }
//前序任务需要签名 但是未签名
public bool IsFrontTaskNeedSignButNotSign { get; set; }
/// <summary>
/// 裁判结果图片地址
/// </summary>
[NotMapped]
public List<string> JudgeResultImagePathList
{
get
{
try
{
return this.JudgeResultImagePath.Trim().Split(',').ToList();
}
catch (Exception)
{
return new List<string>();
}
}
}
}
}
@@ -640,7 +640,7 @@ namespace IRaCIS.Application.Services
{
answers = await _readingTaskQuestionAnswerRepository.Where(x => x.VisitTaskId == visitTaskId).ToListAsync();
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).FirstNotNullAsync();
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
questions.ForEach(x =>
{
x.CrterionDictionaryGroup = taskinfo.CrterionDictionaryGroup;
@@ -726,7 +726,7 @@ namespace IRaCIS.Application.Services
.ToListAsync();
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).FirstNotNullAsync();
var taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.VisitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
if (taskInfo.IsConvertedTask &&taskInfo.BeforeConvertedTaskId!=null)
{
@@ -865,10 +865,10 @@ namespace IRaCIS.Application.Services
isEn_Us = _userInfo.IsEn_Us
}).OrderBy(x => x.ShowOrder).ToListAsync();
var taskInfo = new VisitTask();
var taskInfo = new VisitTaskDto();
if (inDto.TaskId != null)
{
taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.TaskId).FirstNotNullAsync();
taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.TaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
qusetionList.ForEach(x =>
{
@@ -945,7 +945,7 @@ namespace IRaCIS.Application.Services
if (inDto.TaskId != null)
{
taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.TaskId).FirstNotNullAsync();
taskInfo = await _visitTaskRepository.Where(x => x.Id == inDto.TaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
// 取基线
var baseLineVisitId = await _subjectVisitRepository.Where(x => x.SubjectId == taskInfo.SubjectId && x.IsBaseLine).Select(x => x.Id).FirstNotNullAsync();
@@ -978,17 +978,7 @@ namespace IRaCIS.Application.Services
lastTaskTableAnswer= await _readingTableQuestionAnswerRepository.Where(x => x.VisitTaskId == laskTaskId).Include(x => x.ReadingTableQuestionTrial).ToListAsync();
if (taskInfo.IsConvertedTask &&
!(await _visitTaskRepository.AnyAsync(x => x.IsAnalysisCreate == taskInfo.IsAnalysisCreate
&& x.IsSelfAnalysis == taskInfo.IsSelfAnalysis
&& x.VisitTaskNum < taskInfo.VisitTaskNum
&& x.DoctorUserId == taskInfo.DoctorUserId
&& x.TrialReadingCriterionId == taskInfo.TrialReadingCriterionId
&& !x.IsConvertedTask
&& x.SubjectId == taskInfo.SubjectId
&& x.ArmEnum == taskInfo.ArmEnum &&
x.TaskState == TaskState.Effect))
)
if (taskInfo.BeforeConvertedTaskId!=null )
{
isFirstChangeTask = true;
@@ -2248,7 +2238,7 @@ namespace IRaCIS.Application.Services
});
await _visitTaskRepository.SaveChangesAsync();
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).FirstNotNullAsync();
var visitTaskInfo = await _visitTaskRepository.Where(x => x.Id == task.VisitTaskId).ProjectTo<VisitTaskDto>(_mapper.ConfigurationProvider).FirstNotNullAsync();
task.SubjectCode = visitTaskInfo.BlindSubjectCode.IsNullOrEmpty() ? task.SubjectCode : visitTaskInfo.BlindSubjectCode;
@@ -2378,13 +2368,14 @@ namespace IRaCIS.Application.Services
var taskinfo = await _visitTaskRepository.Where(x => x.Id == visitTaskId).Include(x=>x.TrialReadingCriterion).FirstNotNullAsync();
var isConvertedTask=await _visitTaskRepository.Where(x => x.Id == visitTaskId).Select(x=>x.IsConvertedTask).FirstNotNullAsync();
switch (taskinfo.TrialReadingCriterion.CriterionType)
{
case CriterionType.IRECIST1Point1:
if (!taskinfo.IsConvertedTask &&
if (!isConvertedTask &&
(await _readingTaskQuestionAnswerRepository.AnyAsync(x => x.VisitTaskId == visitTaskId
&& x.ReadingQuestionTrial.QuestionType == QuestionType.Tumor && x.Answer==(((int)OverallAssessment.PD)).ToString()))
)
@@ -17,6 +17,7 @@ namespace IRaCIS.Core.Application.Service
//是否英文环境
var isEn_Us=false;
CreateMap<VisitTask, VisitTaskDto>();
CreateMap<ShortcutKey, DefaultShortcutKeyView>();
CreateMap<ReadingPeriodSetAddOrEdit, ReadingPeriodSet>();