liusheng
2025-03-20 db13d846510525ddd4d5c48ee0c549c62cf93efa
smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -60,6 +60,7 @@
        <result property="operator" column="operator"/>
        <result property="operatorId" column="operator_id"/>
        <result property="remark" column="remark"/>
        <result property="tagname" column="tagname"/>
    </resultMap>
    <sql id="selectPatMedInhospVo">
@@ -122,10 +123,6 @@
        select CONCAT( a.age, a.age_unit ) AS age,
        a.telcode as telcode,
        a.sex,
        b.guid,
        b.operator,
        b.remark,
        b.operator_id,
        b.inhospid,
        b.nurse_id,
        b.nurse_name,
@@ -173,28 +170,37 @@
        b.deptid,
        b.leaveldeptid,
        b.long_task_reason,
        b.schemetime
        b.schemetime,
        COALESCE (
        (
        SELECT string_agg(d.tagname, ', ')
        FROM pat_archivetag d
        WHERE d.patid = a.id
        AND d.del_flag = 0
        ), '') AS tagname
        FROM
        pat_med_inhosp b,
        pat_archive a
        pat_med_inhosp b
        JOIN
        pat_archive a ON a.id = b.patid
        LEFT JOIN
        pat_archivetag c ON c.patid = a.id AND (C.del_flag = 0 OR C.del_flag IS NULL)
        <where>
            a.del_flag=0
            and b.del_flag=0
            and a.id = b.patid
            AND a.idcardno != ''
            AND b.del_flag = 0
            AND a.idcardno IS NOT NULL
            <if test="startOutHospTime != null">
                AND date_format(b.endtime,'%y%m%d') &gt;= date_format(#{startOutHospTime},'%y%m%d')
                AND TO_DATE(b.endtime,'YYYY-MM-DD') &gt;= TO_DATE(#{startOutHospTime},'YYYY-MM-DD')
            </if>
            <if test="endOutHospTime != null">
                AND date_format(b.endtime,'%y%m%d') &lt;= date_format(#{endOutHospTime},'%y%m%d')
                AND TO_DATE(b.endtime,'YYYY-MM-DD') &lt;= TO_DATE(#{endOutHospTime},'YYYY-MM-DD')
            </if>
            <if test="tagname != null  and tagname != ''">and c.tagname like concat('%', #{tagname}, '%')</if>
            <if test="startInHospTime != null">
                AND date_format(b.starttime,'%y%m%d') &gt;= date_format(#{startInHospTime},'%y%m%d')
                AND TO_DATE(b.starttime, 'YYYY-MM-DD') >= TO_DATE(#{startInHospTime}, 'YYYY-MM-DD')
            </if>
            <if test="endInHospTime != null">
                AND date_format(b.starttime,'%y%m%d') &lt;= date_format(#{endInHospTime},'%y%m%d')
                AND TO_DATE(b.starttime, 'YYYY-MM-DD') &lt;= TO_DATE(#{startInHospTime}, 'YYYY-MM-DD')
            </if>
            <if test="hospitalname != null  and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
                '%')
@@ -245,9 +251,15 @@
                </foreach>
            </if>
        </where>
        GROUP BY
        b.inhospid,
        a.age,
        a.age_unit,
        a.telcode,
        a.id,
        a.sex
        order by b.inhospid desc
    </select>
    <select id="selectPatMedInhospListByCondition" parameterType="com.smartor.domain.PatMedInhospVO"
            resultMap="PatMedInhospResult">
        select CONCAT( a.age, a.age_unit ) AS age,