Browse Source

危急值函数

master
wxd 1 year ago
parent
commit
0e81ae5ed6
  1. 58
      src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisBuilder.cs
  2. 433
      src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
  3. 24
      src/Shentun.Peis.Application/DiagnosisFunctions/DoctorCheckDiagnosisInput.cs
  4. 18
      src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs
  5. 28
      src/Shentun.Peis.Domain.Shared/Enums/CriticalFollowValueFlag.cs
  6. 78
      src/Shentun.Peis.Domain/CacheService.cs
  7. 2
      test/Shentun.Peis.Application.Tests/DiagnosisFunctionAppServiceTest.cs

58
src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisBuilder.cs

@ -113,6 +113,62 @@ using Shentun.Peis.DiagnosisFunctions;
return GetResult(codeInput, "AsbitemDiagnosisResult", "PatientAsbitemDiagnosisInput", patient);
}
/// <summary>
/// 获取组合项目危急值函数结果
/// </summary>
/// <param name="patient"></param>
/// <param name="codeInput"></param>
/// <returns></returns>
public bool GetAsbitemCriticalResult(PatientAsbitemDiagnosisInput patient, string codeInput)
{
string result = GetResult(codeInput, "AsbitemCriticalResult", "PatientAsbitemDiagnosisInput", patient);
if (string.IsNullOrWhiteSpace(result))
return false;
return Convert.ToBoolean(result);
}
/// <summary>
/// 获取项目危急值函数结果
/// </summary>
/// <param name="patient"></param>
/// <param name="codeInput"></param>
/// <returns></returns>
public bool GetItemCriticalResult(PatientItemDiagnosisInput patient, string codeInput)
{
string result = GetResult(codeInput, "ItemCriticalResult", "PatientItemDiagnosisInput", patient);
if (string.IsNullOrWhiteSpace(result))
return false;
return Convert.ToBoolean(result);
}
/// <summary>
/// 获取组合项目随访函数结果
/// </summary>
/// <param name="patient"></param>
/// <param name="codeInput"></param>
/// <returns></returns>
public bool GetAsbitemFollowUpResult(PatientAsbitemDiagnosisInput patient, string codeInput)
{
string result = GetResult(codeInput, "AsbitemFollowUpResult", "PatientAsbitemDiagnosisInput", patient);
if (string.IsNullOrWhiteSpace(result))
return false;
return Convert.ToBoolean(result);
}
/// <summary>
/// 获取项目随访函数结果
/// </summary>
/// <param name="patient"></param>
/// <param name="codeInput"></param>
/// <returns></returns>
public bool GetItemFollowUpResult(PatientItemDiagnosisInput patient, string codeInput)
{
string result = GetResult(codeInput, "ItemFollowUpResult", "PatientItemDiagnosisInput", patient);
if (string.IsNullOrWhiteSpace(result))
return false;
return Convert.ToBoolean(result);
}
}
/// <summary>
@ -189,7 +245,7 @@ using Shentun.Peis.DiagnosisFunctions;
public class DoctorCheckItemDiagnosisResult
{
public char IsNameIntoSummary { get; set; }
public string ItemName { get; set;}
public string ItemName { get; set; }
public List<ItemDiagnosisTypeResult> ItemDiagnosisTypeResults { get; set; } = new List<ItemDiagnosisTypeResult>();
}

433
src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs

