Browse Source

修改全局录音配置参数

newMaster
zzc 4 months ago
parent
commit
e461eeace5
  1. 7
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupController.java
  2. 207
      acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java
  3. 207
      acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController1.java
  4. 2
      acupuncture-admin/src/main/resources/application-stage.yml
  5. 4
      acupuncture-generator/src/main/resources/mbg.xml
  6. 22
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java
  7. 24
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java
  8. 22
      acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsFollowupQueue.java
  9. 120
      acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsFollowupQueueExample.java
  10. 53
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java
  11. 3
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java
  12. 2
      acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupService.java
  13. 11
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java
  14. 17
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java
  15. 12
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java
  16. 91
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java
  17. 24
      acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml
  18. 4
      acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml
  19. 52
      acupuncture-system/src/main/resources/mapper/system/FmsFollowupQueueMapper.xml

7
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupController.java

@ -123,4 +123,11 @@ public class FmsFollowupController {
fmsFollowupService.completeFollowup(dto);
return JsonResponse.ok();
}
@ApiOperation("修改随访工单状态")
@PostMapping("/status")
public JsonResponse<Integer> status(@RequestBody @Validated FmsFollowupDto.UpdStatusDto dto){
fmsFollowupService.updStatus(dto.getId(), dto.getStatus());
return JsonResponse.ok();
}
}

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

@ -5,8 +5,11 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.acupuncture.common.annotation.Anonymous;
import com.acupuncture.common.core.redis.RedisCache;
import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
import com.acupuncture.system.domain.dto.FmsFollowupDto;
import com.acupuncture.system.domain.po.FmsFollowupTask;
import com.acupuncture.system.domain.po.FmsFollowupTaskExample;
import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
import com.acupuncture.system.domain.vo.FmsFollowupVo;
import com.acupuncture.system.domain.vo.UmsDataSourceVo;
@ -14,11 +17,14 @@ import com.acupuncture.system.persist.dao.FmsFollowupDao;
import com.acupuncture.system.persist.dao.UmsDataSourceDao;
import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper;
import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper;
import com.acupuncture.system.service.FmsFollowupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl;
import org.quartz.spi.OperableTrigger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -27,10 +33,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* @Author zzc
@ -48,17 +51,23 @@ public class TaskController {
@Resource
private FmsFollowupDao fmsFollowupDao;
@Resource
private FmsFollowupService fmsFollowupService;
@Resource
private FmsFollowupTaskMapper fmsFollowupTaskMapper;
@Resource
private UmsDataSourceDao umsDataSourceDao;
@Resource
private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper;
@Resource
private RedisCache redisCache;
@ApiOperation("定时任务添加随访工单")
@PostMapping("/task")
@Scheduled(fixedRate = 10000)
@Anonymous
public void task() {
// TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 )
//查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单
// UmsDataSourceVo.Result result1 = new UmsDataSourceVo.Result();
// result1.setDataSourceKey("MASTER");
@ -68,7 +77,8 @@ public class TaskController {
return;
}
//查询公共队列
List<FmsFollowupVo.FollowupQueueVO> queueResults = fmsFollowupDao.queryCommonQueue(null);
List<Object> queueResults = redisCache.getCacheList("common_followup_queue");
// List<FmsFollowupVo.FollowupQueueVO> queueResults = fmsFollowupDao.queryCommonQueue(null);
//切换数据源
for (UmsDataSourceVo.Result result : query) {
if ("MASTER".equals(result.getDataSourceKey())) {
@ -81,13 +91,23 @@ public class TaskController {
List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null);
if (CollectionUtil.isEmpty(queueList)) {
queueList = queueResults;
if (CollectionUtil.isEmpty(queueResults)) {
queueList = BeanUtil.copyToList(queueResults, FmsFollowupVo.FollowupQueueVO.class);
}
} else {
queueList.addAll(queueResults);
if (CollectionUtil.isEmpty(queueResults)) {
queueList.addAll(BeanUtil.copyToList(queueResults, FmsFollowupVo.FollowupQueueVO.class));
}
}
for (FmsFollowupVo.FollowupQueueVO followupQueueVO : queueList) {
Integer followWindowAdys = followupQueueVO.getFollowWindowAdys();
//2. 查询队列随访患者列表
List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), (byte) 0);
// changeDataSource(result);
FmsFollowupDto.FollowupPatientQueryDTO followupPatientQueryDTO = new FmsFollowupDto.FollowupPatientQueryDTO();
followupPatientQueryDTO.setQueueId(followupQueueVO.getId());
List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupService.queryPatient(followupPatientQueryDTO);
// List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), null, null);
if (CollectionUtil.isEmpty(patientList)) {
continue;
}
@ -117,6 +137,14 @@ public class TaskController {
//3. 判断随访类型
if (followupQueueVO.getFollowupType() == 0) {
//单次
//判断是否已有该次随访
FmsFollowupTaskExample fmsFollowupTaskExample = new FmsFollowupTaskExample();
fmsFollowupTaskExample.createCriteria().andTimesEqualTo(1).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());
@ -140,8 +168,14 @@ public class TaskController {
fmsFollowupTask.setDelFlag((byte) 0);
fmsFollowupTask.setCreateTime(new Date());
fmsFollowupTask.setStatus((byte) 0);
fmsFollowupTask.setStartTime(dateList.get(0));
fmsFollowupTask.setEndTime(dateList.get(0));
//计算第一次随访的时间
Calendar instance = Calendar.getInstance();
instance.setTime(dateList.get(0));
instance.set(Calendar.DAY_OF_MONTH, -followWindowAdys / 2);
fmsFollowupTask.setStartTime(instance.getTime());
instance.set(Calendar.DAY_OF_MONTH, followWindowAdys);
fmsFollowupTask.setEndTime(instance.getTime());
fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
fmsFollowupTask.setFollowupTime(dateList.get(0));
changeDataSource(result);
@ -150,48 +184,55 @@ public class TaskController {
} else {
//周期
//4. 根据频次和总月数添加
int i = 0;
for (Date date : dateList) {
i+=1;
//单次
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(i);
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);
fmsFollowupTask.setEndTime(date);
fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
fmsFollowupTask.setFollowupTime(date);
changeDataSource(result);
fmsFollowupTask.setPatientId(followupPatient.getId());
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
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);
Calendar instance = Calendar.getInstance();
instance.setTime(dateList.get(0));
instance.set(Calendar.DAY_OF_MONTH, -followWindowAdys / 2);
fmsFollowupTask.setStartTime(date);
instance.set(Calendar.DAY_OF_MONTH, followWindowAdys);
fmsFollowupTask.setEndTime(instance.getTime());
changeDataSource(result);
fmsFollowupTask.setPatientId(followupPatient.getId());
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
}
changeDataSource(result);
//将患者设置为已生成工单
FmsPatientQueueRelation fmsPatientQueueRelation = BeanUtil.copyProperties(followupPatient, FmsPatientQueueRelation.class);
fmsPatientQueueRelation.setTaskFlag((byte) 1);
fmsPatientQueueRelation.setPatientId(followupPatient.getId());
fmsPatientQueueRelationMapper.updateByPrimaryKeySelective(fmsPatientQueueRelation);
}
}
@ -202,4 +243,70 @@ public class TaskController {
private static void changeDataSource(UmsDataSourceVo.Result result) {
DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey());
}
/**
* 法用于计算在指定时间范围内触发器的触发时间点具体步骤如下
* 初始化一个空列表 lst 存储触发时间点
* 克隆传入的触发器 trigg并检查其下一个触发时间是否为空如果为空则设置开始时间和结束时间并计算首次触发时间
* 使用 while 循环遍历触发器的触发时间点直到没有更多触发时间或超出指定范围
* 如果触发时间在指定范围内则将其添加到列表中并更新触发器状态
*
* @param trigg cron表达式
* @param from 患者出院时间
* @param to 患者出院时间 + 随访总月数
* @return
*/
public static List<Date> computeFireTimesBetween(OperableTrigger trigg, org.quartz.Calendar cal, Date from, Date to) {
LinkedList<Date> lst = new LinkedList();
OperableTrigger t = (OperableTrigger) trigg.clone();
if (t.getNextFireTime() == null) {
t.setStartTime(from);
t.setEndTime(to);
t.computeFirstFireTime(cal);
}
while (true) {
Date d = t.getNextFireTime();
if (d == null) {
break;
}
if (d.before(from)) {
t.triggered(cal);
} else {
if (d.after(to)) {
break;
}
lst.add(d);
t.triggered(cal);
}
}
return Collections.unmodifiableList(lst);
}
/**
* 返回当前时间之后的第一个date及对应顺序
*
* @param dateList key 为顺序value 为时间
* @return
*/
public static DateComparator getDate(List<Date> dateList) {
Date today = new Date();
DateComparator dateComparator = new DateComparator();
for (int i = 0; i < dateList.size(); i++) {
Date date = dateList.get(i);
if (date.after(today)) {
dateComparator.setDate(date);
dateComparator.setIndex(i + 1);
return dateComparator;
}
}
return dateComparator;
}
@Data
public static class DateComparator {
private Date date;
private Integer index;
}
}

207
acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController1.java

@ -0,0 +1,207 @@
//package com.acupuncture.web.task;
//
//import cn.hutool.core.bean.BeanUtil;
//import cn.hutool.core.collection.CollectionUtil;
//import cn.hutool.core.date.DateUtil;
//import cn.hutool.core.util.IdUtil;
//import com.acupuncture.common.annotation.Anonymous;
//import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder;
//import com.acupuncture.system.domain.po.FmsFollowupTask;
//import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
//import com.acupuncture.system.domain.vo.FmsFollowupVo;
//import com.acupuncture.system.domain.vo.UmsDataSourceVo;
//import com.acupuncture.system.persist.dao.FmsFollowupDao;
//import com.acupuncture.system.persist.dao.UmsDataSourceDao;
//import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper;
//import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.quartz.TriggerUtils;
//import org.quartz.impl.triggers.CronTriggerImpl;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.transaction.annotation.Propagation;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.Calendar;
//import java.util.Date;
//import java.util.List;
//
///**
// * @Author zzc
// * @Package com.acupuncture.web.controller.web
// * @Date 2025/2/13 8:50
// * @description:
// */
//@Slf4j
//@Api(tags = "定时任务相关")
//@RestController
//@RequestMapping("/task")
//@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
//public class TaskController1 {
//
// @Resource
// private FmsFollowupDao fmsFollowupDao;
// @Resource
// private FmsFollowupTaskMapper fmsFollowupTaskMapper;
// @Resource
// private UmsDataSourceDao umsDataSourceDao;
// @Resource
// private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper;
//
// @ApiOperation("定时任务添加随访工单")
// @PostMapping("/task")
// @Scheduled(fixedRate = 10000)
// @Anonymous
// public void task() {
// // TODO 生成工单第一次生成之后2周的,往后只生成之后一周。第一次随访时间: ( 患者的出院时间 - 7 + 轮次时间) 到 (患者的出院时间 + 7 + 轮次时间 )
//
// //查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单
//// UmsDataSourceVo.Result result1 = new UmsDataSourceVo.Result();
//// result1.setDataSourceKey("MASTER");
//// changeDataSource(result1);
// List<UmsDataSourceVo.Result> query = umsDataSourceDao.query();
// if (CollectionUtil.isEmpty(query)) {
// return;
// }
// //查询公共队列
// List<FmsFollowupVo.FollowupQueueVO> queueResults = fmsFollowupDao.queryCommonQueue(null);
// //切换数据源
// for (UmsDataSourceVo.Result result : query) {
// if ("MASTER".equals(result.getDataSourceKey())) {
// continue;
// }
// changeDataSource(result);
// {
// //获取随访患者列表,根据患者出院日时间和队列添加工单
// //1. 查询队列
// List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null);
//
// if (CollectionUtil.isEmpty(queueList)) {
// queueList = queueResults;
// } else {
// queueList.addAll(queueResults);
// }
// for (FmsFollowupVo.FollowupQueueVO followupQueueVO : queueList) {
// //2. 查询队列随访患者列表
// List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), (byte) 0, null);
// if (CollectionUtil.isEmpty(patientList)) {
// continue;
// }
// //随访总月数
// Integer followupMonth = followupQueueVO.getFollowupMonth();
// for (FmsFollowupVo.FollowupPatient followupPatient : patientList) {
// //获取随访到期时间 出院时间+随访总月数 = 到期时间
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(followupPatient.getDischargeTime());
// calendar.set(Calendar.MONTH, followupMonth);
// Date time = calendar.getTime();
//
// //获取队列信息
// String frequency = followupQueueVO.getFrequency();
// List<Date> dateList = new ArrayList<>();
// try {
// CronTriggerImpl cronTrigger = new CronTriggerImpl();
// cronTrigger.setCronExpression(frequency);
// //TriggerUtils.computeFireTimesBetween(要计算触发时间的触发器对象, 用于计算触发时间的日历对象, 计算触发时间的起始时间点, 计算触发时间的结束时间点);
// dateList = TriggerUtils.computeFireTimesBetween(cronTrigger, null, followupPatient.getDischargeTime(), time);
// if (CollectionUtil.isEmpty(dateList)) {
// continue;
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// //3. 判断随访类型
// if (followupQueueVO.getFollowupType() == 0) {
// //单次
// 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.setPhone(followupPatient.getPhone());
// fmsFollowupTask.setTenantId(followupPatient.getTenantId());
// fmsFollowupTask.setIdCardType(followupPatient.getIdCardType());
// fmsFollowupTask.setIdCard(followupPatient.getIdCard());
// fmsFollowupTask.setTimes(1);
// fmsFollowupTask.setQueueId(followupQueueVO.getId());
// fmsFollowupTask.setPatientId(followupPatient.getId());
// fmsFollowupTask.setEducationYears(followupPatient.getEducationYears());
// fmsFollowupTask.setDelFlag((byte) 0);
// fmsFollowupTask.setCreateTime(new Date());
// fmsFollowupTask.setStatus((byte) 0);
// fmsFollowupTask.setStartTime(dateList.get(0));
// fmsFollowupTask.setEndTime(dateList.get(0));
// fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
// fmsFollowupTask.setFollowupTime(dateList.get(0));
// changeDataSource(result);
// fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
//
// } else {
// //周期
// //4. 根据频次和总月数添加
// int i = 0;
// for (Date date : dateList) {
// i+=1;
// //单次
// 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(i);
// 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);
// fmsFollowupTask.setEndTime(date);
// fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
// fmsFollowupTask.setFollowupTime(date);
// changeDataSource(result);
// fmsFollowupTask.setPatientId(followupPatient.getId());
// fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
// }
// }
// changeDataSource(result);
// //将患者设置为已生成工单
// FmsPatientQueueRelation fmsPatientQueueRelation = BeanUtil.copyProperties(followupPatient, FmsPatientQueueRelation.class);
// fmsPatientQueueRelation.setTaskFlag((byte) 1);
// fmsPatientQueueRelation.setPatientId(followupPatient.getId());
// fmsPatientQueueRelationMapper.updateByPrimaryKeySelective(fmsPatientQueueRelation);
// }
// }
//
// }
// }
// }
//
// private static void changeDataSource(UmsDataSourceVo.Result result) {
// DynamicDataSourceContextHolder.setDataSourceType(result.getDataSourceKey());
// }
//}

2
acupuncture-admin/src/main/resources/application-stage.yml

@ -61,4 +61,4 @@ spring:
multi-statement-allow: true
file:
PatientTemplate: /home/acupuncture/server/profile/PatientTemplate.xlsx
TreamentTemplate: /home/acupuncture/server/profile/PatientTemplate.xlsx
TreamentTemplate: /home/acupuncture/server/profile/TreamentTemplate.xlsx

4
acupuncture-generator/src/main/resources/mbg.xml

@ -59,9 +59,9 @@
<!-- <table tableName="dms_tenant" domainObjectName="DmsTenant" enableDeleteByExample="false"/>-->
<!-- <table tableName="dms_user" domainObjectName="DmsUser" enableDeleteByExample="false"/>-->
<!-- <table tableName="fms_followup_queue" domainObjectName="FmsFollowupQueue" enableDeleteByExample="false"/>-->
<table tableName="fms_followup_queue" domainObjectName="FmsFollowupQueue" enableDeleteByExample="false"/>
<!-- <table tableName="fms_followup_task" domainObjectName="FmsFollowupTask" enableDeleteByExample="false"/>-->
<table tableName="fms_patient_queue_relation" domainObjectName="FmsPatientQueueRelation" enableDeleteByExample="false"/>
<!-- <table tableName="fms_patient_queue_relation" domainObjectName="FmsPatientQueueRelation" enableDeleteByExample="false"/>-->
<!-- <table tableName="pms_patient" domainObjectName="PmsPatient" enableDeleteByExample="false"/>-->
<!-- <table tableName="pms_treatment" domainObjectName="PmsTreatment" enableDeleteByExample="false"/>-->
<!-- <table tableName="pms_treatment_record" domainObjectName="PmsTreatmentRecord" enableDeleteByExample="false"/>-->

22
acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java

@ -42,6 +42,12 @@ public class FmsFollowupDto {
private String personInChargeUsername;
private Byte status;
@ApiModelProperty("随访窗口期")
private Integer followWindowAdys;
@ApiModelProperty("临近提醒时间")
private Integer remindTime;
}
@Data
@ -63,6 +69,11 @@ public class FmsFollowupDto {
private String personInChargeUsername;
private Byte status;
@ApiModelProperty("随访窗口期")
private Integer followWindowAdys;
@ApiModelProperty("临近提醒时间")
private Integer remindTime;
}
@Data
@ -109,7 +120,10 @@ public class FmsFollowupDto {
@Data
public static class FollowupPatientQueryDTO {
// @NotNull(message = "队列ID不能为空")
private Long id;
private Long queueId;
@ApiModelProperty("0 无队列")
private Integer haveQueue;
}
// FollowupTaskQueryDTO.java
@ -139,4 +153,10 @@ public class FmsFollowupDto {
private Date followupTime;
private String followupText;
}
@Data
public static class UpdStatusDto {
private Long id;
private Byte status;
}
}

24
acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java

@ -61,6 +61,14 @@ public class PmsTreatmentDto {
}
return age;
}
public Date getDischargeTime() {
//门诊使用门诊时间
if (visitType == 0) {
return visitTime;
}
return dischargeTime;
}
}
@Data
@ -80,6 +88,7 @@ public class PmsTreatmentDto {
private Integer visitType;
private String visitNumber;
private Date visitTime;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dischargeTime;
private String doctor;
private String deptName;
@ -92,6 +101,21 @@ public class PmsTreatmentDto {
private String updateBy;
@ApiModelProperty("随访队列ID集合")
private List<Long> queueIdList;
public Date getDischargeTime() {
//门诊使用门诊时间
if (visitType == 0) {
return visitTime;
}
return dischargeTime;
}
public Integer getAge() {
if (birthDate != null) {
return DateUtil.age(birthDate, new Date());
}
return age;
}
}
// TreatmentQueryDTO.java (查询用)

22
acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsFollowupQueue.java

@ -22,6 +22,8 @@ public class FmsFollowupQueue implements Serializable {
private Byte status;
private Integer remindTime;
private Byte delFlag;
private Long tenantId;
@ -36,6 +38,8 @@ public class FmsFollowupQueue implements Serializable {
private String remark;
private Integer followWindowAdys;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -110,6 +114,14 @@ public class FmsFollowupQueue implements Serializable {
this.status = status;
}
public Integer getRemindTime() {
return remindTime;
}
public void setRemindTime(Integer remindTime) {
this.remindTime = remindTime;
}
public Byte getDelFlag() {
return delFlag;
}
@ -166,6 +178,14 @@ public class FmsFollowupQueue implements Serializable {
this.remark = remark == null ? null : remark.trim();
}
public Integer getFollowWindowAdys() {
return followWindowAdys;
}
public void setFollowWindowAdys(Integer followWindowAdys) {
this.followWindowAdys = followWindowAdys;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -181,6 +201,7 @@ public class FmsFollowupQueue implements Serializable {
sb.append(", personInCharge=").append(personInCharge);
sb.append(", personInChargeUsername=").append(personInChargeUsername);
sb.append(", status=").append(status);
sb.append(", remindTime=").append(remindTime);
sb.append(", delFlag=").append(delFlag);
sb.append(", tenantId=").append(tenantId);
sb.append(", createBy=").append(createBy);
@ -188,6 +209,7 @@ public class FmsFollowupQueue implements Serializable {
sb.append(", updateBy=").append(updateBy);
sb.append(", updateTime=").append(updateTime);
sb.append(", remark=").append(remark);
sb.append(", followWindowAdys=").append(followWindowAdys);
sb.append("]");
return sb.toString();
}

120
acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsFollowupQueueExample.java

@ -685,6 +685,66 @@ public class FmsFollowupQueueExample {
return (Criteria) this;
}
public Criteria andRemindTimeIsNull() {
addCriterion("remind_time is null");
return (Criteria) this;
}
public Criteria andRemindTimeIsNotNull() {
addCriterion("remind_time is not null");
return (Criteria) this;
}
public Criteria andRemindTimeEqualTo(Integer value) {
addCriterion("remind_time =", value, "remindTime");
return (Criteria) this;
}
public Criteria andRemindTimeNotEqualTo(Integer value) {
addCriterion("remind_time <>", value, "remindTime");
return (Criteria) this;
}
public Criteria andRemindTimeGreaterThan(Integer value) {
addCriterion("remind_time >", value, "remindTime");
return (Criteria) this;
}
public Criteria andRemindTimeGreaterThanOrEqualTo(Integer value) {
addCriterion("remind_time >=", value, "remindTime");
return (Criteria) this;
}
public Criteria andRemindTimeLessThan(Integer value) {
addCriterion("remind_time <", value, "remindTime");
return (Criteria) this;
}
public Criteria andRemindTimeLessThanOrEqualTo(Integer value) {
addCriterion("remind_time <=", value, "remindTime");
return (Criteria) this;
}
public Criteria andRemindTimeIn(List<Integer> values) {
addCriterion("remind_time in", values, "remindTime");
return (Criteria) this;
}
public Criteria andRemindTimeNotIn(List<Integer> values) {
addCriterion("remind_time not in", values, "remindTime");
return (Criteria) this;
}
public Criteria andRemindTimeBetween(Integer value1, Integer value2) {
addCriterion("remind_time between", value1, value2, "remindTime");
return (Criteria) this;
}
public Criteria andRemindTimeNotBetween(Integer value1, Integer value2) {
addCriterion("remind_time not between", value1, value2, "remindTime");
return (Criteria) this;
}
public Criteria andDelFlagIsNull() {
addCriterion("del_flag is null");
return (Criteria) this;
@ -1134,6 +1194,66 @@ public class FmsFollowupQueueExample {
addCriterion("remark not between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andFollowWindowAdysIsNull() {
addCriterion("follow_window_adys is null");
return (Criteria) this;
}
public Criteria andFollowWindowAdysIsNotNull() {
addCriterion("follow_window_adys is not null");
return (Criteria) this;
}
public Criteria andFollowWindowAdysEqualTo(Integer value) {
addCriterion("follow_window_adys =", value, "followWindowAdys");
return (Criteria) this;
}
public Criteria andFollowWindowAdysNotEqualTo(Integer value) {
addCriterion("follow_window_adys <>", value, "followWindowAdys");
return (Criteria) this;
}
public Criteria andFollowWindowAdysGreaterThan(Integer value) {
addCriterion("follow_window_adys >", value, "followWindowAdys");
return (Criteria) this;
}
public Criteria andFollowWindowAdysGreaterThanOrEqualTo(Integer value) {
addCriterion("follow_window_adys >=", value, "followWindowAdys");
return (Criteria) this;
}
public Criteria andFollowWindowAdysLessThan(Integer value) {
addCriterion("follow_window_adys <", value, "followWindowAdys");
return (Criteria) this;
}
public Criteria andFollowWindowAdysLessThanOrEqualTo(Integer value) {
addCriterion("follow_window_adys <=", value, "followWindowAdys");
return (Criteria) this;
}
public Criteria andFollowWindowAdysIn(List<Integer> values) {
addCriterion("follow_window_adys in", values, "followWindowAdys");
return (Criteria) this;
}
public Criteria andFollowWindowAdysNotIn(List<Integer> values) {
addCriterion("follow_window_adys not in", values, "followWindowAdys");
return (Criteria) this;
}
public Criteria andFollowWindowAdysBetween(Integer value1, Integer value2) {
addCriterion("follow_window_adys between", value1, value2, "followWindowAdys");
return (Criteria) this;
}
public Criteria andFollowWindowAdysNotBetween(Integer value1, Integer value2) {
addCriterion("follow_window_adys not between", value1, value2, "followWindowAdys");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

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

@ -6,6 +6,7 @@ import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -18,7 +19,7 @@ import java.util.List;
public class FmsFollowupVo {
@Data
public static class QueueResult{
public static class QueueResult {
@ApiModelProperty("")
private Long id;
@ApiModelProperty("队列名称")
@ -57,6 +58,11 @@ public class FmsFollowupVo {
private String updateBy;
private Date updateTime;
private String remark;
@ApiModelProperty("随访窗口期")
private Integer followWindowAdys;
@ApiModelProperty("临近提醒时间")
private Integer remindTime;
}
// FollowupTaskVO.java
@ -69,6 +75,8 @@ public class FmsFollowupVo {
private String ethnicity;
private Integer times;
private Integer educationYears;
private String phone;
@ -101,14 +109,45 @@ public class FmsFollowupVo {
private String updateBy;
private Date updateTime;
private String remark;
private String queueName;
private String tenantName;
@ApiModelProperty("随访窗口期")
private Integer followWindowAdys;
@ApiModelProperty("临近提醒时间")
private Integer remindTime;
public Integer getStatus() {
//随访状态(0待随访, 1已随访, 2失访(手动标记)) 超期根据时间判断 超期已随访
if (status == 0) {
//待随访 判断是否超期 如当前>结束时间,则超期
if (endTime != null && endTime.compareTo(new Date()) < 0) {
//超期
return 4;
}
if (startTime != null) {
//判断是否临近随访时间 开始时间 + 临近提醒时间 < 当前时间
Calendar instance = Calendar.getInstance();
instance.setTime(startTime);
instance.set(Calendar.DAY_OF_MONTH, remindTime);
if (instance.getTime().compareTo(new Date()) < 0) {
return 3;
}
}
}else {
//超期已随访
if (endTime != null && endTime.compareTo(new Date()) < 0) {
return 5;
}
}
return status;
}
}
@Data
public static class FollowupPatient{
public static class FollowupPatient {
private Long id;
private Long queueId;
@ -142,13 +181,17 @@ public class FmsFollowupVo {
private String createBy;
private Date createTime;
@ApiModelProperty("随访窗口期")
private Integer followWindowAdys;
@ApiModelProperty("临近提醒时间")
private Integer remindTime;
public Long getPatientId() {
return id;
}
@Data
public static class QueueVo{
public static class QueueVo {
private Long queueId;
private String queueName;
}

3
acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java

@ -35,7 +35,8 @@ public interface FmsFollowupDao {
@Param("status") Byte status);
List<FmsFollowupVo.FollowupPatient> queryPatient(@Param("id") Long id,
@Param("taskFlag") Byte taskFlag);
@Param("taskFlag") Byte taskFlag,
@Param("haveQueue")Integer haveQueue);
/**
* 查询随访任务

2
acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupService.java

@ -73,6 +73,6 @@ public interface FmsFollowupService {
*/
void completeFollowup(FmsFollowupDto.FollowupCompleteDTO dto);
void updStatus(Long id, Byte status);
}

11
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupQueueServiceImpl.java

@ -30,14 +30,15 @@ public class FmsFollowupQueueServiceImpl implements FmsFollowupQueueService {
@Override
@DataSource(DataSourceType.MASTER)
public List<FmsFollowupVo.FollowupQueueVO> queryCommonQueue(String name) {
List<Object> cacheList =redisCache.getCacheList(COMMON_FOLLOWUP_QUEUE);
if (CollectionUtil.isEmpty(cacheList)) {
// List<Object> cacheList =redisCache.getCacheList(COMMON_FOLLOWUP_QUEUE);
// if (CollectionUtil.isEmpty(cacheList)) {
redisCache.deleteObject(COMMON_FOLLOWUP_QUEUE);
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS = fmsFollowupDao.queryCommonQueue(name);
redisCache.setCacheList(COMMON_FOLLOWUP_QUEUE, followupQueueVOS);
return followupQueueVOS;
}else {
return BeanUtil.copyToList(cacheList, FmsFollowupVo.FollowupQueueVO.class);
}
// }else {
// return BeanUtil.copyToList(cacheList, FmsFollowupVo.FollowupQueueVO.class);
// }
}
}

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

@ -44,6 +44,8 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper;
@Resource
private RedisCache redisCache;
@Resource
private FmsFollowupTaskMapper fmsFollowupTaskMapper;
@Override
public List<FmsFollowupVo.FollowupQueueVO> queryQueue(FmsFollowupDto.FollowupQueueQueryDTO dto) {
@ -79,7 +81,7 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
@Override
public List<FmsFollowupVo.FollowupPatient> queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) {
List<FmsFollowupVo.FollowupPatient> followupPatients = fmsFollowupDao.queryPatient(dto.getId(), null);
List<FmsFollowupVo.FollowupPatient> followupPatients = fmsFollowupDao.queryPatient(dto.getQueueId(), null, dto.getHaveQueue());
if (CollectionUtil.isNotEmpty(followupPatients)) {
List<Object> commonFollowupQueue = redisCache.getCacheList("common_followup_queue");
for (FmsFollowupVo.FollowupPatient followupPatient : followupPatients) {
@ -95,6 +97,9 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity()));
}
for (FmsFollowupVo.FollowupPatient.QueueVo queueVo : queueVoList) {
if (queueVo == null || queueVo.getQueueId() == null) {
continue;
}
FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId());
if (followupQueueVO != null) {
queueVo.setQueueName(followupQueueVO.getName());
@ -169,4 +174,14 @@ public class FmsFollowupServiceImpl implements FmsFollowupService {
public void completeFollowup(FmsFollowupDto.FollowupCompleteDTO dto) {
fmsFollowupDao.completeFollowup(dto);
}
@Override
public void updStatus(Long id, Byte status) {
FmsFollowupTask fmsFollowupTask = fmsFollowupTaskMapper.selectByPrimaryKey(id);
if (fmsFollowupTask != null) {
fmsFollowupTask.setStatus(status);
fmsFollowupTask.setUpdateBy(SecurityUtils.getUsername());
fmsFollowupTaskMapper.updateByPrimaryKeySelective(fmsFollowupTask);
}
}
}

12
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java

@ -54,6 +54,18 @@ public class PmsPatientServiceImpl implements PmsPatientService {
@Override
public Long add(PmsPatientDto.PatientAdd dto) {
PmsPatientExample pmsPatientExample = new PmsPatientExample();
pmsPatientExample.createCriteria().andDelFlagEqualTo((byte)0).andIdCardEqualTo(dto.getIdCard()).andIdCardTypeEqualTo(dto.getIdCardType());
List<PmsPatient> pmsPatients = pmsPatientMapper.selectByExample(pmsPatientExample);
if (CollectionUtil.isNotEmpty(pmsPatients)) {
PmsPatient pmsPatient = BeanUtil.copyProperties(dto, PmsPatient.class);
pmsPatient.setUpdateBy(SecurityUtils.getUsername());
pmsPatient.setUpdateTime(new Date());
pmsPatient.setPinyinFull(PinyinUtil.getPinyin(dto.getName(), ""));
pmsPatient.setPinyinSimple(PinyinUtil.getFirstLetter(dto.getName(), ""));
pmsPatientMapper.updateByPrimaryKeySelective(pmsPatient);
return pmsPatient.getId();
}
PmsPatient pmsPatient = BeanUtil.copyProperties(dto, PmsPatient.class);
pmsPatient.setId(IdUtil.getSnowflakeNextId());
pmsPatient.setPinyinFull(PinyinUtil.getPinyin(dto.getName(), ""));

91
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java

@ -37,10 +37,7 @@ import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -95,6 +92,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
pmsTreatment.setPinyinFull(PinyinUtil.getPinyin(pmsTreatment.getName(), ""));
pmsTreatment.setPinyinSimple(PinyinUtil.getFirstLetter(pmsTreatment.getName(), ""));
pmsTreatment.setId(IdUtil.getSnowflakeNextId());
pmsTreatment.setTenantId(SecurityUtils.getTenantId());
pmsTreatment.setDelFlag((byte) 0);
pmsTreatment.setCreateBy(SecurityUtils.getUsername());
pmsTreatment.setCreateTime(new Date());
@ -106,12 +104,26 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class);
patientQueueRelation.setId(IdUtil.getSnowflakeNextId());
patientQueueRelation.setDelFlag((byte) 0);
patientQueueRelation.setIdCard(dto.getIdCard());
patientQueueRelation.setIdCardType(dto.getIdCardType().byteValue());
patientQueueRelation.setCreateBy(SecurityUtils.getUsername());
patientQueueRelation.setPatientId(patientId);
patientQueueRelation.setQueueId(queueId);
patientQueueRelation.setCreateTime(new Date());
fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation);
}
}else {
FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class);
patientQueueRelation.setId(IdUtil.getSnowflakeNextId());
patientQueueRelation.setDelFlag((byte) 0);
patientQueueRelation.setCreateBy(SecurityUtils.getUsername());
patientQueueRelation.setTenantId(SecurityUtils.getTenantId());
patientQueueRelation.setIdCard(dto.getIdCard());
patientQueueRelation.setIdCardType(dto.getIdCardType().byteValue());
patientQueueRelation.setPatientId(patientId);
patientQueueRelation.setQueueId(null);
patientQueueRelation.setCreateTime(new Date());
fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation);
}
}
@ -141,6 +153,16 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
patientQueueRelation.setId(IdUtil.getSnowflakeNextId());
fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation);
}
}else {
FmsPatientQueueRelation patientQueueRelation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class);
patientQueueRelation.setId(IdUtil.getSnowflakeNextId());
patientQueueRelation.setDelFlag((byte) 0);
patientQueueRelation.setCreateBy(SecurityUtils.getUsername());
patientQueueRelation.setPatientId(pmsTreatment.getPatientId());
patientQueueRelation.setTenantId(pmsTreatment.getTenantId());
patientQueueRelation.setQueueId(null);
patientQueueRelation.setCreateTime(new Date());
fmsPatientQueueRelationMapper.insertSelective(patientQueueRelation);
}
}
@ -165,7 +187,10 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
pmsTreatmentRecordExample.createCriteria().andDelFlagEqualTo((byte) 0).andQuestionCodeEqualTo("JBXX_ZYZD").andTreatmentIdEqualTo(treatmentVO.getId());
List<PmsTreatmentRecord> pmsTreatmentRecords = pmsTreatmentRecordMapper.selectByExample(pmsTreatmentRecordExample);
if (CollectionUtil.isNotEmpty(pmsTreatmentRecords)) {
treatmentVO.setDiagnosisName(pmsTreatmentRecords.stream().map(PmsTreatmentRecord::getAnswer).collect(Collectors.joining(",")));
String answer = pmsTreatmentRecords.get(0).getAnswer();
if (StrUtil.isNotEmpty(answer)) {
treatmentVO.setDiagnosisName(answer.replace("!@#", ","));
}
}
List<PmsTreatmentVo.TreatmentVO.QueueVo> queueVos = fmsFollowupDao.queryQueueListByPatientId(treatmentVO.getPatientId());
if (CollectionUtil.isNotEmpty(queueVos)) {
@ -174,14 +199,20 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
List<FmsFollowupVo.FollowupQueueVO> followupQueueVOS1 = BeanUtil.copyToList(commonFollowupQueue, FmsFollowupVo.FollowupQueueVO.class);
map = followupQueueVOS1.stream().collect(Collectors.toMap(FmsFollowupVo.FollowupQueueVO::getId, Function.identity()));
}
List<PmsTreatmentVo.TreatmentVO.QueueVo> list = new ArrayList<>();
for (PmsTreatmentVo.TreatmentVO.QueueVo queueVo : queueVos) {
if (queueVo == null || queueVo.getQueueId() == null) {
list.add(queueVo);
continue;
}
FmsFollowupVo.FollowupQueueVO followupQueueVO = map.get(queueVo.getQueueId());
if (followupQueueVO != null) {
queueVo.setQueueName(followupQueueVO.getName());
}
}
queueVos.removeAll(list);
}
treatmentVO.setQueueVoList(queueVos);
treatmentVO.setQueueVoList(CollectionUtil.isEmpty(queueVos) ? CollectionUtil.newArrayList() : queueVos);
}
}
return query;
@ -278,33 +309,38 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
int row = 0;
for (int i = 0; i < treatmentVOList.size(); i++) {
row += 1;
// 建档时间 患者姓名 性别 年龄 民族 受教育程度 手机号码 证件类型(0身份证;1护照或外国人永居证; 2港澳居民来往内地通行; 3台湾居民来往大陆通行证; 4其他;) 证件号码 门诊/住院 门诊号/住院号 门诊时间/住院时间 出院时间 责任医生 建档人
writer.writeCellValue(0, row, DateUtil.format(treatmentVOList.get(i).getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
writer.writeCellValue(1, row, treatmentVOList.get(i).getName());
writer.writeCellValue(2, row, treatmentVOList.get(i).getGender() == null ? "未知" : treatmentVOList.get(i).getGender() == 0 ? "男" : "女");
writer.writeCellValue(3, row, treatmentVOList.get(i).getAge());
writer.writeCellValue(4, row, treatmentVOList.get(i).getEthnicity());
writer.writeCellValue(5, row, treatmentVOList.get(i).getEducationYears());
writer.writeCellValue(6, row, treatmentVOList.get(i).getPhone());
Integer idCardType = treatmentVOList.get(i).getIdCardType();
if (idCardType != null) {
switch (idCardType) {
case 0:
writer.writeCellValue(4, row, "身份证");
writer.writeCellValue(7, row, "身份证");
break;
case 1:
writer.writeCellValue(4, row, "护照或外国人永居证");
writer.writeCellValue(7, row, "护照或外国人永居证");
break;
case 2:
writer.writeCellValue(4, row, "港澳居民来往内地通行证");
writer.writeCellValue(7, row, "港澳居民来往内地通行证");
break;
case 3:
writer.writeCellValue(4, row, "其他");
writer.writeCellValue(7, row, "其他");
}
}
writer.writeCellValue(5, row, treatmentVOList.get(i).getIdCard());
writer.writeCellValue(6, row, treatmentVOList.get(i).getVisitType() == 0 ? "门诊" : "住院");
writer.writeCellValue(7, row, treatmentVOList.get(i).getVisitNumber());
writer.writeCellValue(8, row, DateUtil.format(treatmentVOList.get(i).getVisitTime(), "yyyy-MM-dd HH:mm:ss"));
writer.writeCellValue(9, row, treatmentVOList.get(i).getDischargeTime());
writer.writeCellValue(10, row, treatmentVOList.get(i).getDoctor());
writer.writeCellValue(12, row, treatmentVOList.get(i).getCreateBy());
writer.writeCellValue(8, row, treatmentVOList.get(i).getIdCard());
writer.writeCellValue(9, row, treatmentVOList.get(i).getVisitType() == 0 ? "门诊" : "住院");
writer.writeCellValue(9, row, treatmentVOList.get(i).getVisitNumber());
writer.writeCellValue(10, row, DateUtil.format(treatmentVOList.get(i).getVisitTime(), "yyyy-MM-dd HH:mm:ss"));
writer.writeCellValue(12, row, DateUtil.format(treatmentVOList.get(i).getDischargeTime(), "yyyy-MM-dd HH:mm:ss"));
writer.writeCellValue(13, row, treatmentVOList.get(i).getDoctor());
writer.writeCellValue(14, row, treatmentVOList.get(i).getCreateBy());
}
String filename = StrUtil.format("患者档案-{}.xlsx", DateUtil.date().toString("yyyyMMdd"));
@ -332,7 +368,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
//读取excel
List<PmsPatient> pmsPatientList = CollectionUtil.newArrayList();
ExcelUtil.readBySax(file.getInputStream(), 0, (sheetIndex, rowIndex, rowList) -> {
//患者姓名 性别 年龄 证件类型(0身份证;1护照或外国人永居证; 2港澳居民来往内地通行; 3台湾居民来往大陆通行证; 4其他;) 证件号码 门诊/住院 门诊号/住院号 门诊时间/住院时间 出院时间 责任医生 主要诊断 建档人 建档时间 档案状态
// 建档时间 患者姓名 性别 年龄 民族 受教育程度 手机号码 证件类型(0身份证;1护照或外国人永居证; 2港澳居民来往内地通行; 3台湾居民来往大陆通行证; 4其他;) 证件号码 门诊/住院 门诊号/住院号 门诊时间/住院时间 出院时间 责任医生 建档人
try {
if (rowIndex < 1) {
return;
@ -340,17 +376,22 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
PmsTreatmentDto.TreatmentAdd dto = new PmsTreatmentDto.TreatmentAdd();
dto.setName(rowList.get(1).toString());
dto.setGender(rowList.get(2).toString().trim().equals("男") ? 0 : 1);
String idcard = rowList.get(5).toString();
dto.setAge(Integer.parseInt(rowList.get(3).toString()));
dto.setEthnicity(rowList.get(4).toString());
dto.setEducationYears(Integer.parseInt(rowList.get(5).toString()));
dto.setPhone(rowList.get(6).toString());
String idcard = rowList.get(8).toString();
if (StrUtil.isNotEmpty(idcard) && IdcardUtil.isValidCard(idcard)) {
dto.setBirthDate(IdcardUtil.getBirthDate(idcard));
}
dto.setIdCardType(rowList.get(4).toString().trim().equals("身份证") ? 0 : rowList.get(7).toString().trim().equals("护照或外国人永居证") ? 1 : rowList.get(7).toString().trim().equals("港澳居民来往内地通行证") ? 2 : rowList.get(7).toString().trim().equals("台湾居民来往大陆通行证") ? 3 : 4);
dto.setIdCardType(rowList.get(7).toString().trim().equals("身份证") ? 0 : rowList.get(7).toString().trim().equals("护照或外国人永居证") ? 1 : rowList.get(7).toString().trim().equals("港澳居民来往内地通行证") ? 2 : rowList.get(7).toString().trim().equals("台湾居民来往大陆通行证") ? 3 : 4);
dto.setIdCard(idcard);
dto.setVisitType(rowList.get(6).toString().trim().equals("门诊") ? 0 : 1);
dto.setVisitNumber(rowList.get(7).toString());
dto.setVisitTime(DateUtil.parse(rowList.get(8).toString()));
dto.setDischargeTime(DateUtil.parse(rowList.get(9).toString()));
dto.setDoctor(rowList.get(10).toString());
dto.setVisitType(rowList.get(9).toString().trim().equals("门诊") ? 0 : 1);
dto.setVisitNumber(rowList.get(10).toString());
dto.setVisitTime(DateUtil.parse(rowList.get(11).toString()));
dto.setDischargeTime(DateUtil.parse(rowList.get(12).toString()));
dto.setDoctor(rowList.get(13).toString());
dto.setCreateBy(SecurityUtils.getUsername());
dto.setStatus(0);
dto.setCreateBy(SecurityUtils.getUsername());

24
acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml

@ -17,6 +17,8 @@
from
fms_followup_queue
<where>
del_flag = 0
and status = 1
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
@ -33,6 +35,8 @@
person_in_charge as personInCharge,
person_in_charge_username as personInChargeUsername,
status,
follow_window_adys as followWindowAdys,
remind_time remindTime,
create_by as createBy,
create_time as createTime
FROM fms_followup_queue
@ -88,25 +92,32 @@
r.tenant_id as tenantId,
r.create_by as createBy,
r.create_time as createTime,
q.name as queueName
q.name as queueName,
q.remind_time as remindTime,
q.follow_window_adys as followWindowAdys
FROM fms_patient_queue_relation r
left join
fms_followup_queue q
on r.queue_id = q.id or q.id is null
WHERE r.del_flag = 0
<if test="haveQueue != null">
AND r.queue_id is null
</if>
<if test="id != null">
AND r.queue_id = #{id}
</if>
<if test="taskFlag != null">
AND r.task_flag = #{taskFlag}
</if>
group by r.id_card, r.tenant_id
group by r.patient_id, r.tenant_id
order by r.create_time desc
</select>
<select id="selectTaskList" resultType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupTaskVO"
parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupTaskQueryDTO">
SELECT
t.patient_id as id,
t.id as id,
t.patient_id as patientId,
t.name,
t.gender,
t.age,
@ -129,9 +140,11 @@
t.create_time as createTime,
q.name as queueName,
d.name as tenantName,
t.lost_reason as lostReason,
t.lost_reason as reason,
t.start_time as startTime,
t.end_time as endTime
t.end_time as endTime,
q.remind_time as remindTime,
q.follow_window_adys as followWindowAdys
FROM fms_followup_task t
left join
fms_followup_queue q
@ -158,6 +171,7 @@
AND t.age &lt;= #{dto.endAge}
</if>
</where>
order by t.update_time DESC
</select>
<update id="updateStatusToLost" parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupLostDTO">

4
acupuncture-system/src/main/resources/mapper/dao/StatisticsDao.xml

@ -10,6 +10,7 @@
FROM
pms_patient
<where>
del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
@ -27,6 +28,7 @@
FROM
pms_treatment
<where>
del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
@ -74,6 +76,7 @@
FROM
pms_patient
<where>
del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
@ -96,6 +99,7 @@
FROM
pms_patient
<where>
del_flag = 0
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>

52
acupuncture-system/src/main/resources/mapper/system/FmsFollowupQueueMapper.xml

@ -11,6 +11,7 @@
<result column="person_in_charge" jdbcType="VARCHAR" property="personInCharge" />
<result column="person_in_charge_username" jdbcType="VARCHAR" property="personInChargeUsername" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="remind_time" jdbcType="INTEGER" property="remindTime" />
<result column="del_flag" jdbcType="TINYINT" property="delFlag" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
@ -18,6 +19,7 @@
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="follow_window_adys" jdbcType="INTEGER" property="followWindowAdys" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -79,8 +81,8 @@
</sql>
<sql id="Base_Column_List">
id, name, followup_method, followup_type, frequency, followup_month, person_in_charge,
person_in_charge_username, status, del_flag, tenant_id, create_by, create_time, update_by,
update_time, remark
person_in_charge_username, status, remind_time, del_flag, tenant_id, create_by, create_time,
update_by, update_time, remark, follow_window_adys
</sql>
<select id="selectByExample" parameterType="com.acupuncture.system.domain.po.FmsFollowupQueueExample" resultMap="BaseResultMap">
select
@ -110,15 +112,17 @@
insert into fms_followup_queue (id, name, followup_method,
followup_type, frequency, followup_month,
person_in_charge, person_in_charge_username,
status, del_flag, tenant_id,
create_by, create_time, update_by,
update_time, remark)
status, remind_time, del_flag,
tenant_id, create_by, create_time,
update_by, update_time, remark,
follow_window_adys)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{followupMethod,jdbcType=TINYINT},
#{followupType,jdbcType=TINYINT}, #{frequency,jdbcType=VARCHAR}, #{followupMonth,jdbcType=INTEGER},
#{personInCharge,jdbcType=VARCHAR}, #{personInChargeUsername,jdbcType=VARCHAR},
#{status,jdbcType=TINYINT}, #{delFlag,jdbcType=TINYINT}, #{tenantId,jdbcType=BIGINT},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR})
#{status,jdbcType=TINYINT}, #{remindTime,jdbcType=INTEGER}, #{delFlag,jdbcType=TINYINT},
#{tenantId,jdbcType=BIGINT}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR},
#{followWindowAdys,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.acupuncture.system.domain.po.FmsFollowupQueue">
insert into fms_followup_queue
@ -150,6 +154,9 @@
<if test="status != null">
status,
</if>
<if test="remindTime != null">
remind_time,
</if>
<if test="delFlag != null">
del_flag,
</if>
@ -171,6 +178,9 @@
<if test="remark != null">
remark,
</if>
<if test="followWindowAdys != null">
follow_window_adys,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -200,6 +210,9 @@
<if test="status != null">
#{status,jdbcType=TINYINT},
</if>
<if test="remindTime != null">
#{remindTime,jdbcType=INTEGER},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=TINYINT},
</if>
@ -221,6 +234,9 @@
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="followWindowAdys != null">
#{followWindowAdys,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.acupuncture.system.domain.po.FmsFollowupQueueExample" resultType="java.lang.Long">
@ -259,6 +275,9 @@
<if test="record.status != null">
status = #{record.status,jdbcType=TINYINT},
</if>
<if test="record.remindTime != null">
remind_time = #{record.remindTime,jdbcType=INTEGER},
</if>
<if test="record.delFlag != null">
del_flag = #{record.delFlag,jdbcType=TINYINT},
</if>
@ -280,6 +299,9 @@
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.followWindowAdys != null">
follow_window_adys = #{record.followWindowAdys,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -296,13 +318,15 @@
person_in_charge = #{record.personInCharge,jdbcType=VARCHAR},
person_in_charge_username = #{record.personInChargeUsername,jdbcType=VARCHAR},
status = #{record.status,jdbcType=TINYINT},
remind_time = #{record.remindTime,jdbcType=INTEGER},
del_flag = #{record.delFlag,jdbcType=TINYINT},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_by = #{record.updateBy,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
remark = #{record.remark,jdbcType=VARCHAR}
remark = #{record.remark,jdbcType=VARCHAR},
follow_window_adys = #{record.followWindowAdys,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -334,6 +358,9 @@
<if test="status != null">
status = #{status,jdbcType=TINYINT},
</if>
<if test="remindTime != null">
remind_time = #{remindTime,jdbcType=INTEGER},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=TINYINT},
</if>
@ -355,6 +382,9 @@
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="followWindowAdys != null">
follow_window_adys = #{followWindowAdys,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -368,13 +398,15 @@
person_in_charge = #{personInCharge,jdbcType=VARCHAR},
person_in_charge_username = #{personInChargeUsername,jdbcType=VARCHAR},
status = #{status,jdbcType=TINYINT},
remind_time = #{remindTime,jdbcType=INTEGER},
del_flag = #{delFlag,jdbcType=TINYINT},
tenant_id = #{tenantId,jdbcType=BIGINT},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
remark = #{remark,jdbcType=VARCHAR}
remark = #{remark,jdbcType=VARCHAR},
follow_window_adys = #{followWindowAdys,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
Loading…
Cancel
Save