维护关系
parent
1c546fcb2b
commit
4666e030ac
|
@ -37,6 +37,7 @@ namespace IRaCIS.Application.Services
|
||||||
private readonly IRepository<Subject> _subjectRepository;
|
private readonly IRepository<Subject> _subjectRepository;
|
||||||
private readonly IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository;
|
private readonly IRepository<ReadingGlobalTaskInfo> _readingGlobalTaskInfoRepository;
|
||||||
private readonly IRepository<ReadingCriterionPage> _readingCriterionPageRepository;
|
private readonly IRepository<ReadingCriterionPage> _readingCriterionPageRepository;
|
||||||
|
private readonly IRepository<ReadingTaskRelation> _readingTaskRelationRepository;
|
||||||
private readonly IRepository<ReadingJudgeInfo> _readingJudgeInfoRepository;
|
private readonly IRepository<ReadingJudgeInfo> _readingJudgeInfoRepository;
|
||||||
private readonly IRepository<ReadModule> _readModuleRepository;
|
private readonly IRepository<ReadModule> _readModuleRepository;
|
||||||
private readonly IRepository<DicomInstance> _dicomInstanceRepository;
|
private readonly IRepository<DicomInstance> _dicomInstanceRepository;
|
||||||
|
@ -72,6 +73,7 @@ namespace IRaCIS.Application.Services
|
||||||
IRepository<Subject> subjectRepository,
|
IRepository<Subject> subjectRepository,
|
||||||
IRepository<ReadingGlobalTaskInfo> readingGlobalTaskInfoRepository,
|
IRepository<ReadingGlobalTaskInfo> readingGlobalTaskInfoRepository,
|
||||||
IRepository<ReadingCriterionPage> readingCriterionPageRepository,
|
IRepository<ReadingCriterionPage> readingCriterionPageRepository,
|
||||||
|
IRepository<ReadingTaskRelation> readingTaskRelationRepository,
|
||||||
IRepository<ReadingJudgeInfo> readingJudgeInfoRepository,
|
IRepository<ReadingJudgeInfo> readingJudgeInfoRepository,
|
||||||
IRepository<ReadModule> readModuleRepository,
|
IRepository<ReadModule> readModuleRepository,
|
||||||
IRepository<DicomInstance> dicomInstanceRepository,
|
IRepository<DicomInstance> dicomInstanceRepository,
|
||||||
|
@ -105,6 +107,7 @@ namespace IRaCIS.Application.Services
|
||||||
this._subjectRepository = subjectRepository;
|
this._subjectRepository = subjectRepository;
|
||||||
this._readingGlobalTaskInfoRepository = readingGlobalTaskInfoRepository;
|
this._readingGlobalTaskInfoRepository = readingGlobalTaskInfoRepository;
|
||||||
this._readingCriterionPageRepository = readingCriterionPageRepository;
|
this._readingCriterionPageRepository = readingCriterionPageRepository;
|
||||||
|
this._readingTaskRelationRepository = readingTaskRelationRepository;
|
||||||
this._readingJudgeInfoRepository = readingJudgeInfoRepository;
|
this._readingJudgeInfoRepository = readingJudgeInfoRepository;
|
||||||
this._readModuleRepository = readModuleRepository;
|
this._readModuleRepository = readModuleRepository;
|
||||||
this._dicomInstanceRepository = dicomInstanceRepository;
|
this._dicomInstanceRepository = dicomInstanceRepository;
|
||||||
|
@ -124,6 +127,73 @@ namespace IRaCIS.Application.Services
|
||||||
this._trialEmailNoticeConfigService = trialEmailNoticeConfigService;
|
this._trialEmailNoticeConfigService = trialEmailNoticeConfigService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 维护任务关系
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task MaintainTaskRelated()
|
||||||
|
{
|
||||||
|
List<ReadingTaskRelation> relations = new List<ReadingTaskRelation>();
|
||||||
|
var visitList = await _visitTaskRepository.Where(x => x.PastResultTaskIds != "[]" && x.RelatedVisitTaskIds != "[]").Select(x => new
|
||||||
|
{
|
||||||
|
x.Id,
|
||||||
|
x.RelatedVisitTaskIds,
|
||||||
|
x.PastResultTaskIds
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
List<Guid> relatedIds = new List<Guid>();
|
||||||
|
|
||||||
|
List<Guid> PastResultds = new List<Guid>();
|
||||||
|
|
||||||
|
foreach (var item in visitList)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PastResultds = JsonConvert.DeserializeObject<List<Guid>>(item.PastResultTaskIds) ?? new List<Guid>();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
PastResultds = new List<Guid>();
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
relatedIds = JsonConvert.DeserializeObject<List<Guid>>(item.RelatedVisitTaskIds)?? new List<Guid>();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
relatedIds = new List<Guid>();
|
||||||
|
}
|
||||||
|
|
||||||
|
relations.AddRange(PastResultds.Select(x => new ReadingTaskRelation()
|
||||||
|
{
|
||||||
|
|
||||||
|
RelevanceTaskId = x,
|
||||||
|
TaskId = item.Id,
|
||||||
|
RelevanceType = RelevanceType.PastResult,
|
||||||
|
}));
|
||||||
|
|
||||||
|
relations.AddRange(relatedIds.Select(x => new ReadingTaskRelation()
|
||||||
|
{
|
||||||
|
|
||||||
|
RelevanceTaskId = x,
|
||||||
|
TaskId = item.Id,
|
||||||
|
RelevanceType = RelevanceType.Related,
|
||||||
|
}));
|
||||||
|
|
||||||
|
await _readingTaskRelationRepository.BatchDeleteNoTrackingAsync(x => x.TaskId == item.Id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
await _readingTaskRelationRepository.AddRangeAsync(relations);
|
||||||
|
await _readingTaskRelationRepository.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修改计算问题
|
/// 修改计算问题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -2026,10 +2096,27 @@ namespace IRaCIS.Application.Services
|
||||||
await _visitTaskRepository.UpdatePartialFromQueryAsync(taskInfo.Id, x => new VisitTask()
|
await _visitTaskRepository.UpdatePartialFromQueryAsync(taskInfo.Id, x => new VisitTask()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PastResultTaskIds = JsonConvert.SerializeObject(pastResultTaskIdList),
|
PastResultTaskIds = JsonConvert.SerializeObject(pastResultTaskIdList),
|
||||||
RelatedVisitTaskIds = JsonConvert.SerializeObject(relatedVisitTaskIdList),
|
RelatedVisitTaskIds = JsonConvert.SerializeObject(relatedVisitTaskIdList),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await _readingTaskRelationRepository.AddRangeAsync(pastResultTaskIdList.Select(x => new ReadingTaskRelation()
|
||||||
|
{
|
||||||
|
RelevanceTaskId = x,
|
||||||
|
TaskId = visitTaskId,
|
||||||
|
RelevanceType = RelevanceType.PastResult,
|
||||||
|
}));
|
||||||
|
|
||||||
|
await _readingTaskRelationRepository.AddRangeAsync(relatedVisitTaskIdList.Select(x => new ReadingTaskRelation()
|
||||||
|
{
|
||||||
|
RelevanceTaskId = x,
|
||||||
|
TaskId = visitTaskId,
|
||||||
|
RelevanceType = RelevanceType.Related,
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
await _visitTaskRepository.SaveChangesAsync();
|
await _visitTaskRepository.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,20 @@ namespace IRaCIS.Core.Domain.Share
|
||||||
public static readonly string Group = "group";
|
public static readonly string Group = "group";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public enum RelevanceType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 关联的访视任务ID (当前任务是访视任务的话会有自己)集合
|
||||||
|
/// </summary>
|
||||||
|
Related = 0,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 既往任务Id 不包括自己
|
||||||
|
/// </summary>
|
||||||
|
PastResult = 0,
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据来源
|
/// 数据来源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||||
|
// 生成时间 2023-02-03 09:43:09
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||||
|
using System;
|
||||||
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
namespace IRaCIS.Core.Domain.Models
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
///任务关系表
|
||||||
|
///</summary>
|
||||||
|
[Table("ReadingTaskRelation")]
|
||||||
|
public class ReadingTaskRelation : Entity, IAuditAdd
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 任务ID
|
||||||
|
/// </summary>
|
||||||
|
public Guid TaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 关联的任务ID
|
||||||
|
/// </summary>
|
||||||
|
public Guid RelevanceTaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 类型具体解释 看枚举
|
||||||
|
/// </summary>
|
||||||
|
public RelevanceType RelevanceType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// CreateTime
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// CreateUserId
|
||||||
|
/// </summary>
|
||||||
|
public Guid CreateUserId { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -209,6 +209,8 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
|
|
||||||
|
|
||||||
#region Reading
|
#region Reading
|
||||||
|
|
||||||
|
public virtual DbSet<ReadingTaskRelation> ReadingTaskRelation { get; set; }
|
||||||
public virtual DbSet<OrganInfo> OrganInfo { get; set; }
|
public virtual DbSet<OrganInfo> OrganInfo { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<ReadingCriterionDictionary> ReadingCriterionDictionary { get; set; }
|
public virtual DbSet<ReadingCriterionDictionary> ReadingCriterionDictionary { get; set; }
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
public static readonly string ConnectionString = "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_New_Tet;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true";
|
public static readonly string ConnectionString = "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_New_Tet;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true";
|
||||||
public static readonly string DbDatabase = "IRaCIS_New_Tet";
|
public static readonly string DbDatabase = "IRaCIS_New_Tet";
|
||||||
//表名称用字符串,拼接
|
//表名称用字符串,拼接
|
||||||
public static readonly string TableName = "TrialClinicalDataSetCriterion";
|
public static readonly string TableName = "ReadingTaskRelation";
|
||||||
//具体文件里面 例如service 可以配置是否分页
|
//具体文件里面 例如service 可以配置是否分页
|
||||||
}
|
}
|
||||||
#>
|
#>
|
||||||
|
|
Loading…
Reference in New Issue