From c8fbebc0d6e4142233cffe5a1808f1df685bda2c Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 18 九月 2026 15:06:31 +0800
Subject: [PATCH] 【市一】随访增加院区限制

---
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml       |   23 ++++++++---
 smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml        |    4 +-
 smartor/src/main/java/com/smartor/domain/ServiceStatisticsRequest.java |    3 +
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml     |   61 ++++++++++++++++++++----------
 4 files changed, 62 insertions(+), 29 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/domain/ServiceStatisticsRequest.java b/smartor/src/main/java/com/smartor/domain/ServiceStatisticsRequest.java
index 880d3e2..c2b47b9 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceStatisticsRequest.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceStatisticsRequest.java
@@ -34,6 +34,9 @@
     @ApiModelProperty(value = "鏈烘瀯ID锛屼负绌哄垯鏌ヨ鎵�鏈�")
     private String orgid;
 
+    @ApiModelProperty(value = "闄㈠尯ID锛屼负绌哄垯鏌ヨ鎵�鏈�")
+    private String campusid;
+
     @ApiModelProperty(value = "绉戝缂栫爜鍒楄〃锛屼负绌哄垯鏌ヨ鎵�鏈�")
     private List<String> deptcodes;
 
diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index e9f230f..4baa70c 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -274,6 +274,7 @@
         <if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
         <if test="fuflag != null ">and b.fuflag = #{fuflag}</if>
         <if test="orgid != null ">and b.orgid = #{orgid}</if>
+        <if test="campusid != null ">and b.campusid = #{campusid}</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>
@@ -293,7 +294,6 @@
         <if test="cry != null and cry == 2 ">and b.inhospstate=2</if>
         <if test="cry != null and cry == 3 ">and b.inhospstate=3</if>
         <if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if>
-        <if test="campusid != null ">and b.campusid = #{campusid}</if>
         <if test="schemestatus != null ">and b.schemestatus = #{schemestatus}</if>
         <if test="outWayId != null ">and b.out_way_id = #{outWayId}</if>
         <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if>
@@ -454,6 +454,9 @@
         <if test="orgid != null and orgid != ''">
             and orgid = #{orgid}
         </if>
+        <if test="campusid != null and campusid != ''">
+            and campusid = #{campusid}
+        </if>
         <if test="encounterSourceId != null and encounterSourceId != ''">
             and b.encounter_source_id = #{encounterSourceId}
         </if>
@@ -565,6 +568,9 @@
         <if test="orgid != null and orgid != ''">
             and a.orgid = #{orgid}
         </if>
+        <if test="campusid != null and campusid != ''">
+            and a.campusid = #{campusid}
+        </if>
         <if test="hospitalname != null  and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
             '%')
         </if>
@@ -580,7 +586,6 @@
         <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>
-        <if test="campusid != null ">and b.campusid = #{campusid}</if>
         <if test="diagcheckFlag != null ">and b.diagcheck_flag = #{diagcheckFlag}</if>
         <if test="deptcheckFlag != null ">and b.deptcheck_flag = #{deptcheckFlag}</if>
         <if test="scheduleCheckFlag != null ">and b.schedulecheck_flag = #{scheduleCheckFlag}</if>
@@ -652,6 +657,7 @@
         <if test="roomno != null">and roomno = #{roomno}</if>
         <if test="bedNo != null">and bed_no = #{bedNo}</if>
         <if test="orgid != null">and orgid = #{orgid}</if>
+        <if test="campusid != null ">and campusid = #{campusid}</if>
         <if test="updateBy != null">and update_by = #{updateBy}</if>
         <if test="updateTime != null">and update_time = #{updateTime}</if>
         <if test="createBy != null">and create_by = #{createBy}</if>
@@ -701,7 +707,6 @@
         <if test="fuspecialadvice != null ">and fuspecialadvice = #{fuspecialadvice}</if>
         <if test="managementDoctor != null ">and management_doctor = #{managementDoctor}</if>
         <if test="managementDoctorCode != null ">and management_doctor_code = #{managementDoctorCode}</if>
-        <if test="campusid != null ">and campusid = #{campusid}</if>
         <if test="importanceFlagCode != null ">and importance_flag_code = #{importanceFlagCode}</if>
         <if test="emergencyLevelCode != null ">and emergency_level_code = #{emergencyLevelCode}</if>
         <if test="encounterSourceId != null ">and encounter_source_id = #{encounterSourceId}</if>
@@ -731,6 +736,7 @@
             <if test="roomno != null">roomno,</if>
             <if test="bedNo != null">bed_no,</if>
             <if test="orgid != null">orgid,</if>
+            <if test="campusid != null">campusid,</if>
             <if test="delFlag != null and delFlag != ''">del_flag,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
@@ -781,7 +787,6 @@
             <if test="fuspecialadvice != null ">fuspecialadvice,</if>
             <if test="managementDoctor != null ">management_doctor,</if>
             <if test="managementDoctorCode != null ">management_doctor_code,</if>
-            <if test="campusid != null ">campusid,</if>
             <if test="inhospMydFlag != null ">inhosp_myd_flag,</if>
             <if test="importanceFlagCode != null ">importance_flag_code,</if>
             <if test="emergencyLevelCode != null ">emergency_level_code,</if>
@@ -805,6 +810,7 @@
             <if test="roomno != null">#{roomno},</if>
             <if test="bedNo != null">#{bedNo},</if>
             <if test="orgid != null">#{orgid},</if>
+            <if test="campusid != null">#{campusid},</if>
             <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
@@ -855,7 +861,6 @@
             <if test="fuspecialadvice != null ">#{fuspecialadvice},</if>
             <if test="managementDoctor != null ">#{managementDoctor},</if>
             <if test="managementDoctorCode != null ">#{managementDoctorCode},</if>
-            <if test="campusid != null ">#{campusid},</if>
             <if test="importanceFlagCode != null ">#{importanceFlagCode},</if>
             <if test="emergencyLevelCode != null ">#{emergencyLevelCode},</if>
             <if test="encounterSourceId != null ">#{encounterSourceId},</if>
@@ -928,6 +933,7 @@
             <if test="roomno != null">roomno = #{roomno},</if>
             <if test="bedNo != null">bed_no = #{bedNo},</if>
             <if test="orgid != null">orgid = #{orgid},</if>
+            <if test="campusid != null">campusid = #{campusid},</if>
             <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
@@ -978,7 +984,6 @@
             <if test="fuspecialadvice != null ">fuspecialadvice = #{fuspecialadvice},</if>
             <if test="managementDoctor != null ">management_doctor = #{managementDoctor},</if>
             <if test="managementDoctorCode != null ">management_doctor_code = #{managementDoctorCode},</if>
-            <if test="campusid != null ">campusid = #{campusid},</if>
             <if test="inhospMydFlag != null ">inhosp_myd_flag = #{inhospMydFlag},</if>
             <if test="importanceFlagCode != null ">importance_flag_code = #{importanceFlagCode},</if>
             <if test="emergencyLevelCode != null ">emergency_level_code = #{emergencyLevelCode},</if>
@@ -1034,6 +1039,9 @@
         <if test="orgid != null and orgid != ''">
             AND pat_med_inhosp.orgid = #{orgid}
         </if>
+        <if test="campusid != null and campusid != ''">
+            and pat_med_inhosp.campusid = #{campusid}
+        </if>
         AND pat_archive.idcardno IS NOT NULL
         <if test="zy != null">
             AND pat_med_inhosp.inhospstate = 0
@@ -1071,6 +1079,9 @@
         <if test="orgid != null and orgid != ''">
             AND orgid = #{orgid}
         </if>
+        <if test="campusid != null and campusid != ''">
+            and campusid = #{campusid}
+        </if>
         <if test="startDate != null">
             AND visit_time &gt;= #{startDate}
         </if>
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index b8b2a99..0c32669 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -653,7 +653,8 @@
         <if test="labelstatus != null ">and labelstatus = #{labelstatus}</if>
         <if test="isupload != null ">and isupload = #{isupload}</if>
         <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
-        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
+        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
         <if test="pid != null ">and pid = #{pid}</if>
         <if test="preachform != null ">and preachform = #{preachform}</if>
         <if test="guid != null  and guid != ''">and guid = #{guid}</if>
@@ -719,7 +720,8 @@
             AND date_format(visit_time,'%y%m%d') >= date_format(#{starttime},'%y%m%d')
             AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endtime},'%y%m%d')
         </if>
