Browse Source

诊断函数前

bjmzak
wxd 3 years ago
parent
commit
31f2db599d
  1. 14
      src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs
  2. 19
      src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionRequestDto.cs
  3. 23
      src/Shentun.Peis.Application.Contracts/SuggestionDtos/SuggestionDto.cs
  4. 17
      src/Shentun.Peis.Application.Contracts/SumDiagnosises/GetSumDiagnosisListInPatientRegisterIdDto.cs
  5. 27
      src/Shentun.Peis.Application.Contracts/SumDiagnosises/SumDiagnosisDto.cs
  6. 2
      src/Shentun.Peis.Application.Contracts/SumSuggestionHeaders/CreateSumSuggestionHeaderOrContentDto.cs
  7. 7
      src/Shentun.Peis.Application.Contracts/SumSuggestionHeaders/SumSuggestionHeaderOrContentDto.cs
  8. 184
      src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs
  9. 46
      src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs
  10. 17
      src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
  11. 63
      src/Shentun.Peis.Application/SumDiagnosises/SumDiagnosisAppService.cs
  12. 26
      src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs
  13. 25
      src/Shentun.Peis.Domain/ImageHelper.cs
  14. 10
      src/Shentun.Peis.Domain/Suggestions/Suggestion.cs
  15. 84
      src/Shentun.Peis.HttpApi.Host/Filter/ErrorHandlingMiddleware.cs
  16. 8
      src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs
  17. BIN
      src/Shentun.Peis.HttpApi.Host/UpLoad/3a0d9430-4a1f-e05d-7ef6-a34cca06519f.jpg
  18. BIN
      src/Shentun.Peis.HttpApi.Host/UpLoad/3a0d9430-4a1f-e05d-7ef6-a34cca06519f.png

14
src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionDto.cs

@ -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; }
}
}

19
src/Shentun.Peis.Application.Contracts/Diagnosises/DiagnosisInSuggestionRequestDto.cs

@ -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; }
}
}

23
src/Shentun.Peis.Application.Contracts/SuggestionDtos/SuggestionDto.cs

@ -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; }
}
}

17
src/Shentun.Peis.Application.Contracts/SumDiagnosises/GetSumDiagnosisListInPatientRegisterIdDto.cs

@ -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; }
}
}

27
src/Shentun.Peis.Application.Contracts/SumDiagnosises/SumDiagnosisDto.cs

@ -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; }
}
}

2
src/Shentun.Peis.Application.Contracts/SumSuggestionHeaders/CreateSumSuggestionHeaderOrContentDto.cs

@ -17,6 +17,8 @@ namespace Shentun.Peis.SumSuggestionHeaders
/// </summary> /// </summary>
public string SuggestionTitle { get; set; } public string SuggestionTitle { get; set; }
public Guid? DiagnosisId { get; set; }
public List<CreateSumSuggestionContentDto> Details { get; set; } public List<CreateSumSuggestionContentDto> Details { get; set; }
} }
} }

7
src/Shentun.Peis.Application.Contracts/SumSuggestionHeaders/SumSuggestionHeaderOrContentDto.cs

@ -2,6 +2,8 @@
using Shentun.Peis.SumSummaryContents; using Shentun.Peis.SumSummaryContents;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Text; using System.Text;
namespace Shentun.Peis.SumSuggestionHeaders namespace Shentun.Peis.SumSuggestionHeaders
@ -31,5 +33,10 @@ namespace Shentun.Peis.SumSuggestionHeaders
public int DisplayOrder { get; set; } public int DisplayOrder { get; set; }
public List<SumSuggestionContentDto> Details { get; set; } public List<SumSuggestionContentDto> Details { get; set; }
} }
} }

184
src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs

@ -1,11 +1,13 @@
using AutoMapper.Internal.Mappers; using AutoMapper.Internal.Mappers;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Diagnosises; using Shentun.Peis.Diagnosises;
using Shentun.Peis.GuidTypes; using Shentun.Peis.GuidTypes;
using Shentun.Peis.HelperDto; using Shentun.Peis.HelperDto;
using Shentun.Peis.Items; using Shentun.Peis.Items;
using Shentun.Peis.Models; using Shentun.Peis.Models;
using Shentun.Peis.SuggestionDtos;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -32,14 +34,17 @@ namespace Shentun.Peis.Diagnosises
CreateDiagnosisDto, CreateDiagnosisDto,
UpdateDiagnosisDto> UpdateDiagnosisDto>
{ {
private readonly IRepository<Suggestion, Guid> _suggestionRepository;
private readonly IRepository<IdentityUser, Guid> _userRepository; private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly DiagnosisManager _manager; private readonly DiagnosisManager _manager;
public DiagnosisAppService( public DiagnosisAppService(
IRepository<Diagnosis, Guid> repository, IRepository<Diagnosis, Guid> repository,
IRepository<Suggestion, Guid> suggestionRepository,
IRepository<IdentityUser, Guid> userRepository, IRepository<IdentityUser, Guid> userRepository,
DiagnosisManager manager) DiagnosisManager manager)
: base(repository) : base(repository)
{ {
this._suggestionRepository = suggestionRepository;
this._userRepository = userRepository; this._userRepository = userRepository;
_manager = manager; _manager = manager;
} }
@ -62,83 +67,144 @@ namespace Shentun.Peis.Diagnosises
} }
/// <summary> /// <summary>
/// 获取列表 诊断
/// 获取列表 诊断 可以按项目类别搜 两个接口组合到一起
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("api/app/diagnosis/GetListAsync")]
public override async Task<PagedResultDto<DiagnosisDto>> GetListAsync(PagedAndSortedResultRequestDto input)
[HttpPost("api/app/diagnosis/getlistinsuggestion")]
public async Task<List<DiagnosisInSuggestionDto>> GetListInSuggestionAsync(DiagnosisInSuggestionRequestDto input)
{ {
return await base.GetListAsync(input);
}
var query = from a in await Repository.GetQueryableAsync()
join b in await _suggestionRepository.GetQueryableAsync() on a.Id equals b.DiagnosisId into bb
from ab in bb.DefaultIfEmpty()
join c in await _userRepository.GetQueryableAsync() on a.CreatorId equals c.Id into cc
from ac in cc.DefaultIfEmpty()
join d in await _userRepository.GetQueryableAsync() on a.LastModifierId equals d.Id into dd
from ad in dd.DefaultIfEmpty()
join e in await _userRepository.GetQueryableAsync() on ab.CreatorId equals e.Id into ee
from ae in ee.DefaultIfEmpty()
join f in await _userRepository.GetQueryableAsync() on ab.LastModifierId equals f.Id into ff
from af in ff.DefaultIfEmpty()
select new { a, ab, ac, ad, ae, af };
if (input.ItemTypeId != null)
{
query = query.Where(m => m.a.ItemTypeId == input.ItemTypeId);
}
/// <summary>
/// 获取列表 根据项目类别获取
/// </summary>
/// <param name="ItemTypeId"></param>
/// <returns></returns>
public async Task<List<DiagnosisDto>> GetListInItemTypeAsync(Guid ItemTypeId)
{
var entlist = await Repository.GetListAsync(m => m.ItemTypeId == ItemTypeId);
if (!string.IsNullOrEmpty(input.DiagnosisName))
{
query = query.Where(m => m.a.DisplayName == input.DiagnosisName);
}
var userList = await _userRepository.GetListAsync();
var entdto = entlist.Select(s => new DiagnosisDto
var entlist = query.GroupBy(g => g.a.Id).Select(s => new DiagnosisInSuggestionDto
{ {
CreationTime = s.CreationTime,
CreatorId = s.CreatorId,
DisplayName = s.DisplayName,
DisplayOrder = s.DisplayOrder,
Id = s.Id,
LastModificationTime = s.LastModificationTime,
LastModifierId = s.LastModifierId,
SimpleCode = s.SimpleCode,
CreatorName = EntityHelper.GetUserNameNoSql(userList, s.CreatorId),
LastModifierName = EntityHelper.GetUserNameNoSql(userList, s.LastModifierId)
}).ToList();
return entdto;
CreationTime = s.FirstOrDefault().a.CreationTime,
CreatorId = s.FirstOrDefault().a.CreatorId,
DisplayName = s.FirstOrDefault().a.DisplayName,
DisplayOrder = s.FirstOrDefault().a.DisplayOrder,
Id = s.FirstOrDefault().a.Id,
LastModificationTime = s.FirstOrDefault().a.LastModificationTime,
LastModifierId = s.FirstOrDefault().a.LastModifierId,
SimpleCode = s.FirstOrDefault().a.SimpleCode,
CreatorName = s.FirstOrDefault().ac != null ? s.FirstOrDefault().ac.UserName : "",
LastModifierName = s.FirstOrDefault().ad != null ? s.FirstOrDefault().ad.UserName : "",
DiagnosisLevelId = s.FirstOrDefault().a.DiagnosisLevelId,
ForSexId = s.FirstOrDefault().a.ForSexId,
IsIll = s.FirstOrDefault().a.IsIll,
IsSummaryTemplate = s.FirstOrDefault().a.IsSummaryTemplate,
ItemTypeId = s.FirstOrDefault().a.ItemTypeId,
SuggestionName = s.FirstOrDefault().a.SuggestionName,
Suggestions = s.Where(m => m.ab != null).Select(ss => new SuggestionDto
{
CreationTime = ss.ab.CreationTime,
CreatorId = ss.ab.CreatorId,
CreatorName = s.FirstOrDefault().ae != null ? s.FirstOrDefault().ae.UserName : "",
LastModifierName = s.FirstOrDefault().af != null ? s.FirstOrDefault().af.UserName : "",
DiagnosisId = ss.ab.DiagnosisId,
DisplayOrder = ss.ab.DisplayOrder,
Id = ss.ab.Id,
LastModificationTime = ss.ab.LastModificationTime,
LastModifierId = ss.ab.LastModifierId,
SuggestionContent = ss.ab.SuggestionContent
}).OrderBy(o => o.DisplayOrder).ToList(),
}).OrderBy(o => o.DisplayOrder).ToList();
return entlist;
} }
/// <summary>
/// 获取列表 诊断 带搜索
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/diagnosis/getlistinfilter")]
public async Task<PagedResultDto<DiagnosisDto>> GetListInFilterAsync(GetListInFilterDto input)
{
int totalCount = 0;
if (!string.IsNullOrEmpty(input.Filter))
totalCount = (await Repository.GetListAsync()).Where(m => m.DisplayName.Contains(input.Filter)).Count();
else
totalCount = await Repository.CountAsync();
///// <summary>
///// 获取列表 根据项目类别获取
///// </summary>
///// <param name="ItemTypeId"></param>
///// <returns></returns>
//public async Task<List<DiagnosisDto>> GetListInItemTypeAsync(Guid ItemTypeId)
//{
// var entlist = await Repository.GetListAsync(m => m.ItemTypeId == ItemTypeId);
var entlist = await PageHelper.GetPageListInFitler(Repository, _userRepository, input);
var userList = await _userRepository.GetListAsync();
var entdto = entlist.Select(s => new DiagnosisDto
{
CreationTime = s.CreationTime,
CreatorId = s.CreatorId,
DisplayName = s.DisplayName,
DisplayOrder = s.DisplayOrder,
Id = s.Id,
LastModificationTime = s.LastModificationTime,
LastModifierId = s.LastModifierId,
SimpleCode = s.SimpleCode,
CreatorName = EntityHelper.GetUserNameNoSql(userList, s.CreatorId),
LastModifierName = EntityHelper.GetUserNameNoSql(userList, s.LastModifierId)
}).ToList();
// var userList = await _userRepository.GetListAsync();
return new PagedResultDto<DiagnosisDto>(totalCount, entdto);
// var entdto = entlist.Select(s => new DiagnosisDto
// {
// CreationTime = s.CreationTime,
// CreatorId = s.CreatorId,
// DisplayName = s.DisplayName,
// DisplayOrder = s.DisplayOrder,
// Id = s.Id,
// LastModificationTime = s.LastModificationTime,
// LastModifierId = s.LastModifierId,
// SimpleCode = s.SimpleCode,
// CreatorName = EntityHelper.GetUserNameNoSql(userList, s.CreatorId),
// LastModifierName = EntityHelper.GetUserNameNoSql(userList, s.LastModifierId)
// }).ToList();
// return entdto;
//}
}
///// <summary>
///// 获取列表 诊断 带搜索
///// </summary>
///// <param name="input"></param>
///// <returns></returns>
//[HttpPost("api/app/diagnosis/getlistinfilter")]
//public async Task<PagedResultDto<DiagnosisDto>> GetListInFilterAsync(GetListInFilterDto input)
//{
// int totalCount = 0;
// if (!string.IsNullOrEmpty(input.Filter))
// totalCount = (await Repository.GetListAsync()).Where(m => m.DisplayName.Contains(input.Filter)).Count();
// else
// totalCount = await Repository.CountAsync();
// var entlist = await PageHelper.GetPageListInFitler(Repository, _userRepository, input);
// var userList = await _userRepository.GetListAsync();
// var entdto = entlist.Select(s => new DiagnosisDto
// {
// CreationTime = s.CreationTime,
// CreatorId = s.CreatorId,
// DisplayName = s.DisplayName,
// DisplayOrder = s.DisplayOrder,
// Id = s.Id,
// LastModificationTime = s.LastModificationTime,
// LastModifierId = s.LastModifierId,
// SimpleCode = s.SimpleCode,
// CreatorName = EntityHelper.GetUserNameNoSql(userList, s.CreatorId),
// LastModifierName = EntityHelper.GetUserNameNoSql(userList, s.LastModifierId)
// }).ToList();
// return new PagedResultDto<DiagnosisDto>(totalCount, entdto);
//}
/// <summary> /// <summary>
/// 创建 /// 创建

46
src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs

@ -115,8 +115,54 @@ namespace Shentun.Peis.ItemTypes
return GetTree(items.ToList(), 0, ""); return GetTree(items.ToList(), 0, "");
} }
/// <summary>
/// 获取项目类别树型结构 根据ID 只获取上级数据,不包含下级数据
/// </summary>
/// <param name="ItemTypeId">当前项目类别ID</param>
/// <returns></returns>
[HttpGet("api/app/itemtype/getbycodeparent")]
public async Task<List<TreeChildViewDto>> GetByCodeParentAsync(Guid ItemTypeId)
{
var dataList = await Repository.GetListAsync();
var items = from p in dataList
select new TreeChildViewDto()
{
Id = p.Id,
ParentId = p.ParentId,
Code = p.PathCode,
DisplayName = p.DisplayName
};
return GetTreeParent(items.ToList(), 0, "", ItemTypeId);
}
#region 私有方法 #region 私有方法
/// <summary>
/// 使用Code进行递归
/// </summary>
/// <param name="items"></param>
/// <param name="deep"></param>
/// <param name="prefix"></param>
/// <param name="ItemTypeId"></param>
/// <returns></returns>
private List<TreeChildViewDto> GetTreeParent(List<TreeChildViewDto> items, int deep, string prefix, Guid ItemTypeId)
{
return (from p in items
where p.Code.StartsWith(prefix) && p.Code.Count(a => a == '.') == deep && p.Id != ItemTypeId
let subs = GetTreeParent(items, deep + 1, p.Code, ItemTypeId)
select new TreeChildViewDto()
{
Id = p.Id,
ParentId = p.ParentId,
Code = p.Code,
DisplayName = p.DisplayName,
TreeChildren = subs.ToList()
}
).ToList();
}
/// <summary> /// <summary>
/// 使用Code进行递归 /// 使用Code进行递归
/// </summary> /// </summary>

