package com.diagbot.web;


import java.util.List;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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;

import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.DoctorPageModeDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.DoctorPageModeFacade;
import com.diagbot.vo.DoctorIdVO;
import com.diagbot.vo.DoctorPageModeVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 *
 * </p>
 *
 * @author wangfeng
 * @since 2018-11-20
 */

/**
 *
 * @author wangfeng
 * @Description: 医生页面结构设置（文本和半结构） 前端控制器
 * @date 2018年11月20日 下午2:50:40
 */
@RestController
@RequestMapping("/doctorPageMode")
@Api(value = "医生页面结构设置API[by:wangfeng]", tags = { "WF——医生页面结构设置API" })
@SuppressWarnings("unchecked")
public class DoctorPageModeController {

    @Autowired
    DoctorPageModeFacade doctorPageModeFacade;

    @ApiOperation(value = "保存医生页面结构设置信息[by:wangfeng]", notes = "医生id : doctorId;</br>模式分类: modeClassify;</br> 模式值: modeValue;")
    @PostMapping("/saveDoctorPageModes")
    @SysLogger("saveDoctorPageModes")
    @Transactional
    public RespDTO<Boolean> saveDoctorPageModes(@Valid @RequestBody DoctorPageModeVO doctorPageModeVO) {

        boolean res = doctorPageModeFacade.saveDoctorPageMode(doctorPageModeVO);

        return RespDTO.onSuc(res);
    }

    @ApiOperation(value = "获取医生页面结构设置信息[by:wangfeng]", notes = "获取医生页面结构设置信息")
    @PostMapping("/getDoctorPageModes")
    @SysLogger("getDoctorPageModes")
    public RespDTO<List<DoctorPageModeDTO>> getDoctorPageModes(@Valid @RequestBody DoctorIdVO doctorIdVO) {

    	List<DoctorPageModeDTO> doctorPageModeData = doctorPageModeFacade.getDoctorPageMode(doctorIdVO);

        return RespDTO.onSuc(doctorPageModeData);
    }
}
