Browse Source

危急值

master
wxd 2 years ago
parent
commit
e3e2b325c6
  1. 27
      src/Shentun.Peis.Application.Contracts/FollowUps/FollowUpDto.cs
  2. 11
      src/Shentun.Peis.Application.Contracts/FollowUps/FollowUpIdInputDto.cs
  3. 27
      src/Shentun.Peis.Application.Contracts/FollowUps/GetFollowUpListInputDto.cs
  4. 31
      src/Shentun.Peis.Application.Contracts/PhoneFollowUps/CreatePhoneFollowUpDto.cs
  5. 41
      src/Shentun.Peis.Application.Contracts/RegisterCheckItems/UpdateRegisterCheckItemCriticalInputDto.cs
  6. 2
      src/Shentun.Peis.Application.Contracts/RegisterChecks/RegisterCheckDto.cs
  7. 38
      src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateRegisterCheckCriticalInputDto.cs
  8. 17
      src/Shentun.Peis.Application/DiagnosisFunctions/DiagnosisFunctionAppService.cs
  9. 109
      src/Shentun.Peis.Application/FollowUps/FollowUpAppService.cs
  10. 39
      src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs
  11. 72
      src/Shentun.Peis.Application/RegisterCheckItems/RegisterCheckItemAppService.cs
  12. 68
      src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
  13. 11
      src/Shentun.Peis.Domain/FollowUps/FollowUp.cs
  14. 58
      src/Shentun.Peis.Domain/FollowUps/FollowUpManager.cs
  15. 6
      src/Shentun.Peis.Domain/PatientRegisters/PatientRegister.cs
  16. 23
      src/Shentun.Peis.Domain/PhoneFollowUps/PhoneFollowUp.cs
  17. 6
      src/Shentun.Peis.Domain/SmsSends/SmsSend.cs
  18. 2
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/PhoneFollows/PhoneFollowDbMapping.cs
  19. 2
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/SmsSends/SmsSendDbMapping.cs
  20. 15637
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240919025259_update_follow_up_follow_up_date.Designer.cs
  21. 38
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240919025259_update_follow_up_follow_up_date.cs
  22. 12
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

27
src/Shentun.Peis.Application.Contracts/FollowUps/FollowUpDto.cs

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Shentun.Peis.FollowUps
{
public class FollowUpDto : AuditedEntityDtoName
{
/// <summary>
/// 人员登记ID
/// </summary>
public Guid PatientRegisterId { get; set; }
/// <summary>
/// 是否短信随访创建完成
/// </summary>
public char IsSmsComplete { get; set; }
/// <summary>
/// 是否电话随访创建完成
/// </summary>
public char IsPhoneComplete { get; set; }
}
}

11
src/Shentun.Peis.Application.Contracts/FollowUps/FollowUpIdInputDto.cs

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.FollowUps
{
public class FollowUpIdInputDto
{
public Guid FollowUpId { get; set; }
}
}

27
src/Shentun.Peis.Application.Contracts/FollowUps/GetFollowUpListInputDto.cs

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Shentun.Peis.FollowUps
{
public class GetFollowUpListInputDto
{
/// <summary>
/// 人员登记ID 集合
/// </summary>
public List<Guid> PatientRegisterIds { get; set; } = new List<Guid>();
/// <summary>
/// 是否短信随访创建完成
/// </summary>
public char? IsSmsComplete { get; set; }
/// <summary>
/// 是否电话随访创建完成
/// </summary>
public char? IsPhoneComplete { get; set; }
}
}

31
src/Shentun.Peis.Application.Contracts/PhoneFollowUps/CreatePhoneFollowUpDto.cs

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Shentun.Peis.PhoneFollowUps
{
public class CreatePhoneFollowUpDto
{
/// <summary>
/// 表达式
/// </summary>
public string CornValue { get; set; }
/// <summary>
/// 随访主表ID
/// </summary>
public Guid FollowUpId { get; set; }
/// <summary>
/// 随访内容
/// </summary>
public string FollowUpContent { get; set; }
/// <summary>
/// 回复内容
/// </summary>
public string? ReplyContent { get; set; }
}
}

