pad服务指令编排:

1、新增服务指令集移除
2、调整新增、编辑、单个指令移除接口
3、调整获取分类树接口
4、调整获取已编排数据接口
5、增加机构已启用分类标签获取接口
This commit is contained in:
1378012178@qq.com 2026-03-19 13:22:45 +08:00
parent 6ac14e5adc
commit 1c46814751
14 changed files with 382 additions and 109 deletions

View File

@ -12,6 +12,7 @@ import com.nu.modules.servicepackage.IDirectivePackageApi;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
@ -49,9 +50,19 @@ public class CareDirectiveApi {
*
* @return
*/
@GetMapping(value = "/getInstructionTag")
public Result<List<DirectiveInstructionTagEntity>> getInstructionTag() {
return Result.OK(directiveConfigApi.getInstructionTag());
}
/**
* 获取服务指令树-配置数据
*
* @return
*/
@GetMapping(value = "/getServiceTree")
public Result<Map<String, Object>> getServiceTree() {
return Result.OK(directiveConfigApi.getServiceTree("1"));
public Result<Map<String, Object>> getServiceTree(@Param("insTag") String insTags) {
return Result.OK(directiveConfigApi.getServiceTree(insTags));
}
/**
@ -62,6 +73,11 @@ public class CareDirectiveApi {
*/
@GetMapping(value = "/getNclist")
public Result<Map<String, Object>> getPlanList(CareDirectiveEntity careDirectiveEntity) {
if(StringUtils.isBlank(careDirectiveEntity.getInstructionTagId())){
Map<String, Object> errorResult = Maps.newHashMap();
errorResult.put("msg","未知类型");
return Result.ok(errorResult);
}
Map<String, Object> pageList = careDirectivePlanApi.getPlanList(careDirectiveEntity);
return Result.OK(pageList);
}
@ -126,6 +142,21 @@ public class CareDirectiveApi {
return Result.OK("操作成功");
}
/**
* PAD端编排护理流程-删除服务指令集
*
* @param careDirectiveEntity
* @return
*/
@PostMapping(value = "/deleteDirectiveSet")
public Result<String> deleteDirectiveSet(@RequestBody CareDirectiveEntity careDirectiveEntity) {
if(StringUtils.isBlank(careDirectiveEntity.getPositioning()) || StringUtils.isBlank(careDirectiveEntity.getPositioningLong()) || StringUtils.isBlank(careDirectiveEntity.getInstructionTagId())){
return Result.error("操作失败");
}
careDirectivePlanApi.deleteDirectiveSet(careDirectiveEntity);
return Result.OK("操作成功");
}
/**
* 获取护理单元+老人 当天服务指令
* <p>

View File

@ -30,6 +30,8 @@ public class CareDirectiveEntity implements Serializable {
private String elderId;
/**长者姓名*/
private String elderName;
/**分类标签id*/
private String instructionTagId;
/**服务指令id*/
private String directiveId;
/**指令类型ID*/
@ -83,10 +85,6 @@ public class CareDirectiveEntity implements Serializable {
private String queryType;
/**长者标签列表**/
private List<ElderTagEntity> tagList;
/**
* 1 护理类 2医疗类 3仓库类 5后勤类
*/
private String instructionTagId;
/**
* 查询哪些类型

View File

@ -0,0 +1,53 @@
package com.nu.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
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: 2025-07-10
* @Version: V1.0
*/
@Data
public class DirectiveInstructionTagEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
private String id;
/**分类标签名称*/
private String instructionName;
private String instructionType;
/**排序*/
private Integer sort;
/**状态 0已授权 1未授权*/
private String status;
/**是否启用 Y启用 N未启用*/
private String izEnabled;
/**是否删除 0未删除 1删除*/
private String delFlag;
/**创建人*/
private String createBy;
/**创建日期*/
private Date createTime;
/**更新人*/
private String updateBy;
/**更新日期*/
private Date updateTime;
/**所属部门*/
private String sysOrgCode;
private String icon;
}

View File

@ -15,7 +15,7 @@
<select id="getElderServerList" resultType="com.nu.entity.ElderServerEntity">
select a.*
from nu_biz_nu_care_directive_plan a
from nu_biz_directive_plan a
where a.nu_id = #{params.nuId}

View File

@ -14,4 +14,6 @@ public interface ICareDirectivePlanApi {
List<DirectiveOrderEntity> queryFuture(CareDirectiveEntity dto);
List<DirectiveOrderEntity> queryImmediatelyOrderList(CareDirectiveEntity dto);
void deleteDirectiveSet(CareDirectiveEntity careDirectiveEntity);
}

View File

@ -1,8 +1,12 @@
package com.nu.modules.config;
import com.nu.entity.DirectiveInstructionTagEntity;
import java.util.List;
import java.util.Map;
public interface IDirectiveConfigApi {
Map<String, Object> getServiceTree(String instructionType);
Map<String, Object> getServiceTree(String instructionTypes);
List<DirectiveInstructionTagEntity> getInstructionTag();
}

View File

@ -1,7 +1,9 @@
package com.nu.modules.biz.common.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.entity.DirectiveInstructionTagEntity;
import com.nu.modules.biz.common.entity.BizConfigInstructionTag;
import com.nu.modules.biz.common.entity.BizConfigServiceCategory;
import com.nu.modules.biz.common.entity.BizConfigServiceDirective;
@ -158,19 +160,165 @@ public class BizConfigServiceCategoryServiceImpl extends ServiceImpl<BizConfigSe
// }
// @Override
// public Map<String, Object> getServiceTree(String instructionType) {
// Map<String, Object> result = new HashMap<>();
//
// // 查询护理类服务
// QueryWrapper<BizConfigInstructionTag> instructionTagQueryWrapper = new QueryWrapper<>();
// instructionTagQueryWrapper.eq("iz_enabled", "Y");
// instructionTagQueryWrapper.eq("del_flag", "0");
// instructionTagQueryWrapper.eq("instruction_type", instructionType);
// List<BizConfigInstructionTag> instructionTagList = instructionTagService.list(instructionTagQueryWrapper);
// Map<String, Object> tagMap = new HashMap<String, Object>();
// for (BizConfigInstructionTag par : instructionTagList) {
// tagMap.put(par.getId(), par.getInstructionName());
// }
//
// // 查询服务类别数据
// QueryWrapper<BizConfigServiceCategory> categoryQueryWrapper = new QueryWrapper<>();
// categoryQueryWrapper.eq("iz_enabled", "Y");
// categoryQueryWrapper.eq("del_flag", "0");
// List<BizConfigServiceCategory> categoryList = baseMapper.selectList(categoryQueryWrapper);
//
// // 查询服务类型数据
// QueryWrapper<BizConfigServiceType> typeQueryWrapper = new QueryWrapper<>();
// typeQueryWrapper.eq("iz_enabled", "Y");
// typeQueryWrapper.eq("del_flag", "0");
// List<BizConfigServiceType> typeList = configServiceTypeService.list(typeQueryWrapper);
//
// // 查询服务指令数据
// QueryWrapper<BizConfigServiceDirective> directiveQueryWrapper = new QueryWrapper<>();
// directiveQueryWrapper.eq("iz_enabled", "Y");
// directiveQueryWrapper.eq("del_flag", "0");
// List<BizConfigServiceDirective> directiveList = configServiceDirectiveService.list(directiveQueryWrapper);
//
// // 封装服务指令和服务类型tree集合
// List<Map<String, Object>> typeMapList = new ArrayList<>();
// for (BizConfigServiceType par : typeList) {
// Map<String, Object> wllxMap = new HashMap<String, Object>();
// List<Map<String, Object>> directiceMapList = new ArrayList<Map<String, Object>>();
// for (BizConfigServiceDirective directicePar : directiveList) {
// if (StringUtils.equals(directicePar.getTypeId(), par.getId())) {
// Map<String, Object> directiceMap = new HashMap<String, Object>();
// directiceMap.put("id", directicePar.getId());
// directiceMap.put("title", directicePar.getDirectiveName());
// directiceMap.put("serviceDuration", directicePar.getServiceDuration());
// directiceMap.put("serviceContent", directicePar.getServiceContent());
// directiceMap.put("categoryId", directicePar.getCategoryId());
// directiceMap.put("categoryName", directicePar.getCategoryName());
// directiceMap.put("typeId", directicePar.getTypeId());
// directiceMap.put("typeName", directicePar.getTypeName());
//// directiceMap.put("izPackage", "N");
//
// // 处理文件字段
// directiceMap.put("immediateFile", StringUtils.isNotBlank(directicePar.getImmediateFile()) ? directicePar.getImmediateFile() : "");
// directiceMap.put("immediateFileFocus", StringUtils.isNotBlank(directicePar.getImmediateFileFocus()) ? directicePar.getImmediateFileFocus() : "");
// directiceMap.put("previewFile", StringUtils.isNotBlank(directicePar.getPreviewFile()) ? directicePar.getPreviewFile() : "");
// directiceMap.put("previewFileSmall", StringUtils.isNotBlank(directicePar.getPreviewFileSmall()) ? directicePar.getPreviewFileSmall() : "");
// directiceMap.put("mp3File", StringUtils.isNotBlank(directicePar.getMp3File()) ? directicePar.getMp3File() : "");
// directiceMap.put("mp4File", StringUtils.isNotBlank(directicePar.getMp4File()) ? directicePar.getMp4File() : "");
//
// directiceMap.put("levle", "3");
// directiceMapList.add(directiceMap);
// }
// }
// wllxMap.put("key", par.getId());
// wllxMap.put("parentId", par.getCategoryId());
// wllxMap.put("title", par.getTypeName());
// wllxMap.put("netFlag", par.getNetFlag());
// wllxMap.put("animationPath", StringUtils.split(par.getAnimationPath(), ","));
// wllxMap.put("levle", "2");
// wllxMap.put("children", directiceMapList);
// typeMapList.add(wllxMap);
// }
//
// // 封装服务类别服务类型tree集合fwzl
// List<Map<String, Object>> treeList = new ArrayList<>();
//
// // 封装服务类别直接关联服务指令tree集合jszl
// List<Map<String, Object>> jszlTreeList = new ArrayList<>();
//
// for (BizConfigServiceCategory par : categoryList) {
// if (tagMap.get(par.getInstructionId()) != null) {
// // 1. 处理 fwzl二级+三级+四级
// Map<String, Object> infoMap = new HashMap<String, Object>();
// List<Map<String, Object>> wllxMap2List = new ArrayList<Map<String, Object>>();
//
// for (Map<String, Object> wllxPar : typeMapList) {
// if (StringUtils.equals(par.getId(), wllxPar.get("parentId").toString())) {
// wllxMap2List.add(wllxPar);
// }
// }
//
// infoMap.put("key", par.getId());
// infoMap.put("title", par.getCategoryName().substring(0, 2)); // 保持原有逻辑
// infoMap.put("netFlag", par.getNetFlag());
// infoMap.put("animationPath", StringUtils.split(par.getAnimationPath(), ","));
// infoMap.put("levle", "1");
// infoMap.put("children", wllxMap2List);
// treeList.add(infoMap);
//
// // 2. 处理 jszl二级+四级跳过三级
// Map<String, Object> jszlMap = new HashMap<String, Object>();
// List<Map<String, Object>> jszlChildren = new ArrayList<Map<String, Object>>();
//
// // 收集该二级节点下所有的四级节点
// for (Map<String, Object> wllxPar : typeMapList) {
// if (StringUtils.equals(par.getId(), wllxPar.get("parentId").toString())) {
// List<Map<String, Object>> children = (List<Map<String, Object>>) wllxPar.get("children");
// if (children != null && !children.isEmpty()) {
// jszlChildren.addAll(children);
// }
// }
// }
//
// jszlMap.put("key", par.getId());
// jszlMap.put("title", par.getCategoryName().substring(0, 2)); // 保持原有逻辑
// jszlMap.put("netFlag", par.getNetFlag());
// jszlMap.put("animationPath", StringUtils.split(par.getAnimationPath(), ","));
// jszlMap.put("levle", "1");
// jszlMap.put("children", jszlChildren);
// jszlTreeList.add(jszlMap);
// }
// }
//
// result.put("fwzl", treeList);
// result.put("jszl", jszlTreeList);
// return result;
// }
@Override
public Map<String, Object> getServiceTree(String instructionType) {
public Map<String, Object> getServiceTree(String instructionTypes) {
Map<String, Object> result = new HashMap<>();
// 查询护理类服务
List<String> instructionTypeList = new ArrayList<>();
if (StringUtils.isNotBlank(instructionTypes)) {
String[] types = instructionTypes.split(",");
for (String type : types) {
if (StringUtils.isNotBlank(type)) {
instructionTypeList.add(type.trim());
}
}
}
if (instructionTypeList.isEmpty()) {
result.put("fwzl", new HashMap<>());
result.put("jszl", new ArrayList<>());
return result;
}
QueryWrapper<BizConfigInstructionTag> instructionTagQueryWrapper = new QueryWrapper<>();
instructionTagQueryWrapper.eq("iz_enabled", "Y");
instructionTagQueryWrapper.eq("del_flag", "0");
instructionTagQueryWrapper.eq("instruction_type", instructionType);
instructionTagQueryWrapper.in("instruction_type", instructionTypeList);
List<BizConfigInstructionTag> instructionTagList = instructionTagService.list(instructionTagQueryWrapper);
Map<String, Object> tagMap = new HashMap<String, Object>();
Map<String, Map<String, Object>> tagMapByType = new HashMap<>();
for (BizConfigInstructionTag par : instructionTagList) {
tagMap.put(par.getId(), par.getInstructionName());
String type = par.getInstructionType();
tagMapByType.computeIfAbsent(type, k -> new HashMap<>())
.put(par.getId(), par.getInstructionName());
}
// 查询服务类别数据
@ -207,7 +355,6 @@ public class BizConfigServiceCategoryServiceImpl extends ServiceImpl<BizConfigSe
directiceMap.put("categoryName", directicePar.getCategoryName());
directiceMap.put("typeId", directicePar.getTypeId());
directiceMap.put("typeName", directicePar.getTypeName());
directiceMap.put("izPackage", "N");
// 处理文件字段
directiceMap.put("immediateFile", StringUtils.isNotBlank(directicePar.getImmediateFile()) ? directicePar.getImmediateFile() : "");
@ -231,59 +378,83 @@ public class BizConfigServiceCategoryServiceImpl extends ServiceImpl<BizConfigSe
typeMapList.add(wllxMap);
}
// 封装服务类别服务类型tree集合fwzl
List<Map<String, Object>> treeList = new ArrayList<>();
// 按instructionType分组封装fwzl数据
Map<String, List<Map<String, Object>>> fwzlResultMap = new HashMap<>();
// 封装服务类别直接关联服务指令tree集合jszl
// 初始化每个instructionType的列表
for (String type : instructionTypeList) {
fwzlResultMap.put(type, new ArrayList<>());
}
// 处理jszl数据保持不变但需要关联instructionType
List<Map<String, Object>> jszlTreeList = new ArrayList<>();
for (BizConfigServiceCategory par : categoryList) {
if (tagMap.get(par.getInstructionId()) != null) {
// 1. 处理 fwzl二级+三级+四级
Map<String, Object> infoMap = new HashMap<String, Object>();
List<Map<String, Object>> wllxMap2List = new ArrayList<Map<String, Object>>();
// 按instructionType分别处理fwzl数据
for (Map.Entry<String, Map<String, Object>> typeEntry : tagMapByType.entrySet()) {
String currentType = typeEntry.getKey();
Map<String, Object> currentTagMap = typeEntry.getValue();
List<Map<String, Object>> currentTypeTreeList = fwzlResultMap.get(currentType);
for (Map<String, Object> wllxPar : typeMapList) {
if (StringUtils.equals(par.getId(), wllxPar.get("parentId").toString())) {
wllxMap2List.add(wllxPar);
}
}
for (BizConfigServiceCategory par : categoryList) {
if (currentTagMap.get(par.getInstructionId()) != null) {
// 处理 fwzl二级+三级+四级
Map<String, Object> infoMap = new HashMap<String, Object>();
List<Map<String, Object>> wllxMap2List = new ArrayList<Map<String, Object>>();
infoMap.put("key", par.getId());
infoMap.put("title", par.getCategoryName().substring(0, 2)); // 保持原有逻辑
infoMap.put("netFlag", par.getNetFlag());
infoMap.put("animationPath", StringUtils.split(par.getAnimationPath(), ","));
infoMap.put("levle", "1");
infoMap.put("children", wllxMap2List);
treeList.add(infoMap);
// 2. 处理 jszl二级+四级跳过三级
Map<String, Object> jszlMap = new HashMap<String, Object>();
List<Map<String, Object>> jszlChildren = new ArrayList<Map<String, Object>>();
// 收集该二级节点下所有的四级节点
for (Map<String, Object> wllxPar : typeMapList) {
if (StringUtils.equals(par.getId(), wllxPar.get("parentId").toString())) {
List<Map<String, Object>> children = (List<Map<String, Object>>) wllxPar.get("children");
if (children != null && !children.isEmpty()) {
jszlChildren.addAll(children);
for (Map<String, Object> wllxPar : typeMapList) {
if (StringUtils.equals(par.getId(), wllxPar.get("parentId").toString())) {
wllxMap2List.add(wllxPar);
}
}
}
jszlMap.put("key", par.getId());
jszlMap.put("title", par.getCategoryName().substring(0, 2)); // 保持原有逻辑
jszlMap.put("netFlag", par.getNetFlag());
jszlMap.put("animationPath", StringUtils.split(par.getAnimationPath(), ","));
jszlMap.put("levle", "1");
jszlMap.put("children", jszlChildren);
jszlTreeList.add(jszlMap);
infoMap.put("key", par.getId());
infoMap.put("title", par.getCategoryName().substring(0, 2));
infoMap.put("netFlag", par.getNetFlag());
infoMap.put("animationPath", StringUtils.split(par.getAnimationPath(), ","));
infoMap.put("levle", "1");
infoMap.put("children", wllxMap2List);
currentTypeTreeList.add(infoMap);
// 处理 jszl这里假设jszl也需要根据instructionType区分如果需要区分也需要修改
// 如果不区分可以保留原有逻辑
Map<String, Object> jszlMap = new HashMap<String, Object>();
List<Map<String, Object>> jszlChildren = new ArrayList<Map<String, Object>>();
// 收集该二级节点下所有的四级节点
for (Map<String, Object> wllxPar : typeMapList) {
if (StringUtils.equals(par.getId(), wllxPar.get("parentId").toString())) {
List<Map<String, Object>> children = (List<Map<String, Object>>) wllxPar.get("children");
if (children != null && !children.isEmpty()) {
jszlChildren.addAll(children);
}
}
}
jszlMap.put("key", par.getId());
jszlMap.put("title", par.getCategoryName().substring(0, 2));
jszlMap.put("netFlag", par.getNetFlag());
jszlMap.put("animationPath", StringUtils.split(par.getAnimationPath(), ","));
jszlMap.put("levle", "1");
jszlMap.put("children", jszlChildren);
// 判断是否需要按instructionType区分jszl
// 如果需要区分可以按type存储如果不需要去重后加入
if (!jszlTreeList.contains(jszlMap)) {
jszlTreeList.add(jszlMap);
}
}
}
}
result.put("fwzl", treeList);
result.put("fwzl", fwzlResultMap);
result.put("jszl", jszlTreeList);
return result;
}
@Override
public List<DirectiveInstructionTagEntity> getInstructionTag() {
return BeanUtil.copyToList(instructionTagService.list(new QueryWrapper<BizConfigInstructionTag>().eq("iz_enabled", "Y")), DirectiveInstructionTagEntity.class);
}
}

View File

@ -14,7 +14,7 @@
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.opt_time as optTime,
a.opt_count as optCount
from nu_biz_nu_care_directive_plan a
from nu_biz_directive_plan a
where a.cycle_type_id != '2'
<if test="nuId != null and nuId != ''">
AND nu_id = #{nuId}
@ -42,7 +42,7 @@
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.opt_time as optTime,
a.opt_count as optCount
from nu_biz_nu_care_directive_plan a
from nu_biz_directive_plan a
where id = #{id}
</select>

View File

@ -72,7 +72,7 @@
CREATE TABLE IF NOT EXISTS ${tableName} (
id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID',
pool_type varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据池类型 1护理;2医疗:3仓库;4行政',
biz_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令计划ID,nu_biz_nu_care_directive_plan.id;即时指令计划ID,nu_biz_nu_care_directive_plan_instant.id',
biz_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令计划ID,nu_biz_directive_plan.id;即时指令计划ID,nu_biz_nu_care_directive_plan_instant.id',
nu_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '护理单元IDnu_base_info.id',
directive_id varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '服务指令IDnu_config_service_directive.id',
cycle_type_id varchar(3) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '指令类型ID',

View File

@ -721,7 +721,7 @@ public class DirectiveOrderServiceImpl extends ServiceImpl<DirectiveOrderMapper,
String orderType = directiveOrder.getOrderType();
if (orderType.equals("1")) {
//护理即时
directiveOrder.setTableName("nu_biz_nu_care_directive_plan");
directiveOrder.setTableName("nu_biz_directive_plan");
}
if (orderType.equals("2")) {
//医疗即时

View File

@ -19,7 +19,7 @@ import lombok.experimental.Accessors;
* @Version: V1.0
*/
@Data
@TableName("nu_biz_nu_care_directive_plan")
@TableName("nu_biz_directive_plan")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_biz_nu_care_directive_plan对象", description="护理类服务指令计划")
@ -31,6 +31,8 @@ public class CareDirectivePlan implements Serializable {
private String id;
/**护理单元id*/
private String nuId;
/**分类标签id*/
private String instructionTagId;
/**服务指令id*/
private String directiveId;
/**指令类型ID*/
@ -100,7 +102,7 @@ public class CareDirectivePlan implements Serializable {
/**服务类别id*/
@TableField(exist = false)
private String categoryId;
/**服务类别名称*/
@TableField(exist = false)
private String categoryName;

View File

@ -23,4 +23,5 @@ public interface CareDirectivePlanMapper extends BaseMapper<CareDirectivePlan> {
List<DirectiveOrderEntity> queryFuture( @Param("dto") CareDirectiveEntity dto);
int deleteDirectiveSet(@Param("dto") CareDirectiveEntity careDirectiveEntity);
}

View File

@ -103,13 +103,21 @@
<delete id="deleteByIdPhysic">
delete
from nu_biz_nu_care_directive_plan
from nu_biz_directive_plan
where id = #{id}
</delete>
<delete id="deleteDirectiveSet">
delete
from nu_biz_directive_plan
where positioning = #{dto.positioning}
and positioning_long = #{dto.positioningLong}
and instruction_tag_id = #{dto.instructionTagId}
</delete>
<select id="queryTotal" resultType="java.lang.Integer">
SELECT COUNT(p.id) as total_count
FROM nu_biz_nu_care_directive_plan p
FROM nu_biz_directive_plan p
WHERE p.nu_id = #{nuId}
AND (
-- 1: 每天执行
@ -200,7 +208,7 @@
plan.update_time,
plan.sys_org_code,
plan.iz_package
FROM nu_biz_nu_care_directive_plan plan
FROM nu_biz_directive_plan plan
LEFT JOIN nu_base_info base ON plan.nu_id = base.nu_id
LEFT JOIN nu_config_service_directive directive ON plan.iz_package = 'N' AND plan.directive_id = directive.id
LEFT JOIN nu_config_directive_package_main package ON plan.iz_package = 'Y' AND plan.directive_id = package.id
@ -210,6 +218,9 @@
<if test="dto != null and dto.nuId != null and dto.nuId != ''">
AND plan.nu_id = #{dto.nuId}
</if>
<if test="dto != null and dto.instructionTagId != null and dto.instructionTagId != ''">
AND plan.instruction_tag_id = #{dto.instructionTagId}
</if>
<if test="dto != null and dto.queryType != null and dto.queryType != ''">
<choose>
<when test="dto.queryType == 'service'">
@ -283,7 +294,7 @@
p.iz_package,
pd.directive_id AS sub_id,
pd.directive_id AS sub_directive_id
FROM nu_biz_nu_care_directive_plan p
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.iz_package = 'N' AND p.directive_id = directive.id
LEFT JOIN nu_config_directive_package_main package ON p.iz_package = 'Y' AND p.directive_id = package.id

View File

@ -43,39 +43,39 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
Map<String, Object> resMap = new HashMap<>();
//服务指令计划
careDirectiveEntity.setQueryType("service");
List<CareDirectivePlan> groupList = baseMapper.list(careDirectiveEntity);
if (!CollectionUtils.isEmpty(groupList)) {
//将包的指令塞进去写一个sql效率低
CareDirectivePackageEntity queryParams = new CareDirectivePackageEntity();
List<CareDirectivePackageEntity> ids = Lists.newArrayList();
groupList.stream().forEach(item -> {
CareDirectivePackageEntity d_ = new CareDirectivePackageEntity();
if ("Y".equals(item.getIzPackage())) {
d_.setId(item.getDirectiveId());
ids.add(d_);
}
});
List<CareDirectivePackageEntity> packagelist = directivePackageService.getNcPackagelist(queryParams, ids);
if (!CollectionUtils.isEmpty(groupList)) {
Map<String, CareDirectivePackageEntity> packageMap = packagelist.stream()
.collect(Collectors.toMap(
CareDirectivePackageEntity::getId,
entity -> entity,
(existing, replacement) -> existing
));
groupList.stream().forEach(item -> {
if ("Y".equals(item.getIzPackage())) {
List<DirectiveEntity> directives = packageMap.get(item.getDirectiveId()).getDirectives();
if (CollectionUtils.isEmpty(directives)) {
directives = List.of();
}
item.setDirectivesList(BeanUtil.copyToList(directives, CareDirectivePlan.class));
}
});
}
}
List<CareDirectivePlan> planList = baseMapper.list(careDirectiveEntity);
// if (!CollectionUtils.isEmpty(groupList)) {
// //将包的指令塞进去写一个sql效率低
// CareDirectivePackageEntity queryParams = new CareDirectivePackageEntity();
// List<CareDirectivePackageEntity> ids = Lists.newArrayList();
// groupList.stream().forEach(item -> {
// CareDirectivePackageEntity d_ = new CareDirectivePackageEntity();
// if ("Y".equals(item.getIzPackage())) {
// d_.setId(item.getDirectiveId());
// ids.add(d_);
// }
// });
// List<CareDirectivePackageEntity> packagelist = directivePackageService.getNcPackagelist(queryParams, ids);
// if (!CollectionUtils.isEmpty(groupList)) {
// Map<String, CareDirectivePackageEntity> packageMap = packagelist.stream()
// .collect(Collectors.toMap(
// CareDirectivePackageEntity::getId,
// entity -> entity,
// (existing, replacement) -> existing
// ));
// groupList.stream().forEach(item -> {
// if ("Y".equals(item.getIzPackage())) {
// List<DirectiveEntity> directives = packageMap.get(item.getDirectiveId()).getDirectives();
// if (CollectionUtils.isEmpty(directives)) {
// directives = List.of();
// }
// item.setDirectivesList(BeanUtil.copyToList(directives, CareDirectivePlan.class));
// }
// });
// }
// }
resMap.put("serviceList", groupList);//服务指令计划
resMap.put("serviceList", planList);//服务指令计划
//即时指令
careDirectiveEntity.setQueryType("instant");
List<CareDirectivePlan> instantList = baseMapper.list(careDirectiveEntity);
@ -126,12 +126,11 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
CareDirectivePlan careDirectivePlan = new CareDirectivePlan();
BeanUtils.copyProperties(careDirectiveEntity, careDirectivePlan);
baseMapper.insert(careDirectivePlan);
//TODO 增加日志
return careDirectiveEntity;
//单一指令生成到数据池
dataPoolServiceImpl.generateDataPool(careDirectivePlan);
BeanUtils.copyProperties(careDirectivePlan, careDirectiveEntity);
return careDirectiveEntity;
// dataPoolServiceImpl.generateDataPool(careDirectivePlan);
// BeanUtils.copyProperties(careDirectivePlan, careDirectiveEntity);
}
@Override
@ -141,21 +140,17 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
CareDirectivePlan entity = baseMapper.selectById(careDirectiveEntity.getId());
baseMapper.deleteByIdPhysic(careDirectiveEntity.getId());
baseMapper.insert(careDirectivePlan);
// baseMapper.updateById(bizNuCareDirectivePlan);
//TODO 增加日志
//调用方法先删除数据池中的数据再生成数据池中的数据
dataPoolServiceImpl.editDataPool(entity);
// dataPoolServiceImpl.editDataPool(entity);
}
@Override
public void deleteDirective(CareDirectiveEntity careDirectiveEntity) {
CareDirectivePlan careDirectivePlan = new CareDirectivePlan();
BeanUtils.copyProperties(careDirectiveEntity, careDirectivePlan);
String id = careDirectivePlan.getId();
baseMapper.deleteByIdPhysic(careDirectiveEntity.getId());
//调用方法删除数据池中的数据
dataPoolServiceImpl.deleteDataPool(careDirectivePlan);
baseMapper.deleteByIdPhysic(id);
//TODO 增加日志
// CareDirectivePlan careDirectivePlan = new CareDirectivePlan();
// BeanUtils.copyProperties(careDirectiveEntity, careDirectivePlan);
// dataPoolServiceImpl.deleteDataPool(careDirectivePlan);
}
@Override
@ -174,6 +169,11 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
}
}
@Override
public void deleteDirectiveSet(CareDirectiveEntity careDirectiveEntity) {
baseMapper.deleteDirectiveSet(careDirectiveEntity);
}
@Override
public int queryTotal(String nuId, String elderId) {
return baseMapper.queryTotal(nuId, elderId);