From a34be58cdf00e92607edefb3130bdfd979390c16 Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期五, 21 三月 2025 17:29:38 +0800
Subject: [PATCH] 增加外送视图

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysConfigController.java |   77 ++++++++++++++++++++++++++++++--------
 1 files changed, 60 insertions(+), 17 deletions(-)

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 4e903f6..7e24323 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
@@ -3,10 +3,12 @@
 import java.text.SimpleDateFormat;
 import java.util.*;
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.pinyin.PinyinUtil;
 import cn.hutool.json.JSONUtil;
 import com.ltkj.common.core.domain.entity.SysMenu;
@@ -192,23 +194,23 @@
     @GetMapping ("/shoudongtbjyjcwsxmjg")
     @ApiOperation(value = "鎵嬪姩鍚屾妫�楠屾鏌ュ閫侀」鐩粨鏋滄帴鍙�")
     public AjaxResult shoudongtbjyjcwsxmjg(@RequestParam @ApiParam(value = "jy妫�楠� jc妫�鏌� jyjc妫�楠屽拰妫�鏌�") String tblx,
-                                           @ApiParam(value = "浣撴鍙�")@RequestParam String tjh) {
-
-        log.info("鎵嬪姩鍚屾妫�楠屾垨妫�鏌ョ粨鏋滃紑濮�->{}",DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
+                                           @ApiParam(value = "浣撴鍙�")@RequestParam String tjh, HttpServletRequest request) {
+        String hospId = request.getHeader("hospId");
+        log.info("鎵嬪姩鍚屾妫�楠屾垨妫�鏌ョ粨鏋滃紑濮�->{}{}",hospId,DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
         try {
 
             switch (tblx){
                 case "jy":
-                    tbjianyan(tjh);
+                    tbjianyan(tjh,hospId);
                     log.info("褰撳墠鍚屾鐨勬槸->{} 缁撴灉","妫�楠�");
                     break;
                 case "jc":
-                    tbjiancha(tjh);
+                    tbjiancha(tjh,hospId);
                     log.info("褰撳墠鍚屾鐨勬槸->{} 缁撴灉","妫�鏌�");
                     break;
                 case "jyjc":
-                    tbjianyan(tjh);
-                    tbjiancha(tjh);
+                    tbjianyan(tjh,hospId);
+                    tbjiancha(tjh,hospId);
                     log.info("褰撳墠鍚屾鐨勬槸->{} 缁撴灉","妫�楠屾鏌�");
                     break;
                 default:
@@ -228,8 +230,27 @@
         return AjaxResult.success();
     }
 
-    private void tbjianyan(String s) {
+    private void tbjianyan(String s,String hosp) {
         try {
+
+            String isWsByView = configService.selectConfigByKey("is_ws_by_view");
+            if (StrUtil.isNotBlank(isWsByView) && isWsByView.equals("Y")){
+                List<LtkjHysqd> sqd = testMapper.getWsHySqdByView(s);
+                if (sqd != null && !sqd.isEmpty()){
+                    for (LtkjHysqd hysqd : sqd) {
+                        LtkjHysqd jybgid = ltkjHysqdService.getLtkjHysqdByTjhAndTmh(hysqd.getTjh(), hysqd.getTmh());
+                        if (null != jybgid) {
+                            ltkjHysqdService.deletedLtkjHysqdByTjhAndTmh(hysqd.getTjh(), hysqd.getTmh());
+                            ltkjHybgdService.deletedLtkjHybgdByTjhAndTmh(hysqd.getTmh());
+                        }
+                        if (ltkjHysqdService.save(hysqd)) {
+                            List<LtkjHybgd> wsbg = testMapper.getWsHyBgdByView(hysqd.getTmh());
+                            ltkjHybgdService.saveBatch(wsbg);
+                        }
+                    }
+                }
+            }
+
             List<Aws> awsList = testMapper.getWsxmLtkjHysqdByLisViBySLAVEWS(s);
             if(null !=awsList && !awsList.isEmpty()){
                 log.info("澶栭�侀」鐩釜鏁�->{} 缁撴灉",awsList.size());
@@ -239,7 +260,7 @@
                 awsService.saveBatch(awsList);
                 log.info("淇濆瓨澶栭�侀」鐩垚鍔�");
             }
-            List<LtkjHysqd> hysqdList = testMapper.getCcXZxYyLtkjHysqdByLisVi(s);
+            List<LtkjHysqd> hysqdList = testMapper.getCcXZxYyLtkjHysqdByLisVi(s,hosp);
             log.info("鍘焗ysqdList->{} 缁撴灉", JSONUtil.parseObj(hysqdList));
             List<LtkjHysqd> wssq = testMapper.getWsxmLtkjHysqdByLisVi(s);
             if(null !=wssq && !wssq.isEmpty()){
@@ -272,18 +293,39 @@
     }
 
 
-    private void tbjiancha(String s) {
-
+    private void tbjiancha(String s,String hosp) {
+        String yqbm = configService.selectConfigByKey("common_api_service_hospbm");
         try {
-            List<LtkjExamJcsqd> jcsqdList = testMapper.getCcXZxYyPacsLtkjExamJcsqd(s);
+            List<LtkjExamJcsqd> jcsqdList = testMapper.getCcXZxYyPacsLtkjExamJcsqd(s,hosp);
             if (null != jcsqdList && !jcsqdList.isEmpty()) {
                 DynamicDataSourceContextHolder.clearDataSourceType();
                 jcsqdService.deletedLtkjJcsqdByTjhAndTmh(s);
                 jcbgdService.deletedLtkjJcbgdByTjhAndTmh(s);
                 jcsqdService.saveBatch(jcsqdList);
-                List<LtkjExamJcbgd> jcbgdList = testMapper.getCcXZxYyPacsLtkjExamJcbgd(s);
+                List<LtkjExamJcbgd> jcbgdList = testMapper.getCcXZxYyPacsLtkjExamJcbgd(s,hosp);
                 DynamicDataSourceContextHolder.clearDataSourceType();
                 if (null != jcbgdList && !jcbgdList.isEmpty()) jcbgdService.saveBatch(jcbgdList);
+                for (LtkjExamJcsqd jcsqd : jcsqdList) {
+                    if(StringUtil.isNotBlank(jcsqd.getJgzt())){
+                        String[] split = jcsqd.getJgzt().replaceAll("\n", "").split("銆倈锛泑;");
+                        jcycxmService.deletedByTjh(s);
+                        for (String jg : split) {
+                            if(StringUtil.isNotBlank(jg) && !jg.contains("鏈寮傚父")
+                                    && !jg.contains("鏈鏄庢樉寮傚父") && !jg.contains("鏈鍗犱綅") && !jg.contains("鏈")
+                                    && !jg.contains("鏈鏄庢樉")&& !jg.contains("姝e父")&& !jg.contains("鍙屼晶妞庨棿瀛旀棤鐙獎")&& !jg.contains("鏃犳畩")){
+                                TjJcycxm jcycxm=new TjJcycxm();
+                                jcycxm.setTjh(s);
+                                jcycxm.setYqid(yqbm);
+                                String[] split1 = jcsqd.getJcxmid().split(";");
+                                jcycxm.setProId(split1[0]);
+                                jcycxm.setProName(jcsqd.getJcxmmc());
+                                jcycxm.setCreateTime(new Date());
+                                jcycxm.setJcjg(jg);
+                                jcycxmService.save(jcycxm);
+                            }
+                        }
+                    }
+                }
                 DynamicDataSourceContextHolder.clearDataSourceType();
             }
         } catch (Exception e) {
@@ -301,7 +343,7 @@
     public AjaxResult zx(@RequestParam int day) {
         try {
             List<DictHosp> list = dictHospService.list();
-            DateTime dateTime1 = DateUtil.offsetMonth(new Date(), day);
+            DateTime dateTime1 = DateUtil.offsetDay(new Date(), day);
             for (DictHosp dictHosp : list) {
                 String mallMerchantSecretKey = SecurityUtils.getMallMerchantSecretKey(secret, dictHosp.getHospAreaId(), dictHosp.getHospAreaName(), dateTime1);
                 dictHosp.setSecretKey(mallMerchantSecretKey);
@@ -356,11 +398,12 @@
                 List<LtkjExamJcsqd> list = jcsqdService.getLtkjJcsqdByTjh(s);
                 if(null !=list && !list.isEmpty()){
                     for (LtkjExamJcsqd jcsqd : list) {
-                        if(jcsqd.getJgbx().contains("銆�")){
-                            String[] split = jcsqd.getJgzt().split("銆�");
+                        if(StringUtil.isNotBlank(jcsqd.getJgzt())){
+
+                            String[] split = jcsqd.getJgzt().replaceAll("\n", "").split("銆倈锛泑;");
                             for (String jg : split) {
                                 if(StringUtil.isNotBlank(jg) && !jg.contains("鏈寮傚父")
-                                        && !jg.contains("鏈鏄庢樉寮傚父") && !jg.contains("鏈鍗犱綅")
+                                        && !jg.contains("鏈鏄庢樉寮傚父") && !jg.contains("鏈鍗犱綅") && !jg.contains("鏈")
                                         && !jg.contains("鏈鏄庢樉")&& !jg.contains("姝e父")&& !jg.contains("鍙屼晶妞庨棿瀛旀棤鐙獎")&& !jg.contains("鏃犳畩")){
                                     TjJcycxm jcycxm=new TjJcycxm();
                                     jcycxm.setTjh(s);

--
Gitblit v1.8.0