Browse Source

预约总金额

master
wxd 11 months ago
parent
commit
c5e885d3be
  1. 5
      src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/GerAppointPatientRegisterWithAsbitemListDto.cs
  2. 4
      src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs
  3. 83
      src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
  4. 55
      src/Shentun.Peis.EntityFrameworkCore/PatientRegisters/PatientRegisterChargeRepository.cs

5
src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/GerAppointPatientRegisterWithAsbitemListDto.cs

@ -21,6 +21,11 @@ namespace Shentun.Peis.AppointPatientRegisters
/// </summary> /// </summary>
public string AppointDate { get; set; } public string AppointDate { get; set; }
/// <summary>
/// 收费合计金额
/// </summary>
public decimal ChargeSumMoney { get; set; }
/// <summary> /// <summary>
/// 预约项目 /// 预约项目
/// </summary> /// </summary>

4
src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs

@ -156,8 +156,8 @@ namespace Shentun.Peis.CustomerOrgs
SalesPersonPhone = s.SalesPersonPhone, SalesPersonPhone = s.SalesPersonPhone,
MedicalCenterId = s.MedicalCenterId, MedicalCenterId = s.MedicalCenterId,
CountryOrgCode = s.CountryOrgCode, CountryOrgCode = s.CountryOrgCode,
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result,
LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).GetAwaiter().GetResult(),
LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).GetAwaiter().GetResult()
}).OrderBy(m => m.DisplayOrder).ToList(); }).OrderBy(m => m.DisplayOrder).ToList();

83
src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs

@ -42,6 +42,7 @@ using System.Linq;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Security; using System.Security;
using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp; using Volo.Abp;
@ -3654,23 +3655,81 @@ namespace Shentun.Peis.PatientRegisters
[HttpPost("api/app/patientregister/getpatientregisternotchargedlist")] [HttpPost("api/app/patientregister/getpatientregisternotchargedlist")]
public async Task<PagedResultDto<GetPatientRegisterNotChargedListDto>> GetPatientRegisterNotChargedListAsync(PatientRegisterChargeRequestDto input) public async Task<PagedResultDto<GetPatientRegisterNotChargedListDto>> GetPatientRegisterNotChargedListAsync(PatientRegisterChargeRequestDto input)
{ {
PatientRegisterChargeEfCoreDto patientRegisterChargeEfCoreDto = new PatientRegisterChargeEfCoreDto
var query = from patientRegister in await _repository.GetQueryableAsync()
join patient in await _patientRepository.GetQueryableAsync() on patientRegister.PatientId equals patient.Id
join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId
join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId
where registerCheckAsbitem.IsCharge == 'N' && registerCheckAsbitem.PayTypeFlag == PayTypeFlag.PersonPay
orderby patientRegister.Id ascending
select new
{
patientRegister,
patient
};
if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate))
{ {
EndDate = input.EndDate,
InvoiceNo = input.InvoiceNo,
PatientName = input.PatientName,
PatientNo = input.PatientNo,
PatientRegisterNo = input.PatientRegisterNo,
StartDate = input.StartDate
};
var patientRegisterNotChargedList = await _patientRegisterChargeRepository.GetPatientRegisterNotChargedListAsync(patientRegisterChargeEfCoreDto);
query = query.Where(m => m.patientRegister.CreationTime >= Convert.ToDateTime(input.StartDate) &&
m.patientRegister.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1));
}
if (!string.IsNullOrEmpty(input.PatientName))
{
query = query.Where(m => !string.IsNullOrEmpty(m.patientRegister.PatientName) && m.patientRegister.PatientName.Contains(input.PatientName));
}
if (!string.IsNullOrEmpty(input.PatientNo))
{
query = query.Where(m => m.patient.PatientNo == input.PatientNo);
}
if (!string.IsNullOrEmpty(input.PatientRegisterNo))
{
query = query.Where(m => m.patientRegister.PatientRegisterNo == input.PatientRegisterNo);
}
var patientRegisterGroup = query.ToList().GroupBy(g => g.patientRegister);
int totalCount = patientRegisterGroup.Count();
patientRegisterGroup = patientRegisterGroup.Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount);
var entListDto = patientRegisterGroup.ToList().Select(s => new GetPatientRegisterNotChargedListDto
{
PatientRegisterId = s.Key.Id,
Address = s.FirstOrDefault().patient.Address,
Age = s.Key.Age,
CustomerOrgName = _cacheService.GetCustomerOrgAsync(s.Key.CustomerOrgId).GetAwaiter().GetResult().DisplayName,
CustomerOrgParentName = _cacheService.GetTopCustomerOrgAsync(s.Key.CustomerOrgId).GetAwaiter().GetResult().DisplayName,
Email = s.FirstOrDefault().patient.Email,
IdNo = s.FirstOrDefault().patient.IdNo,
IsVip = s.Key.IsVip,
MedicalTimes = s.Key.MedicalTimes,
MobileTelephone = s.FirstOrDefault().patient.MobileTelephone,
PatientName = s.Key.PatientName,
PatientNo = s.FirstOrDefault().patient.PatientNo,
PatientRegisterNo = s.Key.PatientRegisterNo,
Salesman = s.Key.Salesman,
SexId = _cacheService.GetSexNameAsync(s.Key.SexId).GetAwaiter().GetResult(),
Telephone = s.FirstOrDefault().patient.Telephone
}).ToList();
return new PagedResultDto<GetPatientRegisterNotChargedListDto>(totalCount, entListDto);
//PatientRegisterChargeEfCoreDto patientRegisterChargeEfCoreDto = new PatientRegisterChargeEfCoreDto
//{
// EndDate = input.EndDate,
// InvoiceNo = input.InvoiceNo,
// PatientName = input.PatientName,
// PatientNo = input.PatientNo,
// PatientRegisterNo = input.PatientRegisterNo,
// StartDate = input.StartDate
//};
//var patientRegisterNotChargedList = await _patientRegisterChargeRepository.GetPatientRegisterNotChargedListAsync(patientRegisterChargeEfCoreDto);
int totalCount = patientRegisterNotChargedList.Count;
//int totalCount = patientRegisterNotChargedList.Count;
patientRegisterNotChargedList = patientRegisterNotChargedList.Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToList();
//patientRegisterNotChargedList = patientRegisterNotChargedList.Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToList();
return new PagedResultDto<GetPatientRegisterNotChargedListDto>(totalCount, patientRegisterNotChargedList);
//return new PagedResultDto<GetPatientRegisterNotChargedListDto>(totalCount, patientRegisterNotChargedList);
} }
/// <summary> /// <summary>

