Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-07-02 09:29:36
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Collections.Generic;
|
||||
namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
/// <summary> ExploreRecommendView 列表视图模型 </summary>
|
||||
public class ExploreRecommendView: ExploreRecommendAddOrEdit
|
||||
{
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
public DateTime? DeleteTime { get; set; }
|
||||
public Guid? DeleteUserId { get; set; }
|
||||
}
|
||||
|
||||
///<summary>ExploreRecommendQuery 列表查询参数模型</summary>
|
||||
public class ExploreRecommendQuery:PageInput
|
||||
{
|
||||
|
||||
public string? Version { get; set; }
|
||||
|
||||
|
||||
public string? Title { get; set; }
|
||||
|
||||
|
||||
public string? DownloadUrl { get; set; }
|
||||
|
||||
|
||||
public string? FileName { get; set; }
|
||||
|
||||
public bool? IsDeleted { get; set; }
|
||||
|
||||
}
|
||||
|
||||
///<summary> ExploreRecommendAddOrEdit 列表查询参数模型</summary>
|
||||
public class ExploreRecommendAddOrEdit
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public string ExploreType { get; set; }
|
||||
|
||||
public string Version { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
public bool IsDeleted { get; set; }
|
||||
public string DownloadUrl { get; set; }
|
||||
public string Path { get; set; }
|
||||
public string FileName { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-07-02 09:26:59
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// ExploreRecommendService
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Common")]
|
||||
public class ExploreRecommendService : BaseService, IExploreRecommendService
|
||||
{
|
||||
|
||||
private readonly IRepository<ExploreRecommend> _exploreRecommendRepository;
|
||||
|
||||
public ExploreRecommendService(IRepository<ExploreRecommend> exploreRecommendRepository)
|
||||
{
|
||||
_exploreRecommendRepository = exploreRecommendRepository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<ExploreRecommendView>> GetExploreRecommendList(ExploreRecommendQuery inQuery)
|
||||
{
|
||||
|
||||
var exploreRecommendQueryable =
|
||||
|
||||
_exploreRecommendRepository.Where().IgnoreQueryFilters()
|
||||
.WhereIf(string.IsNullOrEmpty(inQuery.Title), t => t.Title.Contains(inQuery.Title))
|
||||
.WhereIf(string.IsNullOrEmpty(inQuery.FileName), t => t.Title.Contains(inQuery.FileName))
|
||||
.WhereIf(string.IsNullOrEmpty(inQuery.DownloadUrl), t => t.Title.Contains(inQuery.DownloadUrl))
|
||||
.WhereIf(string.IsNullOrEmpty(inQuery.Version), t => t.Title.Contains(inQuery.Version))
|
||||
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == t.IsDeleted)
|
||||
.ProjectTo<ExploreRecommendView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList = await exploreRecommendQueryable
|
||||
.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(ExploreRecommendView.Id) : inQuery.SortField,
|
||||
inQuery.Asc);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateExploreRecommend(ExploreRecommendAddOrEdit addOrEditExploreRecommend)
|
||||
{
|
||||
var verifyExp2 = new EntityVerifyExp<ExploreRecommend>()
|
||||
{
|
||||
VerifyExp = u => u.IsDeleted == addOrEditExploreRecommend.IsDeleted && u.ExploreType == addOrEditExploreRecommend.ExploreType,
|
||||
|
||||
VerifyMsg = "当前浏览器启用版本只允许有一个",
|
||||
|
||||
IsVerify = addOrEditExploreRecommend.IsDeleted == false
|
||||
};
|
||||
|
||||
var entity = await _exploreRecommendRepository.InsertOrUpdateAsync(addOrEditExploreRecommend, true, verifyExp2);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete("{exploreRecommendId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteExploreRecommend(Guid exploreRecommendId)
|
||||
{
|
||||
var success = await _exploreRecommendRepository.DeleteFromQueryAsync(t => t.Id == exploreRecommendId, true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
public async Task<List<ExploreRecommendView> > GetExploreRecommentInfo()
|
||||
{
|
||||
|
||||
|
||||
var result = await _exploreRecommendRepository.Where(t => t.IsDeleted == false).ProjectTo<ExploreRecommendView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
if (result .Count==0)
|
||||
{
|
||||
throw new QueryBusinessObjectNotExistException("系统浏览器版本推荐未维护,请联系维护人员");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-07-02 09:27:36
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
namespace IRaCIS.Core.Application.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// IExploreRecommendService
|
||||
/// </summary>
|
||||
public interface IExploreRecommendService
|
||||
{
|
||||
|
||||
Task<PageOutput<ExploreRecommendView>> GetExploreRecommendList(ExploreRecommendQuery inQuery);
|
||||
|
||||
Task<IResponseOutput> AddOrUpdateExploreRecommend(ExploreRecommendAddOrEdit addOrEditExploreRecommend);
|
||||
|
||||
Task<IResponseOutput> DeleteExploreRecommend(Guid exploreRecommendId);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -80,8 +80,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<PublishLog, PublishLogAddOrEdit>().ReverseMap();
|
||||
|
||||
CreateMap<PublishLog, PublishVersionSelect>();
|
||||
|
||||
|
||||
CreateMap<ExploreRecommend, ExploreRecommendView>();
|
||||
CreateMap<ExploreRecommend, ExploreRecommendAddOrEdit>().ReverseMap();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,6 +506,39 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<IResponseOutput> GetSubejectVisitPathInfo(Guid subjectVisitId)
|
||||
{
|
||||
var query = from sv in _subjectVisitRepository.Where(t => t.Id == subjectVisitId)
|
||||
|
||||
select new
|
||||
{
|
||||
SubjectCode = sv.Subject.Code,
|
||||
VisitName = sv.VisitName,
|
||||
StudyList = sv.StudyList.Select(u => new
|
||||
{
|
||||
u.PatientId,
|
||||
u.StudyTime,
|
||||
u.StudyCode,
|
||||
|
||||
SeriesList = u.SeriesList.Select(z => new
|
||||
{
|
||||
z.Modality,
|
||||
|
||||
InstancePathList = z.DicomInstanceList.Select(k => new
|
||||
{
|
||||
k.Path
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
};
|
||||
|
||||
var info = query.FirstOrDefault();
|
||||
|
||||
return ResponseOutput.Ok(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后台任务调用,前端忽略该接口
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-03-22 15:44:37
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
/// <summary> DicomAEView 列表视图模型 </summary>
|
||||
public class DicomAEView : DicomAEAddOrEdit
|
||||
{
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
public DateTime? LatestTestTime { get; set; }
|
||||
|
||||
public bool IsTestOK { get; set; }
|
||||
|
||||
public bool IsPACSConnect { get; set; }
|
||||
|
||||
public bool IsTrialPACSConfirmed { get; set; }
|
||||
|
||||
}
|
||||
|
||||
///<summary>DicomAEQuery 列表查询参数模型</summary>
|
||||
public class DicomAEQuery : PageInput
|
||||
{
|
||||
public Guid? TrialId { get; set; }
|
||||
|
||||
public string? CalledAE { get; set; }
|
||||
|
||||
public string? IP { get; set; }
|
||||
|
||||
|
||||
public int? Port { get; set; }
|
||||
|
||||
|
||||
public string? Modality { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
|
||||
///<summary> DicomAEAddOrEdit 列表查询参数模型</summary>
|
||||
public class DicomAEAddOrEdit
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public string CalledAE { get; set; }
|
||||
public string IP { get; set; }
|
||||
public int Port { get; set; }
|
||||
public string Modality { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -313,6 +313,16 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
|
||||
}
|
||||
|
||||
public class TrialPACSConfig
|
||||
{
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public bool IsPACSConnect { get; set; }
|
||||
|
||||
public bool IsTrialPACSConfirmed { get; set; } = true;
|
||||
}
|
||||
|
||||
public class TrialStateChangeDTO
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-07-02 16:53:52
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
/// <summary> TrialSiteDicomAEView 列表视图模型 </summary>
|
||||
public class TrialSiteDicomAEView : TrialSiteDicomAEAddOrEdit
|
||||
{
|
||||
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public Guid? DeleteUserId { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
public Guid CreateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
///<summary>TrialSiteDicomAEQuery 列表查询参数模型</summary>
|
||||
public class TrialSiteDicomAEQuery /*: PageInput*/
|
||||
{
|
||||
[NotDefault]
|
||||
|
||||
public Guid TrialSiteId { get; set; }
|
||||
|
||||
public string? CallingAE { get; set; }
|
||||
|
||||
public string? IP { get; set; }
|
||||
|
||||
public string? Port { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
}
|
||||
|
||||
///<summary> TrialSiteDicomAEAddOrEdit 列表查询参数模型</summary>
|
||||
public class TrialSiteDicomAEAddOrEdit
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
|
||||
public Guid TrialSiteId { get; set; }
|
||||
public string CallingAE { get; set; }
|
||||
public string IP { get; set; }
|
||||
public string Port { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
//public bool IsDeleted { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace IRaCIS.Application.Contracts
|
||||
//public string ContactPhone { get; set; } = String.Empty;
|
||||
//public string Address { get; set; } = String.Empty;
|
||||
|
||||
|
||||
public List<string> CallingAEList { get; set; }
|
||||
public List<string> UserNameList { get; set; } = new List<string>();
|
||||
|
||||
public int? VisitCount { get; set; }
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-03-22 15:44:27
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
namespace IRaCIS.Core.Application.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// IDicomAEService
|
||||
/// </summary>
|
||||
public interface IDicomAEService
|
||||
{
|
||||
|
||||
Task<IResponseOutput<PageOutput<DicomAEView>>> GetDicomAEList(DicomAEQuery inQuery);
|
||||
|
||||
Task<IResponseOutput> AddOrUpdateDicomAE(DicomAEAddOrEdit addOrEditDicomAE);
|
||||
|
||||
Task<IResponseOutput> DeleteDicomAE(Guid dicomAEId);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace IRaCIS.Application.Interfaces
|
||||
|
||||
Task<IResponseOutput> ConfigTrialUrgentInfo(TrialUrgentConfig trialConfig);
|
||||
|
||||
|
||||
Task<IResponseOutput> ConfigTrialPACSInfo(TrialPACSConfig trialConfig);
|
||||
Task<IResponseOutput> TrialConfigSignatureConfirm(SignConfirmDTO signConfirmDTO);
|
||||
|
||||
Task<IResponseOutput> AsyncTrialCriterionDictionary(AsyncTrialCriterionDictionaryInDto inDto);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-07-02 16:53:55
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
namespace IRaCIS.Core.Application.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// ITrialSiteDicomAEService
|
||||
/// </summary>
|
||||
public interface ITrialSiteDicomAEService
|
||||
{
|
||||
|
||||
Task<List<TrialSiteDicomAEView>> GetTrialSiteDicomAEList(TrialSiteDicomAEQuery inQuery);
|
||||
|
||||
Task<IResponseOutput> AddOrUpdateTrialSiteDicomAE(TrialSiteDicomAEAddOrEdit addOrEditTrialSiteDicomAE);
|
||||
|
||||
Task<IResponseOutput> DeleteTrialSiteDicomAE(Guid trialSiteDicomAEId);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -604,7 +604,7 @@ namespace IRaCIS.Core.Application
|
||||
|
||||
await _readingQuestionCriterionTrialRepository.UpdatePartialFromQueryAsync(inDto.TrialReadingCriterionId, x => new ReadingQuestionCriterionTrial()
|
||||
{
|
||||
IsImageFilter=inDto.IsImageFilter,
|
||||
IsImageFilter = inDto.IsImageFilter,
|
||||
ImageDownloadEnum = inDto.ImageDownloadEnum,
|
||||
ImageUploadEnum = inDto.ImageUploadEnum,
|
||||
CriterionModalitys = inDto.CriterionModalitys,
|
||||
@@ -954,7 +954,7 @@ namespace IRaCIS.Core.Application
|
||||
trialInfo.UpdateTime = DateTime.Now;
|
||||
|
||||
|
||||
//await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialConfig.TrialId && t.IsSigned == false, u => new ReadingQuestionCriterionTrial() { CriterionModalitys = trialConfig.Modalitys });
|
||||
//await _readingQuestionCriterionTrialRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialConfig.TrialId && t.IsSigned == false, u => new ReadingQuestionCriterionTrial() { CriterionModalitys = trialConfig.Modalitys });
|
||||
|
||||
return ResponseOutput.Ok(await _repository.SaveChangesAsync());
|
||||
}
|
||||
@@ -1151,6 +1151,25 @@ namespace IRaCIS.Core.Application
|
||||
return ResponseOutput.Ok(await _repository.SaveChangesAsync());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置pacs信息
|
||||
/// </summary>
|
||||
/// <param name="trialConfig"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput> ConfigTrialPACSInfo(TrialPACSConfig trialConfig)
|
||||
{
|
||||
var trialInfo = (await _trialRepository.FirstOrDefaultAsync(t => t.Id == trialConfig.TrialId)).IfNullThrowException();
|
||||
trialInfo.IsPACSConnect = trialConfig.IsPACSConnect;
|
||||
trialConfig.IsTrialPACSConfirmed = trialConfig.IsTrialPACSConfirmed;
|
||||
trialInfo.UpdateTime = DateTime.Now;
|
||||
await _trialRepository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok(await _repository.SaveChangesAsync());
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<IResponseOutput> IfTrialCanOngoing(Guid trialId)
|
||||
{
|
||||
@@ -1318,7 +1337,7 @@ namespace IRaCIS.Core.Application
|
||||
|
||||
public async Task<IResponseOutput<List<TrialBodyPartView>>> GetTrialBodyPartList(Guid trialId)
|
||||
{
|
||||
var list = await _trialRepository.Where(t => t.Id == trialId).SelectMany(t => t.TrialBodyPartList).Select(t => new TrialBodyPartView() { Code = t.Code, Name = _userInfo.IsEn_Us ? t.Name : t.NameCN ,Id=t.Id,IsHandAdd=t.IsHandAdd}).ToListAsync();
|
||||
var list = await _trialRepository.Where(t => t.Id == trialId).SelectMany(t => t.TrialBodyPartList).Select(t => new TrialBodyPartView() { Code = t.Code, Name = _userInfo.IsEn_Us ? t.Name : t.NameCN, Id = t.Id, IsHandAdd = t.IsHandAdd }).ToListAsync();
|
||||
|
||||
return ResponseOutput.Ok(list);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-03-22 15:44:31
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using FellowOakDicom.Network.Client;
|
||||
using FellowOakDicom.Network;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// DicomAEService
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class TrialDicomAEService : BaseService, IDicomAEService
|
||||
{
|
||||
|
||||
private readonly IRepository<TrialDicomAE> _dicomAERepository;
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
|
||||
public TrialDicomAEService(IRepository<TrialDicomAE> dicomAERepository, IRepository<Trial> trialRepository)
|
||||
{
|
||||
_trialRepository = trialRepository;
|
||||
_dicomAERepository = dicomAERepository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput<PageOutput<DicomAEView>>> GetDicomAEList(DicomAEQuery inQuery)
|
||||
{
|
||||
|
||||
var dicomAEQueryable = _dicomAERepository
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.IP), t => t.IP.Contains(inQuery.IP))
|
||||
.WhereIf(inQuery.Port != null, t => t.Port == inQuery.Port)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.CalledAE), t => t.CalledAE.Contains(inQuery.CalledAE))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Description), t => t.Description.Contains(inQuery.Description))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Modality), t => t.Modality.Contains(inQuery.Modality))
|
||||
.ProjectTo<DicomAEView>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
||||
|
||||
|
||||
var pageList = await dicomAEQueryable.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? nameof(DicomAEView.CalledAE) : inQuery.SortField, inQuery.Asc);
|
||||
|
||||
|
||||
return ResponseOutput.Ok(pageList);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目dicom AE 配置信息,otherinfo里面有IsPACSConnect IsTrialPACSConfirmed
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput<DicomAEView>> GetTrialDicomAE(Guid trialId)
|
||||
{
|
||||
var dicomAE = _dicomAERepository.Where(t => t.TrialId == trialId).ProjectTo<DicomAEView>(_mapper.ConfigurationProvider).FirstOrDefault();
|
||||
var trialConfig = _trialRepository.Where(t => t.Id == trialId).Select(t => new { t.IsPACSConnect, t.IsTrialPACSConfirmed });
|
||||
return ResponseOutput.Ok(dicomAE, trialConfig);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateDicomAE(DicomAEAddOrEdit addOrEditDicomAE)
|
||||
{
|
||||
var verifyExp1 = new EntityVerifyExp<TrialDicomAE>()
|
||||
{
|
||||
VerifyExp = u => u.IP == addOrEditDicomAE.IP && u.Port == addOrEditDicomAE.Port && u.TrialId == addOrEditDicomAE.TrialId,
|
||||
|
||||
VerifyMsg = "不允许添加相同的IP和端口的记录"
|
||||
};
|
||||
|
||||
//var verifyExp2 = new EntityVerifyExp<TrialDicomAE>()
|
||||
//{
|
||||
// VerifyExp = u => u.TrialId == addOrEditDicomAE.TrialId,
|
||||
|
||||
// VerifyMsg = "只允许配置一条记录",
|
||||
// IsVerify=addOrEditDicomAE.Id==null
|
||||
//};
|
||||
|
||||
// 在此处拷贝automapper 映射
|
||||
var entity = await _dicomAERepository.InsertOrUpdateAsync(addOrEditDicomAE, true, verifyExp1);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete("{dicomAEId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteDicomAE(Guid dicomAEId)
|
||||
{
|
||||
var success = await _dicomAERepository.DeleteFromQueryAsync(t => t.Id == dicomAEId, true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 测试scp server 是否可以连接
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{dicomAEId:guid}")]
|
||||
public async Task<bool> TestSCPServerConnect(Guid dicomAEId)
|
||||
{
|
||||
var find = await _dicomAERepository.FirstOrDefaultAsync(t => t.Id == dicomAEId);
|
||||
|
||||
if (find == null)
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
find.LatestTestTime = DateTime.Now;
|
||||
|
||||
try
|
||||
{
|
||||
var client = DicomClientFactory.Create(find.IP, find.Port, false, "test-callingAE", find.CalledAE);
|
||||
|
||||
client.NegotiateAsyncOps();
|
||||
|
||||
await client.AddRequestAsync(new DicomCEchoRequest());
|
||||
|
||||
await client.SendAsync();
|
||||
|
||||
find.IsTestOK = true;
|
||||
await _dicomAERepository.SaveChangesAsync();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
find.IsTestOK = false;
|
||||
await _dicomAERepository.SaveChangesAsync();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2024-07-02 16:53:58
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// TrialSiteDicomAEService
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class TrialSiteDicomAEService : BaseService, ITrialSiteDicomAEService
|
||||
{
|
||||
|
||||
private readonly IRepository<TrialSiteDicomAE> _trialSiteDicomAERepository;
|
||||
|
||||
public TrialSiteDicomAEService(IRepository<TrialSiteDicomAE> trialSiteDicomAERepository)
|
||||
{
|
||||
_trialSiteDicomAERepository = trialSiteDicomAERepository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<List<TrialSiteDicomAEView>> GetTrialSiteDicomAEList(TrialSiteDicomAEQuery inQuery)
|
||||
{
|
||||
|
||||
var trialSiteDicomAEQueryable =
|
||||
|
||||
_trialSiteDicomAERepository.Where(t=>t.TrialSiteId==inQuery.TrialSiteId)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.IP), t => t.IP.Contains(inQuery.IP))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Port), t => t.Port.Contains(inQuery.Port))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Description), t => t.Description.Contains(inQuery.Description))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.CallingAE), t => t.CallingAE.Contains(inQuery.CallingAE))
|
||||
.ProjectTo<TrialSiteDicomAEView>(_mapper.ConfigurationProvider);
|
||||
|
||||
//var pageList = await trialSiteDicomAEQueryable
|
||||
//.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TrialSiteDicomAEView.Id) : inQuery.SortField,
|
||||
//inQuery.Asc);
|
||||
|
||||
var list = await trialSiteDicomAEQueryable.ToListAsync();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateTrialSiteDicomAE(TrialSiteDicomAEAddOrEdit addOrEditTrialSiteDicomAE)
|
||||
{
|
||||
var verifyExp1 = new EntityVerifyExp<TrialSiteDicomAE>()
|
||||
{
|
||||
VerifyExp = u => u.IP == addOrEditTrialSiteDicomAE.IP && u.Port == addOrEditTrialSiteDicomAE.Port &&u.CallingAE==addOrEditTrialSiteDicomAE.CallingAE && u.TrialId == addOrEditTrialSiteDicomAE.TrialId,
|
||||
|
||||
VerifyMsg = "不允许添加相同的IP和端口的记录"
|
||||
};
|
||||
|
||||
|
||||
var entity = await _trialSiteDicomAERepository.InsertOrUpdateAsync(addOrEditTrialSiteDicomAE, true, verifyExp1);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete("{trialSiteDicomAEId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteTrialSiteDicomAE(Guid trialSiteDicomAEId)
|
||||
{
|
||||
var success = await _trialSiteDicomAERepository.DeleteFromQueryAsync(t => t.Id == trialSiteDicomAEId, true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,8 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(d => d.UserCount, u => u.MapFrom(s => s.CRCUserList.Count()))
|
||||
.ForMember(d => d.VisitCount, u => u.MapFrom(s => s.SubjectVisitList.Count()))
|
||||
.ForMember(d => d.SubjectCount, u => u.MapFrom(s => s.SubjectList.Count()))
|
||||
.ForMember(d => d.UserNameList, u => u.MapFrom(s => s.CRCUserList.Where(t => t.IsDeleted == false).Select(u => u.User.FullName)));
|
||||
.ForMember(d => d.UserNameList, u => u.MapFrom(s => s.CRCUserList.Where(t => t.IsDeleted == false).Select(u => u.User.FullName)))
|
||||
.ForMember(d => d.CallingAEList, u => u.MapFrom(s => s.TrialSiteDicomAEList.Select(u => u.CallingAE)));
|
||||
//CreateMap<Site, SiteStatSimpleDTO>();
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,11 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
CreateMap<AddOrUpdateTrialBodyPartCommand, TrialBodyPart>();
|
||||
|
||||
|
||||
|
||||
CreateMap<TrialSiteDicomAE, TrialSiteDicomAEView>();
|
||||
CreateMap<TrialSiteDicomAE, TrialSiteDicomAEAddOrEdit>().ReverseMap();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,374 @@
|
||||
using IRaCIS.Application.Interfaces;
|
||||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using IRaCIS.Core.Application.Auth;
|
||||
using MassTransit;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using AutoMapper.EntityFrameworkCore;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Application.Service.Reading.Dto;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Configuration.Json;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SharpCompress.Common;
|
||||
using System.Reactive.Subjects;
|
||||
using Subject = IRaCIS.Core.Domain.Models.Subject;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using Medallion.Threading;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using EasyCaching.Core;
|
||||
using Pipelines.Sockets.Unofficial.Arenas;
|
||||
using IRaCIS.Core.Application.Contracts;
|
||||
using MailKit.Search;
|
||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||
using IRaCIS.Core.Application.Contracts.Dicom.DTO;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System.Linq;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using System.Text;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using Azure;
|
||||
using System.IO.Compression;
|
||||
using static IRaCIS.Core.Domain.Share.StaticData;
|
||||
using FellowOakDicom;
|
||||
using DocumentFormat.OpenXml.Office2010.Drawing;
|
||||
using EasyCaching.Core.DistributedLock;
|
||||
using IDistributedLockProvider = Medallion.Threading.IDistributedLockProvider;
|
||||
using DocumentFormat.OpenXml.InkML;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
[ApiExplorerSettings(GroupName = "Trial")]
|
||||
public class PatientService : BaseService
|
||||
{
|
||||
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
private readonly IRepository<SCPPatient> _patientRepository;
|
||||
private readonly IRepository<SCPStudy> _scpStudyRepository;
|
||||
private readonly IRepository<Subject> _subjectRepository;
|
||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
private readonly IDistributedLockProvider _distributedLockProvider;
|
||||
|
||||
public PatientService(IRepository<SCPStudy> studyRepository, IRepository<Trial> trialRepository, IRepository<SCPPatient> patientRepository, IRepository<Subject> subjectRepository, IRepository<SubjectVisit> subjectVisitRepository, IDistributedLockProvider distributedLockProvider)
|
||||
{
|
||||
_scpStudyRepository = studyRepository;
|
||||
_trialRepository = trialRepository;
|
||||
_patientRepository = patientRepository;
|
||||
_subjectRepository = subjectRepository;
|
||||
_subjectVisitRepository = subjectVisitRepository;
|
||||
_distributedLockProvider = distributedLockProvider;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// scp 影像推送记录表
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput<PageOutput<SCPImageUploadView>>> GetSCPImageUploadList(SCPImageUploadQuery inQuery)
|
||||
{
|
||||
var query = _repository.Where<SCPImageUpload>()
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.CalledAE), t => t.CalledAE.Contains(inQuery.CalledAE))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.CallingAEIP), t => t.CallingAEIP.Contains(inQuery.CallingAEIP))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.CallingAE), t => t.CallingAE.Contains(inQuery.CallingAE))
|
||||
.WhereIf(inQuery.StartTime != null, t => t.StartTime >= inQuery.StartTime)
|
||||
.WhereIf(inQuery.EndTime != null, t => t.EndTime <= inQuery.EndTime)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteKeyInfo), t => t.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteKeyInfo)
|
||||
|| t.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteKeyInfo) || t.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteKeyInfo))
|
||||
.ProjectTo<SCPImageUploadView>(_mapper.ConfigurationProvider);
|
||||
|
||||
|
||||
var pageList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? nameof(SCPImageUploadView.CallingAE) : inQuery.SortField, inQuery.Asc);
|
||||
|
||||
|
||||
return ResponseOutput.Ok(pageList);
|
||||
}
|
||||
|
||||
|
||||
#region 患者检查管理
|
||||
|
||||
/// <summary>
|
||||
///影像检查列表-患者为维度组织
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput<PageOutput<PatientSubjectView>>> GetPatientList(PatientTrialQuery inQuery)
|
||||
{
|
||||
|
||||
|
||||
#region new ok
|
||||
var query = _patientRepository
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.PatientIdStr), t => t.PatientIdStr.Contains(inQuery.PatientIdStr))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.PatientName), t => t.PatientName.Contains(inQuery.PatientName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.SubejctCode), t => t.Subject.Code.Contains(inQuery.SubejctCode))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialSiteKeyInfo), t => t.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteKeyInfo)
|
||||
|| t.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteKeyInfo)|| t.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteKeyInfo))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.CallingAE), t => t.SCPStudyList.Any(t => t.CallingAE == inQuery.CallingAE))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.CalledAE), t => t.SCPStudyList.Any(t => t.CalledAE == inQuery.CalledAE))
|
||||
.WhereIf(inQuery.BeginPushTime != null, t => t.LatestPushTime >= inQuery.BeginPushTime)
|
||||
.WhereIf(inQuery.EndPushTime != null, t => t.LatestPushTime <= inQuery.EndPushTime);
|
||||
|
||||
//foreach (var calledAE in inQuery.CalledAEList)
|
||||
//{
|
||||
// query = query.Where(t => t.SCPStudyList.Select(c => c.CalledAE).Contains(calledAE));
|
||||
//}
|
||||
|
||||
|
||||
var resultQuery = from patient in query
|
||||
|
||||
select new PatientSubjectView()
|
||||
{
|
||||
PatientId = patient.Id,
|
||||
PatientBirthDate = patient.PatientBirthDate,
|
||||
CreateTime = patient.CreateTime,
|
||||
CalledAEList = patient.SCPStudyList.Select(t => t.CalledAE).Distinct().ToList(),
|
||||
CallingAEList = patient.SCPStudyList.Select(t => t.CallingAE).Distinct().ToList(),
|
||||
CreateUserId = patient.CreateUserId,
|
||||
UpdateTime = patient.UpdateTime,
|
||||
UpdateUserId = patient.UpdateUserId,
|
||||
|
||||
EarliestStudyTime = patient.EarliestStudyTime,
|
||||
LatestStudyTime = patient.LatestStudyTime,
|
||||
LatestPushTime = patient.LatestPushTime,
|
||||
PatientAge = patient.PatientAge,
|
||||
PatientName = patient.PatientName,
|
||||
PatientIdStr = patient.PatientIdStr,
|
||||
PatientSex = patient.PatientSex,
|
||||
|
||||
StudyCount = patient.SCPStudyList.Count(),
|
||||
|
||||
TrialId=patient.TrialId,
|
||||
SubejctId=patient.SubjectId,
|
||||
SubjectCode=patient.Subject.Code,
|
||||
TrialSiteAliasName=patient.TrialSite.TrialSiteAliasName,
|
||||
TrialSiteCode=patient.TrialSite.TrialSiteCode,
|
||||
TrialSiteName=patient.TrialSite.TrialSiteName
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
var pageList = await resultQuery.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? nameof(PatientQueryView.PatientIdStr) : inQuery.SortField, inQuery.Asc);
|
||||
#endregion
|
||||
|
||||
|
||||
return ResponseOutput.Ok(pageList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 影像检查列表-> 获取患者的检查列表
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<PatientStudySimpleView>> GetPatientStudyList(PatientStudyInfoQuery inQuery)
|
||||
{
|
||||
var query = from scpStudy in _scpStudyRepository.Where(t => t.PatientId == inQuery.PatientId)
|
||||
.WhereIf(inQuery.EarliestStudyTime != null, t => t.StudyTime >= inQuery.EarliestStudyTime)
|
||||
.WhereIf(inQuery.LatestStudyTime != null, t => t.StudyTime <= inQuery.LatestStudyTime)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Modalities), t => t.Modalities.Contains(inQuery.Modalities))
|
||||
select new PatientStudySimpleView()
|
||||
{
|
||||
Description = scpStudy.Description,
|
||||
CalledAE = scpStudy.CalledAE,
|
||||
CallingAE = scpStudy.CallingAE,
|
||||
InstanceCount = scpStudy.InstanceCount,
|
||||
Modalities = scpStudy.Modalities,
|
||||
PatientId = scpStudy.PatientId,
|
||||
SCPStudyId = scpStudy.Id,
|
||||
SeriesCount = scpStudy.SeriesCount,
|
||||
StudyTime = scpStudy.StudyTime,
|
||||
|
||||
SubjectVisitId= scpStudy.SubjectVisitId,
|
||||
VisitName=scpStudy.SubjectVisit.VisitName,
|
||||
BlindName=scpStudy.SubjectVisit.BlindName
|
||||
};
|
||||
|
||||
|
||||
//var sortField = string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(PatientStudySimpleView.StudyTime) : inQuery.SortField;
|
||||
//var orderQuery = inQuery.Asc ? query.OrderBy(sortField) : query.OrderBy(sortField + " desc");
|
||||
|
||||
//var list = await orderQuery.ToListAsync();
|
||||
|
||||
var pageList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? nameof(PatientStudySimpleView.StudyTime) : inQuery.SortField, inQuery.Asc);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<string>> GetDicomCalledAEList()
|
||||
{
|
||||
var list = await _scpStudyRepository.Select(t => t.CalledAE).Distinct().ToListAsync();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetDicomCallingAEList()
|
||||
{
|
||||
var list = await _scpStudyRepository.Select(t => t.CallingAE).Distinct().ToListAsync();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 影像访视上传 检查列表
|
||||
/// </summary>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<VisitPatientStudyFilterView>> GetVisitPatientStudyFilterList(VisitPatientStudyFilterQuery inQuery)
|
||||
{
|
||||
|
||||
var trialSiteId=_subjectRepository.Where(t=>t.Id==inQuery.SubjectId).Select(t=>t.TrialSiteId).FirstOrDefault();
|
||||
|
||||
var query = from scpStudy in _scpStudyRepository
|
||||
//未绑定的患者,或者自己已绑定但是未绑定访视的
|
||||
.Where(t => t.Patient.SubjectId == null|| (t.Patient.SubjectId == inQuery.SubjectId && t.SubjectVisitId==null))
|
||||
//中心
|
||||
.Where(t=>t.TrialSiteId==trialSiteId)
|
||||
.WhereIf(inQuery.EarliestStudyTime != null, t => t.StudyTime >= inQuery.EarliestStudyTime)
|
||||
.WhereIf(inQuery.LatestStudyTime != null, t => t.StudyTime <= inQuery.LatestStudyTime)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Modalities), t => t.Modalities.Contains(inQuery.Modalities))
|
||||
select new VisitPatientStudyFilterView()
|
||||
{
|
||||
Description = scpStudy.Description,
|
||||
CalledAE = scpStudy.CalledAE,
|
||||
CallingAE = scpStudy.CallingAE,
|
||||
InstanceCount = scpStudy.InstanceCount,
|
||||
Modalities = scpStudy.Modalities,
|
||||
PatientId = scpStudy.PatientId,
|
||||
SCPStudyId = scpStudy.Id,
|
||||
SeriesCount = scpStudy.SeriesCount,
|
||||
StudyTime = scpStudy.StudyTime,
|
||||
};
|
||||
|
||||
|
||||
var pageList = await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, inQuery.SortField == string.Empty ? nameof(PatientStudySimpleView.StudyTime) : inQuery.SortField, inQuery.Asc);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 提交 患者检查和访视的绑定
|
||||
/// </summary>
|
||||
/// <param name="inCommand"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[UnitOfWork]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput> SubmitVisitStudyBinding(SubmitVisitStudyBindingCommand inCommand)
|
||||
{
|
||||
|
||||
var subjectId = inCommand.SubjectId;
|
||||
var subjectVisitId=inCommand.SubjectVisitId;
|
||||
var trialId = inCommand.TrialId;
|
||||
|
||||
|
||||
|
||||
var @lock = _distributedLockProvider.CreateLock($"StudyCode");
|
||||
|
||||
using (await @lock.AcquireAsync())
|
||||
{
|
||||
var dbStudyCodeIntMax = _repository.Where<DicomStudy>(s => s.TrialId == inCommand.TrialId).Select(t => t.Code).DefaultIfEmpty().Max();
|
||||
|
||||
int currentNextCodeInt = dbStudyCodeIntMax + 1;
|
||||
|
||||
foreach (var scpStudyId in inCommand.SCPStudyIdList)
|
||||
{
|
||||
|
||||
var find = _scpStudyRepository.Where(t => t.Id == scpStudyId).Include(t => t.SeriesList).Include(t => t.InstanceList).FirstOrDefault();
|
||||
|
||||
if (find != null)
|
||||
{
|
||||
|
||||
var newStuty = _mapper.Map<DicomStudy>(find);
|
||||
|
||||
await _repository.AddAsync(newStuty);
|
||||
|
||||
newStuty.SeqId = Guid.Empty;
|
||||
newStuty.Code = currentNextCodeInt;
|
||||
newStuty.StudyCode = AppSettings.GetCodeStr(currentNextCodeInt, nameof(DicomStudy));
|
||||
newStuty.IsFromPACS = true;
|
||||
newStuty.TrialId = trialId;
|
||||
newStuty.SubjectId = subjectId;
|
||||
newStuty.SubjectVisitId = subjectVisitId;
|
||||
|
||||
var newSeriesList = _mapper.Map<List<DicomSeries>>(find.SeriesList);
|
||||
|
||||
foreach (var series in newSeriesList)
|
||||
{
|
||||
|
||||
series.SeqId = Guid.Empty;
|
||||
series.TrialId = trialId;
|
||||
series.SubjectId = subjectId;
|
||||
series.SubjectVisitId = subjectVisitId;
|
||||
}
|
||||
|
||||
await _repository.AddRangeAsync(newSeriesList);
|
||||
|
||||
var newInstanceList = _mapper.Map<List<DicomInstance>>(find.InstanceList);
|
||||
|
||||
foreach (var instance in newInstanceList)
|
||||
{
|
||||
|
||||
|
||||
instance.SeqId = Guid.Empty;
|
||||
instance.TrialId = trialId;
|
||||
instance.SubjectId = subjectId;
|
||||
instance.SubjectVisitId = subjectVisitId;
|
||||
|
||||
}
|
||||
await _repository.AddRangeAsync(newInstanceList);
|
||||
}
|
||||
|
||||
currentNextCodeInt++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -112,6 +112,14 @@ namespace IRaCIS.Core.Application.Service
|
||||
.ForMember(d => d.InstanceInfoList, u => u.MapFrom(s => s.InstanceList));
|
||||
|
||||
CreateMap<TaskInstance, InstanceBasicInfo>();
|
||||
|
||||
|
||||
CreateMap<SCPImageUpload, SCPImageUploadView>()
|
||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode))
|
||||
.ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.TrialSite.TrialSiteAliasName))
|
||||
.ForMember(d => d.TrialSiteName, u => u.MapFrom(s => s.TrialSite.TrialSiteName))
|
||||
;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user