package com.yihu.jw.base.endpoint.area;

import com.yihu.jw.hospital.team.service.WlyyAdminTeamService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
*
* 社区/医院字典控制器
*
* @version
* <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
* @since 1.
*/
@RestController
@RequestMapping(value = BaseRequestMapping.Equipment.PREFIX)
@Api(value = "社区/医院字典控制器", description = "社区/医院字典接口", tags = {"wlyy基础服务 - 社区/医院字典接口"})
public class BaseEquipmentEndpoint extends EnvelopRestEndpoint {

    @Autowired
    private WlyyAdminTeamService wlyyAdminTeamService;
    @ApiOperation("查询社区")
    @GetMapping("/findOrgList")
    public MixEnvelop findOrgList(@ApiParam(name = "code", value = "区code", required = false)
                                  @RequestParam(value = "code", required = false)String code,
                                  @ApiParam(name = "name", value = "社区名称", required = false)
                                  @RequestParam(value = "name", required = false)String name,
                                  @ApiParam(name = "page", value = "第几页，从1开始", required = true, defaultValue = "1")
                                  @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                                  @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                                  @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){


        try {
            return wlyyAdminTeamService.findHospitalByTown(code,name,page,pageSize);
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedMixEnvelopException(e);
        }
    }

 }
