|  | @ -7,18 +7,17 @@ import com.yihu.jw.exception.business.patient.CapthcaInvalidException;
 | 
	
		
			
				|  |  | import com.yihu.jw.exception.business.patient.PatientNotFoundException;
 | 
	
		
			
				|  |  | import com.yihu.jw.file_upload.FileUploadService;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.personal_info.PatientDao;
 | 
	
		
			
				|  |  | 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.restmodel.iot.common.UploadVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.util.RSAService;
 | 
	
		
			
				|  |  | import com.yihu.jw.sms.service.BaseSmsService;
 | 
	
		
			
				|  |  | import com.yihu.utils.security.MD5;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.csource.common.MyException;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | import org.springframework.data.redis.core.StringRedisTemplate;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | import org.springframework.util.Assert;
 | 
	
	
		
			
				|  | @ -28,9 +27,11 @@ import javax.validation.constraints.NotNull;
 | 
	
		
			
				|  |  | import java.io.IOException;
 | 
	
		
			
				|  |  | import java.security.NoSuchAlgorithmException;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | import java.util.concurrent.TimeUnit;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
		
			
				|  |  |  * 居民信息服务
 | 
	
		
			
				|  |  |  *
 | 
	
		
			
				|  |  |  * @author litaohong on  2018年11月28日
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | @Service
 | 
	
	
		
			
				|  | @ -45,78 +46,116 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private FileUploadService fileUploadService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("fastDFS.fastdfs_file_url")
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private StringRedisTemplate redisTemplate;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     private static String BespeakRegist = "bespeakRegist:";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${fastDFS.fastdfs_file_url}")
 | 
	
		
			
				|  |  |     private String fastdfsUrl;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public Map<String,Object> regist(String mobile, String captcha, String password, String openid){
 | 
	
		
			
				|  |  |     public Map<String, Object> regist(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","手机号码格式不正确");
 | 
	
		
			
				|  |  |         if (!b) {
 | 
	
		
			
				|  |  |             map.put("code", -1);
 | 
	
		
			
				|  |  |             map.put("message", "手机号码格式不正确");
 | 
	
		
			
				|  |  |             return map;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //验证手机是否被注册
 | 
	
		
			
				|  |  |         List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile,"1");
 | 
	
		
			
				|  |  |         if(list!=null && list.size()> 0){
 | 
	
		
			
				|  |  |             map.put("code",-1);
 | 
	
		
			
				|  |  |             map.put("message","该手机号已经注册!");
 | 
	
		
			
				|  |  |         List<BasePatientDO> list = basePatientDao.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","验证码已过期!");
 | 
	
		
			
				|  |  |         if (-2 == res) {
 | 
	
		
			
				|  |  |             map.put("code", -1);
 | 
	
		
			
				|  |  |             map.put("message", "验证码已过期!");
 | 
	
		
			
				|  |  |             return map;
 | 
	
		
			
				|  |  |         }else if(-1 == res){
 | 
	
		
			
				|  |  |             map.put("code",-1);
 | 
	
		
			
				|  |  |             map.put("message","请输入正确的验证码!");
 | 
	
		
			
				|  |  |         } else if (-1 == res) {
 | 
	
		
			
				|  |  |             map.put("code", -1);
 | 
	
		
			
				|  |  |             map.put("message", "请输入正确的验证码!");
 | 
	
		
			
				|  |  |             return map;
 | 
	
		
			
				|  |  |         }else if(0 == res){
 | 
	
		
			
				|  |  |             map.put("code",-1);
 | 
	
		
			
				|  |  |             map.put("message","验证码无效!");
 | 
	
		
			
				|  |  |         } else if (0 == res) {
 | 
	
		
			
				|  |  |             map.put("code", -1);
 | 
	
		
			
				|  |  |             map.put("message", "验证码无效!");
 | 
	
		
			
				|  |  |             return map;
 | 
	
		
			
				|  |  |         } else{
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             BasePatientDO patient = new BasePatientDO();
 | 
	
		
			
				|  |  |             patient.setMobile(mobile);
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(password)){
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(password)) {
 | 
	
		
			
				|  |  |                 //增加密码
 | 
	
		
			
				|  |  |                 if(password.length()<6 || password.length()>20){
 | 
	
		
			
				|  |  |                     map.put("code",-1);
 | 
	
		
			
				|  |  |                     map.put("message","密码长度需为6-20位");
 | 
	
		
			
				|  |  |                 if (password.length() < 6 || password.length() > 20) {
 | 
	
		
			
				|  |  |                     map.put("code", -1);
 | 
	
		
			
				|  |  |                     map.put("message", "密码长度需为6-20位");
 | 
	
		
			
				|  |  |                     return map;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 patient.setSalt(randomString(5));
 | 
	
		
			
				|  |  |                 patient.setPassword(MD5.md5Hex(password + "{" + patient.getSalt() + "}"));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if(!"undefined".equals(openid) && StringUtils.isNotBlank(openid)){
 | 
	
		
			
				|  |  |             if (!"undefined".equals(openid) && StringUtils.isNotBlank(openid)) {
 | 
	
		
			
				|  |  |                 patient.setOpenid(openid);
 | 
	
		
			
				|  |  |                 patient.setOpenidTime(new Date());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             patient.setMobile(mobile);
 | 
	
		
			
				|  |  |             patient.setLocked(0);
 | 
	
		
			
				|  |  |             patient.setEnabled(0);
 | 
	
		
			
				|  |  |             patient.setDel("1");
 | 
	
		
			
				|  |  |             patient.setPatientStatus("1");
 | 
	
		
			
				|  |  |             this.save(patient);
 | 
	
		
			
				|  |  |             map.put("code", 1);
 | 
	
		
			
				|  |  |             map.put("message", "注册成功");
 | 
	
		
			
				|  |  |             return map;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 预注册功能接口
 | 
	
		
			
				|  |  |      * @param mobile
 | 
	
		
			
				|  |  |      * @param time 预注册过期时间 例如: 2 , 则2分钟过期
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Map<String,Object> bespeakRegist(String mobile,long time){
 | 
	
		
			
				|  |  |         Map<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             map.put("code",1);
 | 
	
		
			
				|  |  |             map.put("message","注册成功");
 | 
	
		
			
				|  |  |         boolean b = CommonUtils.isMobile(mobile);
 | 
	
		
			
				|  |  |         if(!b){
 | 
	
		
			
				|  |  |             map.put("code",-1);
 | 
	
		
			
				|  |  |             map.put("message","手机号码格式不正确");
 | 
	
		
			
				|  |  |             return map;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //验证手机是否被注册
 | 
	
		
			
				|  |  |         List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile,"1");
 | 
	
		
			
				|  |  |         if(list!=null && list.size()> 0){
 | 
	
		
			
				|  |  |             map.put("code",-1);
 | 
	
		
			
				|  |  |             map.put("message","该手机号已经注册!");
 | 
	
		
			
				|  |  |             return map;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //将预注册信息存到redis中
 | 
	
		
			
				|  |  |         redisTemplate.opsForValue().set(BespeakRegist+mobile , mobile, time, TimeUnit.MINUTES);
 | 
	
		
			
				|  |  |         map.put("code",1);
 | 
	
		
			
				|  |  |         map.put("message","预注册成功");
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 设置登录密码/修改密码
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      * @param newPassword
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |     public String resetPassword(String id,String newPassword){
 | 
	
		
			
				|  |  |     public String resetPassword(String id, String newPassword) {
 | 
	
		
			
				|  |  |         Preconditions.checkNotNull(id);
 | 
	
		
			
				|  |  |         Preconditions.checkNotNull(newPassword);
 | 
	
		
			
				|  |  |         BasePatientDO patient = basePatientDao.findOne(id);
 | 
	
		
			
				|  |  |         if(null == patient){
 | 
	
		
			
				|  |  |         if (null == patient) {
 | 
	
		
			
				|  |  |             throw new PatientNotFoundException("当前居民不存在:【 " + id + "】");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         patient.setSalt(randomString(5));
 | 
	
	
		
			
				|  | @ -126,28 +165,29 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 修改手机号
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      * @param newMobile
 | 
	
		
			
				|  |  |      * @param captcha
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |     public BasePatientDO updateMobile(@NotNull String id, @NotNull String newMobile, @NotNull String captcha){
 | 
	
		
			
				|  |  |     public BasePatientDO updateMobile(@NotNull String id, @NotNull String newMobile, @NotNull String captcha) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Preconditions.checkNotNull(id,"id不可为空");
 | 
	
		
			
				|  |  |         Preconditions.checkNotNull(newMobile,"手机号不可为空");
 | 
	
		
			
				|  |  |         Preconditions.checkNotNull(captcha,"验证码不可为空");
 | 
	
		
			
				|  |  |         Preconditions.checkNotNull(id, "id不可为空");
 | 
	
		
			
				|  |  |         Preconditions.checkNotNull(newMobile, "手机号不可为空");
 | 
	
		
			
				|  |  |         Preconditions.checkNotNull(captcha, "验证码不可为空");
 | 
	
		
			
				|  |  |         BasePatientDO patient = basePatientDao.findOne(id);
 | 
	
		
			
				|  |  |         if(null == patient){
 | 
	
		
			
				|  |  |         if (null == patient) {
 | 
	
		
			
				|  |  |             throw new PatientNotFoundException("当前居民不存在:【 " + id + "】");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(StringUtils.endsWithIgnoreCase(patient.getMobile(),newMobile)){
 | 
	
		
			
				|  |  |         if (StringUtils.endsWithIgnoreCase(patient.getMobile(), newMobile)) {
 | 
	
		
			
				|  |  |             return patient;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(baseSmsService.verifyCaptcha(captcha)){
 | 
	
		
			
				|  |  |         if (baseSmsService.verifyCaptcha(captcha)) {
 | 
	
		
			
				|  |  |             patient.setMobile(newMobile);
 | 
	
		
			
				|  |  |             this.save(patient);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             throw new CapthcaInvalidException("验证码不正确或过期!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return patient;
 | 
	
	
		
			
				|  | @ -155,20 +195,30 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 完善居民基本信息
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param headPortrait 头像
 | 
	
		
			
				|  |  |      * @param json
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |     public BasePatientDO completePatientDetails(MultipartFile headPortrait, String json){
 | 
	
		
			
				|  |  |         BasePatientDO patientDO = JSONObject.parseObject(json,BasePatientDO.class);
 | 
	
		
			
				|  |  |         //如果未上传头像,使用默认头像
 | 
	
		
			
				|  |  |         if(null == headPortrait){
 | 
	
		
			
				|  |  |             patientDO.setPhoto("default");
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |     public BasePatientDO completePatientDetails(MultipartFile headPortrait, String json) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         BasePatientDO patientDetail = JSONObject.parseObject(json, BasePatientDO.class);
 | 
	
		
			
				|  |  |         Assert.notNull(patientDetail.getName(), "姓名不可为空!");
 | 
	
		
			
				|  |  |         Assert.notNull(patientDetail.getSex(), "性别不可为空!");
 | 
	
		
			
				|  |  |         Assert.notNull(patientDetail.getIdcard(), "身份证不可为空!");
 | 
	
		
			
				|  |  |         Assert.notNull(patientDetail.getCommitteeCode(), "居委会不可为空!");
 | 
	
		
			
				|  |  |         Assert.notNull(patientDetail.getCommitteeName(), "居委会不可为空!");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         BasePatientDO patientBrief = basePatientDao.findOne(patientDetail.getId());
 | 
	
		
			
				|  |  |         if (null == patientBrief) {
 | 
	
		
			
				|  |  |             throw new PatientNotFoundException("未找到该居民!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //如果未上传头像,使用默认头像,默认头像由客户端来处理,后台默认存null
 | 
	
		
			
				|  |  |         if (null != headPortrait) {
 | 
	
		
			
				|  |  |             UploadVO uploadedFile = null;
 | 
	
		
			
				|  |  |             try {
 | 
	
		
			
				|  |  |                 uploadedFile = fileUploadService.uploadImg(headPortrait.getInputStream(),headPortrait.getOriginalFilename(),headPortrait.getSize(),fastdfsUrl);
 | 
	
		
			
				|  |  |                 uploadedFile = fileUploadService.uploadImg(headPortrait.getInputStream(), headPortrait.getOriginalFilename(), headPortrait.getSize(), fastdfsUrl);
 | 
	
		
			
				|  |  |             } catch (NoSuchAlgorithmException e) {
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
		
			
				|  |  |             } catch (IOException e) {
 | 
	
	
		
			
				|  | @ -176,32 +226,48 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
 | 
	
		
			
				|  |  |             } catch (MyException e) {
 | 
	
		
			
				|  |  |                 e.printStackTrace();
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             patientDO.setPhoto(uploadedFile.getFullUrl());
 | 
	
		
			
				|  |  |             patientBrief.setPhoto(uploadedFile.getFullUrl());
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         Assert.notNull(patientDO.getName(),"姓名不可为空!");
 | 
	
		
			
				|  |  |         Assert.notNull(patientDO.getSex(),"性别不可为空!");
 | 
	
		
			
				|  |  |         Assert.notNull(patientDO.getIdcard(),"身份证不可为空!");
 | 
	
		
			
				|  |  |         Assert.notNull(patientDO.getCommitteeCode(),"居委会不可为空!");
 | 
	
		
			
				|  |  |         Assert.notNull(patientDO.getCommitteeName(),"居委会不可为空!");
 | 
	
		
			
				|  |  |         this.save(patientDO);
 | 
	
		
			
				|  |  |         return patientDO;
 | 
	
		
			
				|  |  |         patientBrief.setName(patientDetail.getName());
 | 
	
		
			
				|  |  |         patientBrief.setSex(patientDetail.getSex());
 | 
	
		
			
				|  |  |         patientBrief.setIdcard(patientDetail.getIdcard());
 | 
	
		
			
				|  |  |         patientBrief.setProvinceCode(patientDetail.getProvinceCode());
 | 
	
		
			
				|  |  |         patientBrief.setProvinceName(patientDetail.getProvinceName());
 | 
	
		
			
				|  |  |         patientBrief.setCityCode(patientDetail.getCityCode());
 | 
	
		
			
				|  |  |         patientBrief.setCityName(patientDetail.getCityName());
 | 
	
		
			
				|  |  |         patientBrief.setTownCode(patientDetail.getTownCode());
 | 
	
		
			
				|  |  |         patientBrief.setTownName(patientDetail.getTownName());
 | 
	
		
			
				|  |  |         patientBrief.setLiveProvinceCode(patientDetail.getLiveProvinceCode());
 | 
	
		
			
				|  |  |         patientBrief.setLiveProvinceName(patientDetail.getLiveProvinceName());
 | 
	
		
			
				|  |  |         patientBrief.setLiveCityCode(patientDetail.getLiveCityCode());
 | 
	
		
			
				|  |  |         patientBrief.setLiveCityName(patientDetail.getLiveCityName());
 | 
	
		
			
				|  |  |         patientBrief.setLiveTownCode(patientDetail.getLiveTownName());
 | 
	
		
			
				|  |  |         patientBrief.setLiveStreetCode(patientDetail.getLiveStreetCode());
 | 
	
		
			
				|  |  |         patientBrief.setLiveStreetName(patientDetail.getLiveStreetName());
 | 
	
		
			
				|  |  |         patientBrief.setAddress(patientDetail.getAddress());
 | 
	
		
			
				|  |  |         patientBrief.setCommitteeCode(patientDetail.getCommitteeCode());
 | 
	
		
			
				|  |  |         patientBrief.setCommitteeName(patientDetail.getCommitteeName());
 | 
	
		
			
				|  |  |         this.save(patientBrief);
 | 
	
		
			
				|  |  |         return patientDetail;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 验证身份证是否存在,剔除当前用户自身id
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param idcard
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public boolean existsByIdcard(String idcard,String id) {
 | 
	
		
			
				|  |  |     public boolean existsByIdcard(String idcard, String id) {
 | 
	
		
			
				|  |  |         Preconditions.checkNotNull(idcard, "身份证不可为空");
 | 
	
		
			
				|  |  |         Preconditions.checkNotNull(id, "id不可为空");
 | 
	
		
			
				|  |  |         return basePatientDao.existsByIdcardAndIdNot(idcard,id);
 | 
	
		
			
				|  |  |         return basePatientDao.existsByIdcardAndIdNot(idcard, id);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 验证身份证是否存在
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param idcard
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
	
		
			
				|  | @ -212,33 +278,35 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |     public int updateOpenId(String id, String openId){
 | 
	
		
			
				|  |  |         return basePatientDao.updateOpenId(id,openId);
 | 
	
		
			
				|  |  |     public int updateOpenId(String id, String openId) {
 | 
	
		
			
				|  |  |         return basePatientDao.updateOpenId(id, openId);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *  判断是否需要完善信息,身份证未填则需要完善
 | 
	
		
			
				|  |  |      * 判断是否需要完善信息,身份证未填则需要完善
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param id
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public boolean isCompleted(String id) {
 | 
	
		
			
				|  |  |         Assert.notNull(id,"id不可为空");
 | 
	
		
			
				|  |  |         Assert.notNull(id, "id不可为空");
 | 
	
		
			
				|  |  |         BasePatientDO patient = basePatientDao.findOne(id);
 | 
	
		
			
				|  |  |         if(null == patient){
 | 
	
		
			
				|  |  |         if (null == patient) {
 | 
	
		
			
				|  |  |             throw new PatientNotFoundException("居民不存在!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |        return !StringUtils.isEmpty(patient.getIdcard());
 | 
	
		
			
				|  |  |         return !StringUtils.isEmpty(patient.getIdcard());
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 查询居民完善后的基本信息
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public BasePatientDO getCompletedDetails(String id){
 | 
	
		
			
				|  |  |         Assert.notNull(id,"居民id不可为空!");
 | 
	
		
			
				|  |  |     public BasePatientDO getCompletedDetails(String id) {
 | 
	
		
			
				|  |  |         Assert.notNull(id, "居民id不可为空!");
 | 
	
		
			
				|  |  |         BasePatientDO patient = basePatientDao.findOne(id);
 | 
	
		
			
				|  |  |         if(null == patient){
 | 
	
		
			
				|  |  |         if (null == patient) {
 | 
	
		
			
				|  |  |             throw new PatientNotFoundException("居民不存在!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return patient;
 |