package thyyxxk.webserver.entity.casefrontsheet.pojo;

import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import thyyxxk.webserver.constants.Gender;
import thyyxxk.webserver.entity.casefrontsheet.CaseFrontsheetMain;
import thyyxxk.webserver.entity.casefrontsheet.state.AuditState;

import java.util.Date;
import java.util.List;

/**
 * 病案质控申请与审核
 */
@Data
@TableName(value = "t_frontsheet_quality_verification")
public class FrontsheetQualityVerification implements Serializable {

    /**
     * 唯一主键
     */
    @TableId(type = IdType.INPUT)
    private String id;

    /**
     * 患者住院号
     */
    private String patNo;

    /**
     * 患者住院次数
     */
    private Integer times;

    /**
     * 患者姓名
     */
    private String patName;

    /**
     * 患者性别
     */
    private Gender patGender;

    /**
     * 医生编码
     */
    private String doctorCode;

    /**
     * 医生姓名
     */
    private String doctorName;

    /**
     * 出院科室编码
     */
    private String disDeptCode;

    /**
     * 出院科室编码
     */
    private String disDeptName;

    /**
     * 申请时间
     */
    private Date applicationTime;

    /**
     * 审核状态
     */
    private AuditState auditState;

    /**
     * 审核人员编码
     */
    private String auditStaffCode;

    /**
     * 审核人员姓名
     */
    private String auditStaffName;

    /**
     * 审核时间
     */
    private Date auditTime;

    /**
     * 审核备注
     */
    private String auditRemark;

    /**
     * 编码员备注
     */
    private String coderNote;

    private String majorError;

    @TableField(exist = false)
    private List<String> majorErrorList;

    @TableField(exist = false)
    private CaseFrontsheetMain sheet;

    public String getGenderName() {
        if (null == patGender) {
            return null;
        }
        switch (patGender) {
            case MALE:
                return "男";
            case FEMALE:
                return "女";
            default:
                return "未知";
        }
    }

    public String getStateName() {
        if (null == auditState) {
            return null;
        }
        switch (auditState) {
            case APPROVED:
                return "审核通过";
            case REJECTED:
                return "审核驳回";
            case INITIAL:
                return "未审核";
            default:
                return "未知的状态";
        }
    }
}
