修改接口
This commit is contained in:
parent
453c5c5bbe
commit
514f239de4
@ -100,15 +100,15 @@ public class EcgconfigController {
|
||||
}
|
||||
|
||||
@PutMapping("/update-by-conditions")
|
||||
@Operation(summary = "根据机构ID、检查ID、登记号更新心电图参数配置")
|
||||
@Operation(summary = "根据机构ID、检查ID更新或新增心电图参数配置")
|
||||
public CommonResult<Boolean> updateEcgconfigByConditions(@Valid @RequestBody EcgconfigUpdateByOrgidReqVO updateReqVO) {
|
||||
try {
|
||||
ecgconfigService.updateEcgconfigByConditions(updateReqVO);
|
||||
CommonResult<Boolean> result = success(true);
|
||||
result.setMsg("更新成功");
|
||||
result.setMsg("操作成功");
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
return CommonResult.error(400, "更新失败: " + e.getMessage());
|
||||
return CommonResult.error(400, "操作失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -102,12 +102,18 @@ public class EcgworkstationController {
|
||||
|
||||
@PutMapping("/updatePdfUrl")
|
||||
@Operation(summary = "根据机构ID和检查ID更新PDF地址")
|
||||
public CommonResult<String> updatePdfUrlByOrgidAndExamid(@Valid @RequestBody EcgworkstationUpdatePdfUrlReqVO updateReqVO) {
|
||||
boolean updateSuccess = ecgworkstationService.updatePdfUrlByOrgidAndExamid(updateReqVO);
|
||||
if (updateSuccess) {
|
||||
return success("PDF报告地址更新成功");
|
||||
} else {
|
||||
return CommonResult.error(404, "未找到匹配的记录,PDF地址更新失败");
|
||||
public CommonResult<Boolean> updatePdfUrlByOrgidAndExamid(@Valid @RequestBody EcgworkstationUpdatePdfUrlReqVO updateReqVO) {
|
||||
try {
|
||||
boolean updateSuccess = ecgworkstationService.updatePdfUrlByOrgidAndExamid(updateReqVO);
|
||||
if (updateSuccess) {
|
||||
CommonResult<Boolean> result = success(true);
|
||||
result.setMsg("PDF报告地址更新成功");
|
||||
return result;
|
||||
} else {
|
||||
return CommonResult.error(404, "未找到匹配的记录,PDF地址更新失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return CommonResult.error(400, "更新失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,16 +49,12 @@ public interface EcgconfigMapper extends BaseMapperX<EcgconfigDO> {
|
||||
default void updateByConditions(EcgconfigUpdateByOrgidReqVO updateReqVO) {
|
||||
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper<EcgconfigDO> updateWrapper = new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper<EcgconfigDO>()
|
||||
.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());
|
||||
}
|
||||
|
||||
@ -70,7 +70,8 @@ public interface EcgconfigService {
|
||||
List<EcgconfigDO> getEcgconfigListByConditions(String orgid, String examid);
|
||||
|
||||
/**
|
||||
* 根据机构ID、检查ID、登记号更新心电图参数配置
|
||||
* 根据机构ID、检查ID更新或新增心电图参数配置
|
||||
* 如果记录存在则更新,不存在则新增
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
|
||||
@ -95,7 +95,17 @@ public class EcgconfigServiceImpl implements EcgconfigService {
|
||||
|
||||
@Override
|
||||
public void updateEcgconfigByConditions(EcgconfigUpdateByOrgidReqVO updateReqVO) {
|
||||
ecgconfigMapper.updateByConditions(updateReqVO);
|
||||
// 先查询是否存在记录
|
||||
List<EcgconfigDO> 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -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 # 路径
|
||||
|
||||
Loading…
Reference in New Issue
Block a user