feat(shop): 新增根据userId查询推荐人接口- 在控制器中增加 getByUserId 接口,支持通过 userId 查询推荐人信息- 优化服务层逻辑,查询时限定 level 为 1 的推荐关系
- 引入 ShopUserReferee 实体类以支持关联查询功能
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
package com.gxwebsoft.clinic.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.clinic.service.ClinicAppointmentService;
|
||||
import com.gxwebsoft.clinic.entity.ClinicAppointment;
|
||||
import com.gxwebsoft.clinic.param.ClinicAppointmentParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂号控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-10-16 20:34:59
|
||||
*/
|
||||
@Tag(name = "挂号管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/clinic/clinic-appointment")
|
||||
public class ClinicAppointmentController extends BaseController {
|
||||
@Resource
|
||||
private ClinicAppointmentService clinicAppointmentService;
|
||||
|
||||
@PreAuthorize("hasAuthority('clinic:clinicAppointment:list')")
|
||||
@Operation(summary = "分页查询挂号")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<ClinicAppointment>> page(ClinicAppointmentParam param) {
|
||||
// 使用关联查询
|
||||
return success(clinicAppointmentService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('clinic:clinicAppointment:list')")
|
||||
@Operation(summary = "查询全部挂号")
|
||||
@GetMapping()
|
||||
public ApiResult<List<ClinicAppointment>> list(ClinicAppointmentParam param) {
|
||||
// 使用关联查询
|
||||
return success(clinicAppointmentService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('clinic:clinicAppointment:list')")
|
||||
@Operation(summary = "根据id查询挂号")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<ClinicAppointment> get(@PathVariable("id") Long id) {
|
||||
// 使用关联查询
|
||||
return success(clinicAppointmentService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('clinic:clinicAppointment:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "添加挂号")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody ClinicAppointment clinicAppointment) {
|
||||
// 记录当前登录用户id
|
||||
// User loginUser = getLoginUser();
|
||||
// if (loginUser != null) {
|
||||
// clinicAppointment.setUserId(loginUser.getUserId());
|
||||
// }
|
||||
if (clinicAppointmentService.save(clinicAppointment)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('clinic:clinicAppointment:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "修改挂号")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody ClinicAppointment clinicAppointment) {
|
||||
if (clinicAppointmentService.updateById(clinicAppointment)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('clinic:clinicAppointment:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "删除挂号")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (clinicAppointmentService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('clinic:clinicAppointment:save')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量添加挂号")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<ClinicAppointment> list) {
|
||||
if (clinicAppointmentService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('clinic:clinicAppointment:update')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量修改挂号")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<ClinicAppointment> batchParam) {
|
||||
if (batchParam.update(clinicAppointmentService, "id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('clinic:clinicAppointment:remove')")
|
||||
@OperationLog
|
||||
@Operation(summary = "批量删除挂号")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (clinicAppointmentService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.gxwebsoft.clinic.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 挂号
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-10-16 20:34:59
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(name = "ClinicAppointment对象", description = "挂号")
|
||||
public class ClinicAppointment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键ID")
|
||||
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "类型")
|
||||
|
||||
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "就诊原因")
|
||||
|
||||
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "挂号时间")
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private LocalDateTime evaluateTime;
|
||||
|
||||
@Schema(description = "医生")
|
||||
|
||||
|
||||
private Integer doctorId;
|
||||
|
||||
@Schema(description = "患者")
|
||||
|
||||
|
||||
private Integer userId;
|
||||
|
||||
@Schema(description = "备注")
|
||||
|
||||
|
||||
private String comments;
|
||||
|
||||
@Schema(description = "排序号")
|
||||
|
||||
|
||||
private Integer sortNumber;
|
||||
|
||||
@Schema(description = "是否删除")
|
||||
|
||||
|
||||
private Integer isDelete;
|
||||
|
||||
@Schema(description = "租户id")
|
||||
|
||||
|
||||
private Integer tenantId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "修改时间")
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gxwebsoft.clinic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.gxwebsoft.clinic.entity.ClinicAppointment;
|
||||
import com.gxwebsoft.clinic.param.ClinicAppointmentParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂号Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-10-16 20:34:59
|
||||
*/
|
||||
public interface ClinicAppointmentMapper extends BaseMapper<ClinicAppointment> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<ClinicAppointment>
|
||||
*/
|
||||
List<ClinicAppointment> selectPageRel(@Param("page") IPage<ClinicAppointment> page,
|
||||
@Param("param") ClinicAppointmentParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<ClinicAppointment> selectListRel(@Param("param") ClinicAppointmentParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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.gxwebsoft.clinic.mapper.ClinicAppointmentMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM clinic_appointment a
|
||||
<where>
|
||||
<if test="param.id != null">
|
||||
AND a.id = #{param.id}
|
||||
</if>
|
||||
<if test="param.type != null">
|
||||
AND a.type = #{param.type}
|
||||
</if>
|
||||
<if test="param.reason != null">
|
||||
AND a.reason LIKE CONCAT('%', #{param.reason}, '%')
|
||||
</if>
|
||||
<if test="param.evaluateTime != null">
|
||||
AND a.evaluate_time LIKE CONCAT('%', #{param.evaluateTime}, '%')
|
||||
</if>
|
||||
<if test="param.doctorId != null">
|
||||
AND a.doctor_id = #{param.doctorId}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.isDelete != null">
|
||||
AND a.is_delete = #{param.isDelete}
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询 -->
|
||||
<select id="selectPageRel" resultType="com.gxwebsoft.clinic.entity.ClinicAppointment">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.clinic.entity.ClinicAppointment">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.gxwebsoft.clinic.param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||
import com.gxwebsoft.common.core.web.BaseParam;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 挂号查询参数
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-10-16 20:34:58
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(name = "ClinicAppointmentParam对象", description = "挂号查询参数")
|
||||
public class ClinicAppointmentParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "类型")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "就诊原因")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "挂号时间")
|
||||
private String evaluateTime;
|
||||
|
||||
@Schema(description = "医生")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer doctorId;
|
||||
|
||||
@Schema(description = "患者")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String comments;
|
||||
|
||||
@Schema(description = "排序号")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@Schema(description = "是否删除")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer isDelete;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.gxwebsoft.clinic.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.clinic.entity.ClinicAppointment;
|
||||
import com.gxwebsoft.clinic.param.ClinicAppointmentParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂号Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-10-16 20:34:59
|
||||
*/
|
||||
public interface ClinicAppointmentService extends IService<ClinicAppointment> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<ClinicAppointment>
|
||||
*/
|
||||
PageResult<ClinicAppointment> pageRel(ClinicAppointmentParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<ClinicAppointment>
|
||||
*/
|
||||
List<ClinicAppointment> listRel(ClinicAppointmentParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id 主键ID
|
||||
* @return ClinicAppointment
|
||||
*/
|
||||
ClinicAppointment getByIdRel(Long id);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.clinic.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.clinic.mapper.ClinicAppointmentMapper;
|
||||
import com.gxwebsoft.clinic.service.ClinicAppointmentService;
|
||||
import com.gxwebsoft.clinic.entity.ClinicAppointment;
|
||||
import com.gxwebsoft.clinic.param.ClinicAppointmentParam;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂号Service实现
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2025-10-16 20:34:59
|
||||
*/
|
||||
@Service
|
||||
public class ClinicAppointmentServiceImpl extends ServiceImpl<ClinicAppointmentMapper, ClinicAppointment> implements ClinicAppointmentService {
|
||||
|
||||
@Override
|
||||
public PageResult<ClinicAppointment> pageRel(ClinicAppointmentParam param) {
|
||||
PageParam<ClinicAppointment, ClinicAppointmentParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<ClinicAppointment> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClinicAppointment> listRel(ClinicAppointmentParam param) {
|
||||
List<ClinicAppointment> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<ClinicAppointment, ClinicAppointmentParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClinicAppointment getByIdRel(Long id) {
|
||||
ClinicAppointmentParam param = new ClinicAppointmentParam();
|
||||
param.setId(id);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -84,6 +84,9 @@ public class CmsWebsite implements Serializable {
|
||||
@Schema(description = "后台管理地址")
|
||||
private String adminUrl;
|
||||
|
||||
@Schema(description = "自定义API接口")
|
||||
private String apiUrl;
|
||||
|
||||
@Schema(description = "应用版本 10免费版 20授权版 30永久授权")
|
||||
private Integer version;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class CmsWebsiteServiceImplHelper {
|
||||
if (website.getExpirationTime() != null) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Date expirationTimeDate = website.getExpirationTime();
|
||||
|
||||
|
||||
// 将Date转换为LocalDateTime进行计算
|
||||
LocalDateTime expirationTime = expirationTimeDate.toInstant()
|
||||
.atZone(java.time.ZoneId.systemDefault())
|
||||
@@ -66,6 +66,8 @@ public class CmsWebsiteServiceImplHelper {
|
||||
vo.setLogo(website.getWebsiteLogo());
|
||||
vo.setMpQrCode(website.getWebsiteDarkLogo());
|
||||
vo.setDomain(website.getDomain());
|
||||
vo.setAdminUrl(website.getAdminUrl());
|
||||
vo.setApiUrl(website.getApiUrl());
|
||||
vo.setRunning(website.getRunning());
|
||||
vo.setVersion(website.getVersion());
|
||||
if (website.getCreateTime() != null) {
|
||||
|
||||
@@ -48,6 +48,12 @@ public class ShopVo implements Serializable {
|
||||
@Schema(description = "域名")
|
||||
private String domain;
|
||||
|
||||
@Schema(description = "后台管理地址")
|
||||
private String adminUrl;
|
||||
|
||||
@Schema(description = "API地址")
|
||||
private String apiUrl;
|
||||
|
||||
@Schema(description = "运行状态 0未开通 1正常 2维护中 3违规关停")
|
||||
private Integer running;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user