From 68ff33beff11310e830b0615b5a81f83fad0f683 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期日, 08 十一月 2026 23:33:14 +0800
Subject: [PATCH] ai优化

---
 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java |  100 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 98 insertions(+), 2 deletions(-)

diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java
index 965228c..ef9a3cf 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java
@@ -3,7 +3,9 @@
 import cn.hutool.extra.servlet.ServletUtil;
 import cn.lihu.jh.framework.common.pojo.CommonResult;
 import cn.lihu.jh.framework.common.util.object.BeanUtils;
+import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO;
 import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO;
+import cn.lihu.jh.module.ecg.dal.mysql.checktype.CheckTypeMapper;
 import cn.lihu.jh.module.ecg.service.callingscreen.CallingScreenService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -17,6 +19,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 import static cn.lihu.jh.framework.common.pojo.CommonResult.error;
 import static cn.lihu.jh.framework.common.pojo.CommonResult.success;
@@ -30,6 +33,14 @@
 
     @Resource
     private CallingScreenService callingScreenService;
+
+    /** 鐢ㄤ簬缁欏睆骞曟暟鎹ˉ銆屾帓闃熷彿鍓嶇紑銆嶏紙check_type.seq_prefix锛� */
+    @Resource
+    private CheckTypeMapper checkTypeMapper;
+
+    /** 銆愰噸鍙�戠敤浜庣粰灞忓箷鏁版嵁琛�"鏈�杩戜竴娆″彨鍙疯褰昳d"锛坈all_patient锛� */
+    @Resource
+    private cn.lihu.jh.module.ecg.dal.mysql.call.CallMapper callMapper;
 
     @GetMapping("/display-col-info")
     @Operation(summary = "鍒椾笂鏄剧ず鐨勬鏌ョ被鍨嬪悕绉�")
@@ -48,10 +59,16 @@
         Map<Integer, List<QueueDO>> map = callingScreenService.getBigScreenPatient();
 
         Map<Integer, List<ScreenQueueRespVO>> mapVO = new HashMap<>();
+        // 灞忓箷瑕佹樉绀恒�屽墠缂� + 鎺掗槦鍙枫�嶏紝璁惧鏈櫥褰曟嬁涓嶅埌妫�鏌ラ」鐩瓧鍏革紝鏁呯敱鍚庣涓�骞朵笅鍙戯紙姣忔璇锋眰璇讳竴娆★級
+        Map<Integer, String> seqPrefixMap = getSeqPrefixMap();
+        // 銆愰噸鍙�戜竴骞朵笅鍙�"鏈�杩戜竴娆″彨鍙疯褰昳d"锛屽睆骞曟嵁姝ら噸鏂版挱鎶�
+        Map<String, Long> callIdMap = getLatestCallIdMap();
         map.keySet().forEach( displayCol -> {
             //log.info("dispayCol: " + displayCol);
             List<QueueDO> columnQueueDOList = map.get(displayCol);
             List<ScreenQueueRespVO> screenQueueRespVOList = BeanUtils.toBean(columnQueueDOList, ScreenQueueRespVO.class);
+            fillSeqPrefix(screenQueueRespVOList, seqPrefixMap);
+            fillCallId(screenQueueRespVOList, callIdMap);
             mapVO.put(displayCol, screenQueueRespVOList);
         });
 
@@ -69,9 +86,88 @@
         List<QueueDO> queueDOList2 = callingScreenService.getRoomInstallRelatedPatient(reqIp, roomId);
 
         Map<Integer, List<ScreenQueueRespVO>> mapVO = new HashMap<>();
-        mapVO.put(1, BeanUtils.toBean(queueDOList1, ScreenQueueRespVO.class));
-        mapVO.put(2, BeanUtils.toBean(queueDOList2, ScreenQueueRespVO.class));
+        List<ScreenQueueRespVO> waitingVOList = BeanUtils.toBean(queueDOList1, ScreenQueueRespVO.class);
+        List<ScreenQueueRespVO> installVOList = BeanUtils.toBean(queueDOList2, ScreenQueueRespVO.class);
+        // 灞忓箷瑕佹樉绀恒�屽墠缂� + 鎺掗槦鍙枫�嶏紝璁惧鏈櫥褰曟嬁涓嶅埌妫�鏌ラ」鐩瓧鍏革紝鏁呯敱鍚庣涓�骞朵笅鍙戯紙姣忔璇锋眰璇讳竴娆★級
+        Map<Integer, String> seqPrefixMap = getSeqPrefixMap();
+        Map<String, Long> callIdMap = getLatestCallIdMap();
+        fillSeqPrefix(waitingVOList, seqPrefixMap);
+        fillSeqPrefix(installVOList, seqPrefixMap);
+        fillCallId(waitingVOList, callIdMap);
+        fillCallId(installVOList, callIdMap);
+        mapVO.put(1, waitingVOList);
+        mapVO.put(2, installVOList);
         return success( mapVO );
     }
 
+    /**
+     * 缁欏睆骞曟暟鎹ˉ涓娿�屾帓闃熷彿鏄剧ず鍓嶇紑銆�= {@code check_type.seq_prefix}銆�
+     *
+     * <p>銆愬彿缁熶竴锛堟湰闇�姹傦級銆戞帓闃熷彿鎸夋鏌ラ」鐩悇鑷紪鍙凤紝涓嶅悓妫�鏌ラ」鐩細鍑虹幇鐩稿悓鏁板瓧锛�
+     * 灞忓箷涓婂繀椤诲甫鍓嶇紑鎵嶅垎寰楁竻锛堜緥锛欰5 / B5锛夈�傚睆骞曡澶囦笉鐧诲綍銆佹棤娉曡皟鐢ㄦ鏌ラ」鐩帴鍙o紝
+     * 鍥犳鍦ㄨ繖閲岃ˉ榻愩��
+     *
+     * <p>姣忔璇锋眰鏌ヤ竴娆″叏琛ㄥ缓鏄犲皠锛堟鏌ラ」鐩彧鏈夊崄鍑犱釜锛岄噺绾у緢灏忥級锛�
+     * 涓嶅仛闀挎湡缂撳瓨锛岄伩鍏嶇鐞嗗憳鏀逛簡鍓嶇紑鍚庡睆骞曚竴鐩存樉绀烘棫鍊笺��
+     * 鏌ヤ笉鍒伴厤缃椂鐣欑┖涓测�斺�斿畞鍙彧鏄剧ず鏁板瓧锛屼篃涓嶈璁╁睆骞曟姤閿欐垨绌虹櫧銆�
+     */
+    private void fillSeqPrefix(List<ScreenQueueRespVO> voList, Map<Integer, String> seqPrefixMap) {
+        if (voList == null || voList.isEmpty() || seqPrefixMap == null) {
+            return;
+        }
+        voList.forEach(vo -> vo.setSeqPrefix(seqPrefixMap.getOrDefault(vo.getBookCheckType(), "")));
+    }
+
+    /* ==================== 閲嶅彨锛氫笅鍙�"鏈�杩戜竴娆″彨鍙疯褰昳d" ==================== */
+
+    /**
+     * 缁欏睆骞曟暟鎹ˉ涓� {@code callId}锛堣鎮h�呮渶杩戜竴娆″彨鍙疯褰曠殑 id锛夈��
+     *
+     * <p>涓轰粈涔堥渶瑕侊細灞忓箷鎾姤闈�"鏁版嵁鍙樺寲"瑙﹀彂 鈥斺�� 澶у睆鍒ゆ柇"鏌愭偅鑰呮柊鍑虹幇鍦ㄥ彨鍙峰垪"銆�
+     * 璇婇棿灞忓垽鏂�"璇婁腑绗竴浜哄彉鍖�"銆傝�屽尰鐢熺偣銆岄噸鍙�嶆椂**鎮h�呰繕鏄偅涓汉銆佽瘖瀹よ繕鏄偅涓瘖瀹�**锛�
+     * 闃熷垪鏁版嵁涓�鐐规病鍙橈紝涓ゅ潡灞忚嚜鐒朵笉浼氬啀鎾�傞噸鍙細鏂板涓�鏉″彨鍙疯褰曪紙call_patient锛夛紝
+     * 鎶婂畠鐨� id 涓嬪彂鍚庯紝灞忓箷鍙鍙戠幇 callId 鍙樹簡灏遍噸鏂版挱鎶ャ��
+     */
+    private void fillCallId(List<ScreenQueueRespVO> voList, Map<String, Long> callIdMap) {
+        if (voList == null || voList.isEmpty() || callIdMap == null || callIdMap.isEmpty()) {
+            return;
+        }
+        voList.forEach(vo -> {
+            if (null != vo.getPatId()) {
+                vo.setCallId(callIdMap.get(vo.getPatId()));
+            }
+        });
+    }
+
+    /** 涓�娆℃煡璇㈠彇鍒般�屾偅鑰呯紪鍙� 鈫� 鏈�杩戜竴娆″彨鍙疯褰� id銆嶏紱澶辫触鏃惰繑鍥炵┖鏄犲皠锛堝睆骞曟寜鑰侀�昏緫鎾姤锛� */
+    private Map<String, Long> getLatestCallIdMap() {
+        try {
+            Map<String, Long> map = new HashMap<>();
+            for (Map<String, Object> row : callMapper.selectLatestCallIds()) {
+                Object patId = row.get("patId");
+                Object callId = row.get("callId");
+                if (null != patId && callId instanceof Number) {
+                    map.put(String.valueOf(patId), ((Number) callId).longValue());
+                }
+            }
+            return map;
+        } catch (Exception e) {
+            log.error("[getLatestCallIdMap] 璇诲彇鏈�杩戝彨鍙疯褰曞け璐ワ紝閲嶅彨灏嗕笉浼氳Е鍙戝睆骞曢噸鎾�", e);
+            return new HashMap<>();
+        }
+    }
+
+    /** 璇讳竴娆℃鏌ラ」鐩厤缃紝寰楀埌銆屾鏌ラ」鐩�� 鈫� 鎺掗槦鍙峰墠缂�銆嶆槧灏勶紱澶辫触鏃惰繑鍥炵┖鏄犲皠锛堝睆骞曞彧鏄剧ず鍙凤級 */
+    private Map<Integer, String> getSeqPrefixMap() {        try {
+            return checkTypeMapper.simpleCheckTypeList().stream()
+                    .filter(checkType -> null != checkType.getValue())
+                    .collect(Collectors.toMap(CheckTypeDO::getValue,
+                            checkType -> null == checkType.getSeqPrefix() ? "" : checkType.getSeqPrefix(),
+                            (a, b) -> a));
+        } catch (Exception e) {
+            log.error("[getSeqPrefixMap] 璇诲彇妫�鏌ラ」鐩墠缂�澶辫触锛屽睆骞曞皢鍙樉绀哄彿", e);
+            return new HashMap<>();
+        }
+    }
+
 }

--
Gitblit v1.9.3