@ -4,8 +4,10 @@ using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.EntityFrameworkCore;
using NPOI.DDF;
using NPOI.POIFS.Properties;
using NUglify.Helpers;
using Shentun.Peis.Enums;
using Shentun.Peis.ItemResultMatchs;
using Shentun.Peis.Models;
using Shentun.Peis.RegisterCheckItems;
using Shentun.Peis.Sexs;
@ -23,6 +25,7 @@ using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Volo.Abp.Users;
using Xceed.Document.NET;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
@ -55,6 +58,11 @@ namespace Shentun.Peis.DiagnosisFunctions
private string _highSuffix;
string[] _numArry = { "①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨", "⑩",
"⑪", "⑫", "⑬", "⑭", "⑮", "⑯", "⑰", "⑱", "⑲", "⑳" };
private readonly IRepository<CriticalFollowValue, Guid> _criticalFollowValueRepository;
private readonly ICurrentUser _currentUser;
private readonly IRepository<FollowUp, Guid> _followUpRepository;
public DiagnosisFunctionAppService(
IRepository<PatientRegister, Guid> patientRegisterRepository,
IRepository<RegisterCheckAsbitem, Guid> registerAsbitemRepository,
@ -70,7 +78,10 @@ namespace Shentun.Peis.DiagnosisFunctions
IRepository<Unit, Guid> unitRepository,
CacheService cacheService,
SysParmValueManager sysParmValueManager,
RegisterCheckItemManager registerCheckItemManager)
RegisterCheckItemManager registerCheckItemManager,
IRepository<CriticalFollowValue, Guid> criticalFollowValueRepository,
ICurrentUser currentUser,
IRepository<FollowUp, Guid> followUpRepository)
{
this._patientRegisterRepository = patientRegisterRepository;
@ -88,7 +99,9 @@ namespace Shentun.Peis.DiagnosisFunctions
_sysParmValueManager = sysParmValueManager;
_registerCheckItemManager = registerCheckItemManager;
_unitRepository = unitRepository;
_criticalFollowValueRepository = criticalFollowValueRepository;
_currentUser = currentUser;
_followUpRepository = followUpRepository;
}
@ -234,6 +247,7 @@ namespace Shentun.Peis.DiagnosisFunctions
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/diagnosisfunction/getdiagnosisresult")]
[RemoteService(false)]
public async Task<OkObjectResult> GetDiagnosisResultAsync(GetDiagnosisResultRequestDto input)
{
throw new Exception("禁止使用");
@ -367,6 +381,12 @@ namespace Shentun.Peis.DiagnosisFunctions
}
}
/// <summary>
/// 生成小结
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/DiagnosisFunction/GetDoctorCheckDiagnosisResultAsync")]
public async Task<GetDiagnosisResultDto> GetDoctorCheckDiagnosisResultAsync(GetDiagnosisResultRequestDto input)
{
@ -428,12 +448,17 @@ namespace Shentun.Peis.DiagnosisFunctions
{
var asbitemInput = new AsbitemInput()
{
RegisterCheckId = item.registerCheck.Id,
AsbitemId = item.asbitem.Id,
AsbitemName = item.asbitem.DisplayName,
IsDiagnosisFunction = item.asbitem.IsDiagnosisFunction,
DiagnosisFunction = item.asbitem.DiagnosisFunction,
IsContinueProcess = item.asbitem.IsContinueProcess,
DefaultResult = item.asbitem.DefaultResult,
CriticalValueFunction = item.asbitem.CriticalValueFunction,
FollowUpFunction = item.asbitem.FollowUpFunction,
IsCriticalValueFunction = item.asbitem.IsCriticalValueFunction,
IsFollowUpFunction = item.asbitem.IsFollowUpFunction
};
doctorCheckDiagnosisInput.Asbitems.Add(asbitemInput);
}
@ -448,6 +473,7 @@ namespace Shentun.Peis.DiagnosisFunctions
}
var itemInput = new ItemInput()
{
RegisterCheckId = item.registerCheck.Id,
ItemId = item.item.Id,
ItemName = item.item.DisplayName,
Unit = (item.unitHaveEmpty == null) ? "" : item.unitHaveEmpty.DisplayName,
@ -462,7 +488,11 @@ namespace Shentun.Peis.DiagnosisFunctions
DisplayOrder = item.item.DisplayOrder,
ItemResultMatches = item.item.ItemResultMatches.ToList(),
ItemResultTemplates = item.item.ItemResultTemplates.ToList(),
ReferenceRanges = item.item.ReferenceRanges.ToList()
ReferenceRanges = item.item.ReferenceRanges.ToList(),
CriticalValueFunction = item.item.CriticalValueFunction,
FollowUpFunction = item.item.FollowUpFunction,
IsFollowUpFunction = item.item.IsFollowUpFunction,
IsCriticalValueFunction = item.item.IsCriticalValueFunction
};
doctorCheckDiagnosisInput.Items.Add(itemInput);
}
@ -500,9 +530,33 @@ namespace Shentun.Peis.DiagnosisFunctions
};
resultDto.DiagnosisResultDetails.Add(getDiagnosisResult_Detail);
}
#region 处理危急值函数
var isCritical = await GetPatientRegisterIsCriticalAsync(doctorCheckDiagnosisInput, resultDto);
var isFollowUp = false;
if (!isCritical)
{
//随访
isFollowUp = await GetPatientRegisterIsFollowUpAsync(doctorCheckDiagnosisInput, resultDto);
}
else
{
isFollowUp = true;
}
if (isCritical || isFollowUp)
{
await CreateFollowUpAsync(query.First().patientRegister.Id); //标记危急值 生成随访记录
}
#endregion
return resultDto;
}
#region 小结方法
private List<string> GetItemDiagnosisStringList(List<DoctorCheckItemDiagnosisResult> itemDiagnosisList)
{
var diagnosisList = new List<string>();
@ -1505,6 +1559,379 @@ namespace Shentun.Peis.DiagnosisFunctions
}
#endregion
#region 危急值函数
/// <summary>
/// 获取人员是否有危急值项目
/// 【优先处理组合项目危急值函数
/// 未触发时执行项目危急值函数
/// 未触发项目检索危急值关键字
/// 未触发检索小结是否包含危急值关键字】
/// </summary>
/// <param name="doctorCheckDiagnosisInput"></param>
/// <param name="resultDto"></param>
/// <returns></returns>
public async Task<bool> GetPatientRegisterIsCriticalAsync(
DoctorCheckDiagnosisInput doctorCheckDiagnosisInput,
GetDiagnosisResultDto resultDto)
{
var isCritical = false;
isCritical = await GetAsbitemCriticalFunction(doctorCheckDiagnosisInput);
if (isCritical)
{
return isCritical;
}
var criticalFollowValueList = await _criticalFollowValueRepository.GetListAsync(m => m.CriticalFollowValueFlag == CriticalFollowValueFlag.Critical);
//检索项目函数+关键字
isCritical = await GetItemCriticalFunction(doctorCheckDiagnosisInput, criticalFollowValueList);
if (isCritical)
{
return isCritical;
}
//检索小结
foreach (var diagnosisResult in resultDto.DiagnosisResultDetails)
{
isCritical = criticalFollowValueList.Count(m => diagnosisResult.DiagnosisResult.Contains(m.DisplayName)) > 0 ? true : false;
if (isCritical)
break;
}
return isCritical;
}
/// <summary>
/// 获取人员是否有需要随访的项目
/// 【优先处理组合项目随访函数
/// 未触发时执行项目随访函数
/// 未触发项目检索随访关键字
/// 未触发检索小结是否包含随访关键字】
/// </summary>
/// <param name="doctorCheckDiagnosisInput"></param>
/// <param name="resultDto"></param>
/// <returns></returns>
public async Task<bool> GetPatientRegisterIsFollowUpAsync(
DoctorCheckDiagnosisInput doctorCheckDiagnosisInput,
GetDiagnosisResultDto resultDto)
{
var isCritical = false;
isCritical = await GetAsbitemFollowUpFunction(doctorCheckDiagnosisInput);
if (isCritical)
{
return isCritical;
}
var criticalFollowValueList = await _criticalFollowValueRepository.GetListAsync(m => m.CriticalFollowValueFlag == CriticalFollowValueFlag.FollowUp);
//检索项目函数+关键字
isCritical = await GetItemFollowUpFunction(doctorCheckDiagnosisInput, criticalFollowValueList);
if (isCritical)
{
return isCritical;
}
//检索小结
foreach (var diagnosisResult in resultDto.DiagnosisResultDetails)
{
isCritical = criticalFollowValueList.Count(m => diagnosisResult.DiagnosisResult.Contains(m.DisplayName)) > 0 ? true : false;
if (isCritical)
break;
}
return isCritical;
}
/// <summary>
/// 组合项目危急值函数
/// </summary>
/// <param name="doctorCheckDiagnosisInput"></param>
/// <returns></returns>
private async Task<bool> GetAsbitemCriticalFunction(DoctorCheckDiagnosisInput doctorCheckDiagnosisInput)
{
bool isCritical = false;
var patientAsbitemDiagnosisInput = new PatientAsbitemDiagnosisInput()
{
SexName = doctorCheckDiagnosisInput.SexName,
Age = doctorCheckDiagnosisInput.Age
};
foreach (var item in doctorCheckDiagnosisInput.Items)
{
var itemResult = new ItemResultInput()
{
ItemId = item.ItemId,
ItemName = item.ItemName,
Result = item.Result
};
patientAsbitemDiagnosisInput.Items.Add(itemResult);
}
var diagnosisBuilder = new DiagnosisBuilder();
foreach (var asbitem in doctorCheckDiagnosisInput.Asbitems)
{
if (asbitem.IsCriticalValueFunction == 'Y' && !string.IsNullOrWhiteSpace(asbitem.CriticalValueFunction))
{
isCritical = diagnosisBuilder.GetAsbitemCriticalResult(patientAsbitemDiagnosisInput, asbitem.DiagnosisFunction);
if (isCritical)
{
await CreateRegisterCheckCritical(asbitem.RegisterCheckId, 'Y');
break;
}
}
}
return isCritical;
}
/// <summary>
/// 项目危急值函数
/// </summary>
/// <param name="doctorCheckDiagnosisInput"></param>
/// <param name="criticalFollowValueList"></param>
/// <returns></returns>
private async Task<bool> GetItemCriticalFunction(
DoctorCheckDiagnosisInput doctorCheckDiagnosisInput,
List<CriticalFollowValue> criticalFollowValueList
)
{
bool isCritical = false;
var patientItemDiagnosisInput = new PatientItemDiagnosisInput()
{
SexName = doctorCheckDiagnosisInput.SexName,
Age = doctorCheckDiagnosisInput.Age
};
var diagnosisBuilder = new DiagnosisBuilder();
foreach (var item in doctorCheckDiagnosisInput.Items)
{
if (string.IsNullOrWhiteSpace(item.Result))
{
continue;
}
if (item.IsCriticalValueFunction == 'Y' && !string.IsNullOrWhiteSpace(item.CriticalValueFunction))
{
var itemResult = new ItemResultInput()
{
ItemId = item.ItemId,
ItemName = item.ItemName,
Result = item.Result
};
patientItemDiagnosisInput.Item = itemResult;
isCritical = diagnosisBuilder.GetItemCriticalResult(patientItemDiagnosisInput, item.CriticalValueFunction);
if (isCritical)
{
await CreateRegisterCheckItemCritical(item.RegisterCheckId, item.ItemId, 'Y');
break;
}
}
//关键字检索
if (criticalFollowValueList.Count(m => item.Result.Contains(m.DisplayName)) > 0)
{
isCritical = true;
}
if (isCritical)
{
await CreateRegisterCheckItemCritical(item.RegisterCheckId, item.ItemId, 'Y');
break;
}
}
return isCritical;
}
/// <summary>
/// 组合项目随访函数
/// </summary>
/// <param name="doctorCheckDiagnosisInput"></param>
/// <returns></returns>
private async Task<bool> GetAsbitemFollowUpFunction(DoctorCheckDiagnosisInput doctorCheckDiagnosisInput)
{
bool isFollowUp = false;
var patientAsbitemDiagnosisInput = new PatientAsbitemDiagnosisInput()
{
SexName = doctorCheckDiagnosisInput.SexName,
Age = doctorCheckDiagnosisInput.Age
};
foreach (var item in doctorCheckDiagnosisInput.Items)
{
var itemResult = new ItemResultInput()
{
ItemId = item.ItemId,
ItemName = item.ItemName,
Result = item.Result
};
patientAsbitemDiagnosisInput.Items.Add(itemResult);
}
var diagnosisBuilder = new DiagnosisBuilder();
foreach (var asbitem in doctorCheckDiagnosisInput.Asbitems)
{
if (asbitem.IsFollowUpFunction == 'Y' && !string.IsNullOrWhiteSpace(asbitem.FollowUpFunction))
{
isFollowUp = diagnosisBuilder.GetAsbitemFollowUpResult(patientAsbitemDiagnosisInput, asbitem.DiagnosisFunction);
if (isFollowUp)
{
await CreateRegisterCheckCritical(asbitem.RegisterCheckId, 'Y');
break;
}
}
}
return isFollowUp;
}
/// <summary>
/// 项目随访函数
/// </summary>
/// <param name="doctorCheckDiagnosisInput"></param>
/// <param name="criticalFollowValueList"></param>
/// <returns></returns>
private async Task<bool> GetItemFollowUpFunction(
DoctorCheckDiagnosisInput doctorCheckDiagnosisInput,
List<CriticalFollowValue> criticalFollowValueList
)
{
bool isFollowUp = false;
var patientItemDiagnosisInput = new PatientItemDiagnosisInput()
{
SexName = doctorCheckDiagnosisInput.SexName,
Age = doctorCheckDiagnosisInput.Age
};
var diagnosisBuilder = new DiagnosisBuilder();
foreach (var item in doctorCheckDiagnosisInput.Items)
{
if (string.IsNullOrWhiteSpace(item.Result))
{
continue;
}
if (item.IsFollowUpFunction == 'Y' && !string.IsNullOrWhiteSpace(item.FollowUpFunction))
{
var itemResult = new ItemResultInput()
{
ItemId = item.ItemId,
ItemName = item.ItemName,
Result = item.Result
};
patientItemDiagnosisInput.Item = itemResult;
isFollowUp = diagnosisBuilder.GetItemFollowUpResult(patientItemDiagnosisInput, item.FollowUpFunction);
if (isFollowUp)
{
await CreateRegisterCheckItemCritical(item.RegisterCheckId, item.ItemId, 'N');
break;
}
}
if (criticalFollowValueList.Count(m => item.Result.Contains(m.DisplayName)) > 0)
{
isFollowUp = true;
}
if (isFollowUp)
{
await CreateRegisterCheckItemCritical(item.RegisterCheckId, item.ItemId, 'N');
break;
}
}
return isFollowUp;
}
/// <summary>
/// 生成危急值标记、随访记录
/// </summary>
/// <param name="patientRegisterId"></param>
private async Task CreateFollowUpAsync(Guid patientRegisterId)
{
var isFollowUp = await _followUpRepository.FirstOrDefaultAsync(f => f.PatientRegisterId == patientRegisterId);
if (isFollowUp == null)
{
var followUpEnt = new FollowUp
{
IsPhoneComplete = 'N',
IsSmsComplete = 'N',
PatientRegisterId = patientRegisterId
};
await _followUpRepository.InsertAsync(followUpEnt);
}
}
/// <summary>
/// 生成明细表危急值相关数据
/// </summary>
private async Task CreateRegisterCheckItemCritical(Guid registerCheckId, Guid itemId, char isCriticalValue)
{
var registerCheckItemEnt = await _registerCheckItemRepository.FirstOrDefaultAsync(m => m.RegisterCheckId == registerCheckId
&& m.ItemId == itemId);
if (registerCheckItemEnt != null)
{
registerCheckItemEnt.CriticalRangeValue = "";
registerCheckItemEnt.IsCriticalValue = isCriticalValue;
registerCheckItemEnt.CriticalValueCreatorId = _currentUser.Id;
registerCheckItemEnt.CriticalValueCreationTime = DateTime.Now;
registerCheckItemEnt.IsCriticalValueAudit = 'N';
registerCheckItemEnt.IsReview = isCriticalValue;
registerCheckItemEnt.FollowUpFlag = '1';
await _registerCheckItemRepository.UpdateAsync(registerCheckItemEnt);
}
await CreateRegisterCheckCritical(registerCheckId, isCriticalValue);
}
/// <summary>
/// 生成registerCheck表危急值相关数据
/// </summary>
private async Task CreateRegisterCheckCritical(Guid registerCheckId, char isCriticalValue)
{
var registerCheckEnt = await _registerCheckRepository.FirstOrDefaultAsync(m => m.Id == registerCheckId);
if (registerCheckEnt != null)
{
registerCheckEnt.CriticalRangeValue = "";
registerCheckEnt.IsCriticalValue = isCriticalValue;
registerCheckEnt.CriticalValueCreatorId = _currentUser.Id;
registerCheckEnt.CriticalValueCreationTime = DateTime.Now;
registerCheckEnt.IsCriticalValueAudit = 'N';
registerCheckEnt.IsReview = isCriticalValue;
registerCheckEnt.FollowUpFlag = '1';
await _registerCheckRepository.UpdateAsync(registerCheckEnt);
}
}
#endregion
}
}

