ae3d8d1b4e5d77323197aa298e3c767dc4859f0e..fce30cf9f7692d49c3d408475dfb72d289b1cd4f
2025-04-25 liusheng
代码提交
fce30c 对比 | 目录
2025-04-25 liusheng
代码提交
c987cc 对比 | 目录
2025-04-25 liusheng
Merge remote-tracking branch 'origin/master'
5fe107 对比 | 目录
2025-04-25 liusheng
代码提交
07b526 对比 | 目录
2025-04-24 zhs
04-22 zhs 预出院
b0b1e8 对比 | 目录
已修改11个文件
333 ■■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceExternalService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java 184 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceTaskdeptMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceExternalController.java
@@ -230,6 +230,23 @@
    }
    /**
     * 新增出院登记信息
     */
    @ApiOperation("新增预出院登记信息")
    @PostMapping("/addPreOutHospInfo")
    public Map<String, Object> addPreOutHospInfo(@RequestBody Map dataMap) {
        Boolean aBoolean = true;
        try {
            aBoolean = serviceExternalService.addPreOutHospInfo(dataMap);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("serviceExternal---addPreOutHospInfo:{}", e.getMessage());
            aBoolean = false;
        }
        return returnParam(aBoolean, dataMap);
    }
    /**
     * 新增完成接诊信息
     */
    @ApiOperation("新增完成接诊信息")
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -171,6 +171,14 @@
        return toAjax(serviceSubtaskService.insertServiceSubtask(serviceSubtask));
    }
    @ApiOperation("患者再次随访")
    @PostMapping("/addSubTaskAgain")
    public AjaxResult addSubTaskAgain(@RequestBody ServiceSubtask serviceSubtask) {
        SysUser user = getLoginUser().getUser();
        if (ObjectUtils.isNotEmpty(user)) serviceSubtask.setOrgid(user.getOrgid());
        return success(serviceSubtaskService.addSubTaskAgain(serviceSubtask));
    }
    /**
     * 根据条件查询任务信息
     */
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -566,5 +566,17 @@
    @ApiModelProperty(value = "患者来源:0本地患者表    1外部患者表")
    private String patfrom;
    /**
     * 随访次数
     */
    @ApiModelProperty(value = "随访次数")
    private Integer visitCount;
    /**
     * 是否在次随访:1否    2是
     */
    @ApiModelProperty(value = "是否在次随访:1是    2否")
    private Integer isVisitAgain;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java
@@ -22,6 +22,9 @@
    @ApiModelProperty(value = "用户ID")
    private Long userId;
    private Integer visitCount;
    private Integer isVisitAgain;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "开始时间")
    private Date startTime;
smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java
@@ -36,6 +36,18 @@
    private String taskGuid;
    /**
     * 随访次数
     */
    @ApiModelProperty(value = "随访次数")
    private Integer visitCount;
    /**
     * 是否在次随访:1否    2是
     */
    @ApiModelProperty(value = "是否在次随访:1是    2否")
    private Integer isVisitAgain;
    /**
     * 患者ID
     */
    @Excel(name = "  患者ID")
