入住审批
审批流程说明
入住养老院是要经过一系列审批的,在整个过程中涉及到的角色有下面这些
- 养老顾问:填写申请入住单,发起审批流程
- 护理组主管:完成入住评估
- 副院长审批:完成入住审批
- 养老顾问:完成入住配置
- 法务部员工:完成签约办理
审批操作大体分为下面这些:
-
通过:审批通过进入下一节点或结束流程,如果下一节点审批结束不能撤回;最后一人审批结束,发起人不能撤销
-
拒绝:审批拒绝后,流程结束,发起人不可修改此申请单
-
驳回:审批驳回后,流程走到发起人,此时发起人可以修改申请单,重走流程
-
撤回:撤回分为发起人撤回和审批人撤回
发起人撤回只能在所有审批人都没有审批之前,撤回后可修改申请单
审批人撤回只能在下一个审批人审批之前,撤回后可以重新审批
-
撤销:撤销是由发起人操作,必须在审批流程结束前,撤销后流程结束。已撤销的申请依旧显示在审核通过的审批人列表
详细审批流程
https://rp-java.itheima.net/zhyl
我们先来看详细的流程,如下图:
申请入住
申请入住操作由养老顾问填写,主要操作是:上传老人相关资料(个人信息、家人信息、身份信息)
- 基本信息:老人的基本数据
- 家属信息:老人的家属信息可以绑定
- 资料上传:上传老人的身份证信息
![image-20230917114032513](assets/image-20230917114032513.png)
入住评估
入住评估操作由护理组主管来操作,主要是对老人的健康情况做三个方面的评估:
- 健康评估:老人的历史健康数据,疾病情况、用药情况、风险事件、体检报告
- 能力评估:让老人做题,判断老人的自理能力
- 评估报告:根据老人的做题的结果,给老人能力打分,然后给出护理等级鉴定
![image-20230917142710331](assets/image-20230917142710331.png)
入住审批
这一步的操作是由副院长来操作,首先展示老人的详细数据,前两步的数据,让副院长老审批
审批的结果有三种,分别是:
-
审核通过:通过之后进入下一节点,若下一节点已审批,发起人不可撤回;若最后一个审批人通过后,发起人不可撤销
-
审核拒绝:拒绝后,流程结束,发起人不可修改申请单,需重新填写并提交新表单
-
审批驳回:驳回后,流程回到发起人,驳回后,发起人可修改申请单,重新走工作流/审批流
![image-20230917143720343](assets/image-20230917143720343.png)
入住配置
这一步的操作还是由养老顾问来操作,需要进行的操作有:
- 入住期限:可以选择老人入住期限
- 护理等级:可以选择护理等级,当选择护理等级后,在下面的费用设置里面自动显示护理费用
- 入住床位:当点击”选择护理床位”,会跳转到床位管理选择床位,在下面会自动显示床位费用
- 费用设置:可以手动设置费用期限(费用期限必须在入住期限内),可以再手动设置其他费用
- 费用预览:可以预览老人的首月的月度账单费用
- 当点击保存按钮之后,会保存老人的入住的配置
签约办理
这一步由法务人员来操作,让法务人员在线上签订老人的入住合同,并且在系统中上传老人的入住合同
当这一步操作完成后,同时需要保存老人的合同相关数据
撤销申请
养老顾问登录系统后,在我的申请中,可以撤销流程还没有审核完成的申请单;撤销之后,流程结束,该老人如果再次入住,则需要重新发起申请
表结构设计
E-R图
由我们刚才分析的需求,我们需要保存很多的内容,也就是说需要创建很多张表来保存数据,大体如下
- 入住之后,第一肯定会创建老人表
- 在申请入住的时候需要创建填写老人的入住信息
- 在选择入住的时候,需要录入老人的入住配置
- 同时也会创建老人的入住合同,保存合同信息
- 老人入住开始后,会创建余额表,来保存老人的预缴款信息
- 老人入住开始后,根据入住配置会生成月度账单
老人表与余额表、入住表、入住配置表、账单表、合同表都是一对一的关系,实体关系如下:
操作记录表
我们来看原型图,在原型图的右侧有操作记录,效果如下:
处理或者是审核的每一次(通过、拒绝、驳回、撤回、撤销)操作,都会记录到操作记录表中
表结构创建
老人表:
CREATE TABLE "elder" (
"id" bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
"name" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '名称',
"image" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '图片',
"id_card_no" varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '身份证号',
"age" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '欠费金额(元)',
"sex" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '支付截止时间',
"status" int NOT NULL DEFAULT '1' COMMENT '状态(0:禁用,1:启用 2:请假 3:退住中 4入住中 5已退住)',
"phone" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '手机号',
"create_time" datetime NOT NULL COMMENT '创建时间',
"update_time" datetime DEFAULT NULL COMMENT '更新时间',
"create_by" bigint DEFAULT NULL COMMENT '创建人id',
"update_by" bigint DEFAULT NULL COMMENT '更新人id',
"remark" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注',
PRIMARY KEY ("id") USING BTREE,
UNIQUE KEY "name_id_card_no" ("name","id_card_no") USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='老人表';
入住表:
CREATE TABLE "check_in" (
"id" bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
"check_in_code" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '编号',
"title" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '标题',
"elder_id" bigint NOT NULL COMMENT '老人id',
"counselor" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '养老顾问',
"check_in_time" timestamp NULL DEFAULT NULL COMMENT '入住时间',
"reason" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '原因',
"remark" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
"applicat" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请人',
"dept_no" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '部门编号',
"applicat_id" bigint NOT NULL COMMENT '申请人id',
"create_time" timestamp NOT NULL COMMENT '创建时间',
"flow_status" int NOT NULL COMMENT '流程状态',
"status" int NOT NULL COMMENT '审核状态',
"other_apply_info" text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '其他申请信息',
"review_info" text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '评估信息',
"update_time" timestamp NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY ("id") USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=98 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
入住配置表:
CREATE TABLE "check_in_config" (
"id" bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
"elder_id" bigint NOT NULL COMMENT '老人ID',
"check_in_start_time" datetime NOT NULL COMMENT '入住开始时间',
"check_in_end_time" datetime NOT NULL COMMENT '入住结束时间',
"nursing_level_id" bigint NOT NULL COMMENT '护理等级ID',
"bed_no" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '床位号',
"cost_start_time" datetime NOT NULL COMMENT '费用开始时间',
"cost_end_time" datetime NOT NULL COMMENT '费用结束时间',
"deposit_amount" decimal(10,2) NOT NULL COMMENT '押金(元)',
"nursing_cost" decimal(10,2) NOT NULL COMMENT '护理费用(元/月)',
"bed_cost" decimal(10,2) NOT NULL COMMENT '床位费用(元/月)',
"other_cost" decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '其他费用(元/月)',
"medical_insurance_payment" decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '医保支付(元/月)',
"government_subsidy" decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '政府补贴(元/月)',
"create_time" datetime NOT NULL COMMENT '创建时间',
"update_time" datetime DEFAULT NULL COMMENT '更新时间',
"create_by" bigint DEFAULT NULL COMMENT '创建人id',
"update_by" bigint DEFAULT NULL COMMENT '更新人id',
"remark" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注',
PRIMARY KEY ("id") USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='入住配置表';
余额表:
CREATE TABLE "balance" (
"id" bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
"prepaid_balance" decimal(10,2) unsigned zerofill DEFAULT '00000000.00' COMMENT '预交款余额',
"deposit_amount" decimal(10,2) unsigned zerofill DEFAULT '00000000.00' COMMENT '押金金额',
"arrears_amount" decimal(10,2) unsigned zerofill DEFAULT '00000000.00' COMMENT '欠费金额(元)',
"payment_deadline" datetime DEFAULT NULL COMMENT '支付截止时间',
"status" int NOT NULL DEFAULT '0' COMMENT '状态(0:正常,1:退住 2:入住未缴押金)',
"elder_id" bigint NOT NULL COMMENT '老人ID',
"elder_name" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '老人姓名',
"bed_no" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '床位号',
"create_time" datetime NOT NULL COMMENT '创建时间',
"update_time" datetime DEFAULT NULL COMMENT '更新时间',
"create_by" bigint DEFAULT NULL COMMENT '创建人id',
"update_by" bigint DEFAULT NULL COMMENT '更新人id',
"remark" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注',
PRIMARY KEY ("id") USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='余额表';
账单表:
CREATE TABLE "bill" (
"id" bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
"bill_no" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '账单编号',
"trading_order_no" bigint DEFAULT '0' COMMENT '交易系统订单号',
"bill_type" tinyint NOT NULL DEFAULT '0' COMMENT '账单类型(0:月度账单,1服务账单)',
"bill_month" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '账单月份',
"elder_id" bigint NOT NULL COMMENT '老人ID',
"bill_amount" decimal(10,2) NOT NULL COMMENT '账单金额(元)',
"payable_amount" decimal(10,2) NOT NULL COMMENT '应付金额(元)',
"prepaid_amount" decimal(10,2) unsigned zerofill DEFAULT NULL COMMENT '预付款支付金额',
"deposit_amount" decimal(10,2) unsigned zerofill DEFAULT NULL COMMENT '押金金额',
"current_cost" decimal(10,2) NOT NULL COMMENT '本期应付',
"payment_deadline" datetime NOT NULL COMMENT '支付截止时间',
"transaction_status" int NOT NULL COMMENT '账单状态(0:未支付,1已支付, 2已关闭)',
"bill_start_time" datetime DEFAULT NULL COMMENT '账单开始时间',
"bill_end_time" datetime DEFAULT NULL COMMENT '账单结束时间',
"total_days" int DEFAULT NULL COMMENT '共计天数(天)',
"create_time" datetime NOT NULL COMMENT '创建时间',
"lname" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '护理等级名称',
"type_name" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '房间类型名称',
"update_time" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '更新时间',
"create_by" bigint DEFAULT NULL COMMENT '创建人id',
"update_by" bigint DEFAULT NULL COMMENT '更新人id',
"remark" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注',
PRIMARY KEY ("id") USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=73 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='账单表';
合同表:
CREATE TABLE "contract" (
"id" bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
"name" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '合同名称',
"contract_no" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '合同编号',
"pdf_url" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '协议地址',
"member_phone" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '丙方手机号',
"elder_id" bigint DEFAULT NULL COMMENT '老人id',
"elder_name" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '老人姓名',
"member_name" varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '丙方名称',
"start_time" datetime NOT NULL COMMENT '开始时间',
"end_time" datetime NOT NULL COMMENT '结束时间',
"status" tinyint NOT NULL DEFAULT '0' COMMENT '状态,0:未生效,1:已生效,2:已过期, 3:已失效',
"sort" int DEFAULT '0' COMMENT '排序字段',
"level_desc" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '级别描述',
"create_time" datetime NOT NULL COMMENT '创建时间',
"create_by" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '创建人',
"update_time" datetime DEFAULT NULL COMMENT '更新时间',
"update_by" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '更新人',
"remark" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '备注',
"check_in_no" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '入住单号',
"sign_date" datetime NOT NULL COMMENT '签约日期',
"release_submitter" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '解除提交人',
"release_date" datetime DEFAULT NULL COMMENT '解除日期',
"release_pdf_url" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '解除协议url',
PRIMARY KEY ("id") USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='合同表';
操作记录表:
CREATE TABLE "accraditation_record" (
"id" bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
"opinion" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '审批意见',
"type" tinyint DEFAULT NULL COMMENT '审批类型(1:退住,2:请假,3:入住)',
"approver_id" bigint DEFAULT NULL COMMENT '审批人id',
"approver_name" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '审批人',
"approver_name_role" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '审批人角色',
"next_approver_id" bigint DEFAULT NULL COMMENT '下一个审核人id',
"next_approver" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '下一个审核人',
"next_approver_role" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '下一个审核人角色',
"bussniess_id" bigint DEFAULT NULL COMMENT '业务id',
"current_step" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '当前操作步骤',
"next_step" varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '下一步操作',
"audit_status" tinyint DEFAULT NULL COMMENT '审核状态(1:通过,2:拒绝,3:驳回,4:撤回,5:撤销)',
"step_no" bigint DEFAULT NULL COMMENT '审核步骤',
"create_time" datetime DEFAULT NULL COMMENT '创建时间',
"update_time" datetime DEFAULT NULL COMMENT '更新时间',
"create_by" bigint DEFAULT NULL COMMENT '创建人',
"update_by" bigint DEFAULT NULL COMMENT '更新人',
"handle_type" tinyint DEFAULT NULL COMMENT '处理类型(0:已审批,1:已处理)',
PRIMARY KEY ("id") USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=870 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='审批记录表';
流程图绘制
入住流程的思路如下:
-
当启动流程的时候,我们需要设置流程变量,办理人的设置
发起人申请:变量为assignee0,这个办理人为养老顾问,也是当前登录人
入住评估处理:变量为assignee1,这个办理人为护理部组长(根据权限表获取)
副院长审批-处理:变量为assignee2,这个办理人为副院长(根据权限表获取)
入住选配-处理:变量为assignee3,这个办理人为养老顾问,也是当前登录人
签约办理-处理:变量为assignee4,这个办理人为法务人员(根据权限表获取)
-
在第三步院长审核的时候,有多种情况,我们可以使用网关来进行判断
审核通过,则走向第四步:入住选配-处理
审核拒绝,则直接结束流程
驳回,则直接走向第一步:发起入住申请
-
用户任务中的formKey是方便找到节点的位置
- formKey = 0 发起入住申请
- formKey = 1 入住评估-处理
- formKey = 2 副院长审批-处理
- formKey = 3 入住选配-处理
- formKey = 4 签约办理-处理
入住成功关联业务
入住管理查询
在显示的字段列表中,需要从多个表中获取
- 入住表 check_in
- 老人表 elder
合同生成
老人与楼层房间床位绑定
老人护理任务自动生成
任务列表可以查看老人当月的护理任务节点,可以给老人绑定护理员,由绑定的护理员去按照时间去执行任务
自动老人的月度账单数据
可以给老人缴费(线下缴费,需上传凭证)
小程序端查看老人的月度账单和合同
需要先绑定老人,输入老人的姓名和身份号
查看合同和账单
其中合同的展示查询条件是与入住中签约办理的丙方联系方式一致
简单说:现在测试,需要使用自己的手机号在小程序登录,那这个丙方联系方式就是自己的手机号
展示效果如下:
服务下单
订单创建
AppOrderController
package com.zzyl.controller.app;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.entity.Order;
import com.zzyl.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class AppOrderController extends BaseController {
//下单检查--无需实现
@PostMapping("/customer/orders/check")
public ResponseResult createOrderCheck() {
return success(null);
}
@Autowired
private OrderService orderService;
//下单
@PostMapping("/customer/orders")
public ResponseResult createOrder(@RequestBody Order order) {
orderService.createOrder(order);
return ResponseResult.success(order);
}
}
OrderService
//创建订单
void createOrder(Order order);
OrderServiceImpl
//创建订单
@Override
public void createOrder(Order order) {
//1. 保存订单信息
order.setStatus(0);//订单状态: 待支付
order.setPaymentStatus(1);//支付状态: 待支付
order.setOrderNo(UUID.randomUUID().toString());//订单号
order.setMemberId(UserThreadLocal.getUserId());//会员号
getBaseMapper().insert(order);//保存订单
}
订单查询
AppOrderController
//订单查询
@GetMapping("/customer/orders/order/page")
public ResponseResult searchOrders(
Integer status, String orderNo, String elderlyName, String creator,
Long startTime, Long endTime, Integer pageNum, Integer pageSize) {
PageResponse page = orderService.findByPage(status, orderNo, elderlyName, creator, ObjectUtil.isEmpty(startTime) ? null : LocalDateTimeUtil.of(startTime), ObjectUtil.isEmpty(endTime) ? null : LocalDateTimeUtil.of(endTime), pageNum, pageSize);
return ResponseResult.success(page);
}
OrderService
//查询订单
PageResponse<OrderVo> findByPage(Integer status, String orderNo, String elderlyName, String creator, LocalDateTime startTime, LocalDateTime endTime, Integer page, Integer pageSize);
OrderServiceImpl
public PageResponse<OrderVo> findByPage(Integer status, String orderNo, String elderlyName, String creator, LocalDateTime startTime, LocalDateTime endTime, Integer pageNum, Integer pageSize) {
Page<OrderVo> page = new Page<>(pageNum, pageSize);
Long userId = UserThreadLocal.getUserId();
page = getBaseMapper().findByPage(page, status, orderNo, elderlyName, creator, startTime, endTime, userId);
return new PageResponse(page);
}
OrderMapper
Page<OrderVo> findByPage(Page<OrderVo> page,@Param("status") Integer status, @Param("orderNo") String orderNo, @Param("elderlyName") String elderlyName, @Param("creator") String creator, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("userId") Long userId);
OrderMapper.xml
<?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.zzyl.mapper.OrderMapper">
<resultMap id="BaseResultMap" type="com.zzyl.vo.OrderVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="trading_order_no" jdbcType="BIGINT" property="tradingOrderNo"/>
<result column="payment_status" jdbcType="TINYINT" property="paymentStatus"/>
<result column="amount" jdbcType="DECIMAL" property="amount"/>
<result column="refund" jdbcType="DECIMAL" property="refund"/>
<result column="is_refund" jdbcType="VARCHAR" property="isRefund"/>
<result column="member_id" jdbcType="BIGINT" property="memberId"/>
<result column="project_id" jdbcType="BIGINT" property="projectId"/>
<result column="elder_id" jdbcType="BIGINT" property="elderId"/>
<result column="estimated_arrival_time" jdbcType="TIMESTAMP" property="estimatedArrivalTime"/>
<result column="order_no" jdbcType="VARCHAR" property="orderNo"/>
<result column="reason" jdbcType="VARCHAR" property="reason"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="create_by" jdbcType="BIGINT" property="createBy"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/>
<result column="creator" property="creator"/>
<result column="updater" property="updater"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="o_create_type" property="createType"/>
<collection property="elderVo" ofType="com.zzyl.vo.ElderVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="ename" jdbcType="VARCHAR" property="name"/>
<result column="image" jdbcType="VARCHAR" property="image"/>
<result column="id_card_no" jdbcType="VARCHAR" property="idCardNo"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="create_by" jdbcType="BIGINT" property="createBy"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/>
</collection>
<collection property="nursingProjectVo" ofType="com.zzyl.vo.NursingProjectVo">
<id column="id" property="id"/>
<result column="pname" property="name"/>
<result column="unit" property="unit"/>
<result column="price" property="price"/>
<result column="pimage" property="image"/>
<result column="nursing_requirement" property="nursingRequirement"/>
<result column="status" property="status"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
<result column="creator" property="creator"/>
</collection>
<collection property="bedVo" ofType="com.zzyl.vo.BedVo">
<id column="id" property="id"/>
<result column="bed_number" property="bedNumber"/>
<result column="bed_status" property="bedStatus"/>
<result column="room_id" property="roomId"/>
<result property="sort" column="sort"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</collection>
<collection property="memberVo" ofType="com.zzyl.vo.MemberVo">
<id column="id" property="id"/>
<result column="auth_id" property="authId"/>
<result column="id_card_no" property="idCardNo"/>
<result column="id_card_no_verify" property="idCardNoVerify"/>
<result column="phone" property="phone"/>
<result column="mname" property="name"/>
<result column="avatar" property="avatar"/>
<result column="open_id" property="openId"/>
<result column="sex" property="sex"/>
<result column="birthday" property="birthday"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</collection>
<collection property="tradingVo" ofType="com.zzyl.vo.TradingVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="product_order_no" jdbcType="BIGINT" property="productOrderNo"/>
<result column="trading_order_no" jdbcType="BIGINT" property="tradingOrderNo"/>
<result column="trading_channel" jdbcType="VARCHAR" property="tradingChannel"/>
<result column="trading_state" jdbcType="INTEGER" property="tradingState"/>
<result column="payee_name" jdbcType="VARCHAR" property="payeeName"/>
<result column="payee_id" jdbcType="BIGINT" property="payeeId"/>
<result column="payer_name" jdbcType="VARCHAR" property="payerName"/>
<result column="payer_id" jdbcType="BIGINT" property="payerId"/>
<result column="trading_amount" jdbcType="DECIMAL" property="tradingAmount"/>
<result column="refund" jdbcType="DECIMAL" property="refund"/>
<result column="is_refund" jdbcType="VARCHAR" property="isRefund"/>
<result column="result_code" jdbcType="VARCHAR" property="resultCode"/>
<result column="result_msg" jdbcType="VARCHAR" property="resultMsg"/>
<result column="result_json" jdbcType="VARCHAR" property="resultJson"/>
<result column="place_order_code" jdbcType="VARCHAR" property="placeOrderCode"/>
<result column="place_order_msg" jdbcType="VARCHAR" property="placeOrderMsg"/>
<result column="place_order_json" jdbcType="VARCHAR" property="placeOrderJson"/>
<result column="enterprise_id" jdbcType="BIGINT" property="enterpriseId"/>
<result column="open_id" jdbcType="VARCHAR" property="openId"/>
<result column="tcreate_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="tupdate_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="create_by" jdbcType="BIGINT" property="createBy"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/>
</collection>
<collection property="refundRecordVo" ofType="com.zzyl.vo.RefundRecordVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="trading_order_no" jdbcType="BIGINT" property="tradingOrderNo"/>
<result column="product_order_no" jdbcType="BIGINT" property="productOrderNo"/>
<result column="refund_no" jdbcType="BIGINT" property="refundNo"/>
<result column="enterprise_id" jdbcType="BIGINT" property="enterpriseId"/>
<result column="trading_channel" jdbcType="VARCHAR" property="tradingChannel"/>
<result column="refund_status" jdbcType="INTEGER" property="refundStatus"/>
<result column="refund_code" jdbcType="VARCHAR" property="refundCode"/>
<result column="refund_msg" jdbcType="VARCHAR" property="refundMsg"/>
<result column="rrmemo" jdbcType="VARCHAR" property="memo"/>
<result column="refund_amount" jdbcType="DECIMAL" property="refundAmount"/>
<result column="rrcreate_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="rrupdate_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="rrcreate_by" jdbcType="BIGINT" property="createBy"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/>
<result column="admin_creator" property="adminCreator"/>
<result column="member_creator" property="creator"/>
<result column="create_type" property="createType"/>
</collection>
<collection property="nursingTaskVo" ofType="com.zzyl.vo.NursingTaskVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="nursing_id" jdbcType="BIGINT" property="nursingId"/>
<result column="project_id" jdbcType="INTEGER" property="projectId"/>
<result column="elder_id" jdbcType="BIGINT" property="elderId"/>
<result column="bed_number" jdbcType="VARCHAR" property="bedNumber"/>
<result column="task_type" jdbcType="TINYINT" property="taskType"/>
<result column="estimated_server_time" jdbcType="TIMESTAMP" property="estimatedServerTime"/>
<result column="amark" jdbcType="VARCHAR" property="mark"/>
<result column="cancel_reason" jdbcType="VARCHAR" property="cancelReason"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="rel_no" jdbcType="VARCHAR" property="relNo"/>
<result column="task_image" jdbcType="VARCHAR" property="taskImage"/>
<result column="acreate_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="aupdate_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="create_by" jdbcType="BIGINT" property="createBy"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="acreator" jdbcType="VARCHAR" property="creator"/>
</collection>
</resultMap>
<select id="findByPage" parameterType="map" resultMap="BaseResultMap">
SELECT o.*, m.name as mname, m.phone, e.name as ename, p.name as pname ,p.image as pimage , bed.*
, t.*
, rr.memo as rrmemo , rr.refund_status as refund_status, rr.create_by as rrcreate_by,rr.refund_code,
rr.refund_no, rr.refund_amount, rr.refund_msg, rr.refund_code, rr.refund_msg
FROM `app_order` o
left join app_member m on o.member_id = m.id
left join elder e on o.elder_id = e.id
left join nursing_project p on o.project_id = p.id
left join base_bed bed on bed.id = e.bed_id
left join app_trading t on t.trading_order_no = o.trading_order_no
left join pro_refund_record rr on rr.trading_order_no = o.trading_order_no
<where>
<if test="status != null">
AND o.status = #{status,jdbcType=INTEGER}
</if>
<if test="orderNo != null">
AND o.order_no = #{orderNo,jdbcType=VARCHAR}
</if>
<if test="elderlyName != null">
AND e.name like concat('%',#{elderlyName},'%')
</if>
<if test="creator != null">
AND m.name like concat('%',#{creator},'%')
</if>
<if test="userId != null">
AND o.member_id = #{userId} and view_status = 0
</if>
<if test="startTime != null and endTime != null">
AND o.create_time BETWEEN #{startTime} AND #{endTime}
</if>
</where>
ORDER BY o.create_time desc
</select>
</mapper>
AND o.order_no = #{orderNo,jdbcType=VARCHAR}
</if>
<if test="elderlyName != null">
AND e.name like concat('%',#{elderlyName},'%')
</if>
<if test="creator != null">
AND m.name like concat('%',#{creator},'%')
</if>
<if test="userId != null">
AND o.member_id = #{userId} and view_status = 0
</if>
<if test="startTime != null and endTime != null">
AND o.create_time BETWEEN #{startTime} AND #{endTime}
</if>
</where>
ORDER BY o.create_time desc
</select>
~~~