liusheng
2025-03-28 d3b362de432a32c10ccd039dfc417d8c6233f543
smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -61,11 +61,25 @@
        <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,
@@ -171,13 +185,13 @@
        b.leaveldeptid,
        b.long_task_reason,
        b.schemetime,
        COALESCE (
        (
        SELECT string_agg(d.tagname, ', ')
        FROM pat_archivetag d
        WHERE d.patid = a.id
        AND d.del_flag = 0
        ), '') AS tagname
        b.fuflag,
        b.fudate,
        b.fuperiod,
        b.futypecode,
        b.futypedesc,
        b.fuadivce,
        b.fuspecialadvice
        FROM
        pat_med_inhosp b
        JOIN
@@ -189,18 +203,18 @@
            AND b.del_flag = 0
            AND a.idcardno IS NOT NULL
            <if test="startOutHospTime != null">
                AND TO_DATE(b.endtime,'YYYY-MM-DD') &gt;= TO_DATE(#{startOutHospTime},'YYYY-MM-DD')
                AND STR_TO_DATE(b.endtime,'%Y-%m-%d') &gt;= STR_TO_DATE(#{startOutHospTime},'%Y-%m-%d')
            </if>
            <if test="endOutHospTime != null">
                AND TO_DATE(b.endtime,'YYYY-MM-DD') &lt;= TO_DATE(#{endOutHospTime},'YYYY-MM-DD')
                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 TO_DATE(b.starttime, 'YYYY-MM-DD') >= TO_DATE(#{startInHospTime}, 'YYYY-MM-DD')
                AND STR_TO_DATE(b.starttime, '%Y-%m-%d') >= STR_TO_DATE(#{startInHospTime}, '%Y-%m-%d')
            </if>
            <if test="endInHospTime != null">
                AND TO_DATE(b.starttime, 'YYYY-MM-DD') &lt;= TO_DATE(#{startInHospTime}, 'YYYY-MM-DD')
                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},
                '%')
@@ -211,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>
@@ -314,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,
@@ -331,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>
@@ -357,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>
@@ -420,6 +450,13 @@
            <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>
@@ -473,6 +510,13 @@
            <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>
@@ -529,6 +573,13 @@
            <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>