From 987e38327f849e1b13d8541246dde08d877db0e8 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 07 一月 2026 14:10:43 +0800
Subject: [PATCH] 【市一】调整mapper获取ordid

---
 smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml |  147 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 126 insertions(+), 21 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
index 039bc61..27aedda 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
@@ -39,11 +39,15 @@
         <result property="idcardno" column="idcardno"/>
         <result property="remark" column="remark"/>
         <result property="fudate" column="fudate"/>
+        <result property="serverState" column="server_state"/>
+        <result property="campusid" column="campusid"/>
     </resultMap>
 
     <sql id="selectPatMedOuthospVo">
         select id,
                outhospno,
+               campusid,
+               server_state,
                diagcheck_flag,
                patno,
                remark,
@@ -82,8 +86,10 @@
             resultMap="PatMedOuthospResult">
         select
         pmo.id,
+        pmo.campusid,
         pmo.remark,
         pmo.fudate,
+        pmo.server_state,
         pmo.outhospno,
         pmo.diagcheck_flag,
         pmo.patno,
@@ -115,38 +121,40 @@
         pmo.patname,
         pmo.mainsuit
         from pat_med_outhosp pmo
-        <where>
-            pmo.del_flag=0
+        WHERE 1=1
+            <if test="orgid != null and orgid != ''"> and orgid = #{orgid}</if>
+
+            AND pmo.del_flag=0
             <if test="orgid != null ">and pmo.orgid = #{orgid}</if>
+            <if test="serialnum != null ">and pmo.serialnum = #{serialnum}</if>
+            <if test="serverState != null ">and pmo.server_state = #{serverState}</if>
             <if test="hospitalname != null  and hospitalname != ''">and pmo.hospitalname like concat('%',
                 #{hospitalname},
-                '%')
+               '%')
             </if>
             <if test="deptcodes != null and deptcodes.size()>0">
-                AND  pmo.deptcode IN
-                <foreach collection="deptcodes" item="deptcode" open="(" separator=","
-                         close=")">
+                AND pmo.deptcode IN
+                <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
                     #{deptcode}
                 </foreach>
             </if>