55
src/Shentun.Peis.EntityFrameworkCore/PatientRegisters/PatientRegisterChargeRepository.cs

@ -14,8 +14,14 @@ namespace Shentun.Peis.PatientRegisters
{ {
public class PatientRegisterChargeRepository : EfCoreRepository<PeisDbContext, PatientRegister, Guid>, IPatientRegisterChargeRepository public class PatientRegisterChargeRepository : EfCoreRepository<PeisDbContext, PatientRegister, Guid>, IPatientRegisterChargeRepository
{ {
public PatientRegisterChargeRepository(IDbContextProvider<PeisDbContext> dbContextProvider) : base(dbContextProvider)
private readonly CacheService _cacheService;
public PatientRegisterChargeRepository(
IDbContextProvider<PeisDbContext> dbContextProvider,
CacheService cacheService
) : base(dbContextProvider)
{ {
_cacheService = cacheService;
} }
/// <summary> /// <summary>
@ -28,17 +34,14 @@ namespace Shentun.Peis.PatientRegisters
{ {
var dbContext = await GetDbContextAsync(); var dbContext = await GetDbContextAsync();
List<CustomerOrg> customerOrgs = dbContext.CustomerOrgs.ToList();
var query = (from a in dbContext.PatientRegisters var query = (from a in dbContext.PatientRegisters
join b in dbContext.Patients on a.PatientId equals b.Id into bb join b in dbContext.Patients on a.PatientId equals b.Id into bb
from ab in bb.DefaultIfEmpty() from ab in bb.DefaultIfEmpty()
join c in dbContext.Sexes on a.SexId equals c.Id into cc
from ac in cc.DefaultIfEmpty()
join d in dbContext.Charges on a.Id equals d.PatientRegisterId join d in dbContext.Charges on a.Id equals d.PatientRegisterId
join e in dbContext.ChargeBacks on d.Id equals e.ChargeId join e in dbContext.ChargeBacks on d.Id equals e.ChargeId
where d.ChargeFlag == '1' where d.ChargeFlag == '1'
select new { a, ab, ac, d, e }
select new { a, ab, d, e }
); );
if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate)) if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate))
@ -63,8 +66,7 @@ namespace Shentun.Peis.PatientRegisters
query = query.Where(m => m.a.PatientRegisterNo == input.PatientRegisterNo); query = query.Where(m => m.a.PatientRegisterNo == input.PatientRegisterNo);
} }
var entlist = query.OrderBy(o => o.a.CreationTime).Select(s => new GetPatientRegisterChargeBackListDto
var entlist = query.ToList().OrderBy(o => o.a.CreationTime).Select(s => new GetPatientRegisterChargeBackListDto
{ {
PatientRegisterId = s.a.Id, PatientRegisterId = s.a.Id,
Address = s.ab.Address, Address = s.ab.Address,
@ -73,8 +75,8 @@ namespace Shentun.Peis.PatientRegisters
ChargeBackId = s.e.Id, ChargeBackId = s.e.Id,
InvoiceNo = s.d.InvoiceNo, InvoiceNo = s.d.InvoiceNo,
InvoiceOrgName = s.d.InvoiceOrgName, InvoiceOrgName = s.d.InvoiceOrgName,
CustomerOrgName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgs, s.a.CustomerOrgId),
CustomerOrgParentName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgs, s.a.CustomerOrgId),
CustomerOrgName = _cacheService.GetCustomerOrgAsync(s.a.CustomerOrgId).GetAwaiter().GetResult().DisplayName,
CustomerOrgParentName = _cacheService.GetTopCustomerOrgAsync(s.a.CustomerOrgId).GetAwaiter().GetResult().DisplayName,
Email = s.ab.Email, Email = s.ab.Email,
IdNo = s.ab.IdNo, IdNo = s.ab.IdNo,
IsVip = s.a.IsVip, IsVip = s.a.IsVip,
@ -84,7 +86,7 @@ namespace Shentun.Peis.PatientRegisters
PatientNo = s.ab.PatientNo, PatientNo = s.ab.PatientNo,
PatientRegisterNo = s.a.PatientRegisterNo, PatientRegisterNo = s.a.PatientRegisterNo,
Salesman = s.a.Salesman, Salesman = s.a.Salesman,
SexId = s.ac.DisplayName,
SexId = _cacheService.GetSexNameAsync(s.a.SexId).GetAwaiter().GetResult(),
Telephone = s.ab.Telephone Telephone = s.ab.Telephone
}).ToList(); }).ToList();
@ -101,20 +103,16 @@ namespace Shentun.Peis.PatientRegisters
var dbContext = await GetDbContextAsync(); var dbContext = await GetDbContextAsync();
List<CustomerOrg> customerOrgs = dbContext.CustomerOrgs.ToList();
var query = (from a in dbContext.PatientRegisters var query = (from a in dbContext.PatientRegisters
join b in dbContext.Patients on a.PatientId equals b.Id into bb join b in dbContext.Patients on a.PatientId equals b.Id into bb
from ab in bb.DefaultIfEmpty() from ab in bb.DefaultIfEmpty()
join c in dbContext.Sexes on a.SexId equals c.Id into cc
from ac in cc.DefaultIfEmpty()
join d in dbContext.Charges on a.Id equals d.PatientRegisterId join d in dbContext.Charges on a.Id equals d.PatientRegisterId
where d.ChargeFlag == '0' where d.ChargeFlag == '0'
select new { a, ab, ac, d }
select new { a, ab, d }
); );
var sss = query.ToQueryString();
if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate)) if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate))
{ {
query = query.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) && query = query.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) &&
@ -138,7 +136,7 @@ namespace Shentun.Peis.PatientRegisters
} }
var entlist = query.OrderBy(o => o.a.CreationTime).Select(s => new GetPatientRegisterChargeListDto
var entlist = query.ToList().OrderBy(o => o.a.CreationTime).Select(s => new GetPatientRegisterChargeListDto
{ {
PatientRegisterId = s.a.Id, PatientRegisterId = s.a.Id,
Address = s.ab.Address, Address = s.ab.Address,
@ -146,8 +144,8 @@ namespace Shentun.Peis.PatientRegisters
ChargeId = s.d.Id, ChargeId = s.d.Id,
InvoiceNo = s.d.InvoiceNo, InvoiceNo = s.d.InvoiceNo,
InvoiceOrgName = s.d.InvoiceOrgName, InvoiceOrgName = s.d.InvoiceOrgName,
CustomerOrgName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgs, s.a.CustomerOrgId),
CustomerOrgParentName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgs, s.a.CustomerOrgId),
CustomerOrgName = _cacheService.GetCustomerOrgAsync(s.a.CustomerOrgId).GetAwaiter().GetResult().DisplayName,
CustomerOrgParentName = _cacheService.GetTopCustomerOrgAsync(s.a.CustomerOrgId).GetAwaiter().GetResult().DisplayName,
Email = s.ab.Email, Email = s.ab.Email,
IdNo = s.ab.IdNo, IdNo = s.ab.IdNo,
IsVip = s.a.IsVip, IsVip = s.a.IsVip,
@ -157,7 +155,7 @@ namespace Shentun.Peis.PatientRegisters
PatientNo = s.ab.PatientNo, PatientNo = s.ab.PatientNo,
PatientRegisterNo = s.a.PatientRegisterNo, PatientRegisterNo = s.a.PatientRegisterNo,
Salesman = s.a.Salesman, Salesman = s.a.Salesman,
SexId = s.ac.DisplayName,
SexId = _cacheService.GetSexNameAsync(s.a.SexId).GetAwaiter().GetResult(),
Telephone = s.ab.Telephone Telephone = s.ab.Telephone
}).ToList(); }).ToList();
@ -175,16 +173,15 @@ namespace Shentun.Peis.PatientRegisters
{ {
var dbContext = await GetDbContextAsync(); var dbContext = await GetDbContextAsync();
List<CustomerOrg> customerOrgs = dbContext.CustomerOrgs.ToList();
var query = (from a in dbContext.PatientRegisters.Where(m => dbContext.RegisterCheckAsbitems.Where(rsb => rsb.IsCharge == 'N' && rsb.PayTypeFlag == PayTypeFlag.PersonPay).Select(s => s.PatientRegisterId).Contains(m.Id)) var query = (from a in dbContext.PatientRegisters.Where(m => dbContext.RegisterCheckAsbitems.Where(rsb => rsb.IsCharge == 'N' && rsb.PayTypeFlag == PayTypeFlag.PersonPay).Select(s => s.PatientRegisterId).Contains(m.Id))
join b in dbContext.Patients on a.PatientId equals b.Id into bb join b in dbContext.Patients on a.PatientId equals b.Id into bb
from ab in bb.DefaultIfEmpty() from ab in bb.DefaultIfEmpty()
join c in dbContext.Sexes on a.SexId equals c.Id into cc
from ac in cc.DefaultIfEmpty()
select new { a, ab, ac }
select new { a, ab }
); );
if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate)) if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate))
{ {
query = query.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) && query = query.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) &&
@ -204,13 +201,13 @@ namespace Shentun.Peis.PatientRegisters
} }
var entlist = query.OrderBy(o => o.a.CreationTime).Select(s => new GetPatientRegisterNotChargedListDto
var entlist = query.ToList().OrderBy(o => o.a.CreationTime).Select(s => new GetPatientRegisterNotChargedListDto
{ {
PatientRegisterId = s.a.Id, PatientRegisterId = s.a.Id,
Address = s.ab.Address, Address = s.ab.Address,
Age = s.a.Age, Age = s.a.Age,
CustomerOrgName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgs, s.a.CustomerOrgId),
CustomerOrgParentName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgs, s.a.CustomerOrgId),
CustomerOrgName = _cacheService.GetCustomerOrgAsync(s.a.CustomerOrgId).GetAwaiter().GetResult().DisplayName,
CustomerOrgParentName = _cacheService.GetTopCustomerOrgAsync(s.a.CustomerOrgId).GetAwaiter().GetResult().DisplayName,
Email = s.ab.Email, Email = s.ab.Email,
IdNo = s.ab.IdNo, IdNo = s.ab.IdNo,
IsVip = s.a.IsVip, IsVip = s.a.IsVip,
@ -220,7 +217,7 @@ namespace Shentun.Peis.PatientRegisters
PatientNo = s.ab.PatientNo, PatientNo = s.ab.PatientNo,
PatientRegisterNo = s.a.PatientRegisterNo, PatientRegisterNo = s.a.PatientRegisterNo,
Salesman = s.a.Salesman, Salesman = s.a.Salesman,
SexId = s.ac.DisplayName,
SexId = _cacheService.GetSexNameAsync(s.a.SexId).GetAwaiter().GetResult(),
Telephone = s.ab.Telephone Telephone = s.ab.Telephone
}).ToList(); }).ToList();

Loading…
Cancel
Save