|
@ -13,7 +13,9 @@ import com.yihu.wlyy.service.app.account.PatientInfoService;
|
|
|
import com.yihu.wlyy.service.app.sign.FamilyContractService;
|
|
|
import com.yihu.wlyy.service.app.team.AdminTeamService;
|
|
|
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
|
|
|
import com.yihu.wlyy.service.common.SMSService;
|
|
|
import com.yihu.wlyy.service.common.account.DoctorService;
|
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.service.common.account.TokenService;
|
|
|
import com.yihu.wlyy.util.*;
|
|
|
import com.yihu.wlyy.web.WeixinBaseController;
|
|
@ -61,6 +63,10 @@ public class PatientController extends WeixinBaseController {
|
|
|
AdminTeamService teamService;
|
|
|
@Autowired
|
|
|
TokenDao tokenDao;
|
|
|
@Autowired
|
|
|
PatientService patientService;
|
|
|
@Autowired
|
|
|
private SMSService smsService;
|
|
|
|
|
|
/**
|
|
|
* 患者基本信息查询接口
|
|
@ -712,11 +718,14 @@ public class PatientController extends WeixinBaseController {
|
|
|
* @param mobile 新手机号
|
|
|
* @param captcha 验证码
|
|
|
* @param type 1:变更手机号 2:绑定手机号
|
|
|
* @param relation 0:第一次请求(如果新号码成员有多个会返回集合从新请求为是否绑定成为家人)
|
|
|
* 1、第二次请求不成为家人,
|
|
|
* 2.第二次请求传入成为家人
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/mobile_update", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String changePatientMobile(String mobile, String captcha, int type) {
|
|
|
public String changePatientMobile(String mobile, String captcha, int type,int relation) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(mobile)) {
|
|
|
return error(-1, "请填写新手机号码");
|
|
@ -727,15 +736,19 @@ public class PatientController extends WeixinBaseController {
|
|
|
if (type != 1 && type != 2) {
|
|
|
return error(-1, "操作类型参数错误");
|
|
|
}
|
|
|
|
|
|
int result = patientInfoService.changeMobile(getUID(), mobile, captcha, type);
|
|
|
|
|
|
if(relation==0){
|
|
|
int smsCheck = smsService.check(mobile, type == 1 ? 8 : 9, captcha);
|
|
|
if (smsCheck != 1) {
|
|
|
return error(-1, "验证码错误");
|
|
|
}
|
|
|
List<Patient> patients = patientService.findByMobile(mobile);
|
|
|
if(patients!=null&&patients.size()>0){
|
|
|
return write(1, "新手机存在多个用户","data",patients);
|
|
|
}
|
|
|
}
|
|
|
int result = patientInfoService.changeMobile(getUID(), mobile, captcha, type,relation);
|
|
|
if (result == -1) {
|
|
|
return error(-1, "居民信息查找失败");
|
|
|
} else if (result == -2) {
|
|
|
return error(-1, "手机号已注册");
|
|
|
} else if (result == -3) {
|
|
|
return error(-1, "验证码错误");
|
|
|
} else if (result == 1) {
|
|
|
return write(200, "手机号更新成功");
|
|
|
} else {
|