Merge branch 'Test_HIR_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_HIR_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
6a63ffd1f2
|
|
@ -16600,6 +16600,20 @@
|
||||||
<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,19 +1,31 @@
|
||||||
namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace IRaCIS.Core.Application.Contracts.Dicom.DTO
|
||||||
{
|
{
|
||||||
public class ImageShareCommand
|
public class ImageShareCommand
|
||||||
{
|
{
|
||||||
public Guid TrialId { get; set; }
|
[NotDefault]
|
||||||
public Guid SubjectId { get; set; }
|
public Guid VisitTaskId { get; set; }
|
||||||
public Guid? StudyId { get; set; }
|
|
||||||
|
|
||||||
public DateTime? ExpireTime { get; set; }
|
public string RouteUrl { 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 StudyId { get; set; }
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
|
public string RouteUrl { get; set; }
|
||||||
|
|
||||||
public string Token { get; set; } = string.Empty;
|
public string Token { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using IRaCIS.Application.Contracts;
|
using DocumentFormat.OpenXml.Bibliography;
|
||||||
|
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;
|
||||||
|
|
@ -7,66 +8,31 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Services
|
namespace IRaCIS.Core.Application.Services
|
||||||
{
|
{
|
||||||
[AllowAnonymous, ApiExplorerSettings(GroupName = "Image")]
|
[AllowAnonymous, ApiExplorerSettings(GroupName = "HIR")]
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
#region 上传不按照访视上传,基线没传,数据可能出错
|
var imageShare = _mapper.Map<ImageShare>(imageShareCommand);
|
||||||
|
|
||||||
//var subjectVisit1 = _subjectVisitRepository.FirstOrDefault(t =>
|
var addEntity = await _imageShareRepository.AddAsync(imageShare);
|
||||||
// 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);
|
||||||
|
|
||||||
imageShareCommand.Password = verificationPassWord.ToString();
|
addEntity.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();
|
||||||
|
|
||||||
|
|
@ -75,6 +41,25 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
@ -101,7 +86,8 @@ namespace IRaCIS.Core.Application.Services
|
||||||
|
|
||||||
var resource = new ResourceInfo()
|
var resource = new ResourceInfo()
|
||||||
{
|
{
|
||||||
StudyId = imageShare.StudyId,
|
VisitTaskId = imageShare.VisitTaskId,
|
||||||
|
RouteUrl = imageShare.RouteUrl,
|
||||||
Token = _tokenService.GetToken(new UserTokenInfo()
|
Token = _tokenService.GetToken(new UserTokenInfo()
|
||||||
{
|
{
|
||||||
IdentityUserId = Guid.NewGuid(),
|
IdentityUserId = Guid.NewGuid(),
|
||||||
|
|
@ -111,7 +97,6 @@ namespace IRaCIS.Core.Application.Services
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok(resource);
|
return ResponseOutput.Ok(resource);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -580,7 +580,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
var success = await _identityUserRepository.SaveChangesAsync();
|
var success = await _identityUserRepository.SaveChangesAsync();
|
||||||
|
|
||||||
if (userAddModel.UserName.IsNotNullOrEmpty())
|
if (userAddModel.UserName.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
//自动添加到项目用户里面
|
//自动添加到项目用户里面
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,12 @@
|
||||||
[Table("ImageShare")]
|
[Table("ImageShare")]
|
||||||
public class ImageShare : Entity
|
public class ImageShare : Entity
|
||||||
{
|
{
|
||||||
#region 导航属性
|
public Guid VisitTaskId { get; set; }
|
||||||
|
|
||||||
#endregion
|
public string RouteUrl { get; set; }
|
||||||
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; } = string.Empty;
|
public string Password { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -162,13 +162,13 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
|
||||||
|
|
||||||
if (entities.Count > 0)
|
if (entities.Count > 0)
|
||||||
{
|
{
|
||||||
var a1= entities.Where(t=> typeof(DicomStudy).IsAssignableFrom(t.Entity.GetType())).ToList();
|
//var a1= entities.Where(t=> typeof(DicomStudy).IsAssignableFrom(t.Entity.GetType())).ToList();
|
||||||
var a2 = entities.Where(t => typeof(DicomSeries).IsAssignableFrom(t.Entity.GetType())).ToList();
|
//var a2 = entities.Where(t => typeof(DicomSeries).IsAssignableFrom(t.Entity.GetType())).ToList();
|
||||||
var a3 = entities.Where(t => typeof(DicomInstance).IsAssignableFrom(t.Entity.GetType())).ToList();
|
//var a3 = entities.Where(t => typeof(DicomInstance).IsAssignableFrom(t.Entity.GetType())).ToList();
|
||||||
|
|
||||||
var list = a3
|
//var list = a3
|
||||||
.Where(t => ((DicomInstance)t.Entity).SeqId == Guid.Parse("08dde5f4-2134-31e8-0242-c0a801000000"))
|
// .Where(t => ((DicomInstance)t.Entity).SeqId == Guid.Parse("08dde5f4-2134-31e8-0242-c0a801000000"))
|
||||||
.ToList();
|
// .ToList();
|
||||||
|
|
||||||
auditingData.InsertAddEntitys(entities).GetAwaiter().GetResult();
|
auditingData.InsertAddEntitys(entities).GetAwaiter().GetResult();
|
||||||
|
|
||||||
|
|
|
||||||
19068
IRaCIS.Core.Infra.EFCore/Migrations/20250901042050_sharemodify.Designer.cs
generated
Normal file
19068
IRaCIS.Core.Infra.EFCore/Migrations/20250901042050_sharemodify.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,63 @@
|
||||||
|
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,13 +3118,12 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
.HasMaxLength(400)
|
.HasMaxLength(400)
|
||||||
.HasColumnType("nvarchar(400)");
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
b.Property<Guid>("StudyId")
|
b.Property<string>("RouteUrl")
|
||||||
.HasColumnType("uniqueidentifier");
|
.IsRequired()
|
||||||
|
.HasMaxLength(400)
|
||||||
|
.HasColumnType("nvarchar(400)");
|
||||||
|
|
||||||
b.Property<Guid>("SubjectId")
|
b.Property<Guid>("VisitTaskId")
|
||||||
.HasColumnType("uniqueidentifier");
|
|
||||||
|
|
||||||
b.Property<Guid>("TrialId")
|
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue