package io.hmit.modules.serviceOrder.service;

import io.hmit.common.page.PageData;
import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
import io.hmit.modules.serviceOrder.dto.PensionOrderEvaluationDTO;
import io.hmit.modules.serviceOrder.dto.StaffFinishDTO;
import io.hmit.modules.serviceOrder.entity.PensionOrderEntity;

import java.util.Map;

/**
 * 订单表
 *
 * @author zsh 408538940@qq.com
 * @since 1.0.0 2021-01-26
 */
public interface PensionOrderService extends CrudService<PensionOrderEntity, PensionOrderDTO> {

    //查询全部订单
    PageData<PensionOrderDTO> getAllOrderPage(Map<String, Object> params, Long userId);

    //查询今日订单
    PageData<PensionOrderDTO> getTodayOrderPage(Map<String, Object> params);

    //根据订单Id和订单状态查询 (接单时使用)
    PensionOrderDTO getOrderInfoByIdAndStatus(Long orderId, Integer status);

    //服务订单预约
    void reservation(PensionOrderDTO pensionOrderDTO);

    //查询已完成订单
    PageData<PensionOrderDTO> getOrderPageByStatus(Map<String, Object> params, Long userId, Integer status);

    //根据用户ID或订单状态查询(带图)
    PensionOrderDTO getOrderInfoByIdAndUserIdOrStatus(Long orderId, Long userId, Integer status);

    //老人今日订单
    PageData<PensionOrderDTO> getElderTodayOrderPage(Map<String, Object> params, Long creator);

    //老人全部订单或根据订单状态查询
    PageData<PensionOrderDTO> getElderAllOrderOrByStatusPage(Map<String, Object> params, Long creator, Integer status);

    //社工：查询本社区全部订单（根据社区人员id查询所属社区内全部订单）
    PageData<PensionOrderDTO> getAllOrderByCommunityUserIdPage(Map<String, Object> params, Long userId);

    //社工：查询本社区某老人全部订单(模糊查询)
    PageData<PensionOrderDTO> getElderAllOrderByCommunityUserIdPage(Map<String, Object> params, Long userId, String appointmentPerson);

    //查询机构订单
    PageData<PensionOrderDTO> getOrganizationOrder(Map<String, Object> params, Long userId);

    //老人/子女完成评价
    void evaluationDone(PensionOrderEvaluationDTO dto);

    //文件保存到数据库
    void saveFilesToDB(Long orderId,String files[],Long roleId);

    //机构处理订单状态
    Boolean organizationHandle(Map<String, Object> params, Long userId);

    //老人、子女取消订单
    Boolean elderFamilyCancel(Long id, String reason);

    //服务人员完结订单
    void staffFinishedOrder(StaffFinishDTO dto);
}
