From 2056d3a684cbfef126393e12bab028ebb1ec8bf2 Mon Sep 17 00:00:00 2001
From: wxd <123@qq.com>
Date: Sun, 24 Nov 2024 15:47:37 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../GetCustomerOrgThreeListDto.cs | 24 +++++
.../GetExcludeCustomerOrgListDto.cs | 14 +++
...intScheduleExcludeCustomerOrgAppService.cs | 87 ++++++++++++++++++-
.../AppointScheduleAppService.cs | 61 ++++++++++---
.../Persons/PersonAppService.cs | 2 +-
5 files changed, 173 insertions(+), 15 deletions(-)
create mode 100644 src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetCustomerOrgThreeListDto.cs
create mode 100644 src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetExcludeCustomerOrgListDto.cs
diff --git a/src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetCustomerOrgThreeListDto.cs b/src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetCustomerOrgThreeListDto.cs
new file mode 100644
index 0000000..bc9f5f2
--- /dev/null
+++ b/src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetCustomerOrgThreeListDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.WebPeis.AppointScheduleExcludeCustomerOrgs
+{
+ public class GetCustomerOrgThreeListDto
+ {
+ //组织Id
+ public Guid CustomerOrgId { get; set; }
+ //组织名称
+ public string CustomerOrgName { get; set; }
+ //父节点Id
+ public Guid? ParentId { get; set; }
+ ///
+ /// 用来做递归的 新用法
+ ///
+ public string Code { get; set; }
+
+ public int DisplayOrder { get; set; }
+
+ public List TreeChildren { get; set; }
+ }
+}
diff --git a/src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetExcludeCustomerOrgListDto.cs b/src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetExcludeCustomerOrgListDto.cs
new file mode 100644
index 0000000..ba8c2b8
--- /dev/null
+++ b/src/Shentun.WebPeis.Application.Contracts/AppointScheduleExcludeCustomerOrgs/GetExcludeCustomerOrgListDto.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.WebPeis.AppointScheduleExcludeCustomerOrgs
+{
+ public class GetExcludeCustomerOrgListDto
+ {
+ ///
+ /// 单位Id
+ ///
+ public Guid CustomerOrgId { get; set; }
+ }
+}
diff --git a/src/Shentun.WebPeis.Application/AppointScheduleExcludeCustomerOrgs/AppointScheduleExcludeCustomerOrgAppService.cs b/src/Shentun.WebPeis.Application/AppointScheduleExcludeCustomerOrgs/AppointScheduleExcludeCustomerOrgAppService.cs
index 971930a..aabc3e2 100644
--- a/src/Shentun.WebPeis.Application/AppointScheduleExcludeCustomerOrgs/AppointScheduleExcludeCustomerOrgAppService.cs
+++ b/src/Shentun.WebPeis.Application/AppointScheduleExcludeCustomerOrgs/AppointScheduleExcludeCustomerOrgAppService.cs
@@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using Shentun.WebPeis.AppointSchedules;
+using Shentun.WebPeis.Enums;
using Shentun.WebPeis.Models;
using System;
using System.Collections.Generic;
@@ -20,11 +22,13 @@ namespace Shentun.WebPeis.AppointScheduleExcludeCustomerOrgs
public class AppointScheduleExcludeCustomerOrgAppService : ApplicationService
{
private readonly IRepository _appointScheduleExcludeCustomerOrgRepository;
+ private readonly IRepository _customerOrgRepository;
public AppointScheduleExcludeCustomerOrgAppService(
- IRepository appointScheduleExcludeCustomerOrgRepository
- )
+ IRepository appointScheduleExcludeCustomerOrgRepository,
+ IRepository customerOrgRepository)
{
_appointScheduleExcludeCustomerOrgRepository = appointScheduleExcludeCustomerOrgRepository;
+ _customerOrgRepository = customerOrgRepository;
}
///
@@ -62,5 +66,84 @@ namespace Shentun.WebPeis.AppointScheduleExcludeCustomerOrgs
await _appointScheduleExcludeCustomerOrgRepository.InsertManyAsync(appointScheduleExcludeCustomerOrgs);
}
}
+
+
+ ///
+ /// 查询预约计划对应的禁止单位
+ ///
+ ///
+ ///
+ [HttpPost("api/app/AppointScheduleExcludeCustomerOrg/GetExcludeCustomerOrgList")]
+ public async Task> GetExcludeCustomerOrgListAsync(AppointScheduleIdInputDto input)
+ {
+ if (input.AppointScheduleId == Guid.Empty)
+ {
+ throw new UserFriendlyException("预约计划ID不能为空");
+ }
+ //删除
+ var entListDto = (await _appointScheduleExcludeCustomerOrgRepository.GetListAsync(d => d.AppointScheduleId == input.AppointScheduleId))
+ .Select(s => new GetExcludeCustomerOrgListDto
+ {
+ CustomerOrgId = s.CustomerOrgId
+ }).ToList();
+
+ return entListDto;
+ }
+
+ ///
+ /// 获取单位树型结构
+ ///
+ ///
+ [HttpPost("api/app/AppointScheduleExcludeCustomerOrg/GetCustomerOrgThreeList")]
+ public async Task> GetCustomerOrgThreeListAsync()
+ {
+
+ List result = new List();
+
+ var customerOrgList = await _customerOrgRepository.GetListAsync(m => m.CustomerOrgId != GuidFlag.PersonCustomerOrgId);
+
+ var items = from p in customerOrgList.OrderByDescending(o => o.DisplayOrder).AsParallel()
+ select new GetCustomerOrgThreeListDto()
+ {
+ CustomerOrgId = p.CustomerOrgId,
+ ParentId = p.ParentId,
+ Code = p.PathCode,
+ CustomerOrgName = p.CustomerOrgName,
+ DisplayOrder = p.DisplayOrder,
+ TreeChildren = new List()
+ };
+
+ var customerOrgTreeChildList = GetTree(items.ToList(), null);
+
+
+
+ result.AddRange(customerOrgTreeChildList);
+
+
+ return result;
+ }
+
+ ///
+ /// 使用parentId进行递归
+ ///
+ ///
+ ///
+ ///
+ private List GetTree(List items, Guid? parentId)
+ {
+ return (from p in items.AsParallel()
+ where p.ParentId == parentId
+ let subs = GetTree(items, p.CustomerOrgId)
+ select new GetCustomerOrgThreeListDto()
+ {
+ CustomerOrgId = p.CustomerOrgId,
+ ParentId = p.ParentId,
+ Code = p.Code,
+ CustomerOrgName = p.CustomerOrgName,
+ DisplayOrder = p.DisplayOrder,
+ TreeChildren = subs.ToList()
+ }
+ ).ToList();
+ }
}
}
diff --git a/src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs b/src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs
index 2ac7f78..1e3d2f7 100644
--- a/src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs
+++ b/src/Shentun.WebPeis.Application/AppointSchedules/AppointScheduleAppService.cs
@@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Nito.AsyncEx.Synchronous;
using Shentun.WebPeis.AppointScheduleTimes;
+using Shentun.WebPeis.CustomerOrgs;
using Shentun.WebPeis.Models;
using Shentun.WebPeis.OrganizationUnits;
using Shentun.WebPeis.SysParmValues;
@@ -31,7 +32,7 @@ namespace Shentun.WebPeis.AppointSchedules
private readonly SysParmValueManager _sysParmValueManager;
private readonly WebPeisOrganizationUnitManager _webPeisOrganizationUnitManager;
private readonly IRepository _appointScheduleExcludeCustomerOrgRepository;
-
+ private readonly IRepository _customerOrgRepository;
public AppointScheduleAppService(IRepository appointScheduleRepository,
CacheService cacheService,
AppointScheduleManager appointScheduleManager,
@@ -41,7 +42,8 @@ namespace Shentun.WebPeis.AppointSchedules
SysParmValueManager sysParmValueManager,
WebPeisOrganizationUnitManager webPeisOrganizationUnitManager,
IRepository appointScheduleTemplateTimeRepository,
- IRepository appointScheduleExcludeCustomerOrgRepository)
+ IRepository appointScheduleExcludeCustomerOrgRepository,
+ IRepository customerOrgRepository)
{
_appointScheduleRepository = appointScheduleRepository;
_cacheService = cacheService;
@@ -53,6 +55,7 @@ namespace Shentun.WebPeis.AppointSchedules
_webPeisOrganizationUnitManager = webPeisOrganizationUnitManager;
_appointScheduleTemplateTimeRepository = appointScheduleTemplateTimeRepository;
_appointScheduleExcludeCustomerOrgRepository = appointScheduleExcludeCustomerOrgRepository;
+ _customerOrgRepository = customerOrgRepository;
}
///
@@ -120,8 +123,18 @@ namespace Shentun.WebPeis.AppointSchedules
bool isAdd = false;
if (input != null && input.CustomerOrgId != null)
{
- if (appointScheduleExcludeCustomerOrgIds.FirstOrDefault(f => f.appointScheduleId == item.Key.AppointScheduleId
- && f.customerOrgId == input.CustomerOrgId) == null)
+ List customerOrgIds = new List();
+ var customerOrgIdList = appointScheduleExcludeCustomerOrgIds.Where(m => m.appointScheduleId == item.Key.AppointScheduleId);
+ if (customerOrgIdList.Any())
+ {
+ foreach (var customerOrgId in customerOrgIdList)
+ {
+ var customerOrgIdsTemp = await GetCustomerOrgChildrenId(input.CustomerOrgId.Value);
+ customerOrgIds.AddRange(customerOrgIdsTemp);
+ }
+ }
+
+ if (!customerOrgIds.Any() || !customerOrgIds.Contains(input.CustomerOrgId))
{
isAdd = true;
}
@@ -147,14 +160,6 @@ namespace Shentun.WebPeis.AppointSchedules
- //var list = appointSchedules.GroupBy(o => o.appointSchedule)
- // .Select(x => new AppointScheduleDateDto()
- // {
- // AppointScheduleId = x.Key.AppointScheduleId,
- // AppointDate = x.Key.AppointDate,
- // IsWork = x.Key.IsWork,
- // IsFull = x.Key.AppointScheduleTimes.Sum(m => m.NumberLimit) <= x.Key.AppointScheduleTimes.Sum(m => m.AppointNumber) ? 'Y' : 'N'
- // }).ToList();
return entListDto;
}
@@ -381,5 +386,37 @@ namespace Shentun.WebPeis.AppointSchedules
}
}
+
+
+ ///
+ /// 获取包含子级的ID
+ ///
+ ///
+ ///
+ private async Task> GetCustomerOrgChildrenId(Guid CustomerOrgId)
+ {
+
+ var customerOrg = await _customerOrgRepository.GetAsync(g => g.CustomerOrgId == CustomerOrgId);
+ var customerOrgEntList = await _customerOrgRepository.GetListAsync(o => o.PathCode.StartsWith(customerOrg.PathCode));
+ List CustomerOrgIds = new List();
+
+ GetChildren(customerOrgEntList, CustomerOrgId, CustomerOrgIds);
+
+ return CustomerOrgIds;
+ }
+
+ private void GetChildren(List customerOrgEntList, Guid CustomerOrgId, List CustomerOrgIds)
+ {
+ CustomerOrgIds.Add(CustomerOrgId);
+ var entlist = customerOrgEntList.Where(m => m.ParentId == CustomerOrgId).ToList();
+ if (entlist.Count > 0)
+ {
+ foreach (var ent in entlist)
+ {
+ GetChildren(customerOrgEntList, ent.CustomerOrgId, CustomerOrgIds);
+ }
+ }
+ }
+
}
}
diff --git a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
index 058f195..6d83f7b 100644
--- a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
+++ b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
@@ -447,7 +447,6 @@ namespace Shentun.WebPeis.Persons
[HttpPost("api/app/Person/GetMedicalTimesListByPersonId")]
public async Task> GetMedicalTimesListByPersonIdAsync(PersonIdInputDto input)
{
-
var entityList = (from user in await _identityUserRepository.GetQueryableAsync()
join person in await _repository.GetQueryableAsync()
on user.Id equals person.PersonId
@@ -483,6 +482,7 @@ namespace Shentun.WebPeis.Persons
join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.RegisterCheckId equals registerCheckAsbitem.RegisterCheckId
join asbitem in await _asbitemRepository.GetQueryableAsync() on registerCheckAsbitem.AsbitemId equals asbitem.AsbitemId
where patientRegister.PatientRegisterId == input.PatientRegisterId
+ && registerCheck.IsPacsCheck == 'Y'
select new
{
registerCheck.CheckRequestNo,