维护系统->检查部位后端接口优化。

This commit is contained in:
qk123
2025-12-03 17:15:35 +08:00
parent b3c27ec789
commit 7407562ec5
6 changed files with 51 additions and 56 deletions

View File

@@ -1,14 +1,14 @@
package com.openhis.web.check.appservice;
import com.core.common.core.domain.R;
import com.openhis.web.check.dto.CheckPartDto;
import com.openhis.check.domain.CheckPart;
public interface ICheckPartAppService {
R<?> getCheckPartList();
R<?> addCheckPart(CheckPartDto checkPartDto);
R<?> addCheckPart(CheckPart checkPart);
R<?> removeCheckPart(Long code);
R<?> removeCheckPart(Integer checkPartId);
R<?> updateCheckPart(CheckPartDto checkMethodDto);
R<?> updateCheckPart(CheckPart checkPart);
}

View File

@@ -44,7 +44,7 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
}
//2.保存
boolean save = checkMethodService.save(checkMethod);
return R.ok();
return R.ok(save);
}
@Override

View File

@@ -24,54 +24,23 @@ public class CheckPartAppServiceImpl implements ICheckPartAppService {
}
@Override
public R<?> addCheckPart(CheckPartDto checkPartDto) {
public R<?> addCheckPart(CheckPart checkPart) {
//数据检验
if(ObjectUtil.isEmpty(checkPartDto.getName())){
return R.fail("检查项目名称不能为空");
}
if(ObjectUtil.isEmpty(checkPartDto.getCode())){
return R.fail("检查项目代码不能为空");
}
if(ObjectUtil.isEmpty(checkPartDto.getCheckType())){
return R.fail("检查项目类型不能为空");
}
//唯一性检验
LambdaQueryWrapper<CheckPart> wrapper = new LambdaQueryWrapper<CheckPart>()
.eq(CheckPart::getName, checkPartDto.getName())
.eq(CheckPart::getCode, checkPartDto.getCode())
.eq(CheckPart::getCheckType, checkPartDto.getCheckType());
if (checkPartService.getOne(wrapper) != null){
return R.fail("检查部位已存在");
}
//封装数据
CheckPart checkPart = new CheckPart();
checkPart.setName(checkPartDto.getName());
checkPart.setCode(checkPartDto.getCode());
checkPart.setCheckType(checkPartDto.getCheckType());
checkPart.setExposureNum(checkPartDto.getExposureNum());
checkPart.setPackageName(checkPartDto.getPackageName());
checkPart.setPrice(checkPartDto.getPrice());
checkPart.setNumber(checkPartDto.getNumber());
checkPart.setServiceScope(checkPartDto.getServiceScope());
checkPart.setSubType(checkPartDto.getSubType());
checkPart.setRemark(checkPartDto.getRemark());
//保存
checkPartService.save(checkPart);
return R.ok();
boolean save = checkPartService.save(checkPart);
return R.ok(save);
}
@Override
public R<?> removeCheckPart(Long code) {
if (ObjectUtil.isEmpty(code)){
return R.fail("检查项目代码不能为空");
}
LambdaQueryWrapper<CheckPart> wrapper = new LambdaQueryWrapper<CheckPart>().eq(CheckPart::getCode, code);
boolean remove = checkPartService.remove(wrapper);
public R<?> removeCheckPart(Integer checkPartId) {
boolean remove = checkPartService.removeById(checkPartId);
return R.ok(remove);
}
@Override
public R<?> updateCheckPart(CheckPartDto checkPartDto) {
return R.ok();
public R<?> updateCheckPart(CheckPart checkPart) {
boolean b = checkPartService.updateById(checkPart);
return R.ok(b);
}
}

View File

@@ -1,8 +1,8 @@
package com.openhis.web.check.controller;
import com.core.common.core.domain.R;
import com.openhis.check.domain.CheckPart;
import com.openhis.web.check.appservice.ICheckPartAppService;
import com.openhis.web.check.dto.CheckPartDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -29,17 +29,17 @@ public class CheckPartController {
* @Param
*/
@PostMapping("/add")
public R<?> addCheckPart(@RequestBody CheckPartDto checkPartDto){
return R.ok(checkPartAppService.addCheckPart(checkPartDto));
public R<?> addCheckPart(@RequestBody CheckPart checkPart){
return R.ok(checkPartAppService.addCheckPart(checkPart));
}
/*
* 删除检查部位
* @Param code代码
*/
@DeleteMapping("/delete/{code}")
public R<?> deleteCheckPart(@PathVariable Long code){
return R.ok(checkPartAppService.removeCheckPart(code));
@DeleteMapping("/delete/{checkPartId}")
public R<?> deleteCheckPart(@PathVariable Integer checkPartId){
return R.ok(checkPartAppService.removeCheckPart(checkPartId));
}
/*
@@ -47,7 +47,7 @@ public class CheckPartController {
* @Param
*/
@PutMapping("/update")
public R<?> updateCheckPart(@RequestBody CheckPartDto checkPartDto){
return R.ok(checkPartAppService.updateCheckPart(checkPartDto));
public R<?> updateCheckPart(@RequestBody CheckPart checkPart){
return R.ok(checkPartAppService.updateCheckPart(checkPart));
}
}