From 0a164b25c99e3779c64b61ba248b1e809bd15014 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 19 八月 2026 16:33:12 +0800
Subject: [PATCH] 【丽水】patItem 传离院病区+随访科室报错

---
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml |   62 +++++++++++++++++++++++++++++-
 1 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index 7ac873f..5f9666b 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -52,6 +52,7 @@
         <result property="inDeptcheckFlag" column="in_deptcheck_flag"/>
         <result property="wardcheckFlag" column="wardcheck_flag"/>
         <result property="diagcheckFlag" column="diagcheck_flag"/>
+        <result property="scheduleCheckFlag" column="schedulecheck_flag"/>
         <result property="age" column="age"/>
         <result property="sex" column="sex"/>
         <result property="telcode" column="telcode"/>
@@ -79,10 +80,16 @@
         <result property="encounterSourceId" column="encounter_source_id"/>
         <result property="importanceFlagCode" column="importance_flag_code"/>
         <result property="emergencyLevelCode" column="emergency_level_code"/>
+        <result property="medicalCode" column="medical_code"/>
+        <result property="medicalName" column="medical_name"/>
+        <result property="medicalCompany" column="medical_company"/>
     </resultMap>
 
     <sql id="selectPatMedInhospVo">
         select inhospid,
+               medical_code,
+               medical_name,
+               medical_company,
                encounter_source_id,
                importance_flag_code,
                emergency_level_code,
@@ -111,6 +118,7 @@
                in_deptcheck_flag,
                in_wardcheck_flag,
                diagcheck_flag,
+               schedulecheck_flag,
                inhospstate,
                patno,
                long_task_reason,
@@ -156,7 +164,7 @@
     </sql>
 
     <select id="selectPatMedInhospList" parameterType="com.smartor.domain.PatMedInhosp" resultMap="PatMedInhospResult">
-        select CONCAT( a.age, a.age_unit ) AS age,
+        select a.age AS age,
         a.telcode as telcode,
         a.sex,
         b.inhospid,
@@ -172,6 +180,7 @@
         b.in_deptcheck_flag,
         b.in_wardcheck_flag,
         b.diagcheck_flag,
+        b.schedulecheck_flag,
         b.inhospstate,
         b.patno,
         b.inhospno,
@@ -225,6 +234,9 @@
         b.encounter_source_id,
         b.importance_flag_code,
         b.emergency_level_code,
+        b.medical_code,
+        b.medical_name,
+        b.medical_company,
         a.idcardno
         FROM
         pat_med_inhosp b
