HIR 管理端医院修改
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-03-21 10:15:31 +08:00
parent 5a99f476f9
commit 91b20e07f2
8 changed files with 138 additions and 46 deletions

View File

@ -17946,18 +17946,10 @@
<member name="M:IRaCIS.Application.Interfaces.ITrialEnrollmentService.ConfirmReviewer(System.Guid,System.Guid[],System.Int32)">
<summary>入组流程-向CRO提交医生[Submit]</summary>
</member>
<member name="M:IRaCIS.Application.Services.PatientService.GetHospitalInfo(Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Application.Contracts.SystemHospitalOption})">
<member name="M:IRaCIS.Application.Services.PatientService.GetHospitalInfo">
<summary>
获取医院的配置信息
</summary>
<param name="options"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Application.Services.PatientService.UpdateHospitalInfo(IRaCIS.Application.Contracts.SystemHospitalOption)">
<summary>
配置医院信息,方便测试邮件和授权码的方式
</summary>
<param name="systemHospitalOption"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Application.Services.PatientService.GetSystemConfirmedCreiterionList(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ReadingQuestionCriterionSystem})">

View File

@ -0,0 +1,51 @@
//--------------------------------------------------------------------
// 此代码由liquid模板自动生成 byzhouhang 20240909
// 生成时间 2025-03-21 01:28:34Z
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel;
public class HIRHospitalView : HIRHospitalAddOrEdit
{
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
}
public class HIRHospitalAddOrEdit
{
public string HospitalName { get; set; }
public string HospitalAliasName { get; set; }
public string Country { get; set; }
public string City { get; set; }
public string Province { get; set; }
public string Address { get; set; }
public string Phone { get; set; }
public bool IsCanConnectInternet { get; set; }
public string HospitalCode { get; set; }
public string HospitalLogoPath { get; set; }
public int TrialKeepCount { get; set; }
public bool IsDefault { get; set; }
}
public class HIRHospitalQuery : PageInput
{
public string HospitalName { get; set; }
public string Country { get; set; }
public string City { get; set; }
public string Province { get; set; }
public string Address { get; set; }
public string Phone { get; set; }
}

View File

@ -67,6 +67,7 @@ namespace IRaCIS.Application.Services
IRepository<SubejctVisitDownload> _subejctVisitDownloadRepository,
IRepository<SCPImageUpload> _SCPImageUploadRepository,
IRepository<User> _userRepository,
IRepository<HIRHospital> _hIRHospitalRepository,
ILogger<PatientService> _logger,
IDistributedLockProvider _distributedLockProvider, IMapper _mapper, IUserInfo _userInfo, IWebHostEnvironment _hostEnvironment, IStringLocalizer _localizer, IFusionCache _fusionCache
@ -81,46 +82,73 @@ namespace IRaCIS.Application.Services
/// <summary>
/// 获取医院的配置信息
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
[AllowAnonymous]
public async Task<SystemHospitalOption> GetHospitalInfo([FromServices] IOptionsMonitor<SystemHospitalOption> options)
public async Task<HIRHospitalView> GetHospitalInfo()
{
return options.CurrentValue;
var query = _hIRHospitalRepository.Where(t => t.IsDefault == true).ProjectTo<HIRHospitalView>(_mapper.ConfigurationProvider);
return await query.FirstNotNullAsync();
}
/// <summary>
/// 配置医院信息,方便测试邮件和授权码的方式
/// </summary>
/// <param name="systemHospitalOption"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> UpdateHospitalInfo(SystemHospitalOption systemHospitalOption)
[HttpPut]
public async Task<IResponseOutput> UpdateDefaultHospital(Guid hirHospitalId)
{
var path = $"appsettings.{_hostEnvironment.EnvironmentName}.json";
string text = System.IO.File.ReadAllText(path);
await _hIRHospitalRepository.BatchUpdateNoTrackingAsync(t => t.Id != hirHospitalId, u => new HIRHospital() { IsDefault = false });
// 修改
JObject obj = JObject.Parse(text);
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.HospitalName)] = systemHospitalOption.HospitalName;
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.HospitalAliasName)] = systemHospitalOption.HospitalAliasName;
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.Country)] = systemHospitalOption.Country;
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.City)] = systemHospitalOption.City;
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.Phone)] = systemHospitalOption.Phone;
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.Province)] = systemHospitalOption.Province;
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.Address)] = systemHospitalOption.Address;
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.IsCanConnectInternet)] = systemHospitalOption.IsCanConnectInternet;
await _hIRHospitalRepository.BatchUpdateNoTrackingAsync(t => t.Id == hirHospitalId, u => new HIRHospital() { IsDefault = true });
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.HospitalCode)] = systemHospitalOption.HospitalCode;
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.HospitalLogoPath)] = systemHospitalOption.HospitalLogoPath;
obj["SystemHospitalConfig"][nameof(SystemHospitalOption.TrialKeepCount)] = systemHospitalOption.TrialKeepCount;
return ResponseOutput.Ok();
}
// 重新写入appsettings.json
string result = obj.ToString();
System.IO.File.WriteAllText(path, result);
[HttpPost]
public async Task<PageOutput<HIRHospitalView>> GetHIRHospitalList(HIRHospitalQuery inQuery)
{
await _userRepository.BatchUpdateNoTrackingAsync(t => t.IsZhiZhun, t => new User() { OrganizationName = systemHospitalOption.HospitalName });
var hIRHospitalQueryable = _hIRHospitalRepository
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.HospitalName), t => t.HospitalName.Contains(inQuery.HospitalName) || t.HospitalAliasName.Contains(inQuery.HospitalName))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Country), t => t.Country.Contains(inQuery.Country))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.City), t => t.City.Contains(inQuery.Country))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Phone), t => t.Phone.Contains(inQuery.Phone))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Province), t => t.Province.Contains(inQuery.Province))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.Address), t => t.Address.Contains(inQuery.Address))
.ProjectTo<HIRHospitalView>(_mapper.ConfigurationProvider);
var list = await hIRHospitalQueryable.ToPagedListAsync(inQuery);
return list;
}
public async Task<IResponseOutput> AddOrUpdateHIRHospital(HIRHospitalAddOrEdit addOrEditHIRHospital)
{
var exp = new EntityVerifyExp<HIRHospital>()
{
VerifyExp = h => h.IsDefault.Equals(addOrEditHIRHospital.IsDefault),
VerifyMsg = "默认医院只允许一个"
};
var exp2 = new EntityVerifyExp<HIRHospital>()
{
VerifyExp = h => h.HospitalCode.Equals(addOrEditHIRHospital.HospitalCode),
VerifyMsg = "医院编码、名称不能重复"
};
var entity = await _hIRHospitalRepository.InsertOrUpdateAsync(addOrEditHIRHospital, true, exp, exp2);
return ResponseOutput.Ok(entity.Id.ToString());
}
[HttpDelete("{hIRHospitalId:guid}")]
public async Task<IResponseOutput> DeleteHIRHospital(Guid hIRHospitalId)
{
var success = await _hIRHospitalRepository.DeleteFromQueryAsync(t => t.Id == hIRHospitalId, true);
return ResponseOutput.Ok();
}
@ -3079,7 +3107,7 @@ namespace IRaCIS.Application.Services
{
t.Patient.PatientIdStr,
MaxStudyTime = t.Patient.SCPStudyList.Max(t => t.StudyTime),
VisitMaxSubmitTime=t.Subject.SubjectVisitList.Max(t=>t.SubmitTime)
VisitMaxSubmitTime = t.Subject.SubjectVisitList.Max(t => t.SubmitTime)
}).ToListAsync();
foreach (var patient in list)
@ -3110,9 +3138,9 @@ namespace IRaCIS.Application.Services
cloneInQuery.StudyDate = patient.MaxStudyTime?.ToString("yyyyMMdd") + "-";
cloneInQuery.StudyTime = patient.MaxStudyTime?.ToString("HHmmss") + "-";
}
}
var request = CreateStudyRequest(cloneInQuery, modality);
request.OnResponseReceived += responseDelegate;

