医院外呼时间配置
This commit is contained in:
parent
8351b5139e
commit
50fd835842
@ -395,5 +395,8 @@ public class Constants {
|
||||
*/
|
||||
public static final String SMS_CODE ="SMS_CODE_";
|
||||
|
||||
|
||||
/**
|
||||
* 医院时间配置
|
||||
*/
|
||||
public static final String DIAL_TIME ="dial_time";
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ package com.xinelu.manage.controller.patientinfoimportmain;
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.manage.domain.dialtime.DialTime;
|
||||
import com.xinelu.manage.service.patientinfoimportmain.IPatientInfoImportMainService;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.patientinfoimportmain.PatientInfoImportMainVO;
|
||||
@ -55,4 +56,21 @@ public class PatientInfoImportMainController extends BaseController {
|
||||
public AjaxResult updatePatientInfoImport(@RequestBody PatientInfoVo patientInfoVo) {
|
||||
return AjaxResult.success(patientInfoImportMainService.updatePatientInfoImport(patientInfoVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医院外呼时间起止详细信息
|
||||
*/
|
||||
@ApiOperation("获取医院外呼时间起止详细信息")
|
||||
@GetMapping(value = "/selectDialTime")
|
||||
public AjaxResult selectDialTimeById() {
|
||||
return patientInfoImportMainService.selectDialTimeById();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增医院外呼时间起止
|
||||
*/
|
||||
@PostMapping("/addDialTime")
|
||||
public AjaxResult add(@RequestBody DialTime dialTime) {
|
||||
return patientInfoImportMainService.insertDialTime(dialTime);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
package com.xinelu.manage.domain.dialtime;
|
||||
|
||||
import com.xinelu.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 医院外呼时间起止对象 dial_time
|
||||
*
|
||||
* @author zh
|
||||
* @date 2025-04-16
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "医院外呼时间起止对象", description = "dial_time")
|
||||
public class DialTime extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 呼叫开始时间
|
||||
*/
|
||||
@ApiModelProperty(value = "呼叫开始时间")
|
||||
private String dialStartTime;
|
||||
|
||||
/**
|
||||
* 呼叫结束时间
|
||||
*/
|
||||
@ApiModelProperty(value = "呼叫结束时间")
|
||||
private String dialEndTime;
|
||||
|
||||
/**
|
||||
* 所属机构id
|
||||
*/
|
||||
@ApiModelProperty(value = "所属机构id")
|
||||
private Long hospitalAgencyId;
|
||||
|
||||
/**
|
||||
* 所属机构名称
|
||||
*/
|
||||
@ApiModelProperty(value = "所属机构名称")
|
||||
private String hospitalAgencyName;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("dialStartTime", getDialStartTime())
|
||||
.append("dialEndTime", getDialEndTime())
|
||||
.append("hospitalAgencyId", getHospitalAgencyId())
|
||||
.append("hospitalAgencyName", getHospitalAgencyName())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -32,12 +32,12 @@ public class CreateTaskDto {
|
||||
/**
|
||||
* 呼叫开始时间
|
||||
*/
|
||||
private String dialStartTime = "09:00";
|
||||
private String dialStartTime;
|
||||
|
||||
/**
|
||||
* 呼叫结束时间
|
||||
*/
|
||||
private String dialEndTime = "18:00";
|
||||
private String dialEndTime;
|
||||
|
||||
/**
|
||||
* 禁呼日期, 99-节假日;1-周一;2-周二;3-周三;4-周四;5-周五;6-周六;0-周日,默认为空,表示不限制禁呼日期
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xinelu.manage.mapper.patientinfoimportmain;
|
||||
|
||||
import com.xinelu.manage.domain.dialtime.DialTime;
|
||||
import com.xinelu.manage.domain.patientinfoimportmain.PatientInfoImportMain;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.patientinfoimportmain.PatientInfoImportMainVO;
|
||||
@ -162,4 +163,36 @@ public interface PatientInfoImportMainMapper {
|
||||
* @return int
|
||||
*/
|
||||
int selectPatientInfoImportCount(String sn);
|
||||
|
||||
/**
|
||||
* 查询医院外呼时间起止
|
||||
*
|
||||
* @param hospitalAgencyId 医院外呼时间起止主键
|
||||
* @return 医院外呼时间起止
|
||||
*/
|
||||
DialTime selectDialTimeById(Long hospitalAgencyId);
|
||||
|
||||
/**
|
||||
* 新增医院外呼时间起止
|
||||
*
|
||||
* @param dialTime 医院外呼时间起止
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDialTime(DialTime dialTime);
|
||||
|
||||
/**
|
||||
* 修改医院外呼时间起止
|
||||
*
|
||||
* @param dialTime 医院外呼时间起止
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDialTime(DialTime dialTime);
|
||||
|
||||
/**
|
||||
* 根据sn查询医院
|
||||
*
|
||||
* @param sn
|
||||
* @return Long
|
||||
*/
|
||||
Long selectHospitalAgencyId(String sn);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xinelu.manage.service.patientinfoimportmain;
|
||||
|
||||
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.manage.domain.dialtime.DialTime;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.patientinfoimportmain.PatientInfoImportMainVO;
|
||||
|
||||
@ -26,4 +27,19 @@ public interface IPatientInfoImportMainService {
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult updatePatientInfoImport(PatientInfoVo patientInfoVo);
|
||||
|
||||
/**
|
||||
* 获取医院外呼时间起止详细信息
|
||||
*
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult selectDialTimeById();
|
||||
|
||||
/**
|
||||
* 新增医院外呼时间起止
|
||||
*
|
||||
* @param dialTime 医院外呼时间起止
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult insertDialTime(DialTime dialTime);
|
||||
}
|
||||
|
||||
@ -2,15 +2,22 @@ package com.xinelu.manage.service.patientinfoimportmain.impl;
|
||||
|
||||
import com.xinelu.common.annotation.DataScope;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.domain.entity.SysUser;
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.manage.domain.agency.Agency;
|
||||
import com.xinelu.manage.domain.dialtime.DialTime;
|
||||
import com.xinelu.manage.mapper.agency.AgencyMapper;
|
||||
import com.xinelu.manage.mapper.patientinfoimportmain.PatientInfoImportMainMapper;
|
||||
import com.xinelu.manage.service.patientinfoimportmain.IPatientInfoImportMainService;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.patientinfoimportmain.PatientInfoImportMainVO;
|
||||
import com.xinelu.system.mapper.SysUserMapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -21,6 +28,11 @@ public class PatientInfoImportMainServiceImpl implements IPatientInfoImportMainS
|
||||
|
||||
@Resource
|
||||
PatientInfoImportMainMapper patientInfoImportMainMapper;
|
||||
@Resource
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Resource
|
||||
private AgencyMapper agencyMapper;
|
||||
|
||||
|
||||
@DataScope(agencyAlias = "p")
|
||||
@Override
|
||||
@ -80,4 +92,51 @@ public class PatientInfoImportMainServiceImpl implements IPatientInfoImportMainS
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医院外呼时间起止详细信息
|
||||
*
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult selectDialTimeById() {
|
||||
SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
|
||||
if (Objects.isNull(sysUser.getHospitalAgencyId())) {
|
||||
return AjaxResult.error("该账号未绑定医院,请绑定医院后查看!");
|
||||
}
|
||||
Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId());
|
||||
if (Objects.isNull(agency)) {
|
||||
return AjaxResult.error("未查询该账号绑定的医院信息,请联系管理员!");
|
||||
}
|
||||
return AjaxResult.success(patientInfoImportMainMapper.selectDialTimeById(agency.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增医院外呼时间起止
|
||||
*
|
||||
* @param dialTime 医院外呼时间起止
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insertDialTime(DialTime dialTime) {
|
||||
SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
|
||||
if (Objects.isNull(sysUser.getHospitalAgencyId())) {
|
||||
return AjaxResult.error("该账号未绑定医院,请绑定医院后添加!");
|
||||
}
|
||||
Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId());
|
||||
if (Objects.isNull(agency)) {
|
||||
return AjaxResult.error("未查询该账号绑定的医院信息,请联系管理员!");
|
||||
}
|
||||
DialTime dataDialTime = patientInfoImportMainMapper.selectDialTimeById(agency.getId());
|
||||
dialTime.setHospitalAgencyId(agency.getId());
|
||||
dialTime.setHospitalAgencyName(agency.getAgencyName());
|
||||
if (Objects.nonNull(dataDialTime)) {
|
||||
dialTime.setUpdateTime(LocalDateTime.now());
|
||||
dialTime.setUpdateBy(SecurityUtils.getUsername());
|
||||
return AjaxResult.success(patientInfoImportMainMapper.updateDialTime(dialTime));
|
||||
}
|
||||
dialTime.setCreateTime(LocalDateTime.now());
|
||||
dialTime.setCreateBy(SecurityUtils.getUsername());
|
||||
return AjaxResult.success(patientInfoImportMainMapper.insertDialTime(dialTime));
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,4 +315,94 @@
|
||||
from patient_info_import
|
||||
where sn = #{sn}
|
||||
</select>
|
||||
|
||||
<select id="selectDialTimeById" parameterType="Long"
|
||||
resultType="com.xinelu.manage.domain.dialtime.DialTime">
|
||||
select id,
|
||||
dial_start_time,
|
||||
dial_end_time,
|
||||
hospital_agency_id,
|
||||
hospital_agency_name,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from dial_time
|
||||
where hospital_agency_id = #{hospitalAgencyId}
|
||||
</select>
|
||||
|
||||
<insert id="insertDialTime" parameterType="DialTime">
|
||||
insert into dial_time
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dialStartTime != null and dialStartTime != ''">dial_start_time,
|
||||
</if>
|
||||
<if test="dialEndTime != null and dialEndTime != ''">dial_end_time,
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null">hospital_agency_id,
|
||||
</if>
|
||||
<if test="hospitalAgencyName != null and hospitalAgencyName != ''">hospital_agency_name,
|
||||
</if>
|
||||
<if test="createBy != null">create_by,
|
||||
</if>
|
||||
<if test="createTime != null">create_time,
|
||||
</if>
|
||||
<if test="updateBy != null">update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dialStartTime != null and dialStartTime != ''">#{dialStartTime},
|
||||
</if>
|
||||
<if test="dialEndTime != null and dialEndTime != ''">#{dialEndTime},
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null">#{hospitalAgencyId},
|
||||
</if>
|
||||
<if test="hospitalAgencyName != null and hospitalAgencyName != ''">#{hospitalAgencyName},
|
||||
</if>
|
||||
<if test="createBy != null">#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDialTime" parameterType="DialTime">
|
||||
update dial_time
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dialStartTime != null and dialStartTime != ''">dial_start_time =
|
||||
#{dialStartTime},
|
||||
</if>
|
||||
<if test="dialEndTime != null and dialEndTime != ''">dial_end_time =
|
||||
#{dialEndTime},
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null">hospital_agency_id =
|
||||
#{hospitalAgencyId},
|
||||
</if>
|
||||
<if test="hospitalAgencyName != null and hospitalAgencyName != ''">hospital_agency_name =
|
||||
#{hospitalAgencyName},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">create_time =
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">update_by =
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">update_time =
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
where hospital_agency_id = #{hospitalAgencyId}
|
||||
</update>
|
||||
|
||||
<select id="selectHospitalAgencyId" resultType="java.lang.Long">
|
||||
select hospital_agency_id where sn = #{sn}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -2,9 +2,12 @@ package com.xinelu.quartz.task;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xinelu.common.constant.AiobTaskTypeContant;
|
||||
import com.xinelu.common.constant.Constants;
|
||||
import com.xinelu.common.core.domain.entity.SysDictData;
|
||||
import com.xinelu.common.enums.*;
|
||||
import com.xinelu.common.utils.StringUtils;
|
||||
import com.xinelu.common.utils.regex.RegexUtil;
|
||||
import com.xinelu.manage.domain.dialtime.DialTime;
|
||||
import com.xinelu.manage.domain.patientinfo.PatientInfo;
|
||||
import com.xinelu.manage.domain.patientvisitrecord.PatientVisitRecord;
|
||||
import com.xinelu.manage.domain.scriptInfo.ScriptInfo;
|
||||
@ -19,6 +22,8 @@ import com.xinelu.manage.dto.aiob.ImportTaskDto;
|
||||
import com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto;
|
||||
import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper;
|
||||
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
|
||||
import com.xinelu.manage.mapper.patientinfoimport.PatientInfoImportMapper;
|
||||
import com.xinelu.manage.mapper.patientinfoimportmain.PatientInfoImportMainMapper;
|
||||
import com.xinelu.manage.mapper.patientvisitrecord.PatientVisitRecordMapper;
|
||||
import com.xinelu.manage.mapper.scriptInfo.ScriptInfoMapper;
|
||||
import com.xinelu.manage.mapper.scriptinfotaskinfo.ScriptInfoTaskInfoMapper;
|
||||
@ -38,6 +43,7 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.xinelu.system.service.ISysDictTypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@ -77,6 +83,10 @@ public class UploadRobotPublishTask {
|
||||
private LabelFieldContentMapper labelFieldContentMapper;
|
||||
@Resource
|
||||
private RegexUtil regexUtil;
|
||||
@Resource
|
||||
private ISysDictTypeService iSysDictTypeService;
|
||||
@Resource
|
||||
private PatientInfoImportMainMapper patientInfoImportMainMapper;
|
||||
|
||||
/**
|
||||
* @description 创建百度智能外呼任务并导入客户名单
|
||||
@ -149,6 +159,26 @@ public class UploadRobotPublishTask {
|
||||
scriptInfoTaskInfoQuery.setSn(sn);
|
||||
String taskId = scriptInfoTaskInfoMapper.getByNodeId(scriptInfoTaskInfoQuery);
|
||||
if (StringUtils.isBlank(taskId)) {
|
||||
Long aLong = patientInfoImportMainMapper.selectHospitalAgencyId(sn);
|
||||
DialTime dialTime = patientInfoImportMainMapper.selectDialTimeById(aLong);
|
||||
LocalTime localStartTime = LocalTime.parse(dialTime.getDialStartTime());
|
||||
LocalTime localEndTime = LocalTime.parse(dialTime.getDialEndTime());
|
||||
LocalTime dateStartTime;
|
||||
LocalTime dateEndTime;
|
||||
List<SysDictData> sysDictDataList = iSysDictTypeService.selectDictDataByType(Constants.DIAL_TIME);
|
||||
if (CollectionUtils.isEmpty(sysDictDataList) || sysDictDataList.size() != 2) {
|
||||
dateStartTime = LocalTime.parse("08:00");
|
||||
dateEndTime = LocalTime.parse("16:00");
|
||||
} else {
|
||||
dateStartTime = LocalTime.parse(sysDictDataList.get(0).getDictLabel());
|
||||
dateEndTime = LocalTime.parse(sysDictDataList.get(1).getDictLabel());
|
||||
}
|
||||
if (dateStartTime.isAfter(localStartTime) ) {
|
||||
localStartTime = dateStartTime;
|
||||
}
|
||||
if (dateEndTime.isBefore(localEndTime)) {
|
||||
localEndTime = dateEndTime;
|
||||
}
|
||||
// 没有任务则创建任务
|
||||
if (ObjectUtils.isNotEmpty(scriptInfo)) {
|
||||
log.info("创建任务......");
|
||||
@ -168,6 +198,8 @@ public class UploadRobotPublishTask {
|
||||
createTaskDto.setNumTypeFilterList(Arrays.asList(1, 2));
|
||||
createTaskDto.setTaskDataCallback(true);
|
||||
createTaskDto.setCallBackUrl(callBackUrl);
|
||||
createTaskDto.setDialStartTime(localStartTime.format(DateTimeFormatter.ofPattern("HH:mm")));
|
||||
createTaskDto.setDialEndTime(localEndTime.format(DateTimeFormatter.ofPattern("HH:mm")));
|
||||
taskId = aiobService.createTask(createTaskDto);
|
||||
// 开启任务
|
||||
log.info("开启任务......");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user