Browse Source

医生签到,分诊叫号逻辑修改

master
wxd 12 months ago
parent
commit
dec4c83761
  1. 21
      src/Shentun.Peis.Application.Contracts/RegisterChecks/CreateDoctorSignInInputDto.cs
  2. 11
      src/Shentun.Peis.Application.Contracts/RegisterChecks/GetDoctorIsSignInDto.cs
  3. 14
      src/Shentun.Peis.Application.Contracts/RegisterChecks/GetDoctorIsSignInInputDto.cs
  4. 16
      src/Shentun.Peis.Application/QueueRegisters/QueueRegisterAppService.cs
  5. 117
      src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
  6. 25
      src/Shentun.Peis.Domain.Shared/Enums/SignInFlag.cs
  7. 27
      src/Shentun.Peis.Domain/CacheService.cs
  8. 48
      src/Shentun.Peis.Domain/DoctorSignIns/DoctorSignIn.cs
  9. 27
      src/Shentun.Peis.Domain/QueueRegisters/QueueRegisterManager.cs
  10. 30
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/DoctorSignIns/DoctorSignInDbMapping.cs
  11. 13
      src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
  12. 2
      src/Shentun.Peis.HttpApi.Host/appsettings.json

21
src/Shentun.Peis.Application.Contracts/RegisterChecks/CreateDoctorSignInInputDto.cs

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Shentun.Peis.RegisterChecks
{
public class CreateDoctorSignInInputDto
{
/// <summary>
/// 房间ID
/// </summary>
public Guid RoomId { get; set; }
/// <summary>
/// 0-签到,1-签退
/// </summary>
public char SignInFlag { get; set; } = '0';
}
}

11
src/Shentun.Peis.Application.Contracts/RegisterChecks/GetDoctorIsSignInDto.cs

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.RegisterChecks
{
public class GetDoctorIsSignInDto
{
public char IsSignIn { get; set; }
}
}

14
src/Shentun.Peis.Application.Contracts/RegisterChecks/GetDoctorIsSignInInputDto.cs

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.RegisterChecks
{
public class GetDoctorIsSignInInputDto
{
/// <summary>
/// 房间ID
/// </summary>
public Guid RoomId { get; set; }
}
}

16
src/Shentun.Peis.Application/QueueRegisters/QueueRegisterAppService.cs

