From f67e3792248c225259f69fdbc3b87c62d11f6538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Fri, 17 Oct 2025 20:34:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(shop):=20=E6=96=B0=E5=A2=9E=E6=A0=B9?= =?UTF-8?q?=E6=8D=AEuserId=E6=9F=A5=E8=AF=A2=E6=8E=A8=E8=8D=90=E4=BA=BA?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3-=20=E5=9C=A8=E6=8E=A7=E5=88=B6=E5=99=A8?= =?UTF-8?q?=E4=B8=AD=E5=A2=9E=E5=8A=A0=20getByUserId=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87=20userId=20?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A8=E8=8D=90=E4=BA=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=E6=9C=8D=E5=8A=A1=E5=B1=82=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=9F=A5=E8=AF=A2=E6=97=B6=E9=99=90=E5=AE=9A?= =?UTF-8?q?=20level=20=E4=B8=BA=201=20=E7=9A=84=E6=8E=A8=E8=8D=90=E5=85=B3?= =?UTF-8?q?=E7=B3=BB=20-=20=E5=BC=95=E5=85=A5=20ShopUserReferee=20?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB=E4=BB=A5=E6=94=AF=E6=8C=81=E5=85=B3?= =?UTF-8?q?=E8=81=94=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ClinicAppointmentController.java | 128 ++++++++++++++++++ .../clinic/entity/ClinicAppointment.java | 88 ++++++++++++ .../mapper/ClinicAppointmentMapper.java | 37 +++++ .../mapper/xml/ClinicAppointmentMapper.xml | 60 ++++++++ .../clinic/param/ClinicAppointmentParam.java | 58 ++++++++ .../service/ClinicAppointmentService.java | 42 ++++++ .../impl/ClinicAppointmentServiceImpl.java | 47 +++++++ .../com/gxwebsoft/cms/entity/CmsWebsite.java | 3 + .../impl/CmsWebsiteServiceImplHelper.java | 4 +- .../java/com/gxwebsoft/shop/vo/ShopVo.java | 6 + 10 files changed, 472 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/gxwebsoft/clinic/controller/ClinicAppointmentController.java create mode 100644 src/main/java/com/gxwebsoft/clinic/entity/ClinicAppointment.java create mode 100644 src/main/java/com/gxwebsoft/clinic/mapper/ClinicAppointmentMapper.java create mode 100644 src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicAppointmentMapper.xml create mode 100644 src/main/java/com/gxwebsoft/clinic/param/ClinicAppointmentParam.java create mode 100644 src/main/java/com/gxwebsoft/clinic/service/ClinicAppointmentService.java create mode 100644 src/main/java/com/gxwebsoft/clinic/service/impl/ClinicAppointmentServiceImpl.java diff --git a/src/main/java/com/gxwebsoft/clinic/controller/ClinicAppointmentController.java b/src/main/java/com/gxwebsoft/clinic/controller/ClinicAppointmentController.java new file mode 100644 index 0000000..0eea858 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/controller/ClinicAppointmentController.java @@ -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> page(ClinicAppointmentParam param) { + // 使用关联查询 + return success(clinicAppointmentService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:list')") + @Operation(summary = "查询全部挂号") + @GetMapping() + public ApiResult> list(ClinicAppointmentParam param) { + // 使用关联查询 + return success(clinicAppointmentService.listRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:list')") + @Operation(summary = "根据id查询挂号") + @GetMapping("/{id}") + public ApiResult 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 list) { + if (clinicAppointmentService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:update')") + @OperationLog + @Operation(summary = "批量修改挂号") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam 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 ids) { + if (clinicAppointmentService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/entity/ClinicAppointment.java b/src/main/java/com/gxwebsoft/clinic/entity/ClinicAppointment.java new file mode 100644 index 0000000..ac2934e --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/entity/ClinicAppointment.java @@ -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; + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/ClinicAppointmentMapper.java b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicAppointmentMapper.java new file mode 100644 index 0000000..135ad19 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicAppointmentMapper.java @@ -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 { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ClinicAppointmentParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ClinicAppointmentParam param); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicAppointmentMapper.xml b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicAppointmentMapper.xml new file mode 100644 index 0000000..3825e91 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicAppointmentMapper.xml @@ -0,0 +1,60 @@ + + + + + + + SELECT a.* + FROM clinic_appointment a + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.reason LIKE CONCAT('%', #{param.reason}, '%') + + + AND a.evaluate_time LIKE CONCAT('%', #{param.evaluateTime}, '%') + + + AND a.doctor_id = #{param.doctorId} + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.is_delete = #{param.isDelete} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/clinic/param/ClinicAppointmentParam.java b/src/main/java/com/gxwebsoft/clinic/param/ClinicAppointmentParam.java new file mode 100644 index 0000000..9205140 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/param/ClinicAppointmentParam.java @@ -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; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/ClinicAppointmentService.java b/src/main/java/com/gxwebsoft/clinic/service/ClinicAppointmentService.java new file mode 100644 index 0000000..8c2b9dc --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/ClinicAppointmentService.java @@ -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 { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ClinicAppointmentParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ClinicAppointmentParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ClinicAppointment + */ + ClinicAppointment getByIdRel(Long id); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicAppointmentServiceImpl.java b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicAppointmentServiceImpl.java new file mode 100644 index 0000000..ad3d1fa --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicAppointmentServiceImpl.java @@ -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 implements ClinicAppointmentService { + + @Override + public PageResult pageRel(ClinicAppointmentParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ClinicAppointmentParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam 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)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsWebsite.java b/src/main/java/com/gxwebsoft/cms/entity/CmsWebsite.java index 77ccd7c..46bec1c 100644 --- a/src/main/java/com/gxwebsoft/cms/entity/CmsWebsite.java +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsWebsite.java @@ -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; diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteServiceImplHelper.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteServiceImplHelper.java index e632f51..85647df 100644 --- a/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteServiceImplHelper.java +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteServiceImplHelper.java @@ -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) { diff --git a/src/main/java/com/gxwebsoft/shop/vo/ShopVo.java b/src/main/java/com/gxwebsoft/shop/vo/ShopVo.java index b95ca2b..0596949 100644 --- a/src/main/java/com/gxwebsoft/shop/vo/ShopVo.java +++ b/src/main/java/com/gxwebsoft/shop/vo/ShopVo.java @@ -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;