Browse Source

叫号

master
wxd 1 year ago
parent
commit
be50f27fba
  1. 19
      src/Shentun.Peis.Application.Contracts/QueueRegisters/QueueRegisterListByRoomIdInputDto.cs
  2. 1
      src/Shentun.Peis.Application.Contracts/Rooms/RoomIdInputDto.cs
  3. 11
      src/Shentun.Peis.Application.Contracts/Rooms/RoomNoInputDto.cs
  4. 51
      src/Shentun.Peis.Application/QueueRegisters/QueueRegisterAppService.cs
  5. 8
      src/Shentun.Peis.Domain/Rooms/Room.cs
  6. 24
      src/Shentun.Peis.Domain/Rooms/RoomManager.cs
  7. 2
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/Rooms/RoomDbMapping.cs
  8. 15069
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240723111319_room_add_room_no.Designer.cs
  9. 39
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240723111319_room_add_room_no.cs
  10. 11
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

19
src/Shentun.Peis.Application.Contracts/QueueRegisters/QueueRegisterListByRoomIdInputDto.cs

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.QueueRegisters
{
public class QueueRegisterListByRoomIdInputDto
{
/// <summary>
/// 房间ID
/// </summary>
public Guid RoomId { get; set; }
/// <summary>
/// 项目类别id集合
/// </summary>
public List<Guid> ItemTypeIds { get; set; } = new List<Guid>();
}
}

1
src/Shentun.Peis.Application.Contracts/Rooms/RoomIdInputDto.cs

@ -10,5 +10,6 @@ namespace Shentun.Peis.Rooms
/// 房间ID
/// </summary>
public Guid RoomId { get; set; }
}
}

11
src/Shentun.Peis.Application.Contracts/Rooms/RoomNoInputDto.cs

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.Rooms
{
public class RoomNoInputDto
{
public string RoomNo { get; set; }
}
}

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

@ -322,12 +322,14 @@ namespace Shentun.Peis.QueueRegisters
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/QueueRegister/GetQueueRegisterListByRoomId")]
public async Task<GetQueueRegisterListByRoomIdDto> GetQueueRegisterListByRoomIdAsync(RoomIdInputDto input)
public async Task<GetQueueRegisterListByRoomIdDto> GetQueueRegisterListByRoomIdAsync(QueueRegisterListByRoomIdInputDto input)
{
var entDto = new GetQueueRegisterListByRoomIdDto();
var query = from queueRegister in await _queueRegisterRepository.GetQueryableAsync()
join patientRegister in await _patientRegisterRepository.GetQueryableAsync()
on queueRegister.PatientRegisterId equals patientRegister.Id
join roomDetail in await _roomDetailRepository.GetQueryableAsync()
on queueRegister.RoomId equals roomDetail.RoomId
where queueRegister.CreationTime >= DateTime.Now.Date
&& queueRegister.RoomId == input.RoomId
select new
@ -336,10 +338,42 @@ namespace Shentun.Peis.QueueRegisters
patientName = patientRegister.PatientName,
isVip = patientRegister.IsVip,
queueRegisterId = queueRegister.Id,
queueRegisterNumber = queueRegister.DisplayOrder
queueRegisterNumber = queueRegister.DisplayOrder,
patientRegisterId = queueRegister.PatientRegisterId,
roomId = queueRegister.RoomId,
asbitemId = roomDetail.AsbitemId
};
entDto.WaitDetail = query.Where(m => m.completeFlag == QueueRegisterCompleteFlag.Wait)
if (input.ItemTypeIds.Any())
{
//筛选项目类别
//项目类别下登记的所有组合项目
var asbitemIds = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
join registerCheck in await _registerCheckRepository.GetQueryableAsync()
on patientRegister.Id equals registerCheck.PatientRegisterId
join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync()
on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId
join asbitem in await _asbitemRepository.GetQueryableAsync()
on registerCheckAsbitem.AsbitemId equals asbitem.Id
where input.ItemTypeIds.Contains(asbitem.ItemTypeId)
select registerCheckAsbitem.AsbitemId).ToList();
query = query.Where(m => asbitemIds.Contains(m.asbitemId));
}
var roomGroup = query.ToList().GroupBy(g => g.queueRegisterId).Select(s => new
{
completeFlag = s.FirstOrDefault().completeFlag,
patientName = s.FirstOrDefault().patientName,
isVip = s.FirstOrDefault().isVip,
queueRegisterId = s.Key,
queueRegisterNumber = s.FirstOrDefault().queueRegisterNumber,
}).ToList();
entDto.WaitDetail = roomGroup.Where(m => m.completeFlag == QueueRegisterCompleteFlag.Wait)
.Select(s => new GetQueueRegisterListByRoomIdDetailDto
{
IsVip = s.isVip,
@ -348,7 +382,7 @@ namespace Shentun.Peis.QueueRegisters
QueueRegisterNumber = s.queueRegisterNumber
}).ToList();
entDto.AlreadyCalledDetail = query.Where(m => m.completeFlag == QueueRegisterCompleteFlag.AlreadyCalled)
entDto.AlreadyCalledDetail = roomGroup.Where(m => m.completeFlag == QueueRegisterCompleteFlag.AlreadyCalled)
.Select(s => new GetQueueRegisterListByRoomIdDetailDto
{
IsVip = s.isVip,
@ -357,7 +391,7 @@ namespace Shentun.Peis.QueueRegisters
QueueRegisterNumber = s.queueRegisterNumber
}).ToList();
entDto.OverNumberDetail = query.Where(m => m.completeFlag == QueueRegisterCompleteFlag.OverNumber)
entDto.OverNumberDetail = roomGroup.Where(m => m.completeFlag == QueueRegisterCompleteFlag.OverNumber)
.Select(s => new GetQueueRegisterListByRoomIdDetailDto
{
IsVip = s.isVip,
@ -375,15 +409,16 @@ namespace Shentun.Peis.QueueRegisters
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/QueueRegister/GetScreenQueueRegisterListByRoomId")]
public async Task<GetScreenQueueRegisterListByRoomIdDto> GetScreenQueueRegisterListByRoomIdAsync(RoomIdInputDto input)
[HttpPost("api/app/QueueRegister/GetScreenQueueRegisterListByRoomNo")]
public async Task<GetScreenQueueRegisterListByRoomIdDto> GetScreenQueueRegisterListByRoomIdAsync(RoomNoInputDto input)
{
var entDto = new GetScreenQueueRegisterListByRoomIdDto();
var query = from queueRegister in await _queueRegisterRepository.GetQueryableAsync()
join patientRegister in await _patientRegisterRepository.GetQueryableAsync()
on queueRegister.PatientRegisterId equals patientRegister.Id
join room in await _roomRepository.GetQueryableAsync() on queueRegister.RoomId equals room.Id
where queueRegister.CreationTime >= DateTime.Now.Date
&& queueRegister.RoomId == input.RoomId
&& room.RoomNo == input.RoomNo
select new
{
completeFlag = queueRegister.CompleteFlag,

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

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.PatientRegisters;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing;
@ -13,6 +14,7 @@ namespace Shentun.Peis.Models
/// </summary>
[Table("room")]
[Index(nameof(DisplayName), Name = "ix_room", IsUnique = true)]
[Index(nameof(RoomNo), Name = "ix_room_room_no", IsUnique = true)]
public class Room : AuditedEntity<Guid>, IHasConcurrencyStamp, IDisplayName, IDisplayOrder
{
public Room()
@ -20,6 +22,12 @@ namespace Shentun.Peis.Models
RoomDetails = new HashSet<RoomDetail>();
}
[Column("room_no")]
[StringLength(3)]
public string RoomNo { get; set; }
[Column("display_name")]
[StringLength(20)]
public string DisplayName { get; set; } = null!;

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

@ -45,6 +45,7 @@ namespace Shentun.Peis.Rooms
IsActive = entity.IsActive,
ItemTypeId = entity.ItemTypeId,
QueueTime = entity.QueueTime,
RoomNo = entity.RoomNo,
MedicalCenterId = entity.MedicalCenterId,
RoomTypeFlag = entity.RoomTypeFlag
};
@ -76,7 +77,7 @@ namespace Shentun.Peis.Rooms
targetEntity.IsActive = sourceEntity.IsActive;
targetEntity.ItemTypeId = sourceEntity.ItemTypeId;
targetEntity.QueueTime = sourceEntity.QueueTime;
targetEntity.MedicalCenterId=sourceEntity.MedicalCenterId;
targetEntity.MedicalCenterId = sourceEntity.MedicalCenterId;
targetEntity.RoomTypeFlag = sourceEntity.RoomTypeFlag;
}
@ -96,11 +97,11 @@ namespace Shentun.Peis.Rooms
var roomEnt = await _roomRepository.FirstOrDefaultAsync(m => m.Id == id);
if (roomEnt != null)
{
////删除组合项目明细
//await _asbitemDetailManager.CheckAndDeleteAsync(id);
//删除组合项目
await _roomRepository.DeleteAsync(id);
}
@ -151,7 +152,7 @@ namespace Shentun.Peis.Rooms
DataHelper.CheckForSex(entity.ForSexId);
DataHelper.CheckGuidIsDefaultValue(entity.ItemTypeId, "项目类别");
DataHelper.CheckGuidIsDefaultValue(entity.MedicalCenterId, "体检中心");
DataHelper.CheckDecimalIsGeaterThanZero(entity.QueueTime,"候诊时间");
DataHelper.CheckDecimalIsGeaterThanZero(entity.QueueTime, "候诊时间");
DataHelper.CheckCharIsYOrN(entity.IsActive, "是否启用");
if (entity.RoomTypeFlag != RoomTypeFlag.Ordinary
&& entity.RoomTypeFlag != RoomTypeFlag.BloodlettingRoom)
@ -160,5 +161,20 @@ namespace Shentun.Peis.Rooms
}
}
/// <summary>
/// 生成房间号
/// </summary>
/// <returns></returns>
private async string GenerateRoomNo()
{
string roonNo = "001";
var maxRoomEnt = (await _roomRepository.GetQueryableAsync()).OrderByDescending(o => o.RoomNo).FirstOrDefault();
if (maxRoomEnt != null)
{
roonNo = (Convert.ToInt32(maxRoomEnt.RoomNo) + 1).ToString().PadLeft(3, '0');
}
return roonNo;
}
}
}

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

@ -19,6 +19,8 @@ namespace Shentun.Peis.DbMapping
entity.Property(t => t.ItemTypeId).HasComment("项目类别编号").IsRequired().IsFixedLength();
entity.Property(t => t.MedicalCenterId).HasComment("体检中心");
entity.Property(t=>t.RoomNo).HasComment("房间号").IsRequired().IsFixedLength();
entity.Property(e => e.Id).IsFixedLength();
//entity.Property(e => e.CreationTime).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");

15069
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240723111319_room_add_room_no.Designer.cs
File diff suppressed because it is too large
View File

39
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240723111319_room_add_room_no.cs

@ -0,0 +1,39 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class room_add_room_no : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "room_no",
table: "room",
type: "character(3)",
fixedLength: true,
maxLength: 3,
nullable: false,
defaultValue: "",
comment: "房间号");
migrationBuilder.CreateIndex(
name: "ix_room_room_no",
table: "room",
column: "room_no",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "ix_room_room_no",
table: "room");
migrationBuilder.DropColumn(
name: "room_no",
table: "room");
}
}
}

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

@ -9276,6 +9276,14 @@ namespace Shentun.Peis.Migrations
.HasColumnType("numeric(3,1)")
.HasColumnName("queue_time");
b.Property<string>("RoomNo")
.IsRequired()
.HasMaxLength(3)
.HasColumnType("character(3)")
.HasColumnName("room_no")
.IsFixedLength()
.HasComment("房间号");
b.Property<char>("RoomTypeFlag")
.ValueGeneratedOnAdd()
.HasMaxLength(1)
@ -9295,6 +9303,9 @@ namespace Shentun.Peis.Migrations
b.HasIndex(new[] { "DisplayName" }, "ix_room")
.IsUnique();
b.HasIndex(new[] { "RoomNo" }, "ix_room_room_no")
.IsUnique();
b.ToTable("room");
b.HasComment("房间设置");

Loading…
Cancel
Save