| 
					
					
					
				 | 
				@ -1,8 +1,10 @@ | 
			
		
		
	
		
			
				 | 
				 | 
				using Microsoft.AspNetCore.Authorization; | 
				 | 
				 | 
				using Microsoft.AspNetCore.Authorization; | 
			
		
		
	
		
			
				 | 
				 | 
				using Microsoft.AspNetCore.Mvc; | 
				 | 
				 | 
				using Microsoft.AspNetCore.Mvc; | 
			
		
		
	
		
			
				 | 
				 | 
				using Microsoft.EntityFrameworkCore; | 
				 | 
				 | 
				using Microsoft.EntityFrameworkCore; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				using Microsoft.Extensions.Configuration; | 
			
		
		
	
		
			
				 | 
				 | 
				using NPOI.POIFS.Properties; | 
				 | 
				 | 
				using NPOI.POIFS.Properties; | 
			
		
		
	
		
			
				 | 
				 | 
				using NUglify.Helpers; | 
				 | 
				 | 
				using NUglify.Helpers; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				using Shentun.Peis.AsbitemGuides; | 
			
		
		
	
		
			
				 | 
				 | 
				using Shentun.Peis.Enums; | 
				 | 
				 | 
				using Shentun.Peis.Enums; | 
			
		
		
	
		
			
				 | 
				 | 
				using Shentun.Peis.LisRequests; | 
				 | 
				 | 
				using Shentun.Peis.LisRequests; | 
			
		
		
	
		
			
				 | 
				 | 
				using Shentun.Peis.Models; | 
				 | 
				 | 
				using Shentun.Peis.Models; | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -34,6 +36,7 @@ namespace Shentun.Peis.PrintReports | 
			
		
		
	
		
			
				 | 
				 | 
				    public class PrintReportAppService : ApplicationService | 
				 | 
				 | 
				    public class PrintReportAppService : ApplicationService | 
			
		
		
	
		
			
				 | 
				 | 
				    { | 
				 | 
				 | 
				    { | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository; | 
				 | 
				 | 
				        private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private readonly IRepository<CustomerOrgGroup, Guid> _customerOrgGroupRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<Patient, Guid> _patientRepository; | 
				 | 
				 | 
				        private readonly IRepository<Patient, Guid> _patientRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; | 
				 | 
				 | 
				        private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<RegisterCheckAsbitem, Guid> _registerCheckAsbitemRepository; | 
				 | 
				 | 
				        private readonly IRepository<RegisterCheckAsbitem, Guid> _registerCheckAsbitemRepository; | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -42,6 +45,7 @@ namespace Shentun.Peis.PrintReports | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<RegisterCheckPicture, Guid> _registerCheckPictureRepository; | 
				 | 
				 | 
				        private readonly IRepository<RegisterCheckPicture, Guid> _registerCheckPictureRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<Asbitem, Guid> _asbitemRepository; | 
				 | 
				 | 
				        private readonly IRepository<Asbitem, Guid> _asbitemRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<Item, Guid> _itemRepository; | 
				 | 
				 | 
				        private readonly IRepository<Item, Guid> _itemRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private readonly IRepository<MedicalPackage, Guid> _medicalPackageRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<MedicalReportType, char> _medicalReportTypeRepository; | 
				 | 
				 | 
				        private readonly IRepository<MedicalReportType, char> _medicalReportTypeRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<ItemType, Guid> _itemTypeRepository; | 
				 | 
				 | 
				        private readonly IRepository<ItemType, Guid> _itemTypeRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<LisRequest, Guid> _lisRequestRepository; | 
				 | 
				 | 
				        private readonly IRepository<LisRequest, Guid> _lisRequestRepository; | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -54,7 +58,9 @@ namespace Shentun.Peis.PrintReports | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<IdentityUser, Guid> _identityUserRepository; | 
				 | 
				 | 
				        private readonly IRepository<IdentityUser, Guid> _identityUserRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<SumSuggestionHeader, Guid> _sumSuggestionHeaderRepository; | 
				 | 
				 | 
				        private readonly IRepository<SumSuggestionHeader, Guid> _sumSuggestionHeaderRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository; | 
				 | 
				 | 
				        private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IOrganizationUnitRepository _organizationUnitRepository; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private readonly IRepository<PersonnelType, Guid> _personnelTypeRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        //private readonly IOrganizationUnitRepository _organizationUnitRepository;
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private readonly IRepository<OrganizationUnit, Guid> _organizationUnitRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IPatientRegisterGuideReportRepository _patientRegisterGuideReportRepository; | 
				 | 
				 | 
				        private readonly IPatientRegisterGuideReportRepository _patientRegisterGuideReportRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly ILisRequestReportRepository _lisRequestReportRepository; | 
				 | 
				 | 
				        private readonly ILisRequestReportRepository _lisRequestReportRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly ICheckRequestNoReportRepository _checkRequestNoReportRepository; | 
				 | 
				 | 
				        private readonly ICheckRequestNoReportRepository _checkRequestNoReportRepository; | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -63,9 +69,12 @@ namespace Shentun.Peis.PrintReports | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly CacheService _cacheService; | 
				 | 
				 | 
				        private readonly CacheService _cacheService; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly LisRequestManager _lisRequestManager; | 
				 | 
				 | 
				        private readonly LisRequestManager _lisRequestManager; | 
			
		
		
	
		
			
				 | 
				 | 
				        private readonly IUnitOfWorkManager _unitOfWorkManager; | 
				 | 
				 | 
				        private readonly IUnitOfWorkManager _unitOfWorkManager; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private static AsbitemGuideManager _asbitemGuideManager; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private readonly IConfiguration _configuration; | 
			
		
		
	
		
			
				 | 
				 | 
				        public PrintReportAppService( | 
				 | 
				 | 
				        public PrintReportAppService( | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<Patient, Guid> patientRepository, | 
				 | 
				 | 
				            IRepository<Patient, Guid> patientRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<CustomerOrg, Guid> customerOrgRepository, | 
				 | 
				 | 
				            IRepository<CustomerOrg, Guid> customerOrgRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            IRepository<CustomerOrgGroup, Guid> customerOrgGroupRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<PatientRegister, Guid> patientRegisterRepository, | 
				 | 
				 | 
				            IRepository<PatientRegister, Guid> patientRegisterRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<RegisterCheckAsbitem, Guid> registerCheckAsbitemRepository, | 
				 | 
				 | 
				            IRepository<RegisterCheckAsbitem, Guid> registerCheckAsbitemRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<RegisterCheckItem> registerCheckItemRepository, | 
				 | 
				 | 
				            IRepository<RegisterCheckItem> registerCheckItemRepository, | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -73,6 +82,7 @@ namespace Shentun.Peis.PrintReports | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<RegisterCheckPicture, Guid> registerCheckPictureRepository, | 
				 | 
				 | 
				            IRepository<RegisterCheckPicture, Guid> registerCheckPictureRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<Asbitem, Guid> asbitemRepository, | 
				 | 
				 | 
				            IRepository<Asbitem, Guid> asbitemRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<Item, Guid> itemRepository, | 
				 | 
				 | 
				            IRepository<Item, Guid> itemRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            IRepository<MedicalPackage, Guid> medicalPackageRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<MedicalReportType, char> medicalReportTypeRepository, | 
				 | 
				 | 
				            IRepository<MedicalReportType, char> medicalReportTypeRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<ItemType, Guid> itemTypeRepository, | 
				 | 
				 | 
				            IRepository<ItemType, Guid> itemTypeRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<LisRequest, Guid> lisRequestRepository, | 
				 | 
				 | 
				            IRepository<LisRequest, Guid> lisRequestRepository, | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -80,20 +90,25 @@ namespace Shentun.Peis.PrintReports | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<SampleContainer, Guid> sampleContainerRepository, | 
				 | 
				 | 
				            IRepository<SampleContainer, Guid> sampleContainerRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<SampleType, Guid> sampleTypeRepository, | 
				 | 
				 | 
				            IRepository<SampleType, Guid> sampleTypeRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<Sex> sexRegisterRepository, | 
				 | 
				 | 
				            IRepository<Sex> sexRegisterRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            IRepository<PersonnelType,Guid> personnelTypeRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<ResultStatus> resultStatusRepository, | 
				 | 
				 | 
				            IRepository<ResultStatus> resultStatusRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<SumSummaryHeader, Guid> sumSummaryHeaderRepository, | 
				 | 
				 | 
				            IRepository<SumSummaryHeader, Guid> sumSummaryHeaderRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<IdentityUser, Guid> identityUserRepository, | 
				 | 
				 | 
				            IRepository<IdentityUser, Guid> identityUserRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<SumSuggestionHeader, Guid> sumSuggestionHeaderRepository, | 
				 | 
				 | 
				            IRepository<SumSuggestionHeader, Guid> sumSuggestionHeaderRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IRepository<RegisterCheck, Guid> registerCheckRepository, | 
				 | 
				 | 
				            IRepository<RegisterCheck, Guid> registerCheckRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IOrganizationUnitRepository organizationUnitRepository, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            //IOrganizationUnitRepository organizationUnitRepository,
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            IRepository<OrganizationUnit, Guid> organizationUnitRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IPatientRegisterGuideReportRepository patientRegisterGuideReportRepository, | 
				 | 
				 | 
				            IPatientRegisterGuideReportRepository patientRegisterGuideReportRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            ILisRequestReportRepository lisRequestReportRepository, | 
				 | 
				 | 
				            ILisRequestReportRepository lisRequestReportRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            ICheckRequestNoReportRepository checkRequestNoReportRepository, | 
				 | 
				 | 
				            ICheckRequestNoReportRepository checkRequestNoReportRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				            IChargeReportRepository chargeReportRepository, | 
				 | 
				 | 
				            IChargeReportRepository chargeReportRepository, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				             | 
			
		
		
	
		
			
				 | 
				 | 
				           SysParmValueManager sysParmValueManager, | 
				 | 
				 | 
				           SysParmValueManager sysParmValueManager, | 
			
		
		
	
		
			
				 | 
				 | 
				           CacheService cacheService, | 
				 | 
				 | 
				           CacheService cacheService, | 
			
		
		
	
		
			
				 | 
				 | 
				           LisRequestManager lisRequestManager, | 
				 | 
				 | 
				           LisRequestManager lisRequestManager, | 
			
		
		
	
		
			
				 | 
				 | 
				           IUnitOfWorkManager unitOfWorkManager | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				           IUnitOfWorkManager unitOfWorkManager, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				           AsbitemGuideManager asbitemGuideManager, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				           IConfiguration configuration | 
			
		
		
	
		
			
				 | 
				 | 
				            ) | 
				 | 
				 | 
				            ) | 
			
		
		
	
		
			
				 | 
				 | 
				        { | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				            this._customerOrgRepository = customerOrgRepository; | 
				 | 
				 | 
				            this._customerOrgRepository = customerOrgRepository; | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -126,6 +141,12 @@ namespace Shentun.Peis.PrintReports | 
			
		
		
	
		
			
				 | 
				 | 
				            _lisRequestManager = lisRequestManager; | 
				 | 
				 | 
				            _lisRequestManager = lisRequestManager; | 
			
		
		
	
		
			
				 | 
				 | 
				            _unitOfWorkManager = unitOfWorkManager; | 
				 | 
				 | 
				            _unitOfWorkManager = unitOfWorkManager; | 
			
		
		
	
		
			
				 | 
				 | 
				            _patientRepository = patientRepository; | 
				 | 
				 | 
				            _patientRepository = patientRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _asbitemGuideManager = asbitemGuideManager; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _customerOrgGroupRepository = customerOrgGroupRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _medicalPackageRepository = medicalPackageRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _personnelTypeRepository = personnelTypeRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _configuration = configuration; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _organizationUnitRepository = organizationUnitRepository; | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -137,7 +158,72 @@ namespace Shentun.Peis.PrintReports | 
			
		
		
	
		
			
				 | 
				 | 
				        [HttpPost("api/app/PrintReport/getpatientregisterguidereport")] | 
				 | 
				 | 
				        [HttpPost("api/app/PrintReport/getpatientregisterguidereport")] | 
			
		
		
	
		
			
				 | 
				 | 
				        public async Task<PatientRegisterGuideReportDto> GetPatientRegisterGuideReportAsync(Guid PatientRegisterId) | 
				 | 
				 | 
				        public async Task<PatientRegisterGuideReportDto> GetPatientRegisterGuideReportAsync(Guid PatientRegisterId) | 
			
		
		
	
		
			
				 | 
				 | 
				        { | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				            return await _patientRegisterGuideReportRepository.GetPatientRegisterGuideReportAsync(PatientRegisterId); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            //return await _patientRegisterGuideReportRepository.GetPatientRegisterGuideReportAsync(PatientRegisterId);
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var apiUrl = _configuration.GetValue<string>("HostUrl:ApiUrl") + "/"; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var patientRegister = await _patientRegisterRepository.GetAsync(o=>o.Id ==  PatientRegisterId); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            Guid medicalCenterId = patientRegister.MedicalCenterId; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            #region 系统参数配置
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var MedicalCenterAddress = await _sysParmValueManager.GetSysParmValueAsync(medicalCenterId, "medical_center_address"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var MedicalCenterFax = await _sysParmValueManager.GetSysParmValueAsync(medicalCenterId, "medical_center_fax"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var MedicalCenterTelphone = await _sysParmValueManager.GetSysParmValueAsync(medicalCenterId, "medical_center_telphone"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            #endregion
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var customerOrgList = await _customerOrgRepository.GetListAsync(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var query = from a in await _patientRegisterRepository.GetQueryableAsync() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        join b in await _sexRegisterRepository.GetQueryableAsync() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        on a.SexId equals b.Id | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        join c in await _customerOrgGroupRepository.GetQueryableAsync()  | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        on a.CustomerOrgGroupId equals c.Id into cc | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        from ac in cc.DefaultIfEmpty() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        join d in  await _medicalPackageRepository.GetQueryableAsync() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        on a.MedicalPackageId equals d.Id into dd | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        from ad in dd.DefaultIfEmpty() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        join e in await _patientRepository.GetQueryableAsync()  | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        on a.PatientId equals e.Id | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        join f in await _personnelTypeRepository.GetQueryableAsync()  | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        on a.PersonnelTypeId equals f.Id into ff | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        from af in ff.DefaultIfEmpty() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        join g in await _organizationUnitRepository.GetQueryableAsync() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        on a.MedicalCenterId equals g.Id into gg | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        from ag in gg.DefaultIfEmpty() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        where (a.Id == PatientRegisterId) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        select new PatientRegisterGuideReportDto | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            Age = a.Age, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            PatientRegisterId = a.Id, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            CustomerOrgGroupName = ac.DisplayName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            CustomerOrgName = _cacheService.GetTopCustomerOrgNameAsync( a.CustomerOrgId).Result, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            CustomerOrgShortName = _cacheService.GetTopCustomerOrgAsync(a.CustomerOrgId).Result.ShortName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            DepartmentName = _cacheService.GetCustomerOrgNameAsync( a.CustomerOrgId).Result, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            IdNo = e.IdNo, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            JobCardNo = a.JobCardNo, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MedicalCardNo = a.MedicalCardNo, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MedicalCenterAddress = MedicalCenterAddress, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MedicalCenterFax = MedicalCenterFax, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MedicalCenterTelphone = MedicalCenterTelphone, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MedicalPackageName = ad.DisplayName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MedicalTimes = a.MedicalTimes, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MobileTelephone = e.MobileTelephone, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            PatientName = a.PatientName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            PatientNo = e.PatientNo, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            PatientRegisterNo = a.PatientRegisterNo, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            PersonnelTypeName = af.DisplayName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            SexName = b.DisplayName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            // Photo = string.IsNullOrEmpty(a.Photo) ? "" : ImageHelper.GetImageBase64StringAsync( a.Photo),
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            Photo = string.IsNullOrEmpty(a.Photo) ? "" : apiUrl + a.Photo, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MedicalStartDate = Convert.ToDateTime(a.MedicalStartDate.ToString()).ToString("yyyy-MM-dd"), | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            OrganizationUnitId = a.MedicalCenterId, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            OrganizationUnitName = ag.DisplayName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            Detail = PatientRegisterGuideAsbitem(a.Id, medicalCenterId, a.SexId), | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            HisPatientId = a.HisPatientId | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        }; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            return query.FirstOrDefault(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -693,5 +779,42 @@ namespace Shentun.Peis.PrintReports | 
			
		
		
	
		
			
				 | 
				 | 
				            } | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				            return MedicalReportMedicalReportTypeDtos; | 
				 | 
				 | 
				            return MedicalReportMedicalReportTypeDtos; | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        private  List<PatientRegisterGuideReport_Detail> PatientRegisterGuideAsbitem(Guid PatientRegisterId, Guid medicalCenterId, char SexId) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            var entlist = _registerCheckAsbitemRepository.GetQueryableAsync().Result | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            .Include(x => x.Asbitem) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            .Include(x => x.Asbitem.ItemType) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            .Include(x => x.Asbitem.ItemType.GuidType) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            .Where(m => m.PatientRegisterId == PatientRegisterId && m.Asbitem.IsCheck == 'Y') | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            .Select(s => new PatientRegisterGuideReport_Asbitem_Temp | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                AsbitemName = s.Asbitem.DisplayName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                AsbitemGuide = _asbitemGuideManager.GetAsbitemGuideConvertSexId(medicalCenterId, s.AsbitemId, SexId), | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                AsbitemDisplayOrder = s.Asbitem.DisplayOrder, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                GuideDisplayOrder = s.Asbitem.ItemType.GuidType.DisplayOrder, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                GuideName = s.Asbitem.ItemType.GuidType.DisplayName | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            }) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            .OrderBy(o => o.GuideDisplayOrder) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            .GroupBy(g => new { g.GuideName, g.GuideDisplayOrder }) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            .Select(s => new PatientRegisterGuideReport_Detail | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                GuideName = s.Key.GuideName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                AsbitemCount = s.Count(), | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                DisplayOrder = s.Key.GuideDisplayOrder, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                Detail_Name = s.ToList().Select(ss => new PatientRegisterGuideReport_Detail_Asbitem | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    AsbitemName = ss.AsbitemName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    AsbitemGuide = ss.AsbitemGuide, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    DisplayOrder = ss.AsbitemDisplayOrder | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                }).OrderBy(o => o.DisplayOrder).ToList() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            }).OrderBy(o => o.DisplayOrder).ToList(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            return entlist; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				    } | 
				 | 
				 | 
				    } | 
			
		
		
	
		
			
				 | 
				 | 
				} | 
				 | 
				 | 
				} |