Browse Source

pacs接口

bjmzak
wxd 2 years ago
parent
commit
bad7efc43c
  1. 110
      src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PatientPacsInfoDto.cs
  2. 19
      src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PatientPacsInfoInputDto.cs
  3. 92
      src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs
  4. 44
      src/Shentun.Peis.HttpApi.Host/Filter/CustomerActionFilterAttribute.cs
  5. 45
      src/Shentun.Peis.HttpApi.Host/Filter/CustomerExceptionFilterAttribute.cs
  6. 11
      src/Shentun.Peis.HttpApi.Host/Filter/ThirdReturn.cs

110
src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PatientPacsInfoDto.cs

@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.ThirdPartyPublicInterfaces
{
public class PatientPacsInfoDto
{
/// <summary>
/// 人员信息
/// </summary>
public PatientPacsInfo_PatientInfoDto PatientInfo { get; set; }
/// <summary>
/// 项目信息
/// </summary>
public List<PatientPacsInfo_ItemsDto> Items { get; set; }
}
public class PatientPacsInfo_ItemsDto
{
/// <summary>
/// 申请单号 (check_request_no+排序值) check_request_no-1 check_request_no-2
/// </summary>
public string sqdh { get; set; }
/// <summary>
/// 项目编号 id
/// </summary>
public string xmbh { get; set; }
/// <summary>
/// 项目名称
/// </summary>
public string xmmc { get; set; }
/// <summary>
/// 检查类型
/// </summary>
public string xmlx { get; set; }
/// <summary>
/// 科室编码 id
/// </summary>
public string ksbm { get; set; }
/// <summary>
/// 科室名称
/// </summary>
public string ksmc { get; set; }
}
public class PatientPacsInfo_PatientInfoDto
{
/// <summary>
/// 体检编号 对应check_request_no
/// </summary>
public string tjbh { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string xm { get; set; }
/// <summary>
/// 性别 性别代码1.男 2.女 9.未知
/// </summary>
public string xb { get; set; }
/// <summary>
/// 年龄
/// </summary>
public string nl { get; set; }
/// <summary>
/// 出生日期 (格式yyyy-MM-dd HH:mm:SS)
/// </summary>
public string csrq { get; set; }
/// <summary>
/// 登记人
/// </summary>
public string djr { get; set; }
/// <summary>
/// 登记日期 (格式yyyy-MM-dd HH:mm:SS)
/// </summary>
public string djrq { get; set; }
/// <summary>
/// 身份证号
/// </summary>
public string sfzh { get; set; }
/// <summary>
/// 体检日期(格式yyyy-MM-dd HH:mm:SS)
/// </summary>
public string tjrq { get; set; }
/// <summary>
/// 联系电话
/// </summary>
public string lxdh { get; set; }
/// <summary>
/// 地址
/// </summary>
public string addr { get; set; }
}
}

19
src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PatientPacsInfoInputDto.cs

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Shentun.Peis.ThirdPartyPublicInterfaces
{
public class PatientPacsInfoInputDto
{
/// <summary>
/// 体检编号
/// </summary>
public string tjbh { get; set; }
/// <summary>
/// 检查类型
/// </summary>
public string xmlx { get; set; }
}
}

92
src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs

@ -19,7 +19,6 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces
/// <summary>
/// 第三方公开接口
/// </summary>
[Authorize(PeisPermissions.Third.Default)]
public class ThirdPartyPublicInterfaceAppService : ApplicationService
{
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository;
@ -28,6 +27,8 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces
private readonly IRepository<RegisterCheckItem> _registerCheckItemRepository;
private readonly IRepository<Item, Guid> _itemRepository;
private readonly IRepository<ItemType, Guid> _itemTypeRepository;
private readonly IRepository<Asbitem, Guid> _asbitemRepository;
private readonly IRepository<Patient, Guid> _patientRepository;
private readonly CacheService _cacheService;
public ThirdPartyPublicInterfaceAppService(
IRepository<PatientRegister, Guid> patientRegisterRepository,
@ -36,7 +37,9 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces
IRepository<RegisterCheckAsbitem, Guid> registerCheckAsbitemRepository,
IRepository<RegisterCheckItem> registerCheckItemRepository,
IRepository<Item, Guid> itemRepository,
IRepository<ItemType, Guid> itemTypeRepository)
IRepository<ItemType, Guid> itemTypeRepository,
IRepository<Asbitem, Guid> asbitemRepository,
IRepository<Patient, Guid> patientRepository)
{
_patientRegisterRepository = patientRegisterRepository;
_cacheService = cacheService;
@ -45,6 +48,8 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces
_registerCheckItemRepository = registerCheckItemRepository;
_itemRepository = itemRepository;
_itemTypeRepository = itemTypeRepository;
_asbitemRepository = asbitemRepository;
_patientRepository = patientRepository;
}
@ -53,6 +58,7 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[Authorize(PeisPermissions.Third.Default)]
[HttpPost("api/Third/ThirdPartyPublicInterface/GetBasicInformationOfMedicalExaminationPersonnel")]
public async Task<BasicInformationOfMedicalExaminationPersonnelDto> GetBasicInformationOfMedicalExaminationPersonnelAsync(PublicPatientRegisterNoInputDto input)
{
@ -94,6 +100,7 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[Authorize(PeisPermissions.Third.Default)]
[HttpPost("api/Third/ThirdPartyPublicInterface/GetPhysicalExaminationDetailsItemInformation")]
public async Task<List<PhysicalExaminationDetailsItemInformationDto>> GetPhysicalExaminationDetailsItemInformationAsync(PublicPatientRegisterNoInputDto input)
{
@ -138,5 +145,86 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces
/// <summary>
/// 查询pacs条码信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/Third/ThirdPartyPublicInterface/getPatientItems")]
public async Task<PatientPacsInfoDto> GetPatientPacsInfoAsync(PatientPacsInfoInputDto input)
{
if (input == null)
{
throw new UserFriendlyException($"请求参数错误");
}
if (string.IsNullOrEmpty(input.tjbh))
throw new UserFriendlyException($"体检编号不能为空");
var query = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
join patient in await _patientRepository.GetQueryableAsync() on patientRegister.PatientId equals patient.Id into patientTemp
from patientHaveEmpty in patientTemp.DefaultIfEmpty()
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 itemType in await _itemTypeRepository.GetQueryableAsync() on asbitem.ItemTypeId equals itemType.Id into itemTypeTemp
from itemTypeHaveEmpty in itemTypeTemp.DefaultIfEmpty()
where registerCheck.CheckRequestNo == input.tjbh
orderby asbitem.DisplayOrder ascending
select new
{
patientRegister,
IdNo = patientHaveEmpty != null ? patientHaveEmpty.IdNo : "",
MobileTelephone = patientHaveEmpty != null ? patientHaveEmpty.MobileTelephone : "",
CheckRequestNo = registerCheck.CheckRequestNo,
asbitem,
ItemTypeName = itemTypeHaveEmpty != null ? itemTypeHaveEmpty.DisplayName : "",
ItemTypeId = itemTypeHaveEmpty != null ? itemTypeHaveEmpty.Id.ToString() : ""
}).ToList();
if (!string.IsNullOrEmpty(input.xmlx))
{
//检查类型检索
}
if (query.Count == 0)
throw new UserFriendlyException($"体检编号不存在");
var patientInfo = new PatientPacsInfo_PatientInfoDto
{
addr = "",
tjbh = query.FirstOrDefault().CheckRequestNo,
csrq = query.FirstOrDefault().patientRegister.BirthDate != null ? query.FirstOrDefault().patientRegister.BirthDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
djr = _cacheService.GetSurnameAsync(query.FirstOrDefault().patientRegister.CreatorId).Result,
djrq = query.FirstOrDefault().patientRegister.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"),
lxdh = query.FirstOrDefault().MobileTelephone,
nl = query.FirstOrDefault().patientRegister.Age.ToString(),
sfzh = query.FirstOrDefault().IdNo,
tjrq = query.FirstOrDefault().patientRegister.MedicalStartDate != null ? query.FirstOrDefault().patientRegister.MedicalStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
xb = query.FirstOrDefault().patientRegister.SexId == 'M' ? "1" : (query.FirstOrDefault().patientRegister.SexId == 'F' ? "2" : "9"),
xm = query.FirstOrDefault().patientRegister.PatientName
};
var items = query.Select(s => new PatientPacsInfo_ItemsDto
{
ksbm = s.ItemTypeId,
ksmc = s.ItemTypeName,
sqdh = s.CheckRequestNo + "-" + (query.IndexOf(s) + 1),
xmbh = s.asbitem.Id.ToString(),
xmlx = "1",
xmmc = s.asbitem.DisplayName,
}).ToList();
return new PatientPacsInfoDto
{
PatientInfo = patientInfo,
Items = items
};
}
}
}

