From 9741b7a43888c0de5975b72f6aa03cce786d1553 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Sun, 24 Apr 2022 09:23:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StudyController.cs | 5 ++- .../Service/Common/DictionaryService.cs | 44 ++++++++++++++++--- .../Common/Interface/IDictionaryService.cs | 26 ++++++++++- .../ImageAndDoc/DTO/DicomInstanceModel.cs | 2 + .../Service/QC/NoneDicomStudyService.cs | 8 +++- .../Service/QC/QCOperationService.cs | 11 ++++- 6 files changed, 85 insertions(+), 11 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/StudyController.cs b/IRaCIS.Core.API/Controllers/StudyController.cs index 90f799171..27ddf487d 100644 --- a/IRaCIS.Core.API/Controllers/StudyController.cs +++ b/IRaCIS.Core.API/Controllers/StudyController.cs @@ -35,6 +35,7 @@ namespace IRaCIS.Api.Controllers private readonly IStudyService _studyService; private readonly IDicomArchiveService _dicomArchiveService; private readonly ILogger _logger; + private readonly IDictionaryService _dictionaryService; private readonly IInspectionService _inspectionService; private IEasyCachingProvider _provider; private IUserInfo _userInfo; @@ -44,6 +45,7 @@ namespace IRaCIS.Api.Controllers public StudyController(IStudyService studyService, IDicomArchiveService dicomArchiveService, ILogger logger, + IDictionaryService dictionaryService, IInspectionService inspectionService, IEasyCachingProvider provider, IUserInfo userInfo ) @@ -53,6 +55,7 @@ namespace IRaCIS.Api.Controllers _studyService = studyService; _dicomArchiveService = dicomArchiveService; _logger = logger; + this._dictionaryService = dictionaryService; this._inspectionService = inspectionService; } @@ -237,7 +240,7 @@ namespace IRaCIS.Api.Controllers Identification = "Edit|Visit|Status|Visit-Image Upload|Add Image", JsonDetail = JsonConvert.SerializeObject(new { - SubmitState = "待提交", + SubmitState = await _dictionaryService.GetBasicDataTranslateItem("SubmitState", savedInfo.SubmitState), }) }); diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs index 1881ebd74..75226646d 100644 --- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs @@ -2,6 +2,7 @@ using IRaCIS.Application.Contracts; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Domain.Share; namespace IRaCIS.Application.Services { @@ -134,12 +135,45 @@ namespace IRaCIS.Application.Services return searchList; } - - public async Task GetBasicDataTranslateItem(string parentCode, string childCode) + /// + /// 获取是和否 + /// + /// + /// + public async Task GetBoolValueState(bool value) { - return (await _dicRepository.Where(t => t.Parent.Code == parentCode && t.Code == childCode) - .ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync()) - .IfNullThrowConvertException(); + return await _dicRepository.Where(t => t.Parent.Code == "YesOrNo" && t.Code == value.ToString()).Select(x => x.ValueCN).FirstOrDefaultAsync() ?? string.Empty; + } + + + /// + /// 获取审核状态 + /// + /// + /// + /// + /// + public async Task GetAuditState(Guid trial, T childCode) + { + var QCProcessEnum = _trialRepository.Where(x=>x.Id==trial).Select(x => x.QCProcessEnum).FirstOrDefault(); + switch (QCProcessEnum) + { + + + case TrialQCProcess.SingleAudit: + return await _dicRepository.Where(t => t.Parent.Code == "AuditStatePE" && t.Code == Convert.ToInt32(childCode).ToString()).Select(x => x.ValueCN).FirstOrDefaultAsync() ?? string.Empty; + + case TrialQCProcess.DoubleAudit: + return await _dicRepository.Where(t => t.Parent.Code == "AuditStateRC" && t.Code == Convert.ToInt32(childCode).ToString()).Select(x => x.ValueCN).FirstOrDefaultAsync() ?? string.Empty; + default: + return string.Empty; + + } + } + + public async Task GetBasicDataTranslateItem(string parentCode, T childCode) + { + return await _dicRepository.Where(t => t.Parent.Code == parentCode && t.Code == Convert.ToInt32(childCode).ToString() ).Select(x => x.ValueCN).FirstOrDefaultAsync()??string.Empty; } /// diff --git a/IRaCIS.Core.Application/Service/Common/Interface/IDictionaryService.cs b/IRaCIS.Core.Application/Service/Common/Interface/IDictionaryService.cs index 40d8534a9..230c729cd 100644 --- a/IRaCIS.Core.Application/Service/Common/Interface/IDictionaryService.cs +++ b/IRaCIS.Core.Application/Service/Common/Interface/IDictionaryService.cs @@ -8,7 +8,31 @@ namespace IRaCIS.Application.Interfaces { public interface IDictionaryService { + /// + /// 获取是和否 + /// + /// + /// + Task GetBoolValueState(bool value); + + /// + /// 获取审核状态 + /// + /// + /// + /// + /// + Task GetAuditState(Guid trial, T childCode); + + /// + /// 获取枚举翻译 + /// + /// + /// + /// + /// + Task GetBasicDataTranslateItem(string parentCode, T childCode); + - } } diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DicomInstanceModel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DicomInstanceModel.cs index a3bb260aa..e823f20f4 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DicomInstanceModel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/DicomInstanceModel.cs @@ -53,6 +53,8 @@ namespace IRaCIS.Core.Application.Contracts public Guid SubjectId { get; set; } public Guid SubjectVisitId { get; set; } + public SubmitStateEnum SubmitState { get; set; } + //public string SubjectName => LastName + " / " + FirstName; //public string FirstName { get; set; } = string.Empty; //public string LastName { get; set; } = string.Empty; diff --git a/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs b/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs index d02b14bd2..f7263e055 100644 --- a/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs +++ b/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs @@ -13,6 +13,7 @@ using Newtonsoft.Json; using IRaCIS.Core.Application.Service.Inspection.Interface; using IRaCIS.Core.Application.Service.Inspection.DTO; using Nito.AsyncEx; +using IRaCIS.Application.Interfaces; namespace IRaCIS.Core.Application.Contracts { @@ -25,6 +26,7 @@ namespace IRaCIS.Core.Application.Contracts private readonly IRepository _noneDicomStudyRepository; private readonly IHttpContextAccessor _httpContext; private readonly IWebHostEnvironment _hostEnvironment; + private readonly IDictionaryService _dictionaryService; private readonly IInspectionService _inspectionService; private readonly IRepository _noneDicomStudyFileRepository; @@ -35,6 +37,7 @@ namespace IRaCIS.Core.Application.Contracts public NoneDicomStudyService(IRepository noneDicomStudyRepository, IHttpContextAccessor httpContext, IWebHostEnvironment hostEnvironment, + IDictionaryService dictionaryService, IInspectionService inspectionService, IRepository noneDicomStudyFileRepository) { @@ -42,6 +45,7 @@ namespace IRaCIS.Core.Application.Contracts this._httpContext = httpContext; this._hostEnvironment = hostEnvironment; + this._dictionaryService = dictionaryService; this._inspectionService = inspectionService; _noneDicomStudyFileRepository = noneDicomStudyFileRepository; } @@ -139,7 +143,7 @@ namespace IRaCIS.Core.Application.Contracts Identification = "Edit|Visit|Status|Visit-Image Upload|Add Image", JsonDetail = JsonConvert.SerializeObject(new { - SubmitState = "待提交", + SubmitState = await _dictionaryService.GetBasicDataTranslateItem("SubmitState", subvisit.SubmitState), }) }); @@ -193,7 +197,7 @@ namespace IRaCIS.Core.Application.Contracts Identification = "Edit|Visit|Status|Visit-Image Upload|Add Image", JsonDetail = JsonConvert.SerializeObject(new { - SubmitState = "待提交", + SubmitState = await _dictionaryService.GetBasicDataTranslateItem("SubmitState", subvisit.SubmitState), }) }); diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index f58a426c2..341054aa0 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -21,6 +21,7 @@ using IRaCIS.Core.Application.Service.Inspection.Interface; using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Application.Service.Inspection.DTO; using Nito.AsyncEx; +using IRaCIS.Application.Interfaces; namespace IRaCIS.Core.Application.Image.QA { @@ -31,9 +32,11 @@ namespace IRaCIS.Core.Application.Image.QA private readonly DicomFileStoreHelper _dicomFileStoreHelper; private readonly IRepository _subjectVisitRepository; private readonly IRepository _dicomStudyRepository; + private readonly IRepository _dictionaryrepository; private readonly IRepository _trialRepository; private readonly IMediator _mediator; private readonly IInspectionService _inspectionService; + private readonly IDictionaryService _dictionaryService; private object _locker = new object(); private readonly AsyncLock _mutex = new AsyncLock(); @@ -42,15 +45,19 @@ namespace IRaCIS.Core.Application.Image.QA IRepository trialRepository, IMediator mediator, IInspectionService inspectionService, - IRepository dicomStudyRepository + IDictionaryService dictionaryService, + IRepository dicomStudyRepository, + IRepository dictionaryrepository ) { _dicomFileStoreHelper = dicomFileStoreHelper; _subjectVisitRepository = subjectVisitRepository; _dicomStudyRepository = dicomStudyRepository; + this._dictionaryrepository = dictionaryrepository; _mediator = mediator; _trialRepository = trialRepository; _inspectionService = inspectionService; + this._dictionaryService = dictionaryService; } #region QC质疑 以及回复 关闭 @@ -1046,7 +1053,7 @@ namespace IRaCIS.Core.Application.Image.QA Identification = "Edit|Visit|Status|Visit-Image Upload|Add Image", JsonDetail = JsonConvert.SerializeObject(new { - SubmitState = "待提交", + SubmitState = await _dictionaryService.GetBasicDataTranslateItem("SubmitState", subvisit.SubmitState), }) }); await _inspectionService.AddListInspectionRecordAsync(datas);