24
src/Shentun.Peis.Application/DiagnosisFunctions/DoctorCheckDiagnosisInput.cs

@ -19,6 +19,7 @@ namespace Shentun.Peis.DiagnosisFunctions
public class AsbitemInput
{
public Guid RegisterCheckId { get; set; }
/// <summary>
/// 组合项目ID
/// </summary>
@ -32,10 +33,22 @@ namespace Shentun.Peis.DiagnosisFunctions
public char IsContinueProcess { get; set; }
public string DefaultResult { get; set; }
/// <summary>
/// 危急值
/// </summary>
public char IsCriticalValueFunction { get; set; }
public string CriticalValueFunction { get; set; }
/// <summary>
/// 随访
/// </summary>
public char IsFollowUpFunction { get; set; }
public string FollowUpFunction { get; set; }
}
public class ItemInput
{
public Guid RegisterCheckId { get; set; }
/// <summary>
/// 项目ID
/// </summary>
@ -57,5 +70,16 @@ namespace Shentun.Peis.DiagnosisFunctions
public List<ItemResultMatch> ItemResultMatches { get; set; }
public List<ItemResultTemplate> ItemResultTemplates { get; set; }
public List<ReferenceRange> ReferenceRanges { get; set; }
/// <summary>
/// 危急值
/// </summary>
public char IsCriticalValueFunction { get; set; }
public string CriticalValueFunction { get; set; }
/// <summary>
/// 随访
/// </summary>
public char IsFollowUpFunction { get; set; }
public string FollowUpFunction { get; set; }
}
}

