package thyyxxk.webserver.controller.dictionary;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.outpatient.triage.MzfzZdDeptRoom;
import thyyxxk.webserver.service.dictionary.ClinicRoomDictService;
import thyyxxk.webserver.utils.ResultVoUtil;

import java.util.List;

@RestController
@RequestMapping("/clinicRoomDict")
public class ClinicRoomDictController {
    private final ClinicRoomDictService service;

    @Autowired
    public ClinicRoomDictController(ClinicRoomDictService service) {
        this.service = service;
    }

    @GetMapping("/getDeptList")
    public ResultVo<List<CodeName>> getDeptList() {
        return ResultVoUtil.success(service.getDeptList());
    }

    @GetMapping("/getAllRooms")
    public ResultVo<List<MzfzZdDeptRoom>> getAllRooms() {
        List<MzfzZdDeptRoom> list = service.getAllRooms();
        return ResultVoUtil.success(list);
    }

    @PostMapping("/changeRoomInfo")
    public ResultVo<MzfzZdDeptRoom> changeRoomInfo(@RequestBody MzfzZdDeptRoom room) {
        return ResultVoUtil.success(service.changeRoomInfo(room));
    }
}
