package com.yd.dal.service.agms.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yd.api.agms.vo.practitioner.PractitionerFileSharing;
import com.yd.api.agms.vo.practitioner.SharePractitionerInfo;
import com.yd.dal.mapper.agms.AgmsPractitionerMapper;
import com.yd.dal.service.agms.AgmsPractitionerDALService;
import com.yd.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author xxy
 */
@Service("agmsPractitionerDALService")
public class AgmsPractitionerDALServiceImpl implements AgmsPractitionerDALService {

    @Autowired
    private AgmsPractitionerMapper mapper;
    @Override
    public PageInfo<PractitionerFileSharing> practitionerFileSharingList(Long id ,String shareCode,Long[] mdDropOptionIds, Integer isActive, int pageNum, int size) {
        PageHelper.startPage(pageNum, size);
        Page<PractitionerFileSharing> practitionerFileShares = mapper.practitionerFileSharingList(id,shareCode,mdDropOptionIds,isActive);
        PageInfo<PractitionerFileSharing> pageInfo = new PageInfo<>(practitionerFileShares);
        return pageInfo;
    }

    @Override
    public SharePractitionerInfo findSharePractitioner(String shareCode) {
        if (CommonUtil.isNullOrBlank(shareCode)){
            return null;
        }
        return mapper.findSharePractitioner(shareCode);
    }
}
