| 
					
				 | 
			
			
				@ -310,26 +310,25 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //已入学未入学统一从base_doctor_patient_tmp该表查询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //未入学:发起咨询的幼儿列表、发起上门辅导的幼儿列表、已报名但是未录取的幼儿 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public PageEnvelop getTeacherChildren(String doctor,int searchType,String name,int page,int size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        page = page>0?page-1:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //未入学 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql0 = "select * from  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " (select Distinct patient,'1' as type from base_doctor_patient_tmp where type=1 and doctor_code='"+doctor+"' and del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql0 = "select Distinct patient,'1' as type from base_doctor_patient_tmp where type=1 and doctor_code='"+doctor+"' and del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " UNION " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select Distinct patient,'2' as type from base_doctor_patient_tmp where type=2 and doctor_code='"+doctor+"' and del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " UNION " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select Distinct patient,'4' as type from base_doctor_patient_tmp where type=4 and doctor_code='"+doctor+"' and del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " UNION " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select tmp.patient,'3' as type from base_doctor_patient_tmp tmp INNER JOIN base_doctor_hospital dh on dh.org_code = tmp.doctor_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and dh.del =1 where tmp.type=3 and dh.doctor_code='"+doctor+"' and tmp.del=1 and tmp.`status`=0)B where  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " not EXISTS (select DISTINCT rsr.patient  from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and org.del=1  INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=B.patient and " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 2 )"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select tmp.patient,'3' as type from base_doctor_patient_tmp tmp INNER JOIN base_doctor_hospital dh on dh.org_code = tmp.org_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and dh.del =1 where tmp.type=3 and dh.doctor_code='"+doctor+"' and tmp.del=1 and tmp.`status`=0 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //已入学 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql1=" select DISTINCT rsr.patient,null as type from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "and rsr.del<>0  and rsr.`status` = 2   "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql1=" select tmp.patient,'3' as type from base_doctor_patient_tmp tmp INNER JOIN base_doctor_hospital dh on dh.org_code = tmp.org_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and dh.del =1 where tmp.type=3 and dh.doctor_code='"+doctor+"' and tmp.del=1 and tmp.`status`=0   "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select p.id,p.name,p.photo,p.sex,p.idcard,p.openid,p.mobile,group_concat(tmp.type) type,group_concat( pd.category_code) deviceType from ( {sqlReplace} )tmp " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " Inner JOIN base_patient p on tmp.patient  = p.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2 GROUP BY p.id limit "+page*size+","+size; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -383,22 +382,18 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Long> getTeacherChildrenCount(String doctor){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Long> result = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //未入学 (发起咨询的幼儿列表,发起上门辅导的幼儿列表,已报名但是未录取的幼儿) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql0 = "select * from  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " (select Distinct patient from base_doctor_patient_tmp where type=1 and doctor_code='"+doctor+"' and del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //未入学 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql0 = "select Distinct patient,'1' as type from base_doctor_patient_tmp where type=1 and doctor_code='"+doctor+"' and del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " UNION " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select Distinct patient from base_doctor_patient_tmp where type=2 and doctor_code='"+doctor+"' and del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select Distinct patient,'2' as type from base_doctor_patient_tmp where type=2 and doctor_code='"+doctor+"' and del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " UNION " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select Distinct patient from base_doctor_patient_tmp where type=4 and doctor_code='"+doctor+"' and del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select Distinct patient,'4' as type from base_doctor_patient_tmp where type=4 and doctor_code='"+doctor+"' and del=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " UNION " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select tmp.patient from base_doctor_patient_tmp tmp INNER JOIN base_doctor_hospital dh on dh.org_code = tmp.doctor_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and dh.del =1 where tmp.type=3 and dh.doctor_code='"+doctor+"' and tmp.del=1 and tmp.`status`=0)B where  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " not EXISTS (select DISTINCT rsr.patient  from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and org.del=1  INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where rsr.patient=B.patient and " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " dh.doctor_code='"+doctor+"'   and rsr.del<>0  and rsr.`status` = 2 )"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " select tmp.patient,'3' as type from base_doctor_patient_tmp tmp INNER JOIN base_doctor_hospital dh on dh.org_code = tmp.org_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and dh.del =1 where tmp.type=3 and dh.doctor_code='"+doctor+"' and tmp.del=1 and tmp.`status`=0 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //已入学 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql1=" select DISTINCT rsr.patient from base_recruit_students_record rsr INNER JOIN  base_org org on rsr.org_code = org.`code` " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "and org.del=1 INNER JOIN base_doctor_hospital dh on rsr.org_code = dh.org_code and dh.del =1  where dh.doctor_code='"+doctor+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "and rsr.del<>0  and rsr.`status` = 2   "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql1=" select tmp.patient,'3' as type from base_doctor_patient_tmp tmp INNER JOIN base_doctor_hospital dh on dh.org_code = tmp.org_code " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " and dh.del =1 where tmp.type=3 and dh.doctor_code='"+doctor+"' and tmp.del=1 and tmp.`status`=0   "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlcpunt = "select count(Distinct p.id) from ( {sqlReplace} )tmp Inner JOIN base_patient p on tmp.patient  = p.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " LEFT JOIN wlyy_patient_device pd on pd.`user`=p.id and pd.category_code BETWEEN 1 and 2  "; 
			 |