From 9f9e9be084ea03f7b7eb301f2f6e201c6c2589d7 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 05 八月 2026 17:10:31 +0800
Subject: [PATCH] 【景宁】手术随访增加出院科室、病区限制

---
 ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml                       |    8 ++
 smartor/src/main/java/com/smartor/domain/PatMedOperation.java                            |   24 ++++++++
 smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java              |   17 +++--
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java |    1 
 smartor/src/main/java/com/smartor/domain/PatMedOperationItem.java                        |   24 ++++++++
 smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml                  |   10 +++
 smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java           |    5 +
 smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml                      |   48 ++++++++++++++++
 8 files changed, 127 insertions(+), 10 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
index 5608d92..c933413 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -962,5 +962,4 @@
     public void syncMedOperForShiyi(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
         collectHISService.syncOper(startTime, endTime);
     }
-
 }
diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
index 13d62a8..9489fe5 100644
--- a/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
+++ b/ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
@@ -395,6 +395,10 @@
         <result property="deptname" column="deptname"/>
         <result property="hospitaldistrictcode" column="hospitaldistrictcode"/>
         <result property="hospitaldistrictname" column="hospitaldistrictname"/>
+        <result property="leaveldeptcode" column="leaveldeptcode"/>
+        <result property="leaveldeptname" column="leaveldeptname"/>
+        <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
+        <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
         <result property="roomno" column="roomno"/>
         <result property="bedNo" column="bed_no"/>
         <result property="drcode" column="drcode"/>
@@ -871,6 +875,10 @@
         o.deptname ,
         o.hospitaldistrictcode,
         o.hospitaldistrictname ,
+        o.deptcode as leaveldeptcode,
+        o.deptname as leaveldeptname,
+        o.hospitaldistrictcode as leavehospitaldistrictcode,
+        o.hospitaldistrictname as leavehospitaldistrictname,
         o.roomno  ,
         o.bed_no ,
         o.drcode  ,
diff --git a/smartor/src/main/java/com/smartor/domain/PatMedOperation.java b/smartor/src/main/java/com/smartor/domain/PatMedOperation.java
index d6b6ae6..5132e88 100644
--- a/smartor/src/main/java/com/smartor/domain/PatMedOperation.java
+++ b/smartor/src/main/java/com/smartor/domain/PatMedOperation.java
@@ -403,6 +403,30 @@
     private String hospitaldistrictname;
 
     /**
+     * 鍑洪櫌绉戝缂栫爜
+     */
+    @ApiModelProperty(value = "鍑洪櫌绉戝缂栫爜")
+    private String leaveldeptcode;
+
+    /**
+     * 鍑洪櫌绉戝鍚嶇О
+     */
+    @ApiModelProperty(value = "鍑洪櫌绉戝鍚嶇О")
+    private String leaveldeptname;
+
+    /**
+     * 鍑洪櫌鐥呭尯缂栫爜
+     */
+    @ApiModelProperty(value = "鍑洪櫌鐥呭尯缂栫爜")
+    private String leavehospitaldistrictcode;
+
+    /**
+     * 鍑洪櫌鐥呭尯鍚嶇О
+     */
+    @ApiModelProperty(value = "鍑洪櫌鐥呭尯鍚嶇О")
+    private String leavehospitaldistrictname;
+
+    /**
      * 鎴块棿鍙�
      */
     @ApiModelProperty("鎴块棿鍙�")
diff --git a/smartor/src/main/java/com/smartor/domain/PatMedOperationItem.java b/smartor/src/main/java/com/smartor/domain/PatMedOperationItem.java
index 326be38..49f000e 100644
--- a/smartor/src/main/java/com/smartor/domain/PatMedOperationItem.java
+++ b/smartor/src/main/java/com/smartor/domain/PatMedOperationItem.java
@@ -226,5 +226,29 @@
 
     @ApiModelProperty(value = "鎵嬫湳绛夌骇闆嗗悎")
     private List<String> opLevelCodes;
+
+    /**
+     * 鍑洪櫌绉戝缂栫爜
+     */
+    @ApiModelProperty(value = "鍑洪櫌绉戝缂栫爜")
+    private String leaveldeptcode;
+
+    /**
+     * 鍑洪櫌绉戝鍚嶇О
+     */
+    @ApiModelProperty(value = "鍑洪櫌绉戝鍚嶇О")
+    private String leaveldeptname;
+
+    /**
+     * 鍑洪櫌鐥呭尯缂栫爜
+     */
+    @ApiModelProperty(value = "鍑洪櫌鐥呭尯缂栫爜")
+    private String leavehospitaldistrictcode;
+
+    /**
+     * 鍑洪櫌鐥呭尯鍚嶇О
+     */
+    @ApiModelProperty(value = "鍑洪櫌鐥呭尯鍚嶇О")
+    private String leavehospitaldistrictname;
 }
 
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
index 4e6ad83..4350848 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatMedInhospServiceImpl.java
@@ -886,12 +886,12 @@
         if (ObjectUtils.isEmpty(serviceSubtask)) {
             return;
         }
