135 lines
5.6 KiB
C#
135 lines
5.6 KiB
C#
using IRaCIS.Application.Interfaces;
|
|
using IRaCIS.Core.Infra.EFCore;
|
|
using IRaCIS.Core.Domain.Share;
|
|
using IRaCIS.Core.Application.Filter;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using IRaCIS.Core.Application.Service.WorkLoad.DTO;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using IRaCIS.Core.Application.Auth;
|
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
|
using IRaCIS.Core.Domain.Share.Reading;
|
|
using MassTransit;
|
|
|
|
namespace IRaCIS.Application.Services
|
|
{
|
|
/// <summary>
|
|
/// 临床数据配置
|
|
/// </summary>
|
|
[ApiExplorerSettings(GroupName = "Reading")]
|
|
public class ClinicalDataSetService : BaseService
|
|
{
|
|
private readonly IRepository<ReadingClinicalData> _readingClinicalDataRepository;
|
|
|
|
public ClinicalDataSetService(IRepository<ReadingClinicalData> readingClinicalDataRepository
|
|
)
|
|
{
|
|
this._readingClinicalDataRepository = readingClinicalDataRepository;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 新增或者修改
|
|
/// </summary>
|
|
/// <param name="indto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<IResponseOutput> AddOrUpdateReadingClinicalData(AddOrUpdateReadingClinicalDataDto indto)
|
|
{
|
|
var entity = await _readingClinicalDataRepository.InsertOrUpdateAsync(indto,true);
|
|
return ResponseOutput.Ok(entity.Id.ToString());
|
|
}
|
|
|
|
|
|
//public async Task<List<>> GetTrialClinicalData()
|
|
|
|
///// <summary>
|
|
///// 获取系统临床数据(系统)
|
|
///// </summary>
|
|
///// <returns></returns>
|
|
//[HttpPost]
|
|
//public async Task<List<ClinicalDataSystemSetView>> GetSystemClinicalDataSystemSetList(GetTrialClinicalDataSystemIndto inDto)
|
|
//{
|
|
// return await _clinicalDataSystemSetRepository.AsQueryable()
|
|
// .WhereIf(inDto.ClinicalDataLevel != null, x => x.ClinicalDataLevel == inDto.ClinicalDataLevel)
|
|
// .WhereIf(inDto.ClinicalUploadType != null, x => x.ClinicalUploadType == inDto.ClinicalUploadType)
|
|
// .WhereIf(inDto.ClinicalDataSetName != String.Empty, x => x.ClinicalDataSetName.Contains(inDto.ClinicalDataSetName))
|
|
|
|
// .ProjectTo<ClinicalDataSystemSetView>(_mapper.ConfigurationProvider).ToListAsync();
|
|
//}
|
|
|
|
|
|
///// <summary>
|
|
///// 获取项目的临床数据
|
|
///// </summary>
|
|
///// <param name="inDto"></param>
|
|
///// <returns></returns>
|
|
//[HttpPost]
|
|
//public async Task<List<ClinicalDataTrialSetView>> GetTrialClinicalDataTrialSetList(GetTrialClinicalDataTrialIndto inDto)
|
|
//{
|
|
// await this.AddTrialClinicalDataTrialSet(inDto.TrialId);
|
|
// return await _clinicalDataTrialSetRepository.AsQueryable()
|
|
|
|
// .Where(x => x.TrialId == inDto.TrialId)
|
|
// .WhereIf(inDto.ClinicalDataLevel!=null,x=>x.ClinicalDataLevel== inDto.ClinicalDataLevel)
|
|
// .WhereIf(inDto.ClinicalUploadType != null, x => x.ClinicalUploadType == inDto.ClinicalUploadType)
|
|
// .WhereIf(inDto.ClinicalDataSetName != String.Empty, x => x.ClinicalDataSetName.Contains(inDto.ClinicalDataSetName))
|
|
// .ProjectTo<ClinicalDataTrialSetView>(_mapper.ConfigurationProvider).ToListAsync();
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
///// 将系统配置添加到项目配置
|
|
///// </summary>
|
|
///// <param name="trialId"></param>
|
|
///// <returns></returns>
|
|
|
|
//private async Task<IResponseOutput> AddTrialClinicalDataTrialSet(Guid trialId)
|
|
//{
|
|
// var systemIds = await _clinicalDataSystemSetRepository.Select(x => x.Id).ToListAsync();
|
|
// var trialSystemIds =await _clinicalDataTrialSetRepository.Where(x => x.TrialId == trialId && x.SystemClinicalDataSetId != null).Select(x => x.SystemClinicalDataSetId.Value).ToListAsync();
|
|
// var needAddids = systemIds.Except(trialSystemIds).ToList();
|
|
// var systemDataList =await _clinicalDataSystemSetRepository.Where(x => needAddids.Contains(x.Id)).ToListAsync();
|
|
// List<ClinicalDataTrialSet> dataSets = systemDataList.Select(x => new ClinicalDataTrialSet()
|
|
// {
|
|
// Id= NewId.NextGuid(),
|
|
// SystemClinicalDataSetId=x.Id,
|
|
// ClinicalDataSetName=x.ClinicalDataSetName,
|
|
// ClinicalDataLevel=x.ClinicalDataLevel,
|
|
// ClinicalUploadType=x.ClinicalUploadType,
|
|
// TrialId= trialId,
|
|
|
|
// }).ToList();
|
|
// await _clinicalDataTrialSetRepository.AddRangeAsync(dataSets);
|
|
// var result= await _clinicalDataTrialSetRepository.SaveChangesAsync();
|
|
// return ResponseOutput.Ok(result);
|
|
//}
|
|
|
|
///// <summary>
|
|
///// 删除(项目)
|
|
///// </summary>
|
|
///// <param name="id"></param>
|
|
///// <returns></returns>
|
|
//[HttpDelete("{id:guid}")]
|
|
//public async Task<IResponseOutput> DeleteClinicalTrialSetData(Guid id)
|
|
//{
|
|
// await _clinicalDataTrialSetRepository.DeleteFromQueryAsync(x=>x.Id== id,true);
|
|
// return ResponseOutput.Result(true);
|
|
//}
|
|
|
|
///// <summary>
|
|
///// 删除(系统)
|
|
///// </summary>
|
|
///// <param name="id"></param>
|
|
///// <returns></returns>
|
|
//[HttpDelete("{id:guid}")]
|
|
//public async Task<IResponseOutput> DeleteClinicalSystemSetData(Guid id)
|
|
//{
|
|
// await _clinicalDataSystemSetRepository.DeleteFromQueryAsync(x => x.Id == id, true);
|
|
// return ResponseOutput.Result(true);
|
|
//}
|
|
}
|
|
}
|