From bcca711d65c6b58acbcf90df5e4988908a9a41af Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Thu, 16 May 2024 22:08:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=93=E6=A3=80=E6=8A=A5=E5=91=8A=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PublicPatientRegisterNoInputDto.cs | 2 +- .../PatientRegisterAppService.cs | 3 +- .../PeisReports/PeisReportAppService.cs | 94 +++++++++++++------ .../ThirdPartyPublicInterfaceAppService.cs | 6 +- 4 files changed, 74 insertions(+), 31 deletions(-) diff --git a/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs b/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs index 2d11bd7..d1a5836 100644 --- a/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs @@ -9,6 +9,6 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces /// /// 体检人员条码号 /// - public string PatientRegisterNo { get; set; } + public List PatientRegisterNos { get; set; } } } diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index 68cb89f..e5fbe1a 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -1751,8 +1751,7 @@ namespace Shentun.Peis.PatientRegisters 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); } diff --git a/src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs b/src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs index 3eda614..6014d49 100644 --- a/src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs +++ b/src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs @@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore; using Shentun.Peis.CustomerOrgs; using Shentun.Peis.Enums; using Shentun.Peis.Models; +using Shentun.Peis.PatientRegisters; using Shentun.Peis.SampleTypes; using System; using System.Collections.Generic; @@ -78,6 +79,9 @@ namespace Shentun.Peis.PeisReports var query = from a in await _patientRegisterRepository.GetQueryableAsync() join b in await _patientRepository.GetQueryableAsync() on a.PatientId equals b.Id into bb 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 from ac in cc.DefaultIfEmpty() 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.IsUpload }, + RegisterCheckCompleteFlag = registerCheck.CompleteFlag, + IsCheck = asbitem.IsCheck, ab = new { ab.IdNo, ab.Address, ab.PatientNo, ab.MobileTelephone, ab.Telephone, ab.Email, ab.DisplayName }, ac = new { ac.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); } - if (input.CompleteFlag != null) + if (input.CompleteFlag != null && input.CompleteFlag != PatientRegisterCompleteFlag.ItemCheckUnSumCheck) { 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); + - var entlist = sumquery.Select(s => new GetPatientRegisterReportDto + List entlist = new List(); + + 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, - //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(totalCount, entlist); ; + 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.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(totalCount, entlist); } diff --git a/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs b/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs index ccecf4d..2daa6f1 100644 --- a/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs +++ b/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs @@ -81,9 +81,13 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces throw new UserFriendlyException($"请求参数错误"); } + if(!input.PatientRegisterNos.Any()) + throw new UserFriendlyException($"体检编号不能为空"); 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) { //基础信息