-        if (StringUtils.isNotEmpty(patMedOperationItem.getDeptcode())) {
-            serviceSubtask.setVisitDeptCode(patMedOperationItem.getDeptcode());
-            serviceSubtask.setVisitDeptName(patMedOperationItem.getDeptname());
+        if (StringUtils.isNotEmpty(patMedOperationItem.getLeaveldeptcode())) {
+            serviceSubtask.setVisitDeptCode(patMedOperationItem.getLeaveldeptcode());
+            serviceSubtask.setVisitDeptName(patMedOperationItem.getLeaveldeptname());
         } else {
-            serviceSubtask.setVisitDeptCode(patMedOperationItem.getHospitaldistrictcode());
-            serviceSubtask.setVisitDeptName(patMedOperationItem.getHospitaldistrictname());
+            serviceSubtask.setVisitDeptCode(patMedOperationItem.getLeavehospitaldistrictcode());
+            serviceSubtask.setVisitDeptName(patMedOperationItem.getLeavehospitaldistrictname());
         }
         //璁板綍insertServiceSubtask璇彞杩斿洖鐘舵��
         Integer i = 0;
@@ -1280,8 +1280,11 @@
                 serviceTaskoper.setOplevelcode(opItem.getOplevelcode());
 
                 //鏍规嵁绉戝銆佺梾鍖鸿繃婊�
-                serviceTaskoper.setDeptCode(opItem.getDeptcode());
-                serviceTaskoper.setWardCode(opItem.getHospitaldistrictcode());
+                if(StringUtils.isNotEmpty(opItem.getLeaveldeptcode())){
+                    serviceTaskoper.setDeptCode(opItem.getLeaveldeptcode());
+                }else {
+                    serviceTaskoper.setWardCode(opItem.getLeavehospitaldistrictcode());
+                }
 
                 List<ServiceTaskoper> serviceTaskopers = serviceTaskoperMapper.selectServiceTaskoperList(serviceTaskoper);
                 //濡傛灉閮ㄩ棬妯℃澘涓虹┖锛堝皢deptIsNull璁剧疆涓簍rue锛�
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 d858375..9276652 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -1335,7 +1335,6 @@
         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);
 
 
@@ -1356,6 +1355,10 @@
         patMedOperation.setPatid(patArchive.getId());
         patMedOperation.setPatcode(externalInHospPatientInfo.getBingRenID());
         patMedOperation.setPaname(externalInHospPatientInfo.getXingMing());
+        patMedOperation.setLeaveldeptcode(externalInHospPatientInfo.getDangQianKSID());
+        patMedOperation.setLeaveldeptname(externalInHospPatientInfo.getDangQianKSMC());
+        patMedOperation.setLeavehospitaldistrictcode(externalInHospPatientInfo.getDangQianBQID());
+        patMedOperation.setLeavehospitaldistrictname(externalInHospPatientInfo.getDangQianBQMC());
         patMedOperation.setOpreqcode(externalOperationInfo.getShenQingDID());
         //鏌ヨ涓�涓嬶紝璇ユ偅鑰呮槸鍚﹀凡缁忔湁杩欎簺鏁版嵁
         List<PatMedOperation> patMedOperations = patMedOperationMapper.selectPatMedOperationList(patMedOperation);
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml
index b856fc2..ce9ba38 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOperationItemMapper.xml
@@ -34,6 +34,10 @@
             <result property="deptname" column="deptname"/>
             <result property="hospitaldistrictcode" column="hospitaldistrictcode"/>
             <result property="hospitaldistrictname" column="hospitaldistrictname"/>
+            <result property="leaveldeptcode" column="leaveldeptcode"/>
+            <result property="leaveldeptname" column="leaveldeptname"/>
+            <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
+            <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
             <result property="patid" column="patid"/>
             <result property="drcode" column="drcode"/>
             <result property="drname" column="drname"/>
@@ -415,7 +419,8 @@
         pmoi.incitypedesc, pmoi.oplevelcode, pmoi.opleveldesc, pmoi.opposition, pmoi.del_flag, pmoi.update_by,
         pmoi.update_time, pmoi.create_by, pmoi.create_time, pmoi.isupload, pmoi.upload_time, pmoi.orgid,
         pmoi.pguid, pmoi.guid, pmoi.pid, pmoi.opercheck_flag, pmoi.long_task_reason,
