From e0d63096c613106d3aa149ca80552a444ac820a0 Mon Sep 17 00:00:00 2001
From: zhs <zhs18203887318@163.com>
Date: 星期五, 27 六月 2025 10:10:45 +0800
Subject: [PATCH] 06-27 zhs

---
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 670e726..6b379f6 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -80,6 +80,8 @@
         <result property="isVisitAgain" column="is_visit_again"/>
         <result property="upid" column="upid"/>
         <result property="visitTime" column="visit_time"/>
+        <result property="visitDeptName" column="visit_dept_name"/>
+        <result property="visitDeptCode" column="visit_dept_code"/>
     </resultMap>
 
     <resultMap type="com.smartor.domain.ServiceSubtaskCount" id="ServiceSubtaskResult2">
@@ -95,6 +97,8 @@
                task_guid,
                patfrom,
                upid,
+               visit_dept_name,
+               visit_dept_code,
                visit_time,
                inhospid,
                visit_count,
@@ -165,7 +169,8 @@
                leavehospitaldistrictcode,
                leavehospitaldistrictname,
                leavediagname,
-               leaveicd10code
+               leaveicd10code,
+               visit_type
         from service_subtask
     </sql>
 
@@ -182,6 +187,7 @@
             <if test="leavehospitaldistrictname != null  and leavehospitaldistrictname != ''">and
                 leavehospitaldistrictname = #{leavehospitaldistrictname}
             </if>
