|  | @ -1902,9 +1902,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @param orgCode 机构码
 | 
	
		
			
				|  |  |      * @param dept 部门CODE
 | 
	
		
			
				|  |  |      * @param diseaseKey 疾病名称
 | 
	
		
			
				|  |  |      * @param jobTitleNameKey
 | 
	
		
			
				|  |  |      * @param outpatientType
 | 
	
		
			
				|  |  |      * @param keyName
 | 
	
		
			
				|  |  |      * @param workingTime
 | 
	
		
			
				|  |  |      * @param consutlSort
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String orgCode, String dept, String diseaseKey,String doctorNameKey) {
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String orgCode, String dept,
 | 
	
		
			
				|  |  |                                                                           String diseaseKey, String doctorNameKey,
 | 
	
		
			
				|  |  |                                                                           String jobTitleNameKey, String outpatientType,
 | 
	
		
			
				|  |  |                                                                           String keyName, String workingTime, String consutlSort) {
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 " d.id, " +
 | 
	
	
		
			
				|  | @ -1915,11 +1923,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 " d.job_title_code AS jobTitleCode, " +
 | 
	
		
			
				|  |  |                 " d.job_title_name AS jobTitleName," +
 | 
	
		
			
				|  |  |                 " d.charge_type AS chargeType," +
 | 
	
		
			
				|  |  |                 " h.dept_name AS deptName" +
 | 
	
		
			
				|  |  |                 " h.dept_name AS deptName," +
 | 
	
		
			
				|  |  |                 " a.total as consultTotal" +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " base_doctor d " +
 | 
	
		
			
				|  |  |                 " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
 | 
	
		
			
				|  |  |                 " WHERE  " +
 | 
	
		
			
				|  |  |                 " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
 | 
	
		
			
				|  |  |                 " Left join ( select count(id) as total,doctor from wlyy_consult_team GROUP BY doctor ) a on a.doctor = d.id ";
 | 
	
		
			
				|  |  |                 
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(workingTime)){
 | 
	
		
			
				|  |  |             sql+=" JOIN wlyy_doctor_work_time wk on wk.doctor = d.id ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql +=  " WHERE  " +
 | 
	
		
			
				|  |  |                 " h.org_code = '"+orgCode+"'";
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(diseaseKey)){
 | 
	
		
			
				|  |  |             sql+=" AND d.expertise like '%"+diseaseKey+"%'";
 | 
	
	
		
			
				|  | @ -1932,6 +1946,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(dept)){
 | 
	
		
			
				|  |  |             sql+=" AND h.dept_code = '"+dept+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(jobTitleNameKey)){
 | 
	
		
			
				|  |  |             sql+=" AND d.job_title_name AS = '"+jobTitleNameKey+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(outpatientType)){
 | 
	
		
			
				|  |  |             sql+=" AND d.outpatient_type AS = '"+outpatientType+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(keyName)){
 | 
	
		
			
				|  |  |             sql+=" AND (h.dept_name like '%"+keyName+"%' or d.name like '%"+keyName+"%' or d.expertise like '%"+keyName+"%' )";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(workingTime)){
 | 
	
		
			
				|  |  |             sql+=" AND wk.date = '"+workingTime+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         sql += " order by a.total "+ consutlSort;
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         return list;
 |