Browse Source

lis申请

bjmzak
DESKTOP-G961P6V\Zhh 2 years ago
parent
commit
2102baab00
  1. 62
      src/Shentun.Peis.Application.Contracts/LisRequests/GetLisRequestListDto.cs
  2. 74
      src/Shentun.Peis.Application.Contracts/LisRequests/LisRequestDto.cs
  3. 89
      src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs
  4. 10
      src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
  5. 10
      src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs

62
src/Shentun.Peis.Application.Contracts/LisRequests/GetLisRequestListDto.cs

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.LisRequests
{
public class GetLisRequestListDto
{
/// <summary>
/// 单位id
/// </summary>
public Guid? CustomerOrgId { get; set; }
public Guid? CustomerOrgRegisterId { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string? PatientName { get; set; }
/// <summary>
/// 性别
/// </summary>
public char? SexId { get; set; }
/// <summary>
/// 档案号
/// </summary>
public string? PatientNo { get; set; }
/// <summary>
/// 条码号
/// </summary>
public string? PatientRegisterNo { get; set; }
/// <summary>
/// 身份证号
/// </summary>
public string? IdNo { get; set; }
/// <summary>
/// 开始日期
/// </summary>
public string? StartDate { get; set; }
/// <summary>
/// 结束日期
/// </summary>
public string? EndDate { get; set; }
/// <summary>
/// 手机号(支持手机跟座机)
/// </summary>
public string? Phone { get; set; }
//public override int MaxResultCount { get; set; } = 50;
public int MaxResultCount { get; set; } = 50;
public int SkipCount { get; set; } = 0;
}
}

74
src/Shentun.Peis.Application.Contracts/LisRequests/LisRequestDto.cs

@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.LisRequests
{
public class LisRequestDto
{
/// <summary>
/// LisRequest的ID
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string PatientName { get; set; }
/// <summary>
/// 性别
/// </summary>
public string? SexName { get; set; }
/// <summary>
/// 年龄
/// </summary>
public short? Age { get; set; }
/// <summary>
/// 标本类型名称
/// </summary>
public string SampleTypeName { get; set; }
/// <summary>
/// 标本容器名称
/// </summary>
public string SampleContainerName { get; set; }
/// <summary>
/// 颜色值
/// </summary>
public int ContainerColor { get; set; }
/// <summary>
/// 标本容器备注
/// </summary>
public string? SampleContainerRemark { get; set; }
/// <summary>
/// 检验申请单号
/// </summary>
public string LisRequestNo { get; set; }
/// <summary>
/// 档案号
/// </summary>
public string PatientNo { get; set; }
/// <summary>
/// 登记人员条码号
/// </summary>
public string PatientRegisterNo { get; set; }
/// <summary>
/// 组合项目简称(多个“,”号隔开)
/// </summary>
public string AsbitemName { get; set; }
/// <summary>
/// 单位名称
/// </summary>
public string CustomerOrgName { get; set; }
/// <summary>
/// 部门名称
/// </summary>
public string DepartmentName { get; set; }
}
}

89
src/Shentun.Peis.Application/LisRequests/LisRequestAppService.cs

@ -1,5 +1,8 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.CustomerOrgs;
using Shentun.Peis.Enums;
using Shentun.Peis.Models;
using Shentun.Peis.PrintReports;
using System;
@ -8,6 +11,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
@ -28,13 +32,17 @@ namespace Shentun.Peis.LisRequests
private readonly ILisRequestReportRepository _lisRequestReportRepository;
private readonly LisRequestManager _lisRequestManager;
private readonly CacheService _cacheService;
private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository;
private readonly CustomerOrgManager _customerOrgManager;
public LisRequestAppService(
IRepository<IdentityUser, Guid> userRepository,
IRepository<PatientRegister, Guid> patientRegisterRepository,
IRepository<RegisterCheckAsbitem, Guid> registerAsbitemRepository,
ILisRequestReportRepository lisRequestReportRepository,
IRepository<CustomerOrg, Guid> customerOrgRepository,
LisRequestManager lisRequestManager,
CacheService cacheService
CacheService cacheService,
CustomerOrgManager customerOrgManager
)
{
this._userRepository = userRepository;
@ -43,8 +51,75 @@ namespace Shentun.Peis.LisRequests
this._lisRequestReportRepository = lisRequestReportRepository;
this._lisRequestManager = lisRequestManager;
_cacheService = cacheService;
_customerOrgRepository = customerOrgRepository;
_customerOrgManager = customerOrgManager;
}
[HttpPost("api/app/LisRequest/GetListInFilter")]
public async Task<PagedResultDto<LisRequestDto>> GetListInFilterAsync(GetLisRequestListDto input)
{
var customerOrgList = await _customerOrgRepository.GetListAsync();
//Stopwatch stopwatch = Stopwatch.StartNew();
//stopwatch.Start();
#region MyRegion
var patientRegisterQuery = (await _patientRegisterRepository.GetQueryableAsync()).Include(x => x.Patient).AsQueryable();
if (!string.IsNullOrEmpty(input.PatientNo))
patientRegisterQuery = patientRegisterQuery.Where(m => m.Patient.PatientNo == input.PatientNo);
if (!string.IsNullOrEmpty(input.IdNo))
patientRegisterQuery = patientRegisterQuery.Where(m => m.Patient.IdNo == input.IdNo);
if (!string.IsNullOrEmpty(input.PatientName))
patientRegisterQuery = patientRegisterQuery.Where(m => !string.IsNullOrEmpty(m.PatientName) && m.PatientName.Contains(input.PatientName));
if (!string.IsNullOrEmpty(input.PatientRegisterNo))
patientRegisterQuery = patientRegisterQuery.Where(m => m.PatientRegisterNo == input.PatientRegisterNo);
if (!string.IsNullOrEmpty(input.Phone))
patientRegisterQuery = patientRegisterQuery.Where(m => m.Patient.MobileTelephone == input.Phone || m.Patient.Telephone == input.Phone);
if (input.SexId != null && input.SexId != ForSexFlag.All)
patientRegisterQuery = patientRegisterQuery.Where(m => m.SexId == input.SexId);
if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate))
patientRegisterQuery = patientRegisterQuery.Where(m => m.CreationTime >= Convert.ToDateTime(input.StartDate) &&
m.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1));
if (input.CustomerOrgId != null)
{
var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(input.CustomerOrgId.Value);
patientRegisterQuery = patientRegisterQuery.Where(m => CustomerOrgIds.Contains(m.CustomerOrgId));
}
if (input.CustomerOrgRegisterId != null && input.CustomerOrgRegisterId != Guid.Empty)
{
patientRegisterQuery = patientRegisterQuery.Where(m => m.CustomerOrgRegisterId == input.CustomerOrgRegisterId);
}
patientRegisterQuery.Where(o => o.CompleteFlag != PatientRegisterCompleteFlag.PreRegistration);
#endregion
int totalCount = patientRegisterQuery.Count();
patientRegisterQuery = patientRegisterQuery.Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount);
var patientRegisterList = patientRegisterQuery.ToList();
if (patientRegisterList.Count > 10000)
{
throw new UserFriendlyException("选择的人员数不能超过1万条");
}
//生成LIS申请数据
foreach(var patientRegister in patientRegisterList )
{
var lisRequests = await _lisRequestManager.SetLisRequestAsync(patientRegister.Id);
}
//返回检索到的数据
var result = new PagedResultDto<LisRequestDto>();
return result;
}
/// <summary>
/// 生成检验申请单 首次自动生成
/// </summary>
@ -144,6 +219,11 @@ namespace Shentun.Peis.LisRequests
{
if (input.OperateType == 1)
{
var _patientRegister = await _patientRegisterRepository.GetAsync((Guid)input.PatientRegisterId);
if (_patientRegister.CompleteFlag == PatientRegisterCompleteFlag.PreRegistration)
{
throw new UserFriendlyException("未正式登记,不能打印");
}
//按人员登记批量修改
var LisRequestIds = (await _registerAsbitemRepository.GetListAsync(m => m.PatientRegisterId == input.PatientRegisterId && m.LisRequestId != null)).Select(s => s.LisRequestId);
if (LisRequestIds.Count() > 0)
@ -164,6 +244,13 @@ namespace Shentun.Peis.LisRequests
var oldent = await _lisRequestReportRepository.FirstOrDefaultAsync(m => m.Id == input.LisRequestId);
if (oldent != null)
{
var registerAsbitem = (await _registerAsbitemRepository.GetListAsync(o => o.LisRequestId == input.LisRequestId)).FirstOrDefault();
var _patientRegister = await _patientRegisterRepository.GetAsync(registerAsbitem.PatientRegisterId);
if (_patientRegister.CompleteFlag == PatientRegisterCompleteFlag.PreRegistration)
{
throw new UserFriendlyException("未正式登记,不能打印");
}
oldent.IsPrint = 'Y';
await _lisRequestReportRepository.UpdateAsync(oldent);

10
src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs

@ -338,7 +338,7 @@ namespace Shentun.Peis.PatientRegisters
public async Task<PagedResultDto<PatientRegisterOrNoDto>> GetListInFilterAsync(GetListInSearchDto input)
{
var userList = await _userRepository.GetListAsync();
//var userList = await _userRepository.GetListAsync();
var customerOrgList = await _customerOrgRepository.GetListAsync();
//Stopwatch stopwatch = Stopwatch.StartNew();
@ -650,13 +650,13 @@ namespace Shentun.Peis.PatientRegisters
LastModifierId = ent.LastModifierId,
ThirdInfo = ent.ThirdInfo,
SummaryDoctorId = ent.SummaryDoctorId,
SummaryDate = ent.SummaryDate.ToString(),
SummaryDate = DataHelper.ConversionDateToString(ent.SummaryDate),
SexId = ent.SexId,
SexName = _cacheService.GetSexNameAsync(ent.SexId).Result,
Age = ent.Age,
AuditDate = ent.AuditDate.ToString(),
AuditDate = DataHelper.ConversionDateToString(ent.AuditDate),
AuditDoctorId = ent.AuditDoctorId,
BirthDate = ent.BirthDate.ToString(),
BirthDate = DataHelper.ConversionDateToString(ent.BirthDate),
CompleteFlag = ent.CompleteFlag,
CustomerOrgGroupId = ent.CustomerOrgGroupId,
CustomerOrgId = ent.CustomerOrgId,
@ -679,7 +679,7 @@ namespace Shentun.Peis.PatientRegisters
MedicalCardNo = ent.MedicalCardNo,
MedicalConclusionId = ent.MedicalConclusionId,
MedicalPackageId = ent.MedicalPackageId,
MedicalStartDate = ent.MedicalStartDate.ToString(),
MedicalStartDate = DataHelper.ConversionDateToString(ent.MedicalStartDate),
MedicalTimes = ent.MedicalTimes,
MedicalTypeId = ent.MedicalTypeId,
MedicalTypeName = _cacheService.GetMedicalTypeNameAsync(ent.MedicalTypeId).Result,

10
src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs

@ -192,7 +192,7 @@ namespace Shentun.Peis.LisRequests
{
string LisRequestNo = ""; //条码号
List<SysParmValue> spvlist = await _sysParmValueRepository.GetListAsync();
//List<SysParmValue> spvlist = await _sysParmValueRepository.GetListAsync();
//var spv_tjzx = spvlist.Where(m => m.MedicalCenterId == medicalCenterId); //体检中心配置
//var spv_global = spvlist.Where(m => m.MedicalCenterId == Guid.Empty); //全局配置
@ -211,11 +211,15 @@ namespace Shentun.Peis.LisRequests
{
throw new UserFriendlyException("LIS编码尾号长度不能为空");
}
int i_lis_request_no_rule_tail_len = 0;
if(!int.TryParse(lis_request_no_rule_tail_len, out i_lis_request_no_rule_tail_len))
int tailLen = 0;
if(!int.TryParse(lis_request_no_rule_tail_len, out tailLen))
{
throw new UserFriendlyException("LIS编码尾号长度不能为空");
}
if(tailLen < 3)
{
throw new UserFriendlyException("LIS编码尾号长度至少为3位");
}
if (string.IsNullOrWhiteSpace(lis_request_no_rule_prefix))
{
lis_request_no_rule_prefix = "";

Loading…
Cancel
Save