-
-
             <if test="deptname != null  and deptname != ''">and pmo.deptname like concat('%', #{deptname}, '%')</if>
             <if test="drname != null  and drname != ''">and pmo.drname like concat('%', #{drname}, '%')</if>
             <if test="patname != null  and patname != ''">and pmo.patname like concat('%', #{patname}, '%')</if>
             <if test="beginTime != null ">and date_format(pmo.admitdate,'%y%m%d') &gt;=
-                date_format(#{beginTime},'%y%m%d')
+                AND date_format(#{beginTime},'%y%m%d')
             </if>
             <if test="endTime != null ">and date_format(pmo.admitdate,'%y%m%d') &lt;=
-                date_format(#{endTime},'%y%m%d')
+                AND date_format(#{endTime},'%y%m%d')
             </if>
             <if test="patid != null ">and pmo.patid = #{patid}</if>
+            <if test="campusid != null ">and pmo.campusid = #{campusid}</if>
             <if test="fuflag != null ">and pmo.fuflag = #{fuflag}</if>
             <if test="patno != null ">and pmo.patno = #{patno}</if>
             <if test="outhospno != null  and outhospno != ''">and pmo.outhospno = #{outhospno}</if>
             <if test="diagcheckFlag != null  and diagcheckFlag != ''">and pmo.diagcheck_flag = #{diagcheckFlag}</if>
             <if test="diagname != null  and diagname != ''">and pmo.diagname like concat('%',#{diagname}, '%')</if>
-        </where>
+        
         order by pmo.update_time desc
     </select>
 
@@ -191,6 +199,8 @@
             <if test="remark != null">remark,</if>
             <if test="fuflag != null">fuflag,</if>
             <if test="fudate != null">fudate,</if>
+            <if test="campusid != null">campusid,</if>
+            <if test="serverState != null">server_state,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="serialnum != null">#{serialnum},</if>
@@ -225,6 +235,8 @@
             <if test="remark != null">#{remark},</if>
             <if test="fuflag != null">#{fuflag},</if>
             <if test="fudate != null">#{fudate},</if>
+            <if test="campusid != null">#{campusid},</if>
+            <if test="serverState != null">#{serverState},</if>
         </trim>
     </insert>
 
@@ -262,6 +274,8 @@
         diagcheck_flag,
         fuflag,
         fudate,
+        campusid,
+        server_state,
         remark)
         values
         <foreach collection="list" item="item" separator=",">
@@ -297,6 +311,86 @@
             #{item.diagcheckFlag},
             #{item.fuflag},
             #{item.fudate},
+            #{item.campusid},
+            #{item.serverState},
+            #{item.remark}
+            )
+        </foreach>
+    </insert>
+
+    <insert id="batchInsertIgnore">
+        insert ignore into pat_med_outhosp
+        (
+        serialnum,
+        patid,
+        hospitalname,
+        hospitalcode,
+        icd10code,
+        diagname,
+        deptcode,
+        deptname,
+        drcode,
+        drname,
+        admitdate,
+        orgid,
+        del_flag,
+        update_by,
+        update_time,
+        create_by,
+        create_time,
+        isupload,
+        upload_time,
+        schemestatus,
+        deptid,
+        schemetime,
+        hpi,
+        mainsuit,
+        outhospno,
+        patname,
+        guid,
+        patno,
+        diagcheck_flag,
+        fuflag,
+        fudate,
+        campusid,
+        server_state,
+        remark)
+        values
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.serialnum},
+            #{item.patid},
+            #{item.hospitalname},
+            #{item.hospitalcode},
+            #{item.icd10code},
+            #{item.diagname},
+            #{item.deptcode},
+            #{item.deptname},
+            #{item.drcode},
+            #{item.drname},
+            #{item.admitdate},
+            #{item.orgid},
+            #{item.delFlag},
+            #{item.updateBy},
+            #{item.updateTime},
+            #{item.createBy},
+            #{item.createTime},
+            #{item.isupload},
+            #{item.uploadTime},
+            #{item.schemestatus},
+            #{item.deptid},
+            #{item.schemetime},
+            #{item.hpi},
+            #{item.mainsuit},
+            #{item.outhospno},
+            #{item.patname},
+            #{item.guid},
+            #{item.patno},
+            #{item.diagcheckFlag},
+            #{item.fuflag},
+            #{item.fudate},
+            #{item.campusid},
+            #{item.serverState},
             #{item.remark}
             )
         </foreach>
@@ -338,6 +432,8 @@
             <if test="remark != null">remark = #{remark},</if>
             <if test="fuflag != null">fuflag = #{fuflag},</if>
             <if test="fudate != null">fudate = #{fudate},</if>
+            <if test="campusid != null">campusid = #{campusid},</if>
+            <if test="serverState != null">server_state = #{serverState},</if>
         </trim>
         where id = #{id}
     </update>
@@ -365,8 +461,10 @@
         0 AS rs
         FROM
         pat_med_outhosp
-        <where>
-            del_flag=0
+        WHERE 1=1
+            <if test="orgid != null and orgid != ''"> and orgid = #{orgid}</if>
+
+            AND del_flag=0
             <if test="orgid != null">
                 and orgid = #{orgid}
             </if>
@@ -378,15 +476,17 @@
                     #{deptcode}
                 </foreach>
             </if>
-        </where>
+        
         union all
         select
         0 AS rc,
         count(1) AS rs
         FROM
         service_subtask
-        <where>
-            del_flag = 0
+        WHERE 1=1
+            <if test="orgid != null and orgid != ''"> and orgid = #{orgid}</if>
+
+            AND del_flag = 0
             and service_type=3
             <if test="orgid != null">
                 and orgid = #{orgid}
@@ -403,17 +503,22 @@
                     #{deptcode}
                 </foreach>
             </if>
-        </where>
+        
         ) AS combined_data
     </select>
 
     <select id="getDeptRanking" parameterType="com.smartor.domain.PatMedReq" resultType="com.smartor.domain.PatMedRes">
         SELECT deptname, COUNT(1) AS rc
         FROM pat_med_outhosp
-        <where>
-            del_flag=0
-            <if test="inhospstate != inhospstate">
+        WHERE 1=1
+            <if test="orgid != null and orgid != ''"> and orgid = #{orgid}</if>
+
+            AND del_flag=0
+            <if test="inhospstate != null">
                 and inhospstate= #{inhospstate}
+            </if>
+            <if test="serverState != null">
+                and server_state= #{inhospstate}
             </if>
             <if test="deptcodeList != null and deptcodeList.size()>0">
                 and deptcode in
@@ -421,7 +526,7 @@
                     #{deptcode}
                 </foreach>
             </if>
-        </where>
+        
     </select>
 
     <!-- PatMedOuthospMapper.xml -->

--
Gitblit v1.9.3