zjh
昨天 9597821e57d4bad1ea4e984241f363be956dda8c
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
package com.ltkj.web.controller.system;
 
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
 
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ltkj.common.core.redis.RedisCache;
import com.ltkj.framework.config.MatchUtils;
import com.ltkj.hosp.domain.*;
import com.ltkj.hosp.service.*;
import com.ltkj.system.service.ISysConfigService;
import com.ltkj.web.controller.his.HisApiMethod;
import com.ltkj.web.controller.lis.LisApiMethod;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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
 */
@Slf4j
@RestController
@RequestMapping("/sampling/sampling")
@Api(tags = "PC端 体检采样管理")
public class TjSamplingController extends BaseController {
    @Resource
    private ITjSamplingService tjSamplingService;
    @Resource
    private ITjCustomerService customerService;
    @Resource
    private ITjProjectService projectService;
    @Resource
    private TjAsyncService asyncService;
    @Resource
    private RedisCache redisCache;
    @Autowired
    private ITjOrderService orderService;
    @Autowired
    private ITbTransitionService tbTransitionService;
    @Autowired
    private LisApiMethod lisApiMethod;
    @Autowired
    private ISysConfigService configService;
    @Autowired
    private SamplingServiceApi samplingService;
    @Autowired
    private HisApiMethod hisApiMethod;
    @Autowired
    private LtkjJianchajianyanTreeService treeService;
    @Autowired
    private TbLisSqService tbLisSqService;
    @Autowired
    private LtkjJfxmgljyxmzdService jfxmgljyxmzdService;
 
    /**
     * 查询体检采样管理列表
     */
    //@PreAuthorize("@ss.hasPermi('sampling:sampling:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询体检采样管理列表(自带默认)")
    public TableDataInfo list(TjSampling tjSampling) {
        startPage();
        List<TjSampling> list = tjSamplingService.selectTjSamplingList(tjSampling);
        if (null != list && list.size() > 0) {
            for (TjSampling sampling : list) {
                TjCustomer customer = customerService.getById(sampling.getCusId());
                if (null != customer) {
                    sampling.setCustomer(customer);
                }
            }
        }
        return getDataTable(list);
    }
 
 
    @GetMapping("/getList")
    @ApiOperation(value = "查询采样未签收列表()")
    public AjaxResult getList(@RequestParam @ApiParam(value = "0是1否") Integer isSignFor,
                              @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,
                              @ApiParam(value = "开始时间") @RequestParam(required = false) String beginTime,
                              @ApiParam(value = "结束时间") @RequestParam(required = false) String endTime) {
        LambdaQueryWrapper<TjSampling> wq = new LambdaQueryWrapper<>();
        List<Map<String, Object>> arrayList = new ArrayList<>();
        wq.orderByDesc(TjSampling::getApplicationTime);
        if (null != beginTime && !"".equals(beginTime) && null != endTime && !"".equals(endTime))
            wq.between(TjSampling::getApplicationTime, beginTime, endTime);
        if (null != tjNum) {
            wq.eq(TjSampling::getTjNum, tjNum);
            wq.eq(TjSampling::getIsSignFor, isSignFor);
            List<TjSampling> list = tjSamplingService.list(wq);
            List<Map<String, Object>> extracted = extracted(arrayList, list, pageNum, pageSize);
 
            //________________________解决搜索数据不对
            Map<String, Object> map = new HashMap<>();
            map.put("list", extracted);
            map.put("total", arrayList.size());
            return AjaxResult.success(map);
            //________________________解决搜索数据不对
        }
        if (null != name) {
            wq.like(TjSampling::getCusName, name);
            wq.eq(TjSampling::getIsSignFor, isSignFor);
            List<TjSampling> list = tjSamplingService.list(wq);
            List<Map<String, Object>> extracted = extracted(arrayList, list, pageNum, pageSize);
 
            //________________________解决搜索数据不对
            Map<String, Object> map = new HashMap<>();
            map.put("list", extracted);
            map.put("total", arrayList.size());
            return AjaxResult.success(map);
            //________________________解决搜索数据不对
        }
        List<Map<String, Object>> cacheMapValue = null;
        if (isSignFor == 0) {
            cacheMapValue = redisCache.getCacheMapValue("sampling", "yqs");
        }
        if (isSignFor == 1) {
            cacheMapValue = redisCache.getCacheMapValue("sampling", "wqs");
        }
        asyncService.saveSampling();
        List<Map<String, Object>> collect = null;
        Map<String, Object> map = new HashMap<>();
        if (null == cacheMapValue || cacheMapValue.size() == 0) {
            wq.eq(TjSampling::getIsSignFor, isSignFor);
            List<TjSampling> list = tjSamplingService.list(wq);
            collect = extracted(arrayList, list, pageNum, pageSize);
            map.put("total", arrayList.size());
        } else {
            collect = cacheMapValue.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
            map.put("total", cacheMapValue.size());
        }
        map.put("list", collect);
 
        return AjaxResult.success(map);
    }
 
