字典表加组字段
This commit is contained in:
@@ -1,74 +1,88 @@
|
||||
//using AutoMapper;
|
||||
//using AutoMapper.QueryableExtensions;
|
||||
//using IRaCIS.Application.ViewModels;
|
||||
//using IRaCIS.Core.Application.Contracts;
|
||||
//using IRaCIS.Core.Application.Filter;
|
||||
//using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
||||
//using IRaCIS.Core.Domain.Models;
|
||||
//using IRaCIS.Core.Domain.Share;
|
||||
//using IRaCIS.Core.Infra.EFCore;
|
||||
//using IRaCIS.Core.Infrastructure.Extention;
|
||||
//using Magicodes.ExporterAndImporter.Core;
|
||||
//using Magicodes.ExporterAndImporter.Excel;
|
||||
//using MediatR;
|
||||
//using Microsoft.AspNetCore.Hosting;
|
||||
//using Microsoft.AspNetCore.Http;
|
||||
//using Microsoft.AspNetCore.Mvc;
|
||||
//using Microsoft.AspNetCore.WebUtilities;
|
||||
//using Microsoft.Net.Http.Headers;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Linq;
|
||||
//using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
|
||||
//namespace IRaCIS.Core.API.Controllers
|
||||
//{
|
||||
// [ApiExplorerSettings(GroupName = "Image")]
|
||||
// [ApiController]
|
||||
// public class DownLoadController : ControllerBase
|
||||
// {
|
||||
// public IMapper _mapper { get; set; }
|
||||
// public IUserInfo _userInfo { get; set; }
|
||||
// private readonly IMediator _mediator;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
|
||||
// private readonly IWebHostEnvironment _hostEnvironment;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
|
||||
// private readonly IServiceProvider _serviceProvider;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
// public DownLoadController(IMapper mapper, IUserInfo userInfo, IMediator mediator, IWebHostEnvironment hostEnvironment, IServiceProvider serviceProvider)
|
||||
// {
|
||||
// _serviceProvider = serviceProvider;
|
||||
// _hostEnvironment = hostEnvironment;
|
||||
// _mediator = mediator;
|
||||
// _mapper = mapper;
|
||||
// _userInfo = userInfo;
|
||||
// }
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// [HttpGet("VisitPlan/DownloadInflunceStudyList{trialId:guid}/{createTime:dateTime}")]
|
||||
// public async Task<IActionResult> DownloadInflunceStudyList(Guid trialId, DateTime createTime, [FromServices] IRepository<VisitPlanInfluenceSubjectVisit> _influnceRepository)
|
||||
// {
|
||||
// var list = _influnceRepository.Where(t => t.TrialId == trialId && t.CreateTime == createTime)
|
||||
// .ProjectTo<VisitPlanInfluenceSubjectVisitDTO>(_mapper.ConfigurationProvider).ToList();
|
||||
namespace IRaCIS.Core.API.Controllers
|
||||
{
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
[ApiController]
|
||||
public class DownLoadController : ControllerBase
|
||||
{
|
||||
public IMapper _mapper { get; set; }
|
||||
public IUserInfo _userInfo { get; set; }
|
||||
|
||||
// if(list.Count == 0)
|
||||
// {
|
||||
// list.Add(new VisitPlanInfluenceSubjectVisitDTO() { CreateTime=DateTime.Now,SubjectCode="test",StudyTime=DateTime.Now,IsDicomStudy=false,HistoryWindow="test"});
|
||||
// }
|
||||
|
||||
// IExporter exporter = new ExcelExporter();
|
||||
|
||||
// var result = await exporter.ExportAsByteArray(list);
|
||||
|
||||
|
||||
// return new XlsxFileResult(bytes: bytes);
|
||||
|
||||
// //return File(result, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"检查导出_{DateTime.Now}.xlsx");
|
||||
|
||||
// }
|
||||
private readonly IWebHostEnvironment _hostEnvironment;
|
||||
|
||||
|
||||
|
||||
public DownLoadController(IMapper mapper, IUserInfo userInfo, IMediator mediator, IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_hostEnvironment = hostEnvironment;
|
||||
_mapper = mapper;
|
||||
_userInfo = userInfo;
|
||||
}
|
||||
|
||||
// }
|
||||
//}
|
||||
//[HttpGet("VisitPlan/DownloadInflunceStudyList{trialId:guid}/{createTime:dateTime}")]
|
||||
//public async Task<IActionResult> DownloadInflunceStudyList(Guid trialId, DateTime createTime, [FromServices] IRepository<VisitPlanInfluenceSubjectVisit> _influnceRepository)
|
||||
//{
|
||||
// var list = _influnceRepository.Where(t => t.TrialId == trialId && t.CreateTime == createTime)
|
||||
// .ProjectTo<VisitPlanInfluenceSubjectVisitDTO>(_mapper.ConfigurationProvider).ToList();
|
||||
|
||||
// if (list.Count == 0)
|
||||
// {
|
||||
// list.Add(new VisitPlanInfluenceSubjectVisitDTO() { CreateTime = DateTime.Now, SubjectCode = "test", StudyTime = DateTime.Now, IsDicomStudy = false, HistoryWindow = "test" });
|
||||
// }
|
||||
|
||||
// IExporter exporter = new ExcelExporter();
|
||||
|
||||
// var result = await exporter.ExportAsByteArray(list);
|
||||
|
||||
|
||||
// return new XlsxFileResult(bytes: bytes);
|
||||
|
||||
// //return File(result, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"检查导出_{DateTime.Now}.xlsx");
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
[HttpGet("CommonDocument/DownloadCommonDoc")]
|
||||
public async Task<IActionResult> DownloadCommonFile(string code, [FromServices] IRepository<CommonDocument> _commonDocumentRepository)
|
||||
{
|
||||
var doc = _commonDocumentRepository.AsQueryable(true).FirstOrDefault(t => t.Code == code);
|
||||
|
||||
if (doc == null)
|
||||
{
|
||||
throw new Exception("当前code 没要找到对应的文件");
|
||||
}
|
||||
|
||||
var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName;
|
||||
|
||||
var filePath = Path.Combine(rootPath, doc.Path.Trim('/'));
|
||||
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
{
|
||||
throw new Exception("服务器本地不存在该路径文件");
|
||||
}
|
||||
|
||||
|
||||
var stream = System.IO.File.OpenRead(filePath);
|
||||
return File(stream, "application/octet-stream", Path.GetFileName(doc.Name));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,31 +153,6 @@ namespace IRaCIS.Core.API.Controllers
|
||||
|
||||
|
||||
|
||||
[HttpGet("CommonDocument/DownloadCommonDoc")]
|
||||
public async Task<IActionResult> DownloadCommonFile(string code, [FromServices] IRepository<CommonDocument> _commonDocumentRepository)
|
||||
{
|
||||
var doc = _commonDocumentRepository.AsQueryable(true).FirstOrDefault(t => t.Code == code);
|
||||
|
||||
if (doc==null)
|
||||
{
|
||||
throw new Exception("当前code 没要找到对应的文件");
|
||||
}
|
||||
|
||||
var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName;
|
||||
|
||||
var filePath = Path.Combine(rootPath, doc.Path.Trim('/'));
|
||||
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
{
|
||||
throw new Exception("服务器本地不存在该路径文件");
|
||||
}
|
||||
|
||||
|
||||
var stream = System.IO.File.OpenRead(filePath);
|
||||
return File(stream, "application/octet-stream", Path.GetFileName(doc.Name));
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void DealCommonStorePath(string fileType, string moduleType, string fileRealName, out string serverFilePath, out string relativePath)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user