From b609590d7f0d65a1fa59b65c8afcdc8abb10e30e Mon Sep 17 00:00:00 2001 From: lichuanyang <1176537920@qq.com> Date: Wed, 18 Dec 2024 10:58:12 +0800 Subject: [PATCH] =?UTF-8?q?ecg=E6=89=93=E5=8D=B0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/doctor/DoctorController.java | 63 +++++++++++-------- .../system/dal/mysql/doctor/DoctorMapper.java | 7 ++- .../system/service/doctor/DoctorService.java | 8 +++ .../service/doctor/DoctorServiceImpl.java | 8 +++ 4 files changed, 58 insertions(+), 28 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/DoctorController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/DoctorController.java index e586fea83..0eb1ef2b2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/DoctorController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/doctor/DoctorController.java @@ -20,11 +20,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; + import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; @@ -53,17 +55,15 @@ public class DoctorController { @PostMapping("/create") @Operation(summary = "创建医生管理") @PreAuthorize("@ss.hasPermission('doctor::create')") - @LogRecord(type = "医生管理", subType = "创建", bizNo ="{{#createReqVO.getDoctorID}}" , success = "创建ID为{{#createReqVO.getDoctorID}}的医生") + @LogRecord(type = "医生管理", subType = "创建", bizNo = "{{#createReqVO.getDoctorID}}", success = "创建ID为{{#createReqVO.getDoctorID}}的医生") public CommonResult create(@Valid @RequestBody DoctorSaveReqVO createReqVO) { - String Msg=""; - DoctorDO doctorDO= Service.get(createReqVO.getDoctorID()); - if(doctorDO!=null) { - Msg="医生编号已存在"; - } - else - { - Msg= Service.create(createReqVO); + String Msg = ""; + DoctorDO doctorDO = Service.get(createReqVO.getDoctorID()); + if (doctorDO != null) { + Msg = "医生编号已存在"; + } else { + Msg = Service.create(createReqVO); } return success(Msg); } @@ -71,7 +71,7 @@ public class DoctorController { @PutMapping("/update") @Operation(summary = "更新医生管理") @PreAuthorize("@ss.hasPermission('doctor::update')") - @LogRecord(type = "医生管理", subType = "更新", bizNo ="{{#updateReqVO.getDoctorID}}" , success = "更新ID为{{#updateReqVO.getDoctorID}}的医生") + @LogRecord(type = "医生管理", subType = "更新", bizNo = "{{#updateReqVO.getDoctorID}}", success = "更新ID为{{#updateReqVO.getDoctorID}}的医生") public CommonResult update(@Valid @RequestBody DoctorSaveReqVO updateReqVO) { Service.update(updateReqVO); return success(true); @@ -81,14 +81,14 @@ public class DoctorController { @Operation(summary = "删除医生管理") @Parameter(name = "id", description = "编号", required = true) @PreAuthorize("@ss.hasPermission('doctor::delete')") - @LogRecord(type = "医生管理", subType = "删除", bizNo ="{{#id}}" , success = "删除ID为{{#id}}的医生") + @LogRecord(type = "医生管理", subType = "删除", bizNo = "{{#id}}", success = "删除ID为{{#id}}的医生") public CommonResult delete(@RequestParam("id") String id, @RequestParam("username") String username) { //不是真删除 修改状态 //Service.delete(id); //当前时间 - LocalDateTime dateTime= LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), + LocalDateTime dateTime = LocalDateTime.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); - DoctorSaveReqVO up=new DoctorSaveReqVO(); + DoctorSaveReqVO up = new DoctorSaveReqVO(); up.setDoctorID(id); up.setDeletePerson(username); up.setDeleteDate(dateTime); @@ -102,19 +102,27 @@ public class DoctorController { @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('doctor::query')") public CommonResult get(@RequestParam("id") String id) { - DoctorDO doctorDO= Service.get(id); + DoctorDO doctorDO = Service.get(id); return success(BeanUtils.toBean(doctorDO, DoctorRespVO.class)); } + @GetMapping("/getBydoctorID") + @Operation(summary = "获得医生管理") + @Parameter(name = "doctorID", description = "医生id", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('doctor::query')") + public CommonResult getBydoctorID(@RequestParam("doctorID") String doctorID) { + DoctorDO doctorDO = Service.getBydoctorID(doctorID); + return success(doctorDO); + } + @GetMapping("/page") @Operation(summary = "获得医生管理分页") @PreAuthorize("@ss.hasPermission('doctor::query')") public CommonResult> getPage(@Valid DoctorPageReqVO pageReqVO) { //获取当前登陆用户 AdminUserDO user = userService.getUser(getLoginUserId()); - String creator=user.getCreator(); - if(!creator.equals("admin")) - { + String creator = user.getCreator(); + if (!creator.equals("admin")) { pageReqVO.setOrgId(user.getOrgId()); } PageResult pageResult = Service.getPage(pageReqVO); @@ -125,23 +133,23 @@ public class DoctorController { @Operation(summary = "导出医生管理 Excel") @PreAuthorize("@ss.hasPermission('doctor::export')") @ApiAccessLog(operateType = EXPORT) - @LogRecord(type = "医生管理", subType = "导出", bizNo ="999" , success = "导出医生") + @LogRecord(type = "医生管理", subType = "导出", bizNo = "999", success = "导出医生") public void exportExcel(@Valid DoctorPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { + HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); List list = Service.getPage(pageReqVO).getList(); // 导出 Excel ExcelUtils.write(response, "医生管理.xls", "数据", DoctorRespVO.class, - BeanUtils.toBean(list, DoctorRespVO.class)); + BeanUtils.toBean(list, DoctorRespVO.class)); } @PostMapping("/upload") @Operation(summary = "上传图片") @PreAuthorize("@ss.hasPermission('doctor::create')") - public CommonResult handleFileUpload(@Valid @RequestBody uoloadVO uoloadVO) { + public CommonResult handleFileUpload(@Valid @RequestBody uoloadVO uoloadVO) { - String id=uoloadVO.getDoctorID(); - DoctorSaveReqVO up=new DoctorSaveReqVO(); + String id = uoloadVO.getDoctorID(); + DoctorSaveReqVO up = new DoctorSaveReqVO(); up.setDoctorID(id); up.setIsdelete("0"); up.setESignatureUrl(uoloadVO.getBase()); @@ -154,7 +162,7 @@ public class DoctorController { @PreAuthorize("@ss.hasPermission('doctor::query')") public CommonResult> getAlllist() { - List doctorDOs= Service.getDoctorList(null); + List doctorDOs = Service.getDoctorList(null); return success(doctorDOs); } @@ -166,16 +174,17 @@ public class DoctorController { //当前登陆用户 AdminUserDO user = userService.getUser(getLoginUserId()); - List doctorDOs= Service.getDoctorList(user.getOrgId()); + List doctorDOs = Service.getDoctorList(user.getOrgId()); return success(doctorDOs); } + @GetMapping("/getdoctorlist") @Operation(summary = "根据传入的机构获得医生list") @PreAuthorize("@ss.hasPermission('doctor::query')") - public CommonResult> getdoctorlist(@RequestParam("orgId") String orgId) { + public CommonResult> getdoctorlist(@RequestParam("orgId") String orgId) { - List doctorDOs= Service.getDoctorList(orgId); + List doctorDOs = Service.getDoctorList(orgId); return success(doctorDOs); } } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java index c133774ff..dc8bbb0bc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/doctor/DoctorMapper.java @@ -33,9 +33,14 @@ public interface DoctorMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(DoctorDO::getDoctorName, reqVO.getDoctorName()) .likeIfPresent(DoctorDO::getDepartmentName, reqVO.getDepartmentName()) - .eqIfPresent(DoctorDO::getOrgId,reqVO.getOrgId()) + .eqIfPresent(DoctorDO::getOrgId, reqVO.getOrgId()) .eq(DoctorDO::getIsdelete, '0') .orderByAsc(DoctorDO::getDoctorName)); } + default DoctorDO selectOne(String doctorID) { + return selectOne(new LambdaQueryWrapperX() + .neIfPresent(DoctorDO::getIsdelete, '1') + .eq(DoctorDO::getDoctorID, doctorID)); + } } \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorService.java index 6b6c7d96c..537ad0f86 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorService.java @@ -46,6 +46,14 @@ public interface DoctorService { */ DoctorDO get(String id); + /** + * 获得医生管理 + * + * @param doctorID 编号 + * @return 医生管理 + */ + DoctorDO getBydoctorID(String doctorID); + /** * 获得医生管理分页 * diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorServiceImpl.java index f5cc8ba76..a676e4932 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/doctor/DoctorServiceImpl.java @@ -69,6 +69,14 @@ public class DoctorServiceImpl implements DoctorService { return Mapper.selectById(id); } + @Override + public DoctorDO getBydoctorID(String doctorID) { + if (doctorID == null || doctorID.trim().isEmpty()) + return null; + else + return Mapper.selectOne(doctorID.trim()); + } + @Override public PageResult getPage(DoctorPageReqVO pageReqVO) { return Mapper.selectPage(pageReqVO);