18
src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs

@ -240,9 +240,9 @@ namespace Shentun.Peis.PrintReports
Age = a.Age,
PatientRegisterId = a.Id,
CustomerOrgGroupName = ac.DisplayName,
CustomerOrgName = _cacheService.GetTopCustomerOrgNameAsync(a.CustomerOrgId).Result,
CustomerOrgShortName = _cacheService.GetTopCustomerOrgAsync(a.CustomerOrgId).Result.ShortName,
DepartmentName = _cacheService.GetCustomerOrgNameAsync(a.CustomerOrgId).Result,
CustomerOrgName = _cacheService.GetTopCustomerOrgNameAsync(a.CustomerOrgId).GetAwaiter().GetResult(),
CustomerOrgShortName = _cacheService.GetTopCustomerOrgAsync(a.CustomerOrgId).GetAwaiter().GetResult().ShortName,
DepartmentName = _cacheService.GetAllDepartmentNameAsync(a.CustomerOrgId).GetAwaiter().GetResult(),
IdNo = e.IdNo,
JobCardNo = a.JobCardNo,
MedicalCardNo = a.MedicalCardNo,
@ -364,7 +364,7 @@ namespace Shentun.Peis.PrintReports
SampleTypeName = (o.sampleTypeHaveEmpty == null) ? "" : o.sampleTypeHaveEmpty.DisplayName,
SexName = o.sex.DisplayName,
CustomerOrgName = _cacheService.GetTopCustomerOrgShortNameAsync(o.patientRegister.CustomerOrgId).Result,
DepartmentName = _cacheService.GetCustomerOrgShortNameAsync(o.patientRegister.CustomerOrgId).Result,
DepartmentName = _cacheService.GetAllDepartmentNameAsync(o.patientRegister.CustomerOrgId).Result,
IsPrint = o.lisRequest.IsPrint,
IsSignIn = o.lisRequest.IsSignIn,
SamplingTime = o.lisRequest.SamplingTime,
@ -545,7 +545,7 @@ namespace Shentun.Peis.PrintReports
SampleContainerRemark = lisRequestInfo.sampleContainer.ContainerRemark,
AsbitemNames = string.Join(",", list.OrderBy(o => o.asbitem.DisplayOrder).Select(o => o.asbitem.DisplayName).Distinct()),
CustomerOrgName = _cacheService.GetTopCustomerOrgShortNameAsync(lisRequestInfo.patientRegister.CustomerOrgId).Result,
DepartmentName = _cacheService.GetCustomerOrgShortNameAsync(lisRequestInfo.patientRegister.CustomerOrgId).Result,
DepartmentName = _cacheService.GetAllDepartmentNameAsync(lisRequestInfo.patientRegister.CustomerOrgId).Result,
SampleGroupName = lisRequestInfo.sampleGroupName,
MobileTelephone = lisRequestInfo.patient.MobileTelephone,
SamplePrintCount = lisRequestInfo.samplePrintCount
@ -819,7 +819,7 @@ namespace Shentun.Peis.PrintReports
PatientRegisterNo = s.FirstOrDefault().PatientRegisterNo,
SexName = s.FirstOrDefault().SexName,
CustomerOrgName = _cacheService.GetTopCustomerOrgShortNameAsync(s.FirstOrDefault().CustomerOrgId).Result,
DepartmentName = _cacheService.GetCustomerOrgShortNameAsync(s.FirstOrDefault().CustomerOrgId).Result,
DepartmentName = _cacheService.GetAllDepartmentNameAsync(s.FirstOrDefault().CustomerOrgId).Result,
MobileTelephone = s.FirstOrDefault().MobileTelephone
});
}
@ -835,7 +835,7 @@ namespace Shentun.Peis.PrintReports
PatientRegisterNo = s.FirstOrDefault().PatientRegisterNo,
SexName = s.FirstOrDefault().SexName,
CustomerOrgName = _cacheService.GetTopCustomerOrgShortNameAsync(s.FirstOrDefault().CustomerOrgId).Result,
DepartmentName = _cacheService.GetCustomerOrgShortNameAsync(s.FirstOrDefault().CustomerOrgId).Result,
DepartmentName = _cacheService.GetAllDepartmentNameAsync(s.FirstOrDefault().CustomerOrgId).Result,
MobileTelephone = s.FirstOrDefault().MobileTelephone
});
}
@ -900,7 +900,7 @@ namespace Shentun.Peis.PrintReports
PatientRegisterNo = queryGroup.FirstOrDefault().PatientRegisterNo,
SexName = queryGroup.FirstOrDefault().SexName,
CustomerOrgName = _cacheService.GetTopCustomerOrgShortNameAsync(queryGroup.FirstOrDefault().CustomerOrgId).Result,
DepartmentName = _cacheService.GetCustomerOrgShortNameAsync(queryGroup.FirstOrDefault().CustomerOrgId).Result
DepartmentName = _cacheService.GetAllDepartmentNameAsync(queryGroup.FirstOrDefault().CustomerOrgId).Result
};
}
else if (queryGroup.Where(m => m.BarcodeMode == '1').Count() > 0)
@ -914,7 +914,7 @@ namespace Shentun.Peis.PrintReports
PatientRegisterNo = queryGroup.FirstOrDefault().PatientRegisterNo,
SexName = queryGroup.FirstOrDefault().SexName,
CustomerOrgName = _cacheService.GetTopCustomerOrgShortNameAsync(queryGroup.FirstOrDefault().CustomerOrgId).Result,
DepartmentName = _cacheService.GetCustomerOrgShortNameAsync(queryGroup.FirstOrDefault().CustomerOrgId).Result
DepartmentName = _cacheService.GetAllDepartmentNameAsync(queryGroup.FirstOrDefault().CustomerOrgId).Result
};
}

