/*
 *    Copyright (c) 2018-2025, hnqz All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: hnqz
 */

package com.qunzhixinxi.hnqz.admin.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;

/**
 * 积分包
 *
 * @author gaoyanng
 * @date 2020-06-25 23:35:42
 */
@Data
@TableName("wm_score_package")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "积分包")
public class WmScorePackage extends Model<WmScorePackage> {
	private static final long serialVersionUID = 1L;

	/**
	 * id
	 */
	@TableId
	@ApiModelProperty(value = "id")
	private String id;
	/**
	 * 药企ID
	 */
	@ApiModelProperty(value = "药企ID")
	private String drugEntId;

	/**
	 * 药企ID
	 */
	@ApiModelProperty(value = "任务规则ID")
	private String taskRuleId;

	/**
	 * 积分
	 */
	@ApiModelProperty(value = "积分包ID")
	private String scoreId;


	/**
	 * 积分包名称
	 */
	@ApiModelProperty(value = "积分包名称")
	private String scoreName;
	/**
	 * 积分
	 */
	@ApiModelProperty(value = "积分")
	private Integer score;
	/**
	 * 代理商类型
	 */
	@ApiModelProperty(value = "代理商类型")
	private String agentTypeId;

	/**
	 * 积分包状态
	 */
	@ApiModelProperty(value = "积分包状态")
	@TableField(updateStrategy = FieldStrategy.IGNORED)
	private String packageStatus;

	/**
	 * 积分包完成状态：0->未完成，1->已完成
	 */
	@ApiModelProperty(value = "积分包完成状态")
	private String packageFinishStatus;

	@ApiModelProperty(value = "积分包完成状态")
	private String packageAuditStatus;

	/**
	 * 一级代理商
	 */
	@ApiModelProperty(value = "一级代理商")
	private String level1Id;
	/**
	 * 二级代理商
	 */
	@ApiModelProperty(value = "二级代理商")
	private String level2Id;
	/**
	 * 众包ID
	 */
	@ApiModelProperty(value = "众包ID")
	private String zbId;

	/**
	 * 销售代表ID
	 */
	@ApiModelProperty(value = "销售代表ID")
	private String xxdbId;

	@ApiModelProperty(value = "查询结束时间")
	private String endLabelDate;

	/**
	 * 1：定额积分包
	 * 2：定量积分包
	 * 3：通用包
	 * 4：结算包（证据链）
	 * 5：患者教育积分包
	 */
	@ApiModelProperty(value = "积分包任务类型1")
	private String packageType1;

	@ApiModelProperty(value = "描述")
	private String description;

	@ApiModelProperty(value = "关联积分包id")
	private String relationScoreId;

	@ApiModelProperty(value = "关联服务企业")
	private String relatedService;

	@ApiModelProperty(value = "积分包名称")
	private String scorePackageName;

	@ApiModelProperty(value = "积分包是否进行中")
	private String packageIsConduct;
	@ApiModelProperty(value = "规则id")
	private String ruleId;

	@TableField(exist = false)
	private List<WmScoreTaskType> wmScoreTaskTypeList;
	@TableField(exist = false)
	private Set taskTypeSet;

	/**
	 * 分配对象类型
	 */
	@ApiModelProperty(value = "分配对象类型")
	private String typeid;

	/**
	 * 组织机构ID
	 */
	@ApiModelProperty(value = "组织机构ID")
	private String deptId;

	/**
	 * 发包方组织机构ID
	 */
	@ApiModelProperty(value = "发包方组织机构ID")
	private String sendPackageDeptId;

	/**
	 * 是否删除
	 */
	@ApiModelProperty(value = "是否删除")
	private String delFlag;
	/**
	 * 是否禁用
	 */
	@ApiModelProperty(value = "是否禁用")
	private String enableFlag;
	/**
	 * 所属租户
	 */
	@ApiModelProperty(value = "所属租户", hidden = true)
	private Integer tenantId;
	/**
	 * 创建时间
	 */
	@ApiModelProperty(value = "创建时间")
	private LocalDateTime createTime;
	/**
	 * 结算时间
	 */
	@ApiModelProperty(value = "结算时间")
	private LocalDateTime settlementDate;

	/**
	 * 结算时间
	 */
	@TableField(exist = false)
	@ApiModelProperty(value = "结算成功时间")
	private LocalDateTime notifyDate;
	/**
	 * 创建人
	 */
	@ApiModelProperty(value = "创建人")
	private Integer createUser;
	/**
	 * 更新时间
	 */
	@ApiModelProperty(value = "更新时间")
	private LocalDateTime updateTime;
	/**
	 * 更新人
	 */
	@ApiModelProperty(value = "更新人")
	private Integer updateUser;


	/**
	 * 所属月份
	 */
	@ApiModelProperty(value = "所属月份")
//	@JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
//	private Date belongDate;
	private String belongDate;

	/**
	 * 分配日期
	 */
	@ApiModelProperty(value = "分配日期")
	private String allocationDate;

	/**
	 * 已支付百分比
	 */
	@ApiModelProperty(value = "已支付百分比")
	private String payRate;

	/**
	 * 已支付积分值
	 */
	@ApiModelProperty(value = "已支付积分值")
	private Integer payScore;
	/**
	 * 接包对象
	 */
	@ApiModelProperty(value = "接包对象")
	private String acceptSug;

