zhaowenxuan
2025-01-02 f78aea34f0cbdaba114723d6edadc3648669aa24
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
package com.ltkj.web.controller.system;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.common.annotation.RepeatSubmit;
import com.ltkj.common.core.domain.entity.SysUser;
import com.ltkj.system.service.ISysUserService;
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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.TjCheckModifiedState;
import com.ltkj.hosp.service.ITjCheckModifiedStateService;
import com.ltkj.common.utils.poi.ExcelUtil;
import com.ltkj.common.core.page.TableDataInfo;
 
/**
 * 医师修改状态Controller
 *
 * @author ltkj_赵佳豪&李格
 * @date 2023-03-14
 */
@Api(tags = "医师修改状态")
@RestController
@RequestMapping("/ModifiedState/ModifiedState")
public class TjCheckModifiedStateController extends BaseController {
    @Autowired
    private ITjCheckModifiedStateService tjCheckModifiedStateService;
    @Autowired
    private ISysUserService userService;
 
    /**
     * 查询医师修改状态列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TjCheckModifiedState tjCheckModifiedState) {
        startPage();
        List<TjCheckModifiedState> list = tjCheckModifiedStateService.selectTjCheckModifiedStateList(tjCheckModifiedState);
        return getDataTable(list);
    }
 
    /**
     * 导出医师修改状态列表
     */
    @RepeatSubmit
    @Log(title = "医师修改状态", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TjCheckModifiedState tjCheckModifiedState) {
        List<TjCheckModifiedState> list = tjCheckModifiedStateService.selectTjCheckModifiedStateList(tjCheckModifiedState);
        ExcelUtil<TjCheckModifiedState> util = new ExcelUtil<TjCheckModifiedState>(TjCheckModifiedState.class);
        util.exportExcel(response, list, "医师修改状态数据");
    }
 
    /**
     * 获取医师修改状态详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(tjCheckModifiedStateService.selectTjCheckModifiedStateById(id));
    }
 
    /**
     * 新增医师修改状态
     */
    @Log(title = "医师修改状态", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation(value = "新增医师修改状态")
    @RepeatSubmit
    public AjaxResult add(@RequestBody TjCheckModifiedState tjCheckModifiedState) {
        if (tjCheckModifiedStateService.save(tjCheckModifiedState)) {
            return AjaxResult.success(tjCheckModifiedState.getId());
        }
        return AjaxResult.error();
    }
 
    /**
     * 修改医师修改状态
     */
    @RepeatSubmit
    @Log(title = "医师修改状态", businessType = BusinessType.UPDATE)
    @PostMapping(value = "/edit")
    @ApiOperation(value = "修改医师修改状态")
    public AjaxResult edit(@RequestBody TjCheckModifiedState tjCheckModifiedState) {
        return toAjax(tjCheckModifiedStateService.updateById(tjCheckModifiedState));
    }
 
    /**
     * 删除医师修改状态
     */
    @RepeatSubmit
    @Log(title = "医师修改状态", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(tjCheckModifiedStateService.deleteTjCheckModifiedStateByIds(ids));
    }
 
    /**
     * 查看修改记录判断是否有人正在改
     */
    @RepeatSubmit
    @GetMapping(value = "/hasModified/{tjNumber}")
    @ApiOperation(value = "查看修改记录判断是否有人正在改")
    public AjaxResult hasModified(@PathVariable("tjNumber") String tjNumber) {
        Map<String, String> map = new HashMap<>();
        LambdaQueryWrapper<TjCheckModifiedState> wq = new LambdaQueryWrapper<>();
        wq.eq(TjCheckModifiedState::getTjNumber, tjNumber);
        wq.eq(TjCheckModifiedState::getState, "0");
        TjCheckModifiedState a = tjCheckModifiedStateService.getOne(wq);
        if (a != null) {
            SysUser sysUser = userService.selectUserById(Long.valueOf(a.getUserId()));
            map.put("status", "0");
            map.put("name", sysUser.getNickName());
            return AjaxResult.success(map);
        }
        map.put("status", "1");
        return AjaxResult.success(map);
    }
 
 
    /**
     * 强制进医生检查
     */
    @PostMapping(value = "/forceIn")
    @ApiOperation(value = "强制进医生检查")
    @RepeatSubmit
    public AjaxResult forceIn(@RequestBody TjCheckModifiedState tjCheckModifiedState) {
        LambdaQueryWrapper<TjCheckModifiedState> wq = new LambdaQueryWrapper<>();
        wq.eq(TjCheckModifiedState::getTjNumber, tjCheckModifiedState.getTjNumber());
        wq.eq(TjCheckModifiedState::getState, "0");
        TjCheckModifiedState a = tjCheckModifiedStateService.getOne(wq);
        if (a!=null){
            a.setState("1");
            if (tjCheckModifiedStateService.updateById(a)){
                tjCheckModifiedStateService.save(tjCheckModifiedState);
                return AjaxResult.success(tjCheckModifiedState.getId());
            }
            return AjaxResult.error("失败!");
        }
        return AjaxResult.error("失败!");
    }
}