@ -3,13 +3,16 @@ using Microsoft.AspNetCore.Authorization; 
			
		 
		
	
		
			
				 
				 
				using  Microsoft.AspNetCore.Mvc ;  
				 
				 
				using  Microsoft.AspNetCore.Mvc ;  
			
		 
		
	
		
			
				 
				 
				using  Microsoft.EntityFrameworkCore ;  
				 
				 
				using  Microsoft.EntityFrameworkCore ;  
			
		 
		
	
		
			
				 
				 
				using  Microsoft.VisualBasic ;  
				 
				 
				using  Microsoft.VisualBasic ;  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				using  NPOI.OpenXmlFormats.Wordprocessing ;  
			
		 
		
	
		
			
				 
				 
				using  Shentun.Peis.Enums ;  
				 
				 
				using  Shentun.Peis.Enums ;  
			
		 
		
	
		
			
				 
				 
				using  Shentun.Peis.Models ;  
				 
				 
				using  Shentun.Peis.Models ;  
			
		 
		
	
		
			
				 
				 
				using  System ;  
				 
				 
				using  System ;  
			
		 
		
	
		
			
				 
				 
				using  System.Collections.Generic ;  
				 
				 
				using  System.Collections.Generic ;  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				using  System.Collections.Immutable ;  
			
		 
		
	
		
			
				 
				 
				using  System.Linq ;  
				 
				 
				using  System.Linq ;  
			
		 
		
	
		
			
				 
				 
				using  System.Text ;  
				 
				 
				using  System.Text ;  
			
		 
		
	
		
			
				 
				 
				using  System.Threading.Tasks ;  
				 
				 
				using  System.Threading.Tasks ;  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				using  Volo.Abp.Account ;  
			
		 
		
	
		
			
				 
				 
				using  Volo.Abp.Application.Services ;  
				 
				 
				using  Volo.Abp.Application.Services ;  
			
		 
		
	
		
			
				 
				 
				using  Volo.Abp.Domain.Repositories ;  
				 
				 
				using  Volo.Abp.Domain.Repositories ;  
			
		 
		
	
		
			
				 
				 
				using  Volo.Abp.Identity ;  
				 
				 
				using  Volo.Abp.Identity ;  
			
		 
		
	
	
		
			
				
					
					
					
						
							 
						 
					
				 
				@ -31,6 +34,8 @@ namespace Shentun.Peis.SumSummaryReports 
			
		 
		
	
		
			
				 
				 
				        private  readonly  IRepository < ResultStatus >  _resultStatusRepository ;  
				 
				 
				        private  readonly  IRepository < ResultStatus >  _resultStatusRepository ;  
			
		 
		
	
		
			
				 
				 
				        private  readonly  ISumSummaryReportRepository  _sumSummaryReportRepository ;  
				 
				 
				        private  readonly  ISumSummaryReportRepository  _sumSummaryReportRepository ;  
			
		 
		
	
		
			
				 
				 
				        private  readonly  CacheService  _cacheService ;  
				 
				 
				        private  readonly  CacheService  _cacheService ;  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				        private  readonly  IRepository < RegisterCheckSummary ,  Guid >  _registerCheckSummaryRepository ;  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				        private  readonly  IRepository < Asbitem ,  Guid >  _asbitemRepository ;  
			
		 
		
	
		
			
				 
				 
				        public  SumSummaryReportAppService (  
				 
				 
				        public  SumSummaryReportAppService (  
			
		 
		
	
		
			
				 
				 
				            IRepository < RegisterCheck ,  Guid >  registerCheckRepository ,  
				 
				 
				            IRepository < RegisterCheck ,  Guid >  registerCheckRepository ,  
			
		 
		
	
		
			
				 
				 
				            IRepository < IdentityUser ,  Guid >  identityUserRepository ,  
				 
				 
				            IRepository < IdentityUser ,  Guid >  identityUserRepository ,  
			
		 
		
	
	
		
			
				
					
					
					
						
							 
						 
					
				 
				@ -39,8 +44,9 @@ namespace Shentun.Peis.SumSummaryReports 
			
		 
		
	
		
			
				 
				 
				            IRepository < RegisterCheckAsbitem ,  Guid >  registerAsbitemRepository ,  
				 
				 
				            IRepository < RegisterCheckAsbitem ,  Guid >  registerAsbitemRepository ,  
			
		 
		
	
		
			
				 
				 
				            ISumSummaryReportRepository  sumSummaryReportRepository ,  
				 
				 
				            ISumSummaryReportRepository  sumSummaryReportRepository ,  
			
		 
		
	
		
			
				 
				 
				            IRepository < ResultStatus >  resultStatusRepository ,  
				 
				 
				            IRepository < ResultStatus >  resultStatusRepository ,  
			
		 
		
	
		
			
				 
				 
				            CacheService  cacheService  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				            CacheService  cacheService ,  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				            IRepository < RegisterCheckSummary ,  Guid >  registerCheckSummaryRepository ,  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				            IRepository < Asbitem ,  Guid >  asbitemRepository )  
			
		 
		
	
		
			
				 
				 
				        {  
				 
				 
				        {  
			
		 
		
	
		
			
				 
				 
				            this . _registerCheckRepository  =  registerCheckRepository ;  
				 
				 
				            this . _registerCheckRepository  =  registerCheckRepository ;  
			
		 
		
	
		
			
				 
				 
				            this . _identityUserRepository  =  identityUserRepository ;  
				 
				 
				            this . _identityUserRepository  =  identityUserRepository ;  
			
		 
		
	
	
		
			
				
					
					
					
						
							 
						 
					
				 
				@ -50,6 +56,8 @@ namespace Shentun.Peis.SumSummaryReports 
			
		 
		
	
		
			
				 
				 
				            this . _sumSummaryReportRepository  =  sumSummaryReportRepository ;  
				 
				 
				            this . _sumSummaryReportRepository  =  sumSummaryReportRepository ;  
			
		 
		
	
		
			
				 
				 
				            _cacheService  =  cacheService ;  
				 
				 
				            _cacheService  =  cacheService ;  
			
		 
		
	
		
			
				 
				 
				            _resultStatusRepository  =  resultStatusRepository ;  
				 
				 
				            _resultStatusRepository  =  resultStatusRepository ;  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				            _registerCheckSummaryRepository  =  registerCheckSummaryRepository ;  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				            _asbitemRepository  =  asbitemRepository ;  
			
		 
		
	
		
			
				 
				 
				        }  
				 
				 
				        }  
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
		
			
				 
				 
				        /// <summary>
  
				 
				 
				        /// <summary>
  
			
		 
		
	
	
		
			
				
					
					
					
						
							 
						 
					
				 
				@ -68,7 +76,7 @@ namespace Shentun.Peis.SumSummaryReports 
			
		 
		
	
		
			
				 
				 
				                 . Include ( x  = >  x . RegisterCheckAsbitems )  
				 
				 
				                 . Include ( x  = >  x . RegisterCheckAsbitems )  
			
		 
		
	
		
			
				 
				 
				                 . ThenInclude ( x  = >  x . Asbitem )  
				 
				 
				                 . ThenInclude ( x  = >  x . Asbitem )  
			
		 
		
	
		
			
				 
				 
				                 . ThenInclude ( x  = >  x . ItemType )  
				 
				 
				                 . ThenInclude ( x  = >  x . ItemType )  
			
		 
		
	
		
			
				 
				 
				                 . ThenInclude ( x = > x . MedicalReportType )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                 . ThenInclude ( x   = >   x . MedicalReportType )  
			
		 
		
	
		
			
				 
				 
				                 . Include ( x  = >  x . RegisterCheckSummaries )  
				 
				 
				                 . Include ( x  = >  x . RegisterCheckSummaries )  
			
		 
		
	
		
			
				 
				 
				                 . Include ( x  = >  x . RegisterCheckItems )  
				 
				 
				                 . Include ( x  = >  x . RegisterCheckItems )  
			
		 
		
	
		
			
				 
				 
				                 . ThenInclude ( x  = >  x . Item )  
				 
				 
				                 . ThenInclude ( x  = >  x . Item )  
			
		 
		
	
	
		
			
				
					
					
					
						
							 
						 
					
				 
				@ -89,7 +97,7 @@ namespace Shentun.Peis.SumSummaryReports 
			
		 
		
	
		
			
				 
				 
				                    ItemName  =  sa . Item . DisplayName ,  
				 
				 
				                    ItemName  =  sa . Item . DisplayName ,  
			
		 
		
	
		
			
				 
				 
				                    ItemResult  =  sa . Result ,  
				 
				 
				                    ItemResult  =  sa . Result ,  
			
		 
		
	
		
			
				 
				 
				                    ReferenceRangeValue  =  sa . ReferenceRangeValue ,  
				 
				 
				                    ReferenceRangeValue  =  sa . ReferenceRangeValue ,  
			
		 
		
	
		
			
				 
				 
				                    ResultStatusName  =  ( resultStatus . Where ( o = > o . Id  = =  sa . ResultStatusId ) . FirstOrDefault ( )  = =  null ) ?  "" :  resultStatus . Where ( o  = >  o . Id  = =  sa . ResultStatusId ) . FirstOrDefault ( ) . ReportPrompt ,  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                    ResultStatusName  =  ( resultStatus . Where ( o   = >   o . Id  = =  sa . ResultStatusId ) . FirstOrDefault ( )  = =  null )   ?  ""   :  resultStatus . Where ( o  = >  o . Id  = =  sa . ResultStatusId ) . FirstOrDefault ( ) . ReportPrompt ,  
			
		 
		
	
		
			
				 
				 
				                    Unit  =  sa . Unit  
				 
				 
				                    Unit  =  sa . Unit  
			
		 
		
	
		
			
				 
				 
				                } ) . ToList ( ) ,  
				 
				 
				                } ) . ToList ( ) ,  
			
		 
		
	
		
			
				 
				 
				                Summarys  =  s . RegisterCheckSummaries . Count  >  0  ?  s . RegisterCheckSummaries . Select ( sb  = >  new  DetailedResultsList_Asbitem_Summary  
				 
				 
				                Summarys  =  s . RegisterCheckSummaries . Count  >  0  ?  s . RegisterCheckSummaries . Select ( sb  = >  new  DetailedResultsList_Asbitem_Summary  
			
		 
		
	
	
		
			
				
					
						
							 
						 
					
					
						
							 
						 
					
					
				 
				@ -125,49 +133,29 @@ namespace Shentun.Peis.SumSummaryReports 
			
		 
		
	
		
			
				 
				 
				        [HttpGet("api/app/sumsummaryreport/getitemtypecontrastlist")]  
				 
				 
				        [HttpGet("api/app/sumsummaryreport/getitemtypecontrastlist")]  
			
		 
		
	
		
			
				 
				 
				        public  async  Task < List < ItemTypeContrastListDto > >  GetItemTypeContrastListAsync ( Guid  PatientId )  
				 
				 
				        public  async  Task < List < ItemTypeContrastListDto > >  GetItemTypeContrastListAsync ( Guid  PatientId )  
			
		 
		
	
		
			
				 
				 
				        {  
				 
				 
				        {  
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            List < ItemTypeContrastListDto >  msg  =  new  List < ItemTypeContrastListDto > ( ) ;  
				 
				 
				            List < ItemTypeContrastListDto >  msg  =  new  List < ItemTypeContrastListDto > ( ) ;  
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
		
			
				 
				 
				            var  userlist  =  await  _identityUserRepository . GetListAsync ( ) ;  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            //var entlist = (await _registerCheckRepository.GetDbSetAsync())
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            //     .Include(x => x.RegisterAsbitem.PatientRegister)
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            //     .Include(x => x.RegisterAsbitem.Asbitem.ItemType)
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            //     .Include(x => x.RegisterCheckSummaries)
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            //     .Include(x => x.RegisterCheckItems)
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            //     .ThenInclude(x => x.Item)
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            //     .Where(m => m.RegisterAsbitem.PatientRegister.PatientId == PatientId)
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            //     .ToList();
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            var  entlist  =  ( await  _registerCheckRepository . GetDbSetAsync ( ) )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                       . Include ( x  = >  x . RegisterCheckAsbitems )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                       . ThenInclude ( x  = >  x . Asbitem )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                       . ThenInclude ( x  = >  x . ItemType )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                       . Include ( x  = >  x . RegisterCheckAsbitems )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                       . ThenInclude ( x  = >  x . PatientRegister )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                       . Include ( x  = >  x . RegisterCheckSummaries )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                       . Include ( x  = >  x . RegisterCheckItems )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                       . ThenInclude ( x  = >  x . Item )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                       . Where ( m  = >  m . RegisterCheckAsbitems . First ( ) . PatientRegister . PatientId  = =  PatientId )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                       . ToList ( ) ;  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            ////查询所有项目类别
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            //var ItemTypeNames = new HashSet<string>(entlist.Select(s => s.RegisterAsbitem.Asbitem.ItemType.DisplayName).ToList()).ToList();
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            //以registercheck表为主
  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            var  registercheckList  =  entlist . Select ( s  = >  new  ItemTypeContrastList_Result  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            {  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                ItemTypeName  =  string . Join ( "|" ,  s . RegisterCheckAsbitems . Select ( rs  = >  rs . Asbitem . ItemType . DisplayName ) . ToList ( ) ) ,  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                RegisterDate  =  DataHelper . ConversionDateToString ( s . RegisterCheckAsbitems . First ( ) . PatientRegister . CreationTime ) ,  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                PatientRegisterId  =  s . RegisterCheckAsbitems . First ( ) . PatientRegisterId ,  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                Summarys  =  string . Join ( "|" ,  s . RegisterCheckAsbitems . Select ( rs  = >  rs . Asbitem . DisplayName ) . ToList ( ) )  +  ":"  +  string . Join ( "," ,  s . RegisterCheckSummaries . Select ( sb  = >  sb . Summary ) . ToList ( ) )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				            } ) . ToList ( ) ;  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				            var  query  =  from  a  in  await  _patientRegisterRepository . GetQueryableAsync ( )  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        join  b  in  await  _registerCheckRepository . GetQueryableAsync ( )  on  a . Id  equals  b . PatientRegisterId  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        join  c  in  await  _registerAsbitemRepository . GetQueryableAsync ( )  on  b . Id  equals  c . RegisterCheckId  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        join  d  in  await  _asbitemRepository . GetQueryableAsync ( )  on  c . AsbitemId  equals  d . Id  into  dd  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        from  ad  in  dd . DefaultIfEmpty ( )  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        join  e  in  await  _itemTypeRepository . GetQueryableAsync ( )  on  ad . ItemTypeId  equals  e . Id  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        join  f  in  await  _registerCheckSummaryRepository . GetQueryableAsync ( )  on  b . Id  equals  f . RegisterCheckId  into  ff  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        from  af  in  ff . DefaultIfEmpty ( )  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        where  a . PatientId  = =  PatientId  & &  a . CompleteFlag  ! =  PatientRegisterCompleteFlag . PreRegistration  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        select  new  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        {  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                            RegisterDate  =  a . CreationTime ,  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                            PatientRegisterId  =  a . Id ,  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                            ItemTypeName  =  e . DisplayName ,  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                            Summary  =  af  ! =  null  ?  af . Summary  :  ""  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                        } ;  
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
		
			
				 
				 
				            var  grouplist  =  registercheckList . GroupBy ( g  = >  new  {  g . PatientRegisterId ,  g . ItemTypeName  } ) ;  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				            var  grouplist  =  query . ToList ( ) . GroupBy ( g  = >  new  {  g . PatientRegisterId ,  g . ItemTypeName  } ) ;  
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
		
			
				 
				 
				            foreach  ( var  g  in  grouplist )  
				 
				 
				            foreach  ( var  g  in  grouplist )  
			
		 
		
	
		
			
				 
				 
				            {  
				 
				 
				            {  
			
		 
		
	
	
		
			
				
					
					
					
						
							 
						 
					
				 
				@ -176,8 +164,8 @@ namespace Shentun.Peis.SumSummaryReports 
			
		 
		
	
		
			
				 
				 
				                {  
				 
				 
				                {  
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
		
			
				 
				 
				                    ItemTypeName  =  glist . FirstOrDefault ( ) . ItemTypeName ,  
				 
				 
				                    ItemTypeName  =  glist . FirstOrDefault ( ) . ItemTypeName ,  
			
		 
		
	
		
			
				 
				 
				                    RegisterDate  =  glist . FirstOrDefault ( ) . RegisterDate ,  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				                    Summarys  =  string . Join ( "\n" ,  glist . Select ( s  = >  s . Summarys  ) . ToList ( ) )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                    RegisterDate  =  DataHelper . ConversionDateToString ( glist . FirstOrDefault ( ) . RegisterDate ) ,  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                    Summarys  =  string . Join ( "\n" ,  glist . Select ( s  = >  s . Summary ) . ToList ( ) )  
			
		 
		
	
		
			
				 
				 
				                } ;  
				 
				 
				                } ;  
			
		 
		
	
		
			
				 
				 
				                msg . Add ( resultlist ) ;  
				 
				 
				                msg . Add ( resultlist ) ;  
			
		 
		
	
		
			
				 
				 
				            }  
				 
				 
				            }  
			
		 
		
	
	
		
			
				
					
						
							 
						 
					
					
						
							 
						 
					
					
				 
				@ -205,7 +193,8 @@ namespace Shentun.Peis.SumSummaryReports 
			
		 
		
	
		
			
				 
				 
				                 . ThenInclude ( x  = >  x . SumSummaryContents )  
				 
				 
				                 . ThenInclude ( x  = >  x . SumSummaryContents )  
			
		 
		
	
		
			
				 
				 
				                 . Include ( x  = >  x . SumSuggestionHeaders )  
				 
				 
				                 . Include ( x  = >  x . SumSuggestionHeaders )  
			
		 
		
	
		
			
				 
				 
				                 . ThenInclude ( x  = >  x . SumSuggestionContents )  
				 
				 
				                 . ThenInclude ( x  = >  x . SumSuggestionContents )  
			
		 
		
	
		
			
				 
				 
				                 . Where ( m  = >  m . PatientId  = =  PatientId  & &  ( m . SumSummaryHeaders . Count  >  0  | |  m . SumSuggestionHeaders . Count  >  0 ) )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                 . Where ( m  = >  m . PatientId  = =  PatientId  & &  ( m . SumSummaryHeaders . Count  >  0  | |  m . SumSuggestionHeaders . Count  >  0 )  
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				                 & &  m . CompleteFlag  ! =  PatientRegisterCompleteFlag . PreRegistration )  
			
		 
		
	
		
			
				 
				 
				                 . ToList ( ) ;  
				 
				 
				                 . ToList ( ) ;  
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
	
		
			
				
					
						
							 
						 
					
					
						
							 
						 
					
					
				 
				@ -240,7 +229,7 @@ namespace Shentun.Peis.SumSummaryReports 
			
		 
		
	
		
			
				 
				 
				            . Include ( x  = >  x . Asbitem )  
				 
				 
				            . Include ( x  = >  x . Asbitem )  
			
		 
		
	
		
			
				 
				 
				            . Include ( x  = >  x . RegisterCheck )  
				 
				 
				            . Include ( x  = >  x . RegisterCheck )  
			
		 
		
	
		
			
				 
				 
				            . Include ( x  = >  x . PatientRegister )  
				 
				 
				            . Include ( x  = >  x . PatientRegister )  
			
		 
		
	
		
			
				 
				 
				            . Where ( m  = >  m . PatientRegister . PatientId  = =  PatientId )  
				 
				 
				 
			
		 
		
	
		
			
				 
				 
				 
				 
				 
				            . Where ( m  = >  m . PatientRegister . PatientId  = =  PatientId  & &  m . PatientRegister . CompleteFlag  ! =  PatientRegisterCompleteFlag . PreRegistration  )  
			
		 
		
	
		
			
				 
				 
				            . ToList ( ) ;  
				 
				 
				            . ToList ( ) ;  
			
		 
		
	
		
			
				 
				 
				
 
				 
				 
				
 
			
		 
		
	
		
			
				 
				 
				            var  grouplist  =  entlist . GroupBy ( o  = >  o . AsbitemId ) ;  
				 
				 
				            var  grouplist  =  entlist . GroupBy ( o  = >  o . AsbitemId ) ;