| 
															
																@ -1,22 +1,22 @@ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																package com.yihu.jw.patient.endpoint.patient; 
															 | 
															
															 | 
															
																package com.yihu.jw.patient.endpoint.patient; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.base.patient.BasePatientDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.base.patient.BasePatientDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.patient.dao.BasePatientDao; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.patient.dao.personal_info.PatientDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.patient.service.personal_Info.PatientService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import com.yihu.jw.patient.util.CommonUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.patient.util.RSAService; 
															 | 
															
															 | 
															
																import com.yihu.jw.patient.util.RSAService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.restmodel.web.Envelop; 
															 | 
															
															 | 
															
																import com.yihu.jw.restmodel.web.Envelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint; 
															 | 
															
															 | 
															
																import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.rm.patient.PatientRequestMapping; 
															 | 
															
															 | 
															
																import com.yihu.jw.rm.patient.PatientRequestMapping; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.util.common.RSAUtils; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.util.security.MD5; 
															 | 
															
															 | 
															
																import com.yihu.jw.util.security.MD5; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import io.swagger.annotations.Api; 
															 | 
															
															 | 
															
																import io.swagger.annotations.Api; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import io.swagger.annotations.ApiOperation; 
															 | 
															
															 | 
															
																import io.swagger.annotations.ApiOperation; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import io.swagger.annotations.ApiParam; 
															 | 
															
															 | 
															
																import io.swagger.annotations.ApiParam; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.apache.commons.lang3.StringUtils; 
															 | 
															
															 | 
															
																import org.apache.commons.lang3.StringUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.json.JSONObject; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.beans.factory.annotation.Autowired; 
															 | 
															
															 | 
															
																import org.springframework.beans.factory.annotation.Autowired; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import org.springframework.util.CollectionUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.web.bind.annotation.*; 
															 | 
															
															 | 
															
																import org.springframework.web.bind.annotation.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import javax.servlet.http.HttpServletRequest; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import java.util.*; 
															 | 
															
															 | 
															
																import java.util.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																@RestController 
															 | 
															
															 | 
															
																@RestController 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -25,7 +25,9 @@ import java.util.*; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																public class PatientInfoEndpint extends EnvelopRestEndpoint { 
															 | 
															
															 | 
															
																public class PatientInfoEndpint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private BasePatientDao patientDao; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private PatientDao patientDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private PatientService patientService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private RSAService rsaService; 
															 | 
															
															 | 
															
																    private RSAService rsaService; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -41,10 +43,10 @@ public class PatientInfoEndpint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String modulus = rsaService.getModulus(); 
															 | 
															
															 | 
															
																        String modulus = rsaService.getModulus(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String exponent = rsaService.getExponent(); 
															 | 
															
															 | 
															
																        String exponent = rsaService.getExponent(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        JSONObject json = new JSONObject(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        json.put("modulus", modulus); //加密指数 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        json.put("exponent", exponent);//加密系数 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return success(json); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        Map<String, String> map = new HashMap<>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        map.put("modulus", modulus); //加密指数 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        map.put("exponent", exponent);//加密系数 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return success(map); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -54,18 +56,24 @@ public class PatientInfoEndpint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public Envelop regist(@ApiParam(value = "手机号", name = "mobile") @RequestParam(required = true)String mobile , 
															 | 
															
															 | 
															
																    public Envelop regist(@ApiParam(value = "手机号", name = "mobile") @RequestParam(required = true)String mobile , 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         @ApiParam(value = "验证码", name = "captcha") @RequestParam(value = "captcha", required = true) String captcha, 
															 | 
															
															 | 
															
																                         @ApiParam(value = "验证码", name = "captcha") @RequestParam(value = "captcha", required = true) String captcha, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         @ApiParam(value = "微信openId", name = "openid") @RequestParam(value = "openid", required = false) String openid, 
															 | 
															
															 | 
															
																                         @ApiParam(value = "微信openId", name = "openid") @RequestParam(value = "openid", required = false) String openid, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                         @ApiParam(value = "密码", name = "password") @RequestParam(value = "password", required = true) String password) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        try { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            Envelop envelop = new Envelop(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                         @ApiParam(value = "密码", name = "password") @RequestParam(value = "password", required = false) String password) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        Envelop envelop = new Envelop(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            //验证手机是否被注册 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            List<BasePatientDO> list =  patientDao.findByMobile(mobile); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            if(list!=null && list.size()>0){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                envelop.setMessage("该手机号已经注册!"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                envelop.setStatus(-1); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                return envelop; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            // 对验证码进行校验 todo cyx 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        boolean b = CommonUtils.isMobile(mobile); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(!b){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            envelop.setMessage("手机号码格式不正确"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            envelop.setStatus(-1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return envelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //验证手机是否被注册 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<BasePatientDO> list =  patientDao.findByMobileAndDel(mobile,"1"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(list!=null && list.size()> 0){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            envelop.setMessage("该手机号已经注册!"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            envelop.setStatus(-1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return envelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        // 对验证码进行校验 todo cyx 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            int res = smsService.check(mobile, 1, captcha); 
															 | 
															
															 | 
															
																//            int res = smsService.check(mobile, 1, captcha); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            switch (res) { 
															 | 
															
															 | 
															
																//            switch (res) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                case -2: 
															 | 
															
															 | 
															
																//                case -2: 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -76,135 +84,140 @@ public class PatientInfoEndpint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    return error(-1, "验证码无效!"); 
															 | 
															
															 | 
															
																//                    return error(-1, "验证码无效!"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            } 
															 | 
															
															 | 
															
																//            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            BasePatientDO patient = new BasePatientDO(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            patient.setMobile(mobile); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        BasePatientDO patient = new BasePatientDO(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        patient.setMobile(mobile); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(StringUtils.isNotBlank(password)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            //增加密码 
															 | 
															
															 | 
															
																            //增加密码 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            String salt = UUID.randomUUID().toString().replace("-", ""); 
															 | 
															
															 | 
															
																            String salt = UUID.randomUUID().toString().replace("-", ""); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            patient.setSalt(salt); 
															 | 
															
															 | 
															
																            patient.setSalt(salt); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            password = RSAUtils.decryptString(password); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            password = rsaService.decryptString(password); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            password = StringUtils.reverse(password); 
															 | 
															
															 | 
															
																            password = StringUtils.reverse(password); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            patient.setPassword(MD5.GetMD5Code(password + salt)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            if(!"undefined".equals(openid) && StringUtils.isNotBlank(openid)){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                patient.setOpenid(openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																                patient.setOpenidTime(new Date()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if(password.length()<6 || password.length()>20){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                envelop.setMessage("密码长度需为6-20位"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                envelop.setStatus(-1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                return envelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            } 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            JSONObject json = patientService.register(mobile, MD5.GetMD5Code(password + salt) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    ,salt,openid,3); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } catch (Exception e) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            error(e); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////            return error(-1, "注册失败!"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            patient.setPassword(MD5.GetMD5Code(password + salt)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(!"undefined".equals(openid) && StringUtils.isNotBlank(openid)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            patient.setOpenid(openid); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            patient.setOpenidTime(new Date()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        return null; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        patient.setDel("1"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        patient.setPatientStatus("1"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        patientService.save(patient); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        envelop.setMessage("注册成功"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        envelop.setStatus(200); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        return envelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    } 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//    /** 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//     * 患者微信登录接口 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//     * 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//     * @param captcha  短信号 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//     * @param mobile   电话号码 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//     * @param password 登录密码 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//     * @return 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//     */ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//    @RequestMapping(value = "login", method = RequestMethod.POST) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//    @ResponseBody 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//    public String login( 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            @RequestParam(required = false) String mobile, 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            @RequestParam(required = false) String captcha, 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            @RequestParam(required = false) String password, 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            String openid) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        String errorMessage; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        LoginLog loginLog = new LoginLog(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        loginLog.setCreateTime(new Date()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        loginLog.setPhone(mobile); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        loginLog.setType("2"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        loginLog.setUserType("1"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    /** 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * 患者微信登录接口 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param captcha  短信号 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param mobile   电话号码 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @param password 登录密码 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     * @return 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																     */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        @RequestMapping(value = "login", method = RequestMethod.POST) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        @ResponseBody 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        public Envelop login( 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                @RequestParam(required = true) String mobile, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                @RequestParam(required = false) String captcha, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                @RequestParam(required = false) String password, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                @RequestParam(required = false) String openId) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        Envelop envelop = new Envelop(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        boolean b = CommonUtils.isMobile(mobile); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(!b){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            envelop.setMessage("手机号码格式不正确"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            envelop.setStatus(-1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return envelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //验证手机是否被注册 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        List<BasePatientDO> list = patientDao.findByMobileAndDel(mobile,"1"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(CollectionUtils.isEmpty(list)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            envelop.setMessage("该手机未注册"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            envelop.setStatus(-1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return envelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(list.size()> 1){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            envelop.setMessage("该手机号存在多个账号,请联系管理员"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            envelop.setStatus(-1); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return envelop; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        BasePatientDO p = list.get(0); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //用于判断是否登陆成功,若登陆成功,且openId不为空,则更新openId 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        boolean isLogin = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(StringUtils.isNotBlank(password)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            password = rsaService.decryptString(password); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            password = StringUtils.reverse(password); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            //生成MD5 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            String loginPassword = MD5.GetMD5Code(password + p.getSalt()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if (loginPassword.equals(p.getPassword())) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                //使用密码登录成功 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            }else{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																                //使用密码登录失败 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } else { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																          //验证码登陆 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        if(isLogin && StringUtils.isNotBlank(openId) && !"undefined".equals(openId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            //更新openId 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            if(!openId.equals(p.getOpenid())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//         String errorMessage; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        try { 
															 | 
															
															 | 
															
																//        try { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            //账号登录 mobile可能是电话号也可能是身份证 
															 | 
															
															 | 
															
																//            //账号登录 mobile可能是电话号也可能是身份证 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(password)) { 
															 | 
															
															 | 
															
																//            if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(password)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                Patient p = patientService.findByIdcard(mobile); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                if (p == null) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    List<Patient> patients = patientService.findByMobile(mobile); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    if (patients.size() > 1) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        return error(-1, "此手机号码存在多个用户,请用身份证进行登录!"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } else if (patients.size() == 1) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        p = patients.get(0); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                loginLog.setLoginType("2"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                if (p == null) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    if (mobile.length() == 11) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        errorMessage = "该手机号暂未注册账号,请确认后重新输入!"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } else { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        errorMessage = "该身份证号暂未注册账号,请确认后重新输入!"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    loginLog.setErrorMessage(errorMessage); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    loginLogService.saveLog(loginLog); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    return error(-1, errorMessage); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } else if (p.getStatus() == 0) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    if (mobile.length() == 11) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        errorMessage = "该手机号已被禁止使用!"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } else { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        errorMessage = "该身份证号已被禁止使用!"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    loginLog.setErrorMessage(errorMessage); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    loginLogService.saveLog(loginLog); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    return error(-1, errorMessage); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } else if (p.getStatus() == 2) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    errorMessage = "该账号正在审核中,请确认审核通过后再登录,“如有疑问,拨打400-6677-400转2人工客服”"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    loginLog.setErrorMessage(errorMessage); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    loginLogService.saveLog(loginLog); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    return error(-1, errorMessage); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } else if (StringUtils.isEmpty(openid)) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    errorMessage = "无效的OpenID!"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    loginLog.setErrorMessage(errorMessage); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    loginLogService.saveLog(loginLog); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    return error(-1, errorMessage); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                loginLog.setUserCode(p.getCode()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                //解密 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                rsaUtils.setBaseService(patientService); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                password = rsaUtils.decryptString(password); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                password = StringUtils.reverse(password); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                BasePatientDO p = patientService.findByMobile(mobile); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                //生成MD5 
															 | 
															
															 | 
															
																//                //生成MD5 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                String loginPassword = MD5.GetMD5Code(password + p.getSalt()); 
															 | 
															
															 | 
															
																//                String loginPassword = MD5.GetMD5Code(password + p.getSalt()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                //判断d登录密码是否正确 
															 | 
															
															 | 
															
																//                //判断d登录密码是否正确 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                if (loginPassword.equals(p.getPassword())) { 
															 | 
															
															 | 
															
																//                if (loginPassword.equals(p.getPassword())) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    // 绑定用户手机号和openid 
															 | 
															
															 | 
															
																//                    // 绑定用户手机号和openid 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    if (StringUtils.isNotBlank(openid) && !"undefined".equals(openid)) {//undefined不更新数据库 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        //patient.setOpenid(openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    if (StringUtils.isNotBlank(openId) && !"undefined".equals(openId)) {//undefined不更新数据库 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                        //patient.setOpenid(openId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        //1.判斷居民OPenid是不是空 
															 | 
															
															 | 
															
																//                        //1.判斷居民OPenid是不是空 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        if(StringUtils.isNotBlank(p.getOpenid())){ 
															 | 
															
															 | 
															
																//                        if(StringUtils.isNotBlank(p.getOpenid())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            //如果OPenid与原来用户不相等,则判断登录的openids是否被大于10人登录 
															 | 
															
															 | 
															
																//                            //如果OPenid与原来用户不相等,则判断登录的openids是否被大于10人登录 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            if(!p.getOpenid().equals(openid)){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                            if(!p.getOpenid().equals(openId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                                //判断登录的openids是否被大于10人登录 
															 | 
															
															 | 
															
																//                                //判断登录的openids是否被大于10人登录 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                                if(!patientService.checkOpenidCount(openid)){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																////                                if(!patientService.checkOpenidCount(openId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                                    errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录"; 
															 | 
															
															 | 
															
																////                                    errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                                    return error(-2, errorMessage); 
															 | 
															
															 | 
															
																////                                    return error(-2, errorMessage); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                                } 
															 | 
															
															 | 
															
																////                                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            } 
															 | 
															
															 | 
															
																//                            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            patientService.updatePatient(p, openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                            patientService.updatePatient(p, openId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        }else{ 
															 | 
															
															 | 
															
																//                        }else{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            // 判断登录的openids是否被大于10人登录 
															 | 
															
															 | 
															
																//                            // 判断登录的openids是否被大于10人登录 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            if(!patientService.checkOpenidCount(openid)){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                            if(!patientService.checkOpenidCount(openId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                                errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录"; 
															 | 
															
															 | 
															
																////                                errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                                return error(-2, errorMessage); 
															 | 
															
															 | 
															
																////                                return error(-2, errorMessage); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            }else{ 
															 | 
															
															 | 
															
																//                            }else{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                                //未达到上限更新用户openid 
															 | 
															
															 | 
															
																//                                //未达到上限更新用户openid 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                                patientService.updatePatient(p, openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                                patientService.updatePatient(p, openId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            } 
															 | 
															
															 | 
															
																//                            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        } 
															 | 
															
															 | 
															
																//                        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } 
															 | 
															
															 | 
															
																//                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																// 
															 | 
															
															 | 
															
																// 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    // 用户校验通过,生成token 
															 | 
															
															 | 
															
																//                    // 用户校验通过,生成token 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    Token token = tokenService.newTxToken(p.getCode(), openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    Token token = tokenService.newTxToken(p.getCode(), openId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    Map<Object, Object> map = new HashMap<Object, Object>(); 
															 | 
															
															 | 
															
																//                    Map<Object, Object> map = new HashMap<Object, Object>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    map.put("id", p.getId()); 
															 | 
															
															 | 
															
																//                    map.put("id", p.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    map.put("uid", p.getCode()); 
															 | 
															
															 | 
															
																//                    map.put("uid", p.getCode()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    map.put("name", p.getName()); 
															 | 
															
															 | 
															
																//                    map.put("name", p.getName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    map.put("token", token.getToken()); 
															 | 
															
															 | 
															
																//                    map.put("token", token.getToken()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    map.put("photo", p.getPhoto()); 
															 | 
															
															 | 
															
																//                    map.put("photo", p.getPhoto()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    if (StringUtils.isNoneEmpty(openid)) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    if (StringUtils.isNoneEmpty(openId)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        //发送微信模板 
															 | 
															
															 | 
															
																//                        //发送微信模板 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        familyService.sendWXMessage(p); 
															 | 
															
															 | 
															
																//                        familyService.sendWXMessage(p); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } 
															 | 
															
															 | 
															
																//                    } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -217,7 +230,7 @@ public class PatientInfoEndpint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    //清空患者的微信标签 
															 | 
															
															 | 
															
																//                    //清空患者的微信标签 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    weiXinTagUtil.deleteTagWithOpenid(p.getOpenid()); 
															 | 
															
															 | 
															
																//                    weiXinTagUtil.deleteTagWithOpenid(p.getOpenid()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    //给患者打微信标签 
															 | 
															
															 | 
															
																//                    //给患者打微信标签 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    weiXinTagUtil.addTagWithOpenid(openid, p.getCode(), p.getName()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    weiXinTagUtil.addTagWithOpenid(openId, p.getCode(), p.getName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    //} 
															 | 
															
															 | 
															
																//                    //} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    return write(200, "登录成功", "data", map); 
															 | 
															
															 | 
															
																//                    return write(200, "登录成功", "data", map); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } else { 
															 | 
															
															 | 
															
																//                } else { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -285,7 +298,7 @@ public class PatientInfoEndpint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        loginLog.setErrorMessage(errorMessage); 
															 | 
															
															 | 
															
																//                        loginLog.setErrorMessage(errorMessage); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        loginLogService.saveLog(loginLog); 
															 | 
															
															 | 
															
																//                        loginLogService.saveLog(loginLog); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        return error(-1, errorMessage); 
															 | 
															
															 | 
															
																//                        return error(-1, errorMessage); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } else if (StringUtils.isEmpty(openid)) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    } else if (StringUtils.isEmpty(openId)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        errorMessage = "无效的OpenID!"; 
															 | 
															
															 | 
															
																//                        errorMessage = "无效的OpenID!"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        loginLog.setErrorMessage(errorMessage); 
															 | 
															
															 | 
															
																//                        loginLog.setErrorMessage(errorMessage); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        loginLogService.saveLog(loginLog); 
															 | 
															
															 | 
															
																//                        loginLogService.saveLog(loginLog); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -293,44 +306,44 @@ public class PatientInfoEndpint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } 
															 | 
															
															 | 
															
																//                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    loginLog.setUserCode(p.getCode()); 
															 | 
															
															 | 
															
																//                    loginLog.setUserCode(p.getCode()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    // 绑定用户手机号和openid 
															 | 
															
															 | 
															
																//                    // 绑定用户手机号和openid 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                    if (!StringUtils.equals(p.getOpenid(), openid) && !"undefined".equals(openid)) {//undefined不更新数据库 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                        //patient.setOpenid(openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                        patientService.updatePatient(p, openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																////                    if (!StringUtils.equals(p.getOpenid(), openId) && !"undefined".equals(openId)) {//undefined不更新数据库 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																////                        //patient.setOpenid(openId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																////                        patientService.updatePatient(p, openId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                    } 
															 | 
															
															 | 
															
																////                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    if (StringUtils.isNotBlank(openid) && !"undefined".equals(openid)) {//undefined不更新数据库 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        //patient.setOpenid(openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    if (StringUtils.isNotBlank(openId) && !"undefined".equals(openId)) {//undefined不更新数据库 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                        //patient.setOpenid(openId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        //1.判斷居民OPenid是不是空 
															 | 
															
															 | 
															
																//                        //1.判斷居民OPenid是不是空 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        if(StringUtils.isNotBlank(p.getOpenid())){ 
															 | 
															
															 | 
															
																//                        if(StringUtils.isNotBlank(p.getOpenid())){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            //如果OPenid与原来用户不相等,则判断登录的openids是否被大于10人登录 
															 | 
															
															 | 
															
																//                            //如果OPenid与原来用户不相等,则判断登录的openids是否被大于10人登录 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            if(!p.getOpenid().equals(openid)){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                            if(!p.getOpenid().equals(openId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                                //判断登录的openids是否被大于10人登录 
															 | 
															
															 | 
															
																//                                //判断登录的openids是否被大于10人登录 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                                if(!patientService.checkOpenidCount(openid)){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                                if(!patientService.checkOpenidCount(openId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                                    errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录"; 
															 | 
															
															 | 
															
																////                                    errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                                    return error(-2, errorMessage); 
															 | 
															
															 | 
															
																////                                    return error(-2, errorMessage); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                                } 
															 | 
															
															 | 
															
																//                                } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            } 
															 | 
															
															 | 
															
																//                            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            patientService.updatePatient(p, openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                            patientService.updatePatient(p, openId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        }else{ 
															 | 
															
															 | 
															
																//                        }else{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            // 判断登录的openids是否被大于10人登录 
															 | 
															
															 | 
															
																//                            // 判断登录的openids是否被大于10人登录 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            if(!patientService.checkOpenidCount(openid)){ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                            if(!patientService.checkOpenidCount(openId)){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                                errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录"; 
															 | 
															
															 | 
															
																////                                errorMessage ="您已超过系统允许登录的最大居民账号数量,当前不再允许使用该微信登录新的居民账号,请使用其他微信号进行登录"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																////                                return error(-2, errorMessage); 
															 | 
															
															 | 
															
																////                                return error(-2, errorMessage); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            }else{ 
															 | 
															
															 | 
															
																//                            }else{ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                                //未达到上限更新用户openid 
															 | 
															
															 | 
															
																//                                //未达到上限更新用户openid 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                                patientService.updatePatient(p, openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                                patientService.updatePatient(p, openId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            } 
															 | 
															
															 | 
															
																//                            } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        } 
															 | 
															
															 | 
															
																//                        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } 
															 | 
															
															 | 
															
																//                    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																// 
															 | 
															
															 | 
															
																// 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    // 用户校验通过,生成token 
															 | 
															
															 | 
															
																//                    // 用户校验通过,生成token 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    Token token = tokenService.newTxToken(p.getCode(), openid); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    Token token = tokenService.newTxToken(p.getCode(), openId); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    Map<Object, Object> map = new HashMap<Object, Object>(); 
															 | 
															
															 | 
															
																//                    Map<Object, Object> map = new HashMap<Object, Object>(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    map.put("id", p.getId()); 
															 | 
															
															 | 
															
																//                    map.put("id", p.getId()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    map.put("uid", p.getCode()); 
															 | 
															
															 | 
															
																//                    map.put("uid", p.getCode()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    map.put("name", p.getName()); 
															 | 
															
															 | 
															
																//                    map.put("name", p.getName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    map.put("token", token.getToken()); 
															 | 
															
															 | 
															
																//                    map.put("token", token.getToken()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    map.put("photo", p.getPhoto()); 
															 | 
															
															 | 
															
																//                    map.put("photo", p.getPhoto()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    if (StringUtils.isNoneEmpty(openid)) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    if (StringUtils.isNoneEmpty(openId)) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        //发送微信模板 
															 | 
															
															 | 
															
																//                        //发送微信模板 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        familyService.sendWXMessage(p); 
															 | 
															
															 | 
															
																//                        familyService.sendWXMessage(p); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } 
															 | 
															
															 | 
															
																//                    } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -341,7 +354,7 @@ public class PatientInfoEndpint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    //清空患者的微信标签 
															 | 
															
															 | 
															
																//                    //清空患者的微信标签 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    weiXinTagUtil.deleteTagWithOpenid(p.getOpenid()); 
															 | 
															
															 | 
															
																//                    weiXinTagUtil.deleteTagWithOpenid(p.getOpenid()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    //给患者打微信标签 
															 | 
															
															 | 
															
																//                    //给患者打微信标签 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    weiXinTagUtil.addTagWithOpenid(openid, p.getCode(), p.getName()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																//                    weiXinTagUtil.addTagWithOpenid(openId, p.getCode(), p.getName()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    //} 
															 | 
															
															 | 
															
																//                    //} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    return write(200, "登录成功", "data", map); 
															 | 
															
															 | 
															
																//                    return write(200, "登录成功", "data", map); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } 
															 | 
															
															 | 
															
																//                } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -355,7 +368,8 @@ public class PatientInfoEndpint extends EnvelopRestEndpoint { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            error(e); 
															 | 
															
															 | 
															
																//            error(e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            return error(-1, "系统异常,登录失败"); 
															 | 
															
															 | 
															
																//            return error(-1, "系统异常,登录失败"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        } 
															 | 
															
															 | 
															
																//        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//    } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																            return null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																} 
															 | 
															
															 | 
															
																} 
															 |