package com.emr.controller.otherManage;

import com.emr.dao.EmrComomSetMapper;
import com.emr.entity.EmrComomSet;
import com.emr.entity.ResultUtil;
import com.emr.service.CommomSetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("commomSet/")
public class CommomSetController {
    @Autowired
    private CommomSetService commomSetService;

    @RequestMapping("commomSetList")
    public String commomSetList(Model model){
        try{
            EmrComomSet comomSet = commomSetService.selectByPrimaryKey(1);
            model.addAttribute("comomSet",comomSet);
        }catch (Exception e){
            e.printStackTrace();
        }
        return "otherManage/commomSetList";
    }

    @RequestMapping("updateCommomSet")
    @ResponseBody
    public ResultUtil updateCommomSet(EmrComomSet comomSet){
        try{
            commomSetService.update(comomSet);
            return ResultUtil.ok();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.error("保存出错了,请联系系统管理员");
        }
    }
}
