liusheng
10 小时以前 732024c03df1d810b8f5a8a526066967f1bfbb5d
南华部分功能提交
已修改15个文件
523 ■■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskAnswerController.java 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SmsTempletController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/domain/SmsTemplet.java 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SmsTempletMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SmsTempletServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SmsTempletMapper.xml 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskExport.java 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskAnswerController.java
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -1,6 +1,8 @@
package com.ruoyi.web.controller.smartor;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.ISelect;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -14,20 +16,21 @@
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.dx.MessageSend;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.MsgLSEnum;
import com.ruoyi.common.enums.PreachFormEnum;
import com.ruoyi.common.enums.SendStateEnum;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.reflect.ReflectUtils;
import com.ruoyi.quartz.service.ICollectHISService;
import com.ruoyi.quartz.task.RyTask;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserDeptService;
import com.smartor.common.LSHospTokenUtil;
import com.smartor.common.QwenLLMUtil;
import com.smartor.domain.*;
import com.smartor.domain.VO.HeLibraryCountVO;
@@ -50,6 +53,8 @@
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -562,18 +567,14 @@
                    if(CollectionUtils.isEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())){
                        //全部病区
                        String deptInfo = user.getDeptInfo();
                        List<String> leavehospitaldistrictcodes = JSON.parseArray(deptInfo)
                                .stream()
                                .map(item -> (String) ((List<?>) item).get(0)).collect(Collectors.toList());
                        List<String> leavehospitaldistrictcodes = JSON.parseArray(deptInfo).stream().map(item -> (String) ((List<?>) item).get(0)).collect(Collectors.toList());
                        serviceSubtaskCountReq.setLeavehospitaldistrictcodes(leavehospitaldistrictcodes);
                    }
                }else if(statisticaltype==2){
                    if(CollectionUtils.isEmpty(serviceSubtaskCountReq.getDeptcodes())){
                        //全部科室
                        String hospInfo = user.getHospInfo();
                        List<String> deptCodes = JSON.parseArray(hospInfo)
                                .stream()
                                .map(item -> (String) ((List<?>) item).get(0)).collect(Collectors.toList());
                        List<String> deptCodes = JSON.parseArray(hospInfo).stream().map(item -> (String) ((List<?>) item).get(0)).collect(Collectors.toList());
                        serviceSubtaskCountReq.setDeptcodes(deptCodes);
                    }
                }
