|  | @ -234,7 +234,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                 "  t.label_type = '8' " +
 | 
	
		
			
				|  |  |                 " AND t.`status` = '1' " +
 | 
	
		
			
				|  |  |                 " ) h ON h.patient = lb.patient " +
 | 
	
		
			
				|  |  |                 " WHERE s.doctor ='"+doctor+ " AND h.label='"+labelCode+"' AND s.status >=0  AND s.sign_status >0"+
 | 
	
		
			
				|  |  |                 " WHERE ( s.doctor ='"+doctor+"' OR s.health_doctor='"+doctor+"') AND s.status >=0  AND s.sign_status >0"+
 | 
	
		
			
				|  |  |                 " LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         if("7".equals(labelType)){
 | 
	
	
		
			
				|  | @ -252,9 +252,9 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |                     "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
 | 
	
		
			
				|  |  |                     "JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+
 | 
	
		
			
				|  |  |                     "JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE " +
 | 
	
		
			
				|  |  |                     "LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=" +labelType+" AND d.`status`=1" +
 | 
	
		
			
				|  |  |                     " WHERE a.sign_status> 0 AND a.`status`>=0 AND a.doctor='"+doctor+"'"+
 | 
	
		
			
				|  |  |                     " LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |                     "LEFT JOIN "+basedb+".wlyy_sign_patient_label_info d ON a.patient=d.patient AND d.label_type=8 AND d.`status`=1" +
 | 
	
		
			
				|  |  |                     " WHERE a.sign_status> 0 AND a.`status`>=0 AND a.doctor='"+doctor+"' OR a.health_assistant= '"+doctor+
 | 
	
		
			
				|  |  |                     "' LIMIT "+(page-1)*size+","+size;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -582,6 +582,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public MixEnvelop findPatientSignSpecialist(String patient){
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 " r.id AS relationCode, " +
 | 
	
		
			
				|  |  |                 " r.patient, " +
 | 
	
		
			
				|  |  |                 " r.team_code AS teamCode," +
 | 
	
		
			
				|  |  |                 " r.patient_name AS patientName, " +
 | 
	
	
		
			
				|  | @ -780,7 +781,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 专科-模糊搜索注册居民
 | 
	
		
			
				|  |  |      * 专科-模糊搜索注册居民(未与该医生所在团队医生签约的居民)
 | 
	
		
			
				|  |  |      * @param doctorCode
 | 
	
		
			
				|  |  |      * @param keywords
 | 
	
		
			
				|  |  |      */
 | 
	
	
		
			
				|  | @ -792,11 +793,19 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |             whereSql+=" and (p.name like '%"+keywords+"%' or p.idcard like '%"+keywords+"%' or p.mobile like '%"+keywords+"%') ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String centerSql =" from "+basedb+".wlyy_patient p  " +
 | 
	
		
			
				|  |  |                 " WHERE p.code not in (SELECT r.patient FROM  wlyy_specialist.wlyy_specialist_patient_relation r WHERE r.sign_status = '1' and doctor='"+doctorCode+"')"+" AND p.openid IS NOT NULL "+
 | 
	
		
			
				|  |  |                 " WHERE p.code not in (SELECT r.patient FROM  wlyy_specialist.wlyy_specialist_patient_relation r WHERE r.sign_status = '1' " +
 | 
	
		
			
				|  |  |                 " AND doctor in (SELECT m.doctor_code FROM  "+basedb+".wlyy_admin_team_member m where m.team_id in " +
 | 
	
		
			
				|  |  |                 " (SELECT dt.id FROM  "+basedb+".wlyy_admin_team dt LEFT JOIN  "+basedb+".wlyy_admin_team_member watm ON dt.id=watm.team_id " +
 | 
	
		
			
				|  |  |                 " WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctorCode+"') AND  m.available='1'))"
 | 
	
		
			
				|  |  |                 +" AND p.openid IS NOT NULL "+
 | 
	
		
			
				|  |  |                whereSql;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String countCenterSql =" from "+basedb+".wlyy_patient p " +
 | 
	
		
			
				|  |  |                 " WHERE p.code not in (SELECT r.patient FROM  wlyy_specialist.wlyy_specialist_patient_relation r WHERE r.sign_status = '1' and doctor='"+doctorCode+"')"+" AND p.openid IS NOT NULL "+
 | 
	
		
			
				|  |  |                 " WHERE p.code not in (SELECT r.patient FROM  wlyy_specialist.wlyy_specialist_patient_relation r WHERE r.sign_status = '1'" +
 | 
	
		
			
				|  |  |                 " AND doctor in (SELECT m.doctor_code FROM  "+basedb+".wlyy_admin_team_member m where m.team_id in " +
 | 
	
		
			
				|  |  |                 " (SELECT dt.id FROM  "+basedb+".wlyy_admin_team dt LEFT JOIN  "+basedb+".wlyy_admin_team_member watm ON dt.id=watm.team_id " +
 | 
	
		
			
				|  |  |                 " WHERE dt.available='1' AND watm.available='1' AND watm.doctor_code='"+doctorCode+"') AND  m.available='1'))"
 | 
	
		
			
				|  |  |                 +" AND p.openid IS NOT NULL "+
 | 
	
		
			
				|  |  |                 whereSql;
 | 
	
		
			
				|  |  |         String sqlCount=sql1+countCenterSql;
 | 
	
		
			
				|  |  |         String sql=sql2+centerSql+" LIMIT "+(page-1)*pageSize+","+pageSize;
 | 
	
	
		
			
				|  | @ -844,7 +853,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |         JSONObject jsonObject = new JSONObject();
 | 
	
		
			
				|  |  |         //1、获取居民基础信息
 | 
	
		
			
				|  |  |         String preSql = "SELECT p.name as name, p.photo as photo,p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
 | 
	
		
			
				|  |  |                 " CASE  WHEN wd.doctor_name is null THEN '无' ELSE wd.doctor_name END as doctorName,CASE  WHEN wd.hospital_name is NULL THEN '无' ELSE wd.hospital_name END as hospitalName,CASE  WHEN wd.mobile is NULL THEN '无' ELSE wd.mobile END as doctorMobole ";
 | 
	
		
			
				|  |  |                 " CASE  WHEN wd.name is null THEN '无' ELSE wd.name END as doctorName,CASE  WHEN wd.hospital_name is NULL THEN '无' ELSE wd.hospital_name END as hospitalName,CASE  WHEN wd.mobile is NULL THEN '无' ELSE wd.mobile END as doctorMobole ";
 | 
	
		
			
				|  |  |         String patientSql = " from " + basedb + ".wlyy_patient p LEFT JOIN " + basedb + ".wlyy_sign_family wsf " +
 | 
	
		
			
				|  |  |                 " ON p.code=wsf.patient AND wsf.type='2' AND wsf.status='1' " +
 | 
	
		
			
				|  |  |                 " LEFT JOIN " + basedb + ".wlyy_doctor wd ON wsf.doctor =wd.code WHERE p.code='" + patientCode + "'";
 | 
	
	
		
			
				|  | @ -911,6 +920,7 @@ public class SpecialistService{
 | 
	
		
			
				|  |  |     public ObjEnvelop<SpecialistPatientRelationDO> createPatientInSpeciaRelation(SpecialistPatientRelationDO specialistPatientRelationDO) throws Exception {
 | 
	
		
			
				|  |  |         specialistPatientRelationDO.setSignStatus("1");
 | 
	
		
			
				|  |  |         specialistPatientRelationDO.setSignDate(new Date());
 | 
	
		
			
				|  |  |         specialistPatientRelationDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |         specialistPatientRelationDO.setCreateUser(specialistPatientRelationDO.getDoctor());
 | 
	
		
			
				|  |  |         specialistPatientRelationDO.setCreateUserName(specialistPatientRelationDO.getDoctorName());
 | 
	
		
			
				|  |  |         specialistPatientRelationDO.setStatus("1");//计管师分配状态
 |