统计:护理、行政、后勤 当天矩阵编排指令总数、当天已执行完成总数

This commit is contained in:
1378012178@qq.com 2026-01-08 09:50:46 +08:00
parent 02981291b2
commit f93227c177
18 changed files with 431 additions and 69 deletions

View File

@ -43,4 +43,6 @@ public interface IDirectiveOrderApi {
IPage<DirectiveOrderEntity> queryWorkOrderList(Integer pageNo, Integer pageSize, DirectiveOrderEntity directiveOrderEntity, HttpServletRequest req); IPage<DirectiveOrderEntity> queryWorkOrderList(Integer pageNo, Integer pageSize, DirectiveOrderEntity directiveOrderEntity, HttpServletRequest req);
int queryTodayFinishedTotal(String type,String nuId, String elderId);
} }

View File

@ -3,21 +3,31 @@ package com.nu.modules.biz.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nu.modules.biz.order.entity.DirectiveOrder; import com.nu.modules.biz.order.entity.DirectiveOrder;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* @Description: 服务指令工单主表 * @Description: 服务指令工单主表
* @Author: caolei * @Author: caolei
* @Date: 2025-11-18 * @Date: 2025-11-18
* @Version: V1.0 * @Version: V1.0
*/ */
public interface DirectiveOrderMapper extends BaseMapper<DirectiveOrder> { public interface DirectiveOrderMapper extends BaseMapper<DirectiveOrder> {
List<DirectiveOrder> queryDataPoolList(DirectiveOrder orders); List<DirectiveOrder> queryDataPoolList(DirectiveOrder orders);
List<DirectiveOrder> getEmpPermissionAndOnline(@Param("directiveIds") String directiveIds, @Param("employeeIds") String employeeIds, @Param("startTime") Date startTime); List<DirectiveOrder> getEmpPermissionAndOnline(@Param("directiveIds") String directiveIds, @Param("employeeIds") String employeeIds, @Param("startTime") Date startTime);
DirectiveOrder getEmpOrderly(@Param("elderId") String elderId); DirectiveOrder getEmpOrderly(@Param("elderId") String elderId);
List<DirectiveOrder> getPermissionEmps(@Param("directiveIds") String directiveIds); List<DirectiveOrder> getPermissionEmps(@Param("directiveIds") String directiveIds);
void updatePoolIzOrder(@Param("poolId") String poolId); void updatePoolIzOrder(@Param("poolId") String poolId);
DirectiveOrder getDirectivePrice(@Param("directiveId") String directiveId); DirectiveOrder getDirectivePrice(@Param("directiveId") String directiveId);
DirectiveOrder selectInfoById(@Param("id") String id); DirectiveOrder selectInfoById(@Param("id") String id);
int queryTodayFinishedTotal(@Param("type") String type, @Param("nuId") String nuId, @Param("elderId") String elderId);
} }

View File

