From 9d26379470b304ca084c877c114c051d57b495d6 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 30 一月 2026 16:44:42 +0800
Subject: [PATCH] 【市一】市一同步逻辑调整,增加hospinfo和deptinfo记录

---
 smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml |  113 ++++++++++++++++++++++++--------------------------------
 1 files changed, 49 insertions(+), 64 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
index 1f482fc..9b42b4a 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
@@ -86,17 +86,10 @@
             resultMap="PatMedOuthospResult">
         select
         pmo.id,
-        pmo.campusid,
-        pmo.remark,
-        pmo.fudate,
-        pmo.server_state,
         pmo.outhospno,
-        pmo.diagcheck_flag,
         pmo.patno,
         pmo.serialnum,
         pmo.patid,
-        pmo.hospitalname,
-        pmo.hospitalcode,
         pmo.icd10code,
         pmo.diagname,
         pmo.deptcode,
@@ -104,25 +97,15 @@
         pmo.drcode,
         pmo.drname,
         pmo.admitdate,
-        pmo.orgid,
-        pmo.del_flag,
-        pmo.guid,
-        pmo.update_by,
-        pmo.update_time,
-        pmo.create_by,
-        pmo.create_time,
-        pmo.isupload,
-        pmo.upload_time,
         pmo.schemestatus,
         pmo.deptid,
         pmo.schemetime,
-        pmo.hpi,
         pmo.fuflag,
         pmo.patname,
+        pmo.update_time,
         pmo.mainsuit
         from pat_med_outhosp pmo
-        where 1=1
-            and pmo.del_flag=0
+        <where>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>
@@ -153,7 +136,9 @@
             <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
+        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
     </select>
 
     <select id="selectPatMedOuthospById" parameterType="Long" resultMap="PatMedOuthospResult">
@@ -460,18 +445,18 @@
         FROM
         pat_med_outhosp
         where 1=1
-            and del_flag = 0
-            <if test="orgid != null">
-                and orgid = #{orgid}
-            </if>
-            and date_format(admitdate,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
-            and date_format(admitdate,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
-            <if test="deptcodeList != null and deptcodeList.size()>0">
-                and deptcode in
-                <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
-                    #{deptcode}
-                </foreach>
-            </if>
+        and del_flag = 0
+        <if test="orgid != null">
+            and orgid = #{orgid}
+        </if>
+        and date_format(admitdate,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
+        and date_format(admitdate,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
+        <if test="deptcodeList != null and deptcodeList.size()>0">
+            and deptcode in
+            <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
+                #{deptcode}
+            </foreach>
+        </if>
         union all
         select
         0 AS rc,
@@ -479,23 +464,23 @@
         FROM
         service_subtask
         where 1=1
-            and del_flag = 0
-            and service_type=3
-            <if test="orgid != null">
-                and orgid = #{orgid}
-            </if>
-            <if test="startDate != null">
-                AND date_format( visit_time, '%y%m%d' ) &gt;= date_format( #{startDate}, '%y%m%d' )
-            </if>
-            <if test="endDate != null">
-                AND date_format( visit_time, '%y%m%d' ) &lt;= date_format(#{endDate},'%y%m%d')
-            </if>
-            <if test="deptcodeList != null and deptcodeList.size()>0">
-                and deptcode in
-                <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
-                    #{deptcode}
-                </foreach>
-            </if>
+        and del_flag = 0
+        and service_type=3
+        <if test="orgid != null">
+            and orgid = #{orgid}
+        </if>
+        <if test="startDate != null">
+            AND date_format( visit_time, '%y%m%d' ) &gt;= date_format( #{startDate}, '%y%m%d' )
+        </if>
+        <if test="endDate != null">
+            AND date_format( visit_time, '%y%m%d' ) &lt;= date_format(#{endDate},'%y%m%d')
+        </if>
+        <if test="deptcodeList != null and deptcodeList.size()>0">
+            and deptcode in
+            <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
+                #{deptcode}
+            </foreach>
+        </if>
         ) AS combined_data
     </select>
 
@@ -503,22 +488,22 @@
         SELECT deptname, COUNT(1) AS rc
         FROM pat_med_outhosp
         where 1=1
-            and del_flag = 0
-            <if test="orgid != null  and orgid != ''">
-                and orgid = #{orgid}
-            </if>
-            <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
-                <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
-                    #{deptcode}
-                </foreach>
-            </if>
+        and del_flag = 0
+        <if test="orgid != null  and orgid != ''">
+            and orgid = #{orgid}
+        </if>
+        <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
+            <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
+                #{deptcode}
+            </foreach>
+        </if>
     </select>
 
     <!-- PatMedOuthospMapper.xml -->

--
Gitblit v1.9.3