|  |  | @ -2,14 +2,17 @@ package com.ruoyi.system.service.impl; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.List; |  |  |  | import java.util.List; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.ruoyi.common.utils.DateUtils; |  |  |  | import com.ruoyi.common.utils.DateUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.ruoyi.system.domain.TRecord; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.ruoyi.system.domain.req.PcTDoctorQueryByPageReq; |  |  |  | import com.ruoyi.system.domain.req.PcTDoctorQueryByPageReq; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.ruoyi.system.domain.resp.AppDoctorResp; |  |  |  | import com.ruoyi.system.domain.resp.AppDoctorResp; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.ruoyi.system.domain.resp.PcTDoctorQueryByPageResp; |  |  |  | import com.ruoyi.system.domain.resp.PcTDoctorQueryByPageResp; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.ruoyi.system.mapper.TRecordMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; |  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.stereotype.Service; |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.ruoyi.system.mapper.TDoctorMapper; |  |  |  | import com.ruoyi.system.mapper.TDoctorMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.ruoyi.system.domain.TDoctor; |  |  |  | import com.ruoyi.system.domain.TDoctor; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.ruoyi.system.service.ITDoctorService; |  |  |  | import com.ruoyi.system.service.ITDoctorService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.util.ObjectUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | /** |  |  |  | /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  * 医生信息Service业务层处理 |  |  |  |  * 医生信息Service业务层处理 | 
			
		
	
	
		
		
			
				
					|  |  | @ -23,6 +26,8 @@ public class TDoctorServiceImpl implements ITDoctorService | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Autowired |  |  |  |     @Autowired | 
			
		
	
		
		
			
				
					
					|  |  |  |     private TDoctorMapper tDoctorMapper; |  |  |  |     private TDoctorMapper tDoctorMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Autowired | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private TRecordMapper tRecordMapper; | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * 查询医生信息 |  |  |  |      * 查询医生信息 | 
			
		
	
		
		
			
				
					
					|  |  |  |      *  |  |  |  |      *  | 
			
		
	
	
		
		
			
				
					|  |  | @ -99,8 +104,23 @@ public class TDoctorServiceImpl implements ITDoctorService | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Override |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |     public List<PcTDoctorQueryByPageResp> queryByPage(PcTDoctorQueryByPageReq pcTDoctorQueryByPageReq) { |  |  |  |     public List<PcTDoctorQueryByPageResp> queryByPage(PcTDoctorQueryByPageReq pcTDoctorQueryByPageReq) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Long hospitalId = pcTDoctorQueryByPageReq.getHospitalId(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         TRecord record = new TRecord(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         record.setStatus("1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         record.setHospitalId(hospitalId); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<PcTDoctorQueryByPageResp> pcTDoctorQueryByPageResps = tDoctorMapper.queryByPage(pcTDoctorQueryByPageReq); |  |  |  |         List<PcTDoctorQueryByPageResp> pcTDoctorQueryByPageResps = tDoctorMapper.queryByPage(pcTDoctorQueryByPageReq); | 
			
		
	
		
		
			
				
					
					|  |  |  |         pcTDoctorQueryByPageResps.stream().forEach(a -> a.setCountPatints(tDoctorMapper.queryPatintCountByDoctor(pcTDoctorQueryByPageReq.getHospitalId(),a.getId()))); |  |  |  |         pcTDoctorQueryByPageResps.stream().forEach(a ->{ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             record.setDoctorId(a.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             List<TRecord> tRecords = tRecordMapper.selectTRecordDoctorFirst(record); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //最近一次就诊时间
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (!ObjectUtils.isEmpty(tRecords)){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 a.setLatestTime(tRecords.get(0).getCreateTime()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //患者个数
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             a.setCountPatints(tDoctorMapper.queryPatintCountByDoctor(hospitalId,a.getId())); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //诊断次数
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             a.setCountRecords(tRecords.size()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         }); | 
			
		
	
		
		
			
				
					
					|  |  |  |         return pcTDoctorQueryByPageResps; |  |  |  |         return pcTDoctorQueryByPageResps; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |