Browse Source

修改随访工单公共队列名称不显示问题

new-ays
zzc 3 months ago
parent
commit
3bf72c27b6
  1. 310
      acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java
  2. 2
      acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java
  3. 7
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java
  4. 18
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java

310
acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java

@ -83,192 +83,154 @@ public class TaskController {
slavelQueueList.addAll(commonQueue); slavelQueueList.addAll(commonQueue);
//查询每个队列的对象 //查询每个队列的对象
for (FmsFollowupVo.FollowupQueueVO queue : slavelQueueList) { for (FmsFollowupVo.FollowupQueueVO followupQueueVO : slavelQueueList) {
FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO(); FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO();
followupPatientQueryDTO.setQueueId(queue.getId()); followupPatientQueryDTO.setQueueId(followupQueueVO.getId());
followupPatientQueryDTO.setTenantId(queue.getTenantId()); followupPatientQueryDTO.setTenantId(followupQueueVO.getTenantId());
List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO); List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO);
log.info("查询每个队列的对象:{}", patientList); log.info("查询每个队列的对象:{}", patientList);
if (CollectionUtil.isEmpty(patientList)) { if (CollectionUtil.isEmpty(patientList)) {
continue; continue;
} }
} Integer followWindowAdys = followupQueueVO.getFollowWindowAdys();
// //随访总月数
//// //定时任务 Integer followupMonth = followupQueueVO.getFollowupMonth();
// for (FmsFollowupVo.FollowupPatient followupPatient : patientList) {
// //循环租户 //获取随访到期时间 出院时间+随访总月数 = 到期时间
// for (UmsDataSourceVo.Result tenant : tenantList) { Calendar calendar = Calendar.getInstance();
// if ("MASTER".equals(tenant.getDataSourceKey())) { calendar.setTime(followupPatient.getDischargeTime());
// continue; calendar.set(Calendar.MONTH, followupMonth);
// } Date time = calendar.getTime();
// changeDataSource(tenant);
// { //获取队列信息
// //获取随访患者列表,根据患者出院日时间和队列添加工单 String frequency = followupQueueVO.getFrequency();
// //1. 查询队列 List<Date> dateList = new ArrayList<>();
// List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null, null); try {
// CronTriggerImpl cronTrigger = new CronTriggerImpl();
// if (CollectionUtil.isEmpty(queueList)) { cronTrigger.setCronExpression(frequency);
// queueList = followupQueueVOS; //TriggerUtils.computeFireTimesBetween(要计算触发时间的触发器对象, 用于计算触发时间的日历对象, 计算触发时间的起始时间点, 计算触发时间的结束时间点);
// } else { dateList = TriggerUtils.computeFireTimesBetween(cronTrigger, null, followupPatient.getDischargeTime(), time);
// if (CollectionUtil.isEmpty(followupQueueVOS)) { if (CollectionUtil.isEmpty(dateList)) {
// queueList.addAll(followupQueueVOS); continue;
// } }
// } } catch (Exception e) {
// for (FmsFollowupVo.FollowupQueueVO followupQueueVO : queueList) { e.printStackTrace();
// Integer followWindowAdys = followupQueueVO.getFollowWindowAdys(); }finally {
// if (CollectionUtil.isEmpty(dateList)) {
// //2. 查询队列随访患者列表 continue;
//// changeDataSource(result); }
// FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO(); }
// followupPatientQueryDTO.setQueueId(followupQueueVO.getId()); //3. 判断随访类型
// followupPatientQueryDTO.setTenantId(followupQueueVO.getTenantId()); if (followupQueueVO.getFollowupType() == 0) {
// changeDataSource(result); //单次
//
// List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO); //判断是否已有该次随访
//// List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), null, null); FmsFollowupTaskExample fmsFollowupTaskExample = new FmsFollowupTaskExample();
// if (CollectionUtil.isEmpty(patientList)) { fmsFollowupTaskExample.createCriteria().andTimesEqualTo(1).andPatientIdEqualTo(followupPatient.getPatientId()).andQueueIdEqualTo(followupQueueVO.getId());
// continue; List<FmsFollowupTask> fmsFollowupTasks = fmsFollowupTaskMapper.selectByExample(fmsFollowupTaskExample);
// } if (CollectionUtil.isNotEmpty(fmsFollowupTasks)) {
// //随访总月数 continue;
// Integer followupMonth = followupQueueVO.getFollowupMonth(); }
// for (FmsFollowupVo.FollowupPatient followupPatient : patientList) { FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
// //获取随访到期时间 出院时间+随访总月数 = 到期时间 BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
// Calendar calendar = Calendar.getInstance(); fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
// calendar.setTime(followupPatient.getDischargeTime()); fmsFollowupTask.setName(followupPatient.getName());
// calendar.set(Calendar.MONTH, followupMonth); fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull());
// Date time = calendar.getTime(); fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple());
// fmsFollowupTask.setGender(followupPatient.getGender());
// //获取队列信息 if (followupPatient.getBirthDate() != null) {
// String frequency = followupQueueVO.getFrequency(); fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date()));
// List<Date> dateList = new ArrayList<>(); }
// try { fmsFollowupTask.setEthnicity(followupPatient.getEthnicity());
// CronTriggerImpl cronTrigger = new CronTriggerImpl(); fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
// cronTrigger.setCronExpression(frequency); fmsFollowupTask.setPhone(followupPatient.getPhone());
// //TriggerUtils.computeFireTimesBetween(要计算触发时间的触发器对象, 用于计算触发时间的日历对象, 计算触发时间的起始时间点, 计算触发时间的结束时间点); fmsFollowupTask.setTenantId(followupPatient.getTenantId());
// dateList = TriggerUtils.computeFireTimesBetween(cronTrigger, null, followupPatient.getDischargeTime(), time); fmsFollowupTask.setIdCardType(followupPatient.getIdCardType());
// if (CollectionUtil.isEmpty(dateList)) { fmsFollowupTask.setIdCard(followupPatient.getIdCard());
// continue; fmsFollowupTask.setTimes(1);
// } fmsFollowupTask.setQueueId(followupQueueVO.getId());
// } catch (Exception e) { fmsFollowupTask.setPatientId(followupPatient.getId());
// e.printStackTrace(); fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
// } fmsFollowupTask.setDelFlag((byte) 0);
// //3. 判断随访类型 fmsFollowupTask.setCreateTime(new Date());
// if (followupQueueVO.getFollowupType() == 0) { fmsFollowupTask.setStatus((byte) 0);
// //单次
// //计算第一次随访的时间
// //判断是否已有该次随访 DateComparator dateComparator = getDate(dateList);
// FmsFollowupTaskExample fmsFollowupTaskExample = new FmsFollowupTaskExample(); if (dateComparator.getDate() != null) {
// fmsFollowupTaskExample.createCriteria().andTimesEqualTo(1).andPatientIdEqualTo(followupPatient.getPatientId()).andQueueIdEqualTo(followupQueueVO.getId()); fmsFollowupTask.setStartTime(dateComparator.getDate());
// List<FmsFollowupTask> fmsFollowupTasks = fmsFollowupTaskMapper.selectByExample(fmsFollowupTaskExample); } else {
// if (CollectionUtil.isNotEmpty(fmsFollowupTasks)) { Calendar instance = Calendar.getInstance();
// continue; instance.setTime(dateList.get(0));
// } instance.add(Calendar.DATE, -followWindowAdys / 2);
// FmsFollowupTask fmsFollowupTask = new FmsFollowupTask(); fmsFollowupTask.setStartTime(instance.getTime());
// BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask); }
// fmsFollowupTask.setId(IdUtil.getSnowflakeNextId()); Calendar instance1 = Calendar.getInstance();
// fmsFollowupTask.setName(followupPatient.getName()); instance1.setTime(dateList.get(0));
// fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull()); instance1.add(Calendar.DATE, followWindowAdys / 2);
// fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple()); fmsFollowupTask.setEndTime(instance1.getTime());
// fmsFollowupTask.setGender(followupPatient.getGender()); fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
// if (followupPatient.getBirthDate() != null) { fmsFollowupTask.setFollowupTime(dateList.get(0));
// fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date())); fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
// } } else {
// fmsFollowupTask.setEthnicity(followupPatient.getEthnicity()); //周期
// fmsFollowupTask.setEducationYears(followupPatient.getEducationYears()); //4. 根据频次和总月数添加
// fmsFollowupTask.setPhone(followupPatient.getPhone()); DateComparator dateComparator = getDate(dateList);
// fmsFollowupTask.setTenantId(followupPatient.getTenantId()); if (dateComparator.getDate() == null || dateComparator.getIndex() == null) {
// fmsFollowupTask.setIdCardType(followupPatient.getIdCardType()); continue;
// fmsFollowupTask.setIdCard(followupPatient.getIdCard()); }
// fmsFollowupTask.setTimes(1); Date date = dateComparator.getDate();
// fmsFollowupTask.setQueueId(followupQueueVO.getId()); Integer index = dateComparator.getIndex();
// fmsFollowupTask.setPatientId(followupPatient.getId());
// fmsFollowupTask.setEducationYears(followupPatient.getEducationYears()); //判断是否已有该次随访
// fmsFollowupTask.setDelFlag((byte) 0); FmsFollowupTaskExample fmsFollowupTaskExample = new FmsFollowupTaskExample();
// fmsFollowupTask.setCreateTime(new Date()); fmsFollowupTaskExample.createCriteria().andTimesEqualTo(index).andPatientIdEqualTo(followupPatient.getPatientId()).andQueueIdEqualTo(followupQueueVO.getId());
// fmsFollowupTask.setStatus((byte) 0); List<FmsFollowupTask> fmsFollowupTasks = fmsFollowupTaskMapper.selectByExample(fmsFollowupTaskExample);
// if (CollectionUtil.isNotEmpty(fmsFollowupTasks)) {
// //计算第一次随访的时间 continue;
// DateComparator dateComparator = getDate(dateList); }
// if (dateComparator.getDate() != null) {
// fmsFollowupTask.setStartTime(dateComparator.getDate());
// } else {
// Calendar instance = Calendar.getInstance();
// instance.setTime(dateList.get(0));
// instance.add(Calendar.DATE, -followWindowAdys / 2);
// fmsFollowupTask.setStartTime(instance.getTime());
// }
// Calendar instance1 = Calendar.getInstance();
// instance1.setTime(dateList.get(0));
// instance1.add(Calendar.DATE, followWindowAdys / 2);
// fmsFollowupTask.setEndTime(instance1.getTime());
// fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
// fmsFollowupTask.setFollowupTime(dateList.get(0));
// changeDataSource(result);
// fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
//
// } else {
// //周期
// //4. 根据频次和总月数添加
// DateComparator dateComparator = getDate(dateList);
// if (dateComparator.getDate() == null || dateComparator.getIndex() == null) {
// continue;
// }
// Date date = dateComparator.getDate();
// Integer index = dateComparator.getIndex();
//
// //判断是否已有该次随访
// FmsFollowupTaskExample fmsFollowupTaskExample = new FmsFollowupTaskExample();
// fmsFollowupTaskExample.createCriteria().andTimesEqualTo(index).andPatientIdEqualTo(followupPatient.getPatientId()).andQueueIdEqualTo(followupQueueVO.getId());
// List<FmsFollowupTask> fmsFollowupTasks = fmsFollowupTaskMapper.selectByExample(fmsFollowupTaskExample);
// if (CollectionUtil.isNotEmpty(fmsFollowupTasks)) {
// continue;
// }
//
// FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
// BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
// fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
// fmsFollowupTask.setName(followupPatient.getName());
// fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull());
// fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple());
// fmsFollowupTask.setGender(followupPatient.getGender());
// if (followupPatient.getBirthDate() != null) {
// fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date()));
// }
// fmsFollowupTask.setEthnicity(followupPatient.getEthnicity());
// fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
// fmsFollowupTask.setTimes(index);
// fmsFollowupTask.setPhone(followupPatient.getPhone());
// fmsFollowupTask.setTenantId(followupPatient.getTenantId());
// fmsFollowupTask.setIdCardType(followupPatient.getIdCardType());
// fmsFollowupTask.setIdCard(followupPatient.getIdCard());
// fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
// fmsFollowupTask.setQueueId(followupQueueVO.getId());
// fmsFollowupTask.setDelFlag((byte) 0);
// fmsFollowupTask.setCreateTime(new Date());
// fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
// fmsFollowupTask.setStatus((byte) 0);
//
// fmsFollowupTask.setStartTime(date);
// Calendar instance = Calendar.getInstance();
// instance.setTime(date);
// instance.add(Calendar.DATE, followWindowAdys / 2);
//
// fmsFollowupTask.setEndTime(instance.getTime());
// changeDataSource(result);
// fmsFollowupTask.setPatientId(followupPatient.getId());
// fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
// }
// }
// }
// } FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
// } BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
fmsFollowupTask.setName(followupPatient.getName());
fmsFollowupTask.setPinyinFull(followupPatient.getPinyinFull());
fmsFollowupTask.setPinyinSimple(followupPatient.getPinyinSimple());
fmsFollowupTask.setGender(followupPatient.getGender());
if (followupPatient.getBirthDate() != null) {
fmsFollowupTask.setAge(DateUtil.age(followupPatient.getBirthDate(), new Date()));
}
fmsFollowupTask.setEthnicity(followupPatient.getEthnicity());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setTimes(index);
fmsFollowupTask.setPhone(followupPatient.getPhone());
fmsFollowupTask.setTenantId(followupPatient.getTenantId());
fmsFollowupTask.setIdCardType(followupPatient.getIdCardType());
fmsFollowupTask.setIdCard(followupPatient.getIdCard());
fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
fmsFollowupTask.setQueueId(followupQueueVO.getId());
fmsFollowupTask.setDelFlag((byte) 0);
fmsFollowupTask.setCreateTime(new Date());
fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
fmsFollowupTask.setStatus((byte) 0);
fmsFollowupTask.setStartTime(date);
Calendar instance = Calendar.getInstance();
instance.setTime(date);
instance.add(Calendar.DATE, followWindowAdys / 2);
fmsFollowupTask.setEndTime(instance.getTime());
fmsFollowupTask.setPatientId(followupPatient.getId());
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
}
}
}
} }
@DataSource(DataSourceType.MASTER) @DataSource(DataSourceType.MASTER)
@ApiOperation("定时任务添加随访工单") @ApiOperation("定时任务添加随访工单")
@PostMapping("/task") @PostMapping("/task")
@Scheduled(cron = "0 0 0 * * ?") @Scheduled(cron = "0 0 0 * * 1")
@Anonymous @Anonymous
public void task() { public void task() {
// TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 ) // TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 )

2
acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java

@ -62,7 +62,7 @@ public class WebDmsLoginService
public String login(String username, String password, String code, String uuid) public String login(String username, String password, String code, String uuid)
{ {
// 验证码校验 // 验证码校验
validateCaptcha(username, code, uuid); // validateCaptcha(username, code, uuid);
// 登录前置校验 // 登录前置校验
loginPreCheck(username, password); loginPreCheck(username, password);
// 用户验证 // 用户验证

7
acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java

@ -123,6 +123,7 @@ public class FmsFollowupVo {
private Date updateTime; private Date updateTime;
private String remark; private String remark;
private String queueName; private String queueName;
private Long queueId;
private String tenantName; private String tenantName;
@ApiModelProperty("随访窗口期") @ApiModelProperty("随访窗口期")
private Integer followWindowAdys; private Integer followWindowAdys;
@ -132,6 +133,9 @@ public class FmsFollowupVo {
public Integer getStatus() { public Integer getStatus() {
if (status == null) {
return 0;
}
if (status == 2){ if (status == 2){
return status; return status;
} }
@ -143,6 +147,9 @@ public class FmsFollowupVo {
return 4; return 4;
} }
if (startTime != null) { if (startTime != null) {
if (remindTime == null) {
return status;
}
//判断是否临近随访时间 开始时间 + 临近提醒时间 < 当前时间 //判断是否临近随访时间 开始时间 + 临近提醒时间 < 当前时间
Calendar instance = Calendar.getInstance(); Calendar instance = Calendar.getInstance();
instance.setTime(startTime); instance.setTime(startTime);

18
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java

@ -3,6 +3,7 @@ package com.acupuncture.system.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.acupuncture.common.annotation.DataSource; import com.acupuncture.common.annotation.DataSource;
import com.acupuncture.common.core.redis.RedisCache; import com.acupuncture.common.core.redis.RedisCache;
import com.acupuncture.common.enums.DataSourceType; import com.acupuncture.common.enums.DataSourceType;
@ -15,6 +16,7 @@ import com.acupuncture.system.persist.dao.FmsFollowupDao;
import com.acupuncture.system.persist.mapper.FmsFollowupQueueMapper; import com.acupuncture.system.persist.mapper.FmsFollowupQueueMapper;
import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper; import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper;
import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper; import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper;
import com.acupuncture.system.service.FmsFollowupQueueService;
import com.acupuncture.system.service.FmsFollowupService; import com.acupuncture.system.service.FmsFollowupService;
import org.quartz.TriggerUtils; import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl; import org.quartz.impl.triggers.CronTriggerImpl;
@ -48,6 +50,8 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
private RedisCache redisCache; private RedisCache redisCache;
@Resource @Resource
private FmsFollowupTaskMapper fmsFollowupTaskMapper; private FmsFollowupTaskMapper fmsFollowupTaskMapper;
@Resource
private FmsFollowupQueueService fmsFollowupQueueService;
@Override @Override
public List<FmsFollowupVo.FollowupQueueVO> queryQueue(FmsFollowupDto.FollowupQueueQueryDTO dto) { public List<FmsFollowupVo.FollowupQueueVO> queryQueue(FmsFollowupDto.FollowupQueueQueryDTO dto) {
@ -200,6 +204,20 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
if (CollectionUtil.isEmpty(followupTaskVOS)) { if (CollectionUtil.isEmpty(followupTaskVOS)) {
return CollectionUtil.newArrayList(); return CollectionUtil.newArrayList();
} }
List<Object> commonFollowupQueue = redisCache.getCacheList("common_followup_queue");
// List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS = fmsFollowupQueueService.queryCommonQueue(null);
if (CollectionUtil.isNotEmpty(commonFollowupQueue)) {
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class);
Map<Long, FmsFollowupVo.FollowupQueueVO> map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity()));
for (FmsFollowupVo.FollowupTaskVO followupTaskVO : followupTaskVOS) {
if (StrUtil.isEmpty(followupTaskVO.getQueueName()) && followupTaskVO.getQueueId() != null) {
FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(followupTaskVO.getQueueId());
if (followupQueueVO != null) {
followupTaskVO.setQueueName(followupQueueVO.getName());
}
}
}
}
return followupTaskVOS; return followupTaskVOS;
} }

Loading…
Cancel
Save