liusheng
3 天以前 1713fac8ca97c63924d2f1ed08ef520a7b4a4439
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -230,15 +230,15 @@
            resultMap="ServiceSubtaskResult">
        <include refid="selectServiceSubtaskVo"/>
        where 1=1
            and del_flag = 0
            <if test="orgid != null and orgid != ''">
                and orgid = #{orgid}
            </if>
            <if test="taskid != null ">and taskid = #{taskid}</if>
            <if test="visitTime != null">
                AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{visitTime},'%y%m%d')
            </if>
            <if test="sendstate != null ">and sendstate = #{sendstate}</if>
        and del_flag = 0
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="taskid != null ">and taskid = #{taskid}</if>
        <if test="visitTime != null">
            AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{visitTime},'%y%m%d')
        </if>
        <if test="sendstate != null ">and sendstate = #{sendstate}</if>
    </select>
@@ -382,7 +382,6 @@
        <if test="excep != null ">and excep = #{excep}</if>
        <if test="nurseName != null ">and nurse_name = #{nurseName}</if>
        <if test="score != null">and score = #{score}</if>
        <!--            <if test="visitCount != null">and visit_count = #{visitCount}</if>-->
        <if test="visitCount != null and visitCount == 1">
            AND visit_count = 1
        </if>
@@ -395,10 +394,6 @@
        <if test="taskGuid != null">and task_guid = #{taskGuid}</if>
        <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
        <if test="isVisitAgain != null">and is_visit_again = #{isVisitAgain}</if>
        <!--            <if test="dateLimit != null and dateLimit = '1'"> and CURDATE() + 1 > long_send_time</if>-->
        <!-- <if test="visitTime != null">and visit_time = #{visitTime}</if> -->
        <!--<if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
        <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>-->
        <if test="visitCount != null and visitCount > 1 and visitDeptCodes != null and visitDeptCodes.size() > 0">
            AND visit_dept_code IN
            <foreach collection="visitDeptCodes" item="visitDeptCodes" open="("
@@ -415,8 +410,7 @@
        <if test="sort != null  and sort==6">order by admindate desc</if>
        <if test="sort != null  and sort==7">order by visit_time asc</if>
        <if test="sort != null  and sort==8">order by visit_time desc</if>
        <!-- order by update_time desc,id desc -->
        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
    </select>
    <select id="getCompensateServiceSubtaskList" parameterType="com.smartor.domain.ServiceSubtaskVO"
            resultMap="ServiceSubtaskResult">
@@ -567,6 +561,8 @@
        SUM(CASE WHEN DATE(visit_time) &lt; DATE(IFNULL(finishtime, NOW())) THEN 1 ELSE 0 END) / COUNT(*) as rate
        FROM service_subtask
        WHERE del_flag = 0
        AND visit_time IS NOT NULL
        AND finishtime IS NOT NULL
        <if test="orgid != null">AND orgid = #{orgid}</if>
        <if test="starttime == null and endtime==null">
            AND visit_time &lt; NOW()
@@ -1216,7 +1212,39 @@
    <select id="getSfStatistics" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
            resultMap="ServiceSubtaskResult">
        <include refid="selectServiceSubtaskVo"/>
        select id,
        visit_count,
        is_visit_again,
        type,
        orgid,
        drcode,
        drname,
        leavehospitaldistrictcode,
        leavehospitaldistrictname,
        deptcode,
        deptname,
        sendstate,
        preachform,
        excep,
        nurse_id,
        nurse_name,
        taskid,
        task_name,
        visit_time,
        finishtime,
        endtime,
        senddate,
        suggest,
        result,
        templateid,
        templatename,
        patid,
        sendname,
        send_type,
        recordid,
        exrecallcount,
        task_situation
        from service_subtask
        where 1=1
        and del_flag = 0
        <if test="orgid != null and orgid != ''">
@@ -1983,7 +2011,8 @@
        SUM(CASE WHEN sendstate >= 3 OR sendstate = 1 THEN 1 ELSE 0 END) AS yfs,
        SUM(CASE WHEN sendstate = 2 THEN 1 ELSE 0 END) AS dsf,
        SUM(CASE WHEN sendstate = 1 THEN 1 ELSE 0 END) AS blq,
        SUM(CASE WHEN excep IS NOT NULL AND excep != '0' THEN 1 ELSE 0 END) AS yc
        SUM(CASE WHEN excep IS NOT NULL AND excep != '0' THEN 1 ELSE 0 END) AS yc,
        SUM(CASE WHEN isabnormal IS NOT NULL AND isabnormal = 2 THEN 1 ELSE 0 END) AS jg
        FROM service_subtask
        where 1=1
        and del_flag = 0