@ -3,74 +3,73 @@
<mapper namespace="com.nu.modules.biz.order.mapper.DirectiveOrderMapper"> <mapper namespace="com.nu.modules.biz.order.mapper.DirectiveOrderMapper">
<select id="queryDataPoolList" resultType="com.nu.modules.biz.order.entity.DirectiveOrder"> <select id="queryDataPoolList" resultType="com.nu.modules.biz.order.entity.DirectiveOrder">
select select a.id as poolId,
a.id as poolId, a.biz_id as bizId,
a.biz_id as bizId, a.nu_id as nuId,
a.nu_id as nuId, a.nu_name as nuName,
a.nu_name as nuName, a.elder_id as elderId,
a.elder_id as elderId, a.elder_name as elderName,
a.elder_name as elderName, a.directive_id as directiveId,
a.directive_id as directiveId, a.directive_name as directiveName,
a.directive_name as directiveName, a.cycle_type_id as cycleTypeId,
a.cycle_type_id as cycleTypeId, a.cycle_type as cycleType,
a.cycle_type as cycleType, a.cycle_value as cycleValue,
a.cycle_value as cycleValue, a.preview_file as previewFile,
a.preview_file as previewFile, a.net_preview_file as netPeviewFile,
a.net_preview_file as netPeviewFile, a.preview_file_small as previewFileSmall,
a.preview_file_small as previewFileSmall, a.net_preview_file_small as netPreviewFileSmall,
a.net_preview_file_small as netPreviewFileSmall, a.mp3_file as mp3File,
a.mp3_file as mp3File, a.net_mp3_file as netMp3File,
a.net_mp3_file as netMp3File, a.mp4_file as mp4File,
a.mp4_file as mp4File, a.net_mp4_file as netMp4File,
a.net_mp4_file as netMp4File, a.service_duration as serviceDuration,
a.service_duration as serviceDuration, a.service_content as serviceContent,
a.service_content as serviceContent, a.package_id as packageId,
a.package_id as packageId, a.package_name as packageName,
a.package_name as packageName, a.iz_package as izPackage,
a.iz_package as izPackage, a.start_time as startTime,
a.start_time as startTime, a.end_time as endTime,
a.end_time as endTime, (case when b.orderly is null then 2 else 1 end) as orderEmp
(case when b.orderly is null then 2 else 1 end) as orderEmp
from nu_biz_nu_care_directive_data_pool a from nu_biz_nu_care_directive_data_pool a
left join nu_biz_elder_info b on a.elder_id = b.id left join nu_biz_elder_info b on a.elder_id = b.id
where a.iz_orders = 'N' where a.iz_orders = 'N'
order by a.start_time,orderEmp,a.nu_id order by a.start_time, orderEmp, a.nu_id
</select> </select>
<select id="getEmpPermissionAndOnline" resultType="com.nu.modules.biz.order.entity.DirectiveOrder"> <select id="getEmpPermissionAndOnline" resultType="com.nu.modules.biz.order.entity.DirectiveOrder">
select select
distinct distinct
a.id as employeeId, a.id as employeeId,
a.name as employeeName, a.name as employeeName,
a.order_cap as orderCap, a.order_cap as orderCap,
ifnull(e.orderNum,0) as orderNum, ifnull(e.orderNum,0) as orderNum,
ifnull(e.totalDuration,0) as totalDuration, ifnull(e.totalDuration,0) as totalDuration,
ifnull(e.totalComPrice,0) as totalComPrice, ifnull(e.totalComPrice,0) as totalComPrice,
e.maxTime, e.maxTime,
ifnull(e.ownCn,0) as ownCn, ifnull(e.ownCn,0) as ownCn,
(case when ifnull(f.orderNum,0) = 0 then 1 else 0 end) as izFree, (case when ifnull(f.orderNum,0) = 0 then 1 else 0 end) as izFree,
0 as level 0 as level
from nu_biz_employees_info a from nu_biz_employees_info a
inner join nu_biz_employees_servcie_tags b on a.id = b.employees_id inner join nu_biz_employees_servcie_tags b on a.id = b.employees_id
inner join nu_service_tag c on c.id = b.tags_id inner join nu_service_tag c on c.id = b.tags_id
inner join nu_servtag_directive d on d.tag_id = c.id inner join nu_servtag_directive d on d.tag_id = c.id
left join ( left join (
select employee_id,count(*) as orderNum, select employee_id,count(*) as orderNum,
sum(service_duration) as totalDuration, sum(service_duration) as totalDuration,
round(sum(ifnull(com_price,0)),4) as totalComPrice, round(sum(ifnull(com_price,0)),4) as totalComPrice,
max(start_time) as maxTime, max(start_time) as maxTime,
sum(case when iz_finish='N' then 1 else 0 end) as ownCn sum(case when iz_finish='N' then 1 else 0 end) as ownCn
from nu_biz_nu_directive_order_sub from nu_biz_nu_directive_order_sub
where start_time >=DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00') where start_time >=DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00')
and start_time &lt;=DATE_FORMAT(NOW(), '%Y-%m-%d 23:59:59') and start_time &lt;=DATE_FORMAT(NOW(), '%Y-%m-%d 23:59:59')
group by employee_id group by employee_id
) e on a.id = e.employee_id ) e on a.id = e.employee_id
left join ( left join (
select employee_id,sum(case when iz_finish='N' then 1 else 0 end) as orderNum select employee_id,sum(case when iz_finish='N' then 1 else 0 end) as orderNum
from nu_biz_nu_directive_order_sub from nu_biz_nu_directive_order_sub
where start_time = #{startTime} where start_time = #{startTime}
or (start_time &lt; #{startTime} and end_time > #{startTime}) or (start_time &lt; #{startTime} and end_time > #{startTime})
group by employee_id group by employee_id
) f on a.id = f.employee_id ) f on a.id = f.employee_id
where a.del_flag = '0' where a.del_flag = '0'
and a.iz_freeze = 'N' and a.iz_freeze = 'N'
@ -135,5 +134,23 @@
ON mainStatus.dict_id = dict.id AND mainStatus.item_value = a.opt_type ON mainStatus.dict_id = dict.id AND mainStatus.item_value = a.opt_type
where a.id = #{id} where a.id = #{id}
</select> </select>
<select id="queryTodayFinishedTotal" resultType="java.lang.Integer">
SELECT COUNT(*) as total_count
FROM nu_biz_nu_directive_order_sub
<where>
iz_finish = 'Y'
AND DATE(start_time) = CURDATE()
<if test="type != null">
AND order_type = #{type}
</if>
<if test="nuId != null">
AND nu_id = #{nuId}
</if>
<if test="elderId != null">
AND elder_id = #{elderId}
</if>
AND del_flag = '0'
</where>
</select>
</mapper> </mapper>

View File

@ -172,6 +172,11 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
return entityPage; return entityPage;
} }
@Override
public int queryTodayFinishedTotal(String type,String nuId, String elderId) {
return baseMapper.queryTodayFinishedTotal(type,nuId, elderId);
}
@Override @Override
public Map<String, Object> editSubMp4(DirectiveOrderSubEntity directiveOrderSubEntity) { public Map<String, Object> editSubMp4(DirectiveOrderSubEntity directiveOrderSubEntity) {
DirectiveOrderSub directiveOrderSub = new DirectiveOrderSub(); DirectiveOrderSub directiveOrderSub = new DirectiveOrderSub();

View File

@ -0,0 +1,96 @@
package com.nu.modules.biz.plan.care.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.beust.jcommander.internal.Maps;
import com.nu.entity.DirectiveOrderSubEntity;
import com.nu.modules.biz.plan.care.entity.CareDirectivePlan;
import com.nu.modules.biz.plan.care.service.ICareDirectivePlanService;
import com.nu.modules.biz.plan.invoicing.entity.InvoicingDirectivePlan;
import com.nu.modules.biz.plan.invoicing.service.IInvoicingDirectivePlanService;
import com.nu.modules.biz.plan.logistics.entity.LogisticsDirectivePlan;
import com.nu.modules.biz.plan.logistics.service.LogisticsDirectivePlanService;
import com.nu.modules.order.api.IDirectiveOrderApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @Description: 长者矩阵
* @Author: 张明远
* @Date: 2025-03-13
* @Version: V1.0
*/
@Api(tags = "长者矩阵")
@RestController
@RequestMapping("/services/directivePlan")
@Slf4j
public class DirectivePlanController extends JeecgController<CareDirectivePlan, ICareDirectivePlanService> {
@Autowired
private ICareDirectivePlanService careDirectivePlanService;
@Autowired
private IInvoicingDirectivePlanService invoicingDirectivePlanService;
@Autowired
private LogisticsDirectivePlanService logisticsDirectivePlanService;
@Autowired
private IDirectiveOrderApi directiveOrderApi;
/**
* 查询长者当天已完整指令数量/矩阵中编排的数量 分子会比分母大
*
* @return
*/
@ApiOperation(value = "查询长者当天已完整指令数量/矩阵中编排的数量", notes = "查询长者当天已完整指令数量/矩阵中编排的数量")
@GetMapping(value = "/queryCountByType")
public Result<Map<String, Object>> queryCountByType(@RequestParam("nuId") String nuId, @RequestParam("elderId") String elderId) {
Map<String, Object> result = Maps.newHashMap();
//护理类即时指令
{
//当天已完成总数
int hllFinishedTotal = directiveOrderApi.queryTodayFinishedTotal("1", nuId, elderId);
result.put("hllFinishedTotal", hllFinishedTotal);
//当天编排好的非即时指令总数量
int hllTotal = careDirectivePlanService.queryTotal(nuId, elderId);
result.put("hllTotal", hllTotal);
}
//TODO 医疗类即时指令
{
}
//仓库类即时指令
{
//当天已完成总数
int hllFinishedTotal = directiveOrderApi.queryTodayFinishedTotal("3", nuId, null);
result.put("cklFinishedTotal", hllFinishedTotal);
//当天编排好的非即时指令总数量
int hllTotal = invoicingDirectivePlanService.queryTotal(nuId);
result.put("cklTotal", hllTotal);
}
//后勤类即时指令
{
//当天已完成总数
int hllFinishedTotal = directiveOrderApi.queryTodayFinishedTotal("4", nuId, elderId);
result.put("hqlFinishedTotal", hllFinishedTotal);
//当天编排好的非即时指令总数量
int hllTotal = logisticsDirectivePlanService.queryTotal(nuId, elderId);
result.put("hqlTotal", hllTotal);
}
return Result.OK(result);
}
}

View File

@ -68,7 +68,7 @@ public class DirectivePlanInstantController extends JeecgController<CareDirectiv
List<InvoicingDirectivePlanInstant> invoicingList = invoicingDirectivePlanInstantService.list(invoicingQW); List<InvoicingDirectivePlanInstant> invoicingList = invoicingDirectivePlanInstantService.list(invoicingQW);
result.put("invoicing", invoicingList); result.put("invoicing", invoicingList);
//行政类即时指令 //后勤类即时指令
QueryWrapper<LogisticsDirectivePlanInstant> logisticsQW = new QueryWrapper<>(); QueryWrapper<LogisticsDirectivePlanInstant> logisticsQW = new QueryWrapper<>();
logisticsQW.eq("nu_id", nuId); logisticsQW.eq("nu_id", nuId);
logisticsQW.eq("elder_id", elderId); logisticsQW.eq("elder_id", elderId);

View File

@ -21,4 +21,6 @@ public interface CareDirectivePlanMapper extends BaseMapper<CareDirectivePlan> {
List<CareDirectivePlan> getNcDirectiveList(@Param("params") CareDirectivePlan planBizNuCustomerServer); List<CareDirectivePlan> getNcDirectiveList(@Param("params") CareDirectivePlan planBizNuCustomerServer);
int deleteByIdPhysic(@Param("id") String id); int deleteByIdPhysic(@Param("id") String id);
int queryTotal(@Param("nuId") String nuId, @Param("elderId") String elderId);
} }

View File

@ -2,7 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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.CareDirectivePlanMapper"> <mapper namespace="com.nu.modules.biz.plan.care.mapper.CareDirectivePlanMapper">
<delete id="deleteByIdPhysic"> <delete id="deleteByIdPhysic">
delete from nu_biz_nu_care_directive_plan where id = #{id} delete
from nu_biz_nu_care_directive_plan
where id = #{id}
</delete> </delete>
<select id="getGroupPositioning" resultType="com.nu.modules.biz.plan.care.entity.CareDirectivePlan"> <select id="getGroupPositioning" resultType="com.nu.modules.biz.plan.care.entity.CareDirectivePlan">
@ -12,9 +14,9 @@
<select id="getNcPackagelist" resultType="com.nu.modules.biz.plan.care.entity.DirectivePackagePlan"> <select id="getNcPackagelist" resultType="com.nu.modules.biz.plan.care.entity.DirectivePackagePlan">
select id, select id,
package_name as packageName, package_name as packageName,
total_duration as serviceDuration, total_duration as serviceDuration,
description description
from nu_config_directive_package from nu_config_directive_package
where del_flag = '0' where del_flag = '0'
and iz_enabled = 'Y' and iz_enabled = 'Y'
@ -38,4 +40,73 @@
</if> </if>
</where> </where>
</select> </select>
<select id="queryTotal" resultType="java.lang.Integer">
SELECT
COUNT(*) as total_count
FROM
nu_biz_nu_care_directive_plan p
LEFT JOIN
nu_config_package_directive pd ON p.directive_id = pd.package_id
WHERE
p.nu_id = #{nuId}
AND p.elder_id = #{elderId}
AND (
-- 条件1: 包数据 (cycle_type_id为空或空字符串)
(
(p.cycle_type_id IS NULL OR p.cycle_type_id = '')
AND (
-- 包数据按星期执行
(
pd.cycle_value IN ('0','1','2','3','4','5','6')
AND pd.cycle_value = (
CASE DAYOFWEEK(CURDATE())
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
)
)
OR
-- 包数据按日期执行
(
LENGTH(pd.cycle_value) = 2
AND pd.cycle_value = DATE_FORMAT(CURDATE(), '%d')
)
)
)
-- 条件2: 日常类型指令 (cycle_type_id = '1')
OR p.cycle_type_id = '1'
-- 条件3: 周期类型指令 (cycle_type_id = '2')
OR (
p.cycle_type_id = '2'
AND (
-- 周期指令按星期执行
(
p.cycle_value IN ('0','1','2','3','4','5','6')
AND p.cycle_value = (
CASE DAYOFWEEK(CURDATE())
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
)
)
OR
-- 周期指令按日期执行
(
LENGTH(p.cycle_value) = 2
AND p.cycle_value = DATE_FORMAT(CURDATE(), '%d')
)
)
)
);
</select>
</mapper> </mapper>

View File

@ -11,4 +11,5 @@ import com.nu.modules.biz.plan.care.entity.CareDirectivePlan;
*/ */
public interface ICareDirectivePlanService extends IService<CareDirectivePlan> { public interface ICareDirectivePlanService extends IService<CareDirectivePlan> {
int queryTotal(String nuId, String elderId);
} }

View File

@ -445,4 +445,9 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
getOpeMediaAddress(); getOpeMediaAddress();
return serverNetUrl + imageUrl; return serverNetUrl + imageUrl;
} }
@Override
public int queryTotal(String nuId, String elderId) {
return baseMapper.queryTotal(nuId,elderId);
}
} }

