package thyyxxk.webserver.controller.outpatient.triage;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.CodeName;
import thyyxxk.webserver.entity.outpatient.mangedoctorinfo.DoctorInfo;
import thyyxxk.webserver.entity.outpatient.triage.MessageForPush;
import thyyxxk.webserver.service.outpatient.triage.RoomScreenService;

import java.util.List;

@RestController
@RequestMapping("/roomScreen")
public class RoomScreenController {
    private final RoomScreenService service;

    @Autowired
    public RoomScreenController(RoomScreenService service) {
        this.service = service;
    }

    @PassToken
    @GetMapping("/getRoomCodeByIp")
    public ResultVo<String> getRoomCodeByIp(@RequestParam("ip") String ip) {
        return service.getRoomCodeByIp(ip);
    }

    @PassToken
    @GetMapping("/getPageUrl")
    public ResultVo<String> getPageUrl() {
        return service.getPageUrl();
    }

    @PassToken
    @GetMapping("/getVideoList")
    public ResultVo<List<String>> getVideoList() {
        return service.getVideoList();
    }

    @PassToken
    @GetMapping("/getDoctorInfo")
    public ResultVo<DoctorInfo> getDoctorInfo(@RequestParam("code") String code) {
        return service.getDoctorInfo(code);
    }

    @PassToken
    @GetMapping("/getRoomNoAndDept")
    public ResultVo<CodeName> getRoomNoAndDept(@RequestParam("roomCode") String roomCode) {
        return service.getRoomNoAndDept(roomCode);
    }

    @PassToken
    @PostMapping("/pushMsg")
    public ResultVo<String> pushMsg(@RequestBody MessageForPush param) {
        return service.pushSocketMsg(param);
    }

    @PassToken
    @PostMapping("/getNextJz")
    public ResultVo<MessageForPush> getNextJz(@RequestBody MessageForPush param) {
        return service.getNextJz(param);
    }

    @PassToken
    @PostMapping("/getNextJzList")
    public ResultVo<List<MessageForPush>> getNextJzList(@RequestBody MessageForPush param) {
        return service.getNextJzList(param);
    }

    @PassToken
    @GetMapping("/notifyComplete")
    public void notifyComplete(@RequestParam("serialNo") Integer serialNo) {
        service.notifyComplete(serialNo);
    }
}
