统计:护理、行政、后勤 当天矩阵编排指令总数、当天已执行完成总数
This commit is contained in:
parent
02981291b2
commit
f93227c177
|
|
@ -43,4 +43,6 @@ public interface IDirectiveOrderApi {
|
|||
|
||||
IPage<DirectiveOrderEntity> queryWorkOrderList(Integer pageNo, Integer pageSize, DirectiveOrderEntity directiveOrderEntity, HttpServletRequest req);
|
||||
|
||||
int queryTodayFinishedTotal(String type,String nuId, String elderId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nu.modules.biz.order.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.biz.order.entity.DirectiveOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -14,10 +15,19 @@ import java.util.List;
|
|||
*/
|
||||
public interface DirectiveOrderMapper extends BaseMapper<DirectiveOrder> {
|
||||
List<DirectiveOrder> queryDataPoolList(DirectiveOrder orders);
|
||||
|
||||
List<DirectiveOrder> getEmpPermissionAndOnline(@Param("directiveIds") String directiveIds, @Param("employeeIds") String employeeIds, @Param("startTime") Date startTime);
|
||||
|
||||
DirectiveOrder getEmpOrderly(@Param("elderId") String elderId);
|
||||
|
||||
List<DirectiveOrder> getPermissionEmps(@Param("directiveIds") String directiveIds);
|
||||
|
||||
void updatePoolIzOrder(@Param("poolId") String poolId);
|
||||
|
||||
DirectiveOrder getDirectivePrice(@Param("directiveId") String directiveId);
|
||||
|
||||
DirectiveOrder selectInfoById(@Param("id") String id);
|
||||
|
||||
int queryTodayFinishedTotal(@Param("type") String type, @Param("nuId") String nuId, @Param("elderId") String elderId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
<mapper namespace="com.nu.modules.biz.order.mapper.DirectiveOrderMapper">
|
||||
|
||||
<select id="queryDataPoolList" resultType="com.nu.modules.biz.order.entity.DirectiveOrder">
|
||||
select
|
||||
a.id as poolId,
|
||||
select a.id as poolId,
|
||||
a.biz_id as bizId,
|
||||
a.nu_id as nuId,
|
||||
a.nu_name as nuName,
|
||||
|
|
@ -34,7 +33,7 @@
|
|||
from nu_biz_nu_care_directive_data_pool a
|
||||
left join nu_biz_elder_info b on a.elder_id = b.id
|
||||
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 id="getEmpPermissionAndOnline" resultType="com.nu.modules.biz.order.entity.DirectiveOrder">
|
||||
|
|
@ -135,5 +134,23 @@
|
|||
ON mainStatus.dict_id = dict.id AND mainStatus.item_value = a.opt_type
|
||||
where a.id = #{id}
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -172,6 +172,11 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
|||
return entityPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryTodayFinishedTotal(String type,String nuId, String elderId) {
|
||||
return baseMapper.queryTodayFinishedTotal(type,nuId, elderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> editSubMp4(DirectiveOrderSubEntity directiveOrderSubEntity) {
|
||||
DirectiveOrderSub directiveOrderSub = new DirectiveOrderSub();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ public class DirectivePlanInstantController extends JeecgController<CareDirectiv
|
|||
List<InvoicingDirectivePlanInstant> invoicingList = invoicingDirectivePlanInstantService.list(invoicingQW);
|
||||
result.put("invoicing", invoicingList);
|
||||
|
||||
//行政类即时指令
|
||||
//后勤类即时指令
|
||||
QueryWrapper<LogisticsDirectivePlanInstant> logisticsQW = new QueryWrapper<>();
|
||||
logisticsQW.eq("nu_id", nuId);
|
||||
logisticsQW.eq("elder_id", elderId);
|
||||
|
|
|
|||
|
|
@ -21,4 +21,6 @@ public interface CareDirectivePlanMapper extends BaseMapper<CareDirectivePlan> {
|
|||
List<CareDirectivePlan> getNcDirectiveList(@Param("params") CareDirectivePlan planBizNuCustomerServer);
|
||||
|
||||
int deleteByIdPhysic(@Param("id") String id);
|
||||
|
||||
int queryTotal(@Param("nuId") String nuId, @Param("elderId") String elderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
<!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">
|
||||
<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>
|
||||
|
||||
<select id="getGroupPositioning" resultType="com.nu.modules.biz.plan.care.entity.CareDirectivePlan">
|
||||
|
|
@ -38,4 +40,73 @@
|
|||
</if>
|
||||
</where>
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -11,4 +11,5 @@ import com.nu.modules.biz.plan.care.entity.CareDirectivePlan;
|
|||
*/
|
||||
public interface ICareDirectivePlanService extends IService<CareDirectivePlan> {
|
||||
|
||||
int queryTotal(String nuId, String elderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -445,4 +445,9 @@ public class CareDirectivePlanServiceImpl extends ServiceImpl<CareDirectivePlanM
|
|||
getOpeMediaAddress();
|
||||
return serverNetUrl + imageUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryTotal(String nuId, String elderId) {
|
||||
return baseMapper.queryTotal(nuId,elderId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,4 +12,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
*/
|
||||
public interface InvoicingDirectivePlanMapper extends BaseMapper<InvoicingDirectivePlan> {
|
||||
int deleteByIdPhysic(@Param("id") String id);
|
||||
|
||||
int queryTotal(@Param("nuId") String nuId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,72 @@
|
|||
<delete id="deleteByIdPhysic">
|
||||
delete from nu_biz_nu_invoicing_directive_plan where id = #{id}
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -12,4 +12,6 @@ import com.nu.modules.biz.plan.invoicing.entity.InvoicingDirectivePlan;
|
|||
*/
|
||||
public interface IInvoicingDirectivePlanService extends IService<InvoicingDirectivePlan> {
|
||||
|
||||
int queryTotal(String nuId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.nu.modules.invoicing.api.IInvoicingDirectivePlanApi;
|
|||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -55,7 +56,7 @@ public class InvoicingDirectivePlanServiceImpl extends ServiceImpl<InvoicingDire
|
|||
@Override
|
||||
public InvoicingDirectiveEntity addDirective(InvoicingDirectiveEntity invoicingDirectiveEntity) {
|
||||
InvoicingDirectivePlan invoicingDirectivePlan = new InvoicingDirectivePlan();
|
||||
BeanUtils.copyProperties(invoicingDirectiveEntity,invoicingDirectivePlan);
|
||||
BeanUtils.copyProperties(invoicingDirectiveEntity, invoicingDirectivePlan);
|
||||
baseMapper.insert(invoicingDirectivePlan);
|
||||
//TODO 增加日志
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ public class InvoicingDirectivePlanServiceImpl extends ServiceImpl<InvoicingDire
|
|||
@Override
|
||||
public void editDirective(InvoicingDirectiveEntity invoicingDirectiveEntity) {
|
||||
InvoicingDirectivePlan invoicingDirectivePlan = new InvoicingDirectivePlan();
|
||||
BeanUtils.copyProperties(invoicingDirectiveEntity,invoicingDirectivePlan);
|
||||
BeanUtils.copyProperties(invoicingDirectiveEntity, invoicingDirectivePlan);
|
||||
InvoicingDirectivePlan entity = baseMapper.selectById(invoicingDirectiveEntity.getId());
|
||||
baseMapper.updateById(invoicingDirectivePlan);
|
||||
//TODO 增加日志
|
||||
|
|
@ -79,7 +80,7 @@ public class InvoicingDirectivePlanServiceImpl extends ServiceImpl<InvoicingDire
|
|||
@Override
|
||||
public void deleteDirective(InvoicingDirectiveEntity invoicingDirectiveEntity) {
|
||||
InvoicingDirectivePlan invoicingDirectivePlan = new InvoicingDirectivePlan();
|
||||
BeanUtils.copyProperties(invoicingDirectiveEntity,invoicingDirectivePlan);
|
||||
BeanUtils.copyProperties(invoicingDirectiveEntity, invoicingDirectivePlan);
|
||||
String id = invoicingDirectivePlan.getId();
|
||||
//调用方法删除数据池中的数据
|
||||
dataPoolServiceImpl.deleteDataPool(invoicingDirectivePlan);
|
||||
|
|
@ -90,17 +91,17 @@ public class InvoicingDirectivePlanServiceImpl extends ServiceImpl<InvoicingDire
|
|||
@Override
|
||||
public InvoicingDirectiveInstantEntity addInstant(InvoicingDirectiveInstantEntity invoicingDirectiveInstantEntity) {
|
||||
InvoicingDirectivePlanInstant instant = new InvoicingDirectivePlanInstant();
|
||||
BeanUtils.copyProperties(invoicingDirectiveInstantEntity,instant);
|
||||
BeanUtils.copyProperties(invoicingDirectiveInstantEntity, instant);
|
||||
invoicingDirectivePlanInstantService.save(instant);
|
||||
//TODO 增加日志
|
||||
BeanUtils.copyProperties(instant,invoicingDirectiveInstantEntity);
|
||||
BeanUtils.copyProperties(instant, invoicingDirectiveInstantEntity);
|
||||
return invoicingDirectiveInstantEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editInstant(InvoicingDirectiveInstantEntity invoicingDirectiveInstantEntity) {
|
||||
InvoicingDirectivePlanInstant instant = new InvoicingDirectivePlanInstant();
|
||||
BeanUtils.copyProperties(invoicingDirectiveInstantEntity,instant);
|
||||
BeanUtils.copyProperties(invoicingDirectiveInstantEntity, instant);
|
||||
invoicingDirectivePlanInstantService.updateById(instant);
|
||||
//TODO 增加日志
|
||||
}
|
||||
|
|
@ -111,4 +112,8 @@ public class InvoicingDirectivePlanServiceImpl extends ServiceImpl<InvoicingDire
|
|||
//TODO 增加日志
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryTotal(String nuId) {
|
||||
return baseMapper.queryTotal(nuId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,4 +12,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
*/
|
||||
public interface LogisticsDirectivePlanMapper extends BaseMapper<LogisticsDirectivePlan> {
|
||||
int deleteByIdPhysic(@Param("id") String id);
|
||||
|
||||
int queryTotal(@Param("nuId") String nuId, @Param("elderId") String elderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,73 @@
|
|||
<delete id="deleteByIdPhysic">
|
||||
delete from nu_biz_nu_logistics_directive_plan where id = #{id}
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@ import com.nu.modules.biz.plan.logistics.entity.LogisticsDirectivePlan;
|
|||
*/
|
||||
public interface LogisticsDirectivePlanService extends IService<LogisticsDirectivePlan> {
|
||||
|
||||
int queryTotal(String nuId, String elderId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,4 +112,8 @@ public class LogisticsDirectivePlanServiceImpl extends ServiceImpl<LogisticsDire
|
|||
//TODO 增加日志
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryTotal(String nuId, String elderId) {
|
||||
return baseMapper.queryTotal(nuId, elderId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue