From 22ee32de2535dd80be7d510712988b8fc9441658 Mon Sep 17 00:00:00 2001
From: "DESKTOP-G961P6V\\Zhh" <839860190@qq.com>
Date: Wed, 17 Apr 2024 18:16:18 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=9F=A5=E7=BB=93=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../RegisterChecks/UpdateCheckResultDto.cs | 87 +++++++++++++++++++
.../RegisterCheckItemAppService.cs | 14 +--
.../RegisterChecks/RegisterCheckAppService.cs | 7 ++
.../Suggestions/Suggestion.cs | 6 ++
.../SumSuggestionContent.cs | 4 +
.../Suggestions/SuggestionDbMapping.cs | 1 +
.../SumSuggestionContentDbMapping.cs | 1 +
.../DiagnosisFunctionAppServiceTest.cs | 79 +++++++++++++++++
8 files changed, 193 insertions(+), 6 deletions(-)
create mode 100644 src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateCheckResultDto.cs
diff --git a/src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateCheckResultDto.cs b/src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateCheckResultDto.cs
new file mode 100644
index 0000000..d66743e
--- /dev/null
+++ b/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
+ {
+ ///
+ /// RegisterCheck表ID
+ ///
+ public Guid RegisterCheckId { get; set; }
+ ///
+ /// 检查医生(内部传ID,外部医生存名字)
+ ///
+ public string? CheckDoctorId { get; set; }
+ ///
+ /// 检查日期(格式:2023-07-18) 空值跟null取当前日期
+ ///
+ public string? CheckDate { get; set; }
+ public List RegisterCheckItems { get; set; }
+ public List Summarys { get; set; } = new List();
+ public List Suggestions { get; set; } = new List();
+
+
+ }
+
+ public class UpdateRegisterCheckItemDetail
+ {
+
+ ///
+ /// 项目ID
+ ///
+ public Guid ItemId { get; set; }
+
+
+
+ #region 修改内容
+ ///
+ /// 结果
+ ///
+ public string? Result { get; set; }
+
+ ///
+ /// 危急值
+ ///
+ public string? CriticalValue { get; set; }
+
+ ///
+ /// 检查医生
+ ///
+ public string? CheckDoctorName { get; set; }
+ ///
+ /// 检查日期
+ ///
+ public string? CheckDate { get; set; }
+ #endregion
+ }
+ public class UpdateRegisterCheckSummaryDetail
+ {
+ ///
+ /// 综述
+ ///
+ public string Summary { get; set; }
+
+ ///
+ /// 综述标志
+ ///
+ public char SummaryFlag { get; set; }
+ }
+
+ public class UpdateRegisterCheckSuggestionDetail
+ {
+ ///
+ /// 综述
+ ///
+ public string Summary { get; set; }
+
+ ///
+ /// 综述标志
+ ///
+ public char SummaryFlag { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs b/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs
index 51f7745..ef9e5af 100644
--- a/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs
+++ b/src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs
@@ -33,14 +33,15 @@ namespace Shentun.Peis.RegisterCheckItems
private readonly IRepository _userRepository;
private readonly RegisterCheckItemManager _registerCheckItemManager;
private readonly ReferenceRangeManager _referenceRangeManager;
-
+ private readonly CacheService _cacheService;
public RegisterCheckItemAppService(
IRepository registerCheckItemRepository,
IRepository userRepository,
RegisterCheckItemManager registerCheckItemManager,
ReferenceRangeManager referenceRangeManager,
IRepository patientRegisterRepository,
- IRepository referenceRangeRepository)
+ IRepository 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;
}
///
@@ -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();
diff --git a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
index 4efe2c9..8e6ff4f 100644
--- a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
+++ b/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参数不能为空");
+ }
+ }
/////
///// 弃检跟恢复操作 0(为未检), 1(已检), 2(弃检)
/////
diff --git a/src/Shentun.Peis.Domain/Suggestions/Suggestion.cs b/src/Shentun.Peis.Domain/Suggestions/Suggestion.cs
index dd3b4d8..2b01633 100644
--- a/src/Shentun.Peis.Domain/Suggestions/Suggestion.cs
+++ b/src/Shentun.Peis.Domain/Suggestions/Suggestion.cs
@@ -22,6 +22,12 @@ namespace Shentun.Peis.Models
//[StringLength(8)]
public Guid DiagnosisId { get; set; }
///
+ /// 建议类别
+ ///
+ [Column("suggestion_type")]
+ [StringLength(1)]
+ public char SuggestionType { get; set; }
+ ///
/// 建议内容
///
[Column("suggestion_content")]
diff --git a/src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContent.cs b/src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContent.cs
index d5079ab..8c506e6 100644
--- a/src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContent.cs
+++ b/src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContent.cs
@@ -19,6 +19,10 @@ namespace Shentun.Peis.Models
///
[Column("sum_suggestion_header_id")]
public Guid SumSuggestionHeaderId { get; set; }
+ [Column("suggestion_type")]
+ [StringLength(1)]
+ public string SuggestionType { get; set; }
+
///
/// 建议内容
///
diff --git a/src/Shentun.Peis.EntityFrameworkCore/DbMapping/Suggestions/SuggestionDbMapping.cs b/src/Shentun.Peis.EntityFrameworkCore/DbMapping/Suggestions/SuggestionDbMapping.cs
index b8cb4e4..d027e3e 100644
--- a/src/Shentun.Peis.EntityFrameworkCore/DbMapping/Suggestions/SuggestionDbMapping.cs
+++ b/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();
diff --git a/src/Shentun.Peis.EntityFrameworkCore/DbMapping/SumSuggestionContents/SumSuggestionContentDbMapping.cs b/src/Shentun.Peis.EntityFrameworkCore/DbMapping/SumSuggestionContents/SumSuggestionContentDbMapping.cs
index e7e2e4d..eb5ed03 100644
--- a/src/Shentun.Peis.EntityFrameworkCore/DbMapping/SumSuggestionContents/SumSuggestionContentDbMapping.cs
+++ b/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();
diff --git a/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs b/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs
index b202b81..2a21ce7 100644
--- a/test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs
+++ b/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;
+ }
///
/// 乙肝五项
///