diff --git a/src/Shentun.Peis.Application.Contracts/PacsBusiness/GetPatientRegisterByCheckRequestNoDto.cs b/src/Shentun.Peis.Application.Contracts/PacsBusiness/GetPatientRegisterByCheckRequestNoDto.cs
index 8d0c74e..c226689 100644
--- a/src/Shentun.Peis.Application.Contracts/PacsBusiness/GetPatientRegisterByCheckRequestNoDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/PacsBusiness/GetPatientRegisterByCheckRequestNoDto.cs
@@ -13,5 +13,7 @@ namespace Shentun.Peis.PacsBusiness
public string PatientSex { get; set; }
public string PatientAge { get; set; }
+
+ public string HospitalName { get; set; }
}
}
diff --git a/src/Shentun.Peis.Application.Contracts/Worklists/CreateRegisterCheckWorklistInputDto.cs b/src/Shentun.Peis.Application.Contracts/Worklists/CreateRegisterCheckWorklistInputDto.cs
index cf191f7..aee6c30 100644
--- a/src/Shentun.Peis.Application.Contracts/Worklists/CreateRegisterCheckWorklistInputDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/Worklists/CreateRegisterCheckWorklistInputDto.cs
@@ -9,7 +9,7 @@ namespace Shentun.Peis.Worklists
///
/// 预检Aet
///
- public string ScheduledAET { get; set; }
+ public string ScheduledAet { get; set; }
///
/// 检查条码
diff --git a/src/Shentun.Peis.Application.Contracts/Worklists/GetWorklistPatientListDto.cs b/src/Shentun.Peis.Application.Contracts/Worklists/GetWorklistPatientListDto.cs
index 0ba970a..36e52b0 100644
--- a/src/Shentun.Peis.Application.Contracts/Worklists/GetWorklistPatientListDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/Worklists/GetWorklistPatientListDto.cs
@@ -6,59 +6,62 @@ namespace Shentun.Peis.Worklists
{
public class GetWorklistPatientListDto
{
- public string AccessionNumber { get; set; } = string.Empty;
+ public string AccessionNumber { get; set; }
///
/// 检查条码号
///
- public string PatientID { get; set; } = string.Empty;
+ public string PatientID { get; set; }
- public string Surname { get; set; } = string.Empty;
+ public string Surname { get; set; }
///
/// 姓名
///
- public string Forename { get; set; } = string.Empty;
+ public string Forename { get; set; }
- public string Title { get; set; } = string.Empty;
+ public string Title { get; set; }
///
/// 性别
///
- public string Sex { get; set; } = string.Empty;
+ public string Sex { get; set; }
///
/// 出生日期
///
- public DateTime DateOfBirth { get; set; } = DateTime.Now;
+ public DateTime DateOfBirth { get; set; }
- public string ReferringPhysician { get; set; } = string.Empty;
+ public string ReferringPhysician { get; set; }
- public string PerformingPhysician { get; set; } = string.Empty;
+ public string PerformingPhysician { get; set; }
- public string Modality { get; set; } = string.Empty;
+ ///
+ /// 设备类型
+ ///
+ public string Modality { get; set; }
///
/// 扫码日期
///
- public DateTime ExamDateAndTime { get; set; } = DateTime.Now;
+ public DateTime ExamDateAndTime { get; set; }
- public string ExamRoom { get; set; } = string.Empty;
+ public string ExamRoom { get; set; }
- public string ExamDescription { get; set; } = string.Empty;
+ public string ExamDescription { get; set; }
- public string StudyUID { get; set; } = string.Empty;
+ public string StudyUID { get; set; }
- public string ProcedureID { get; set; } = string.Empty;
+ public string ProcedureID { get; set; }
- public string ProcedureStepID { get; set; } = string.Empty;
+ public string ProcedureStepID { get; set; }
- public string HospitalName { get; set; } = string.Empty;
+ public string HospitalName { get; set; }
///
/// 预检Aet
///
- public string ScheduledAET { get; set; } = string.Empty;
+ public string ScheduledAET { get; set; }
}
}
diff --git a/src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs b/src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs
index 7d973af..515aa61 100644
--- a/src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs
+++ b/src/Shentun.Peis.Application/PacsBusiness/PacsBusinessAppService.cs
@@ -30,7 +30,6 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Users;
-using static Volo.Abp.Identity.Settings.IdentitySettingNames;
namespace Shentun.Peis.PacsBusiness
{
@@ -61,6 +60,7 @@ namespace Shentun.Peis.PacsBusiness
private readonly ILogger _logger;
private readonly IRepository _itemTypeRepository;
private readonly CustomerOrgManager _customerOrgManager;
+ private readonly IRepository _organizationUnitRepository;
public PacsBusinessAppService(
IConfiguration configuration,
IRepository registerCheckRepository,
@@ -81,7 +81,8 @@ namespace Shentun.Peis.PacsBusiness
IRepository dicomFileDetailRepository,
ILogger logger,
IRepository itemTypeRepository,
- CustomerOrgManager customerOrgManager)
+ CustomerOrgManager customerOrgManager,
+ IRepository organizationUnitRepository)
{
_configuration = configuration;
_registerCheckRepository = registerCheckRepository;
@@ -103,6 +104,7 @@ namespace Shentun.Peis.PacsBusiness
_logger = logger;
_itemTypeRepository = itemTypeRepository;
_customerOrgManager = customerOrgManager;
+ _organizationUnitRepository = organizationUnitRepository;
}
@@ -717,10 +719,19 @@ namespace Shentun.Peis.PacsBusiness
{
throw new UserFriendlyException("检查条码不能为空");
}
+
+
var patientRegisterEnt = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId
+ join organizationUnit in await _organizationUnitRepository.GetQueryableAsync()
+ on patientRegister.MedicalCenterId equals organizationUnit.Id into organizationUnitTemp
+ from organizationUnitHaveEmpty in organizationUnitTemp.DefaultIfEmpty()
where registerCheck.CheckRequestNo == input.CheckRequestNo
- select patientRegister).FirstOrDefault();
+ select new
+ {
+ patientRegister,
+ medicalCenterName = organizationUnitHaveEmpty != null ? organizationUnitHaveEmpty.DisplayName : ""
+ }).FirstOrDefault();
if (patientRegisterEnt == null)
{
@@ -729,10 +740,11 @@ namespace Shentun.Peis.PacsBusiness
var entDto = new GetPatientRegisterByCheckRequestNoDto
{
- PatientAge = patientRegisterEnt.Age == null ? "" : patientRegisterEnt.Age.ToString(),
- PatientBirthDate = patientRegisterEnt.BirthDate == null ? "" : DataHelper.ConversionDateShortNoSymbolToString(patientRegisterEnt.BirthDate),
- PatientName = patientRegisterEnt.PatientName,
- PatientSex = patientRegisterEnt.SexId.ToString()
+ PatientAge = patientRegisterEnt.patientRegister.Age == null ? "" : patientRegisterEnt.patientRegister.Age.ToString(),
+ PatientBirthDate = patientRegisterEnt.patientRegister.BirthDate == null ? "" : DataHelper.ConversionDateShortNoSymbolToString(patientRegisterEnt.patientRegister.BirthDate),
+ PatientName = patientRegisterEnt.patientRegister.PatientName,
+ PatientSex = patientRegisterEnt.patientRegister.SexId.ToString(),
+ HospitalName = patientRegisterEnt.medicalCenterName
};
return entDto;
diff --git a/src/Shentun.Peis.Application/Worklists/WorklistAppService.cs b/src/Shentun.Peis.Application/Worklists/WorklistAppService.cs
index 7fdb3c1..86d96a4 100644
--- a/src/Shentun.Peis.Application/Worklists/WorklistAppService.cs
+++ b/src/Shentun.Peis.Application/Worklists/WorklistAppService.cs
@@ -1,11 +1,14 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Volo.Abp;
using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
namespace Shentun.Peis.Worklists
{
@@ -13,9 +16,25 @@ namespace Shentun.Peis.Worklists
[Authorize]
public class WorklistAppService : ApplicationService
{
- public WorklistAppService()
- {
+ private readonly IRepository _registerCheckRepository;
+ private readonly IRepository _registerCheckAsbitemRepository;
+ private readonly IRepository _asbitemRepository;
+ private readonly IRepository _deviceTypeRepository;
+ private readonly IRepository _patientRegisterRepository;
+
+ public WorklistAppService(
+ IRepository registerCheckRepository,
+ IRepository registerCheckAsbitemRepository,
+ IRepository asbitemRepository,
+ IRepository deviceTypeRepository,
+ IRepository patientRegisterRepository)
+ {
+ _registerCheckRepository = registerCheckRepository;
+ _registerCheckAsbitemRepository = registerCheckAsbitemRepository;
+ _asbitemRepository = asbitemRepository;
+ _deviceTypeRepository = deviceTypeRepository;
+ _patientRegisterRepository = patientRegisterRepository;
}
///
@@ -23,9 +42,66 @@ namespace Shentun.Peis.Worklists
///
///
[HttpPost("api/app/Worklist/GetWorklistPatientList")]
+ [AllowAnonymous]
public async Task> GetWorklistPatientListAsync(GetWorklistPatientListInputDto input)
{
- return new List();
+ if (string.IsNullOrWhiteSpace(input.ScheduledAet))
+ {
+ throw new UserFriendlyException("预检AET不能为空");
+ }
+
+ if (string.IsNullOrWhiteSpace(input.Modality))
+ {
+ throw new UserFriendlyException("设备类型不能为空");
+ }
+
+ if (string.IsNullOrWhiteSpace(input.StartDate) || string.IsNullOrWhiteSpace(input.EndDate))
+ {
+ throw new UserFriendlyException("日期不能为空");
+ }
+
+
+ var queryList = (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
+ join deviceType in await _deviceTypeRepository.GetQueryableAsync() on asbitem.DeviceTypeId equals deviceType.Id
+ where registerCheck.ScheduledAet == input.ScheduledAet
+ && registerCheck.WorklistPreCheckDate != null
+ && registerCheck.WorklistPreCheckDate >= Convert.ToDateTime(input.StartDate)
+ && registerCheck.WorklistPreCheckDate < Convert.ToDateTime(input.EndDate).AddDays(1)
+ && deviceType.DisplayName == input.Modality
+ select new
+ {
+ patientRegister,
+ registerCheck,
+ deviceType
+ }).ToList();
+
+ var entListDto = queryList.Select(s => new GetWorklistPatientListDto
+ {
+ DateOfBirth = s.patientRegister.BirthDate != null ? s.patientRegister.BirthDate.Value : DateTime.Now,
+ ExamDateAndTime = s.registerCheck.WorklistPreCheckDate != null ? s.registerCheck.WorklistPreCheckDate.Value : DateTime.Now,
+ Modality = s.deviceType.DisplayName,
+ PatientID = s.registerCheck.CheckRequestNo,
+ Forename = s.patientRegister.PatientName,
+ ScheduledAET = s.registerCheck.ScheduledAet,
+ Sex = s.patientRegister.SexId.ToString(),
+ AccessionNumber = "",
+ Surname = "",
+ ExamDescription = "",
+ ExamRoom = "",
+ HospitalName = "",
+ PerformingPhysician = "",
+ ProcedureID = "",
+ ProcedureStepID = "",
+ ReferringPhysician = "",
+ StudyUID = "",
+ Title = ""
+ }).ToList();
+
+
+ return entListDto;
}
@@ -36,7 +112,47 @@ namespace Shentun.Peis.Worklists
[HttpPost("api/app/Worklist/CreateRegisterCheckWorklist")]
public async Task CreateRegisterCheckWorklistAsync(CreateRegisterCheckWorklistInputDto input)
{
-
+ if (string.IsNullOrWhiteSpace(input.ScheduledAet))
+ {
+ throw new UserFriendlyException("预检AET不能为空");
+ }
+
+ if (string.IsNullOrWhiteSpace(input.CheckRequestNo))
+ {
+ throw new UserFriendlyException("检查条码不能为空");
+ }
+
+ var queryList = (from registerCheck in await _registerCheckRepository.GetQueryableAsync()
+ 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 registerCheck.CheckRequestNo == input.CheckRequestNo
+ select new
+ {
+ registerCheck,
+ asbitem
+ }).ToList();
+
+ if (!queryList.Any())
+ {
+ throw new UserFriendlyException("条码号不正确");
+ }
+
+ foreach (var item in queryList)
+ {
+ if (item.asbitem.DeviceTypeId == null || item.asbitem.DeviceTypeId == Guid.Empty)
+ {
+ throw new UserFriendlyException($"组合项目:{item.asbitem.DisplayName}未配置仪器类别");
+ }
+ }
+
+ var registerCheckEnt = queryList.Select(s => s.registerCheck).FirstOrDefault();
+
+ registerCheckEnt.WorklistFlag = '1';
+ registerCheckEnt.WorklistPreCheckDate = DateTime.Now;
+ registerCheckEnt.ScheduledAet = input.ScheduledAet;
+
+ await _registerCheckRepository.UpdateAsync(registerCheckEnt);
+
}
}
}
diff --git a/src/Shentun.Peis.DbMigrator/appsettings.json b/src/Shentun.Peis.DbMigrator/appsettings.json
index f671d85..3444c1b 100644
--- a/src/Shentun.Peis.DbMigrator/appsettings.json
+++ b/src/Shentun.Peis.DbMigrator/appsettings.json
@@ -1,7 +1,7 @@
{
"ConnectionStrings": {
- //"Default": "Host=140.143.162.39;Port=5432;Database=ShentunPeis240701;User ID=postgres;Password=shentun123;"
- "Default": "Host=192.168.2.67;Port=5432;Database=ShentunPeis;User ID=postgres;Password=st123;"
+ "Default": "Host=140.143.162.39;Port=5432;Database=ShentunPeis240701;User ID=postgres;Password=shentun123;"
+ //"Default": "Host=192.168.2.67;Port=5432;Database=ShentunPeis;User ID=postgres;Password=st123;"
//"Default": "Host=localhost;Port=5432;Database=ShentunPeis1218;User ID=postgres;Password=wxd123;"
//"Default": "Host=10.1.12.140;Port=5432;Database=ShentunPeis0508;User ID=postgres;Password=st123;"
},