18 changed files with 493 additions and 79 deletions
-
14src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs
-
19src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionRequestDto.cs
-
23src/Shentun.Peis.Application.Contracts/SuggestionDtos/SuggestionDto.cs
-
17src/Shentun.Peis.Application.Contracts/SumDiagnosises/GetSumDiagnosisListInPatientRegisterIdDto.cs
-
27src/Shentun.Peis.Application.Contracts/SumDiagnosises/SumDiagnosisDto.cs
-
2src/Shentun.Peis.Application.Contracts/SumSuggestionHeaders/CreateSumSuggestionHeaderOrContentDto.cs
-
7src/Shentun.Peis.Application.Contracts/SumSuggestionHeaders/SumSuggestionHeaderOrContentDto.cs
-
180src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs
-
46src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs
-
17src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
-
63src/Shentun.Peis.Application/SumDiagnosises/SumDiagnosisAppService.cs
-
24src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs
-
25src/Shentun.Peis.Domain/ImageHelper.cs
-
84src/Shentun.Peis.HttpApi.Host/Filter/ErrorHandlingMiddleware.cs
-
8src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs
-
BINsrc/Shentun.Peis.HttpApi.Host/UpLoad/3a0d9430-4a1f-e05d-7ef6-a34cca06519f.jpg
-
BINsrc/Shentun.Peis.HttpApi.Host/UpLoad/3a0d9430-4a1f-e05d-7ef6-a34cca06519f.png
@ -0,0 +1,14 @@ |
|||||
|
using Shentun.Peis.SuggestionDtos; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.Diagnosises |
||||
|
{ |
||||
|
public class DiagnosisInSuggestionDto:DiagnosisDto |
||||
|
{ |
||||
|
public List<SuggestionDto> Suggestions { get; set; } |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.Diagnosises |
||||
|
{ |
||||
|
public class DiagnosisInSuggestionRequestDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 诊断名称
|
||||
|
/// </summary>
|
||||
|
public string? DiagnosisName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 项目类别
|
||||
|
/// </summary>
|
||||
|
public Guid? ItemTypeId { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.SuggestionDtos |
||||
|
{ |
||||
|
public class SuggestionDto: AuditedEntityDtoName |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 诊断ID
|
||||
|
/// </summary>
|
||||
|
public Guid DiagnosisId { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 建议内容
|
||||
|
/// </summary>
|
||||
|
public string SuggestionContent { get; set; } = null!; |
||||
|
|
||||
|
public int DisplayOrder { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.SumDiagnosises |
||||
|
{ |
||||
|
public class GetSumDiagnosisListInPatientRegisterIdDto: SumDiagnosisDto |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 诊断名称
|
||||
|
/// </summary>
|
||||
|
public string DiagnosisName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.SumDiagnosises |
||||
|
{ |
||||
|
public class SumDiagnosisDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 病人登记ID
|
||||
|
/// </summary>
|
||||
|
public Guid PatientRegisterId { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 诊断ID
|
||||
|
/// </summary>
|
||||
|
[Key] |
||||
|
public Guid DiagnosisId { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 建议头ID
|
||||
|
/// </summary>
|
||||
|
public Guid SumSuggestionHeaderId { get; set; } |
||||
|
|
||||
|
public int DisplayOrder { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,63 @@ |
|||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Shentun.Peis.Models; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace Shentun.Peis.SumDiagnosises |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 总检诊断
|
||||
|
/// </summary>
|
||||
|
[ApiExplorerSettings(GroupName = "Work")] |
||||
|
[Authorize] |
||||
|
public class SumDiagnosisAppService : ApplicationService |
||||
|
{ |
||||
|
private readonly IRepository<Diagnosis, Guid> _diagnosisRepository; |
||||
|
private readonly IRepository<SumDiagnosis> _sumDiagnosisRepository; |
||||
|
|
||||
|
public SumDiagnosisAppService( |
||||
|
IRepository<Diagnosis, Guid> diagnosisRepository, |
||||
|
IRepository<SumDiagnosis> sumDiagnosisRepository |
||||
|
) |
||||
|
{ |
||||
|
this._diagnosisRepository = diagnosisRepository; |
||||
|
this._sumDiagnosisRepository = sumDiagnosisRepository; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 总检诊断列表查询接口
|
||||
|
/// </summary>
|
||||
|
/// <param name="PatientRegisterId">体检人员ID</param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpGet("api/app/sumdiagnosis/getsumdiagnosislistinpatientregisterid")] |
||||
|
public async Task<List<GetSumDiagnosisListInPatientRegisterIdDto>> GetSumDiagnosisListInPatientRegisterIdAsync(Guid PatientRegisterId) |
||||
|
{ |
||||
|
var query = from a in await _sumDiagnosisRepository.GetQueryableAsync() |
||||
|
join b in await _diagnosisRepository.GetQueryableAsync() on a.DiagnosisId equals b.Id into bb |
||||
|
from ab in bb.DefaultIfEmpty() |
||||
|
where (a.PatientRegisterId == PatientRegisterId) |
||||
|
select new |
||||
|
{ |
||||
|
a, |
||||
|
DiagnosisName = ab.DisplayName |
||||
|
}; |
||||
|
|
||||
|
var entlist = query.Select(s => new GetSumDiagnosisListInPatientRegisterIdDto |
||||
|
{ |
||||
|
DiagnosisName = s.DiagnosisName, |
||||
|
DiagnosisId = s.a.DiagnosisId, |
||||
|
DisplayOrder = s.a.DisplayOrder, |
||||
|
PatientRegisterId = s.a.PatientRegisterId, |
||||
|
SumSuggestionHeaderId = s.a.SumSuggestionHeaderId |
||||
|
}).OrderBy(o => o.DisplayOrder).ToList(); |
||||
|
|
||||
|
return entlist; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,84 @@ |
|||||
|
using Microsoft.AspNetCore.Builder; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Newtonsoft.Json; |
||||
|
using Shentun.WebApi.Service; |
||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using TencentCloud.Bpaas.V20181217.Models; |
||||
|
|
||||
|
namespace Shentun.Peis.Filter |
||||
|
{ |
||||
|
public class ErrorHandlingMiddleware |
||||
|
{ |
||||
|
private readonly RequestDelegate next; |
||||
|
|
||||
|
public ErrorHandlingMiddleware(RequestDelegate next) |
||||
|
{ |
||||
|
this.next = next; |
||||
|
} |
||||
|
|
||||
|
public async Task Invoke(HttpContext context) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
await next(context); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
var statusCode = context.Response.StatusCode; |
||||
|
if (ex is ArgumentException) |
||||
|
{ |
||||
|
statusCode = 200; |
||||
|
} |
||||
|
await HandleExceptionAsync(context, statusCode, ex.Message); |
||||
|
} |
||||
|
finally |
||||
|
{ |
||||
|
var statusCode = context.Response.StatusCode; |
||||
|
var msg = ""; |
||||
|
if (statusCode == 401) |
||||
|
{ |
||||
|
msg = "未授权"; |
||||
|
} |
||||
|
else if (statusCode == 404) |
||||
|
{ |
||||
|
msg = "未找到服务"; |
||||
|
} |
||||
|
|
||||
|
else if (statusCode == 400) |
||||
|
{ |
||||
|
msg = "Token失效"; |
||||
|
} |
||||
|
else if (statusCode == 502) |
||||
|
{ |
||||
|
msg = "请求错误"; |
||||
|
} |
||||
|
//else if (statusCode != 200)
|
||||
|
//{
|
||||
|
// msg = "未知错误";
|
||||
|
//}
|
||||
|
if (!string.IsNullOrWhiteSpace(msg)) |
||||
|
{ |
||||
|
await HandleExceptionAsync(context, statusCode, msg); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
//异常错误信息捕获,将错误信息用Json方式返回
|
||||
|
private static Task HandleExceptionAsync(HttpContext context, int statusCode, string msg) |
||||
|
{ |
||||
|
var result = JsonConvert.SerializeObject(ReturnValue.CreateErrorInstance(msg)); |
||||
|
context.Response.StatusCode = 200; |
||||
|
context.Response.ContentType = "application/json;charset=utf-8"; |
||||
|
return context.Response.WriteAsync(result); |
||||
|
} |
||||
|
} |
||||
|
//扩展方法
|
||||
|
public static class ErrorHandlingExtensions |
||||
|
{ |
||||
|
public static IApplicationBuilder UseErrorHandling(this IApplicationBuilder builder) |
||||
|
{ |
||||
|
return builder.UseMiddleware<ErrorHandlingMiddleware>(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
After Width: 150 | Height: 180 | Size: 3.7 KiB |
|
After Width: 640 | Height: 360 | Size: 286 KiB |
Write
Preview
Loading…
Cancel
Save
Reference in new issue