package cn.sh.stc.sict.cloud.common.data.dto;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;
import java.util.Date;

/**
 * @author admin
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("chain_event_info")
public class EventInfo extends Model<EventInfo> {

    @ApiModelProperty(hidden = true)
    @TableId("`key`")
    protected String key;

    private String hospId;
    private String doctorId;
    private String patientId;
    @ApiModelProperty(example = "2020-09-10 08:29:31")
    @TableField("`time`")
    private Date time;
    /**
     * 操作类型：
     */
    private String type;
    /**
     * 业务类型：知情同意书
     */
    private String biz;
    /**
     * 具体数据
     */
    @TableField(typeHandler = JacksonTypeHandler.class)
    private Object data;

    /**
     * 入链状态：0-失败 1-成功
     */
    private Byte status;

    /**
     * 主键值
     */
    @Override
    protected Serializable pkVal(){
        return this.key;
    }

    @Override
    public String toString() {
        return "EventInfo{" +
                "key='" + key + '\'' +
                ", hospId='" + hospId + '\'' +
                ", doctorId='" + doctorId + '\'' +
                ", patientId='" + patientId + '\'' +
                ", time=" + time +
                ", type='" + type + '\'' +
                ", biz='" + biz + '\'' +
                ", data='" + data + '\'' +
                '}';
    }
}
