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 |   60 ++++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index ca1e06f..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}
@@ -485,7 +488,6 @@
                     #{tagId}
                 </foreach>
             </if>
-
         </where>
         order by a.update_time desc
     </select>
@@ -493,7 +495,6 @@
 
     <select id="selectPatArchiveInfoByInhosp" parameterType="com.smartor.domain.PatArchiveReq"
             resultMap="PatArchiveOthreInfoResult">
-
         select
         a.id,
         a.age_unit,
@@ -540,7 +541,6 @@
         d.endtime,
         d.nurse_name,
         d.nurse_id,
-        d.endtime,
         d.out_way_id,
         d.leavehospitaldistrictname AS leavehospitaldistrictname,
         d.leavehospitaldistrictcode AS leavehospitaldistrictcode,
@@ -548,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>
@@ -630,7 +632,6 @@
 
     <select id="selectPatArchiveInfoByOuthosp" parameterType="com.smartor.domain.PatArchiveReq"
             resultMap="PatArchiveOthreInfoResult">
-
         select
         a.id,
         a.age_unit,
@@ -670,13 +671,16 @@
         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>
@@ -756,13 +760,16 @@
         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>
@@ -805,7 +812,7 @@
             resultMap="PatArchiveOthreInfoResult">
 
         select
-        distinct a.idcardno,
+        a.idcardno,
         a.id,
         a.age_unit,
         a.age_unit2,
@@ -820,6 +827,8 @@
         d.deptcode,
         d.drcode,
         d.drname,
+        d.leavediagname,
+        d.leaveicd10code,
         a.sex,
         a.nation,
         a.native_place,
@@ -857,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>
@@ -886,14 +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>
-            <if test="deptname != null and deptname != ''">
-                AND d.deptname LIKE concat('%',#{deptname}, '%')
+            <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
@@ -919,14 +924,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,
@@ -946,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,
@@ -964,13 +970,16 @@
         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>
@@ -980,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}
@@ -1012,7 +1021,7 @@
             resultMap="PatArchiveOthreInfoResult">
 
         select
-        distinct a.idcardno,
+        a.idcardno,
         a.id,
         a.age_unit,
         a.age_unit2,
@@ -1050,13 +1059,16 @@
         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