@@ -254,6 +266,7 @@
             concat('%', #{hospitaldistrictname}, '%')
         </if>
         <if test="endtime != null ">and b.endtime = #{endtime}</if>
+        <if test="bedNo != null ">and b.bed_no = #{bedNo}</if>
         <if test="inhospMydFlag != null ">and b.inhosp_myd_flag = #{inhospMydFlag}</if>
         <if test="managementDoctor != null ">and b.management_doctor = #{managementDoctor}</if>
         <if test="managementDoctorCode != null ">and b.management_doctor_code = #{managementDoctorCode}</if>
@@ -266,6 +279,7 @@
         <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
         <if test="nurseName != null and nurseName != ''">and b.nurse_name = #{nurseName}</if>
         <if test="deptcheckFlag != null ">and b.deptcheck_flag = #{deptcheckFlag}</if>
+        <if test="scheduleCheckFlag != null ">and b.schedulecheck_flag = #{scheduleCheckFlag}</if>
         <if test="wardcheckFlag != null ">and b.wardcheck_flag = #{wardcheckFlag}</if>
         <if test="inDeptcheckFlag != null ">and b.in_deptcheck_flag = #{inDeptcheckFlag}</if>
         <if test="inWardcheckFlag != null ">and b.in_wardcheck_flag = #{inWardcheckFlag}</if>
@@ -328,6 +342,16 @@
                 #{deptcode}
             </foreach>
         </if>
+        <if test="icd10codeList != null and icd10codeList.size()>0">
+            AND b.leaveicd10code IN
+            <foreach collection="icd10codeList" item="icd10code" open="(" separator=","
+                     close=")">
+                #{icd10code}
+            </foreach>
+        </if>
+        <if test="medicalCode != null and medicalCode != ''">and b.medical_code = #{medicalCode}</if>
+        <if test="medicalName != null and medicalName != ''">and b.medical_name = #{medicalName}</if>
+        <if test="medicalCompany != null and medicalCompany != ''">and b.medical_company = #{medicalCompany}</if>
         GROUP BY
         b.inhospid,
         a.age,
@@ -354,6 +378,9 @@
         select
         b.inhospid,
         b.nurse_id,
+        b.medical_code,
+        b.medical_name,
+        b.medical_company,
         b.encounter_source_id,
         b.importance_flag_code,
         b.emergency_level_code,
@@ -369,6 +396,7 @@
         b.in_deptcheck_flag,
         b.in_wardcheck_flag,
         b.diagcheck_flag,
+        b.schedulecheck_flag,
         b.inhospstate,
         b.patno,
         b.inhospno,
@@ -445,6 +473,9 @@
         select CONCAT( a.age, a.age_unit ) AS age,
         a.telcode as telcode,
         b.inhospid,
+        b.medical_code,
+        b.medical_name,
+        b.medical_company,
         b.encounter_source_id,
         b.importance_flag_code,
         b.emergency_level_code,
@@ -551,6 +582,7 @@
         <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>
         <if test="wardcheckFlag != null ">and b.wardcheck_flag = #{wardcheckFlag}</if>
         <if test="inDeptcheckFlag != null ">and b.in_deptcheck_flag = #{inDeptcheckFlag}</if>
         <if test="inWardcheckFlag != null ">and b.in_wardcheck_flag = #{inWardcheckFlag}</if>
@@ -573,6 +605,13 @@
                      close=")">
                 #{leaveldeptcode}
             </foreach>
+        </if>
+        <if test="medicalCode != null  and medicalCode != ''">and b.medical_code like concat('%'#{medicalCode}, '%')
+        </if>
+        <if test="medicalName != null  and medicalName != ''">and b.medical_name like concat('%'#{medicalName}, '%')
+        </if>
+        <if test="medicalCompany != null  and medicalCompany != ''">and b.medical_company like
+            concat('%'#{medicalCompany}, '%')
         </if>
         order by b.inhospid desc
     </select>
@@ -665,6 +704,11 @@
         <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>
+        <if test="medicalCode != null  and medicalCode != ''">and medical_code like concat('%'#{medicalCode}, '%')</if>
+        <if test="medicalName != null  and medicalName != ''">and medical_name like concat('%'#{medicalName}, '%')</if>
+        <if test="medicalCompany != null  and medicalCompany != ''">and medical_company like
+            concat('%'#{medicalCompany}, '%')
+        </if>
     </select>
 
 
@@ -741,6 +785,9 @@
             <if test="importanceFlagCode != null ">importance_flag_code,</if>
             <if test="emergencyLevelCode != null ">emergency_level_code,</if>
             <if test="encounterSourceId != null ">encounter_source_id,</if>
+            <if test="medicalCode != null  and medicalCode != ''">medical_code,</if>
+            <if test="medicalName != null  and medicalName != ''">medical_name,</if>
+            <if test="medicalCompany != null  and medicalCompany != ''">medical_company,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="serialnum != null">#{serialnum},</if>
@@ -811,6 +858,9 @@
             <if test="importanceFlagCode != null ">#{importanceFlagCode},</if>
             <if test="emergencyLevelCode != null ">#{emergencyLevelCode},</if>
             <if test="encounterSourceId != null ">#{encounterSourceId},</if>
+            <if test="medicalCode != null  and medicalCode != ''">#{medicalCode},</if>
+            <if test="medicalName != null  and medicalName != ''">#{medicalName},</if>
+            <if test="medicalCompany != null  and medicalCompany != ''">#{medicalCompany},</if>
         </trim>
     </insert>
 
@@ -829,7 +879,8 @@
         nurse_id, nurse_name, out_way_id, out_way_name, guid,
         operator, operator_id, inhospno, remark,
         fuflag, fudate, fuperiod, futypecode, futypedesc, fuadvice, fuspecialadvice, management_doctor,
-        management_doctor_doctor,campusid, inhosp_myd_flag, importance_flag_code, emergency_level_code, encounter_source_id
+        management_doctor_doctor,campusid, inhosp_myd_flag, importance_flag_code, emergency_level_code, encounter_source_id,
+        medical_code, medical_name, medical_company
         )
         values
         <foreach collection="list" item="item" separator=",">
@@ -852,7 +903,8 @@
             #{item.operator}, #{item.operatorId}, #{item.inhospno}, #{item.remark},
             #{item.fuflag}, #{item.fudate}, #{item.fuperiod}, #{item.futypecode}, #{item.futypedesc}, #{item.fuadvice},
             #{item.fuspecialadvice}, #{item.managementDoctor}, #{item.managementDoctorCode}, #{item.campusid}, #{item.inhospMydFlag},
-            #{item.importanceFlagCode}, #{item.emergencyLevelCode}, #{item.encounterSourceId}
+            #{item.importanceFlagCode}, #{item.emergencyLevelCode}, #{item.encounterSourceId},
+            #{item.medicalCode}, #{item.medicalName}, #{item.medicalCompany}
             )
         </foreach>
     </insert>
@@ -902,6 +954,7 @@
             <if test="patno != null">patno = #{patno},</if>
             <if test="inhospstate != null">inhospstate = #{inhospstate},</if>
             <if test="deptcheckFlag != null">deptcheck_flag = #{deptcheckFlag},</if>
+            <if test="scheduleCheckFlag != null">schedulecheck_flag = #{scheduleCheckFlag},</if>
             <if test="wardcheckFlag != null">wardcheck_flag = #{wardcheckFlag},</if>
             <if test="inDeptcheckFlag != null">in_deptcheck_flag = #{inDeptcheckFlag},</if>
             <if test="inWardcheckFlag != null">in_wardcheck_flag = #{inWardcheckFlag},</if>
@@ -929,6 +982,9 @@
             <if test="importanceFlagCode != null ">importance_flag_code = #{importanceFlagCode},</if>
             <if test="emergencyLevelCode != null ">emergency_level_code = #{emergencyLevelCode},</if>
             <if test="encounterSourceId != null ">encounter_source_id = #{encounterSourceId},</if>
+            <if test="medicalCode != null  and medicalCode != ''">medical_code = #{medicalCode},</if>
+            <if test="medicalName != null  and medicalName != ''">medical_name = #{medicalName},</if>
+            <if test="medicalCompany != null  and medicalCompany != ''">medical_company = #{medicalCompany},</if>
         </trim>
         where inhospid = #{inhospid}
     </update>

--
Gitblit v1.9.3