From a05b3a8d3c1519c1fe845d111708efed9b65f57f Mon Sep 17 00:00:00 2001 From: wangjian963 <15215920+aprilry@user.noreply.gitee.com> Date: Sat, 28 Feb 2026 14:59:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82-78-=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=97=A8=E8=AF=8A=E5=8C=BB=E7=94=9F=E5=BC=80=E7=AB=8B=E6=A3=80?= =?UTF-8?q?=E9=AA=8C=E7=94=B3=E8=AF=B7=E5=8D=95=E7=9A=84=E5=BC=80=E7=AB=8B?= =?UTF-8?q?=E4=B8=8E=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E8=B0=83=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...octorStationInspectionLabApplyService.java | 22 + .../DoctorStationLabApplyServiceImpl.java | 526 +++++++ ...orStationInspectionLabApplyController.java | 65 + .../dto/DoctorStationLabApplyDto.java | 151 ++ .../dto/DoctorStationLabApplyItemDto.java | 70 + .../mapper/DoctorStationLabApplyMapper.java | 22 + .../DoctorStationLabApplyMapper.xml | 35 + .../java/com/openhis/lab/domain/BarCode.java | 67 + .../lab/domain/InspectionLabApply.java | 126 ++ .../lab/domain/InspectionLabApplyItem.java | 77 + .../mapper/InspectionLabApplyItemMapper.java | 9 + .../lab/mapper/InspectionLabApplyMapper.java | 15 + .../mapper/InspectionLabBarCodeMapper.java | 15 + .../IInspectionLabApplyItemService.java | 12 + .../service/IInspectionLabApplyService.java | 13 + .../service/IInspectionLabBarCodeService.java | 13 + .../InspectionLabApplyItemServiceImpl.java | 13 + .../impl/InspectionLabApplyServiceImpl.java | 12 + .../impl/InspectionLabBarCodeServiceImpl.java | 19 + .../src/views/doctorstation/components/api.js | 59 +- .../inspection/inspectionApplication.vue | 1344 ++++++++++++----- 21 files changed, 2308 insertions(+), 377 deletions(-) create mode 100644 openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationInspectionLabApplyService.java create mode 100644 openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationLabApplyServiceImpl.java create mode 100644 openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationInspectionLabApplyController.java create mode 100644 openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DoctorStationLabApplyDto.java create mode 100644 openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DoctorStationLabApplyItemDto.java create mode 100644 openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationLabApplyMapper.java create mode 100644 openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationLabApplyMapper.xml create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/BarCode.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/InspectionLabApply.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/InspectionLabApplyItem.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabApplyItemMapper.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabApplyMapper.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabBarCodeMapper.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabApplyItemService.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabApplyService.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabBarCodeService.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabApplyItemServiceImpl.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabApplyServiceImpl.java create mode 100644 openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabBarCodeServiceImpl.java diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationInspectionLabApplyService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationInspectionLabApplyService.java new file mode 100644 index 00000000..7e04abfa --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationInspectionLabApplyService.java @@ -0,0 +1,22 @@ +package com.openhis.web.doctorstation.appservice; + +import com.core.common.core.domain.R; +import com.openhis.web.doctorstation.dto.DoctorStationLabApplyDto; + +/** + * 门诊医生站-检验服务接口 + */ +public interface IDoctorStationInspectionLabApplyService { + R saveInspectionLabApply(DoctorStationLabApplyDto doctorStationLabApplyDto); + + Object getInspectionApplyByApplyNo(String applyNo); + + Object getInspectionApplyListPage(Integer pageNo, Integer pageSize, Long encounterId); + + /** + * 删除检验申请单(同时删除关联的门诊医嘱) + * @param applyNo 申请单号 + * @return 删除结果 + */ + R deleteInspectionLabApply(String applyNo); +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationLabApplyServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationLabApplyServiceImpl.java new file mode 100644 index 00000000..3ac71b08 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationLabApplyServiceImpl.java @@ -0,0 +1,526 @@ +package com.openhis.web.doctorstation.appservice.impl; + +import com.core.common.core.domain.R; +import com.core.common.utils.SecurityUtils; +import com.openhis.administration.service.IAccountService; +import com.openhis.administration.domain.Account; +import com.openhis.lab.domain.InspectionLabApply; +import com.openhis.lab.domain.InspectionLabApplyItem; +import com.openhis.lab.domain.BarCode; +import com.openhis.lab.service.IInspectionLabApplyItemService; +import com.openhis.lab.service.IInspectionLabApplyService; +import com.openhis.lab.service.IInspectionLabBarCodeService; +import com.openhis.workflow.domain.ServiceRequest; +import com.openhis.workflow.service.IServiceRequestService; +import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService; +import com.openhis.web.doctorstation.appservice.IDoctorStationInspectionLabApplyService; +import com.openhis.web.doctorstation.dto.AdviceSaveDto; +import com.openhis.web.doctorstation.dto.AdviceSaveParam; +import com.openhis.web.doctorstation.dto.DoctorStationLabApplyDto; +import com.openhis.web.doctorstation.mapper.DoctorStationLabApplyMapper; +import com.openhis.administration.service.IOrganizationService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import com.openhis.web.doctorstation.dto.DoctorStationLabApplyItemDto; +import com.openhis.workflow.service.IActivityDefinitionService; +import com.openhis.administration.domain.Organization; +import com.openhis.workflow.domain.ActivityDefinition; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 根据检验申请单开单信息系统自动插入门诊医嘱表(与检验申请主表申请单号进行关联), + * 当检验申请单表删除(作废)时门诊医嘱表也随之删除(作废),为后续门诊收费业务数据闭环 + */ +@Slf4j +@Service +public class DoctorStationLabApplyServiceImpl implements IDoctorStationInspectionLabApplyService { + + @Autowired + private IInspectionLabApplyService inspectionLabApplyService; + + @Autowired + private IInspectionLabApplyItemService inspectionLabApplyItemService; + + @Autowired + private IInspectionLabBarCodeService inspectionLabBarCodeService; + + @Autowired + private DoctorStationLabApplyMapper doctorStationLabApplyMapper; + + @Autowired + private IDoctorStationAdviceAppService iDoctorStationAdviceAppService; + + @Autowired + private IActivityDefinitionService activityDefinitionService; + + @Autowired + private IOrganizationService organizationService; + + @Autowired + private IAccountService accountService; + + @Autowired + private IServiceRequestService serviceRequestService; + + /** + * 保存检验申请单信息 + * @param doctorStationLabApplyDto + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public R saveInspectionLabApply(DoctorStationLabApplyDto doctorStationLabApplyDto) { + /** + * 保存检验申请单信息逻辑 + * 保存检验申请单信息同时根据检验申请单检验项目数据保存检验申请单明细信息 + */ + log.debug("保存检验申请单信息:{}", doctorStationLabApplyDto); + log.debug("保存申请单明细信息:{}",doctorStationLabApplyDto.getLabApplyItemList()); + //获取当前登陆用户 ID + String userId = String.valueOf(SecurityUtils.getLoginUser().getUserId()); + InspectionLabApply inspectionLabApply = new InspectionLabApply(); + //将 dto 数据复制到 InspectionLabApply 对象中 + BeanUtils.copyProperties(doctorStationLabApplyDto, inspectionLabApply); + //设置租户 ID + inspectionLabApply.setTenantId(SecurityUtils.getLoginUser().getTenantId()); + //获取当前登陆用户名称 + inspectionLabApply.setCreateBy(SecurityUtils.getLoginUser().getUsername()); + inspectionLabApply.setOperatorId(userId); + inspectionLabApply.setCreateTime(new Date()); + inspectionLabApply.setDeleteFlag("0"); + + log.debug("保存检验申请单信息:{}", inspectionLabApply); + inspectionLabApplyService.saveOrUpdate(inspectionLabApply); + + + //遍历 doctorStationLabApplyDto.getLabApplyItemList() + int index = 0; + for (DoctorStationLabApplyItemDto doctorStationLabApplyItemDto : doctorStationLabApplyDto.getLabApplyItemList()) { + //将 dto 数据复制到 InspectionLabApplyItem 对象中 + InspectionLabApplyItem inspectionLabApplyItem = new InspectionLabApplyItem(); + BeanUtils.copyProperties(doctorStationLabApplyItemDto, inspectionLabApplyItem); + + //设置从表申请单明细的申请单号 + inspectionLabApplyItem.setApplyNo(doctorStationLabApplyDto.getApplyNo()); + //检验科代码,取值于检验申请单 + inspectionLabApplyItem.setPerformDeptCode(doctorStationLabApplyDto.getApplyDeptCode()); + //同主表状态,可单独回写 + inspectionLabApplyItem.setItemStatus(doctorStationLabApplyDto.getApplyStatus()); + // 设置项目序号 (打印顺序),按照遍历序号进行排序 + inspectionLabApplyItem.setItemSeq((long) (index + 1)); + index++; + + inspectionLabApplyItem.setDeleteFlag("0"); + log.debug("保存申请单明细信息:{}", inspectionLabApplyItem); + inspectionLabApplyItemService.saveOrUpdate(inspectionLabApplyItem); + + //创建条码对象 + BarCode barCode = new BarCode(); + barCode.setApplyNo(doctorStationLabApplyDto.getApplyNo()); + //将 doctorStationLabApplyDto 的 Long 类型的 PatientId 转换为 String 类型 + String patientId = String.valueOf(doctorStationLabApplyDto.getPatientId()); + barCode.setPatientId(patientId); + //设置申请单明细 ID,此处暂时设置为 null + barCode.setItemId(inspectionLabApplyItem.getItemId()); + barCode.setTenantId(SecurityUtils.getLoginUser().getTenantId()); + barCode.setCreateBy(SecurityUtils.getLoginUser().getUsername()); + barCode.setCreateTime(new Date()); + barCode.setDeleteFlag("0"); + + + log.debug("插入条码数据前,barCode:{}",barCode); + inspectionLabBarCodeService.saveOrUpdate(barCode); + } + + + /** + * 业务逻辑说明: + * 1. 当医生开具检验申请单时,系统需自动在门诊医嘱表中创建对应的医嘱记录 + * 2. 检验申请单与门诊医嘱通过申请单号建立关联关系 + */ + + // 创建门诊医嘱保存参数 + AdviceSaveParam adviceSaveParam = new AdviceSaveParam(); + // 患者挂号对应的科室 id + adviceSaveParam.setOrganizationId(doctorStationLabApplyDto.getApplyOrganizationId()); + + // 准备医嘱保存列表 + List adviceSaveList = new ArrayList<>(); + + // 遍历检验申请单明细,为每个检验项目创建对应的门诊医嘱记录 + for (DoctorStationLabApplyItemDto labApplyItemDto : doctorStationLabApplyDto.getLabApplyItemList()) { + // 1. 根据检验项目名称查询诊疗定义(检验项目) + String itemName = labApplyItemDto.getItemName(); + Long activityDefinitionId = activityDefinitionService.getAppointActivityDefinitionId(itemName); +// log.debug("检验项目:{} 对应的诊疗定义 ID: {}", itemName, activityDefinitionId); + + if (activityDefinitionId == null) { +// log.error("未找到检验项目对应的诊疗定义:{}", itemName); + throw new RuntimeException("未找到检验项目 '" + itemName + "' 对应的诊疗定义"); + } + + // 2. 获取诊疗定义详情 + ActivityDefinition activityDefinition = activityDefinitionService.getById(activityDefinitionId); + if (activityDefinition == null) { +// log.error("诊疗定义不存在,ID: {}", activityDefinitionId); + throw new RuntimeException("诊疗定义不存在"); + } + + // 3. 根据执行科室代码获取科室 ID(positionId) + Long positionId = null; + String performDeptCode = labApplyItemDto.getPerformDeptCode(); + if (performDeptCode != null && !performDeptCode.trim().isEmpty()) { + // 查询科室信息 + Organization organization = organizationService.getOne( + new QueryWrapper() + .eq("bus_no", performDeptCode) + .eq("delete_flag", "0") + ); + if (organization != null) { + positionId = organization.getId(); + } else { + log.warn("未找到执行科室代码对应的科室:{}", performDeptCode); + } + } + + // 4. 创建医嘱保存对象 + AdviceSaveDto adviceSaveDto = new AdviceSaveDto(); + // 设置医嘱操作类型 + adviceSaveDto.setDbOpType("1"); // 1:新增 + // 设置医嘱类型 + adviceSaveDto.setAdviceType(3); // 3:项目(检验项目) + + // 设置检验项目相关信息 + // 医嘱定义 ID(诊疗定义 ID) + adviceSaveDto.setAdviceDefinitionId(activityDefinitionId); + // 费用定价主表 ID(对应 adm_charge_item 表的 definition_id 字段) + adviceSaveDto.setDefinitionId(activityDefinitionId); + // 医嘱名称 + adviceSaveDto.setAdviceName(itemName); + // 医嘱详细分类 + adviceSaveDto.setCategoryCode(activityDefinition.getCategoryCode()); + // 活动 ID(诊疗定义 ID) + adviceSaveDto.setActivityId(activityDefinitionId); + // 医嘱定义对应表名 + adviceSaveDto.setAdviceTableName("wor_activity_definition"); + // 执行科室 ID + adviceSaveDto.setPositionId(positionId); + + // 设置患者和就诊信息 + // 患者 ID + adviceSaveDto.setPatientId(doctorStationLabApplyDto.getPatientId()); + // 就诊 ID + adviceSaveDto.setEncounterId(doctorStationLabApplyDto.getEncounterId()); + // 开方医生 ID - AdviceSaveDto 构造函数已设置,这里可覆盖 + adviceSaveDto.setPractitionerId(SecurityUtils.getUserId()); + // 开方科室 ID - AdviceSaveDto 构造函数已设置,这里可覆盖 + adviceSaveDto.setFounderOrgId(SecurityUtils.getDeptId()); + // 账户 ID - 获取就诊的账户(多级回退策略) +// log.debug("获取就诊 id 的参数:{}", doctorStationLabApplyDto.getEncounterId()); + Long accountId = accountService.getSelfPayAccount(doctorStationLabApplyDto.getEncounterId()); + if (accountId == null) { +// log.warn("未找到就诊 ID {} 对应的自费账户,尝试获取医保账户", doctorStationLabApplyDto.getEncounterId()); + accountId = accountService.getMedicalInsuranceAccount(doctorStationLabApplyDto.getEncounterId()); + } + if (accountId == null) { +// log.warn("未找到就诊 ID {} 对应的医保账户,尝试获取任何账户", doctorStationLabApplyDto.getEncounterId()); + List accountList = accountService.getAccountListByEncounter(doctorStationLabApplyDto.getEncounterId()); + if (accountList != null && !accountList.isEmpty()) { + accountId = accountList.get(0).getId(); +// log.info("使用就诊 ID {} 的第一个账户,ID: {}", doctorStationLabApplyDto.getEncounterId(), accountId); + } + } + if (accountId == null) { +// log.error("就诊 ID {} 没有任何关联的账户", doctorStationLabApplyDto.getEncounterId()); + throw new RuntimeException("未找到就诊对应的账户,请确认患者已完成挂号并拥有有效的账户"); + } + adviceSaveDto.setAccountId(accountId); + + // 将申请单号作为业务关联标识(请求内容 json) + adviceSaveDto.setContentJson("{\"applyNo\":\"" + doctorStationLabApplyDto.getApplyNo() + "\"}"); + + // 设置其他必要字段 + // 请求数量 + adviceSaveDto.setQuantity(labApplyItemDto.getItemQty() != null ? labApplyItemDto.getItemQty() : java.math.BigDecimal.ONE); + // 请求单位编码(使用诊疗定义的使用单位) + adviceSaveDto.setUnitCode(activityDefinition.getPermittedUnitCode()); + // 单价 + adviceSaveDto.setUnitPrice(labApplyItemDto.getItemPrice()); + // 总价 + adviceSaveDto.setTotalPrice(labApplyItemDto.getItemAmount()); + + // 请求状态 + adviceSaveDto.setStatusEnum(1); + // 请求类型 + adviceSaveDto.setCategoryEnum(1); + // 设置治疗类型(临时医嘱) + adviceSaveDto.setTherapyEnum(1); // 1:临时医嘱 + + // 添加到医嘱列表 + adviceSaveList.add(adviceSaveDto); + } + + // 设置医嘱保存参数的医嘱列表 + adviceSaveParam.setAdviceSaveList(adviceSaveList); + + // 调用门诊医嘱保存接口,创建关联的医嘱记录 + try { + iDoctorStationAdviceAppService.saveAdvice(adviceSaveParam, "1"); // "1"表示保存操作 +// log.info("成功创建与检验申请单 [{}] 关联的门诊医嘱记录", doctorStationLabApplyDto.getApplyNo()); + } catch (Exception e) { +// log.error("创建与检验申请单 [{}] 关联的门诊医嘱记录失败:{}", doctorStationLabApplyDto.getApplyNo(), e.getMessage(), e); + throw new RuntimeException("创建关联医嘱记录失败", e); + } + return R.ok(); + } + + /** + * 根据申请单号查询检验申请单 + * + * @param applyNo + * @return + */ + @Override + public Object getInspectionApplyByApplyNo(String applyNo) { + return doctorStationLabApplyMapper.getInspectionApplyByApplyNo(applyNo); + } + + /** + * 根据就诊 ID 查询检验申请单列表(分页) + * @param pageNo 页码 + * @param pageSize 每页数量 + * @param encounterId 就诊 ID + * @return 检验申请单列表分页信息 + */ + @Override + public Map getInspectionApplyListPage(Integer pageNo, Integer pageSize, Long encounterId) { + // 使用 PageHelper 进行分页查询 + PageHelper.startPage(pageNo, pageSize); + + // 查询检验申请单列表 + log.debug("查询申请单数据前"); + List list = doctorStationLabApplyMapper.getInspectionApplyListPage(encounterId); + log.debug("查询申请单数据后"); + + // 使用 PageInfo 包装查询结果 + PageInfo pageInfo = new PageInfo<>(list); + + // 构建返回结果 + Map result = new HashMap<>(); + result.put("records", pageInfo.getList()); + result.put("total", pageInfo.getTotal()); + log.debug("查询检验申请单列表,分页信息:{}", result); + return result; + } + + /** + * 删除(作废)检验申请单(同时删除(作废)关联的门诊医嘱(诊疗),检验申请单明细和条码数据) + * @param applyNo 申请单号 + * @return 删除结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public R deleteInspectionLabApply(String applyNo) { + log.debug("删除检验申请单 [{}]", applyNo); + + try { + // 1. 根据申请单号查询检验申请单信息 + InspectionLabApply inspectionLabApply = inspectionLabApplyService.getOne( + new QueryWrapper().eq("apply_no", applyNo) + ); + + if (inspectionLabApply == null) { + log.warn("未找到申请单号为 [{}] 的检验申请单", applyNo); + return R.fail("未找到对应的检验申请单"); + } + + // 2. 删除关联的门诊医嘱 + deleteAssociatedAdvice(applyNo); + + // 3. 删除检验申请单明细 + deleteInspectionLabApplyItems(applyNo); + + // 4. 删除条码数据 + deleteBarCodeData(applyNo); + + // 5. 删除检验申请单主表数据,并设置更新人和更新时间 + String currentUsername = SecurityUtils.getUsername(); + Date currentTime = new Date(); + boolean deleteResult = inspectionLabApplyService.update( + new LambdaUpdateWrapper() + .set(InspectionLabApply::getDeleteFlag, "1") + .set(InspectionLabApply::getUpdateBy, currentUsername) + .set(InspectionLabApply::getUpdateTime, currentTime) + .eq(InspectionLabApply::getApplyNo, applyNo) + ); + + if (deleteResult) { + log.debug("成功删除申请单号为 [{}] 的检验申请单及相关数据,更新人:{},更新时间:{}", + applyNo, currentUsername, currentTime); + return R.ok("删除成功"); + } else { + log.error("删除申请单号为 [{}] 的检验申请单失败", applyNo); + // 手动抛出异常,确保事务回滚 + throw new RuntimeException("删除检验申请单失败,申请单号:" + applyNo); + } + + } catch (Exception e) { + log.error("删除检验申请单 [{}] 时发生异常,事务将回滚", applyNo, e); + // 重新抛出异常,确保事务回滚 + throw new RuntimeException("删除检验申请单过程中发生异常:" + e.getMessage(), e); + } + } + + /** + * 删除关联的门诊医嘱 + * @param applyNo 申请单号 + */ + private void deleteAssociatedAdvice(String applyNo) { + try { + // 1. 根据申请单号查询关联的医嘱信息,获取正确的requestId + List requestIds = getAdviceRequestIdsByApplyNo(applyNo); + log.debug("申请单号 [{}] 关联的医嘱信息:{}", applyNo, requestIds); + + if (requestIds.isEmpty()) { + log.debug("申请单号 [{}] 没有关联的医嘱记录,无需删除", applyNo); + return; + } + + // 2. 直接更新医嘱的删除状态为1(逻辑删除),并设置更新人和更新时间 + String currentUsername = SecurityUtils.getUsername(); + Date currentTime = new Date(); + boolean updateResult = serviceRequestService.update( + new LambdaUpdateWrapper() + .set(ServiceRequest::getDeleteFlag, "1") + .set(ServiceRequest::getUpdateBy, currentUsername) + .set(ServiceRequest::getUpdateTime, currentTime) + .in(ServiceRequest::getId, requestIds) + ); + + if (updateResult) { + log.debug("成功将申请单号 [{}] 关联的 {} 条门诊医嘱的删除状态更新为1,更新人:{},更新时间:{}", + applyNo, requestIds.size(), currentUsername, currentTime); + } else { + log.warn("更新申请单号 [{}] 关联的门诊医嘱删除状态失败", applyNo); + } + + } catch (Exception e) { + log.error("删除申请单号 [{}] 关联的门诊医嘱时发生异常", applyNo, e); + // 不抛出异常,继续执行其他删除操作 + } + } + + /** + * 根据申请单号查询关联的医嘱请求ID列表 + * @param applyNo 申请单号 + * @return 医嘱请求ID列表 + */ + private List getAdviceRequestIdsByApplyNo(String applyNo) { + try { + // 根据申请单号查询关联的医嘱信息 + // 医嘱表(wor_service_request)中的contentJson字段存储了申请单号 + // contentJson格式:{"applyNo":"20260228094429944868"} + + // 使用MyBatis Plus查询,通过contentJson字段模糊匹配申请单号 + List serviceRequests = + serviceRequestService.list( + new QueryWrapper() + .like("content_json", applyNo) + .eq("delete_flag", "0") + ); + + if (serviceRequests == null || serviceRequests.isEmpty()) { + log.debug("申请单号 [{}] 没有关联的医嘱记录", applyNo); + return new ArrayList<>(); + } + + // 提取所有的医嘱请求ID + List requestIds = serviceRequests.stream() + .map(ServiceRequest::getId) + .collect(java.util.stream.Collectors.toList()); + + log.debug("查询到申请单号 [{}] 关联的 {} 条医嘱记录,requestId列表:{}", + applyNo, requestIds.size(), requestIds); + + return requestIds; + + } catch (Exception e) { + log.error("查询申请单号 [{}] 关联的医嘱请求ID时发生异常", applyNo, e); + return new ArrayList<>(); + } + } + + /** + * 删除检验申请单明细 + * @param applyNo 申请单号 + */ + private void deleteInspectionLabApplyItems(String applyNo) { + try { + // 根据申请单号删除明细数据,并设置更新人和更新时间 + String currentUsername = SecurityUtils.getUsername(); + Date currentTime = new Date(); + boolean deleteResult = inspectionLabApplyItemService.update( + new LambdaUpdateWrapper() + .set(InspectionLabApplyItem::getDeleteFlag, "1") + .set(InspectionLabApplyItem::getUpdateBy, currentUsername) + .set(InspectionLabApplyItem::getUpdateTime, currentTime) + .eq(InspectionLabApplyItem::getApplyNo, applyNo) + ); + + if (deleteResult) { + log.debug("成功删除申请单号 [{}] 的检验申请单明细,更新人:{},更新时间:{}", + applyNo, currentUsername, currentTime); + } else { + log.warn("删除申请单号 [{}] 的检验申请单明细失败", applyNo); + } + + } catch (Exception e) { + log.error("删除申请单号 [{}] 的检验申请单明细时发生异常", applyNo, e); + // 不抛出异常,继续执行其他删除操作 + } + } + + /** + * 删除条码数据 + * @param applyNo 申请单号 + */ + private void deleteBarCodeData(String applyNo) { + try { + // 根据申请单号删除条码数据,并设置更新人和更新时间 + String currentUsername = SecurityUtils.getUsername(); + Date currentTime = new Date(); + boolean deleteResult = inspectionLabBarCodeService.update( + new LambdaUpdateWrapper() + .set(BarCode::getDeleteFlag, "1") + .set(BarCode::getUpdateBy, currentUsername) + .set(BarCode::getUpdateTime, currentTime) + .eq(BarCode::getApplyNo, applyNo) + ); + + if (deleteResult) { + log.debug("成功删除申请单号 [{}] 的条码数据,更新人:{},更新时间:{}", + applyNo, currentUsername, currentTime); + } else { + log.warn("删除申请单号 [{}] 的条码数据失败", applyNo); + } + + } catch (Exception e) { + log.error("删除申请单号 [{}] 的条码数据时发生异常", applyNo, e); + // 不抛出异常,继续执行其他删除操作 + } + } + +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationInspectionLabApplyController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationInspectionLabApplyController.java new file mode 100644 index 00000000..0f46eebe --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationInspectionLabApplyController.java @@ -0,0 +1,65 @@ +package com.openhis.web.doctorstation.controller; + +import com.core.common.core.domain.R; +import com.openhis.web.doctorstation.appservice.IDoctorStationInspectionLabApplyService; +import com.openhis.web.doctorstation.dto.DoctorStationLabApplyDto; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import org.springframework.validation.annotation.Validated; + +/** + * 门诊医生站-检验控制器 + */ +@RestController +@Slf4j +@RequestMapping("/doctor-station/inspection") +@Validated +public class DoctorStationInspectionLabApplyController { + @Autowired + private IDoctorStationInspectionLabApplyService iDoctorStationInspectionLabApplyService; + /** + * 保存检验申请单信息 + */ + @PostMapping(value = "/application") + public R saveInspectionApply(@Valid @RequestBody DoctorStationLabApplyDto doctorStationLabApplyDto){ + log.debug("保存检验申请单信息:{}", doctorStationLabApplyDto); + return R.ok(iDoctorStationInspectionLabApplyService.saveInspectionLabApply(doctorStationLabApplyDto)); + } + /** + * 根据申请单号查询检验申请单信息 + */ + @GetMapping(value = "/apply-no") + public R getInspectionApplyByApplyNo(@RequestParam String applyNo){ + log.debug("根据申请单号查询检验申请单信息:{}", applyNo); + return R.ok(iDoctorStationInspectionLabApplyService.getInspectionApplyByApplyNo(applyNo)); + } + + /** + * 分页查询检验申请单 + * @param pageNo 页码(默认 1) + * @param pageSize 每页数量(默认 10) + * @param encounterId 就诊 ID(可选,用于筛选特定就诊记录) + * @return 分页数据 + */ + @GetMapping(value = "/get-applyList") + public R getInspectionApplyListPage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, + @RequestParam(value = "encounterId", required = false) Long encounterId){ + log.debug("分页查询检验申请单:pageNo={}, pageSize={}, encounterId={}", pageNo, pageSize, encounterId); + return R.ok(iDoctorStationInspectionLabApplyService.getInspectionApplyListPage(pageNo, pageSize, encounterId)); + } + + /** + * 删除检验申请单(同时删除关联的门诊医嘱) + * @param applyNo 申请单号 + * @return 删除结果 + */ + @DeleteMapping(value = "/apply/{applyNo}") + public R deleteInspectionApply(@PathVariable String applyNo){ + log.debug("删除检验申请单:{}", applyNo); + return R.ok(iDoctorStationInspectionLabApplyService.deleteInspectionLabApply(applyNo)); + } +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DoctorStationLabApplyDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DoctorStationLabApplyDto.java new file mode 100644 index 00000000..c2f491da --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DoctorStationLabApplyDto.java @@ -0,0 +1,151 @@ +package com.openhis.web.doctorstation.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.openhis.common.annotation.Dict; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 检验申请单DTO + */ +@Data +@Accessors(chain = true) +public class DoctorStationLabApplyDto { + /** + * 申请单编号 + */ + @Size(max = 32, message = "申请单编号长度不能超过32个字符") + private String applyNo; + /** + * 患者就诊科室id + */ + private Long applyOrganizationId; + /** + * 患者主索引 + */ + private Long patientId; + /** + * 患者姓名 + */ + @Size(max = 50, message = "患者姓名长度不能超过50个字符") + private String patientName; + /** + * 就诊卡号 + */ + private String medicalrecordNumber; + /* + * 费用性质 + */ + @Size(max = 20, message = "费用性质长度不能超过20个字符") + private String natureofCost; + /** + * 门诊就诊流水号 + */ + private String visitNo; + /** + * 开单科室编码 + */ + @Size(max = 20, message = "开单科室编码长度不能超过20个字符") + private String applyDeptCode; + /** + * 申请科室名称 + */ + @Size(max = 100, message = "申请科室名称长度不能超过100个字符") + private String applyDepartment; + /** + * 开单医生工号 + */ + private String applyDocCode; + /** + * 申请医生名称 + */ + @Size(max = 50, message = "申请医生名称长度不能超过50个字符") + private String applyDocName; + /** + * 申请时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") + private Date applyTime; + /** + * 临床诊断 + */ + private String clinicDiag; + /** + * 临床印象 + */ + private String clinicDesc; + /** + * 禁忌症 + */ + private String contraindication; + /** + * 病史摘要 + */ + private String medicalHistorySummary; + /** + * 检验目的 + */ + private String purposeofInspection; + /** + * 体格检查 + */ + private String physicalExamination; + /** + * 检验项目 + */ + private String inspectionItem; + /** + * 标本类型代码 + */ + private String specimenTypeCode; + /** + * 标本名称 + */ + @Size(max = 100, message = "标本名称长度不能超过100个字符") + private String specimenName; + /** + * 申请单优先级代码 + */ + @Size(max = 4, message = "申请单优先级代码长度不能超过4个字符") + private String priorityCode; + /** + * 申请单状态 + */ + private Long applyStatus; + /** + * 备注 + */ + private String applyRemark; + /** + * 创建时间 + */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + /** + * 操作员工号 + */ + private String operatorId; + /** + * 就诊id + */ + private Long encounterId; + /** + * 检验项目数据列表 + */ + private List labApplyItemList; + + /** + * 金额 + */ + private BigDecimal itemAmount; + /** + * 项目名称 + */ + private String itemName; +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DoctorStationLabApplyItemDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DoctorStationLabApplyItemDto.java new file mode 100644 index 00000000..42189f28 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DoctorStationLabApplyItemDto.java @@ -0,0 +1,70 @@ +package com.openhis.web.doctorstation.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.math.BigDecimal; + +/** + * 检验申请单明细表 + */ +@Data +@Accessors(chain = true) +public class DoctorStationLabApplyItemDto { + /** + * 申请单号 + */ + @Size(max = 32, message = "申请单号长度不能超过32个字符") + private String applyNo; + /** + * 项目序号 + */ + @NotNull(message = "项目序号不能为空") + private Long itemSeq; + /** + * 项目代码 + */ +// @NotBlank(message = "项目代码不能为空") + @Size(max = 30, message = "项目代码长度不能超过30个字符") + private String itemCode; + /** + * 项目名称 + */ + @NotBlank(message = "项目名称不能为空") + @Size(max = 100, message = "项目名称长度不能超过100个字符") + private String itemName; + /** + * 国家平台项目代码 + */ + @Size(max = 30, message = "国家平台项目代码长度不能超过30个字符") + private String nationalItemCode; + /** + * 执行科室代码 + */ +// @NotBlank(message = "执行科室代码不能为空") + @Size(max = 20, message = "执行科室代码长度不能超过20个字符") + private String performDeptCode; + /** + * 单价 + */ + @NotNull(message = "单价不能为空") + private BigDecimal itemPrice; + /** + * 数量 + */ + @NotNull(message = "数量不能为空") + private BigDecimal itemQty; + /** + * 金额 + */ + @NotNull(message = "金额不能为空") + private BigDecimal itemAmount; + /** + * 行状态 + */ + @NotNull(message = "行状态不能为空") + private Long itemStatus; +} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationLabApplyMapper.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationLabApplyMapper.java new file mode 100644 index 00000000..fd7aca61 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationLabApplyMapper.java @@ -0,0 +1,22 @@ +package com.openhis.web.doctorstation.mapper; + +import com.openhis.lab.domain.InspectionLabApply; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 门诊医生站 - 检验申请单 Mapper + */ +@Repository +public interface DoctorStationLabApplyMapper { + Object getInspectionApplyByApplyNo(String applyNo); + + /** + * 分页查询检验申请单列表 + * @param encounterId 就诊 ID + * @return 检验申请单列表 + */ + List getInspectionApplyListPage(@Param("encounterId") Long encounterId); +} diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationLabApplyMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationLabApplyMapper.xml new file mode 100644 index 00000000..486e3c24 --- /dev/null +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationLabApplyMapper.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/BarCode.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/BarCode.java new file mode 100644 index 00000000..9f882a42 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/BarCode.java @@ -0,0 +1,67 @@ +package com.openhis.lab.domain; + +import com.baomidou.mybatisplus.annotation.*; +import com.core.common.core.domain.HisBaseEntity; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.Date; + +/** + * 条码/标本流转表 + * + * @author system + * @date 2026-01-27 + */ +@Data +@TableName("lab_barcode") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class BarCode extends HisBaseEntity { + /** + * 主键 + * 条码号 + */ + @TableId(type = IdType.NONE) + private String barcode; + /** + * 检验申请单号 + */ + private String applyNo; + /** + * 明细ID + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long itemId; + /** + * 患者id + */ + private String patientId; + /** + * 采样时间 + */ + @TableField(updateStrategy = FieldStrategy.IGNORED) + private Date collectTime; + /** + * 采样人 + */ + private String collectionEmp; + /** + * 送检时间 + */ + @TableField(updateStrategy = FieldStrategy.IGNORED) + private Date sendTime; + /** + * 签收时间 + */ + @TableField(updateStrategy = FieldStrategy.IGNORED) + private Date receiveTime; + /** + * 退检时间 + */ + @TableField(updateStrategy = FieldStrategy.IGNORED) + private Date backFlag; +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/InspectionLabApply.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/InspectionLabApply.java new file mode 100644 index 00000000..4aa5d469 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/InspectionLabApply.java @@ -0,0 +1,126 @@ +package com.openhis.lab.domain; + +import com.baomidou.mybatisplus.annotation.*; +import com.core.common.core.domain.HisBaseEntity; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.Date; + +/** + * 检验申请单定义Entity实体 + * + * @author system + * @Date 2026-01-27 + */ +@Data +@TableName("lab_apply") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class InspectionLabApply extends HisBaseEntity { + + /** + * 主键ID,申请单编号 + */ + @TableId(type = IdType.NONE) + private String applyNo; + /** + * 患者主索引 + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long patientId; + /** + * 患者姓名 + */ + private String patientName; + /** + * 就诊卡号 + */ + private String medicalrecordNumber; + /* + * 费用性质 + */ + private String natureofCost; + /** + * 门诊就诊流水号 + */ + private String visitNo; + /** + * 开单科室编码 + */ + private String applyDeptCode; + /** + * 申请科室名称 + */ + private String applyDepartment; + /** + * 开单医生工号 + */ + private String applyDocCode; + /** + * 申请医生名称 + */ + private String applyDocName; + /** + * 申请时间 + */ + @TableField(updateStrategy = FieldStrategy.IGNORED) + private Date applyTime; + /** + * 临床诊断 + */ + private String clinicDiag; + /** + * 临床印象 + */ + private String clinicDesc; + /** + * 禁忌症 + */ + private String contraindication; + /** + * 病史摘要 + */ + private String medicalHistorySummary; + /** + * 检验目的 + */ + private String purposeofInspection; + /** + * 体格检查 + */ + private String physicalExamination; + /** + * 检验项目 + */ + private String inspectionItem; + /** + * 标本类型代码 + */ + private String specimenTypeCode; + /** + * 标本名称 + */ + private String specimenName; + /** + * 申请单优先级代码 + */ + private String priorityCode; + /** + * 申请单状态 + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long applyStatus; + /** + * 备注 + */ + private String applyRemark; + /** + * 操作员工号 + */ + private String operatorId; +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/InspectionLabApplyItem.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/InspectionLabApplyItem.java new file mode 100644 index 00000000..8b0a257a --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/domain/InspectionLabApplyItem.java @@ -0,0 +1,77 @@ +package com.openhis.lab.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.core.common.core.domain.HisBaseEntity; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + + +/** + * 检验申请单明细表 + * + * @author system + * @date 2026-01-27 + */ +@Data +@TableName("lab_apply_item") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class InspectionLabApplyItem extends HisBaseEntity { + /** + * 主键 + */ + @TableId(type = IdType.AUTO) + private Long itemId; + /** + * 申请单号 + */ + private String applyNo; + /** + * 项目序号 + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long itemSeq; + /** + * 项目代码 + */ + private String itemCode; + /** + * 项目名称 + */ + private String itemName; + /** + * 国家平台项目代码 + */ + private String nationalItemCode; + /** + * 执行科室代码 + */ + private String performDeptCode; + /** + * 单价 + */ + @JsonSerialize(using = ToStringSerializer.class) + private BigDecimal itemPrice; + /** + * 数量 + */ + @JsonSerialize(using = ToStringSerializer.class) + private BigDecimal itemQty; + /** + * 金额 + */ + @JsonSerialize(using = ToStringSerializer.class) + private BigDecimal itemAmount; + /** + * 行状态 + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long itemStatus; +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabApplyItemMapper.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabApplyItemMapper.java new file mode 100644 index 00000000..bf3501ca --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabApplyItemMapper.java @@ -0,0 +1,9 @@ +package com.openhis.lab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.openhis.lab.domain.InspectionLabApplyItem; +import org.springframework.stereotype.Repository; + +@Repository +public interface InspectionLabApplyItemMapper extends BaseMapper { +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabApplyMapper.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabApplyMapper.java new file mode 100644 index 00000000..67dbea85 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabApplyMapper.java @@ -0,0 +1,15 @@ +package com.openhis.lab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.openhis.lab.domain.InspectionLabApply; +import org.springframework.stereotype.Repository; + +/** + * 检验申请单Mapper接口 + * + * @author system + * @date 2026-01-27 + */ +@Repository +public interface InspectionLabApplyMapper extends BaseMapper { +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabBarCodeMapper.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabBarCodeMapper.java new file mode 100644 index 00000000..18a18f4a --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/mapper/InspectionLabBarCodeMapper.java @@ -0,0 +1,15 @@ +package com.openhis.lab.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.openhis.lab.domain.BarCode; +import org.springframework.stereotype.Repository; + +/** + * 条码Mapper接口 + * + * @author system + * @date 2026-01-27 + */ +@Repository +public interface InspectionLabBarCodeMapper extends BaseMapper { +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabApplyItemService.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabApplyItemService.java new file mode 100644 index 00000000..68fccc87 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabApplyItemService.java @@ -0,0 +1,12 @@ +package com.openhis.lab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.openhis.lab.domain.InspectionLabApplyItem; + +/** + * 检验申请单明细表 + * @author system + * @date 2026-01-27 + */ +public interface IInspectionLabApplyItemService extends IService { +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabApplyService.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabApplyService.java new file mode 100644 index 00000000..3eb9d28d --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabApplyService.java @@ -0,0 +1,13 @@ +package com.openhis.lab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.openhis.lab.domain.InspectionLabApply; + +/** + * 检验申请单Service接口 + * + * @author system + * @date 2026-01-27 + */ +public interface IInspectionLabApplyService extends IService { +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabBarCodeService.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabBarCodeService.java new file mode 100644 index 00000000..c3e6fde5 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/IInspectionLabBarCodeService.java @@ -0,0 +1,13 @@ +package com.openhis.lab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.openhis.lab.domain.BarCode; + +/** + * 检验申请单条码Service接口 + * + * @author system + * @date 2026-01-27 + */ +public interface IInspectionLabBarCodeService extends IService { +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabApplyItemServiceImpl.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabApplyItemServiceImpl.java new file mode 100644 index 00000000..91e80777 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabApplyItemServiceImpl.java @@ -0,0 +1,13 @@ +package com.openhis.lab.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.openhis.lab.domain.InspectionLabApplyItem; +import com.openhis.lab.mapper.InspectionLabApplyItemMapper; +import com.openhis.lab.service.IInspectionLabApplyItemService; +import org.springframework.stereotype.Service; + +@Service +public class InspectionLabApplyItemServiceImpl extends ServiceImpl + implements IInspectionLabApplyItemService + { +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabApplyServiceImpl.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabApplyServiceImpl.java new file mode 100644 index 00000000..5544cfc2 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabApplyServiceImpl.java @@ -0,0 +1,12 @@ +package com.openhis.lab.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.openhis.lab.domain.InspectionLabApply; +import com.openhis.lab.mapper.InspectionLabApplyMapper; +import com.openhis.lab.service.IInspectionLabApplyService; +import org.springframework.stereotype.Service; + +@Service +public class InspectionLabApplyServiceImpl extends ServiceImpl + implements IInspectionLabApplyService{ +} diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabBarCodeServiceImpl.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabBarCodeServiceImpl.java new file mode 100644 index 00000000..9c3a4db8 --- /dev/null +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/lab/service/impl/InspectionLabBarCodeServiceImpl.java @@ -0,0 +1,19 @@ +package com.openhis.lab.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.openhis.lab.domain.BarCode; +import com.openhis.lab.mapper.InspectionLabBarCodeMapper; +import com.openhis.lab.service.IInspectionLabBarCodeService; +import org.springframework.stereotype.Service; + +/** + * 检验申请单条码Service业务层处理 + * + * @author system + * @date 2026-01-27 + */ +@Service +public class InspectionLabBarCodeServiceImpl extends ServiceImpl + implements IInspectionLabBarCodeService { + +} diff --git a/openhis-ui-vue3/src/views/doctorstation/components/api.js b/openhis-ui-vue3/src/views/doctorstation/components/api.js index 44c40451..cdfb77e2 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/api.js +++ b/openhis-ui-vue3/src/views/doctorstation/components/api.js @@ -842,6 +842,37 @@ export function getTestResult(queryParams) { }); } +/** + * 分页查询检验申请单列表 + * @param {Object} queryParams - 查询参数 + * @param {number} queryParams.pageNo - 页码(可选,默认 1) + * @param {number} queryParams.pageSize - 每页数量(可选,默认 10) + * @param {string} queryParams.encounterId - 就诊 ID(可选,用于筛选特定就诊记录) + * @returns {Promise} 分页数据 { code: 200, data: { records: Array, total: number } } + */ +export function getApplyList(queryParams) { + const params = {}; + + // 添加分页参数 + if (queryParams && queryParams.pageNo !== undefined) { + params.pageNo = queryParams.pageNo; + } + if (queryParams && queryParams.pageSize !== undefined) { + params.pageSize = queryParams.pageSize; + } + + // 添加就诊 ID 参数(可选) + if (queryParams && queryParams.encounterId) { + params.encounterId = queryParams.encounterId; + } + + return request({ + url: '/doctor-station/inspection/get-applyList', + method: 'get', + params: params, + }); +} + /** * 获取检验申请单列表 */ @@ -886,11 +917,33 @@ export function saveInspectionApplication(data) { } /** - * 删除检验申请单 + * 查询申请单号 */ -export function deleteInspectionApplication(id) { +export function checkInspectionApplicationNo(applyNo){ + // 如果申请单号为空,返回一个rejected promise以避免向后端发送空值 + if (!applyNo) { + console.debug('申请单号为空,跳过API调用'); + return Promise.resolve({ + code: 200, + data: { exists: false }, + message: '申请单号不存在' + }); + } + return request({ - url: '/doctor-station/inspection/application/' + id, + url: '/doctor-station/inspection/apply-no', + method: 'get', + params: { applyNo: applyNo }, // 确保参数名为applyNo + }); +} + +/** + * 删除检验申请单 + * @param {string} applyNo 申请单号 + */ +export function deleteInspectionApplication(applyNo) { + return request({ + url: '/doctor-station/inspection/apply/' + applyNo, method: 'delete', }); } diff --git a/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue b/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue index 9d761a01..be7c326b 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue @@ -1,149 +1,177 @@ - - + + - - - -
- -
-

检验项目选择

+ + + + + + + -
- -
+ -
+
@@ -371,58 +443,64 @@
-
-
+ + -
- -
- 已选择 - 清空 -
+ + -
-
-
- {{ item.itemName }} - ¥{{ item.itemPrice }} - - 删除 - -
-
-
- 暂无选择项目 -
-
-
- - - - + + + + + {{ item.itemName }} + ¥{{ item.itemPrice }} + + 删除 + + + + + + + + + + +