package com.docus.server.message.controller;

import com.docus.server.message.busservice.SdBusinessService;
import com.docus.server.message.dto.Message;
import com.docus.server.message.dto.MessageResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;

/**
 * 消息接收控制
 *
 * @author wyb
 */
@Api("消息接收")
@RestController
@Slf4j
@RequestMapping("/message/receive")
public class MessageReceiveController {

    private SdBusinessService sdBusinessService;

    @Autowired
    public void setSdBusinessService(SdBusinessService sdBusinessService) {
        this.sdBusinessService = sdBusinessService;
    }

    @PostMapping("/wsRecordSubmit/do")
    @ApiOperation("顺德人医电子病历提交消息接收")
    public MessageResponse receiveWsRecordSubmitMessage(@RequestBody Message message) {
        log.info("顺德人医电子病历提交消息接收：{}", message);
        return sdBusinessService.recordSubmitHandle(message);
    }

    @PostMapping("/wsNurseSubmit/do")
    @ApiOperation("顺德人医护理提交消息接收")
    public MessageResponse receiveWsNurseSubmitMessage(@RequestBody Message message) {
        log.info("顺德人医护理提交消息接收：{}", message);
        return sdBusinessService.wsNurseSubmitHandle(message);
    }
}
