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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
package com.ruoyi.web.controller.smartor;
 
import com.github.pagehelper.ISelect;
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.domain.entity.SysUser;
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.PatMedInhosp;
import com.smartor.domain.PatMedInhospVO;
import com.smartor.domain.PatMedReq;
import com.smartor.domain.PatServiceCount;
import com.smartor.service.IPatMedInhospService;
import com.smartor.service.IPatMedOuthospService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * 患者住院记录Controller
 *
 * @author smartor
 * @date 2023-03-04
 */
@Api(description = "患者住院记录")
@RestController
@RequestMapping("/smartor/patinhosp")
public class PatMedInhospController extends BaseController {
    @Autowired
    private IPatMedInhospService patMedInhospService;
 
    @Autowired
    private IPatMedOuthospService iPatMedOuthospService;
 
    @Value("${visitHosp}")
    private Integer visitHosp;
 
 
    /**
     * 查询患者住院记录列表
     */
    @ApiOperation("查询患者住院记录列表")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:list')")
    @PostMapping("/selectPatMedInhospList")
    public TableDataInfo selectPatMedInhosplist(@RequestBody PatMedInhosp patMedInhosp) {
        PageUtils.startPageByPost(patMedInhosp.getPageNum(), patMedInhosp.getPageSize());
        List<PatMedInhosp> list = patMedInhospService.selectPatMedInhospList(patMedInhosp);
        long count = PageUtils.count(new ISelect() {
            @Override
            public void doSelect() {
                patMedInhospService.selectPatMedInhospList(patMedInhosp);
            }
        });
        return getDataTable2(count, list);
    }
 
    /**
     * 出院、门诊人数和随访量统计(周,月,年)
     */
    @ApiOperation("出院、门诊人数和随访量统计(周,月,年)")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:list')")
    @PostMapping("/queryPersonCount")
    public TableDataInfo queryPersonCount(@RequestBody PatServiceCount patServiceCount) {
 
        return null;
    }
 
    /**
     * 查询当前登陆人自己(病区、部门)的患者住院记录列表
     */
    @ApiOperation("查询当前登陆人自己(病区、部门)的患者住院记录列表")
    @PostMapping("/selectPatMedInhospListByCondition")
    public TableDataInfo selectPatMedInhospListByCondition(@RequestBody PatMedInhospVO patMedInhospVO) {
        PageUtils.startPageByPost(patMedInhospVO.getPageNum(), patMedInhospVO.getPageSize());
        List<PatMedInhosp> list = null;
        if (!CollectionUtils.isEmpty(patMedInhospVO.getLeavehospitaldistrictcodes())) {
            list = patMedInhospService.selectPatMedInhospListByCondition(patMedInhospVO);
        } else if (!CollectionUtils.isEmpty(patMedInhospVO.getLeaveldeptcodes())) {
            list = patMedInhospService.selectPatMedInhospListByCondition(patMedInhospVO);
        }
        long count = PageUtils.count(new ISelect() {
            @Override
            public void doSelect() {
                patMedInhospService.selectPatMedInhospListByCondition(patMedInhospVO);
            }
        });
        return getDataTable2(count, list);
    }
 
    @PostMapping("/getDeptCodeByPatId")
    @ApiOperation("查询住、出院部门编码通过patId")
    public AjaxResult getDeptCodeByPatId(@RequestBody PatMedInhosp patMedInhosp) {
        return success(patMedInhospService.getDeptCodeByPatId(patMedInhosp));
    }
 
    @PostMapping("/selectPatMedInhospListCount")
    @ApiOperation("查询出、入院看病人次和人数")
    public AjaxResult selectPatMedInhospListCount(PatMedReq patMedReq) {
        return success(patMedInhospService.selectPatMedInhospListCount(patMedReq));
    }
 
    /**
     * 导出患者住院记录列表
     */
    @ApiOperation("导出患者住院记录列表")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:export')")
    @Log(title = "患者住院记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PatMedInhosp patMedInhosp) {
        List<PatMedInhosp> list = patMedInhospService.selectPatMedInhospList(patMedInhosp);
        ExcelUtil<PatMedInhosp> util = new ExcelUtil<PatMedInhosp>(PatMedInhosp.class);
        util.exportExcel(response, list, "患者住院记录数据");
    }
 
    /**
     * 获取患者住院记录详细信息
     */
    @ApiOperation("获取患者住院记录详细信息")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:query')")
    @GetMapping(value = "/getInfo/{inhospid}")
    public AjaxResult getInfo(@PathVariable("inhospid") Long inhospid) {
        return success(patMedInhospService.selectPatMedInhospByInhospid(inhospid));
    }
 
    /**
     * 新增患者住院记录
     */
    @ApiOperation("新增患者住院记录")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:add')")
    @Log(title = "患者住院记录", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody PatMedInhosp patMedInhosp) {
        SysUser user = getLoginUser().getUser();
        patMedInhosp.setOrgid(user.getOrgid());
        return toAjax(patMedInhospService.insertPatMedInhosp(patMedInhosp));
    }
 
    /**
     * 修改患者住院记录
     */
    @ApiOperation("修改患者住院记录")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:edit')")
    @Log(title = "患者住院记录", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody PatMedInhosp patMedInhosp) {
        return toAjax(patMedInhospService.updatePatMedInhosp(patMedInhosp));
    }
 
    /**
     * 删除患者住院记录
     */
    @ApiOperation("删除患者住院记录")
    //@PreAuthorize("@ss.hasPermi('smartor:patinhosp:remove')")
    @Log(title = "患者住院记录", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{inhospids}")
    public AjaxResult remove(@PathVariable Long[] inhospids) {
        return toAjax(patMedInhospService.deletePatMedInhospByInhospids(inhospids));
    }
 
    /**
     * 各科室服务人次
     *
     * @return
     */
    @ApiOperation("各科室服务人次")
    @PostMapping("/getDeptRanking")
    public TableDataInfo getDeptRanking(@RequestBody PatMedReq patMedReq) {
        return getDataTable(patMedInhospService.getDeptRanking(patMedReq));
    }
 
 
    /**
     * 医护与患者关联关系
     *
     * @return
     */
    @ApiOperation("医护与患者关联关系")
    @PostMapping("/getDocAndPat")
    public TableDataInfo getDocAndPat(@RequestBody PatMedInhosp patMedInhosp) {
        return getDataTable(patMedInhospService.getDocAndPat(patMedInhosp));
    }
 
//    /**
//     * 医护与患者关联关系
//     *
//     * @return
//     */
//    @ApiOperation("医护与患者关联关系")
//    @GetMapping("/test")
//    public void test() {
//        patMedInhospService.dealOutHospInfo();
//
//        //门诊表
//        if (visitHosp != 1) {
//            iPatMedOuthospService.dealOutpatientInfo();
//        }
//    }
 
}