|
@ -4,8 +4,12 @@ import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
import org.apache.http.NameValuePair;
|
|
import org.apache.http.NameValuePair;
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
@ -24,6 +28,8 @@ import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
|
|
|
|
|
|
import javax.print.Doc;
|
|
|
|
|
|
@Component
|
|
@Component
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public class SMSService extends BaseService {
|
|
public class SMSService extends BaseService {
|
|
@ -32,7 +38,10 @@ public class SMSService extends BaseService {
|
|
public SMSDao smsDao;
|
|
public SMSDao smsDao;
|
|
@Autowired
|
|
@Autowired
|
|
PatientDao patientDao;
|
|
PatientDao patientDao;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
SignFamilyDao signFamilyDao;
|
|
|
|
@Autowired
|
|
|
|
DoctorDao doctorDao;
|
|
/**
|
|
/**
|
|
* 发送短信验证码接口
|
|
* 发送短信验证码接口
|
|
*
|
|
*
|
|
@ -81,9 +90,9 @@ public class SMSService extends BaseService {
|
|
// 1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录
|
|
// 1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录
|
|
if (type == 1) {
|
|
if (type == 1) {
|
|
// 患者注册
|
|
// 患者注册
|
|
|
|
|
|
sms.setContent("您的注册验证码为:" + captcha);
|
|
sms.setContent("您的注册验证码为:" + captcha);
|
|
} else if (type == 2 || type == 3) {
|
|
} else if (type == 2 || type == 3) {
|
|
// 找回密码
|
|
|
|
sms.setContent("您找回密码验证码为:" + captcha);
|
|
sms.setContent("您找回密码验证码为:" + captcha);
|
|
} else if (type == 4 || type == 5) {
|
|
} else if (type == 4 || type == 5) {
|
|
// 登录
|
|
// 登录
|
|
@ -108,6 +117,38 @@ public class SMSService extends BaseService {
|
|
// 其他验证码
|
|
// 其他验证码
|
|
sms.setContent("验证码:" + captcha);
|
|
sms.setContent("验证码:" + captcha);
|
|
}
|
|
}
|
|
|
|
if(type==2||type==4||type==10) {//患者
|
|
|
|
List<Patient> patients = patientDao.findByMobile(mobile);
|
|
|
|
if(patients!=null&&patients.size()>0){
|
|
|
|
SignFamily signFamily = signFamilyDao.findByMobile(mobile);
|
|
|
|
if(signFamily!=null){
|
|
|
|
sms.setUserType(0);
|
|
|
|
sms.setUserCode(signFamily.getPatient());
|
|
|
|
sms.setHospital(signFamily.getHospital());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else if(type==3||type==5||type==6){//医生
|
|
|
|
Doctor d = doctorDao.findByMobile(mobile);
|
|
|
|
if(d!=null){
|
|
|
|
sms.setUserType(0);
|
|
|
|
sms.setUserCode(d.getCode());
|
|
|
|
sms.setHospital(d.getHospital());
|
|
|
|
}
|
|
|
|
}else{//未知
|
|
|
|
Doctor d = doctorDao.findByMobile(mobile);
|
|
|
|
if(d!=null){
|
|
|
|
sms.setUserType(0);
|
|
|
|
sms.setUserCode(d.getCode());
|
|
|
|
sms.setHospital(d.getHospital());
|
|
|
|
}else{
|
|
|
|
SignFamily signFamily = signFamilyDao.findByMobile(mobile);
|
|
|
|
if(signFamily!=null){
|
|
|
|
sms.setUserType(0);
|
|
|
|
sms.setUserCode(signFamily.getPatient());
|
|
|
|
sms.setHospital(signFamily.getHospital());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
sms.setCaptcha(captcha);
|
|
sms.setCaptcha(captcha);
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
// 延后5分钟
|
|
// 延后5分钟
|