wxd 1 year ago
parent
commit
49ff090d4e
  1. 3
      src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
  2. 24
      src/Shentun.Peis.Application/FollowUps/FollowUpAppService.cs
  3. 9
      src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs
  4. 12
      src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs

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

@ -1988,11 +1988,12 @@ namespace Shentun.Peis.DiagnosisFunctions
if (registerCheckEnt != null) if (registerCheckEnt != null)
{ {
registerCheckEnt.CriticalRangeValue = CriticalRangeValue; registerCheckEnt.CriticalRangeValue = CriticalRangeValue;
registerCheckEnt.IsCriticalValue = isCriticalValue;
if (isCriticalValue == 'Y') if (isCriticalValue == 'Y')
{ {
registerCheckEnt.CriticalValueCreatorId = _currentUser.Id; registerCheckEnt.CriticalValueCreatorId = _currentUser.Id;
registerCheckEnt.CriticalValueCreationTime = DateTime.Now; registerCheckEnt.CriticalValueCreationTime = DateTime.Now;
registerCheckEnt.IsCriticalValue = isCriticalValue;
} }
registerCheckEnt.FollowUpCreatorId = _currentUser.Id; registerCheckEnt.FollowUpCreatorId = _currentUser.Id;
registerCheckEnt.FollowUpCreationTime = DateTime.Now; registerCheckEnt.FollowUpCreationTime = DateTime.Now;

24
src/Shentun.Peis.Application/FollowUps/FollowUpAppService.cs

@ -27,6 +27,8 @@ namespace Shentun.Peis.FollowUps
private readonly IRepository<SmsSend, Guid> _smsSendRepository; private readonly IRepository<SmsSend, Guid> _smsSendRepository;
private readonly SmsSendAppService _smsSendAppService; private readonly SmsSendAppService _smsSendAppService;
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository;
private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository;
private readonly IRepository<RegisterCheckItem> _registerCheckItemRepository;
public FollowUpAppService( public FollowUpAppService(
IRepository<FollowUp, Guid> followUpRepository, IRepository<FollowUp, Guid> followUpRepository,
CacheService cacheService, CacheService cacheService,
@ -34,7 +36,9 @@ namespace Shentun.Peis.FollowUps
IRepository<PhoneFollowUp, Guid> phoneFollowUpRepository, IRepository<PhoneFollowUp, Guid> phoneFollowUpRepository,
IRepository<SmsSend, Guid> smsSendRepository, IRepository<SmsSend, Guid> smsSendRepository,
SmsSendAppService smsSendAppService, SmsSendAppService smsSendAppService,
IRepository<PatientRegister, Guid> patientRegisterRepository)
IRepository<PatientRegister, Guid> patientRegisterRepository,
IRepository<RegisterCheck, Guid> registerCheckRepository,
IRepository<RegisterCheckItem> registerCheckItemRepository)
{ {
_followUpRepository = followUpRepository; _followUpRepository = followUpRepository;
_cacheService = cacheService; _cacheService = cacheService;
@ -43,6 +47,8 @@ namespace Shentun.Peis.FollowUps
_smsSendRepository = smsSendRepository; _smsSendRepository = smsSendRepository;
_smsSendAppService = smsSendAppService; _smsSendAppService = smsSendAppService;
_patientRegisterRepository = patientRegisterRepository; _patientRegisterRepository = patientRegisterRepository;
_registerCheckRepository = registerCheckRepository;
_registerCheckItemRepository = registerCheckItemRepository;
} }
/// <summary> /// <summary>
@ -76,6 +82,21 @@ namespace Shentun.Peis.FollowUps
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
public async Task DeleteByPatientRegisterId(PatientRegisterIdInputDto input) public async Task DeleteByPatientRegisterId(PatientRegisterIdInputDto input)
{
//检查是否所有项目都没有
var isFollowUpDelete = (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 patientRegister.Id == input.PatientRegisterId
&& (registerCheck.IsFollowUp == 'Y'
|| registerCheck.IsCriticalValue == 'Y'
|| registerCheckItem.IsCriticalValue == 'Y'
|| registerCheckItem.IsFollowUp == 'Y')
select patientRegister.Id
).Count();
if (isFollowUpDelete == 0)
{ {
var isFollowUp = await _followUpRepository.FirstOrDefaultAsync(f => f.PatientRegisterId == input.PatientRegisterId); var isFollowUp = await _followUpRepository.FirstOrDefaultAsync(f => f.PatientRegisterId == input.PatientRegisterId);
if (isFollowUp != null) if (isFollowUp != null)
@ -116,6 +137,7 @@ namespace Shentun.Peis.FollowUps
} }
} }
} }
}
/// <summary> /// <summary>
/// 获取随访主表记录 可根据人员跟状态筛选 /// 获取随访主表记录 可根据人员跟状态筛选

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

@ -444,12 +444,21 @@ namespace Shentun.Peis.RegisterCheckItems
} }
else else
{ {
var registerCheckItemCount = await _registerCheckItemRepository.CountAsync(c => c.RegisterCheckId == input.RegisterCheckId && (c.IsFollowUp == 'Y' || c.IsCriticalValue == 'Y'));
if (registerCheckItemCount == 0)
{
//更新registerCheck
registerCheckEnt.IsCriticalValue = registerCheckItemEnt.IsCriticalValue;
registerCheckEnt.IsFollowUp= registerCheckItemEnt.IsFollowUp;
await _registerCheckRepository.UpdateAsync(registerCheckEnt);
//删除随访表记录 //删除随访表记录
await _followUpAppService.DeleteByPatientRegisterId(new PatientRegisterIdInputDto await _followUpAppService.DeleteByPatientRegisterId(new PatientRegisterIdInputDto
{ {
PatientRegisterId = registerCheckEnt.PatientRegisterId PatientRegisterId = registerCheckEnt.PatientRegisterId
}); });
} }
}
} }

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

@ -736,6 +736,18 @@ namespace Shentun.Peis.RegisterChecks
} }
else else
{ {
#region 更新明细项目的危急值跟随访值状态
var registerCheckItemList = await _registerCheckItemRepository.GetListAsync(m => m.RegisterCheckId == input.RegisterCheckId);
foreach (var registerCheckItem in registerCheckItemList)
{
registerCheckItem.IsCriticalValue = registerCheckEnt.IsCriticalValue;
registerCheckItem.IsFollowUp = registerCheckEnt.IsFollowUp;
}
await _registerCheckItemRepository.UpdateManyAsync(registerCheckItemList);
#endregion
//删除随访表记录 //删除随访表记录
await _followUpAppService.DeleteByPatientRegisterId(new PatientRegisterIdInputDto await _followUpAppService.DeleteByPatientRegisterId(new PatientRegisterIdInputDto
{ {

Loading…
Cancel
Save