From 59363c48a5977f4df327d87085d4c565c06bc96c Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期五, 27 九月 2024 08:39:04 +0800
Subject: [PATCH] zjh20240927  修改驾驶员体检登记失败的问题

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java |  175 +++++++++++++++-------------------------------------------
 1 files changed, 46 insertions(+), 129 deletions(-)

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 163de7f..1e33d91 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
@@ -20,7 +20,9 @@
 
 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.RandomUtil;
 import cn.hutool.crypto.symmetric.DES;
 import cn.hutool.extra.pinyin.PinyinUtil;
 import cn.hutool.json.JSONArray;
@@ -38,6 +40,8 @@
 import com.ltkj.common.core.domain.entity.SysUser;
 import com.ltkj.common.core.redis.RedisCache;
 import com.ltkj.common.enums.DataSourceType;
+import com.ltkj.common.utils.AgeResult;
+import com.ltkj.common.utils.DateUtils;
 import com.ltkj.common.utils.PDFDocumentUtil;
 import com.ltkj.common.utils.SecurityUtils;
 import com.ltkj.framework.config.MatchUtils;
@@ -50,6 +54,7 @@
 import com.ltkj.hosp.hisDto.OutpinimpapplyDto;
 import com.ltkj.hosp.hisDto.OutpinmedicapplyDto;
 import com.ltkj.hosp.mapper.TestMapper;
+import com.ltkj.hosp.pacsDto.SavePacsApply;
 import com.ltkj.hosp.service.*;
 import com.ltkj.hosp.sqlDomain.LtkjMiddleDetail;
 import com.ltkj.hosp.sqlDomain.LtkjMiddleHead;
@@ -71,10 +76,13 @@
 import com.ltkj.web.controller.his.HisApiMethod;
 import com.ltkj.web.controller.his.HisApiMethodService;
 import com.ltkj.web.controller.his.HisMzJysqController;
+import com.ltkj.web.controller.lis.LisApiMethod;
+import com.ltkj.web.controller.pacs.PacsApiMethodService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 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;
@@ -198,6 +206,12 @@
     private TjProBlService blService;
     @Autowired
     private LtkjJianchajianyanTreeService ltkjJianchajianyanTreeService;
+    @Autowired
+    private PacsApiMethodService pacsApiMethodService;
+    @Autowired
+    private ITbTransitionService tbTransitionService;
+    @Autowired
+    private LisApiMethod lisApiMethod;
 
     @Autowired
     private TjCfService cfService;
@@ -516,7 +530,7 @@
             LambdaQueryWrapper<TjCustomer> wqq = new LambdaQueryWrapper<>();
             wqq.like(TjCustomer::getCusName, name);
             List<TjCustomer> customerList = tjCustomerService.list(wqq);
-            if (null != customerList && customerList.size() > 0) {
+            if (null != customerList && !customerList.isEmpty()) {
                 List<TjOrder> list = new ArrayList<>();
                 for (TjCustomer customer : customerList) {
                     LambdaQueryWrapper<TjOrder> wq = new LambdaQueryWrapper<>();
@@ -526,7 +540,7 @@
                     list.addAll(tjOrderService.list(wq));
                 }
                 List<TjOrder> collect = null;
-                if (list.size() > 0) {
+                if (!list.isEmpty()) {
 
                     for (int i = 0; i < list.size(); i++) {
                         TjCustomer tjCustomer = tjCustomerService.getById(list.get(i).getUserId());
@@ -536,7 +550,7 @@
                         }
                         list.get(i).setTjCustomerSex(tjCustomer.getCusSex());
                         list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
-                        list.get(i).setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName()));
+                        list.get(i).setTjCustomerName(tjCustomer.getCusName());
                         list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone()));
                         list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard()));
 
@@ -597,7 +611,7 @@
                 }
                 list.get(i).setTjCustomerSex(tjCustomer.getCusSex());
                 list.get(i).setTjCustomerAge(DateUtil.ageOfNow(tjCustomer.getCusBrithday()));
-                list.get(i).setTjCustomerName(MatchUtils.hideCusName(tjCustomer.getCusName()));
+                list.get(i).setTjCustomerName(tjCustomer.getCusName());
                 list.get(i).setTjCustomerPhone(MatchUtils.hidePhoneNum(tjCustomer.getCusPhone()));
                 if (tjCustomer.getCusIdcard() != null) {
                     list.get(i).setTjCusIdCard(MatchUtils.hideIdCardNum(tjCustomer.getCusIdcard()));
@@ -893,7 +907,7 @@
             return AjaxResult.error("涓嶅彲閲嶅鐧昏");
         }
 
