Browse Source

体检查询

bjmzak
wxd 2 years ago
parent
commit
fd33900e9d
  1. 52
      src/Shentun.Peis.Application/PeisReports/PeisReportAppService.cs
  2. 13785
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240420092428_init20240420003.Designer.cs
  3. 158
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240420092428_init20240420003.cs
  4. 51
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

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

@ -34,6 +34,7 @@ namespace Shentun.Peis.PeisReports
private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository;
private readonly IRepository<Asbitem, Guid> _asbitemRepository;
private readonly CustomerOrgManager _customerOrgManager;
private readonly CacheService _cacheService;
public PeisReportAppService(
IRepository<PatientRegister, Guid> patientRegisterRepository,
@ -47,8 +48,8 @@ namespace Shentun.Peis.PeisReports
IRepository<RegisterCheckAsbitem, Guid> registerAsbitemRepository,
IRepository<RegisterCheck, Guid> registerCheckRepository,
IRepository<Asbitem, Guid> asbitemRepository,
CustomerOrgManager customerOrgManager
)
CustomerOrgManager customerOrgManager,
CacheService cacheService)
{
this._patientRegisterRepository = patientRegisterRepository;
this._patientRepository = patientRepository;
@ -62,6 +63,7 @@ namespace Shentun.Peis.PeisReports
this._registerCheckRepository = registerCheckRepository;
this._asbitemRepository = asbitemRepository;
this._customerOrgManager = customerOrgManager;
this._cacheService = cacheService;
}
@ -72,9 +74,6 @@ namespace Shentun.Peis.PeisReports
[HttpPost("api/app/peisreport/getpatientregisterreport")]
public async Task<List<GetPatientRegisterReportDto>> GetPatientRegisterReportAsync(GetPatientRegisterReportRequestDto input)
{
var customerOrgList = await _customerOrgRepository.GetListAsync();
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()
@ -121,7 +120,7 @@ namespace Shentun.Peis.PeisReports
var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(item.CustomerOrgId.Value);
sumquery = sumquery.Where(m => CustomerOrgIds.Contains(m.a.CustomerOrgId));
}
if ( !string.IsNullOrEmpty(item.StartDate) && !string.IsNullOrEmpty(item.EndDate))
if (!string.IsNullOrEmpty(item.StartDate) && !string.IsNullOrEmpty(item.EndDate))
{
if (item.DateType == '1')
{
@ -161,7 +160,7 @@ namespace Shentun.Peis.PeisReports
var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(item2.CustomerOrgId.Value);
newquery = newquery.Where(m => CustomerOrgIds.Contains(m.a.CustomerOrgId));
}
if ( !string.IsNullOrEmpty(item2.StartDate) && !string.IsNullOrEmpty(item2.EndDate))
if (!string.IsNullOrEmpty(item2.StartDate) && !string.IsNullOrEmpty(item2.EndDate))
{
if (item2.DateType == '1')
{
@ -223,7 +222,7 @@ namespace Shentun.Peis.PeisReports
}
else
{
sumquery = sumquery.Where(m => m.a.ReportPrintTimes == null || m.a.ReportPrintTimes == 0);
sumquery = sumquery.Where(m => m.a.ReportPrintTimes == 0);
}
}
@ -248,10 +247,6 @@ namespace Shentun.Peis.PeisReports
}
//var s4 = sumquery.ToQueryString();
var entlist = sumquery.Select(s => new GetPatientRegisterReportDto
{
Address = s.ab.Address,
@ -260,8 +255,8 @@ namespace Shentun.Peis.PeisReports
BirthDate = DataHelper.ConversionDateToString(s.a.BirthDate),
CompleteFlag = s.a.CompleteFlag,
CustomerOrgGroupName = s.ac.DisplayName,
CustomerOrgName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgList, s.a.CustomerOrgId),
DepartmentName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgList, s.a.CustomerOrgId),
CustomerOrgName = _cacheService.GetTopCustomerOrgAsync(s.a.CustomerOrgId).Result.DisplayName,
DepartmentName = _cacheService.GetCustomerOrgNameAsync(s.a.CustomerOrgId).Result,
Email = s.ab.Email,
IdNo = s.ab.IdNo,
IsAudit = s.a.IsAudit,
@ -288,9 +283,6 @@ namespace Shentun.Peis.PeisReports
[HttpPost("api/app/peisreport/getregisterasbitemregistercheckstatus")]
public async Task<List<GetRegisterAsbitemRegisterCheckStatusDto>> GetRegisterAsbitemRegisterCheckStatusAsync(GetRegisterAsbitemRegisterCheckStatusRequestDto input)
{
var customerOrgList = await _customerOrgRepository.GetListAsync();
var query = from j in await _registerAsbitemRepository.GetQueryableAsync()
join k in await _registerCheckRepository.GetQueryableAsync() on j.RegisterCheckId equals k.Id into kk
from jk in kk.DefaultIfEmpty()
@ -385,7 +377,7 @@ namespace Shentun.Peis.PeisReports
var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(item2.CustomerOrgId.Value);
newquery = newquery.Where(m => CustomerOrgIds.Contains(m.a.CustomerOrgId));
}
if ( !string.IsNullOrEmpty(item2.StartDate) && !string.IsNullOrEmpty(item2.EndDate))
if (!string.IsNullOrEmpty(item2.StartDate) && !string.IsNullOrEmpty(item2.EndDate))
{
if (item2.DateType == '1')
{
@ -430,8 +422,8 @@ namespace Shentun.Peis.PeisReports
Age = s.a.Age,
CompleteFlag = s.jk.CompleteFlag,
CustomerOrgGroupName = s.ac.DisplayName,
CustomerOrgName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgList, s.a.CustomerOrgId),
DepartmentName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgList, s.a.CustomerOrgId),
CustomerOrgName = _cacheService.GetTopCustomerOrgAsync(s.a.CustomerOrgId).Result.DisplayName,
DepartmentName = _cacheService.GetCustomerOrgNameAsync(s.a.CustomerOrgId).Result,
MedicalPackageName = s.ad.DisplayName,
MobileTelephone = s.ab.MobileTelephone,
PatientNo = s.ab.PatientNo,
@ -458,9 +450,7 @@ namespace Shentun.Peis.PeisReports
[HttpPost("api/app/peisreport/getregisterasbitemchargestatus")]
public async Task<List<GetRegisterAsbitemChargeStatusDto>> GetRegisterAsbitemChargeStatusAsync(GetRegisterAsbitemChargeStatusRequestDto input)
{
var customerOrgList = await _customerOrgRepository.GetListAsync();
var query = from j in await _registerAsbitemRepository.GetQueryableAsync()
join k in await _registerCheckRepository.GetQueryableAsync() on j.RegisterCheckId equals k.Id into kk
from jk in kk.DefaultIfEmpty()
@ -515,7 +505,7 @@ namespace Shentun.Peis.PeisReports
var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(item.CustomerOrgId.Value);
sumquery = sumquery.Where(m => CustomerOrgIds.Contains(m.a.CustomerOrgId));
}
if ( !string.IsNullOrEmpty(item.StartDate) && !string.IsNullOrEmpty(item.EndDate))
if (!string.IsNullOrEmpty(item.StartDate) && !string.IsNullOrEmpty(item.EndDate))
{
if (item.DateType == '1')
{
@ -555,7 +545,7 @@ namespace Shentun.Peis.PeisReports
var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(item2.CustomerOrgId.Value);
newquery = newquery.Where(m => CustomerOrgIds.Contains(m.a.CustomerOrgId));
}
if ( !string.IsNullOrEmpty(item2.StartDate) && !string.IsNullOrEmpty(item2.EndDate))
if (!string.IsNullOrEmpty(item2.StartDate) && !string.IsNullOrEmpty(item2.EndDate))
{
if (item2.DateType == '1')
{
@ -598,8 +588,8 @@ namespace Shentun.Peis.PeisReports
Age = s.a.Age,
CompleteFlag = s.jk.CompleteFlag,
CustomerOrgGroupName = s.ac.DisplayName,
CustomerOrgName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgList, s.a.CustomerOrgId),
DepartmentName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgList, s.a.CustomerOrgId),
CustomerOrgName = _cacheService.GetTopCustomerOrgAsync(s.a.CustomerOrgId).Result.DisplayName,
DepartmentName = _cacheService.GetCustomerOrgNameAsync(s.a.CustomerOrgId).Result,
MedicalPackageName = s.ad.DisplayName,
MobileTelephone = s.ab.MobileTelephone,
PatientNo = s.ab.PatientNo,
@ -626,8 +616,6 @@ namespace Shentun.Peis.PeisReports
[HttpPost("api/app/peisreport/getpatientregisteruncheckedreport")]
public async Task<List<GetPatientRegisterUnCheckedReportDto>> GetPatientRegisterUnCheckedReportAsync(GetPatientRegisterUnCheckedReportRequestDto input)
{
var customerOrgList = await _customerOrgRepository.GetListAsync();
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()
@ -685,7 +673,7 @@ namespace Shentun.Peis.PeisReports
var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(item.CustomerOrgId.Value);
sumquery = sumquery.Where(m => CustomerOrgIds.Contains(m.a.CustomerOrgId));
}
if ( !string.IsNullOrEmpty(item.StartDate) && !string.IsNullOrEmpty(item.EndDate))
if (!string.IsNullOrEmpty(item.StartDate) && !string.IsNullOrEmpty(item.EndDate))
{
if (item.DateType == '1')
{
@ -770,8 +758,8 @@ namespace Shentun.Peis.PeisReports
{
Age = s.FirstOrDefault().a.Age,
CustomerOrgGroupName = s.FirstOrDefault().ac.DisplayName,
CustomerOrgName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgList, s.FirstOrDefault().a.CustomerOrgId),
DepartmentName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgList, s.FirstOrDefault().a.CustomerOrgId),
CustomerOrgName = _cacheService.GetTopCustomerOrgAsync(s.FirstOrDefault().a.CustomerOrgId).Result.DisplayName,
DepartmentName = _cacheService.GetCustomerOrgNameAsync(s.FirstOrDefault().a.CustomerOrgId).Result,
//GiveUpAsbitems = s.Where(m => m.ak.CompleteFlag == '2').Select(gs => new GetPatientRegisterUnCheckedReport_GiveUpAsbitem
//{
// AsbitemName = gs.al.DisplayName

13785
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240420092428_init20240420003.Designer.cs
File diff suppressed because it is too large
View File

158
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240420092428_init20240420003.cs

@ -0,0 +1,158 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class init20240420003 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_lis_request_sample_group",
table: "lis_request");
migrationBuilder.DropForeignKey(
name: "fk_sample_",
table: "sample_group");
migrationBuilder.DropIndex(
name: "IX_lis_request_sample_group_id",
table: "lis_request");
migrationBuilder.DropColumn(
name: "sample_group_id",
table: "lis_request");
migrationBuilder.DropColumn(
name: "sampler",
table: "lis_request");
migrationBuilder.AddColumn<Guid>(
name: "sample_container_id",
table: "lis_request",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
comment: "标本容器编号");
migrationBuilder.AddColumn<Guid>(
name: "sample_type_id",
table: "lis_request",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
comment: "标本类型");
migrationBuilder.AddColumn<Guid>(
name: "sampler_id",
table: "lis_request",
type: "uuid",
nullable: true,
comment: "采样人ID");
migrationBuilder.CreateIndex(
name: "IX_lis_request_sample_container_id",
table: "lis_request",
column: "sample_container_id");
migrationBuilder.CreateIndex(
name: "IX_lis_request_sample_type_id",
table: "lis_request",
column: "sample_type_id");
migrationBuilder.AddForeignKey(
name: "fk_lis_request_sample_container",
table: "lis_request",
column: "sample_container_id",
principalTable: "sample_container",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_lis_request_sample_type",
table: "lis_request",
column: "sample_type_id",
principalTable: "sample_type",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_sample_group_sample_container",
table: "sample_group",
column: "sample_container_id",
principalTable: "sample_container",
principalColumn: "id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_lis_request_sample_container",
table: "lis_request");
migrationBuilder.DropForeignKey(
name: "fk_lis_request_sample_type",
table: "lis_request");
migrationBuilder.DropForeignKey(
name: "fk_sample_group_sample_container",
table: "sample_group");
migrationBuilder.DropIndex(
name: "IX_lis_request_sample_container_id",
table: "lis_request");
migrationBuilder.DropIndex(
name: "IX_lis_request_sample_type_id",
table: "lis_request");
migrationBuilder.DropColumn(
name: "sample_container_id",
table: "lis_request");
migrationBuilder.DropColumn(
name: "sample_type_id",
table: "lis_request");
migrationBuilder.DropColumn(
name: "sampler_id",
table: "lis_request");
migrationBuilder.AddColumn<Guid>(
name: "sample_group_id",
table: "lis_request",
type: "uuid",
fixedLength: true,
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
comment: "条码分组ID");
migrationBuilder.AddColumn<string>(
name: "sampler",
table: "lis_request",
type: "character varying(16)",
maxLength: 16,
nullable: true,
comment: "采样人姓名");
migrationBuilder.CreateIndex(
name: "IX_lis_request_sample_group_id",
table: "lis_request",
column: "sample_group_id");
migrationBuilder.AddForeignKey(
name: "fk_lis_request_sample_group",
table: "lis_request",
column: "sample_group_id",
principalTable: "sample_group",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "fk_sample_",
table: "sample_group",
column: "sample_container_id",
principalTable: "sample_container",
principalColumn: "id");
}
}
}