@@ -878,6 +879,17 @@
        return serviceSubtaskService.getHeLibraryCount(heLibraryCountVO);
    }
    /**
     * 手动发送问卷模板的短信功能
     *
     * @param subid
     * @return
     */
    @GetMapping(value = "/smsSubTask/{subid}")
    public Map<String, Object> smsSubTask(@PathVariable("subid") Long subid) {
        return serviceSubtaskService.smsSubTask(subid);
    }
    @PostMapping("/test")
    public void test() {
@@ -905,8 +917,7 @@
    }
    @PostMapping("/qwenLLMTest")
    public int qwenLLMTest(@RequestParam("voiceText") String questionText, @RequestParam("voiceText") String voiceText,
                                      @RequestParam("value") String value,@RequestParam("regexText") String regexText) {
    public int qwenLLMTest(@RequestParam("voiceText") String questionText, @RequestParam("voiceText") String voiceText, @RequestParam("value") String value, @RequestParam("regexText") String regexText) {
        int result = ryTask.qwenLLMTest(questionText, voiceText, value, regexText);
        return result;
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SmsTempletController.java
@@ -1,8 +1,10 @@
package com.smartor.controller;
package com.ruoyi.web.controller.smartor;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -35,11 +37,13 @@
     * 查询短信模板列表
     */
    //@PreAuthorize("@ss.hasPermi('smartor:smstemplet:list')")
    @PostMapping("list")
    public TableDataInfo list(@RequestBody SmsTemplet smsTemplet) {
        startPage();
    @PostMapping("/list")
    public Map<String, Object> list(@RequestBody SmsTemplet smsTemplet) {
        //这个不需要分页,一个科室也不会有多少条短信模板
        smsTemplet.setPageNum(null);
        smsTemplet.setPageSize(null);
        List<SmsTemplet> list = smsTempletService.selectSmsTempletList(smsTemplet);
        return getDataTable(list);
        return getDataTable3(ObjectUtil.isNotEmpty(list)?list.size():0, list);
    }
    /**
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java
@@ -4,6 +4,7 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils;
@@ -114,7 +115,9 @@
     * 计算相差天数
     */
    public static int differentDaysByMillisecond(Date date1, Date date2) {
        return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
        LocalDate d1 = date1.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        LocalDate d2 = date2.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        return (int) ChronoUnit.DAYS.between(d1, d2);
    }
    /**
ruoyi-system/src/main/java/com/ruoyi/system/domain/SmsTemplet.java
@@ -1,7 +1,9 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@@ -13,114 +15,84 @@
 * @author smartor
 * @date 2023-03-06
 */
public class SmsTemplet extends BaseEntity
{
@Data
public class SmsTemplet extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /** $column.columnComment */
    /**
     * 主键
     */
    private Long templetid;
    /** $column.columnComment */
    /**
     * 短信模板编号
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String templetno;
    /** $column.columnComment */
    /**
     * 短信模板名称
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String templetname;
    /** $column.columnComment */
    /**
     * 模板内容
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String templetcontent;
    /** $column.columnComment */
    /**
     * 部门编码
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String deptCode;
    /**
     * 部门名称
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String deptName;
    /**
     * 病区编码
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String wardCode;
    /**
     * 病区名称
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String wardName;
    /**
     * 用户工号
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String userName;
    /**
     * 用户铝箔
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private String nickName;
    /**
     * $column.columnComment
     */
    private String delFlag;
    /** $column.columnComment */
    /**
     * $column.columnComment
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private Long isupload;
    /** $column.columnComment */
    /**
     * $column.columnComment
     */
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private Date uploadTime;
    public void setTempletid(Long templetid)
    {
        this.templetid = templetid;
    }
    public Long getTempletid()
    {
        return templetid;
    }
    public void setTempletno(String templetno)
    {
        this.templetno = templetno;
    }
    public String getTempletno()
    {
        return templetno;
    }
    public void setTempletname(String templetname)
    {
        this.templetname = templetname;
    }
    public String getTempletname()
    {
        return templetname;
    }
    public void setTempletcontent(String templetcontent)
    {
        this.templetcontent = templetcontent;
    }
    public String getTempletcontent()
    {
        return templetcontent;
    }
    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }
    public String getDelFlag()
    {
        return delFlag;
    }
    public void setIsupload(Long isupload)
    {
        this.isupload = isupload;
    }
    public Long getIsupload()
    {
        return isupload;
    }
    public void setUploadTime(Date uploadTime)
    {
        this.uploadTime = uploadTime;
    }
    public Date getUploadTime()
    {
        return uploadTime;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("templetid", getTempletid())
            .append("templetno", getTempletno())
            .append("templetname", getTempletname())
            .append("templetcontent", getTempletcontent())
            .append("delFlag", getDelFlag())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("isupload", getIsupload())
            .append("uploadTime", getUploadTime())
            .toString();
    }
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SmsTempletMapper.java
@@ -4,6 +4,8 @@
import java.util.List;
import org.apache.ibatis.annotations.Param;
/**
 * 短信模板Mapper接口
 *
@@ -58,5 +60,5 @@
     * @param templetids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteSmsTempletByTempletids(Long[] templetids);
    public int deleteSmsTempletByTempletids(@Param("templetids") Long[] templetids);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SmsTempletServiceImpl.java
@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -15,8 +16,7 @@
 * @date 2023-03-06
 */
@Service
public class SmsTempletServiceImpl implements ISmsTempletService
{
public class SmsTempletServiceImpl implements ISmsTempletService {
    @Autowired
    private SmsTempletMapper smsTempletMapper;
@@ -27,8 +27,7 @@
     * @return 短信模板
     */
    @Override
    public SmsTemplet selectSmsTempletByTempletid(Long templetid)
    {
    public SmsTemplet selectSmsTempletByTempletid(Long templetid) {
        return smsTempletMapper.selectSmsTempletByTempletid(templetid);
    }
@@ -39,8 +38,7 @@
     * @return 短信模板
     */
    @Override
    public List<SmsTemplet> selectSmsTempletList(SmsTemplet smsTemplet)
    {
    public List<SmsTemplet> selectSmsTempletList(SmsTemplet smsTemplet) {
        return smsTempletMapper.selectSmsTempletList(smsTemplet);
    }
@@ -51,8 +49,7 @@
     * @return 结果
     */
    @Override
    public int insertSmsTemplet(SmsTemplet smsTemplet)
    {
    public int insertSmsTemplet(SmsTemplet smsTemplet) {
        smsTemplet.setCreateTime(DateUtils.getNowDate());
        return smsTempletMapper.insertSmsTemplet(smsTemplet);
    }
@@ -64,8 +61,7 @@
     * @return 结果
     */
    @Override
    public int updateSmsTemplet(SmsTemplet smsTemplet)
    {
    public int updateSmsTemplet(SmsTemplet smsTemplet) {
        smsTemplet.setUpdateTime(DateUtils.getNowDate());
        return smsTempletMapper.updateSmsTemplet(smsTemplet);
    }
@@ -77,8 +73,7 @@
     * @return 结果
     */
    @Override
    public int deleteSmsTempletByTempletids(Long[] templetids)
    {
    public int deleteSmsTempletByTempletids(Long[] templetids) {
        return smsTempletMapper.deleteSmsTempletByTempletids(templetids);
    }
@@ -89,8 +84,7 @@
     * @return 结果
     */
    @Override
    public int deleteSmsTempletByTempletid(Long templetid)
    {
    public int deleteSmsTempletByTempletid(Long templetid) {
        return smsTempletMapper.deleteSmsTempletByTempletid(templetid);
    }
}
ruoyi-system/src/main/resources/mapper/system/SmsTempletMapper.xml
@@ -18,10 +18,36 @@
        <result property="uploadTime"    column="upload_time"    />
        <result property="guid"    column="guid"    />
        <result property="orgid"    column="orgid"    />
        <result property="deptCode" column="dept_code"/>
        <result property="deptName" column="dept_name"/>
        <result property="wardName" column="ward_name"/>
        <result property="wardCode" column="ward_code"/>
        <result property="userName" column="user_name"/>
        <result property="nickName" column="nick_name"/>
    </resultMap>
    <sql id="selectSmsTempletVo">
        select templetid, templetno, orgid, templetname, templetcontent, del_flag, update_by, guid, update_time, create_by, create_time, isupload, upload_time from sms_templet
        select templetid,
               templetno,
               orgid,
               templetname,
               templetcontent,
               del_flag,
               update_by,
               guid,
               update_time,
               create_by,
               create_time,
               isupload,
               upload_time,
               dept_code,
               dept_name,
               ward_name,
               ward_code,
               user_name,
               nick_name
        from sms_templet
    </sql>
    <select id="selectSmsTempletList" parameterType="SmsTemplet" resultMap="SmsTempletResult">
@@ -35,6 +61,12 @@
            <if test="templetcontent != null  and templetcontent != ''"> and templetcontent = #{templetcontent}</if>
            <if test="isupload != null "> and isupload = #{isupload}</if>
            <if test="uploadTime != null "> and upload_time = #{uploadTime}</if>
        <if test="deptCode != null  and deptCode != ''">and dept_code = #{deptCode}</if>
        <if test="deptName != null  and deptName != ''">and dept_name = #{deptName}</if>
        <if test="wardName != null  and wardName != ''">and ward_name = #{wardName}</if>
        <if test="wardCode != null  and wardCode != ''">and ward_code = #{wardCode}</if>
        <if test="userName != null  and userName != ''">and user_name = #{userName}</if>
        <if test="nickName != null  and nickName != ''">and nick_name = #{nickName}</if>
    </select>
    <select id="selectSmsTempletByTempletid" parameterType="Long" resultMap="SmsTempletResult">
@@ -42,10 +74,10 @@
        where templetid = #{templetid}
    </select>
    <insert id="insertSmsTemplet" parameterType="SmsTemplet">
    <insert id="insertSmsTemplet" parameterType="SmsTemplet" useGeneratedKeys="true"
            keyProperty="templetid">
        insert into sms_templet
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="templetid != null">templetid,</if>
            <if test="templetno != null">templetno,</if>
            <if test="templetname != null">templetname,</if>
            <if test="templetcontent != null">templetcontent,</if>
@@ -58,9 +90,14 @@
            <if test="uploadTime != null">upload_time,</if>
            <if test="guid != null">guid,</if>
            <if test="orgid != null">orgid,</if>
            <if test="deptCode != null">dept_code,</if>
            <if test="deptName != null">dept_name,</if>
            <if test="wardCode != null">ward_code,</if>
            <if test="wardName != null">ward_name,</if>
            <if test="userName != null">user_name,</if>
            <if test="nickName != null">nick_name,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="templetid != null">#{templetid},</if>
            <if test="templetno != null">#{templetno},</if>
            <if test="templetname != null">#{templetname},</if>
            <if test="templetcontent != null">#{templetcontent},</if>
@@ -73,6 +110,12 @@
            <if test="uploadTime != null">#{uploadTime},</if>
            <if test="guid != null">#{guid},</if>
            <if test="orgid != null">#{orgid},</if>
            <if test="deptCode != null">#{deptCode},</if>
            <if test="deptName != null">#{deptName},</if>
            <if test="wardCode != null">#{wardCode},</if>
            <if test="wardName != null">#{wardName},</if>
            <if test="userName != null">#{userName},</if>
            <if test="nickName != null">#{nickName},</if>
         </trim>
    </insert>
@@ -91,17 +134,25 @@
            <if test="uploadTime != null">upload_time = #{uploadTime},</if>
            <if test="guid != null">guid = #{guid},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="deptCode != null">dept_code = #{deptCode},</if>
            <if test="deptName != null">dept_name = #{deptName},</if>
            <if test="wardCode != null">ward_code = #{wardCode},</if>
            <if test="wardName != null">ward_name = #{wardName},</if>
            <if test="userName != null">user_name = #{userName},</if>
            <if test="nickName != null">nick_name = #{nickName},</if>
        </trim>
        where templetid = #{templetid}
    </update>
    <delete id="deleteSmsTempletByTempletid" parameterType="Long">
        delete from sms_templet where templetid = #{templetid}
        update sms_templet
        set del_flag = '1'
        where templetid = #{templetid}
    </delete>
    <delete id="deleteSmsTempletByTempletids" parameterType="String">
        delete from sms_templet where templetid in
        <foreach item="templetid" collection="array" open="(" separator="," close=")">
        update sms_templet set del_flag = '1' where templetid in
        <foreach item="templetid" collection="templetids" open="(" separator="," close=")">
            #{templetid}
        </foreach>
    </delete>
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java
@@ -2,7 +2,6 @@
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;
@@ -45,6 +44,14 @@
    @ApiModelProperty(value = "结束时间")
    private Date endTime;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "出院开始时间")
    private Date hospitalStartTime;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "出院结束时间")
    private Date hospitalEndTime;
    @ApiModelProperty(value = "服务类型")
    private List<Long> serviceType;
smartor/src/main/java/com/smartor/domain/ServiceSubtaskExport.java
@@ -21,11 +21,11 @@
    private static final long serialVersionUID = 1L;
    /**
     * 任务名称
     * 科室名称
     */
    @Excel(name = "任务名称")
    @ApiModelProperty(value = "任务名称")
    private String taskName;
    @Excel(name = "科室名称")
    @ApiModelProperty(value = "科室名称")
    private String deptname;
    /**
     * 发送人
@@ -33,28 +33,6 @@
    @Excel(name = " 姓名 ")
    @ApiModelProperty(value = "发送人")
    private String sendname;
    /**
     * 发送状态
     */
//    @Excel(name = " 任务状态 ")
    @ApiModelProperty(value = "发送状态 1 被领取(在任务中是新建,在服务中是被领取)  2 待发送  3 已发送  4 不执行  5 发送失败 6 已完成 7 超时(人工)")
    private Long sendstate;
    /**
     * 发送状态
     */
    @Excel(name = " 任务状态 ")
    @ApiModelProperty(value = "发送状态 1 被领取(在任务中是新建,在服务中是被领取)  2 待发送  3 已发送  4 不执行  5 发送失败 6 已完成 7 超时(人工)")
    private String stName;
    /**
     * 完成时间
     */
    @Excel(name = " 完成时间 ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "完成时间")
    private Date finishtime;
    /**
     * 出院时间
@@ -71,6 +49,19 @@
    @ApiModelProperty(value = "应随访日期")
    private Date visitTime;
    /**
     * 完成时间
     */
    @Excel(name = " 完成时间 ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "完成时间")
    private Date finishtime;
    /**
     * 随访人员
     */
    @Excel(name = "随访人员")
    private String updateBy;
    /**
     * 医生姓名
@@ -79,15 +70,32 @@
    @ApiModelProperty(value = "医生姓名")
    private String drname;
    /**
     * 随访人员
     */
    @Excel(name = "随访人员")
    private String updateBy;
    @Excel(name = "出院天数", suffix = "天")
    @ApiModelProperty(value = "出院天数")
    private Integer endDay;
    /**
     * 出院诊断
     */
    @Excel(name = " 出院诊断 ")
    @ApiModelProperty(value = "出院诊断")
    private String leavediagname;
    /**
     * 发送状态
     */
//    @Excel(name = " 任务状态 ")
    @ApiModelProperty(value = "发送状态 1 被领取(在任务中是新建,在服务中是被领取)  2 待发送  3 已发送  4 不执行  5 发送失败 6 已完成 7 超时(人工)")
    private Long sendstate;
    /**
     * 发送状态
     */
    @Excel(name = " 任务状态 ")
    @ApiModelProperty(value = "发送状态 1 被领取(在任务中是新建,在服务中是被领取)  2 待发送  3 已发送  4 不执行  5 发送失败 6 已完成 7 超时(人工)")
    private String stName;
    /**
     * 身份证号
@@ -113,14 +121,6 @@
    /**
     * 科室名称
     */
    @Excel(name = "科室名称")
    @ApiModelProperty(value = "科室名称")
    private String deptname;
    /**
     * 出院病区名称
     */
    @ApiModelProperty(value = "出院病区名称")
@@ -143,10 +143,18 @@
    @Excel(name = "任务执行方式")
    private String preachform;
    /**
     * 任务名称
     */
    @Excel(name = "任务名称")
    @ApiModelProperty(value = "任务名称")
    private String taskName;
    /**
     * 备注
     */
    @Excel(name = "备注")
    @ApiModelProperty(value = "备注")
    private String remark;
smartor/src/main/java/com/smartor/domain/entity/ServiceSubtaskEntity.java
@@ -31,6 +31,12 @@
    @ApiModelProperty(value = "主键id")
    private Long subId;
    /**
     * 主键id集合
     */
    @ApiModelProperty(value = "主键id集合")
    private List<Long> subIdList;
    /**
     * 第三方任务ID
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -186,4 +186,6 @@
    public void setFailSubTaskDefalutVal(Long failDay);
    public Map<String, Object> getHeLibraryCount(@RequestBody HeLibraryCountVO heLibraryCountVO);
    Map<String, Object> smsSubTask(Long subid);
}
smartor/src/main/java/com/smartor/service/impl/ServiceSLTDHealthcareRecordServiceImpl.java
@@ -74,6 +74,10 @@
    @Value("${lwl_app_key}")
    private String APP_KEY;
    @Value("${spring.profiles.active}")
    private String active;
    @Override
    public List<ServiceSLTDInhospResDTO> queryHealthcareRecordList(ServiceSLTDInhospReqVO reqVO) {
        try {
@@ -783,6 +787,16 @@
        patMedInhosp.setCampusid(dto.getCampusId());
        if (StringUtils.isNotEmpty(dto.getHealthcareRecordStatus()) && dto.getHealthcareRecordStatus().equals("FH0109.25"))
            patMedInhosp.setRemark("预出院");
        if (active.equals("nhfy") && dto.getAreaId() != null && dto.getAreaId().toString().equals("40003483") && StringUtils.isNotEmpty(patMedInhosp.getPatname())) {
            //南华附一的产科,要求不生成“之子、之女、之婴”的随访任务
            if (patMedInhosp.getPatname().contains("之子") || patMedInhosp.getPatname().contains("之女") || patMedInhosp.getPatname().contains("之婴")) {
                patMedInhosp.setDeptcheckFlag("3");
                patMedInhosp.setWardcheckFlag("3");
                patMedInhosp.setDiagcheckFlag("3");
                patMedInhosp.setRemark(patMedInhosp.getRemark() + ";不生成之子、之女、之婴问卷");
            }
        }
        return patMedInhosp;
    }
@@ -815,8 +829,7 @@
     */
    private PatArchive processPatientArchive(ServiceSLTDInhospResDTO dto) {
        // 构建锁的 key:基于 patientno 或 idcardno
        String lockKey = "pat_archive_lock:" +
            (StringUtils.isNotEmpty(dto.getMedicalRecordNo()) ? dto.getMedicalRecordNo() : dto.getIdCardNo());
        String lockKey = "pat_archive_lock:" + (StringUtils.isNotEmpty(dto.getMedicalRecordNo()) ? dto.getMedicalRecordNo() : dto.getIdCardNo());
        
        // 尝试获取分布式锁,最多等待 3 秒,锁定 10 秒自动释放
        Boolean lockAcquired = redisTemplate.opsForValue().setIfAbsent(lockKey, "1", 10, TimeUnit.SECONDS);
@@ -865,8 +878,7 @@
        }
        PatArchive patArchive = buildPatientArchive(dto);
        log.info("【processPatientArchive】患者档案查重完成,patientno={}, 是否已存在={}",
            patArchive.getPatientno(), CollectionUtils.isEmpty(existingArchives) ? "否" : "是(id=" + existingArchives.get(0).getId() + ")");
        log.info("【processPatientArchive】患者档案查重完成,patientno={}, 是否已存在={}", patArchive.getPatientno(), CollectionUtils.isEmpty(existingArchives) ? "否" : "是(id=" + existingArchives.get(0).getId() + ")");
        
        if (CollectionUtils.isEmpty(existingArchives)) {
            try {
@@ -880,13 +892,11 @@
                }
                
                List<PatArchive> finalCheck = patArchiveService.selectPatArchiveList(finalQuery);
                log.info("【processPatientArchive】最终确认查询,patientno={}, idcardno={}, 结果数量={}",
                    dto.getMedicalRecordNo(), dto.getIdCardNo(), finalCheck.size());
                log.info("【processPatientArchive】最终确认查询,patientno={}, idcardno={}, 结果数量={}", dto.getMedicalRecordNo(), dto.getIdCardNo(), finalCheck.size());
                
                if (CollectionUtils.isEmpty(finalCheck)) {
                    patArchiveService.insertPatArchive(patArchive);
                    log.info("【processPatientArchive】✓ 新增患者档案成功,patientno={}, id={}",
                        patArchive.getPatientno(), patArchive.getId());
                    log.info("【processPatientArchive】✓ 新增患者档案成功,patientno={}, id={}", patArchive.getPatientno(), patArchive.getId());
                } else {
                    // 其他线程已经插入,直接使用已有记录
                    existingArchives = finalCheck;
@@ -896,8 +906,7 @@
                    log.info("【processPatientArchive】档案已被其他线程创建,使用已有记录,id={}", patArchive.getId());
                }
            } catch (org.springframework.dao.DuplicateKeyException e) {
                log.warn("【processPatientArchive】患者档案已存在(并发插入异常),跳过:patientno={}, idcardno={}",
                    patArchive.getPatientno(), patArchive.getIdcardno());
                log.warn("【processPatientArchive】患者档案已存在(并发插入异常),跳过:patientno={}, idcardno={}", patArchive.getPatientno(), patArchive.getIdcardno());
                // 并发插入场景,重新查询获取已存在的记录
                PatArchive queryRetry = new PatArchive();
                queryRetry.setPatientno(patArchive.getPatientno());
@@ -917,8 +926,7 @@
            patArchive.setNotrequiredFlag(existingArchives.get(0).getNotrequiredFlag());
            patArchive.setNotrequiredreason(existingArchives.get(0).getNotrequiredreason());
            patArchiveService.updateArchive(patArchive);
            log.info("【processPatientArchive】✓ 更新患者档案,patientno={}, id={}",
                patArchive.getPatientno(), patArchive.getId());
            log.info("【processPatientArchive】✓ 更新患者档案,patientno={}, id={}", patArchive.getPatientno(), patArchive.getId());
        }
        return patArchive;
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -12,7 +12,10 @@
import com.ruoyi.common.utils.*;
import com.ruoyi.common.core.service.IConfigService;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.mapper.SysConfigMapper;
import com.smartor.common.FtpService;
import com.smartor.common.MtSubmitSmUtil;
import com.smartor.config.PhoneUtils;
import com.smartor.domain.DTO.ServiceSubtaskDetailDTO;
import com.smartor.domain.*;
@@ -135,6 +138,12 @@
    @Value("${ASRCallBackPath}")
    private String ASRCallBackPath;
    @Autowired
    private MtSubmitSmUtil mtSubmitSmUtil;
    @Autowired
    private SysConfigMapper sysConfigMapper;
    @Autowired
    private RedisTemplate redisTemplate;
@@ -353,8 +362,7 @@
        }else {
            if(CollectionUtils.isNotEmpty(list)){
                //获取该患者所有的执行状态
                List<ServiceSubtaskPreachform> serviceSubtaskPreachformList = serviceSubtaskPreachformLists.stream()
                        .filter((item -> item.getSubid().equals(list.get(0).getId()) && item.getTaskid().equals(serviceTask.getTaskid()))).collect(Collectors.toList());
                List<ServiceSubtaskPreachform> serviceSubtaskPreachformList = serviceSubtaskPreachformLists.stream().filter((item -> item.getSubid().equals(list.get(0).getId()) && item.getTaskid().equals(serviceTask.getTaskid()))).collect(Collectors.toList());
                List<Map<String, Object>> resultList = serviceSubtaskPreachformList.stream().map(item -> {
                    Map<String, Object> map = new HashMap<>();
                    map.put("sort", item.getSort());
@@ -390,7 +398,8 @@
                serviceSubtaskRes.setContinueContent(serviceSubtask.getContinueContent());
            }
//            1:待随访(2 待发送);2:随访中(3 已发送、1 被领取)、3:未完成(5 发送失败、7、超时)、4:已完成( 6 已完成)、5:无需随访(4 不执行)
            if (serviceSubtaskRes.getSendstate() == 1 || serviceSubtaskRes.getSendstate() == 2L || serviceSubtaskRes.getSendstate() == 3L || serviceSubtaskRes.getSendstate() == 5 || serviceSubtaskRes.getSendstate() == 7L) serviceSubtaskRes.setSendstateView(1L);
            if (serviceSubtaskRes.getSendstate() == 1 || serviceSubtaskRes.getSendstate() == 2L || serviceSubtaskRes.getSendstate() == 3L || serviceSubtaskRes.getSendstate() == 5 || serviceSubtaskRes.getSendstate() == 7L)
                serviceSubtaskRes.setSendstateView(1L);
            if (serviceSubtaskRes.getSendstate() == 6) serviceSubtaskRes.setSendstateView(2L);
            if (serviceSubtaskRes.getSendstate() == 4) serviceSubtaskRes.setSendstateView(3L);
            serviceSubtaskResList.add(serviceSubtaskRes);
@@ -694,8 +703,8 @@
                    //南华附一的icd10code是有重复的,所以不能用南华附一的icd10code去查询
                    log.info("----serviceTaskdiag的值为:{}", serviceTaskdiag);
                    if (!StringUtils.isEmpty(serviceTaskVO.getIcd10name())) {
                        String[] Icd10Names = serviceTaskVO.getIcd10name().split(",");
                        String[] Icd10codes = serviceTaskVO.getIcd10code().split(",");
                        String[] Icd10Names = serviceTaskVO.getIcd10name().split("$");
                        String[] Icd10codes = serviceTaskVO.getIcd10code().split("$");
                        for (int i = 0; i < Icd10Names.length; i++) {
                            serviceTaskdiag.setIcd10code(Icd10codes[i]);
                            serviceTaskdiag.setIcd10name(Icd10Names[i]);
@@ -797,7 +806,8 @@
                    serviceSubtask.setUpdateBy(serviceTask.getCreateBy());
                    serviceSubtask.setVisitTime(DateUtils.parseDate(serviceTaskVO.getShowTimeMorn()));
                    //如果立即执行,时间就是当前时间
                    if(serviceTaskVO.getSendType()!=null&&serviceTaskVO.getSendType()==2) serviceSubtask.setVisitTime(new Date());
                    if (serviceTaskVO.getSendType() != null && serviceTaskVO.getSendType() == 2)
                        serviceSubtask.setVisitTime(new Date());
                    if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1) {
                        serviceSubtask.setLongSendTime(patTaskRelevance.getLongSendTime());
                        serviceSubtask.setVisitTime(patTaskRelevance.getVisittime());
@@ -3039,6 +3049,7 @@
        }
        return serviceSubtaskStatistic;
    }
    /**
     * 首次随访统计
     *
@@ -4481,6 +4492,60 @@
        return resultMap;
    }
    @Override
    public Map<String, Object> smsSubTask(Long subid) {
        log.info("smsSubTask的入参为:{}", subid);
        Map<String, Object> resultMap = new HashMap<>();
        resultMap.put("code", "500");
        resultMap.put("msg", "发送失败");
        //获取患者的基本信息
        ServiceSubtask serviceSubtask = selectServiceSubtaskById(subid);
        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
        String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
        String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
        String taskId = rsaPublicKeyExample.encryptedData(serviceSubtask.getTaskid().toString(), pub_key);
        //发送数据的封装
        ServiceOutPath serviceOutPath = new ServiceOutPath();
        serviceOutPath.setParam1(taskId);
        serviceOutPath.setParam2(patid);
        serviceOutPath.setParam3(serviceSubtask.getTaskName());
        serviceOutPath.setParam6(subId);
        serviceOutPath.setCreateTime(new Date());
        serviceOutPath.setOrgid(serviceSubtask.getOrgid());
        iServiceOutPathService.insertServiceOutPath(serviceOutPath);
        String format = String.format("%03X", serviceOutPath.getId());
        serviceOutPath.setRadix(format);
        serviceOutPath.setUpdateTime(new Date());
        iServiceOutPathService.updateServiceOutPath(serviceOutPath);
        SendMagParam sendMagParam = new SendMagParam();
        sendMagParam.setType("4");
        sendMagParam.setPhone(serviceSubtask.getPhone());
        sendMagParam.setUrl(StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/wt?p=" + format : localIP + "/wt?p=" + format);
        SysConfig sysConfig = new SysConfig();
        sysConfig = sysConfigMapper.checkConfigKeyUnique("wj.sms.template");
        if (!Objects.isNull(sysConfig)) {
            String smsContemt = sysConfig.getConfigValue();
            sendMagParam.setContent(smsContemt.replace("${wjurl}", sendMagParam.getUrl()));
        }
        if (active.equals("nhfy")) {
            Map<String, Object> smsResult = mtSubmitSmUtil.submitSm(sendMagParam.getPhone(), sendMagParam.getContent());
            if (smsResult != null && smsResult.get("result") != null && smsResult.get("result").toString().equals("0")) {
                resultMap.put("code", "200");
                resultMap.put("msg", "发送成功");
                serviceSubtask.setRemark(StringUtils.isNotEmpty(serviceSubtask.getRemark()) ? serviceSubtask.getRemark() + ";短信发送成功" : "短信发送成功");
                log.info("是否发送成功:{}", serviceSubtask.getRemark());
                updateServiceSubtask(serviceSubtask);
            }
        }
        return resultMap;
    }
    private Boolean saveServiceSubtaskDetail(ServiceSubtask serviceSubtask) {
        Boolean result = true;
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -355,6 +355,12 @@
                #{state}
            </foreach>
        </if>
        <if test="subIdList != null  and sendstates.size() > 0">
            AND id IN
            <foreach collection="subIdList" item="subId" open="(" separator="," close=")">
                #{subId}
            </foreach>
        </if>
        <!-- taskIds筛选 -->
        <if test="taskIds != null and taskIds.size() > 0">
            AND taskid IN
@@ -1530,6 +1536,10 @@
            AND visit_time >= DATE(#{startTime})
            AND visit_time &lt; DATE_ADD(DATE(#{endTime}), INTERVAL 1 DAY)
        </if>
        <if test="hospitalStartTime != null and hospitalEndTime!=null">
            AND endtime >= DATE(#{hospitalStartTime})
            AND endtime &lt; DATE_ADD(DATE(#{hospitalEndTime}), INTERVAL 1 DAY)
        </if>
        <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
        <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
        <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
@@ -1709,6 +1719,10 @@
            AND visit_time >= DATE(#{startTime})
            AND visit_time &lt; DATE_ADD(DATE(#{endTime}), INTERVAL 1 DAY)
        </if>
        <if test="hospitalStartTime != null and hospitalEndTime!=null">
            AND endtime >= DATE(#{hospitalStartTime})
            AND endtime &lt; DATE_ADD(DATE(#{hospitalEndTime}), INTERVAL 1 DAY)
        </if>
        <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
        <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
        <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>