package cn.hnthyy.thmz.entity.thmz;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

/**
 * 发票表
 */
@Data
public class Receipt {
    //主键
    private Long id;
    //用户id
    private String userIdCode;
    //门诊发票开始
    private String receiptBegin;
    //门诊发票结束
    private String receiptEnd;
    //门诊发票当前发票号
    private String receiptCurrent;
    //住院发票开始
    private String zyReceiptBegin;
    //住院发票结束
    private String zyReceiptEnd;
    //住院发票当前发票号
    private String zyReceiptCurrent;
    //当前发票范围维护时间
    private Date updateDate;

    /**
     * 设置门诊当前发票号
     * @param receiptCurrent
     */
    public void setReceiptCurrent(String receiptCurrent) {
        //当当前发票号不足位时，用高位补位
        if(StringUtils.isNotBlank(this.receiptCurrent) && StringUtils.isNotBlank(receiptCurrent) && this.receiptCurrent.length()>receiptCurrent.length()){
            receiptCurrent=this.receiptCurrent.substring(0,this.receiptCurrent.length()-receiptCurrent.length())+receiptCurrent;
        }
        this.receiptCurrent = receiptCurrent;
    }

    /**
     * 设置住院当前发票号
     * @param zyReceiptCurrent
     */
    public void setZyReceiptCurrent(String zyReceiptCurrent) {
        //当当前发票号不足位时，用高位补位
        if(StringUtils.isNotBlank(this.zyReceiptCurrent) && StringUtils.isNotBlank(zyReceiptCurrent) && this.zyReceiptCurrent.length()>zyReceiptCurrent.length()){
            zyReceiptCurrent=this.zyReceiptCurrent.substring(0,this.zyReceiptCurrent.length()-zyReceiptCurrent.length())+zyReceiptCurrent;
        }
        this.zyReceiptCurrent = zyReceiptCurrent;
    }
}
