package cn.hnthyy.thmz.controller.mz;

import cn.hnthyy.thmz.comment.UserLoginToken;
import cn.hnthyy.thmz.service.his.zd.ZdChequeTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

@Slf4j
@RestController
public class ZdChequeTypeComtroller {
    @Autowired
    private ZdChequeTypeService zdChequeTypeService;

    /**
     * 查询所有门诊可用的付款方式
     *
     * @return
     */
    @UserLoginToken
    @RequestMapping(value = "/getAllZdChequeTypeForMz", method = {RequestMethod.GET, RequestMethod.POST})
    public Map<String, Object> getAllZdChequeTypeForMz() {
        Map<String, Object> resultMap = new HashMap<>();
        try {
            resultMap.put("code", 0);
            resultMap.put("message", "查询所有门诊可用的付款方式成功");
            resultMap.put("data", zdChequeTypeService.queryAllZdChequeTypeForMz());
            return resultMap;
        } catch (Exception e) {
            e.printStackTrace();
            log.error("查询所有门诊可用的付款方式失败，错误信息{}", e.getMessage());
            resultMap.put("code", -1);
            resultMap.put("message", "查询所有门诊可用的付款方式失败");
            return resultMap;
        }
    }


    /**
     * 查询所有住院可用的付款方式
     *
     * @return
     */
    @UserLoginToken
    @RequestMapping(value = "/getAllZdChequeTypeForZy", method = {RequestMethod.GET, RequestMethod.POST})
    public Map<String, Object> getAllZdChequeTypeForZy() {
        Map<String, Object> resultMap = new HashMap<>();
        try {
            resultMap.put("code", 0);
            resultMap.put("message", "查询所有住院可用的付款方式成功");
            resultMap.put("data", zdChequeTypeService.queryAllZdChequeTypeForZy());
            return resultMap;
        } catch (Exception e) {
            e.printStackTrace();
            log.error("查询所有住院可用的付款方式失败，错误信息{}", e.getMessage());
            resultMap.put("code", -1);
            resultMap.put("message", "查询所有住院可用的付款方式失败");
            return resultMap;
        }
    }
}