View File

@ -12,4 +12,6 @@ import org.apache.ibatis.annotations.Param;
*/ */
public interface InvoicingDirectivePlanMapper extends BaseMapper<InvoicingDirectivePlan> { public interface InvoicingDirectivePlanMapper extends BaseMapper<InvoicingDirectivePlan> {
int deleteByIdPhysic(@Param("id") String id); int deleteByIdPhysic(@Param("id") String id);
int queryTotal(@Param("nuId") String nuId);
} }

View File

@ -4,4 +4,72 @@
<delete id="deleteByIdPhysic"> <delete id="deleteByIdPhysic">
delete from nu_biz_nu_invoicing_directive_plan where id = #{id} delete from nu_biz_nu_invoicing_directive_plan where id = #{id}
</delete> </delete>
<select id="queryTotal" resultType="java.lang.Integer">
SELECT
COUNT(*) as total_count
FROM
nu_biz_nu_invoicing_directive_plan p
LEFT JOIN
nu_config_package_directive pd ON p.directive_id = pd.package_id
WHERE
p.nu_id = #{nuId}
AND (
-- 条件1: 包数据 (cycle_type_id为空或空字符串)
(
(p.cycle_type_id IS NULL OR p.cycle_type_id = '')
AND (
-- 包数据按星期执行
(
pd.cycle_value IN ('0','1','2','3','4','5','6')
AND pd.cycle_value = (
CASE DAYOFWEEK(CURDATE())
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
)
)
OR
-- 包数据按日期执行
(
LENGTH(pd.cycle_value) = 2
AND pd.cycle_value = DATE_FORMAT(CURDATE(), '%d')
)
)
)
-- 条件2: 日常类型指令 (cycle_type_id = '1')
OR p.cycle_type_id = '1'
-- 条件3: 周期类型指令 (cycle_type_id = '2')
OR (
p.cycle_type_id = '2'
AND (
-- 周期指令按星期执行
(
p.cycle_value IN ('0','1','2','3','4','5','6')
AND p.cycle_value = (
CASE DAYOFWEEK(CURDATE())
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
)
)
OR
-- 周期指令按日期执行
(
LENGTH(p.cycle_value) = 2
AND p.cycle_value = DATE_FORMAT(CURDATE(), '%d')
)
)
)
);
</select>
</mapper> </mapper>

