package cn.hnthyy.thmz.entity.his.mz;

import cn.hnthyy.thmz.Utils.NumberToCN;
import lombok.Data;

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

/**
 * 门诊发票记录表
 */
@Data
public class MzReceiptSerial implements Serializable {
    //病人编码
    private String patientId;
    //病人就诊次数
    private Integer times;
    //缴费次数
    private Integer receiptNo;
    //交费流水号 (机制号)
    private Integer serialNo;
    //操作员
    private String operatorId;
    //挂号费
    private BigDecimal charge1;
    //床位费
    private BigDecimal charge2;
    //诊察费
    private BigDecimal charge3;
    //检查费
    private BigDecimal charge4;
    //治疗费
    private BigDecimal charge5;
    //护理费
    private BigDecimal charge6;
    //手术费
    private BigDecimal charge7;
    //化验费
    private BigDecimal charge8;
    //其他
    private BigDecimal charge9;
    //西药费
    private BigDecimal charge10;
    //中成药费
    private BigDecimal charge11;
    //中草药费
    private BigDecimal charge12;
    //特殊材料费
    private BigDecimal charge13;
    //输血费
    private BigDecimal charge14;
    //鉴定费
    private BigDecimal charge15;
    //消毒费
    private BigDecimal charge16;
    //手术器械使用费
    private BigDecimal charge17;
    //材料费
    private BigDecimal charge18;
    //麻醉费
    private BigDecimal charge19;
    //四舍五入
    private BigDecimal charge20;
    //退欠标记:0:收；1：退；2：作废；5：未收费  payMarkEnum
    private String payMark;
    //总金额
    private BigDecimal totalCharge;
    //收费日期
    private Date chargeDate;
    //发票号
    private String receiptBill;
    //发票流水号
    private Integer receiptSn;
    //结账日期
    private Date dcountDate;
    //收费窗口
    private String windowsNo;
    //1：已结帐；0：未结
    private Integer dcountNo;
    //医保流水号
    private Integer serialYb;
    //分票标志：1：分票     借用为是否是由本院记账重收后产生的发票记录 设置成Y表示本院记账重收
    private String fpFlag;
    //病人身份信息
    private String responceType;
    //付款方式：1：自费；2：公费  ZdChequeType
    private String chequeType;
    //支票号
    private String chequeNo;
    //退费标志 1 退费 0 或者null 没有退
    private Integer tfFlag;
    //院区
    private String deptNo;
    //新付款方式
    private String newChequeType;
    //付款人
    private String payId;
    //总金额
    private String totalChargeStr;

    //发票日结日期  收费的人的日结时间
    private Date chargeDcountDate;
    //发票日结状态 1：已结帐；0：未结 收费的人的日结状态
    private Integer chargeDcountNo;

    private Integer totalCount;
    //病人姓名
    private String name;
    //做版本控制，防止发票号被并发修改
    private String bz;
    public void setCharge1(BigDecimal charge1) {
        this.charge1 = charge1;
        if(totalCharge==null){
            totalCharge=charge1;
        }else {
            totalCharge=totalCharge.add(charge1);
        }
        if(totalCharge!=null){
            totalCharge=totalCharge.setScale(2, BigDecimal.ROUND_HALF_UP);
            totalChargeStr=NumberToCN.number2CNMontrayUnit(this.totalCharge);
        }
    }


    public MzReceiptSerial() {
    }

    public MzReceiptSerial(String receiptBill) {
        this.receiptBill = receiptBill;
    }
    public MzReceiptSerial(String patientId, Integer times) {
        this.patientId = patientId;
        this.times = times;
    }
}
