From d3b362de432a32c10ccd039dfc417d8c6233f543 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 28 三月 2025 18:10:21 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml |  102 +++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 86 insertions(+), 16 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index c114008..95018be 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -59,11 +59,28 @@
         <result property="guid" column="guid"/>
         <result property="operator" column="operator"/>
         <result property="operatorId" column="operator_id"/>
+        <result property="remark" column="remark"/>
+        <result property="tagname" column="tagname"/>
+        <result property="fuflag" column="fuflag"/>
+        <result property="fudate" column="fudate"/>
+        <result property="fuperiod" column="fuperiod"/>
+        <result property="futypecode" column="futypecode"/>
+        <result property="futypedesc" column="futypedesc"/>
+        <result property="fuadivce" column="fuadivce"/>
+        <result property="fuspecialadvice" column="fuspecialadvice"/>
     </resultMap>
 
     <sql id="selectPatMedInhospVo">
         select inhospid,
                patname,
+               fuflag,
+               fudate,
+               fuperiod,
+               futypecode,
+               futypedesc,
+               fuadivce,
+               fuspecialadvice,
+               remark,
                guid,
                operator,
                operator_id,
@@ -120,9 +137,6 @@
         select CONCAT( a.age, a.age_unit ) AS age,
         a.telcode as telcode,
         a.sex,
-        b.guid,
-        b.operator,
-        b.operator_id,
         b.inhospid,
         b.nurse_id,
         b.nurse_name,
@@ -170,28 +184,37 @@
         b.deptid,
         b.leaveldeptid,
         b.long_task_reason,
-        b.schemetime
+        b.schemetime,
+        b.fuflag,
+        b.fudate,
+        b.fuperiod,
+        b.futypecode,
+        b.futypedesc,
+        b.fuadivce,
+        b.fuspecialadvice
         FROM
-        pat_med_inhosp b,
-        pat_archive a
+        pat_med_inhosp b
+        JOIN
+        pat_archive a ON a.id = b.patid
+        LEFT JOIN
+        pat_archivetag c ON c.patid = a.id AND (C.del_flag = 0 OR C.del_flag IS NULL)
         <where>
-            a.del_flag=0
-            and b.del_flag=0
-            and a.id = b.patid
-            AND a.idcardno != ''
+            a.del_flag = 0
+            AND b.del_flag = 0
+            AND a.idcardno IS NOT NULL
             <if test="startOutHospTime != null">