51
src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

@ -5075,17 +5075,20 @@ namespace Shentun.Peis.Migrations
.HasColumnName("lis_request_no")
.HasComment("检验申请单号");
b.Property<Guid>("SampleGroupId")
b.Property<Guid>("SampleContainerId")
.HasColumnType("uuid")
.HasColumnName("sample_group_id")
.IsFixedLength()
.HasComment("条码分组ID");
.HasColumnName("sample_container_id")
.HasComment("标本容器编号");
b.Property<string>("Sampler")
.HasMaxLength(16)
.HasColumnType("character varying(16)")
.HasColumnName("sampler")
.HasComment("采样人姓名");
b.Property<Guid>("SampleTypeId")
.HasColumnType("uuid")
.HasColumnName("sample_type_id")
.HasComment("标本类型");
b.Property<Guid?>("SamplerId")
.HasColumnType("uuid")
.HasColumnName("sampler_id")
.HasComment("采样人ID");
b.Property<DateTime?>("SamplingTime")
.HasColumnType("timestamp without time zone")
@ -5110,7 +5113,9 @@ namespace Shentun.Peis.Migrations
b.HasKey("Id");
b.HasIndex("SampleGroupId");
b.HasIndex("SampleContainerId");
b.HasIndex("SampleTypeId");
b.HasIndex(new[] { "LisRequestNo" }, "ix_lis_request")
.IsUnique();
@ -12582,13 +12587,23 @@ namespace Shentun.Peis.Migrations
modelBuilder.Entity("Shentun.Peis.Models.LisRequest", b =>
{
b.HasOne("Shentun.Peis.Models.SampleGroup", "SampleGroup")
b.HasOne("Shentun.Peis.Models.SampleContainer", "SampleContainer")
.WithMany("LisRequests")
.HasForeignKey("SampleGroupId")
.HasForeignKey("SampleContainerId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired()
.HasConstraintName("fk_lis_request_sample_group");
.HasConstraintName("fk_lis_request_sample_container");
b.Navigation("SampleGroup");
b.HasOne("Shentun.Peis.Models.SampleType", "SampleType")
.WithMany("LisRequests")
.HasForeignKey("SampleTypeId")
.OnDelete(DeleteBehavior.NoAction)
.IsRequired()
.HasConstraintName("fk_lis_request_sample_type");
b.Navigation("SampleContainer");
b.Navigation("SampleType");
});
modelBuilder.Entity("Shentun.Peis.Models.MedicalConclusion", b =>
@ -12938,7 +12953,7 @@ namespace Shentun.Peis.Migrations
.WithMany("SampleGroups")
.HasForeignKey("SampleContainerId")
.IsRequired()
.HasConstraintName("fk_sample_");
.HasConstraintName("fk_sample_group_sample_container");
b.HasOne("Shentun.Peis.Models.SampleType", "SampleType")
.WithMany("SampleGroups")
@ -13665,18 +13680,20 @@ namespace Shentun.Peis.Migrations
modelBuilder.Entity("Shentun.Peis.Models.SampleContainer", b =>
{
b.Navigation("LisRequests");
b.Navigation("SampleGroups");
});
modelBuilder.Entity("Shentun.Peis.Models.SampleGroup", b =>
{
b.Navigation("LisRequests");
b.Navigation("SampleGroupDetails");
});
modelBuilder.Entity("Shentun.Peis.Models.SampleType", b =>
{
b.Navigation("LisRequests");
b.Navigation("SampleGroups");
});

Loading…
Cancel
Save