package cn.hnthyy.thmz.controller.zy;

import cn.hnthyy.thmz.comment.UserLoginToken;
import cn.hnthyy.thmz.service.his.zy.ZyZdAuditItemService;
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 ZyZdAuditItemController {
    @Autowired
    private ZyZdAuditItemService zyZdAuditItemService;

    /**
     * 查询所有住院字典  核算码
     * @return
     */
    @UserLoginToken
    @RequestMapping(value = "/getAllZyZdAuditItem", method = {RequestMethod.GET})
    public Map<String, Object> ZyZdAuditItem() {
        log.info("查询所有住院字典");
        Map<String, Object> resultMap = new HashMap<>();
        try {
            resultMap.put("code", 0);
            resultMap.put("message", "查询所有住院字典成功");
            resultMap.put("data", zyZdAuditItemService.querytAll());
            return resultMap;
        }catch (Exception e){
            e.printStackTrace();
            resultMap.put("code", -1);
            resultMap.put("message", "系统出错，请联系管理员");
            log.error("查询所有住院字典出现系统异常，错误信息{}",e.getMessage());
            return resultMap;
        }
    }
}