-                AND date_format(b.endtime,'%y%m%d') &gt;= date_format(#{startOutHospTime},'%y%m%d')
+                AND STR_TO_DATE(b.endtime,'%Y-%m-%d') &gt;= STR_TO_DATE(#{startOutHospTime},'%Y-%m-%d')
             </if>
             <if test="endOutHospTime != null">
-                AND date_format(b.endtime,'%y%m%d') &lt;= date_format(#{endOutHospTime},'%y%m%d')
+                AND STR_TO_DATE(b.endtime,'%Y-%m-%d') &lt;= STR_TO_DATE(#{endOutHospTime},'%Y-%m-%d')
             </if>
-
+            <if test="tagname != null  and tagname != ''">and c.tagname like concat('%', #{tagname}, '%')</if>
 
             <if test="startInHospTime != null">
-                AND date_format(b.starttime,'%y%m%d') &gt;= date_format(#{startInHospTime},'%y%m%d')
+                AND STR_TO_DATE(b.starttime, '%Y-%m-%d') >= STR_TO_DATE(#{startInHospTime}, '%Y-%m-%d')
             </if>
             <if test="endInHospTime != null">
-                AND date_format(b.starttime,'%y%m%d') &lt;= date_format(#{endInHospTime},'%y%m%d')
+                AND STR_TO_DATE(b.starttime, '%Y-%m-%d') &lt;= STR_TO_DATE(#{startInHospTime}, '%Y-%m-%d')
             </if>
             <if test="hospitalname != null  and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
                 '%')
@@ -202,6 +225,7 @@
             </if>
             <if test="endtime != null ">and b.endtime = #{endtime}</if>
             <if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
+            <if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
             <if test="serialnum != null ">and b.serialnum = #{serialnum}</if>
             <if test="endtime != null ">and b.endtime = #{endtime}</if>
             <if test="patno != null ">and b.patno = #{patno}</if>
@@ -242,9 +266,15 @@
                 </foreach>
             </if>
         </where>
+        GROUP BY
+        b.inhospid,
+        a.age,
+        a.age_unit,
+        a.telcode,
+        a.id,
+        a.sex
         order by b.inhospid desc
     </select>
-
     <select id="selectPatMedInhospListByCondition" parameterType="com.smartor.domain.PatMedInhospVO"
             resultMap="PatMedInhospResult">
         select CONCAT( a.age, a.age_unit ) AS age,
@@ -253,6 +283,7 @@
         b.patname,
         b.operator_id,
         b.operator,
+        b.remark,
         b.out_way_id,
         b.out_way_name,
         b.nurse_id,
@@ -298,6 +329,13 @@
         b.deptid,
         b.leaveldeptid,
         b.long_task_reason,
+        b.fuflag,
+        b.fudate,
+        b.fuperiod,
+        b.futypecode,
+        b.futypedesc,
+        b.fuadivce,
+        b.fuspecialadvice
         b.schemetime
         FROM
         pat_med_inhosp b,
@@ -315,6 +353,7 @@
                 concat('%', #{hospitaldistrictname}, '%')
             </if>
             <if test="endtime != null ">and b.endtime = #{endtime}</if>
+            <if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
             <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
             <if test="nurseName != null ">and b.nurse_name = #{nurseName}</if>
             <if test="patno != null ">and b.patno = #{patno}</if>
@@ -341,6 +380,13 @@
             </if>
         </where>
         order by b.inhospid desc
+    </select>
+
+    <select id="getTagnameBypatid" parameterType="Long" resultType="string">
+        SELECT GROUP_CONCAT(d.tagname, ', ')
+        FROM pat_archivetag d
+        WHERE d.patid = #{patid}
+          AND d.del_flag = 0
     </select>
 
 
@@ -403,6 +449,14 @@
             <if test="operator != null ">operator,</if>
             <if test="operatorId != null ">operator_id,</if>
             <if test="inhospno != null ">inhospno,</if>
+            <if test="remark != null ">remark,</if>
+            <if test="fuflag != null ">fuflag,</if>
+            <if test="fudate != null ">fudate,</if>
+            <if test="fuperiod != null ">fuperiod,</if>
+            <if test="futypecode != null ">futypecode,</if>
+            <if test="futypedesc != null ">futypedesc,</if>
+            <if test="fuadivce != null ">fuadivce,</if>
+            <if test="fuspecialadvice != null ">fuspecialadvice,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="serialnum != null">#{serialnum},</if>
@@ -455,6 +509,14 @@
             <if test="operator != null ">#{operator},</if>
             <if test="operatorId != null ">#{operatorId},</if>
             <if test="inhospno != null ">#{inhospno},</if>
+            <if test="remark != null ">#{remark},</if>
+            <if test="fuflag != null ">#{fuflag},</if>
+            <if test="fudate != null ">#{fudate},</if>
+            <if test="fuperiod != null ">#{fuperiod},</if>
+            <if test="futypecode != null ">#{futypecode},</if>
+            <if test="futypedesc != null ">#{futypedesc},</if>
+            <if test="fuadivce != null ">#{fuadivce},</if>
+            <if test="fuspecialadvice != null ">#{fuspecialadvice},</if>
         </trim>
     </insert>
 
@@ -510,6 +572,14 @@
             <if test="guid != null ">guid = #{guid},</if>
             <if test="operator != null ">operator = #{operator},</if>
             <if test="operatorId != null ">operator_id = #{operatorId},</if>
+            <if test="remark != null ">remark = #{remark},</if>
+            <if test="fuflag != null ">fuflag = #{fuflag},</if>
+            <if test="fudate != null ">fudate = #{fudate},</if>
+            <if test="fuperiod != null ">fuperiod = #{fuperiod},</if>
+            <if test="futypecode != null ">futypecode = #{futypecode},</if>
+            <if test="futypedesc != null ">futypedesc = #{futypedesc},</if>
+            <if test="fuadivce != null ">fuadivce = #{fuadivce},</if>
+            <if test="fuspecialadvice != null ">fuspecialadvice = #{fuspecialadvice},</if>
         </trim>
         where inhospid = #{inhospid}
     </update>

--
Gitblit v1.9.3