package com.bonus.boot.manager.manager.controller;

import com.bonus.boot.manager.basic.entity.MapBean;
import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean;
import com.bonus.boot.manager.manager.annotation.LogAnnotation;
import com.bonus.boot.manager.manager.entity.R;
import com.bonus.boot.manager.manager.service.UtilService;
import com.bonus.boot.manager.physical.service.RetiremenService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 医院管理表控制层
 * @author tqzhang
 * @Data 2023/5/31 9:30
 */
@RestController
@RequestMapping("utilConnection")
public class UtilController {
    /**
     * 服务对象
     */
    @Resource
    private UtilService service;


    @LogAnnotation
    @PostMapping("determineIfExists")
    @ApiOperation(value = "自定义查询")
    public R determineIfExists(String tableName, String filedId, String filedValue, String id){
        int num = service.determineIfExists(tableName,filedId,filedValue,id);
        return  R.okTable(num,num);
    }


    @LogAnnotation
    @PostMapping("getHospitalSelect")
    @ApiOperation(value = "医院select列表")
    public R getList(MapBean  o){
        List<MapBean> list = service.getHospitalSelect(o);
        return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
    }
    @LogAnnotation
    @PostMapping("getNewHospitalSelect")
    @ApiOperation(value = "医院select列表")
    public R getNewHospitalSelectv(MapBean  o){
        List<MapBean> list = service.getNewHospitalSelect(o);
        return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
    }

    @LogAnnotation
    @PostMapping(value = "/getPackageType")
    @ApiOperation(value = "套餐类型select列表")
    public List<MapBean> getPackageType() {
        List<MapBean> result = service.getPackageType();
        return result;
    }
    @LogAnnotation
    @PostMapping(value = "/getHazard")
    @ApiOperation(value = "危害因素select列表")
    public List<MapBean> getHazard() {
        List<MapBean> result = service.getHazard();
        return result;
    }

    @LogAnnotation
    @PostMapping(value = "/getPersonType")
    @ApiOperation(value = "人员类别select列表")
    public List<MapBean> getPersonType() {
        List<MapBean> result = service.getPersonType();
        return result;
    }

    @LogAnnotation
    @PostMapping(value = "/getExaminationHospital")
    @ApiOperation(value = "体检医院select列表")
    public List<MapBean> getExaminationHospital() {
        List<MapBean> result = service.getExaminationHospital();
        return result;
    }

    @LogAnnotation
    @PostMapping(value = "/getSpecialPost")
    @ApiOperation(value = "特殊岗位select列表")
    public List<MapBean> getSpecialPost() {
        List<MapBean> result = service.getSpecialPost();
        return result;
    }

    @LogAnnotation
    @PostMapping(value = "/getRole")
    @ApiOperation(value = "人员角色select列表")
    public List<MapBean> getRole() {
        List<MapBean> result = service.getRole();
        return result;
    }

    @PostMapping("getSetMeal")
    @ApiOperation(value = "医院套餐列表")
    public R getSetMeal(MapBean  o){
        System.err.println("医院套餐列表MapBean ="+o);
        List<MapBean> list = service.getSetMeal(o);
        return R.okTable(list, list.size());
    }
}

