From 514f239de45fe30abd1b3ed2ee75ddfdaadad3ec Mon Sep 17 00:00:00 2001 From: Flow <958079825@qq.com> Date: Tue, 12 Aug 2025 16:51:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/ecgconfig/EcgconfigController.java | 6 +++--- .../vo/EcgconfigUpdateByOrgidReqVO.java | 4 ---- .../EcgworkstationController.java | 18 ++++++++++++------ .../dal/mysql/ecgconfig/EcgconfigMapper.java | 6 +----- .../service/ecgconfig/EcgconfigService.java | 3 ++- .../ecgconfig/EcgconfigServiceImpl.java | 12 +++++++++++- .../src/main/resources/application.yaml | 1 + 7 files changed, 30 insertions(+), 20 deletions(-) diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgconfig/EcgconfigController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgconfig/EcgconfigController.java index ac614d9..f814433 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgconfig/EcgconfigController.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgconfig/EcgconfigController.java @@ -100,15 +100,15 @@ public class EcgconfigController { } @PutMapping("/update-by-conditions") - @Operation(summary = "根据机构ID、检查ID、登记号更新心电图参数配置") + @Operation(summary = "根据机构ID、检查ID更新或新增心电图参数配置") public CommonResult updateEcgconfigByConditions(@Valid @RequestBody EcgconfigUpdateByOrgidReqVO updateReqVO) { try { ecgconfigService.updateEcgconfigByConditions(updateReqVO); CommonResult result = success(true); - result.setMsg("更新成功"); + result.setMsg("操作成功"); return result; } catch (Exception e) { - return CommonResult.error(400, "更新失败: " + e.getMessage()); + return CommonResult.error(400, "操作失败: " + e.getMessage()); } } diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgconfig/vo/EcgconfigUpdateByOrgidReqVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgconfig/vo/EcgconfigUpdateByOrgidReqVO.java index ea72c5d..fe66ea0 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgconfig/vo/EcgconfigUpdateByOrgidReqVO.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgconfig/vo/EcgconfigUpdateByOrgidReqVO.java @@ -16,10 +16,6 @@ public class EcgconfigUpdateByOrgidReqVO { @NotBlank(message = "检查唯一标识号不能为空") private String examid; - @Schema(description = "患者登记号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5233") - @NotBlank(message = "患者登记号不能为空") - private String regid; - @Schema(description = "心率") private String hr; diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgworkstation/EcgworkstationController.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgworkstation/EcgworkstationController.java index 3efd3ae..b8e73d5 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgworkstation/EcgworkstationController.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ecgworkstation/EcgworkstationController.java @@ -102,12 +102,18 @@ public class EcgworkstationController { @PutMapping("/updatePdfUrl") @Operation(summary = "根据机构ID和检查ID更新PDF地址") - public CommonResult updatePdfUrlByOrgidAndExamid(@Valid @RequestBody EcgworkstationUpdatePdfUrlReqVO updateReqVO) { - boolean updateSuccess = ecgworkstationService.updatePdfUrlByOrgidAndExamid(updateReqVO); - if (updateSuccess) { - return success("PDF报告地址更新成功"); - } else { - return CommonResult.error(404, "未找到匹配的记录,PDF地址更新失败"); + public CommonResult updatePdfUrlByOrgidAndExamid(@Valid @RequestBody EcgworkstationUpdatePdfUrlReqVO updateReqVO) { + try { + boolean updateSuccess = ecgworkstationService.updatePdfUrlByOrgidAndExamid(updateReqVO); + if (updateSuccess) { + CommonResult result = success(true); + result.setMsg("PDF报告地址更新成功"); + return result; + } else { + return CommonResult.error(404, "未找到匹配的记录,PDF地址更新失败"); + } + } catch (Exception e) { + return CommonResult.error(400, "更新失败: " + e.getMessage()); } } diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/ecgconfig/EcgconfigMapper.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/ecgconfig/EcgconfigMapper.java index 12be87a..0c85f0f 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/ecgconfig/EcgconfigMapper.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/ecgconfig/EcgconfigMapper.java @@ -49,16 +49,12 @@ public interface EcgconfigMapper extends BaseMapperX { default void updateByConditions(EcgconfigUpdateByOrgidReqVO updateReqVO) { com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper updateWrapper = new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper() .eq(EcgconfigDO::getOrgid, updateReqVO.getOrgid()) - .eq(EcgconfigDO::getExamid, updateReqVO.getExamid()) - .eq(EcgconfigDO::getRegid, updateReqVO.getRegid()); + .eq(EcgconfigDO::getExamid, updateReqVO.getExamid()); // 只更新非空字段 if (updateReqVO.getExamid() != null) { updateWrapper.set(EcgconfigDO::getExamid, updateReqVO.getExamid()); } - if (updateReqVO.getRegid() != null) { - updateWrapper.set(EcgconfigDO::getRegid, updateReqVO.getRegid()); - } if (updateReqVO.getHr() != null) { updateWrapper.set(EcgconfigDO::getHr, updateReqVO.getHr()); } diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgconfig/EcgconfigService.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgconfig/EcgconfigService.java index 5fa3488..2a5cf74 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgconfig/EcgconfigService.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgconfig/EcgconfigService.java @@ -70,7 +70,8 @@ public interface EcgconfigService { List getEcgconfigListByConditions(String orgid, String examid); /** - * 根据机构ID、检查ID、登记号更新心电图参数配置 + * 根据机构ID、检查ID更新或新增心电图参数配置 + * 如果记录存在则更新,不存在则新增 * * @param updateReqVO 更新信息 */ diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgconfig/EcgconfigServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgconfig/EcgconfigServiceImpl.java index e434c35..d7e6b16 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgconfig/EcgconfigServiceImpl.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/ecgconfig/EcgconfigServiceImpl.java @@ -95,7 +95,17 @@ public class EcgconfigServiceImpl implements EcgconfigService { @Override public void updateEcgconfigByConditions(EcgconfigUpdateByOrgidReqVO updateReqVO) { - ecgconfigMapper.updateByConditions(updateReqVO); + // 先查询是否存在记录 + List existingRecords = ecgconfigMapper.selectListByConditions(updateReqVO.getOrgid(), updateReqVO.getExamid()); + + if (existingRecords != null && !existingRecords.isEmpty()) { + // 记录存在,执行更新操作 + ecgconfigMapper.updateByConditions(updateReqVO); + } else { + // 记录不存在,执行插入操作 + EcgconfigDO newRecord = BeanUtils.toBean(updateReqVO, EcgconfigDO.class); + ecgconfigMapper.insert(newRecord); + } } } \ No newline at end of file diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 50ab639..3020432 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -246,6 +246,7 @@ yudao: - /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录 - /admin-api/system/ecgconfig/list-by-conditions # 获取心电图参数配置列表 - /admin-api/system/ecgconfig/update-by-conditions # 更新心电图参数配置 + - /admin-api/system/ecgworkstation/updatePdfUrl # 更新心电工作站PDF报告地址 websocket: enable: true # websocket的开关 path: /infra/ws # 路径