zhaowenxuan
2024-12-09 19590a728a4aa4286bd9bad7aa620357b8c65bd4
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
package com.ltkj.web.controller.app;
 
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ltkj.common.core.controller.BaseController;
import com.ltkj.common.core.domain.AjaxResult;
import com.ltkj.common.core.page.TableDataInfo;
import com.ltkj.common.utils.SecurityUtils;
import com.ltkj.common.utils.StringUtils;
import com.ltkj.framework.config.UserHoder;
import com.ltkj.hosp.domain.*;
import com.ltkj.hosp.service.*;
import com.ltkj.hosp.sqlDomain.LtkjExamJcbgd;
import com.ltkj.hosp.sqlDomain.LtkjExamJcsqd;
import com.ltkj.hosp.sqlDomain.LtkjHybgd;
import com.ltkj.hosp.sqlDomain.LtkjHysqd;
import com.ltkj.hosp.vodomain.ShenGaoTiZhongVo;
import com.ltkj.mall.mallOrderUtils.TjConstants;
import com.ltkj.web.config.pdfutils.PDFBinaryUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.One;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTJcImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.session.InMemoryWebSessionStore;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.net.URL;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
 
/**
 * @Author: 西安路泰科技有限公司/lige
 * @Date: 2023/1/10 15:42
 */
 
@RestController
@RequestMapping("/cus/getReport")
@Api(tags = "小程序查看体检报告")
@Slf4j
public class ReportController extends BaseController {
 
    @Resource
    private ITjReportService reportService;
    @Resource
    private ITjCustomerService customerService;
    @Autowired
    private ITjOrderService orderService;
    @Autowired
    private ITjOrderDetailService detailService;
    @Resource
    private ITjProjectService projectService;
    @Resource
    private ITjOrderRemarkService remarkService;
    @Resource
    private ITjStandardService standardService;
    @Resource
    private ITjAdviceService adviceService;
    @Resource
    private IDictCompService compService;
    @Resource
    private ITjReportTemplateService reportTemplateService;
    @Value("${path.filePath}")
    private String value;
    @Resource
    private LtkjHybgdService ltkjHybgdService;
    @Resource
    private LtkjHysqdService ltkjHysqdService;
    @Resource
    private LtkjExamJcbgdService jcbgdService;
    @Resource
    private LtkjExamJcsqdService jcsqdService;
 
 
    /**
     * 小程序查询体检报告列表
     */
    @GetMapping("/getReportList")
    @ApiOperation(value = "小程序-体检报告列表")
    public AjaxResult getReportList(String cusPhone) {
//        Wxuser wxuser = UserHoder.getWxuser();
        if (cusPhone == null) {
            return AjaxResult.error("请绑定手机号!");
        }
        List<Object> result = new ArrayList<>();
        LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>();
        wq1.eq(TjCustomer::getCusPhone, cusPhone);
        List<TjCustomer> list1 = customerService.list(wq1);
        if (list1.size() != 0) {
            for (TjCustomer tjCustomer : list1) {
                Map<String, Object> map = new HashMap<>();
                QueryWrapper<TjOrder> wq2 = new QueryWrapper<>();
                wq2.eq("user_id", tjCustomer.getCusId());
                wq2.eq("check_status", 1);
                wq2.isNotNull("finish_time");
                wq2.orderByDesc("finish_time");
                List<TjOrder> list = orderService.list(wq2);
                if (null != list && list.size() > 0) {
                    TjOrder tjOrder = orderService.list(wq2).get(0);
                    map.put("report", tjOrder);
                    map.put("customer", tjCustomer);
                    result.add(map);
                }
            }
            return AjaxResult.success(result);
        }
        return AjaxResult.error("您还没有体检记录!");
    }
 
 
    /**
     * 小程序查询体检报告列表
     */
    @GetMapping("/getRelativeReportList")
    @ApiOperation(value = "小程序-查询亲友最新报告")
    public AjaxResult getRelativeReportList(@RequestParam @ApiParam(value = "姓名") String cusName,
                                            @RequestParam @ApiParam(value = "身份证号") String cusIdcard) {
        LambdaQueryWrapper<TjCustomer> wq1 = new LambdaQueryWrapper<>();
        wq1.like(TjCustomer::getCusName, cusName);
        wq1.eq(TjCustomer::getCusIdcard, cusIdcard);
        TjCustomer customer = customerService.getOne(wq1);
        if (null != customer) {
            Map<String, Object> map = new HashMap<>();
            QueryWrapper<TjOrder> wq2 = new QueryWrapper<>();
            wq2.eq("user_id", customer.getCusId());
            wq2.eq("check_status", 1);
            wq2.isNotNull("finish_time");
            wq2.orderByDesc("finish_time");
            List<TjOrder> list = orderService.list(wq2);
            if (null != list && list.size() > 0) {
                TjOrder tjOrder = orderService.list(wq2).get(0);
                map.put("report", tjOrder);
                map.put("customer", customer);
                return AjaxResult.success(map);
            }
            return AjaxResult.success("体检报告暂未生成");
        }
        return AjaxResult.success("暂时没有体检记录!");
    }
 
    /**
     * 小程序点击体检报告查询详情
     */
    @GetMapping("/getReportByTjNumber")
    @ApiOperation(value = "小程序-体检报告查询详情")
    public AjaxResult getReportByTjNumber(@RequestParam @ApiParam(value = "体检号") String tjNumber) {
        Map<String, Object> objectMap = new HashMap<>();
        List<Map<String, Object>> list = new ArrayList<>();
        LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>();
        wq1.eq(TjOrder::getTjNumber, tjNumber);
        wq1.eq(TjOrder::getCheckStatus, 1);
        TjOrder one = orderService.getOne(wq1);
        if (one == null) {
            return AjaxResult.success("体检暂未完成!!");
        }
        LambdaQueryWrapper<TjCustomer> wq22 = new LambdaQueryWrapper<>();
        wq22.eq(TjCustomer::getCusId, one.getUserId());
        TjCustomer customer = customerService.getOne(wq22);
        LambdaQueryWrapper<TjOrderRemark> wqm = new LambdaQueryWrapper<>();
        wqm.eq(TjOrderRemark::getTjNumber, tjNumber);
        wqm.in(TjOrderRemark::getDeptId,"100", "240", "253", "254", "255", "257", "258", "259", "269", "270");
        List<TjOrderRemark> remarkList = remarkService.list(wqm);
        List<Map<String, Object>> abnormalList = new ArrayList<>();
        if (null != remarkList && remarkList.size() > 0) {
            for (TjOrderRemark remark : remarkList) {
                Map<String, Object> parent = new HashMap<>();
                Map<String, Object> parent1 = new HashMap<>();
                TjProject tjProject = projectService.getById(remark.getProId());
                if (null != tjProject && tjProject.getNeedReport().equals("Y")) {
                    parent.put("parent", tjProject.getProName());
                    parent1.put("parent", tjProject.getProName());
                    LambdaQueryWrapper<TjProject> wq2 = new LambdaQueryWrapper<>();
                    wq2.eq(TjProject::getProParentId, remark.getProId());
                    List<Long> sonsTjProjectList = null;
                    if (null != projectService.list(wq2) && projectService.list(wq2).size() > 0) {
                        sonsTjProjectList = projectService.list(wq2).stream().map(TjProject::getProId).collect(Collectors.toList());
                    }
                    if (sonsTjProjectList == null) {
                        log.info("我报空指针了::::::::::::" + remark.toString());
                        continue;
                    }
                    LambdaQueryWrapper<TjOrderDetail> wq = new LambdaQueryWrapper<>();
                    wq.eq(TjOrderDetail::getOrderId, one.getOrderId());
                    wq.in(TjOrderDetail::getProId, sonsTjProjectList);
                    List<TjOrderDetail> tjOrderDetails = detailService.list(wq);
                    if (null != tjOrderDetails && tjOrderDetails.size() > 0) {
                        List<TjOrderDetail> abnormals = new ArrayList<>();
                        for (TjOrderDetail tjOrderDetail : tjOrderDetails) {
                            if (tjOrderDetail.getExceptionDesc() == 1) {
                                abnormals.add(tjOrderDetail);
                                parent1.put("abnormalList", abnormals);
                                abnormalList.add(parent1);
                            }
                            LambdaQueryWrapper<TjProject> wqqqq = new LambdaQueryWrapper<>();
                            wqqqq.eq(TjProject::getProId, tjOrderDetail.getProId());
                            wqqqq.eq(TjProject::getNeedReport,"Y");
                            tjOrderDetail.setProject(projectService.getOne(wqqqq));
                            //                            LambdaQueryWrapper<TjStandard> wq6 = new LambdaQueryWrapper<>();
//                            wq6.eq(TjStandard::getProId, tjOrderDetail.getProId());
//                            List<TjStandard> list2 = standardService.list(wq6);
//                            if (list2.size() == 0) {
//                                tjOrderDetail.setStandard(null);
//                            } else if (list2.size() == 1) {
//                                tjOrderDetail.setStandard(list2.get(0));
//                            } else {
//                                for (TjStandard tjStandard : list2) {
//                                    LambdaQueryWrapper<TjStandard> wq8 = new LambdaQueryWrapper<>();
//                                    if (tjStandard.getTjSex() != null) {
//                                        wq8.eq(TjStandard::getTjSex, customer.getCusSex());
//                                    }
//                                    if (tjStandard.getTjType() != null) {
//                                        wq8.eq(TjStandard::getTjType, StringUtils.getAgeType(DateUtil.ageOfNow(customer.getCusBrithday())));
//                                    }
//                                    tjOrderDetail.setStandard(standardService.getOne(wq8));
//                                }
//                            }
                        }
                        LambdaQueryWrapper<TjAdvice> wq3 = new LambdaQueryWrapper<>();
                        wq3.eq(TjAdvice::getProId, remark.getProId());
                        parent.put("sons", tjOrderDetails);
                        parent.put("parentAdvice", adviceService.list(wq3));
                        parent.put("advice", remark.getSummary());
                        list.add(parent);
                    } else {
                        return AjaxResult.success("该客户在没有体检项目数据");
                    }
                }
            }
            objectMap.put("list", list);
            objectMap.put("inspectionAdvice", one.getCheckAdvice());
            objectMap.put("tjAbnormal", abnormalList);
            objectMap.put("customter", customer);
            return AjaxResult.success(objectMap);
        }
        return AjaxResult.success("该客户在没有体检项目数据!");
    }
 
