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.HospitalDeptInfoDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.entity.HospitalDept;
import com.diagbot.facade.HospitalDeptFacade;
import com.diagbot.vo.HospitalDeptInfoVO;

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

/**
 * @Description:
 * @author: wangyu
 * @time: 2018/11/22 13:41
 */
@RestController
@RequestMapping("/hospitalDeptInfo")
@Api(value = "医院信息API", tags = { "医院信息API" })
@SuppressWarnings("unchecked")
@ApiIgnore
public class HospitalDeptInfoController {

    @Autowired
    private HospitalDeptFacade hospitalDeptFacade;

    @ApiOperation(value = "医院信息——根据医院编码获取医院信息[by:wangyu]",
            notes = "id: 医院id<br>" +
                    "code：医院编码<br>")
    @PostMapping("/getHospitalDeptInfo")
    @SysLogger("getHospitalDeptInfo")
    public RespDTO<HospitalDeptInfoDTO> getHospitalDeptInfo(@RequestBody @Valid HospitalDeptInfoVO hospitalDeptInfoVO) {
        HospitalDeptInfoDTO data = hospitalDeptFacade.getHospitalDeptInfo(hospitalDeptInfoVO);
        return RespDTO.onSuc(data);
    }
    
    @PostMapping(value = "/hospitalDeptInfoMapByIds")
    @SysLogger("hospitalDeptInfoMapByIds")
    @ApiOperation(value = "根据ids获取科室信息map[by:rengb]")
    @ApiIgnore
    RespDTO<Map<Long, HospitalDept>> hospitalDeptInfoMapByIds(@RequestBody List<Long> ids) {
        Map<Long, HospitalDept> result = hospitalDeptFacade.hospitalDeptInfoMapByIds(ids);
        return RespDTO.onSuc(result);
    }
    
}
