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

import com.alibaba.fastjson.JSONObject;
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.utils.AjaxRes;
import com.bonus.boot.manager.manager.utils.GlobalConst;
import com.bonus.boot.manager.manager.utils.ImportNoPhotoExcelHelper;
import com.bonus.boot.manager.physical.entity.NegativeResultBean;
import com.bonus.boot.manager.positive.service.Impl.NegativeResultServiceimple;
import com.bonus.boot.manager.positive.service.NegativeResultService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("negativeResult")
public class NegativeResultController {

    @Resource
    private NegativeResultService service;

    @Resource
    private NegativeResultServiceimple serviceimple;

    @LogAnnotation
    @PostMapping("getMsgContent")
    @ApiOperation(value = "上传体检数据-列表")
    public R getList(NegativeResultBean o){
        System.err.println("NegativeResultBean="+o);
        List<NegativeResultBean> list = serviceimple.getList(o);
        return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
    }

    @RequestMapping(value = "getListById", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "上传体检数据-查询人员信息")
    public AjaxRes getListById(String id){
        AjaxRes ar = new AjaxRes();
        PersonnelLibraryBean negativeResultBean = service.getListById(id);
        // 通过调用service的getListById方法，传入id参数进行查询人员信息
        Map<String, Object> map = new HashMap<>();
        if(negativeResultBean !=null){
            map.put("negativeResultBean",negativeResultBean);
            // 如果查询结果不为空，则将查询到的人员信息放入map中
        }
        ar.setSucceed(map, GlobalConst.DATA_SUCCEED);
        // 调用AjaxRes对象的setSucceed方法，将map作为数据结果设置到AjaxRes中
        return ar;
        // 将AjaxRes对象作为响应结果返回
    }



}
