From 21ce122193e2fb57d206dbfca59e8d2ab2114fd0 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 23 三月 2026 17:12:56 +0800
Subject: [PATCH] 新增病区与科室组合

---
 smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml |  814 +++++++++++++++++++++++++++++++---------------------------
 1 files changed, 435 insertions(+), 379 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
index 30ba326..8a53951 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
@@ -39,398 +39,464 @@
         <result property="idcardno" column="idcardno"/>
         <result property="remark" column="remark"/>
         <result property="fudate" column="fudate"/>
+        <result property="serverState" column="server_state"/>
+        <result property="campusid" column="campusid"/>
     </resultMap>
 
-    <sql id="selectPatMedOuthospVo">
-        select id,
-               outhospno,
-               diagcheck_flag,
-               patno,
-               remark,
-               fudate,
-               fuflag,
-               serialnum,
-               patid,
-               hospitalname,
-               hospitalcode,
-               icd10code,
-               diagname,
-               deptcode,
-               deptname,
-               drcode,
-               drname,
-               admitdate,
-               orgid,
-               del_flag,
-               guid,
-               update_by,
-               update_time,
-               create_by,
-               create_time,
-               isupload,
-               upload_time,
-               schemestatus,
-               deptid,
-               schemetime,
-               hpi,
-               patname,
-               mainsuit
-        from pat_med_outhosp
-    </sql>
+<!--    <sql id="selectPatMedOuthospVo">-->
+<!--        select id,-->
+<!--               outhospno,-->
+<!--               campusid,-->
+<!--               server_state,-->
+<!--               diagcheck_flag,-->
+<!--               patno,-->
+<!--               remark,-->
+<!--               fudate,-->
+<!--               fuflag,-->
+<!--               serialnum,-->
+<!--               patid,-->
+<!--               hospitalname,-->
+<!--               hospitalcode,-->
+<!--               icd10code,-->
+<!--               diagname,-->
+<!--               deptcode,-->
+<!--               deptname,-->
+<!--               drcode,-->
+<!--               drname,-->
+<!--               admitdate,-->
+<!--               orgid,-->
+<!--               del_flag,-->
+<!--               guid,-->
+<!--               update_by,-->
+<!--               update_time,-->
+<!--               create_by,-->
+<!--               create_time,-->
+<!--               isupload,-->
+<!--               upload_time,-->
+<!--               schemestatus,-->
+<!--               deptid,-->
+<!--               schemetime,-->
+<!--               hpi,-->
+<!--               patname,-->
+<!--               mainsuit-->
+<!--        from pat_med_outhosp-->
+<!--    </sql>-->
 
