23 changed files with 16765 additions and 2 deletions
-
4src/Shentun.Peis.Application.Contracts/PatientRegisters/CreatePatientRegisterDto.cs
-
91src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs
-
31src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListInputDto.cs
-
20src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/CreateThirdMedicalCenterBookingDateInputDto.cs
-
20src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/CreateThirdMedicalCenterDto.cs
-
19src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/GetThirdMedicalCenterBookingDateListDto.cs
-
25src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/ThirdMedicalCenterDto.cs
-
11src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/ThirdMedicalCenterIdInputDto.cs
-
16src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/ThirdMedicalCenterListInputDto.cs
-
19src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/UpdateManySortThirdMedicalCenterInputDto.cs
-
22src/Shentun.Peis.Application.Contracts/ThirdMedicalCenters/UpdateThirdMedicalCenterDto.cs
-
7src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
-
125src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs
-
217src/Shentun.Peis.Application/ThirdMedicalCenters/ThirdMedicalCenterAppService.cs
-
3src/Shentun.Peis.Domain.Shared/Enums/ThirdInterfaceTypeFlag.cs
-
5src/Shentun.Peis.Domain/PatientRegisters/CreatePatientRegisterArg.cs
-
3src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs
-
6src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs
-
133src/Shentun.Peis.Domain/ThirdMedicalCenters/ThirdMedicalCenterManager.cs
-
1src/Shentun.Peis.EntityFrameworkCore/DbMapping/ThirdBookings/ThirdBookingDbMapping.cs
-
15955src/Shentun.Peis.EntityFrameworkCore/Migrations/20240927073902_update_third_booking.Designer.cs
-
27src/Shentun.Peis.EntityFrameworkCore/Migrations/20240927073902_update_third_booking.cs
-
7src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs
@ -0,0 +1,91 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdBookings |
|||
{ |
|||
public class GetThirdBookingListDto |
|||
{ |
|||
/// <summary>
|
|||
/// 登记时需要写入
|
|||
/// </summary>
|
|||
public Guid ThirdBookingId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 姓名
|
|||
/// </summary>
|
|||
public string PatientName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 单位分组ID
|
|||
/// </summary>
|
|||
public string CustomerOrgGroupId { get; set; } |
|||
|
|||
///// <summary>
|
|||
///// 第三方体检中心Id 不是体检中的体检中心
|
|||
///// </summary>
|
|||
//public string ThirdMedicalCenterId { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 身份证类型( 0 身份证 )
|
|||
///// </summary>
|
|||
//public string IdType { get; set; }
|
|||
|
|||
/// <summary>
|
|||
/// 身份证
|
|||
/// </summary>
|
|||
public string IdNo { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 性别
|
|||
/// </summary>
|
|||
public char SexId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 年龄
|
|||
/// </summary>
|
|||
public short Age { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 预约日期
|
|||
/// </summary>
|
|||
public DateTime BookingDate { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 电话
|
|||
/// </summary>
|
|||
public string Phone { get; set; } |
|||
|
|||
///// <summary>
|
|||
///// 分公司
|
|||
///// </summary>
|
|||
//public string ChildCompanyName { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 部门
|
|||
///// </summary>
|
|||
//public string DepartmentName { get; set; }
|
|||
|
|||
///// <summary>
|
|||
///// 婚姻状况
|
|||
///// </summary>
|
|||
//public char MaritalStatusId { get; set; }
|
|||
|
|||
/// <summary>
|
|||
/// 体检状态 0未开始 1已登记 2已完成体检
|
|||
/// </summary>
|
|||
public char MedicalStatus { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 体检次数ID
|
|||
/// </summary>
|
|||
public Guid? CustomerOrgRegisterId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 单位ID
|
|||
/// </summary>
|
|||
public Guid? CustomerOrgId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdBookings |
|||
{ |
|||
public class GetThirdBookingListInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 体检状态 0未开始 1已登记 2已完成体检
|
|||
/// </summary>
|
|||
public char? MedicalStatus { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 预约开始日期
|
|||
/// </summary>
|
|||
public string StartDate { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 预约结束日期
|
|||
/// </summary>
|
|||
public string EndDate { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 支持身份证、手机号、姓名 完全匹配
|
|||
/// </summary>
|
|||
public string KeyWord { get; set; } |
|||
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdMedicalCenters |
|||
{ |
|||
public class CreateThirdMedicalCenterBookingDateInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 第三方体检中心id
|
|||
/// </summary>
|
|||
public Guid ThirdMedicalCenterId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 可以预约日期集合 格式2024-09-27
|
|||
/// </summary>
|
|||
public List<string> BookingDates { get; set; } = new List<string>(); |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdMedicalCenters |
|||
{ |
|||
public class CreateThirdMedicalCenterDto |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 单位分组ID
|
|||
/// </summary>
|
|||
|
|||
public Guid CustomerOrgGroupId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdMedicalCenters |
|||
{ |
|||
public class GetThirdMedicalCenterBookingDateListDto |
|||
{ |
|||
public Guid Id { get; set; } |
|||
|
|||
|
|||
public Guid ThirdMedicalCenterId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 可预约日期
|
|||
/// </summary>
|
|||
public string BookingDate { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdMedicalCenters |
|||
{ |
|||
public class ThirdMedicalCenterDto : AuditedEntityDtoName |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 单位分组ID
|
|||
/// </summary>
|
|||
|
|||
public Guid CustomerOrgGroupId { get; set; } |
|||
|
|||
|
|||
public int DisplayOrder { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdMedicalCenters |
|||
{ |
|||
public class ThirdMedicalCenterIdInputDto |
|||
{ |
|||
public Guid ThirdMedicalCenterId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdMedicalCenters |
|||
{ |
|||
public class ThirdMedicalCenterListInputDto |
|||
{ |
|||
public Guid? CustomerOrgGroupId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 关键字
|
|||
/// </summary>
|
|||
public string KeyWord { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdMedicalCenters |
|||
{ |
|||
public class UpdateManySortThirdMedicalCenterInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 需要修改的ID
|
|||
/// </summary>
|
|||
public Guid ThirdMedicalCenterId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 修改方式:1 置顶 2 置底
|
|||
/// </summary>
|
|||
public int SortType { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.Peis.ThirdMedicalCenters |
|||
{ |
|||
public class UpdateThirdMedicalCenterDto |
|||
{ |
|||
public Guid ThirdMedicalCenterId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 单位分组ID
|
|||
/// </summary>
|
|||
|
|||
public Guid CustomerOrgGroupId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,125 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Shentun.Peis.Enums; |
|||
using Shentun.Peis.Models; |
|||
using Shentun.Peis.PlugIns.Sms; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Shentun.Peis.ThirdBookings |
|||
{ |
|||
/// <summary>
|
|||
/// 第三方预约记录
|
|||
/// </summary>
|
|||
[Authorize] |
|||
[ApiExplorerSettings(GroupName = "Work")] |
|||
public class ThirdBookingAppService : ApplicationService |
|||
{ |
|||
private readonly IRepository<ThirdBooking, Guid> _thirdBookingRepository; |
|||
private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository; |
|||
|
|||
public ThirdBookingAppService( |
|||
IRepository<ThirdBooking, Guid> thirdBookingRepository, |
|||
IRepository<ThirdInterface, Guid> thirdInterfaceRepository) |
|||
{ |
|||
_thirdBookingRepository = thirdBookingRepository; |
|||
_thirdInterfaceRepository = thirdInterfaceRepository; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 获取人寿预约记录
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdBooking/GetThirdBookingList")] |
|||
public async Task<List<GetThirdBookingListDto>> GetThirdBookingListAsync(GetThirdBookingListInputDto input) |
|||
{ |
|||
Guid? customerOrgRegisterId = null; |
|||
Guid? customerOrgId = null; |
|||
|
|||
var thirdBookingInterface = await _thirdInterfaceRepository.FirstOrDefaultAsync(o => o.ThirdInterfaceType == |
|||
ThirdInterfaceTypeFlag.ThirdBooking); |
|||
if (thirdBookingInterface != null && thirdBookingInterface.IsActive == 'Y') |
|||
{ |
|||
|
|||
var parmValue = thirdBookingInterface.ParmValue; |
|||
var configurationBuilder = new ConfigurationBuilder() |
|||
.AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue))); |
|||
var interfaceConfig = configurationBuilder.Build(); |
|||
var isActive = interfaceConfig.GetSection("Interface").GetSection("IsActive").Value; |
|||
var customerOrgRegisterIdPara = interfaceConfig.GetSection("Interface").GetSection("CustomerOrgRegisterId").Value; |
|||
var customerOrgIdPara = interfaceConfig.GetSection("Interface").GetSection("CustomerOrgId").Value; |
|||
if (!string.IsNullOrWhiteSpace(isActive) |
|||
&& isActive == "Y") |
|||
{ |
|||
customerOrgRegisterId = Guid.Parse(customerOrgRegisterIdPara); |
|||
customerOrgId = Guid.Parse(customerOrgIdPara); |
|||
} |
|||
} |
|||
|
|||
var query = await _thirdBookingRepository.GetQueryableAsync(); |
|||
if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.StartDate)) |
|||
{ |
|||
query = query.Where(m => m.BookingDate >= Convert.ToDateTime(input.StartDate) && |
|||
m.BookingDate < Convert.ToDateTime(input.EndDate).AddDays(1)); |
|||
} |
|||
if (!string.IsNullOrWhiteSpace(input.KeyWord)) |
|||
{ |
|||
query = query.Where(m => m.PatientName == input.KeyWord |
|||
|| m.IdNo == input.KeyWord || m.Phone == input.KeyWord); |
|||
} |
|||
if (input.MedicalStatus != null) |
|||
{ |
|||
query = query.Where(m => m.MedicalStatus == input.MedicalStatus); |
|||
} |
|||
|
|||
var entListDto = query.Select(s => new GetThirdBookingListDto |
|||
{ |
|||
ThirdBookingId = s.Id, |
|||
Age = s.Age, |
|||
BookingDate = s.BookingDate, |
|||
CustomerOrgGroupId = s.CustomerOrgGroupId, |
|||
IdNo = s.IdNo, |
|||
MedicalStatus = s.MedicalStatus, |
|||
PatientName = s.PatientName, |
|||
Phone = s.Phone, |
|||
SexId = GetSexId(s.SexName), |
|||
CustomerOrgId = customerOrgId, |
|||
CustomerOrgRegisterId = customerOrgRegisterId, |
|||
}).ToList(); |
|||
|
|||
return entListDto; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 转换性别
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
private static char GetSexId(string SexName) |
|||
{ |
|||
char SexId = 'U'; |
|||
if (SexName == "0" || SexName == "男") |
|||
{ |
|||
SexId = 'M'; |
|||
} |
|||
if (SexName == "1" || SexName == "女") |
|||
{ |
|||
SexId = 'F'; |
|||
} |
|||
return SexId; |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,217 @@ |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Shentun.Peis.ThirdMedicalCenters; |
|||
using Shentun.Peis.HelperDto; |
|||
using Shentun.Peis.Models; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace Shentun.Peis.ThirdMedicalCenters |
|||
{ |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 第三方体检中心
|
|||
/// </summary>
|
|||
[ApiExplorerSettings(GroupName = "Work")] |
|||
[Authorize] |
|||
public class ThirdMedicalCenterAppService : ApplicationService |
|||
{ |
|||
private readonly IRepository<ThirdMedicalCenter, Guid> _thirdMedicalCenterRepository; |
|||
private readonly CacheService _cacheService; |
|||
private readonly ThirdMedicalCenterManager _thirdMedicalCenterManager; |
|||
private readonly IRepository<ThirdMedicalCenterBookingDate, Guid> _thirdMedicalCenterBookingDateRepository; |
|||
public ThirdMedicalCenterAppService( |
|||
IRepository<ThirdMedicalCenter, Guid> thirdMedicalCenterRepository, |
|||
CacheService cacheService, |
|||
ThirdMedicalCenterManager thirdMedicalCenterManager, |
|||
IRepository<ThirdMedicalCenterBookingDate, Guid> thirdMedicalCenterBookingDateRepository) |
|||
{ |
|||
_thirdMedicalCenterRepository = thirdMedicalCenterRepository; |
|||
_cacheService = cacheService; |
|||
_thirdMedicalCenterManager = thirdMedicalCenterManager; |
|||
_thirdMedicalCenterBookingDateRepository = thirdMedicalCenterBookingDateRepository; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取通过主键
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdMedicalCenter/Get")] |
|||
public async Task<ThirdMedicalCenterDto> GetAsync(ThirdMedicalCenterIdInputDto input) |
|||
{ |
|||
var thirdMedicalCenterEnt = await _thirdMedicalCenterRepository.GetAsync(input.ThirdMedicalCenterId); |
|||
var entityDto = ObjectMapper.Map<ThirdMedicalCenter, ThirdMedicalCenterDto>(thirdMedicalCenterEnt); |
|||
entityDto.CreatorName = await _cacheService.GetSurnameAsync(entityDto.CreatorId); |
|||
entityDto.LastModifierName = await _cacheService.GetSurnameAsync(entityDto.LastModifierId); |
|||
return entityDto; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取列表 可根据条件检索
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdMedicalCenter/GetList")] |
|||
public async Task<List<ThirdMedicalCenterDto>> GetListAsync(ThirdMedicalCenterListInputDto input) |
|||
{ |
|||
|
|||
var query = await _thirdMedicalCenterRepository.GetQueryableAsync(); |
|||
|
|||
if (input.CustomerOrgGroupId != null) |
|||
query = query.Where(m => m.CustomerOrgGroupId == input.CustomerOrgGroupId); |
|||
|
|||
|
|||
if (!string.IsNullOrWhiteSpace(input.KeyWord)) |
|||
query = query.Where(m => m.DisplayName.Contains(input.KeyWord)); |
|||
|
|||
|
|||
var entdto = query.Select(s => new ThirdMedicalCenterDto |
|||
{ |
|||
CreationTime = s.CreationTime, |
|||
CreatorId = s.CreatorId, |
|||
DisplayName = s.DisplayName, |
|||
DisplayOrder = s.DisplayOrder, |
|||
Id = s.Id, |
|||
CustomerOrgGroupId = s.CustomerOrgGroupId, |
|||
LastModificationTime = s.LastModificationTime, |
|||
LastModifierId = s.LastModifierId, |
|||
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result, |
|||
LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result |
|||
}).OrderBy(o => o.DisplayOrder).ToList(); |
|||
|
|||
return entdto; |
|||
|
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdMedicalCenter/Create")] |
|||
public async Task<ThirdMedicalCenterDto> CreateAsync(CreateThirdMedicalCenterDto input) |
|||
{ |
|||
var createEntity = ObjectMapper.Map<CreateThirdMedicalCenterDto, ThirdMedicalCenter>(input); |
|||
var entity = await _thirdMedicalCenterManager.CreateAsync(createEntity); |
|||
entity = await _thirdMedicalCenterRepository.InsertAsync(entity); |
|||
var dto = ObjectMapper.Map<ThirdMedicalCenter, ThirdMedicalCenterDto>(entity); |
|||
dto.CreatorName = await _cacheService.GetSurnameAsync(dto.CreatorId); |
|||
dto.LastModifierName = await _cacheService.GetSurnameAsync(dto.LastModifierId); |
|||
return dto; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 更新
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdMedicalCenter/Update")] |
|||
public async Task<ThirdMedicalCenterDto> UpdateAsync(UpdateThirdMedicalCenterDto input) |
|||
{ |
|||
var entity = await _thirdMedicalCenterRepository.GetAsync(input.ThirdMedicalCenterId); |
|||
var sourceEntity = ObjectMapper.Map<UpdateThirdMedicalCenterDto, ThirdMedicalCenter>(input); |
|||
await _thirdMedicalCenterManager.UpdateAsync(sourceEntity, entity); |
|||
entity = await _thirdMedicalCenterRepository.UpdateAsync(entity); |
|||
var dto = ObjectMapper.Map<ThirdMedicalCenter, ThirdMedicalCenterDto>(entity); |
|||
dto.CreatorName = await _cacheService.GetSurnameAsync(dto.CreatorId); |
|||
dto.LastModifierName = await _cacheService.GetSurnameAsync(dto.LastModifierId); |
|||
return dto; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 删除
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdMedicalCenter/Delete")] |
|||
public async Task DeleteAsync(ThirdMedicalCenterIdInputDto input) |
|||
{ |
|||
await _thirdMedicalCenterManager.CheckAndDeleteAsync(input.ThirdMedicalCenterId); |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 修改排序 置顶,置底
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdMedicalCenter/UpdateManySort")] |
|||
public async Task UpdateManySortAsync(UpdateManySortThirdMedicalCenterInputDto input) |
|||
{ |
|||
await _thirdMedicalCenterManager.UpdateManySortAsync(input.ThirdMedicalCenterId, input.SortType); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 修改排序 拖拽
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdMedicalCenter/UpdateSortMany")] |
|||
public async Task UpdateSortManyAsync(UpdateSortManyCommonDto input) |
|||
{ |
|||
await _thirdMedicalCenterManager.UpdateSortManyAsync(input); |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 根据体检中心获取可预约日期
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdMedicalCenter/GetThirdMedicalCenterBookingDateList")] |
|||
public async Task<List<GetThirdMedicalCenterBookingDateListDto>> GetThirdMedicalCenterBookingDateListAsync(ThirdMedicalCenterIdInputDto input) |
|||
{ |
|||
var entList = await _thirdMedicalCenterBookingDateRepository.GetListAsync(m => m.ThirdMedicalCenterId == input.ThirdMedicalCenterId); |
|||
var entListDto = entList.OrderBy(o => o.BookingDate).Select(s => new GetThirdMedicalCenterBookingDateListDto |
|||
{ |
|||
BookingDate = DataHelper.ConversionDateShortToString(s.BookingDate), |
|||
Id = s.Id, |
|||
ThirdMedicalCenterId = s.ThirdMedicalCenterId |
|||
}).ToList(); |
|||
|
|||
return entListDto; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 生成预约日期 会先删除再添加
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/ThirdMedicalCenter/CreateThirdMedicalCenterBookingDate")] |
|||
public async Task CreateThirdMedicalCenterBookingDateAsync(CreateThirdMedicalCenterBookingDateInputDto input) |
|||
{ |
|||
//删除
|
|||
await _thirdMedicalCenterBookingDateRepository.DeleteAsync(d => d.ThirdMedicalCenterId == input.ThirdMedicalCenterId); |
|||
if (input.BookingDates.Any()) |
|||
{ |
|||
List<ThirdMedicalCenterBookingDate> thirdMedicalCenterBookingDates = new List<ThirdMedicalCenterBookingDate>(); |
|||
|
|||
foreach (var date in input.BookingDates) |
|||
{ |
|||
|
|||
thirdMedicalCenterBookingDates.Add(new ThirdMedicalCenterBookingDate |
|||
{ |
|||
BookingDate = Convert.ToDateTime(date), |
|||
ThirdMedicalCenterId = input.ThirdMedicalCenterId |
|||
}); |
|||
} |
|||
|
|||
if (thirdMedicalCenterBookingDates.Any()) |
|||
{ |
|||
await _thirdMedicalCenterBookingDateRepository.InsertManyAsync(thirdMedicalCenterBookingDates); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,133 @@ |
|||
using Shentun.Peis.HelperDto; |
|||
using Shentun.Peis.Models; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Volo.Abp.Domain.Services; |
|||
|
|||
namespace Shentun.Peis.ThirdMedicalCenters |
|||
{ |
|||
public class ThirdMedicalCenterManager : DomainService |
|||
{ |
|||
private readonly IRepository<ThirdMedicalCenter, Guid> _thirdMedicalCenterRepository; |
|||
private readonly IRepository<ThirdMedicalCenterBookingDate,Guid> _thirdMedicalCenterBookingDateRepository; |
|||
public ThirdMedicalCenterManager( |
|||
IRepository<ThirdMedicalCenter, Guid> thirdMedicalCenterRepository, |
|||
IRepository<ThirdMedicalCenterBookingDate, Guid> thirdMedicalCenterBookingDateRepository |
|||
) |
|||
{ |
|||
_thirdMedicalCenterRepository = thirdMedicalCenterRepository; |
|||
_thirdMedicalCenterBookingDateRepository = thirdMedicalCenterBookingDateRepository; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 创建
|
|||
/// </summary>
|
|||
/// <param name="entity"></param>
|
|||
/// <returns></returns>
|
|||
public async Task<ThirdMedicalCenter> CreateAsync( |
|||
ThirdMedicalCenter entity |
|||
) |
|||
{ |
|||
Verify(entity); |
|||
await EntityHelper.CheckSameName(_thirdMedicalCenterRepository, entity.DisplayName); |
|||
return new ThirdMedicalCenter |
|||
{ |
|||
DisplayName = entity.DisplayName, |
|||
CustomerOrgGroupId = entity.CustomerOrgGroupId, |
|||
DisplayOrder = await EntityHelper.CreateMaxDisplayOrder(_thirdMedicalCenterRepository) |
|||
}; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 更新
|
|||
/// </summary>
|
|||
/// <param name="sourceEntity"></param>
|
|||
/// <param name="targetEntity"></param>
|
|||
/// <returns></returns>
|
|||
public async Task UpdateAsync( |
|||
ThirdMedicalCenter sourceEntity, |
|||
ThirdMedicalCenter targetEntity |
|||
) |
|||
{ |
|||
DataHelper.CheckEntityIsNull(sourceEntity); |
|||
Verify(targetEntity); |
|||
if (sourceEntity.DisplayName != targetEntity.DisplayName) |
|||
{ |
|||
|
|||
await EntityHelper.CheckSameName(_thirdMedicalCenterRepository, sourceEntity.DisplayName, targetEntity); |
|||
targetEntity.DisplayName = sourceEntity.DisplayName; |
|||
} |
|||
|
|||
targetEntity.CustomerOrgGroupId = sourceEntity.CustomerOrgGroupId; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 删除
|
|||
/// </summary>
|
|||
/// <param name="id"></param>
|
|||
/// <returns></returns>
|
|||
/// <exception cref="UserFriendlyException"></exception>
|
|||
public async Task CheckAndDeleteAsync(Guid id) |
|||
{ |
|||
var thirdMedicalCenterBookingDateEnt = await _thirdMedicalCenterBookingDateRepository.FirstOrDefaultAsync(f => f.ThirdMedicalCenterId == id); |
|||
if (thirdMedicalCenterBookingDateEnt != null) |
|||
{ |
|||
throw new UserFriendlyException("第三方体检中心设置了预约日期,不能删除"); |
|||
} |
|||
await _thirdMedicalCenterRepository.DeleteAsync(id); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 修改排序 置顶,置底
|
|||
/// </summary>
|
|||
/// <param name="id">需要修改的ID</param>
|
|||
/// <param name="SortType">修改方式:1 置顶 2 置底</param>
|
|||
/// <returns></returns>
|
|||
public async Task UpdateManySortAsync(Guid id, int SortType) |
|||
{ |
|||
await EntityHelper.UpdateManySortCommonAsync(_thirdMedicalCenterRepository, id, SortType); |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 修改排序 拖拽
|
|||
/// </summary>
|
|||
/// <typeparam name="TEntity"></typeparam>
|
|||
/// <param name="repository"></param>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
public async Task UpdateSortManyAsync(UpdateSortManyCommonDto input) |
|||
{ |
|||
await EntityHelper.UpdateSortManyCommonAsync(_thirdMedicalCenterRepository, input); |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 检查空值
|
|||
/// </summary>
|
|||
/// <param name="entity"></param>
|
|||
private void Verify(ThirdMedicalCenter entity) |
|||
{ |
|||
|
|||
DataHelper.CheckEntityIsNull(entity); |
|||
DataHelper.CheckStringIsNull(entity.DisplayName, "名称"); |
|||
DataHelper.CheckGuidIsDefaultValue(entity.CustomerOrgGroupId, "单位分组ID"); |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
15955
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240927073902_update_third_booking.Designer.cs
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,27 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Shentun.Peis.Migrations |
|||
{ |
|||
public partial class update_third_booking : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<char>( |
|||
name: "medical_status", |
|||
table: "third_booking", |
|||
type: "character(1)", |
|||
nullable: false, |
|||
defaultValueSql: "'0'", |
|||
comment: "体检状态 0未开始 1已登记 2已完成体检"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "medical_status", |
|||
table: "third_booking"); |
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue