From c3dfd3eb21b5af43da9050ce482cfc907caa2cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=B3=E7=BE=BD?= <关羽@gentronhealth.com> Date: Mon, 11 May 2026 14:07:50 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#499:=20=E3=80=90=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=B7=A5=E4=BD=9C=E7=AB=99-=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E7=94=B3=E8=AF=B7=E3=80=91=E6=A3=80=E6=9F=A5=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=88=97=E8=A1=A8=E7=BC=BA=E5=A4=B1=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E5=8A=9F=E8=83=BD=EF=BC=8C=E4=B8=8D=E7=AC=A6?= =?UTF-8?q?=E5=90=88=E4=B8=B4=E5=BA=8A=E9=AB=98=E6=95=88=E6=A3=80=E7=B4=A2?= =?UTF-8?q?=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 补充修复: 1. 后端 get-inspection 接口新增 keyword 关键字参数(检验申请关键字搜索) 2. 新增 deleteRequestForm 接口(仅待签发状态可删除) 3. 新增 withdrawRequestForm 接口(已签发状态撤回至待签发) 4. RequestForm 实体新增 status 字段(用于撤回方法状态校验) Co-Authored-By: Claude Opus 4.7 --- .../IRequestFormManageAppService.java | 16 +++++ .../impl/RequestFormManageAppServiceImpl.java | 64 +++++++++++++++++++ .../RequestFormManageController.java | 6 +- .../openhis/document/domain/RequestForm.java | 5 ++ 4 files changed, 89 insertions(+), 2 deletions(-) diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/IRequestFormManageAppService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/IRequestFormManageAppService.java index f67aeeee..d4ae392a 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/IRequestFormManageAppService.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/IRequestFormManageAppService.java @@ -64,4 +64,20 @@ public interface IRequestFormManageAppService { * @return 申请单 */ IPage getRequestFormPage(RequestFormDto requestFormDto); + + /** + * 删除申请单(仅待签发状态可删除) + * + * @param requestFormId 申请单ID + * @return 结果 + */ + R deleteRequestForm(Long requestFormId); + + /** + * 撤回申请单(已签发状态撤回至待签发) + * + * @param requestFormId 申请单ID + * @return 结果 + */ + R withdrawRequestForm(Long requestFormId); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java index eb61dd26..b7ff0647 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java @@ -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 serviceRequestIds = iServiceRequestService + .list(new LambdaQueryWrapper().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 serviceRequests = iServiceRequestService + .list(new LambdaQueryWrapper().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, "撤回成功"); + } + } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/controller/RequestFormManageController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/controller/RequestFormManageController.java index f135ff44..3bc1216f 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/controller/RequestFormManageController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/controller/RequestFormManageController.java @@ -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)); } /** diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/document/domain/RequestForm.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/document/domain/RequestForm.java index e52ffd07..4b0d4102 100755 --- a/openhis-server-new/openhis-domain/src/main/java/com/openhis/document/domain/RequestForm.java +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/document/domain/RequestForm.java @@ -59,4 +59,9 @@ public class RequestForm extends HisBaseEntity { */ private String typeCode; + /** + * 单据状态 0=待签发 1=已签发 2=已校对 3=待接收 4=已接收 5=已检查 6=已出报告 7=已作废 + */ + private Integer status; + } \ No newline at end of file