package com.lantone.entity.cdss;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
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 com.diagbot.util.StringUtil;
import lombok.Data;

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

/**
 * <p>
 * 医学术语映射表
 * </p>
 *
 * @author zhaops
 * @since 2021-06-09
 */
@Data
@TableName("tran_mapping_config")
public class MappingConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 是否删除,N:未删除，Y:删除
     */
    private String isDeleted;

    /**
     * 记录创建时间
     */
    private Date gmtCreate;

    /**
     * 记录修改时间,如果时间是1970年则表示纪录未修改
     */
    private Date gmtModified;

    /**
     * 创建人，0表示无创建人值
     */
    private String creator;

    /**
     * 修改人,如果为0则表示纪录未修改
     */
    private String modifier;

    /**
     * 医院id
     */
    private Long hospitalId;

    /**
     * 医学术语类型（ 1-检验套餐、2-检验细项、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医疾病、13-中医证候、14-麻醉）
     */
    private Integer type;

    /**
     * 医院术语名称
     */
    private String hisName;

    /**
     * 医院术语编码
     */
    private String hisCode;

    /**
     * 医院术语细项名称（检验细项）
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String hisDetailName;

    /**
     * 医学标准术语id
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private Long conceptId;

    /**
     * 药品剂型id
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private Long formConceptId;

    /**
     * 是否匹配（0-未匹配、1-已匹配）
     */
    private Integer isMatch;

    /**
     * 数据来源（1-标准词、2-同义词、3-编码、4-历史数据、5-相似词、99-数据迁移）
     */
    private Integer source;

    /**
     * 备注
     */
    private String remark;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(String isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getModifier() {
        return modifier;
    }

    public void setModifier(String modifier) {
        this.modifier = modifier;
    }

    public Long getHospitalId() {
        return hospitalId;
    }

    public void setHospitalId(Long hospitalId) {
        this.hospitalId = hospitalId;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getHisName() {
        return hisName;
    }

    public void setHisName(String hisName) {
        this.hisName = hisName;
    }

    public String getHisCode() {
        return hisCode;
    }

    public void setHisCode(String hisCode) {
        this.hisCode = hisCode;
    }

    public String getHisDetailName() {
        return hisDetailName;
    }

    public void setHisDetailName(String hisDetailName) {
        this.hisDetailName = hisDetailName;
    }

    public Long getConceptId() {
        return conceptId;
    }

    public void setConceptId(Long conceptId) {
        this.conceptId = conceptId;
    }

    public Long getFormConceptId() {
        return formConceptId;
    }

    public void setFormConceptId(Long formConceptId) {
        this.formConceptId = formConceptId;
    }

    public Integer getIsMatch() {
        return isMatch;
    }

    public void setIsMatch(Integer isMatch) {
        this.isMatch = isMatch;
    }

    public Integer getSource() {
        return source;
    }

    public void setSource(Integer source) {
        this.source = source;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public String toString() {
        return "MappingConfig{" +
                "id=" + id +
                ", isDeleted=" + isDeleted +
                ", gmtCreate=" + gmtCreate +
                ", gmtModified=" + gmtModified +
                ", creator=" + creator +
                ", modifier=" + modifier +
                ", hospitalId=" + hospitalId +
                ", type=" + type +
                ", hisName=" + hisName +
                ", hisCode=" + hisCode +
                ", hisDetailName=" + hisDetailName +
                ", conceptId=" + conceptId +
                ", formConceptId=" + formConceptId +
                ", isMatch=" + isMatch +
                ", source=" + source +
                ", remark=" + remark +
                "}";
    }

    /*@Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        MappingConfig mappingConfig = (MappingConfig) o;
        return Objects.equals(id, mappingConfig.id)
                && Objects.equals(isDeleted, mappingConfig.isDeleted)
                && Objects.equals(hospitalId, mappingConfig.hospitalId)
                && Objects.equals(type, mappingConfig.type)
                && Objects.equals(hisName, mappingConfig.hisName)
                && Objects.equals(hisCode, mappingConfig.hisCode)
                && Objects.equals(hisDetailName, mappingConfig.hisDetailName)
                && Objects.equals(conceptId, mappingConfig.conceptId)
                && Objects.equals(formConceptId, mappingConfig.formConceptId)
                && Objects.equals(isMatch, mappingConfig.isMatch)
                //&& Objects.equals(source, mappingConfig.source)
                ;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, isDeleted, hospitalId, type, hisName, hisCode, hisDetailName, conceptId, formConceptId, isMatch);
    }*/

    public static boolean nonNull(MappingConfig o) {
        return !(o == null
                || (o.hospitalId == null
                && o.type == null
                && StringUtil.isBlank(o.hisName)
                && StringUtil.isBlank(o.hisCode)
                && StringUtil.isBlank(o.hisDetailName)
                && o.conceptId == null
                && o.formConceptId == null
                && o.isMatch == null
                && o.source == null));
    }
}