44
src/Shentun.Peis.HttpApi.Host/Filter/CustomerActionFilterAttribute.cs

@ -2,15 +2,20 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using OpenAI_API.Moderation;
using Shentun.Peis.DiagnosisFunctions;
using Shentun.Peis.Filter;
//using Microsoft.AspNetCore.Mvc;
//using Microsoft.AspNetCore.Mvc.Filters;
using Shentun.WebApi.Service;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Volo.Abp;
using static Shentun.Peis.Permissions.PeisPermissions;
namespace Shentun.Peis
{
@ -19,9 +24,6 @@ namespace Shentun.Peis
/// </summary>
public class CustomerActionFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext context)
{
//if (context.Result is ObjectResult objRst)
@ -55,30 +57,22 @@ namespace Shentun.Peis
else
{
List<string> filterApiUrl = new List<string> { "/api/third/thirdpartypublicinterface/getpatientitems" };
List<string> filterApiUrl = new List<string> { "/api/app/diagnosisfunction/getdiagnosisresult" };
if (!filterApiUrl.Contains(context.HttpContext.Request.Path.ToString().ToLower()))
if (filterApiUrl.Contains(context.HttpContext.Request.Path.ToString().ToLower()))
{
ThirdReturn msg = new ThirdReturn
{
code = "200",
message = "处理成功",
data = result.Value
};
context.Result = new OkObjectResult(msg);
}
else
{
context.Result = new OkObjectResult(ReturnValue.CreateSuccessInstance(result.Value));
//Type type = result.Value.GetType();
//PropertyInfo IsTH = type.GetProperty("CustomerMessage");
//if (IsTH != null)
//{
// string message = IsTH.GetValue(result.Value).ToString();
// //FieldInfo field = type.GetField("<" + IsTH.Name + ">k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance); // 根据属性名称生成字段名称
// //if (field != null)
// // field.SetValue(result.Value, null); // 将字段值设置为 null,相当于删除属性
//}
//GetDiagnosisResultDto myObj = (GetDiagnosisResultDto)result.Value;
//context.Result = new OkObjectResult(ReturnValue.CreateCustomErrorInstance(result.Value, message));
}
@ -122,6 +116,7 @@ namespace Shentun.Peis
//var result = context.Result as FileContentResult;
//context.Result = new OkObjectResult(result);
}
//else if (context.Result == null)
//{
// //全局加返回值
@ -129,7 +124,6 @@ namespace Shentun.Peis
//}
else
{
//if (context.Exception != null && !string.IsNullOrEmpty(context.Exception.Message))
//{
// context.Result = new OkObjectResult(ReturnValue.CreateErrorInstance(context.Exception.Message));

45
src/Shentun.Peis.HttpApi.Host/Filter/CustomerExceptionFilterAttribute.cs

@ -3,8 +3,10 @@ using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Shentun.Peis.Filter;
using Shentun.WebApi.Service;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp;
@ -85,14 +87,43 @@ namespace Shentun.Peis
}
exceptionContext.Result = new ContentResult
List<string> filterApiUrl = new List<string> { "/api/third/thirdpartypublicinterface/getpatientitems" };
if (filterApiUrl.Contains(exceptionContext.HttpContext.Request.Path.ToString().ToLower()))
{
// 返回状态码设置为200,表示成功
StatusCode = 200,
// 设置返回格式
ContentType = "application/json;charset=utf-8",
Content = JsonConvert.SerializeObject(ReturnValue.CreateErrorInstance(errorMessage))
};
ThirdReturn msg = new ThirdReturn
{
code = "-1",
message = exceptionContext.Exception.Message,
data = null
};
exceptionContext.Result = new ContentResult
{
// 返回状态码设置为200,表示成功
StatusCode = 200,
// 设置返回格式
ContentType = "application/json;charset=utf-8",
Content = JsonConvert.SerializeObject(msg)
};
}
else
{
exceptionContext.Result = new ContentResult
{
// 返回状态码设置为200,表示成功
StatusCode = 200,
// 设置返回格式
ContentType = "application/json;charset=utf-8",
Content = JsonConvert.SerializeObject(ReturnValue.CreateErrorInstance(errorMessage))
};
}
}
// 设置为true,表示异常已经被处理了

11
src/Shentun.Peis.HttpApi.Host/Filter/ThirdReturn.cs

@ -0,0 +1,11 @@
namespace Shentun.Peis.Filter
{
public class ThirdReturn
{
public string code { get; set; }
public string message { get; set; }
public object data { get; set; }
}
}
Loading…
Cancel
Save