From 2e1fc763314f7231780c7d6e36fd6922548b285a Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期三, 04 六月 2025 18:16:52 +0800
Subject: [PATCH] zjh20250604

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/api/DefaultController.java |   86 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 80 insertions(+), 6 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/api/DefaultController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/api/DefaultController.java
index 56a0346..b6e6a79 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/api/DefaultController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/api/DefaultController.java
@@ -1,26 +1,36 @@
 package com.ltkj.web.controller.api;
 
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ltkj.common.core.domain.AjaxResult;
+import com.ltkj.hosp.domain.TjCustomer;
 import com.ltkj.hosp.domain.TjOrder;
 import com.ltkj.hosp.mapper.TjCustomerMapper;
+import com.ltkj.hosp.service.ITjOrderDetailService;
 import com.ltkj.hosp.service.ITjOrderService;
+import com.ltkj.hosp.vodomain.ShenGaoTiZhongVo;
+import com.ltkj.system.service.ISysConfigService;
 import com.ltkj.web.controller.system.TjCheckController;
 import com.ltkj.web.controller.system.TjReportController;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
+import java.io.File;
 import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
+
+import static com.ltkj.framework.datasource.DynamicDataSourceContextHolder.log;
 
 /**
  * @Company: 瑗垮畨璺嘲绉戞妧鏈夐檺鍏徃
@@ -39,6 +49,10 @@
     private TjCustomerMapper tjCustomerMapper;
     @Autowired
     private ITjOrderService tjOrderService;
+    @Autowired
+    private ITjOrderDetailService detailService;
+    @Autowired
+    private ISysConfigService sysConfigService;
 
     /**
      * 鎻愪緵缁欎笁鏂硅皟鐢ㄧ殑鎶ュ憡鏌ョ湅鎺ュ彛
@@ -57,6 +71,23 @@
             return;
         }
         tjReportController.preview(response,true,tjNum);
+    }
+
+    @PostMapping("/viewReportUrl")
+    public AjaxResult viewReportUrl(@RequestBody String json){
+        JSONObject entries = JSONUtil.parseObj(json);
+        String tjNum = entries.getStr("tjNum");
+        LambdaQueryWrapper<TjOrder> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(TjOrder::getHeshouStatus,1);
+        wrapper.eq(TjOrder::getTjNumber,tjNum);
+        List<TjOrder> list = tjOrderService.list(wrapper);
+        if (list.isEmpty()){
+            return AjaxResult.error();
+        }
+        TjOrder tjOrder = tjOrderService.getOrderByTjNum(tjNum);
+        TjCustomer tjCustomer = tjCustomerMapper.selectById( tjOrder.getUserId());
+        String filePath = tjCustomer.getCusId() + tjNum + tjCustomer.getCusName() + "_鎶ュ憡.pdf";
+        return AjaxResult.success(filePath);
     }
 
     /**
@@ -90,8 +121,18 @@
         JSONObject entries = JSONUtil.parseObj(json);
         String card = entries.getStr("card");
 //        TjCustomer customer = tjCustomerMapper.getCusInfo(card);
-        List<Map<String ,Object>> customer = tjCustomerMapper.getCusInfoList(card);
-        return AjaxResult.success(customer);
+        String key = sysConfigService.selectConfigByKey("h5OrXcxQueryDate");
+        if (StrUtil.isBlank(key)){
+            key = "2025-05-01";
+        }
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            Date date = sdf.parse(key);
+            List<Map<String ,Object>> customer = tjCustomerMapper.getCusInfoList(card,date);
+            return AjaxResult.success(customer);
+        } catch (ParseException e) {
+            return AjaxResult.error();
+        }
     }
 
     /**
@@ -105,6 +146,15 @@
         JSONObject entries = JSONUtil.parseObj(json);
         String card = entries.getStr("card");
         String name = entries.getStr("name");
+        if (StrUtil.isBlank(name)){
+            LambdaQueryWrapper<TjCustomer> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(TjCustomer::getCusIdcard,card);
+            wrapper.orderByDesc(TjCustomer::getCusId);
+            wrapper.last("LIMIT 1");
+            TjCustomer customer = tjCustomerMapper.selectOne(wrapper);
+            if (customer == null) return AjaxResult.error();
+            name = customer.getCusName();
+        }
         List<Map<String ,Object>> customer = tjCustomerMapper.getCusInfoListByCardAndName(card,name);
         return AjaxResult.success(customer);
     }
@@ -145,4 +195,28 @@
         }
     }
 
+
+
+    /**
+     * 灏忕▼搴忕偣鍑讳綋妫�鎶ュ憡鏌ヨ璇︽儏,鏄剧ず韬珮浣撻噸浣撻噸鎸囨暟鏀剁缉鍘嬭垝寮犲帇
+     */
+    @GetMapping("/getShenGaoTiZhong")
+    @ApiOperation(value = "灏忕▼搴�-浣撴鎶ュ憡鏌ヨ璇︽儏")
+    public AjaxResult getShenGaoTiZhong(@RequestParam @ApiParam(value = "浣撴鍙�") String tjNumber) {
+//        Map<String, Object> objectMap = new HashMap<>();
+        LambdaQueryWrapper<TjOrder> wq1 = new LambdaQueryWrapper<>();
+        wq1.eq(TjOrder::getTjNumber, tjNumber);
+        wq1.eq(TjOrder::getCheckStatus, 1);
+        TjOrder one = tjOrderService.getOne(wq1);
+        if (one == null) {
+            return AjaxResult.success("浣撴鏆傛湭瀹屾垚锛侊紒");
+        }
+
+        List<ShenGaoTiZhongVo> maps = detailService.getShenGaoTiZhongList(one.getTjNumber());
+
+        log.info("ltkj {}鐨勪綋妫�鎶ュ憡鏌ヨ璇︽儏"+maps,tjNumber);
+        return AjaxResult.success(maps);
+
+    }
+
 }

--
Gitblit v1.8.0