-
+        TjFlowingWater tjFlowingWater = new TjFlowingWater();
         LambdaQueryWrapper<TjReservation> wq1 = new LambdaQueryWrapper<>();
         wq1.eq(TjReservation::getIdCard, tjCustomer.getCusIdcard());
         wq1.eq(TjReservation::getIsExpire, 2);
@@ -958,7 +972,11 @@
             tjOrder.setFinishTime(new Date());
             tjOrder.setCheckStatus(1);
             tjOrder.setStatus(TjConstants.TJ_WAIT);
+//            tjFlowingWater.setPayStasus(1L);
         }
+//        else {
+            tjFlowingWater.setPayStasus(0L);
+//        }
         if (tjOrderService.save(tjOrder)) {
 
             //淇濆瓨鏀惰揣鍦板潃
@@ -973,8 +991,7 @@
             cusNumber += 1;
             tjCustomer.setCusNumber(cusNumber);
             BigDecimal discount = BigDecimal.valueOf(Double.parseDouble(tjOrder.getTjFlowingWater().getDiscount()));
-            TjFlowingWater tjFlowingWater = new TjFlowingWater();
-            tjFlowingWater.setPayStasus(0L);
+
             if ("1".equals(tjOrder.getTjType())) {
                 if (null != tjReservation && tjReservation.getPayType() == 1) {
                     tjFlowingWater.setPayStasus(3L);
@@ -1032,8 +1049,6 @@
             if (tjFlowingWaterService.save(tjFlowingWater)) {
                 tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber()));
                 tjOrderService.updateById(tjOrder);
-
-
             }
 
             //淇敼姣忛」鐨勫師浠风幇浠� //淇敼涓存椂琛ㄤ綋妫�鍙�
@@ -1049,6 +1064,7 @@
                     if(null !=jzh && null !=jzh.toString()){
                         hisApiMethod.ZfHisApiMethod(jzh.toString());
                     }
+                    log.info("璇ョ櫥璁颁汉鎸傚彿澶辫触, 灏辫瘖鍙蜂负: "+tjOrder.getCardId());
                     return AjaxResult.error("鎸傚彿澶辫触!" + result.get("msg").toString());
                 }
 
@@ -1062,7 +1078,19 @@
                     //asyncService.newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater);
                     newSaveextracted(tjOrder, tjCustomer, discount, sysUser, tjReservation, tjFlowingWater);
                 }
-                hisApiMethod.tijianshenqing(tjCustomer,DateUtil.format(date1,"yyyy-MM-dd HH:mm:ss"),tjOrder.getCardId());
+                // 鏌ヨ 瀵规帴Lis銆丳acs鐢宠濡傛灉绫诲瀷鍖呭惈鍦ㄩ厤缃唴鍒欎娇鐢ㄥ鎺is銆乸acs
+//                String useLisAndPacsRegisterDictTeam = configService.selectConfigByKey("use_lis_and_pacs_register_dict_team");
+//                String[] split = useLisAndPacsRegisterDictTeam.split(",");
+//                List<String> list = Arrays.asList(split);
+//                if (list.contains(tjOrder.getTjType())) {
+//                    List<TbTransition> detailList = tbTransitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(),tjOrder.getCardId());
+//                    pacsApiMethodService.save(tjOrder,tjCustomer,detailList);
+//                    lisApiMethod.save(tjOrder,tjCustomer,detailList);
+//                }else {
+//                    hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId());
+//                }
+
+                hisApiMethod.tijianshenqing(tjCustomer, DateUtil.format(date1, "yyyy-MM-dd HH:mm:ss"), tjOrder.getCardId());
 
                 return AjaxResult.success(tjNumber);
             } else {
@@ -1554,143 +1582,32 @@
                 redisCache.deleteCacheMapValue(cardId + cusId + "cusId", cardId + cusId);
             }
         }
