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

import lombok.Data;

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

/**
 * 门诊收费记录表
 */
@Data
public class MzChargeDetail implements Serializable,Comparable<MzChargeDetail> {
    //病人ID码
    private String patientId;
    //次数
    private Integer times;
    //是发票分票号，现在不用了，默认为1就好 没有缴费是0 缴费了是1
    private Integer receiptNo;
    //处方号
    private Integer orderNo;
    //项目数
    private Integer itemNo;
    //药疗代码
    private String chargeItemCode;
    //收费类别 发票码
    private String billItemCode;
    //数量
    private Double quantity;
    //单价
    private BigDecimal unitPrice;
    //退欠标记:0:收；1：退；2：作废；5：未收费 具体看   cn.hnthyy.thmz.enums.PayMarkEnum
    private String payMark;
    //药品序号
    private String serial;
    //库房标记
    private String chargeItemType;
    //国别标志
    private String countryFlag;
    //药品接收标志
    private String drugFlag;
    //是缴费的流水号 一次缴费一次
    private Integer serialNo;
    //姓名
    private String name;
    //收费日期
    private Date chargeDate;
    //发药时间
    private Date confirmTime;
    //发药药房  如果是00 说明是医技套餐项目
    private String groupNo;
    //发药人
    private String confirmId;
    //剂量
    private Integer drugWin;
    //录入员 退费人
    private String inputId;
    //输入日期  退费时间
    private Date inputDate;
    //收款员->配药员
    private String cashierId;
    //收费窗口
    private String windowsNo;
    //划价人
    private String priceId;
    //划价时间
    private Date priceTime;
    //执行科室
    private String execDept;
    //核算码
    private String auditCode;
    //皮试结果:1.阳性能2.阴性能3.脱敏  具体看 GongnksEnum枚举
    private String gongnksFlag;
    //实际是药房打印标记   但是我借用为控制发票打印标志，只是页面做显示，不更新
    private String printFlag;
    //标识: 0 初始状态 1确认发药 医技确认 2.打印药品清单 3.已取消，此时可以退费 4 退费
    private Integer confirmFlag;
    //申请科室
    private String warnDept;
    //急诊标记   1 急诊
    private String jzFlag;
    //药品组：输液用
    private Integer groupOrder;
    //收款人
    private String cashId;
    //医生工号
    private String doctorCode;
    //给药方式：查询 表 mz_supply_type
    private String supplyCode;
    //频率
    private String frequency;
    //一次用量
    private Double drugQuan;
    //用量单位：查询 表 yp_zd_unit
    private String drugUnit;
    //1：医生处方
    private String doctorFlag;
    //注射余量
    private Double injectRes;
    //注射次数
    private Integer injectTimes;
    //1：注射室确认
    private String confirmZs;
    //发票流水号 分票的
    private Integer realNo;
    //药房窗口号
    private String windowsNoYf;
    //医保报销标志
    private String ybbxFlag;
    // 套餐号:order_no + item_no
    private String tcNo;
    //套餐名称
    private String tcName;
    //套餐细目标志
    private String detailFlag;
    //自付比例
    private BigDecimal glPercent;
    //套餐类别
    private String orderType;
    //给药方式附加收费编号:order_no + item_no  无用
    private String supplyNo;
    //嘱托码
    private String instructionCode;
    //嘱托说明
    private String instructionText;
    //处方天数
    private Integer orderDays;
    //1：自备药
    private String paySelf;
    //试敏结果:1:阳性；0：阴性   YesNo
    private String tryFlag;
    //医技申请标志:
    private String reqYj;
    //申请单号
    private Integer reqNo;
    //处方类型:1:西药;2:成药;3:草药;4:诊疗   GroupTypeEnum
    private String groupType;
    //发票分组
    private Integer orderBill;
    //对应的收费项目码
    private String chargeBillCode;
    //自费标志
    private String selfFlag;
    //就诊身份
    private String responceType;
    //退药数量
    private BigDecimal decAmount;
    //反查 取药号码
    private Integer backSerial;
    //录入时刻->配药时间
    private Date inputTime;
    //每天剂数
    private Integer cyMtjs;
    //加水量
    private Integer cyJsl;
    //煮取量
    private Integer cyZql;
    //复煎次数
    private Integer cyFj;
    //分服次数
    private Integer cyFfcs;
    //服用说明
    private Integer cyFysm;
    //给药方式执行次数
    private Integer supplyAmount;
    //加水说明
    private String cyJssm;
    //坐诊号别  用来区分院区的
    private String deptNo;
    //
    private BigDecimal glPercentFt;
    //医保支付标记
    private String ybZfFlag;
    //实际价格 实收金额
    private BigDecimal origPrice;
    //皮试结果
    private String tryResult;
    //给药方式执行科室
    private String supplyExec;
    //草药代煎
    private String cyDj;
    //接收标志
    private String receiveFlag;
    //
    private String chequType;
    //
    private String printFlagYj;
    //
    private String confirmFlagQx;

    //统计的优惠后总金额
    private BigDecimal amount;
    //退款金额
    private BigDecimal refundFee;
    //原缴费金额金额
    private BigDecimal oriAmount;
    //单价的字符串
    private String unitPriceStr;
    //原价格的字符串
    private String origPriceStr;
    //新的收费次数
    private Integer newReceiptNo;
    //统计的原始总金额 未做优惠前
    private BigDecimal notDiscountAmount;
    //统计的优惠掉的总金额
    private BigDecimal discountAmount;
    public MzChargeDetail(String patientId, Integer times) {
        this.patientId = patientId;
        this.times = times;
    }

