修改一版
parent
ad9e0208f3
commit
b119b01b95
|
@ -77,6 +77,21 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
}
|
||||
|
||||
public class CriterionNidusData : CriterionNidus
|
||||
{
|
||||
public Guid OriginalId { get; set; }
|
||||
}
|
||||
|
||||
public class SynchronizeSystemOrganToTrialInDto
|
||||
{
|
||||
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
|
||||
|
||||
public Guid? SystemCriterionId { get; set; }
|
||||
}
|
||||
|
||||
public class SetOrganIsEnableInDto
|
||||
{
|
||||
public bool IsEnable { get; set; }
|
||||
|
|
|
@ -8,6 +8,12 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
{
|
||||
public class GetSystemCriterionListOutDto
|
||||
{
|
||||
public Guid CriterionId { get; set; }
|
||||
|
||||
public string CriterionName { get; set; }
|
||||
}
|
||||
public class ReadingTableQuestionSystemView
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
|
|
@ -22,6 +22,9 @@ namespace IRaCIS.Core.Application.Interfaces
|
|||
|
||||
Task<IResponseOutput> DeleteOrganInfo(Guid organInfoId);
|
||||
|
||||
|
||||
Task<IResponseOutput> SynchronizeSystemOrganToTrial(SynchronizeSystemOrganToTrialInDto inDto);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using MassTransit;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
|
@ -21,16 +22,19 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
private readonly IRepository<OrganInfo> _organInfoRepository;
|
||||
private readonly IRepository<OrganTrialInfo> _organTrialInfoRepository;
|
||||
private readonly IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrial;
|
||||
private readonly IRepository<CriterionNidus> _criterionNidusRepository;
|
||||
|
||||
public OrganInfoService(
|
||||
IRepository<OrganInfo> organInfoRepository,
|
||||
IRepository<OrganTrialInfo> organTrialInfoRepository,
|
||||
IRepository<ReadingQuestionCriterionTrial> readingQuestionCriterionTrial,
|
||||
IRepository<CriterionNidus> criterionNidusRepository
|
||||
)
|
||||
{
|
||||
_organInfoRepository = organInfoRepository;
|
||||
this._organTrialInfoRepository = organTrialInfoRepository;
|
||||
this._readingQuestionCriterionTrial = readingQuestionCriterionTrial;
|
||||
this._criterionNidusRepository = criterionNidusRepository;
|
||||
}
|
||||
|
||||
|
@ -217,6 +221,70 @@ namespace IRaCIS.Core.Application.Service
|
|||
return await organInfoQueryable.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 同步系统器官到项目
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> SynchronizeSystemOrganToTrial(SynchronizeSystemOrganToTrialInDto inDto)
|
||||
{
|
||||
|
||||
var readingQuestionCriterionTrial = await _readingQuestionCriterionTrial.Where(x => x.TrialId == inDto.TrialId && x.IsConfirm).FirstOrDefaultAsync();
|
||||
|
||||
if (readingQuestionCriterionTrial != null)
|
||||
{
|
||||
Guid trialCriterionId = default(Guid);
|
||||
|
||||
trialCriterionId = readingQuestionCriterionTrial.Id;
|
||||
if (inDto.SystemCriterionId == null)
|
||||
{
|
||||
inDto.SystemCriterionId = readingQuestionCriterionTrial.ReadingQuestionCriterionSystemId;
|
||||
}
|
||||
await _criterionNidusRepository.BatchDeleteNoTrackingAsync(x => x.CriterionId == trialCriterionId);
|
||||
List<CriterionNidusData> criterionNidusList = await _criterionNidusRepository.Where(x => x.CriterionId == inDto.SystemCriterionId).Select(x => new CriterionNidusData()
|
||||
{
|
||||
Id = NewId.NextGuid(),
|
||||
CriterionId = trialCriterionId,
|
||||
NidusType = x.NidusType,
|
||||
NidusTypeCN = x.NidusTypeCN,
|
||||
OriginalId = x.Id,
|
||||
}).ToListAsync();
|
||||
|
||||
await _criterionNidusRepository.AddRangeAsync(criterionNidusList);
|
||||
await _organTrialInfoRepository.BatchDeleteNoTrackingAsync(x => x.TrialId == inDto.TrialId);
|
||||
var originalIds = criterionNidusList.Select(x => x.OriginalId).Distinct().ToList();
|
||||
List<OrganTrialInfo> organTrialInfoList = await _organInfoRepository.Where(x => originalIds.Contains(x.CriterionNidusId)).Select(x => new OrganTrialInfo()
|
||||
{
|
||||
CriterionNidusId = x.CriterionNidusId,
|
||||
Id = NewId.NextGuid(),
|
||||
IsEnable = true,
|
||||
OrganInfoId = x.Id,
|
||||
TrialId = inDto.TrialId,
|
||||
}).ToListAsync();
|
||||
|
||||
organTrialInfoList.ForEach(x =>
|
||||
{
|
||||
|
||||
x.OrganInfoId = criterionNidusList.Where(y => y.OriginalId == x.OrganInfoId).Select(x => x.Id).FirstOrDefault();
|
||||
});
|
||||
|
||||
|
||||
await _organTrialInfoRepository.AddRangeAsync(organTrialInfoList);
|
||||
await _readingQuestionCriterionTrial.UpdatePartialFromQueryAsync(trialCriterionId,x=> new ReadingQuestionCriterionTrial() {
|
||||
SynchronizeOriginalTime=DateTime.Now
|
||||
});
|
||||
await _organTrialInfoRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置项目器官是否生效
|
||||
|
|
|
@ -68,6 +68,22 @@ namespace IRaCIS.Application.Services
|
|||
this._previousPDFRepository = previousPDFRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取获取系统阅片标准下拉
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<GetSystemCriterionListOutDto>> GetSystemCriterionList()
|
||||
{
|
||||
List<GetSystemCriterionListOutDto> result = await _readingQuestionCriterionSystemRepository.Select(x => new GetSystemCriterionListOutDto()
|
||||
{
|
||||
CriterionId=x.Id,
|
||||
CriterionName=x.CriterionName,
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统的表格问题
|
||||
|
|
|
@ -11,6 +11,8 @@ using IRaCIS.Core.Application.Auth;
|
|||
using Panda.DynamicWebApi.Attributes;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
|
||||
namespace IRaCIS.Core.Application
|
||||
{
|
||||
|
@ -24,7 +26,7 @@ namespace IRaCIS.Core.Application
|
|||
private readonly IRepository<ClinicalDataTrialSet> _clinicalDataTrialSetRepository;
|
||||
private readonly IRepository<ReadingCriterionPage> _readingCriterionPageRepository;
|
||||
private readonly IEasyCachingProvider _provider;
|
||||
|
||||
private readonly IOrganInfoService _iOrganInfoService;
|
||||
private readonly IRepository<TaskAllocationRule> _taskAllocationRuleRepository;
|
||||
private readonly IReadingQuestionService iReadingQuestionService;
|
||||
|
||||
|
@ -36,7 +38,8 @@ namespace IRaCIS.Core.Application
|
|||
IRepository<ReadingCriterionPage> readingCriterionPageRepository,
|
||||
IRepository<TaskAllocationRule> taskAllocationRuleRepository,
|
||||
IReadingQuestionService iReadingQuestionService,
|
||||
IEasyCachingProvider provider
|
||||
IEasyCachingProvider provider,
|
||||
IOrganInfoService iOrganInfoService
|
||||
)
|
||||
{
|
||||
_trialRepository = trialRepository;
|
||||
|
@ -48,6 +51,7 @@ namespace IRaCIS.Core.Application
|
|||
this._clinicalDataTrialSetRepository = clinicalDataTrialSetRepository;
|
||||
this._readingCriterionPageRepository = readingCriterionPageRepository;
|
||||
this._provider = provider;
|
||||
this._iOrganInfoService = iOrganInfoService;
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,12 +242,23 @@ namespace IRaCIS.Core.Application
|
|||
result.FormType = trialCriterion.FormType;
|
||||
result.IsFromSystem = trialCriterion.ReadingQuestionCriterionSystemId != null;
|
||||
|
||||
if (trialCriterion.SynchronizeOriginalTime == null && trialCriterion.ReadingQuestionCriterionSystemId != null)
|
||||
{
|
||||
await _iOrganInfoService.SynchronizeSystemOrganToTrial(new SynchronizeSystemOrganToTrialInDto()
|
||||
{
|
||||
TrialId = inDto.TrialId,
|
||||
SystemCriterionId = trialCriterion.ReadingQuestionCriterionSystemId
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
result.TrialQuestionList = await _readingQuestionTrialRepository.Where(x => x.ReadingQuestionCriterionTrial.IsConfirm && x.TrialId == inDto.TrialId&&x.ReadingQuestionCriterionTrialId == result.TrialCriterionId
|
||||
&&x.ReadingCriterionPageId==null)
|
||||
.ProjectTo<TrialReadQuestion>(_mapper.ConfigurationProvider).OrderBy(x => x.ShowOrder).ToListAsync();
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,14 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// CreateUserId
|
||||
/// </summary>
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 标准 病灶类型
|
||||
/// </summary>
|
||||
public Guid CriterionNidusId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -94,6 +94,12 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public DateTime SynchronizeTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 同步器官时间
|
||||
/// </summary>
|
||||
public DateTime? SynchronizeOriginalTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue