Browse Source

预约

master
DESKTOP-G961P6V\Zhh 2 years ago
parent
commit
2c4b3ceccd
  1. 9
      src/Shentun.WebPeis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterDto.cs
  2. 119
      src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs
  3. 1
      src/Shentun.WebPeis.Domain.Shared/Enums/AppointPatientRegisterCompleteFlag.cs
  4. 1
      src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
  5. 5
      src/Shentun.WebPeis.Domain/Models/AppointPatientRegister.cs
  6. 4
      src/Shentun.WebPeis.EntityFrameworkCore/Configures/AppointPatientRegisterConfigure.cs

9
src/Shentun.WebPeis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterDto.cs

@ -78,6 +78,15 @@ namespace Shentun.WebPeis.AppointPatientRegisters
public char CompleteFlag { get; set; } public char CompleteFlag { get; set; }
/// <summary> /// <summary>
/// 完成标志名称
/// </summary>
public string CompleteFlagName { get; set; }
/// <summary>
/// 是否已收费
/// </summary>
public char IsCharge { get; set; }
/// <summary>
/// 预约日期 /// 预约日期
/// </summary> /// </summary>

119
src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs

@ -90,7 +90,12 @@ namespace Shentun.WebPeis.AppointPatientRegisters
_registerCheckRepository = registerCheckRepository; _registerCheckRepository = registerCheckRepository;
} }
/// <summary>
/// 预约,小程序使用
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("api/app/AppointPatientRegister/Create")] [HttpPost("api/app/AppointPatientRegister/Create")]
public async Task<AppointPatientRegisterDto> CreateAsync(CreateAppointPatientRegisterDto input) public async Task<AppointPatientRegisterDto> CreateAsync(CreateAppointPatientRegisterDto input)
{ {
@ -120,6 +125,12 @@ namespace Shentun.WebPeis.AppointPatientRegisters
return result; return result;
} }
/// <summary>
/// 通过手机号等获取预约列表信息,体检程序前台登记使用
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("api/app/AppointPatientRegister/GetListByFilter")] [HttpPost("api/app/AppointPatientRegister/GetListByFilter")]
public async Task<List<AppointPatientRegisterDto>> GetListByFilterAsync(AppointPatientRegisterInputDto input) public async Task<List<AppointPatientRegisterDto>> GetListByFilterAsync(AppointPatientRegisterInputDto input)
{ {
@ -234,6 +245,7 @@ namespace Shentun.WebPeis.AppointPatientRegisters
MedicalPackageName = o.FirstOrDefault().haveMedicalPackage == null ? "" : o.FirstOrDefault().haveMedicalPackage.MedicalPackageName, MedicalPackageName = o.FirstOrDefault().haveMedicalPackage == null ? "" : o.FirstOrDefault().haveMedicalPackage.MedicalPackageName,
MedicalCenterId = o.FirstOrDefault().appointPatientRegister.MedicalCenterId, MedicalCenterId = o.FirstOrDefault().appointPatientRegister.MedicalCenterId,
CompleteFlag = o.FirstOrDefault().appointPatientRegister.CompleteFlag, CompleteFlag = o.FirstOrDefault().appointPatientRegister.CompleteFlag,
IsCharge = o.FirstOrDefault().appointPatientRegister.IsCharge,
AppointDate = o.FirstOrDefault().appointPatientRegister.AppointDate, AppointDate = o.FirstOrDefault().appointPatientRegister.AppointDate,
Remark = o.FirstOrDefault().appointPatientRegister.Remark, Remark = o.FirstOrDefault().appointPatientRegister.Remark,
PregnantFlag = o.FirstOrDefault().appointPatientRegister.PregnantFlag, PregnantFlag = o.FirstOrDefault().appointPatientRegister.PregnantFlag,
@ -250,8 +262,113 @@ namespace Shentun.WebPeis.AppointPatientRegisters
}
/// <summary>
/// 获取某人的预约列表,小程序使用
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[HttpPost("api/app/AppointPatientRegister/GetListByPersonId")]
public async Task<List<AppointPatientRegisterDto>> GetListByPersonIdAsync(PersonIdInputDto input)
{
if (input == null) throw new UserFriendlyException("参数不能为空");
var query = (from user in await _identityUserRepository.GetQueryableAsync()
join person in await _personRepository.GetQueryableAsync()
on user.Id equals person.PersonId
join appointPatientRegister in await _repository.GetQueryableAsync()
on person.PersonId equals appointPatientRegister.PersonId
join medicalPackage in await _medicalPackageRepository.GetQueryableAsync()
on appointPatientRegister.MedicalPackageId equals medicalPackage.MedicalPackageId into canEmptyMedicalPackage
from haveMedicalPackage in canEmptyMedicalPackage.DefaultIfEmpty()
join customerOrgGroup in await _customerOrgGroupRepository.GetQueryableAsync()
on appointPatientRegister.CustomerOrgGroupId equals customerOrgGroup.CustomerOrgGroupId into canEmptyCustomerOrgGroup
from haveCustomerOrgGroup in canEmptyCustomerOrgGroup.DefaultIfEmpty()
join appointRegisterAsbitem in await _appointRegisterAsbitemRepository.GetQueryableAsync()
on appointPatientRegister.AppointPatientRegisterId equals appointRegisterAsbitem.AppointPatientRegisterId
join asbitem in await _asbitemRepository.GetQueryableAsync()
on appointRegisterAsbitem.AsbitemId equals asbitem.AsbitemId
join customerOrg in await _customerOrgRepository.GetQueryableAsync()
on appointPatientRegister.CustomerOrgId equals customerOrg.CustomerOrgId
where appointPatientRegister.PersonId == input.PersonId
orderby appointPatientRegister.AppointDate
select new
{
user,
person,
appointPatientRegister,
appointRegisterAsbitem,
asbitem,
haveMedicalPackage,
haveCustomerOrgGroup,
customerOrg
}
);
var appointPatientRegisterDtos = query.ToList();
var list = appointPatientRegisterDtos.GroupBy(o => o.appointPatientRegister)
.Select(o => new AppointPatientRegisterDto()
{
AppointPatientRegisterId = o.FirstOrDefault().appointPatientRegister.AppointPatientRegisterId,
PersonId = o.FirstOrDefault().appointPatientRegister.PersonId,
PersonName = o.FirstOrDefault().user.Name,
IdNo = o.FirstOrDefault().person.IdNo,
SexId = o.FirstOrDefault().person.SexId,
MaritalStatusId = o.FirstOrDefault().person.MaritalStatusId,
CustomerOrgId = o.FirstOrDefault().appointPatientRegister.CustomerOrgId,
ChildCustomerOrgName = o.FirstOrDefault().customerOrg.PathCode.Length == 5 ? "" : o.FirstOrDefault().customerOrg.CustomerOrgName,
CustomerOrgGroupId = o.FirstOrDefault().appointPatientRegister.CustomerOrgGroupId,
CustomerOrgGroupName = o.FirstOrDefault().haveCustomerOrgGroup == null ? "" : o.FirstOrDefault().haveCustomerOrgGroup.CustomerOrgGroupName,
CustomerOrgRegisterId = o.FirstOrDefault().appointPatientRegister.CustomerOrgRegisterId,
MedicalPackageId = o.FirstOrDefault().appointPatientRegister.MedicalPackageId,
MedicalPackageName = o.FirstOrDefault().haveMedicalPackage == null ? "" : o.FirstOrDefault().haveMedicalPackage.MedicalPackageName,
MedicalCenterId = o.FirstOrDefault().appointPatientRegister.MedicalCenterId,
CompleteFlag = o.FirstOrDefault().appointPatientRegister.CompleteFlag,
AppointDate = o.FirstOrDefault().appointPatientRegister.AppointDate,
Remark = o.FirstOrDefault().appointPatientRegister.Remark,
PregnantFlag = o.FirstOrDefault().appointPatientRegister.PregnantFlag,
Height = o.FirstOrDefault().appointPatientRegister.Height,
Weight = o.FirstOrDefault().appointPatientRegister.Weight,
SexName = _cacheService.GetSexNameAsync(o.FirstOrDefault().person.SexId).Result,
MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(o.FirstOrDefault().person.MaritalStatusId).Result,
CustomerOrgName = _customerOrgManager.GetTopCustomerOrgAsync(o.FirstOrDefault().appointPatientRegister.CustomerOrgId).Result.CustomerOrgName
}).ToList();
return list;
} }
/// <summary>
/// 取消预约
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async Task CancelAppoint(AppointPatientRegisterIdInputDto input)
{
var appointPatientRegister = await _repository.GetAsync(o => o.AppointPatientRegisterId == input.AppointPatientRegisterId);
if(appointPatientRegister.IsCharge == 'Y')
{
throw new UserFriendlyException("已收费不能取消");
}
if (appointPatientRegister.CompleteFlag == AppointPatientRegisterCompleteFlag.Check)
{
throw new UserFriendlyException("已到检不能取消");
}
if (appointPatientRegister.CompleteFlag == AppointPatientRegisterCompleteFlag.CancelAppoint)
{
throw new UserFriendlyException("已取消预约不能重复取消");
}
appointPatientRegister.CompleteFlag = AppointPatientRegisterCompleteFlag.CancelAppoint;
await _repository.UpdateAsync(appointPatientRegister);
}
[HttpPost("api/app/AppointPatientRegister/GetAppointRegisterAsbitemListById")] [HttpPost("api/app/AppointPatientRegister/GetAppointRegisterAsbitemListById")]
public async Task<List<AppointRegisterAsbitemDto>> GetAppointRegisterAsbitemListByIdAsync(AppointPatientRegisterIdInputDto input) public async Task<List<AppointRegisterAsbitemDto>> GetAppointRegisterAsbitemListByIdAsync(AppointPatientRegisterIdInputDto input)
{ {

1
src/Shentun.WebPeis.Domain.Shared/Enums/AppointPatientRegisterCompleteFlag.cs

@ -12,6 +12,7 @@ namespace Shentun.WebPeis.Enums
/// </summary> /// </summary>
[Description("预约")] [Description("预约")]
public const char Appoint = '0'; public const char Appoint = '0';
/// <summary> /// <summary>
/// 取消预约 1 /// 取消预约 1
/// </summary> /// </summary>

1
src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs

@ -68,6 +68,7 @@ namespace Shentun.WebPeis.AppointPatientRegisters
await Verify(entity); await Verify(entity);
entity.AppointPatientRegisterId = GuidGenerator.Create(); entity.AppointPatientRegisterId = GuidGenerator.Create();
entity.CompleteFlag = AppointPatientRegisterCompleteFlag.Appoint; entity.CompleteFlag = AppointPatientRegisterCompleteFlag.Appoint;
entity.IsCharge = 'N';
foreach (var appointRegisterAsbitem in entity.AppointRegisterAsbitems) foreach (var appointRegisterAsbitem in entity.AppointRegisterAsbitems)
{ {
appointRegisterAsbitem.AppointPatientRegisterId = entity.AppointPatientRegisterId; appointRegisterAsbitem.AppointPatientRegisterId = entity.AppointPatientRegisterId;

5
src/Shentun.WebPeis.Domain/Models/AppointPatientRegister.cs

@ -76,6 +76,11 @@ public partial class AppointPatientRegister: AuditedEntity, IHasConcurrencyStamp
/// 人员登记ID /// 人员登记ID
/// </summary> /// </summary>
public Guid? PatientRegisterId { get; set; } public Guid? PatientRegisterId { get; set; }
/// <summary>
/// 是否已收费
/// </summary>
public char IsCharge { get; set; }
/// <summary> /// <summary>
/// 收费 /// 收费
/// </summary> /// </summary>

4
src/Shentun.WebPeis.EntityFrameworkCore/Configures/AppointPatientRegisterConfigure.cs

@ -28,6 +28,10 @@ namespace Shentun.WebPeis.Configures
.HasMaxLength(1) .HasMaxLength(1)
.HasDefaultValueSql("'0'::bpchar") .HasDefaultValueSql("'0'::bpchar")
.HasColumnName("complete_flag"); .HasColumnName("complete_flag");
entity.Property(e => e.IsCharge)
.HasMaxLength(1)
.HasDefaultValueSql("'N'::bpchar")
.HasColumnName("is_charge");
entity.Property(e => e.ConcurrencyStamp) entity.Property(e => e.ConcurrencyStamp)
.HasMaxLength(40) .HasMaxLength(40)
.HasColumnName("concurrency_stamp"); .HasColumnName("concurrency_stamp");

Loading…
Cancel
Save