| | |
| | | package com.kidgrow.oprationcenter.controller; |
| | | |
| | | import java.util.Map; |
| | | import com.kidgrow.common.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.oprationcenter.model.HospitalScreening; |
| | | import com.kidgrow.oprationcenter.service.IHospitalScreeningService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import com.kidgrow.oprationcenter.model.HospitalScreening; |
| | | import com.kidgrow.oprationcenter.service.IHospitalScreeningService; |
| | | import com.kidgrow.common.model.*; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | |
| | | /** |
| | |
| | | @ApiImplicitParam(name = "limit", value = "分页结束位置", required = true, dataType = "Integer") |
| | | }) |
| | | @GetMapping |
| | | public ResultBody<PageResult> list(@RequestParam Map<String, Object> params) { |
| | | public PageResult<HospitalScreening> list(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | } |
| | | return ResultBody.ok().data(hospitalScreeningService.findList(params)); |
| | | return hospitalScreeningService.findList(params); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | if(hospitalScreening.getId() == null){ |
| | | HospitalScreening hs = new HospitalScreening(); |
| | | hs.setHospitalId(hospitalScreening.getHospitalId()); |
| | | HospitalScreening byObject = hospitalScreeningService.findByObject(hs); |
| | | if(byObject != null){ |
| | | return ResultBody.failed().msg("该医院已添加"); |
| | | } |
| | | } |
| | | boolean v= hospitalScreeningService.saveOrUpdate(hospitalScreening); |
| | | if(v) { |
| | | return ResultBody.ok().data(hospitalScreening).msg("保存成功"); |
| | |
| | | return ResultBody.failed().msg("删除失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "修改反馈数据状态") |
| | | @GetMapping("/updateEnabled") |
| | | public ResultBody updateEnabled(@RequestParam Map<String, Object> params) { |
| | | if (params.size() == 0) { |
| | | return ResultBody.failed().msg("参数异常!"); |
| | | } |
| | | return hospitalScreeningService.updateEnabled(params); |
| | | } |
| | | |
| | | /** |
| | | * 查询 |
| | | */ |
| | | @ApiOperation(value = "查询") |
| | | @GetMapping("/findByName") |
| | | public ResultBody findByName(@RequestParam String hospitalName) { |
| | | if (!hospitalName.isEmpty()) { |
| | | return ResultBody.ok().data(hospitalScreeningService.findByName(hospitalName).getData()).msg("查询成功"); |
| | | } else { |
| | | return ResultBody.ok().data(null).msg(""); |
| | | } |
| | | } |
| | | } |