From 6c9e1bdb612fead54a204561c1d5c796ab5bc830 Mon Sep 17 00:00:00 2001
From: zjh <zjh@888>
Date: 星期五, 21 六月 2024 15:46:42 +0800
Subject: [PATCH] zjh 本地 2024/06/21 --1

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjOrderController.java |  121 ++++++++++++++++++++++++++++++----------
 1 files changed, 91 insertions(+), 30 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 eacdf66..683b6a5 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
@@ -856,7 +856,7 @@
 //        }
         TjOrder order = tjOrderService.getOne(wqq);
         if (null != order) {
-            transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(),tjCustomer.getCardId());
+            transitionService.deletedTbTransitionListByCusIdAndTjNum(tjCustomer.getCusIdcard(), tjCustomer.getCardId());
             return AjaxResult.error("涓嶅彲閲嶅鐧昏");
         }
 
@@ -1034,18 +1034,18 @@
 
             /*璋冪敤his鎺ュ彛*/
             String config = configService.selectConfigByKey("sfkqdyhis");
-            if(null !=config && config.equals("Y")){
+            if (null != config && config.equals("Y")) {
                 AjaxResult result = hisApiMethod.HisApiMethods(tjCustomer, tjOrder.getOrderId());
-                if(!result.get("code").toString().equals("200")){
+                if (!result.get("code").toString().equals("200")) {
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                    return AjaxResult.error("鎸傚彿澶辫触!"+result.get("msg").toString());
+                    return AjaxResult.error("鎸傚彿澶辫触!" + result.get("msg").toString());
                 }
-            }else {
-            tjCustomer.setCardId(tjOrder.getTjNumber());
-            tjCustomerService.updateById(tjCustomer);
-            transitionService.updateCardIdByTjNumAndIdCard(tjCustomer.getCusIdcard(),tjOrder.getTjNumber(),tjOrder.getTjNumber());
-            tjOrder.setCardId(tjOrder.getTjNumber());
-             tjOrderService.updateById(tjOrder);
+            } else {
+                tjCustomer.setCardId(tjOrder.getTjNumber());
+                tjCustomerService.updateById(tjCustomer);
+                transitionService.updateCardIdByTjNumAndIdCard(tjCustomer.getCusIdcard(), tjOrder.getTjNumber(), tjOrder.getTjNumber());
+                tjOrder.setCardId(tjOrder.getTjNumber());
+                tjOrderService.updateById(tjOrder);
             }
             return AjaxResult.success(tjNumber);
         }
@@ -1056,7 +1056,7 @@
     @PostMapping("/addPlOrderAndDetail")
     @ApiOperation(value = "浣撴鎵归噺绛惧埌鐧昏鎺ュ彛")
     @Transactional  //(鍒囨崲鏁版嵁搴撳嚭閿欙紝鎵�浠ユ敞閲�)
-    public AjaxResult addPlOrderAndDetail(@RequestBody QianDaoDto daoDto,HttpServletResponse response) {
+    public AjaxResult addPlOrderAndDetail(@RequestBody QianDaoDto daoDto, HttpServletResponse response) {
         SysUser sysUser = UserHoder.getLoginUser().getUser();
         List<String> cusIds = daoDto.getCusIds();
         ArrayList<String> tjNumbers = new ArrayList<>();
@@ -1441,7 +1441,7 @@
 
                 tjCustomer.setCardId("0");
                 tjCustomerService.updateById(tjCustomer);
-                return AjaxResult.success().put("tjNumber",tjNumber);
+                return AjaxResult.success().put("tjNumber", tjNumber);
             }
         }
         return AjaxResult.error();
@@ -1540,7 +1540,7 @@
                 if (null != ppList && ppList.size() > 0) {
                     //寮傛淇濆瓨鏁版嵁搴�
 //                    asyncService.addRedisTransitionPac(cusId, pacId, ppList);
-                    asyncService.saveRedisTransitionByPacId(cusId,cardId, pacId, null);
+                    asyncService.saveRedisTransitionByPacId(cusId, cardId, pacId, null);
                     for (TjPackageProject tjPackageProject : ppList) {
                         TjProject project = projectService.getTjProjectById(String.valueOf(tjPackageProject.getProId()));
                         if (null != project) {
@@ -1585,7 +1585,7 @@
         //鍗曢」
         if (null != proIds && proIds.size() > 0) {
             //寮傛淇濆瓨鏁版嵁搴撹〃
-            asyncService.saveRedisTransitionByPacId(cusId,cardId,null, proIds);
+            asyncService.saveRedisTransitionByPacId(cusId, cardId, null, proIds);
             for (Long proId : proIds) {
                 List<TbTransition> transitions = transitionService.getTbTransitionListByCusIdAndPacIdAndProId(cusId, String.valueOf(proId));
                 if (null != transitions && transitions.size() > 0) {
@@ -1918,7 +1918,7 @@
         for (Map.Entry<Long, List<TbTransition>> entry : collect.entrySet()) {
             Map<String, Object> map = new HashMap<>();
             Long pacId = entry.getValue().get(0).getPacId();
-            map.put("proPrantId",entry.getKey().toString());
+            map.put("proPrantId", entry.getKey().toString());
             if (null != pacId) {
                 TjPackage aPackage = tjPackageService.getById(entry.getValue().get(0).getPacId());
                 map.put("pacName", aPackage.getPacName());
@@ -1954,7 +1954,7 @@
     }
 
 
-    private List<Map<String, Object>> getMap(String cusId, String cardId,List<TbTransition> transitionList) {
+    private List<Map<String, Object>> getMap(String cusId, String cardId, List<TbTransition> transitionList) {
 
 //        List<TbTransition> transitionList = null;
 //        if (redisCache.hasKey(cardId + cusId)) {
@@ -1968,7 +1968,7 @@
         for (Map.Entry<Long, List<TbTransition>> entry : collect.entrySet()) {
             Map<String, Object> map = new HashMap<>();
             Long pacId = entry.getValue().get(0).getPacId();
-            map.put("proPrantId",entry.getKey().toString());
+            map.put("proPrantId", entry.getKey().toString());
             if (null != pacId) {
                 TjPackage aPackage = tjPackageService.getById(entry.getValue().get(0).getPacId());
                 map.put("pacName", aPackage.getPacName());
@@ -2395,39 +2395,41 @@
             remarkService.deletedOrderRemarkByTjNum(tjNum);
             tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId()));
             transitionService.deletedTbTransitionByTjNum(tjNum);
-            transitionService.updateTbTransitionByTjNum(tjNum);
+
             TjCustomer customer = tjCustomerService.getById(order.getUserId());
-            if(null !=customer){
+            if (null != customer) {
                 customer.setCardId("0");
                 tjCustomerService.updateById(customer);
             }
             String configByKey = configService.selectConfigByKey("sfkqdyhis");
-            if (configByKey.equals("Y")){
+            if (configByKey.equals("Y")) {
                 HashMap<String, Object> map = new HashMap<>();
-                map.put("cardtype","4");
-                map.put("input",order.getCardId());
+                map.put("cardtype", "4");
+                map.put("input", order.getCardId());
                 LocalDate currentDate = LocalDate.now();
                 LocalDateTime startOfDay = currentDate.atStartOfDay();
                 LocalDateTime nineteenOClock = currentDate.atTime(LocalTime.of(19, 0));
                 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
                 String ksrq = startOfDay.format(formatter);
                 String jsrq = nineteenOClock.format(formatter);
-                map.put("ksrq",ksrq);
-                map.put("jsrq",jsrq);
+                map.put("ksrq", ksrq);
+                map.put("jsrq", jsrq);
                 AjaxResult result = hisApiGetMethodService.getHISDataNew("Getoutpatientcostinfo", map);
-                if (Integer.parseInt(String.valueOf(result.get("code"))) == 200){
+                if (Integer.parseInt(String.valueOf(result.get("code"))) == 200) {
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     return AjaxResult.error("鎾ら攢澶辫触,闂ㄨ瘖鎮h�呰垂鐢ㄦ竻鍗曚俊鎭笉涓虹┖");
-                }else {
+                } else {
                     boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order);
                     if (zfHisApiMethods) {
                         return AjaxResult.success("鎾ら攢鎴愬姛", map);
-                    }else {
+                    } else {
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                         return AjaxResult.error("鎾ら攢澶辫触,璋冪敤浣滃簾鍑虹幇澶辫触");
                     }
                 }
             }
+
+//            transitionService.updateTbTransitionByTjNum(tjNum);
             return AjaxResult.success("鎾ら攢鎴愬姛!!!");
         }
         return AjaxResult.success("绛惧埌璁板綍涓嶅瓨鍦�!");
@@ -2508,7 +2510,7 @@
     @ApiOperation(value = "鎵归噺鐢熸垚PDF")
     public AjaxResult makeTjPDF(@RequestBody List<String> reservations) {
         QueryWrapper<TjOrder> queryWrapper = new QueryWrapper<>();
-        queryWrapper.in("reservation_id",reservations);
+        queryWrapper.in("reservation_id", reservations);
         List<TjOrder> tjNumbers = tjOrderService.list(queryWrapper);
         Map<String, Object> map = null;
         try {
@@ -2551,12 +2553,71 @@
     @ApiOperation(value = "鏍规嵁瀹㈡埛韬唤璇佸彿鍜岄」鐩埗椤筰d鍒犻櫎涓存椂琛ㄦ暟鎹�")
     @Transactional
     public AjaxResult delTbBycusCardIdAndProId(@RequestParam @ApiParam(value = "韬唤璇佸彿") String cusCardId,
-                                           @RequestParam @ApiParam(value = "鐖堕」id") String proId) {
+                                               @RequestParam @ApiParam(value = "鐖堕」id") String proId) {
 
-        if (transitionService.delTbBycusCardIdAndProId(cusCardId,proId)) {
+        if (transitionService.delTbBycusCardIdAndProId(cusCardId, proId)) {
             return AjaxResult.success();
         }
         return AjaxResult.error("璁板綍涓嶅瓨鍦�!");
     }
+
+
+    @GetMapping("/revokeTjOrderByTjCardId")
+    @ApiOperation(value = "鏍规嵁灏辫瘖鍙锋挙閿�鐢宠璁板綍")
+    @Transactional
+    public AjaxResult revokeTjOrderByTjCardId(@RequestParam @ApiParam(value = "灏辫瘖鍙�") String cardId) {
+
+        TjOrder order = new TjOrder();
+        order.setCardId(cardId);
+        String configByKey = configService.selectConfigByKey("sfkqdyhis");
+        if (configByKey.equals("Y")) {
+            HashMap<String, Object> map = new HashMap<>();
+            map.put("cardtype", "4");
+            map.put("input", order.getCardId());
+            LocalDate currentDate = LocalDate.now();
+            LocalDateTime startOfDay = currentDate.atStartOfDay();
+            LocalDateTime nineteenOClock = currentDate.atTime(LocalTime.of(19, 0));
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+            String ksrq = startOfDay.format(formatter);
+            String jsrq = nineteenOClock.format(formatter);
+            map.put("ksrq", ksrq);
+            map.put("jsrq", jsrq);
+            AjaxResult result = hisApiGetMethodService.getHISDataNew("Getoutpatientcostinfo", map);
+            if (Integer.parseInt(String.valueOf(result.get("code"))) == 200) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("鎾ら攢澶辫触,闂ㄨ瘖鎮h�呰垂鐢ㄦ竻鍗曚俊鎭笉涓虹┖");
+            } else {
+                boolean zfHisApiMethods = hisApiMethod.ZfHisApiMethods(null, order);
+                if (zfHisApiMethods) {
+                    return AjaxResult.success("鎾ら攢鎴愬姛", map);
+                } else {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("鎾ら攢澶辫触,璋冪敤浣滃簾鍑虹幇澶辫触");
+                }
+            }
+        }
+        return AjaxResult.success();
+    }
+
+
+    @GetMapping("/revokeTjOrderByTjh")
+    @ApiOperation(value = "鏍规嵁灏变綋妫�鍙峰垹闄よ褰�")
+    @Transactional
+    public AjaxResult revokeTjOrderByTjh(@RequestParam @ApiParam(value = "浣撴鍙�") String tjNum) {
+
+        TjOrder order = tjOrderService.getOrderByTjNum(tjNum);
+        if (null != order) {
+//            String payByTjNum = tjOrderService.isPayByTjNum(String.valueOf(order.getOrderId()));
+//            if (null != payByTjNum) {
+//                return AjaxResult.error("璇ョ敤鎴峰凡鏀惰垂涓嶅彲鎾ら攢绛惧埌!");
+//            }
+            tjOrderService.deleteTjOrderByOrderId(order.getOrderId());
+            tjOrderDetailService.deleteTjOrderDetailByOrderDetailId(String.valueOf(order.getOrderId()));
+            remarkService.deletedOrderRemarkByTjNum(tjNum);
+            tjFlowingWaterService.deleteTjFlowingWaterByOrderId(String.valueOf(order.getOrderId()));
+            transitionService.deletedTbTransitionByTjNum(tjNum);
+        }
+        return AjaxResult.success();
+    }
 }
 

--
Gitblit v1.8.0