lige
2024-02-29 8e0bc2b6ee9817f00cc4240c596e31441888a0fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package com.ltkj.web.controller.system;
 
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
 
import cn.hutool.extra.pinyin.PinyinUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.common.core.domain.entity.SysDept;
import com.ltkj.framework.config.MatchUtils;
import com.ltkj.framework.web.domain.server.Sys;
import com.ltkj.hosp.service.IDictOrgService;
import com.ltkj.system.service.ISysDeptService;
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.*;
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 = "PC端 所属医院管理模块接口")
public class DictHospController extends BaseController {
    @Resource
    private IDictHospService dictHospService;
    @Resource
    private IDictOrgService orgService;
    @Resource
    private ISysDeptService deptService;
 
    @GetMapping("/getDeptListByDictHospId")
    @ApiOperation(value = "跟医院查询对应的部门科室")
    public AjaxResult getDeptListByDictHospId(@RequestParam String id ) {
        List<SysDept> list = deptService.list(new LambdaQueryWrapper<SysDept>().eq(SysDept::getHospId,id));
        return AjaxResult.success(list);
    }
 
 
 
 
    /**
     * 查询院区信息列表
     */
    //@PreAuthorize("@ss.hasPermi('hosp:hosp:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询院区信息列表")
    public TableDataInfo list(DictHosp dictHosp) {
        startPage();
        List<DictHosp> 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<DictHosp> list = dictHospService.selectDictHospList(dictHosp);
        ExcelUtil<DictHosp> util = new ExcelUtil<DictHosp>(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) {
        if(null !=dictHosp.getHospid() ){
            dictHosp.setHospName(orgService.getById(dictHosp.getHospid()).getOrgCnName());
        }
        dictHosp.setWbm(MatchUtils.toWubi(dictHosp.getHospAreaName()));
        dictHosp.setSpell(PinyinUtil.getFirstLetter(dictHosp.getHospAreaName(),""));
        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));
    }
}