smartor/src/main/java/com/smartor/service/IServiceExternalService.java
@@ -78,6 +78,11 @@
    public Boolean cancelOutHospInfo(@RequestBody Map dataMap);
    /**
     * 新增预出院登记信息
     */
    public Boolean addPreOutHospInfo(@RequestBody Map dataMap);
    /**
     * 新增完成接诊信息
     */
    public Boolean addFinshJZInfo(@RequestBody Map dataMap);
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -56,6 +56,14 @@
    public int insertServiceSubtask(ServiceSubtask ServiceSubtask);
    /**
     * 再次新增单一任务(随访)
     *
     * @param ServiceSubtask 再次新增单一任务(随访)
     * @return 结果
     */
    public String addSubTaskAgain(ServiceSubtask ServiceSubtask);
    /**
     * 修改单一任务(随访)
     *
     * @param ServiceSubtask 单一任务(随访)
smartor/src/main/java/com/smartor/service/impl/ServiceExternalServiceImpl.java
@@ -3,6 +3,7 @@
import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.StringUtils;
import com.smartor.domain.*;
@@ -58,6 +59,10 @@
    private Icd10Mapper icd10Mapper;
    @Autowired
    private PatMedOuthospMapper patMedOuthospMapper;
    @Autowired
    private ServiceSubtaskMapper serviceSubtaskMapper;
    @Autowired
    private RedisCache redisCache;
    @Value("${defaultPwd}")
    private String defaultPwd;
@@ -446,9 +451,8 @@
            }).collect(Collectors.toList());
            patMedInhosp1.setLeaveicd10code(hospPatientDiagnoseInfos2.get(0).getIcd10());
            patMedInhosp1.setLeavediagname(hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
            patMedInhosp1.setDiagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
            //patMedInhosp1.setLeavediagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
            //patMedInhosp1.setDiagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
            //patMedInhosp1.setDiagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
            patMedInhosp1.setDiagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
        }
        patMedInhosp1.setInhospstate("1");
@@ -496,12 +500,183 @@
            Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null;
            PatMedInhosp patMedInhosp1 = patMedInhospList.get(0);
            patMedInhosp1.setSchemestatus(4L);
            //需要将出院状态改成在院
            patMedInhosp1.setInhospstate("0");
            if (ObjectUtils.isNotEmpty(JiuZhenXX)) {
                patMedInhosp1.setOperator(ObjectUtils.isNotEmpty(JiuZhenXX.get("CaoZuoRXM")) ? JiuZhenXX.get("CaoZuoRXM").toString() : null);
                patMedInhosp1.setOperatorId(ObjectUtils.isNotEmpty(JiuZhenXX.get("CaoZuoRXM")) ? JiuZhenXX.get("CaoZuoRID").toString() : null);
            }
            patMedInhosp1.setUpdateTime(new Date());
            int i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
            //取消出院,就不需要服务了,需要通过patid和sendstate=2或者sendstate=1去查询一下,service_subtask里是否有正在执行的任务,有的话,立即停了
            ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
            serviceSubtaskVO.setPatid(patMedInhosp1.getPatid());
            serviceSubtaskVO.setSendstate(2L);
            List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
            serviceSubtaskVO.setSendstate(1L);
            List<ServiceSubtask> serviceSubtaskList1 = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
            if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
                if (CollectionUtils.isNotEmpty(serviceSubtaskList1)) serviceSubtaskList.addAll(serviceSubtaskList1);
            } else {
                if (CollectionUtils.isNotEmpty(serviceSubtaskList1)) serviceSubtaskList = serviceSubtaskList1;
            }
            //去redis中,查询是否有subid,有的话移除cache-exist
            if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
                for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
                    log.error("需要移除的subId为:{}", serviceSubtask.getId().toString());
                    serviceSubtaskMapper.deleteServiceSubtaskById(serviceSubtask.getId());
                    redisCache.removeElementFromList("cache-exist", serviceSubtask.getId().toString());
                    redisCache.removeElementFromList("cache-0", serviceSubtask.getId().toString());
                    redisCache.removeElementFromList("cache-1", serviceSubtask.getId().toString());
                    redisCache.removeElementFromList("cache-2", serviceSubtask.getId().toString());
                    redisCache.removeElementFromList("cache-3", serviceSubtask.getId().toString());
                    redisCache.removeElementFromList("cache-4", serviceSubtask.getId().toString());
                }
            }
            if (i != 1) return false;
        }
        return true;
    }
    @Override
    public Boolean addPreOutHospInfo(Map dataMap) {
        log.error("ServiceExternalServiceImpl---addPreOutHospInfo的新增的值为:{}", dataMap);
        Map yeWuXX = (Map) dataMap.get("YeWuXX");
        Map<String, Object> BingRenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("BingRenXX") : null;
        Map<String, Object> ChuYuanJL = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("ChuYuanJL") : null;
        List<HashMap<String, Object>> epai = ObjectUtils.isNotEmpty(BingRenXX) ? (List<HashMap<String, Object>>) BingRenXX.get("DiZhiXXList") : null;
        List<HashMap<String, Object>> epli = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("LianXiRList") : null;
        Map<String, Object> SuiFangJH = ObjectUtils.isNotEmpty(ChuYuanJL) ? (Map<String, Object>) ChuYuanJL.get("SuiFangJH") : null;
        ExternalInHospPatientInfo externalInHospPatientInfo = BeanUtil.mapToBean(BingRenXX, ExternalInHospPatientInfo.class, true);
        ExternalInHospPatientAddrInfo externalInHospPatientAddrInfo = null;
        ExternalInHospPatientLiaisonInfo externalInHospPatientLiaisonInfo = null;
        List<ExternalInHospPatientAddrInfo> epai2 = null;
        if (CollectionUtils.isNotEmpty(epai)) {
            epai2 = epai.stream().map(map -> {
                ExternalInHospPatientAddrInfo info = new ExternalInHospPatientAddrInfo();
                info.setDiZhiLX((String) map.get("DiZhiLX")); // 假设字段类型是 Integer
                info.setDiZhiXX((String) map.get("DiZhiXX"));
                info.setShengFenDM((String) map.get("ShengFenDM"));
                info.setShengFenMC((String) map.get("ShengFenMC"));
                info.setShiDiQDM((String) map.get("ShiDiQDM"));
                info.setShiDiQMC((String) map.get("ShiDiQMC"));
                info.setXianQuDM((String) map.get("XianQuDM"));
                info.setXianQuMC((String) map.get("XianQuMC"));
                info.setXiangZhenDM((String) map.get("XiangZhenDM"));
                info.setXiangZhenMC((String) map.get("XiangZhenMC"));
                info.setCunJiDM((String) map.get("CunJiDM"));
                info.setQiTaXX((String) map.get("QiTaXX"));
                info.setYouBian((String) map.get("YouBian"));
                return info;
            }).collect(Collectors.toList());
        }
        List<ExternalInHospPatientLiaisonInfo> epli2 = null;
        if (CollectionUtils.isNotEmpty(epli)) {
            epli2 = epli.stream().map(map -> {
                ExternalInHospPatientLiaisonInfo info = new ExternalInHospPatientLiaisonInfo();
                info.setLianXiRXM((String) map.get("LianXiRXM"));
                info.setLianXiRDH((String) map.get("LianXiRDH"));
                info.setGuanXiDM((String) map.get("GuanXiDM"));
                info.setGuanXiMC((String) map.get("GuanXiMC"));
                return info;
            }).collect(Collectors.toList());
        }
        if (CollectionUtils.isNotEmpty(epai)) externalInHospPatientAddrInfo = epai2.get(0);
        if (CollectionUtils.isNotEmpty(epli)) externalInHospPatientLiaisonInfo = epli2.get(0);
        //新增患者基本信息新增或修改
        PatArchive patArchive = addPatArchive(externalInHospPatientInfo, externalInHospPatientAddrInfo, externalInHospPatientLiaisonInfo);
        PatMedInhosp patMedInhosp = new PatMedInhosp();
        patMedInhosp.setInhospno(externalInHospPatientInfo.getBingAnHao());
        patMedInhosp.setSerialnum(externalInHospPatientInfo.getJiuZhenYWID());
        List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
        for (PatMedInhosp patMedInhosp1 : patMedInhospList) {
            String tagname = patMedInhospMapper.getTagnameBypatid(patMedInhosp1.getPatid());
            patMedInhosp1.setTagname(tagname);
        }
        Map<String, Object> JiuZhenXX = ObjectUtils.isNotEmpty(yeWuXX) ? (Map<String, Object>) yeWuXX.get("JiuZhenXX") : null;
        PatMedInhosp patMedInhosp1 = new PatMedInhosp();
        if (CollectionUtils.isNotEmpty(patMedInhospList)) patMedInhosp1 = patMedInhospList.get(0);
        patMedInhosp1.setSchemestatus(2L);
        try {
            patMedInhosp1.setEndtime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(JiuZhenXX.get("YuChuYSJ").toString()));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        if (ObjectUtils.isNotEmpty(JiuZhenXX)) {
            patMedInhosp1.setOperator(ObjectUtils.isNotEmpty(JiuZhenXX.get("CaoZuoRXM")) ? JiuZhenXX.get("CaoZuoRXM").toString() : null);
            patMedInhosp1.setOperatorId(ObjectUtils.isNotEmpty(JiuZhenXX.get("CaoZuoRID")) ? JiuZhenXX.get("CaoZuoRID").toString() : null);
            patMedInhosp1.setDrname(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZhuZhiYSXM")) ? JiuZhenXX.get("ZhuZhiYSXM").toString() : null);
            patMedInhosp1.setDrcode(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZhuZhiYSID")) ? JiuZhenXX.get("ZhuZhiYSID").toString() : null);
            patMedInhosp1.setNurseName(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSXM")) ? JiuZhenXX.get("ZeRenHSXM").toString() : null);
            patMedInhosp1.setNurseId(ObjectUtils.isNotEmpty(JiuZhenXX.get("ZeRenHSID")) ? JiuZhenXX.get("ZeRenHSID").toString() : null);
            patMedInhosp1.setBedNo(ObjectUtils.isNotEmpty(JiuZhenXX.get("DangQianCWMC")) ? JiuZhenXX.get("DangQianCWMC").toString() : null);
        }
        patMedInhosp1.setUpdateTime(new Date());
        patMedInhosp1.setTelcode(patArchive.getTelcode());
        patMedInhosp1.setLeavehospitaldistrictcode(externalInHospPatientInfo.getDangQianBQID());
        patMedInhosp1.setLeavehospitaldistrictname(externalInHospPatientInfo.getDangQianBQMC());
        patMedInhosp1.setLeaveldeptname(externalInHospPatientInfo.getDangQianKSMC());
        patMedInhosp1.setDeptname(externalInHospPatientInfo.getDangQianKSMC());
        patMedInhosp1.setLeaveldeptcode(externalInHospPatientInfo.getDangQianKSID());
        patMedInhosp1.setDeptcode(externalInHospPatientInfo.getDangQianKSID());
        if (ObjectUtils.isNotEmpty(SuiFangJH)) {
            patMedInhosp1.setFuflag(ObjectUtils.isNotEmpty(SuiFangJH.get("SuiFangBS")) ? SuiFangJH.get("SuiFangBS").toString() : null);
            if (ObjectUtils.isNotEmpty(SuiFangJH.get("SuiFangRQ"))) {
                try {
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    patMedInhosp1.setFudate(simpleDateFormat.parse(SuiFangJH.get("SuiFangRQ").toString()));
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            }
            patMedInhosp1.setFuperiod(ObjectUtils.isNotEmpty(SuiFangJH.get("SuiFangZQJY")) ? SuiFangJH.get("SuiFangZQJY").toString() : null);
            patMedInhosp1.setFutypecode(ObjectUtils.isNotEmpty(SuiFangJH.get("SuiFangFSDM")) ? SuiFangJH.get("SuiFangFSDM").toString() : null);
            patMedInhosp1.setFutypedesc(ObjectUtils.isNotEmpty(SuiFangJH.get("SuiFangFSMC")) ? SuiFangJH.get("SuiFangFSMC").toString() : null);
            patMedInhosp1.setFuadvice(ObjectUtils.isNotEmpty(SuiFangJH.get("FuZhenZD")) ? SuiFangJH.get("FuZhenZD").toString() : null);
            patMedInhosp1.setFuspecialadvice(ObjectUtils.isNotEmpty(SuiFangJH.get("QiTaZKJBSF")) ? SuiFangJH.get("QiTaZKJBSF").toString() : null);
        }
        List<HashMap<String, Object>> zhenDuanList = ObjectUtils.isNotEmpty(yeWuXX) ? (List<HashMap<String, Object>>) yeWuXX.get("ZhenDuanList") : null;
        if (CollectionUtils.isNotEmpty(zhenDuanList)) {
            List<ExternalInHospPatientDiagnoseInfo> hospPatientDiagnoseInfos2 = zhenDuanList.stream().map(map -> {
                ExternalInHospPatientDiagnoseInfo info = new ExternalInHospPatientDiagnoseInfo();
                info.setZhenDuanID((String) map.get("ZhenDuanID"));
                info.setZhenDuanMC((String) map.get("ZhenDuanMC"));
                info.setIcd10((String) map.get("Icd10"));
                return info;
            }).collect(Collectors.toList());
            patMedInhosp1.setLeaveicd10code(hospPatientDiagnoseInfos2.get(0).getIcd10());
            patMedInhosp1.setLeavediagname(hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
            //patMedInhosp1.setDiagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() + "," + hospPatientDiagnoseInfos2.get(0).getZhenDuanMC() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
            patMedInhosp1.setDiagname(StringUtils.isNotEmpty(patMedInhosp1.getLeavediagname()) ? patMedInhosp1.getLeavediagname() : hospPatientDiagnoseInfos2.get(0).getZhenDuanMC());
        }
        patMedInhosp1.setInhospstate("3");
        if (CollectionUtils.isNotEmpty(patMedInhospList)) {
            patMedInhosp1.setUpdateTime(new Date());
            patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX) && ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null);
            int i = patMedInhospMapper.updatePatMedInhosp(patMedInhosp1);
            if (i != 1) return false;
        } else {
            if (ObjectUtils.isNotEmpty(BingRenXX)) {
                patMedInhosp1.setHospitalname(ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGMC")) ? BingRenXX.get("ZuZhiJGMC").toString() : null);
                patMedInhosp1.setHospitalcode(ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null);
                patMedInhosp1.setLeavehospitaldistrictname(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianBQMC")) ? BingRenXX.get("DangQianBQMC").toString() : null);
                patMedInhosp1.setLeavehospitaldistrictcode(ObjectUtils.isNotEmpty(BingRenXX.get("DangQianBQID")) ? BingRenXX.get("DangQianBQID").toString() : null);
                patMedInhosp1.setOrgid(ObjectUtils.isNotEmpty(BingRenXX.get("ZuZhiJGID")) ? BingRenXX.get("ZuZhiJGID").toString() : null);
                patMedInhosp1.setPatno(ObjectUtils.isNotEmpty(BingRenXX.get("BingRenID")) ? BingRenXX.get("BingRenID").toString() : null);
                patMedInhosp1.setInhospno(ObjectUtils.isNotEmpty(BingRenXX.get("BingAnHao")) ? BingRenXX.get("BingAnHao").toString() : null);
                patMedInhosp1.setSerialnum(ObjectUtils.isNotEmpty(BingRenXX.get("JiuZhenYWID")) ? BingRenXX.get("JiuZhenYWID").toString() : null);
            }
            patMedInhosp1.setPatid(patArchive.getId());
            patMedInhosp1.setPatname(patArchive.getName());
            patMedInhosp1.setCreateTime(new Date());
            int i = patMedInhospMapper.insertPatMedInhosp(patMedInhosp1);
            if (i != 1) return false;
        }
        return true;
@@ -1095,6 +1270,9 @@
            case "JZ_ZY_QuXiaoCY":
                log.error("取消出院入参类型为:{}", type);
                return cancelOutHospInfo(dataMap);
            case "JZ_ZY_YuChuYuan":
                log.error("患者预出院入参类型为:{}", type);
                return addPreOutHospInfo(dataMap);
            case "JG_ZZ_BingQu":
                log.error("病区信息入参类型为:{}", type);
                return addWardAreaInfo(dataMap);
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -92,6 +92,12 @@
    @Autowired
    private FtpService ftpService;
    @Autowired
    private PatMedInhospMapper patMedInhospMapper;
    @Autowired
    private PatArchiveMapper patArchiveMapper;
    @Value("${pri_key}")
    private String pri_key;
@@ -256,7 +262,6 @@
    @Override
    public List<ServiceSubtask> patItem(ServiceSubtaskVO serviceSubtaskVO) {
        List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskVO);
        return selectServiceSubtaskList;
    }
@@ -312,6 +317,49 @@
    public int insertServiceSubtask(ServiceSubtask serviceSubtask) {
        serviceSubtask.setCreateTime(DateUtils.getNowDate());
        return serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
    }
    /**
     * 再次新增单一任务(随访)
     *
     * @param serviceSubtask 再次新增单一任务(随访)
     * @return 结果
     */
    @Override
    public String addSubTaskAgain(ServiceSubtask serviceSubtask) {
        ServiceSubtask serviceSubtask1 = selectServiceSubtaskById(serviceSubtask.getId());
        PatMedInhosp patMedInhosp = new PatMedInhosp();
        patMedInhosp.setPatid(serviceSubtask1.getPatid());
        patMedInhosp.setInhospstate("0");
        List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
        PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(serviceSubtask1.getPatid());
        if (patMedInhospList.size() > 0) {
            serviceSubtask1.setIsVisitAgain(2);
            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
            return "无需再次随访,患者再入院了";
        } else if (serviceSubtask1.getSendstate() == 4L) {
            serviceSubtask1.setIsVisitAgain(2);
            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
            return "无需再次随访,任务被标记不在执行";
        } else if (patArchive.getNotrequiredFlag().equals("1")) {
            serviceSubtask1.setIsVisitAgain(2);
            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
            return "无需再次随访,患者被标记不需要被服务";
        }
        //新增再次随访任务
        ServiceSubtask serviceSubtask2 = DtoConversionUtils.sourceToTarget(serviceSubtask1, ServiceSubtask.class);
        serviceSubtask2.setId(null);
        serviceSubtask2.setVisitCount(serviceSubtask1.getVisitCount() + 1);
        serviceSubtask2.setSendstate(2L);
        int i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask2);
        if (i == 1) {
            //新增成功后,需要将之前的任务设置为不要再随访(防止重复点,然后重复生成)
            serviceSubtask1.setIsVisitAgain(2);
            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
            return "再次随访任务创建成功";
        }
        return "再次随访任务创建失败,再请次重试";
    }
    /**
@@ -375,7 +423,7 @@
            if (serviceTask.getSendState() == null) {
                serviceTask.setSendState(1L);
                serviceTaskVO.setSendState(1L);
            }else {
            } else {
                serviceTask.setSendState(serviceTaskVO.getSendState());
            }
            if (StringUtils.isNotEmpty(serviceTaskVO.getLibtemplateid())) {
@@ -391,7 +439,7 @@
            }
            serviceTask.setLeaveldeptcodes(serviceTaskVO.getLeaveldeptcodes());
            serviceTask.setLeavehospitaldistrictcode(serviceTask.getLeavehospitaldistrictcode());
            serviceTask.setSendState(2L);
            if (serviceTaskVO.getLongTask() == 1) serviceTask.setSendState(2L);
            serviceTask.setCreateTime(new Date());
            serviceTask.setUpdateTime(new Date());
            serviceTaskService.insertServiceTask(serviceTask);
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -76,6 +76,8 @@
        <result property="inhospid" column="inhospid"/>
        <result property="patfrom" column="patfrom"/>
        <result property="patguid" column="patguid"/>
        <result property="visitCount" column="visit_count"/>
        <result property="isVisitAgain" column="is_visit_again"/>
    </resultMap>
    <resultMap type="com.smartor.domain.ServiceSubtaskCount" id="ServiceSubtaskResult2">
@@ -91,6 +93,8 @@
               task_guid,
               patfrom,
               inhospid,
               visit_count,
               is_visit_again,
               patguid,
               suggest,
               sendstate,
@@ -280,10 +284,12 @@
            <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="remark != null">and remark = #{remark}</if>
            <if test="suggest != null">and suggest = #{suggest}</if>
            <if test="createBy != null">and create_by = #{createBy}</if>
            <if test="taskGuid != null">and task_guid = #{taskGuid}</if>
            <if test="isVisitAgain != null">and is_visit_again = #{isVisitAgain}</if>
        </where>
        <if test="sort != null  and sort==0">order by endtime asc</if>
        <if test="sort != null  and sort==1">order by endtime desc</if>
@@ -307,6 +313,8 @@
            <if test="sendname != null ">and sendname = #{sendname}</if>
            <if test="sfzh != null ">and sfzh = #{sfzh}</if>
            <if test="patguid != null ">and patguid = #{patguid}</if>
            <if test="visitCount != null ">and visit_count = #{visitCount}</if>
            <if test="isVisitAgain != null ">and is_visit_again = #{isVisitAgain}</if>
        </where>
    </select>
@@ -401,6 +409,8 @@
            <if test="patfrom != null ">patfrom,</if>
            <if test="taskGuid != null ">task_guid,</if>
            <if test="patguid != null ">patguid,</if>
            <if test="visitCount != null ">visit_count,</if>
            <if test="isVisitAgain != null ">is_visit_again,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sendname != null">#{sendname},</if>
@@ -476,6 +486,8 @@
            <if test="patfrom != null ">#{patfrom},</if>
            <if test="taskGuid != null ">#{taskGuid},</if>
            <if test="patguid != null ">#{patguid},</if>
            <if test="visitCount != null ">#{visitCount},</if>
            <if test="isVisitAgain != null ">#{isVisitAgain},</if>
        </trim>
    </insert>
@@ -556,6 +568,8 @@
            <if test="patfrom != null ">patfrom=#{patfrom},</if>
            <if test="taskGuid != null ">task_guid=#{taskGuid},</if>
            <if test="patguid != null ">patguid=#{patguid},</if>
            <if test="visitCount != null ">visit_count=#{visitCount},</if>
            <if test="isVisitAgain != null ">is_visit_again=#{isVisitAgain},</if>
        </trim>
        where id = #{id}
    </update>
@@ -617,6 +631,7 @@
            <if test="sendstate != null ">sendstate = #{sendstate},</if>
            <if test="serviceType != null ">service_type = #{serviceType},</if>
            <if test="score != null ">score = #{score},</if>
            <if test="visitCount != null ">visit_count = #{visitCount},</if>
            <if test="submit != null ">submit = #{submit},</if>
            <if test="leavehospitaldistrictcode != null  and leavehospitaldistrictcode != ''">leavehospitaldistrictcode
                = #{leavehospitaldistrictcode},
@@ -637,6 +652,7 @@
            <if test="patfrom != null ">patfrom=#{patfrom},</if>
            <if test="taskGuid != null ">taskGuid=#{taskGuid},</if>
            <if test="patguid != null ">patguid=#{patguid},</if>
            <if test="isVisitAgain != null ">is_visit_again=#{isVisitAgain},</if>
        </trim>
        <where>
            <if test="patid != null ">and patid = #{patid}</if>
@@ -677,6 +693,8 @@
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="pid != null">pid = #{pid},</if>
            <if test="guid != null">guid = #{guid},</if>
            <if test="visitCount != null">visit_count = #{visitCount},</if>
            <if test="isVisitAgain != null">is_visit_again = #{isVisitAgain},</if>
            <if test="textParam != null">text_param = #{textParam},</if>
            <if test="preachform != null">preachform = #{preachform},</if>
            <if test="bedNo != null">bed_no = #{bedNo},</if>
@@ -770,6 +788,8 @@
            <if test="wechat != null  and wechat != ''">wechat = #{wechat},</if>
            <if test="roomno != null  and roomno != ''">roomno = #{roomno},</if>
            <if test="admindate != null ">admindate = #{admindate},</if>
            <if test="visitCount != null ">visit_count = #{visitCount},</if>
            <if test="isVisitAgain != null ">is_visit_again = #{isVisitAgain},</if>
            <if test="deptname != null  and deptname != ''">deptname = #{deptname},</if>
            <if test="leaveicd10code != null  and leaveicd10code != ''">leaveicd10code = #{leaveicd10code},</if>
            <if test="leavediagname != null  and leavediagname != ''">leavediagname = #{leavediagname},</if>
@@ -882,6 +902,8 @@
               upload_time,
               orgid,
               pid,
               visit_count,
               is_visit_again,
               guid,
               text_param,
               preachform,
smartor/src/main/resources/mapper/smartor/ServiceTaskdeptMapper.xml
@@ -173,8 +173,8 @@
            </if>
        </trim>
        <where>
        <if test="id != null">and id = #{id},</if>
        <if test="taskId != null">and task_id = #{taskId},</if>
        <if test="id != null">and id = #{id}</if>
        <if test="taskId != null">and task_id = #{taskId}</if>
        </where>
    </update>
@@ -193,8 +193,8 @@
            update_time = sysdate()
        </trim>
        <where>
            <if test="id != null">and id = #{id},</if>
            <if test="taskId != null">and task_id = #{taskId},</if>
            <if test="id != null">and id = #{id}</if>
            <if test="taskId != null">and task_id = #{taskId}</if>
        </where>
    </update>