41
src/Shentun.Peis.Application.Contracts/RegisterCheckItems/UpdateRegisterCheckItemCriticalInputDto.cs

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.RegisterCheckItems
{
public class UpdateRegisterCheckItemCriticalInputDto
{
public Guid RegisterCheckId { get; set; }
public Guid ItemId { get; set; }
/// <summary>
/// 危急值标志 Y N 无需修改时传null
/// </summary>
public char? IsCriticalValue { get; set; }
/// <summary>
/// 随访值标志 Y N 无需修改时传null
/// </summary>
public char? IsFollowUp { get; set; }
/// <summary>
/// 危急值医生填写的内容
/// </summary>
public string CriticalValueContent { get; set; }
/// <summary>
/// 危急值是否审核 Y N 无需修改时传null
/// </summary>
public char? IsCriticalValueAudit { get; set; }
/// <summary>
/// 该项目要复查 Y N 无需修改时传null
/// </summary>
public char? IsReview { get; set; }
}
}

2
src/Shentun.Peis.Application.Contracts/RegisterChecks/RegisterCheckDto.cs

@ -87,5 +87,7 @@ namespace Shentun.Peis.RegisterChecks
///// 检查组合项目记录ID
///// </summary>
//public Guid RegisterAsbitemId { get; set; }
public string AsbitemName { get; set; }
}
}

38
src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateRegisterCheckCriticalInputDto.cs

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.RegisterChecks
{
public class UpdateRegisterCheckCriticalInputDto
{
public Guid RegisterCheckId { get; set; }
/// <summary>
/// 危急值标志 Y N 无需修改时传null
/// </summary>
public char? IsCriticalValue { get; set; }
/// <summary>
/// 随访值标志 Y N 无需修改时传null
/// </summary>
public char? IsFollowUp { get; set; }
/// <summary>
/// 危急值医生填写的内容
/// </summary>
public string CriticalValueContent { get; set; }
/// <summary>
/// 危急值是否审核 Y N 无需修改时传null
/// </summary>
public char? IsCriticalValueAudit { get; set; }
/// <summary>
/// 该项目要复查 Y N 无需修改时传null
/// </summary>
public char? IsReview { get; set; }
}
}

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

