package thyyxxk.webserver.controller.dictionary;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.service.dictionary.BedDeptDictService;

import java.util.List;
import java.util.Map;

/**
 * @ClassName BedDeptDictController
 * @Author hsh
 * @Date 2024/9/9 15:59
 * @Version 1.0
 * @Description 床位（科室）字典维护
 **/
@RestController
@RequestMapping("/bedDict")
public class BedDeptDictController {

    private final BedDeptDictService service;

    public BedDeptDictController(BedDeptDictService service) {
        this.service = service;
    }

    @GetMapping("/selectDeptInfoForBed")
    public ResultVo<List<Map<String, Object>>> selectDeptInfoForBed(@RequestParam("text") String text){
        return service.selectDeptInfoForBed(text);
    }

    @GetMapping("/selectBedInfoForDept")
    public ResultVo<List<Map<String, Object>>> selectBedInfoForDept(@RequestParam("wardCode") String wardCode){
        return service.selectBedInfoForDept(wardCode);
    }

    @GetMapping("/selectAirItemInfo")
    public ResultVo<List<Map<String, Object>>> selectAirItemInfo(@RequestParam("text") String text){
        return service.selectAirItemInfo(text);
    }

    @PostMapping("/updateDeptInfoForBed")
    public ResultVo<Map<String, Object>> updateDeptInfoForBed(@RequestBody @Validated List<Map<String, Object>> deptInfoList){
        return service.updateDeptInfoForBed(deptInfoList);
    }

    @PostMapping("/updateBedInfoForDept")
    public ResultVo<Map<String, Object>> updateBedInfoForDept(@RequestBody @Validated List<Map<String, Object>> bedInfoList){
        return service.updateBedInfoForDept(bedInfoList);
    }

    @PostMapping("/saveBedForDept")
    public ResultVo<Map<String, Object>> saveBedForDept(@RequestBody @Validated Map<String, Object> map){
        return service.saveBedForDept(map);
    }

    @GetMapping("/selectRoomDept")
    public ResultVo<List<Map<String, Object>>> selectRoomDept(@RequestParam("text") String text){
        return service.selectRoomDept(text);
    }

    @PostMapping("/saveRoomDept")
    public ResultVo<Map<String, Object>> saveRoomDept(@RequestBody @Validated Map<String, Object> roomDept){
        return service.saveRoomDept(roomDept);
    }

    @GetMapping("/delRoomDeptByCode")
    public ResultVo<Map<String, Object>> delRoomDeptByCode(@RequestParam("wardCode") String wardCode, @RequestParam("deptCode") String deptCode){
        return service.delRoomDeptByCode(wardCode, deptCode);
    }

    @GetMapping("/selectSmallDept")
    public ResultVo<List<Map<String, Object>>> selectSmallDept(@RequestParam("text") String text){
        return service.selectSmallDept(text);
    }

    @PostMapping("/saveSmallDept")
    public ResultVo<Map<String, Object>> saveSmallDept(@RequestBody @Validated Map<String, Object> smallMap){
        return service.saveSmallDept(smallMap);
    }

    @GetMapping("/delSmallDeptByCode")
    public ResultVo<Map<String, Object>> delSmallDeptByCode(@RequestParam("deptId") String deptId){
        return service.delSmallDeptByCode(deptId);
    }

}
