维护系统->检查部位后端接口优化。
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class CheckMethodAppServiceImpl implements ICheckMethodAppService {
|
||||
}
|
||||
//2.保存
|
||||
boolean save = checkMethodService.save(checkMethod);
|
||||
return R.ok();
|
||||
return R.ok(save);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.openhis.check.domain;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -24,7 +23,7 @@ public class CheckPart {
|
||||
|
||||
/** 检查部位ID */
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
private Integer id;
|
||||
|
||||
/** 检查部位名称 */
|
||||
private String name;
|
||||
|
||||
@@ -81,12 +81,39 @@ export function delCheckMethod(checkMethodId) {
|
||||
// 查询检查部位列表
|
||||
export function listCheckPart(query) {
|
||||
return request({
|
||||
url: '/system/check-part/list',
|
||||
url: '/check/part/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 新增检查部位
|
||||
export function addCheckPart(data) {
|
||||
return request({
|
||||
url: '/check/part/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除检查部位
|
||||
export function delCheckPart(checkPartId) {
|
||||
return request({
|
||||
url: '/check/part/delete/' + checkPartId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 更新检查部位
|
||||
export function updateCheckPart(data) {
|
||||
return request({
|
||||
url: '/check/part/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 查询检查套餐列表
|
||||
export function listCheckPackage(query) {
|
||||
return request({
|
||||
|
||||
Reference in New Issue
Block a user