From e8740ff335d406b21ba7724714e1d7e951170daa Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期五, 28 三月 2025 15:57:28 +0800
Subject: [PATCH] zjh20250328

---
 ltkj-hosp/src/main/java/com/ltkj/hosp/idutil/IdUtils.java                           |  240 ++++++++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjOrderServiceImpl.java          |    5 
 ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java |  337 +++++++-------
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java      |  218 +++++----
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java                     |    6 
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjOrderService.java                  |    2 
 ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java          |    3 
 /dev/null                                                                           |  111 ----
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysConfigController.java    |   40 +
 ltkj-admin/src/main/java/com/ltkj/web/controller/lis/LisApiMethod.java              |  247 ----------
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/OrderNumberMapper.java                 |   17 
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSamplingServiceImpl.java       |   95 ++--
 ltkj-admin/src/main/java/com/ltkj/web/controller/lis/LisController.java             |    4 
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSamplingController.java   |   11 
 14 files changed, 641 insertions(+), 695 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/lis/LisApiMethod.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/lis/LisApiMethod.java
index 32e0250..8391e61 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/lis/LisApiMethod.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/lis/LisApiMethod.java
@@ -2,8 +2,6 @@
 
 
 import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.RandomUtil;
-import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.pinyin.PinyinUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
@@ -11,7 +9,7 @@
 import com.ltkj.common.core.domain.AjaxResult;
 import com.ltkj.common.utils.AgeResult;
 import com.ltkj.common.utils.DateUtils;
-import com.ltkj.common.utils.IdUtils;
+import com.ltkj.hosp.idutil.IdUtils;
 import com.ltkj.hosp.domain.*;
 import com.ltkj.hosp.hisDto.OutpintestapplyDetailsDto;
 import com.ltkj.hosp.lisDto.LisSaveSqdxxDto;
@@ -68,132 +66,6 @@
     @Autowired
     private ITjSamplingService tjSamplingService;
 