View File

@ -12,4 +12,6 @@ import com.nu.modules.biz.plan.invoicing.entity.InvoicingDirectivePlan;
*/ */
public interface IInvoicingDirectivePlanService extends IService<InvoicingDirectivePlan> { public interface IInvoicingDirectivePlanService extends IService<InvoicingDirectivePlan> {
int queryTotal(String nuId);
} }

View File

@ -15,6 +15,7 @@ import com.nu.modules.invoicing.api.IInvoicingDirectivePlanApi;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -22,7 +23,7 @@ import java.util.Map;
/** /**
* @Description: 护理单元客户仓库类服务指令计划 * @Description: 护理单元客户仓库类服务指令计划
* @Author: caolei * @Author: caolei
* @Date: 2026-1-6 * @Date: 2026-1-6
* @Version: V1.0 * @Version: V1.0
*/ */
@Service @Service
@ -55,7 +56,7 @@ public class InvoicingDirectivePlanServiceImpl extends ServiceImpl<InvoicingDire
@Override @Override
public InvoicingDirectiveEntity addDirective(InvoicingDirectiveEntity invoicingDirectiveEntity) { public InvoicingDirectiveEntity addDirective(InvoicingDirectiveEntity invoicingDirectiveEntity) {
InvoicingDirectivePlan invoicingDirectivePlan = new InvoicingDirectivePlan(); InvoicingDirectivePlan invoicingDirectivePlan = new InvoicingDirectivePlan();
BeanUtils.copyProperties(invoicingDirectiveEntity,invoicingDirectivePlan); BeanUtils.copyProperties(invoicingDirectiveEntity, invoicingDirectivePlan);
baseMapper.insert(invoicingDirectivePlan); baseMapper.insert(invoicingDirectivePlan);
//TODO 增加日志 //TODO 增加日志
@ -68,7 +69,7 @@ public class InvoicingDirectivePlanServiceImpl extends ServiceImpl<InvoicingDire
@Override @Override
public void editDirective(InvoicingDirectiveEntity invoicingDirectiveEntity) { public void editDirective(InvoicingDirectiveEntity invoicingDirectiveEntity) {
InvoicingDirectivePlan invoicingDirectivePlan = new InvoicingDirectivePlan(); InvoicingDirectivePlan invoicingDirectivePlan = new InvoicingDirectivePlan();
BeanUtils.copyProperties(invoicingDirectiveEntity,invoicingDirectivePlan); BeanUtils.copyProperties(invoicingDirectiveEntity, invoicingDirectivePlan);
InvoicingDirectivePlan entity = baseMapper.selectById(invoicingDirectiveEntity.getId()); InvoicingDirectivePlan entity = baseMapper.selectById(invoicingDirectiveEntity.getId());
baseMapper.updateById(invoicingDirectivePlan); baseMapper.updateById(invoicingDirectivePlan);
//TODO 增加日志 //TODO 增加日志
@ -79,7 +80,7 @@ public class InvoicingDirectivePlanServiceImpl extends ServiceImpl<InvoicingDire
@Override @Override
public void deleteDirective(InvoicingDirectiveEntity invoicingDirectiveEntity) { public void deleteDirective(InvoicingDirectiveEntity invoicingDirectiveEntity) {
InvoicingDirectivePlan invoicingDirectivePlan = new InvoicingDirectivePlan(); InvoicingDirectivePlan invoicingDirectivePlan = new InvoicingDirectivePlan();
BeanUtils.copyProperties(invoicingDirectiveEntity,invoicingDirectivePlan); BeanUtils.copyProperties(invoicingDirectiveEntity, invoicingDirectivePlan);
String id = invoicingDirectivePlan.getId(); String id = invoicingDirectivePlan.getId();
//调用方法删除数据池中的数据 //调用方法删除数据池中的数据
dataPoolServiceImpl.deleteDataPool(invoicingDirectivePlan); dataPoolServiceImpl.deleteDataPool(invoicingDirectivePlan);
@ -90,17 +91,17 @@ public class InvoicingDirectivePlanServiceImpl extends ServiceImpl<InvoicingDire
@Override @Override
public InvoicingDirectiveInstantEntity addInstant(InvoicingDirectiveInstantEntity invoicingDirectiveInstantEntity) { public InvoicingDirectiveInstantEntity addInstant(InvoicingDirectiveInstantEntity invoicingDirectiveInstantEntity) {
InvoicingDirectivePlanInstant instant = new InvoicingDirectivePlanInstant(); InvoicingDirectivePlanInstant instant = new InvoicingDirectivePlanInstant();
BeanUtils.copyProperties(invoicingDirectiveInstantEntity,instant); BeanUtils.copyProperties(invoicingDirectiveInstantEntity, instant);
invoicingDirectivePlanInstantService.save(instant); invoicingDirectivePlanInstantService.save(instant);
//TODO 增加日志 //TODO 增加日志
BeanUtils.copyProperties(instant,invoicingDirectiveInstantEntity); BeanUtils.copyProperties(instant, invoicingDirectiveInstantEntity);
return invoicingDirectiveInstantEntity; return invoicingDirectiveInstantEntity;
} }
@Override @Override
public void editInstant(InvoicingDirectiveInstantEntity invoicingDirectiveInstantEntity) { public void editInstant(InvoicingDirectiveInstantEntity invoicingDirectiveInstantEntity) {
InvoicingDirectivePlanInstant instant = new InvoicingDirectivePlanInstant(); InvoicingDirectivePlanInstant instant = new InvoicingDirectivePlanInstant();
BeanUtils.copyProperties(invoicingDirectiveInstantEntity,instant); BeanUtils.copyProperties(invoicingDirectiveInstantEntity, instant);
invoicingDirectivePlanInstantService.updateById(instant); invoicingDirectivePlanInstantService.updateById(instant);
//TODO 增加日志 //TODO 增加日志
} }
@ -111,4 +112,8 @@ public class InvoicingDirectivePlanServiceImpl extends ServiceImpl<InvoicingDire
//TODO 增加日志 //TODO 增加日志
} }
@Override
public int queryTotal(String nuId) {
return baseMapper.queryTotal(nuId);
}
} }

View File

@ -7,9 +7,11 @@ import org.apache.ibatis.annotations.Param;
/** /**
* @Description: 行政类服务指令计划 * @Description: 行政类服务指令计划
* @Author: caolei * @Author: caolei
* @Date: 2026-1-6 * @Date: 2026-1-6
* @Version: V1.0 * @Version: V1.0
*/ */
public interface LogisticsDirectivePlanMapper extends BaseMapper<LogisticsDirectivePlan> { public interface LogisticsDirectivePlanMapper extends BaseMapper<LogisticsDirectivePlan> {
int deleteByIdPhysic(@Param("id") String id); int deleteByIdPhysic(@Param("id") String id);
int queryTotal(@Param("nuId") String nuId, @Param("elderId") String elderId);
} }

View File

@ -4,4 +4,73 @@
<delete id="deleteByIdPhysic"> <delete id="deleteByIdPhysic">
delete from nu_biz_nu_logistics_directive_plan where id = #{id} delete from nu_biz_nu_logistics_directive_plan where id = #{id}
</delete> </delete>
<select id="queryTotal" resultType="java.lang.Integer">
SELECT
COUNT(*) as total_count
FROM
nu_biz_nu_logistics_directive_plan p
LEFT JOIN
nu_config_package_directive pd ON p.directive_id = pd.package_id
WHERE
p.nu_id = #{nuId}
AND p.elder_id = #{elderId}
AND (
-- 条件1: 包数据 (cycle_type_id为空或空字符串)
(
(p.cycle_type_id IS NULL OR p.cycle_type_id = '')
AND (
-- 包数据按星期执行
(
pd.cycle_value IN ('0','1','2','3','4','5','6')
AND pd.cycle_value = (
CASE DAYOFWEEK(CURDATE())
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
)
)
OR
-- 包数据按日期执行
(
LENGTH(pd.cycle_value) = 2
AND pd.cycle_value = DATE_FORMAT(CURDATE(), '%d')
)
)
)
-- 条件2: 日常类型指令 (cycle_type_id = '1')
OR p.cycle_type_id = '1'
-- 条件3: 周期类型指令 (cycle_type_id = '2')
OR (
p.cycle_type_id = '2'
AND (
-- 周期指令按星期执行
(
p.cycle_value IN ('0','1','2','3','4','5','6')
AND p.cycle_value = (
CASE DAYOFWEEK(CURDATE())
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
)
)
OR
-- 周期指令按日期执行
(
LENGTH(p.cycle_value) = 2
AND p.cycle_value = DATE_FORMAT(CURDATE(), '%d')
)
)
)
);
</select>
</mapper> </mapper>

View File

@ -12,4 +12,5 @@ import com.nu.modules.biz.plan.logistics.entity.LogisticsDirectivePlan;
*/ */
public interface LogisticsDirectivePlanService extends IService<LogisticsDirectivePlan> { public interface LogisticsDirectivePlanService extends IService<LogisticsDirectivePlan> {
int queryTotal(String nuId, String elderId);
} }

View File

@ -112,4 +112,8 @@ public class LogisticsDirectivePlanServiceImpl extends ServiceImpl<LogisticsDire
//TODO 增加日志 //TODO 增加日志
} }
@Override
public int queryTotal(String nuId, String elderId) {
return baseMapper.queryTotal(nuId, elderId);
}
} }