package com.hs.api.controller;

import com.hs.api.common.Result;
import com.hs.api.common.annotations.CurrentUser;
import com.hs.api.common.annotations.Token;
import com.hs.api.model.SerDepartment;
import com.hs.api.model.reqmodel.Disease;
import com.hs.api.service.SysUserOrgRsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

@Api(tags = "科室 Api")
@RestController
public class DeptController {
    @Autowired
    private SysUserOrgRsService sysUserOrgRsService;

    /**
     * 查询科室列表
     *
     * @return
     */
    @PostMapping("/dept/list")
    @Token
    @ApiOperation("查询科室列表")
    public Object getList(@ApiIgnore @CurrentUser Long userId, @RequestBody Disease.DiseaseIDorLevel disease) {
        List<SerDepartment> sysMenuList = sysUserOrgRsService.getUserOrg(userId, disease.getDisease(), disease.getDate());
        return Result.success(sysMenuList);
    }
}