@ -7,8 +7,10 @@ using NPOI.DDF;
using NPOI.POIFS.Properties;
using NUglify.Helpers;
using Shentun.Peis.Enums;
using Shentun.Peis.FollowUps;
using Shentun.Peis.ItemResultMatchs;
using Shentun.Peis.Models;
using Shentun.Peis.PatientRegisters;
using Shentun.Peis.RegisterCheckItems;
using Shentun.Peis.Sexs;
using Shentun.Peis.SumDiagnosises;
@ -62,6 +64,7 @@ namespace Shentun.Peis.DiagnosisFunctions
private readonly IRepository<CriticalFollowValue, Guid> _criticalFollowValueRepository;
private readonly ICurrentUser _currentUser;
private readonly IRepository<FollowUp, Guid> _followUpRepository;
private readonly FollowUpAppService _followUpAppService;
public DiagnosisFunctionAppService(
IRepository<PatientRegister, Guid> patientRegisterRepository,
@ -81,7 +84,8 @@ namespace Shentun.Peis.DiagnosisFunctions
RegisterCheckItemManager registerCheckItemManager,
IRepository<CriticalFollowValue, Guid> criticalFollowValueRepository,
ICurrentUser currentUser,
IRepository<FollowUp, Guid> followUpRepository)
IRepository<FollowUp, Guid> followUpRepository,
FollowUpAppService followUpAppService)
{
this._patientRegisterRepository = patientRegisterRepository;
@ -102,6 +106,7 @@ namespace Shentun.Peis.DiagnosisFunctions
_criticalFollowValueRepository = criticalFollowValueRepository;
_currentUser = currentUser;
_followUpRepository = followUpRepository;
_followUpAppService = followUpAppService;
}
@ -547,7 +552,11 @@ namespace Shentun.Peis.DiagnosisFunctions
if (isCritical || isFollowUp)
{
await CreateFollowUpAsync(query.First().patientRegister.Id); //标记危急值 生成随访记录
//await CreateFollowUpAsync(query.First().patientRegister.Id); //标记危急值 生成随访记录
await _followUpAppService.CreateAsync(new PatientRegisterIdInputDto
{
PatientRegisterId = query.First().patientRegister.Id
});
}
#endregion
@ -1911,7 +1920,7 @@ namespace Shentun.Peis.DiagnosisFunctions
registerCheckItemEnt.CriticalValueCreatorId = _currentUser.Id;
registerCheckItemEnt.CriticalValueCreationTime = DateTime.Now;
registerCheckItemEnt.IsCriticalValueAudit = 'N';
registerCheckItemEnt.IsReview = isCriticalValue;
registerCheckItemEnt.IsReview = 'N';
registerCheckItemEnt.FollowUpFlag = '1';
await _registerCheckItemRepository.UpdateAsync(registerCheckItemEnt);
@ -1937,7 +1946,7 @@ namespace Shentun.Peis.DiagnosisFunctions
registerCheckEnt.CriticalValueCreatorId = _currentUser.Id;
registerCheckEnt.CriticalValueCreationTime = DateTime.Now;
registerCheckEnt.IsCriticalValueAudit = 'N';
registerCheckEnt.IsReview = isCriticalValue;
registerCheckEnt.IsReview = 'N';
registerCheckEnt.FollowUpFlag = '1';
await _registerCheckRepository.UpdateAsync(registerCheckEnt);

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

@ -0,0 +1,109 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Shentun.Peis.Models;
using Shentun.Peis.PatientRegisters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
namespace Shentun.Peis.FollowUps
{
/// <summary>
/// 随访主表
/// </summary>
[ApiExplorerSettings(GroupName = "Work")]
[Authorize]
public class FollowUpAppService : ApplicationService
{
private readonly IRepository<FollowUp, Guid> _followUpRepository;
private readonly CacheService _cacheService;
private readonly FollowUpManager _followUpManager;
public FollowUpAppService(
IRepository<FollowUp, Guid> followUpRepository,
CacheService cacheService,
FollowUpManager followUpManager
)
{
_followUpRepository = followUpRepository;
_cacheService = cacheService;
_followUpManager = followUpManager;
}
/// <summary>
/// 生成危急值标记、随访记录
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/FollowUp/Create")]
public async Task CreateAsync(PatientRegisterIdInputDto input)
{
var isFollowUp = await _followUpRepository.FirstOrDefaultAsync(f => f.PatientRegisterId == input.PatientRegisterId);
if (isFollowUp == null)
{
var followUpEnt = new FollowUp
{
IsPhoneComplete = 'N',
IsSmsComplete = 'N',
PatientRegisterId = input.PatientRegisterId
};
await _followUpRepository.InsertAsync(followUpEnt);
}
}
/// <summary>
/// 获取随访主表记录 可根据人员跟状态筛选
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/FollowUp/GetList")]
public async Task<List<FollowUpDto>> GetListAsync(GetFollowUpListInputDto input)
{
var query = await _followUpRepository.GetQueryableAsync();
if (input.PatientRegisterIds.Any())
{
query = query.Where(m => input.PatientRegisterIds.Contains(m.PatientRegisterId));
}
if (input.IsPhoneComplete != null)
{
query = query.Where(m => m.IsPhoneComplete == input.IsPhoneComplete);
}
if (input.IsSmsComplete != null)
{
query = query.Where(m => m.IsSmsComplete == input.IsSmsComplete);
}
var entListDto = query.ToList().Select(s => new FollowUpDto
{
CreationTime = s.CreationTime,
CreatorId = s.CreatorId,
Id = s.Id,
IsPhoneComplete = s.IsPhoneComplete,
IsSmsComplete = s.IsSmsComplete,
LastModificationTime = s.LastModificationTime,
LastModifierId = s.LastModifierId,
PatientRegisterId = s.PatientRegisterId,
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).GetAwaiter().GetResult(),
LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).GetAwaiter().GetResult()
}).ToList();
return entListDto;
}
/// <summary>
/// 删除记录
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/FollowUp/Delete")]
public async Task DeleteAsync(FollowUpIdInputDto input)
{
await _followUpManager.CheckAndDeleteAsync(input.FollowUpId);
}
}
}

