医院废弃物信息化管理平台
“mitao”
2025-12-24 3763145f34d7706923d55edc32f5cfbc8bc08b92
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
package cn.besteam.modules.system.controller;
 
import cn.besteam.common.api.vo.Result;
import cn.besteam.modules.system.dto.SysDepartmentInformationDTO;
import cn.besteam.modules.system.service.ISysDepartmentInformationService;
import cn.besteam.modules.system.vo.SysDepartmentInformationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.MyBatisSystemException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.web.bind.annotation.*;
 
/**
 * 医疗机构信息
 */
@RestController
@RequestMapping("/system/sysDepartmentInformation")
@Slf4j
@Api(description = "医疗机构信息")
public class SysDepartmentInformationController {
    @Autowired
    ISysDepartmentInformationService sysDepartmentInformationService;
 
    /**
     * 根据医院id获取医院信息
     *
     * @param departmentId
     * @return
     */
    @RequestMapping(value = "/queryOne", method = RequestMethod.GET)
    @ApiOperation(value = "医疗机构信息-根据医院id获取医院信息", notes = "医疗机构信息-根据医院id获取医院信息")
    public Result<?> queryOne(@RequestParam(name = "departmentId") Integer departmentId) {
        SysDepartmentInformationVO sysDepartmentInformationVO=sysDepartmentInformationService.queryOne(departmentId);
        return Result.ok(sysDepartmentInformationVO);
    }
 
 
 
    /**
     * 编辑
     *
     * @param departmentInformationDTO
     * @return
     */
    @RequestMapping(value = "/update", method = RequestMethod.PUT)
    @ApiOperation(value = "医疗机构信息-保存信息", notes = "医疗机构信息-保存信息")
    public Result<?> update(@RequestBody SysDepartmentInformationDTO departmentInformationDTO) {
        SysDepartmentInformationVO sysDepartmentInformationVO= null;
        try {
            sysDepartmentInformationVO = sysDepartmentInformationService.update(departmentInformationDTO);
        } catch (DuplicateKeyException e) {
            SysDepartmentInformationVO res = new SysDepartmentInformationVO();
            BeanUtils.copyProperties(departmentInformationDTO, res);
            return Result.ok(res);
        }
        return Result.ok(sysDepartmentInformationVO);
    }
 
    /**
     * 通过id删除
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
    @ApiOperation(value = "医疗机构信息-删除信息", notes = "医疗机构信息-删除信息")
    public Result<?> delete(@RequestParam(name = "id") Integer id) {
        sysDepartmentInformationService.delete(id);
        return Result.ok("删除成功");
    }
 
}