@ -117,6 +117,9 @@ namespace Shentun.Peis.QueueRegisters
if (input.MedicalCenterId == Guid.Empty)
throw new UserFriendlyException("体检中心不能为空");
//已签到的房间
var roomIds = await _queueRegisterManager.GetSignInRoomAsync();
var entListDto = (from room in await _roomRepository.GetQueryableAsync()
join queueRegister in (await _queueRegisterRepository.GetQueryableAsync())
.Where(m => m.CompleteFlag == QueueRegisterCompleteFlag.Wait && m.CreationTime >= DateTime.Now.Date).AsQueryable()
@ -125,6 +128,7 @@ namespace Shentun.Peis.QueueRegisters
join itemType in await _itemTypeRepository.GetQueryableAsync()
on room.ItemTypeId equals itemType.Id into itemTypeTemp
from itemTypeEmpty in itemTypeTemp.DefaultIfEmpty()
where room.IsActive == 'Y' && roomIds.Contains(room.Id)
group new { room, itemTypeEmpty, queueRegisterEmpty } by room.Id into roomGroup
select new RoomQueueListDto
{
@ -232,11 +236,16 @@ namespace Shentun.Peis.QueueRegisters
[HttpPost("api/app/QueueRegister/GetRoomListByAsbitemId")]
public async Task<List<BaseRoomDto>> GetRoomListByAsbitemIdAsync(AsbitemIdInputDto input)
{
//已签到的房间
var roomIds = await _queueRegisterManager.GetSignInRoomAsync();
var query = (from room in await _roomRepository.GetQueryableAsync()
join roomDetail in await _roomDetailRepository.GetQueryableAsync() on room.Id equals roomDetail.RoomId
join queueRegister in await _queueRegisterRepository.GetQueryableAsync() on room.Id equals queueRegister.RoomId into queueRegisterTemp
from queueRegisterHaveEmpty in queueRegisterTemp.DefaultIfEmpty()
where roomDetail.AsbitemId == input.AsbitemId
&& room.IsActive == 'Y'
&& roomIds.Contains(room.Id)
orderby room.DisplayOrder ascending
select new
{
@ -278,6 +287,13 @@ namespace Shentun.Peis.QueueRegisters
[HttpPost("api/app/QueueRegister/ManualQueuingRoom")]
public async Task<QueueRegisterByPatientRegisterIdDto> ManualQueuingRoomAsync(ManualQueuingRoomInputDto input)
{
//已签到的房间
var roomIds = await _queueRegisterManager.GetSignInRoomAsync();
if (!roomIds.Contains(input.RoomId))
{
throw new UserFriendlyException("房间未签到,不能分配");
}
//删除排队操作
await _queueRegisterRepository.DeleteAsync(d => d.PatientRegisterId == input.PatientRegisterId, true);

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

@ -57,6 +57,7 @@ namespace Shentun.Peis.RegisterChecks
private readonly IRepository<Asbitem, Guid> _asbitemRepository;
private readonly IRepository<LisRequest, Guid> _lisRequestRepository;
private readonly FollowUpAppService _followUpAppService;
private readonly IRepository<DoctorSignIn, Guid> _doctorSignInRepository;
public RegisterCheckAppService(IRepository<RegisterCheck, Guid> registerCheckRepository,
IRepository<RegisterCheckItem> registerCheckItemRepository,
@ -76,7 +77,8 @@ namespace Shentun.Peis.RegisterChecks
IRepository<RegisterCheckAsbitem> registerCheckAsbitemRepository,
IRepository<ItemType> itemTypeRepository,
IRepository<LisRequest, Guid> lisRequestRepository,
FollowUpAppService followUpAppService)
FollowUpAppService followUpAppService,
IRepository<DoctorSignIn, Guid> doctorSignInRepository)
{
_registerCheckRepository = registerCheckRepository;
_userRepository = userRepository;
@ -97,6 +99,7 @@ namespace Shentun.Peis.RegisterChecks
_itemTypeRepository = itemTypeRepository;
_lisRequestRepository = lisRequestRepository;
_followUpAppService = followUpAppService;
_doctorSignInRepository = doctorSignInRepository;
}
/// <summary>
@ -758,6 +761,118 @@ namespace Shentun.Peis.RegisterChecks
}
/// <summary>
/// 医生签到 签退
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/RegisterCheck/CreateDoctorSignIn")]
public async Task CreateDoctorSignInAsync(CreateDoctorSignInInputDto input)
{
//1、创建日期就是签到日期
//2、创建者ID就是签到的医生ID
//3、今天已经签到的再点签到的时候不做处理
//4、签退的再点签到先将当天sign_in_flag标志为0的这条记录设置为1,然后重新创建一条签到记录
//5、分配房间的逻辑修改为只能分配给已经签到的房间
var doctorId = _currentUser.Id;
if (doctorId != null)
{
if (input.SignInFlag == SignInFlag.SignIn)
{
//签到
var doctorSignInEnt = await _doctorSignInRepository.FirstOrDefaultAsync(f => f.CreatorId == doctorId
&& f.RoomId == input.RoomId
&& f.CreationTime.Date == DateTime.Now.Date);
if (doctorSignInEnt != null)
{
if (doctorSignInEnt.SignInFlag == SignInFlag.SignOut)
{
//有签退记录
//创建一条信息的
doctorSignInEnt = new DoctorSignIn
{
RoomId = doctorSignInEnt.RoomId,
SignInFlag = SignInFlag.SignIn
};
await _doctorSignInRepository.InsertAsync(doctorSignInEnt);
}
else
{
throw new UserFriendlyException("当天已签到");
}
}
else
{
//当天无记录 直接插入
doctorSignInEnt = new DoctorSignIn
{
RoomId = doctorSignInEnt.RoomId,
SignInFlag = SignInFlag.SignIn
};
await _doctorSignInRepository.InsertAsync(doctorSignInEnt);
}
}
else
{
//签退
var doctorSignInEnt = await _doctorSignInRepository.FirstOrDefaultAsync(f => f.CreatorId == doctorId
&& f.RoomId == input.RoomId
&& f.CreationTime.Date == DateTime.Now.Date);
if (doctorSignInEnt != null)
{
doctorSignInEnt.SignInFlag = SignInFlag.SignOut;
doctorSignInEnt.SignOutDate = DateTime.Now;
await _doctorSignInRepository.UpdateAsync(doctorSignInEnt);
}
else
{
throw new UserFriendlyException("当天无签到记录");
}
}
}
else
{
throw new UserFriendlyException("医生未登录");
}
}
/// <summary>
/// 获取医生是否签到
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/RegisterCheck/GetDoctorIsSignIn")]
public async Task<GetDoctorIsSignInDto> GetDoctorIsSignInAsync(GetDoctorIsSignInInputDto input)
{
var entDto = new GetDoctorIsSignInDto
{
IsSignIn = 'N'
};
var doctorId = _currentUser.Id;
if (doctorId != null)
{
//签到
var doctorSignInEnt = await _doctorSignInRepository.FirstOrDefaultAsync(f => f.CreatorId == doctorId
&& f.RoomId == input.RoomId
&& f.CreationTime.Date == DateTime.Now.Date
&& f.SignInFlag == SignInFlag.SignIn);
if (doctorSignInEnt != null)
{
entDto.IsSignIn = 'Y';
}
}
else
{
throw new UserFriendlyException("医生未登录");
}
return entDto;
}
}

25
src/Shentun.Peis.Domain.Shared/Enums/SignInFlag.cs

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace Shentun.Peis.Enums
{
/// <summary>
/// 医生签到枚举 0-签到 1-签退
/// </summary>
public static class SignInFlag
{
/// <summary>
/// 签到
/// </summary>
[Description("签到")]
public const char SignIn = '0';
/// <summary>
/// 签退
/// </summary>
[Description("签退")]
public const char SignOut = '1';
}
}

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

@ -552,6 +552,33 @@ namespace Shentun.Peis
return entity.DisplayName;
}
/// <summary>
/// 获取顶级单位ID 直取,不按配置来,用登记界面做单位比较
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<Guid> GetTopCustomerOrgIdAsync(Guid id)
{
Guid topCustomerOrgId = id;
var entity = (CustomerOrg)_customerOrgCache.Get(id);
if (entity == null)
{
entity = await _customerOrgRepository.GetAsync(o => o.Id == id);
_customerOrgCache.Set(id, entity);
}
if (entity.PathCode.Length > 5)
{
entity = await _customerOrgRepository.GetAsync(o => o.PathCode == entity.PathCode.Substring(0, 5));
topCustomerOrgId = entity.Id;
}
return topCustomerOrgId;
}
private async Task<SampleType> GetSampleTypeAsync(Guid id)
{

48
src/Shentun.Peis.Domain/DoctorSignIns/DoctorSignIn.cs

@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Domain.Entities;
namespace Shentun.Peis.Models
{
/// <summary>
/// 医生签到表
/// </summary>
[Table("doctor_sign_in")]
public class DoctorSignIn : AuditedEntity<Guid>, IHasConcurrencyStamp
{
[Column("room_id")]
public Guid RoomId { get; set; }
/// <summary>
/// 0-签到,1-签退
/// </summary>
[Column("sign_in_flag")]
[MaxLength(1)]
public char SignInFlag { get; set; }
/// <summary>
/// 签退日期
/// </summary>
[Column("sign_out_date")]
public DateTime? SignOutDate { get; set; }
[Column("concurrency_stamp")]
public string ConcurrencyStamp { get; set; }
}
}

27
src/Shentun.Peis.Domain/QueueRegisters/QueueRegisterManager.cs

@ -21,14 +21,15 @@ namespace Shentun.Peis.QueueRegisters
private readonly IRepository<RegisterCheckAsbitem, Guid> _registerCheckAsbitemRepository;
private readonly IRepository<RoomDetail> _roomDetailRepository;
private readonly IRepository<Room, Guid> _roomRepository;
private readonly IRepository<DoctorSignIn, Guid> _doctorSignInRepository;
public QueueRegisterManager(
IRepository<QueueRegister, Guid> queueRegisterRepository,
IRepository<PatientRegister, Guid> patientRegisterRepository,
IRepository<RegisterCheck, Guid> registerCheckRepository,
IRepository<RegisterCheckAsbitem, Guid> registerCheckAsbitemRepository,
IRepository<RoomDetail> roomDetailRepository,
IRepository<Room, Guid> roomRepository)
IRepository<Room, Guid> roomRepository,
IRepository<DoctorSignIn, Guid> doctorSignInRepository)
{
_queueRegisterRepository = queueRegisterRepository;
_patientRegisterRepository = patientRegisterRepository;
@ -36,6 +37,7 @@ namespace Shentun.Peis.QueueRegisters
_registerCheckAsbitemRepository = registerCheckAsbitemRepository;
_roomDetailRepository = roomDetailRepository;
_roomRepository = roomRepository;
_doctorSignInRepository = doctorSignInRepository;
}
/// <summary>
/// 人员排队
@ -76,6 +78,9 @@ namespace Shentun.Peis.QueueRegisters
/// <returns></returns>
public async Task<QueueRegister> AutomaticQueuingRoomAsync(Guid PatientRegisterId)
{
//当天签到房间
var roomIds = await GetSignInRoomAsync();
//获取当前人员登记的所有项目
var asbitemIds = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
join registerCheck in await _registerCheckRepository.GetQueryableAsync()
@ -95,6 +100,8 @@ namespace Shentun.Peis.QueueRegisters
on room.Id equals queueRegister.RoomId into queueRegisterTemp
from queueRegisterHaveEmpty in queueRegisterTemp.DefaultIfEmpty()
where asbitemIds.Contains(roomDetail.AsbitemId)
&& room.IsActive == 'Y'
&& roomIds.Contains(room.Id)
select new
{
roomId = room.Id,
@ -154,5 +161,21 @@ namespace Shentun.Peis.QueueRegisters
return queueRegisterEnt;
}
/// <summary>
/// 获取当天签到的房间
/// </summary>
/// <returns></returns>
public async Task<List<Guid>> GetSignInRoomAsync()
{
List<Guid> roomIds = new List<Guid>();
roomIds = (await _doctorSignInRepository.GetListAsync(m => m.CreationTime.Date == DateTime.Now.Date
&& m.SignInFlag == SignInFlag.SignIn))
.Select(s => s.RoomId)
.Distinct()
.ToList();
return roomIds;
}
}
}

30
src/Shentun.Peis.EntityFrameworkCore/DbMapping/DoctorSignIns/DoctorSignInDbMapping.cs

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Shentun.Peis.EntityFrameworkCore;
namespace Shentun.Peis.DbMapping
{
internal class DoctorSignInDbMapping : IEntityTypeConfiguration<DoctorSignIn>
{
public void Configure(EntityTypeBuilder<DoctorSignIn> entity)
{
entity.HasComment("医生签到表");
entity.Property(e => e.RoomId).HasComment("房间ID");
entity.Property(e => e.SignInFlag).HasComment("0-签到,1-签退");
entity.Property(e => e.SignOutDate).HasComment("签退日期");
entity.Property(e => e.Id).IsFixedLength();
entity.ConfigureByConvention();
}
}
}

13
src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs

@ -332,14 +332,14 @@ public class PeisDbContext :
#endregion
#region 收费申请
public DbSet<ChargeRequest> ChargeRequests { get; set; } = null!;
public DbSet<ChargeRequestAsbitem> ChargeRequestAsbitems { get; set; } = null!;
public DbSet<ChargeRequest> ChargeRequests { get; set; } = null!;
public DbSet<ChargeRequestAsbitem> ChargeRequestAsbitems { get; set; } = null!;
#endregion
#region 第三方接口
public DbSet<ThirdInterface> ThirdInterfaces { get; set; } = null!;
#endregion
public DbSet<CollectItemType> CollectItemTypes { get; set; } = null!;
public DbSet<PatientRegisterExter> PatientRegisterExters { get; set; } = null!;
@ -359,7 +359,7 @@ public class PeisDbContext :
public DbSet<PatientPastMedicalHistory> PatientPastMedicalHistorys { get; set; } = null!;
public DbSet<OcCheckTypeDetail> OcCheckTypeDetails { get; set; }=null!;
public DbSet<OcCheckTypeDetail> OcCheckTypeDetails { get; set; } = null!;
public DbSet<RoomDetail> RoomDetails { get; set; } = null!;
@ -379,6 +379,8 @@ public class PeisDbContext :
public DbSet<DicomFileDetail> DicomFileDetails { get; set; } = null!;
public DbSet<DoctorSignIn> DoctorSignIns { get; set; } = null!;
public PeisDbContext(DbContextOptions<PeisDbContext> options)
: base(options)
{
@ -629,7 +631,8 @@ public class PeisDbContext :
.ApplyConfiguration(new ThirdBookingDbMapping())
.ApplyConfiguration(new ThirdMedicalCenterBookingDateDbMapping())
.ApplyConfiguration(new ThirdMedicalCenterDbMapping())
.ApplyConfiguration(new DicomFileDetailDbMapping());
.ApplyConfiguration(new DicomFileDetailDbMapping())
.ApplyConfiguration(new DoctorSignInDbMapping());
#endregion

2
src/Shentun.Peis.HttpApi.Host/appsettings.json

@ -5,8 +5,10 @@
"CorsOrigins": "https://*.Peis.com,http://localhost:4200,http://localhost:9530,http://192.168.1.108:9530,http://localhost:8080,http://localhost:8081",
"RedirectAllowedUrls": "http://localhost:9530",
"SelfUser": "admin",
//"SelfPassword": "Shentun!@#qwe123",
"SelfPassword": "666666",
"LisUser": "admin",
//"LisPassword": "Shentun!@#qwe123"
"LisPassword": "666666"
},
"ConnectionStrings": {

Loading…
Cancel
Save