    @GetMapping("/getHyReportByTjNumber")
    @ApiOperation(value = "小程序-体检化验报告查询详情")
    public AjaxResult getHyReportByTjNumber(@RequestParam @ApiParam(value = "体检号") String tjNumber) {
        LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>();
        wq1.eq(TjOrder::getTjNumber, tjNumber);
        wq1.eq(TjOrder::getCheckStatus, 1);
        TjOrder one = orderService.getOne(wq1);
        if (one == null) {
            return AjaxResult.success("体检暂未完成!!");
        }
        List<LtkjHysqd> hysqdList = ltkjHysqdService.getLtkjHysqdByTjh(one.getCardId());
        if(null !=hysqdList && hysqdList.size()>0){
            List<Map<String, Object>> list = new ArrayList<>();
 
            for (LtkjHysqd hysqd : hysqdList) {
                Map<String, Object> map = new HashMap<>();
                map.put("parent",hysqd.getXmmc());
                List<LtkjHybgd> hybgdList = ltkjHybgdService.getJianYanBaoGaoDanList(hysqd.getTmh());
                if(null !=hybgdList && hybgdList.size()>0){
                    for (LtkjHybgd hybgd : hybgdList) {
                        String jyjg = hybgd.getJyjg();
                        String fwz = hybgd.getFwz();
                        if (jyjg != null && StrUtil.isNotBlank(jyjg) && fwz != null && StrUtil.isNotBlank(fwz)){
                            try {
                                String[] fwzs = fwz.split("-");
                                BigDecimal min = new BigDecimal(fwzs[0]);
                                BigDecimal max = new BigDecimal(fwzs[1]);
                                BigDecimal jyjgval = new BigDecimal(jyjg);
                                // 比较检验结果和范围值
                                if (jyjgval.compareTo(min) < 0) {
                                    // jyjg 小于范围最小值,添加下箭头
                                    jyjg = jyjg + "   ↓";
                                    hybgd.setYcbz("1");
                                } else if (jyjgval.compareTo(max) > 0) {
                                    // jyjg 大于范围最大值,添加上箭头
                                    jyjg = jyjg + "   ↑";
                                    hybgd.setYcbz("1");
                                }else {
                                    hybgd.setYcbz("0");
                                }
                                hybgd.setJyjg(jyjg);
                            } catch (Exception ignored) {}
                        }
                    }
                }
                map.put("sons",hybgdList);
                list.add(map);
            }
            return AjaxResult.success(list);
        }
        return AjaxResult.success("该客户在没有体检项目数据!");
    }
 
 
 
