luodangjia
2025-01-01 196ac84b6ec0dd05304dd6577f169f7fbf5fe726
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
package com.sinata.web.controller.applet;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sinata.common.core.domain.R;
import com.sinata.common.core.domain.entity.SysUser;
import com.sinata.common.utils.SecurityUtils;
import com.sinata.system.domain.MwWarningRecord;
import com.sinata.system.domain.SysDepartment;
import com.sinata.system.domain.dto.CollectTotalUpDto;
import com.sinata.system.service.MwWarningRecordService;
import com.sinata.system.service.SysDepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.time.LocalDate;
import java.util.List;
 
/**
 * <p>
 * 预警记录表 前端控制器
 * </p>
 *
 * @author mitao
 * @since 2024-12-02
 */
@RestController
@RequestMapping("/applet/mwWarningRecord")
@Api(tags = {"医院工作人员"})
@AllArgsConstructor
public class AppMwWarningRecordController {
    private  final MwWarningRecordService mwWarningRecordService;
    private final SysDepartmentService sysDepartmentService;
 
    @ApiOperation("预警记录")
    @PostMapping("/record")
    public R<Page<MwWarningRecord>> record(@RequestParam Integer pageNum,@RequestParam Integer pageSize) {
        SysUser sysUser = SecurityUtils.getLoginUser().getUser();
        Page<MwWarningRecord> page = mwWarningRecordService.lambdaQuery().eq(MwWarningRecord::getDepartmentId, sysUser.getDepartmentId()).page(Page.of(pageNum, pageSize));
        return R.ok(page);
    }
 
    @ApiOperation(value = "预警统计",tags = "监管人员")
    @PostMapping("/danger")
    public R<List<SysDepartment>> danger(String name) {
        //
        List<SysDepartment> list = sysDepartmentService.lambdaQuery().like(name!=null,SysDepartment::getDepartmentName,name).eq(SysDepartment::getOrgType, 2).list();
        for (SysDepartment sysDepartment : list) {
            sysDepartment.setDangerCount(mwWarningRecordService.lambdaQuery().eq(MwWarningRecord::getDepartmentId,sysDepartment.getId()).count());
        }
        return R.ok(list);
    }
 
}