package com.ltkj.web.controller.system; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import com.ltkj.hosp.service.IDictOrgService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ltkj.common.annotation.Log; import com.ltkj.common.core.controller.BaseController; import com.ltkj.common.core.domain.AjaxResult; import com.ltkj.common.enums.BusinessType; import com.ltkj.hosp.domain.DictHosp; import com.ltkj.hosp.service.IDictHospService; import com.ltkj.common.utils.poi.ExcelUtil; import com.ltkj.common.core.page.TableDataInfo; /** * 院区信息Controller * * @author ltkj * @date 2022-11-18 */ @RestController @RequestMapping("/hosp/hosp") @Api(tags = "分院管理模块接口") public class DictHospController extends BaseController { @Resource private IDictHospService dictHospService; @Resource private IDictOrgService orgService; /** * 查询院区信息列表 */ //@PreAuthorize("@ss.hasPermi('hosp:hosp:list')") @GetMapping("/list") @ApiOperation(value = "查询院区信息列表") public TableDataInfo list(DictHosp dictHosp) { startPage(); List list = dictHospService.selectDictHospList(dictHosp); return getDataTable(list); } /** * 导出院区信息列表 */ //@PreAuthorize("@ss.hasPermi('hosp:hosp:export')") @Log(title = "院区信息", businessType = BusinessType.EXPORT) @PostMapping("/export") @ApiOperation(value = "导出院区信息列表") public void export(HttpServletResponse response, DictHosp dictHosp) { List list = dictHospService.selectDictHospList(dictHosp); ExcelUtil util = new ExcelUtil(DictHosp.class); util.exportExcel(response, list, "院区信息数据"); } /** * 获取院区信息详细信息 */ //@PreAuthorize("@ss.hasPermi('hosp:hosp:query')") @GetMapping(value = "/{hospAreaId}") @ApiOperation(value = "获取院区信息详细信息") public AjaxResult getInfo(@PathVariable("hospAreaId") String hospAreaId) { return success(dictHospService.selectDictHospByHospAreaId(hospAreaId)); } /** * 新增院区信息 */ //@PreAuthorize("@ss.hasPermi('hosp:hosp:add')") @Log(title = "院区信息", businessType = BusinessType.INSERT) @PostMapping @ApiOperation(value = "新增院区信息") public AjaxResult add(@RequestBody DictHosp dictHosp) { dictHosp.setHospName(orgService.getById(dictHosp.getHospid()).getOrgCnName()); return toAjax(dictHospService.save(dictHosp)); } /** * 修改院区信息 */ //@PreAuthorize("@ss.hasPermi('hosp:hosp:edit')") @Log(title = "院区信息", businessType = BusinessType.UPDATE) @PutMapping @ApiOperation(value = "修改院区信息") public AjaxResult edit(@RequestBody DictHosp dictHosp) { dictHosp.setHospName(orgService.getById(dictHosp.getHospid()).getOrgCnName()); return toAjax(dictHospService.updateDictHosp(dictHosp)); } /** * 删除院区信息 */ //@PreAuthorize("@ss.hasPermi('hosp:hosp:remove')") @Log(title = "院区信息", businessType = BusinessType.DELETE) @DeleteMapping("/{hospAreaIds}") @ApiOperation(value = "删除院区信息") public AjaxResult remove(@PathVariable String[] hospAreaIds) { return toAjax(dictHospService.deleteDictHospByHospAreaIds(hospAreaIds)); } }