package thyyxxk.webserver.entity.executeItem;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.math.BigDecimal;
import java.util.Date;

/**
 * (YzZyPatientFee)表实体类
 *   所有非药品的费用条数 中间表
 * @author lihong
 * @since 2024-01-08 16:23:10
 */
@SuppressWarnings("serial")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("yz_zy_patient_fee")
@ToString
public class YzZyPatientFee {
    private String inpatientNo;
    private Integer admissTimes;
    /**账页号*/
    private Integer ledgerSn;
    /**细目序列号*/
    private Integer detailSn;
    /** 收费日期*/
    private Date chargeDate;
    /** 操作员工号*/
    private String opIdCode;
    /**收费编码  见zd_charge_item 的 code*/
    private String chargeCode;
    /**婴儿标识 1 婴儿  0 成人*/
    private String infantFlag;
    /** 1 未接收 0 接收 2 无效 5 科室确认 6 科室录入 */
    private String chargeStatus;
    /** 单价*/
    private BigDecimal chargeFee;
    /** 自费标志 1自费 */
    private String selfFlag;
    /** 单列标志 1单列*/
    private String separateFlag;
    /** 贵重标志*/
    private String suppressFlag;
    /** 执行时间*/
    private Date occTime;
    /** 医嘱号*/
    private BigDecimal actOrderNo;
    /**科室*/
    private String deptCode;
    /**病室*/
    private String wardCode;
    /**数量*/
    private BigDecimal orderCount;
    /** 0 普通1=需住院确认 2=住院已确认已付款 3=住院已确认*/
    private String paySelf;
    /** 执行科室*/
    private String execUnit;
    /** 住院流水号*/
    private String zySerialNo;
    /** 1手术项目*/
    private String opFlag;
    /** 手术医生编码*/
    private String opId;
    private String ybSelfFlag;
    /** 手术时间*/
    private Date opDate;
    @TableField(exist = false)
    private String actOrderNoStr;
    public String getActOrderNoStr() {
        if(actOrderNo != null){
            actOrderNoStr = actOrderNo.toPlainString();
        }
        return actOrderNoStr;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        YzZyPatientFee that = (YzZyPatientFee) o;

        return new EqualsBuilder()
                .append(inpatientNo, that.inpatientNo)
                .append(admissTimes, that.admissTimes)
                .append(chargeCode, that.chargeCode)
                .append(occTime, that.occTime)
                .append(actOrderNo, that.actOrderNo)
                .append(deptCode, that.deptCode)
                .append(wardCode, that.wardCode)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(inpatientNo)
                .append(admissTimes)
                .append(chargeCode)
                .append(occTime)
                .append(actOrderNo)
                .append(deptCode)
                .append(wardCode)
                .toHashCode();
    }
}

