Compare commits
No commits in common. "b331799b3f1dcb58cf2201f4a337e1cad0e1e2ff" and "8be56c5a4da21412f3a0082aa8f4c31bb1f28391" have entirely different histories.
b331799b3f
...
8be56c5a4d
|
|
@ -16600,20 +16600,6 @@
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
<exception cref="T:System.NotImplementedException"></exception>
|
<exception cref="T:System.NotImplementedException"></exception>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Services.ImageShareService.CreateImageShare(IRaCIS.Core.Application.Contracts.Dicom.DTO.ImageShareCommand)">
|
|
||||||
<summary>
|
|
||||||
创建影像分享,返回分享Id 和初始化随机密码
|
|
||||||
</summary>
|
|
||||||
<param name="imageShareCommand"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Core.Application.Services.ImageShareService.UpdateImageShare(IRaCIS.Core.Application.Contracts.Dicom.DTO.UpdateImageShare)">
|
|
||||||
<summary>
|
|
||||||
更新影像分享 密码和授权时间
|
|
||||||
</summary>
|
|
||||||
<param name="inComand"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Core.Application.Services.InstanceService.List(System.Guid)">
|
<member name="M:IRaCIS.Core.Application.Services.InstanceService.List(System.Guid)">
|
||||||
<summary> 指定资源Id,获取Dicom序列所属的实例信息列表 </summary>
|
<summary> 指定资源Id,获取Dicom序列所属的实例信息列表 </summary>
|
||||||
<param name="seriesId"> Dicom序列的Id </param>
|
<param name="seriesId"> Dicom序列的Id </param>
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,19 @@
|
||||||
using System.ComponentModel.DataAnnotations;
|
namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
|
|
||||||
{
|
{
|
||||||
public class ImageShareCommand
|
public class ImageShareCommand
|
||||||
{
|
{
|
||||||
[NotDefault]
|
public Guid TrialId { get; set; }
|
||||||
public Guid VisitTaskId { get; set; }
|
public Guid SubjectId { get; set; }
|
||||||
|
public Guid? StudyId { get; set; }
|
||||||
|
|
||||||
public string RouteUrl { get; set; }
|
public DateTime? ExpireTime { get; set; }
|
||||||
|
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
}
|
|
||||||
|
|
||||||
public class UpdateImageShare
|
|
||||||
{
|
|
||||||
public Guid Id { get; set; }
|
|
||||||
|
|
||||||
public int ImageShareExpireDays { get; set; }
|
|
||||||
|
|
||||||
public string Password { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ResourceInfo
|
public class ResourceInfo
|
||||||
{
|
{
|
||||||
public Guid VisitTaskId { get; set; }
|
public Guid StudyId { get; set; }
|
||||||
|
|
||||||
public string RouteUrl { get; set; }
|
|
||||||
|
|
||||||
public string Token { get; set; } = string.Empty;
|
public string Token { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using DocumentFormat.OpenXml.Bibliography;
|
using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Application.Contracts;
|
|
||||||
using IRaCIS.Core.Application.Auth;
|
using IRaCIS.Core.Application.Auth;
|
||||||
using IRaCIS.Core.Application.Contracts.Dicom.DTO;
|
using IRaCIS.Core.Application.Contracts.Dicom.DTO;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
|
@ -8,31 +7,66 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Services
|
namespace IRaCIS.Core.Application.Services
|
||||||
{
|
{
|
||||||
[AllowAnonymous, ApiExplorerSettings(GroupName = "HIR")]
|
[AllowAnonymous, ApiExplorerSettings(GroupName = "Image")]
|
||||||
public class ImageShareService(IRepository<ImageShare> _imageShareRepository,
|
public class ImageShareService(IRepository<ImageShare> _imageShareRepository,
|
||||||
|
IRepository<DicomStudy> _studyRepository,
|
||||||
ITokenService _tokenService, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IImageShareService
|
ITokenService _tokenService, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IImageShareService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建影像分享,返回分享Id 和初始化随机密码
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="imageShareCommand"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IResponseOutput> CreateImageShare(ImageShareCommand imageShareCommand)
|
public async Task<IResponseOutput> CreateImageShare(ImageShareCommand imageShareCommand)
|
||||||
{
|
{
|
||||||
|
if (imageShareCommand.StudyId == null)
|
||||||
|
{
|
||||||
|
|
||||||
var imageShare = _mapper.Map<ImageShare>(imageShareCommand);
|
#region 上传不按照访视上传,基线没传,数据可能出错
|
||||||
|
|
||||||
var addEntity = await _imageShareRepository.AddAsync(imageShare);
|
//var subjectVisit1 = _subjectVisitRepository.FirstOrDefault(t =>
|
||||||
|
// t.TrialId == imageShareCommand.TrialId && t.SubjectId == imageShareCommand.SubjectId &&
|
||||||
|
// t.VisitNum == 1);
|
||||||
|
|
||||||
|
//if (subjectVisit1 == null)
|
||||||
|
//{
|
||||||
|
// return ResponseOutput.NotOk("当前无影像数据,无法分享!");
|
||||||
|
//}
|
||||||
|
|
||||||
|
//imageShareCommand.StudyId =
|
||||||
|
// _studyRepository.GetAll().First(t => t.SubjectVisitId == subjectVisit1.Id&&t.Status != (int)StudyStatus.Abandon).Id;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
var studyIds = await _studyRepository.AsQueryable()
|
||||||
|
.Where(t => t.TrialId == imageShareCommand.TrialId && t.SubjectId == imageShareCommand.SubjectId
|
||||||
|
)
|
||||||
|
.Select(u => u.Id).ToListAsync();
|
||||||
|
|
||||||
|
if (!studyIds.Any())
|
||||||
|
{
|
||||||
|
//---当前检查没有影像可以分享。
|
||||||
|
return ResponseOutput.NotOk(_localizer["ISS_NoImgToShare"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
imageShareCommand.StudyId = studyIds.First();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//验证码 4位
|
//验证码 4位
|
||||||
int verificationPassWord = new Random().Next(1000, 10000);
|
int verificationPassWord = new Random().Next(1000, 10000);
|
||||||
|
|
||||||
addEntity.Password = verificationPassWord.ToString();
|
imageShareCommand.Password = verificationPassWord.ToString();
|
||||||
|
|
||||||
|
//配置文件读取过期时间
|
||||||
|
|
||||||
|
var days = AppSettings.IRaCISBasicConfig.ImageShareExpireDays;
|
||||||
|
|
||||||
|
|
||||||
|
imageShareCommand.ExpireTime = DateTime.Now.AddDays(days);
|
||||||
|
|
||||||
|
var imageShare = _mapper.Map<ImageShare>(imageShareCommand);
|
||||||
|
|
||||||
|
await _imageShareRepository.AddAsync(imageShare);
|
||||||
|
|
||||||
var success = await _imageShareRepository.SaveChangesAsync();
|
var success = await _imageShareRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
@ -41,25 +75,6 @@ namespace IRaCIS.Core.Application.Services
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新影像分享 密码和授权时间
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inComand"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPut]
|
|
||||||
public async Task<IResponseOutput> UpdateImageShare(UpdateImageShare inComand)
|
|
||||||
{
|
|
||||||
var find = await _imageShareRepository.FirstOrDefaultAsync(t => t.Id == inComand.Id);
|
|
||||||
|
|
||||||
find.ExpireTime = DateTime.Now.AddDays(inComand.ImageShareExpireDays);
|
|
||||||
|
|
||||||
find.Password = inComand.Password;
|
|
||||||
|
|
||||||
await _imageShareRepository.SaveChangesAsync();
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet, Route("{resourceId:guid}/{password}")]
|
[HttpGet, Route("{resourceId:guid}/{password}")]
|
||||||
public async Task<IResponseOutput> VerifyShareImage(Guid resourceId, string password)
|
public async Task<IResponseOutput> VerifyShareImage(Guid resourceId, string password)
|
||||||
{
|
{
|
||||||
|
|
@ -86,8 +101,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
|
|
||||||
var resource = new ResourceInfo()
|
var resource = new ResourceInfo()
|
||||||
{
|
{
|
||||||
VisitTaskId = imageShare.VisitTaskId,
|
StudyId = imageShare.StudyId,
|
||||||
RouteUrl = imageShare.RouteUrl,
|
|
||||||
Token = _tokenService.GetToken(new UserTokenInfo()
|
Token = _tokenService.GetToken(new UserTokenInfo()
|
||||||
{
|
{
|
||||||
IdentityUserId = Guid.NewGuid(),
|
IdentityUserId = Guid.NewGuid(),
|
||||||
|
|
@ -97,6 +111,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok(resource);
|
return ResponseOutput.Ok(resource);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,15 @@
|
||||||
[Table("ImageShare")]
|
[Table("ImageShare")]
|
||||||
public class ImageShare : Entity
|
public class ImageShare : Entity
|
||||||
{
|
{
|
||||||
public Guid VisitTaskId { get; set; }
|
#region 导航属性
|
||||||
|
|
||||||
public string RouteUrl { get; set; }
|
#endregion
|
||||||
|
public Guid TrialId { get; set; }
|
||||||
|
public Guid SubjectId { get; set; }
|
||||||
|
public Guid StudyId { get; set; }
|
||||||
|
|
||||||
public DateTime ExpireTime { get; set; }
|
public DateTime ExpireTime { get; set; }
|
||||||
|
|
||||||
public string Password { get; set; }
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,63 +0,0 @@
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class sharemodify : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "StudyId",
|
|
||||||
table: "ImageShare");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "SubjectId",
|
|
||||||
table: "ImageShare");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "TrialId",
|
|
||||||
table: "ImageShare",
|
|
||||||
newName: "VisitTaskId");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "RouteUrl",
|
|
||||||
table: "ImageShare",
|
|
||||||
type: "nvarchar(400)",
|
|
||||||
maxLength: 400,
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "RouteUrl",
|
|
||||||
table: "ImageShare");
|
|
||||||
|
|
||||||
migrationBuilder.RenameColumn(
|
|
||||||
name: "VisitTaskId",
|
|
||||||
table: "ImageShare",
|
|
||||||
newName: "TrialId");
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<Guid>(
|
|
||||||
name: "StudyId",
|
|
||||||
table: "ImageShare",
|
|
||||||
type: "uniqueidentifier",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<Guid>(
|
|
||||||
name: "SubjectId",
|
|
||||||
table: "ImageShare",
|
|
||||||
type: "uniqueidentifier",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3118,12 +3118,13 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.HasMaxLength(400)
|
.HasMaxLength(400)
|
||||||
.HasColumnType("nvarchar(400)");
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
b.Property<string>("RouteUrl")
|
b.Property<Guid>("StudyId")
|
||||||
.IsRequired()
|
.HasColumnType("uniqueidentifier");
|
||||||
.HasMaxLength(400)
|
|
||||||
.HasColumnType("nvarchar(400)");
|
|
||||||
|
|
||||||
b.Property<Guid>("VisitTaskId")
|
b.Property<Guid>("SubjectId")
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<Guid>("TrialId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue