| 
					
				 | 
			
			
				@ -1,12 +1,13 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.jw.security.core.userdetails.jdbc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.wx.BasePatientWechatDo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.security.core.userdetails.SaltUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.security.dao.patient.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.security.dao.patient.BasePatientWechatDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.security.model.WlyyUserDetails; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.security.model.WlyyUserSimple; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.security.utils.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.http.HttpClientUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.utils.security.MD5; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -82,6 +83,8 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HttpClientUtil httpClientUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BasePatientDao patientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyUserDetailsService(DataSource dataSource) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        this.setDataSource(dataSource); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -628,6 +631,34 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject object1 = JSONObject.parseObject(res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null != object1&&null!=object1.get("status") && "200".equals(object1.get("status").toString())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject patient = object1.getJSONObject("userinfo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("开始同步患者数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String idcard = patient.getString("idcard"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BasePatientDO patientDO2 = patientDao.findByIdcardAndDel(idcard,"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BasePatientDO patient1 = new BasePatientDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (patientDO2!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    patient1=patientDO2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String salt = UUID.randomUUID().toString().substring(0,5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String mobile = patient.getString("mobile"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String pw = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(org.apache.commons.lang3.StringUtils.isNotBlank(mobile)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    pw = mobile.substring(mobile.length()-6); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    pw = idcard.substring(idcard.length()-6); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setIdcard(idcard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setName(patient.getString("name")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setPassword(MD5.md5Hex(pw + "{" + salt + "}")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setSalt(salt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setMobile(mobile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setEnabled(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setLocked(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient1 = patientDao.save(patient1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("结束同步患者数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return patient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 |