修改一版
This commit is contained in:
@@ -1,94 +1,107 @@
|
||||
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 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;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 临床数据
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Reading")]
|
||||
public class ClinicalDataService : BaseService
|
||||
{
|
||||
//namespace IRaCIS.Application.Services
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// 临床数据
|
||||
// /// </summary>
|
||||
// [ApiExplorerSettings(GroupName = "Reading")]
|
||||
// public class ClinicalDataService : BaseService
|
||||
// {
|
||||
|
||||
public IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
private readonly IRepository<ClinicalData> _clinicalDataRepository;
|
||||
public ClinicalDataService(IRepository<SubjectVisit> subjectVisitRepository,
|
||||
IRepository<ClinicalData> clinicalDataRepository
|
||||
)
|
||||
{
|
||||
_subjectVisitRepository = subjectVisitRepository;
|
||||
_clinicalDataRepository = clinicalDataRepository;
|
||||
}
|
||||
// public IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
// private readonly IRepository<ClinicalData> _clinicalDataRepository;
|
||||
// private readonly IRepository<PreviousPDF> _previousPDFRepository;
|
||||
|
||||
// public ClinicalDataService(IRepository<SubjectVisit> subjectVisitRepository,
|
||||
// IRepository<ClinicalData> clinicalDataRepository,
|
||||
// IRepository<PreviousPDF> previousPDFRepository
|
||||
// )
|
||||
// {
|
||||
// _subjectVisitRepository = subjectVisitRepository;
|
||||
// _clinicalDataRepository = clinicalDataRepository;
|
||||
// this._previousPDFRepository = previousPDFRepository;
|
||||
// }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增或者修改
|
||||
/// </summary>
|
||||
/// <param name="addOrEditClinicalData"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddOrUpdateClinicalDataService(ClinicalDataAddOrEdit addOrEditClinicalData)
|
||||
{
|
||||
var entity = await _repository.InsertOrUpdateAsync<ClinicalData, ClinicalDataAddOrEdit>(addOrEditClinicalData, true);
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
// /// <summary>
|
||||
// /// 新增或者修改
|
||||
// /// </summary>
|
||||
// /// <param name="addOrEditClinicalData"></param>
|
||||
// /// <returns></returns>
|
||||
// [HttpPost]
|
||||
// public async Task<IResponseOutput> AddOrUpdateClinicalDataService(ClinicalDataAddOrEdit addOrEditClinicalData)
|
||||
// {
|
||||
// var entity = await _repository.InsertOrUpdateAsync<ClinicalData, ClinicalDataAddOrEdit>(addOrEditClinicalData, true);
|
||||
// return ResponseOutput.Ok(entity.Id.ToString());
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 分页获取
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<ClinicalDataView>> GetClinicalDataList(ClinicalDataQuery query)
|
||||
{
|
||||
// /// <summary>
|
||||
// /// 分页获取
|
||||
// /// </summary>
|
||||
// /// <param name="query"></param>
|
||||
// /// <returns></returns>
|
||||
// [HttpPost]
|
||||
// public async Task<PageOutput<ClinicalDataView>> GetClinicalDataList(ClinicalDataQuery query)
|
||||
// {
|
||||
|
||||
var readquery = _clinicalDataRepository.AsQueryable()
|
||||
.WhereIf(query.TrialId!=null,x=>x.TrialId==query.TrialId)
|
||||
|
||||
.ProjectTo<ClinicalDataView>(_mapper.ConfigurationProvider);
|
||||
var pageList= await readquery.ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField == null ? "CreateTime" : query.SortField,
|
||||
query.SortAsc);
|
||||
// var readquery = _clinicalDataRepository.AsQueryable()
|
||||
// .WhereIf(query.TrialId!=null,x=>x.TrialId==query.TrialId)
|
||||
// .ProjectTo<ClinicalDataView>(_mapper.ConfigurationProvider);
|
||||
// var pageList= await readquery.ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField == null ? "CreateTime" : query.SortField,
|
||||
// query.SortAsc);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
// return pageList;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 获取
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<ClinicalDataView>> ClinicalDataView(ClinicalDataInDto inDto)
|
||||
{
|
||||
var list= await _clinicalDataRepository.AsQueryable().Where(x => x.TrialId == inDto.TrialId)
|
||||
.Where(x => (x.ClinicalLevel == ClinicalLevel.Subject && x.SubjectId == inDto.SubjectId) || x.VisitOrReadId == inDto.VisitOrReadId)
|
||||
.ProjectTo<ClinicalDataView>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// 获取
|
||||
// /// </summary>
|
||||
// /// <param name="query"></param>
|
||||
// /// <returns></returns>
|
||||
// [HttpPost]
|
||||
// public async Task<dynamic> ClinicalDataView(ClinicalDataInDto inDto)
|
||||
// {
|
||||
// var list= await _previousPDFRepository.AsQueryable().Where(x => x.TrialId == inDto.TrialId)
|
||||
// .Where(x => (x.ClinicalLevel == ClinicalLevel.Subject && x.SubjectId == inDto.SubjectId) || x.SubjectVisitId == inDto.VisitOrReadId)
|
||||
// .Select(x=>new {
|
||||
// x.Path,
|
||||
// x.DataType,
|
||||
// x.CreateTime,
|
||||
// x.ClinicalLevel,
|
||||
// x.FileName,
|
||||
// x.UploadType,
|
||||
// x.Id,
|
||||
// })
|
||||
// .ToListAsync();
|
||||
// return list;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="clinicalDataId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ClinicalDataId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteClinicalData(Guid clinicalDataId)
|
||||
{
|
||||
var success = await _repository.BatchDeleteAsync<ClinicalData>(t => t.Id == clinicalDataId);
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
}
|
||||
}
|
||||
// /// <summary>
|
||||
// /// 删除
|
||||
// /// </summary>
|
||||
// /// <param name="clinicalDataId"></param>
|
||||
// /// <returns></returns>
|
||||
// [HttpDelete("{ClinicalDataId:guid}")]
|
||||
// public async Task<IResponseOutput> DeleteClinicalData(Guid clinicalDataId)
|
||||
// {
|
||||
// var success = await _repository.BatchDeleteAsync<ClinicalData>(t => t.Id == clinicalDataId);
|
||||
// return ResponseOutput.Result(success);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.Application.Service.Reading.Dto
|
||||
{
|
||||
|
||||
|
||||
public class PreviousPDFInDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目Id
|
||||
/// </summary>
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 受试者ID
|
||||
/// </summary>
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 访视或者阅片ID
|
||||
/// </summary>
|
||||
public Guid VisitOrReadId { get; set; }
|
||||
}
|
||||
public class PreviousPDFQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目ID
|
||||
/// </summary>
|
||||
public Guid? TrialId { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
/// </summary>
|
||||
public int PageIndex { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 每页大小
|
||||
/// </summary>
|
||||
public int PageSize { get; set; } = 10;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
/// </summary>
|
||||
public string? SortField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
/// </summary>
|
||||
public bool SortAsc { get; set; } = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
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 IRaCIS.Core.Application.Contracts;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 临床数据 原表
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Reading")]
|
||||
public class PreviousPDFService : BaseService
|
||||
{
|
||||
|
||||
public IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
private readonly IRepository<PreviousPDF> _previousPDFRepository;
|
||||
|
||||
public PreviousPDFService(IRepository<SubjectVisit> subjectVisitRepository,
|
||||
IRepository<PreviousPDF> PreviousPDFRepository
|
||||
)
|
||||
{
|
||||
_subjectVisitRepository = subjectVisitRepository;
|
||||
_previousPDFRepository = PreviousPDFRepository;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增或者修改
|
||||
/// </summary>
|
||||
/// <param name="addOrEditPreviousPDF"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> AddOrUpdatePreviousPDFService(PreviousPDFAddOrEdit addOrEditPreviousPDF)
|
||||
{
|
||||
var entity = await _repository.InsertOrUpdateAsync<PreviousPDF, PreviousPDFAddOrEdit>(addOrEditPreviousPDF, true);
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PreviousPDFView(PreviousPDFInDto inDto)
|
||||
{
|
||||
var list= await _previousPDFRepository.AsQueryable().Where(x => x.TrialId == inDto.TrialId)
|
||||
.Where(x => (x.ClinicalLevel == ClinicalLevel.Subject && x.SubjectId == inDto.SubjectId) || x.SubjectVisitId == inDto.VisitOrReadId)
|
||||
.Select(x=>new {
|
||||
x.Path,
|
||||
x.DataType,
|
||||
x.CreateTime,
|
||||
x.ClinicalLevel,
|
||||
x.FileName,
|
||||
x.UploadType,
|
||||
x.Id,
|
||||
})
|
||||
.ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="PreviousPDFId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{previousPDFId:guid}")]
|
||||
public async Task<IResponseOutput> DeletePreviousPDF(Guid previousPDFId)
|
||||
{
|
||||
var success = await _repository.BatchDeleteAsync<PreviousPDF>(t => t.Id == previousPDFId);
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using AutoMapper;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
|
||||
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
public class ReadingConfig : Profile
|
||||
@@ -19,6 +19,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
CreateMap<ClinicalData, ClinicalDataView>();
|
||||
|
||||
|
||||
|
||||
|
||||
CreateMap<PreviousPDF, PreviousPDFAddOrEdit>().ReverseMap();
|
||||
|
||||
CreateMap<PreviousPDF, PreviousPDFView>();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user