Browse Source

分诊排队

master
wxd 3 weeks ago
parent
commit
f198e4268e
  1. 5
      src/Shentun.Peis.Application.Contracts/Rooms/CreateRoomDto.cs
  2. 5
      src/Shentun.Peis.Application.Contracts/Rooms/RoomDto.cs
  3. 6
      src/Shentun.Peis.Application.Contracts/Rooms/UpdateRoomDto.cs
  4. 25
      src/Shentun.Peis.Application/QueueRegisters/QueueRegisterAppService.cs
  5. 3
      src/Shentun.Peis.Application/Rooms/RoomAppService.cs
  6. 8
      src/Shentun.Peis.Domain/Rooms/Room.cs
  7. 4
      src/Shentun.Peis.Domain/Rooms/RoomManager.cs
  8. 2
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/Rooms/RoomDbMapping.cs
  9. 16846
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20260403100304_update_room_add_queue_room_flag.Designer.cs
  10. 26
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20260403100304_update_room_add_queue_room_flag.cs
  11. 6
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

5
src/Shentun.Peis.Application.Contracts/Rooms/CreateRoomDto.cs

@ -36,5 +36,10 @@ namespace Shentun.Peis.Rooms
public char IsActive { get; set; } public char IsActive { get; set; }
/// <summary>
/// 分诊模式 0-默认模式(单房间) 1-多房间模式 2-多房间模式, 并且启用自动排队(人员签到等模式)
/// </summary>
public char QueueRoomFlag { get; set; } = '0';
} }
} }

5
src/Shentun.Peis.Application.Contracts/Rooms/RoomDto.cs

@ -41,5 +41,10 @@ namespace Shentun.Peis.Rooms
public char IsActive { get; set; } public char IsActive { get; set; }
/// <summary>
/// 分诊模式 0-默认模式(单房间) 1-多房间模式 2-多房间模式, 并且启用自动排队(人员签到等模式)
/// </summary>
public char QueueRoomFlag { get; set; }
} }
} }

6
src/Shentun.Peis.Application.Contracts/Rooms/UpdateRoomDto.cs

@ -35,5 +35,11 @@ namespace Shentun.Peis.Rooms
public char IsActive { get; set; } public char IsActive { get; set; }
/// <summary>
/// 分诊模式 0-默认模式(单房间) 1-多房间模式 2-多房间模式, 并且启用自动排队(人员签到等模式)
/// </summary>
public char QueueRoomFlag { get; set; } = '0';
} }
} }

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

@ -97,7 +97,7 @@ namespace Shentun.Peis.QueueRegisters
join patientRegister in await _patientRegisterRepository.GetQueryableAsync() on queueRegister.PatientRegisterId equals patientRegister.Id join patientRegister in await _patientRegisterRepository.GetQueryableAsync() on queueRegister.PatientRegisterId equals patientRegister.Id
where queueRegister.PatientRegisterId == input.PatientRegisterId where queueRegister.PatientRegisterId == input.PatientRegisterId
&& queueRegister.CreationTime >= DateTime.Now.Date && queueRegister.CreationTime >= DateTime.Now.Date
orderby queueRegister.CreationTime descending
orderby room.QueueRoomFlag ascending, queueRegister.CreationTime descending
select new select new
{ {
queueRegister, queueRegister,
@ -161,7 +161,7 @@ namespace Shentun.Peis.QueueRegisters
doctorAutoSignIn = "Y"; doctorAutoSignIn = "Y";
if (doctorAutoSignIn == "Y") if (doctorAutoSignIn == "Y")
{ {
@ -200,7 +200,7 @@ namespace Shentun.Peis.QueueRegisters
join itemType in await _itemTypeRepository.GetQueryableAsync() join itemType in await _itemTypeRepository.GetQueryableAsync()
on room.ItemTypeId equals itemType.Id into itemTypeTemp on room.ItemTypeId equals itemType.Id into itemTypeTemp
from itemTypeEmpty in itemTypeTemp.DefaultIfEmpty() from itemTypeEmpty in itemTypeTemp.DefaultIfEmpty()
where room.IsActive == 'Y'
where room.IsActive == 'Y'
group new { room, itemTypeEmpty, queueRegisterEmpty } by room.Id into roomGroup group new { room, itemTypeEmpty, queueRegisterEmpty } by room.Id into roomGroup
select new RoomQueueListDto select new RoomQueueListDto
{ {
@ -217,7 +217,7 @@ namespace Shentun.Peis.QueueRegisters
} }
@ -429,9 +429,11 @@ namespace Shentun.Peis.QueueRegisters
} }
} }
var yesDelRoomIds = (await _roomRepository.GetListAsync(m => m.QueueRoomFlag == '0')).Select(s => s.Id).ToList();
//删除排队操作 //删除排队操作
await _queueRegisterRepository.DeleteAsync(d => d.PatientRegisterId == input.PatientRegisterId await _queueRegisterRepository.DeleteAsync(d => d.PatientRegisterId == input.PatientRegisterId
&& d.CompleteFlag != QueueRegisterCompleteFlag.AlreadyCalled, true);
&& d.CompleteFlag != QueueRegisterCompleteFlag.AlreadyCalled && yesDelRoomIds.Contains(d.RoomId), true);
var entity = await _queueRegisterManager.ManualQueuingRoomAsync(input.PatientRegisterId, input.RoomId); var entity = await _queueRegisterManager.ManualQueuingRoomAsync(input.PatientRegisterId, input.RoomId);
@ -452,9 +454,14 @@ namespace Shentun.Peis.QueueRegisters
[HttpPost("api/app/QueueRegister/AutomaticQueuingRoom")] [HttpPost("api/app/QueueRegister/AutomaticQueuingRoom")]
public async Task<QueueRegisterByPatientRegisterIdDto> AutomaticQueuingRoomAsync(AutomaticQueuingRoomInputDto input) public async Task<QueueRegisterByPatientRegisterIdDto> AutomaticQueuingRoomAsync(AutomaticQueuingRoomInputDto input)
{ {
var yesDelRoomIds = (await _roomRepository.GetListAsync(m => m.QueueRoomFlag == '0')).Select(s => s.Id).ToList();
//删除排队操作 //删除排队操作
await _queueRegisterRepository.DeleteAsync(d => d.PatientRegisterId == input.PatientRegisterId await _queueRegisterRepository.DeleteAsync(d => d.PatientRegisterId == input.PatientRegisterId
&& d.CompleteFlag != QueueRegisterCompleteFlag.AlreadyCalled, true);
&& d.CompleteFlag != QueueRegisterCompleteFlag.AlreadyCalled && yesDelRoomIds.Contains(d.RoomId), true);
var entity = await _queueRegisterManager.AutomaticQueuingRoomAsync(input.PatientRegisterId, new List<Guid>()); var entity = await _queueRegisterManager.AutomaticQueuingRoomAsync(input.PatientRegisterId, new List<Guid>());
@ -829,9 +836,11 @@ namespace Shentun.Peis.QueueRegisters
throw new UserFriendlyException("无排队信息"); throw new UserFriendlyException("无排队信息");
} }
var yesDelRoomIds = (await _roomRepository.GetListAsync(m => m.QueueRoomFlag == '0')).Select(s => s.Id).ToList();
//删除排队操作 //删除排队操作
await _queueRegisterRepository.DeleteAsync(d => d.PatientRegisterId == input.PatientRegisterId await _queueRegisterRepository.DeleteAsync(d => d.PatientRegisterId == input.PatientRegisterId
&& d.CompleteFlag != QueueRegisterCompleteFlag.AlreadyCalled, true);
&& d.CompleteFlag != QueueRegisterCompleteFlag.AlreadyCalled && yesDelRoomIds.Contains(d.RoomId), true);
var entity = await _queueRegisterManager.AutomaticQueuingRoomAsync(input.PatientRegisterId, asbitemIds.Select(s => s.AsbitemId).ToList()); var entity = await _queueRegisterManager.AutomaticQueuingRoomAsync(input.PatientRegisterId, asbitemIds.Select(s => s.AsbitemId).ToList());
@ -938,7 +947,7 @@ namespace Shentun.Peis.QueueRegisters
join patientRegister in await _patientRegisterRepository.GetQueryableAsync() on queueRegister.PatientRegisterId equals patientRegister.Id join patientRegister in await _patientRegisterRepository.GetQueryableAsync() on queueRegister.PatientRegisterId equals patientRegister.Id
where queueRegister.PatientRegisterId == patientRegisterFirst.patientRegister.Id where queueRegister.PatientRegisterId == patientRegisterFirst.patientRegister.Id
&& queueRegister.CreationTime >= DateTime.Now.Date && queueRegister.CreationTime >= DateTime.Now.Date
orderby queueRegister.CreationTime descending
orderby room.QueueRoomFlag ascending, queueRegister.CreationTime descending
select new select new
{ {
queueRegister, queueRegister,

3
src/Shentun.Peis.Application/Rooms/RoomAppService.cs

@ -82,7 +82,8 @@ namespace Shentun.Peis.Rooms
RoomTypeFlag = s.RoomTypeFlag, RoomTypeFlag = s.RoomTypeFlag,
RoomNo = s.RoomNo, RoomNo = s.RoomNo,
LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).GetAwaiter().GetResult(), LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).GetAwaiter().GetResult(),
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).GetAwaiter().GetResult()
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).GetAwaiter().GetResult(),
QueueRoomFlag = s.QueueRoomFlag
}).ToList(); }).ToList();
return entListDto; return entListDto;