39
src/Shentun.Peis.Application/PhoneFollowUps/PhoneFollowUpAppService.cs

@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
namespace Shentun.Peis.PhoneFollowUps
{
/// <summary>
/// 电话随访记录
/// </summary>
[ApiExplorerSettings(GroupName = "Work")]
[Authorize]
public class PhoneFollowUpAppService : ApplicationService
{
private readonly IRepository<PhoneFollowUp, Guid> _phoneFollowUpRepository;
public PhoneFollowUpAppService(IRepository<PhoneFollowUp, Guid> phoneFollowUpRepository)
{
_phoneFollowUpRepository = phoneFollowUpRepository;
}
///// <summary>
///// 创建电话随访记录
///// </summary>
///// <param name="input"></param>
///// <returns></returns>
//public async Task CreateAsync(CreatePhoneFollowUpDto input)
//{
//}
}
}

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

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Enums;
using Shentun.Peis.FollowUps;
using Shentun.Peis.GuideTypes;
using Shentun.Peis.Models;
using Shentun.Peis.PatientRegisters;
@ -18,6 +19,7 @@ using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Users;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace Shentun.Peis.RegisterCheckItems
{
@ -39,6 +41,8 @@ namespace Shentun.Peis.RegisterCheckItems
private readonly IRepository<RegisterCheckAsbitem, Guid> _registerCheckAsbitemRepository;
private readonly IRepository<AsbitemDetail> _asbitemDetailRepository;
private readonly CacheService _cacheService;
private readonly ICurrentUser _currentUser;
private readonly FollowUpAppService _followUpAppService;
public RegisterCheckItemAppService(
IRepository<RegisterCheckItem> registerCheckItemRepository,
IRepository<IdentityUser, Guid> userRepository,
@ -50,7 +54,9 @@ namespace Shentun.Peis.RegisterCheckItems
CacheService cacheService,
IRepository<RegisterCheck, Guid> registerCheckRepository,
IRepository<RegisterCheckAsbitem, Guid> registerCheckAsbitemRepository,
IRepository<AsbitemDetail> asbitemDetailRepository)
IRepository<AsbitemDetail> asbitemDetailRepository,
ICurrentUser currentUser,
FollowUpAppService followUpAppService)
{
this._registerCheckItemRepository = registerCheckItemRepository;
this._userRepository = userRepository;
@ -63,6 +69,8 @@ namespace Shentun.Peis.RegisterCheckItems
_registerCheckRepository = registerCheckRepository;
_registerCheckAsbitemRepository = registerCheckAsbitemRepository;
_asbitemDetailRepository = asbitemDetailRepository;
_currentUser = currentUser;
_followUpAppService = followUpAppService;
}
/// <summary>
@ -299,6 +307,7 @@ namespace Shentun.Peis.RegisterCheckItems
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("api/app/RegisterCheckItem/TempHandRegisterCheckItem")]
[RemoteService(false)]
public async Task TempHandRegisterCheckItemAsync(Guid AsbitemId)
{
var query = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
@ -347,5 +356,66 @@ namespace Shentun.Peis.RegisterCheckItems
}
/// <summary>
/// 修改明细表危急值相关内容
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/RegisterCheckItem/UpdateRegisterCheckItemCritical")]
public async Task UpdateRegisterCheckItemCriticalAsync(UpdateRegisterCheckItemCriticalInputDto input)
{
var registerCheckItemEnt = await _registerCheckItemRepository.FirstOrDefaultAsync(f => f.RegisterCheckId == input.RegisterCheckId && f.ItemId == input.ItemId);
if (registerCheckItemEnt == null)
{
throw new UserFriendlyException("参数不正确");
}
if (input.IsCriticalValue != null)
{
registerCheckItemEnt.IsCriticalValue = input.IsCriticalValue;
}
if (input.IsCriticalValueAudit != null)
{
registerCheckItemEnt.IsCriticalValueAudit = input.IsCriticalValueAudit;
}
if (input.IsReview != null)
{
registerCheckItemEnt.IsReview = input.IsReview;
}
if (!string.IsNullOrWhiteSpace(input.CriticalValueContent))
{
registerCheckItemEnt.CriticalValueContent = input.CriticalValueContent;
}
if (input.IsFollowUp != null && input.IsFollowUp == 'Y')
{
registerCheckItemEnt.FollowUpFlag = '1';
}
if (registerCheckItemEnt.CriticalValueCreatorId == null)
{
registerCheckItemEnt.CriticalValueCreatorId = _currentUser.Id;
registerCheckItemEnt.CriticalValueCreationTime = DateTime.Now;
}
await _registerCheckItemRepository.UpdateAsync(registerCheckItemEnt);
if ((input.IsFollowUp != null && input.IsFollowUp == 'Y')
|| (input.IsCriticalValue != null && input.IsCriticalValue == 'Y'))
{
var registerCheckEnt = await _registerCheckRepository.FirstOrDefaultAsync(f => f.Id == input.RegisterCheckId);
if (registerCheckEnt != null)
{
//增加随访表记录
await _followUpAppService.CreateAsync(new PatientRegisterIdInputDto
{
PatientRegisterId = registerCheckEnt.PatientRegisterId
});
}
}
}
}
}

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

@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration;
using Org.BouncyCastle.Asn1.Ocsp;
using Shentun.Peis.Asbitems;
using Shentun.Peis.Enums;
using Shentun.Peis.FollowUps;
using Shentun.Peis.MenuInfos;
using Shentun.Peis.Models;
using Shentun.Peis.PatientRegisters;
@ -55,6 +56,7 @@ namespace Shentun.Peis.RegisterChecks
private readonly IRepository<UserItemType> _userItemTypeRepository;
private readonly IRepository<Asbitem, Guid> _asbitemRepository;
private readonly IRepository<LisRequest, Guid> _lisRequestRepository;
private readonly FollowUpAppService _followUpAppService;
public RegisterCheckAppService(IRepository<RegisterCheck, Guid> registerCheckRepository,
IRepository<RegisterCheckItem> registerCheckItemRepository,
@ -73,7 +75,8 @@ namespace Shentun.Peis.RegisterChecks
IRepository<Asbitem, Guid> asbitemRepository,
IRepository<RegisterCheckAsbitem> registerCheckAsbitemRepository,
IRepository<ItemType> itemTypeRepository,
IRepository<LisRequest, Guid> lisRequestRepository)
IRepository<LisRequest, Guid> lisRequestRepository,
FollowUpAppService followUpAppService)
{
_registerCheckRepository = registerCheckRepository;
_userRepository = userRepository;
@ -93,6 +96,7 @@ namespace Shentun.Peis.RegisterChecks
_registerCheckAsbitemRepository = registerCheckAsbitemRepository;
_itemTypeRepository = itemTypeRepository;
_lisRequestRepository = lisRequestRepository;
_followUpAppService = followUpAppService;
}
/// <summary>
@ -105,6 +109,7 @@ namespace Shentun.Peis.RegisterChecks
{
var registerCheckEntity = (await _registerCheckRepository.GetQueryableAsync())
.Include(x => x.RegisterCheckAsbitems)
.ThenInclude(x => x.Asbitem)
.FirstOrDefault(f => f.Id == id);
var registerCheckDto = new RegisterCheckDto
@ -133,7 +138,8 @@ namespace Shentun.Peis.RegisterChecks
ThirdInfo = registerCheckEntity.ThirdInfo,
LastModifierName = _cacheService.GetSurnameAsync(registerCheckEntity.LastModifierId).Result,
CreatorName = _cacheService.GetSurnameAsync(registerCheckEntity.CreatorId).Result,
IsCharge = registerCheckEntity.RegisterCheckAsbitems.Where(m => m.PayTypeFlag == PayTypeFlag.PersonPay && m.IsCharge == 'N').Count() > 0 ? 'N' : 'Y'
IsCharge = registerCheckEntity.RegisterCheckAsbitems.Where(m => m.PayTypeFlag == PayTypeFlag.PersonPay && m.IsCharge == 'N').Count() > 0 ? 'N' : 'Y',
AsbitemName = string.Join(",", registerCheckEntity.RegisterCheckAsbitems.Select(rs => rs.Asbitem.DisplayName).ToList())
};
return registerCheckDto;
@ -625,6 +631,64 @@ namespace Shentun.Peis.RegisterChecks
}
}
}
/// <summary>
/// 修改检查表危急值相关内容
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/RegisterCheck/UpdateRegisterCheckCritical")]
public async Task UpdateRegisterCheckCriticalAsync(UpdateRegisterCheckCriticalInputDto input)
{
var registerCheckEnt = await _registerCheckRepository.FirstOrDefaultAsync(f => f.Id == input.RegisterCheckId);
if (registerCheckEnt == null)
{
throw new UserFriendlyException("参数不正确");
}
if (input.IsCriticalValue != null)
{
registerCheckEnt.IsCriticalValue = input.IsCriticalValue;
}
if (input.IsCriticalValueAudit != null)
{
registerCheckEnt.IsCriticalValueAudit = input.IsCriticalValueAudit;
}
if (input.IsReview != null)
{
registerCheckEnt.IsReview = input.IsReview;
}
if (!string.IsNullOrWhiteSpace(input.CriticalValueContent))
{
registerCheckEnt.CriticalValueContent = input.CriticalValueContent;
}
if (input.IsFollowUp != null && input.IsFollowUp == 'Y')
{
registerCheckEnt.FollowUpFlag = '1';
}
if (registerCheckEnt.CriticalValueCreatorId == null)
{
registerCheckEnt.CriticalValueCreatorId = _currentUser.Id;
registerCheckEnt.CriticalValueCreationTime = DateTime.Now;
}
await _registerCheckRepository.UpdateAsync(registerCheckEnt);
if ((input.IsFollowUp != null && input.IsFollowUp == 'Y')
|| (input.IsCriticalValue != null && input.IsCriticalValue == 'Y'))
{
//增加随访表记录
await _followUpAppService.CreateAsync(new PatientRegisterIdInputDto
{
PatientRegisterId = registerCheckEnt.PatientRegisterId
});
}
}
}