-        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if>
+        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
         <if test="serviceType != null and serviceType != ''">and service_type = #{serviceType}</if>
         <if test="serviceTypes != null and serviceTypes != ''">and service_type IN (#{serviceTypes})</if>
         <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
@@ -827,6 +829,7 @@
             AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endtime},'%y%m%d')
         </if>
         <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
         <if test="serviceType != null and serviceType != ''">and service_type = #{serviceType}</if>
         <if test="serviceTypes != null and serviceTypes != ''">and service_type IN (#{serviceTypes})</if>
         <if test="isabnormal != null ">and isabnormal = #{isabnormal}</if>
@@ -857,7 +860,8 @@
         <if test="sendname != null">and sendname like concat('%',#{sendname}, '%')</if>
         <if test="taskName != null">and task_name like concat('%',#{taskName}, '%')</if>
         <if test="sendstate != null">and sendstate = #{sendstate}</if>
-        <if test="orgid != null">and orgid =#{orgid}</if>
+        <if test="orgid != null and orgid != ''">and orgid = #{orgid} </if>
+        <if test="campusid != null and campusid != ''">and campusid = #{campusid}</if>
         <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
         <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
         <if test="continueCount != null ">and continue_count = #{continueCount}</if>
@@ -903,7 +907,8 @@
             <if test="createTime != null">create_time,</if>
             <if test="isupload != null">isupload,</if>
             <if test="uploadTime != null">upload_time,</if>
-            <if test="orgid != null">orgid,</if>
+            <if test="orgid != null and orgid != ''">orgid,</if>
+            <if test="campusid != null and campusid != ''">campusid,</if>
             <if test="pid != null">pid,</if>
             <if test="guid != null">guid,</if>
             <if test="textParam != null">text_param,</if>
@@ -967,7 +972,6 @@
             <if test="continueTimeNext != null ">continue_time_next,</if>
             <if test="continueContent != null ">continue_content,</if>
             <if test="operationItemId != null ">operation_item_id,</if>
-            <if test="campusid != null">campusid,</if>
             <if test="scheduleId != null ">schedule_id,</if>
             <if test="scheduleDetailId != null ">schedule_detail_id,</if>
             <if test="scheduleSeq != null ">schedule_seq,</if>
@@ -1000,7 +1004,8 @@
             <if test="createTime != null">#{createTime},</if>
             <if test="isupload != null">#{isupload},</if>
             <if test="uploadTime != null">#{uploadTime},</if>
-            <if test="orgid != null">#{orgid},</if>
+            <if test="orgid != null and orgid != ''">#{orgid},</if>
+            <if test="campusid != null and campusid != ''">#{campusid},</if>
             <if test="pid != null">#{pid},</if>
             <if test="guid != null">#{guid},</if>
             <if test="textParam != null">#{textParam},</if>
@@ -1064,7 +1069,6 @@
             <if test="continueTimeNext != null ">#{continueTimeNext,jdbcType=TIMESTAMP},</if>
             <if test="continueContent != null ">#{continueContent},</if>
             <if test="operationItemId != null ">#{operationItemId},</if>
-            <if test="campusid != null">#{campusid},</if>
             <if test="scheduleId != null ">#{scheduleId},</if>
             <if test="scheduleDetailId != null ">#{scheduleDetailId},</if>
             <if test="scheduleSeq != null ">#{scheduleSeq},</if>
@@ -1102,7 +1106,8 @@
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="isupload != null">isupload = #{isupload},</if>
             <if test="uploadTime != null">upload_time = #{uploadTime},</if>
-            <if test="orgid != null">orgid = #{orgid},</if>
+            <if test="orgid != null and orgid != ''">orgid = #{orgid},</if>
+            <if test="campusid != null and campusid != ''">campusid = #{campusid},</if>
             <if test="pid != null">pid = #{pid},</if>
             <if test="guid != null">guid = #{guid},</if>
             <if test="textParam != null">text_param = #{textParam},</if>
@@ -1166,7 +1171,6 @@
             <if test="continueTimeNext != null ">continue_time_next = #{continueTimeNext,jdbcType=TIMESTAMP},</if>
             <if test="continueContent != null ">continue_content = #{continueContent},</if>
             <if test="operationItemId != null ">operation_item_id = #{operationItemId},</if>
-            <if test="campusid != null">campusid=#{campusid},</if>
             <if test="scheduleId != null ">schedule_id = #{scheduleId},</if>
             <if test="scheduleDetailId != null ">schedule_detail_id = #{scheduleDetailId},</if>
             <if test="scheduleSeq != null ">schedule_seq = #{scheduleSeq},</if>
@@ -1205,7 +1209,8 @@
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="isupload != null">isupload = #{isupload},</if>
             <if test="uploadTime != null">upload_time = #{uploadTime},</if>
-            <if test="orgid != null">orgid = #{orgid},</if>
+            <if test="orgid != null and orgid != ''">orgid = #{orgid},</if>
+            <if test="campusid != null and campusid != ''">campusid = #{campusid},</if>
             <if test="pid != null">pid = #{pid},</if>
             <if test="guid != null">guid = #{guid},</if>
             <if test="textParam != null">text_param = #{textParam},</if>
@@ -1307,7 +1312,8 @@
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="isupload != null">isupload = #{isupload},</if>
             <if test="uploadTime != null">upload_time = #{uploadTime},</if>
-            <if test="orgid != null">orgid = #{orgid},</if>
+            <if test="orgid != null and orgid != ''">orgid = #{orgid},</if>
+            <if test="campusid != null and campusid != ''">campusid = #{campusid},</if>
             <if test="pid != null">pid = #{pid},</if>
             <if test="guid != null">guid = #{guid},</if>
             <if test="visitCount != null">visit_count = #{visitCount},</if>
@@ -1413,7 +1419,8 @@
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="isupload != null">isupload = #{isupload},</if>
             <if test="uploadTime != null">upload_time = #{uploadTime},</if>
-            <if test="orgid != null">orgid = #{orgid},</if>
+            <if test="orgid != null and orgid != ''">orgid = #{orgid},</if>
+            <if test="campusid != null and campusid != ''">campusid = #{campusid},</if>
             <if test="pid != null">pid = #{pid},</if>
             <if test="guid != null">guid = #{guid},</if>
             <if test="textParam != null">text_param = #{textParam},</if>
@@ -2375,8 +2382,11 @@
         AND DATE_FORMAT(visit_time, '%Y-%m-%d') &lt;= #{endDate}
         AND service_type IN (2, 13)
         AND del_flag = '0'
-        <if test="orgid != null">
+        <if test="orgid != null and orgid != ''">
             AND orgid = #{orgid}
+        </if>
+        <if test="campusid != null and campusid != ''">
+            AND campusid = #{campusid}
         </if>
         GROUP BY deptname
     </select>
@@ -2422,10 +2432,12 @@
             AND visit_time &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)
         </if>
 
-        <if test="orgid != null">
+        <if test="orgid != null and orgid != ''">
             AND orgid = #{orgid}
         </if>
-
+        <if test="campusid != null and campusid != ''">
+            AND campusid = #{campusid}
+        </if>
         <if test="deptcodes != null and deptcodes.size() > 0">
             AND deptcode IN
             <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
@@ -2479,10 +2491,12 @@
             AND endtime &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)
         </if>
         AND inhospstate=1
-        <if test="orgid != null">
+        <if test="orgid != null and orgid != ''">
             AND orgid = #{orgid}
         </if>
-
+        <if test="campusid != null and campusid != ''">
+            AND campusid = #{campusid}
+        </if>
         <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
             AND leavehospitaldistrictcode IN
             <foreach collection="leavehospitaldistrictcodes" item="districtcode" open="(" separator="," close=")">
@@ -2529,9 +2543,11 @@
         <!--            AND admitdate &lt;= DATE_ADD(#{endDate}, INTERVAL 1 DAY)-->
         <!--        </if>-->
         <!--        <if test="orgid != null">-->
-        <!--            AND orgid = #{orgid}-->
+        <!--             AND orgid = #{orgid}-->
         <!--        </if>-->
-
+        <!--        <if test="campusid != null">-->
+        <!--             AND campusid = #{campusid}-->
+        <!--        </if>-->
         <!--        <if test="deptcodes != null and deptcodes.size() > 0">-->
         <!--            AND deptcode IN-->
         <!--            <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">-->
@@ -2755,8 +2771,11 @@
         where 1=1
         and del_flag = 0
         and service_type=3
-        <if test="orgid != null">
-            and orgid = #{orgid}
+        <if test="orgid != null and orgid != ''">
+            AND orgid = #{orgid}
+        </if>
+        <if test="campusid != null and campusid != ''">
+            AND campusid = #{campusid}
         </if>
         <if test="startDate != null">
             AND date_format( visit_time, '%y%m%d' ) &gt;= date_format( #{startDate}, '%y%m%d' )
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
index a381b3d..a0b670f 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
@@ -346,8 +346,8 @@
         <if test="deptname != null  and deptname != ''">and service_task.deptname = #{deptname}</if>
         <if test="isupload != null ">and service_task.isupload = #{isupload}</if>
         <if test="uploadTime != null ">and service_task.upload_time = #{uploadTime}</if>
-        <if test="orgid != null  and orgid != ''">and service_task.orgid = #{orgid}</if>
-        <if test="campusid != null  and campusid != ''">and service_task.campusid = #{campusid}</if>
+        <if test="orgid != null and orgid != ''">and service_task.orgid = #{orgid}</if>
+        <if test="campusid != null and campusid != ''">and service_task.campusid = #{campusid}</if>
         <if test="compensateDate != null  and compensateDate != ''">and service_task.compensate_date =
             #{compensateDate}
         </if>

--
Gitblit v1.9.3