From e98752fd82d699c3b53f1f4e9e9e10281172d3f3 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 03 九月 2026 11:42:28 +0800
Subject: [PATCH] 【丽水】手术撤销

---
 smartor/src/main/java/com/smartor/service/IServiceExternalService.java         |    6 +++
 smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java      |    6 +++
 smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java |   75 +++++++++++++++++++++++++++++++++++++
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml             |    7 +++
 4 files changed, 94 insertions(+), 0 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java b/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java
index de813bc..0ff3281 100644
--- a/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java
+++ b/smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java
@@ -799,4 +799,10 @@
 //    @Excel(name = " 鍙戦�佺姸鎬� 1 琚鍙�(鍦ㄤ换鍔′腑鏄柊寤猴紝鍦ㄦ湇鍔′腑鏄棰嗗彇)  2 寰呭彂閫�  3 宸插彂閫�  4 涓嶆墽琛�  5 鍙戦�佸け璐� 6 宸插畬鎴怽") ")
     @ApiModelProperty(value = "椤甸潰灞曠ず鐘舵�� 锛�1锛氬緟闅忚锛�1 琚鍙栥��2 寰呭彂閫併��3 宸插彂閫併��5 鍙戦�佸け璐ャ��7銆佽秴鏃讹級锛�2锛氬凡瀹屾垚锛� 6 宸插畬鎴愶級銆�3锛氭棤闇�闅忚锛�4 涓嶆墽琛岋級")
     private Long sendstateView;
+
+    @ApiModelProperty(value = "鎵嬫湳璁板綍id 瀵瑰簲pat_med_operation_item.id")
+    private Long operationItemId;
+
+    @ApiModelProperty(value = "鎵嬫湳璁板綍id闆嗗悎")
+    private List<Long> operationItemIds;
 }
diff --git a/smartor/src/main/java/com/smartor/service/IServiceExternalService.java b/smartor/src/main/java/com/smartor/service/IServiceExternalService.java
index 33d169d..06fde72 100644
--- a/smartor/src/main/java/com/smartor/service/IServiceExternalService.java
+++ b/smartor/src/main/java/com/smartor/service/IServiceExternalService.java
@@ -119,6 +119,12 @@
     public Boolean addOperationInfo(@RequestBody Map dataMap);
 
     /**
+     * 鎾ら攢鎵嬫湳淇℃伅
+     */
+    public Boolean cancelOperationInfo(@RequestBody Map dataMap);
+
+
+    /**
      * 鏂板鍖荤枟缁勫尰鐢�
      */
     public Boolean addMedicalTeam(Map dataMap);
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
index e4fa9a8..797b55e 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -1520,6 +1520,80 @@
         return true;
     }
 