11
src/Shentun.Peis.Domain/FollowUps/FollowUp.cs

@ -16,6 +16,12 @@ namespace Shentun.Peis.Models
[Table("follow_up")]
public class FollowUp : AuditedEntity<Guid>, IHasConcurrencyStamp
{
public FollowUp()
{
PhoneFollowUps = new HashSet<PhoneFollowUp>();
}
/// <summary>
/// 登记流水号
/// </summary>
@ -40,6 +46,11 @@ namespace Shentun.Peis.Models
[Column("concurrency_stamp")]
public string ConcurrencyStamp { get; set; }
[InverseProperty(nameof(PhoneFollowUp.FollowUp))]
public virtual ICollection<PhoneFollowUp> PhoneFollowUps { get; set; }
}

58
src/Shentun.Peis.Domain/FollowUps/FollowUpManager.cs

@ -0,0 +1,58 @@
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
namespace Shentun.Peis.FollowUps
{
/// <summary>
/// 随访主表
/// </summary>
public class FollowUpManager : DomainService
{
private readonly IRepository<FollowUp, Guid> _followUpRepository;
private readonly IRepository<PhoneFollowUp, Guid> _phoneFollowUpRepository;
private readonly IRepository<SmsSend, Guid> _smsSendRepository;
public FollowUpManager(
IRepository<FollowUp, Guid> followUpRepository,
IRepository<PhoneFollowUp, Guid> phoneFollowUpRepository,
IRepository<SmsSend, Guid> smsSendRepository
)
{
_followUpRepository = followUpRepository;
_phoneFollowUpRepository = phoneFollowUpRepository;
_smsSendRepository = smsSendRepository;
}
/// <summary>
/// 删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async Task CheckAndDeleteAsync(Guid id)
{
var phoneFollowUpEnt = await _phoneFollowUpRepository.FirstOrDefaultAsync(m => m.FollowUpId == id);
if (phoneFollowUpEnt != null)
{
throw new UserFriendlyException($"已创建电话随访记录,不能删除");
}
var smsSendEnt = await _smsSendRepository.FirstOrDefaultAsync(m => m.FollowUpId == id);
if (smsSendEnt != null)
{
throw new UserFriendlyException($"已创建短信随访记录,不能删除");
}
await _followUpRepository.DeleteAsync(id);
}
}
}

