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

---
 smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOperationMapper.xml
index aba4680..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,
@@ -156,8 +164,8 @@
     <select id="selectPatMedOperationList" parameterType="com.smartor.domain.PatMedOperation"
             resultMap="PatMedOperationResult">
         <include refid="selectPatMedOperationVo"/>
-        <where>
-            del_flag='0'
+        where 1=1
+            and del_flag='0'
             <if test="patid != null ">
                 and patid = #{patid}
             </if>
@@ -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>
@@ -356,7 +376,6 @@
             <if test="opleveldesc != null  and opleveldesc != ''">
                 and opleveldesc = #{opleveldesc}
             </if>
-        </where>
     </select>
 
     <select id="selectPatMedOperationById" parameterType="Long"
@@ -365,11 +384,9 @@
         where id = #{id}
     </select>
 
-    <insert id="insertPatMedOperation" parameterType="com.smartor.domain.PatMedOperation">
+    <insert id="insertPatMedOperation" parameterType="com.smartor.domain.PatMedOperation" useGeneratedKeys="true" keyProperty="id">
         insert into pat_med_operation
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="id != null">id,
-            </if>
             <if test="patid != null">patid,
             </if>
             <if test="patcode != null">patcode,
@@ -484,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,
@@ -512,8 +537,6 @@
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="id != null">#{id},
-            </if>
             <if test="patid != null">#{patid},
             </if>
             <if test="patcode != null">#{patcode},
@@ -627,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>
@@ -831,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