feat(clinic):优化处方相关功能并调整菜单排序- 修改 ClinicPatientUser 实体中的 sex 字段类型为 Integer
- 移除 ClinicPatientUser 中 age 字段的 @TableField 注解 - 在 ClinicPrescription 实体中新增患者和医生相关信息字段 - 更新处方主表关联查询 SQL,增加患者和医生信息关联 - 处方控制器中启用当前登录用户作为医生,并生成订单号- 保存处方后返回包含处方 ID 的完整数据 - 调整处方明细接口权限注解,统一使用处方主表权限 - 新增获取最新一条处方记录的服务方法 - 菜单服务中将插件菜单排序号从0 调整为 100
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.gxwebsoft.clinic.controller;
|
package com.gxwebsoft.clinic.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.gxwebsoft.clinic.entity.ClinicPrescription;
|
import com.gxwebsoft.clinic.entity.ClinicPrescription;
|
||||||
import com.gxwebsoft.clinic.param.ClinicPrescriptionParam;
|
import com.gxwebsoft.clinic.param.ClinicPrescriptionParam;
|
||||||
import com.gxwebsoft.clinic.service.ClinicPrescriptionService;
|
import com.gxwebsoft.clinic.service.ClinicPrescriptionService;
|
||||||
@@ -8,6 +9,7 @@ import com.gxwebsoft.common.core.web.ApiResult;
|
|||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@@ -30,7 +32,6 @@ public class ClinicPrescriptionController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ClinicPrescriptionService clinicPrescriptionService;
|
private ClinicPrescriptionService clinicPrescriptionService;
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescription:list')")
|
|
||||||
@Operation(summary = "分页查询处方主表")
|
@Operation(summary = "分页查询处方主表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ClinicPrescription>> page(ClinicPrescriptionParam param) {
|
public ApiResult<PageResult<ClinicPrescription>> page(ClinicPrescriptionParam param) {
|
||||||
@@ -46,7 +47,6 @@ public class ClinicPrescriptionController extends BaseController {
|
|||||||
return success(clinicPrescriptionService.listRel(param));
|
return success(clinicPrescriptionService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescription:list')")
|
|
||||||
@Operation(summary = "根据id查询处方主表")
|
@Operation(summary = "根据id查询处方主表")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<ClinicPrescription> get(@PathVariable("id") Integer id) {
|
public ApiResult<ClinicPrescription> get(@PathVariable("id") Integer id) {
|
||||||
@@ -60,12 +60,16 @@ public class ClinicPrescriptionController extends BaseController {
|
|||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ClinicPrescription clinicPrescription) {
|
public ApiResult<?> save(@RequestBody ClinicPrescription clinicPrescription) {
|
||||||
// 记录当前登录用户id
|
// 记录当前登录用户id
|
||||||
// User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
// if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
// clinicPrescription.setUserId(loginUser.getUserId());
|
clinicPrescription.setDoctorId(loginUser.getUserId());
|
||||||
// }
|
// 生成订单号
|
||||||
|
String orderNo = Long.toString(IdUtil.getSnowflakeNextId());
|
||||||
|
clinicPrescription.setOrderNo(orderNo);
|
||||||
|
}
|
||||||
if (clinicPrescriptionService.save(clinicPrescription)) {
|
if (clinicPrescriptionService.save(clinicPrescription)) {
|
||||||
return success("添加成功");
|
// 返回处方数据,包含处方ID
|
||||||
|
return success("添加成功",clinicPrescriptionService.getByLastId(clinicPrescription));
|
||||||
}
|
}
|
||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ public class ClinicPrescriptionItemController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ClinicPrescriptionItemService clinicPrescriptionItemService;
|
private ClinicPrescriptionItemService clinicPrescriptionItemService;
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescriptionItem:list')")
|
|
||||||
@Operation(summary = "分页查询处方明细表")
|
@Operation(summary = "分页查询处方明细表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<ClinicPrescriptionItem>> page(ClinicPrescriptionItemParam param) {
|
public ApiResult<PageResult<ClinicPrescriptionItem>> page(ClinicPrescriptionItemParam param) {
|
||||||
@@ -38,7 +37,7 @@ public class ClinicPrescriptionItemController extends BaseController {
|
|||||||
return success(clinicPrescriptionItemService.pageRel(param));
|
return success(clinicPrescriptionItemService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescriptionItem:list')")
|
@PreAuthorize("hasAuthority('clinic:clinicPrescription:list')")
|
||||||
@Operation(summary = "查询全部处方明细表")
|
@Operation(summary = "查询全部处方明细表")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<ClinicPrescriptionItem>> list(ClinicPrescriptionItemParam param) {
|
public ApiResult<List<ClinicPrescriptionItem>> list(ClinicPrescriptionItemParam param) {
|
||||||
@@ -46,7 +45,6 @@ public class ClinicPrescriptionItemController extends BaseController {
|
|||||||
return success(clinicPrescriptionItemService.listRel(param));
|
return success(clinicPrescriptionItemService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescriptionItem:list')")
|
|
||||||
@Operation(summary = "根据id查询处方明细表")
|
@Operation(summary = "根据id查询处方明细表")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<ClinicPrescriptionItem> get(@PathVariable("id") Integer id) {
|
public ApiResult<ClinicPrescriptionItem> get(@PathVariable("id") Integer id) {
|
||||||
@@ -54,23 +52,18 @@ public class ClinicPrescriptionItemController extends BaseController {
|
|||||||
return success(clinicPrescriptionItemService.getByIdRel(id));
|
return success(clinicPrescriptionItemService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescriptionItem:save')")
|
@PreAuthorize("hasAuthority('clinic:clinicPrescription:save')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@Operation(summary = "添加处方明细表")
|
@Operation(summary = "添加处方明细表")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody ClinicPrescriptionItem clinicPrescriptionItem) {
|
public ApiResult<?> save(@RequestBody ClinicPrescriptionItem clinicPrescriptionItem) {
|
||||||
// 记录当前登录用户id
|
|
||||||
// User loginUser = getLoginUser();
|
|
||||||
// if (loginUser != null) {
|
|
||||||
// clinicPrescriptionItem.setUserId(loginUser.getUserId());
|
|
||||||
// }
|
|
||||||
if (clinicPrescriptionItemService.save(clinicPrescriptionItem)) {
|
if (clinicPrescriptionItemService.save(clinicPrescriptionItem)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescriptionItem:update')")
|
@PreAuthorize("hasAuthority('clinic:clinicPrescription:update')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@Operation(summary = "修改处方明细表")
|
@Operation(summary = "修改处方明细表")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
@@ -81,7 +74,7 @@ public class ClinicPrescriptionItemController extends BaseController {
|
|||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescriptionItem:remove')")
|
@PreAuthorize("hasAuthority('clinic:clinicPrescription:remove')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@Operation(summary = "删除处方明细表")
|
@Operation(summary = "删除处方明细表")
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
@@ -92,7 +85,7 @@ public class ClinicPrescriptionItemController extends BaseController {
|
|||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescriptionItem:save')")
|
@PreAuthorize("hasAuthority('clinic:clinicPrescription:save')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@Operation(summary = "批量添加处方明细表")
|
@Operation(summary = "批量添加处方明细表")
|
||||||
@PostMapping("/batch")
|
@PostMapping("/batch")
|
||||||
@@ -103,7 +96,7 @@ public class ClinicPrescriptionItemController extends BaseController {
|
|||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescriptionItem:update')")
|
@PreAuthorize("hasAuthority('clinic:clinicPrescription:update')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@Operation(summary = "批量修改处方明细表")
|
@Operation(summary = "批量修改处方明细表")
|
||||||
@PutMapping("/batch")
|
@PutMapping("/batch")
|
||||||
@@ -114,7 +107,7 @@ public class ClinicPrescriptionItemController extends BaseController {
|
|||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('clinic:clinicPrescriptionItem:remove')")
|
@PreAuthorize("hasAuthority('clinic:clinicPrescription:remove')")
|
||||||
@OperationLog
|
@OperationLog
|
||||||
@Operation(summary = "批量删除处方明细表")
|
@Operation(summary = "批量删除处方明细表")
|
||||||
@DeleteMapping("/batch")
|
@DeleteMapping("/batch")
|
||||||
|
|||||||
@@ -45,11 +45,9 @@ public class ClinicPatientUser implements Serializable {
|
|||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@Schema(description = "性别 0未知 1男 2女")
|
@Schema(description = "性别 0未知 1男 2女")
|
||||||
@TableField(exist = false)
|
private Integer sex;
|
||||||
private String sex;
|
|
||||||
|
|
||||||
@Schema(description = "年龄")
|
@Schema(description = "年龄")
|
||||||
@TableField(exist = false)
|
|
||||||
private Integer age;
|
private Integer age;
|
||||||
|
|
||||||
@Schema(description = "身高")
|
@Schema(description = "身高")
|
||||||
|
|||||||
@@ -33,9 +33,33 @@ public class ClinicPrescription implements Serializable {
|
|||||||
@Schema(description = "患者")
|
@Schema(description = "患者")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
@Schema(description = "患者名称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String realName;
|
||||||
|
|
||||||
|
@Schema(description = "年龄")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String age;
|
||||||
|
|
||||||
|
@Schema(description = "身高")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String height;
|
||||||
|
|
||||||
|
@Schema(description = "体重")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String weight;
|
||||||
|
|
||||||
@Schema(description = "医生")
|
@Schema(description = "医生")
|
||||||
private Integer doctorId;
|
private Integer doctorId;
|
||||||
|
|
||||||
|
@Schema(description = "医生名称")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String doctorName;
|
||||||
|
|
||||||
|
@Schema(description = "医生资格")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String qualification;
|
||||||
|
|
||||||
@Schema(description = "订单编号")
|
@Schema(description = "订单编号")
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*, b.phone,b.avatar, b.sex, b.age
|
SELECT a.*, b.phone, b.avatar
|
||||||
FROM clinic_patient_user a
|
FROM clinic_patient_user a
|
||||||
LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id
|
LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id
|
||||||
<where>
|
<where>
|
||||||
|
|||||||
@@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*
|
SELECT a.*, b.real_name, b.age, b.sex, b.height, b.weight, c.real_name as doctorName, c.qualification
|
||||||
FROM clinic_prescription a
|
FROM clinic_prescription a
|
||||||
|
LEFT JOIN clinic_patient_user b ON a.user_id = b.user_id
|
||||||
|
LEFT JOIN clinic_doctor_user c ON a.doctor_id = c.user_id
|
||||||
<where>
|
<where>
|
||||||
<if test="param.id != null">
|
<if test="param.id != null">
|
||||||
AND a.id = #{param.id}
|
AND a.id = #{param.id}
|
||||||
|
|||||||
@@ -40,4 +40,6 @@ public interface ClinicPrescriptionService extends IService<ClinicPrescription>
|
|||||||
*/
|
*/
|
||||||
ClinicPrescription getByIdRel(Integer id);
|
ClinicPrescription getByIdRel(Integer id);
|
||||||
|
|
||||||
|
// 添加成功后返回数据
|
||||||
|
ClinicPrescription getByLastId(ClinicPrescription clinicPrescription);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.gxwebsoft.clinic.service.impl;
|
package com.gxwebsoft.clinic.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.clinic.entity.ClinicPrescription;
|
import com.gxwebsoft.clinic.entity.ClinicPrescription;
|
||||||
import com.gxwebsoft.clinic.entity.ClinicPrescriptionItem;
|
import com.gxwebsoft.clinic.entity.ClinicPrescriptionItem;
|
||||||
@@ -66,4 +67,9 @@ public class ClinicPrescriptionServiceImpl extends ServiceImpl<ClinicPrescriptio
|
|||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ClinicPrescription getByLastId(ClinicPrescription clinicPrescription) {
|
||||||
|
return getOne(new LambdaQueryWrapper<ClinicPrescription>().orderByDesc(ClinicPrescription::getId).eq(ClinicPrescription::getUserId, clinicPrescription.getUserId()).last("limit 1"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
|
|||||||
});
|
});
|
||||||
// 5.调整新插件的排序
|
// 5.调整新插件的排序
|
||||||
final Menu menu = baseMapper.selectById(this.plugMenuId);
|
final Menu menu = baseMapper.selectById(this.plugMenuId);
|
||||||
menu.setSortNumber(0);
|
menu.setSortNumber(100);
|
||||||
baseMapper.updateById(menu);
|
baseMapper.updateById(menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user