Explorar o código

Do与数据库不对应

chenyongxing %!s(int64=6) %!d(string=hai) anos
pai
achega
51478e3043

+ 205 - 73
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -2,14 +2,10 @@ package com.yihu.jw.entity.base.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
@ -72,6 +68,10 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
	 * 联系电话
	 */
	private String phone;
    /**
     * 社保卡号
     */
	private String ssc;
    /**
	 * 头像http地址
@ -117,6 +117,15 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
     * 街道名称
     */
    private String streetName;
    /**
     * 居住居委会代码
     */
    private String committeeCode;
    /**
     * 居住居委会名称
     */
    private String committeeName;
    /**
     * 地址
@ -124,132 +133,166 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String address;
    /**
     * 居住省代码
     * 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
     */
    private String liveProvinceCode;
    private String disease;
    /**
     * 病情:0绿标,1黄标,2红标,3重点关注
     */
    private String diseaseCondition;
    /**
     * 居住省名称
     * 总积分
     */
    private String liveProvinceName;
    private String points;
    /**
     * 居住市代码
     * 病历总数
     */
    private String liveCityCode;
    private String recordAmount;
    /**
     * 居住市名称
     * 微信编号
     */
    private String liveCityName;
    private String openid;
    /**
     * 居住区县代码
     * 用户状态:1正常,0禁用,-1恶意注册,2审核中
     */
    private String liveTownCode;
    private String patientStatus;
    /**
     * 居住区县名称
     * 联系方式备注【基卫】
     */
    private String liveTownName;
    private String mobileRemarks;
    /**
     * 居住街道代码
     * 第一次添加open的时间
     */
    private String liveStreetCode;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date openidTime;
    /**
     * 居住街道名称
     * 绑定电子社保卡主体(共济为操作人code,医社保关联patient_medicare_card)
     */
    private String liveStreetName;
    private String principalCode;
    /**
     * 是否绑定电子社保卡 (0否 1是)
     */
    private String sicardStatus;
    /**
     * 居住居委会代码
     * 电子社保卡绑定时间
     */
    private String committeeCode;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date sicardTime;
    /**
     * 居住居委会名称
     * 是否分配过微信标签
     */
    private String committeeName;
    private Integer isWxtag;
    /**
	 * 总积分
	 */
	private String points;
     * 微信tagId
     */
    private String wxtagid;
    /**
	 * 病历总数
	 */
	private String recordAmount;
     * 居民预警状态:0为标准,1为预警状态
     */
    private Integer standardStatus;
    /**
	 * 微信编号
	 */
	private String openid;
     * 医疗保险号
     */
    private String medicareNumber;
    /**
	 * 用户状态:1正常,0禁用,-1恶意注册,2审核中
	 */
	private String patientStatus;
     * unionId 开发平台唯一标识
     */
    private String unionid;
    /**
	 * 联系方式备注【基卫】
	 */
	private String mobileRemarks;
     * 作废标识,1正常,0作废
     */
    private String del;
    /**
	 * 第一次添加open的时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date openidTime;
     * 登录时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date loginDate;
    /**
	 * 绑定电子社保卡主体(共济为操作人code,医社保关联patient_medicare_card)
	 */
	private String principalCode;
     * 锁定时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date lockedDate;
    /**
	 * 是否绑定电子社保卡 (0否 1是)
	 */
	private String sicardStatus;
     * 是否被锁定;1为锁定,0为可用
     */
    private Integer locked;
    /**
	 * 电子社保卡绑定时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date sicardTime;
     * 是否可用
     */
    private Integer enabled;
    /**
	 * 是否分配过微信标签
	 */
	private Integer isWxtag;
     * 备注
     */
    private String remark;
    /**
	 * 微信tagId
	 */
	private String wxtagid;
     * 登录失败次数
     */
    private Integer loginFailureCount;
    /**
	 * 居民预警状态:0为标准,1为预警状态
	 */
	private Integer standardStatus;
     * 居住区县代码
     */
    private String liveTownCode;
    /**
	 * unionId 开发平台唯一标识
	 */
	private String unionid;
     * 居住区县名称
     */
    private String liveTownName;
    /**
	 * 作废标识,1正常,0作废
	 */
	private String del;
     * 居住市代码
     */
    private String liveCityCode;
    /**
     * 居住市名称
     */
    private String liveCityName;
    /**
     * 居住省代码
     */
    private String liveProvinceCode;
	/**
	 * 备注
	 */
	private String remark;
    /**
     * 居住省名称
     */
    private String liveProvinceName;
    /**
     * 居住街道代码
     */
    private String liveStreetCode;
    /**
     * 居住街道名称
     */
    private String liveStreetName;
	@Column(name = "saas_id")
