已修改7个文件
169 ■■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -709,6 +709,7 @@
     * taskSituation4Info - taskSituation = 4
     * taskSituation5Info - taskSituation = 5
     * taskSituation6Info - taskSituation = 7
     * manuallyCalledInfo - isManuallyCalled = 1L
     * filterCountList - taskSituation = 6 && sendstate = 4
     *
     */
@@ -843,37 +844,38 @@
    @ApiOperation("获取当前用户随访数量统计")
    @PostMapping("/getCurrentUserServiceSubtaskCount")
    public Map<String, Object> getCurrentUserServiceSubtaskCount() {
        Map<String, Object> map = new HashMap<>();
        LoginUser loginUser = getLoginUser();
        LoginUser loginUser = SecurityUtils.getLoginUser();
        if (loginUser == null || loginUser.getUser() == null) {
            return new HashMap<>();
        }
        SysUser sysUser = loginUser.getUser();
        SysUserDept sysUserDept = new SysUserDept();
        sysUserDept.setUserId(sysUser.getUserId());
        sysUserDept.setOrgid(sysUser.getOrgid());
        sysUserDept.setCampusid(sysUser.getCampusid());
        sysUserDept.setDeptType("1");
        List<SysUserDept> sysUserDepts = sysUserDeptService.selectSysUserDeptList(sysUserDept);
        SysUserDept sysUserWard = new SysUserDept();
        sysUserWard.setUserId(sysUser.getUserId());
        sysUserWard.setOrgid(sysUser.getOrgid());
        sysUserWard.setCampusid(sysUser.getCampusid());
        sysUserWard.setDeptType("2");
        List<SysUserDept> sysUserWards = sysUserDeptService.selectSysUserDeptList(sysUserWard);
        List<String> deptCodes = sysUserDepts.stream().map(SysUserDept::getDeptCode).collect(Collectors.toList());
        List<String> wardCodes = sysUserWards.stream().map(SysUserDept::getDeptCode).collect(Collectors.toList());
        List<String> deptCodes = CollectionUtils.emptyIfNull(sysUser.getBelongDepts()).stream()
                .map(item -> item.get("deptCode"))
                .filter(Objects::nonNull) // 剔除null
                .map(Object::toString)
                .collect(Collectors.toList());
        List<String> wardCodes = CollectionUtils.emptyIfNull(sysUser.getBelongWards()).stream()
                .map(item -> item.get("districtCode"))
                .filter(Objects::nonNull) // 剔除null
                .map(Object::toString)
                .collect(Collectors.toList());
        ServiceSubtaskEntity entity = new ServiceSubtaskEntity();
        entity.setOrgid(sysUser.getOrgid());
        entity.setLeaveldeptcodes(deptCodes);
        entity.setLeavehospitaldistrictcodes(wardCodes);
        if (ObjectUtils.isNotEmpty(sysUser)) {
            if (!("admin").equals(sysUser.getUserName())) {
                if (ObjectUtils.isNotEmpty(sysUserWards) && ObjectUtils.isNotEmpty(sysUserDepts)) {
                    map = serviceSubtaskService.getCurrentUserServiceSubtaskCount(entity);
                }
            } else {
                map = serviceSubtaskService.getCurrentUserServiceSubtaskCount(entity);
            }
        // admin 查看全院;非 admin 只要配置了科室或病区任一维度即可查询(SQL 中为 OR 关系)
        boolean isAdmin = "admin".equals(sysUser.getUserName());
        if (isAdmin || CollectionUtils.isNotEmpty(deptCodes) || CollectionUtils.isNotEmpty(wardCodes)) {
            return serviceSubtaskService.getCurrentUserServiceSubtaskCount(entity);
        }
        return map;
        // 非 admin 且未配置任何科室/病区权限时,返回默认 0 值,避免前端取不到 key
        Map<String, Object> empty = new HashMap<>();
        empty.put("pendingVisitCount", 0);
        empty.put("failedVisitCount", 0);
        empty.put("abnormalVisitCount", 0);
        empty.put("warnningVisitCount", 0);
        empty.put("allVisitCount", 0);
        return empty;
    }
    @ApiOperation("获取当前用户宣教数量统计")
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
@@ -33,7 +33,7 @@
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd[ HH:mm:ss]", timezone = "GMT+8")
    private Date createTime;
    /**
@@ -44,7 +44,7 @@
    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd[ HH:mm:ss]", timezone = "GMT+8")
    private Date updateTime;
    /**
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -223,6 +224,12 @@
    private String hospType;
    /**
     * 人工电话标记
     */
    @ApiModelProperty(value = "是否人工打过电话 0-没打过 1-打过")
    private Long isManuallyCalled;
    /**
     * pageNum
     */
    @ApiModelProperty("pageNum")
smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java
@@ -102,6 +102,10 @@
    @Excel(name = " 应随访人次 ")
    private Long followUpNeeded = 0L;
    @ApiModelProperty(value = "人工已拨通总量")
    @Excel(name = " 人工已拨通总量 ")
    private Long manuallyCalled = 0L;
    @ApiModelProperty(value = "首次无需随访")
    private Long nonFollowUpFirst = 0L;
smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
@@ -212,6 +212,7 @@
     * ywc: 已完成数量 sendstate = 6L
     * dfs: 待发送数量 sendstate = 1L, 3L, 4L, 5L, 6L, 7L
     * yfs: 已发送数量 sendstate = 2L
     * cs: 超时数量 sendstate = 7L
     * yc: 异常数量 excep = '1'
     * yc: 警告数量 excep = '2'
     */
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -558,11 +558,22 @@
    @Override
    public List<ServiceSubtask> patItem2(ServiceSubtaskEntity serviceSubtaskEntity) {
        if (serviceSubtaskEntity.getSendstateView() != null) {
            //            1:待随访(1 被领取、2 待发送、3 已发送、5 发送失败、7、超时);2:已完成( 6 已完成)、3:无需随访(4 不执行)
            if (serviceSubtaskEntity.getSendstateView() == 1)
                serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 5L, 7L)));
            if (serviceSubtaskEntity.getSendstateView() == 2)
                serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(6L)));
            if (serviceSubtaskEntity.getSendstateView() == 3)
                serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(4L)));
        }
        List<ServiceSubtask> serviceSubtaskList = new ArrayList<>();
        for (Long sendstate : serviceSubtaskEntity.getSendstates()) {
            serviceSubtaskEntity.setSendstate(sendstate);
            List<ServiceSubtask> serviceSubtasks = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskEntity);
            serviceSubtaskList.addAll(serviceSubtasks);
        if(CollectionUtils.isNotEmpty(serviceSubtaskEntity.getSendstates())){
            for (Long sendstate : serviceSubtaskEntity.getSendstates()) {
                serviceSubtaskEntity.setSendstate(sendstate);
                List<ServiceSubtask> serviceSubtasks = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskEntity);
                serviceSubtaskList.addAll(serviceSubtasks);
            }
        }
        return serviceSubtaskList;
    }
