Browse Source

检查结果

bjmzak
DESKTOP-G961P6V\Zhh 2 years ago
parent
commit
22ee32de25
  1. 87
      src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateCheckResultDto.cs
  2. 14
      src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs
  3. 7
      src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
  4. 6
      src/Shentun.Peis.Domain/Suggestions/Suggestion.cs
  5. 4
      src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContent.cs
  6. 1
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/Suggestions/SuggestionDbMapping.cs
  7. 1
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/SumSuggestionContents/SumSuggestionContentDbMapping.cs
  8. 79
      test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs

87
src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateCheckResultDto.cs

@ -0,0 +1,87 @@
using Shentun.Peis.RegisterCheckItems;
using Shentun.Peis.RegisterCheckSuggestions;
using Shentun.Peis.RegisterCheckSummarys;
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.RegisterChecks
{
public class UpdateCheckResultDto
{
/// <summary>
/// RegisterCheck表ID
/// </summary>
public Guid RegisterCheckId { get; set; }
/// <summary>
/// 检查医生(内部传ID,外部医生存名字)
/// </summary>
public string? CheckDoctorId { get; set; }
/// <summary>
/// 检查日期(格式:2023-07-18) 空值跟null取当前日期
/// </summary>
public string? CheckDate { get; set; }
public List<UpdateRegisterCheckItemDetail> RegisterCheckItems { get; set; }
public List<UpdateRegisterCheckSummaryDetail> Summarys { get; set; } = new List<UpdateRegisterCheckSummaryDetail>();
public List<UpdateRegisterCheckSuggestionDetail> Suggestions { get; set; } = new List<UpdateRegisterCheckSuggestionDetail>();
}
public class UpdateRegisterCheckItemDetail
{
/// <summary>
/// 项目ID
/// </summary>
public Guid ItemId { get; set; }
#region 修改内容
/// <summary>
/// 结果
/// </summary>
public string? Result { get; set; }
/// <summary>
/// 危急值
/// </summary>
public string? CriticalValue { get; set; }
/// <summary>
/// 检查医生
/// </summary>
public string? CheckDoctorName { get; set; }
/// <summary>
/// 检查日期
/// </summary>
public string? CheckDate { get; set; }
#endregion
}
public class UpdateRegisterCheckSummaryDetail
{
/// <summary>
/// 综述
/// </summary>
public string Summary { get; set; }
/// <summary>
/// 综述标志
/// </summary>
public char SummaryFlag { get; set; }
}
public class UpdateRegisterCheckSuggestionDetail
{
/// <summary>
/// 综述
/// </summary>
public string Summary { get; set; }
/// <summary>
/// 综述标志
/// </summary>
public char SummaryFlag { get; set; }
}
}

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

@ -33,14 +33,15 @@ namespace Shentun.Peis.RegisterCheckItems
private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly RegisterCheckItemManager _registerCheckItemManager;
private readonly ReferenceRangeManager _referenceRangeManager;
private readonly CacheService _cacheService;
public RegisterCheckItemAppService(
IRepository<RegisterCheckItem> registerCheckItemRepository,
IRepository<IdentityUser, Guid> userRepository,
RegisterCheckItemManager registerCheckItemManager,
ReferenceRangeManager referenceRangeManager,
IRepository<PatientRegister, Guid> patientRegisterRepository,
IRepository<ReferenceRange, Guid> referenceRangeRepository)
IRepository<ReferenceRange, Guid> referenceRangeRepository,
CacheService cacheService)
{
this._registerCheckItemRepository = registerCheckItemRepository;
this._userRepository = userRepository;
@ -48,6 +49,7 @@ namespace Shentun.Peis.RegisterCheckItems
this._referenceRangeManager = referenceRangeManager;
this._patientRegisterRepository = patientRegisterRepository;
this._referenceRangeRepository = referenceRangeRepository;
_cacheService = cacheService;
}
/// <summary>
@ -59,7 +61,7 @@ namespace Shentun.Peis.RegisterCheckItems
{
var entlist = (await _registerCheckItemRepository.GetDbSetAsync())
var entlist = (await _registerCheckItemRepository.GetQueryableAsync())
.Include(x => x.Item)
.Include(x => x.Item.ItemResultTemplates)
.Include(x => x.Item.ItemType)
@ -109,7 +111,7 @@ namespace Shentun.Peis.RegisterCheckItems
var userList = await _userRepository.GetListAsync();
var entdto = entlist.Select(s => new RegisterCheckItemOrItemOrItemResultTemplateDto
{
@ -141,8 +143,8 @@ namespace Shentun.Peis.RegisterCheckItems
CreatorId = s.CreatorId,
LastModificationTime = s.LastModificationTime,
LastModifierId = s.LastModifierId,
CreatorName = EntityHelper.GetUserNameNoSql(userList, s.CreatorId),
LastModifierName = EntityHelper.GetUserNameNoSql(userList, s.LastModifierId),
CreatorName = _cacheService.GetUserNameAsync(s.CreatorId).Result,
LastModifierName = _cacheService.GetUserNameAsync(s.LastModifierId).Result,
InputCheck = s.Item.InputCheck
}).ToList();

7
src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs

@ -137,6 +137,13 @@ namespace Shentun.Peis.RegisterChecks
return entdto;
}
public async Task UpdateCheckResult(UpdateCheckResultDto input)
{
if(input == null)
{
throw new UserFriendlyException("input参数不能为空");
}
}
///// <summary>
///// 弃检跟恢复操作 0(为未检), 1(已检), 2(弃检)
///// </summary>

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

