package cn.hnthyy.thmz.service.impl.his.mz;

import cn.hnthyy.thmz.entity.MzException;
import cn.hnthyy.thmz.entity.his.mz.MzYjReq;
import cn.hnthyy.thmz.mapper.his.mz.MzYjReqMapper;
import cn.hnthyy.thmz.service.his.mz.MzYjReqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class MzYjReqServiceImpl implements MzYjReqService {
    @SuppressWarnings("all")
    @Autowired
    private MzYjReqMapper mzYjReqMapper;
    @Override
    public List<MzYjReq> queryNotPayMzYjReq(MzYjReq mzYjReq) {
        return mzYjReqMapper.selectNotPayMzYjReq(mzYjReq);
    }

    @Override
    public List<Map<String, Object>> queryUnPaidYjReq(String patientId) {
        return mzYjReqMapper.selectUnPaidYjReq(patientId);
    }

    @Override
    public int modifyMzYjReq(MzYjReq mzYjReq) throws MzException {
        if (mzYjReq == null || mzYjReq.getPatientId() == null || mzYjReq.getTimes() == null) {
            throw new MzException("病人编号和就诊次数不能为空！");
        }
        return mzYjReqMapper.updateMzYjReq(mzYjReq);
    }

    @Override
    public List<MzYjReq> queryNotRefundYjReq(String patientId, Integer times, List<String> orderCodes) {
        return mzYjReqMapper.selectNotRefundYjReq(patientId,times,orderCodes);
    }

    @Override
    public List<String> queryExecDept(MzYjReq mzYjReq) {
        return mzYjReqMapper.selectExecDept(mzYjReq);
    }

    @Override
    public MzYjReq queryMzYjReqByReqNo(String reqNo) {
        return mzYjReqMapper.selectMzYjReqByReqNo(reqNo);
    }

}
