1
lige
2024-02-02 3845de0796e77f8182ef5748caa349d048255f3d
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.common.core.redis.RedisCache;
import com.ltkj.framework.config.MatchUtils;
import com.ltkj.hosp.domain.TjCustomer;
import com.ltkj.hosp.domain.TjProject;
import com.ltkj.hosp.domain.TjSampling;
import com.ltkj.hosp.domain.TjXdPicture;
import com.ltkj.hosp.service.ITjCustomerService;
import com.ltkj.hosp.service.ITjProjectService;
import com.ltkj.hosp.service.ITjXdPictureService;
import com.ltkj.hosp.service.TjAsyncService;
import com.ltkj.system.service.ISysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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.common.utils.poi.ExcelUtil;
import com.ltkj.common.core.page.TableDataInfo;
 
/**
 * 体检心电图管理Controller
 *
 * @author ltkj_赵佳豪&李格
 * @date 2023-04-11
 */
@RestController
@RequestMapping("/picture/picture")
@Api(tags = "体检心电图管理")
public class TjXdPictureController extends BaseController {
    @Resource
    private ITjXdPictureService tjXdPictureService;
    @Resource
    private ITjCustomerService customerService;
    @Autowired
    private ISysConfigService configService;
 
    /**
     * 查询体检心电图管理列表
     */
    //@PreAuthorize("@ss.hasPermi('picture:picture:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询体检心电图管理列表(自带默认)")
    public TableDataInfo list(TjXdPicture tjXdPicture) {
        startPage();
        List<TjXdPicture> list = tjXdPictureService.selectTjXdPictureList(tjXdPicture);
        return getDataTable(list);
    }
 
    @GetMapping("/getList")
    @ApiOperation(value = "查询体检客户心电图列表(非自带)")
    public AjaxResult getList(@RequestParam(required = false) @ApiParam(value = "体检号") String tjNum,
                              @RequestParam(required = false) @ApiParam(value = "客户姓名") String name,
                              @ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer pageNum,
                              @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize) {
        LambdaQueryWrapper<TjXdPicture>wq=new LambdaQueryWrapper<>();
        if(null !=tjNum)wq.eq(TjXdPicture::getTjNum,tjNum);
        if(null !=name)wq.like(TjXdPicture::getCusName,name);
        wq.orderByDesc(TjXdPicture::getCreateTime);
        List<TjXdPicture> list = tjXdPictureService.list(wq);
        List<Map<String,Object>> arrayList=new ArrayList<>();
        if(null !=list && list.size()>0){
            Map<String, List<TjXdPicture>> stringListMap = list.stream().collect(Collectors.groupingBy(TjXdPicture::getCusId));
            for (Map.Entry<String, List<TjXdPicture>> entry : stringListMap.entrySet()) {
                Map<String,Object>map=new HashMap<>();
                TjCustomer customer = customerService.getById(entry.getKey());
                customer.setCusName(MatchUtils.hideCusName(customer.getCusName()));
                customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                customer.setTjNumber(entry.getValue().get(0).getTjNum());
                map.put("list",entry.getValue());
                map.put("customer",customer);
                map.put("picturePath",configService.selectConfigByKey("TjXdPicture"));
                arrayList.add(map);
            }
        }
        List<Map<String, Object>> collect =null;
        Map<String,Object>map=new HashMap<>();
        if(arrayList.size()>0){
            collect = arrayList.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
        }
        map.put("list",collect);
        map.put("total",arrayList.size());
        return AjaxResult.success(map);
    }
 
    /**
     * 导出体检心电图管理列表
     */
    //@PreAuthorize("@ss.hasPermi('picture:picture:export')")
    @Log(title = "体检心电图管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value = "导出体检心电图管理列表")
    public void export(HttpServletResponse response, TjXdPicture tjXdPicture) {
        List<TjXdPicture> list = tjXdPictureService.selectTjXdPictureList(tjXdPicture);
        ExcelUtil<TjXdPicture> util = new ExcelUtil<TjXdPicture>(TjXdPicture.class);
        util.exportExcel(response, list, "体检心电图管理数据");
    }
 
    /**
     * 获取体检心电图管理详细信息
     */
    //@PreAuthorize("@ss.hasPermi('picture:picture:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取体检心电图管理详细信息")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(tjXdPictureService.selectTjXdPictureById(id));
    }
 
    /**
     * 新增体检心电图管理
     */
    //@PreAuthorize("@ss.hasPermi('picture:picture:add')")
    @Log(title = "体检心电图管理", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation(value = "新增体检心电图管理")
    public AjaxResult add(@RequestBody TjXdPicture tjXdPicture) {
        return toAjax(tjXdPictureService.insertTjXdPicture(tjXdPicture));
    }
 
    /**
     * 修改体检心电图管理
     */
    //@PreAuthorize("@ss.hasPermi('picture:picture:edit')")
    @Log(title = "体检心电图管理", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation(value = "修改体检心电图管理")
    public AjaxResult edit(@RequestBody TjXdPicture tjXdPicture) {
        return toAjax(tjXdPictureService.updateTjXdPicture(tjXdPicture));
    }
 
    /**
     * 删除体检心电图管理
     */
    //@PreAuthorize("@ss.hasPermi('picture:picture:remove')")
    @Log(title = "体检心电图管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation(value = "删除体检心电图管理")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(tjXdPictureService.deleteTjXdPictureByIds(ids));
    }
}