package thyyxxk.webserver.entity.querydata;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

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

/**
 * <p>
 * 分组结果表
 * </p>
 *
 * @author lihong
 * @since 2023-01-29
 */
@Data
@TableName("t_upload_drg_group")
public class TUploadDrgGroup implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 分组编码
     */
    private String code;

    /**
     * 分组名称
     */
    private String name;

    /**
     * 权重
     */
    private BigDecimal weight;

    /**
     * 倍率
     */
    private String bl;

    /**
     * 盈亏额
     */
    private BigDecimal profit;

    /**
     * 标杆费用
     */
    @TableField(value = "fee_stand")
    private BigDecimal feeStand;

    /**
     * 住院号
     */
    @TableField(value = "pat_no")
    private String patNo;

    /**
     * 住院次数
     */
    private Integer times;
    /**
     * 账页号
     */
    @TableField(value = "ledger_sn")
    private Integer ledgerSn;

    /**
     * 分组提示
     */
    @TableField(value = "group_messages")
    private String groupMessages;
    /**
     * 总费用
     */
    @TableField(value = "total_fee")
    private BigDecimal totalFee;


    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private Date createTime;

    /**
     * 结算时间
     */
    @TableField(value = "setl_time")
    private Date setlTime;

    @TableField(exist = false)
    private long currentPage;
    /**
     * 分页
     */
    @TableField(exist = false)
    private long pageSize;

    @TableField(exist = false)
    private String setlStartTime;

    @TableField(exist = false)
    private String setlEndTime;

    @TableField(exist = false)
    private String outDept;

    @TableField(exist = false)
    private String outDeptName;
    //医疗类别
    @TableField(exist = false)
    private String medType;
    @TableField(exist = false)
    private String medTypeName;
    @TableField(exist = false)
    private String insuplcAdmdvs;
    //参保地
    @TableField(exist = false)
    private String insuplcAdmdvsName;
    //清算机构
    @TableField(exist = false)
    private String clrOptins;
    @TableField(exist = false)
    private String clrOptinsName;
    //人员类别
    @TableField(exist = false)
    private String psnType;
    @TableField(exist = false)
    private String psnTypeName;



    /**病例类型查询条件
     * 1	未入组病例
     2	高倍率病例(按DRG)
     3	低倍率病例
     4	正常病例
     7	住院天数小于等于2天
     11	QY组
     12	不稳定病组
       */
    @TableField(exist = false)
    private Integer blType;


    public  enum BlTypeEnum {
        WRZ(1,"未入组病例"),
        GBL(2,"高倍率病例(按DRG)"),
        DBL(3,"低倍率病例"),
        ZC(4,"正常病例"),
        TSXY2(7,"住院天数小于等于2天"),
        QY(11,"QY组"),
        BWD(12,"不稳定病组");
        private final int code;
        private final String name;

        BlTypeEnum(int code, String name) {
            this.code = code;
            this.name = name;
        }

        public int getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        public static String getNameByCode(Integer code) {
            if(code == null){
                return null;
            }
            for (BlTypeEnum item : BlTypeEnum.values()) {
                if (item.getCode()==code) {
                    return item.getName();
                }
            }
            return null;
        }
    }

}
