package com.rf.psychological.scale.dao.model;

import com.rf.psychological.base.model.BaseEntity;
import lombok.*;

import javax.persistence.*;

/**
 * @author zsy
 * @description:用户测试记录信息表
 * @date 2021/6/17 15:55
 */
@Entity
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_user_record", indexes = {
        @Index(columnList = "test_plan_id"),
        @Index(columnList = "phone,institution_no"),
        @Index(columnList = "flag")
})
@org.hibernate.annotations.Table(appliesTo = "t_user_record", comment = "用户测试记录信息表")
public class UserRecordEntity extends BaseEntity {

    @Column(name = "phone", columnDefinition = "varchar(20) not null comment '用户手机号（登录账号）")
    private String phone;

    @Column(name = "institution_no", columnDefinition = "varchar(50) comment '所属机构编码'")
    private String institutionNo;

    @Column(name = "flag", columnDefinition = "varchar(50) comment '量表/认知任务/生理标志'")
    private String flag;

    @Column(name = "name", columnDefinition = "varchar(255) comment '量表/认知任务/生理名称'")
    private String name;

    @Column(name = "test_date", columnDefinition = "varchar(50) not null comment '测试日期'")
    private String testDate;

    @Column(name = "test_result", columnDefinition = "text comment '测试结果'")
    private String testResult;

    @Column(name = "test_results", columnDefinition = "text comment '测试结果(String类型)'")
    private String testResults;

    @Column(name = "file_name", columnDefinition = "varchar(255) comment '测试结果文件名称'")
    private String fileName;

    @Column(name = "img", columnDefinition = "text comment 'b64格式图片'")
    private String img;

    @Column(name = "type", columnDefinition = "varchar(2) comment '类型：0-量表；1-认知任务；2-生理'")
    private String type;

    @Column(name = "test_record", columnDefinition = "text comment '答题记录'")
    private String testRecord;

    @Column(name = "test_plan_id", columnDefinition = "varchar(36) comment '测试计划id，如果是从测试计划中进入的任务，并且完成，此字段将是测试计划的id，正常做的测试此字段为0'")
    private String testPlanId;

    @Transient
    private String subjectOrCognitiveId;

    @Transient
    private String pay;//是否已支付(0--免费；1--未支付；2--已支付）

}
