| 
					
				 | 
			
			
				@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.data.domain.Page; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.data.domain.PageRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.data.domain.Sort; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Component; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springside.modules.utils.Clock; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -51,6 +52,8 @@ public class PatientService extends TokenService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DoctorPatientDao doctorPatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    TokenDao tokenDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    JdbcTemplate jdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private Clock clock = Clock.DEFAULT; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -108,7 +111,7 @@ public class PatientService extends TokenService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (tokens != null && tokens.getContent().size() >= 10) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int i = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int last = tokens.getContent().size() - 10; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(Token token : tokens) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Token token : tokens) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                i++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Patient p = patientDao.findByCode(token.getUser()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (p == null || i <= last) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -147,7 +150,7 @@ public class PatientService extends TokenService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject register(Patient patient, String imei, int platform) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject register_bak(Patient patient, String imei, int platform) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        IdcardInfoExtractor ie = new IdcardInfoExtractor(patient.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patient.setBirthday(ie.getBirthday()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patient.setSex(ie.getGender()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -180,6 +183,52 @@ public class PatientService extends TokenService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 患者注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param idcard 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param ssc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param mobile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param password 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param salt 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param imei 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param platform 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject register(String idcard, String ssc, String name, String mobile 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            , String password, String salt, String imei, int platform) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        IdcardInfoExtractor ie = new IdcardInfoExtractor(idcard); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String code = getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "insert wlyy_patient(code,idcard,name,ssc,mobile,password,salt,openid" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ",status,birthday,sex,czrq,disease,disease_condition,record_amount,points)" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jdbcTemplate.update(sql, new Object[]{code, idcard, name, ssc, mobile, password, salt, imei, 1, ie.getBirthday() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                , ie.getGender(), clock.getCurrentDate(), 0, 0, 0, 0}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Patient temp = patientDao.findByCode(code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (temp != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 更新openid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            updatePatient(temp, imei); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 生成登录tokey 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Token token = newToken(temp.getCode(), imei, platform); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (token != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // 生成登录信息成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("id", temp.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("uid", temp.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("token", token.getToken()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("name", temp.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("photo", temp.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //new Thread(new SignSsGetTask(patient.getIdcard())).start(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return json; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 建立三师团队与患者的关系 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 |