17
src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs

@ -1,6 +1,8 @@
using Microsoft.AspNetCore.Authorization;
using Castle.Core.Logging;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Shentun.Peis.CommonCharTypes; using Shentun.Peis.CommonCharTypes;
using Shentun.Peis.CustomerOrgRegisters; using Shentun.Peis.CustomerOrgRegisters;
using Shentun.Peis.CustomerOrgs; using Shentun.Peis.CustomerOrgs;
@ -33,7 +35,7 @@ namespace Shentun.Peis.PatientRegisters
/// 人员体检登记 /// 人员体检登记
/// </summary> /// </summary>
[ApiExplorerSettings(GroupName = "Work")] [ApiExplorerSettings(GroupName = "Work")]
[Authorize]
//[Authorize]
public class PatientRegisterAppService : CrudAppService< public class PatientRegisterAppService : CrudAppService<
PatientRegister, //The Book entity PatientRegister, //The Book entity
PatientRegisterDto, //Used to show books PatientRegisterDto, //Used to show books
@ -61,6 +63,7 @@ namespace Shentun.Peis.PatientRegisters
private readonly IRepository<RegisterCheckItem> _registerCheckItemRepository; private readonly IRepository<RegisterCheckItem> _registerCheckItemRepository;
private readonly IRepository<Item, Guid> _itemRepository; private readonly IRepository<Item, Guid> _itemRepository;
private readonly IPatientRegisterChargeRepository _patientRegisterChargeRepository; private readonly IPatientRegisterChargeRepository _patientRegisterChargeRepository;
private readonly ILogger<PatientRegisterAppService> _logger;
private readonly CustomerOrgManager _customerOrgManager; private readonly CustomerOrgManager _customerOrgManager;
private readonly CustomerOrgRegisterManager _customerOrgRegisterManager; private readonly CustomerOrgRegisterManager _customerOrgRegisterManager;
private readonly PatientManager _patientManager; private readonly PatientManager _patientManager;
@ -94,6 +97,7 @@ namespace Shentun.Peis.PatientRegisters
//IRepository<CustomerOrg, Guid> customerOrgRepository, //IRepository<CustomerOrg, Guid> customerOrgRepository,
//IRepository<PrimarykeyBuilder> primarykeyBuilderRepository, //IRepository<PrimarykeyBuilder> primarykeyBuilderRepository,
IPatientRegisterChargeRepository patientRegisterChargeRepository, IPatientRegisterChargeRepository patientRegisterChargeRepository,
ILogger<PatientRegisterAppService> logger,
CustomerOrgManager customerOrgManager, CustomerOrgManager customerOrgManager,
CustomerOrgRegisterManager customerOrgRegisterManager, CustomerOrgRegisterManager customerOrgRegisterManager,
PatientManager patientManager, PatientManager patientManager,
@ -121,6 +125,7 @@ namespace Shentun.Peis.PatientRegisters
this._registerCheckItemRepository = registerCheckItemRepository; this._registerCheckItemRepository = registerCheckItemRepository;
this._itemRepository = itemRepository; this._itemRepository = itemRepository;
this._patientRegisterChargeRepository = patientRegisterChargeRepository; this._patientRegisterChargeRepository = patientRegisterChargeRepository;
this._logger = logger;
this._customerOrgManager = customerOrgManager; this._customerOrgManager = customerOrgManager;
this._customerOrgRegisterManager = customerOrgRegisterManager; this._customerOrgRegisterManager = customerOrgRegisterManager;
this._patientManager = patientManager; this._patientManager = patientManager;
@ -590,10 +595,12 @@ namespace Shentun.Peis.PatientRegisters
/// <returns></returns> /// <returns></returns>
public string UpLoadImg(UpdatePhotoDto input) public string UpLoadImg(UpdatePhotoDto input)
{ {
string imgurl = "UpLoad/" + input.PatientRegisterId + ".png";
//_logger.LogInformation(input.Photo);
string imgurl = "UpLoad/" + input.PatientRegisterId;
var isupload = ImageHelper.Base64StrToImage(input.Photo, imgurl); var isupload = ImageHelper.Base64StrToImage(input.Photo, imgurl);
if (isupload)
return imgurl;
if (!string.IsNullOrEmpty(isupload))
return isupload;
else else
return ""; return "";
} }

63
src/Shentun.Peis.Application/SumDiagnosises/SumDiagnosisAppService.cs

@ -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;
}
}
}

26
src/Shentun.Peis.Application/SumSuggestionHeaders/SumSuggestionHeaderAppService.cs

@ -26,16 +26,19 @@ namespace Shentun.Peis.SumSuggestionHeaders
private readonly IRepository<SumSuggestionHeader, Guid> _sumSuggestionHeaderRepository; private readonly IRepository<SumSuggestionHeader, Guid> _sumSuggestionHeaderRepository;
private readonly IRepository<SumSuggestionContent, Guid> _sumSuggestionContentRepository; private readonly IRepository<SumSuggestionContent, Guid> _sumSuggestionContentRepository;
private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository; private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository;
private readonly IRepository<SumDiagnosis> _sumDiagnosisRepository;
public SumSuggestionHeaderAppService( public SumSuggestionHeaderAppService(
IRepository<SumSuggestionHeader, Guid> sumSuggestionHeaderRepository, IRepository<SumSuggestionHeader, Guid> sumSuggestionHeaderRepository,
IRepository<SumSuggestionContent, Guid> sumSuggestionContentRepository, IRepository<SumSuggestionContent, Guid> sumSuggestionContentRepository,
IRepository<RegisterCheck, Guid> registerCheckRepository
IRepository<RegisterCheck, Guid> registerCheckRepository,
IRepository<SumDiagnosis> sumDiagnosisRepository
) )
{ {
this._sumSuggestionHeaderRepository = sumSuggestionHeaderRepository; this._sumSuggestionHeaderRepository = sumSuggestionHeaderRepository;
this._sumSuggestionContentRepository = sumSuggestionContentRepository; this._sumSuggestionContentRepository = sumSuggestionContentRepository;
this._registerCheckRepository = registerCheckRepository; this._registerCheckRepository = registerCheckRepository;
this._sumDiagnosisRepository = sumDiagnosisRepository;
} }
@ -68,7 +71,7 @@ namespace Shentun.Peis.SumSuggestionHeaders
DisplayOrder = sa.DisplayOrder, DisplayOrder = sa.DisplayOrder,
SuggestionContent = sa.SuggestionContent, SuggestionContent = sa.SuggestionContent,
SumSuggestionHeaderId = sa.SumSuggestionHeaderId SumSuggestionHeaderId = sa.SumSuggestionHeaderId
}).OrderBy(o => o.DisplayOrder).ToList()
}).OrderBy(o => o.DisplayOrder).ToList(),
}).OrderBy(o => o.DisplayOrder).ToList(); }).OrderBy(o => o.DisplayOrder).ToList();
} }
else else
@ -87,7 +90,7 @@ namespace Shentun.Peis.SumSuggestionHeaders
msg = checklist.Select(s => new SumSuggestionHeaderOrContentDto msg = checklist.Select(s => new SumSuggestionHeaderOrContentDto
{ {
Id = s.Id, Id = s.Id,
SuggestionTitle =string.Join(",",s.RegisterAsbitems.Select(rs=>rs.Asbitem.DisplayName).ToList()),
SuggestionTitle = string.Join(",", s.RegisterAsbitems.Select(rs => rs.Asbitem.DisplayName).ToList()),
SuggestionFlag = null, SuggestionFlag = null,
PatientRegisterId = s.RegisterAsbitems.FirstOrDefault().PatientRegisterId, PatientRegisterId = s.RegisterAsbitems.FirstOrDefault().PatientRegisterId,
DisplayOrder = 0, DisplayOrder = 0,
@ -136,6 +139,23 @@ namespace Shentun.Peis.SumSuggestionHeaders
if (sumSuggestionHeaderEnt_New != null) if (sumSuggestionHeaderEnt_New != null)
{ {
#region 插入SumDiagnosis
if (item.DiagnosisId != null && item.DiagnosisId != Guid.Empty)
{
SumDiagnosis sumDiagnosis = new SumDiagnosis
{
DiagnosisId = item.DiagnosisId.Value,
DisplayOrder = input.IndexOf(item) + 1,
PatientRegisterId = item.PatientRegisterId,
SumSuggestionHeaderId = sumSuggestionHeaderEnt_New.Id
};
await _sumDiagnosisRepository.InsertAsync(sumDiagnosis);
}
#endregion
#region 插入SumSuggestionContent #region 插入SumSuggestionContent
List<SumSuggestionContent> sumSuggestionContentList = new List<SumSuggestionContent>(); List<SumSuggestionContent> sumSuggestionContentList = new List<SumSuggestionContent>();
foreach (var item2 in item.Details) foreach (var item2 in item.Details)

25
src/Shentun.Peis.Domain/ImageHelper.cs

@ -22,9 +22,9 @@ namespace Shentun.Peis
/// <param name="base64Str">base64字符串</param> /// <param name="base64Str">base64字符串</param>
/// <param name="savePath">图片保存地址,如:/Content/Images/10000.png</param> /// <param name="savePath">图片保存地址,如:/Content/Images/10000.png</param>
/// <returns></returns> /// <returns></returns>
public static bool Base64StrToImage(string base64Str, string savePath)
public static string Base64StrToImage(string base64Str, string savePath)
{ {
var ret = true;
var ret = "";
try try
{ {
@ -32,8 +32,21 @@ namespace Shentun.Peis
if (bitmap != null) if (bitmap != null)
{ {
string ImageSuffix = "";
if (ImageFormat.Png.Guid == bitmap.RawFormat.Guid)
{
ImageSuffix = ".png";
}
else if (ImageFormat.Gif.Guid == bitmap.RawFormat.Guid)
{
ImageSuffix = ".gif";
}
else
{
ImageSuffix = ".jpg";
}
savePath = savePath + ImageSuffix;
//创建文件夹 //创建文件夹
var folderPath = savePath.Substring(0, savePath.LastIndexOf('/')); var folderPath = savePath.Substring(0, savePath.LastIndexOf('/'));
@ -64,15 +77,17 @@ namespace Shentun.Peis
bmpNew.Dispose(); bmpNew.Dispose();
bitmap.Dispose(); bitmap.Dispose();
ret = savePath;
} }
else else
{ {
ret = false;
ret = "";
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
ret = false;
ret = "";
} }
return ret; return ret;

10
src/Shentun.Peis.Domain/Suggestions/Suggestion.cs

@ -13,14 +13,14 @@ namespace Shentun.Peis.Models
/// </summary> /// </summary>
[Table("suggestion")] [Table("suggestion")]
[Index(nameof(DiagnosisId), nameof(SuggestionContent), Name = "ix_suggestion", IsUnique = true)] [Index(nameof(DiagnosisId), nameof(SuggestionContent), Name = "ix_suggestion", IsUnique = true)]
public class Suggestion: AuditedEntity<Guid>, IHasConcurrencyStamp
public class Suggestion : AuditedEntity<Guid>, IHasConcurrencyStamp
{ {
/// <summary>
/// 诊断ID
/// </summary>
/// <summary>
/// 诊断ID
/// </summary>
[Column("diagnosis_id")] [Column("diagnosis_id")]
//[StringLength(8)] //[StringLength(8)]
public Guid DiagnosisId { get; set; }
public Guid DiagnosisId { get; set; }
/// <summary> /// <summary>
/// 建议内容 /// 建议内容
/// </summary> /// </summary>

84
src/Shentun.Peis.HttpApi.Host/Filter/ErrorHandlingMiddleware.cs

@ -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>();
}
}
}

8
src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs

@ -50,6 +50,7 @@ using static IdentityModel.ClaimComparer;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Diagnostics; using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Shentun.Peis.Filter;
namespace Shentun.Peis; namespace Shentun.Peis;
[DependsOn( [DependsOn(
@ -361,8 +362,8 @@ public class PeisHttpApiHostModule : AbpModule
var app = context.GetApplicationBuilder(); var app = context.GetApplicationBuilder();
var env = context.GetEnvironment(); var env = context.GetEnvironment();
//app.UseErrorHandling();
//请求错误提示配置
app.UseErrorHandling();
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {
@ -402,6 +403,9 @@ public class PeisHttpApiHostModule : AbpModule
app.UseRouting(); app.UseRouting();
app.UseCors(); app.UseCors();
app.UseAuthentication(); app.UseAuthentication();
app.UseAbpOpenIddictValidation(); app.UseAbpOpenIddictValidation();

BIN
src/Shentun.Peis.HttpApi.Host/UpLoad/3a0d9430-4a1f-e05d-7ef6-a34cca06519f.jpg

After

Width: 150  |  Height: 180  |  Size: 3.7 KiB

BIN
src/Shentun.Peis.HttpApi.Host/UpLoad/3a0d9430-4a1f-e05d-7ef6-a34cca06519f.png

After

Width: 640  |  Height: 360  |  Size: 286 KiB

Loading…
Cancel
Save