package com.xinelu.manage.service.patienttaskpushrecord.impl;

import com.xinelu.manage.domain.patienttaskpushrecord.PatientTaskPushRecord;
import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode;
import com.xinelu.manage.mapper.patienttaskpushrecord.PatientTaskPushRecordMapper;
import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper;
import com.xinelu.manage.service.patienttaskpushrecord.IPatientTaskPushRecordService;
import com.xinelu.manage.service.signpatientmanageroutenode.ISignPatientManageRouteNodeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 患者管理任务推送方式记录Service业务层处理
 *
 * @author xinelu
 * @date 2024-03-21
 */
@Service
public class PatientTaskPushRecordServiceImpl implements IPatientTaskPushRecordService {
    @Resource
    private PatientTaskPushRecordMapper patientTaskPushRecordMapper;
    @Resource
    private ISignPatientManageRouteNodeService manageRouteNodeService;

    /**
     * 查询患者管理任务推送方式记录
     *
     * @param id 患者管理任务推送方式记录主键
     * @return 患者管理任务推送方式记录
     */
    @Override
    public PatientTaskPushRecord selectPatientTaskPushRecordById(Long id) {
        return patientTaskPushRecordMapper.selectPatientTaskPushRecordById(id);
    }

    /**
     * 查询患者管理任务推送方式记录列表
     *
     * @param patientTaskPushRecord 患者管理任务推送方式记录
     * @return 患者管理任务推送方式记录
     */
    @Override
    public List<PatientTaskPushRecord> selectPatientTaskPushRecordList(PatientTaskPushRecord patientTaskPushRecord) {
        return patientTaskPushRecordMapper.selectPatientTaskPushRecordList(patientTaskPushRecord);
    }

    /**
     * 新增患者管理任务推送方式记录
     *
     * @param patientTaskPushRecord 患者管理任务推送方式记录
     * @return 结果
     */
    @Override
    public int insertPatientTaskPushRecord(PatientTaskPushRecord patientTaskPushRecord) {
        patientTaskPushRecord.setCreateTime(LocalDateTime.now());
        return patientTaskPushRecordMapper.insertPatientTaskPushRecord(patientTaskPushRecord);
    }

    /**
     * 修改患者管理任务推送方式记录
     *
     * @param patientTaskPushRecord 患者管理任务推送方式记录
     * @return 结果
     */
    @Override
    public int updatePatientTaskPushRecord(PatientTaskPushRecord patientTaskPushRecord) {
        patientTaskPushRecord.setUpdateTime(LocalDateTime.now());
        return patientTaskPushRecordMapper.updatePatientTaskPushRecord(patientTaskPushRecord);
    }

    /**
     * 批量删除患者管理任务推送方式记录
     *
     * @param ids 需要删除的患者管理任务推送方式记录主键
     * @return 结果
     */
    @Override
    public int deletePatientTaskPushRecordByIds(Long[] ids) {
        return patientTaskPushRecordMapper.deletePatientTaskPushRecordByIds(ids);
    }

    /**
     * 删除患者管理任务推送方式记录信息
     *
     * @param id 患者管理任务推送方式记录主键
     * @return 结果
     */
    @Override
    public int deletePatientTaskPushRecordById(Long id) {
        return patientTaskPushRecordMapper.deletePatientTaskPushRecordById(id);
    }

    @Override
    public SignPatientManageRouteNode getManageRouteNode(Long manageRouteNodeId) {
        return manageRouteNodeService.selectSignPatientManageRouteNodeById(manageRouteNodeId);
    }
}
