增加课题组标签 相关接口
parent
1fc70b1340
commit
f4f94f1f48
|
|
@ -13696,6 +13696,32 @@
|
|||
<param name="inQuery"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.HospitalGroupService.AddOrUpdateHospitalGroupTag(IRaCIS.Core.Application.ViewModel.HospitalGroupTagAddOrEdit)">
|
||||
<summary>
|
||||
添加编辑 课题组标签
|
||||
</summary>
|
||||
<param name="addOrEditHospitalGroupTag"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.HospitalGroupService.DeleteHospitalGroupTag(System.Guid)">
|
||||
<summary>
|
||||
删除课题组标签
|
||||
</summary>
|
||||
<param name="hospitalGroupTagId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.HospitalGroupService.AddPatientHospitalGroupTag(IRaCIS.Core.Application.ViewModel.AddOrDeletePatientHospitalGroupTag)">
|
||||
<summary>
|
||||
给 患者添加 或者删除 课题组标签 1是添加 2 是删除
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.HospitalGroupService.GetHospitalGroupTagList">
|
||||
<summary>
|
||||
获取当前登录用户课题组标签下拉框
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Service.SubjectService.AddOrUpdateSubject(IRaCIS.Application.Contracts.SubjectCommand)">
|
||||
<summary>
|
||||
添加或更新受试者信息[New]
|
||||
|
|
|
|||
|
|
@ -84,4 +84,32 @@ public class HospitalGroupAdminUserInfo
|
|||
|
||||
|
||||
|
||||
public class HospitalGroupTagAddOrEdit
|
||||
{
|
||||
public Guid HospitalGroupId { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class AddOrDeletePatientHospitalGroupTag
|
||||
{
|
||||
|
||||
public int AddOrDelete { get; set; }
|
||||
|
||||
public Guid PatientId { get; set; }
|
||||
|
||||
public Guid HospitalGroupTagId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class HospitalGroupAndTagSelectView
|
||||
{
|
||||
public Guid HospitalGroupTagId { get; set; }
|
||||
|
||||
public Guid HospitalGroupId { get; set; }
|
||||
|
||||
public string HospitalGroupName { get; set; }
|
||||
|
||||
public string HospitalGroupTagName { get; set; }
|
||||
}
|
||||
|
|
@ -267,6 +267,9 @@ namespace IRaCIS.Application.Contracts
|
|||
public DateTime? BeginPushTime { get; set; }
|
||||
public DateTime? EndPushTime { get; set; }
|
||||
|
||||
|
||||
public List<Guid> PatientHospitalGroupTagIdList { get; set; } = new List<Guid>();
|
||||
|
||||
}
|
||||
|
||||
public class PatientTrialView : PatientQueryView
|
||||
|
|
@ -282,6 +285,17 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public List<string> ViewHospitalGroupList => StudyHospitalGroupList.Intersect(CurrentUserHospitalGroupList).ToList();
|
||||
|
||||
public List<PatientTagView> PatientHospitalGroupTagList { get; set; } = new List<PatientTagView>();
|
||||
|
||||
public List<PatientTagView> ViewPatientHospitalGroupTagList => PatientHospitalGroupTagList.Where(t => CurrentUserHospitalGroupList.Contains(t.HospitalGroupName)).ToList();
|
||||
|
||||
}
|
||||
|
||||
public class PatientTagView
|
||||
{
|
||||
public string HospitalGroupName { get; set; }
|
||||
|
||||
public string HospitalGroupTagName { get; set; }
|
||||
}
|
||||
|
||||
public class PatientTrialStatInfo
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ using IRaCIS.Application.Contracts;
|
|||
namespace IRaCIS.Core.Application.Service;
|
||||
|
||||
[ApiExplorerSettings(GroupName = "HIR")]
|
||||
public class HospitalGroupService(IRepository<HospitalGroup> _hospitalGroupRepository,
|
||||
public class HospitalGroupService(IRepository<HospitalGroup> _hospitalGroupRepository, IRepository<HospitalGroupTag> _hospitalGroupTagRepository,
|
||||
IRepository<PatientHospitalGroupTag> _patientHospitalGroupTagRepository,
|
||||
IRepository<IdentityUser> _identityUserRepository, IRepository<HospitalGroupIdentityUser> _hospitalGroupIdentityUserRepository,
|
||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IHospitalGroupService
|
||||
{
|
||||
|
|
@ -151,6 +152,105 @@ public class HospitalGroupService(IRepository<HospitalGroup> _hospitalGroupRepos
|
|||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#region 课题组标签
|
||||
|
||||
/// <summary>
|
||||
/// 添加编辑 课题组标签
|
||||
/// </summary>
|
||||
/// <param name="addOrEditHospitalGroupTag"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> AddOrUpdateHospitalGroupTag(HospitalGroupTagAddOrEdit addOrEditHospitalGroupTag)
|
||||
{
|
||||
var verifyExp1 = new EntityVerifyExp<HospitalGroupTag>()
|
||||
{
|
||||
VerifyExp = u => u.Name == addOrEditHospitalGroupTag.Name,
|
||||
VerifyMsg = _localizer["HospitalGroup_DuplicateTagName"]
|
||||
};
|
||||
|
||||
var entity = await _hospitalGroupTagRepository.InsertOrUpdateAsync(addOrEditHospitalGroupTag, true, verifyExp1);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除课题组标签
|
||||
/// </summary>
|
||||
/// <param name="hospitalGroupTagId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{hospitalGroupTagId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteHospitalGroupTag(Guid hospitalGroupTagId)
|
||||
{
|
||||
if (_patientHospitalGroupTagRepository.Any(t => t.HospitalGroupTagId == hospitalGroupTagId))
|
||||
{
|
||||
return ResponseOutput.NotOk(_localizer["HospitalGroup_PatientHaveBindTag"]);
|
||||
}
|
||||
|
||||
var success = await _hospitalGroupTagRepository.DeleteFromQueryAsync(t => t.Id == hospitalGroupTagId);
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给 患者添加 或者删除 课题组标签 1是添加 2 是删除
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> AddPatientHospitalGroupTag(AddOrDeletePatientHospitalGroupTag inCommand)
|
||||
{
|
||||
|
||||
if (inCommand.AddOrDelete == 1)
|
||||
{
|
||||
if (!_patientHospitalGroupTagRepository.Any(t => t.HospitalGroupTagId == inCommand.HospitalGroupTagId))
|
||||
{
|
||||
await _patientHospitalGroupTagRepository.InsertFromDTOAsync(inCommand);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await _patientHospitalGroupTagRepository.DeleteFromQueryAsync(t => t.PatientId == inCommand.PatientId && t.HospitalGroupTagId == inCommand.HospitalGroupTagId);
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前登录用户课题组标签下拉框
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<HospitalGroupAndTagSelectView> GetHospitalGroupTagList()
|
||||
{
|
||||
var currentUserHospitalGroupIdList = new List<Guid>();
|
||||
|
||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
||||
{
|
||||
currentUserHospitalGroupIdList = _identityUserRepository.Where(t => t.Id == _userInfo.IdentityUserId).SelectMany(t => t.IdentityUserHospitalGroupList)
|
||||
.Where(t => t.IsDisabled == false && t.HospitalGroup.IsEnable).Select(t => t.HospitalGroupId).ToList();
|
||||
}
|
||||
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.GA)
|
||||
{
|
||||
currentUserHospitalGroupIdList = _identityUserRepository.Where(t => t.Id == _userInfo.IdentityUserId).SelectMany(t => t.IdentityUserHospitalGroupList)
|
||||
.Where(t => t.IsDisabled == false && t.HospitalGroup.IsEnable && t.IsManager).Select(t => t.HospitalGroupId).ToList();
|
||||
}
|
||||
|
||||
|
||||
var list = _hospitalGroupTagRepository.Where(t => currentUserHospitalGroupIdList.Contains(t.HospitalGroupId))
|
||||
.Select(t => new HospitalGroupAndTagSelectView()
|
||||
{
|
||||
HospitalGroupId = t.HospitalGroupId,
|
||||
HospitalGroupName = t.HospitalGroup.Name,
|
||||
HospitalGroupTagId = t.HospitalGroupId,
|
||||
HospitalGroupTagName = t.Name
|
||||
}).OrderBy(t => t.HospitalGroupName).ThenBy(t => t.HospitalGroupTagName).ToList();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -644,6 +644,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
#region new ok
|
||||
var query = _patientRepository.Where(t => isAdminOrOA ? true : t.SCPStudyList.Any(c => c.HospitalGroupList.Any(c => currentUserHospitalGroupIdList.Contains(c.HospitalGroupId))))
|
||||
.WhereIf(inQuery.PatientHospitalGroupTagIdList.Any(), t => t.PatientHospitalGroupTagList.Any(k => inQuery.PatientHospitalGroupTagIdList.Contains(k.HospitalGroupTagId)))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.PatientIdStr), t => t.PatientIdStr.Contains(inQuery.PatientIdStr))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.PatientName), t => t.PatientName.Contains(inQuery.PatientName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.ExperimentName), t => t.SubjectPatientList.Any(t => t.Subject.Trial.ExperimentName.Contains(inQuery.ExperimentName)))
|
||||
|
|
@ -686,7 +687,10 @@ namespace IRaCIS.Application.Services
|
|||
VisitCount = c.Subject.SubjectVisitList.Count()
|
||||
}).ToList(),
|
||||
|
||||
StudyHospitalGroupList = patient.SCPStudyList.SelectMany(t => t.HospitalGroupList).Select(t => t.HospitalGroup.Name).Distinct().ToList()
|
||||
StudyHospitalGroupList = patient.SCPStudyList.SelectMany(t => t.HospitalGroupList).Select(t => t.HospitalGroup.Name).Distinct().ToList(),
|
||||
|
||||
PatientHospitalGroupTagList = patient.PatientHospitalGroupTagList
|
||||
.Select(t => new PatientTagView() { HospitalGroupName = t.HospitalGroupTag.HospitalGroup.Name, HospitalGroupTagName = t.HospitalGroupTag.Name }).ToList()
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -222,9 +222,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
.ForMember(d => d.IsGACurrentHospitalDisabled, u => u.MapFrom(s => s.IdentityUserHospitalGroupList.Any(t => t.IsDisabled && t.HospitalGroupId == hostpitalGroupId)));
|
||||
|
||||
|
||||
CreateMap<HospitalGroupTag, HospitalGroupTagAddOrEdit>().ReverseMap();
|
||||
|
||||
|
||||
|
||||
CreateMap<AddOrDeletePatientHospitalGroupTag, PatientHospitalGroupTag>();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,13 @@
|
|||
public class SCPPatient : BaseFullAuditEntity
|
||||
{
|
||||
#region 导航属性
|
||||
|
||||
[JsonIgnore]
|
||||
public List<SubjectPatient> SubjectPatientList { get; set; }
|
||||
[JsonIgnore]
|
||||
public List<SCPStudy> SCPStudyList { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public List<PatientHospitalGroupTag> PatientHospitalGroupTagList { get; set; }
|
||||
//[JsonIgnore]
|
||||
//public Subject Subject { get; set; }
|
||||
//[JsonIgnore]
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public Guid HospitalGroupId { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public int ShowOrder { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
19191
IRaCIS.Core.Infra.EFCore/Migrations/20250910035014_addorderbak.Designer.cs
generated
Normal file
19191
IRaCIS.Core.Infra.EFCore/Migrations/20250910035014_addorderbak.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,29 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addorderbak : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ShowOrder",
|
||||
table: "HospitalGroupTag",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ShowOrder",
|
||||
table: "HospitalGroupTag");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2992,6 +2992,9 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<int>("ShowOrder")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
|
|
@ -15514,7 +15517,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.SCPPatient", "Patient")
|
||||
.WithMany()
|
||||
.WithMany("PatientHospitalGroupTagList")
|
||||
.HasForeignKey("PatientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
|
@ -18921,6 +18924,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.SCPPatient", b =>
|
||||
{
|
||||
b.Navigation("PatientHospitalGroupTagList");
|
||||
|
||||
b.Navigation("SCPStudyList");
|
||||
|
||||
b.Navigation("SubjectPatientList");
|
||||
|
|
|
|||
Loading…
Reference in New Issue