From e4e220916dd2a4aa649a9b0162e5b5ed0dc9d7e5 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 20 五月 2025 10:36:54 +0800
Subject: [PATCH] 代码提交

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

diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index 6d19dff..80a2175 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -117,6 +117,8 @@
         <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
         <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
         <result property="guid" column="guid"/>
+        <result property="leavediagname" column="leavediagname"/>
+        <result property="leaveicd10code" column="leaveicd10code"/>
     </resultMap>
 
     <sql id="selectPatArchiveVo">
@@ -474,6 +476,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}
@@ -545,11 +548,13 @@
         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>
@@ -669,11 +674,13 @@
         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>
@@ -756,11 +763,13 @@
         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>
@@ -818,6 +827,8 @@
         d.deptcode,
         d.drcode,
         d.drname,
+        d.leavediagname,
+        d.leaveicd10code,
         a.sex,
         a.nation,
         a.native_place,
@@ -855,11 +866,13 @@
         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>
@@ -884,11 +897,8 @@
             <if test="deptname != null and deptname != ''">
                 and d.deptname LIKE concat('%', #{deptname}, '%')
             </if>
-            <if test="drname != null and drname != ''">
-                AND d.drname LIKE concat('%',#{drname}, '%')
-            </if>
-            <if test="diagname != null and diagname != ''">
-                AND d.diagname LIKE concat('%',#{diagname}, '%')
+            <if test="leavediagname != null and leavediagname != ''">
+                AND d.leavediagname LIKE concat('%',#{leavediagname}, '%')
             </if>
             <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
                 AND d.leavehospitaldistrictcode IN
@@ -940,6 +950,8 @@
         a.place_of_residence,
         a.birthplace,
         a.birthdate,
+        a.icd10code as leaveicd10code,
+        a.diagname as leavediagname,
         a.age,
         a.age2,
         a.viptype,
@@ -961,11 +973,13 @@
         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>
@@ -975,8 +989,8 @@
             </if>
             <if test="notrequiredFlag != null  and notrequiredFlag != ''">and a.notrequired_flag = #{notrequiredFlag}
             </if>
-            <if test="diagname != null and diagname != ''">
-                AND d.diagname LIKE concat('%',#{diagname}, '%')
+            <if test="leavediagname != null and leavediagname != ''">
+                AND d.diagname LIKE concat('%',#{leavediagname}, '%')
             </if>
             <if test="hospitalname != null and hospitalname != ''">
                 AND d.hospitalname = #{hospitalname}
@@ -1048,11 +1062,13 @@
         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