liusheng
5 天以前 6659135780e718758417efde4c8c351c69e3755b
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -197,12 +197,16 @@
        <include refid="selectServiceSubtaskVo"/>
        <where>
            del_flag=0
            and taskid = #{taskid}
            AND sendstate IN
            <foreach collection="sendstates" item="sendstate" open="(" separator=","
                     close=")">
                #{sendstate}
            </foreach>
            <if test="taskid != null ">and taskid = #{taskid}</if>
            <if test="serviceType != null ">and service_type = #{serviceType}</if>
            <if test="patid != null ">and patid = #{patid}</if>
            <if test="sendstates!=null">
                AND sendstate IN
                <foreach collection="sendstates" item="sendstate" open="(" separator=","
                         close=")">
                    #{sendstate}
                </foreach>
            </if>
        </where>
    </select>
@@ -475,9 +479,14 @@
    <select id="selectSendstateByCondition" parameterType="com.smartor.domain.ServiceSubtask" resultType="Integer">
        SELECT b.sendstate
        from service_task a
                 JOIN service_subtask b on a.taskid = b.taskid and a.pat_cycle = 0 and b.del_flag = 0
        where b.taskid = #{taskid}
          and b.patid = #{patid}
        JOIN service_subtask b on a.taskid = b.taskid and a.pat_cycle = 0 and b.del_flag = 0
        <where>b.taskid = #{taskid}
            and b.patid = #{patid}
            <if test="createTime != null and createTime != ''">
                DATE_FORMAT(b.create_time, '%Y-%m-%d') LIKE CONCAT(#{createTimeNew}, '%')
            </if>
            <if test="sendstate != null ">and b.sendstate = #{sendstate}</if>
        </where>
    </select>
    <select id="selectTimelyRate" parameterType="com.smartor.domain.ServiceSubtask" resultType="double">
@@ -545,6 +554,20 @@
    <select id="selectServiceSubtaskById" parameterType="Long" resultMap="ServiceSubtaskResult">
        <include refid="selectServiceSubtaskVo"/>
        where id = #{id}
    </select>
    <select id="selectServiceSubtaskByDiagname" parameterType="com.smartor.domain.ServiceSubtask"
            resultMap="ServiceSubtaskResult">
        select sendstate,starttime,endtime,nurse_name,phone,sex,task_name,sendname,leavediagname,visit_time FROM
        service_subtask WHERE del_flag=0
        <if test="leavediagname != null">and leavediagname like concat('%',#{leavediagname}, '%')</if>
        <if test="sendname != null">and sendname like concat('%',#{sendname}, '%')</if>
        <if test="taskName != null">and task_name like concat('%',#{taskName}, '%')</if>
        <if test="sendstate != null">and sendstate = #{sendstate}</if>
        <if test="orgid != null">and orgid =#{orgid}</if>
        GROUP BY sendname,sendstate,starttime,endtime,nurse_name,phone,sex,task_name,leavediagname,visit_time ORDER BY
        visit_time
        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
    </select>
    <insert id="insertServiceSubtask" parameterType="com.smartor.domain.ServiceSubtask" useGeneratedKeys="true"
@@ -1394,7 +1417,6 @@
        SUM(pmiCount) AS pmiCount,
        SUM(pmoCount) AS pmoCount
        FROM (
        -- 随访数据
        SELECT
        <choose>
            <when test="timeType == 'day'">