    @GetMapping("/getJcReportByTjNumber")
    @ApiOperation(value = "小程序-体检检查报告查询详情")
    public AjaxResult getJcReportByTjNumber(@RequestParam @ApiParam(value = "体检号") String tjNumber) {
        LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>();
        wq1.eq(TjOrder::getTjNumber, tjNumber);
        wq1.eq(TjOrder::getCheckStatus, 1);
        TjOrder one = orderService.getOne(wq1);
        if (one == null) {
            return AjaxResult.success("体检暂未完成!!");
        }
        List<LtkjExamJcsqd> jcsqdList = jcsqdService.getLtkjJcsqdByTjh(one.getCardId());
        if(null !=jcsqdList && jcsqdList.size()>0){
            List<Map<String, Object>> list = new ArrayList<>();
            for (LtkjExamJcsqd jcsqd : jcsqdList) {
                Map<String, Object> map = new HashMap<>();
                map.put("parent",jcsqd.getJcxmmc());
                map.put("jcbx",jcsqd.getJgbx());
                List<LtkjExamJcbgd> jcbgdList = jcbgdService.getJianJcBaoGaoDanList(jcsqd.getTmh());
                map.put("sons",jcbgdList);
                list.add(map);
            }
            return AjaxResult.success(list);
        }
        return AjaxResult.success("该客户在没有体检项目数据!");
    }
 
 
 
