liusheng
2024-09-04 9526971c403417c1c007804f24884c443b9e6cd7
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -54,14 +54,29 @@
        <result property="patid" column="patid"/>
        <result property="libtemplatename" column="libtemplatename"/>
        <result property="libtemplateid" column="libtemplateid"/>
        <result property="openid" column="openid"/>
        <result property="longSendTime" column="long_send_time"/>
        <result property="serviceType" column="service_type"/>
        <result property="score" column="score"/>
    </resultMap>
    <resultMap type="com.smartor.domain.ServiceSubtaskCount" id="ServiceSubtaskResult2">
        <result property="month" column="month"/>
        <result property="serviceType" column="service_type"/>
        <result property="subTaskId" column="subTaskId"/>
    </resultMap>
    <sql id="selectServiceSubtaskVo">
        select id,
               hosp_type,
               long_send_time,
               openid,
               service_type,
               libtemplateid,
               libtemplatename,
               hospno,
               score,
               phone,
               sex,
               age,
@@ -110,7 +125,8 @@
        from service_subtask
    </sql>
    <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.ServiceSubtask" resultMap="ServiceSubtaskResult">
    <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.ServiceSubtaskVO"
            resultMap="ServiceSubtaskResult">
        <include refid="selectServiceSubtaskVo"/>
        <where>
            del_flag=0
@@ -118,6 +134,7 @@
            <if test="phone != null  and phone != ''">and phone = #{phone}</if>
            <if test="sex != null  and sex != ''">and sex = #{sex}</if>
            <if test="age != null ">and age = #{age}</if>
            <if test="serviceType != null ">and service_type = #{serviceType}</if>
            <if test="patid != null ">and patid = #{patid}</if>
            <if test="sfzh != null  and sfzh != ''">and sfzh = #{sfzh}</if>
            <if test="addr != null  and addr != ''">and addr = #{addr}</if>
@@ -150,8 +167,14 @@
            <if test="operatorNo != null  and operatorNo != ''">and operator_no = #{operatorNo}</if>
            <if test="wechat != null  and wechat != ''">and wechat = #{wechat}</if>
            <if test="hospType != null  and hospType != ''">and hosp_type = #{hospType}</if>
            <if test="libtemplateid != null ">and libtemplateid = #{libtemplateid},</if>
            <if test="libtemplatename != null ">and libtemplatename = #{libtemplatename},</if>
            <if test="libtemplateid != null ">and libtemplateid = #{libtemplateid}</if>
            <if test="libtemplatename != null ">and libtemplatename = #{libtemplatename}</if>
            <if test="openid != null ">and openid = #{openid}</if>
            <if test="longSendTime != null ">and long_send_time = #{longSendTime}</if>
            <if test="sendstate != null ">and sendstate = #{sendstate}</if>
            <if test="score != null">
                and score = #{score}
            </if>
        </where>
        order by update_time desc,id desc
    </select>
@@ -213,6 +236,10 @@
            <if test="libtemplateid != null ">libtemplateid,</if>
            <if test="libtemplatename != null ">libtemplatename,</if>
            <if test="patid != null ">patid,</if>
            <if test="openid != null ">openid,</if>
            <if test="longSendTime != null ">long_send_time,</if>
            <if test="serviceType != null ">service_type,</if>
            <if test="score != null ">score,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sendname != null">#{sendname},</if>
@@ -263,6 +290,10 @@
            <if test="libtemplateid != null ">#{libtemplateid},</if>
            <if test="libtemplatename != null ">#{libtemplatename},</if>
            <if test="patid != null ">#{patid},</if>
            <if test="openid != null ">#{openid},</if>
            <if test="longSendTime != null ">#{longSendTime},</if>
            <if test="serviceType != null ">#{serviceType},</if>
            <if test="score != null ">#{score},</if>
        </trim>
    </insert>
@@ -317,6 +348,11 @@
            <if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if>
            <if test="libtemplatename != null ">libtemplatename = #{libtemplatename},</if>
            <if test="patid != null ">patid = #{patid},</if>
            <if test="openid != null ">openid = #{openid},</if>
            <if test="longSendTime != null ">long_send_time = #{longSendTime},</if>
            <if test="sendstate != null ">sendstate = #{sendstate},</if>
            <if test="serviceType != null ">service_type = #{serviceType},</if>
            <if test="score != null ">score = #{score},</if>
        </trim>
        where id = #{id}
    </update>
@@ -372,6 +408,11 @@
            <if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if>
            <if test="libtemplatename != null ">libtemplatename = #{libtemplatename},</if>
            <if test="patid != null ">patid = #{patid},</if>
            <if test="openid != null ">openid = #{openid},</if>
            <if test="longSendTime != null ">long_send_time = #{longSendTime},</if>
            <if test="serviceType != null ">service_type = #{serviceType},</if>
            <if test="score != null ">score = #{score},</if>
        </trim>
        where patid = #{patid} and taskid = #{taskid}
    </update>
@@ -384,7 +425,7 @@
        where id = #{id}
    </update>
    <update id="deleteServiceSubtaskByCondition" >
    <update id="deleteServiceSubtaskByCondition">
        update service_subtask
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
@@ -396,9 +437,11 @@
        select id,
               sendname,
               long_send_time,
               phone,
               sex,
               age,
               openid,
               sfzh,
               addr,
               senderdetail,
@@ -439,7 +482,9 @@
               roomno,
               admindate,
               patid,
               service_type,
               deptname,
               score,
               diagname
        FROM service_subtask,
             JSON_TABLE(send_time_slot, '$[*]' COLUMNS (
@@ -451,5 +496,29 @@
          AND del_flag = 0
    </select>
    <!--    获取随访门诊每月的数量-->
    <select id="getSfFzInfoEveryMonth" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
            resultMap="ServiceSubtaskResult2">
        SELECT DATE_FORMAT(st.finishtime, '%Y-%m') AS month,
              st.service_type as service_type,
            st.id as subTaskId,
    COUNT(*) AS count
        FROM
            service_subtask st
            JOIN
            sys_user_dept dd
        ON dep.dept_id = dd.dept_id
        WHERE
            dd.user_id =#{userId}
          AND st.finishtime IS NOT NULL
          and DATE_FORMAT(st.finishtime
            , '%Y-%m') &gt;= #{startTime}
          and DATE_FORMAT(st.finishtime
            , '%Y-%m') &lt;= #{endTime}
        GROUP BY
            month, st.service_type, st.id
        ORDER BY
            month, st.service_type, st.id;
    </select>
</mapper>