+    @Override
+    public Boolean cancelOperationInfo(Map dataMap) {
+        log.info("ServiceExternalServiceImpl---cancelOperationInfo鐨勬挙閿�鐨勫�间负锛歿}", dataMap);
+
+        Map yeWuXX = (Map) dataMap.get("YeWuXX");
+        Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null;
+        ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
+        PatArchive patArchive = addPatArchive(externalInHospPatientInfo, null, null);
+        //鎵嬫湳鎾ら攢
+        Map<String, Object> sscx = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("ShouShuCX") : null;
+        ExternalOperationInfo externalOperationInfo = null;
+        if (ObjectUtils.isNotEmpty(sscx))
+            externalOperationInfo = BeanUtil.mapToBean(sscx, ExternalOperationInfo.class, true);
+        PatMedOperation patMedOperation = new PatMedOperation();
+        patMedOperation.setPatid(patArchive.getId());
+        patMedOperation.setOrgid(patArchive.getOrgid());
+        patMedOperation.setOpreqcode(externalOperationInfo.getShenQingDID());
+        //鏌ヨ涓�涓嬶紝璇ユ偅鑰呮槸鍚﹀凡缁忔湁杩欎簺鏁版嵁
+        List<PatMedOperation> patMedOperations = patMedOperationMapper.selectPatMedOperationList(patMedOperation);
+        if (CollectionUtils.isNotEmpty(patMedOperations)) {
+            for(PatMedOperation operation : patMedOperations){
+                Long id = operation.getId();
+                //濡傛灉鎵嬫湳鎾ら攢锛岀洿鎺ュ垹闄よ鏉℃墜鏈俊鎭�
+                if (ObjectUtils.isNotEmpty(sscx)) {
+                    operation.setId(id);
+                    operation.setCheckFlag("1");
+                    operation.setDelFlag("1");
+                    //鍚屾椂鍘绘煡璇紝鏄惁鍦╯ubtask涓敓鎴愪换鍔★紝濡傛灉鐢熸垚鍑哄緱绔嬮┈鍒犻櫎
+                    //            鎵嬫湳闅忚
+                    PatMedOperationItem pmoi = new PatMedOperationItem();
+                    //鑾峰彇闇�瑕佸嚭闄㈡墜鏈殢璁匡紝鏈鐞嗙殑鏁版嵁
+                    pmoi.setOpid(operation.getId().toString());
+                    List<PatMedOperationItem> patMedOperationItems
+                            = patMedOperationItemMapper.selectOperationItemList(pmoi);
+                    List<Long> operationItemIds = patMedOperationItems.stream()
+                            .map(PatMedOperationItem::getId)
+                            .filter(Objects::nonNull)
+                            .distinct()
+                            .collect(Collectors.toList());
+
+
+                    //涓嶉渶瑕佹湇鍔′簡锛岄渶瑕侀�氳繃patid鍜宻endstate=1,2,3,5,7鍘绘煡璇竴涓嬶紝service_subtask閲屾槸鍚︽湁姝e湪鎵ц鐨勪换鍔★紝
+                    //鏈夌殑璇濓紝绔嬪嵆鍋滀簡
+                    List<Long> sendstates = Arrays.asList(1L, 2L, 3L, 5L, 7L);
+                    List<ServiceSubtask> serviceSubtaskList = new ArrayList<>();
+                    ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
+                    serviceSubtaskVO.setOrgid(patArchive.getOrgid());
+                    serviceSubtaskVO.setPatid(patArchive.getId());
+                    serviceSubtaskVO.setSendstates(sendstates);
+                    serviceSubtaskVO.setOperationItemIds(operationItemIds);
+                    serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
+                    //鍘籸edis涓紝鏌ヨ鏄惁鏈塻ubid锛屾湁鐨勮瘽绉婚櫎cache-exist
+                    if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
+                        for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
+                            log.info("闇�瑕佺Щ闄ょ殑subId涓猴細{}", serviceSubtask.getId().toString());
+                            serviceSubtask.setSendstate(4L);
+                            serviceSubtask.setRemark("鎵嬫湳鎾ら攢");
+                            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+                            redisCache.removeElementFromList("cache-exist", serviceSubtask.getId().toString());
+                            redisCache.removeElementFromList("cache-0", serviceSubtask.getId().toString());
+                            redisCache.removeElementFromList("cache-1", serviceSubtask.getId().toString());
+                            redisCache.removeElementFromList("cache-2", serviceSubtask.getId().toString());
+                            redisCache.removeElementFromList("cache-3", serviceSubtask.getId().toString());
+                            redisCache.removeElementFromList("cache-4", serviceSubtask.getId().toString());
+                        }
+                    }
+                    operation.setUpdateTime(new Date());
+                    patMedOperationMapper.updatePatMedOperation(operation);
+                }
+            }
+        }
+        return true;
+    }
+
     //鏂板鎮h�呭熀鏈俊鎭�
     private PatArchive addPatArchive(ExternalInHospPatientInfo externalInHospPatientInfo, ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo, ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo) {
         Date parse = null;
@@ -2013,6 +2087,7 @@
                 return true;
             case "SM_SQ_CheXiao":
                 log.info("鎵嬫湳鎾ら攢鍏ュ弬绫诲瀷涓猴細{}", type);
+                cancelOperationInfo(dataMap);
                 return true;
             case "TJ_YW_BaoGaoXX":
                 log.info("浣撴鎶ュ憡鍏ュ弬绫诲瀷涓猴細{}", type);
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 1683cd0..47bde97 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -358,6 +358,12 @@
                 #{itemTaskId}
             </foreach>
         </if>
+        <if test="operationItemIds != null and operationItemIds.size() > 0">
+            AND operation_item_id IN
+            <foreach collection="operationItemIds" item="operationItemIdItem" open="(" separator="," close=")">
+                #{operationItemIdItem}
+            </foreach>
+        </if>
         <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
         <if test="templatename != null  and templatename != ''">and templatename like concat('%', #{templatename},
             '%')
@@ -483,6 +489,7 @@
         <if test="libtemplatename != null ">and libtemplatename = #{libtemplatename}</if>
         <if test="openid != null ">and openid = #{openid}</if>
         <if test="sendstate != null ">and sendstate = #{sendstate}</if>
+        <if test="operationItemId != null ">and operation_item_id = #{operationItemId}</if>
         <if test="drname != null  and drname != ''">and drname like concat('%', #{drname}, '%')</if>
         <if test="taskName != null  and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
         <if test="drcode != null and drcode != ''">and (drcode = #{drcode}</if>

--
Gitblit v1.9.3