28
src/Shentun.Peis.Domain.Shared/Enums/CriticalFollowValueFlag.cs

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace Shentun.Peis.Enums
{
/// <summary>
/// 危急随访值标志
/// </summary>
public static class CriticalFollowValueFlag
{
/// <summary>
/// 危急值
/// </summary>
[Description("危急值")]
public const char Critical = '0';
/// <summary>
/// 随访值
/// </summary>
[Description("随访值")]
public const char FollowUp = '1';
}
}

78
src/Shentun.Peis.Domain/CacheService.cs

@ -3,6 +3,7 @@ using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Caching.Memory;
using Shentun.Peis.Enums;
using Shentun.Peis.Models;
using Shentun.Peis.SysParmValues;
using System;
using System.Collections.Generic;
using System.Linq;
@ -48,6 +49,8 @@ namespace Shentun.Peis
private readonly IDistributedCache<SampleType, Guid> _sampleTypeCache;
private readonly IRepository<SampleType, Guid> _sampleTypeRepository;
private readonly SysParmValueManager _sysParmValueManager;
public CacheService(
IDistributedCache<IdentityUser, Guid> userCache,
IMemoryCache customerOrgCache,
@ -73,7 +76,8 @@ namespace Shentun.Peis
IRepository<PersonnelType, Guid> personnelTypeRepository,
IDistributedCache<string, Guid> customerOrgTopNameCache,
IDistributedCache<SampleType, Guid> sampleTypeCache,
IRepository<SampleType, Guid> sampleTypeRepository)
IRepository<SampleType, Guid> sampleTypeRepository,
SysParmValueManager sysParmValueManager)
{
_userCache = userCache;
_userRepository = userRepository;
@ -110,6 +114,7 @@ namespace Shentun.Peis
_customerOrgTopNameCache = customerOrgTopNameCache;
_sampleTypeCache = sampleTypeCache;
_sampleTypeRepository = sampleTypeRepository;
_sysParmValueManager = sysParmValueManager;
}
private async Task<IdentityUser> GetUserAsync(Guid id)
@ -311,6 +316,11 @@ namespace Shentun.Peis
return entity.DisplayName;
}
/// <summary>
/// 获取部门名称
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<CustomerOrg> GetCustomerOrgAsync(Guid id)
{
var entity = (CustomerOrg)_customerOrgCache.Get(id);
@ -324,6 +334,11 @@ namespace Shentun.Peis
return entity;
}
/// <summary>
/// 获取部门名称
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<string> GetCustomerOrgNameAsync(Guid? id)
{
if (id == null || id == default(Guid) || !id.HasValue)
@ -334,6 +349,11 @@ namespace Shentun.Peis
return entity.DisplayName;
}
/// <summary>
/// 获取一级单位
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<CustomerOrg> GetTopCustomerOrgAsync(Guid id)
{
var entity = (CustomerOrg)_customerOrgCache.Get(id);
@ -379,6 +399,62 @@ namespace Shentun.Peis
return customerOrgEnt.ShortName;
}
/// <summary>
/// 获取所有部门名称
/// </summary>
/// <param name="CustomerOrgId"></param>
/// <returns></returns>
public async Task<string> GetAllDepartmentNameAsync(Guid CustomerOrgId)
{
var departmentDisplayMode = await _sysParmValueManager.GetSysParmValueAsync(Guid.Empty, "department_display_mode");
if (departmentDisplayMode == "1")
{
List<string> customerOrgNames = new List<string>();
await GetAllDepartmentNameAsync(customerOrgNames, CustomerOrgId);
if (customerOrgNames.Count > 1)
{
customerOrgNames.RemoveAt(0);
return string.Join("\\", customerOrgNames);
}
else
{
//无部门
return "";
}
}
else
{
//兼容不设置系统参数的
return await GetCustomerOrgNameAsync(CustomerOrgId);
}
}
/// <summary>
/// 遍历获取单位数据
/// </summary>
/// <param name="customerOrgNames"></param>
/// <param name="customerOrgId"></param>
/// <returns></returns>
public async Task GetAllDepartmentNameAsync(List<string> customerOrgNames, Guid? customerOrgId)
{
if (customerOrgId != null)
{
var customerOrgEnt = await GetCustomerOrgAsync(customerOrgId.Value);
if (customerOrgEnt != null)
{
if (string.IsNullOrWhiteSpace(customerOrgEnt.ShortName))
customerOrgNames.AddFirst(customerOrgEnt.DisplayName);
else
customerOrgNames.AddFirst(customerOrgEnt.ShortName);
await GetAllDepartmentNameAsync(customerOrgNames, customerOrgEnt.ParentId);
}
}
}
/// <summary>
/// 缓存取单位名称
/// </summary>

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

@ -1052,5 +1052,7 @@ namespace Shentun.Peis
return itemResult;
}
}
}
Loading…
Cancel
Save