From ba69dcfe19d7718449f45b3aba8e9fc75ed93025 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 15 四月 2025 15:56:14 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index 036a68a..fef487e 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -432,7 +432,7 @@
             resultMap="PatArchiveOthreInfoResult">
 
         SELECT
-        DISTINCT a.id,
+        a.id,
         a.age_unit,
         a.age_unit2,
         a.patid_his,
@@ -474,6 +474,7 @@
         LEFT JOIN pat_archivetag b ON a.id = b.patid AND b.del_flag = 0
         <where>
             a.del_flag = 0
+            and a.orgid = #{orgid}
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
             <if test="notrequiredFlag != null  and notrequiredFlag != ''">and a.notrequired_flag = #{notrequiredFlag}
@@ -485,7 +486,6 @@
                     #{tagId}
                 </foreach>
             </if>
-
         </where>
         order by a.update_time desc
     </select>
@@ -493,9 +493,8 @@
 
     <select id="selectPatArchiveInfoByInhosp" parameterType="com.smartor.domain.PatArchiveReq"
             resultMap="PatArchiveOthreInfoResult">
-
         select
-        DISTINCT a.id,
+        a.id,
         a.age_unit,
         a.age_unit2,
         a.inhospno,
@@ -547,11 +546,12 @@
         FROM
         pat_med_inhosp d
         JOIN pat_archive a ON a.id = d.patid
-        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag GROUP BY patid ) t ON t.patid =
+        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid ) t ON t.patid =
         d.patid
         <where>
             d.del_flag != 1
             AND a.del_flag != 1
+            and d.orgid = #{orgid}
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
             <if test="pid != null  and pid != ''">and a.id = #{id}</if>
@@ -629,9 +629,8 @@
 
     <select id="selectPatArchiveInfoByOuthosp" parameterType="com.smartor.domain.PatArchiveReq"
             resultMap="PatArchiveOthreInfoResult">
-
         select
-        DISTINCT a.id,
+        a.id,
         a.age_unit,
         a.age_unit2,
         a.patid_his,
@@ -669,13 +668,15 @@
         a.create_time,
         a.isupload,
         a.upload_time,
+        t.tagname,
         a.pattype
         from pat_med_outhosp d JOIN pat_archive a ON a.id = d.patid
-        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag GROUP BY patid ) t ON t.patid =
+        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid ) t ON t.patid =
         d.patid
         <where>
             d.del_flag != 1
             AND a.del_flag != 1
+            and d.orgid = #{orgid}
             <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
@@ -755,13 +756,15 @@
         a.create_time,
         a.isupload,
         a.upload_time,
+        t.tagname,
         a.pattype
         from pat_med_physical d JOIN pat_archive a ON a.id = d.patid
-        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag GROUP BY patid ) t ON t.patid =
+        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid ) t ON t.patid =
         d.patid
         <where>
             d.del_flag != 1
             AND a.del_flag != 1
+            and d.orgid = #{orgid}
             <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
@@ -804,7 +807,7 @@
             resultMap="PatArchiveOthreInfoResult">
 
         select
-        distinct a.idcardno,
+        a.idcardno,
         a.id,
         a.age_unit,
         a.age_unit2,
@@ -856,11 +859,12 @@
         FROM
         pat_med_inhosp d
         JOIN pat_archive a ON a.id = d.patid
-        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag GROUP BY patid ) t ON t.patid =
+        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid ) t ON t.patid =
         d.patid
         <where>
             d.del_flag != 1
             AND a.del_flag != 1
+            and d.orgid = #{orgid}
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
             <if test="pid != null  and pid != ''">and a.id = #{id}</if>
@@ -891,9 +895,6 @@
             <if test="diagname != null and diagname != ''">
                 AND d.diagname LIKE concat('%',#{diagname}, '%')
             </if>
-            <if test="deptname != null and deptname != ''">
-                AND d.deptname LIKE concat('%',#{deptname}, '%')
-            </if>
             <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
                 AND d.leavehospitaldistrictcode IN
                 <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
@@ -918,14 +919,13 @@
                 AND NOT exists ( SELECT 1 FROM pat_filterlist f where d.patid=f.patid)
             </if>
         </where>
-        order by a.update_time desc
     </select>
 
     <select id="selectPatArchiveInfoByOuthospQC" parameterType="com.smartor.domain.PatArchiveReq"
             resultMap="PatArchiveOthreInfoResult">
 
         select
-        distinct a.idcardno,
+        a.idcardno,
         a.id,
         a.age_unit,
         a.age_unit2,
@@ -963,13 +963,15 @@
         a.create_time,
         a.isupload,
         a.upload_time,
+        t.tagname,
         a.pattype
         from pat_med_outhosp d JOIN pat_archive a ON a.id = d.patid
-        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag GROUP BY patid ) t ON t.patid =
+        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid ) t ON t.patid =
         d.patid
         <where>
             d.del_flag != 1
             AND a.del_flag != 1
+            and d.orgid = #{orgid}
             <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
@@ -1011,7 +1013,7 @@
             resultMap="PatArchiveOthreInfoResult">
 
         select
-        distinct a.idcardno,
+        a.idcardno,
         a.id,
         a.age_unit,
         a.age_unit2,
@@ -1049,13 +1051,15 @@
         a.create_time,
         a.isupload,
         a.upload_time,
+        t.tagname,
         a.pattype
         from pat_med_physical d JOIN pat_archive a ON a.id = d.patid
-        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag GROUP BY patid ) t ON t.patid =
+        LEFT JOIN ( SELECT patid, GROUP_CONCAT( tagname ) AS tagname FROM pat_archivetag where del_flag=0 GROUP BY patid ) t ON t.patid =
         d.patid
         <where>
             d.del_flag != 1
             AND a.del_flag != 1
+            and d.orgid = #{orgid}
             <if test="pid != null  and pid != ''">and a.id = #{pid}</if>
             <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
             <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>

--
Gitblit v1.9.3