|  | @ -18,6 +18,7 @@ import com.yihu.wlyy.repository.address.TownDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.charge.ChargeDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.consult.ConsultDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.consult.ConsultTeamDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.doctor.DoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
 | 
	
	
		
			
				|  | @ -30,6 +31,7 @@ import com.yihu.wlyy.service.common.SMSService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.account.DoctorService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.common.account.PatientService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.system.SystemDictService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.third.jw.JwSignService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.task.PushMsgTask;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
 | 
	
	
		
			
				|  | @ -37,6 +39,8 @@ import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.json.JSONArray;
 | 
	
		
			
				|  |  | import org.json.JSONObject;
 | 
	
		
			
				|  |  | import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.data.domain.Page;
 | 
	
		
			
				|  |  | import org.springframework.data.domain.PageRequest;
 | 
	
	
		
			
				|  | @ -55,6 +59,7 @@ import java.util.*;
 | 
	
		
			
				|  |  | @Component
 | 
	
		
			
				|  |  | @Transactional
 | 
	
		
			
				|  |  | public class SignWebService extends BaseService {
 | 
	
		
			
				|  |  |     private static Logger logger = LoggerFactory.getLogger(SignWebService.class);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private SignWebDao signWebDao;
 | 
	
	
		
			
				|  | @ -98,7 +103,10 @@ public class SignWebService extends BaseService {
 | 
	
		
			
				|  |  |     private SignFamilyServerDao signFamilyServerDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ChargeDao chargeDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private JwSignService jwSignService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DoctorAdminTeamMemberDao doctorAdminTeamMemberDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private TownDao townDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
	
		
			
				|  | @ -2606,4 +2614,43 @@ public class SignWebService extends BaseService {
 | 
	
		
			
				|  |  |         json.put("signFamilyServer",ja);
 | 
	
		
			
				|  |  |         return json;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 判断医生所属行政团队是否已达上限
 | 
	
		
			
				|  |  |      * @param doctorCode
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Integer getSickFamilyDoctorSignLimit(String doctorCode){
 | 
	
		
			
				|  |  |         Integer re = 0;//0未达上线 1 已达上限
 | 
	
		
			
				|  |  |         List<AdminTeam> adminTeams = doctorAdminTeamMemberDao.findDoctorTeams(doctorCode);
 | 
	
		
			
				|  |  |         int limitNum = 0;
 | 
	
		
			
				|  |  |         for(AdminTeam one:adminTeams){
 | 
	
		
			
				|  |  |             //获取团队签约数
 | 
	
		
			
				|  |  |             Integer signCount = signFamilyDao.findByAdminTeamIdAndStatus(one.getId(),0);
 | 
	
		
			
				|  |  |             //获取智业团队签约上线
 | 
	
		
			
				|  |  |             String jwCode = one.getMappingCode();//智业服务团队的code
 | 
	
		
			
				|  |  |             try{
 | 
	
		
			
				|  |  |                 String response = jwSignService.getSickFamilyDoctorSignLimit(jwCode);
 | 
	
		
			
				|  |  |                 com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(response);
 | 
	
		
			
				|  |  |                 if(json.getInteger("status")==200){
 | 
	
		
			
				|  |  |                     com.alibaba.fastjson.JSONObject data = json.getJSONObject("data");
 | 
	
		
			
				|  |  |                     if("1".equals(data.getString("CODE"))){
 | 
	
		
			
				|  |  |                         int sign_limit_number = data.getJSONArray("DATA").getJSONObject(0).getInteger("SIGN_LIMIT_NUMBER");//签约上线
 | 
	
		
			
				|  |  |                         if(signCount>=sign_limit_number){
 | 
	
		
			
				|  |  |                             limitNum++;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }catch (Exception e){
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(adminTeams.size()==limitNum){
 | 
	
		
			
				|  |  |             re = 1;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return re;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |