7 changed files with 266 additions and 7 deletions
-
24src/Shentun.Peis.Application.Contracts/PacsBusiness/ImportRegisterCheckPictureByCheckRequestNoInputDto.cs
-
3src/Shentun.Peis.Application.Contracts/SumSummaryReports/SumSummaryReportHorizontalComparisonDto.cs
-
2src/Shentun.Peis.Application/MenuInfos/MenuInfoAppService.cs
-
128src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs
-
22src/Shentun.Peis.Application/RegisterCheckAsbitems/RegisterCheckAsbitemAppService.cs
-
1src/Shentun.Peis.Application/RegisterCheckPictures/RegisterCheckPictureAppService.cs
-
93src/Shentun.Peis.Application/SumSummaryReports/SumSummaryReportAppService.cs
@ -0,0 +1,24 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.PacsBusiness |
|||
{ |
|||
public class ImportRegisterCheckPictureByCheckRequestNoInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 检查单号
|
|||
/// </summary>
|
|||
public string CheckRequestNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 文件名称
|
|||
/// </summary>
|
|||
public string FileName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 图片base64
|
|||
/// </summary>
|
|||
public string PictureBaseStr { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,128 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Shentun.Peis.Enums; |
|||
using Shentun.Peis.Models; |
|||
using Shentun.Peis.RegisterCheckPictures; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Shentun.Peis.PacsBusiness |
|||
{ |
|||
/// <summary>
|
|||
/// pacs相关接口
|
|||
/// </summary>
|
|||
[ApiExplorerSettings(GroupName = "Work")] |
|||
public class PacsBusinessAppService : ApplicationService |
|||
{ |
|||
|
|||
private readonly IConfiguration _configuration; |
|||
private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository; |
|||
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; |
|||
private readonly IRepository<RegisterCheckPicture, Guid> _registerCheckPictureRepository; |
|||
|
|||
public PacsBusinessAppService( |
|||
IConfiguration configuration, |
|||
IRepository<RegisterCheck, Guid> registerCheckRepository, |
|||
IRepository<PatientRegister, Guid> patientRegisterRepository, |
|||
IRepository<RegisterCheckPicture, Guid> registerCheckPictureRepository) |
|||
{ |
|||
_configuration = configuration; |
|||
_registerCheckRepository = registerCheckRepository; |
|||
_patientRegisterRepository = patientRegisterRepository; |
|||
_registerCheckPictureRepository = registerCheckPictureRepository; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 导入心电图图片 根据检查单号 免登录
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="UserFriendlyException"></exception>
|
|||
[HttpPost("api/app/PacsBusiness/ImportRegisterCheckPictureByCheckRequestNo")] |
|||
public async Task ImportRegisterCheckPictureByCheckRequestNoAsync(ImportRegisterCheckPictureByCheckRequestNoInputDto input) |
|||
{ |
|||
Random rd = new Random(); |
|||
|
|||
string AbsolutePath = _configuration.GetValue<string>("PacsVirtualPath:RealPath"); |
|||
string AbsoluteName = _configuration.GetValue<string>("PacsVirtualPath:Alias"); |
|||
|
|||
|
|||
|
|||
if (string.IsNullOrWhiteSpace(input.PictureBaseStr)) |
|||
{ |
|||
throw new UserFriendlyException("图片数据不存在"); |
|||
} |
|||
|
|||
string PatientRegisterId = ""; |
|||
|
|||
var patientRegisterCompleteFlag = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync() |
|||
join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId |
|||
where registerCheck.CheckRequestNo == input.CheckRequestNo |
|||
select new |
|||
{ |
|||
registerCheckId = registerCheck.Id, |
|||
CompleteFlag = patientRegister.CompleteFlag |
|||
}).ToList(); |
|||
|
|||
if (patientRegisterCompleteFlag.Count == 0) |
|||
throw new UserFriendlyException("体检人员不存在"); |
|||
|
|||
if (patientRegisterCompleteFlag.FirstOrDefault().CompleteFlag == PatientRegisterCompleteFlag.PreRegistration) |
|||
throw new UserFriendlyException("预登记人员不能导入图片"); |
|||
if (patientRegisterCompleteFlag.FirstOrDefault().CompleteFlag == PatientRegisterCompleteFlag.SumCheck) |
|||
throw new UserFriendlyException("已总检人员不能导入图片"); |
|||
|
|||
|
|||
Guid registerCheckId = patientRegisterCompleteFlag.FirstOrDefault().registerCheckId; |
|||
|
|||
|
|||
|
|||
string PictureUrl = ImageHelper.Base64StrToImageInAbsolutePath(AbsolutePath, input.FileName, input.PictureBaseStr, |
|||
PatientRegisterId, |
|||
registerCheckId.ToString(), AbsoluteName); |
|||
|
|||
if (string.IsNullOrEmpty(PictureUrl)) |
|||
{ |
|||
throw new UserFriendlyException("图片数据有误"); |
|||
} |
|||
|
|||
var ent = await _registerCheckPictureRepository.FirstOrDefaultAsync(m => m.RegisterCheckId == registerCheckId |
|||
&& m.PictureFilename == PictureUrl); |
|||
|
|||
if (ent != null) |
|||
{ |
|||
ent.PictureFilename = PictureUrl; |
|||
|
|||
await _registerCheckPictureRepository.UpdateAsync(ent); |
|||
} |
|||
else |
|||
{ |
|||
var maxDisplayOrder = (await _registerCheckPictureRepository.GetQueryableAsync()) |
|||
.Where(m => m.RegisterCheckId == registerCheckId) |
|||
.OrderByDescending(o => o.DisplayOrder) |
|||
.Select(s => s.DisplayOrder) |
|||
.FirstOrDefault(); |
|||
|
|||
ent = new RegisterCheckPicture |
|||
{ |
|||
DisplayOrder = maxDisplayOrder + 1, |
|||
IsPrint = 'Y', |
|||
PictureFilename = PictureUrl, |
|||
RegisterCheckId = registerCheckId, |
|||
PictureFileType = '0', |
|||
LocalPathName = "" |
|||
}; |
|||
|
|||
await _registerCheckPictureRepository.InsertAsync(ent); |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue