Browse Source

完成

newMaster
zzc 5 months ago
parent
commit
38e60663f6
  1. 2
      acupuncture-admin/src/main/java/com/acupuncture/AcupunctureApplication.java
  2. 25
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/FmsFollowupController.java
  3. 2
      acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/StatisticsController.java
  4. 75
      acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java
  5. 6
      acupuncture-admin/src/main/resources/application-stage.yml
  6. 20
      acupuncture-generator/src/main/resources/mbg.xml
  7. 90
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/FmsFollowupDto.java
  8. 8
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsPatientDto.java
  9. 12
      acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsTreatmentDto.java
  10. 11
      acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelation.java
  11. 60
      acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelationExample.java
  12. 11
      acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatient.java
  13. 70
      acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatientExample.java
  14. 35
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/FmsFollowupVo.java
  15. 5
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsPatientVo.java
  16. 1
      acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java
  17. 9
      acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/FmsFollowupDao.java
  18. 28
      acupuncture-system/src/main/java/com/acupuncture/system/service/FmsFollowupService.java
  19. 15
      acupuncture-system/src/main/java/com/acupuncture/system/service/TaskService.java
  20. 80
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/FmsFollowupServiceImpl.java
  21. 4
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsPatientServiceImpl.java
  22. 13
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java
  23. 120
      acupuncture-system/src/main/java/com/acupuncture/system/service/impl/TaskServiceImpl.java
  24. 104
      acupuncture-system/src/main/resources/mapper/dao/FmsFollowupDao.xml
  25. 57
      acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml
  26. 27
      acupuncture-system/src/main/resources/mapper/system/FmsPatientQueueRelationMapper.xml
  27. 33
      acupuncture-system/src/main/resources/mapper/system/PmsPatientMapper.xml

2
acupuncture-admin/src/main/java/com/acupuncture/AcupunctureApplication.java

