| 
															
																@ -4663,13 +4663,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " + 
															 | 
															
															 | 
															
																                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 3 GROUP BY doctor ) a on a.doctor = d.id "; 
															 | 
															
															 | 
															
																                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 3 GROUP BY doctor ) a on a.doctor = d.id "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        Map<String, Object> params = new HashedMap(); 
															 | 
															
															 | 
															
																        Map<String, Object> params = new HashedMap(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (StringUtils.isNotBlank(iswork) &&"0".equalsIgnoreCase(iswork)){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            Date date = new Date(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sql+="LEFT JOIN (SELECT  COUNT(t1.doctor) as workTotal, t1.doctor FROM  wlyy_doctor_work_time t1   WHERE   " + 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    "t1.start_time <=:startTime  AND t1.end_time >=:endTime GROUP BY t1.doctor) dw ON dw.doctor=d.id "; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            params.put("startTime", date); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            params.put("endTime", date); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        Date date = new Date(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        sql+="LEFT JOIN (SELECT  COUNT(t1.doctor) as workTotal, t1.doctor FROM  wlyy_doctor_work_time t1   WHERE   " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                "t1.start_time <=:startTime  AND t1.end_time >=:endTime GROUP BY t1.doctor) dw ON dw.doctor=d.id "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        params.put("startTime", date); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        params.put("endTime", date); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if ("1".equalsIgnoreCase(isAttention)) { 
															 | 
															
															 | 
															
																        if ("1".equalsIgnoreCase(isAttention)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='" + patientid + "' "; 
															 | 
															
															 | 
															
																            sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='" + patientid + "' "; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -4705,7 +4703,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        if (StringUtils.isNotBlank(iswork) && "1".equals(iswork)) { 
															 | 
															
															 | 
															
																        if (StringUtils.isNotBlank(iswork) && "1".equals(iswork)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            logger.info("iswork:" + iswork); 
															 | 
															
															 | 
															
																            logger.info("iswork:" + iswork); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            Date date = new Date(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            sql += " AND (" + 
															 | 
															
															 | 
															
																            sql += " AND (" + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    " EXISTS ( " + 
															 | 
															
															 | 
															
																                    " EXISTS ( " + 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                    " SELECT " + 
															 | 
															
															 | 
															
																                    " SELECT " + 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -4781,7 +4778,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        sql += " and d.del='1' order by d.consult_status DESC,a.total " + consutlSort; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        sql += " and d.del='1' order by dw.workTotal desc,d.consult_status DESC,a.total " + consutlSort; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t"; 
															 | 
															
															 | 
															
																        String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize); 
															 | 
															
															 | 
															
																        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        for (Map<String,Object> map:list){ 
															 | 
															
															 | 
															
																        for (Map<String,Object> map:list){ 
															 |