diff --git a/src/Shentun.Peis.Application.Contracts/PatientRegisters/GetListInSearchDto.cs b/src/Shentun.Peis.Application.Contracts/PatientRegisters/GetListInSearchDto.cs index 11bd572..adc9318 100644 --- a/src/Shentun.Peis.Application.Contracts/PatientRegisters/GetListInSearchDto.cs +++ b/src/Shentun.Peis.Application.Contracts/PatientRegisters/GetListInSearchDto.cs @@ -55,6 +55,11 @@ namespace Shentun.Peis.PatientRegisters /// public string? EndDate { get; set; } + /// + /// 日期类型(1、登记日期 2、体检日期 ) 默认登记日期 + /// + public char DateType { get; set; } = '1'; + /// /// 完成状态 /// @@ -75,7 +80,7 @@ namespace Shentun.Peis.PatientRegisters public int MaxResultCount { get; set; } = 50; public int SkipCount { get; set; } = 0; - + } } diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs index 5af69e0..5d49cd0 100644 --- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs @@ -447,9 +447,26 @@ namespace Shentun.Peis.PatientRegisters entlist = entlist.Where(m => m.patientRegister.SexId == input.SexId); if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate)) - entlist = entlist.Where(m => m.patientRegister.CreationTime >= Convert.ToDateTime(input.StartDate) && - m.patientRegister.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); - + { + if (input.DateType == '1') + { + entlist = entlist.Where(m => m.patientRegister.CreationTime >= Convert.ToDateTime(input.StartDate) && + m.patientRegister.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + else if (input.DateType == '2') + { + entlist = entlist.Where(m => m.patientRegister.MedicalStartDate >= Convert.ToDateTime(input.StartDate) && + m.patientRegister.MedicalStartDate < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + else + { + entlist = entlist.Where(m => (m.patientRegister.CreationTime >= Convert.ToDateTime(input.StartDate) && + m.patientRegister.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)) + || (m.patientRegister.MedicalStartDate >= Convert.ToDateTime(input.StartDate) && + m.patientRegister.MedicalStartDate < Convert.ToDateTime(input.EndDate).AddDays(1)) + ); + } + } if (input.CompleteFlag != null) { entlist = entlist.Where(m => m.patientRegister.CompleteFlag == input.CompleteFlag);