-    <select id="selectPatMedOuthospList" parameterType="com.smartor.domain.PatMedOuthosp"
-            resultMap="PatMedOuthospResult">
-        select
-        pmo.id,
-        pmo.remark,
-        pmo.fudate,
-        pmo.outhospno,
-        pmo.diagcheck_flag,
-        pmo.patno,
-        pmo.serialnum,
-        pmo.patid,
-        pmo.hospitalname,
-        pmo.hospitalcode,
-        pmo.icd10code,
-        pmo.diagname,
-        pmo.deptcode,
-        pmo.deptname,
-        pmo.drcode,
-        pmo.drname,
-        pmo.admitdate,
-        pmo.orgid,
-        pmo.del_flag,
-        pmo.guid,
-        pmo.update_by,
-        pmo.update_time,
-        pmo.create_by,
-        pmo.create_time,
-        pmo.isupload,
-        pmo.upload_time,
-        pmo.schemestatus,
-        pmo.deptid,
-        pmo.schemetime,
-        pmo.hpi,
-        pmo.fuflag,
-        pmo.patname,
-        CONCAT(pa.age,pa.age_unit,pa.age2,pa.age_unit2) AS age,
-        pa.telcode,
-        pmo.mainsuit,
-        pa.idcardno
-        from pat_med_outhosp pmo left join pat_archive pa on pmo.patid = pa.id
-        <where>
-            pmo.del_flag=0
-            <if test="orgid != null ">and pmo.orgid = #{orgid}</if>
-            <if test="hospitalname != null  and hospitalname != ''">and pmo.hospitalname like concat('%',
-                #{hospitalname},
-                '%')
-            </if>
-            <if test="deptname != null  and deptname != ''">and pmo.deptname like concat('%', #{deptname}, '%')</if>
-            <if test="drname != null  and drname != ''">and pmo.drname like concat('%', #{drname}, '%')</if>
-            <if test="patname != null  and patname != ''">and pmo.patname like concat('%', #{patname}, '%')</if>
-            <if test="beginTime != null ">and date_format(pmo.admitdate,'%y%m%d') &gt;=
-                date_format(#{beginTime},'%y%m%d')
-            </if>
-            <if test="endTime != null ">and date_format(pmo.admitdate,'%y%m%d') &lt;=
-                date_format(#{endTime},'%y%m%d')
-            </if>
-            <if test="patid != null ">and pmo.patid = #{patid}</if>
-            <if test="fuflag != null ">and pmo.fuflag = #{fuflag}</if>
-            <if test="patno != null ">and pmo.patno = #{patno}</if>
-            <if test="outhospno != null  and outhospno != ''">and pmo.outhospno = #{outhospno}</if>
-            <if test="diagcheckFlag != null  and diagcheckFlag != ''">and pmo.diagcheck_flag = #{diagcheckFlag}</if>
-            <if test="diagname != null  and diagname != ''">and pmo.diagname like concat('%',#{diagname}, '%')</if>
-        </where>
-        order by pmo.update_time desc
-    </select>
+    <!--    <select id="selectPatMedOuthospList" parameterType="com.smartor.domain.PatMedOuthosp"-->
+    <!--            resultMap="PatMedOuthospResult">-->
+    <!--        select-->
+    <!--        pmo.id,-->
+    <!--        pmo.outhospno,-->
+    <!--        pmo.patno,-->
+    <!--        pmo.serialnum,-->
+    <!--        pmo.patid,-->
+    <!--        pmo.icd10code,-->
+    <!--        pmo.diagname,-->
+    <!--        pmo.deptcode,-->
+    <!--        pmo.deptname,-->
+    <!--        pmo.drcode,-->
+    <!--        pmo.drname,-->
+    <!--        pmo.admitdate,-->
+    <!--        pmo.schemestatus,-->
+    <!--        pmo.deptid,-->
+    <!--        pmo.schemetime,-->
+    <!--        pmo.fuflag,-->
+    <!--        pmo.patname,-->
+    <!--        pmo.update_time,-->
+    <!--        pmo.mainsuit-->
+    <!--        from pat_med_outhosp pmo-->
+    <!--        <where>pmo.del_flag='0'-->
+    <!--            <if test="orgid != null ">and pmo.orgid = #{orgid}</if>-->
+    <!--            <if test="serialnum != null ">and pmo.serialnum = #{serialnum}</if>-->
+    <!--            <if test="serverState != null ">and pmo.server_state = #{serverState}</if>-->
+    <!--            <if test="hospitalname != null  and hospitalname != ''">and pmo.hospitalname like concat('%',-->
+    <!--                #{hospitalname},-->
+    <!--                '%')-->
+    <!--            </if>-->
+    <!--            <if test="deptcodes != null and deptcodes.size()>0">-->
+    <!--                AND pmo.deptcode IN-->
+    <!--                <foreach collection="deptcodes" item="deptcode" open="(" separator=","-->
+    <!--                         close=")">-->
+    <!--                    #{deptcode}-->
+    <!--                </foreach>-->
+    <!--            </if>-->
+    <!--            <if test="deptname != null  and deptname != ''">and pmo.deptname like concat('%', #{deptname}, '%')</if>-->
+    <!--            <if test="drname != null  and drname != ''">and pmo.drname like concat('%', #{drname}, '%')</if>-->
+    <!--            <if test="patname != null  and patname != ''">and pmo.patname like concat('%', #{patname}, '%')</if>-->
+    <!--            <if test="beginTime != null ">and date_format(pmo.admitdate,'%y%m%d') &gt;=-->
+    <!--                date_format(#{beginTime},'%y%m%d')-->
+    <!--            </if>-->
+    <!--            <if test="endTime != null ">and date_format(pmo.admitdate,'%y%m%d') &lt;=-->
+    <!--                date_format(#{endTime},'%y%m%d')-->
+    <!--            </if>-->
+    <!--            <if test="patid != null ">and pmo.patid = #{patid}</if>-->
+    <!--            <if test="campusid != null ">and pmo.campusid = #{campusid}</if>-->
+    <!--            <if test="fuflag != null ">and pmo.fuflag = #{fuflag}</if>-->
+    <!--            <if test="patno != null ">and pmo.patno = #{patno}</if>-->
+    <!--            <if test="outhospno != null  and outhospno != ''">and pmo.outhospno = #{outhospno}</if>-->
+    <!--            <if test="diagcheckFlag != null  and diagcheckFlag != ''">and pmo.diagcheck_flag = #{diagcheckFlag}</if>-->
+    <!--            <if test="diagname != null  and diagname != ''">and pmo.diagname like concat('%',#{diagname}, '%')</if>-->
+    <!--        </where>-->
+    <!--        order by pmo.update_time desc-->
+    <!--        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>-->
+    <!--    </select>-->
 
-    <select id="selectPatMedOuthospById" parameterType="Long" resultMap="PatMedOuthospResult">
-        <include refid="selectPatMedOuthospVo"/>
-        where id = #{id}
-    </select>
 
-    <insert id="insertPatMedOuthosp" parameterType="com.smartor.domain.PatMedOuthosp" useGeneratedKeys="true"
-            keyProperty="id">
-        insert into pat_med_outhosp
+    <!--    <insert id="insertPatMedOuthosp" parameterType="com.smartor.domain.PatMedOuthosp" useGeneratedKeys="true"-->
+    <!--            keyProperty="id">-->
+    <!--        insert into pat_med_outhosp-->
+    <!--        <trim prefix="(" suffix=")" suffixOverrides=",">-->
+    <!--            <if test="serialnum != null">serialnum,</if>-->
+    <!--            <if test="patid != null">patid,</if>-->
+    <!--            <if test="hospitalname != null">hospitalname,</if>-->
+    <!--            <if test="hospitalcode != null">hospitalcode,</if>-->
+    <!--            <if test="icd10code != null">icd10code,</if>-->
+    <!--            <if test="diagname != null">diagname,</if>-->
+    <!--            <if test="deptcode != null">deptcode,</if>-->
+    <!--            <if test="deptname != null">deptname,</if>-->
+    <!--            <if test="drcode != null">drcode,</if>-->
+    <!--            <if test="drname != null">drname,</if>-->
+    <!--            <if test="admitdate != null">admitdate,</if>-->
+    <!--            <if test="orgid != null">orgid,</if>-->
+    <!--            <if test="delFlag != null and delFlag != ''">del_flag,</if>-->
+    <!--            <if test="updateBy != null">update_by,</if>-->
+    <!--            <if test="updateTime != null">update_time,</if>-->
+    <!--            <if test="createBy != null">create_by,</if>-->
+    <!--            <if test="createTime != null">create_time,</if>-->
+    <!--            <if test="isupload != null">isupload,</if>-->
+    <!--            <if test="uploadTime != null">upload_time,</if>-->
+    <!--            <if test="schemestatus != null">schemestatus,</if>-->
+    <!--            <if test="deptid != null">deptid,</if>-->
+    <!--            <if test="schemetime != null">schemetime,</if>-->
+    <!--            <if test="hpi != null">hpi,</if>-->
+    <!--            <if test="mainsuit != null">mainsuit,</if>-->
+    <!--            <if test="outhospno != null">outhospno,</if>-->
+    <!--            <if test="patname != null">patname,</if>-->
+    <!--            <if test="guid != null">guid,</if>-->
+    <!--            <if test="patno != null">patno,</if>-->
+    <!--            <if test="diagcheckFlag != null">diagcheck_flag,</if>-->
+    <!--            <if test="remark != null">remark,</if>-->
+    <!--            <if test="fuflag != null">fuflag,</if>-->
+    <!--            <if test="fudate != null">fudate,</if>-->
+    <!--            <if test="campusid != null">campusid,</if>-->
+    <!--            <if test="serverState != null">server_state,</if>-->
+    <!--        </trim>-->
+    <!--        <trim prefix="values (" suffix=")" suffixOverrides=",">-->
+    <!--            <if test="serialnum != null">#{serialnum},</if>-->
+    <!--            <if test="patid != null">#{patid},</if>-->
+    <!--            <if test="hospitalname != null">#{hospitalname},</if>-->
+    <!--            <if test="hospitalcode != null">#{hospitalcode},</if>-->
+    <!--            <if test="icd10code != null">#{icd10code},</if>-->
+    <!--            <if test="diagname != null">#{diagname},</if>-->
+    <!--            <if test="deptcode != null">#{deptcode},</if>-->
+    <!--            <if test="deptname != null">#{deptname},</if>-->
+    <!--            <if test="drcode != null">#{drcode},</if>-->
+    <!--            <if test="drname != null">#{drname},</if>-->
+    <!--            <if test="admitdate != null">#{admitdate},</if>-->
+    <!--            <if test="orgid != null">#{orgid},</if>-->
+    <!--            <if test="delFlag != null and delFlag != ''">#{delFlag},</if>-->
+    <!--            <if test="updateBy != null">#{updateBy},</if>-->
+    <!--            <if test="updateTime != null">#{updateTime},</if>-->
+    <!--            <if test="createBy != null">#{createBy},</if>-->
+    <!--            <if test="createTime != null">#{createTime},</if>-->
+    <!--            <if test="isupload != null">#{isupload},</if>-->
+    <!--            <if test="uploadTime != null">#{uploadTime},</if>-->
+    <!--            <if test="schemestatus != null">#{schemestatus},</if>-->
+    <!--            <if test="deptid != null">#{deptid},</if>-->
+    <!--            <if test="schemetime != null">#{schemetime},</if>-->
+    <!--            <if test="hpi != null">#{hpi},</if>-->
+    <!--            <if test="mainsuit != null">#{mainsuit},</if>-->
+    <!--            <if test="outhospno != null">#{outhospno},</if>-->
+    <!--            <if test="patname != null">#{patname},</if>-->
+    <!--            <if test="guid != null">#{guid},</if>-->
+    <!--            <if test="patno != null">#{patno},</if>-->
+    <!--            <if test="diagcheckFlag != null">#{diagcheckFlag},</if>-->
+    <!--            <if test="remark != null">#{remark},</if>-->
+    <!--            <if test="fuflag != null">#{fuflag},</if>-->
+    <!--            <if test="fudate != null">#{fudate},</if>-->
+    <!--            <if test="campusid != null">#{campusid},</if>-->
+    <!--            <if test="serverState != null">#{serverState},</if>-->
+    <!--        </trim>-->
+    <!--    </insert>-->
+
+    <!-- 鏂板鍒板姩鎬佽〃鍚嶏紙鐢ㄤ簬璺敱鍒版渶鏂板垎琛級 -->
+    <insert id="insertIntoTable" parameterType="map" useGeneratedKeys="true" keyProperty="record.id">
+        insert into ${tableName}
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="serialnum != null">serialnum,</if>
-            <if test="patid != null">patid,</if>
-            <if test="hospitalname != null">hospitalname,</if>
-            <if test="hospitalcode != null">hospitalcode,</if>
-            <if test="icd10code != null">icd10code,</if>
-            <if test="diagname != null">diagname,</if>
-            <if test="deptcode != null">deptcode,</if>
-            <if test="deptname != null">deptname,</if>
-            <if test="drcode != null">drcode,</if>
-            <if test="drname != null">drname,</if>
-            <if test="admitdate != null">admitdate,</if>
-            <if test="orgid != null">orgid,</if>
-            <if test="delFlag != null and delFlag != ''">del_flag,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="createBy != null">create_by,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="isupload != null">isupload,</if>
-            <if test="uploadTime != null">upload_time,</if>
-            <if test="schemestatus != null">schemestatus,</if>
-            <if test="deptid != null">deptid,</if>
-            <if test="schemetime != null">schemetime,</if>
-            <if test="hpi != null">hpi,</if>
-            <if test="mainsuit != null">mainsuit,</if>
-            <if test="outhospno != null">outhospno,</if>
-            <if test="patname != null">patname,</if>
-            <if test="guid != null">guid,</if>
-            <if test="patno != null">patno,</if>
-            <if test="diagcheckFlag != null">diagcheck_flag,</if>
-            <if test="remark != null">remark,</if>
-            <if test="fuflag != null">fuflag,</if>
-            <if test="fudate != null">fudate,</if>
+            <if test="record.serialnum != null">serialnum,</if>
+            <if test="record.patid != null">patid,</if>
+            <if test="record.hospitalname != null">hospitalname,</if>
+            <if test="record.hospitalcode != null">hospitalcode,</if>
+            <if test="record.icd10code != null">icd10code,</if>
+            <if test="record.diagname != null">diagname,</if>
+            <if test="record.deptcode != null">deptcode,</if>
+            <if test="record.deptname != null">deptname,</if>
+            <if test="record.drcode != null">drcode,</if>
+            <if test="record.drname != null">drname,</if>
+            <if test="record.admitdate != null">admitdate,</if>
+            <if test="record.orgid != null">orgid,</if>
+            <if test="record.delFlag != null and record.delFlag != ''">del_flag,</if>
+            <if test="record.updateBy != null">update_by,</if>
+            <if test="record.updateTime != null">update_time,</if>
+            <if test="record.createBy != null">create_by,</if>
+            <if test="record.createTime != null">create_time,</if>
+            <if test="record.isupload != null">isupload,</if>
+            <if test="record.uploadTime != null">upload_time,</if>
+            <if test="record.schemestatus != null">schemestatus,</if>
+            <if test="record.deptid != null">deptid,</if>
+            <if test="record.schemetime != null">schemetime,</if>
+            <if test="record.hpi != null">hpi,</if>
+            <if test="record.mainsuit != null">mainsuit,</if>
+            <if test="record.outhospno != null">outhospno,</if>
+            <if test="record.patname != null">patname,</if>
+            <if test="record.guid != null">guid,</if>
+            <if test="record.patno != null">patno,</if>
+            <if test="record.diagcheckFlag != null">diagcheck_flag,</if>
+            <if test="record.remark != null">remark,</if>
+            <if test="record.fuflag != null">fuflag,</if>
+            <if test="record.fudate != null">fudate,</if>
+            <if test="record.campusid != null">campusid,</if>
+            <if test="record.serverState != null">server_state,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="serialnum != null">#{serialnum},</if>
-            <if test="patid != null">#{patid},</if>
-            <if test="hospitalname != null">#{hospitalname},</if>
-            <if test="hospitalcode != null">#{hospitalcode},</if>
-            <if test="icd10code != null">#{icd10code},</if>
-            <if test="diagname != null">#{diagname},</if>
-            <if test="deptcode != null">#{deptcode},</if>
-            <if test="deptname != null">#{deptname},</if>
-            <if test="drcode != null">#{drcode},</if>
-            <if test="drname != null">#{drname},</if>
-            <if test="admitdate != null">#{admitdate},</if>
-            <if test="orgid != null">#{orgid},</if>
-            <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="createBy != null">#{createBy},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="isupload != null">#{isupload},</if>
-            <if test="uploadTime != null">#{uploadTime},</if>
-            <if test="schemestatus != null">#{schemestatus},</if>
-            <if test="deptid != null">#{deptid},</if>
-            <if test="schemetime != null">#{schemetime},</if>
-            <if test="hpi != null">#{hpi},</if>
-            <if test="mainsuit != null">#{mainsuit},</if>
-            <if test="outhospno != null">#{outhospno},</if>
-            <if test="patname != null">#{patname},</if>
-            <if test="guid != null">#{guid},</if>
-            <if test="patno != null">#{patno},</if>
-            <if test="diagcheckFlag != null">#{diagcheckFlag},</if>
-            <if test="remark != null">#{remark},</if>
-            <if test="fuflag != null">#{fuflag},</if>
-            <if test="fudate != null">#{fudate},</if>
+            <if test="record.serialnum != null">#{record.serialnum},</if>
+            <if test="record.patid != null">#{record.patid},</if>
+            <if test="record.hospitalname != null">#{record.hospitalname},</if>
+            <if test="record.hospitalcode != null">#{record.hospitalcode},</if>
+            <if test="record.icd10code != null">#{record.icd10code},</if>
+            <if test="record.diagname != null">#{record.diagname},</if>
+            <if test="record.deptcode != null">#{record.deptcode},</if>
+            <if test="record.deptname != null">#{record.deptname},</if>
+            <if test="record.drcode != null">#{record.drcode},</if>
+            <if test="record.drname != null">#{record.drname},</if>
+            <if test="record.admitdate != null">#{record.admitdate},</if>
+            <if test="record.orgid != null">#{record.orgid},</if>
+            <if test="record.delFlag != null and record.delFlag != ''">#{record.delFlag},</if>
+            <if test="record.updateBy != null">#{record.updateBy},</if>
+            <if test="record.updateTime != null">#{record.updateTime},</if>
+            <if test="record.createBy != null">#{record.createBy},</if>
+            <if test="record.createTime != null">#{record.createTime},</if>
+            <if test="record.isupload != null">#{record.isupload},</if>
+            <if test="record.uploadTime != null">#{record.uploadTime},</if>
+            <if test="record.schemestatus != null">#{record.schemestatus},</if>
+            <if test="record.deptid != null">#{record.deptid},</if>
+            <if test="record.schemetime != null">#{record.schemetime},</if>
+            <if test="record.hpi != null">#{record.hpi},</if>
+            <if test="record.mainsuit != null">#{record.mainsuit},</if>
+            <if test="record.outhospno != null">#{record.outhospno},</if>
+            <if test="record.patname != null">#{record.patname},</if>
+            <if test="record.guid != null">#{record.guid},</if>
+            <if test="record.patno != null">#{record.patno},</if>
+            <if test="record.diagcheckFlag != null">#{record.diagcheckFlag},</if>
+            <if test="record.remark != null">#{record.remark},</if>
+            <if test="record.fuflag != null">#{record.fuflag},</if>
+            <if test="record.fudate != null">#{record.fudate},</if>
+            <if test="record.campusid != null">#{record.campusid},</if>
+            <if test="record.serverState != null">#{record.serverState},</if>
         </trim>
     </insert>
 
-    <insert id="batchPatMedOuthosp">
-        insert into pat_med_outhosp
-        (
-        serialnum,
-        patid,
-        hospitalname,
-        hospitalcode,
-        icd10code,
-        diagname,
-        deptcode,
-        deptname,
-        drcode,
-        drname,
-        admitdate,
-        orgid,
-        del_flag,
-        update_by,
-        update_time,
-        create_by,
-        create_time,
-        isupload,
-        upload_time,
-        schemestatus,
-        deptid,
-        schemetime,
-        hpi,
-        mainsuit,
-        outhospno,
-        patname,
-        guid,
-        patno,
-        diagcheck_flag,
-        fuflag,
-        fudate,
-        remark)
-        values
-        <foreach collection="list" item="item" separator=",">
-            (
-            #{item.serialnum},
-            #{item.patid},
-            #{item.hospitalname},
-            #{item.hospitalcode},
-            #{item.icd10code},
-            #{item.diagname},
-            #{item.deptcode},
-            #{item.deptname},
-            #{item.drcode},
-            #{item.drname},
-            #{item.admitdate},
-            #{item.orgid},
-            #{item.delFlag},
-            #{item.updateBy},
-            #{item.updateTime},
-            #{item.createBy},
-            #{item.createTime},
-            #{item.isupload},
-            #{item.uploadTime},
-            #{item.schemestatus},
-            #{item.deptid},
-            #{item.schemetime},
-            #{item.hpi},
-            #{item.mainsuit},
-            #{item.outhospno},
-            #{item.patname},
-            #{item.guid},
-            #{item.patno},
-            #{item.diagcheckFlag},
-            #{item.fuflag},
-            #{item.fudate},
-            #{item.remark}
-            )
-        </foreach>
-    </insert>
 
 
-    <update id="updatePatMedOuthosp" parameterType="com.smartor.domain.PatMedOuthosp">
-        update pat_med_outhosp
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="serialnum != null">serialnum = #{serialnum},</if>
-            <if test="patid != null">patid = #{patid},</if>
-            <if test="hospitalname != null">hospitalname = #{hospitalname},</if>
-            <if test="hospitalcode != null">hospitalcode = #{hospitalcode},</if>
-            <if test="icd10code != null">icd10code = #{icd10code},</if>
-            <if test="diagname != null">diagname = #{diagname},</if>
-            <if test="deptcode != null">deptcode = #{deptcode},</if>
-            <if test="deptname != null">deptname = #{deptname},</if>
-            <if test="drcode != null">drcode = #{drcode},</if>
-            <if test="drname != null">drname = #{drname},</if>
-            <if test="admitdate != null">admitdate = #{admitdate},</if>
-            <if test="orgid != null">orgid = #{orgid},</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>
-            <if test="createBy != null">create_by = #{createBy},</if>
-            <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="schemestatus != null">schemestatus = #{schemestatus},</if>
-            <if test="deptid != null">deptid = #{deptid},</if>
-            <if test="schemetime != null">schemetime = #{schemetime},</if>
-            <if test="hpi != null">hpi = #{hpi},</if>
-            <if test="mainsuit != null">mainsuit = #{mainsuit},</if>
-            <if test="outhospno != null">outhospno = #{outhospno},</if>
-            <if test="patname != null">patname = #{patname},</if>
-            <if test="guid != null">guid = #{guid},</if>
-            <if test="patno != null">patno = #{patno},</if>
-            <if test="diagcheckFlag != null">diagcheck_flag = #{diagcheckFlag},</if>
-            <if test="remark != null">remark = #{remark},</if>
-            <if test="fuflag != null">fuflag = #{fuflag},</if>
-            <if test="fudate != null">fudate = #{fudate},</if>
-        </trim>
-        where id = #{id}
+
+    <!--    <update id="updatePatMedOuthosp" parameterType="com.smartor.domain.PatMedOuthosp">-->
+    <!--        update pat_med_outhosp-->
+    <!--        <trim prefix="SET" suffixOverrides=",">-->
+    <!--            <if test="serialnum != null">serialnum = #{serialnum},</if>-->
+    <!--            <if test="patid != null">patid = #{patid},</if>-->
+    <!--            <if test="hospitalname != null">hospitalname = #{hospitalname},</if>-->
+    <!--            <if test="hospitalcode != null">hospitalcode = #{hospitalcode},</if>-->
+    <!--            <if test="icd10code != null">icd10code = #{icd10code},</if>-->
+    <!--            <if test="diagname != null">diagname = #{diagname},</if>-->
+    <!--            <if test="deptcode != null">deptcode = #{deptcode},</if>-->
+    <!--            <if test="deptname != null">deptname = #{deptname},</if>-->
+    <!--            <if test="drcode != null">drcode = #{drcode},</if>-->
+    <!--            <if test="drname != null">drname = #{drname},</if>-->
+    <!--            <if test="admitdate != null">admitdate = #{admitdate},</if>-->
+    <!--            <if test="orgid != null">orgid = #{orgid},</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>-->
+    <!--            <if test="createBy != null">create_by = #{createBy},</if>-->
+    <!--            <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="schemestatus != null">schemestatus = #{schemestatus},</if>-->
+    <!--            <if test="deptid != null">deptid = #{deptid},</if>-->
+    <!--            <if test="schemetime != null">schemetime = #{schemetime},</if>-->
+    <!--            <if test="hpi != null">hpi = #{hpi},</if>-->
+    <!--            <if test="mainsuit != null">mainsuit = #{mainsuit},</if>-->
+    <!--            <if test="outhospno != null">outhospno = #{outhospno},</if>-->
+    <!--            <if test="patname != null">patname = #{patname},</if>-->
+    <!--            <if test="guid != null">guid = #{guid},</if>-->
+    <!--            <if test="patno != null">patno = #{patno},</if>-->
+    <!--            <if test="diagcheckFlag != null">diagcheck_flag = #{diagcheckFlag},</if>-->
+    <!--            <if test="remark != null">remark = #{remark},</if>-->
+    <!--            <if test="fuflag != null">fuflag = #{fuflag},</if>-->
+    <!--            <if test="fudate != null">fudate = #{fudate},</if>-->
+    <!--            <if test="campusid != null">campusid = #{campusid},</if>-->
+    <!--            <if test="serverState != null">server_state = #{serverState},</if>-->
+    <!--        </trim>-->
+    <!--        where id = #{id}-->
+    <!--    </update>-->
+
+
+    <select id="getTableColumns" resultType="String">
+        SELECT column_name
+        FROM information_schema.columns
+        WHERE table_schema = DATABASE()
+          AND table_name = #{tableName}
+        ORDER BY ordinal_position
+    </select>
+
+    <select id="getTableColumnMeta" resultType="java.util.HashMap">
+        SELECT column_name AS column_name,
+               data_type   AS data_type,
+               column_type AS column_type
+        FROM information_schema.columns
+        WHERE table_schema = DATABASE()
+          AND table_name = #{tableName}
+        ORDER BY ordinal_position
+    </select>
+
+    <update id="createOrReplaceProcedure">
+        ${procSql}
     </update>
 
-    <delete id="deletePatMedOuthospById" parameterType="Long">
-        delete
-        from pat_med_outhosp
-        where id = #{id}
-    </delete>
-
-    <delete id="deletePatMedOuthospByIds" parameterType="String">
-        delete from pat_med_outhosp where id in
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-
-    <select id="selectPatMedOuthospCount" parameterType="com.smartor.domain.PatMedReq"
-            resultType="com.smartor.domain.PatMedRes">
-        SELECT SUM( rs ) AS rs,
-        SUM( rc ) AS rc
-        FROM (
-        SELECT
-        COUNT(id) AS rc,
-        0 AS rs
-        FROM
-        pat_med_outhosp
-        <where>
-            del_flag=0
-            <if test="orgid != null">
-                and orgid = #{orgid}
-            </if>
-            and date_format(admitdate,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
-            and date_format(admitdate,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
-            <if test="deptcodeList != null and deptcodeList.size()>0">
-                and deptcode in
-                <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
-                    #{deptcode}
-                </foreach>
-            </if>
-        </where>
-        union all
-        select
-        0 AS rc,
-        count(1) AS rs
-        FROM
-        service_subtask
-        <where>
-            del_flag = 0
-            and service_type=3
-            <if test="orgid != null">
-                and orgid = #{orgid}
-            </if>
-            <if test="startDate != null">
-                AND date_format( visit_time, '%y%m%d' ) &gt;= date_format( #{startDate}, '%y%m%d' )
-            </if>
-            <if test="endDate != null">
-                AND date_format( visit_time, '%y%m%d' ) &lt;= date_format(#{endDate},'%y%m%d')
-            </if>
-            <if test="deptcodeList != null and deptcodeList.size()>0">
-                and deptcode in
-                <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
-                    #{deptcode}
-                </foreach>
-            </if>
-        </where>
-        ) AS combined_data
+    <!-- 璋冪敤瀛樺偍杩囩▼ sp_query_outhosp 鏌ヨ闂ㄨ瘖璁板綍 -->
+    <select id="callSpQueryOuthosp" parameterType="com.smartor.domain.PatMedOuthospQueryReq"
+            resultType="com.smartor.domain.PatMedOuthosp"
+            statementType="CALLABLE">
+        {CALL sp_query_outhosp(
+                #{outhospno,     jdbcType=VARCHAR,  mode=IN},
+                #{serialnum,     jdbcType=VARCHAR,  mode=IN},
+                #{patid,         jdbcType=BIGINT,   mode=IN},
+                #{patname,       jdbcType=VARCHAR,  mode=IN},
+                #{patno,        jdbcType=VARCHAR,  mode=IN},
+                #{hospitalname,  jdbcType=VARCHAR,  mode=IN},
+                #{hospitalcode,  jdbcType=VARCHAR,  mode=IN},
+                #{icd10code,     jdbcType=VARCHAR,  mode=IN},
+                #{diagname,      jdbcType=VARCHAR,  mode=IN},
+                #{deptid,        jdbcType=BIGINT,   mode=IN},
+                #{deptcode,      jdbcType=VARCHAR,  mode=IN},
+                #{deptname,      jdbcType=VARCHAR,  mode=IN},
+                #{drcode,        jdbcType=VARCHAR,  mode=IN},
+                #{drname,        jdbcType=VARCHAR,  mode=IN},
+                #{beginAdmitdate,jdbcType=DATE,     mode=IN},
+                #{endAdmitdate,  jdbcType=DATE,     mode=IN},
+                #{orgid,         jdbcType=VARCHAR,  mode=IN},
+                #{isupload,      jdbcType=BIGINT,   mode=IN},
+                #{schemestatus,  jdbcType=BIGINT,   mode=IN},
+                #{hpi,         jdbcType=VARCHAR,  mode=IN},
+                #{mainsuit,         jdbcType=VARCHAR,  mode=IN},
+                #{pid,   jdbcType=INTEGER,  mode=IN},
+                #{guid, jdbcType=VARCHAR,  mode=IN},
+                #{pguid, jdbcType=VARCHAR,  mode=IN},
+                #{hospitaldistrictcode,   jdbcType=VARCHAR,  mode=IN},
+                #{hospitaldistrictname,   jdbcType=VARCHAR,  mode=IN},
+                #{diagcheckFlag,          jdbcType=VARCHAR,  mode=IN},
+                #{fuflag,          jdbcType=VARCHAR,  mode=IN},
+                #{campusid,          jdbcType=VARCHAR,  mode=IN},
+                #{serverState,      jdbcType=VARCHAR,  mode=IN}
+                #{pageSize,      jdbcType=INTEGER,  mode=IN},
+                #{pageNum,       jdbcType=INTEGER,  mode=IN}
+            )}
     </select>
 
-    <select id="getDeptRanking" parameterType="com.smartor.domain.PatMedReq" resultType="com.smartor.domain.PatMedRes">
-        SELECT deptname, COUNT(1) AS rc
-        FROM pat_med_outhosp
-        <where>
-            del_flag=0
-            <if test="inhospstate != inhospstate">
-                and inhospstate= #{inhospstate}
-            </if>
-            <if test="deptcodeList != null and deptcodeList.size()>0">
-                and deptcode in
-                <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
-                    #{deptcode}
-                </foreach>
-            </if>
-        </where>
+
+    <select id="callSpQueryOuthospCount" parameterType="com.smartor.domain.PatMedOuthospQueryReq"
+            resultType="Long"
+            statementType="CALLABLE">
+        {CALL sp_count_outhosp(
+                #{outhospno,     jdbcType=VARCHAR,  mode=IN},
+                #{serialnum,     jdbcType=VARCHAR,  mode=IN},
+                #{patid,         jdbcType=BIGINT,   mode=IN},
+                #{patname,       jdbcType=VARCHAR,  mode=IN},
+                #{patno,        jdbcType=VARCHAR,  mode=IN},
+                #{hospitalname,  jdbcType=VARCHAR,  mode=IN},
+                #{hospitalcode,  jdbcType=VARCHAR,  mode=IN},
+                #{icd10code,     jdbcType=VARCHAR,  mode=IN},
+                #{diagname,      jdbcType=VARCHAR,  mode=IN},
+                #{deptid,        jdbcType=BIGINT,   mode=IN},
+                #{deptcode,      jdbcType=VARCHAR,  mode=IN},
+                #{deptname,      jdbcType=VARCHAR,  mode=IN},
+                #{drcode,        jdbcType=VARCHAR,  mode=IN},
+                #{drname,        jdbcType=VARCHAR,  mode=IN},
+                #{beginAdmitdate,jdbcType=DATE,     mode=IN},
+                #{endAdmitdate,  jdbcType=DATE,     mode=IN},
+                #{orgid,         jdbcType=VARCHAR,  mode=IN},
+                #{isupload,      jdbcType=BIGINT,   mode=IN},
+                #{schemestatus,  jdbcType=BIGINT,   mode=IN},
+                #{hpi,         jdbcType=VARCHAR,  mode=IN},
+                #{mainsuit,         jdbcType=VARCHAR,  mode=IN},
+                #{pid,   jdbcType=INTEGER,  mode=IN},
+                #{guid, jdbcType=VARCHAR,  mode=IN},
+                #{pguid, jdbcType=VARCHAR,  mode=IN},
+                #{hospitaldistrictcode,   jdbcType=VARCHAR,  mode=IN},
+                #{hospitaldistrictname,   jdbcType=VARCHAR,  mode=IN},
+                #{diagcheckFlag,          jdbcType=VARCHAR,  mode=IN},
+                #{fuflag,          jdbcType=VARCHAR,  mode=IN},
+                #{campusid,          jdbcType=VARCHAR,  mode=IN},
+                #{serverState,      jdbcType=VARCHAR,  mode=IN}
+            )}
     </select>
 
-    <!-- PatMedOuthospMapper.xml -->
-    <select id="countPatMedOuthosp" resultType="int">
+    <select id="existsInTable" resultType="int">
         SELECT COUNT(*)
-        FROM pat_med_outhosp
+        FROM ${tableName}
+        WHERE id = #{id}
     </select>
 
-    <update id="renameTable">
-        RENAME
-        TABLE
-        ${oldName}
-        TO
-        ${newName}
+    <update id="updateInTable" parameterType="map">
+        update ${tableName}
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="record.serialnum != null">serialnum = #{record.serialnum},</if>
+            <if test="record.patid != null">patid = #{record.patid},</if>
+            <if test="record.hospitalname != null">hospitalname = #{record.hospitalname},</if>
+            <if test="record.hospitalcode != null">hospitalcode = #{record.hospitalcode},</if>
+            <if test="record.icd10code != null">icd10code = #{record.icd10code},</if>
+            <if test="record.diagname != null">diagname = #{record.diagname},</if>
+            <if test="record.deptcode != null">deptcode = #{record.deptcode},</if>
+            <if test="record.deptname != null">deptname = #{record.deptname},</if>
+            <if test="record.drcode != null">drcode = #{record.drcode},</if>
+            <if test="record.drname != null">drname = #{record.drname},</if>
+            <if test="record.admitdate != null">admitdate = #{record.admitdate},</if>
+            <if test="record.orgid != null">orgid = #{record.orgid},</if>
+            <if test="record.delFlag != null and record.delFlag != ''">del_flag = #{record.delFlag},</if>
+            <if test="record.updateBy != null">update_by = #{record.updateBy},</if>
+            <if test="record.updateTime != null">update_time = #{record.updateTime},</if>
+            <if test="record.createBy != null">create_by = #{record.createBy},</if>
+            <if test="record.createTime != null">create_time = #{record.createTime},</if>
+            <if test="record.isupload != null">isupload = #{record.isupload},</if>
+            <if test="record.uploadTime != null">upload_time = #{record.uploadTime},</if>
+            <if test="record.schemestatus != null">schemestatus = #{record.schemestatus},</if>
+            <if test="record.deptid != null">deptid = #{record.deptid},</if>
+            <if test="record.schemetime != null">schemetime = #{record.schemetime},</if>
+            <if test="record.hpi != null">hpi = #{record.hpi},</if>
+            <if test="record.mainsuit != null">mainsuit = #{record.mainsuit},</if>
+            <if test="record.outhospno != null">outhospno = #{record.outhospno},</if>
+            <if test="record.patname != null">patname = #{record.patname},</if>
+            <if test="record.guid != null">guid = #{record.guid},</if>
+            <if test="record.patno != null">patno = #{record.patno},</if>
+            <if test="record.diagcheckFlag != null">diagcheck_flag = #{record.diagcheckFlag},</if>
+            <if test="record.remark != null">remark = #{record.remark},</if>
+            <if test="record.fuflag != null">fuflag = #{record.fuflag},</if>
+            <if test="record.fudate != null">fudate = #{record.fudate},</if>
+            <if test="record.campusid != null">campusid = #{record.campusid},</if>
+            <if test="record.serverState != null">server_state = #{record.serverState},</if>
+        </trim>
+        <where>del_flag=0
+            <if test="record.guid != null">and guid = #{record.guid}</if>
+            <if test="record.serialnum != null">and serialnum = #{record.serialnum}</if>
+        </where>
     </update>
+
+    <select id="tableExists" resultType="int">
+        SELECT COUNT(*)
+        FROM information_schema.tables
+        WHERE table_schema = DATABASE()
+          AND table_name = #{tableName}
+    </select>
 
     <update id="createPatMedOuthosp">
         CREATE TABLE ${newName} LIKE ${templateName}
@@ -450,14 +516,4 @@
         WHERE table_schema = DATABASE()
           AND table_name LIKE 'pat_med_outhosp%'
     </select>
-
-    <select id="getMaxIdFromTable" resultType="Long">
-        SELECT IFNULL(MAX(id), 0)
-        FROM ${tableName}
-    </select>
-
-    <update id="createOrReplaceView">
-        ${viewSql}
-    </update>
-
 </mapper>

--
Gitblit v1.9.3