/*
 *    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.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qunzhixinxi.hnqz.admin.api.entity.SysDept;
import com.qunzhixinxi.hnqz.admin.api.vo.WmScorePackageVO;
import com.qunzhixinxi.hnqz.admin.entity.WmDaDrugEntDrugtable;
import com.qunzhixinxi.hnqz.admin.entity.WmScorePackage;
import com.qunzhixinxi.hnqz.admin.entity.WmTask;
import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageApiOutput;
import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageSettleInput;
import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageSettleOutput;
import com.qunzhixinxi.hnqz.common.core.util.R;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;

/**
 * 积分包
 *
 * @author gaoyanng
 * @date 2020-06-25 23:35:42
 */
public interface WmScorePackageService extends IService<WmScorePackage> {

	public List<WmScorePackage> listWmScorePackageAndTask(WmScorePackage wmScorePackage);

	public List<WmScorePackage> listWmScorePackageAndTaskExt(WmScorePackage wmScorePackage);

	public List<WmScorePackage> listWmScorePackageAndTaskExtOld(WmScorePackage wmScorePackage);


	public List<WmScorePackage> listWmScorePackageAndTaskExt2(WmScorePackage wmScorePackage);

	public List<WmScorePackage> listWmScorePackageAndTaskExt2Old(WmScorePackage wmScorePackage);


	public List<WmScorePackage> listWmScorePackageAndTaskLevel1(WmScorePackage wmScorePackage);

	public List<WmScorePackage> listWmScorePackageAndTaskLevel3(WmScorePackage wmScorePackage);


	public List<WmScorePackage> pageList(QueryWrapper<WmScorePackage> wrappers);

	public WmScorePackage getPackageScoreByTaskInfo(WmScorePackage wmScorePackage);

	public String getPackageScoreEntByTaskInfo(WmScorePackage wmScorePackage);

	public List<WmScorePackage> listPage(Page page, WmScorePackage wmScorePackage);

	public IPage<WmScorePackage> getExportPackageTotalList(Page page, WmScorePackage wmScorePackage);

	public IPage<WmScorePackage> getExportPackageTotalList1(Page page, WmScorePackage wmScorePackage);

	public IPage<Map<String, Object>> getPlatTotalData(Page page, WmScorePackage wmScorePackage);

	public IPage<Map<String, Object>> selectWmScorePackageList(Page page, WmScorePackage wmScorePackage);

	R updateByIdWithType(WmScorePackageVO wmScorePackageVO);

	WmScorePackage selectByPackage(String id);

	public List<WmScorePackage> selectLists(WmScorePackage wmScorePackage);

	public Map<String, Object> selectSettleStatus(WmScorePackage wmScorePackage);

	List<SysDept> selectSendPackageDeptId(WmScorePackage wmScorePackage);


	List<WmScorePackage> selectWmScorePackageByCode(Map<String, Object> map);

	WmScorePackage selectWmScorePackage(WmScorePackage wmScorePackage);

	IPage<WmScorePackage> selectWmScorePackageLists(Page page, WmScorePackage wmScorePackage);

	WmScorePackage selectKfpjf(String scoreId);

	WmScorePackage selectKfpjfs(String scoreName);

	WmScorePackage selectWmScorePackageById(String relationScoreId);

	List<WmScorePackage> selectRelationScoreId(String relationScoreId);

	List<WmScorePackage> selectByReRelatedService(WmScorePackage wmScorePackage);

	R getRelationScoreList(WmScorePackage wmScorePackage);

	R addWmScorePackage(WmScorePackage wmScorePackage);

	R getScorePackagePage(Page page, WmScorePackage wmScorePackage);

	R updateEnable(WmScorePackage wmScorePackage);

	R getScorePackagePageById(WmScorePackage wmScorePackage);

	R updateEasy(WmScorePackage wmScorePackage);

	R updateWmScorePackage(WmScorePackage wmScorePackage);

	WmScorePackage selectRelationScoreIdList(WmScorePackage wmScorePackage);

	List<WmScorePackage> listWmScorePackages(WmScorePackage wmScorePackage1);

	IPage<WmScorePackageApiOutput> getPackageListForReceive(Page page, WmScorePackage wmScorePackage);

	/**
	 * 积分包结算列表（分页）
	 *
	 * @param page
	 * @param input
	 * @return
	 */
	IPage<WmScorePackageSettleOutput> listPackageSettleList(Page page, WmScorePackageSettleInput input);

	/**
	 * 积分包结算列表
	 *
	 * @param input
	 * @return
	 */
	List<WmScorePackageSettleOutput> listAllPackageSettle(WmScorePackageSettleInput input);

	/**
	 * 获取当前部门的基于所有积分包的相关信息
	 *
	 * @param deptId
	 * @return
	 */
	Map<String, Object> getDeptScorePackageInfo(Integer deptId);

	/**
	 * 根据积分包获取推广的药品
	 *
	 * @param page      分页信息
	 * @param packageId 积分包id
	 * @param drugName  药品名称
	 * @return 药品列表
	 */
	IPage<WmDaDrugEntDrugtable> listDrugsByPackageId(Page page, Integer packageId, String drugName);

	Page<WmScorePackage> selectWmScorePackageLists(Page<WmScorePackage> page, String scorePackageName, String acceptSug,
												   LocalDate allocationDate, LocalDate endLabelDate);

	Future<WmScorePackage> finishRate(WmScorePackage wmScorePackage);

	R getScorePackagePage(Page<WmScorePackage> page, Integer packageType1, Integer packageType2,
						  String scorePackageName, Integer scorePackageStatus, String typeId);


	Future<WmScorePackage> buildScorePackage(WmScorePackage wmScorePackage, Integer packageType1, Integer packageType2);
}
