项目绑定医院,防止演示切换医院

Test_HIR_Net8
hang 2025-08-20 13:25:21 +08:00
parent c479574905
commit 77444e35fa
5 changed files with 18863 additions and 0 deletions

View File

@ -53,6 +53,7 @@ using System.Dynamic;
using System.Threading.Channels;
using NPOI.HSSF.Record.Chart;
using IRaCIS.Core.Application.Helper.OtherTool;
using IRaCIS.Core.Infrastructure.Extention;
namespace IRaCIS.Application.Services
@ -195,6 +196,8 @@ namespace IRaCIS.Application.Services
[HttpPost]
public async Task<IResponseOutput<PageOutput<NewTrialView>>> GetTrialList(NewTrialQuery inQuery)
{
var hospitalInfo = await _fusionCache.GetOrSetAsync(CacheKeys.Hospital, _ => CacheHelper.GetHospitalCode(_hIRHospitalRepository), TimeSpan.FromDays(7));
var trialQuery = _trialRepository
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.ResearchProgramNo), t => t.ResearchProgramNo.Contains(inQuery.ResearchProgramNo))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), t => t.ExperimentName.Contains(inQuery.ExperimentName))
@ -202,6 +205,8 @@ namespace IRaCIS.Application.Services
.WhereIf(inQuery.TrialType != null, t => t.TrialType == inQuery.TrialType)
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.TrialCode), t => t.TrialCode.Contains(inQuery.TrialCode))
//过滤医院,切换会有问题
.Where(t => t.HospitalId == hospitalInfo.Id)
//GA 要过滤课题组
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.GA, t => _userInfo.HospitalGroupIdList.Contains(t.HospitalGroupId))
.WhereIf(_userInfo.UserTypeEnumInt != (int)UserTypeEnum.SuperAdmin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.Admin && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.OA && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.GA

View File

@ -307,6 +307,8 @@ public partial class Trial : BaseFullDeleteAuditEntity
public Guid HospitalGroupId { get; set; }
public Guid HospitalId { get; set; }
#endregion
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class addHospitalId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "HospitalId",
table: "Trial",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "HospitalId",
table: "Trial");
}
}
}

View File

@ -10751,6 +10751,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<Guid>("HospitalGroupId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("HospitalId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Indication")
.IsRequired()
.HasMaxLength(400)