eight
2024-08-22 2cb4f97e706193afbddf49e56fcf798e9dc8eb85
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
package cn.lihu.jh.module.ecg.controller.admin.doctor;
 
import cn.lihu.jh.framework.apilog.core.annotation.ApiAccessLog;
import cn.lihu.jh.framework.common.pojo.CommonResult;
import cn.lihu.jh.framework.common.pojo.PageParam;
import cn.lihu.jh.framework.common.pojo.PageResult;
import cn.lihu.jh.framework.common.util.object.BeanUtils;
import cn.lihu.jh.framework.excel.core.util.ExcelUtils;
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.PatientStatisticVO;
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueuePageReqVO;
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueRespVO;
import cn.lihu.jh.module.ecg.controller.admin.queue.vo.QueueSaveReqVO;
import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
import cn.lihu.jh.module.ecg.enums.QueueStatusEnum;
import cn.lihu.jh.module.ecg.service.queue.QueueService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
 
import static cn.lihu.jh.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
 
@Tag(name = "管理后台 - 医生叫号")
@RestController
@RequestMapping("/ecg/doctor")
@Validated
public class DoctorController {
 
    @Resource
    private QueueService queueService;
 
    @GetMapping("/finish-next-patient")
    @Operation(summary = "完成、下一位患者")
    @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116")
    @Parameter(name = "bedNo", description = "工位编号", required = true, example = "B2")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:nextpatient')")
    public CommonResult<List<QueueRespVO>> finishNextPatient(
            @RequestParam("roomId") Long roomId,
            @RequestParam("bedNo") String bedNo)
    {
        queueService.finishNextPatient(roomId, bedNo);
 
        List<Byte> queueStatusList = new ArrayList<>();
        queueStatusList.add(QueueStatusEnum.READY.getStatus());
        queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
        queueStatusList.add(QueueStatusEnum.PASSED.getStatus());
        List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList);
        return success(BeanUtils.toBean(queueDOList, QueueRespVO.class));
    }
 
    @GetMapping("/pass-next-patient")
    @Operation(summary = "过号、下一位患者")
    @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116")
    @Parameter(name = "bedNo", description = "工位编号", required = true, example = "B2")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:nextpatient')")
    public CommonResult<List<QueueRespVO>> passNextPatient(
            @RequestParam("roomId") Long roomId,
            @RequestParam("bedNo") String bedNo)
    {
        queueService.passNextPatient(roomId, bedNo);
 
        List<Byte> queueStatusList = new ArrayList<>();
        queueStatusList.add(QueueStatusEnum.READY.getStatus());
        queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
        queueStatusList.add(QueueStatusEnum.PASSED.getStatus());
        List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList);
        return success(BeanUtils.toBean(queueDOList, QueueRespVO.class));
    }
 
    @GetMapping("/get-patient-list")
    @Operation(summary = "取患者列表")
    @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116")
    @Parameter(name = "bedNo", description = "工位编号", required = true, example = "B2")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:patientlist')")
    public CommonResult<List<QueueRespVO>> getPatientList(
            @RequestParam("roomId") Long roomId,
            @RequestParam("bedNo") String bedNo)
    {
        List<Byte> queueStatusList = new ArrayList<>();
        queueStatusList.add(QueueStatusEnum.READY.getStatus());
        queueStatusList.add(QueueStatusEnum.ONSTAGE.getStatus());
        queueStatusList.add(QueueStatusEnum.PASSED.getStatus());
        List<QueueDO> queueDOList = queueService.getDoctorQueueByStatus(roomId, bedNo, queueStatusList);
        return success(BeanUtils.toBean(queueDOList, QueueRespVO.class));
    }
 
    @GetMapping("/get-patient-statistic")
    @Operation(summary = "取患者统计")
    @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116")
    @Parameter(name = "bedNo", description = "工位编号", required = true, example = "B2")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:patientstatistic')")
    public CommonResult<PatientStatisticVO> getPatientStatistic(
            @RequestParam("roomId") Long roomId,
            @RequestParam("bedNo") String bedNo)
    {
        PatientStatisticVO patientStatisticVO = queueService.getPatientStatistic(roomId, bedNo);
        return success(patientStatisticVO);
    }
 
    @GetMapping("/passed-patient-return")
    @Operation(summary = "过期病人回来")
    @Parameter(name = "roomId", description = "诊室编号", required = true, example = "116")
    @Parameter(name = "bedNo", description = "工位编号", required = true, example = "B2")
    @Parameter(name = "patId", description = "患者编号", required = true, example = "B2")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:patient')")
    public CommonResult<String> passedPatientReturn(
            @RequestParam("roomId") Long roomId,
            @RequestParam("bedNo") String bedNo,
            @RequestParam("patId") String patId )
    {
        Integer result = queueService.passedPatientReturn(roomId, bedNo, patId);
        return success("success");
    }
 
    @GetMapping("/queuejump")
    @Operation(summary = "插队")
    @Parameter(name = "patId", description = "患者编号", required = true, example = "B2")
    @PreAuthorize("@ss.hasPermission('ecg:doctor:patient')")
    public CommonResult<String> queueJump(
            @RequestParam("patId") String patId,
            @RequestParam("jumpFlag") Byte jumpFlag)
    {
        Integer result = queueService.queueJump(patId, jumpFlag);
        return success("success");
    }
 
}