+            <if test="leavediagname != null  and leavediagname != ''">and leavediagname like concat('%', #{leavediagname}, '%')</if>
             <if test="sex != null  and sex != ''">and sex = #{sex}</if>
             <if test="age != null ">and age = #{age}</if>
             <if test="patguid != null ">and patguid = #{patguid}</if>
@@ -289,13 +295,29 @@
             <if test="excep != null ">and excep = #{excep}</if>
             <if test="nurseName != null ">and nurse_name = #{nurseName}</if>
             <if test="score != null">and score = #{score}</if>
-            <if test="visitCount != null">and visit_count = #{visitCount}</if>
+            <!--            <if test="visitCount != null">and visit_count = #{visitCount}</if>-->
+            <if test="visitCount != null and visitCount == 1">
+                AND visit_count = 1
+            </if>
+            <if test="visitCount != null and visitCount > 1">
+                AND visit_count > 1
+            </if>
             <if test="remark != null">and remark = #{remark}</if>
             <if test="suggest != null">and suggest = #{suggest}</if>
             <if test="createBy != null">and create_by = #{createBy}</if>
             <if test="taskGuid != null">and task_guid = #{taskGuid}</if>
             <if test="isVisitAgain != null">and is_visit_again = #{isVisitAgain}</if>
             <if test="visitTime != null">and visit_time = #{visitTime}</if>
+            <!--<if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
+            <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>-->
+            <if test="visitCount != null and visitCount > 1 and visitDeptCodes != null and visitDeptCodes.size() > 0">
+                AND visit_dept_code IN
+                <foreach collection="visitDeptCodes" item="visitDeptCodes" open="("
+                         separator=","
+                         close=")">
+                    #{visitDeptCodes}
+                </foreach>
+            </if>
         </where>
         <if test="sort != null  and sort==0">order by endtime asc</if>
         <if test="sort != null  and sort==1">order by endtime desc</if>
@@ -322,6 +344,8 @@
             <if test="upid != null ">and upid = #{upid}</if>
             <if test="visitCount != null ">and visit_count = #{visitCount}</if>
             <if test="isVisitAgain != null ">and is_visit_again = #{isVisitAgain}</if>
+            <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
+            <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
         </where>
 
     </select>
@@ -374,6 +398,8 @@
             <if test="excep != null ">and excep = #{excep}</if>
             <if test="nurseName != null ">and nurse_name = #{nurseName}</if>
             <if test="visitTime != null ">and visit_time = #{visitTime}</if>
+            <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
+            <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
         </where>
 
     </select>
@@ -471,7 +497,9 @@
             <if test="visitCount != null ">visit_count,</if>
             <if test="isVisitAgain != null ">is_visit_again,</if>
             <if test="upid != null ">upid,</if>
-            <if test="visit_time != null ">visitTime,</if>
+            <if test="visitTime != null ">visit_Time,</if>
+            <if test="visitDeptCode != null">visit_dept_code,</if>
+            <if test="visitDeptName != null">visit_dept_name,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="sendname != null">#{sendname},</if>
@@ -551,6 +579,8 @@
             <if test="isVisitAgain != null ">#{isVisitAgain},</if>
             <if test="upid != null ">#{upid},</if>
             <if test="visitTime != null ">#{visitTime},</if>
+            <if test="visitDeptCode != null">#{visitDeptCode},</if>
+            <if test="visitDeptName != null">#{visitDeptName},</if>
         </trim>
     </insert>
 
@@ -635,6 +665,8 @@
             <if test="isVisitAgain != null ">is_visit_again=#{isVisitAgain},</if>
             <if test="upid != null ">upid=#{upid},</if>
             <if test="visitTime != null ">visit_time=#{visitTime},</if>
+            <if test="visitDeptCode != null">visit_dept_code = #{visitDeptCode},</if>
+            <if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
         </trim>
         where id = #{id}
     </update>
@@ -720,6 +752,8 @@
             <if test="isVisitAgain != null ">is_visit_again=#{isVisitAgain},</if>
             <if test="upid != null ">upid=#{upid},</if>
             <if test="visitTime != null ">visit_time=#{visitTime},</if>
+            <if test="visitDeptCode != null">visit_dept_code = #{visitDeptCode},</if>
+            <if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
         </trim>
         <where>
             <if test="patid != null ">and patid = #{patid}</if>
@@ -807,6 +841,8 @@
             <if test="patguid != null ">patguid=#{patguid},</if>
             <if test="upid != null ">upid=#{upid},</if>
             <if test="visitTime != null ">visit_time=#{visitTime},</if>
+            <if test="visitDeptCode != null">visit_dept_code = #{visitDeptCode},</if>
+            <if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
         </trim>
         where patid = #{patid} and taskid = #{taskid}
     </update>
@@ -891,6 +927,8 @@
             <if test="patguid != null ">patguid=#{patguid},</if>
             <if test="upid != null ">upid=#{upid},</if>
             <if test="visitTime != null ">visit_time=#{visitTime},</if>
+            <if test="visitDeptCode != null">visit_dept_code = #{visitDeptCode},</if>
+            <if test="visitDeptName != null">visit_dept_name = #{visitDeptName},</if>
         </trim>
         where task_guid = #{taskGuid} and task_name = #{taskName}
     </update>
@@ -924,6 +962,13 @@
                     #{leavehospitaldistrictcode}
                 </foreach>
             </if>
+            <if test="deptcodes != null and deptcodes.size() > 0">
+                AND leavehospitaldistrictcode IN
+                <foreach collection="deptcodes" item="deptcode" open="(" separator=","
+                         close=")">
+                    #{leavehospitaldistrictcode}
+                </foreach>
+            </if>
             <if test="serviceType != null and serviceType.size() > 0">
                 AND service_type IN
                 <foreach collection="serviceType" item="serviceType" open="(" separator=","
@@ -935,6 +980,8 @@
                 AND endtime > #{startTime}
                 AND endtime &lt;= #{endTime}
             </if>
+            <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
+            <if test="visitDeptName != null">abd visit_dept_name = #{visitDeptName}</if>
         </where>
     </select>
 
@@ -1010,6 +1057,8 @@
                task_guid,
                leavediagname,
                patguid,
+               visitDeptCode,
+               visitDeptName,
                leaveicd10code
         FROM service_subtask,
              JSON_TABLE(send_time_slot, '$[*]' COLUMNS (

--
Gitblit v1.9.3