Browse Source

bak0905

bjmzak
wxd 2 years ago
parent
commit
c81f885f34
  1. 24
      src/Shentun.Peis.Application.Contracts/InternalReports/GetRegistrationPersonnelWorkLoadReportDto.cs
  2. 24
      src/Shentun.Peis.Application.Contracts/InternalReports/GetRegistrationPersonnelWorkLoadReportRequestDto.cs
  3. 42
      src/Shentun.Peis.Application/InternalReports/InternalReportAppService.cs
  4. 67
      src/Shentun.Peis.Application/OrganizationUnits/OrganizationUnitsAppService.cs
  5. 1
      src/Shentun.Peis.Application/RegisterAsbitems/RegisterAsbitemAppService.cs
  6. 3
      src/Shentun.Peis.Domain/AsbitemGuides/AsbitemGuideManager.cs

24
src/Shentun.Peis.Application.Contracts/InternalReports/GetRegistrationPersonnelWorkLoadReportDto.cs

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.InternalReports
{
public class GetRegistrationPersonnelWorkLoadReportDto
{
/// <summary>
/// 人员名称
/// </summary>
public string PersonnelName { get; set; }
/// <summary>
/// 登记数量
/// </summary>
public int RegisterCount { get; set; }
/// <summary>
/// 占百分比
/// </summary>
public string Percentage { get; set; }
}
}

24
src/Shentun.Peis.Application.Contracts/InternalReports/GetRegistrationPersonnelWorkLoadReportRequestDto.cs

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.InternalReports
{
public class GetRegistrationPersonnelWorkLoadReportRequestDto
{
/// <summary>
/// 登记人员ID 集合
/// </summary>
public List<Guid> UserIds { get; set;}
/// <summary>
/// 开始登记日期
/// </summary>
public string StartDate { get; set; }
/// <summary>
/// 结束登记日期
/// </summary>
public string EndDate { get; set; }
}
}

42
src/Shentun.Peis.Application/InternalReports/InternalReportAppService.cs

@ -1,11 +1,15 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
namespace Shentun.Peis.InternalReports namespace Shentun.Peis.InternalReports
{ {
@ -16,12 +20,50 @@ namespace Shentun.Peis.InternalReports
[Authorize] [Authorize]
public class InternalReportAppService : ApplicationService public class InternalReportAppService : ApplicationService
{ {
private readonly IRepository<IdentityUser, Guid> _userRepository;
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository;
public InternalReportAppService( public InternalReportAppService(
IRepository<IdentityUser, Guid> userRepository,
IRepository<PatientRegister, Guid> patientRegisterRepository
) )
{ {
this._userRepository = userRepository;
this._patientRegisterRepository = patientRegisterRepository;
} }
/// <summary>
/// 登记人员工作量统计
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/internalreport/getregistrationpersonnelworkloadreport")]
public async Task<List<GetRegistrationPersonnelWorkLoadReportDto>> GetRegistrationPersonnelWorkLoadReportAsync(GetRegistrationPersonnelWorkLoadReportRequestDto input)
{
var query = (from a in await _patientRegisterRepository.GetQueryableAsync()
join b in await _userRepository.GetQueryableAsync() on a.CreatorId equals b.Id into bb
from ab in bb.DefaultIfEmpty()
where (a.CreationTime >= Convert.ToDateTime(input.StartDate) &&
a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1))
select new { a, PersonnelName = ab != null ? ab.UserName : "" });
var sumCount = query.Count(); //总数
if (input.UserIds.Count > 0)
{
query = query.Where(m => input.UserIds.Contains(m.a.CreatorId.Value));
}
var entlistdto = query.GroupBy(g => new { g.a.CreatorId, g.PersonnelName })
.Select(s => new GetRegistrationPersonnelWorkLoadReportDto
{
PersonnelName = s.Key.PersonnelName,
RegisterCount = s.Count(),
Percentage = Math.Round(Convert.ToDecimal(s.Count() * 100) / sumCount, 2).ToString()
}).ToList();
return entlistdto;
}
} }
} }

67
src/Shentun.Peis.Application/OrganizationUnits/OrganizationUnitsAppService.cs

@ -252,7 +252,7 @@ namespace Shentun.Peis.OrganizationUnits
/// <summary> /// <summary>
/// 检查是否可以设置为体检中心
/// 检查是否可以设置为体检中心 创建时用 无下级数据
/// </summary> /// </summary>
/// <param name="parentid">上级数据ID</param> /// <param name="parentid">上级数据ID</param>
/// <returns>Ture 可以设置 False 不能设置</returns> /// <returns>Ture 可以设置 False 不能设置</returns>
@ -262,41 +262,6 @@ namespace Shentun.Peis.OrganizationUnits
return !CheckParentIsPeis(dataList, parentid); return !CheckParentIsPeis(dataList, parentid);
} }
///// <summary>
///// 检查是否可以设置为体检中心
///// </summary>
///// <param name="datalist"></param>
///// <param name="parentid"></param>
///// <returns>Ture 可以设置 False 不能设置</returns>
//private bool CheckIsPeis(List<OrganizationUnit> datalist, Guid? parentid)
//{
// if (parentid != null && parentid != Guid.Empty)
// {
// var parentEnt = datalist.FirstOrDefault(m => m.Id == parentid);
// if (parentEnt != null)
// {
// var IsPeis = parentEnt.GetProperty<char>("IsPeis");
// if (IsPeis == 'Y')
// {
// return false; //上级为体检中心,不能设置为体检中心
// }
// else
// {
// return CheckIsPeis(datalist, parentEnt.ParentId);
// }
// }
// else
// {
// return true; //无上级,可以设置为体检中心
// }
// }
// else
// {
// return true; //无上级,可以设置为体检中心
// }
//}
/// <summary> /// <summary>
/// 检查上级有没有体检中心 /// 检查上级有没有体检中心
@ -334,7 +299,7 @@ namespace Shentun.Peis.OrganizationUnits
} }
/// <summary> /// <summary>
/// 检查下级可以设置为体检中心
/// 检查下级是否有体检中心
/// </summary> /// </summary>
/// <param name="datalist"></param> /// <param name="datalist"></param>
/// <param name="id"></param> /// <param name="id"></param>
@ -345,32 +310,38 @@ namespace Shentun.Peis.OrganizationUnits
GetChildren(datalist, id, datalisttemp); GetChildren(datalist, id, datalisttemp);
if (datalisttemp.Any())
{
foreach (var ent in datalisttemp)
{
var IsPeis = ent.GetProperty<char>("IsPeis");
datalisttemp = datalisttemp.Where(m => m.Id != id).ToList(); //剔除自身
if (IsPeis == 'Y')
if (datalisttemp.Any())
{ {
return true; //下级为体检中心,不能设置为体检中心
}
}
return true;
} }
else
{
return false; return false;
} }
}
/// <summary>
/// 递归查找下级的设置为体检中心的数据
/// </summary>
/// <param name="datalist"></param>
/// <param name="id"></param>
/// <param name="datalisttemp"></param>
private void GetChildren(List<OrganizationUnit> datalist, Guid id, List<OrganizationUnit> datalisttemp) private void GetChildren(List<OrganizationUnit> datalist, Guid id, List<OrganizationUnit> datalisttemp)
{ {
var ent = datalist.Find(m => m.Id == id); var ent = datalist.Find(m => m.Id == id);
if (ent != null) if (ent != null)
{
var IsPeis = ent.GetProperty<char>("IsPeis");
if (IsPeis == 'Y')
{ {
datalisttemp.Add(ent); datalisttemp.Add(ent);
} }
}
var entlist = datalist.Where(m => m.ParentId == id).ToList(); var entlist = datalist.Where(m => m.ParentId == id).ToList();
if (entlist.Count > 0) if (entlist.Count > 0)
{ {

1
src/Shentun.Peis.Application/RegisterAsbitems/RegisterAsbitemAppService.cs

@ -409,6 +409,7 @@ namespace Shentun.Peis.RegisterAsbitems
ChargePrice = item.ChargePrice ChargePrice = item.ChargePrice
}); });
registerAsbitems.Find(f => f.Id == item.RegisterAsbitemId).ChargePrice = item.ChargePrice;
} }

3
src/Shentun.Peis.Domain/AsbitemGuides/AsbitemGuideManager.cs

@ -54,5 +54,8 @@ namespace Shentun.Peis.AsbitemGuides
return ""; return "";
} }
} }
} }
} }
Loading…
Cancel
Save