package com.openhis.web.appointmentmanage.controller;

import com.core.common.core.domain.R;
import com.openhis.web.appointmentmanage.appservice.IDeptAppService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/dept")
public class DeptController {

    @Resource
    private IDeptAppService deptAppService;

    /*
    * 获取科室列表
    *
    * */
    @GetMapping("/list")
    public R<?> getDeptList(){
        return R.ok(deptAppService.getDeptList());
    }

    /*
    * 查询科室
    *
    * */
    @GetMapping("/search")
    public R<?> searchDept(
            @RequestParam(required = false,defaultValue = "1") Integer pageNo,
            @RequestParam(required = false,defaultValue = "10") Integer pageSize,
            @RequestParam(required = false)String orgName,
            @RequestParam(required = false)String deptName
    ){
        return R.ok(deptAppService.searchDept(pageNo,pageSize,orgName,deptName));
    }
}