View File

@ -195,9 +195,10 @@ namespace IRaCIS.Core.Application.Service
CreateMap<SCPSeries, PatientSeriesDTO>();
CreateMap<HIRHospital, HIRHospitalView>();
CreateMap<HIRHospital, HIRHospitalAddOrEdit>().ReverseMap();
}
}

View File

@ -26,3 +26,23 @@ public class Hospital : BaseFullAuditEntity
[Comment("中心Id")]
public Guid? SiteId { get; set; } = Guid.Empty;
}
public class HIRHospital : BaseFullAuditEntity
{
public string HospitalName { get; set; }
public string HospitalAliasName { get; set; }
public string Country { get; set; }
public string City { get; set; }
public string Province { get; set; }
public string Address { get; set; }
public string Phone { get; set; }
public bool IsCanConnectInternet { get; set; }
public string HospitalCode { get; set; }
public string HospitalLogoPath { get; set; }
public int TrialKeepCount { get; set; }
public bool IsDefault { get; set; }
}

View File

@ -62,7 +62,7 @@ public class {{TableName}}Service(IRepository<{{TableName}}> {{LowercaseReposito
[HttpDelete("{{ '{' }}{{LowercaseTableNameId}}:guid{{ '}' }}")]
public async Task<IResponseOutput> Delete{{TableName}}(Guid {{LowercaseTableNameId}})
{
var success = await _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.DeleteFromQueryAsync(t => t.Id == {{LowercaseTableNameId}},true);
var success = await {{LowercaseRepositoryName}}.DeleteFromQueryAsync(t => t.Id == {{LowercaseTableNameId}},true);
return ResponseOutput.Ok();
}

View File

@ -28,7 +28,7 @@ public class {{ TableNameAddOrEdit }}
{%- endfor -%}
}
public class {{ TableNameQuery }}
public class {{ TableNameQuery }}:PageInput
{
{%- for field in QueryListFieldList -%}
{% if field.IsNullable and field.IsCSharpString == false %}

View File

@ -13,13 +13,13 @@ namespace IRaCIS.Core.Application.Interfaces;
public interface I{{TableName}}Service
{
{% if IsPaged %}
Task<PageOutput<{{TableNameView}}> Get{{TableName}}List({{TableNameQuery}} inQuery);
Task<PageOutput<{{TableNameView}}>> Get{{TableName}}List({{TableNameQuery}} inQuery);
{% else %}
Task<List<{{TableNameView}}>> Get{{TableName}}List({{TableNameQuery}} inQuery);
{% endif %}
Task<IResponseOutput> AddOrUpdate{{TableName}}({{TableNameAddOrEdit}} addOrEdit{{TableName}});
Task<IResponseOutput> Delete{{TableNameView}}(Guid {{LowercaseTableNameId}});
Task<IResponseOutput> Delete{{TableName}}(Guid {{LowercaseTableNameId}});
}