-    /**
-     * 淇濆瓨妫�楠屽崟鐢宠淇℃伅
-     * @param tjOrder
-     * @param tjCustomer
-     * @param detailList
-     * @return
-     * @deprecated 淇敼 涓嶄娇鐢↙ist<TbTransition>浼犲弬鏁�
-     */
-    @Deprecated
-    public Boolean save(TjOrder tjOrder, TjCustomer tjCustomer, List<TbTransition> detailList){
-        if (detailList != null && !detailList.isEmpty()) {
-            String dept = configService.selectConfigByKey("request_default_dept");
-            String ysbm = configService.selectConfigByKey("request_default_ysbm");
-            String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix");
-            LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>();
-            wq.in(TjProject::getProId, detailList.stream().map(TbTransition::getParentProId).collect(Collectors.toList()));
-            wq.in(TjProject::getDeptId,deptService.getJyDeptIds());
-            List<TjProject> projects = projectService.list(wq);
-            if (projects != null && !projects.isEmpty()){
-                // 鏍规嵁project琛ㄧ殑his_xmbm鏌ョ粍鍚堝叧鑱旇〃 ltkj_jfzhgljyxmzd 鏍规嵁瀛楁`zhxmdm`
-                // - 鏌ュ埌 浣跨敤瀛楁`jyxmdm`鏌ユ楠岄」鐩瓧鍏歌〃 ltkj_jyxmzd 鏍规嵁瀛楁`jyxmdm`
-                // - 鏈煡鍒� 鏌ラ」鐩叧鑱旇〃ltkj_jfxmgljyxmzd 鏍规嵁瀛楁`xmdm`
-                AtomicInteger xh = new AtomicInteger();
-                for (TjProject project : projects) {
-                    if (0 == project.getProParentId() && project.getProPrice().compareTo(BigDecimal.ZERO) != 0) {
-                        if (null != project.getHisXmbm()) {
-                            LtkjJyxmzd jyxmzd = getJyxmzd(project);
-                            if (jyxmzd != null) {
-                                LisSaveSqdxxDto lisSaveSqdxxDto = new LisSaveSqdxxDto();
-                                String jyxh = idUtils.generateLisID(lis_tmh_prefix);
-                                lisSaveSqdxxDto.setJyxh(jyxh);
-                                lisSaveSqdxxDto.setBah(tjOrder.getCardId());
-                                lisSaveSqdxxDto.setBrxm(tjCustomer.getCusName());
-                                lisSaveSqdxxDto.setBrdm(PinyinUtil.getFirstLetter(tjCustomer.getCusName(),""));
-                                lisSaveSqdxxDto.setXb(tjCustomer.getCusSex()==1?"2":"1");
-                                lisSaveSqdxxDto.setCsrq(DateFormatUtils.format(tjCustomer.getCusBrithday(), "yyyy-MM-dd"));
-                                AgeResult ageResult = DateUtils.calculateAge(tjCustomer.getCusBrithday());
-                                lisSaveSqdxxDto.setNl(String.valueOf(ageResult.getAge()));
-                                lisSaveSqdxxDto.setNldw(String.valueOf(ageResult.getUnit()));
-                                lisSaveSqdxxDto.setSfzh(tjCustomer.getCusIdcard());
-                                lisSaveSqdxxDto.setLxdh(tjCustomer.getCusPhone());
-                                lisSaveSqdxxDto.setJtzz("");
-                                Date date = new Date();
-                                lisSaveSqdxxDto.setSqrq(DateFormatUtils.format(date, "yyyy-MM-dd HH:mm:ss"));
-                                lisSaveSqdxxDto.setCyrq("");
-                                lisSaveSqdxxDto.setLczd("");
-                                lisSaveSqdxxDto.setBz("");
-                                lisSaveSqdxxDto.setKsbm(dept);
-                                lisSaveSqdxxDto.setSqys(ysbm);
-                                lisSaveSqdxxDto.setKfbz("1");
-                                List<OutpintestapplyDetailsDto> detailsDtos = new ArrayList<>();
-                                ArrayList<LisSaveSqdxxJyxmlistDto> dtos = new ArrayList<>();
-                                BigDecimal allPrice = new BigDecimal("0");
-                                for (TbTransition transition : detailList.stream().filter(item -> Objects.equals(item.getParentProId(), project.getProId()))
-                                        .collect(Collectors.toList())) {
-                                    allPrice = allPrice.add(transition.getNowPrice());
-                                }
-                                lisSaveSqdxxDto.setFyje(allPrice.toString());
-                                lisSaveSqdxxDto.setYbbm(jyxmzd.getJybbdm());
-                                LisSaveSqdxxJyxmlistDto dto = new LisSaveSqdxxJyxmlistDto();
-                                dto.setXh(String.valueOf(xh.getAndIncrement() + 1));
-                                dto.setJyxm(jyxmzd.getJyxmdm());
-                                dto.setXmmc(jyxmzd.getJyxmmc());
-                                dtos.add(dto);
-
-                                OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
-                                detailsDto.setMxfyxmbm(project.getHisXmbm());
-                                if (project.getSfzhfy().equals("Y")) {
-                                    detailsDto.setSfzhfy("1");
-                                } else {
-                                    detailsDto.setSfzhfy("0");
-                                }
-                                detailsDto.setSl(project.getSl());
-                                detailsDto.setProjg(project.getProPrice());
-                                detailsDtos.add(detailsDto);
-
-                                lisSaveSqdxxDto.setJyxmlist(dtos);
-                                log.info("妫�楠岀敵璇峰弬鏁� ->{}",JSONUtil.toJsonStr(lisSaveSqdxxDto));
-                                AjaxResult ajaxResult = lisApiMethodService.saveSqdxx(lisSaveSqdxxDto);
-                                // Lis璇锋眰杩斿洖 ->{"msg":"鎿嶄綔澶辫触","code":500,"result":{"Response":{"ResultContent":"鎴愬姛","ResultData":null,"ResultCode":"1"}}}
-                                // {"msg":"鎿嶄綔鎴愬姛","code":200,"data":{"ResultContent":"鎴愬姛","ResultData":null,"ResultCode":"1"}}
-                                log.info("Lis璇锋眰杩斿洖 ->{}",JSONUtil.toJsonStr(ajaxResult));
-                                String result = ajaxResult.get("data").toString();
-                                JSONObject object = JSONUtil.parseObj(result);
-                                String code = object.getStr("ResultCode");
-                                if(code.equals("1")){
-                                    for (OutpintestapplyDetailsDto detail : detailsDtos) {
-                                        LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree();
-                                        tree.setCardId(tjOrder.getCardId());
-                                        tree.setPationid(tjCustomer.getPationId());
-                                        tree.setSqdh(jyxh);
-                                        tree.setFyhj(allPrice.toString());
-                                        String mxfyxmbm = detail.getMxfyxmbm();
-                                        tree.setHisXmdm(mxfyxmbm);
-                                        tree.setType("妫�楠�");
-                                        tree.setService("lis");
-                                        tree.setTjPrice(String.valueOf(detail.getProjg()));
-                                        LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>();
-                                        if (detail.getSfzhfy().equals("1"))
-                                            wrapper1.eq(LtkjJfzhglmxjfxmzd::getZhxmdm, mxfyxmbm);
-                                        else wrapper1.eq(LtkjJfzhglmxjfxmzd::getXmdm, mxfyxmbm);
-                                        List<LtkjJfzhglmxjfxmzd> ltkjJfzhglmxjfxmzds = ltkjJfzhglmxjfxmzdService.list(wrapper1);
-                                        if (ltkjJfzhglmxjfxmzds != null && !ltkjJfzhglmxjfxmzds.isEmpty()) {
-                                            String xmdm = ltkjJfzhglmxjfxmzds.get(0).getXmdm();
-                                            LambdaQueryWrapper<LtkjMxjfxmzd> wrapper3 = new LambdaQueryWrapper<>();
-                                            wrapper3.eq(LtkjMxjfxmzd::getXmdm, xmdm);
-                                            LtkjMxjfxmzd mxjfxmzd = ltkjMxjfxmzdService.getOne(wrapper3);
-                                            LambdaQueryWrapper<LtkjEjjfxmzd> wrapper4 = new LambdaQueryWrapper<>();
-                                            wrapper4.eq(LtkjEjjfxmzd::getEjkmdm, mxjfxmzd.getEjkmdm());
-                                            LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper4);
-                                            tree.setXmfl(ejjfxmzd.getYjkmdm());
-                                        }
-                                        tree.setCreateTime(DateUtil.date());
-                                        ltkjJianchajianyanTreeService.save(tree);
-                                    }
-                                }else {
-                                    log.error("璇锋眰澶辫触 ->{}",lisSaveSqdxxDto);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return true;
-    }
 
     public Boolean save(TjSampling sampling,TjOrder tjOrder,TjCustomer tjCustomer){
         String dept = configService.selectConfigByKey("request_default_dept");
@@ -322,123 +194,6 @@
             log.error("璇锋眰澶辫触 ->{}", lisSaveSqdxxDto);
             return false;
         }
-    }
-
-    public Boolean save(TjOrder tjOrder, TjCustomer tjCustomer, List<TjProject> projects,List<TbTransition> detailList) {
-//            LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>();
-//            wq.in(TjProject::getProId, detailList.stream().map(TbTransition::getParentProId).collect(Collectors.toList()));
-//            wq.in(TjProject::getDeptId,deptService.getJyDeptIds());
-//            List<TjProject> projects = projectService.list(wq);
-
-        if (projects != null && !projects.isEmpty()) {
-            String dept = configService.selectConfigByKey("request_default_dept");
-            String ysbm = configService.selectConfigByKey("request_default_ysbm");
-            String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix");
-            // 鏍规嵁project琛ㄧ殑his_xmbm鏌ョ粍鍚堝叧鑱旇〃 ltkj_jfzhgljyxmzd 鏍规嵁瀛楁`zhxmdm`
-            // - 鏌ュ埌 浣跨敤瀛楁`jyxmdm`鏌ユ楠岄」鐩瓧鍏歌〃 ltkj_jyxmzd 鏍规嵁瀛楁`jyxmdm`
-            // - 鏈煡鍒� 鏌ラ」鐩叧鑱旇〃ltkj_jfxmgljyxmzd 鏍规嵁瀛楁`xmdm`
-            AtomicInteger xh = new AtomicInteger();
-            for (TjProject project : projects) {
-                if (0 == project.getProParentId() && project.getProPrice().compareTo(BigDecimal.ZERO) != 0) {
-                    if (null != project.getHisXmbm()) {
-                        LtkjJyxmzd jyxmzd = getJyxmzd(project);
-                        if (jyxmzd != null) {
-                            LisSaveSqdxxDto lisSaveSqdxxDto = new LisSaveSqdxxDto();
-                            String jyxh = idUtils.generateLisID(lis_tmh_prefix);
-                            lisSaveSqdxxDto.setJyxh(jyxh);
-                            lisSaveSqdxxDto.setBah(tjOrder.getCardId());
-                            lisSaveSqdxxDto.setBrxm(tjCustomer.getCusName());
-                            lisSaveSqdxxDto.setBrdm(PinyinUtil.getFirstLetter(tjCustomer.getCusName(), ""));
-                            lisSaveSqdxxDto.setXb(tjCustomer.getCusSex() == 1 ? "2" : "1");
-                            lisSaveSqdxxDto.setCsrq(DateFormatUtils.format(tjCustomer.getCusBrithday(), "yyyy-MM-dd"));
-                            AgeResult ageResult = DateUtils.calculateAge(tjCustomer.getCusBrithday());
-                            lisSaveSqdxxDto.setNl(String.valueOf(ageResult.getAge()));
-                            lisSaveSqdxxDto.setNldw(String.valueOf(ageResult.getUnit()));
-                            lisSaveSqdxxDto.setSfzh(tjCustomer.getCusIdcard());
-                            lisSaveSqdxxDto.setLxdh(tjCustomer.getCusPhone());
-                            lisSaveSqdxxDto.setJtzz("");
-                            Date date = new Date();
-                            lisSaveSqdxxDto.setSqrq(DateFormatUtils.format(date, "yyyy-MM-dd HH:mm:ss"));
-                            lisSaveSqdxxDto.setCyrq("");
-                            lisSaveSqdxxDto.setLczd("");
-                            lisSaveSqdxxDto.setBz("");
-                            lisSaveSqdxxDto.setKsbm(dept);
-                            lisSaveSqdxxDto.setSqys(ysbm);
-                            lisSaveSqdxxDto.setKfbz("1");
-                            List<OutpintestapplyDetailsDto> detailsDtos = new ArrayList<>();
-                            ArrayList<LisSaveSqdxxJyxmlistDto> dtos = new ArrayList<>();
-                            BigDecimal allPrice = new BigDecimal("0");
-                            for (TbTransition transition : detailList.stream().filter(item -> Objects.equals(item.getParentProId(), project.getProId()))
-                                    .collect(Collectors.toList())) {
-                                allPrice = allPrice.add(transition.getNowPrice());
-                            }
-                            lisSaveSqdxxDto.setFyje(allPrice.toString());
-                            lisSaveSqdxxDto.setYbbm(jyxmzd.getJybbdm());
-                            LisSaveSqdxxJyxmlistDto dto = new LisSaveSqdxxJyxmlistDto();
-                            dto.setXh(String.valueOf(xh.getAndIncrement() + 1));
-                            dto.setJyxm(jyxmzd.getJyxmdm());
-                            dto.setXmmc(jyxmzd.getJyxmmc());
-                            dtos.add(dto);
-
-                            OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
-                            detailsDto.setMxfyxmbm(project.getHisXmbm());
-                            if (project.getSfzhfy().equals("Y")) {
-                                detailsDto.setSfzhfy("1");
-                            } else {
-                                detailsDto.setSfzhfy("0");
-                            }
-                            detailsDto.setSl(project.getSl());
-                            detailsDto.setProjg(project.getProPrice());
-                            detailsDtos.add(detailsDto);
-
-                            lisSaveSqdxxDto.setJyxmlist(dtos);
-                            log.info("妫�楠岀敵璇峰弬鏁� ->{}", JSONUtil.toJsonStr(lisSaveSqdxxDto));
-                            AjaxResult ajaxResult = lisApiMethodService.saveSqdxx(lisSaveSqdxxDto);
-                            // Lis璇锋眰杩斿洖 ->{"msg":"鎿嶄綔澶辫触","code":500,"result":{"Response":{"ResultContent":"鎴愬姛","ResultData":null,"ResultCode":"1"}}}
-                            // {"msg":"鎿嶄綔鎴愬姛","code":200,"data":{"ResultContent":"鎴愬姛","ResultData":null,"ResultCode":"1"}}
-                            log.info("Lis璇锋眰杩斿洖 ->{}", JSONUtil.toJsonStr(ajaxResult));
-                            String result = ajaxResult.get("data").toString();
-                            JSONObject object = JSONUtil.parseObj(result);
-                            String code = object.getStr("ResultCode");
-                            if (code.equals("1")) {
-                                for (OutpintestapplyDetailsDto detail : detailsDtos) {
-                                    LtkjJianchajianyanTree tree = new LtkjJianchajianyanTree();
-                                    tree.setCardId(tjOrder.getCardId());
-                                    tree.setPationid(tjCustomer.getPationId());
-                                    tree.setSqdh(jyxh);
-                                    tree.setFyhj(allPrice.toString());
-                                    String mxfyxmbm = detail.getMxfyxmbm();
-                                    tree.setHisXmdm(mxfyxmbm);
-                                    tree.setType("妫�楠�");
-                                    tree.setService("lis");
-                                    tree.setTjPrice(String.valueOf(detail.getProjg()));
-                                    LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>();
-                                    if (detail.getSfzhfy().equals("1"))
-                                        wrapper1.eq(LtkjJfzhglmxjfxmzd::getZhxmdm, mxfyxmbm);
-                                    else wrapper1.eq(LtkjJfzhglmxjfxmzd::getXmdm, mxfyxmbm);
-                                    List<LtkjJfzhglmxjfxmzd> ltkjJfzhglmxjfxmzds = ltkjJfzhglmxjfxmzdService.list(wrapper1);
-                                    if (ltkjJfzhglmxjfxmzds != null && !ltkjJfzhglmxjfxmzds.isEmpty()) {
-                                        String xmdm = ltkjJfzhglmxjfxmzds.get(0).getXmdm();
-                                        LambdaQueryWrapper<LtkjMxjfxmzd> wrapper3 = new LambdaQueryWrapper<>();
-                                        wrapper3.eq(LtkjMxjfxmzd::getXmdm, xmdm);
-                                        LtkjMxjfxmzd mxjfxmzd = ltkjMxjfxmzdService.getOne(wrapper3);
-                                        LambdaQueryWrapper<LtkjEjjfxmzd> wrapper4 = new LambdaQueryWrapper<>();
-                                        wrapper4.eq(LtkjEjjfxmzd::getEjkmdm, mxjfxmzd.getEjkmdm());
-                                        LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper4);
-                                        tree.setXmfl(ejjfxmzd.getYjkmdm());
-                                    }
-                                    tree.setCreateTime(DateUtil.date());
-                                    ltkjJianchajianyanTreeService.save(tree);
-                                }
-                            } else {
-                                log.error("璇锋眰澶辫触 ->{}", lisSaveSqdxxDto);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return true;
     }
 
     /**
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/lis/LisController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/lis/LisController.java
index 1acc77a..59a50ad 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/lis/LisController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/lis/LisController.java
@@ -49,11 +49,11 @@
         LambdaQueryWrapper<TjCustomer> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TjCustomer::getCusIdcard,cusId);
         TjCustomer customer = customerService.getOne(wrapper);
-        lisApiMethod.save(tjOrder,customer,detailList);
+//        lisApiMethod.save(tjOrder,customer,detailList);
         // 妫�楠屼綔搴�
         lisApiMethod.cancel("",tjOrder.getCardId(),customer.getCusName());
         // 妫�鏌ヤ繚瀛�
-        pacsApiMethodService.save(tjOrder,customer,detailList);
+//        pacsApiMethodService.save(tjOrder,customer,detailList);
         // 妫�鏌ヤ綔搴�
         pacsApiMethodService.updatePacsApply("","",customer.getCusName());
         return AjaxResult.success();
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java
index dcdd26e..d2f35d8 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/service/TjSysAsyncServiceImpl.java
@@ -1,6 +1,5 @@
 package com.ltkj.web.controller.service;
 
-import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.IdUtil;
@@ -14,7 +13,7 @@
 import com.ltkj.common.core.domain.entity.SysDept;
 import com.ltkj.common.core.domain.entity.SysUser;
 import com.ltkj.common.core.redis.RedisCache;
-import com.ltkj.common.utils.IdUtils;
+import com.ltkj.hosp.idutil.IdUtils;
 import com.ltkj.common.utils.StringUtils;
 import com.ltkj.framework.config.MatchUtils;
 import com.ltkj.hosp.domain.*;
@@ -452,103 +451,107 @@
     }
 
     public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser,String jxbz) {
-        String lis_tmh_prefix = sysConfigService.selectConfigByKey("make_lis_tmh_prefix");
-        String config = configService.selectConfigByKey("sfkqdyhis");
-        Boolean lisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order);
-        if (null != detailList && detailList1) {
-            String format = DateUtil.format(new Date(), "yyMMddHHmmssSSS");
-            for (TjOrderDetail detail : detailList) {
-                int i = samplingService.isExistProId(order.getTjNumber(), String.valueOf(detail.getProId()));
-                if(i>0) continue;
-                TjSampling sampling = new TjSampling();
-                if (null == projectService.getById(detail.getProId())) continue;
-                TjProject project = projectService.getById(detail.getProId());
-                Long proParentId = project.getProParentId();
-                String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType());
-                if (null != proParentId && proParentId == 0) {
-                    sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
-//                    LtkjJyxmzd jyxmzd = lisApiMethod.getJyxmzd(project);
-//                    if (jyxmzd != null) {
-                    if (config.equals("Y") && lisAndPacsRegister)
-                        sampling.setJyxmdm(project.getLisXmbm());
-                    else sampling.setJyxmdm(String.valueOf(project.getProId()));
-                    sampling.setSpecimenTypeCode(project.getSpecimenType());
-                    sampling.setSpecimenType(dictLabel);
-//                        LambdaQueryWrapper<LtkjJybbzd> wrapper = new LambdaQueryWrapper<>();
-//                        wrapper.eq(LtkjJybbzd::getJybbdm,jyxmzd.getJybbdm());
-//                        LtkjJybbzd jybbzd = jybbzdService.getOne(wrapper);
-//                        sampling.setSpecimenType(jybbzd.getJybbmc());
-//                        sampling.setJyxmdm(jyxmzd.getJyxmdm());
-//                    }
-                } else {
-                    TjProject project1 = projectService.getById(proParentId);
-                    sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
-                    sampling.setSpecimenTypeCode(project1.getSpecimenType());
-                    sampling.setSpecimenType(dictLabel);
-                    if (config.equals("Y") && lisAndPacsRegister)
-                        sampling.setJyxmdm(project1.getLisXmbm());
-                    else sampling.setJyxmdm(String.valueOf(project1.getProId()));
-//                    LtkjJyxmzd jyxmzd = lisApiMethod.getJyxmzd(project1);
-//                    if (jyxmzd != null) {
-//                        sampling.setSpecimenTypeCode(jyxmzd.getJybbdm());
-//                        LambdaQueryWrapper<LtkjJybbzd> wrapper = new LambdaQueryWrapper<>();
-//                        wrapper.eq(LtkjJybbzd::getJybbdm,jyxmzd.getJybbdm());
-//                        LtkjJybbzd jybbzd = jybbzdService.getOne(wrapper);
-//                        sampling.setSpecimenType(jybbzd.getJybbmc());
-//                        sampling.setJyxmdm(jyxmzd.getJyxmdm());
-//                    }
+        try {
+            String lis_tmh_prefix = sysConfigService.selectConfigByKey("make_lis_tmh_prefix");
+            String config = configService.selectConfigByKey("sfkqdyhis");
+            Boolean lisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order);
+            if (null != detailList && detailList1) {
+                String format = DateUtil.format(new Date(), "yyMMddHHmmssSSS");
+                for (TjOrderDetail detail : detailList) {
+                    int i = samplingService.isExistProId(order.getTjNumber(), String.valueOf(detail.getProId()));
+                    if(i>0) continue;
+                    TjSampling sampling = new TjSampling();
+                    if (null == projectService.getById(detail.getProId())) continue;
+                    TjProject project = projectService.getById(detail.getProId());
+                    Long proParentId = project.getProParentId();
+                    String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType());
+                    if (null != proParentId && proParentId == 0) {
+                        sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
+    //                    LtkjJyxmzd jyxmzd = lisApiMethod.getJyxmzd(project);
+    //                    if (jyxmzd != null) {
+                        if (config.equals("Y") && lisAndPacsRegister)
+                            sampling.setJyxmdm(project.getLisXmbm());
+                        else sampling.setJyxmdm(String.valueOf(project.getProId()));
+                        sampling.setSpecimenTypeCode(project.getSpecimenType());
+                        sampling.setSpecimenType(dictLabel);
+    //                        LambdaQueryWrapper<LtkjJybbzd> wrapper = new LambdaQueryWrapper<>();
+    //                        wrapper.eq(LtkjJybbzd::getJybbdm,jyxmzd.getJybbdm());
+    //                        LtkjJybbzd jybbzd = jybbzdService.getOne(wrapper);
+    //                        sampling.setSpecimenType(jybbzd.getJybbmc());
+    //                        sampling.setJyxmdm(jyxmzd.getJyxmdm());
+    //                    }
+                    } else {
+                        TjProject project1 = projectService.getById(proParentId);
+                        sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
+                        sampling.setSpecimenTypeCode(project1.getSpecimenType());
+                        sampling.setSpecimenType(dictLabel);
+                        if (config.equals("Y") && lisAndPacsRegister)
+                            sampling.setJyxmdm(project1.getLisXmbm());
+                        else sampling.setJyxmdm(String.valueOf(project1.getProId()));
+    //                    LtkjJyxmzd jyxmzd = lisApiMethod.getJyxmzd(project1);
+    //                    if (jyxmzd != null) {
+    //                        sampling.setSpecimenTypeCode(jyxmzd.getJybbdm());
+    //                        LambdaQueryWrapper<LtkjJybbzd> wrapper = new LambdaQueryWrapper<>();
+    //                        wrapper.eq(LtkjJybbzd::getJybbdm,jyxmzd.getJybbdm());
+    //                        LtkjJybbzd jybbzd = jybbzdService.getOne(wrapper);
+    //                        sampling.setSpecimenType(jybbzd.getJybbmc());
+    //                        sampling.setJyxmdm(jyxmzd.getJyxmdm());
+    //                    }
+                    }
+                    sampling.setSamplingNumber(format);
+                    sampling.setTjNum(order.getTjNumber());
+                    sampling.setCusId(String.valueOf(order.getUserId()));
+                    if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) {
+                        sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName());
+                    }
+                    sampling.setApplicationTime(new Date());
+                    sampling.setTjTime(order.getCreateTime());
+                    sampling.setProId(String.valueOf(detail.getProId()));
+                    sampling.setProName(projectService.getById(detail.getProId()).getProName());
+                    sampling.setCreateBy(sysUser.getNickName());
+                    sampling.setCreateTime(new Date());
+                    sampling.setUpdateBy(sysUser.getNickName());
+                    sampling.setUpdateTime(new Date());
+                    sampling.setCreateId(String.valueOf(sysUser.getUserId()));
+                    sampling.setUpdateId(String.valueOf(sysUser.getUserId()));
+                    sampling.setJxbz(jxbz);
+                    samplingService.save(sampling);
                 }
-                sampling.setSamplingNumber(format);
-                sampling.setTjNum(order.getTjNumber());
-                sampling.setCusId(String.valueOf(order.getUserId()));
-                if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) {
-                    sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName());
-                }
-                sampling.setApplicationTime(new Date());
-                sampling.setTjTime(order.getCreateTime());
-                sampling.setProId(String.valueOf(detail.getProId()));
-                sampling.setProName(projectService.getById(detail.getProId()).getProName());
-                sampling.setCreateBy(sysUser.getNickName());
-                sampling.setCreateTime(new Date());
-                sampling.setUpdateBy(sysUser.getNickName());
-                sampling.setUpdateTime(new Date());
-                sampling.setCreateId(String.valueOf(sysUser.getUserId()));
-                sampling.setUpdateId(String.valueOf(sysUser.getUserId()));
-                sampling.setJxbz(jxbz);
-                samplingService.save(sampling);
             }
-        }
-        if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))){
-            AjaxResult ajaxResult = lisApiMethod.getJyFlHb();
-            if (ajaxResult.get("code").toString().equals("200")){
-                String str = ajaxResult.get("data").toString();
-                str = str.replace("=", ":");
-                JSONArray array = JSONUtil.parseArray(str);
-                for (Object o : array) {
-                    JSONObject object = (JSONObject) o;
-                    LisJyflhb lisJyflhb = new LisJyflhb();
-                    lisJyflhb.setHbhxm(object.getStr("hbhxm"));
-                    lisJyflhb.setFlmc(object.getStr("flmc"));
-                    lisJyflhb.setMc(object.getStr("mc"));
-                    lisJyflhb.setFlbm(object.getStr("flbm"));
-                    LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>();
-                    wrapper.eq(LisJyflhb::getFlbm,lisJyflhb.getFlbm());
-                    LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper);
-                    if (jyflhb == null) {
-                        lisJyflhb.setId(IdUtil.getSnowflake().nextId());
-                        lisJyflhbService.save(lisJyflhb);
-                    }else {
-                        lisJyflhb.setId(jyflhb.getId());
-                        lisJyflhbService.updateById(lisJyflhb);
+            if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))){
+                AjaxResult ajaxResult = lisApiMethod.getJyFlHb();
+                if (ajaxResult.get("code").toString().equals("200")){
+                    String str = ajaxResult.get("data").toString();
+                    str = str.replace("=", ":");
+                    JSONArray array = JSONUtil.parseArray(str);
+                    for (Object o : array) {
+                        JSONObject object = (JSONObject) o;
+                        LisJyflhb lisJyflhb = new LisJyflhb();
+                        lisJyflhb.setHbhxm(object.getStr("hbhxm"));
+                        lisJyflhb.setFlmc(object.getStr("flmc"));
+                        lisJyflhb.setMc(object.getStr("mc"));
+                        lisJyflhb.setFlbm(object.getStr("flbm"));
+                        LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>();
+                        wrapper.eq(LisJyflhb::getFlbm,lisJyflhb.getFlbm());
+                        LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper);
+                        if (jyflhb == null) {
+                            lisJyflhb.setId(IdUtil.getSnowflake().nextId());
+                            lisJyflhbService.save(lisJyflhb);
+                        }else {
+                            lisJyflhb.setId(jyflhb.getId());
+                            lisJyflhbService.updateById(lisJyflhb);
+                        }
                     }
                 }
-            }
 
-        }
-        if (StrUtil.isNotBlank(jxbz)){
-            tjSamplingMapper.updateUserIdByTjNumAndJxbz(order.getTjNumber(),sysUser.getNickName(), String.valueOf(sysUser.getUserId()),jxbz);
-        }else {
-            tjSamplingMapper.updateUserIdByTjNum(order.getTjNumber(),sysUser.getNickName(), String.valueOf(sysUser.getUserId()));
+            }
+            if (StrUtil.isNotBlank(jxbz)){
+                tjSamplingMapper.updateUserIdByTjNumAndJxbz(order.getTjNumber(),sysUser.getNickName(), String.valueOf(sysUser.getUserId()),jxbz);
+            }else {
+                tjSamplingMapper.updateUserIdByTjNum(order.getTjNumber(),sysUser.getNickName(), String.valueOf(sysUser.getUserId()));
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage());
         }
     }
 
@@ -870,85 +873,89 @@
     }
 
     public void addCaiYangDengJiByDiaoYongShiTu(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser,String jxbz) {
-        String lis_tmh_prefix = sysConfigService.selectConfigByKey("make_lis_tmh_prefix");
-        if (null != detailList && detailList1) {
-            Date date = new Date();
-            String format = DateUtil.format(date, "yyMMddHHmmssSSS");
-            for (TjOrderDetail detail : detailList) {
-                int i = samplingService.isExistProId(order.getTjNumber(), String.valueOf(detail.getProId()));
-                if(i>0) continue;
+        try {
+            String lis_tmh_prefix = sysConfigService.selectConfigByKey("make_lis_tmh_prefix");
+            if (null != detailList && detailList1) {
+                Date date = new Date();
+                String format = DateUtil.format(date, "yyMMddHHmmssSSS");
+                for (TjOrderDetail detail : detailList) {
+                    int i = samplingService.isExistProId(order.getTjNumber(), String.valueOf(detail.getProId()));
+                    if(i>0) continue;
 
-                TjSampling sampling = new TjSampling();
-                if (null == projectService.getById(detail.getProId())) continue;
-                TjProject project = projectService.getById(detail.getProId());
-                Long proParentId = project.getProParentId();
-                String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType());
-                if (null != proParentId && proParentId == 0) {
-                    sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
-                    sampling.setSpecimenTypeCode(project.getSpecimenType());
-                    sampling.setSpecimenType(dictLabel);
-                    sampling.setJyxmdm(project.getProId().toString());
-                } else {
-                    TjProject project1 = projectService.getById(proParentId);
-                    sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
+                    TjSampling sampling = new TjSampling();
+                    if (null == projectService.getById(detail.getProId())) continue;
+                    TjProject project = projectService.getById(detail.getProId());
+                    Long proParentId = project.getProParentId();
+                    String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType());
+                    if (null != proParentId && proParentId == 0) {
+                        sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
+                        sampling.setSpecimenTypeCode(project.getSpecimenType());
+                        sampling.setSpecimenType(dictLabel);
+                        sampling.setJyxmdm(project.getProId().toString());
+                    } else {
+                        TjProject project1 = projectService.getById(proParentId);
+                        sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
 
-                    sampling.setSpecimenTypeCode(project1.getSpecimenType());
-                    sampling.setSpecimenType(dictLabel);
-                    sampling.setJyxmdm(project.getProId().toString());
+                        sampling.setSpecimenTypeCode(project1.getSpecimenType());
+                        sampling.setSpecimenType(dictLabel);
+                        sampling.setJyxmdm(project.getProId().toString());
 
+                    }
+                    sampling.setSamplingNumber(format);
+                    sampling.setTjNum(order.getTjNumber());
+                    sampling.setCusId(String.valueOf(order.getUserId()));
+                    if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) {
+                        sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName());
+                    }
+                    sampling.setApplicationTime(date);
+                    sampling.setTjTime(order.getCreateTime());
+                    sampling.setProId(String.valueOf(detail.getProId()));
+                    sampling.setProName(projectService.getById(detail.getProId()).getProName());
+                    sampling.setCreateBy(sysUser.getNickName());
+                    sampling.setCreateTime(date);
+                    sampling.setUpdateBy(sysUser.getNickName());
+                    sampling.setUpdateTime(date);
+                    sampling.setCreateId(String.valueOf(sysUser.getUserId()));
+                    sampling.setUpdateId(String.valueOf(sysUser.getUserId()));
+                    sampling.setJxbz(jxbz);
+                    samplingService.save(sampling);
                 }
-                sampling.setSamplingNumber(format);
-                sampling.setTjNum(order.getTjNumber());
-                sampling.setCusId(String.valueOf(order.getUserId()));
-                if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) {
-                    sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName());
-                }
-                sampling.setApplicationTime(date);
-                sampling.setTjTime(order.getCreateTime());
-                sampling.setProId(String.valueOf(detail.getProId()));
-                sampling.setProName(projectService.getById(detail.getProId()).getProName());
-                sampling.setCreateBy(sysUser.getNickName());
-                sampling.setCreateTime(date);
-                sampling.setUpdateBy(sysUser.getNickName());
-                sampling.setUpdateTime(date);
-                sampling.setCreateId(String.valueOf(sysUser.getUserId()));
-                sampling.setUpdateId(String.valueOf(sysUser.getUserId()));
-                sampling.setJxbz(jxbz);
-                samplingService.save(sampling);
             }
-        }
-        String config = configService.selectConfigByKey("sfkqdyhis");
-        if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))){
-            AjaxResult ajaxResult = lisApiMethod.getJyFlHb();
-            if (ajaxResult.get("code").toString().equals("200")){
-                String str = ajaxResult.get("data").toString();
-                str = str.replace("=", ":");
-                JSONArray array = JSONUtil.parseArray(str);
-                for (Object o : array) {
-                    JSONObject object = (JSONObject) o;
-                    LisJyflhb lisJyflhb = new LisJyflhb();
-                    lisJyflhb.setHbhxm(object.getStr("hbhxm"));
-                    lisJyflhb.setFlmc(object.getStr("flmc"));
-                    lisJyflhb.setMc(object.getStr("mc"));
-                    lisJyflhb.setFlbm(object.getStr("flbm"));
-                    LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>();
-                    wrapper.eq(LisJyflhb::getFlbm,lisJyflhb.getFlbm());
-                    LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper);
-                    if (jyflhb == null) {
-                        lisJyflhb.setId(IdUtil.getSnowflake().nextId());
-                        lisJyflhbService.save(lisJyflhb);
-                    }else {
-                        lisJyflhb.setId(jyflhb.getId());
-                        lisJyflhbService.updateById(lisJyflhb);
+            String config = configService.selectConfigByKey("sfkqdyhis");
+            if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))){
+                AjaxResult ajaxResult = lisApiMethod.getJyFlHb();
+                if (ajaxResult.get("code").toString().equals("200")){
+                    String str = ajaxResult.get("data").toString();
+                    str = str.replace("=", ":");
+                    JSONArray array = JSONUtil.parseArray(str);
+                    for (Object o : array) {
+                        JSONObject object = (JSONObject) o;
+                        LisJyflhb lisJyflhb = new LisJyflhb();
+                        lisJyflhb.setHbhxm(object.getStr("hbhxm"));
+                        lisJyflhb.setFlmc(object.getStr("flmc"));
+                        lisJyflhb.setMc(object.getStr("mc"));
+                        lisJyflhb.setFlbm(object.getStr("flbm"));
+                        LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>();
+                        wrapper.eq(LisJyflhb::getFlbm,lisJyflhb.getFlbm());
+                        LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper);
+                        if (jyflhb == null) {
+                            lisJyflhb.setId(IdUtil.getSnowflake().nextId());
+                            lisJyflhbService.save(lisJyflhb);
+                        }else {
+                            lisJyflhb.setId(jyflhb.getId());
+                            lisJyflhbService.updateById(lisJyflhb);
+                        }
                     }
                 }
-            }
 
-        }
-        if (StrUtil.isNotBlank(jxbz)){
-            tjSamplingMapper.updateUserIdByTjNumAndJxbz(order.getTjNumber(),sysUser.getNickName(), String.valueOf(sysUser.getUserId()),jxbz);
-        }else {
-            tjSamplingMapper.updateUserIdByTjNum(order.getTjNumber(),sysUser.getNickName(), String.valueOf(sysUser.getUserId()));
+            }
+            if (StrUtil.isNotBlank(jxbz)){
+                tjSamplingMapper.updateUserIdByTjNumAndJxbz(order.getTjNumber(),sysUser.getNickName(), String.valueOf(sysUser.getUserId()),jxbz);
+            }else {
+                tjSamplingMapper.updateUserIdByTjNum(order.getTjNumber(),sysUser.getNickName(), String.valueOf(sysUser.getUserId()));
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage());
         }
     }
 
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysConfigController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysConfigController.java
index 9be1c70..82c5064 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysConfigController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysConfigController.java
@@ -1,7 +1,8 @@
 package com.ltkj.web.controller.system;
 
-import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
@@ -9,13 +10,10 @@
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.extra.pinyin.PinyinUtil;
 import cn.hutool.json.JSONUtil;
-import com.ltkj.common.core.domain.entity.SysMenu;
+import com.ltkj.hosp.idutil.IdUtils;
 import com.ltkj.common.utils.SecurityUtils;
 import com.ltkj.framework.datasource.DynamicDataSourceContextHolder;
-import com.ltkj.hosp.domain.DictHosp;
-import com.ltkj.hosp.domain.TjJcycxm;
-import com.ltkj.hosp.domain.TjOrder;
-import com.ltkj.hosp.domain.TjProject;
+import com.ltkj.hosp.domain.*;
 import com.ltkj.hosp.mapper.TestMapper;
 import com.ltkj.hosp.service.*;
 import com.ltkj.hosp.sqlDomain.*;
@@ -25,8 +23,6 @@
 import io.swagger.annotations.ApiParam;
 import jodd.util.StringUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.annotations.Case;
-import org.apache.ibatis.jdbc.Null;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -78,6 +74,8 @@
     private TestMapper testMapper;
     @Autowired
     private AwsService awsService;
+    @Autowired
+    private IdUtils idUtils;
 
     /**
      * 鑾峰彇鍙傛暟閰嶇疆鍒楄〃
@@ -414,4 +412,30 @@
         }
     }
 
+
+    @GetMapping ("/ceshitijianhao")//鍚屾his椤圭洰鍗曚环淇℃伅
+//    @PreAuthorize("@ss.hasPermi('system:config:tbhisproprice')")
+    @ApiOperation (value = "娴嬭瘯浣撴鍙�")
+    public AjaxResult ceshitijianhao() {
+        //鍒涘缓绾跨▼姹�
+        ExecutorService threadPool = Executors.newFixedThreadPool(2000);
+        List<String> numbers = new ArrayList<>();
+        for (int i = 0; i < 2000; i++) {
+            //鑾峰彇绾跨▼
+            threadPool.execute(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        String number = idUtils.getNewTjNumberRedisLock(); // 璋冪敤鑾峰彇缂栧彿鐨勬柟娉�
+                        numbers.add(number); // 娣诲姞鍒� Set
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+        }
+        threadPool.shutdown();
+        return AjaxResult.success(numbers);
+    }
+
 }
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
index 6e9b4a2..1614902 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java
@@ -2,31 +2,24 @@
 
 import java.io.*;
 import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
-import java.time.OffsetTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.List;
 import java.util.concurrent.*;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.stream.Collectors;
-import java.util.stream.Stream;
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.core.codec.Base64;
 import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.IdUtil;
-import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.crypto.symmetric.DES;
 import cn.hutool.extra.pinyin.PinyinUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
@@ -34,10 +27,7 @@
 import com.alibaba.fastjson2.JSON;
 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.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fasterxml.jackson.databind.BeanProperty;
 import com.itextpdf.text.Document;
 import com.itextpdf.text.DocumentException;
 import com.ltkj.common.annotation.RepeatSubmit;
@@ -54,12 +44,10 @@
 import com.ltkj.hosp.dto.QianDaoDto;
 import com.ltkj.hosp.dto.TjProBlDto;
 import com.ltkj.hosp.dto.UpdateTransitionnewPriceDto;
-import com.ltkj.hosp.hisDto.OutpinimpapplyDto;
 import com.ltkj.hosp.hisDto.OutpinmedicapplyDto;
 import com.ltkj.hosp.mapper.TbTransitionMapper;
 import com.ltkj.hosp.mapper.TestMapper;
 import com.ltkj.hosp.mapper.TjSamplingMapper;
-import com.ltkj.hosp.pacsDto.SavePacsApply;
 import com.ltkj.hosp.service.*;
 import com.ltkj.hosp.sqlDomain.LtkjMiddleDetail;
 import com.ltkj.hosp.sqlDomain.LtkjMiddleHead;
@@ -76,24 +64,19 @@
 import com.ltkj.mall.service.IMallOrderService;
 import com.ltkj.system.domain.TjDjdDyjl;
 import com.ltkj.system.service.*;
+import com.ltkj.hosp.idutil.IdUtils;
 import com.ltkj.web.controller.his.*;
 import com.ltkj.web.controller.lis.LisApiMethod;
 import com.ltkj.web.controller.pacs.PacsApiMethodService;
-import com.ltkj.web.controller.service.TjSysAsyncServiceImpl;
 import com.ltkj.web.wxUtils.HttpClientUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import jodd.util.StringUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.time.DateFormatUtils;
-import org.aspectj.weaver.ast.Var;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.http.HttpRequest;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
@@ -1107,11 +1090,37 @@
         //鐢熸垚浣撴鍙�
 //        String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date()));
 //        if(StringUtil.isNotBlank(makeLisTmhPrefix)) tjNumber=makeLisTmhPrefix+tjNumber;
-
-
 //        String tjNumber = (SecurityUtils.getUsername() + idUtils.getTjNumber());
-        String tjNumber = idUtils.getTjNumber();
-        if (StringUtil.isNotBlank(makeLisTmhPrefix)) tjNumber = makeLisTmhPrefix + tjNumber;
+//        String tjNumber = idUtils.getTjNumber();
+        String tjNumber = null;
+
+        int a =0;
+        while (tjNumber ==null){
+            if(a>3){
+                throw new RuntimeException("鍓嶆柟鎷ユ尋,璇风◢绛�!!!");
+            }
+            try {
+                String newTjNumberRedisLockAndMysql = idUtils.getNewTjNumberRedisLockAndMysql();
+                if (StringUtil.isNotBlank(makeLisTmhPrefix)){
+                 String tjh=  makeLisTmhPrefix + newTjNumberRedisLockAndMysql;
+                 int countByTjNum = tjOrderService.getOrderCountByTjNum(tjh);
+                 if(countByTjNum==0){
+                     tjNumber=tjh;
+                 }
+                }else {
+                    int countByTjNum = tjOrderService.getOrderCountByTjNum(newTjNumberRedisLockAndMysql);
+                    if(countByTjNum==0){
+                        tjNumber=newTjNumberRedisLockAndMysql;
+                    }
+                }
+            } catch (Exception e) {
+                log.error(e.getMessage());
+            }finally {
+                a++;
+            }
+        }
+
+
         tjOrder.setTjNumber(tjNumber);
 
 
@@ -1461,89 +1470,93 @@
     }
 
     public void addCaiYangDengJi(List<TjOrderDetail> detailList, boolean detailList1, TjOrder order, SysUser sysUser, String jxbz) {
-        String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix");
-        String config = configService.selectConfigByKey("sfkqdyhis");
-        Boolean lisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order);
-        if (null != detailList && detailList1) {
-            Date date = new Date();
-            String format = DateUtil.format(date, "yyMMddHHmmssSSS");
-            for (TjOrderDetail detail : detailList) {
-                int i = samplingService.isExistProId(order.getTjNumber(), String.valueOf(detail.getProId()));
-                if(i>0) continue;
-                TjSampling sampling = new TjSampling();
-                if (null == projectService.getById(detail.getProId())) continue;
-                TjProject project = projectService.getById(detail.getProId());
-                Long proParentId = project.getProParentId();
-                String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType());
-                if (null != proParentId && proParentId == 0) {
-                    sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
-                    sampling.setSpecimenTypeCode(project.getSpecimenType());
-                    sampling.setSpecimenType(dictLabel);
-                    if (config.equals("Y") && lisAndPacsRegister)
-                        sampling.setJyxmdm(project.getLisXmbm());
-                    else sampling.setJyxmdm(project.getProId().toString());
-                } else {
-                    TjProject project1 = projectService.getById(proParentId);
-                    sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
-
-                    sampling.setSpecimenTypeCode(project1.getSpecimenType());
-                    sampling.setSpecimenType(dictLabel);
-                    if (config.equals("Y") && lisAndPacsRegister)
-                        sampling.setJyxmdm(project1.getLisXmbm());
-                    else sampling.setJyxmdm(project1.getProId().toString());
-
-                }
-                sampling.setSamplingNumber(format);
-                sampling.setTjNum(order.getTjNumber());
-                sampling.setCusId(String.valueOf(order.getUserId()));
-                if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) {
-                    sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName());
-                }
-                sampling.setApplicationTime(date);
-                sampling.setTjTime(order.getCreateTime());
-                sampling.setProId(String.valueOf(detail.getProId()));
-                sampling.setProName(projectService.getById(detail.getProId()).getProName());
-                sampling.setCreateBy(sysUser.getNickName());
-                sampling.setCreateTime(date);
-                sampling.setUpdateBy(sysUser.getNickName());
-                sampling.setUpdateTime(date);
-                sampling.setCreateId(String.valueOf(sysUser.getUserId()));
-                sampling.setUpdateId(String.valueOf(sysUser.getUserId()));
-                sampling.setJxbz(jxbz);
-                samplingService.save(sampling);
-            }
-        }
-        if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))) {
-            AjaxResult ajaxResult = lisApiMethod.getJyFlHb();
-            if (ajaxResult.get("code").toString().equals("200")) {
-                String str = ajaxResult.get("data").toString();
-                str = str.replace("=", ":");
-                JSONArray array = JSONUtil.parseArray(str);
-                for (Object o : array) {
-                    JSONObject object = (JSONObject) o;
-                    LisJyflhb lisJyflhb = new LisJyflhb();
-                    lisJyflhb.setHbhxm(object.getStr("hbhxm"));
-                    lisJyflhb.setFlmc(object.getStr("flmc"));
-                    lisJyflhb.setMc(object.getStr("mc"));
-                    lisJyflhb.setFlbm(object.getStr("flbm"));
-                    LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>();
-                    wrapper.eq(LisJyflhb::getFlbm, lisJyflhb.getFlbm());
-                    LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper);
-                    if (jyflhb == null) {
-                        lisJyflhb.setId(IdUtil.getSnowflake().nextId());
-                        lisJyflhbService.save(lisJyflhb);
+        try {
+            String lis_tmh_prefix = configService.selectConfigByKey("make_lis_tmh_prefix");
+            String config = configService.selectConfigByKey("sfkqdyhis");
+            Boolean lisAndPacsRegister = lisApiMethod.isUseLisAndPacsRegister(order);
+            if (null != detailList && detailList1) {
+                Date date = new Date();
+                String format = DateUtil.format(date, "yyMMddHHmmssSSS");
+                for (TjOrderDetail detail : detailList) {
+                    int i = samplingService.isExistProId(order.getTjNumber(), String.valueOf(detail.getProId()));
+                    if(i>0) continue;
+                    TjSampling sampling = new TjSampling();
+                    if (null == projectService.getById(detail.getProId())) continue;
+                    TjProject project = projectService.getById(detail.getProId());
+                    Long proParentId = project.getProParentId();
+                    String dictLabel = sysDictDataService.selectDictLabel("sys_dict_specimen", project.getSpecimenType());
+                    if (null != proParentId && proParentId == 0) {
+                        sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
+                        sampling.setSpecimenTypeCode(project.getSpecimenType());
+                        sampling.setSpecimenType(dictLabel);
+                        if (config.equals("Y") && lisAndPacsRegister)
+                            sampling.setJyxmdm(project.getLisXmbm());
+                        else sampling.setJyxmdm(project.getProId().toString());
                     } else {
-                        lisJyflhb.setId(jyflhb.getId());
-                        lisJyflhbService.updateById(lisJyflhb);
+                        TjProject project1 = projectService.getById(proParentId);
+                        sampling.setJyxh(idUtils.generateLisID(lis_tmh_prefix));
+
+                        sampling.setSpecimenTypeCode(project1.getSpecimenType());
+                        sampling.setSpecimenType(dictLabel);
+                        if (config.equals("Y") && lisAndPacsRegister)
+                            sampling.setJyxmdm(project1.getLisXmbm());
+                        else sampling.setJyxmdm(project1.getProId().toString());
+
+                    }
+                    sampling.setSamplingNumber(format);
+                    sampling.setTjNum(order.getTjNumber());
+                    sampling.setCusId(String.valueOf(order.getUserId()));
+                    if (tjCustomerService.getById(String.valueOf(order.getUserId())) != null) {
+                        sampling.setCusName(tjCustomerService.getById(String.valueOf(order.getUserId())).getCusName());
+                    }
+                    sampling.setApplicationTime(date);
+                    sampling.setTjTime(order.getCreateTime());
+                    sampling.setProId(String.valueOf(detail.getProId()));
+                    sampling.setProName(projectService.getById(detail.getProId()).getProName());
+                    sampling.setCreateBy(sysUser.getNickName());
+                    sampling.setCreateTime(date);
+                    sampling.setUpdateBy(sysUser.getNickName());
+                    sampling.setUpdateTime(date);
+                    sampling.setCreateId(String.valueOf(sysUser.getUserId()));
+                    sampling.setUpdateId(String.valueOf(sysUser.getUserId()));
+                    sampling.setJxbz(jxbz);
+                    samplingService.save(sampling);
+                }
+            }
+            if (lisApiMethod.isUseLisAndPacsRegister(order) && (null != config && config.equals("Y"))) {
+                AjaxResult ajaxResult = lisApiMethod.getJyFlHb();
+                if (ajaxResult.get("code").toString().equals("200")) {
+                    String str = ajaxResult.get("data").toString();
+                    str = str.replace("=", ":");
+                    JSONArray array = JSONUtil.parseArray(str);
+                    for (Object o : array) {
+                        JSONObject object = (JSONObject) o;
+                        LisJyflhb lisJyflhb = new LisJyflhb();
+                        lisJyflhb.setHbhxm(object.getStr("hbhxm"));
+                        lisJyflhb.setFlmc(object.getStr("flmc"));
+                        lisJyflhb.setMc(object.getStr("mc"));
+                        lisJyflhb.setFlbm(object.getStr("flbm"));
+                        LambdaQueryWrapper<LisJyflhb> wrapper = new LambdaQueryWrapper<>();
+                        wrapper.eq(LisJyflhb::getFlbm, lisJyflhb.getFlbm());
+                        LisJyflhb jyflhb = lisJyflhbService.getOne(wrapper);
+                        if (jyflhb == null) {
+                            lisJyflhb.setId(IdUtil.getSnowflake().nextId());
+                            lisJyflhbService.save(lisJyflhb);
+                        } else {
+                            lisJyflhb.setId(jyflhb.getId());
+                            lisJyflhbService.updateById(lisJyflhb);
+                        }
                     }
                 }
-            }
 
-        }
-        if (StrUtil.isNotBlank(jxbz)) {
-            tjSamplingMapper.updateUserIdByTjNumAndJxbz(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), jxbz);
-        } else {
-            tjSamplingMapper.updateUserIdByTjNum(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()));
+            }
+            if (StrUtil.isNotBlank(jxbz)) {
+                tjSamplingMapper.updateUserIdByTjNumAndJxbz(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), jxbz);
+            } else {
+                tjSamplingMapper.updateUserIdByTjNum(order.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()));
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage());
         }
     }
 
@@ -1913,7 +1926,8 @@
             //鑾峰彇鎷兼帴鍓嶇紑
             String makeLisTmhPrefix = configService.selectConfigByKey("make_lis_tmh_prefix");
 //            String tjNumber = (sysUser.getUserName() + idUtils.getTjNumber());
-            String tjNumber = idUtils.getTjNumber();
+//            String tjNumber = idUtils.getTjNumber();
+            String tjNumber = idUtils.getNewTjNumberRedisLockAndMysql();
             if (StringUtil.isNotBlank(makeLisTmhPrefix)) tjNumber = makeLisTmhPrefix + tjNumber;
 
 
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSamplingController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSamplingController.java
index defdf2c..51d0401 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSamplingController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjSamplingController.java
@@ -4,20 +4,13 @@
 import java.util.*;
 import java.util.stream.Collectors;
 import javax.annotation.Resource;
-import javax.servlet.ServletSecurityElement;
 import javax.servlet.http.HttpServletResponse;
-import javax.swing.plaf.basic.BasicScrollPaneUI;
 
-import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.extra.pinyin.PinyinUtil;
-import cn.hutool.json.JSONArray;
-import cn.hutool.json.JSONObject;
 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.common.utils.IdUtils;
 import com.ltkj.framework.config.MatchUtils;
 import com.ltkj.hosp.domain.*;
 import com.ltkj.hosp.service.*;
@@ -28,12 +21,8 @@
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
-import org.aspectj.weaver.AjAttribute;
-import org.springframework.beans.BeanUtils;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.web.bind.annotation.*;
 import com.ltkj.common.annotation.Log;
 import com.ltkj.common.core.controller.BaseController;
diff --git a/ltkj-common/src/main/java/com/ltkj/common/utils/IdUtils.java b/ltkj-common/src/main/java/com/ltkj/common/utils/IdUtils.java
deleted file mode 100644
index 71bb04c..0000000
--- a/ltkj-common/src/main/java/com/ltkj/common/utils/IdUtils.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package com.ltkj.common.utils;
-
-import cn.hutool.core.util.StrUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.stereotype.Component;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Random;
-
-/**
- * @Company: 瑗垮畨璺嘲绉戞妧鏈夐檺鍏徃
- * @Author: zhaowenxuan
- * @Date: 2024/10/10 14:55
- */
-@Component
-public class IdUtils {
-
-    private static final String LIS_LAST_ID_KEY = "id:generate:lis:id";
-    private static final String TJH_LAST_ID_KEY = "id:generate:tjhs:tjh";
-    private static final String LIS_LAST_ID_INCR_KEY = "id:generate:lis:id:incr";
-    private static final String LIS_CURRENT_DATE_KEY = "id:generate:lis:currentDate";
-
-//    private static final UidGenerator uidGenerator = new DefaultUidGenerator();  // 浣跨敤榛樿鐨凷nowflake鐢熸垚鍣�
-
-    @Autowired
-    private StringRedisTemplate stringRedisTemplate;
-
-    public synchronized String generateLisID(String prefix) {
-        String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
-        String storedDate = stringRedisTemplate.opsForValue().get(LIS_CURRENT_DATE_KEY);
-        String lastIdStr = stringRedisTemplate.opsForValue().get(LIS_LAST_ID_KEY);
-        int lastId;
-        if (storedDate == null || !storedDate.equals(currentDate)) {
-            lastId = 1;
-            stringRedisTemplate.opsForValue().set(LIS_LAST_ID_KEY, String.valueOf(lastId));
-            stringRedisTemplate.opsForValue().set(LIS_CURRENT_DATE_KEY, currentDate);
-        } else {
-            lastId = Integer.parseInt(lastIdStr) + 1;
-            stringRedisTemplate.opsForValue().set(LIS_LAST_ID_KEY, String.valueOf(lastId));
-        }
-        String yyMMdd = currentDate.substring(2);
-        return String.format(prefix+"%s%05d", yyMMdd, lastId);
-    }
-
-    /**
-     * 鐢熸垚鏃犻檺閫掑鏉$爜鍙�
-     * @param prefix
-     * @return
-     */
-    public synchronized String generateLisNextId(String prefix){
-        String lastIdStr = stringRedisTemplate.opsForValue().get(LIS_LAST_ID_INCR_KEY);
-        int current;
-        if (StrUtil.isBlank(lastIdStr)) {
-            current = 1;
-        }else {
-            current = Integer.parseInt(lastIdStr);
-        }
-        int numberLength = String.valueOf(99999).length();
-        String result = prefix + String.format("%0" + numberLength + "d", current);
-        current++;
-        stringRedisTemplate.opsForValue().set(LIS_LAST_ID_INCR_KEY,String.valueOf(current));
-        return result;
-    }
-
-
-    //鐢熸垚浣撴鍙风敤
-    private static long lastTimestamp = -1;
-    private static final Random random = new Random();
-
-//    public static synchronized String getTjNumber() {
-//        long timestamp = System.currentTimeMillis();  // 鑾峰彇褰撳墠鏃堕棿鎴筹紙姣锛�
-//
-//        // 濡傛灉鏃堕棿鎴冲拰涓婃鐢熸垚鐨勬椂闂存埑鐩稿悓锛岀敓鎴愪竴涓柊鐨勯殢鏈烘暟
-//        if (timestamp == lastTimestamp) {
-//            return String.format("%09d", (timestamp % 1000000000) + random.nextInt(900) + 100);
-//        } else {
-//            lastTimestamp = timestamp;  // 鏇存柊鏈�鍚庣敓鎴愭椂闂存埑
-//            return String.format("%09d", (timestamp % 1000000000) + random.nextInt(900) + 100);
-//        }
-//    }
-
-
-    public  synchronized String getTjNumber() {
-        String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
-        String storedDate = stringRedisTemplate.opsForValue().get(LIS_CURRENT_DATE_KEY);
-        String lastIdStr = stringRedisTemplate.opsForValue().get(TJH_LAST_ID_KEY);
-        if (StrUtil.isBlank(lastIdStr))lastIdStr = "0";
-        int lastId;
-        if (storedDate == null || !storedDate.equals(currentDate)) {
-            lastId = 1;
-            stringRedisTemplate.opsForValue().set(TJH_LAST_ID_KEY, String.valueOf(lastId));
-            stringRedisTemplate.opsForValue().set(LIS_CURRENT_DATE_KEY, currentDate);
-        } else {
-            lastId = Integer.parseInt(lastIdStr) + 1;
-            stringRedisTemplate.opsForValue().set(TJH_LAST_ID_KEY, String.valueOf(lastId));
-        }
-        String yyMMdd = currentDate.substring(2);
-        return String.format("%s%05d", yyMMdd, lastId);
-    }
-
-
-//    浣跨敤鍒嗗竷寮廔D鐢熸垚鍣紙濡係nowflake锛�
-    public static String generateExamNumber() {
-//        long id = uidGenerator.getUID();  // 鑾峰彇鐢熸垚鐨勫敮涓�ID
-//        return String.format("%09d", Math.abs(id) % 1000000000);  // 鏍煎紡鍖栦负9浣�
-        return null;
-    }
-
-}
diff --git a/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java b/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java
index 7e8b40d..23c0d40 100644
--- a/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java
+++ b/ltkj-framework/src/main/java/com/ltkj/framework/config/SecurityConfig.java
@@ -110,7 +110,8 @@
                 // 瀵逛簬鐧诲綍login 娉ㄥ唽register 楠岃瘉鐮乧aptchaImage 鍏佽鍖垮悕璁块棶
                 .antMatchers("/login", "/register", "/captchaImage","/cus/**","/getCaptchaConfigKey","/report/jmreport/**",
                         "/sqlserver/getdata/**","/api/His/**","/system/config/zx","/system/config/gxxmpym","/system/report/savePdf",
-                        "/system/dyjl/saveGjddyjl","/system/dyjl/saveBlGjddyjl","/check/ceshi","/check/pacs","/check/ceshicc","/system/report/xiugaidayinzhuangtai").permitAll()
+                        "/system/dyjl/saveGjddyjl","/system/dyjl/saveBlGjddyjl","/check/ceshi","/check/pacs","/check/ceshicc"
+                        ,"/system/report/xiugaidayinzhuangtai","/system/config/ceshitijianhao").permitAll()
                 .antMatchers("/common/uploadImgExe","/common/listExeVal","/pacs/InvokeRisService/**").permitAll()
                 .antMatchers("/check/dataSynchronizationApi","/reservation/reservation/linkage").permitAll()
                 // 闈欐�佽祫婧愶紝鍙尶鍚嶈闂�
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/idutil/IdUtils.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/idutil/IdUtils.java
new file mode 100644
index 0000000..ae2e541
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/idutil/IdUtils.java
@@ -0,0 +1,240 @@
+package com.ltkj.hosp.idutil;
+
+import cn.hutool.core.util.StrUtil;
+import com.ltkj.hosp.mapper.OrderNumberMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.redisson.api.RLock;
+import org.redisson.api.RedissonClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.core.StringRedisTemplate;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @Company: 瑗垮畨璺嘲绉戞妧鏈夐檺鍏徃
+ * @Author: zhaowenxuan
+ * @Date: 2024/10/10 14:55
+ */
+@Configuration
+@Slf4j
+public class IdUtils {
+
+    private static final String LIS_LAST_ID_KEY = "id:generate:lis:id";
+    private static final String TJH_LAST_ID_KEY = "id:generate:tjhs:tjh";
+    private static final String LIS_LAST_ID_INCR_KEY = "id:generate:lis:id:incr";
+    private static final String LIS_CURRENT_DATE_KEY = "id:generate:lis:currentDate";
+
+    @Autowired
+    private StringRedisTemplate stringRedisTemplate;
+    @Autowired
+    private OrderNumberMapper orderNumberMapper;
+    @Autowired
+    private RedissonClient redissonClient;
+
+    public synchronized String yuangenerateLisID(String prefix) {
+        String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
+        String storedDate = stringRedisTemplate.opsForValue().get(LIS_CURRENT_DATE_KEY);
+        String lastIdStr = stringRedisTemplate.opsForValue().get(LIS_LAST_ID_KEY);
+        int lastId;
+        if (storedDate == null || !storedDate.equals(currentDate)) {
+            lastId = 1;
+            stringRedisTemplate.opsForValue().set(LIS_LAST_ID_KEY, String.valueOf(lastId));
+            stringRedisTemplate.opsForValue().set(LIS_CURRENT_DATE_KEY, currentDate);
+        } else {
+            lastId = Integer.parseInt(lastIdStr) + 1;
+            stringRedisTemplate.opsForValue().set(LIS_LAST_ID_KEY, String.valueOf(lastId));
+        }
+        String yyMMdd = currentDate.substring(2);
+        return String.format(prefix+"%s%05d", yyMMdd, lastId);
+    }
+
+    //redis鍒嗗竷寮忛攣鍜孧ySQL鍏敤
+    public String generateLisID(String prefix) {
+        String lockKey = "lock:tmh:tj_tmh_lock";
+        RLock lock = redissonClient.getLock(lockKey);
+
+        try {
+            if (lock.tryLock(3, 5, TimeUnit.SECONDS)) {
+                String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
+                String storedDate = stringRedisTemplate.opsForValue().get(LIS_CURRENT_DATE_KEY);
+                String lastIdStr = stringRedisTemplate.opsForValue().get(LIS_LAST_ID_KEY);
+
+                // 2. 濡傛灉 Redis 涓病鏈夋垨鑰呯紪鍙蜂涪澶憋紝鏌ヨ鏁版嵁搴撳苟鍚屾鍒� Redis
+                if (storedDate == null || !storedDate.equals(currentDate) || lastIdStr == null) {
+                    Integer lastIdFromDb = orderNumberMapper.getLastId(currentDate,lockKey);
+                    lastIdFromDb = (lastIdFromDb == null) ? 0 : lastIdFromDb;
+
+                    // 鍚屾鍒� Redis
+                    stringRedisTemplate.opsForValue().set(LIS_LAST_ID_KEY, String.valueOf(lastIdFromDb), 1, TimeUnit.DAYS);
+                    stringRedisTemplate.opsForValue().set(LIS_CURRENT_DATE_KEY, currentDate, 1, TimeUnit.DAYS);
+                }
+
+                // 3. 浣跨敤 Redis 鐨� INCR 淇濊瘉娴佹按鍙峰敮涓�
+                long lastId = stringRedisTemplate.opsForValue().increment(LIS_LAST_ID_KEY);
+
+                // 4. 鍚屾椂鏇存柊鏁版嵁搴擄紝纭繚涓�鑷存��
+                orderNumberMapper.updateLastId(currentDate, (int) lastId,lockKey);
+
+                return String.format(prefix+"%s%05d", currentDate.substring(2), lastId);
+            } else {
+                throw new RuntimeException("鑾峰彇鏉$爜鍙峰け璐ワ紝璇烽噸璇�");
+            }
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        } finally {
+            if (lock.isHeldByCurrentThread()) {
+                lock.unlock();
+            }
+        }
+    }
+
+
+    /**
+     * 鐢熸垚鏃犻檺閫掑鏉$爜鍙�
+     * @param prefix
+     * @return
+     */
+    public synchronized String generateLisNextId(String prefix){
+        String lastIdStr = stringRedisTemplate.opsForValue().get(LIS_LAST_ID_INCR_KEY);
+        int current;
+        if (StrUtil.isBlank(lastIdStr)) {
+            current = 1;
+        }else {
+            current = Integer.parseInt(lastIdStr);
+        }
+        int numberLength = String.valueOf(99999).length();
+        String result = prefix + String.format("%0" + numberLength + "d", current);
+        current++;
+        stringRedisTemplate.opsForValue().set(LIS_LAST_ID_INCR_KEY,String.valueOf(current));
+        return result;
+    }
+
+
+    //鐢熸垚浣撴鍙风敤
+    private static long lastTimestamp = -1;
+    private static final Random random = new Random();
+
+//    public static synchronized String getTjNumber() {
+//        long timestamp = System.currentTimeMillis();  // 鑾峰彇褰撳墠鏃堕棿鎴筹紙姣锛�
+//
+//        // 濡傛灉鏃堕棿鎴冲拰涓婃鐢熸垚鐨勬椂闂存埑鐩稿悓锛岀敓鎴愪竴涓柊鐨勯殢鏈烘暟
+//        if (timestamp == lastTimestamp) {
+//            return String.format("%09d", (timestamp % 1000000000) + random.nextInt(900) + 100);
+//        } else {
+//            lastTimestamp = timestamp;  // 鏇存柊鏈�鍚庣敓鎴愭椂闂存埑
+//            return String.format("%09d", (timestamp % 1000000000) + random.nextInt(900) + 100);
+//        }
+//    }
+
+
+    public  synchronized String getTjNumber() {
+        String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
+        String storedDate = stringRedisTemplate.opsForValue().get(LIS_CURRENT_DATE_KEY);
+        String lastIdStr = stringRedisTemplate.opsForValue().get(TJH_LAST_ID_KEY);
+        if (StrUtil.isBlank(lastIdStr))lastIdStr = "0";
+        int lastId;
+        if (storedDate == null || !storedDate.equals(currentDate)) {
+            lastId = 1;
+            stringRedisTemplate.opsForValue().set(TJH_LAST_ID_KEY, String.valueOf(lastId));
+            stringRedisTemplate.opsForValue().set(LIS_CURRENT_DATE_KEY, currentDate);
+        } else {
+            lastId = Integer.parseInt(lastIdStr) + 1;
+            stringRedisTemplate.opsForValue().set(TJH_LAST_ID_KEY, String.valueOf(lastId));
+        }
+        String yyMMdd = currentDate.substring(2);
+        return String.format("%s%05d", yyMMdd, lastId);
+    }
+
+
+//    浣跨敤鍒嗗竷寮廔D鐢熸垚鍣紙濡係nowflake锛�
+    public static String generateExamNumber() {
+//        long id = uidGenerator.getUID();  // 鑾峰彇鐢熸垚鐨勫敮涓�ID
+//        return String.format("%09d", Math.abs(id) % 1000000000);  // 鏍煎紡鍖栦负9浣�
+        return null;
+    }
+
+
+//    redis鍒嗗竷寮忛攣
+    public String getNewTjNumberRedisLock() {
+        String lockKey = "lock:tjh:tj_number_lock";
+        String lockValue = UUID.randomUUID().toString();
+
+        Boolean locked = stringRedisTemplate.opsForValue().setIfAbsent(lockKey, lockValue, 5, TimeUnit.SECONDS);
+
+        if (Boolean.TRUE.equals(locked)) {
+            try {
+                String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
+                String storedDate = stringRedisTemplate.opsForValue().get(LIS_CURRENT_DATE_KEY);
+
+                if (storedDate == null || !storedDate.equals(currentDate)) {
+                    // 鏃ユ湡鍙樻洿锛岄噸缃� Redis 璁℃暟鍣�
+                    stringRedisTemplate.opsForValue().set(TJH_LAST_ID_KEY, "1", 1, TimeUnit.DAYS);
+                    stringRedisTemplate.opsForValue().set(LIS_CURRENT_DATE_KEY, currentDate, 1, TimeUnit.DAYS);
+                    return String.format("%s%05d", currentDate.substring(2), 1);
+                }
+
+                // 浣跨敤 Redis INCR 纭繚鍞竴鎬�
+                long lastId = stringRedisTemplate.opsForValue().increment(TJH_LAST_ID_KEY);
+                return String.format("%s%05d", currentDate.substring(2), lastId);
+            } finally {
+                // 閲婃斁閿侊紙纭繚鏄綋鍓嶇嚎绋嬫寔鏈夌殑閿佹墠鍒犻櫎锛�
+                String currentLockValue = stringRedisTemplate.opsForValue().get(lockKey);
+                if (lockValue.equals(currentLockValue)) {
+                    stringRedisTemplate.delete(lockKey);
+                }
+            }
+        } else {
+            throw new RuntimeException("鑾峰彇娴佹按鍙峰け璐ワ紝璇烽噸璇�");
+        }
+    }
+
+//redis鍒嗗竷寮忛攣鍜孧ySQL鍏敤
+    public String getNewTjNumberRedisLockAndMysql() {
+        String lockKey = "lock:tjh:tj_number_lock";
+        RLock lock = redissonClient.getLock(lockKey);
+
+        try {
+            if (lock.tryLock(5, 10, TimeUnit.SECONDS)) {
+                String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
+
+                // 1. 鍏堜粠 Redis 鑾峰彇缂栧彿
+                String storedDate = stringRedisTemplate.opsForValue().get(LIS_CURRENT_DATE_KEY);
+                String lastIdStr = stringRedisTemplate.opsForValue().get(TJH_LAST_ID_KEY);
+
+                // 2. 濡傛灉 Redis 涓病鏈夋垨鑰呯紪鍙蜂涪澶憋紝鏌ヨ鏁版嵁搴撳苟鍚屾鍒� Redis
+                if (storedDate == null || !storedDate.equals(currentDate) || lastIdStr == null) {
+                    Integer lastIdFromDb = orderNumberMapper.getLastId(currentDate,lockKey);
+                    lastIdFromDb = (lastIdFromDb == null) ? 0 : lastIdFromDb;
+
+                    // 鍚屾鍒� Redis
+                    stringRedisTemplate.opsForValue().set(TJH_LAST_ID_KEY, String.valueOf(lastIdFromDb), 1, TimeUnit.DAYS);
+                    stringRedisTemplate.opsForValue().set(LIS_CURRENT_DATE_KEY, currentDate, 1, TimeUnit.DAYS);
+                }
+
+                // 3. 浣跨敤 Redis 鐨� INCR 淇濊瘉娴佹按鍙峰敮涓�
+                long lastId = stringRedisTemplate.opsForValue().increment(TJH_LAST_ID_KEY);
+
+                // 4. 鍚屾椂鏇存柊鏁版嵁搴擄紝纭繚涓�鑷存��
+                orderNumberMapper.updateLastId(currentDate, (int) lastId,lockKey);
+
+                return String.format("%s%05d", currentDate.substring(2), lastId);
+            } else {
+                throw new RuntimeException("鑾峰彇浣撴鍙峰け璐ワ紝璇烽噸璇�");
+            }
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        } finally {
+            if (lock.isHeldByCurrentThread()) {
+                lock.unlock();
+            }
+        }
+    }
+
+
+
+}
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/OrderNumberMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/OrderNumberMapper.java
new file mode 100644
index 0000000..94510bb
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/OrderNumberMapper.java
@@ -0,0 +1,17 @@
+package com.ltkj.hosp.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.poi.ss.formula.functions.T;
+
+@Mapper
+public interface OrderNumberMapper extends BaseMapper<T> {
+    @Select("SELECT max(last_id) FROM order_number WHERE date_key = #{dateKey} and fl=#{fl}")
+    Integer getLastId(@Param("dateKey") String dateKey,@Param("fl") String fl);
+
+    @Insert("INSERT INTO order_number(date_key, last_id,fl) VALUES(#{dateKey}, #{lastId},#{fl}) ON DUPLICATE KEY UPDATE last_id = #{lastId}")
+    void updateLastId(@Param("dateKey") String dateKey, @Param("lastId") int lastId,@Param("fl") String fl);
+}
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java
index 494690f..2bda91c 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java
@@ -145,7 +145,7 @@
     @Select("SELECT * FROM tj_order WHERE user_id = #{cusId} AND deleted='0' ORDER BY create_time DESC")
     public List<TjOrder> getOrderListByCusId(@Param("cusId") String cusId);
 
-    @Select("SELECT * FROM tj_order WHERE tj_number = #{tjNum} AND deleted='0' ")
+    @Select("SELECT * FROM tj_order WHERE tj_number = #{tjNum} AND deleted=0 ")
     public TjOrder getOrderByTjNum(String tjNum);
 
     @Select("SELECT * FROM tj_order WHERE card_id = #{cardId} AND deleted='0' ")
@@ -389,4 +389,8 @@
 
 
     List<List<?>> getYxJcList(Map<String,Object> map);
+
+
+    @Select("SELECT count(*) FROM tj_order WHERE tj_number = #{tjNum}")
+    int getOrderCountByTjNum(String tjNum);
 }
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjOrderService.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjOrderService.java
index 018c85f..20debd9 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjOrderService.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjOrderService.java
@@ -163,6 +163,8 @@
     List<String> getHuoQuBlZlsqdh(String cardId, String bldh);
     Boolean delHuoQuZlsqdh(String cardId, String bldh);
 
+    int getOrderCountByTjNum(String tjNum);
+
     Map<String,Object> getgetBghsList(String tjNumber, Integer page, Integer pageSize, String value, String beginTime, String endTime, String name);
 
 
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjOrderServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjOrderServiceImpl.java
index 2225356..01480b4 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjOrderServiceImpl.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjOrderServiceImpl.java
@@ -358,6 +358,11 @@
     }
 
     @Override
+    public int getOrderCountByTjNum(String tjNum) {
+        return tjOrderMapper.getOrderCountByTjNum(tjNum);
+    }
+
+    @Override
     public Map<String, Object> getgetBghsList(String tjNumber, Integer page, Integer pageSize,
                                               String compId, String beginTime, String endTime, String tjname) {
         Map<String, Object> map = new HashMap<>();
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSamplingServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSamplingServiceImpl.java
index 18c3ed1..1cc25ec 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSamplingServiceImpl.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjSamplingServiceImpl.java
@@ -1,19 +1,14 @@
 package com.ltkj.hosp.service.impl;
 
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ltkj.common.core.domain.AjaxResult;
 import com.ltkj.common.utils.DateUtils;
-import com.ltkj.common.utils.IdUtils;
-import com.ltkj.hosp.domain.TjCustomer;
-import com.ltkj.hosp.domain.TjOrder;
+import com.ltkj.hosp.idutil.IdUtils;
 import com.ltkj.hosp.service.ITjCustomerService;
 import com.ltkj.hosp.service.ITjOrderService;
 import lombok.extern.slf4j.Slf4j;
@@ -169,55 +164,59 @@
     }
 
     private AjaxResult mergeCaiYang(List<String> ids,String prefix) {
-        if (null != ids && !ids.isEmpty()) {
-            if(ids.size()==1) return AjaxResult.error("璇烽�夋嫨鑷冲皯涓ゆ潯椤圭洰杩涜鍚堝苟!");
-            int i = panduanshifoukeyihebing(ids);
-            if (i > 1) {
-                return AjaxResult.error("鏍囨湰绫诲瀷涓嶄竴鑷�,涓嶅彲鍚堝苟");
-            }
-            int pdsfczhbxm = pdsfczhbxm(ids);
-            if (pdsfczhbxm == ids.size()) return AjaxResult.error("澶氫釜鍚堝苟椤圭洰涓嶅彲鍐嶇户缁悎骞�!");
-            if (pdsfczhbxm > 1) return AjaxResult.error("鏈�澶氬厑璁搁�夋嫨涓�涓悎骞惰繃鐨勯」鐩�!");
-//            鏌ヨ鍑洪噷闈笉鍙悎骞剁殑鍖栭獙椤圭洰
-            String string = getBuKeHebingProName(ids);
-            if(null !=string){
-                return AjaxResult.error(string + "杩欏嚑涓」鐩笉鍙悎骞�!");
-            }
-            if (pdsfczhbxm == 0) {
-                TjSampling tjSampling = getById(ids.get(0));
-                Map<String, Object> map = hebingCaiYangInFo(ids);
-                TjSampling sampling = new TjSampling();
-                String proId = map.get("proId").toString();
-                String proName = map.get("proName").toString();
-                BeanUtil.copyProperties(tjSampling, sampling, new String[]{"id"});
-                sampling.setProId(proId);
-                sampling.setProName(proName);
-                sampling.setIsMerge(1);
-                sampling.setJyxh(idUtils.generateLisID(prefix));
-                if (save(sampling)) {
-                    if (updateHeBingXm(ids, sampling.getId())) {
-                        return AjaxResult.success("鍚堝苟椤圭洰鎴愬姛!", sampling.getId());
-                    }
+        try {
+            if (null != ids && !ids.isEmpty()) {
+                if(ids.size()==1) return AjaxResult.error("璇烽�夋嫨鑷冲皯涓ゆ潯椤圭洰杩涜鍚堝苟!");
+                int i = panduanshifoukeyihebing(ids);
+                if (i > 1) {
+                    return AjaxResult.error("鏍囨湰绫诲瀷涓嶄竴鑷�,涓嶅彲鍚堝苟");
                 }
-                return AjaxResult.error("鎿嶄綔澶辫触!");
-            } else {
-                TjSampling tjSampling = getTjSamplingByHb(ids);
-                List<TjSampling> samplingList = getTjSamplingListByHb(ids);
-                if (null != tjSampling && null != samplingList && !samplingList.isEmpty()) {
-                    List<String> stringList = samplingList.stream().map(TjSampling::getId).collect(Collectors.toList());
-                    Map<String, Object> map = hebingCaiYangInFo(stringList);
+                int pdsfczhbxm = pdsfczhbxm(ids);
+                if (pdsfczhbxm == ids.size()) return AjaxResult.error("澶氫釜鍚堝苟椤圭洰涓嶅彲鍐嶇户缁悎骞�!");
+                if (pdsfczhbxm > 1) return AjaxResult.error("鏈�澶氬厑璁搁�夋嫨涓�涓悎骞惰繃鐨勯」鐩�!");
+    //            鏌ヨ鍑洪噷闈笉鍙悎骞剁殑鍖栭獙椤圭洰
+                String string = getBuKeHebingProName(ids);
+                if(null !=string){
+                    return AjaxResult.error(string + "杩欏嚑涓」鐩笉鍙悎骞�!");
+                }
+                if (pdsfczhbxm == 0) {
+                    TjSampling tjSampling = getById(ids.get(0));
+                    Map<String, Object> map = hebingCaiYangInFo(ids);
+                    TjSampling sampling = new TjSampling();
                     String proId = map.get("proId").toString();
                     String proName = map.get("proName").toString();
-                    tjSampling.setProId(proId);
-                    tjSampling.setProName(proName);
-                    if (updateById(tjSampling)) {
-                        if (updateHeBingXm(stringList, tjSampling.getParentId())) {
-                            return AjaxResult.success("鍚堝苟椤圭洰鎴愬姛!", tjSampling.getId());
+                    BeanUtil.copyProperties(tjSampling, sampling, new String[]{"id"});
+                    sampling.setProId(proId);
+                    sampling.setProName(proName);
+                    sampling.setIsMerge(1);
+                    sampling.setJyxh(idUtils.generateLisID(prefix));
+                    if (save(sampling)) {
+                        if (updateHeBingXm(ids, sampling.getId())) {
+                            return AjaxResult.success("鍚堝苟椤圭洰鎴愬姛!", sampling.getId());
                         }
                     }
+                    return AjaxResult.error("鎿嶄綔澶辫触!");
+                } else {
+                    TjSampling tjSampling = getTjSamplingByHb(ids);
+                    List<TjSampling> samplingList = getTjSamplingListByHb(ids);
+                    if (null != tjSampling && null != samplingList && !samplingList.isEmpty()) {
+                        List<String> stringList = samplingList.stream().map(TjSampling::getId).collect(Collectors.toList());
+                        Map<String, Object> map = hebingCaiYangInFo(stringList);
+                        String proId = map.get("proId").toString();
+                        String proName = map.get("proName").toString();
+                        tjSampling.setProId(proId);
+                        tjSampling.setProName(proName);
+                        if (updateById(tjSampling)) {
+                            if (updateHeBingXm(stringList, tjSampling.getParentId())) {
+                                return AjaxResult.success("鍚堝苟椤圭洰鎴愬姛!", tjSampling.getId());
+                            }
+                        }
+                    }
+                    return AjaxResult.error("鎿嶄綔澶辫触!");
                 }
-                return AjaxResult.error("鎿嶄綔澶辫触!");
             }
+        } catch (Exception e) {
+            log.error(e.getMessage());
         }
         return AjaxResult.error("璇烽�夋嫨浣犺鍚堝苟鐨勯」鐩�!!!");
     }

--
Gitblit v1.8.0