|  | @ -9,8 +9,10 @@ import com.yihu.jw.file_upload.FileUploadService;
 | 
												
													
														
															|  | import com.yihu.jw.patient.dao.BasePatientDao;
 |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
												
													
														
															|  | import com.yihu.jw.patient.dao.personal_info.PatientDao;
 |  | import com.yihu.jw.patient.dao.personal_info.PatientDao;
 | 
												
													
														
															|  | import com.yihu.jw.patient.service.BasePatientService;
 |  | import com.yihu.jw.patient.service.BasePatientService;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.patient.util.CommonUtils;
 | 
												
													
														
															|  | import com.yihu.jw.patient.util.ConstantUtils;
 |  | import com.yihu.jw.patient.util.ConstantUtils;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.iot.common.UploadVO;
 |  | import com.yihu.jw.restmodel.iot.common.UploadVO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.patient.util.RSAService;
 | 
												
													
														
															|  | import com.yihu.jw.sms.service.BaseSmsService;
 |  | import com.yihu.jw.sms.service.BaseSmsService;
 | 
												
													
														
															|  | import com.yihu.utils.security.MD5;
 |  | import com.yihu.utils.security.MD5;
 | 
												
													
														
															|  | import org.apache.commons.lang3.StringUtils;
 |  | import org.apache.commons.lang3.StringUtils;
 | 
												
											
												
													
														
															|  | @ -25,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
 | 
												
													
														
															|  | import javax.validation.constraints.NotNull;
 |  | import javax.validation.constraints.NotNull;
 | 
												
													
														
															|  | import java.io.IOException;
 |  | import java.io.IOException;
 | 
												
													
														
															|  | import java.security.NoSuchAlgorithmException;
 |  | import java.security.NoSuchAlgorithmException;
 | 
												
													
														
															|  | 
 |  | import java.util.*;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | /**
 |  | /**
 | 
												
													
														
															|  |  * 居民信息服务
 |  |  * 居民信息服务
 | 
												
											
												
													
														
															|  | @ -45,6 +48,70 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
 | 
												
													
														
															|  |     @Value("fastDFS.fastdfs_file_url")
 |  |     @Value("fastDFS.fastdfs_file_url")
 | 
												
													
														
															|  |     private String fastdfsUrl;
 |  |     private String fastdfsUrl;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private RSAService rsaService;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public Map<String,Object> regis(String mobile, String captcha, String password, String openid){
 | 
												
													
														
															|  | 
 |  |         Map<String, Object> map = new HashMap<>();
 | 
												
													
														
															|  | 
 |  |         boolean b = CommonUtils.isMobile(mobile);
 | 
												
													
														
															|  | 
 |  |         if(!b){
 | 
												
													
														
															|  | 
 |  |             map.put("code",-1);
 | 
												
													
														
															|  | 
 |  |             map.put("message","手机号码格式不正确");
 | 
												
													
														
															|  | 
 |  |             return map;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         //验证手机是否被注册
 | 
												
													
														
															|  | 
 |  |         List<BasePatientDO> list = patientDao.findByMobileAndDel(mobile,"1");
 | 
												
													
														
															|  | 
 |  |         if(list!=null && list.size()> 0){
 | 
												
													
														
															|  | 
 |  |             map.put("code",-1);
 | 
												
													
														
															|  | 
 |  |             map.put("message","该手机号已经注册!");
 | 
												
													
														
															|  | 
 |  |             return map;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         // 对验证码进行校验
 | 
												
													
														
															|  | 
 |  |         int res = baseSmsService.check(mobile, 0, captcha);
 | 
												
													
														
															|  | 
 |  |         if(-2 == res){
 | 
												
													
														
															|  | 
 |  |             map.put("code",-1);
 | 
												
													
														
															|  | 
 |  |             map.put("message","验证码已过期!");
 | 
												
													
														
															|  | 
 |  |             return map;
 | 
												
													
														
															|  | 
 |  |         }else if(-1 == res){
 | 
												
													
														
															|  | 
 |  |             map.put("code",-1);
 | 
												
													
														
															|  | 
 |  |             map.put("message","请输入正确的验证码!");
 | 
												
													
														
															|  | 
 |  |             return map;
 | 
												
													
														
															|  | 
 |  |         }else if(0 == res){
 | 
												
													
														
															|  | 
 |  |             map.put("code",-1);
 | 
												
													
														
															|  | 
 |  |             map.put("message","验证码无效!");
 | 
												
													
														
															|  | 
 |  |             return map;
 | 
												
													
														
															|  | 
 |  |         } else{
 | 
												
													
														
															|  | 
 |  |             BasePatientDO patient = new BasePatientDO();
 | 
												
													
														
															|  | 
 |  |             patient.setMobile(mobile);
 | 
												
													
														
															|  | 
 |  |             if(org.apache.commons.lang.StringUtils.isNotBlank(password)){
 | 
												
													
														
															|  | 
 |  |                 //增加密码
 | 
												
													
														
															|  | 
 |  |                 String salt = UUID.randomUUID().toString().replace("-", "");
 | 
												
													
														
															|  | 
 |  |                 patient.setSalt(salt);
 | 
												
													
														
															|  | 
 |  |                 password = rsaService.decryptString(password);
 | 
												
													
														
															|  | 
 |  |                 password = org.apache.commons.lang.StringUtils.reverse(password);
 | 
												
													
														
															|  | 
 |  |                 if(password.length()<6 || password.length()>20){
 | 
												
													
														
															|  | 
 |  |                     map.put("code",-1);
 | 
												
													
														
															|  | 
 |  |                     map.put("message","密码长度需为6-20位");
 | 
												
													
														
															|  | 
 |  |                     return map;
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 patient.setPassword(com.yihu.jw.util.security.MD5.GetMD5Code(password + salt));
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             if(!"undefined".equals(openid) && org.apache.commons.lang.StringUtils.isNotBlank(openid)){
 | 
												
													
														
															|  | 
 |  |                 patient.setOpenid(openid);
 | 
												
													
														
															|  | 
 |  |                 patient.setOpenidTime(new Date());
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             patient.setDel("1");
 | 
												
													
														
															|  | 
 |  |             patient.setPatientStatus("1");
 | 
												
													
														
															|  | 
 |  |             this.save(patient);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             map.put("code",1);
 | 
												
													
														
															|  | 
 |  |             map.put("message","注册成功");
 | 
												
													
														
															|  | 
 |  |             return map;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 设置登录密码/修改密码
 |  |      * 设置登录密码/修改密码
 | 
												
													
														
															|  |      * @param id
 |  |      * @param id
 |