@ -535,14 +578,16 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.del = del;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    @Column(name = "remark")
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "live_province_code")
    public String getLiveProvinceCode() {
        return liveProvinceCode;
    }
@ -551,6 +596,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.liveProvinceCode = liveProvinceCode;
    }
    @Column(name = "live_province_name")
    public String getLiveProvinceName() {
        return liveProvinceName;
    }
@ -559,6 +605,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.liveProvinceName = liveProvinceName;
    }
    @Column(name = "live_city_code")
    public String getLiveCityCode() {
        return liveCityCode;
    }
@ -567,6 +614,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.liveCityCode = liveCityCode;
    }
    @Column(name = "live_city_name")
    public String getLiveCityName() {
        return liveCityName;
    }
@ -575,6 +623,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.liveCityName = liveCityName;
    }
    @Column(name = "live_town_code")
    public String getLiveTownCode() {
        return liveTownCode;
    }
@ -583,6 +632,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
        this.liveTownCode = liveTownCode;
    }
    @Column(name = "live_town_name")
    public String getLiveTownName() {
        return liveTownName;
    }
@ -607,4 +657,86 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setLiveStreetName(String liveStreetName) {
        this.liveStreetName = liveStreetName;
    }
    @Column(name = "ssc")
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    @Column(name = "disease")
    public String getDisease() {
        return disease;
    }
    public void setDisease(String disease) {
        this.disease = disease;
    }
    @Column(name = "disease_condition")
    public String getDiseaseCondition() {
        return diseaseCondition;
    }
    public void setDiseaseCondition(String diseaseCondition) {
        this.diseaseCondition = diseaseCondition;
    }
    @Column(name = "medicare_number")
    public String getMedicareNumber() {
        return medicareNumber;
    }
    public void setMedicareNumber(String medicareNumber) {
        this.medicareNumber = medicareNumber;
    }
    @Column(name = "login_date")
    public Date getLoginDate() {
        return loginDate;
    }
    public void setLoginDate(Date loginDate) {
        this.loginDate = loginDate;
    }
    @Column(name = "locked_date")
    public Date getLockedDate() {
        return lockedDate;
    }
    public void setLockedDate(Date lockedDate) {
        this.lockedDate = lockedDate;
    }
    @Column(name = "locked")
    public Integer getLocked() {
        return locked;
    }
    public void setLocked(Integer locked) {
        this.locked = locked;
    }
    @Column(name = "enabled")
    public Integer getEnabled() {
        return enabled;
    }
    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }
    @Column(name = "login_failure_count")
    public Integer getLoginFailureCount() {
        return loginFailureCount;
    }
    public void setLoginFailureCount(Integer loginFailureCount) {
        this.loginFailureCount = loginFailureCount;
    }
}

+ 4 - 113
svr/svr-patient/src/main/java/com/yihu/jw/patient/endpoint/personal_info/PatientEndpoint.java