	/**
	 * 已完成百分比
	 */
	@ApiModelProperty(value = "已完成百分比")
	private String finishRate;


	private Integer ytj;
	@ApiModelProperty(value = "已完成")
	private Integer ysh;

	private Integer dsh;


	private Integer ytjtt;

	private Integer ywctt;

	@TableField(exist = false)
	private Integer shtg;
	@TableField(exist = false)
	private Integer shbtg;
	@TableField(exist = false)
	private Integer shtgnum;
	@TableField(exist = false)
	private Integer shbtgnum;
	@TableField(exist = false)
	private Integer shtgtt;
	@TableField(exist = false)
	private Integer shbtgtt;

	private Integer yshtt;
	@ApiModelProperty(value = "是否进行中 1进行中 0未进行")
	private String isConduct;

	private BigDecimal settleAmount;

	private BigDecimal discount;

	private LocalDateTime receiveDate;

	@TableField(exist = false)
	private List<String> drugsIds;

	@ApiModelProperty(value = "结算单号")
	private String statementNo;

	private Integer settleStatus;

	private String remark;


	@ApiModelProperty(value = "可分配积分")
	private Integer kfpjf;

	/**
	 * 发票类目
	 */
	private Integer invoiceCategory;


	/**
	 * 1：任务包
	 * 2：结算包
	 */
	@ApiModelProperty(value = "积分包任务类型2")
	private String packageType2;

	@ApiModelProperty(value = "接单对象范围")
	private String packageUserScope;
	@TableField(exist = false)
	private Integer certStatus;

	@ApiModelProperty(value = "需求人数")
	private Integer userNum;
	@ApiModelProperty(value = "任务个数")
	private Integer taskNum;

	//private String packageLevel;

	/**
	 * 完成时间
	 */
	@ApiModelProperty(value = "完成时间")
	private LocalDateTime packageFinishTime;


	/**
	 * 有效任务类型
	 */
	@TableField(exist = false)
	private List<WmTaskTypeTree> taskTypeList;

	/**
	 * 有效任务类型
	 */
	@TableField(exist = false)
	private List<WmScoreTaskType> taskTypeList1;

	/**
	 * 有效任务类型--前端展示
	 */
	@TableField(exist = false)
	private String taskTypes;

	/**
	 * 个人预计包值
	 */
	@ApiModelProperty(value = "个人预计包值")
	private String userScore;

	/**
	 * 终止方式
	 */
	@ApiModelProperty(value = "终止方式")
	private String enableType;

	/**
	 * 已接单人数
	 */
	@TableField(exist = false)
	private Integer yjd;


	/**
	 * 已接单待审核人数
	 */
	@TableField(exist = false)
	private Integer yjddsh;


	/**
	 * 是否允许接单  0允许接单 1不允许接单
	 */
	@ApiModelProperty(value = "是否允许接单")
	private String isReceive;

	/**
	 * 是否可以新增任务1-可以  0-不可以
	 */
	@ApiModelProperty(value = "是否可以新增任务")
	private String taskAddFlag;

	/**
	 * 是否可以新增任务1-已经发起  0-没有
	 */
	@ApiModelProperty(value = "是否结算")
	private String settleFlag;

	/**
	 * 接单对象list
	 */
	@TableField(exist = false)
	private List<String> userList;

	/**
	 * 接单对象id-list
	 */
	@TableField(exist = false)
	private List<String> userIdList;

	/**
	 * 接单对象list人数
	 */
	@TableField(exist = false)
	private Integer userListNum;

	/**
	 * 结算包--是否有任务
	 */
	@TableField(exist = false)
	private String isTask;

	//score_package_status
	/**
	 * 积分包状态
	 */
	@ApiModelProperty(value = "积分包状态")
	private String scorePackageStatus;

	/**
	 * 是否为旧数据
	 */
	@ApiModelProperty(value = "是否为旧数据")
	private String oldPackage;

	/**
	 * 结算渠道
	 */
	@ApiModelProperty(value = "结算渠道")
	private String subType;

	/**
	 * 数据来源类型（0：手动上传，1：系统对接）
	 */
	@ApiModelProperty(value = "数据来源类型（0：手动上传，1：系统对接）")
	private String sourceType;

	/**
	 * 结算包--任务类型
	 */
	@TableField(exist = false)
	private String taskTypeId;

	@TableField(exist = false)
	private Integer wsTaskNum;

	@TableField(exist = false)
	private Integer asTaskNum;

	/**
	 * 项目编号
	 */
	private String projectNum;

	/**
	 * 药企是否存在审核记录
	 */
	@TableField(exist = false)
	private PackageStopStatus stopStatus;

	/**
	 * 关联药品的生产厂商列表
	 */
	@TableField(value = "drug_producer")
	@ApiModelProperty(value = "关联药品的生产厂商列表")
	private String[] drugProducerList;

	@AllArgsConstructor
	public enum PackageStopStatus {
		NOTHING(0, "不能操作"),
		ALL_IN(1, "全部收回"),
		REMAIN_MSG(2, "剩余收回"),
		REMAIN(3, "剩余收回（无信息提示）");

		private final int code;

		private final String msg;
	}

}
