7 changed files with 278 additions and 4 deletions
			
			
		- 
					15src/Shentun.Peis.Application.Contracts/Permissions/PeisPermissionDefinitionProvider.cs
 - 
					12src/Shentun.Peis.Application.Contracts/Permissions/PeisPermissions.cs
 - 
					58src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/BasicInformationOfMedicalExaminationPersonnelDto.cs
 - 
					39src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PhysicalExaminationDetailsItemInformationDto.cs
 - 
					14src/Shentun.Peis.Application.Contracts/ThirdPartyPublicInterfaces/PublicPatientRegisterNoInputDto.cs
 - 
					142src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs
 - 
					2src/Shentun.Peis.Domain.Shared/Localization/Peis/en.json
 
@ -0,0 +1,58 @@ | 
				
			|||
using System; | 
				
			|||
using System.Collections.Generic; | 
				
			|||
using System.Text; | 
				
			|||
 | 
				
			|||
namespace Shentun.Peis.ThirdPartyPublicInterfaces | 
				
			|||
{ | 
				
			|||
    public class BasicInformationOfMedicalExaminationPersonnelDto | 
				
			|||
    { | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 条码号
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string PatientRegisterNo { get; set; }   | 
				
			|||
         | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 姓名
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string PatientName { get; set; }  | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 性别
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string SexName { get; set; } | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 出生日期 (yyyy-MM-dd)
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string BirthDate { get; set; } | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 完成标志(0 预登记  1正式登记  2部分已检  3已总检)
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public char CompleteFlag { get; set; } | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 体检开始标志( Y 已开始   N 未开始)
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public char IsMedicalStart { get; set; } | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 体检开始日期 (格式:1999-09-09 09:09:09)
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string MedicalStartDate { get; set; } | 
				
			|||
         | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 总检日期  (格式:1999-09-09 09:09:09)
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string SummaryDate { get; set; } | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 总检医生
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string SummaryDoctorName { get; set; } | 
				
			|||
         | 
				
			|||
        | 
				
			|||
        | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,39 @@ | 
				
			|||
using System; | 
				
			|||
using System.Collections.Generic; | 
				
			|||
using System.Text; | 
				
			|||
 | 
				
			|||
namespace Shentun.Peis.ThirdPartyPublicInterfaces | 
				
			|||
{ | 
				
			|||
    public class PhysicalExaminationDetailsItemInformationDto | 
				
			|||
    { | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 人员条码号
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string PatientRegisterNo { get; set; } | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 科室名字
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string ItemTypeName { get; set; } | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 明细项目名字
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string ItemName { get; set; } | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 结果
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string ItemResult { get; set; } | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 参考范围
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string ReferenceRangeValue { get; set; } | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 单位
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string Unit { get; set; } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,14 @@ | 
				
			|||
using System; | 
				
			|||
using System.Collections.Generic; | 
				
			|||
using System.Text; | 
				
			|||
 | 
				
			|||
namespace Shentun.Peis.ThirdPartyPublicInterfaces | 
				
			|||
{ | 
				
			|||
    public class PublicPatientRegisterNoInputDto | 
				
			|||
    { | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 人员条码号
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        public string PatientRegisterNo { get; set; } | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,142 @@ | 
				
			|||
using Microsoft.AspNetCore.Authorization; | 
				
			|||
using Microsoft.AspNetCore.Mvc; | 
				
			|||
using Microsoft.VisualBasic; | 
				
			|||
using NPOI.SS.Formula.Functions; | 
				
			|||
using Shentun.Peis.Models; | 
				
			|||
using Shentun.Peis.PatientRegisters; | 
				
			|||
using Shentun.Peis.Permissions; | 
				
			|||
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.ThirdPartyPublicInterfaces | 
				
			|||
{ | 
				
			|||
    /// <summary>
 | 
				
			|||
    /// 第三方公开接口
 | 
				
			|||
    /// </summary>
 | 
				
			|||
    [Authorize(PeisPermissions.Third.Default)] | 
				
			|||
    public class ThirdPartyPublicInterfaceAppService : ApplicationService | 
				
			|||
    { | 
				
			|||
        private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; | 
				
			|||
        private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository; | 
				
			|||
        private readonly IRepository<RegisterCheckAsbitem, Guid> _registerCheckAsbitemRepository; | 
				
			|||
        private readonly IRepository<RegisterCheckItem> _registerCheckItemRepository; | 
				
			|||
        private readonly IRepository<Item, Guid> _itemRepository; | 
				
			|||
        private readonly IRepository<ItemType, Guid> _itemTypeRepository; | 
				
			|||
        private readonly CacheService _cacheService; | 
				
			|||
        public ThirdPartyPublicInterfaceAppService( | 
				
			|||
            IRepository<PatientRegister, Guid> patientRegisterRepository, | 
				
			|||
            CacheService cacheService, | 
				
			|||
            IRepository<RegisterCheck, Guid> registerCheckRepository, | 
				
			|||
            IRepository<RegisterCheckAsbitem, Guid> registerCheckAsbitemRepository, | 
				
			|||
            IRepository<RegisterCheckItem> registerCheckItemRepository, | 
				
			|||
            IRepository<Item, Guid> itemRepository, | 
				
			|||
            IRepository<ItemType, Guid> itemTypeRepository) | 
				
			|||
        { | 
				
			|||
            _patientRegisterRepository = patientRegisterRepository; | 
				
			|||
            _cacheService = cacheService; | 
				
			|||
            _registerCheckRepository = registerCheckRepository; | 
				
			|||
            _registerCheckAsbitemRepository = registerCheckAsbitemRepository; | 
				
			|||
            _registerCheckItemRepository = registerCheckItemRepository; | 
				
			|||
            _itemRepository = itemRepository; | 
				
			|||
            _itemTypeRepository = itemTypeRepository; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 查询体检人员基本信息
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        /// <param name="input"></param>
 | 
				
			|||
        /// <returns></returns>
 | 
				
			|||
        [HttpPost("api/Third/ThirdPartyPublicInterface/GetBasicInformationOfMedicalExaminationPersonnel")] | 
				
			|||
        public async Task<BasicInformationOfMedicalExaminationPersonnelDto> GetBasicInformationOfMedicalExaminationPersonnelAsync(PublicPatientRegisterNoInputDto input) | 
				
			|||
        { | 
				
			|||
            if (input == null) | 
				
			|||
            { | 
				
			|||
                throw new UserFriendlyException($"请求参数错误"); | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            var result = new BasicInformationOfMedicalExaminationPersonnelDto(); | 
				
			|||
 | 
				
			|||
            var patientRegisterEnt = await _patientRegisterRepository.FirstOrDefaultAsync(m => m.PatientRegisterNo == input.PatientRegisterNo); | 
				
			|||
            if (patientRegisterEnt != null) | 
				
			|||
            { | 
				
			|||
                result = new BasicInformationOfMedicalExaminationPersonnelDto | 
				
			|||
                { | 
				
			|||
                    BirthDate = patientRegisterEnt.BirthDate != null ? patientRegisterEnt.BirthDate.Value.ToString("yyyy-MM-dd") : "", | 
				
			|||
                    PatientRegisterNo = patientRegisterEnt.PatientRegisterNo, | 
				
			|||
                    CompleteFlag = patientRegisterEnt.CompleteFlag, | 
				
			|||
                    IsMedicalStart = patientRegisterEnt.IsMedicalStart, | 
				
			|||
                    MedicalStartDate = patientRegisterEnt.MedicalStartDate != null ? patientRegisterEnt.MedicalStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", | 
				
			|||
                    PatientName = patientRegisterEnt.PatientName, | 
				
			|||
                    SexName = _cacheService.GetSexNameAsync(patientRegisterEnt.SexId).Result, | 
				
			|||
                    SummaryDoctorName = _cacheService.GetSurnameAsync(patientRegisterEnt.SummaryDoctorId).Result, | 
				
			|||
                    SummaryDate = patientRegisterEnt.SummaryDate != null ? patientRegisterEnt.SummaryDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", | 
				
			|||
                }; | 
				
			|||
            } | 
				
			|||
            else | 
				
			|||
            { | 
				
			|||
                throw new UserFriendlyException($"条码号不正确"); | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            return result; | 
				
			|||
 | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
        /// <summary>
 | 
				
			|||
        /// 查询体检明细项目信息
 | 
				
			|||
        /// </summary>
 | 
				
			|||
        /// <param name="input"></param>
 | 
				
			|||
        /// <returns></returns>
 | 
				
			|||
        [HttpPost("api/Third/ThirdPartyPublicInterface/GetPhysicalExaminationDetailsItemInformation")] | 
				
			|||
        public async Task<List<PhysicalExaminationDetailsItemInformationDto>> GetPhysicalExaminationDetailsItemInformationAsync(PublicPatientRegisterNoInputDto input) | 
				
			|||
        { | 
				
			|||
            if (input == null) | 
				
			|||
            { | 
				
			|||
                throw new UserFriendlyException($"请求参数错误"); | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            var query = from patientRegister in await _patientRegisterRepository.GetQueryableAsync() | 
				
			|||
                        join registerCheck in await _registerCheckRepository.GetQueryableAsync() on patientRegister.Id equals registerCheck.PatientRegisterId | 
				
			|||
                        join registerCheckItem in await _registerCheckItemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckItem.RegisterCheckId | 
				
			|||
                        join item in await _itemRepository.GetQueryableAsync() on registerCheckItem.ItemId equals item.Id | 
				
			|||
                        join itemType in await _itemTypeRepository.GetQueryableAsync() on item.ItemTypeId equals itemType.Id into itemTypeTemp | 
				
			|||
                        from itemTypeHaveEmpty in itemTypeTemp.DefaultIfEmpty() | 
				
			|||
                        where patientRegister.PatientRegisterNo == input.PatientRegisterNo | 
				
			|||
                        select new | 
				
			|||
                        { | 
				
			|||
                            PatientRegisterNo = patientRegister.PatientRegisterNo, | 
				
			|||
                            registerCheckItem, | 
				
			|||
                            ItemName = item.DisplayName, | 
				
			|||
                            ItemTypeName = itemTypeHaveEmpty != null ? itemTypeHaveEmpty.DisplayName : "" | 
				
			|||
 | 
				
			|||
                        }; | 
				
			|||
 | 
				
			|||
            if (query.Count() == 0) | 
				
			|||
            { | 
				
			|||
                throw new UserFriendlyException($"条码号不正确"); | 
				
			|||
            } | 
				
			|||
 | 
				
			|||
            var entList = query.Select(s => new PhysicalExaminationDetailsItemInformationDto | 
				
			|||
            { | 
				
			|||
                ItemName = s.ItemName, | 
				
			|||
                ItemResult = s.registerCheckItem.Result, | 
				
			|||
                ItemTypeName = s.ItemTypeName, | 
				
			|||
                PatientRegisterNo = s.PatientRegisterNo, | 
				
			|||
                ReferenceRangeValue = s.registerCheckItem.ReferenceRangeValue, | 
				
			|||
                Unit = s.registerCheckItem.Unit | 
				
			|||
            }).ToList(); | 
				
			|||
 | 
				
			|||
            return entList; | 
				
			|||
        } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue