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;

/**
 * (YzYpZyOrder)表实体类
 *
 * @author lihong
 * @since 2024-01-08 16:18:34
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("yz_yp_zy_order")
@ToString
public class YzYpZyOrder {
    /**科室*/
    private String deptCode;
    /**病室*/
    private String wardCode;
    /**收费编码  见zd_charge_item 的 code*/
    private String chargeCode;
    /**执行时间*/
    private Date occTime;
    /** 医嘱号*/
    private BigDecimal actOrderNo;
    /**住院号*/
    private String inpatientNo;
    /**住院次数*/
    private Integer admissTimes;
    /**病人姓名*/
    private String name;
    /**床号*/
    private String bedNo;
    /**数量*/
    private BigDecimal amount;
    /**单价*/
    private BigDecimal retprice;
    /** 收费? 日期*/
    private Date chargeDate;
    //婴儿标志 1 婴儿 0 成人
    private String infantFlag;
    /**申请人*/
    private String drawer;
    /**a-长期医嘱。t-临时医嘱*/
     private String alwaysFlag;
    /**0 已经发药或退药 1 初始值 2 拒绝发药 3 基数药 4 已发药*/
     private String statusFlag;
    //药标志位 d 口服药 i 大输液 j 其他
     private String drugClass;
    //无用
     private Integer serail;
    //药单号
     private BigDecimal pageNo;
    //0 普通1=需住院确认 2=住院已确认已付款 3=住院已确认
     private String paySelf;
    //自费标志 1 自费 0 公费
     private String selfFlag;
    //单列标志
     private String separateFlag;
    //贵重标志
     private String supriceFlag;
    //毒麻标志
     private String drugFlag;
    //药序列号 01-小包装 99-大包装
     private String serial;
    //药库号
     private String groupNo;
     private String doctorName;
    //住院流水号
     private String zySerialNo;
    //退药单号
     private BigDecimal pageNoTy;
    //药单类别
     private String pageClass;
    //医保自费标志
     private String ybSelfFlag;
    //账页号
     private Integer ledgerSn;
    //流水号
     private Integer detailSn;
    @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;

        YzYpZyOrder that = (YzYpZyOrder) o;

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

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

