diff --git a/src/Shentun.Peis.Application.Contracts/RegisterChecks/CreateDoctorSignInInputDto.cs b/src/Shentun.Peis.Application.Contracts/RegisterChecks/CreateDoctorSignInInputDto.cs
new file mode 100644
index 0000000..1476d9f
--- /dev/null
+++ b/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
+ {
+ ///
+ /// 房间ID
+ ///
+ public Guid RoomId { get; set; }
+
+ ///
+ /// 0-签到,1-签退
+ ///
+ public char SignInFlag { get; set; } = '0';
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/RegisterChecks/GetDoctorIsSignInDto.cs b/src/Shentun.Peis.Application.Contracts/RegisterChecks/GetDoctorIsSignInDto.cs
new file mode 100644
index 0000000..206dbdf
--- /dev/null
+++ b/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; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/RegisterChecks/GetDoctorIsSignInInputDto.cs b/src/Shentun.Peis.Application.Contracts/RegisterChecks/GetDoctorIsSignInInputDto.cs
new file mode 100644
index 0000000..3b4e61e
--- /dev/null
+++ b/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
+ {
+ ///
+ /// 房间ID
+ ///
+ public Guid RoomId { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application/QueueRegisters/QueueRegisterAppService.cs b/src/Shentun.Peis.Application/QueueRegisters/QueueRegisterAppService.cs
index ec588c7..ff84ed0 100644
--- a/src/Shentun.Peis.Application/QueueRegisters/QueueRegisterAppService.cs
+++ b/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> 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 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);
diff --git a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
index 8445d0f..2d27648 100644
--- a/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
+++ b/src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs
@@ -57,6 +57,7 @@ namespace Shentun.Peis.RegisterChecks
private readonly IRepository _asbitemRepository;
private readonly IRepository _lisRequestRepository;
private readonly FollowUpAppService _followUpAppService;
+ private readonly IRepository _doctorSignInRepository;
public RegisterCheckAppService(IRepository registerCheckRepository,
IRepository registerCheckItemRepository,
@@ -76,7 +77,8 @@ namespace Shentun.Peis.RegisterChecks
IRepository registerCheckAsbitemRepository,
IRepository itemTypeRepository,
IRepository lisRequestRepository,
- FollowUpAppService followUpAppService)
+ FollowUpAppService followUpAppService,
+ IRepository doctorSignInRepository)
{
_registerCheckRepository = registerCheckRepository;
_userRepository = userRepository;
@@ -97,6 +99,7 @@ namespace Shentun.Peis.RegisterChecks
_itemTypeRepository = itemTypeRepository;
_lisRequestRepository = lisRequestRepository;
_followUpAppService = followUpAppService;
+ _doctorSignInRepository = doctorSignInRepository;
}
///
@@ -758,6 +761,118 @@ namespace Shentun.Peis.RegisterChecks
}
+ ///
+ /// 医生签到 签退
+ ///
+ ///
+ ///
+ [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("医生未登录");
+ }
+ }
+
+ ///
+ /// 获取医生是否签到
+ ///
+ ///
+ ///
+ [HttpPost("api/app/RegisterCheck/GetDoctorIsSignIn")]
+ public async Task 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;
+ }
+
}
diff --git a/src/Shentun.Peis.Domain.Shared/Enums/SignInFlag.cs b/src/Shentun.Peis.Domain.Shared/Enums/SignInFlag.cs
new file mode 100644
index 0000000..c4ae4fc
--- /dev/null
+++ b/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
+{
+ ///
+ /// 医生签到枚举 0-签到 1-签退
+ ///
+ public static class SignInFlag
+ {
+ ///
+ /// 签到
+ ///
+ [Description("签到")]
+ public const char SignIn = '0';
+ ///
+ /// 签退
+ ///
+ [Description("签退")]
+ public const char SignOut = '1';
+
+ }
+}
diff --git a/src/Shentun.Peis.Domain/CacheService.cs b/src/Shentun.Peis.Domain/CacheService.cs
index d7f358a..213f2fb 100644
--- a/src/Shentun.Peis.Domain/CacheService.cs
+++ b/src/Shentun.Peis.Domain/CacheService.cs
@@ -552,6 +552,33 @@ namespace Shentun.Peis
return entity.DisplayName;
}
+ ///
+ /// 获取顶级单位ID 直取,不按配置来,用登记界面做单位比较
+ ///
+ ///
+ ///
+ public async Task 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 GetSampleTypeAsync(Guid id)
{
diff --git a/src/Shentun.Peis.Domain/DoctorSignIns/DoctorSignIn.cs b/src/Shentun.Peis.Domain/DoctorSignIns/DoctorSignIn.cs
new file mode 100644
index 0000000..082cb98
--- /dev/null
+++ b/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
+{
+
+ ///
+ /// 医生签到表
+ ///
+ [Table("doctor_sign_in")]
+ public class DoctorSignIn : AuditedEntity, IHasConcurrencyStamp
+ {
+
+ [Column("room_id")]
+ public Guid RoomId { get; set; }
+
+
+ ///
+ /// 0-签到,1-签退
+ ///
+ [Column("sign_in_flag")]
+ [MaxLength(1)]
+ public char SignInFlag { get; set; }
+
+ ///
+ /// 签退日期
+ ///
+ [Column("sign_out_date")]
+ public DateTime? SignOutDate { get; set; }
+
+
+ [Column("concurrency_stamp")]
+ public string ConcurrencyStamp { get; set; }
+
+
+
+
+ }
+}
diff --git a/src/Shentun.Peis.Domain/QueueRegisters/QueueRegisterManager.cs b/src/Shentun.Peis.Domain/QueueRegisters/QueueRegisterManager.cs
index bcb8910..b5458f4 100644
--- a/src/Shentun.Peis.Domain/QueueRegisters/QueueRegisterManager.cs
+++ b/src/Shentun.Peis.Domain/QueueRegisters/QueueRegisterManager.cs
@@ -21,14 +21,15 @@ namespace Shentun.Peis.QueueRegisters
private readonly IRepository _registerCheckAsbitemRepository;
private readonly IRepository _roomDetailRepository;
private readonly IRepository _roomRepository;
-
+ private readonly IRepository _doctorSignInRepository;
public QueueRegisterManager(
IRepository queueRegisterRepository,
IRepository patientRegisterRepository,
IRepository registerCheckRepository,
IRepository registerCheckAsbitemRepository,
IRepository roomDetailRepository,
- IRepository roomRepository)
+ IRepository roomRepository,
+ IRepository doctorSignInRepository)
{
_queueRegisterRepository = queueRegisterRepository;
_patientRegisterRepository = patientRegisterRepository;
@@ -36,6 +37,7 @@ namespace Shentun.Peis.QueueRegisters
_registerCheckAsbitemRepository = registerCheckAsbitemRepository;
_roomDetailRepository = roomDetailRepository;
_roomRepository = roomRepository;
+ _doctorSignInRepository = doctorSignInRepository;
}
///
/// 人员排队
@@ -76,6 +78,9 @@ namespace Shentun.Peis.QueueRegisters
///
public async Task 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;
}
+
+ ///
+ /// 获取当天签到的房间
+ ///
+ ///
+ public async Task> GetSignInRoomAsync()
+ {
+ List roomIds = new List();
+
+ roomIds = (await _doctorSignInRepository.GetListAsync(m => m.CreationTime.Date == DateTime.Now.Date
+ && m.SignInFlag == SignInFlag.SignIn))
+ .Select(s => s.RoomId)
+ .Distinct()
+ .ToList();
+ return roomIds;
+ }
}
}
diff --git a/src/Shentun.Peis.EntityFrameworkCore/DbMapping/DoctorSignIns/DoctorSignInDbMapping.cs b/src/Shentun.Peis.EntityFrameworkCore/DbMapping/DoctorSignIns/DoctorSignInDbMapping.cs
new file mode 100644
index 0000000..8e620a6
--- /dev/null
+++ b/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
+ {
+ public void Configure(EntityTypeBuilder 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();
+ }
+ }
+}
diff --git a/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs b/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
index f4f1497..82e7311 100644
--- a/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
+++ b/src/Shentun.Peis.EntityFrameworkCore/EntityFrameworkCore/PeisDbContext.cs
@@ -332,14 +332,14 @@ public class PeisDbContext :
#endregion
#region 收费申请
- public DbSet ChargeRequests { get; set; } = null!;
- public DbSet ChargeRequestAsbitems { get; set; } = null!;
+ public DbSet ChargeRequests { get; set; } = null!;
+ public DbSet ChargeRequestAsbitems { get; set; } = null!;
#endregion
#region 第三方接口
public DbSet ThirdInterfaces { get; set; } = null!;
#endregion
-
+
public DbSet CollectItemTypes { get; set; } = null!;
public DbSet PatientRegisterExters { get; set; } = null!;
@@ -359,7 +359,7 @@ public class PeisDbContext :
public DbSet PatientPastMedicalHistorys { get; set; } = null!;
- public DbSet OcCheckTypeDetails { get; set; }=null!;
+ public DbSet OcCheckTypeDetails { get; set; } = null!;
public DbSet RoomDetails { get; set; } = null!;
@@ -379,6 +379,8 @@ public class PeisDbContext :
public DbSet DicomFileDetails { get; set; } = null!;
+ public DbSet DoctorSignIns { get; set; } = null!;
+
public PeisDbContext(DbContextOptions 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
diff --git a/src/Shentun.Peis.HttpApi.Host/appsettings.json b/src/Shentun.Peis.HttpApi.Host/appsettings.json
index 33234d4..0f5edfa 100644
--- a/src/Shentun.Peis.HttpApi.Host/appsettings.json
+++ b/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": {