Fix Bug #499: 【住院医生工作站-检查申请】检查申请列表缺失查询过滤功能,不符合临床高效检索要求
补充修复: 1. 后端 get-inspection 接口新增 keyword 关键字参数(检验申请关键字搜索) 2. 新增 deleteRequestForm 接口(仅待签发状态可删除) 3. 新增 withdrawRequestForm 接口(已签发状态撤回至待签发) 4. RequestForm 实体新增 status 字段(用于撤回方法状态校验) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -64,4 +64,20 @@ public interface IRequestFormManageAppService {
|
||||
* @return 申请单
|
||||
*/
|
||||
IPage<RequestFormPageDto> getRequestFormPage(RequestFormDto requestFormDto);
|
||||
|
||||
/**
|
||||
* 删除申请单(仅待签发状态可删除)
|
||||
*
|
||||
* @param requestFormId 申请单ID
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> deleteRequestForm(Long requestFormId);
|
||||
|
||||
/**
|
||||
* 撤回申请单(已签发状态撤回至待签发)
|
||||
*
|
||||
* @param requestFormId 申请单ID
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> withdrawRequestForm(Long requestFormId);
|
||||
}
|
||||
|
||||
@@ -458,4 +458,68 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
||||
return requestFormManageAppMapper.getRequestFormPage(requestFormDto, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除申请单(仅待签发状态可删除)
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<?> deleteRequestForm(Long requestFormId) {
|
||||
if (requestFormId == null) {
|
||||
return R.fail("申请单ID不能为空");
|
||||
}
|
||||
RequestForm requestForm = iRequestFormService.getById(requestFormId);
|
||||
if (requestForm == null) {
|
||||
return R.fail("申请单不存在");
|
||||
}
|
||||
if (!Integer.valueOf(0).equals(requestForm.getStatus())) {
|
||||
return R.fail("仅待签发状态的申请单可删除");
|
||||
}
|
||||
// 删除申请单
|
||||
iRequestFormService.removeById(requestFormId);
|
||||
// 删除关联的诊疗项目及账单
|
||||
String prescriptionNo = requestForm.getPrescriptionNo();
|
||||
List<Long> serviceRequestIds = iServiceRequestService
|
||||
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getPrescriptionNo, prescriptionNo))
|
||||
.stream().map(ServiceRequest::getId).collect(Collectors.toList());
|
||||
for (Long serviceRequestId : serviceRequestIds) {
|
||||
iServiceRequestService.removeById(serviceRequestId);
|
||||
iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.WOR_SERVICE_REQUEST, serviceRequestId);
|
||||
}
|
||||
return R.ok(null, "删除成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回申请单(已签发状态撤回至待签发)
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R<?> withdrawRequestForm(Long requestFormId) {
|
||||
if (requestFormId == null) {
|
||||
return R.fail("申请单ID不能为空");
|
||||
}
|
||||
RequestForm requestForm = iRequestFormService.getById(requestFormId);
|
||||
if (requestForm == null) {
|
||||
return R.fail("申请单不存在");
|
||||
}
|
||||
if (!Integer.valueOf(1).equals(requestForm.getStatus())) {
|
||||
return R.fail("仅已签发状态的申请单可撤回");
|
||||
}
|
||||
// 将申请单状态回滚至待签发
|
||||
RequestForm updateForm = new RequestForm();
|
||||
updateForm.setId(requestFormId);
|
||||
updateForm.setStatus(0);
|
||||
iRequestFormService.updateById(updateForm);
|
||||
// 将关联的诊疗项目状态回滚至DRAFT
|
||||
String prescriptionNo = requestForm.getPrescriptionNo();
|
||||
List<ServiceRequest> serviceRequests = iServiceRequestService
|
||||
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getPrescriptionNo, prescriptionNo));
|
||||
for (ServiceRequest serviceRequest : serviceRequests) {
|
||||
ServiceRequest updateService = new ServiceRequest();
|
||||
updateService.setId(serviceRequest.getId());
|
||||
updateService.setStatusEnum(RequestStatus.DRAFT.getValue());
|
||||
iServiceRequestService.updateById(updateService);
|
||||
}
|
||||
return R.ok(null, "撤回成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ public class RequestFormManageController {
|
||||
* @param startDate 开始日期(可选,格式:yyyy-MM-dd)
|
||||
* @param endDate 结束日期(可选,格式:yyyy-MM-dd)
|
||||
* @param status 单据状态(可选)
|
||||
* @param keyword 关键字(可选,申请单号/检验项目名称模糊匹配)
|
||||
* @return 检验申请单
|
||||
*/
|
||||
@GetMapping(value = "/get-inspection")
|
||||
@@ -114,11 +115,12 @@ public class RequestFormManageController {
|
||||
@RequestParam(required = false) Long encounterId,
|
||||
@RequestParam(required = false) String startDate,
|
||||
@RequestParam(required = false) String endDate,
|
||||
@RequestParam(required = false) String status) {
|
||||
@RequestParam(required = false) String status,
|
||||
@RequestParam(required = false) String keyword) {
|
||||
if (encounterId == null) {
|
||||
return R.fail("就诊ID不能为空");
|
||||
}
|
||||
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROOF.getCode(), startDate, endDate, status));
|
||||
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROOF.getCode(), startDate, endDate, status, keyword));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,4 +59,9 @@ public class RequestForm extends HisBaseEntity {
|
||||
*/
|
||||
private String typeCode;
|
||||
|
||||
/**
|
||||
* 单据状态 0=待签发 1=已签发 2=已校对 3=待接收 4=已接收 5=已检查 6=已出报告 7=已作废
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user