package com.bzd.system.service;

import com.bzd.common.config.dao.DaoBase;
import com.bzd.common.config.dao.DaoSupport;
import com.bzd.common.config.dao.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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


/**
 * 药事服务管理 service
 */
@Service
public class PharmaceuticalService {

    @Autowired
    private DaoBase dao;

    @Resource(name = "daoSupport")
    private DaoSupport daoSupport;

    public List<PageData> findArchivesList(PageData pd) throws Exception{
        return (List<PageData>) daoSupport.findForList("PharmaceuticalServiceMapper.selectArchivesList", pd);

    }

    public Integer archivesRemove(PageData pd)throws Exception {
        return daoSupport.delete("PharmaceuticalServiceMapper.archivesRemove", pd);
    }


    public Integer updateArchives(PageData pd)throws Exception {
        return daoSupport.update("PharmaceuticalServiceMapper.updateArchives", pd);
    }

    public List<PageData> findFollowUpList(PageData pd) throws Exception{
        return (List<PageData>) daoSupport.findForList("PharmaceuticalServiceMapper.selectFollowUpList", pd);

    }

    public Integer followUpRemove(PageData pd)throws Exception {
        return daoSupport.delete("PharmaceuticalServiceMapper.followUpRemove", pd);
    }


    public Integer updateFollowUp(PageData pd)throws Exception {
        return daoSupport.update("PharmaceuticalServiceMapper.updateFollowUp", pd);
    }

    public List<PageData> findFollowUpAssignList(PageData pd) throws Exception{
        return (List<PageData>) daoSupport.findForList("PharmaceuticalServiceMapper.selectFollowUpAssignList", pd);

    }

    public Integer followUpAssignRemove(PageData pd)throws Exception {
        return daoSupport.delete("PharmaceuticalServiceMapper.followUpAssignRemove", pd);
    }


    public Integer updateFollowUpAssign(PageData pd)throws Exception {
        return daoSupport.update("PharmaceuticalServiceMapper.updateFollowUpAssign", pd);
    }

    public List<PageData> findPatientCounselingList(PageData pd) throws Exception{
        return (List<PageData>) daoSupport.findForList("PharmaceuticalServiceMapper.selectPatientCounselingList", pd);

    }

    public Integer patientCounselingRemove(PageData pd)throws Exception {
        return daoSupport.delete("PharmaceuticalServiceMapper.patientCounselingRemove", pd);
    }


    public Integer updatePatientCounseling(PageData pd)throws Exception {
        return daoSupport.update("PharmaceuticalServiceMapper.updatePatientCounseling", pd);
    }

    public List<PageData> findFollowUpEvaluationList(PageData pd) throws Exception{
        return (List<PageData>) daoSupport.findForList("PharmaceuticalServiceMapper.selectFindFollowUpEvaluationList", pd);

    }

    public Integer followUpEvaluationRemove(PageData pd)throws Exception {
        return daoSupport.delete("PharmaceuticalServiceMapper.findFollowUpEvaluationRemove", pd);
    }


    @Transactional(rollbackFor = Exception.class)
    public Integer updateFollowUpEvaluation(PageData pd)throws Exception {
        return daoSupport.update("PharmaceuticalServiceMapper.updateFindFollowUpEvaluation", pd);
    }
}
