liusheng
2024-09-04 9526971c403417c1c007804f24884c443b9e6cd7
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -56,6 +56,15 @@
        <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">
@@ -63,9 +72,11 @@
               hosp_type,
               long_send_time,
               openid,
               service_type,
               libtemplateid,
               libtemplatename,
               hospno,
               score,
               phone,
               sex,
               age,
@@ -114,7 +125,7 @@
        from service_subtask
    </sql>
    <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.ServiceSubtask"
    <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.ServiceSubtaskVO"
            resultMap="ServiceSubtaskResult">
        <include refid="selectServiceSubtaskVo"/>
        <where>
@@ -123,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>
@@ -160,6 +172,9 @@
            <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>
@@ -223,7 +238,8 @@
            <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>
@@ -276,7 +292,8 @@
            <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>
@@ -334,6 +351,8 @@
            <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>
@@ -391,6 +410,9 @@
            <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>
@@ -460,7 +482,9 @@
               roomno,
               admindate,
               patid,
               service_type,
               deptname,
               score,
               diagname
        FROM service_subtask,
             JSON_TABLE(send_time_slot, '$[*]' COLUMNS (
@@ -472,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>