    private List<Map<String, Object>> extracted(List<Map<String, Object>> arrayList, List<TjSampling> list, Integer pageNum, Integer pageSize) {
        if (null != list && list.size() > 0) {
            Map<String, List<TjSampling>> stringListMap = list.stream().collect(Collectors.groupingBy(TjSampling::getCusId));
            for (Map.Entry<String, List<TjSampling>> entry : stringListMap.entrySet()) {
                Map<String, Object> map = new HashMap<>();
                TjCustomer customer = customerService.getById(entry.getKey());
                if (customer == null) {
                    continue;
                }
                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());
                customer.setApplicationTime(entry.getValue().get(0).getApplicationTime());
                List<TjSampling> samplings = entry.getValue();
                if (null != samplings && samplings.size() > 0) {
                    List<TjSampling> projectList = new ArrayList<>();
                    for (TjSampling sampling : samplings) {
                        sampling.setCusName(MatchUtils.hideCusName(sampling.getCusName()));
                        TjProject project = projectService.getById(sampling.getProId());
                        if (null != project && project.getProParentId() == 0) {
                            projectList.add(sampling);
                        }
                    }
                    map.put("list", projectList);
                }
                map.put("customer", customer);
                arrayList.add(map);
            }
        }
        List<Map<String, Object>> collect = null;
        if (null != arrayList && arrayList.size() > 0) {
            collect = arrayList.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
        }
        return collect;
    }
 
    /**
     * 获取采样客户列表
     *
     * @param isSignFor
     * @param tjNum
     * @param name
     * @param pageNum
     * @param pageSize
     * @param beginTime
     * @param endTime
     * @return
     */
    @GetMapping("/getCusList")
    @ApiOperation(value = "获取采样客户列表")
    public AjaxResult getCusList(@RequestParam(defaultValue = "1") @ApiParam(value = "0是1否") Integer isSignFor,
                                 @RequestParam(required = false) @ApiParam(value = "体检号") String tjNumber,
                                 @RequestParam(required = false) @ApiParam(value = "客户姓名") String name,
                                 @RequestParam(required = false) @ApiParam(value = "单位") String dw,
                                 @ApiParam(value = "页码数(默认1)") @RequestParam(defaultValue = "1") Integer pageNum,
                                 @ApiParam(value = "显示条数(默认10)") @RequestParam(defaultValue = "10") Integer pageSize,
                                 @ApiParam(value = "开始时间") @RequestParam(required = false) String beginTime,
                                 @ApiParam(value = "结束时间") @RequestParam(required = false) String endTime) {
        Page<TjSampling> samplingPage = new Page<>(pageNum, pageSize);
        LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TjSampling::getIsSignFor, isSignFor);
        if (null != tjNumber && StrUtil.isNotBlank(tjNumber))
            wrapper.like(TjSampling::getTjNum, tjNumber);
        if (null != name && StrUtil.isNotBlank(name))
            wrapper.like(TjSampling::getCusName, name);
        if (null != beginTime && null != endTime && StrUtil.isNotBlank(beginTime) && StrUtil.isNotBlank(endTime))
            wrapper.between(TjSampling::getApplicationTime, beginTime, endTime);
        if (StrUtil.isNotBlank(dw)){
            LambdaQueryWrapper<TjOrder> wqq=new LambdaQueryWrapper<>();
            wqq.like(TjOrder::getFirmId,dw);
            wqq.select(TjOrder::getTjNumber);
            List<TjOrder> orderList = orderService.list(wqq);
            if(null !=orderList && !orderList.isEmpty()){
                List<String> list = orderList.stream().map(TjOrder::getTjNumber).collect(Collectors.toList());
                wrapper.in(TjSampling::getTjNum, list);
            }
        }
 
        wrapper.groupBy(TjSampling::getTjNum);
        wrapper.orderByDesc(TjSampling::getCreateTime);
