1、每天23:50分生成第二天指令快照
2、每小时每04、09、间隔5分 - 59更新快照+生成矩阵备份+生成快照备份
This commit is contained in:
parent
ae9c1ec397
commit
3c8e1658c1
|
|
@ -3,6 +3,7 @@ package com.nu.modules.pad.directiveplan.api;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nu.entity.*;
|
||||
import com.nu.modules.care.api.IDirectivePlanDateApi;
|
||||
import com.nu.modules.config.IDirectiveConfigApi;
|
||||
import com.nu.modules.care.api.ICareDirectivePlanApi;
|
||||
import com.nu.modules.invoicing.api.IInvoicingDirectivePlanApi;
|
||||
|
|
@ -44,6 +45,8 @@ public class CareDirectiveApi {
|
|||
private IInvoicingDirectivePlanApi invoicingDirectivePlanApi;
|
||||
@Autowired
|
||||
private ILogisticsDirectivePlanApi logisticsDirectivePlanApi;
|
||||
@Autowired
|
||||
private IDirectivePlanDateApi directivePlanDateApi;
|
||||
|
||||
/**
|
||||
* 获取护理类服务指令树-配置数据
|
||||
|
|
@ -479,4 +482,23 @@ public class CareDirectiveApi {
|
|||
result.put("ckList", ckList);
|
||||
return Result.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* PAD端编排护理流程-点击保存按钮
|
||||
* 更新日期快照表数据 分类标签会传进来多个
|
||||
*
|
||||
* @param careDirectiveEntity
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/saveTable")
|
||||
public Result<String> saveTable(@RequestBody CareDirectiveEntity careDirectiveEntity) {
|
||||
if (StringUtils.isBlank(careDirectiveEntity.getNuId())) {
|
||||
return Result.error("未提供护理单元nuId");
|
||||
}
|
||||
if (StringUtils.isBlank(careDirectiveEntity.getInstructionIds())) {
|
||||
return Result.error("未提供分类标签");
|
||||
}
|
||||
directivePlanDateApi.saveTable(careDirectiveEntity);
|
||||
return Result.OK("保存成功");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,5 +90,11 @@ public class CareDirectiveEntity implements Serializable {
|
|||
* 查询哪些类型
|
||||
*/
|
||||
private String queryInstructionIds;
|
||||
/**
|
||||
* 查询哪些类型
|
||||
*/
|
||||
private String instructionIds;
|
||||
|
||||
private List<DirectivePlanChangeStatusEntity> planChangeStatusList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,18 @@ public class DirectiveOrderEntity implements Serializable {
|
|||
private String employeeId;
|
||||
/**员工姓名*/
|
||||
private String employeeName;
|
||||
/**分类标签*/
|
||||
private String instructionId;
|
||||
/**分类标签名称*/
|
||||
private String instructionName;
|
||||
/**服务类别ID,nu_config_service_category.id*/
|
||||
private String categoryId;
|
||||
/**服务类别名称*/
|
||||
private String categoryName;
|
||||
/**服务类型ID,nu_config_service_type.id*/
|
||||
private String typeId;
|
||||
/**服务类型名称*/
|
||||
private String typeName;
|
||||
/**服务指令ID,nu_config_service_directive.id*/
|
||||
private String directiveId;
|
||||
/**服务指令名称*/
|
||||
|
|
@ -68,6 +80,17 @@ public class DirectiveOrderEntity implements Serializable {
|
|||
private String cycleType;
|
||||
/**周期值*/
|
||||
private String cycleValue;
|
||||
/**
|
||||
* 操作日志,用于频次类型的计算
|
||||
*/
|
||||
private Date optTime;
|
||||
/**
|
||||
* 执行次数,0不限次数 非0具体次数,用于频次类型计算
|
||||
*/
|
||||
private Integer optCount;
|
||||
private String izMulti;
|
||||
private String immediateFile;
|
||||
private String immediateFileFocus;
|
||||
/**服务指令图片大图*/
|
||||
private String previewFile;
|
||||
/**服务指令图片小图*/
|
||||
|
|
@ -80,6 +103,12 @@ public class DirectiveOrderEntity implements Serializable {
|
|||
private String serviceDuration;
|
||||
/**服务说明*/
|
||||
private String serviceContent;
|
||||
/**定位*/
|
||||
private String positioning;
|
||||
/**纵向定位*/
|
||||
private String positioningLong;
|
||||
/**PAD端无线循环使用*/
|
||||
private String tagName;
|
||||
/**超时时长(分钟)*/
|
||||
private String timeoutDuration;
|
||||
/**服务指令包ID*/
|
||||
|
|
@ -120,10 +149,14 @@ public class DirectiveOrderEntity implements Serializable {
|
|||
private String initiatorName;
|
||||
/**创建人*/
|
||||
private String createEmp;
|
||||
/**创建人*/
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
private String updateEmp;
|
||||
/**更新人*/
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
private Date updateTime;
|
||||
/**是否删除 0未删除 1删除*/
|
||||
|
|
@ -144,6 +177,7 @@ public class DirectiveOrderEntity implements Serializable {
|
|||
|
||||
private String manuallyPicPath;
|
||||
private String manuallyMp4Path;
|
||||
private String immediateFile;
|
||||
private String immediateFileFocus;
|
||||
|
||||
/**所属部门*/
|
||||
private String sysOrgCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
package com.nu.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元+分类标签-矩阵是否变更记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class DirectivePlanChangeStatusEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
private String id;
|
||||
/**护理单元id*/
|
||||
private String nuId;
|
||||
/**分类标签id*/
|
||||
private String instructionTagId;
|
||||
/**是否有变动未处理 Y有变动未处理 N无需处理*/
|
||||
private String izChange;
|
||||
/**修改时间*/
|
||||
private Date changeTime;
|
||||
/**处理时间*/
|
||||
private Date handleTime;
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ public interface ICareDirectivePlanApi {
|
|||
void editDirective(CareDirectiveEntity careDirectiveEntity);
|
||||
void deleteDirective(CareDirectiveEntity careDirectiveEntity);
|
||||
List<DirectiveOrderEntity> queryFuture(CareDirectiveEntity dto);
|
||||
List<DirectiveOrderEntity> queryListByDateTime(CareDirectiveEntity dto);
|
||||
|
||||
List<DirectiveOrderEntity> queryImmediatelyOrderList(CareDirectiveEntity dto);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package com.nu.modules.care.api;
|
||||
|
||||
import com.nu.entity.CareDirectiveEntity;
|
||||
|
||||
public interface IDirectivePlanDateApi {
|
||||
void saveTable(CareDirectiveEntity careDirectiveEntity);
|
||||
}
|
||||
|
|
@ -74,6 +74,9 @@ public class CareDirectivePlan implements Serializable {
|
|||
*/
|
||||
private Integer optCount;
|
||||
|
||||
/**是否多个 Y是(指令集) N否*/
|
||||
private String izMulti;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String packageId;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
package com.nu.modules.biz.plan.care.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元+分类标签-矩阵是否变更记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_biz_directive_plan_change_status")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_biz_directive_plan_change_status对象", description="护理单元+分类标签-矩阵是否变更记录")
|
||||
public class DirectivePlanChangeStatus implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**护理单元id*/
|
||||
@Excel(name = "护理单元id", width = 15)
|
||||
@ApiModelProperty(value = "护理单元id")
|
||||
private java.lang.String nuId;
|
||||
/**分类标签id*/
|
||||
@Excel(name = "分类标签id", width = 15)
|
||||
@ApiModelProperty(value = "分类标签id")
|
||||
private java.lang.String instructionTagId;
|
||||
/**是否有变动未处理 Y有变动未处理 N无需处理*/
|
||||
@Excel(name = "是否有变动未处理 Y有变动未处理 N无需处理", width = 15)
|
||||
@ApiModelProperty(value = "是否有变动未处理 Y有变动未处理 N无需处理")
|
||||
private java.lang.String izChange;
|
||||
/**修改时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date changeTime;
|
||||
/**处理开始时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date handleStartTime;
|
||||
/**处理完成时间*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date handleFinishTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.nu.modules.biz.plan.care.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令编排-日期-快照表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_biz_directive_plan_date")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_biz_directive_plan_date对象", description="服务指令编排-日期-快照表")
|
||||
public class DirectivePlanDate implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**护理单元nuid nu_base_info.nu_id*/
|
||||
@Excel(name = "护理单元nuid nu_base_info.nu_id", width = 15)
|
||||
@ApiModelProperty(value = "护理单元nuid nu_base_info.nu_id")
|
||||
private java.lang.String nuId;
|
||||
/**分类标签id nu_config_service_instruction_tag.id*/
|
||||
@Excel(name = "分类标签id nu_config_service_instruction_tag.id", width = 15)
|
||||
@ApiModelProperty(value = "分类标签id nu_config_service_instruction_tag.id")
|
||||
private java.lang.String instructionId;
|
||||
/**服务指令id*/
|
||||
@Excel(name = "服务指令id", width = 15)
|
||||
@ApiModelProperty(value = "服务指令id")
|
||||
private java.lang.String directiveId;
|
||||
/**开始日期*/
|
||||
@Excel(name = "开始日期", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "开始日期")
|
||||
private java.util.Date startDate;
|
||||
/**开始时间*/
|
||||
@Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private java.util.Date startTime;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**周期类型ID*/
|
||||
@Excel(name = "周期类型ID", width = 15)
|
||||
@ApiModelProperty(value = "周期类型ID")
|
||||
private java.lang.String cycleTypeId;
|
||||
/**周期值*/
|
||||
@Excel(name = "周期值", width = 15)
|
||||
@ApiModelProperty(value = "周期值")
|
||||
private java.lang.String cycleValue;
|
||||
/**操作日期,用于频次类型的计算*/
|
||||
@Excel(name = "操作日期,用于频次类型的计算", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "操作日期,用于频次类型的计算")
|
||||
private java.util.Date optTime;
|
||||
/**执行次数,0不限次数 非0具体次数,用于频次类型计算 */
|
||||
@Excel(name = "执行次数,0不限次数 非0具体次数,用于频次类型计算 ", width = 15)
|
||||
@ApiModelProperty(value = "执行次数,0不限次数 非0具体次数,用于频次类型计算 ")
|
||||
private java.lang.Integer optCount;
|
||||
/**是否多个 Y是(指令集) N否*/
|
||||
@Excel(name = "是否多个 Y是(指令集) N否", width = 15)
|
||||
@ApiModelProperty(value = "是否多个 Y是(指令集) N否")
|
||||
private java.lang.String izMulti;
|
||||
/**横向定位*/
|
||||
@Excel(name = "横向定位", width = 15)
|
||||
@ApiModelProperty(value = "横向定位")
|
||||
private java.lang.String positioning;
|
||||
/**纵向定位*/
|
||||
@Excel(name = "纵向定位", width = 15)
|
||||
@ApiModelProperty(value = "纵向定位")
|
||||
private java.lang.String positioningLong;
|
||||
/**服务标签名称*/
|
||||
@Excel(name = "服务标签名称", width = 15)
|
||||
@ApiModelProperty(value = "服务标签名称")
|
||||
private java.lang.String tagName;
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package com.nu.modules.biz.plan.care.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 指令日期快照的备份
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_biz_directive_plan_date_log")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_biz_directive_plan_date_log对象", description="指令日期快照的备份")
|
||||
public class DirectivePlanDateLog implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**护理单元nuid nu_base_info.nu_id*/
|
||||
@Excel(name = "护理单元nuid nu_base_info.nu_id", width = 15)
|
||||
@ApiModelProperty(value = "护理单元nuid nu_base_info.nu_id")
|
||||
private java.lang.String nuId;
|
||||
/**分类标签id nu_config_service_instruction_tag.id*/
|
||||
@Excel(name = "分类标签id nu_config_service_instruction_tag.id", width = 15)
|
||||
@ApiModelProperty(value = "分类标签id nu_config_service_instruction_tag.id")
|
||||
private java.lang.String instructionId;
|
||||
/**服务指令id*/
|
||||
@Excel(name = "服务指令id", width = 15)
|
||||
@ApiModelProperty(value = "服务指令id")
|
||||
private java.lang.String directiveId;
|
||||
/**开始日期*/
|
||||
@Excel(name = "开始日期", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "开始日期")
|
||||
private java.util.Date startDate;
|
||||
/**开始时间*/
|
||||
@Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private java.util.Date startTime;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**周期类型ID*/
|
||||
@Excel(name = "周期类型ID", width = 15)
|
||||
@ApiModelProperty(value = "周期类型ID")
|
||||
private java.lang.String cycleTypeId;
|
||||
/**周期值*/
|
||||
@Excel(name = "周期值", width = 15)
|
||||
@ApiModelProperty(value = "周期值")
|
||||
private java.lang.String cycleValue;
|
||||
/**操作日期,用于频次类型的计算*/
|
||||
@Excel(name = "操作日期,用于频次类型的计算", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "操作日期,用于频次类型的计算")
|
||||
private java.util.Date optTime;
|
||||
/**执行次数,0不限次数 非0具体次数,用于频次类型计算 */
|
||||
@Excel(name = "执行次数,0不限次数 非0具体次数,用于频次类型计算 ", width = 15)
|
||||
@ApiModelProperty(value = "执行次数,0不限次数 非0具体次数,用于频次类型计算 ")
|
||||
private java.lang.Integer optCount;
|
||||
/**是否多个 Y是(指令集) N否*/
|
||||
@Excel(name = "是否多个 Y是(指令集) N否", width = 15)
|
||||
@ApiModelProperty(value = "是否多个 Y是(指令集) N否")
|
||||
private java.lang.String izMulti;
|
||||
/**横向定位*/
|
||||
@Excel(name = "横向定位", width = 15)
|
||||
@ApiModelProperty(value = "横向定位")
|
||||
private java.lang.String positioning;
|
||||
/**纵向定位*/
|
||||
@Excel(name = "纵向定位", width = 15)
|
||||
@ApiModelProperty(value = "纵向定位")
|
||||
private java.lang.String positioningLong;
|
||||
/**服务标签名称*/
|
||||
@Excel(name = "服务标签名称", width = 15)
|
||||
@ApiModelProperty(value = "服务标签名称")
|
||||
private java.lang.String tagName;
|
||||
/**数据变更时间*/
|
||||
@Excel(name = "数据变更时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "数据变更时间")
|
||||
private java.util.Date changeTime;
|
||||
}
|
||||
|
|
@ -98,4 +98,12 @@ public class DirectivePlanLog implements Serializable {
|
|||
/**数据变更人*/
|
||||
@ApiModelProperty(value = "数据变更人")
|
||||
private java.lang.String changeBy;
|
||||
/**处理时间*/
|
||||
@Excel(name = "处理时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "处理时间")
|
||||
private java.util.Date handleTime;
|
||||
/**是否多个 Y是(指令集) N否*/
|
||||
private String izMulti;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.nu.modules.biz.plan.care.job;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.nu.entity.CareDirectiveEntity;
|
||||
import com.nu.entity.DirectiveOrderEntity;
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanDate;
|
||||
import com.nu.modules.biz.plan.care.service.IDirectivePlanDateService;
|
||||
import com.nu.modules.care.api.ICareDirectivePlanApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 指令快照生成第二天整天数据
|
||||
*/
|
||||
@Slf4j
|
||||
public class DirectiveDateGenerateJob implements Job {
|
||||
@Autowired
|
||||
private ICareDirectivePlanApi careDirectivePlanApi;
|
||||
@Autowired
|
||||
private IDirectivePlanDateService directivePlanDateService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
//获取到第二天00:00:00
|
||||
Date targetDate = DateUtils.truncate(
|
||||
DateUtils.addDays(new Date(), 1),
|
||||
Calendar.DAY_OF_MONTH
|
||||
);
|
||||
|
||||
CareDirectiveEntity dto = new CareDirectiveEntity();
|
||||
dto.setQueryDate(targetDate);
|
||||
List<DirectiveOrderEntity> allDateSnapshootList = careDirectivePlanApi.queryListByDateTime(dto);
|
||||
|
||||
List<DirectivePlanDate> directivePlanDates = BeanUtil.copyToList(allDateSnapshootList, DirectivePlanDate.class);
|
||||
directivePlanDates.stream().forEach(item -> {
|
||||
item.setId(null);
|
||||
});
|
||||
directivePlanDateService.saveBatch(directivePlanDates);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.nu.modules.biz.plan.care.job;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.nu.entity.CareDirectiveEntity;
|
||||
import com.nu.entity.DirectiveOrderEntity;
|
||||
import com.nu.entity.DirectivePlanChangeStatusEntity;
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanChangeStatus;
|
||||
import com.nu.modules.biz.plan.care.service.IDirectivePlanChangeStatusService;
|
||||
import com.nu.modules.care.api.ICareDirectivePlanApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 定时更新矩阵日期快照表、备份表
|
||||
*/
|
||||
@Slf4j
|
||||
public class DirectiveDateUpdateJob implements Job {
|
||||
@Autowired
|
||||
private IDirectivePlanChangeStatusService directivePlanChangeStatusService;
|
||||
@Autowired
|
||||
private ICareDirectivePlanApi careDirectivePlanApi;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
//准备当前时间 用于记录处理数据的定时任务时间
|
||||
Date handleDateTime = new Date();
|
||||
|
||||
//1、计算出要处理的时间点
|
||||
//14:00:01 → 14:10:00
|
||||
//14:04:59 → 14:10:00
|
||||
//14:05:00 → 14:15:00
|
||||
//14:09:59 → 14:15:00
|
||||
//14:55:00 → 15:05:00
|
||||
//23:55:00 → 00:05:00
|
||||
Date targetDate = Date.from(calculateTargetTimeSimple().atZone(ZoneId.systemDefault()).toInstant());
|
||||
|
||||
//2、找到要处理的多个【nuId+分类标签ID】组合
|
||||
QueryWrapper<DirectivePlanChangeStatus> qw = new QueryWrapper<>();
|
||||
qw.eq("iz_change", "Y");
|
||||
List<DirectivePlanChangeStatus> list = directivePlanChangeStatusService.list(qw);
|
||||
|
||||
//3、从矩阵编排表查到targetDate时间点及之后数据(需要考虑跨天问题) 如果23:50执行就已经算的是第二天00:00:00的了
|
||||
CareDirectiveEntity dto = new CareDirectiveEntity();
|
||||
dto.setQueryDate(targetDate);
|
||||
dto.setPlanChangeStatusList(BeanUtil.copyToList(list, DirectivePlanChangeStatusEntity.class));
|
||||
List<DirectiveOrderEntity> allDateSnapshootList = careDirectivePlanApi.queryListByDateTime(dto);
|
||||
|
||||
// 创建Map,key为nuId+instructionTagId组合,value为对应的列表
|
||||
Map<String, List<DirectiveOrderEntity>> dateSnapshootMap = allDateSnapshootList.stream()
|
||||
.filter(item -> item.getNuId() != null && item.getInstructionId() != null)
|
||||
.collect(Collectors.groupingBy(
|
||||
item -> item.getNuId() + "_" + item.getInstructionId(),
|
||||
Collectors.collectingAndThen(
|
||||
Collectors.toList(),
|
||||
tempList -> {
|
||||
tempList.sort(Comparator.comparing(DirectiveOrderEntity::getStartTime));
|
||||
return tempList;
|
||||
}
|
||||
)
|
||||
));
|
||||
|
||||
//异步把所有的nuId+分类标签备份一下
|
||||
directivePlanChangeStatusService.backUpPlanData(handleDateTime,list);
|
||||
|
||||
//前面准备好了时间点 、要修改的数据
|
||||
list.forEach(item -> {
|
||||
//定时任务处理时间
|
||||
item.setHandleStartTime(handleDateTime);
|
||||
//异步并行处理 提高处理速度 每个异步处理的都是不同的nuId+instructionTagId组合 互不影响
|
||||
List<DirectiveOrderEntity> dateSnapshootList = dateSnapshootMap.get(item.getNuId() + "_" + item.getInstructionTagId());
|
||||
directivePlanChangeStatusService.updateDirectiveDateSnapshoot(targetDate, item, dateSnapshootList);
|
||||
});
|
||||
}
|
||||
|
||||
private LocalDateTime calculateTargetTimeSimple() {
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
// 1. 获取当前分钟
|
||||
int currentMinute = currentTime.getMinute();
|
||||
|
||||
// 2. 计算目标分钟(使用正确的公式)
|
||||
int targetMinuteRaw = ((currentMinute / 5) + 2) * 5;
|
||||
|
||||
// 3. 处理进位
|
||||
int hourIncrement = targetMinuteRaw / 60;
|
||||
int targetMinute = targetMinuteRaw % 60;
|
||||
|
||||
// 4. 组装目标时间
|
||||
return currentTime
|
||||
.plusHours(hourIncrement)
|
||||
.withMinute(targetMinute)
|
||||
.withSecond(0)
|
||||
.withNano(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -23,5 +23,7 @@ public interface CareDirectivePlanMapper extends BaseMapper<CareDirectivePlan> {
|
|||
|
||||
List<DirectiveOrderEntity> queryFuture( @Param("dto") CareDirectiveEntity dto);
|
||||
|
||||
List<DirectiveOrderEntity> queryListByDateTime( @Param("dto") CareDirectiveEntity dto);
|
||||
|
||||
int deleteDirectiveSet(@Param("dto") CareDirectiveEntity careDirectiveEntity);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.nu.modules.biz.plan.care.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.nu.modules.biz.plan.care.entity.CareDirectivePlan;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanChangeStatus;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元+分类标签-矩阵是否变更记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DirectivePlanChangeStatusMapper extends BaseMapper<DirectivePlanChangeStatus> {
|
||||
|
||||
int deleteOldSnapshoot(@Param("nuId") String nuId, @Param("instructionTagId") String instructionTagId, @Param("targetDate") Date targetDate);
|
||||
|
||||
List<CareDirectivePlan> selectDataByNuIdAndInstructionTagId(@Param("param") List<DirectivePlanChangeStatus> list);
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.nu.modules.biz.plan.care.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanDateLog;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 指令日期快照的备份
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DirectivePlanDateLogMapper extends BaseMapper<DirectivePlanDateLog> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.nu.modules.biz.plan.care.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanDate;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令编排-日期-快照表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DirectivePlanDateMapper extends BaseMapper<DirectivePlanDate> {
|
||||
|
||||
}
|
||||
|
|
@ -16,17 +16,31 @@
|
|||
<result column="elder_name" property="elderName"/>
|
||||
<result column="employee_id" property="employeeId"/>
|
||||
<result column="employee_name" property="employeeName"/>
|
||||
<result column="instruction_tag_id" property="instructionId"/>
|
||||
<result column="instruction_name" property="instructionName"/>
|
||||
<result column="category_id" property="categoryId"/>
|
||||
<result column="category_name" property="categoryName"/>
|
||||
<result column="type_id" property="typeId"/>
|
||||
<result column="type_name" property="typeName"/>
|
||||
<result column="directive_id" property="directiveId"/>
|
||||
<result column="directive_name" property="directiveName"/>
|
||||
<result column="cycle_type_id" property="cycleTypeId"/>
|
||||
<result column="cycle_type" property="cycleType"/>
|
||||
<result column="cycle_value" property="cycleValue"/>
|
||||
<result column="opt_time" property="optTime"/>
|
||||
<result column="opt_count" property="optCount"/>
|
||||
<result column="iz_multi" property="izMulti"/>
|
||||
<result column="immediate_file" property="immediateFile"/>
|
||||
<result column="immediate_file_focus" property="immediateFileFocus"/>
|
||||
<result column="preview_file" property="previewFile"/>
|
||||
<result column="preview_file_small" property="previewFileSmall"/>
|
||||
<result column="mp3_file" property="mp3File"/>
|
||||
<result column="mp4_file" property="mp4File"/>
|
||||
<result column="service_duration" property="serviceDuration"/>
|
||||
<result column="service_content" property="serviceContent"/>
|
||||
<result column="positioning" property="positioning"/>
|
||||
<result column="positioning_long" property="positioningLong"/>
|
||||
<result column="tagName" property="tagName"/>
|
||||
<result column="package_id" property="packageId"/>
|
||||
<result column="package_name" property="packageName"/>
|
||||
<result column="iz_package" property="izPackage"/>
|
||||
|
|
@ -46,11 +60,14 @@
|
|||
<result column="initiator_id" property="initiatorId"/>
|
||||
<result column="initiator_name" property="initiatorName"/>
|
||||
<result column="create_emp" property="createEmp"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_emp" property="updateEmp"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="remarks" property="remarks"/>
|
||||
<result column="sys_org_code" property="sysOrgCode"/>
|
||||
<collection property="infoList" ofType="com.nu.entity.DirectiveOrderInfoEntity">
|
||||
<id column="sub_id" property="id"/>
|
||||
<result column="sub_order_type" property="orderType"/>
|
||||
|
|
@ -155,7 +172,8 @@
|
|||
)
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.nu.modules.biz.plan.care.entity.CareDirectivePlan" flushCache="true" useCache="false">
|
||||
<select id="list" resultType="com.nu.modules.biz.plan.care.entity.CareDirectivePlan" flushCache="true"
|
||||
useCache="false">
|
||||
SELECT
|
||||
plan.id,
|
||||
plan.nu_id,
|
||||
|
|
@ -339,4 +357,116 @@
|
|||
|
||||
ORDER BY p.start_time ASC
|
||||
</select>
|
||||
|
||||
<select id="queryListByDateTime" resultMap="DirectiveOrderMap">
|
||||
SELECT p.id,
|
||||
p.nu_id,
|
||||
base.nu_name,
|
||||
p.instruction_tag_id,
|
||||
inst.instruction_name,
|
||||
directive.category_id,
|
||||
category.category_name,
|
||||
directive.type_id,
|
||||
stype.type_name,
|
||||
p.directive_id,
|
||||
directive.directive_name,
|
||||
p.cycle_type_id,
|
||||
p.cycle_value,
|
||||
p.opt_time,
|
||||
p.opt_count,
|
||||
p.iz_multi,
|
||||
directive.immediate_file,
|
||||
directive.immediate_file_focus,
|
||||
directive.preview_file,
|
||||
directive.preview_file_small,
|
||||
directive.mp3_file,
|
||||
directive.mp4_file,
|
||||
directive.service_duration,
|
||||
directive.service_content,
|
||||
p.positioning,
|
||||
p.positioning_long,
|
||||
p.tag_name,
|
||||
CONCAT(
|
||||
DATE_FORMAT(#{dto.queryDate}, '%Y-%m-%d'), ' ',
|
||||
p.start_time, ':00'
|
||||
) as start_time,
|
||||
CASE
|
||||
WHEN directive.service_duration IS NOT NULL
|
||||
THEN CONCAT(
|
||||
DATE_FORMAT(#{dto.queryDate}, '%Y-%m-%d'), ' ',
|
||||
DATE_FORMAT(ADDTIME(STR_TO_DATE(CONCAT(p.start_time, ':00'), '%H:%i:%s'),
|
||||
SEC_TO_TIME(directive.service_duration * 60)), '%H:%i:%s')
|
||||
)
|
||||
ELSE NULL
|
||||
END as end_time,
|
||||
p.create_by,
|
||||
p.create_time,
|
||||
p.update_by,
|
||||
p.update_time,
|
||||
p.sys_org_code
|
||||
FROM nu_biz_directive_plan p
|
||||
LEFT JOIN nu_base_info base ON p.nu_id = base.nu_id
|
||||
LEFT JOIN nu_config_service_directive directive ON p.directive_id = directive.id
|
||||
LEFT JOIN nu_config_service_instruction_tag inst ON directive.instruction_tag_id = inst.id
|
||||
LEFT JOIN nu_config_service_category category ON directive.category_id = category.id
|
||||
LEFT JOIN nu_config_service_type stype ON directive.type_id = stype.id
|
||||
|
||||
<if test="dto.planChangeStatusList != null and dto.planChangeStatusList.size() > 0">
|
||||
INNER JOIN (
|
||||
<foreach collection="dto.planChangeStatusList" item="item" separator="UNION ALL">
|
||||
SELECT #{item.nuId} as nu_id, #{item.instructionTagId} as instruction_tag_id
|
||||
</foreach>
|
||||
) filter ON p.nu_id = filter.nu_id AND p.instruction_tag_id = filter.instruction_tag_id
|
||||
</if>
|
||||
|
||||
WHERE
|
||||
(
|
||||
-- 1: 每天执行
|
||||
p.cycle_type_id = '1'
|
||||
|
||||
-- 3: 按星期执行
|
||||
OR (p.cycle_type_id = '3' AND p.cycle_value = (
|
||||
CASE DAYOFWEEK(#{dto.queryDate})
|
||||
WHEN 1 THEN '6'
|
||||
WHEN 2 THEN '0'
|
||||
WHEN 3 THEN '1'
|
||||
WHEN 4 THEN '2'
|
||||
WHEN 5 THEN '3'
|
||||
WHEN 6 THEN '4'
|
||||
WHEN 7 THEN '5'
|
||||
END
|
||||
))
|
||||
|
||||
-- 4: 按日期执行
|
||||
OR (p.cycle_type_id = '4' AND p.cycle_value = DATE_FORMAT(#{dto.queryDate}, '%d'))
|
||||
|
||||
-- 5: 频次执行
|
||||
OR (
|
||||
p.cycle_type_id = '5'
|
||||
|
||||
AND (
|
||||
-- 不限次数
|
||||
(p.opt_count = 0
|
||||
AND DATEDIFF(#{dto.queryDate}, DATE(p.opt_time)) >= 0
|
||||
AND
|
||||
MOD(DATEDIFF(#{dto.queryDate}, DATE(p.opt_time)), (CAST(p.cycle_value AS UNSIGNED) + 1)) = 0)
|
||||
|
||||
-- 有限次数
|
||||
OR (p.opt_count > 0
|
||||
AND DATEDIFF(#{dto.queryDate}, DATE(p.opt_time)) >= 0
|
||||
AND MOD(DATEDIFF(#{dto.queryDate}, DATE(p.opt_time)), (CAST(p.cycle_value AS UNSIGNED) + 1)) = 0
|
||||
AND (DATEDIFF(#{dto.queryDate}, DATE(p.opt_time)) / (CAST(p.cycle_value AS UNSIGNED) + 1)) <
|
||||
p.opt_count)
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
-- 查询指定日期当天,指定时间点及之后的数据
|
||||
AND CONCAT(DATE_FORMAT(#{dto.queryDate}, '%Y-%m-%d'), ' ', p.start_time, ':00') >= #{dto.queryDate}
|
||||
|
||||
ORDER BY p.nu_id ASC, p.instruction_tag_id ASC, start_time ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.biz.plan.care.mapper.DirectivePlanChangeStatusMapper">
|
||||
|
||||
<delete id="deleteOldSnapshoot">
|
||||
delete
|
||||
from nu_biz_directive_plan_date
|
||||
where nu_id = #{nuId}
|
||||
and instruction_id = #{instructionTagId}
|
||||
and DATE (start_time) = DATE (#{targetDate})
|
||||
and start_time >= #{targetDate}
|
||||
</delete>
|
||||
|
||||
<select id="selectDataByNuIdAndInstructionTagId"
|
||||
resultType="com.nu.modules.biz.plan.care.entity.CareDirectivePlan">
|
||||
select * from nu_biz_directive_plan
|
||||
where (nu_id, instruction_tag_id) in
|
||||
<foreach collection="param" item="item" open="(" close=")" separator=",">
|
||||
(#{item.nuId}, #{item.instructionTagId})
|
||||
</foreach>
|
||||
order by nu_id asc, instruction_tag_id asc, str_to_date(start_time, '%i:%s') asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.biz.plan.care.mapper.DirectivePlanDateLogMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.biz.plan.care.mapper.DirectivePlanDateMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.nu.modules.biz.plan.care.service;
|
||||
|
||||
import com.nu.entity.DirectiveOrderEntity;
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanChangeStatus;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元+分类标签-矩阵是否变更记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDirectivePlanChangeStatusService extends IService<DirectivePlanChangeStatus> {
|
||||
|
||||
void updateDirectiveDateSnapshoot(Date targetDate, DirectivePlanChangeStatus item, List<DirectiveOrderEntity> dateSnapshootList);
|
||||
|
||||
void backUpPlanData(Date handleDateTime,List<DirectivePlanChangeStatus> list);
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.nu.modules.biz.plan.care.service;
|
||||
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanDateLog;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 指令日期快照的备份
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDirectivePlanDateLogService extends IService<DirectivePlanDateLog> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.nu.modules.biz.plan.care.service;
|
||||
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanDate;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令编排-日期-快照表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDirectivePlanDateService extends IService<DirectivePlanDate> {
|
||||
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import com.nu.modules.biz.plan.care.entity.DirectivePlanLog;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -15,5 +16,5 @@ import java.util.List;
|
|||
*/
|
||||
public interface IDirectivePlanLogService extends IService<DirectivePlanLog> {
|
||||
|
||||
void batchInsert(LoginUser sysUser, List<CareDirectivePlan> list);
|
||||
void batchInsert(Date now, LoginUser sysUser, List<CareDirectivePlan> list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.nu.modules.biz.plan.care.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.nu.entity.*;
|
||||
import com.nu.modules.biz.datapool.service.ICareDataPoolService;
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanChangeStatus;
|
||||
import com.nu.modules.biz.plan.care.service.IDirectivePlanChangeStatusService;
|
||||
import com.nu.modules.biz.plan.care.service.IDirectivePlanLogService;
|
||||
import com.nu.modules.config.directivepackage.service.IDirectivePackageService;
|
||||
import com.nu.modules.config.directivepackage.service.impl.DirectivePackageServiceImpl;
|
||||
|
|
@ -42,6 +45,8 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
private DirectivePackageServiceImpl directivePackageService;
|
||||
@Autowired
|
||||
private IDirectivePlanLogService directivePlanLogService;
|
||||
@Autowired
|
||||
private IDirectivePlanChangeStatusService directivePlanChangeStatusService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getPlanList(CareDirectiveEntity careDirectiveEntity) {
|
||||
|
|
@ -133,6 +138,15 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
BeanUtils.copyProperties(careDirectiveEntity, careDirectivePlan);
|
||||
baseMapper.insert(careDirectivePlan);
|
||||
|
||||
//记录变化 用于定时任务调整日期快照
|
||||
DirectivePlanChangeStatus directivePlanChangeStatus = new DirectivePlanChangeStatus();
|
||||
directivePlanChangeStatus.setIzChange("Y");
|
||||
directivePlanChangeStatus.setChangeTime(new Date());
|
||||
UpdateWrapper<DirectivePlanChangeStatus> uw = new UpdateWrapper<>();
|
||||
uw.eq("nu_id", careDirectiveEntity.getNuId());
|
||||
uw.eq("instruction_tag_id", careDirectiveEntity.getInstructionTagId());
|
||||
directivePlanChangeStatusService.saveOrUpdate(directivePlanChangeStatus, uw);
|
||||
|
||||
//查询护理单元+对应分类下全部数据进行存储(保存是异步 线程里查询的由于事务原因会少数据)
|
||||
QueryWrapper<CareDirectivePlan> qw = new QueryWrapper<>();
|
||||
qw.eq("nu_id", careDirectiveEntity.getNuId());
|
||||
|
|
@ -141,7 +155,7 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
directivePlanLogService.batchInsert(sysUser, list);
|
||||
directivePlanLogService.batchInsert(new Date(), sysUser, list);
|
||||
}
|
||||
|
||||
return careDirectiveEntity;
|
||||
|
|
@ -161,6 +175,15 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
//调用方法先删除数据池中的数据,再生成数据池中的数据
|
||||
// dataPoolServiceImpl.editDataPool(entity);
|
||||
|
||||
//记录变化 用于定时任务调整日期快照
|
||||
DirectivePlanChangeStatus directivePlanChangeStatus = new DirectivePlanChangeStatus();
|
||||
directivePlanChangeStatus.setIzChange("Y");
|
||||
directivePlanChangeStatus.setChangeTime(new Date());
|
||||
UpdateWrapper<DirectivePlanChangeStatus> uw = new UpdateWrapper<>();
|
||||
uw.eq("nu_id", careDirectiveEntity.getNuId());
|
||||
uw.eq("instruction_tag_id", careDirectiveEntity.getInstructionTagId());
|
||||
directivePlanChangeStatusService.saveOrUpdate(directivePlanChangeStatus, uw);
|
||||
|
||||
//查询护理单元+对应分类下全部数据进行存储(保存是异步 线程里查询的由于事务原因会少数据)
|
||||
QueryWrapper<CareDirectivePlan> qw = new QueryWrapper<>();
|
||||
qw.eq("nu_id", careDirectiveEntity.getNuId());
|
||||
|
|
@ -169,7 +192,7 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
directivePlanLogService.batchInsert(sysUser, list);
|
||||
directivePlanLogService.batchInsert(new Date(), sysUser, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -181,6 +204,15 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
// BeanUtils.copyProperties(careDirectiveEntity, careDirectivePlan);
|
||||
// dataPoolServiceImpl.deleteDataPool(careDirectivePlan);
|
||||
|
||||
//记录变化 用于定时任务调整日期快照
|
||||
DirectivePlanChangeStatus directivePlanChangeStatus = new DirectivePlanChangeStatus();
|
||||
directivePlanChangeStatus.setIzChange("Y");
|
||||
directivePlanChangeStatus.setChangeTime(new Date());
|
||||
UpdateWrapper<DirectivePlanChangeStatus> uw = new UpdateWrapper<>();
|
||||
uw.eq("nu_id", careDirectiveEntity.getNuId());
|
||||
uw.eq("instruction_tag_id", careDirectiveEntity.getInstructionTagId());
|
||||
directivePlanChangeStatusService.saveOrUpdate(directivePlanChangeStatus, uw);
|
||||
|
||||
//查询护理单元+对应分类下全部数据进行存储(保存是异步 线程里查询的由于事务原因会少数据)
|
||||
QueryWrapper<CareDirectivePlan> qw = new QueryWrapper<>();
|
||||
qw.eq("nu_id", careDirectiveEntity.getNuId());
|
||||
|
|
@ -189,7 +221,7 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
directivePlanLogService.batchInsert(sysUser, list);
|
||||
directivePlanLogService.batchInsert(new Date(), sysUser, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -198,6 +230,11 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
return baseMapper.queryFuture(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DirectiveOrderEntity> queryListByDateTime(CareDirectiveEntity dto) {
|
||||
return baseMapper.queryListByDateTime(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DirectiveOrderEntity> queryImmediatelyOrderList(CareDirectiveEntity dto) {
|
||||
dto.setQueryType("instant");
|
||||
|
|
@ -213,6 +250,15 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
public void deleteDirectiveSet(CareDirectiveEntity careDirectiveEntity) {
|
||||
baseMapper.deleteDirectiveSet(careDirectiveEntity);
|
||||
|
||||
//记录变化 用于定时任务调整日期快照
|
||||
DirectivePlanChangeStatus directivePlanChangeStatus = new DirectivePlanChangeStatus();
|
||||
directivePlanChangeStatus.setIzChange("Y");
|
||||
directivePlanChangeStatus.setChangeTime(new Date());
|
||||
UpdateWrapper<DirectivePlanChangeStatus> uw = new UpdateWrapper<>();
|
||||
uw.eq("nu_id", careDirectiveEntity.getNuId());
|
||||
uw.eq("instruction_tag_id", careDirectiveEntity.getInstructionTagId());
|
||||
directivePlanChangeStatusService.saveOrUpdate(directivePlanChangeStatus, uw);
|
||||
|
||||
//查询护理单元+对应分类下全部数据进行存储(保存是异步 线程里查询的由于事务原因会少数据)
|
||||
QueryWrapper<CareDirectivePlan> qw = new QueryWrapper<>();
|
||||
qw.eq("nu_id", careDirectiveEntity.getNuId());
|
||||
|
|
@ -221,7 +267,7 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
directivePlanLogService.batchInsert(sysUser, list);
|
||||
directivePlanLogService.batchInsert(new Date(), sysUser, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,129 @@
|
|||
package com.nu.modules.biz.plan.care.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.nu.entity.DirectiveOrderEntity;
|
||||
import com.nu.modules.biz.plan.care.entity.*;
|
||||
import com.nu.modules.biz.plan.care.mapper.DirectivePlanChangeStatusMapper;
|
||||
import com.nu.modules.biz.plan.care.service.IDirectivePlanChangeStatusService;
|
||||
import com.nu.modules.biz.plan.care.service.IDirectivePlanDateLogService;
|
||||
import com.nu.modules.biz.plan.care.service.IDirectivePlanDateService;
|
||||
import com.nu.modules.biz.plan.care.service.IDirectivePlanLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元+分类标签-矩阵是否变更记录
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DirectivePlanChangeStatusServiceImpl extends ServiceImpl<DirectivePlanChangeStatusMapper, DirectivePlanChangeStatus> implements IDirectivePlanChangeStatusService {
|
||||
|
||||
@Autowired
|
||||
private IDirectivePlanDateService directivePlanDateService;
|
||||
@Autowired
|
||||
private IDirectivePlanDateLogService directivePlanDateLogService;
|
||||
@Autowired
|
||||
private IDirectivePlanLogService directivePlanLogService;
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void updateDirectiveDateSnapshoot(Date targetDate, DirectivePlanChangeStatus planChangeStatusData, List<DirectiveOrderEntity> dateSnapshootList) {
|
||||
|
||||
String nuId = planChangeStatusData.getNuId();//护理单元
|
||||
String instructionTagId = planChangeStatusData.getInstructionTagId();//分类标签
|
||||
Date changeTime = planChangeStatusData.getChangeTime();//变更时间
|
||||
|
||||
//1、读快照单天的存到备份里
|
||||
QueryWrapper<DirectivePlanDate> directivePlanDateQueryWrapper = new QueryWrapper<>();
|
||||
directivePlanDateQueryWrapper.eq("nu_id", nuId);
|
||||
directivePlanDateQueryWrapper.eq("instruction_id", instructionTagId);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String targetDateStr = sdf.format(targetDate);
|
||||
directivePlanDateQueryWrapper.apply("DATE(start_time) = {0}", targetDateStr);
|
||||
List<DirectivePlanDate> oldList = directivePlanDateService.list();//旧的数据
|
||||
|
||||
|
||||
//2、删除targetDate时间之后的 再把算好的dateSnapshootList存进去
|
||||
baseMapper.deleteOldSnapshoot(nuId, instructionTagId, targetDate);
|
||||
//存新的日期快照
|
||||
//处理要存的数据
|
||||
List<DirectivePlanDate> newDirectivePlanDateData = new ArrayList<>();
|
||||
dateSnapshootList.stream().forEach(item -> {
|
||||
DirectivePlanDate data_ = new DirectivePlanDate();
|
||||
data_.setNuId(item.getNuId());
|
||||
data_.setInstructionId(item.getInstructionId());
|
||||
data_.setDirectiveId(item.getDirectiveId());
|
||||
data_.setStartDate(item.getStartTime());
|
||||
data_.setStartTime(item.getStartTime());
|
||||
data_.setCycleTypeId(item.getCycleTypeId());
|
||||
data_.setCycleValue(item.getCycleValue());
|
||||
data_.setOptTime(item.getOptTime());
|
||||
data_.setOptCount(item.getOptCount());
|
||||
data_.setIzMulti(item.getIzMulti());
|
||||
data_.setPositioning(item.getPositioning());
|
||||
data_.setPositioningLong(item.getPositioningLong());
|
||||
data_.setTagName(item.getTagName());
|
||||
newDirectivePlanDateData.add(data_);
|
||||
});
|
||||
directivePlanDateService.saveBatch(newDirectivePlanDateData);
|
||||
|
||||
//、存储日期快照备份表数据
|
||||
List<DirectivePlanDateLog> directivePlanDateLogs = BeanUtil.copyToList(oldList, DirectivePlanDateLog.class);
|
||||
directivePlanDateLogs.forEach(temp -> {
|
||||
temp.setId(null);
|
||||
temp.setChangeTime(changeTime);
|
||||
});
|
||||
directivePlanDateLogService.saveBatch(directivePlanDateLogs);
|
||||
|
||||
//、修改状态值
|
||||
DirectivePlanChangeStatus newData = baseMapper.selectById(planChangeStatusData.getId());
|
||||
if (newData.getChangeTime().equals(planChangeStatusData.getChangeTime())) {
|
||||
//changeTime是数据有变更的时间 如果一致 说明没有新的变动 走到这里说明已经处理完了数据 直接把是否有变更更改为未变更状态
|
||||
planChangeStatusData.setIzChange("N");
|
||||
planChangeStatusData.setHandleStartTime(planChangeStatusData.getHandleStartTime());//定时任务开始处理时间
|
||||
planChangeStatusData.setHandleFinishTime(new Date());//定时任务处理完成时间
|
||||
baseMapper.updateById(planChangeStatusData);
|
||||
} else {
|
||||
//只做时间处理
|
||||
planChangeStatusData.setHandleStartTime(planChangeStatusData.getHandleStartTime());//定时任务开始处理时间
|
||||
planChangeStatusData.setHandleFinishTime(new Date());//定时任务处理完成时间
|
||||
baseMapper.updateById(planChangeStatusData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void backUpPlanData(Date handleDateTime,List<DirectivePlanChangeStatus> list) {
|
||||
Map<String, DirectivePlanChangeStatus> changeStatusMap = list.stream()
|
||||
.collect(Collectors.toMap(
|
||||
item -> item.getNuId() + "_" + item.getInstructionTagId(),
|
||||
item -> item,
|
||||
(existing, replacement) -> replacement // 如果有重复key,保留后者
|
||||
));
|
||||
|
||||
List<CareDirectivePlan> allData = baseMapper.selectDataByNuIdAndInstructionTagId(list);
|
||||
|
||||
List<DirectivePlanLog> planLogList = BeanUtil.copyToList(allData, DirectivePlanLog.class);
|
||||
planLogList.stream().forEach(item -> {
|
||||
item.setId(null);
|
||||
item.setChangeBy("定时任务");
|
||||
item.setChangeTime(changeStatusMap.get(item.getNuId()+"_" + item.getInstructionTagId()).getChangeTime());
|
||||
item.setHandleTime(handleDateTime);
|
||||
});
|
||||
directivePlanLogService.saveBatch(planLogList);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.nu.modules.biz.plan.care.service.impl;
|
||||
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanDateLog;
|
||||
import com.nu.modules.biz.plan.care.mapper.DirectivePlanDateLogMapper;
|
||||
import com.nu.modules.biz.plan.care.service.IDirectivePlanDateLogService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 指令日期快照的备份
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DirectivePlanDateLogServiceImpl extends ServiceImpl<DirectivePlanDateLogMapper, DirectivePlanDateLog> implements IDirectivePlanDateLogService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.nu.modules.biz.plan.care.service.impl;
|
||||
|
||||
import com.nu.entity.CareDirectiveEntity;
|
||||
import com.nu.modules.biz.plan.care.entity.DirectivePlanDate;
|
||||
import com.nu.modules.biz.plan.care.mapper.DirectivePlanDateMapper;
|
||||
import com.nu.modules.biz.plan.care.service.IDirectivePlanDateService;
|
||||
import com.nu.modules.care.api.IDirectivePlanDateApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令编排-日期-快照表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2026-03-20
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DirectivePlanDateServiceImpl extends ServiceImpl<DirectivePlanDateMapper, DirectivePlanDate> implements IDirectivePlanDateService, IDirectivePlanDateApi {
|
||||
|
||||
@Override
|
||||
public void saveTable(CareDirectiveEntity careDirectiveEntity) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
|
@ -25,12 +25,11 @@ public class DirectivePlanLogServiceImpl extends ServiceImpl<DirectivePlanLogMap
|
|||
|
||||
@Async
|
||||
@Override
|
||||
public void batchInsert(LoginUser sysUser, List<CareDirectivePlan> list) {
|
||||
public void batchInsert(Date now, LoginUser sysUser, List<CareDirectivePlan> list) {
|
||||
List<DirectivePlanLog> saveList = BeanUtil.copyToList(list, DirectivePlanLog.class);
|
||||
Date changeTime = new Date();
|
||||
saveList.forEach(item -> {
|
||||
item.setId(null);
|
||||
item.setChangeTime(changeTime);//变更时间
|
||||
item.setChangeTime(now);//变更时间
|
||||
item.setChangeBy(sysUser.getRealname());//变更人
|
||||
});
|
||||
saveBatch(saveList);
|
||||
|
|
|
|||
Loading…
Reference in New Issue