package cn.hnthyy.thmz.controller.mz;

import cn.hnthyy.thmz.comment.UserLoginToken;
import cn.hnthyy.thmz.service.his.zd.ZdChargeClassService;
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.HashMap;
import java.util.Map;

@RestController
@Slf4j
public class ZdChargeClassController {
    @Autowired
    private ZdChargeClassService zdChargeClassService;

    /**
     * 查询所有收费项目类型
     * @return
     */
    @UserLoginToken
    @RequestMapping(value = "/getAllZdChargeClass", method = {RequestMethod.GET})
    public Map<String, Object> getAllZdChargeClass() {
        log.info("查询所有收费项目类型");
        Map<String, Object> resultMap = new HashMap<>();
        try {
            resultMap.put("code", 0);
            resultMap.put("message", "查询所有收费项目类型成功");
            resultMap.put("data", zdChargeClassService.queryAllZdChargeClass());
            return resultMap;
        }catch (Exception e){
            e.printStackTrace();
            resultMap.put("code", -1);
            resultMap.put("message", "系统出错，请联系管理员");
            log.error("查询所有收费项目类型出现系统异常，错误信息{}",e.getMessage());
            return resultMap;
        }
    }
}
