diff --git a/src/Shentun.Peis.Application.Contracts/DiagnosisFunctions/GetCriticalResultDto.cs b/src/Shentun.Peis.Application.Contracts/DiagnosisFunctions/GetCriticalResultDto.cs
index 8385245..2f25129 100644
--- a/src/Shentun.Peis.Application.Contracts/DiagnosisFunctions/GetCriticalResultDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/DiagnosisFunctions/GetCriticalResultDto.cs
@@ -19,6 +19,8 @@ namespace Shentun.Peis.DiagnosisFunctions
public char? IsFollowUp { get; set; }
public string CriticalRangeValue { get; set; }
+
+ public string CriticalValueContent { get; set; }
}
public class GetItemCriticalResultDto
@@ -32,5 +34,7 @@ namespace Shentun.Peis.DiagnosisFunctions
public char? IsFollowUp { get; set; }
public string CriticalRangeValue { get; set; }
+
+ public string CriticalValueContent { get; set; }
}
}
diff --git a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs
index fff0ebf..65f9685 100644
--- a/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/PhoneFollowUps/PhoneFollowUpWithCriticalItemDto.cs
@@ -111,13 +111,13 @@ namespace Shentun.Peis.PhoneFollowUps
public string? MobileTelephone { get; set; }
///
- /// 单位名称
+ /// 部门
///
public string CustomerOrgName { get; set; }
///
- /// 父级单位名称
+ /// 单位
///
public string CustomerOrgParentName { get; set; }
@@ -136,6 +136,12 @@ namespace Shentun.Peis.PhoneFollowUps
///
public List PhoneFollowUpDetail { get; set; }
+
+ ///
+ /// 危急值处理内容 多个拼合在一起
+ ///
+ public string CriticalValueContents { get; set; }
+
///
/// 是否短信随访创建完成
///
diff --git a/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs b/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
index 067d7b1..942498a 100644
--- a/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
+++ b/src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
@@ -1930,10 +1930,8 @@ namespace Shentun.Peis.DiagnosisFunctions
GetDiagnosisResultDto resultDto,
GetCriticalResultDto criticalResultDto)
{
- var isCritical = false;
- var isFollowUp = false;
- GetAsbitemCriticalFunction(doctorCheckDiagnosisInput, criticalResultDto, isCritical, isFollowUp);
+ GetAsbitemCriticalFunction(doctorCheckDiagnosisInput, criticalResultDto);
var criticalFollowValueList = await _criticalFollowValueRepository.GetListAsync();
@@ -1941,6 +1939,10 @@ namespace Shentun.Peis.DiagnosisFunctions
//检索小结
foreach (var diagnosisResult in resultDto.DiagnosisResultDetails)
{
+ var isCritical = false;
+ var isFollowUp = false;
+
+
if (!isCritical)
{
var criticalKeyCount = criticalFollowValueList.Count(m => m.CriticalFollowValueFlag == CriticalFollowValueFlag.Critical
@@ -1949,7 +1951,7 @@ namespace Shentun.Peis.DiagnosisFunctions
{
isCritical = true;
isFollowUp = true;
- UpdateRegisterCheckCriticalResult(criticalResultDto, doctorCheckDiagnosisInput.Asbitems.FirstOrDefault().RegisterCheckId, 'Y', 'Y', diagnosisResult.DiagnosisResult);
+ UpdateRegisterCheckCriticalResult(criticalResultDto, doctorCheckDiagnosisInput.Asbitems.FirstOrDefault().RegisterCheckId, 'Y', 'Y', diagnosisResult.DiagnosisResult, "");
}
}
if (!isFollowUp)
@@ -1959,7 +1961,7 @@ namespace Shentun.Peis.DiagnosisFunctions
if (followUpKeyCount > 0)
{
isFollowUp = true;
- UpdateRegisterCheckCriticalResult(criticalResultDto, doctorCheckDiagnosisInput.Asbitems.FirstOrDefault().RegisterCheckId, null, 'Y', diagnosisResult.DiagnosisResult);
+ UpdateRegisterCheckCriticalResult(criticalResultDto, doctorCheckDiagnosisInput.Asbitems.FirstOrDefault().RegisterCheckId, null, 'Y', diagnosisResult.DiagnosisResult, "");
}
}
}
@@ -1972,10 +1974,7 @@ namespace Shentun.Peis.DiagnosisFunctions
///
///
///
- ///
- ///
- ///
- private void GetAsbitemCriticalFunction(DoctorCheckDiagnosisInput doctorCheckDiagnosisInput, GetCriticalResultDto criticalResultDto, bool isCritical, bool isFollowUp)
+ private void GetAsbitemCriticalFunction(DoctorCheckDiagnosisInput doctorCheckDiagnosisInput, GetCriticalResultDto criticalResultDto)
{
var patientAsbitemDiagnosisInput = new PatientAsbitemDiagnosisInput()
{
@@ -1997,25 +1996,25 @@ namespace Shentun.Peis.DiagnosisFunctions
foreach (var asbitem in doctorCheckDiagnosisInput.Asbitems)
{
+ var isCritical = false;
+
if (asbitem.IsCriticalValueFunction == 'Y' && !string.IsNullOrWhiteSpace(asbitem.CriticalValueFunction))
{
var isCriticalTemp = diagnosisBuilder.GetAsbitemCriticalResult(patientAsbitemDiagnosisInput, asbitem.CriticalValueFunction);
if (isCriticalTemp)
{
isCritical = true;
- isFollowUp = true;
- UpdateRegisterCheckCriticalResult(criticalResultDto, asbitem.RegisterCheckId, 'Y', 'Y', "");
+ UpdateRegisterCheckCriticalResult(criticalResultDto, asbitem.RegisterCheckId, 'Y', 'Y', "", "");
break;
}
}
- if (asbitem.IsFollowUpFunction == 'Y' && !string.IsNullOrWhiteSpace(asbitem.FollowUpFunction))
+ if (asbitem.IsFollowUpFunction == 'Y' && !string.IsNullOrWhiteSpace(asbitem.FollowUpFunction) && !isCritical)
{
var isFollowUpTemp = diagnosisBuilder.GetAsbitemFollowUpResult(patientAsbitemDiagnosisInput, asbitem.FollowUpFunction);
if (isFollowUpTemp)
{
- isFollowUp = true;
- UpdateRegisterCheckCriticalResult(criticalResultDto, asbitem.RegisterCheckId, null, 'Y', "");
+ UpdateRegisterCheckCriticalResult(criticalResultDto, asbitem.RegisterCheckId, null, 'Y', "", "");
}
}
}
@@ -2042,10 +2041,7 @@ namespace Shentun.Peis.DiagnosisFunctions
GetDiagnosisResultDto resultDto,
GetCriticalResultDto criticalResultDto)
{
- var isCritical = false;
- var isFollowUp = false;
-
- await GetItemCriticalFunction(doctorCheckDiagnosisInput, criticalResultDto, isCritical, isFollowUp);
+ await GetItemCriticalFunction(doctorCheckDiagnosisInput, criticalResultDto);
}
@@ -2054,14 +2050,10 @@ namespace Shentun.Peis.DiagnosisFunctions
///
///
///
- ///
- ///
///
private async Task GetItemCriticalFunction(
DoctorCheckDiagnosisInput doctorCheckDiagnosisInput,
- GetCriticalResultDto criticalResultDto,
- bool isCritical,
- bool isFollowUp
+ GetCriticalResultDto criticalResultDto
)
{
@@ -2077,6 +2069,8 @@ namespace Shentun.Peis.DiagnosisFunctions
foreach (var item in doctorCheckDiagnosisInput.Items)
{
+ var isCritical = false;
+ var isFollowUp = false;
if (string.IsNullOrWhiteSpace(item.Result))
{
continue;
@@ -2099,20 +2093,20 @@ namespace Shentun.Peis.DiagnosisFunctions
{
isCritical = true;
isFollowUp = true;
- UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, 'Y', 'Y', "");
+ UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, 'Y', 'Y', "", "");
continue;
}
}
#endregion
#region 随访函数
- if (item.IsFollowUpFunction == 'Y' && !string.IsNullOrWhiteSpace(item.FollowUpFunction))
+ if (item.IsFollowUpFunction == 'Y' && !string.IsNullOrWhiteSpace(item.FollowUpFunction) && !isFollowUp)
{
var isFollowUpTemp = diagnosisBuilder.GetItemCriticalResult(patientItemDiagnosisInput, item.FollowUpFunction);
if (isFollowUpTemp)
{
isFollowUp = true;
- UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, null, 'Y', "");
+ UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, null, 'Y', "", "");
}
}
#endregion
@@ -2122,33 +2116,37 @@ namespace Shentun.Peis.DiagnosisFunctions
if (referenceRange == null)
{
referenceRange = item.ReferenceRanges.Where(o => o.ForSexId == ForSexFlag.All && doctorCheckDiagnosisInput.Age >= o.AgeLowerLimit && doctorCheckDiagnosisInput.Age <= o.AgeUpperLimit).FirstOrDefault();
- if (referenceRange != null && !string.IsNullOrWhiteSpace(referenceRange.CriticalRangeValue))
- {
- var isCriticalTemp = _registerCheckItemManager.GetNumberResultIsCritical(item.Result, referenceRange.CriticalRangeValue);
- if (isCriticalTemp)
- {
- isCritical = true;
- isFollowUp = true;
- UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, 'Y', 'Y', referenceRange.CriticalRangeValue);
- continue;
- }
- }
- if (referenceRange != null && !string.IsNullOrWhiteSpace(referenceRange.FollowUpRangeValue) && !isFollowUp)
+ }
+ if (referenceRange != null && !string.IsNullOrWhiteSpace(referenceRange.CriticalRangeValue) && !isCritical)
+ {
+
+ var isCriticalTemp = _registerCheckItemManager.GetNumberResultIsCritical(item.Result, referenceRange.CriticalRangeValue);
+ if (isCriticalTemp)
{
+ isCritical = true;
+ isFollowUp = true;
+ string criticalValueContent = $"{item.ItemName}异常(结果{item.Result} {item.Unit},危急值范围{referenceRange.CriticalRangeValue})";
+ UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, 'Y', 'Y', referenceRange.CriticalRangeValue, criticalValueContent);
+ continue;
+ }
+ }
+ if (referenceRange != null && !string.IsNullOrWhiteSpace(referenceRange.FollowUpRangeValue) && !isFollowUp)
+ {
- var isFollowUpTemp = _registerCheckItemManager.GetNumberResultIsCritical(item.Result, referenceRange.FollowUpRangeValue);
- if (isFollowUpTemp)
- {
- isFollowUp = true;
- UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, null, 'Y', referenceRange.FollowUpRangeValue);
- }
+ var isFollowUpTemp = _registerCheckItemManager.GetNumberResultIsCritical(item.Result, referenceRange.FollowUpRangeValue);
+ if (isFollowUpTemp)
+ {
+ isFollowUp = true;
+ string criticalValueContent = $"{item.ItemName}异常(结果{item.Result} {item.Unit},随访范围{referenceRange.FollowUpRangeValue})";
+ UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, null, 'Y', referenceRange.FollowUpRangeValue, criticalValueContent);
}
}
#endregion
#region 关键字
+
if (!isCritical)
{
var criticalKeyCount = criticalFollowValueList.Count(m => m.CriticalFollowValueFlag == CriticalFollowValueFlag.Critical
@@ -2157,9 +2155,10 @@ namespace Shentun.Peis.DiagnosisFunctions
{
isCritical = true;
isFollowUp = true;
- UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, 'Y', 'Y', item.Result);
+ UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, 'Y', 'Y', item.Result, "");
}
}
+
if (!isFollowUp)
{
var followUpKeyCount = criticalFollowValueList.Count(m => m.CriticalFollowValueFlag == CriticalFollowValueFlag.FollowUp
@@ -2167,9 +2166,10 @@ namespace Shentun.Peis.DiagnosisFunctions
if (followUpKeyCount > 0)
{
isFollowUp = true;
- UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, null, 'Y', item.Result);
+ UpdateRegisterCheckItemCriticalResult(criticalResultDto, item.RegisterCheckId, item.ItemId, null, 'Y', item.Result, "");
}
}
+
#endregion
}
@@ -2189,7 +2189,8 @@ namespace Shentun.Peis.DiagnosisFunctions
///
///
///
- private void UpdateRegisterCheckCriticalResult(GetCriticalResultDto criticalResultDto, Guid registerCheckId, char? isCritical, char? isFollowUp, string criticalRangeValue)
+ ///
+ private void UpdateRegisterCheckCriticalResult(GetCriticalResultDto criticalResultDto, Guid registerCheckId, char? isCritical, char? isFollowUp, string criticalRangeValue, string criticalValueContent)
{
if (criticalResultDto.AsbitemDetails.Where(m => m.RegisterCheckId == registerCheckId).Count() == 0)
{
@@ -2216,6 +2217,10 @@ namespace Shentun.Peis.DiagnosisFunctions
{
asbitemDetail.CriticalRangeValue = criticalRangeValue;
}
+ if (!string.IsNullOrWhiteSpace(criticalValueContent) && string.IsNullOrWhiteSpace(asbitemDetail.CriticalValueContent))
+ {
+ asbitemDetail.CriticalValueContent = criticalValueContent;
+ }
}
}
}
@@ -2230,7 +2235,8 @@ namespace Shentun.Peis.DiagnosisFunctions
///
///
///
- private void UpdateRegisterCheckItemCriticalResult(GetCriticalResultDto criticalResultDto, Guid registerCheckId, Guid itemId, char? isCritical, char? isFollowUp, string criticalRangeValue)
+ ///
+ private void UpdateRegisterCheckItemCriticalResult(GetCriticalResultDto criticalResultDto, Guid registerCheckId, Guid itemId, char? isCritical, char? isFollowUp, string criticalRangeValue, string criticalValueContent)
{
//先增加registerCheck
@@ -2261,6 +2267,10 @@ namespace Shentun.Peis.DiagnosisFunctions
{
itemDetail.CriticalRangeValue = criticalRangeValue;
}
+ if (!string.IsNullOrWhiteSpace(criticalValueContent) && string.IsNullOrWhiteSpace(itemDetail.CriticalValueContent))
+ {
+ itemDetail.CriticalValueContent = criticalValueContent;
+ }
}
}
@@ -2280,12 +2290,12 @@ namespace Shentun.Peis.DiagnosisFunctions
{
foreach (var asbitemDetail in criticalResultDto.AsbitemDetails)
{
- await CreateRegisterCheckCritical(asbitemDetail.RegisterCheckId, asbitemDetail.IsCritical, asbitemDetail.IsFollowUp, asbitemDetail.CriticalRangeValue);
+ await CreateRegisterCheckCritical(asbitemDetail.RegisterCheckId, asbitemDetail.IsCritical, asbitemDetail.IsFollowUp, asbitemDetail.CriticalRangeValue, asbitemDetail.CriticalValueContent);
}
- foreach (var itemDetails in criticalResultDto.ItemDetails)
+ foreach (var itemDetail in criticalResultDto.ItemDetails)
{
- await CreateRegisterCheckItemCritical(itemDetails.RegisterCheckId, itemDetails.ItemId, itemDetails.IsCritical, itemDetails.IsFollowUp, itemDetails.CriticalRangeValue);
+ await CreateRegisterCheckItemCritical(itemDetail.RegisterCheckId, itemDetail.ItemId, itemDetail.IsCritical, itemDetail.IsFollowUp, itemDetail.CriticalRangeValue,itemDetail.CriticalValueContent);
}
if (criticalResultDto.AsbitemDetails.Count > 0 || criticalResultDto.ItemDetails.Count > 0)
@@ -2307,7 +2317,6 @@ namespace Shentun.Peis.DiagnosisFunctions
// });
//}
}
-
///
/// 生成registerCheck表危急值相关数据
///
@@ -2315,13 +2324,14 @@ namespace Shentun.Peis.DiagnosisFunctions
///
///
///
+ ///
///
- private async Task CreateRegisterCheckCritical(Guid registerCheckId, char? isCriticalValue, char? isFollowUp, string CriticalRangeValue)
+ private async Task CreateRegisterCheckCritical(Guid registerCheckId, char? isCriticalValue, char? isFollowUp, string CriticalRangeValue, string criticalValueContent)
{
var registerCheckEnt = await _registerCheckRepository.FirstOrDefaultAsync(m => m.Id == registerCheckId);
if (registerCheckEnt != null)
{
- if (!string.IsNullOrWhiteSpace(CriticalRangeValue))
+ if (string.IsNullOrWhiteSpace(registerCheckEnt.CriticalRangeValue) && !string.IsNullOrWhiteSpace(CriticalRangeValue))
{
registerCheckEnt.CriticalRangeValue = CriticalRangeValue;
}
@@ -2338,11 +2348,15 @@ namespace Shentun.Peis.DiagnosisFunctions
registerCheckEnt.IsFollowUp = isFollowUp;
}
+ if (string.IsNullOrWhiteSpace(registerCheckEnt.CriticalValueContent)&&!string.IsNullOrWhiteSpace(criticalValueContent))
+ {
+ registerCheckEnt.CriticalValueContent = criticalValueContent;
+ }
+
await _registerCheckRepository.UpdateAsync(registerCheckEnt);
}
}
-
///
/// 生成明细表危急值相关数据
///
@@ -2350,17 +2364,18 @@ namespace Shentun.Peis.DiagnosisFunctions
///
///
///
- ///
+ ///
+ ///
///
- private async Task CreateRegisterCheckItemCritical(Guid registerCheckId, Guid itemId, char? isCriticalValue, char? isFollowUp, string CriticalRangeValue)
+ private async Task CreateRegisterCheckItemCritical(Guid registerCheckId, Guid itemId, char? isCriticalValue, char? isFollowUp, string criticalRangeValue,string criticalValueContent)
{
var registerCheckItemEnt = await _registerCheckItemRepository.FirstOrDefaultAsync(m => m.RegisterCheckId == registerCheckId
&& m.ItemId == itemId);
if (registerCheckItemEnt != null)
{
- if (!string.IsNullOrWhiteSpace(CriticalRangeValue))
+ if (string.IsNullOrWhiteSpace(registerCheckItemEnt.CriticalRangeValue) && !string.IsNullOrWhiteSpace(criticalRangeValue))
{
- registerCheckItemEnt.CriticalRangeValue = CriticalRangeValue;
+ registerCheckItemEnt.CriticalRangeValue = criticalRangeValue;
}
if (isCriticalValue == 'Y')
@@ -2376,10 +2391,15 @@ namespace Shentun.Peis.DiagnosisFunctions
registerCheckItemEnt.IsFollowUp = isFollowUp;
}
+ if (string.IsNullOrWhiteSpace(registerCheckItemEnt.CriticalValueContent) && !string.IsNullOrWhiteSpace(criticalValueContent))
+ {
+ registerCheckItemEnt.CriticalValueContent = criticalValueContent;
+ }
+
await _registerCheckItemRepository.UpdateAsync(registerCheckItemEnt);
}
- }
+ }
#endregion
diff --git a/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs b/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs
index ca0908e..ae424fe 100644
--- a/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs
+++ b/src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs
@@ -291,7 +291,7 @@ namespace Shentun.Peis.PhoneFollowUps
PersonnelTypeName = _cacheService.GetPersonnelTypeNameAsync(s.FirstOrDefault().patientRegister.PersonnelTypeId).GetAwaiter().GetResult(),
SexName = _cacheService.GetSexNameAsync(s.FirstOrDefault().patientRegister.SexId).GetAwaiter().GetResult(),
Telephone = s.FirstOrDefault().patient.Telephone,
- PhoneFollowUpDetail = s.Where(m => m.phoneFollowUpEmpty != null).GroupBy(g => g.phoneFollowUpEmpty).Select(ss => new PhoneFollowUpSimpleDto
+ PhoneFollowUpDetail = s.Where(m => m.phoneFollowUpEmpty != null).GroupBy(g => g.phoneFollowUpEmpty).OrderBy(o => o.Key.PlanFollowDate).Select(ss => new PhoneFollowUpSimpleDto
{
FollowUpContent = ss.Key.FollowUpContent,
IsComplete = ss.Key.IsComplete,
@@ -312,6 +312,7 @@ namespace Shentun.Peis.PhoneFollowUps
IsCriticalValue = ss.Key.IsCriticalValue == null ? 'N' : ss.Key.IsCriticalValue.Value,
IsReview = ss.Key.IsReview == null ? 'N' : ss.Key.IsReview.Value
}).ToList(),
+ CriticalValueContents = string.Join("\n", s.Where(m => !string.IsNullOrWhiteSpace(m.registerCheck.CriticalValueContent)).Select(ss => ss.registerCheck.CriticalValueContent).Distinct()) + "\n" + string.Join("\n", s.Where(m => !string.IsNullOrWhiteSpace(m.registerCheckItem.CriticalValueContent)).Select(ss => ss.registerCheckItem.CriticalValueContent).Distinct()),
IsPhoneComplete = s.Key.IsPhoneComplete,
IsSmsComplete = s.Key.IsSmsComplete
}).ToList();