    /**
     * 小程序点击体检报告查询详情,显示身高体重体重指数收缩压舒张压
     */
    @GetMapping("/getShenGaoTiZhong")
    @ApiOperation(value = "小程序-体检报告查询详情")
    public AjaxResult getShenGaoTiZhong(@RequestParam @ApiParam(value = "体检号") String tjNumber) {
//        Map<String, Object> objectMap = new HashMap<>();
        LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>();
        wq1.eq(TjOrder::getTjNumber, tjNumber);
        wq1.eq(TjOrder::getCheckStatus, 1);
        TjOrder one = orderService.getOne(wq1);
        if (one == null) {
            return AjaxResult.success("体检暂未完成!!");
        }
 
        List<ShenGaoTiZhongVo> maps = detailService.getShenGaoTiZhongList(one.getTjNumber());
//        if(null !=maps && maps.size()>0){
//            for (Map<String, Object> map : maps) {
//                if (map.get("") == null) {
//                    objectMap.put("shenggao", "无");
//                } else {
//                    objectMap.put("shenggao", one1.getProResult());
//                }
//                if (one2 == null) {
//                    objectMap.put("tizhong", "无");
//                } else {
//                    objectMap.put("tizhong", one2.getProResult());
//                }
//                if (one3 == null) {
//                    objectMap.put("tizhongzhishu", "无");
//                } else {
//                    objectMap.put("tizhongzhishu", one3.getProResult());
//                }
//                if (one4 == null) {
//                    objectMap.put("shousuoya", "无");
//                } else {
//                    objectMap.put("shousuoya", one4.getProResult());
//                }
//                if (one5 == null) {
//                    objectMap.put("shuzhangya", "无");
//                } else {
//                    objectMap.put("shuzhangya", one5.getProResult());
//                }
//            }
//        }
        log.info("ltkj {}的体检报告查询详情"+maps,tjNumber);
        return AjaxResult.success(maps);
 
    }
 
 
    /**
     * 小程序点击下载报告
     */
    @GetMapping("/downloadReport")
    @ApiOperation(value = "小程序-下载报告")
    public AjaxResult downloadReport(@RequestParam @ApiParam(value = "体检号") String tjNumber) {
        Map<String, String> res = new HashMap<>();
        LambdaQueryWrapper<TjReport> we = new LambdaQueryWrapper<>();
        we.eq(TjReport::getTjNumber, tjNumber);
        we.eq(TjReport::getType, "体检报告");
        TjReport one = reportService.getOne(we);
        if ("pdf".equals(one.getPrint())) {
            res.put("flag", "0");
            res.put("url", one.getPath());
            return AjaxResult.success(res);
        } else if ("报表".equals(one.getPrint())) {
            res.put("flag", "1");
            res.put("url", one.getPath());
            return AjaxResult.success(res);
        } else {
            return AjaxResult.error("暂无体检报告");
        }
    }
 
 
    @GetMapping("/preview/{flag}/{TjNumber}")
    @ApiOperation(value = "下载体检报告")
    public void preview(HttpServletResponse response, @PathVariable("flag") boolean flag, @PathVariable("TjNumber") String tjNumber) {
        //修改order表中的下载报告时间为当前时间
//        LambdaUpdateWrapper<TjOrder> updateWrapper = new LambdaUpdateWrapper<>();
//        updateWrapper.eq(TjOrder::getTjNumber, tjNumber);
//        updateWrapper.set(TjOrder::getPrintLastTime, new Date());
//        updateWrapper.set(TjOrder::getDownloadLastTime, new Date());
//        updateWrapper.set(TjOrder::getStatus, TjConstants.TJ_END);
//        orderService.update(updateWrapper);
 
 
        LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>();
        wq1.eq(TjOrder::getTjNumber, tjNumber);
        TjOrder tjOrder = orderService.getOne(wq1);
 
 
        LambdaQueryWrapper<TjCustomer> wq2 = new LambdaQueryWrapper<>();
        wq2.eq(TjCustomer::getCusId, tjOrder.getUserId());
        TjCustomer tjCustomer = customerService.getOne(wq2);
 
 
        LambdaQueryWrapper<TjReport> we = new LambdaQueryWrapper<>();
        we.eq(TjReport::getTjNumber, tjNumber);
        we.eq(TjReport::getType, "体检报告");
        TjReport one = reportService.getOne(we);
        if (one == null) {
            return;
        }
        final UUID uuid = UUID.randomUUID();
        final String substring = uuid.toString().substring(0, 5);
 
//        String userId = SecurityUtils.getLoginUser().getUsername();
        PDFBinaryUtil.base64StringToPDF(one.getReport(), FileUtil.mkdir(value).getPath() + File.separator + substring + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf");
        //String filePath = one.getPath();
        String filePath = value + File.separator + substring + tjNumber + tjCustomer.getCusName() + "_体检报告.pdf";
        File f = new File(filePath);
        if (filePath.isEmpty()) {
            System.out.println("文件不存在!");
            return;
        }
        BufferedInputStream br = null;
        OutputStream out = null;
        FileInputStream fileInputStream = null;
        try {
            fileInputStream = new FileInputStream(f);
            br = new BufferedInputStream(fileInputStream);
            byte[] bs = new byte[1024];
            int len = 0;
            response.reset(); // 非常重要
            if (flag) {
                // 在线打开方式
                URL u = new URL("file:///" + filePath);
                //System.out.println(u);
                String contentType = u.openConnection().getContentType();
                response.setContentType(contentType);
                response.setHeader("Content-Disposition", "inline;filename="
                        + substring + tjNumber + ".pdf");
            } else {
                // 纯下载方式
                response.setContentType("application/x-msdownload");
                response.setContentType("application/pdf;charset=utf-8");
                response.setHeader("Content-Disposition", "attachment;filename="
                        + substring + tjNumber + ".pdf");
            }
            out = response.getOutputStream();
            while ((len = br.read(bs)) > 0) {
                out.write(bs, 0, len);
            }
            out.flush();
            out.close();
            br.close();
            fileInputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
            //System.out.println("pdf处理文件异常" + e);
        } finally {
            if (out != null) {
                try {
                    out.close();
                    br.close();
                    fileInputStream.close();
 
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
 
 
    /**
     * 小程序查询体检历史报告列表
     */
    @GetMapping("/getHistryReportList")
    @ApiOperation(value = "小程序-体检历史报告列表")
    public AjaxResult getHistryReportList(@RequestParam @ApiParam(value = "手机号") String cusPhone) {
        List<Object> result = new ArrayList<>();
        QueryWrapper<TjCustomer> wq1 = new QueryWrapper<>();
        wq1.eq("cus_phone", cusPhone);
        List<TjCustomer> list1 = customerService.list(wq1);
        if (list1.size() != 0) {
            for (TjCustomer tjCustomer : list1) {
                Map<String, Object> map = new HashMap<>();
                QueryWrapper<TjOrder> wq2 = new QueryWrapper<>();
                wq2.eq("user_id", tjCustomer.getCusId());
                wq2.eq("check_status", 1);
                wq2.isNotNull("finish_time");
                wq2.orderByDesc("finish_time");
                List<TjOrder> list = orderService.list(wq2);
                if (null != list && list.size() > 0) {
                    map.put("report", list);
                    map.put("customer", tjCustomer);
                    result.add(map);
                }
            }
            return AjaxResult.success(result);
        }
        return AjaxResult.success("您还没有体检记录!");
    }
}