6
src/Shentun.Peis.Domain/PatientRegisters/PatientRegister.cs

@ -26,7 +26,6 @@ namespace Shentun.Peis.Models
PatientOccupationalHistories = new HashSet<PatientOccupationalHistory>();
PatientPoisons = new HashSet<PatientPoison>();
PatientSymptoms = new HashSet<PatientSymptom>();
PhoneFollows = new HashSet<PhoneFollowUp>();
QueueRegisters = new HashSet<QueueRegister>();
RegisterCheckAsbitems = new HashSet<RegisterCheckAsbitem>();
SumDiagnoses = new HashSet<SumDiagnosis>();
@ -43,7 +42,6 @@ namespace Shentun.Peis.Models
PatientOccupationalHistories = new HashSet<PatientOccupationalHistory>();
PatientPoisons = new HashSet<PatientPoison>();
PatientSymptoms = new HashSet<PatientSymptom>();
PhoneFollows = new HashSet<PhoneFollowUp>();
QueueRegisters = new HashSet<QueueRegister>();
RegisterCheckAsbitems = new HashSet<RegisterCheckAsbitem>();
SumDiagnoses = new HashSet<SumDiagnosis>();
@ -348,8 +346,8 @@ namespace Shentun.Peis.Models
public virtual ICollection<PatientPoison> PatientPoisons { get; set; }
[InverseProperty(nameof(PatientSymptom.PatientRegister))]
public virtual ICollection<PatientSymptom> PatientSymptoms { get; set; }
[InverseProperty(nameof(PhoneFollowUp.PatientRegister))]
public virtual ICollection<PhoneFollowUp> PhoneFollows { get; set; }
//[InverseProperty(nameof(PhoneFollowUp.PatientRegister))]
//public virtual ICollection<PhoneFollowUp> PhoneFollows { get; set; }
[InverseProperty(nameof(QueueRegister.PatientRegister))]
public virtual ICollection<QueueRegister> QueueRegisters { get; set; }
[InverseProperty(nameof(RegisterCheckAsbitem.PatientRegister))]

23
src/Shentun.Peis.Domain/PhoneFollowUps/PhoneFollowUp.cs