//        wrapper.last("LIMIT " + (pageNum - 1) * pageSize + "," + pageSize);
        Page<TjSampling> page = tjSamplingService.page(samplingPage, wrapper);
        List<TjSampling> list = page.getRecords();
        ArrayList<TjCustomer> tjCustomers = new ArrayList<>();
        for (TjSampling tjSampling : list) {
            TjCustomer customer = customerService.getById(tjSampling.getCusId());
            if(null !=customer){
                TjOrder order = orderService.getOrderByTjNum(tjSampling.getTjNum());
                if(null !=order){
                    customer.setCompName(order.getFirmName());
                    customer.setCusName(customer.getCusName());
                    customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                    customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                    customer.setTjNumber(tjSampling.getTjNum());
                    customer.setApplicationTime(tjSampling.getApplicationTime());
                    tjCustomers.add(customer);
                }
            }
        }
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("list", tjCustomers);
        hashMap.put("total", page.getTotal());
        return AjaxResult.success(hashMap);
    }
 
    /**
     * 根据客户获取采样列表
     *
     * @param tjNumber
     * @return
     */
    @GetMapping("/getCusCyList")
    @ApiOperation(value = "根据客户获取采样列表")
    public AjaxResult getCusCyList(@RequestParam @ApiParam(value = "客户id") String tjNumber,
                                   @RequestParam(defaultValue = "1") @ApiParam(value = "0是1否") Integer isSignFor) {
        if (tjNumber == null || StrUtil.isBlank(tjNumber))
            return AjaxResult.error("参数错误,未传参数");
        LambdaQueryWrapper<TjSampling> wrapper = new LambdaQueryWrapper<>();
        String config = configService.selectConfigByKey("sfkqdyhis");
        if (config.equals("Y")){
//            LambdaQueryWrapper<TjSampling> wrapper6 = new LambdaQueryWrapper<>();
//            wrapper6.eq(TjSampling::getTjNum, tjNumber);
//            wrapper6.eq(TjSampling::getIsSignFor,isSignFor);
//            wrapper6.and(i -> i.isNull(TjSampling::getParentId).or().eq(TjSampling::getIsMerge,1));
//            wrapper6.isNull(TjSampling::getJyxh);
//            List<TjSampling> list1 = tjSamplingService.list(wrapper6);
//            if (!list1.isEmpty()){
            if (true){
                LambdaQueryWrapper<TjOrder> wrapper1 = new LambdaQueryWrapper<>();
                wrapper1.eq(TjOrder::getTjNumber,tjNumber);
                TjOrder tjOrder = orderService.getOne(wrapper1);
                hisApiMethod.Getlabreginfoinfo(tjOrder.getCardId(),new SimpleDateFormat("yyyy-MM-dd").format(tjOrder.getCreateTime()));
            LambdaQueryWrapper<TbLisSq> wrapper2 = new LambdaQueryWrapper<>();
            wrapper2.eq(TbLisSq::getCardId,tjOrder.getCardId());
            List<TbLisSq> list = tbLisSqService.list(wrapper2);
            for (TbLisSq lisSq : list) {
                if (!lisSq.getSqdbh().contains("jk"))
                    continue;
                String jyxmdm = lisSq.getJyxmdm();
                LambdaQueryWrapper<TjProject> wrapper4 = new LambdaQueryWrapper<>();
                wrapper4.eq(TjProject::getLisXmbm,jyxmdm);
                TjProject project = projectService.getOne(wrapper4);
                if (project != null){
                    LambdaUpdateWrapper<TjSampling> wrapper5 = new LambdaUpdateWrapper<>();
                    String jyxh = "";
                    if (StrUtil.isNotBlank(lisSq.getJyxhHb()))
                        jyxh = lisSq.getJyxhHb();
                    else jyxh = lisSq.getJyxh();
                    wrapper5.set(TjSampling::getJyxh,jyxh);
                    wrapper5.set(TjSampling::getJyxmdm,lisSq.getJyxmdm());
                    wrapper5.eq(TjSampling::getProId,project.getProParentId());
                    wrapper5.eq(TjSampling::getTjNum,tjNumber);
                    tjSamplingService.update(wrapper5);
                }
            }
 
//                JSONArray array = hisApiMethod.Getlabreginfoinfo(tjOrder.getCardId());
//                if (array != null && !array.isEmpty()){
//                    for (Object o : array) {
//                        JSONObject jsonObject = (JSONObject) o;
//                        String sqdh = jsonObject.getStr("sqdh");
//                        String jyxh = jsonObject.getStr("jyxh");
//                        LambdaQueryWrapper<LtkjJianchajianyanTree> wrapper2 = new LambdaQueryWrapper<>();
//                        wrapper2.eq(LtkjJianchajianyanTree::getCardId,tjOrder.getCardId());
//                        wrapper2.eq(LtkjJianchajianyanTree::getType,"检验");
//                        wrapper2.eq(LtkjJianchajianyanTree::getSqdh,sqdh);
//                        List<LtkjJianchajianyanTree> list = treeService.list(wrapper2);
//                        List<String> hisXms = list.stream().map(LtkjJianchajianyanTree::getHisXmdm).collect(Collectors.toList());
//                        LambdaQueryWrapper<TjProject> wrapper3 = new LambdaQueryWrapper<>();
//                        wrapper3.in(TjProject::getHisXmbm,hisXms);
//                        wrapper3.ne(TjProject::getProParentId,0);
//                        wrapper3.groupBy(TjProject::getProParentId);
//                        List<Long> proParentIds = projectService.list(wrapper3).stream().map(TjProject::getProParentId).collect(Collectors.toList());
//                        LambdaQueryWrapper<TjProject> wrapper4 = new LambdaQueryWrapper<>();
//                        wrapper4.in(TjProject::getProId,proParentIds);
//                        List<Long> proIds = projectService.list(wrapper4).stream().map(TjProject::getProId).collect(Collectors.toList());
//                        LambdaUpdateWrapper<TjSampling> wrapper5 = new LambdaUpdateWrapper<>();
//                        wrapper5.set(TjSampling::getJyxh,jyxh);
//                        wrapper5.in(TjSampling::getProId,proIds);
//                        wrapper5.eq(TjSampling::getTjNum,tjNumber);
//                        tjSamplingService.update(wrapper5);
//                    }
//                }
            }
        }
 
//        if (config.equals("Y"))
//            wrapper.eq(TjSampling::getJyxh,"");
        wrapper.eq(TjSampling::getTjNum, tjNumber);
        wrapper.eq(TjSampling::getIsSignFor,isSignFor);
        wrapper.and(i -> i.isNull(TjSampling::getParentId).or().eq(TjSampling::getIsMerge,1));
//        wrapper.eq(TjSampling::getIsPay,1);
//        if (isSignFor == 1)
//            wrapper.eq(TjSampling::getIsApply,0);
        wrapper.orderByDesc(TjSampling::getIsMerge);
 
        List<TjSampling> list = tjSamplingService.list(wrapper);
        if (list.isEmpty()){
            logger.info("jtNum ->{}",tjNumber);
//            return AjaxResult.error("未查询到数据,人员未缴费或没有未采样项目");
            return AjaxResult.error("参数错误,未查询到数据");
        }
//        for (TjSampling sampling : list) {
//            TjCustomer customer = customerService.getById(sampling.getCusId());
//            TjOrder order = orderService.getOrderByTjNum(sampling.getTjNum());
//            if(null !=order)sampling.setCardId(order.getCardId());
//            sampling.setCustomer(customer);
//        }
 
        if (list.size() >= 2) {
            // 进行合并
            List<String> stringList = list.stream().map(TjSampling::getId).collect(Collectors.toList());
//            log.info("提取id ->{}",stringList);
            for (String s : stringList) {
                if (tjSamplingService.isMergeItem(s) != 0) {
                    list.removeIf(item -> Objects.equals(item.getId(), s));
                }
            }
            String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix");
            Map<String, List<TjSampling>> map = list.stream().filter(i->StrUtil.isNotBlank(i.getSpecimenTypeCode())).collect(Collectors.groupingBy(item -> item.getSpecimenTypeCode()));
            for (Map.Entry<String, List<TjSampling>> entry : map.entrySet()) {
                List<TjSampling> entryValue = entry.getValue();
                tjSamplingService.mergeCaiYangTran(entryValue.stream().map(TjSampling::getId).collect(Collectors.toList()),lis_tmh_prefix);
            }
        }
        wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(TjSampling::getTjNum, tjNumber);
        wrapper.eq(TjSampling::getIsSignFor,isSignFor);
        wrapper.and(i -> i.isNull(TjSampling::getParentId).or().eq(TjSampling::getIsMerge,1));
//        wrapper.orderByDesc(TjSampling::getIsMerge);
        wrapper.orderByAsc(TjSampling::getSpecimenTypeCode,TjSampling::getIsMerge);
        list = tjSamplingService.list(wrapper);
        for (TjSampling sampling : list) {
            TjCustomer customer = customerService.getById(sampling.getCusId());
            TjOrder order = orderService.getOrderByTjNum(sampling.getTjNum());
            if(null !=order)sampling.setCardId(order.getCardId());
            sampling.setCustomer(customer);
        }
        return AjaxResult.success(list);
    }
 
    @PostMapping("/mergeCaiYang")
    @ApiOperation(value = "采样登记合并项目接口")
    public AjaxResult mergeCaiYang(@RequestBody List<String> ids) {
        String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix");
        return tjSamplingService.mergeCaiYangTran(ids,lis_tmh_prefix);
    }
 
 
    @PostMapping("/chexiaoCaiYang")
    @ApiOperation(value = "撤销采样登记合并项目接口")
    @Transactional
    public AjaxResult chexiaoCaiYang(@RequestBody List<String> ids) {
        if (null != ids && !ids.isEmpty()) {
            int pdsfczhbxm = tjSamplingService.pdsfczhbxm(ids);
            if (pdsfczhbxm != ids.size()) return AjaxResult.error("存在未合并的项目不可撤销!!!");
            tjSamplingService.deletedTjSamplingListByHb(ids);
            tjSamplingService.updateHeBingXm(ids);
            return AjaxResult.success("撤销成功!!!");
        }
        return AjaxResult.error("请选择你要撤销的项目!!!");
    }
 
 
    /**
     * 导出体检采样管理列表
     */
    //@PreAuthorize("@ss.hasPermi('sampling:sampling:export')")
    @Log(title = "体检采样管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value = "导出体检采样管理列表")
    public void export(HttpServletResponse response, TjSampling tjSampling) {
        List<TjSampling> list = tjSamplingService.selectTjSamplingList(tjSampling);
        ExcelUtil<TjSampling> util = new ExcelUtil<TjSampling>(TjSampling.class);
        util.exportExcel(response, list, "体检采样管理数据");
    }
 
    /**
     * 获取体检采样管理详细信息
     */
    //@PreAuthorize("@ss.hasPermi('sampling:sampling:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取体检采样管理详细信息")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(tjSamplingService.selectTjSamplingById(id));
    }
 
    /**
     * 新增体检采样管理
     */
    //@PreAuthorize("@ss.hasPermi('sampling:sampling:add')")
    @Log(title = "体检采样管理", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation(value = "新增体检采样管理")
    public AjaxResult add(@RequestBody TjSampling tjSampling) {
        return toAjax(tjSamplingService.insertTjSampling(tjSampling));
    }
 
    /**
     * 修改体检采样管理
     */
    //@PreAuthorize("@ss.hasPermi('sampling:sampling:edit')")
    @Log(title = "体检采样管理", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation(value = "修改体检采样管理")
    public AjaxResult edit(@RequestBody TjSampling tjSampling) {
        return toAjax(tjSamplingService.updateById(tjSampling));
    }
 
    /**
     * 删除体检采样管理
     */
    //@PreAuthorize("@ss.hasPermi('sampling:sampling:remove')")
    @Log(title = "体检采样管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation(value = "删除体检采样管理")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(tjSamplingService.deleteTjSamplingByIds(ids));
    }
 
 
    /**
     * 确认采样接口
     */
    @PostMapping("/confirmSampling")
    @ApiOperation(value = "确认采样接口")
    @Transactional
    public AjaxResult confirmSampling(@RequestBody List<String> ids) {
        String config = configService.selectConfigByKey("sfkqdyhis");
        String mergeRequest = configService.selectConfigByKey("use_lis_pacs_is_auto_merge_request");
        return samplingService.confirmApi(ids,config,mergeRequest);
    }
}