@ -22,6 +22,12 @@ namespace Shentun.Peis.Models
//[StringLength(8)]
public Guid DiagnosisId { get; set; }
/// <summary>
/// 建议类别
/// </summary>
[Column("suggestion_type")]
[StringLength(1)]
public char SuggestionType { get; set; }
/// <summary>
/// 建议内容
/// </summary>
[Column("suggestion_content")]

4
src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContent.cs

@ -19,6 +19,10 @@ namespace Shentun.Peis.Models
/// </summary>
[Column("sum_suggestion_header_id")]
public Guid SumSuggestionHeaderId { get; set; }
[Column("suggestion_type")]
[StringLength(1)]
public string SuggestionType { get; set; }
/// <summary>
/// 建议内容
/// </summary>

1
src/Shentun.Peis.EntityFrameworkCore/DbMapping/Suggestions/SuggestionDbMapping.cs

@ -16,6 +16,7 @@ namespace Shentun.Peis.DbMapping
{
entity.HasComment("建议设置");
entity.Property(t => t.DiagnosisId).HasComment("诊断ID").IsRequired().IsFixedLength();
entity.Property(t => t.SuggestionType).HasComment("建议类别").IsRequired();
entity.Property(t => t.SuggestionContent).HasComment("建议内容").IsRequired();
entity.Property(e => e.Id).IsFixedLength();

1
src/Shentun.Peis.EntityFrameworkCore/DbMapping/SumSuggestionContents/SumSuggestionContentDbMapping.cs

@ -16,6 +16,7 @@ namespace Shentun.Peis.DbMapping
{
entity.HasComment("总检建议内容");
entity.Property(t => t.SumSuggestionHeaderId).HasComment("建议头ID").IsRequired();
entity.Property(t => t.SuggestionType).HasComment("建议类型").IsRequired();
entity.Property(t => t.SuggestionContent).HasComment("建议内容").IsRequired();
entity.Property(e => e.Id).ValueGeneratedNever().IsRequired();

79
test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs

@ -427,6 +427,85 @@ namespace Shentun.Peis
return result;
}
[Fact]
public void GetItemDiagnosisResultTzzsTest()
{
PatientItemDiagnosisInput patient = new PatientItemDiagnosisInput();
patient.SexName = "男";
patient.Age = 30;
patient.Item = new ItemResultInput()
{
ItemId = Guid.NewGuid(),
ItemName = "体重指数",
Result = "25"
};
var result = GetItemDiagnosisResultTzzs(patient);
_output.WriteLine("结果:" + result);
string code = @"
string result = """";
decimal tzzsDecimal = 0;
var itemResult = patient.Item.Result;
if (string.IsNullOrWhiteSpace(itemResult))
{
return null;
}
if (!decimal.TryParse(itemResult, out tzzsDecimal))
{
return null;
}
if (tzzsDecimal > 24 )
{
return """";
}
if (tzzsDecimal < 18)
{
return """";
}
return result;;
";
DiagnosisBuilder diagnosisBuilder = new DiagnosisBuilder();
result = diagnosisBuilder.GetItemDiagnosisResult(patient, code);
_output.WriteLine("动态结果:" + result);
}
public string GetItemDiagnosisResultTzzs(PatientItemDiagnosisInput patient)
{
string result = "";
decimal tzzsDecimal = 0;
var itemResult = patient.Item.Result;
if (string.IsNullOrWhiteSpace(itemResult))
{
return null;
}
if (!decimal.TryParse(itemResult, out tzzsDecimal))
{
return null;
}
if (tzzsDecimal > 24 )
{
return "超重";
}
if (tzzsDecimal < 18)
{
return "营养不良";
}
return result;
}
/// <summary>
/// 乙肝五项
/// </summary>

Loading…
Cancel
Save