    public MzChargeDetail() {
    }

    public void setUnitPrice(BigDecimal unitPrice) {
        this.unitPrice = unitPrice;
        if(unitPrice!=null){
         this.unitPriceStr = unitPrice.toString();
        }
    }

    public void setOrigPrice(BigDecimal origPrice) {
        this.origPrice = origPrice;
        if(origPrice!=null){
            this.origPriceStr = origPrice.toString();
        }
    }

    @Override
    public String toString() {
        return "MzChargeDetail{" +
                "patientId='" + patientId + '\'' +
                ", times=" + times +
                ", receiptNo=" + receiptNo +
                ", orderNo=" + orderNo +
                ", itemNo=" + itemNo +
                ", chargeItemCode='" + chargeItemCode + '\'' +
                ", billItemCode='" + billItemCode + '\'' +
                ", quantity=" + quantity +
                ", unitPrice=" + unitPrice +
                ", payMark='" + payMark + '\'' +
                ", serial='" + serial + '\'' +
                ", chargeItemType='" + chargeItemType + '\'' +
                ", countryFlag='" + countryFlag + '\'' +
                ", drugFlag='" + drugFlag + '\'' +
                ", serialNo=" + serialNo +
                ", name='" + name + '\'' +
                ", chargeDate=" + chargeDate +
                ", confirmTime=" + confirmTime +
                ", groupNo='" + groupNo + '\'' +
                ", confirmId='" + confirmId + '\'' +
                ", drugWin=" + drugWin +
                ", inputId='" + inputId + '\'' +
                ", inputDate=" + inputDate +
                ", cashierId='" + cashierId + '\'' +
                ", windowsNo='" + windowsNo + '\'' +
                ", priceId='" + priceId + '\'' +
                ", priceTime=" + priceTime +
                ", execDept='" + execDept + '\'' +
                ", auditCode='" + auditCode + '\'' +
                ", gongnksFlag='" + gongnksFlag + '\'' +
                ", printFlag='" + printFlag + '\'' +
                ", confirmFlag=" + confirmFlag +
                ", warnDept='" + warnDept + '\'' +
                ", jzFlag='" + jzFlag + '\'' +
                ", groupOrder=" + groupOrder +
                ", cashId='" + cashId + '\'' +
                ", doctorCode='" + doctorCode + '\'' +
                ", supplyCode='" + supplyCode + '\'' +
                ", frequency='" + frequency + '\'' +
                ", drugQuan=" + drugQuan +
                ", drugUnit='" + drugUnit + '\'' +
                ", doctorFlag='" + doctorFlag + '\'' +
                ", injectRes=" + injectRes +
                ", injectTimes=" + injectTimes +
                ", confirmZs='" + confirmZs + '\'' +
                ", realNo=" + realNo +
                ", windowsNoYf='" + windowsNoYf + '\'' +
                ", ybbxFlag='" + ybbxFlag + '\'' +
                ", tcNo='" + tcNo + '\'' +
                ", tcName='" + tcName + '\'' +
                ", detailFlag='" + detailFlag + '\'' +
                ", glPercent=" + glPercent +
                ", orderType='" + orderType + '\'' +
                ", supplyNo='" + supplyNo + '\'' +
                ", instructionCode='" + instructionCode + '\'' +
                ", instructionText='" + instructionText + '\'' +
                ", orderDays=" + orderDays +
                ", paySelf='" + paySelf + '\'' +
                ", tryFlag='" + tryFlag + '\'' +
                ", reqYj='" + reqYj + '\'' +
                ", reqNo=" + reqNo +
                ", groupType='" + groupType + '\'' +
                ", orderBill=" + orderBill +
                ", chargeBillCode='" + chargeBillCode + '\'' +
                ", selfFlag='" + selfFlag + '\'' +
                ", responceType='" + responceType + '\'' +
                ", decAmount=" + decAmount +
                ", backSerial=" + backSerial +
                ", inputTime=" + inputTime +
                ", cyMtjs=" + cyMtjs +
                ", cyJsl=" + cyJsl +
                ", cyZql=" + cyZql +
                ", cyFj=" + cyFj +
                ", cyFfcs=" + cyFfcs +
                ", cyFysm=" + cyFysm +
                ", supplyAmount=" + supplyAmount +
                ", cyJssm='" + cyJssm + '\'' +
                ", deptNo='" + deptNo + '\'' +
                ", glPercentFt=" + glPercentFt +
                ", ybZfFlag='" + ybZfFlag + '\'' +
                ", origPrice=" + origPrice +
                ", tryResult='" + tryResult + '\'' +
                ", supplyExec='" + supplyExec + '\'' +
                ", cyDj='" + cyDj + '\'' +
                ", receiveFlag='" + receiveFlag + '\'' +
                ", chequType='" + chequType + '\'' +
                ", printFlagYj='" + printFlagYj + '\'' +
                ", confirmFlagQx='" + confirmFlagQx + '\'' +
                ", amount=" + amount +
                ", refundFee=" + refundFee +
                ", oriAmount=" + oriAmount +
                ", unitPriceStr='" + unitPriceStr + '\'' +
                ", origPriceStr='" + origPriceStr + '\'' +
                ", newReceiptNo=" + newReceiptNo +
                ", notDiscountAmount=" + notDiscountAmount +
                ", discountAmount=" + discountAmount +
                '}';
    }

    //根据处方号升序排列，降序修改相减顺序即可
    @Override
    public int compareTo(MzChargeDetail o) {
        return this.orderNo-o.orderNo;
    }
}