@ -95,126 +95,17 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                          @ApiParam(value = "微信openId", name = "openid") @RequestParam(value = "openid", required = false) String openid,
                          @ApiParam(value = "密码", name = "password") @RequestParam(value = "password", required = false) String password) {
        Envelop envelop = new Envelop();
        boolean b = CommonUtils.isMobile(mobile);
        if (!b) {
            envelop.setMessage("手机号码格式不正确");
            envelop.setStatus(-1);
            return envelop;
        }
        //验证手机是否被注册
        List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile, "1");
        if (list != null && list.size() > 0) {
            envelop.setMessage("该手机号已经注册!");
            Map<String, Object> result = patientService.regist(mobile, captcha, password, openid);
            if ("-1".equals(result.get("code"))) {
                envelop.setStatus(-1);
                envelop.setMessage(result.get("message") + "");
            } else {
                envelop.setStatus(200);
                envelop.setMessage(result.get("message") + "");
            }
        }
        return envelop;
    }
    /**
     * 患者微信登录接口
     *
     * @param captcha  短信号
     * @param mobile   电话号码
     * @param password 登录密码
     * @return
     */
    @RequestMapping(value = BaseRequestMapping.BasePatient.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) throws Exception {
        Envelop envelop = new Envelop();
        boolean b = CommonUtils.isMobile(mobile);
        if (!b) {
            envelop.setMessage("手机号码格式不正确");
            envelop.setStatus(-1);
            return envelop;
        }
        //验证手机是否被注册
        List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile, "1");
        if (CollectionUtils.isEmpty(list)) {
            envelop.setMessage("该手机未注册");
        Map<String, Object> result = patientService.regist(mobile, captcha, password, openid);
        if ("-1".equals(result.get("code"))) {
            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 (org.apache.commons.lang3.StringUtils.isNotBlank(password)) {
            password = rsaService.decryptString(password);
            password = org.apache.commons.lang3.StringUtils.reverse(password);
            //生成MD5
            String loginPassword = MD5.GetMD5Code(password + p.getSalt());
            if (loginPassword.equals(p.getPassword())) {
                //使用密码登录成功
                isLogin = true;
            } else {
                //使用密码登录失败
                envelop.setMessage("密码错误");
                envelop.setStatus(-1);
                return envelop;
            }
            envelop.setMessage(result.get("message") + "");
        } else {
            //验证码登陆
            int res = baseSmsService.check(mobile, 4, captcha);
            if (-2 == res) {
                envelop.setMessage("验证码已过期!");
                envelop.setStatus(-1);
                return envelop;
            } else if (-1 == res) {
                envelop.setMessage("请输入正确的验证码!");
                envelop.setStatus(-1);
                return envelop;
            } else if (0 == res) {
                envelop.setMessage("验证码无效!");
                envelop.setStatus(-1);
                return envelop;
            } else {
                //使用密码登录成功
                isLogin = true;
            }
        }
        if (isLogin) {
            if (StringUtils.isNotBlank(openId) && !"undefined".equals(openId)) {
                //更新openId
                if (!openId.equals(p.getOpenid())) {
                    patientService.updateOpenId(p.getId(), openId);
                }
            }
            // 用户校验通过,生成token
            Token token = tokenService.newTxToken(p.getId(), p.getOpenid());
            Map<Object, Object> map = new HashMap<Object, Object>();
            map.put("id", p.getId());
            map.put("uid", p.getId());
            map.put("name", p.getName());
            map.put("token", token.getToken());
            map.put("photo", p.getPhoto());
            envelop.setMessage("登陆成功");
            envelop.setStatus(200);
            envelop.setMessage(result.get("message") + "");
        }
        return envelop;
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.CREATE)
    @ApiOperation(value = "创建")
    public Envelop create(

+ 12 - 2
svr/svr-patient/src/main/java/com/yihu/jw/patient/service/personal_Info/PatientService.java

@ -80,7 +80,6 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
            return map;
        } else{
            BasePatientDO patient = new BasePatientDO();
            patient.setMobile(mobile);
            if(StringUtils.isNotBlank(password)){
                //增加密码
                if(password.length()<6 || password.length()>20){
@ -95,16 +94,27 @@ public class PatientService extends BasePatientService<BasePatientDO, BasePatien
                patient.setOpenid(openid);
                patient.setOpenidTime(new Date());
            }
            patient.setMobile(mobile);
            patient.setLocked(0);
            patient.setEnabled(0);
            patient.setDel("1");
            patient.setPatientStatus("1");
            this.save(patient);
            map.put("code",1);
            map.put("message","注册成功");
            return map;
        }
    }
    /**
     * 预注册功能接口
     * @param phone
     * @return
     */
//    public Map<String,Object> bespeakRegist(String phone){
//
//    }
    /**
     * 设置登录密码/修改密码
     * @param id