Browse Source

体检报告查询

bjmzak
wxd 2 years ago
parent
commit
bcca711d65
  1. 2
      src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs
  2. 3
      src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
  3. 92
      src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs
  4. 6
      src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs

2
src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs

@ -9,6 +9,6 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces
/// <summary> /// <summary>
/// 体检人员条码号 /// 体检人员条码号
/// </summary> /// </summary>
public string PatientRegisterNo { get; set; }
public List<string> PatientRegisterNos { get; set; }
} }
} }

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

@ -1751,8 +1751,7 @@ namespace Shentun.Peis.PatientRegisters
if (input.CompleteFlag != null if (input.CompleteFlag != null
&& input.CompleteFlag != PatientRegisterCompleteFlag.ItemCheckUnSumCheck
&& input.CompleteFlag != PatientRegisterCompleteFlag.PartCheck)
&& input.CompleteFlag != PatientRegisterCompleteFlag.ItemCheckUnSumCheck)
{ {
sumquery = sumquery.Where(m => m.a.CompleteFlag == input.CompleteFlag); sumquery = sumquery.Where(m => m.a.CompleteFlag == input.CompleteFlag);
} }

92
src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs

@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
using Shentun.Peis.CustomerOrgs; using Shentun.Peis.CustomerOrgs;
using Shentun.Peis.Enums; using Shentun.Peis.Enums;
using Shentun.Peis.Models; using Shentun.Peis.Models;
using Shentun.Peis.PatientRegisters;
using Shentun.Peis.SampleTypes; using Shentun.Peis.SampleTypes;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -78,6 +79,9 @@ namespace Shentun.Peis.PeisReports
var query = from a in await _patientRegisterRepository.GetQueryableAsync() var query = from a in await _patientRegisterRepository.GetQueryableAsync()
join b in await _patientRepository.GetQueryableAsync() on a.PatientId equals b.Id into bb join b in await _patientRepository.GetQueryableAsync() on a.PatientId equals b.Id into bb
from ab in bb.DefaultIfEmpty() from ab in bb.DefaultIfEmpty()
join registerCheck in await _registerCheckRepository.GetQueryableAsync() on a.Id equals registerCheck.PatientRegisterId
join registerAsbitem in await _registerAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerAsbitem.RegisterCheckId
join asbitem in await _asbitemRepository.GetQueryableAsync() on registerAsbitem.AsbitemId equals asbitem.Id
join c in await _customerOrgGroupRepository.GetQueryableAsync() on a.CustomerOrgGroupId equals c.Id into cc join c in await _customerOrgGroupRepository.GetQueryableAsync() on a.CustomerOrgGroupId equals c.Id into cc
from ac in cc.DefaultIfEmpty() from ac in cc.DefaultIfEmpty()
join d in await _medicalPackageRepository.GetQueryableAsync() on a.MedicalPackageId equals d.Id into dd join d in await _medicalPackageRepository.GetQueryableAsync() on a.MedicalPackageId equals d.Id into dd
@ -111,6 +115,8 @@ namespace Shentun.Peis.PeisReports
a.PersonnelTypeId, a.PersonnelTypeId,
a.IsUpload a.IsUpload
}, },
RegisterCheckCompleteFlag = registerCheck.CompleteFlag,
IsCheck = asbitem.IsCheck,
ab = new { ab.IdNo, ab.Address, ab.PatientNo, ab.MobileTelephone, ab.Telephone, ab.Email, ab.DisplayName }, ab = new { ab.IdNo, ab.Address, ab.PatientNo, ab.MobileTelephone, ab.Telephone, ab.Email, ab.DisplayName },
ac = new { ac.DisplayName }, ac = new { ac.DisplayName },
ad = new { ad.DisplayName }, ad = new { ad.DisplayName },
@ -225,7 +231,7 @@ namespace Shentun.Peis.PeisReports
sumquery = sumquery.Where(m => m.ab.MobileTelephone == input.phone || m.ab.Telephone == input.phone); sumquery = sumquery.Where(m => m.ab.MobileTelephone == input.phone || m.ab.Telephone == input.phone);
} }
if (input.CompleteFlag != null)
if (input.CompleteFlag != null && input.CompleteFlag != PatientRegisterCompleteFlag.ItemCheckUnSumCheck)
{ {
sumquery = sumquery.Where(m => m.a.CompleteFlag == input.CompleteFlag); sumquery = sumquery.Where(m => m.a.CompleteFlag == input.CompleteFlag);
} }
@ -272,36 +278,70 @@ namespace Shentun.Peis.PeisReports
} }
int totalCount = sumquery.Count();
var sumqueryGroup = sumquery.ToList().GroupBy(g => g.a.Id);
List<GetPatientRegisterReportDto> entlist = new List<GetPatientRegisterReportDto>();
var entlist = sumquery.Select(s => new GetPatientRegisterReportDto
foreach (var s in sumqueryGroup.OrderBy(o => o.Key))
{ {
Address = s.ab.Address,
PatientName = s.a.PatientName,
Age = s.a.Age,
BirthDate = DataHelper.ConversionDateToString(s.a.BirthDate),
CompleteFlag = s.a.CompleteFlag,
CustomerOrgGroupName = s.ac.DisplayName,
bool IsDisplay = false;
if (input.CompleteFlag == PatientRegisterCompleteFlag.ItemCheckUnSumCheck)
{
if (s.Where(m => m.RegisterCheckCompleteFlag != RegisterCheckCompleteFlag.Checked && m.IsCheck == 'Y').Count() == 0
&& s.FirstOrDefault().a.CompleteFlag != PatientRegisterCompleteFlag.SumCheck)
{
IsDisplay = true;
}
else
{
IsDisplay = false;
}
}
else
{
IsDisplay = true;
}
if (IsDisplay)
{
entlist.Add(new GetPatientRegisterReportDto
{
Address = s.FirstOrDefault().ab.Address,
PatientName = s.FirstOrDefault().a.PatientName,
Age = s.FirstOrDefault().a.Age,
BirthDate = DataHelper.ConversionDateToString(s.FirstOrDefault().a.BirthDate),
CompleteFlag = s.FirstOrDefault().a.CompleteFlag,
CustomerOrgGroupName = s.FirstOrDefault().ac.DisplayName,
//CustomerOrgName = _cacheService.GetTopCustomerOrgAsync(s.a.CustomerOrgId).Result.DisplayName, //CustomerOrgName = _cacheService.GetTopCustomerOrgAsync(s.a.CustomerOrgId).Result.DisplayName,
CustomerOrgName = _cacheService.GetTopCustomerOrgNameAsync(s.a.CustomerOrgId).Result,
DepartmentName = _cacheService.GetCustomerOrgNameAsync(s.a.CustomerOrgId).Result,
Email = s.ab.Email,
IdNo = s.ab.IdNo,
IsAudit = s.a.IsAudit,
IsReportPrint = s.a.ReportPrintTimes > 0 ? 'Y' : 'N',
MedicalPackageName = s.ad.DisplayName,
MedicalTypeName = s.ae.DisplayName,
MobileTelephone = s.ab.MobileTelephone,
PatientNo = s.ab.PatientNo,
PatientRegisterNo = s.a.PatientRegisterNo,
PersonnelTypeName = s.af.DisplayName,
SexName = s.ag.DisplayName,
Telephone = s.ab.Telephone,
PatientRegisterId = s.a.Id
}).Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToList();
return new PagedResultDto<GetPatientRegisterReportDto>(totalCount, entlist); ;
CustomerOrgName = _cacheService.GetTopCustomerOrgNameAsync(s.FirstOrDefault().a.CustomerOrgId).Result,
DepartmentName = _cacheService.GetCustomerOrgNameAsync(s.FirstOrDefault().a.CustomerOrgId).Result,
Email = s.FirstOrDefault().ab.Email,
IdNo = s.FirstOrDefault().ab.IdNo,
IsAudit = s.FirstOrDefault().a.IsAudit,
IsReportPrint = s.FirstOrDefault().a.ReportPrintTimes > 0 ? 'Y' : 'N',
MedicalPackageName = s.FirstOrDefault().ad.DisplayName,
MedicalTypeName = s.FirstOrDefault().ae.DisplayName,
MobileTelephone = s.FirstOrDefault().ab.MobileTelephone,
PatientNo = s.FirstOrDefault().ab.PatientNo,
PatientRegisterNo = s.FirstOrDefault().a.PatientRegisterNo,
PersonnelTypeName = s.FirstOrDefault().af.DisplayName,
SexName = s.FirstOrDefault().ag.DisplayName,
Telephone = s.FirstOrDefault().ab.Telephone,
PatientRegisterId = s.FirstOrDefault().a.Id
});
}
}
int totalCount = entlist.Count;
entlist = entlist.Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToList();
return new PagedResultDto<GetPatientRegisterReportDto>(totalCount, entlist);
} }

6
src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs

@ -81,9 +81,13 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces
throw new UserFriendlyException($"请求参数错误"); throw new UserFriendlyException($"请求参数错误");
} }
if(!input.PatientRegisterNos.Any())
throw new UserFriendlyException($"体检编号不能为空");
var result = new BasicInformationOfMedicalExaminationPersonnelDto(); var result = new BasicInformationOfMedicalExaminationPersonnelDto();
var patientRegisterEnt = (await _patientRegisterRepository.GetQueryableAsync()).Include(x => x.Patient).FirstOrDefault(m => m.PatientRegisterNo == input.PatientRegisterNo);
var patientRegisterEnt = (await _patientRegisterRepository.GetQueryableAsync()).Include(x => x.Patient)
.FirstOrDefault(m => input.PatientRegisterNos.Contains(m.PatientRegisterNo)
&& m.CompleteFlag == PatientRegisterCompleteFlag.SumCheck);
if (patientRegisterEnt != null) if (patientRegisterEnt != null)
{ {
//基础信息 //基础信息

Loading…
Cancel
Save