8
src/Shentun.Peis.Domain/Rooms/Room.cs

@ -76,6 +76,14 @@ namespace Shentun.Peis.Models
[Column("display_order")] [Column("display_order")]
public int DisplayOrder { get; set; } public int DisplayOrder { get; set; }
/// <summary>
/// 分诊模式 0-默认模式(单房间) 1-多房间模式 2-多房间模式, 并且启用自动排队(人员签到等模式)
/// </summary>
[Column("queue_room_flag")]
public char QueueRoomFlag { get; set; }
[Column("concurrency_stamp")] [Column("concurrency_stamp")]
public string ConcurrencyStamp { get; set; } public string ConcurrencyStamp { get; set; }

4
src/Shentun.Peis.Domain/Rooms/RoomManager.cs

@ -47,7 +47,8 @@ namespace Shentun.Peis.Rooms
QueueTime = entity.QueueTime, QueueTime = entity.QueueTime,
RoomNo = GenerateRoomNo().Result, RoomNo = GenerateRoomNo().Result,
MedicalCenterId = entity.MedicalCenterId, MedicalCenterId = entity.MedicalCenterId,
RoomTypeFlag = entity.RoomTypeFlag
RoomTypeFlag = entity.RoomTypeFlag,
QueueRoomFlag = entity.QueueRoomFlag
}; };
} }
@ -79,6 +80,7 @@ namespace Shentun.Peis.Rooms
targetEntity.QueueTime = sourceEntity.QueueTime; targetEntity.QueueTime = sourceEntity.QueueTime;
targetEntity.MedicalCenterId = sourceEntity.MedicalCenterId; targetEntity.MedicalCenterId = sourceEntity.MedicalCenterId;
targetEntity.RoomTypeFlag = sourceEntity.RoomTypeFlag; targetEntity.RoomTypeFlag = sourceEntity.RoomTypeFlag;
targetEntity.QueueRoomFlag = sourceEntity.QueueRoomFlag;
} }

2
src/Shentun.Peis.EntityFrameworkCore/DbMapping/Rooms/RoomDbMapping.cs

@ -32,7 +32,7 @@ namespace Shentun.Peis.DbMapping
entity.Property(e => e.RoomTypeFlag).HasDefaultValueSql("0").IsRequired(); entity.Property(e => e.RoomTypeFlag).HasDefaultValueSql("0").IsRequired();
entity.Property(e => e.QueueRoomFlag).HasDefaultValueSql("0").IsRequired();
entity.HasOne(d => d.ItemType) entity.HasOne(d => d.ItemType)
.WithMany(p => p.Rooms) .WithMany(p => p.Rooms)

16846
src/Shentun.Peis.EntityFrameworkCore/Migrations/20260403100304_update_room_add_queue_room_flag.Designer.cs
File diff suppressed because it is too large
View File

26
src/Shentun.Peis.EntityFrameworkCore/Migrations/20260403100304_update_room_add_queue_room_flag.cs

@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class update_room_add_queue_room_flag : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<char>(
name: "queue_room_flag",
table: "room",
type: "character(1)",
nullable: false,
defaultValueSql: "0");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "queue_room_flag",
table: "room");
}
}
}

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

@ -10607,6 +10607,12 @@ namespace Shentun.Peis.Migrations
.IsFixedLength() .IsFixedLength()
.HasComment("体检中心"); .HasComment("体检中心");
b.Property<char>("QueueRoomFlag")
.ValueGeneratedOnAdd()
.HasColumnType("character(1)")
.HasColumnName("queue_room_flag")
.HasDefaultValueSql("0");
b.Property<decimal>("QueueTime") b.Property<decimal>("QueueTime")
.HasPrecision(3, 1) .HasPrecision(3, 1)
.HasColumnType("numeric(3,1)") .HasColumnType("numeric(3,1)")

Loading…
Cancel
Save