sinake
2025-09-24 b0e0b4c0e342865daefb31eb3b956129fe722c8c
随访查询7应随访日期(倒序)8应随访日期(正序)
已修改10个文件
166 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/CollectHISController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/smsVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SmsController.java
@@ -8,7 +8,9 @@
import com.ruoyi.common.utils.sms.smsUtils;
import com.ruoyi.framework.config.ServerConfig;
import com.smartor.domain.HtmlContentVO;
import com.smartor.domain.ServiceOutPath;
import com.smartor.domain.smsVO;
import com.smartor.service.IServiceOutPathService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +23,7 @@
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Date;
@RestController
@Api(description = "知信接口")
@@ -44,6 +47,9 @@
    @Value("${pub_key}")
    private String pub_key;
    @Autowired
    private IServiceOutPathService iServiceOutPathService;
    /**
     * @param
@@ -62,13 +68,24 @@
    @ApiOperation("短信发送")
    @PostMapping("/sendAsk")
    public AjaxResult sendAsk(@RequestBody smsVO vo) throws UnsupportedEncodingException {
//        String format = String.format("%03X", vo.getId());
//        String url=ip + ":" + req_path + "/wt?p=" + format;
        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
        String taskId = rsaPublicKeyExample.encryptedData(vo.getTaskId().toString(), pub_key);
        String patid = rsaPublicKeyExample.encryptedData(vo.getPatId().toString(), pub_key);
        String url = null;
        url = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(vo.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
        String subId = rsaPublicKeyExample.encryptedData(vo.getSubId().toString(), pub_key);
        ServiceOutPath serviceOutPath = new ServiceOutPath();
        serviceOutPath.setParam1(taskId);
        serviceOutPath.setParam2(patid);
        serviceOutPath.setParam3(vo.getTaskName());
        serviceOutPath.setParam6(subId);
        serviceOutPath.setCreateTime(new Date());
        iServiceOutPathService.insertServiceOutPath(serviceOutPath);
        String format = String.format("%03X", serviceOutPath.getId());
        serviceOutPath.setRadix(format);
        serviceOutPath.setUpdateTime(new Date());
        iServiceOutPathService.updateServiceOutPath(serviceOutPath);
        String url=ip + ":" + req_path + "/wt?p=" + format;
        //String url = = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(vo.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
        String content="您好,邀请您填写出院调查表,请点击" + url + "填写。感谢您配合!";
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -325,6 +325,18 @@
    }
    /**
     * 获取随访统计比例
     */
    @ApiOperation("获取随访统计比例")
    @PostMapping("/getSfStatisticsAsk")
    public AjaxResult getSfStatisticsAsk(@RequestBody ServiceSubtaskCountReq serviceSubtaskCountReq) {
        if (CollectionUtils.isEmpty(serviceSubtaskCountReq.getServiceType())) {
            return error("服务类型不能为空");
        }
        return success(serviceSubtaskService.getSfStatisticsAsk(serviceSubtaskCountReq));
    }
    /**
     * 随访统计导出
     */
    //@PreAuthorize("@ss.hasPermi('system:taskcall:export')")
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/CollectHISController.java
@@ -31,10 +31,13 @@
    @PostMapping("/collect")
    @ApiOperation("同步病人相关数据")
    public AjaxResult hnDataGather(@RequestBody HnDataGatherVO hnDataGatherVO) {
        try {
            Integer count =ichService.sync();
            return AjaxResult.success(count);
        } catch (Exception ex) {
            return AjaxResult.error(ex.getMessage());
        }
        //Boolean aBoolean = ichService.hnDataGather(hnDataGatherVO);
       Integer count= ichService.sync();
        return AjaxResult.success(count);
    }
    /**
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/CollectHISServiceImpl.java
@@ -171,21 +171,23 @@
        for (PatMedInhosp pm : patMedInhospList) {
            try {
                //患者基本信息
                PatArchive patArchive = new PatArchive();
                patArchive.setPatientno(pm.getPatno());
                List<PatArchive> patArchives = chMapper.selectPatArchiveList(patArchive);
                if (patArchives.size() > 0) {
                    PatArchive pa1 = new PatArchive();
                    pa1.setPatientno(pm.getPatno());
                    List<PatArchive> patArchives1 = patArchiveMapper.selectPatArchiveList(pa1);
                    if (CollectionUtils.isNotEmpty(patArchives1)) {
                        patArchives.get(0).setId(patArchives1.get(0).getId());
                        patArchives.get(0).setUpdateTime(new Date());
                        count += patArchiveMapper.updatePatArchive(patArchives.get(0));
                    } else {
                        patArchives.get(0).setCreateTime(new Date());
                        count += patArchiveMapper.insertPatArchiveSingle(patArchives.get(0));
                if(ObjectUtils.isNotEmpty(pm.getPatno())) {
                    PatArchive patArchive = new PatArchive();
                    patArchive.setPatientno(pm.getPatno());
                    patArchive.setPageSize(5);
                    List<PatArchive> patArchives = chMapper.selectPatArchiveList(patArchive);
                    if (patArchives.size() > 0) {
                        PatArchive pa1 = new PatArchive();
                        pa1.setPatientno(pm.getPatno());
                        List<PatArchive> patArchives1 = patArchiveMapper.selectPatArchiveList(pa1);
                        if (CollectionUtils.isNotEmpty(patArchives1)) {
                            patArchives.get(0).setId(patArchives1.get(0).getId());
                            patArchives.get(0).setUpdateTime(new Date());
                            count += patArchiveMapper.updatePatArchive(patArchives.get(0));
                        } else {
                            patArchives.get(0).setCreateTime(new Date());
                            count += patArchiveMapper.insertPatArchiveSingle(patArchives.get(0));
                        }
                    }
                }
            }catch (Exception ex) {
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -643,8 +643,15 @@
                                    serviceSubtaskMapper.updateServiceSubtask(ss);
                                    continue;
                                }
                                String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), patArchive.getTelcode(), serviceSubtask.getSendname(), patArchive.getPatidHis(), wxqqxx);
                                String wxCode = "";
                                if (visitHosp == 3) {//市一医院
                                    String urlTemp="http://192.200.54.14:5003/sfjk/SendMessage?sfzh="+serviceSubtask.getSfzh()
                                            +"&title=您好,邀请您填写出院调查表,请点击填写。&content=您好,邀请您填写出院调查表,请点击填写。&phone="+patArchive.getTelcode()
                                            +"&url="+url+"&key=ff76f8904f5f32b5ee1739e8ea46e60g";
                                    HttpUtils.sendGet(urlTemp);
                                }else{
                                    wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), patArchive.getTelcode(), serviceSubtask.getSendname(), patArchive.getPatidHis(), wxqqxx);
                                }
                                Map<String, Object> map = JSONObject.parseObject(wxCode, Map.class);
                                //任务发送记录
                                ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
ruoyi-quartz/src/main/resources/mapper/quartz/CollectHISMapper.xml
@@ -394,7 +394,7 @@
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
            <if test="viptype != null ">and viptype = #{viptype}</if>
            <if test="pattype != null ">and pattype = #{pattype}</if>
            <if test="patientno != null ">and patientno = #{patientno}</if>
            <if test="patientno != null ">and patientno = #{patientno} </if>
            <if test="patidHis != null ">and patid_his = #{patidHis}</if>
            <if test="sdFlag != null ">and sd_flag = #{sdFlag}</if>
            <if test="ageUnit != null ">and age_unit = #{ageUnit}</if>
@@ -419,6 +419,9 @@
            <if test="lastEndTime != null and lastEndTime != ''">
                and to_char(last_Update_Time, 'YYYY-MM-DD HH24:MI:SS') &lt;= #{lastEndTime}
            </if>
            <if test="pageSize != null and pageSize!='' ">and rownum&lt;#{pageSize}</if>
        </where>
    </select>
smartor/src/main/java/com/smartor/domain/smsVO.java
@@ -13,6 +13,9 @@
    @ApiModelProperty(value = "短信内容")
    private String content;
    @ApiModelProperty(value = "任务ID")
    private String subId;
    @ApiModelProperty(value = "问卷ID")
    private String taskId;
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -129,5 +129,7 @@
    public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq);
    public List<ServiceSubtaskStatistic> getSfStatisticsAsk(ServiceSubtaskCountReq serviceSubtaskCountReq);
    public List<ServiceStatisticsResponse> getServiceStatistics(ServiceStatisticsRequest request);
}
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -2282,6 +2282,71 @@
        return serviceSubtaskStatistics;
    }
    /**
     * 获取随访统计比例
     *
     * @param serviceSubtaskCountReq
     * @return
     */
    @Override
    public List<ServiceSubtaskStatistic> getSfStatisticsAsk(ServiceSubtaskCountReq serviceSubtaskCountReq) {
        log.error("getSfStatistics的入参为:{}", serviceSubtaskCountReq);
        List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
        List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
        // 根据条件进行分组
        Map<String, List<ServiceSubtask>> collect = new HashMap<>();
        if (serviceSubtaskCountReq.getLeavehospitaldistrictcodes() != null && serviceSubtaskCountReq.getLeavehospitaldistrictcodes().size() > 0) {
            if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
                collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrname()).orElse("Unknown")));
            } else {
                collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictname()).orElse("Unknown")));
            }
        } else if (serviceSubtaskCountReq.getDeptcodes() != null && serviceSubtaskCountReq.getDeptcodes().size() > 0) {
            if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
                collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrname()).orElse("Unknown")));
            } else {
                collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptname()).orElse("Unknown")));
            }
        }
        for (List<ServiceSubtask> serviceSubtaskList : collect.values()) {
            if (CollectionUtils.isEmpty(serviceSubtaskList)) {
                continue;
            }
            ServiceSubtaskStatistic statistic = getStatistic(serviceSubtaskList);
            //及时率
            ServiceSubtask ss = new ServiceSubtask();
            ss.setOrgid(serviceSubtaskList.get(0).getOrgid());
            // 如果有医生编码,设置医生编码用于及时率查询
            if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
                ss.setDrcode(serviceSubtaskList.get(0).getDrcode());
            }else {
                if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())) {
                    ss.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode());
                } else if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getDeptcodes())) {
                    ss.setDeptcode(serviceSubtaskList.get(0).getDeptcode());
                }
            }
            ss.setStarttime(serviceSubtaskCountReq.getStartTime());
            ss.setEndtime(serviceSubtaskCountReq.getEndTime());
            if (serviceSubtaskCountReq.getEndTime() != null && new Date().before(serviceSubtaskCountReq.getEndTime())) {
                ss.setEndtime(new Date());
            }
            Double jsRate = serviceSubtaskMapper.selectTimelyRate(ss);
            statistic.setRate(jsRate);
            if (ObjectUtils.isNotEmpty(statistic)) {
                serviceSubtaskStatistics.add(statistic);
            }
        }
        return serviceSubtaskStatistics;
    }
    private ServiceSubtaskStatistic getStatistic(List<ServiceSubtask> serviceSubtaskList) {
        ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic();
        //格式化为两位小数的百分比
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -338,6 +338,8 @@
        <if test="sort != null  and sort==3">order by long_send_time desc</if>
        <if test="sort != null  and sort==5">order by admindate asc</if>
        <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 -->
    </select>