-//        List<TbTransition> tbTransitionList = null;
-//        if (!redisCache.hasKey(cardId + cusId)) {
-//            tbTransitionList = new ArrayList<>();
-//        } else {
-//            tbTransitionList = redisCache.getCacheList(cardId + cusId);
-//        }
-        //濂楅
         /*濂楅*/
         if (null != packId && !packId.equals("")) {
             Long pacId = Long.valueOf(packId.toString());
             List<TbTransition> list = transitionService.getTbTransitionListByCusIdAndPac(cusId, String.valueOf(pacId));
-            if (null == list || list.size() == 0) {
+            if (null == list || list.isEmpty()) {
                 transitionService.deletedTbTransitionListByCusIdAndPac(cusId, cardId);
-//                if (redisCache.hasKey(cardId + cusId + "cusId"))
-//                    redisCache.deleteCacheMapValue(cardId + cusId + "cusId", cardId + cusId);
-//                if (redisCache.hasKey(cardId + cusId)) {
-//                    tbTransitionList = new ArrayList<>();
-//                    redisCache.deleteObject(cardId + cusId);
-//                }
                 List<TjPackageProject> ppList = tjPackageProjectService.getTjPackageProjectListByPacId(String.valueOf(pacId));
-                if (null != ppList && ppList.size() > 0) {
+                if (null != ppList && !ppList.isEmpty()) {
                     transitionService.saveRedisTransitionByPacId(cusId, cardId, pacId);
-                    //寮傛淇濆瓨鏁版嵁搴�
-//                    asyncService.addRedisTransitionPac(cusId, pacId, ppList);
-//                    asyncService.saveRedisTransitionByPacId(cusId, cardId, pacId, null);
-//                    for (TjPackageProject tjPackageProject : ppList) {
-//                        TjProject project = projectService.getTjProjectById(String.valueOf(tjPackageProject.getProId()));
-//                        if (null != project) {
-//
-//                            BigDecimal divide = BigDecimal.valueOf(0);
-//                            if (tjPackageProject.getPriceNow().compareTo(BigDecimal.valueOf(0)) == 0 || project.getProPrice().compareTo(BigDecimal.valueOf(0)) == 0) {
-//                                divide = BigDecimal.valueOf(0);
-//                            } else {
-//                                divide = tjPackageProject.getPriceNow().divide(project.getProPrice(), 5, RoundingMode.HALF_DOWN);
-//                            }
-//                            List<TjProject> tjProSonList = projectService.getTjProjectListBySoneId(String.valueOf(project.getProId()));
-//                            if (null != tjProSonList && tjProSonList.size() > 0) {
-//                                //addRedisTransitionPac(cusId, tbTransitionList, pacId, tjPackageProject, project, divide, tjProSonList);
-//                                for (TjProject tjProject : tjProSonList) {
-//                                    TbTransition tbTransition = new TbTransition();
-//                                    tbTransition.setCusId(cusId);
-//                                    tbTransition.setPacId(pacId);
-//                                    if (null != tjPackageProject.getPriceNow() && divide.compareTo(BigDecimal.valueOf(0)) > 0) {
-//                                        tbTransition.setNowPrice(tjProject.getProPrice().multiply(divide).setScale(2, RoundingMode.HALF_DOWN));
-//                                        tbTransition.setOrdPrice(tjProject.getProPrice().multiply(divide).setScale(2, RoundingMode.HALF_DOWN));
-//                                    } else {
-//                                        tbTransition.setNowPrice(BigDecimal.valueOf(0.00));
-//                                        tbTransition.setOrdPrice(BigDecimal.valueOf(0.00));
-//                                    }
-//                                    tbTransition.setParentProId(project.getProId());
-//                                    tbTransition.setParentProName(project.getProName());
-//                                    tbTransition.setProId(tjProject.getProId());
-//                                    tbTransition.setProName(tjProject.getProName());
-//                                    tbTransition.setPacName(tjPackageService.getById(tbTransition.getPacId()).getPacName());
-//                                    tbTransition.setProType(tjProject.getProType());
-//                                    tbTransition.setProCheckMethod(tjProject.getProCheckMethod());
-//                                    tbTransitionList.add(tbTransition);
-//                                }
-//
-//                            }
-//                        }
-//                    }
                 }
             }
         }
 
         //鍗曢」
-        if (null != proIds && proIds.size() > 0) {
+        if (null != proIds && !proIds.isEmpty()) {
             //寮傛淇濆瓨鏁版嵁搴撹〃
-//            asyncService.saveRedisTransitionByPacId(cusId, cardId, null, proIds);
             for (Long proId : proIds) {
                 TjProject project = projectService.selectTjProjectByProId(proId);
-                if (null != project) { //&& (!project.getProName().contains("闈欒剦閲囪")|| !project.getProName().contains("璐�"))
+                if (null != project) {
                     List<TbTransition> transitionList = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId));
-                    if (null == transitionList || transitionList.size() == 0) {
+                    if (null == transitionList || transitionList.isEmpty()) {
                         transitionService.saveRedisTransitionByProId(cusId, cardId, proId);
                     }
                 }
-//            if(null !=project) transitionService.saveRedisTransitionByProId(cusId,cardId, proId);
             }
-//            for (Long proId : proIds) {
-//                List<TbTransition> transitions = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId));
-//                if (null != transitions && transitions.size() > 0) {
-//                    continue;
-//                }
-//                TjProject tjProject = projectService.getTjProjectById(String.valueOf(proId));
-//                if (null != tjProject) {
-////                    List<TjProject> tjProSonList = projectService.getTjProjectListBySoneId(String.valueOf(project.getProId()));
-////                    if (null != tjProSonList && tjProSonList.size() > 0) {
-////                        for (TjProject tjProject : tjProSonList) {
-////                    List<TbTransition> transitionss = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(tjProject.getProId()));
-////                    if (null != transitionss && transitionss.size() > 0) {
-////                        continue;
-////                    }
-//                    TbTransition tbTransition = new TbTransition();
-//                    tbTransition.setCusId(cusId);
-//                    tbTransition.setPacId(null);
-//                    if (null != tjProject.getProPrice()) {
-//                        tbTransition.setOrdPrice(tjProject.getProPrice());
-//                        tbTransition.setNowPrice(tjProject.getProPrice());
-//                    } else {
-//                        tbTransition.setOrdPrice(BigDecimal.valueOf(0.00));
-//                        tbTransition.setNowPrice(BigDecimal.valueOf(0.00));
-//                    }
-//                    tbTransition.setParentProId(tjProject.getProParentId());
-//                    if (tjProject.getProParentId() != null) {
-//                        TjProject byId = projectService.getById(tjProject.getProParentId());
-//                        if (null != byId) {
-//                            tbTransition.setParentProName(byId.getProName());
-//                        }
-//                    }
-//                    tbTransition.setParentProName("");
-//
-//                    tbTransition.setProId(tjProject.getProId());
-//                    tbTransition.setProName(tjProject.getProName());
-//                    tbTransition.setProType(tjProject.getProType());
-//                    tbTransition.setProCheckMethod(tjProject.getProCheckMethod());
-//                    tbTransitionList.add(tbTransition);
-////                        }
-////                    }
-//                }
-//            }
         }
-
-
-//        if (null != tbTransitionList && tbTransitionList.size() > 0) {
-//            if (redisCache.hasKey(cardId + cusId)) {
-//                redisCache.deleteObject(cardId + cusId);
-//                redisCache.setCacheList(cardId + cusId, tbTransitionList);
-//                redisCache.setCacheMapValue(cardId + cusId + "cusId", cardId + cusId, getMaps(cusId, cardId));
-//            } else {
-//                redisCache.setCacheList(cardId + cusId, tbTransitionList);
-//                redisCache.setCacheMapValue(cardId + cusId + "cusId", cardId + cusId, getMaps(cusId, cardId));
-//            }
-//            List<Map<String, Object>> map1 = getMap(cusId, cardId, tbTransitionList);
-//            return AjaxResult.success();
-//        }
         return AjaxResult.success();
     }
 
@@ -1923,7 +1840,6 @@
                 dto.setJzqk(9);
                 controller.Outpinimpapply(dto);
             }*/
-
             return AjaxResult.success("绛剧鎴愬姛锛�");
         } else {
             return getAjaxResult(tjNumber);
@@ -2361,7 +2277,8 @@
     public void newSaveextracted(TjOrder tjOrder, TjCustomer tjCustomer, BigDecimal discount, SysUser sysUser, TjReservation tjReservation, TjFlowingWater tjFlowingWater) {
         tjAskMedicalHistoryService.updateTjAskMedicalHistoryByCusId(tjOrder.getTjNumber(), sysUser.getNickName(), String.valueOf(sysUser.getUserId()), String.valueOf(tjCustomer.getCusId()));
         if (null != tjOrder.getTjCategory() && tjOrder.getTjCategory().equals("13")) {
-            tjOrderDetailService.saveJSYTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()),tjOrder.getCardId());
+            tjOrderDetailService.saveJSYTjOrderDetailsByCusId(tjCustomer.getCusIdcard(),
+                    String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()),tjOrder.getCardId(),String.valueOf(tjFlowingWater.getTjSerialNumber()));
         } else {
             tjOrderDetailService.saveTjOrderDetailsByCusId(tjCustomer.getCusIdcard(), String.valueOf(tjOrder.getOrderId()), sysUser.getNickName(), String.valueOf(sysUser.getUserId()),tjOrder.getCardId());
         }
@@ -2390,7 +2307,7 @@
             tjFlowingWater.setCopeWith(tjOrder.getTjFlowingWater().getCopeWith());
             tjFlowingWater.setPayType(4L);
             tjFlowingWaterService.updateById(tjFlowingWater);
-            asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser);
+//            asyncService.addTjChargingStandard(tjOrder, transitionService.getTbTransitionListByCusId(tjCustomer.getCusIdcard(), tjOrder.getCardId()), sysUser);
         }
     }
 

--
Gitblit v1.8.0