Sfoglia il codice sorgente

图文消息连接添加

8 anni fa
parent
commit
a3271ec68a

+ 36 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/message/SMS.java

@ -24,6 +24,42 @@ public class SMS extends IdEntity {
    private Date deadline;// 过期时间
    private Integer status;// 状态,0未发送,1已发送
    private Date czrq;
    private String userCode;//用户标示
    private Integer userType;//用户类型
    private String town; //所属区
    private String hospital;//所属机构,未签约用居民地址
    public String getUserCode() {
        return userCode;
    }
    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }
    public int getUserType() {
        return userType;
    }
    public void setUserType(int userType) {
        this.userType = userType;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getMobile() {
        return mobile;

+ 43 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/SMSService.java

@ -4,8 +4,12 @@ import java.util.ArrayList;
import java.util.Date;
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.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
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.SystemConf;
import javax.print.Doc;
@Component
@Transactional(rollbackFor = Exception.class)
public class SMSService extends BaseService {
@ -32,7 +38,10 @@ public class SMSService extends BaseService {
    public SMSDao smsDao;
    @Autowired
    PatientDao patientDao;
    @Autowired
    SignFamilyDao signFamilyDao;
    @Autowired
    DoctorDao doctorDao;
    /**
     * 发送短信验证码接口
     *
@ -81,9 +90,9 @@ public class SMSService extends BaseService {
        // 1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录
        if (type == 1) {
            // 患者注册
            sms.setContent("您的注册验证码为:" + captcha);
        } else if (type == 2 || type == 3) {
            // 找回密码
            sms.setContent("您找回密码验证码为:" + captcha);
        } else if (type == 4 || type == 5) {
            // 登录
@ -108,6 +117,38 @@ public class SMSService extends BaseService {
            // 其他验证码
            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);
        Date date = new Date();
        // 延后5分钟