liusheng
21 小时以前 e4e220916dd2a4aa649a9b0162e5b5ed0dc9d7e5
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
package com.ruoyi.web.controller.smartor;
 
import cn.hutool.db.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.MedicalHistory;
import com.smartor.service.IMedicalHistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * 病史Controller
 *
 * @author ruoyi
 * @date 2023-12-06
 */
@Api(description = "病史")
@RestController
@RequestMapping("/medicalhistory")
public class MedicalHistoryController extends BaseController {
    @Autowired
    private IMedicalHistoryService medicalHistoryService;
 
    /**
     * 查询病史列表
     */
    //@PreAuthorize("@ss.hasPermi('system:history:list')")
    @PostMapping("/selectMedicalHistoryList")
    @ApiOperation("查询病史列表")
    public TableDataInfo selectMedicalHistorylist(@RequestBody  MedicalHistory medicalHistory) {
        PageUtils.startPageByPost(medicalHistory.getPageNum(),medicalHistory.getPageSize());
        List<MedicalHistory> list = medicalHistoryService.selectMedicalHistoryList(medicalHistory);
        return getDataTable(list);
    }
 
    /**
     * 导出病史列表
     */
    //@PreAuthorize("@ss.hasPermi('system:history:export')")
    @Log(title = "病史", businessType = BusinessType.EXPORT)
    @ApiOperation("导出病史列表")
    @PostMapping("/export")
    public void export(HttpServletResponse response, MedicalHistory medicalHistory) {
        List<MedicalHistory> list = medicalHistoryService.selectMedicalHistoryList(medicalHistory);
        ExcelUtil<MedicalHistory> util = new ExcelUtil<MedicalHistory>(MedicalHistory.class);
        util.exportExcel(response, list, "病史数据");
    }
 
    /**
     * 获取病史详细信息
     */
    //@PreAuthorize("@ss.hasPermi('system:history:query')")
    @ApiOperation("获取病史详细信息")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id,@PathVariable("pid") Long pid) {
        return success(medicalHistoryService.selectMedicalHistoryById(id));
    }
 
    /**
     * 新增病史
     */
    //@PreAuthorize("@ss.hasPermi('system:history:add')")
    @Log(title = "病史", businessType = BusinessType.INSERT)
    @ApiOperation("新增病史")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody MedicalHistory medicalHistory) {
        medicalHistory.setOrgid(getOrgid());
        return toAjax(medicalHistoryService.insertMedicalHistory(medicalHistory));
    }
 
    /**
     * 修改病史
     */
    //@PreAuthorize("@ss.hasPermi('system:history:edit')")
    @Log(title = "病史", businessType = BusinessType.UPDATE)
    @ApiOperation("修改病史")
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody MedicalHistory medicalHistory) {
        return toAjax(medicalHistoryService.updateMedicalHistory(medicalHistory));
    }
 
    /**
     * 删除病史
     */
    //@PreAuthorize("@ss.hasPermi('system:history:remove')")
    @Log(title = "病史", businessType = BusinessType.DELETE)
    @ApiOperation("删除病史")
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(medicalHistoryService.deleteMedicalHistoryByIds(ids));
    }
}