@@ -633,6 +644,7 @@
            result.putIfAbsent("xsf", 0);
            result.putIfAbsent("dsf", 0);
            result.putIfAbsent("ywc", 0);
            result.putIfAbsent("cs", 0);
            result.putIfAbsent("yc", 0);
            result.putIfAbsent("jg", 0);
        }
@@ -669,6 +681,7 @@
            result.putIfAbsent("dsf", 0);
            result.putIfAbsent("dfs", 0);
            result.putIfAbsent("yfs", 0);
            result.putIfAbsent("cs", 0);
            result.putIfAbsent("ywc", 0);
            result.putIfAbsent("yc", 0);
            result.putIfAbsent("jg", 0);
@@ -3311,6 +3324,12 @@
                    serviceSubtaskStatistic.setFollowUpNeeded(serviceSubtaskStatistic.getFollowUpNeeded() + 1L);
                }
                //人工已拨通总量
                if (ObjectUtils.isNotEmpty(serviceSubtask.getIsManuallyCalled())
                        && serviceSubtask.getIsManuallyCalled().equals(1L)) {
                    serviceSubtaskStatistic.setManuallyCalled(serviceSubtaskStatistic.getManuallyCalled() + 1L);
                }
                //首次出院随访
                if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 1) {
                    //首次应随访
@@ -4330,6 +4349,7 @@
     * taskSituation4Info - taskSituation = 4
     * taskSituation5Info - taskSituation = 5
     * taskSituation6Info - taskSituation = 7
     * manuallyCalledInfo - isManuallyCalled = 1L
     * filterCountList - taskSituation = 6 && sendstate = 4
     *
     */
@@ -4508,6 +4528,9 @@
                serviceSubtaskCountReq.setTaskSituation(6);
                serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(4L)));
                break;
            case "manuallyCalledInfo":
                serviceSubtaskCountReq.setIsManuallyCalled(1L);
                break;
            default:
                break;
        }
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -406,17 +406,21 @@
            </if>
        </if>
        <if test="deptOrDistrict==2">
            AND (1=1
            <if test="leavehospitaldistrictcodes != null">
                AND leavehospitaldistrictcode IN
            AND (
            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
                leavehospitaldistrictcode IN
                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
                         separator=","
                         close=")">
                    #{leavehospitaldistrictcode}
                </foreach>
            </if>
            <if test=" leaveldeptcodes != null">
                OR deptcode IN
            <if test="(leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0)
                and (leaveldeptcodes != null and leaveldeptcodes.size() > 0)">
                OR
            </if>
            <if test=" leaveldeptcodes != null and leaveldeptcodes.size() > 0">
                deptcode IN
                <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
                         close=")">
                    #{leaveldeptcode}
@@ -1569,7 +1573,8 @@
        continue_content,
        continue_count,
        continue_time_next,
        task_situation
        task_situation,
        is_manually_called
        from service_subtask
        where 1=1
        and del_flag = 0
@@ -1856,7 +1861,8 @@
        continue_count,
        continue_time_next,
        task_situation,
        remark
        remark,
        is_manually_called
        from service_subtask
        where 1=1
        and del_flag = 0
@@ -1942,6 +1948,9 @@
        </if>
        <if test="deptcode != null and deptcode != ''">
            AND deptcode = #{deptcode}
        </if>
        <if test="isManuallyCalled != null">
            AND is_manually_called = #{isManuallyCalled}
        </if>
        order by endtime desc
        <if test="pageSize != null  and pageNum != null">
@@ -2600,6 +2609,7 @@
        SUM(CASE WHEN sendstate != 2 THEN 1 ELSE 0 END) AS yfs,
        SUM(CASE WHEN sendstate = 2 THEN 1 ELSE 0 END) AS wfs,
        SUM(CASE WHEN sendstate = 6 THEN 1 ELSE 0 END) AS ywc,
        SUM(CASE WHEN sendstate = 7 THEN 1 ELSE 0 END) AS cs,
        SUM(CASE WHEN excep IS NOT NULL AND excep = '1' THEN 1 ELSE 0 END) AS yc,
        SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS jg,
        COUNT(1) as total
@@ -2636,17 +2646,21 @@
            </if>
        </if>
        <if test="deptOrDistrict==2">
            AND (1=1
            AND (
            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
                AND leavehospitaldistrictcode IN
                leavehospitaldistrictcode IN
                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
                         separator=","
                         close=")">
                    #{leavehospitaldistrictcode}
                </foreach>
            </if>
            <if test="(leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0)
                and (leaveldeptcodes != null and leaveldeptcodes.size() > 0)">
                OR
            </if>
            <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
                OR deptcode IN
                deptcode IN
                <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
                         close=")">
                    #{leaveldeptcode}
@@ -2843,20 +2857,28 @@
        <if test="campusid != null and campusid != ''">
            and campusid = #{campusid}
        </if>
        <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            AND leavehospitaldistrictcode IN
            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
                     separator=","
                     close=")">
                #{leavehospitaldistrictcode}
            </foreach>
        </if>
        <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
            AND deptcode IN
            <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
                     close=")">
                #{leaveldeptcode}
            </foreach>
        <if test="(leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0)
                or (leaveldeptcodes != null and leaveldeptcodes.size() > 0)">
            AND (
            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
                leavehospitaldistrictcode IN
                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
                         separator=","
                         close=")">
                    #{leavehospitaldistrictcode}
                </foreach>
            </if>
            <if test="(leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0)
                and (leaveldeptcodes != null and leaveldeptcodes.size() > 0)">
                OR
            </if>
            <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
                deptcode IN
                <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
                         close=")">
                    #{leaveldeptcode}
                </foreach>
            </if>)
        </if>
    </select>