Browse Source

历次结果

master
wxd 1 year ago
parent
commit
39aa21b9cf
  1. 25
      src/Shentun.Peis.Application.Contracts/RegisterCheckItems/GetItemTwoHistoricalResultsDto.cs
  2. 20
      src/Shentun.Peis.Application.Contracts/RegisterCheckItems/GetItemTwoHistoricalResultsInputDto.cs
  3. 57
      src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs

25
src/Shentun.Peis.Application.Contracts/RegisterCheckItems/GetItemTwoHistoricalResultsDto.cs

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.RegisterCheckItems
{
public class GetItemTwoHistoricalResultsDto
{
/// <summary>
/// 检查日期
/// </summary>
public string CheckDate { get; set; }
/// <summary>
/// 项目名称
/// </summary>
public string ItemName { get; set; }
/// <summary>
/// 项目结果
/// </summary>
public string ItemResult { get; set; }
}
}

20
src/Shentun.Peis.Application.Contracts/RegisterCheckItems/GetItemTwoHistoricalResultsInputDto.cs

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.RegisterCheckItems
{
public class GetItemTwoHistoricalResultsInputDto
{
/// <summary>
/// 检查ID
/// </summary>
public Guid RegisterCheckId { get; set; }
/// <summary>
/// 项目ID
/// </summary>
public Guid ItemId { get; set; }
}
}

57
src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs

@ -518,5 +518,62 @@ namespace Shentun.Peis.RegisterCheckItems
}
/// <summary>
/// 获取前两次历史结果
/// </summary>
/// <returns></returns>
[HttpPost("api/app/RegisterCheckItem/GetItemTwoHistoricalResults")]
public async Task<List<GetItemTwoHistoricalResultsDto>> GetItemTwoHistoricalResultsAsync(GetItemTwoHistoricalResultsInputDto input)
{
if (input.RegisterCheckId == Guid.Empty)
{
throw new UserFriendlyException("检查id不正确");
}
if (input.ItemId == Guid.Empty)
{
throw new UserFriendlyException("项目id不正确");
}
var patientRegisterEnt = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId
join registerCheckItem in await _registerCheckItemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckItem.RegisterCheckId
where registerCheckItem.RegisterCheckId == input.RegisterCheckId && registerCheckItem.ItemId == input.ItemId
select new
{
patientId = patientRegister.PatientId,
patientRegisterId = patientRegister.Id
}).FirstOrDefault();
if (patientRegisterEnt == null)
{
throw new UserFriendlyException("数据不正确");
}
var historicalItemResult = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId
join registerCheckItem in await _registerCheckItemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckItem.RegisterCheckId
join item in await _itemRepository.GetQueryableAsync() on registerCheckItem.ItemId equals item.Id
where patientRegister.PatientId == patientRegisterEnt.patientId
&& registerCheckItem.ItemId == input.ItemId
&& patientRegister.Id != patientRegisterEnt.patientRegisterId
orderby registerCheckItem.CreationTime descending
select new
{
checkDate = registerCheckItem.CheckDate,
itemName = item.DisplayName,
itemResult = registerCheckItem.Result
}).Take(2);
var entListDto = historicalItemResult.Select(s => new GetItemTwoHistoricalResultsDto
{
CheckDate = DataHelper.ConversionDateShortToString(s.checkDate),
ItemName = s.itemName,
ItemResult = s.itemResult
}).ToList();
return entListDto;
}
}
}
Loading…
Cancel
Save