修改一版
parent
3d15d8ce31
commit
2690536904
|
@ -13,10 +13,12 @@ using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
|||
using IRaCIS.Core.Application.Service;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Domain.Share.Reading;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using Magicodes.ExporterAndImporter.Excel;
|
||||
using MassTransit;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
@ -206,16 +208,19 @@ namespace IRaCIS.Core.API.Controllers
|
|||
public IMapper _mapper { get; set; }
|
||||
public IUserInfo _userInfo { get; set; }
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
private readonly IRepository<ClinicalData> _clinicalDataRepository;
|
||||
private readonly IWebHostEnvironment _hostEnvironment;
|
||||
|
||||
private readonly IRepository _repository;
|
||||
|
||||
|
||||
public StudyController(IMapper mapper, IUserInfo userInfo, IWebHostEnvironment hostEnvironment, IMediator mediator,IRepository repository)
|
||||
public StudyController(IMapper mapper, IUserInfo userInfo, IWebHostEnvironment hostEnvironment, IMediator mediator,
|
||||
IRepository<ClinicalData> clinicalDataRepository,
|
||||
IRepository repository)
|
||||
{
|
||||
_hostEnvironment = hostEnvironment;
|
||||
_mediator = mediator;
|
||||
this._clinicalDataRepository = clinicalDataRepository;
|
||||
_mapper = mapper;
|
||||
_userInfo = userInfo;
|
||||
_repository = repository;
|
||||
|
@ -375,44 +380,55 @@ namespace IRaCIS.Core.API.Controllers
|
|||
public async Task<IResponseOutput> UploadVisitClinicalData(Guid subjectVisitId)
|
||||
{
|
||||
await QCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
||||
|
||||
var sv = _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefault().IfNullThrowException();
|
||||
|
||||
|
||||
ClinicalData? clinical = await _clinicalDataRepository.Where(x => x.VisitOrReadId == subjectVisitId && x.ClinicalLevel == ClinicalLevel.Subject).FirstOrDefaultAsync();
|
||||
if (clinical == null)
|
||||
{
|
||||
clinical = new ClinicalData()
|
||||
{
|
||||
ClinicalLevel = ClinicalLevel.Subject,
|
||||
SubjectId = sv.SubjectId,
|
||||
DataType = ClinicalDataType.MedicalHistory,
|
||||
TrialId = sv.TrialId,
|
||||
UploadType = ClinicalUploadType.PDF,
|
||||
VisitOrReadId = subjectVisitId,
|
||||
Id= NewId.NextGuid(),
|
||||
};
|
||||
|
||||
await _clinicalDataRepository.AddAsync(clinical);
|
||||
|
||||
}
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId, sv.SiteId, sv.SubjectId, subjectVisitId);
|
||||
|
||||
//插入临床pdf 路径
|
||||
await _repository.AddAsync(new PreviousPDF() { SubjectVisitId = subjectVisitId, Path = relativePath, FileName = fileRealName });
|
||||
|
||||
await _repository.AddAsync(new PreviousPDF() { ClinicalDataId= clinical.Id, SubjectVisitId = subjectVisitId, Path = relativePath, FileName = fileRealName });
|
||||
return serverFilePath;
|
||||
});
|
||||
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传临床数据
|
||||
/// </summary>
|
||||
/// <param name="clinicalDataId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{clinicalDataId:guid}")]
|
||||
[HttpPost("ClinicalData/UploadClinicalData/{clinicalDataId:guid}")]
|
||||
[DisableRequestSizeLimit]
|
||||
public async Task<IResponseOutput> UploadClinicalData(Guid clinicalDataId)
|
||||
{
|
||||
|
||||
var sv = _repository.Where<ClinicalData>(t => t.Id == clinicalDataId).Select(t => new { t.TrialId, t.SubjectId }).FirstOrDefault().IfNullThrowException();
|
||||
var sv = _repository.Where<ClinicalData>(t => t.Id == clinicalDataId).Select(t => new { t.TrialId, t.SubjectId }).FirstOrDefault().IfNullThrowException();
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId.Value, sv.SubjectId.Value, clinicalDataId);
|
||||
|
||||
//插入临床pdf 路径
|
||||
await _repository.AddAsync(new PreviousPDF() { SubjectVisitId = clinicalDataId, Path = relativePath, FileName = fileRealName });
|
||||
await _repository.AddAsync(new PreviousPDF() { SubjectVisitId = clinicalDataId, ClinicalDataId= clinicalDataId, Path = relativePath, FileName = fileRealName });
|
||||
|
||||
return serverFilePath;
|
||||
});
|
||||
|
@ -421,9 +437,6 @@ namespace IRaCIS.Core.API.Controllers
|
|||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传非Dicom 文件 支持压缩包 多文件上传
|
||||
/// </summary>
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace IRaCIS.Core.API
|
|||
options.SwaggerDoc("Management", new OpenApiInfo { Title = "管理模块", Version = "Management" });
|
||||
options.SwaggerDoc("Image", new OpenApiInfo { Title = "影像模块", Version = "Image" });
|
||||
options.SwaggerDoc("Reading", new OpenApiInfo { Title = "读片模块", Version = "Reading" });
|
||||
|
||||
|
||||
// 接口排序
|
||||
options.OrderActionsBy(o => o.GroupName);
|
||||
|
@ -107,6 +108,7 @@ namespace IRaCIS.Core.API
|
|||
options.SwaggerEndpoint($"swagger/Management/swagger.json", "管理模块");
|
||||
options.SwaggerEndpoint($"swagger/Image/swagger.json", "影像模块");
|
||||
options.SwaggerEndpoint($"swagger/Reading/swagger.json", "读片模块");
|
||||
|
||||
|
||||
//路径配置,设置为空,表示直接在根域名(localhost:8001)访问该文件,
|
||||
//注意localhost:8001/swagger是访问不到的,去launchSettings.json把launchUrl去掉,如果你想换一个路径,直接写名字即可,比如直接写c.Route = "doc";
|
||||
|
|
|
@ -427,6 +427,21 @@
|
|||
<returns></returns>
|
||||
<exception cref="T:IRaCIS.Core.Infrastructure.BusinessValidationFailedException"></exception>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ClinicalDataInDto.TrialId">
|
||||
<summary>
|
||||
项目Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ClinicalDataInDto.SubjectId">
|
||||
<summary>
|
||||
受试者ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ClinicalDataInDto.VisitOrReadId">
|
||||
<summary>
|
||||
访视或者阅片ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ClinicalDataQuery.TrialId">
|
||||
<summary>
|
||||
项目ID
|
||||
|
@ -497,6 +512,16 @@
|
|||
数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SetReadingPeriodSetEffect.Id">
|
||||
<summary>
|
||||
项目ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.SetReadingPeriodSetEffect.IsTakeEffect">
|
||||
<summary>
|
||||
设置阅片是否生效
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ReadingPeriodSetQuery.ExpirationVisit">
|
||||
<summary>
|
||||
截止访视
|
||||
|
@ -2571,13 +2596,25 @@
|
|||
<param name="query"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ClinicalDataService.ClinicalDataView(IRaCIS.Core.Application.Service.Reading.Dto.ClinicalDataInDto)">
|
||||
<summary>
|
||||
获取
|
||||
</summary>
|
||||
<param name="query"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ClinicalDataService.DeleteClinicalData(System.Guid)">
|
||||
<summary>
|
||||
删除
|
||||
</summary>
|
||||
<param name="ClinicalDataId"></param>
|
||||
<param name="clinicalDataId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Application.Services.ReadingPeriodSetService">
|
||||
<summary>
|
||||
阅片期配置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ReadingPeriodSetService.AddOrUpdateReadingPeriodSet(IRaCIS.Core.Application.Service.Reading.Dto.ReadingPeriodSetAddOrEdit)">
|
||||
<summary>
|
||||
新增或者修改
|
||||
|
@ -2592,6 +2629,13 @@
|
|||
<param name="query"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ReadingPeriodSetService.SetReadingPeriodSetEffect(IRaCIS.Core.Application.Service.Reading.Dto.SetReadingPeriodSetEffect)">
|
||||
<summary>
|
||||
设置阅片期配置是否生效
|
||||
</summary>
|
||||
<param name="indto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ReadingPeriodSetService.DeleteReadingPeriodSet(System.Guid)">
|
||||
<summary>
|
||||
删除
|
||||
|
@ -2599,6 +2643,11 @@
|
|||
<param name="readingPeriodSetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Application.Services.ReadModuleService">
|
||||
<summary>
|
||||
生成的阅片模块(在大列表上展示的)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.ReadModuleService.GetReadModule(IRaCIS.Core.Application.Service.Reading.Dto.GetReadModuleDto)">
|
||||
<summary>
|
||||
获取读片模块
|
||||
|
|
|
@ -60,14 +60,31 @@ namespace IRaCIS.Application.Services
|
|||
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="ClinicalDataId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ClinicalDataId:guid}")]
|
||||
|
||||
|
||||
|
||||
/// <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);
|
||||
|
|
|
@ -18,6 +18,23 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
}
|
||||
|
||||
public class ClinicalDataInDto
|
||||
{
|
||||
/// <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 ClinicalDataQuery
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -18,6 +18,19 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
|
||||
}
|
||||
|
||||
public class SetReadingPeriodSetEffect
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目ID
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置阅片是否生效
|
||||
/// </summary>
|
||||
public bool IsTakeEffect { get; set; }
|
||||
}
|
||||
|
||||
public class ReadingPeriodSetQuery
|
||||
{
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@ using IRaCIS.Core.Domain.Share.Reading;
|
|||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成的阅片模块(在大列表上展示的)
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Reading")]
|
||||
public class ReadModuleService : BaseService
|
||||
{
|
||||
|
@ -31,9 +34,8 @@ namespace IRaCIS.Application.Services
|
|||
/// 获取读片模块
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<GetReadModuleResultDto> GetReadModule(GetReadModuleDto dto)
|
||||
public async Task<(PageOutput<GetReadModuleDtoOut>,int)> GetReadModule(GetReadModuleDto dto)
|
||||
{
|
||||
|
||||
var subjectquery = _subjectRepository.WhereIf(dto.TrialId!=null, x => x.TrialId == dto.TrialId).Include(x => x.SubjectVisitList).Include(x=>x.Site)
|
||||
.Select(x => new GetReadModuleDtoOut
|
||||
{
|
||||
|
@ -56,27 +58,10 @@ namespace IRaCIS.Application.Services
|
|||
VisitName = y.VisitName,
|
||||
|
||||
}).ToList()
|
||||
|
||||
});
|
||||
|
||||
|
||||
var pageList = await subjectquery.ToPagedListAsync(dto.PageIndex, dto.PageSize, dto.SortField == null ? "SiteCode" : dto.SortField,
|
||||
dto.SortAsc);
|
||||
|
||||
|
||||
GetReadModuleResultDto resultDto = new GetReadModuleResultDto()
|
||||
{
|
||||
CurrentPageData = pageList.CurrentPageData.ToList(),
|
||||
PageSize = pageList.PageSize,
|
||||
MaxLength = pageList.CurrentPageData.ToList().Max(x => x.Data.Count),
|
||||
PageIndex = pageList.PageIndex,
|
||||
TotalCount = pageList.TotalCount,
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
return resultDto;
|
||||
return (pageList, pageList.CurrentPageData.ToList().Max(x => x.Data.Count));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@ using IRaCIS.Core.Domain.Share.Reading;
|
|||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 阅片期配置
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Reading")]
|
||||
public class ReadingPeriodSetService : BaseService
|
||||
{
|
||||
|
@ -59,13 +62,31 @@ namespace IRaCIS.Application.Services
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置阅片期配置是否生效
|
||||
/// </summary>
|
||||
/// <param name="indto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task SetReadingPeriodSetEffect(SetReadingPeriodSetEffect indto)
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="readingPeriodSetId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{readingPeriodSetId:guid}")]
|
||||
var readquery =await _readingPeriodSetRepository.UpdatePartialNowNoQueryAsync(indto.Id, x => new ReadingPeriodSet() {
|
||||
IsTakeEffect = indto.IsTakeEffect
|
||||
});
|
||||
|
||||
|
||||
await _readingPeriodSetRepository.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="readingPeriodSetId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{readingPeriodSetId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteReadingPeriodSet(Guid readingPeriodSetId)
|
||||
{
|
||||
var success = await _repository.BatchDeleteAsync<ReadingPeriodSet>(t => t.Id == readingPeriodSetId);
|
||||
|
|
|
@ -39,9 +39,9 @@ namespace IRaCIS.Core.Domain.Share.Reading
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// 受试者范围
|
||||
/// 阅片期范围
|
||||
/// </summary>
|
||||
public enum SubjectScopeEnum
|
||||
public enum ReadingScopeEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 全部
|
||||
|
@ -148,9 +148,9 @@ namespace IRaCIS.Core.Domain.Share.Reading
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 临床分组类型
|
||||
/// 临床分组级别
|
||||
/// </summary>
|
||||
public enum ClinicalScopeType
|
||||
public enum ClinicalLevel
|
||||
{
|
||||
/// <summary>
|
||||
/// 受试者
|
||||
|
@ -160,7 +160,7 @@ namespace IRaCIS.Core.Domain.Share.Reading
|
|||
/// <summary>
|
||||
/// 访视
|
||||
/// </summary>
|
||||
Visit = 1,
|
||||
SubjectVisit = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 阅片
|
||||
|
|
|
@ -51,8 +51,10 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// 临床数据ID
|
||||
/// </summary>
|
||||
public Guid? ClinicalDataId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public Guid? VisitOrReadId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组类型(受试者)
|
||||
/// 临床级别
|
||||
/// </summary>
|
||||
public ClinicalScopeType? ScopeType { get; set; }
|
||||
public ClinicalLevel? ClinicalLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型
|
||||
|
@ -41,7 +41,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public ClinicalDataType? DataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上传方式()
|
||||
/// 上传方式
|
||||
/// </summary>
|
||||
public ClinicalUploadType? UploadType { get; set; }
|
||||
|
||||
|
|
|
@ -26,14 +26,14 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public string ReadingPeriodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 受试者范围
|
||||
/// 阅片范围
|
||||
/// </summary>
|
||||
public SubjectScopeEnum? SubjectScope { get; set; }
|
||||
public ReadingScopeEnum? ReadingScope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 范围ID
|
||||
/// 中心ID
|
||||
/// </summary>
|
||||
public Guid? ScopeId { get; set; }
|
||||
public Guid? SiteId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 截止日期
|
||||
|
@ -46,9 +46,14 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public decimal? ExpirationVisit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// 访视计划ID
|
||||
/// </summary>
|
||||
public ReadingPeriodStatus? Status { get; set; }
|
||||
public Guid? VisitStageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否生效
|
||||
/// </summary>
|
||||
public bool? IsTakeEffect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
|
@ -60,6 +65,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
/// </summary>
|
||||
public Guid CreateUserId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -177,6 +177,10 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
public virtual DbSet<ReadingPeriodSet> ReadingPeriodSet { get; set; }
|
||||
|
||||
public virtual DbSet<ReadModule> ReadModule { get; set; }
|
||||
|
||||
public virtual DbSet<ClinicalData> ClinicalData { get; set; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Subject and Visit and study
|
||||
|
|
Loading…
Reference in New Issue