package thyyxxk.webserver.controller.surgicalmanagement;

import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.surgeryarrangement.QuerySurgeryParams;
import thyyxxk.webserver.entity.zhuyuanyisheng.shoushu.OpRecord;
import thyyxxk.webserver.service.surgicalmanagement.SurgeryArrangementService;

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

@RestController
@RequestMapping("/surgeryArrangement")
public class SurgeryArrangementController {
    private final SurgeryArrangementService service;

    public SurgeryArrangementController(SurgeryArrangementService server) {
        this.service = server;
    }

    @GetMapping("/getDicList")
    public ResultVo<Map<String, List<CodeName>>> getDicList() {
        return service.getDicList();
    }

    @PostMapping("/selectSurgeryArrangements")
    public ResultVo<List<OpRecord>> selectSurgeryArrangements(@RequestBody QuerySurgeryParams param) {
        return service.selectSurgeryArrangements(param);
    }

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

    @GetMapping("/updateSurgeryStatus")
    public ResultVo<String> updateSurgeryStatus(@RequestParam("recordId") Integer recordId,
                                                @RequestParam("status") String status) {
        return service.updateSurgeryStatus(recordId, status);
    }

    @GetMapping("/updateArrangement")
    public ResultVo<String> updateArrangement(@RequestParam("recordId") Integer recordId,
                                              @RequestParam("column") String column,
                                              @RequestParam("value") String value) {
        return service.updateArrangement(recordId, column, value);
    }
}
