package com.diagbot.web;


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

import javax.validation.Valid;

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;

import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.DoctorInfoDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.entity.DoctorInfo;
import com.diagbot.facade.DoctorInfoFacade;
import com.diagbot.vo.DoctorInfoVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;

/**
 * <p>
 * 医生信息表 前端控制器
 * </p>
 *
 * @author wangyu
 * @since 2018-11-19
 */
@RestController
@RequestMapping("/doctorInfo")
@Api(value = "医生信息API", tags = { "医生信息API" })
@SuppressWarnings("unchecked")
/*@ApiIgnore*/
public class DoctorInfoController {

    @Autowired
    private DoctorInfoFacade doctorInfoFacade;

    @ApiOperation(value = "医生信息——查询[by:wangyu]",
            notes = "deptCode：科室编号，必填<br>" +
                    "hospitalCode: 医院编号，必填<br>" +
                    "doctorCode: 医生编号，必填<br>")
    @PostMapping("/getDoctorInfo")
    @SysLogger("getDoctorInfo")
    @ApiIgnore
    public RespDTO<List<DoctorInfoDTO>> getDoctorInfo(@Valid @RequestBody DoctorInfoVO doctorInfoVo) {
        List<DoctorInfoDTO> data = doctorInfoFacade.getDoctorInfo(doctorInfoVo);
        return RespDTO.onSuc(data);
    }
    
    @PostMapping(value = "/doctorInfoMapByIds")
    @SysLogger("doctorInfoMapByIds")
    @ApiOperation(value = "根据ids获取医生信息map[by:rengb]")
    @ApiIgnore
    RespDTO<Map<Long, DoctorInfo>> doctorInfoMapByIds(@RequestBody List<Long> ids) {
        Map<Long, DoctorInfo> result = doctorInfoFacade.doctorInfoMapByIds(ids);
        return RespDTO.onSuc(result);
    }
}