@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* 启动程序
@ -12,6 +13,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
*/
@MapperScan({"com.acupuncture.**.mapper", "com.acupuncture.**.dao"})
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableScheduling
public class AcupunctureApplication
{
public static void main(String[] args)

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

@ -16,7 +16,6 @@ import com.acupuncture.system.persist.dao.UmsDataSourceDao;
import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper;
import com.acupuncture.system.service.FmsFollowupQueueService;
import com.acupuncture.system.service.FmsFollowupService;
import com.acupuncture.system.service.TaskService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
@ -72,6 +71,24 @@ public class FmsFollowupController {
return JsonResponse.ok(new PageInfo<>(fmsFollowupService.queryQueue(dto.getParam())));
}
@ApiOperation("添加随访队列")
@PostMapping("/add")
public JsonResponse<Integer> addQueue(@RequestBody @Validated FmsFollowupDto.Add dto){
return JsonResponse.ok(fmsFollowupService.addQueue(dto));
}
@ApiOperation("更新随访队列")
@PostMapping("/upd")
public JsonResponse<Integer> updQueue(@RequestBody @Validated FmsFollowupDto.Upd dto){
return JsonResponse.ok(fmsFollowupService.updQueue(dto));
}
@ApiOperation("删除随访队列")
@PostMapping("/del")
public JsonResponse<Integer> delQueue(@RequestBody @Validated FmsFollowupDto.Del dto){
return JsonResponse.ok(fmsFollowupService.delQueue(dto));
}
@ApiOperation("查询随访患者")
@PostMapping("/queryPatient")
public JsonResponse<PageInfo<FmsFollowupVo.FollowupPatient>> queryPatient(@RequestBody @Validated BaseDto<FmsFollowupDto.FollowupPatientQueryDTO> dto) {
@ -81,6 +98,12 @@ public class FmsFollowupController {
return JsonResponse.ok(new PageInfo<>(fmsFollowupService.queryPatient(dto.getParam())));
}
@ApiOperation("修改随访患者")
@PostMapping("/updPatient")
public JsonResponse<Integer> updPatient(@RequestBody @Validated FmsFollowupDto.UpdPatient dto){
return JsonResponse.ok(fmsFollowupService.updPatient(dto));
}
@ApiOperation("查询随访任务")
@PostMapping("/queryTask")
public JsonResponse<PageInfo<FmsFollowupVo.FollowupTaskVO>> queryTask(@RequestBody @Validated BaseDto<FmsFollowupDto.FollowupTaskQueryDTO> dto) {

2
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/StatisticsController.java

@ -25,7 +25,7 @@ import java.util.List;
@Slf4j
@Api(tags = "统计相关")
@RestController
@RequestMapping("/statistic")
@RequestMapping("/statistics")
public class StatisticsController {
@Resource

75
acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/TaskController.java → acupuncture-admin/src/main/java/com/acupuncture/web/task/TaskController.java

@ -1,20 +1,27 @@
package com.acupuncture.web.controller.web;
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;
@ -35,6 +42,7 @@ import java.util.List;
@Api(tags = "定时任务相关")
@RestController
@RequestMapping("/task")
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class TaskController {
@Resource
@ -43,26 +51,35 @@ public class TaskController {
private FmsFollowupTaskMapper fmsFollowupTaskMapper;
@Resource
private UmsDataSourceDao umsDataSourceDao;
@Resource
private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper;
@ApiOperation("定时任务添加随访工单")
@PostMapping("/task")
@Scheduled(fixedRate = 10000)
@Anonymous
public void task() {
//查询租户,根据租户循环切换数据源,定时处理所有医院的随访工单
// 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);
//查询公共队列
changeDataSource(result);
List<FmsFollowupVo.FollowupQueueVO> queueResults = fmsFollowupDao.queryCommonQueue(null);
List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null, null, null);
if (CollectionUtil.isEmpty(queueList)) {
queueList = queueResults;
} else {
@ -70,18 +87,17 @@ public class TaskController {
}
for (FmsFollowupVo.FollowupQueueVO followupQueueVO : queueList) {
//2. 查询队列随访患者列表
changeDataSource(result);
List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId());
List<FmsFollowupVo.FollowupPatient> patientList = fmsFollowupDao.queryPatient(followupQueueVO.getId(), (byte) 0);
if (CollectionUtil.isEmpty(patientList)) {
continue;
}
//随访总月数
Integer followupMethod = followupQueueVO.getFollowupMethod();
Integer followupMonth = followupQueueVO.getFollowupMonth();
for (FmsFollowupVo.FollowupPatient followupPatient : patientList) {
//获取随访到期时间 出院时间+随访总月数 = 到期时间
Calendar calendar = Calendar.getInstance();
calendar.setTime(followupPatient.getDischargeTime());
calendar.set(Calendar.MONTH, followupMethod);
calendar.set(Calendar.MONTH, followupMonth);
Date time = calendar.getTime();
//获取队列信息
@ -104,8 +120,23 @@ public class TaskController {
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);
@ -119,14 +150,32 @@ 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);
@ -137,6 +186,12 @@ public class TaskController {
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
}
}
changeDataSource(result);
//将患者设置为已生成工单
FmsPatientQueueRelation fmsPatientQueueRelation = BeanUtil.copyProperties(followupPatient, FmsPatientQueueRelation.class);
fmsPatientQueueRelation.setTaskFlag((byte) 1);
fmsPatientQueueRelation.setPatientId(followupPatient.getId());
fmsPatientQueueRelationMapper.updateByPrimaryKeySelective(fmsPatientQueueRelation);
}
}

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

@ -13,9 +13,9 @@ spring:
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
url: jdbc:mysql://localhost:3306/acupuncture_yfyy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: q7510327
# 初始连接数
initialSize: 5
# 最小连接池数量

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

@ -57,17 +57,17 @@
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<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_task" domainObjectName="FmsFollowupTask" enableDeleteByExample="false"/>
<!-- <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_task" domainObjectName="FmsFollowupTask" 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"/>
<table tableName="rms_report_type" domainObjectName="RmsReportType" enableDeleteByExample="false"/>
<table tableName="rms_report_management" domainObjectName="RmsReportManagement" enableDeleteByExample="false"/>
<table tableName="ums_data_source" domainObjectName="UmsDataSource" 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"/>-->
<!-- <table tableName="rms_report_type" domainObjectName="RmsReportType" enableDeleteByExample="false"/>-->
<!-- <table tableName="rms_report_management" domainObjectName="RmsReportManagement" enableDeleteByExample="false"/>-->
<!-- <table tableName="ums_data_source" domainObjectName="UmsDataSource" enableDeleteByExample="false"/>-->
<!-- 有些表的字段需要指定java类型
<table schema="" tableName="">

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

@ -1,10 +1,13 @@
package com.acupuncture.system.domain.dto;
import com.acupuncture.system.domain.po.FmsFollowupQueue;
import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* @Author zzc
@ -19,14 +22,93 @@ public class FmsFollowupDto {
@ApiModelProperty("队列名称")
private String name;
}
@Data
public static class Add{
private Long id;
private String name;
private Byte followupMethod;
private Byte followupType;
private String frequency;
private Integer followupMonth;
private String personInCharge;
private String personInChargeUsername;
private Byte status;
}
@Data
public static class Upd{
private Long id;
private String name;
private Byte followupMethod;
private Byte followupType;
private String frequency;
private Integer followupMonth;
private String personInCharge;
private String personInChargeUsername;
private Byte status;
}
@Data
public static class Del{
@NotNull
private List<Long> idList;
}
@Data
public static class FollowupQueueQueryDTO {
private Long id;
private String name;
private Byte status;
}
@Data
public static class UpdPatient{
private Long id;
private String name;
private String pinyinFull;
private String pinyinSimple;
private Byte gender;
private Date birthDate;
private String ethnicity;
private Integer educationYears;
private String phone;
private Byte idCardType;
private String idCard;
private Long tenantId;
private Long patientId;
private List<Long> queueIdList;
}
@Data
public static class FollowupPatientQueryDTO {
@NotNull(message = "队列ID不能为空")
// @NotNull(message = "队列ID不能为空")
private Long id;
}
@ -43,8 +125,7 @@ public class FmsFollowupDto {
// FollowupLostDTO.java
@Data
public static class FollowupLostDTO {
private Long patientId;
private Long queueId;
private Long id;
private Integer times;
private String reason;
}
@ -52,8 +133,7 @@ public class FmsFollowupDto {
// FollowupCompleteDTO.java
@Data
public static class FollowupCompleteDTO {
private Long patientId;
private Long queueId;
private Long id;
private Integer times;
private String followuper;
private Date followupTime;

8
acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/PmsPatientDto.java

@ -1,5 +1,6 @@
package com.acupuncture.system.domain.dto;
import cn.hutool.core.collection.CollectionUtil;
import com.acupuncture.system.domain.po.PmsPatient;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
@ -60,8 +61,11 @@ public class PmsPatientDto {
private Byte source;
private List<String> currentIllnessHistory;
private String currentIllnessHistoryQt;
public String getCurrentIllnessHistory() {
if (CollectionUtil.isEmpty(currentIllnessHistory)) {
return null;
}
return currentIllnessHistory.stream().collect(Collectors.joining(","));
}
}
@ -89,7 +93,7 @@ public class PmsPatientDto {
private Byte source;
private List<String> currentIllnessHistory;
private String currentIllnessHistoryQt;
public String getCurrentIllnessHistory() {
return currentIllnessHistory.stream().collect(Collectors.joining(","));
}

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

@ -1,6 +1,9 @@
package com.acupuncture.system.domain.dto;
import cn.hutool.Hutool;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.acupuncture.common.constant.UserConstants;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
@ -36,7 +39,9 @@ public class PmsTreatmentDto {
private String idCard;
private Integer visitType;
private String visitNumber;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date visitTime;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dischargeTime;
private String doctor;
private String deptName;
@ -49,6 +54,13 @@ public class PmsTreatmentDto {
@ApiModelProperty("随访队列ID集合")
private List<Long> queueIdList;
public Integer getAge() {
if (birthDate != null) {
return DateUtil.age(birthDate, new Date());
}
return age;
}
}
@Data

11
acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelation.java

@ -40,6 +40,8 @@ public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implemen
private Date dischargeTime;
private Byte taskFlag;
private static final long serialVersionUID = 1L;
public String getName() {
@ -186,6 +188,14 @@ public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implemen
this.dischargeTime = dischargeTime;
}
public Byte getTaskFlag() {
return taskFlag;
}
public void setTaskFlag(Byte taskFlag) {
this.taskFlag = taskFlag;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -210,6 +220,7 @@ public class FmsPatientQueueRelation extends FmsPatientQueueRelationKey implemen
sb.append(", updateTime=").append(updateTime);
sb.append(", remark=").append(remark);
sb.append(", dischargeTime=").append(dischargeTime);
sb.append(", taskFlag=").append(taskFlag);
sb.append("]");
return sb.toString();
}

60
acupuncture-system/src/main/java/com/acupuncture/system/domain/po/FmsPatientQueueRelationExample.java

@ -1421,6 +1421,66 @@ public class FmsPatientQueueRelationExample {
addCriterion("discharge_time not between", value1, value2, "dischargeTime");
return (Criteria) this;
}
public Criteria andTaskFlagIsNull() {
addCriterion("task_flag is null");
return (Criteria) this;
}
public Criteria andTaskFlagIsNotNull() {
addCriterion("task_flag is not null");
return (Criteria) this;
}
public Criteria andTaskFlagEqualTo(Byte value) {
addCriterion("task_flag =", value, "taskFlag");
return (Criteria) this;
}
public Criteria andTaskFlagNotEqualTo(Byte value) {
addCriterion("task_flag <>", value, "taskFlag");
return (Criteria) this;
}
public Criteria andTaskFlagGreaterThan(Byte value) {
addCriterion("task_flag >", value, "taskFlag");
return (Criteria) this;
}
public Criteria andTaskFlagGreaterThanOrEqualTo(Byte value) {
addCriterion("task_flag >=", value, "taskFlag");
return (Criteria) this;
}
public Criteria andTaskFlagLessThan(Byte value) {
addCriterion("task_flag <", value, "taskFlag");
return (Criteria) this;
}
public Criteria andTaskFlagLessThanOrEqualTo(Byte value) {
addCriterion("task_flag <=", value, "taskFlag");
return (Criteria) this;
}
public Criteria andTaskFlagIn(List<Byte> values) {
addCriterion("task_flag in", values, "taskFlag");
return (Criteria) this;
}
public Criteria andTaskFlagNotIn(List<Byte> values) {
addCriterion("task_flag not in", values, "taskFlag");
return (Criteria) this;
}
public Criteria andTaskFlagBetween(Byte value1, Byte value2) {
addCriterion("task_flag between", value1, value2, "taskFlag");
return (Criteria) this;
}
public Criteria andTaskFlagNotBetween(Byte value1, Byte value2) {
addCriterion("task_flag not between", value1, value2, "taskFlag");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

11
acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatient.java

@ -30,6 +30,8 @@ public class PmsPatient implements Serializable {
private String currentIllnessHistory;
private String currentIllnessHistoryQt;
private Byte delFlag;
private Long tenantId;
@ -150,6 +152,14 @@ public class PmsPatient implements Serializable {
this.currentIllnessHistory = currentIllnessHistory == null ? null : currentIllnessHistory.trim();
}
public String getCurrentIllnessHistoryQt() {
return currentIllnessHistoryQt;
}
public void setCurrentIllnessHistoryQt(String currentIllnessHistoryQt) {
this.currentIllnessHistoryQt = currentIllnessHistoryQt == null ? null : currentIllnessHistoryQt.trim();
}
public Byte getDelFlag() {
return delFlag;
}
@ -225,6 +235,7 @@ public class PmsPatient implements Serializable {
sb.append(", idCard=").append(idCard);
sb.append(", source=").append(source);
sb.append(", currentIllnessHistory=").append(currentIllnessHistory);
sb.append(", currentIllnessHistoryQt=").append(currentIllnessHistoryQt);
sb.append(", delFlag=").append(delFlag);
sb.append(", tenantId=").append(tenantId);
sb.append(", createBy=").append(createBy);

70
acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsPatientExample.java

@ -982,6 +982,76 @@ public class PmsPatientExample {
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtIsNull() {
addCriterion("current_illness_history_qt is null");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtIsNotNull() {
addCriterion("current_illness_history_qt is not null");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtEqualTo(String value) {
addCriterion("current_illness_history_qt =", value, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtNotEqualTo(String value) {
addCriterion("current_illness_history_qt <>", value, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtGreaterThan(String value) {
addCriterion("current_illness_history_qt >", value, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtGreaterThanOrEqualTo(String value) {
addCriterion("current_illness_history_qt >=", value, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtLessThan(String value) {
addCriterion("current_illness_history_qt <", value, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtLessThanOrEqualTo(String value) {
addCriterion("current_illness_history_qt <=", value, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtLike(String value) {
addCriterion("current_illness_history_qt like", value, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtNotLike(String value) {
addCriterion("current_illness_history_qt not like", value, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtIn(List<String> values) {
addCriterion("current_illness_history_qt in", values, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtNotIn(List<String> values) {
addCriterion("current_illness_history_qt not in", values, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtBetween(String value1, String value2) {
addCriterion("current_illness_history_qt between", value1, value2, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andCurrentIllnessHistoryQtNotBetween(String value1, String value2) {
addCriterion("current_illness_history_qt not between", value1, value2, "currentIllnessHistoryQt");
return (Criteria) this;
}
public Criteria andDelFlagIsNull() {
addCriterion("del_flag is null");
return (Criteria) this;

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

@ -1,11 +1,13 @@
package com.acupuncture.system.domain.vo;
import com.acupuncture.system.domain.po.FmsFollowupQueue;
import com.acupuncture.system.domain.po.FmsFollowupTask;
import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @Author zzc
@ -61,6 +63,19 @@ public class FmsFollowupVo {
@Data
public static class FollowupTaskVO {
private Long id;
private Byte gender;
private Integer age;
private String ethnicity;
private Integer educationYears;
private String phone;
private Byte idCardType;
private String idCard;
private String name;
private Integer followupMethod;
private Integer followupType;
@ -68,6 +83,14 @@ public class FmsFollowupVo {
private Integer followupMonth;
private String personInCharge;
private String personInChargeUsername;
private String lostReason;
private String followuper;
private Date followupTime;
private String followupText;
private Integer status;
private Long organizationId;
private String createBy;
@ -83,6 +106,8 @@ public class FmsFollowupVo {
private Long queueId;
private List<QueueVo> queueList;
private String name;
private String pinyinFull;
@ -110,5 +135,15 @@ public class FmsFollowupVo {
private String createBy;
private Date createTime;
public Long getPatientId() {
return id;
}
@Data
public static class QueueVo{
private Long queueId;
private String queueName;
}
}
}

5
acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsPatientVo.java

@ -41,14 +41,17 @@ public class PmsPatientVo {
private Integer source;
@ApiModelProperty("现病史,存储格式:[\"高血压\",\"脑血管病\"]")
private String currentIllnessHistory;
private String currentIllnessHistoryQt;
@ApiModelProperty("建档组织(当前登录账号医院ID)")
private Long organizationId;
private Long tenantId;
@ApiModelProperty("创建者")
private String createBy;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("备注")
private String remark;
private String tenantName;
}
}

1
acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java

@ -1,5 +1,6 @@
package com.acupuncture.system.domain.vo;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.acupuncture.common.constant.UserConstants;
import com.acupuncture.system.domain.po.PmsTreatment;

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

@ -29,16 +29,19 @@ public interface FmsFollowupDao {
* @param id
* @return
*/
List<FmsFollowupVo.FollowupQueueVO> selectQueueList(@Param("id") Long id);
List<FmsFollowupVo.FollowupQueueVO> selectQueueList(@Param("id") Long id,
@Param("name") String name,
@Param("status") Byte status);
List<FmsFollowupVo.FollowupPatient> queryPatient(@Param("id") Long id);
List<FmsFollowupVo.FollowupPatient> queryPatient(@Param("id") Long id,
@Param("taskFlag") Byte taskFlag);
/**
* 查询随访任务
* @param dto
* @return
*/
List<FmsFollowupVo.FollowupTaskVO> selectTaskList(FmsFollowupDto.FollowupTaskQueryDTO dto);
List<FmsFollowupVo.FollowupTaskVO> selectTaskList(@Param("dto") FmsFollowupDto.FollowupTaskQueryDTO dto);
/**
* 修改随访任务状态为失访
* @param dto

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

@ -21,6 +21,27 @@ public interface FmsFollowupService {
*/
List<FmsFollowupVo.FollowupQueueVO> queryQueue(FmsFollowupDto.FollowupQueueQueryDTO dto);
/**
* 添加删除随访队列
* @param dto
* @return
*/
int addQueue(FmsFollowupDto.Add dto);
/**
* 更新随访队列
* @param dto
* @return
*/
int updQueue(FmsFollowupDto.Upd dto);
/**
* 删除随访队列
* @param dto
* @return
*/
int delQueue(FmsFollowupDto.Del dto);
/**
* 查询随访患者
* @param dto
@ -28,6 +49,13 @@ public interface FmsFollowupService {
*/
List<FmsFollowupVo.FollowupPatient> queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto);
/**
* 更新随访患者
* @param dto
* @return
*/
Integer updPatient(FmsFollowupDto.UpdPatient dto);
/**
* 查询随访任务
* @param dto

15
acupuncture-system/src/main/java/com/acupuncture/system/service/TaskService.java

@ -1,15 +0,0 @@
package com.acupuncture.system.service;
/**
* @Author zzc
* @Package com.acupuncture.system.service
* @Date 2025/2/12 17:58
* @description:
*/
public interface TaskService {
/**
* 定时任务添加随访工单
*/
void task();
}

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

@ -3,17 +3,21 @@ package com.acupuncture.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import com.acupuncture.common.utils.SecurityUtils;
import com.acupuncture.system.domain.dto.FmsFollowupDto;
import com.acupuncture.system.domain.po.FmsFollowupTask;
import com.acupuncture.system.domain.po.FmsPatientQueueRelation;
import com.acupuncture.system.domain.po.*;
import com.acupuncture.system.domain.vo.FmsFollowupVo;
import com.acupuncture.system.persist.dao.FmsFollowupDao;
import com.acupuncture.system.persist.mapper.FmsFollowupQueueMapper;
import com.acupuncture.system.persist.mapper.FmsFollowupTaskMapper;
import com.acupuncture.system.persist.mapper.FmsPatientQueueRelationMapper;
import com.acupuncture.system.service.FmsFollowupService;
import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl;
import org.springframework.scheduling.support.CronExpression;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
@ -28,24 +32,90 @@ import java.util.List;
* @description:
*/
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class FmsFollowupServiceImpl implements FmsFollowupService {
@Resource
private FmsFollowupDao fmsFollowupDao;
@Resource
private FmsFollowupQueueMapper fmsFollowupQueueMapper;
@Resource
private FmsPatientQueueRelationMapper fmsPatientQueueRelationMapper;
@Override
public List<FmsFollowupVo.FollowupQueueVO> queryQueue(FmsFollowupDto.FollowupQueueQueryDTO dto) {
return fmsFollowupDao.selectQueueList(dto.getId());
return fmsFollowupDao.selectQueueList(dto.getId(), dto.getName(), dto.getStatus());
}
@Override
public int addQueue(FmsFollowupDto.Add dto) {
FmsFollowupQueue fmsFollowupQueue = BeanUtil.copyProperties(dto, FmsFollowupQueue.class);
fmsFollowupQueue.setId(IdUtil.getSnowflakeNextId());
fmsFollowupQueue.setCreateBy(SecurityUtils.getUsername());
fmsFollowupQueue.setCreateTime(new Date());
fmsFollowupQueue.setTenantId(SecurityUtils.getTenantId());
return fmsFollowupQueueMapper.insertSelective(fmsFollowupQueue);
}
@Override
public int updQueue(FmsFollowupDto.Upd dto) {
FmsFollowupQueue fmsFollowupQueue = BeanUtil.copyProperties(dto, FmsFollowupQueue.class);
fmsFollowupQueue.setUpdateBy(SecurityUtils.getUsername());
fmsFollowupQueue.setCreateTime(new Date());
return fmsFollowupQueueMapper.updateByPrimaryKeySelective(fmsFollowupQueue);
}
@Override
public int delQueue(FmsFollowupDto.Del dto) {
FmsFollowupQueueExample fmsFollowupQueueExample = new FmsFollowupQueueExample();
fmsFollowupQueueExample.createCriteria().andIdIn(dto.getIdList());
FmsFollowupQueue fmsFollowupQueue = new FmsFollowupQueue();
fmsFollowupQueue.setDelFlag((byte) 1);
return fmsFollowupQueueMapper.updateByExampleSelective(fmsFollowupQueue, fmsFollowupQueueExample);
}
@Override
public List<FmsFollowupVo.FollowupPatient> queryPatient(FmsFollowupDto.FollowupPatientQueryDTO dto) {
return fmsFollowupDao.queryPatient(dto.getId());
return fmsFollowupDao.queryPatient(dto.getId(), null);
}
@Override
public Integer updPatient(FmsFollowupDto.UpdPatient dto) {
FmsPatientQueueRelationExample fmsPatientQueueRelationExample = new FmsPatientQueueRelationExample();
fmsPatientQueueRelationExample.createCriteria().andPatientIdEqualTo(dto.getPatientId());
FmsPatientQueueRelation fmsPatientQueueRelation = new FmsPatientQueueRelation();
fmsPatientQueueRelation.setDelFlag((byte) 1);
List<FmsPatientQueueRelation> fmsPatientQueueRelations = fmsPatientQueueRelationMapper.selectByExample(fmsPatientQueueRelationExample);
if (CollectionUtil.isNotEmpty(fmsPatientQueueRelations)) {
for (FmsPatientQueueRelation patientQueueRelation : fmsPatientQueueRelations) {
fmsPatientQueueRelationMapper.deleteByPrimaryKey(patientQueueRelation);
}
}
int i = 0;
//空队列则删除
if (CollectionUtil.isNotEmpty(dto.getQueueIdList())) {
for (Long queueId : dto.getQueueIdList()) {
FmsPatientQueueRelation relation = BeanUtil.copyProperties(dto, FmsPatientQueueRelation.class);
relation.setDelFlag((byte) 0);
relation.setCreateBy(SecurityUtils.getUsername());
relation.setPatientId(dto.getPatientId());
relation.setQueueId(queueId);
relation.setTenantId(SecurityUtils.getTenantId());
relation.setCreateTime(new Date());
fmsPatientQueueRelationMapper.insertSelective(relation);
}
i = dto.getQueueIdList().size();
}
return i;
}
@Override
public List<FmsFollowupVo.FollowupTaskVO> queryTask(FmsFollowupDto.FollowupTaskQueryDTO dto) {
return fmsFollowupDao.selectTaskList(dto);
List<FmsFollowupVo.FollowupTaskVO> followupTaskVOS = fmsFollowupDao.selectTaskList(dto);
if (CollectionUtil.isEmpty(followupTaskVOS)) {
return CollectionUtil.newArrayList();
}
return followupTaskVOS;
}
@Override

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

@ -56,6 +56,8 @@ public class PmsPatientServiceImpl implements PmsPatientService {
public Long add(PmsPatientDto.PatientAdd dto) {
PmsPatient pmsPatient = BeanUtil.copyProperties(dto, PmsPatient.class);
pmsPatient.setId(IdUtil.getSnowflakeNextId());
pmsPatient.setPinyinFull(PinyinUtil.getPinyin(dto.getName(), ""));
pmsPatient.setPinyinSimple(PinyinUtil.getFirstLetter(dto.getName(), ""));
pmsPatient.setCreateBy(SecurityUtils.getUsername());
pmsPatient.setDelFlag((byte) 0);
pmsPatient.setCreateTime(new Date());
@ -69,6 +71,8 @@ public class PmsPatientServiceImpl implements PmsPatientService {
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(), ""));
return pmsPatientMapper.updateByPrimaryKeySelective(pmsPatient);
}

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

@ -111,7 +111,18 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService {
@Override
public List<PmsTreatmentVo.TreatmentVO> listTreatment(PmsTreatmentDto.TreatmentQueryDTO queryDTO) {
return pmsTreatmentDao.query(queryDTO);
List<PmsTreatmentVo.TreatmentVO> query = pmsTreatmentDao.query(queryDTO);
if (CollectionUtil.isNotEmpty(query)) {
for (PmsTreatmentVo.TreatmentVO treatmentVO : query) {
PmsTreatmentRecordExample pmsTreatmentRecordExample = new PmsTreatmentRecordExample();
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(",")));
}
}
}
return query;
}
@Override

120
acupuncture-system/src/main/java/com/acupuncture/system/service/impl/TaskServiceImpl.java

@ -1,120 +0,0 @@
package com.acupuncture.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import com.acupuncture.system.domain.po.FmsFollowupTask;
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.service.TaskService;
import org.quartz.TriggerUtils;
import org.quartz.impl.triggers.CronTriggerImpl;
import org.springframework.stereotype.Service;
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.system.service.impl
* @Date 2025/2/12 17:58
* @description:
*/
@Service
public class TaskServiceImpl implements TaskService {
@Resource
private FmsFollowupDao fmsFollowupDao;
@Resource
private FmsFollowupTaskMapper fmsFollowupTaskMapper;
@Resource
private UmsDataSourceDao umsDataSourceDao;
@Override
public void task() {
//获取随访患者列表,根据患者出院日时间和队列添加工单
//1. 查询队列
List<FmsFollowupVo.FollowupQueueVO> queueList = fmsFollowupDao.selectQueueList(null);
//查询公共队列
List<FmsFollowupVo.FollowupQueueVO> queueResults = fmsFollowupDao.queryCommonQueue(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());
if (CollectionUtil.isEmpty(patientList)) {
continue;
}
//随访总月数
Integer followupMethod = followupQueueVO.getFollowupMethod();
for (FmsFollowupVo.FollowupPatient followupPatient : patientList) {
//获取随访到期时间 出院时间+随访总月数 = 到期时间
Calendar calendar = Calendar.getInstance();
calendar.setTime(followupPatient.getDischargeTime());
calendar.set(Calendar.MONTH, followupMethod);
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.setQueueId(followupQueueVO.getId());
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));
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
} else {
//周期
//4. 根据频次和总月数添加
for (Date date : dateList) {
//单次
FmsFollowupTask fmsFollowupTask = new FmsFollowupTask();
BeanUtil.copyProperties(followupQueueVO, fmsFollowupTask);
fmsFollowupTask.setId(IdUtil.getSnowflakeNextId());
fmsFollowupTask.setQueueId(followupQueueVO.getId());
fmsFollowupTask.setDelFlag((byte) 0);
fmsFollowupTask.setCreateTime(new Date());
fmsFollowupTask.setStatus((byte) 0);
fmsFollowupTask.setStartTime(date);
fmsFollowupTask.setEndTime(date);
fmsFollowupTask.setFollowuper(followupQueueVO.getPersonInCharge());
fmsFollowupTask.setFollowupTime(date);
fmsFollowupTaskMapper.insertSelective(fmsFollowupTask);
}
}
}
}
}
}

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

@ -33,54 +33,92 @@
person_in_charge as personInCharge,
person_in_charge_username as personInChargeUsername,
status,
create_by as createBy
create_by as createBy,
create_time as createTime
FROM fms_followup_queue
WHERE del_flag = 0
<if test="id != null">
and id = #{id}
</if>
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="status != null">
and status = #{status}
</if>
</select>
<select id="queryPatient" resultType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupPatient">
<resultMap id="BaseResultMap" type="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupPatient">
<id column="id" property="id"/>
<id column="queueId" property="queueId"/>
<result column="name" property="name"/>
<result column="pinyinFull" property="pinyinFull"/>
<result column="pinyinSimple" property="pinyinSimple"/>
<result column="gender" property="gender"/>
<result column="birthDate" property="birthDate"/>
<result column="ethnicity" property="ethnicity"/>
<result column="education_years" property="educationYears"/>
<result column="phone" property="phone"/>
<result column="dischargeTime" property="dischargeTime"/>
<result column="idCardType" property="idCardType"/>
<result column="idCard" property="idCard"/>
<result column="tenantId" property="tenantId"/>
<result column="createBy" property="createBy"/>
<result column="createTime" property="createTime"/>
<collection property="queueList" ofType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupPatient$QueueVo">
<id column="queueId" property="queueId" />
<result column="queueName" property="queueName" />
</collection>
</resultMap>
<select id="queryPatient" resultMap="BaseResultMap">
select
patient_id as id,
queue_id as queueId,
name,
pinyin_full as pinyinFull,
pinyin_simple as pinyinSimple,
gender,
birth_date as birthDate,
ethnicity,
education_years as educationYears,
phone,
discharge_time as dischargeTime,
id_card_type as idCardType,
id_card as idCard,
tenant_id as tenantId,
create_by as createBy,
create_time as createTime
FROM fms_patient_queue_relation
WHERE del_flag = 0
AND queue_id = #{id}
r.patient_id as id,
r.queue_id as queueId,
r.name,
r.pinyin_full as pinyinFull,
r.pinyin_simple as pinyinSimple,
r.gender,
r.birth_date as birthDate,
r.ethnicity,
r.education_years as educationYears,
r.phone,
r.discharge_time as dischargeTime,
r.id_card_type as idCardType,
r.id_card as idCard,
r.tenant_id as tenantId,
r.create_by as createBy,
r.create_time as createTime,
q.name as queueName
FROM fms_patient_queue_relation r
left join
fms_followup_queue q
on r.queue_id = q.id
WHERE r.del_flag = 0
<if test="id != null">
AND queue_id = #{id}
</if>
<if test="taskFlag != null">
AND r.task_flag = #{taskFlag}
</if>
group by r.id_card, r.queue_id
</select>
<select id="selectTaskList" resultType="com.acupuncture.system.domain.vo.FmsFollowupVo$FollowupTaskVO"
parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupTaskQueryDTO">
SELECT
id,
name,
followup_method as followupMethod,
followup_type as followupType,
frequency,
followup_month as followupMonth,
person_in_charge as personInCharge,
person_in_charge_username as personInChargeUsername,
status,
create_by as createBy
id, patient_id as patientId, name, gender, age, ethnicity, education_years as educationYears,
phone, id_card_type as idCardType, id_card as idCard, tenant_id as tenantId, queue_id as queueId, times, start_time as startTime, end_time as endTime, status,
lost_reason as lostReason, followuper, followup_time as followupTime, followup_text as followupText, create_by as createBy, create_time as createTime
FROM fms_followup_task
<where>
<if test="dto.queueId != null">
queue_id = #{dto.queueId}
</if>
<if test="dto.status != null">
AND status = #{dto.status}
</if>
<if test="dto.keywords != null and dto.keywords != ''">
AND (name LIKE CONCAT('%', #{dto.keywords}, '%')
</if>
@ -96,13 +134,13 @@
<update id="updateStatusToLost" parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupLostDTO">
UPDATE fms_followup_task
SET status = 2, lost_reason = #{dto.reason}
WHERE patient_id = #{dto.patientId} AND queue_id = #{dto.queueId}
WHERE id =#{dto.id}
</update>
<update id="completeFollowup" parameterType="com.acupuncture.system.domain.dto.FmsFollowupDto$FollowupCompleteDTO">
UPDATE fms_followup_task
SET status = 1, followuper = #{dto.followuper},
followup_time = #{dto.followupTime}, followup_text = #{dto.followupText}
WHERE patient_id = #{dto.patientId} AND queue_id = #{dto.queueId}
WHERE id =#{dto.id}
</update>
</mapper>

57
acupuncture-system/src/main/resources/mapper/dao/PmsPatientDao.xml

@ -5,49 +5,56 @@
<select id="query" resultType="com.acupuncture.system.domain.vo.PmsPatientVo$PatientResult"
parameterType="com.acupuncture.system.domain.dto.PmsPatientDto$PatientQuery">
SELECT
id,
name,
gender,
birth_date as birthDate,
ethnicity,
education_years as educationYears,
phone,
id_card_type as idCardType,
id_card as idCard,
source,
current_illness_history as currentIllnessHistory,
create_by as createBy,
create_time as createTime
p.id,
p.name,
p.gender,
p.birth_date as birthDate,
p.ethnicity,
p.education_years as educationYears,
p.phone,
p.id_card_type as idCardType,
p.id_card as idCard,
p.source,
p.current_illness_history as currentIllnessHistory,
p.current_illness_history_qt as currentIllnessHistoryQt,
p.tenant_id as tenantId,
p.create_by as createBy,
p.create_time as createTime,
t.name as tenantName
FROM
pms_patient
pms_patient p
left join
dms_tenant t
on
p.tenant_id = t.id
<where>
del_flag = 0
p.del_flag = 0
<if test="query.tenantId != null">
AND tenant_id = #{query.tenantId}
AND p.tenant_id = #{query.tenantId}
</if>
<if test="query.gender != null">
AND gender = #{query.gender}
AND p.gender = #{query.gender}
</if>
<if test="query.phone != null and query.phone != ''">
AND phone = #{query.phone}
AND p.phone = #{query.phone}
</if>
<if test="query.idCard != null and query.idCard != ''">
AND id_card = #{query.idCard}
AND p.id_card = #{query.idCard}
</if>
<if test="query.sourceId != null">
AND source = #{query.source}
AND p.source = #{query.source}
</if>
<if test="query.startAge != null">
AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), birth_date)), '%Y') + 0 &gt;= #{query.startAge}
AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), p.birth_date)), '%Y') + 0 &gt;= #{query.startAge}
</if>
<if test="query.endAge != null">
AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), birth_date)), '%Y') + 0 &lt;= #{query.endAge}
AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), p.birth_date)), '%Y') + 0 &lt;= #{query.endAge}
</if>
<if test="query.keywords != null and query.keywords != ''">
AND (
name LIKE CONCAT('%', #{query.keywords}, '%')
OR pinyin_full LIKE CONCAT('%', #{query.keywords}, '%')
OR pinyin_simple LIKE CONCAT('%', #{query.keywords}, '%')
p.name LIKE CONCAT('%', #{query.keywords}, '%')
OR p.pinyin_full LIKE CONCAT('%', #{query.keywords}, '%')
OR p.pinyin_simple LIKE CONCAT('%', #{query.keywords}, '%')
)
</if>
</where>

27
acupuncture-system/src/main/resources/mapper/system/FmsPatientQueueRelationMapper.xml

@ -22,6 +22,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="discharge_time" jdbcType="TIMESTAMP" property="dischargeTime" />
<result column="task_flag" jdbcType="TINYINT" property="taskFlag" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -84,7 +85,7 @@
<sql id="Base_Column_List">
patient_id, queue_id, name, pinyin_full, pinyin_simple, gender, birth_date, ethnicity,
education_years, phone, id_card_type, id_card, tenant_id, del_flag, create_by, create_time,
update_by, update_time, remark, discharge_time
update_by, update_time, remark, discharge_time, task_flag
</sql>
<select id="selectByExample" parameterType="com.acupuncture.system.domain.po.FmsPatientQueueRelationExample" resultMap="BaseResultMap">
select
@ -119,14 +120,16 @@
phone, id_card_type, id_card,
tenant_id, del_flag, create_by,
create_time, update_by, update_time,
remark, discharge_time)
remark, discharge_time, task_flag
)
values (#{patientId,jdbcType=BIGINT}, #{queueId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{pinyinFull,jdbcType=VARCHAR}, #{pinyinSimple,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT},
#{birthDate,jdbcType=DATE}, #{ethnicity,jdbcType=VARCHAR}, #{educationYears,jdbcType=INTEGER},
#{phone,jdbcType=VARCHAR}, #{idCardType,jdbcType=TINYINT}, #{idCard,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT}, #{delFlag,jdbcType=TINYINT}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{remark,jdbcType=VARCHAR}, #{dischargeTime,jdbcType=TIMESTAMP})
#{remark,jdbcType=VARCHAR}, #{dischargeTime,jdbcType=TIMESTAMP}, #{taskFlag,jdbcType=TINYINT}
)
</insert>
<insert id="insertSelective" parameterType="com.acupuncture.system.domain.po.FmsPatientQueueRelation">
insert into fms_patient_queue_relation
@ -191,6 +194,9 @@
<if test="dischargeTime != null">
discharge_time,
</if>
<if test="taskFlag != null">
task_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="patientId != null">
@ -253,6 +259,9 @@
<if test="dischargeTime != null">
#{dischargeTime,jdbcType=TIMESTAMP},
</if>
<if test="taskFlag != null">
#{taskFlag,jdbcType=TINYINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.acupuncture.system.domain.po.FmsPatientQueueRelationExample" resultType="java.lang.Long">
@ -324,6 +333,9 @@
<if test="record.dischargeTime != null">
discharge_time = #{record.dischargeTime,jdbcType=TIMESTAMP},
</if>
<if test="record.taskFlag != null">
task_flag = #{record.taskFlag,jdbcType=TINYINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -350,7 +362,8 @@
update_by = #{record.updateBy,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
remark = #{record.remark,jdbcType=VARCHAR},
discharge_time = #{record.dischargeTime,jdbcType=TIMESTAMP}
discharge_time = #{record.dischargeTime,jdbcType=TIMESTAMP},
task_flag = #{record.taskFlag,jdbcType=TINYINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -412,6 +425,9 @@
<if test="dischargeTime != null">
discharge_time = #{dischargeTime,jdbcType=TIMESTAMP},
</if>
<if test="taskFlag != null">
task_flag = #{taskFlag,jdbcType=TINYINT},
</if>
</set>
where patient_id = #{patientId,jdbcType=BIGINT}
and queue_id = #{queueId,jdbcType=BIGINT}
@ -435,7 +451,8 @@
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
remark = #{remark,jdbcType=VARCHAR},
discharge_time = #{dischargeTime,jdbcType=TIMESTAMP}
discharge_time = #{dischargeTime,jdbcType=TIMESTAMP},
task_flag = #{taskFlag,jdbcType=TINYINT}
where patient_id = #{patientId,jdbcType=BIGINT}
and queue_id = #{queueId,jdbcType=BIGINT}
</update>

33
acupuncture-system/src/main/resources/mapper/system/PmsPatientMapper.xml

@ -15,6 +15,7 @@
<result column="id_card" jdbcType="VARCHAR" property="idCard" />
<result column="source" jdbcType="TINYINT" property="source" />
<result column="current_illness_history" jdbcType="VARCHAR" property="currentIllnessHistory" />
<result column="current_illness_history_qt" jdbcType="VARCHAR" property="currentIllnessHistoryQt" />
<result column="del_flag" jdbcType="TINYINT" property="delFlag" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
@ -83,8 +84,8 @@
</sql>
<sql id="Base_Column_List">
id, name, pinyin_full, pinyin_simple, gender, birth_date, ethnicity, education_years,
phone, id_card_type, id_card, source, current_illness_history, del_flag, tenant_id,
create_by, create_time, update_by, update_time, remark
phone, id_card_type, id_card, source, current_illness_history, current_illness_history_qt,
del_flag, tenant_id, create_by, create_time, update_by, update_time, remark
</sql>
<select id="selectByExample" parameterType="com.acupuncture.system.domain.po.PmsPatientExample" resultMap="BaseResultMap">
select
@ -115,16 +116,18 @@
pinyin_simple, gender, birth_date,
ethnicity, education_years, phone,
id_card_type, id_card, source,
current_illness_history, del_flag, tenant_id,
create_by, create_time, update_by,
update_time, remark)
current_illness_history, current_illness_history_qt,
del_flag, tenant_id, create_by,
create_time, update_by, update_time,
remark)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{pinyinFull,jdbcType=VARCHAR},
#{pinyinSimple,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT}, #{birthDate,jdbcType=DATE},
#{ethnicity,jdbcType=VARCHAR}, #{educationYears,jdbcType=INTEGER}, #{phone,jdbcType=VARCHAR},
#{idCardType,jdbcType=TINYINT}, #{idCard,jdbcType=VARCHAR}, #{source,jdbcType=TINYINT},
#{currentIllnessHistory,jdbcType=VARCHAR}, #{delFlag,jdbcType=TINYINT}, #{tenantId,jdbcType=BIGINT},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR})
#{currentIllnessHistory,jdbcType=VARCHAR}, #{currentIllnessHistoryQt,jdbcType=VARCHAR},
#{delFlag,jdbcType=TINYINT}, #{tenantId,jdbcType=BIGINT}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.acupuncture.system.domain.po.PmsPatient">
insert into pms_patient
@ -168,6 +171,9 @@
<if test="currentIllnessHistory != null">
current_illness_history,
</if>
<if test="currentIllnessHistoryQt != null">
current_illness_history_qt,
</if>
<if test="delFlag != null">
del_flag,
</if>
@ -230,6 +236,9 @@
<if test="currentIllnessHistory != null">
#{currentIllnessHistory,jdbcType=VARCHAR},
</if>
<if test="currentIllnessHistoryQt != null">
#{currentIllnessHistoryQt,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=TINYINT},
</if>
@ -301,6 +310,9 @@
<if test="record.currentIllnessHistory != null">
current_illness_history = #{record.currentIllnessHistory,jdbcType=VARCHAR},
</if>
<if test="record.currentIllnessHistoryQt != null">
current_illness_history_qt = #{record.currentIllnessHistoryQt,jdbcType=VARCHAR},
</if>
<if test="record.delFlag != null">
del_flag = #{record.delFlag,jdbcType=TINYINT},
</if>
@ -342,6 +354,7 @@
id_card = #{record.idCard,jdbcType=VARCHAR},
source = #{record.source,jdbcType=TINYINT},
current_illness_history = #{record.currentIllnessHistory,jdbcType=VARCHAR},
current_illness_history_qt = #{record.currentIllnessHistoryQt,jdbcType=VARCHAR},
del_flag = #{record.delFlag,jdbcType=TINYINT},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
create_by = #{record.createBy,jdbcType=VARCHAR},
@ -392,6 +405,9 @@
<if test="currentIllnessHistory != null">
current_illness_history = #{currentIllnessHistory,jdbcType=VARCHAR},
</if>
<if test="currentIllnessHistoryQt != null">
current_illness_history_qt = #{currentIllnessHistoryQt,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=TINYINT},
</if>
@ -430,6 +446,7 @@
id_card = #{idCard,jdbcType=VARCHAR},
source = #{source,jdbcType=TINYINT},
current_illness_history = #{currentIllnessHistory,jdbcType=VARCHAR},
current_illness_history_qt = #{currentIllnessHistoryQt,jdbcType=VARCHAR},
del_flag = #{delFlag,jdbcType=TINYINT},
tenant_id = #{tenantId,jdbcType=BIGINT},
create_by = #{createBy,jdbcType=VARCHAR},

Loading…
Cancel
Save