From 50390eebe01ffae7d11b882f15b581ec880cc15f Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Mon, 15 Jul 2024 19:52:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E8=AF=8A=E5=8F=AB=E5=8F=B7=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E6=95=B0=E6=8D=AE=E7=BB=B4=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Rooms/AsbitemListByRoomIdDto.cs | 29 +++++ .../Rooms/CreateRoomDetailsInutDto.cs | 19 ++++ .../Rooms/CreateRoomDto.cs | 30 ++++++ .../Rooms/RoomDto.cs | 29 ++++- .../Rooms/RoomIdInputDto.cs | 14 +++ .../Rooms/UpdateRoomDto.cs | 28 +++++ .../ChargeReports/ChargeReportAppService.cs | 76 +++++++------ .../PeisApplicationAutoMapperProfile.cs | 5 + .../Rooms/RoomAppService.cs | 100 +++++++++++++++++- 9 files changed, 296 insertions(+), 34 deletions(-) create mode 100644 src/Shentun.Peis.Application.Contracts/Rooms/AsbitemListByRoomIdDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/Rooms/CreateRoomDetailsInutDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/Rooms/RoomIdInputDto.cs diff --git a/src/Shentun.Peis.Application.Contracts/Rooms/AsbitemListByRoomIdDto.cs b/src/Shentun.Peis.Application.Contracts/Rooms/AsbitemListByRoomIdDto.cs new file mode 100644 index 0000000..1c1f461 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/Rooms/AsbitemListByRoomIdDto.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.Rooms +{ + public class AsbitemListByRoomIdDto + { + /// + /// 房间ID + /// + public Guid RoomId { get; set; } + + /// + /// 房间名称 + /// + public string RoomName { get; set; } + + /// + /// 组合项目ID + /// + public Guid AsbitemId { get; set; } + + /// + /// 组合项目名称 + /// + public string AsbitemName { get; set;} + } +} diff --git a/src/Shentun.Peis.Application.Contracts/Rooms/CreateRoomDetailsInutDto.cs b/src/Shentun.Peis.Application.Contracts/Rooms/CreateRoomDetailsInutDto.cs new file mode 100644 index 0000000..ca95db4 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/Rooms/CreateRoomDetailsInutDto.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.Rooms +{ + public class CreateRoomDetailsInutDto + { + /// + /// 房间ID + /// + public Guid RoomId { get; set; } + + /// + /// 项目ID集合 + /// + public List AsbitemIds { get; set;]} + } +} diff --git a/src/Shentun.Peis.Application.Contracts/Rooms/CreateRoomDto.cs b/src/Shentun.Peis.Application.Contracts/Rooms/CreateRoomDto.cs index 630f370..6f688f0 100644 --- a/src/Shentun.Peis.Application.Contracts/Rooms/CreateRoomDto.cs +++ b/src/Shentun.Peis.Application.Contracts/Rooms/CreateRoomDto.cs @@ -1,10 +1,40 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; using System.Text; namespace Shentun.Peis.Rooms { public class CreateRoomDto { + + public string DisplayName { get; set; } = null!; + /// + /// 项目类别编号 + /// + public Guid ItemTypeId { get; set; } + + /// + /// 体检中心ID + /// + public Guid MedicalCenterId { get; set; } + + + public char ForSexId { get; set; } + + /// + /// 0-普通,1-抽血室 + /// + public char RoomTypeFlag { get; set; } + + + /// + /// 候诊时间 + /// + public decimal QueueTime { get; set; } + + + public char IsActive { get; set; } } } diff --git a/src/Shentun.Peis.Application.Contracts/Rooms/RoomDto.cs b/src/Shentun.Peis.Application.Contracts/Rooms/RoomDto.cs index ae18bbf..1a19962 100644 --- a/src/Shentun.Peis.Application.Contracts/Rooms/RoomDto.cs +++ b/src/Shentun.Peis.Application.Contracts/Rooms/RoomDto.cs @@ -4,7 +4,34 @@ using System.Text; namespace Shentun.Peis.Rooms { - public class RoomDto + public class RoomDto : AuditedEntityDtoName { + public string DisplayName { get; set; } = null!; + /// + /// 项目类别编号 + /// + public Guid ItemTypeId { get; set; } + + /// + /// 体检中心ID + /// + public Guid MedicalCenterId { get; set; } + + + public char ForSexId { get; set; } + + /// + /// 0-普通,1-抽血室 + /// + public char RoomTypeFlag { get; set; } + + + /// + /// 候诊时间 + /// + public decimal QueueTime { get; set; } + + + public char IsActive { get; set; } } } diff --git a/src/Shentun.Peis.Application.Contracts/Rooms/RoomIdInputDto.cs b/src/Shentun.Peis.Application.Contracts/Rooms/RoomIdInputDto.cs new file mode 100644 index 0000000..6b36c14 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/Rooms/RoomIdInputDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.Rooms +{ + public class RoomIdInputDto + { + /// + /// 房间ID + /// + public Guid RoomId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/Rooms/UpdateRoomDto.cs b/src/Shentun.Peis.Application.Contracts/Rooms/UpdateRoomDto.cs index ca69e78..ef0e3d7 100644 --- a/src/Shentun.Peis.Application.Contracts/Rooms/UpdateRoomDto.cs +++ b/src/Shentun.Peis.Application.Contracts/Rooms/UpdateRoomDto.cs @@ -7,5 +7,33 @@ namespace Shentun.Peis.Rooms public class UpdateRoomDto { public Guid RoomId { get; set; } + + public string DisplayName { get; set; } = null!; + /// + /// 项目类别编号 + /// + public Guid ItemTypeId { get; set; } + + /// + /// 体检中心ID + /// + public Guid MedicalCenterId { get; set; } + + + public char ForSexId { get; set; } + + /// + /// 0-普通,1-抽血室 + /// + public char RoomTypeFlag { get; set; } + + + /// + /// 候诊时间 + /// + public decimal QueueTime { get; set; } + + + public char IsActive { get; set; } } } diff --git a/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs b/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs index 581576c..3609abf 100644 --- a/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs +++ b/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs @@ -48,7 +48,7 @@ namespace Shentun.Peis.ChargeReports private readonly IRepository _patientRepository; private readonly IRepository _sexRepository; private readonly ItemTypeManager _itemTypeManager; - private readonly IRepository _collectItemTypeRepository; + private readonly IRepository _collectItemTypeRepository; public ChargeReportAppService( IRepository chargeRepository, IRepository chargeBackRepository, @@ -189,45 +189,57 @@ namespace Shentun.Peis.ChargeReports foreach (var userName in userNameList) { - //添加收费数据 - foreach (var payMode in chargeDetails.Where(m => m.UserName == userName).FirstOrDefault().PayModeDetails) + + var userChargeDetail = chargeDetails.Where(m => m.UserName == userName).FirstOrDefault(); + + if (userChargeDetail != null) { - chargeAndChargeBackDetails.Add(new GetTollCollectorFeeReportInPayMode_ChargeAndChargeBackDetail + //添加收费数据 + foreach (var payMode in userChargeDetail.PayModeDetails) { - ChargeName = userName, - PayModeName = payMode.PayModeName, - ChargeMoney = payMode.Money, - ChargeBackMoney = 0 - }); + chargeAndChargeBackDetails.Add(new GetTollCollectorFeeReportInPayMode_ChargeAndChargeBackDetail + { + ChargeName = userName, + PayModeName = payMode.PayModeName, + ChargeMoney = payMode.Money, + ChargeBackMoney = 0 + }); + } } - //添加退费数据 - foreach (var payMode in chargeBackDetails.Where(m => m.UserName == userName).FirstOrDefault().PayModeDetails) + + var userChargeBackDetail = chargeBackDetails.Where(m => m.UserName == userName).FirstOrDefault(); + if (userChargeBackDetail != null) { - //支付方式是否已存在 - var isPayModeName = chargeAndChargeBackDetails.Where(m => m.ChargeName == userName && m.PayModeName == payMode.PayModeName).FirstOrDefault(); - if (isPayModeName != null) + //添加退费数据 + foreach (var payMode in userChargeBackDetail.PayModeDetails) { - //收费处已存在 - - chargeAndChargeBackDetails.ForEach(m => + //支付方式是否已存在 + var isPayModeName = chargeAndChargeBackDetails.Where(m => m.ChargeName == userName && m.PayModeName == payMode.PayModeName).FirstOrDefault(); + if (isPayModeName != null) { - if (m.PayModeName == payMode.PayModeName && m.ChargeName == userName) + //收费处已存在 + + chargeAndChargeBackDetails.ForEach(m => { - m.ChargeBackMoney = payMode.Money; - m.TotalMoney = m.ChargeMoney - payMode.Money; - } - }); - } - else - { - chargeAndChargeBackDetails.Add(new GetTollCollectorFeeReportInPayMode_ChargeAndChargeBackDetail + if (m.PayModeName == payMode.PayModeName && m.ChargeName == userName) + { + m.ChargeBackMoney = payMode.Money; + m.TotalMoney = m.ChargeMoney - payMode.Money; + } + }); + } + else { - ChargeName = userName, - PayModeName = payMode.PayModeName, - ChargeMoney = 0, - ChargeBackMoney = payMode.Money, - TotalMoney = 0 - payMode.Money - }); + chargeAndChargeBackDetails.Add(new GetTollCollectorFeeReportInPayMode_ChargeAndChargeBackDetail + { + ChargeName = userName, + PayModeName = payMode.PayModeName, + ChargeMoney = 0, + ChargeBackMoney = payMode.Money, + TotalMoney = 0 - payMode.Money + }); + } + } } diff --git a/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs b/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs index 9013cec..6d62e22 100644 --- a/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs +++ b/src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs @@ -71,6 +71,7 @@ using Shentun.Peis.ReportFormatTemplates; using Shentun.Peis.ReportPrinters; using Shentun.Peis.Reports; using Shentun.Peis.ResultStatuses; +using Shentun.Peis.Rooms; using Shentun.Peis.SampleContainers; using Shentun.Peis.SampleGroupDetails; using Shentun.Peis.SampleGroups; @@ -541,6 +542,10 @@ public class PeisApplicationAutoMapperProfile : Profile //ְҵ CreateMap(); + //к + CreateMap(); + CreateMap(); + CreateMap(); } } diff --git a/src/Shentun.Peis.Application/Rooms/RoomAppService.cs b/src/Shentun.Peis.Application/Rooms/RoomAppService.cs index c8891af..5e7f3c4 100644 --- a/src/Shentun.Peis.Application/Rooms/RoomAppService.cs +++ b/src/Shentun.Peis.Application/Rooms/RoomAppService.cs @@ -3,11 +3,13 @@ using Microsoft.AspNetCore.Mvc; using Shentun.Peis.Asbitems; using Shentun.Peis.HelperDto; using Shentun.Peis.Models; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; using Volo.Abp.ObjectMapping; @@ -22,16 +24,50 @@ namespace Shentun.Peis.Rooms public class RoomAppService : ApplicationService { private readonly IRepository _roomRepository; + private readonly IRepository _roomDetailRepository; private readonly IRepository _asbitemRepository; + private readonly CacheService _cacheService; private readonly RoomManager _roomManager; public RoomAppService( IRepository roomRepository, IRepository asbitemRepository, - RoomManager roomManager) + RoomManager roomManager, + IRepository roomDetailRepository, + CacheService cacheService) { _roomRepository = roomRepository; _asbitemRepository = asbitemRepository; _roomManager = roomManager; + _roomDetailRepository = roomDetailRepository; + _cacheService = cacheService; + } + + /// + /// 查询房间列表 + /// + /// + [HttpPost("api/app/Room/GetList")] + public async Task> GetListAsync() + { + var entListDto = (await _roomRepository.GetQueryableAsync()).Select(s => new RoomDto + { + CreationTime = s.CreationTime, + CreatorId = s.CreatorId, + ForSexId = s.ForSexId, + Id = s.Id, + IsActive = s.IsActive, + ItemTypeId = s.ItemTypeId, + DisplayName = s.DisplayName, + LastModificationTime = s.LastModificationTime, + LastModifierId = s.LastModifierId, + MedicalCenterId = s.MedicalCenterId, + QueueTime = s.QueueTime, + RoomTypeFlag = s.RoomTypeFlag, + LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result, + CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result + }).ToList(); + + return entListDto; } @@ -76,6 +112,68 @@ namespace Shentun.Peis.Rooms await _roomManager.CheckAndDeleteAsync(id); } + /// + /// 批量创建房间对应的项目 明细 + /// + /// + /// + [HttpPost("api/app/Room/CreateRoomDetails")] + public async Task CreateRoomDetailsAsync(CreateRoomDetailsInutDto input) + { + var roomEnt = await _roomRepository.FirstOrDefaultAsync(f => f.Id == input.RoomId); + if (roomEnt == null) + { + throw new UserFriendlyException("房间不存在"); + } + + await _roomDetailRepository.DeleteAsync(d => d.RoomId == input.RoomId); + + if (input.AsbitemIds.Any()) + { + List roomDetails = new List(); + + foreach (var asbitemId in input.AsbitemIds) + { + if (roomDetails.FirstOrDefault(m => m.AsbitemId == asbitemId) != null) + { + roomDetails.Add(new RoomDetail + { + AsbitemId = asbitemId, + RoomId = input.RoomId + }); + } + } + + await _roomDetailRepository.InsertManyAsync(roomDetails); + } + + } + + + /// + /// 根据房间id查询对应的项目 + /// + /// + /// + [HttpPost("api/app/Room/GetAsbitemListByRoomId")] + public async Task> GetAsbitemListByRoomIdAsync(RoomIdInputDto input) + { + var entListDto = (from roomDetail in await _roomDetailRepository.GetQueryableAsync() + join asbitem in await _asbitemRepository.GetQueryableAsync() on roomDetail.AsbitemId equals asbitem.Id + join room in await _roomRepository.GetQueryableAsync() on roomDetail.RoomId equals room.Id + where roomDetail.RoomId == input.RoomId + orderby asbitem.DisplayOrder ascending + select new AsbitemListByRoomIdDto + { + AsbitemId = roomDetail.AsbitemId, + AsbitemName = asbitem.DisplayName, + RoomId = roomDetail.RoomId, + RoomName = room.DisplayName + }).ToList(); + + return entListDto; + } + /// /// 修改排序 置顶,置底 ///