-        pmo.deptcode, pmo.deptname, pmo.hospitaldistrictcode, pmo.hospitaldistrictname, pmo.patid,
+        pmo.deptcode, pmo.deptname, pmo.hospitaldistrictcode, pmo.hospitaldistrictname,
+        pmo.leaveldeptcode, pmo.leaveldeptname, pmo.leavehospitaldistrictcode, pmo.leavehospitaldistrictname, pmo.patid,
         pmo.drcode, pmo.drname, pmo.nurse_id, pmo.nurse_name
         from pat_med_operation pmo
         join pat_med_operation_item pmoi
@@ -509,6 +514,9 @@
                 #{levelCode}
             </foreach>
         </if>
+        <if test="opercheckFlag != null">
+            and pmoi.opercheck_flag = #{opercheckFlag}
+        </if>
     </select>
 
 </mapper>
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml
index b5c058d..7f5cc26 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml
@@ -63,6 +63,10 @@
         <result property="deptname" column="deptname"/>
         <result property="hospitaldistrictcode" column="hospitaldistrictcode"/>
         <result property="hospitaldistrictname" column="hospitaldistrictname"/>
+        <result property="leaveldeptcode" column="leaveldeptcode"/>
+        <result property="leaveldeptname" column="leaveldeptname"/>
+        <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
+        <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
         <result property="roomno" column="roomno"/>
         <result property="bedNo" column="bed_no"/>
         <result property="drcode" column="drcode"/>
@@ -137,6 +141,10 @@
                deptname,
                hospitaldistrictcode,
                hospitaldistrictname,
+               leaveldeptcode,
+               leaveldeptname,
+               leavehospitaldistrictcode,
+               leavehospitaldistrictname,
                roomno,
                bed_no,
                drcode,
@@ -317,6 +325,18 @@
             <if test="hospitaldistrictname != null  and hospitaldistrictname != ''">
                 and hospitaldistrictname like concat('%', #{hospitaldistrictname}, '%')
             </if>
+            <if test="leaveldeptcode != null  and leaveldeptcode != ''">
+                and leaveldeptcode = #{leaveldeptcode}
+            </if>
+            <if test="leaveldeptname != null  and leaveldeptname != ''">
+                and leaveldeptname like concat('%', #{leaveldeptname}, '%')
+            </if>
+            <if test="leavehospitaldistrictcode != null  and leavehospitaldistrictcode != ''">
+                and leavehospitaldistrictcode = #{leavehospitaldistrictcode}
+            </if>
+            <if test="leavehospitaldistrictname != null  and leavehospitaldistrictname != ''">
+                and leavehospitaldistrictname like concat('%', #{leavehospitaldistrictname}, '%')
+            </if>
             <if test="roomno != null  and roomno != ''">
                 and roomno = #{roomno}
             </if>
@@ -481,6 +501,14 @@
             </if>
             <if test="hospitaldistrictname != null">hospitaldistrictname,
             </if>
+            <if test="leaveldeptcode != null">leaveldeptcode,
+            </if>
+            <if test="leaveldeptname != null">leaveldeptname,
+            </if>
+            <if test="leavehospitaldistrictcode != null">leavehospitaldistrictcode,
+            </if>
+            <if test="leavehospitaldistrictname != null">leavehospitaldistrictname,
+            </if>
             <if test="roomno != null">roomno,
             </if>
             <if test="bedNo != null">bed_no,
@@ -622,6 +650,14 @@
             <if test="hospitaldistrictcode != null">#{hospitaldistrictcode},
             </if>
             <if test="hospitaldistrictname != null">#{hospitaldistrictname},
+            </if>
+            <if test="leaveldeptcode != null">#{leaveldeptcode},
+            </if>
+            <if test="leaveldeptname != null">#{leaveldeptname},
+            </if>
+            <if test="leavehospitaldistrictcode != null">#{leavehospitaldistrictcode},
+            </if>
+            <if test="leavehospitaldistrictname != null">#{leavehospitaldistrictname},
             </if>
             <if test="roomno != null">#{roomno},
             </if>
@@ -826,6 +862,18 @@
             <if test="hospitaldistrictname != null">hospitaldistrictname =
                 #{hospitaldistrictname},
             </if>
+            <if test="leaveldeptcode != null">leaveldeptcode =
+                #{leaveldeptcode},
+            </if>
+            <if test="leaveldeptname != null">leaveldeptname =
+                #{leaveldeptname},
+            </if>
+            <if test="leavehospitaldistrictcode != null">leavehospitaldistrictcode =
+                #{leavehospitaldistrictcode},
+            </if>
+            <if test="leavehospitaldistrictname != null">leavehospitaldistrictname =
+                #{leavehospitaldistrictname},
+            </if>
             <if test="roomno != null">roomno =
                 #{roomno},
             </if>

--
Gitblit v1.9.3