@ -14,11 +14,11 @@ namespace Shentun.Peis.Models
[Table("phone_follow_up")]
public class PhoneFollowUp : AuditedEntity<Guid>, IHasConcurrencyStamp
{
/// <summary>
/// 病人登记ID
/// </summary>
[Column("patient_register_id")]
public Guid PatientRegisterId { get; set; }
///// <summary>
///// 病人登记ID
///// </summary>
//[Column("patient_register_id")]
//public Guid PatientRegisterId { get; set; }
/// <summary>
/// 随访内容
/// </summary>
@ -42,8 +42,13 @@ namespace Shentun.Peis.Models
/// 随访ID
/// </summary>
[Column("follow_up_id")]
public Guid? FollowUpId { get; set; }
public Guid FollowUpId { get; set; }
/// <summary>
/// 随访日期
/// </summary>
[Column("follow_up_date")]
public DateTime FollowUpDate { get; set; }
/// <summary>
/// 是否完成
@ -69,9 +74,9 @@ namespace Shentun.Peis.Models
//[StringLength(40)]
//public string ConcurrencyStamp { get; set; } = null!;
[ForeignKey(nameof(PatientRegisterId))]
[InverseProperty("PhoneFollows")]
public virtual PatientRegister PatientRegister { get; set; } = null!;
[ForeignKey(nameof(FollowUpId))]
[InverseProperty("PhoneFollowUps")]
public virtual FollowUp FollowUp { get; set; } = null!;
//public override object[] GetKeys()
//{

6
src/Shentun.Peis.Domain/SmsSends/SmsSend.cs

@ -63,6 +63,12 @@ namespace Shentun.Peis.Models
[MaxLength(1)]
public char IsComplete { get; set; }
/// <summary>
/// 短信推送时间
/// </summary>
[Column("send_date")]
public DateTime? SendDate { get; set; }
[Column("concurrency_stamp")]
public string ConcurrencyStamp { get; set; }

2
src/Shentun.Peis.EntityFrameworkCore/DbMapping/PhoneFollows/PhoneFollowDbMapping.cs

@ -23,7 +23,7 @@ namespace Shentun.Peis.DbMapping
entity.Property(e => e.Id).ValueGeneratedNever().IsRequired();
//entity.Property(e => e.CreationTime).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
entity.Property(e => e.FollowUpDate).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
//entity.Property(e => e.LastModificationTime).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");

2
src/Shentun.Peis.EntityFrameworkCore/DbMapping/SmsSends/SmsSendDbMapping.cs

@ -22,7 +22,7 @@ namespace Shentun.Peis.DbMapping
entity.Property(t => t.MobileTelephone).HasComment("手机号").IsRequired();
entity.Property(t => t.Content).HasComment("短信内容").IsRequired();
entity.Property(t => t.IsComplete).HasComment("是否完成").IsRequired().HasDefaultValueSql("'N'");
entity.Property(e => e.SendDate).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
entity.Property(e => e.Id).ValueGeneratedNever();
entity.Property(e => e.SmsTypeId).IsFixedLength();

15637
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240919025259_update_follow_up_follow_up_date.Designer.cs
File diff suppressed because it is too large
View File

38
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240919025259_update_follow_up_follow_up_date.cs

@ -0,0 +1,38 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class update_follow_up_follow_up_date : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "send_date",
table: "sms_send",
type: "timestamp without time zone",
nullable: true,
defaultValueSql: "(date(timezone('UTC-8'::text, now())) - 1)");
migrationBuilder.AddColumn<DateTime>(
name: "follow_up_date",
table: "phone_follow_up",
type: "timestamp without time zone",
nullable: false,
defaultValueSql: "(date(timezone('UTC-8'::text, now())) - 1)");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "send_date",
table: "sms_send");
migrationBuilder.DropColumn(
name: "follow_up_date",
table: "phone_follow_up");
}
}
}

12
src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

@ -7841,6 +7841,12 @@ namespace Shentun.Peis.Migrations
.HasColumnName("follow_up_content")
.HasComment("随访内容");
b.Property<DateTime>("FollowUpDate")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp without time zone")
.HasColumnName("follow_up_date")
.HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
b.Property<Guid>("FollowUpId")
.HasColumnType("uuid")
.HasColumnName("follow_up_id");
@ -10519,6 +10525,12 @@ namespace Shentun.Peis.Migrations
.HasColumnName("patient_name")
.HasComment("姓名");
b.Property<DateTime?>("SendDate")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp without time zone")
.HasColumnName("send_date")
.HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
b.Property<string>("SmsTypeId")
.IsRequired()
.HasMaxLength(2)

Loading…
Cancel
Save