package com.xinelu.manage.domain.patientinfo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;
import com.xinelu.common.custominterface.Insert;
import com.xinelu.common.custominterface.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 被护理人基本信息对象 patient_info
 *
 * @author xinyilu
 * @date 2022-09-02
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "被护理人基本信息对象", description = "patient_info")
public class PatientInfo extends BaseDomain implements Serializable {
    private static final long serialVersionUID = -9042864713058829058L;
    /**
     * 主键id
     */
    @NotNull(message = "被护理人id不能为空", groups = {Update.class})
    private Long id;

    /**
     * 居住小区编码
     */
    @ApiModelProperty(value = "居住小区编码")
    @Excel(name = "居住小区编码")
    private String communityCode;

    /**
     * 所属区域编码
     */
    @ApiModelProperty(value = "所属区域编码")
    @Excel(name = "所属区域编码")
    private String areaCode;

    /**
     * 用户编号
     */
    @ApiModelProperty(value = "用户编号")
    @Excel(name = "用户编号")
    private String patientCode;

    /**
     * 用户姓名
     */
    @NotBlank(message = "用户姓名不能为空", groups = {Update.class})
    @ApiModelProperty(value = "用户姓名")
    @Excel(name = "用户姓名")
    private String patientName;

    /**
     * 身份证号
     */
    @Length(max = 18, message = "身份证号不能超过18位", groups = {Insert.class, Update.class})
    @NotBlank(message = "身份证号不能为空", groups = {Update.class})
    @ApiModelProperty(value = "身份证号")
    @Excel(name = "身份证号")
    private String cardNo;

    /**
     * sys_user表id
     */
    @ApiModelProperty(value = "sys_user表id")
    @Excel(name = "sys_user表id")
    private Long userId;

    /**
     * 用户微信unionid
     */
    @ApiModelProperty(value = "用户微信unionid")
    @Excel(name = "用户微信unionid")
    private String unionid;

    /**
     * 用户微信openid
     */
    @ApiModelProperty(value = "用户微信openid")
    @Excel(name = "用户微信openid")
    private String openid;

    /**
     * 手机号码
     */
    @Length(max = 11, message = "手机号码不能超过11位", groups = {Insert.class, Update.class})
    @NotBlank(message = "手机号码不能为空", groups = {Update.class})
    @ApiModelProperty(value = "手机号码")
    @Excel(name = "手机号码")
    private String phone;

    /**
     * 居住地址
     */
    @Length(max = 100, message = "居住地址不能超过100位", groups = {Insert.class, Update.class})
    @ApiModelProperty(value = "居住地址")
    @Excel(name = "居住地址")
    private String address;

    /**
     * 紧急联系人名称
     */
    @ApiModelProperty(value = "紧急联系人名称")
    @Excel(name = "紧急联系人名称")
    private String urgentContactName;

    /**
     * 紧急联系人电话
     */
    @ApiModelProperty(value = "紧急联系人电话")
    @Excel(name = "紧急联系人电话")
    private String urgentContactPhone;

    /**
     * 居住小区名称
     */
    @Length(max = 100, message = "居住小区名称不能超过100位", groups = {Insert.class, Update.class})
    @ApiModelProperty(value = "居住小区名称")
    @Excel(name = "居住小区名称")
    private String communityAliasName;

    /**
     * 住址经度
     */
    @ApiModelProperty(value = "住址经度")
    @Excel(name = "住址经度")
    private String homeLongitude;

    /**
     * 住址纬度
     */
    @ApiModelProperty(value = "住址纬度")
    @Excel(name = "住址纬度")
    private String homeLatitude;

    /**
     * 个人头像地址
     */
    @ApiModelProperty(value = "个人头像地址")
    @Excel(name = "个人头像地址")
    private String headPictureUrl;

    /**
     * 登录密码
     */
    @Length(min = 6, max = 10, message = "密码不能超过10位", groups = {Insert.class})
    @NotBlank(message = "密码", groups = {Insert.class, Update.class})
    @ApiModelProperty(value = "登录密码")
    @Excel(name = "登录密码")
    private String password;

    /**
     * 会员积分
     */
    @ApiModelProperty(value = "会员积分")
    @Excel(name = "会员积分")
    private Integer integral;

    /**
     * 登录标识
     */
    @ApiModelProperty(value = "完善标识")
    @Excel(name = "完善标识")
    private Integer loginFlag;

    /**
     * 主账号标识，0：主账号，1：子账号
     */
    private Integer primaryAccountFlag;

    /**
     * 所选服务id，多个用逗号隔开
     */
    private String serviceIds;

    /**
     * 所在位置名称
     */
    private String locationName;

    /**
     * 会员完善信息来源
     */
    private String source;

    /**
     * 邀请好友完善信息方式-邀请人id
     */
    private Long invitationPatientId;

    /**
     * 累计签到次数
     */
    private Integer totalSignInDays;

    /**
     * 性别
     */
    private String sex;

    /**
     * 出生日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate birthDate;

    /**
     * 逻辑删除标识，0：否，1：是
     */
    private Integer delFlag;

    /**
     * 小程序个人微信二维码图片存放地址
     */
    private String personalWechatCodeUrl;

    /**
     * 失能情况，NOT_DISABLED：未失能，DISABLED：已失能
     */
    private String disablingCondition;

    /**
     * 失能原因
     */
    private String disablingReason;

    /**
     * 基础疾病
     */
    private String disease;

    /**
     * 绑定城市(1：德州 2：东营)
     */
    private String cityCode;

    /**
     * 小程序绑定时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime bindingTime;

    /**
     * 当前是否选中(0： 否 1：是)
     */
    private String isChecked;

    /**
     * 同一微信绑定标识openid，用于区分同一账号绑定的居民
     */
    @ApiModelProperty(value = "同一微信绑定标识openid，用于区分同一账号绑定的居民")
    @Excel(name = "同一微信绑定标识openid，用于区分同一账号绑定的居民")
    private String bindOpenid;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("communityCode", getCommunityCode())
                .append("areaCode", getAreaCode())
                .append("patientCode", getPatientCode())
                .append("patientName", getPatientName())
                .append("cardNo", getCardNo())
                .append("userId", getUserId())
                .append("unionid", getUnionid())
                .append("openid", getOpenid())
                .append("phone", getPhone())
                .append("address", getAddress())
                .append("urgentContactName", getUrgentContactName())
                .append("urgentContactPhone", getUrgentContactPhone())
                .append("homeLongitude", getHomeLongitude())
                .append("homeLatitude", getHomeLatitude())
                .append("headPictureUrl", getHeadPictureUrl())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("password", getPassword())
                .append("integral", getIntegral())
                .append("loginFlag", getLoginFlag())
                .append("primaryAccountFlag", getPrimaryAccountFlag())
                .append("delFlag", getDelFlag())
                .append("cityCode", getCityCode())
                .append("bindingTime", getBindingTime())
                .append("isChecked", getIsChecked())
                .append("bindOpenid", getBindOpenid())
                .toString();
    }
}
