Browse Source

批量修改医生

master
wxd 1 year ago
parent
commit
15ea9ce464
  1. 19
      src/Shentun.Peis.Application.Contracts/Asbitems/SimpleAsbitemDto.cs
  2. 14
      src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdsInputDto.cs
  3. 32
      src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateBatchCheckDoctorInputDto.cs
  4. 86
      src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs

19
src/Shentun.Peis.Application.Contracts/Asbitems/SimpleAsbitemDto.cs

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.Asbitems
{
public class SimpleAsbitemDto
{
/// <summary>
/// 组合项目ID
/// </summary>
public Guid AsbitemId { get; set; }
/// <summary>
/// 组合项目名称
/// </summary>
public string AsbitemName { get; set; }
}
}

14
src/Shentun.Peis.Application.Contracts/PatientRegisters/PatientRegisterIdsInputDto.cs

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.PatientRegisters
{
public class PatientRegisterIdsInputDto
{
/// <summary>
/// 人员ID集合
/// </summary>
public List<Guid> PatientRegisterIds { get; set; }
}
}

32
src/Shentun.Peis.Application.Contracts/RegisterChecks/UpdateBatchCheckDoctorInputDto.cs

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.RegisterChecks
{
public class UpdateBatchCheckDoctorInputDto
{
/// <summary>
/// 人员id集合
/// </summary>
public List<Guid> PatientRegisterIds { get; set; }
/// <summary>
/// 检查医生 不需要修改的信息都不用传过来
/// </summary>
public List<UpdateBatchCheckDoctorInputDetailDto> CheckDoctorDetail { get; set; }
}
public class UpdateBatchCheckDoctorInputDetailDto
{
/// <summary>
/// 组合项目ID
/// </summary>
public Guid AsbitemId { get; set; }
/// <summary>
/// 检查医生 也可以传字符串
/// </summary>
public string CheckDoctorId { get; set; }
}
}

86
src/Shentun.Peis.Application/RegisterChecks/RegisterCheckAppService.cs

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Shentun.Peis.Asbitems;
using Shentun.Peis.Enums;
using Shentun.Peis.MenuInfos;
using Shentun.Peis.Models;
@ -23,6 +24,7 @@ using Volo.Abp.Guids;
using Volo.Abp.Identity;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Users;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace Shentun.Peis.RegisterChecks
{
@ -500,32 +502,70 @@ namespace Shentun.Peis.RegisterChecks
}
///// <summary>
///// 查询检查项目组合项目记录跟检查结果 根据体检登记ID
///// </summary>
///// <param name="PatientRegisterId">体检登记ID</param>
///// <returns></returns>
//public async Task<List<RegisterCheckOrRegisterAsbitemDto>> GetListInPatientRegisterIdAsync(Guid PatientRegisterId)
//{
// var registerCheckList = (await _registerCheckRepository.GetDbSetAsync()).Include(s => s.RegisterAsbitem).Include(s => s.RegisterAsbitem.Asbitem)
// .Where(m => m.RegisterAsbitem.PatientRegisterId == PatientRegisterId).ToList();
// var entListDto = registerCheckList.Select(s => new RegisterCheckOrRegisterAsbitemDto
// {
// AsbitemName = s.RegisterAsbitem.Asbitem.DisplayName,
// CompleteFlag = s.CompleteFlag,
// CreationTime = s.CreationTime,
// CreatorId = s.CreatorId,
// Id = s.Id,
// LastModificationTime = s.LastModificationTime,
// LastModifierId = s.LastModifierId,
// CreatorName = EntityHelper.GetUserNameNoSql(userList, s.CreatorId),
// LastModifierName = EntityHelper.GetUserNameNoSql(userList, s.LastModifierId)
// }).ToList();
/// <summary>
/// 根据人员ID集合获取所有项目
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/RegisterCheck/GetRegisterCheckAsbitemsByPatientRegisterIds")]
public async Task<List<SimpleAsbitemDto>> GetRegisterCheckAsbitemsByPatientRegisterIdsAsync(PatientRegisterIdsInputDto input)
{
if (!input.PatientRegisterIds.Any())
throw new UserFriendlyException("人员ID不能为空");
var entListDto = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId
join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId
join asbitem in await _asbitemRepository.GetQueryableAsync() on registerCheckAsbitem.AsbitemId equals asbitem.Id
where input.PatientRegisterIds.Contains(patientRegister.Id) && asbitem.IsCheck == 'Y'
select new SimpleAsbitemDto
{
AsbitemId = registerCheckAsbitem.AsbitemId,
AsbitemName = asbitem.DisplayName
}).Distinct().ToList();
// return entListDto;
//}
return entListDto;
}
/// <summary>
/// 批量修改医生 根据人员ID集合
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/RegisterCheck/UpdateBatchCheckDoctor")]
public async Task UpdateBatchCheckDoctorAsync(UpdateBatchCheckDoctorInputDto input)
{
if (!input.PatientRegisterIds.Any())
throw new UserFriendlyException("人员ID不能为空");
if (!input.CheckDoctorDetail.Any())
throw new UserFriendlyException("需要修改的信息不能为空");
var registerCheckAsbitemList = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId
join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId
where input.PatientRegisterIds.Contains(patientRegister.Id)
select registerCheckAsbitem).ToList();
if (registerCheckAsbitemList.Any())
{
foreach (var registerCheckAsbitem in registerCheckAsbitemList)
{
var checkDoctorEnt = input.CheckDoctorDetail.FirstOrDefault(f => f.AsbitemId == registerCheckAsbitem.AsbitemId);
if (checkDoctorEnt != null)
{
var registerCheckEnt = await _registerCheckRepository.FirstOrDefaultAsync(f => f.Id == registerCheckAsbitem.RegisterCheckId);
if (registerCheckEnt != null)
{
registerCheckEnt.CheckDoctorId = checkDoctorEnt.CheckDoctorId;
await _registerCheckRepository.UpdateAsync(registerCheckEnt);
}
}
}
}
}
}

Loading…
Cancel
Save