diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java index 9b91cc16..62e51965 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java @@ -96,11 +96,11 @@ public class DiagnosisTreatmentDto { /** 财务类别 */ @Dict(dictCode = "fin_type_code") - private String typeCode; - private String typeCode_dictText; + private String itemTypeCode; + private String itemTypeCode_dictText; /** 医保类别 */ - @Dict(dictCode = "med_chrgitm_type") + @Dict(dictCode = "yb_type") private String ybType; private String ybType_dictText; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java index e5fd9eb5..653e1aed 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java @@ -16,7 +16,7 @@ import lombok.experimental.Accessors; public class DiagnosisTreatmentSelParam { /** 目录类别 */ - private Integer categoryCode; + private String categoryCode; /** 类型 */ private Integer typeEnum; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java index 3eafc386..2ec4ccc0 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java @@ -32,7 +32,6 @@ public class DiagnosisTreatmentUpDto { private String categoryCode; /** 编码 */ - @NotBlank(message = "项目编码不能为空") private String busNo; /** 项目名称 */ @@ -40,16 +39,14 @@ public class DiagnosisTreatmentUpDto { private String name; /** 项目名称拼音 */ - @NotBlank(message = "项目名称拼音不能为空") private String pyStr; /** 五笔拼音 */ - @NotBlank(message = "五笔拼音不能为空") private String wbStr; /** 类型 */ - @NotBlank(message = "类型不能为空") - private String typeCode; + @NotNull(message = "类型不能为空") + private Integer typeEnum; /** 使用单位 */ @NotBlank(message = "使用单位不能为空") diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiseaseManageUpDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiseaseManageUpDto.java index 9d7fa710..80904cf2 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiseaseManageUpDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiseaseManageUpDto.java @@ -27,7 +27,6 @@ public class DiseaseManageUpDto { private ConditionDefinitionSource sourceEnum; /** 编码 */ - @NotBlank(message = "疾病编码不能为空") private String conditionCode; /** 诊断名称 */ diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/IProductTransferAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/IProductTransferAppService.java new file mode 100644 index 00000000..61baa240 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/IProductTransferAppService.java @@ -0,0 +1,80 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.appservice; + +import com.core.common.core.domain.R; +import com.openhis.web.inventorymanage.dto.ProductTransferDto; +import com.openhis.web.inventorymanage.dto.SupplySearchParam; + +import javax.servlet.http.HttpServletRequest; + +/** + * 商品调拨 appService + * + * @author zwh + * @date 2025-03-08 + */ +public interface IProductTransferAppService { + + /** + * 商品调拨页面初始化 + * + * @return 初始化信息 + */ + R productTransferInit(); + + /** + * 商品调拨单据列表 + * + * @param supplySearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 商品调拨单据分页列表 + */ + R getPage(SupplySearchParam supplySearchParam, Integer pageNo, Integer pageSize, String searchKey, + HttpServletRequest request); + + /** + * 商品调拨单据详情 + * + * @param busNo 单据号 + * @return 入库单据详情 + */ + R getDetail(String busNo); + + /** + * 添加/编辑商品调拨单据 + * + * @param productTransferDto 入库单据 + * @return 编辑结果 + */ + R addOrEditTransferReceipt(ProductTransferDto productTransferDto); + + /** + * 删除单据 + * + * @param supplyRequestId 供应请求id + * @return 操作结果 + */ + R deleteReceipt(Long supplyRequestId); + + /** + * 提交审批 + * + * @param busNo 单据号 + * @return 操作结果 + */ + R submitApproval(String busNo); + + /** + * 撤回审批 + * + * @param busNo 单据号 + * @return 操作结果 + */ + R withdrawApproval(String busNo); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/InventoryDetailsAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/InventoryDetailsAppServiceImpl.java index b4ac60f3..d78768a9 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/InventoryDetailsAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/InventoryDetailsAppServiceImpl.java @@ -8,7 +8,6 @@ import java.util.HashSet; import javax.servlet.http.HttpServletRequest; -import com.openhis.web.inventorymanage.dto.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -17,6 +16,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.openhis.common.utils.HisQueryUtils; import com.openhis.web.inventorymanage.appservice.IInventoryDetailsAppService; +import com.openhis.web.inventorymanage.dto.*; import com.openhis.web.inventorymanage.mapper.InventoryDetailsMapper; /** @@ -54,7 +54,7 @@ public class InventoryDetailsAppServiceImpl implements IInventoryDetailsAppServi // return R.ok(inventoryReceiptPage); QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(purchaseInSearchParam, - searchKey, new HashSet<>(Arrays.asList("bus_no","item_name","item_no")), request); + searchKey, new HashSet<>(Arrays.asList("bus_no", "item_name", "item_no")), request); Page purchaseInInfo = inventoryDetailsMapper.selectPurchaseInDetailsPage(new Page<>(pageNo, pageSize), queryWrapper); @@ -72,11 +72,12 @@ public class InventoryDetailsAppServiceImpl implements IInventoryDetailsAppServi * @return 领用出库明细分页列表 */ @Override - public IPage requisitionOutGetPage(RequisitionOutSearchParam requisitionOutSearchParam, String searchKey, - Integer pageNo, Integer pageSize, HttpServletRequest request) { + public IPage requisitionOutGetPage(RequisitionOutSearchParam requisitionOutSearchParam, + String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) { - QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(requisitionOutSearchParam, - searchKey, new HashSet<>(Arrays.asList("bus_no","item_name","item_no")), request); + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(requisitionOutSearchParam, searchKey, + new HashSet<>(Arrays.asList("bus_no", "item_name", "item_no")), request); Page requisitionOutInfo = inventoryDetailsMapper.selectRequisitionOutDetailsPage(new Page<>(pageNo, pageSize), queryWrapper); @@ -95,11 +96,13 @@ public class InventoryDetailsAppServiceImpl implements IInventoryDetailsAppServi * @return 商品调拨明细分页列表 */ @Override - public IPage inventoryTransferGetPage(RequisitionOutSearchParam requisitionOutSearchParam, String searchKey, - Integer pageNo, Integer pageSize, HttpServletRequest request) { + public IPage inventoryTransferGetPage( + RequisitionOutSearchParam requisitionOutSearchParam, String searchKey, Integer pageNo, Integer pageSize, + HttpServletRequest request) { - QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(requisitionOutSearchParam, - searchKey, new HashSet<>(Arrays.asList("bus_no","item_name","item_no")), request); + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(requisitionOutSearchParam, searchKey, + new HashSet<>(Arrays.asList("bus_no", "item_name", "item_no")), request); Page inventoryTransferInfo = inventoryDetailsMapper.selectInventoryTransferDetailsPage(new Page<>(pageNo, pageSize), queryWrapper); @@ -118,11 +121,13 @@ public class InventoryDetailsAppServiceImpl implements IInventoryDetailsAppServi * @return 商品调拨明细分页列表 */ @Override - public IPage inventoryStockTakeGetPage(RequisitionOutSearchParam requisitionOutSearchParam, String searchKey, - Integer pageNo, Integer pageSize, HttpServletRequest request) { + public IPage inventoryStockTakeGetPage( + RequisitionOutSearchParam requisitionOutSearchParam, String searchKey, Integer pageNo, Integer pageSize, + HttpServletRequest request) { - QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(requisitionOutSearchParam, - searchKey, new HashSet<>(Arrays.asList("bus_no","item_name","item_no")), request); + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(requisitionOutSearchParam, searchKey, + new HashSet<>(Arrays.asList("bus_no", "item_name", "item_no")), request); Page inventoryStockTakeInfo = inventoryDetailsMapper.selectInventoryStockTakeDetailsPage(new Page<>(pageNo, pageSize), queryWrapper); diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ProductTransferAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ProductTransferAppServiceImpl.java new file mode 100644 index 00000000..51c47260 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ProductTransferAppServiceImpl.java @@ -0,0 +1,253 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.appservice.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.core.common.core.domain.R; +import com.core.common.utils.AssignSeqUtil; +import com.core.common.utils.DateUtils; +import com.core.common.utils.MessageUtils; +import com.core.common.utils.bean.BeanUtils; +import com.openhis.administration.domain.Location; +import com.openhis.administration.service.ILocationService; +import com.openhis.common.constant.CommonConstants; +import com.openhis.common.constant.PromptMsgConstant; +import com.openhis.common.enums.*; +import com.openhis.common.utils.EnumUtils; +import com.openhis.common.utils.HisQueryUtils; +import com.openhis.web.basedatamanage.dto.LocationQueryDto; +import com.openhis.web.inventorymanage.appservice.IProductTransferAppService; +import com.openhis.web.inventorymanage.dto.*; +import com.openhis.web.inventorymanage.mapper.ProductTransferMapper; +import com.openhis.workflow.domain.SupplyRequest; +import com.openhis.workflow.service.ISupplyRequestService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * 商品调拨 impl + * + * @author zwh + * @date 2025-03-08 + */ +@Service +public class ProductTransferAppServiceImpl implements IProductTransferAppService { + + @Autowired + private ProductTransferMapper productTransferMapper; + + @Autowired + private ISupplyRequestService supplyRequestService; + + @Autowired + private ILocationService locationService; + + @Autowired + private AssignSeqUtil assignSeqUtil; + + /** + * 商品调拨页面初始化 + * + * @return 初始化信息 + */ + @Override + public R productTransferInit() { + + ProductTransferInitDto initDto = new ProductTransferInitDto(); + + // 单据号 + initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.PURCHASE_NUM.getPrefix(), 12)); + + // 入库项目类型 + List categoryListOptions = Stream.of(ItemType.values()) + .map(itemType -> new ProductTransferInitDto.categoryListOption(itemType.getValue(), itemType.getInfo())) + .collect(Collectors.toList()); + // 审批状态 + List supplyStatusOptions = Stream.of(SupplyStatus.values()) + .map(supplyStatus -> new ProductTransferInitDto.supplyStatusOption(supplyStatus.getValue(), + supplyStatus.getInfo())).collect(Collectors.toList()); + + // 获取药房 + List pharmacyList = locationService.getPharmacyList(); + // 药库列表 + List cabinetList = locationService.getCabinetList(); + + // 将位置列表转为树结构 + List pharmacyLocationTree = buildTree(pharmacyList); + List cabinetLocationTree = buildTree(cabinetList); + + initDto.setCategoryListOptions(categoryListOptions).setSupplyStatusOptions(supplyStatusOptions) + .setSourceTypeListOptions(pharmacyLocationTree).setPurposeTypeListOptions(cabinetLocationTree); + + return R.ok(initDto); + } + + /** + * 将位置列表转换为树结构 + * + * @param records 位置列表 + * @return tree + */ + private List buildTree(List records) { + // 按b_no的层级排序,确保父节点先处理 + List sortedRecords = records.stream() + .sorted(Comparator.comparingInt(r -> r.getBusNo().split("\\.").length)).collect(Collectors.toList()); + + Map nodeMap = new HashMap<>(); + List tree = new ArrayList<>(); + + for (Location record : sortedRecords) { + String bNo = record.getBusNo(); + String[] parts = bNo.split("\\."); + LocationQueryDto node = new LocationQueryDto(); + org.springframework.beans.BeanUtils.copyProperties(record, node); + // 将当前节点加入映射 + nodeMap.put(bNo, node); + + if (parts.length == 1) { + // 根节点 + tree.add(node); + } else { + // 获取父节点的b_no(去掉最后一部分) + String parentBNo = String.join(".", Arrays.copyOf(parts, parts.length - 1)); + LocationQueryDto parent = nodeMap.get(parentBNo); + + if (parent != null) { + parent.getChildren().add(node); + } else { + // 处理父节点不存在的情况(例如数据缺失) + // 可根据需求调整为将节点加入根或抛出异常 + tree.add(node); + } + } + } + return tree; + } + + /** + * 商品调拨单据列表 + * + * @param supplySearchParam 供应申请查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 商品调拨单据分页列表 + */ + @Override + public R getPage(SupplySearchParam supplySearchParam, Integer pageNo, Integer pageSize, String searchKey, + HttpServletRequest request) { + + // 设置模糊查询的字段名 + HashSet searchFields = new HashSet<>(); + searchFields.add(CommonConstants.FieldName.SupplyBusNo); + + // 构建查询条件 + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(supplySearchParam, searchKey, searchFields, request); + // 查询商品调拨单据分页列表 + Page transferReceiptPage = productTransferMapper.selectProductTransferPage( + new Page<>(pageNo, pageSize), queryWrapper, SupplyType.PRODUCT_ALLOCATION.getValue()); + + transferReceiptPage.getRecords().forEach(e -> { + // 单据状态 + e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum())); + }); + return R.ok(transferReceiptPage); + } + + /** + * 商品调拨单据详情 + * + * @param busNo 单据号 + * @return 商品调拨单据详情 + */ + @Override + public R getDetail(String busNo) { + List productTransferDetailList = productTransferMapper.selectDetail(busNo); + if (productTransferDetailList.isEmpty()) { + return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null)); + } + return R.ok(productTransferDetailList); + } + + /** + * 添加/编辑商品调拨单据 + * + * @param productTransferDto 商品调拨单据 + * @return 编辑结果 + */ + @Override + public R addOrEditTransferReceipt(ProductTransferDto productTransferDto) { + + // 初始化单据信息 + SupplyRequest supplyRequest = new SupplyRequest(); + BeanUtils.copyProperties(productTransferDto, supplyRequest); + + if (productTransferDto.getId() != null) { + // 更新单据信息 + supplyRequestService.updateById(supplyRequest); + } else { + // 生成商品调拨单据 + supplyRequest + // 单据分类:库存供应 + .setCategoryEnum(SupplyCategory.STOCK_SUPPLY.getValue()) + // 单据类型:商品调拨 + .setTypeEnum(SupplyType.PRODUCT_ALLOCATION.getValue()) + // 申请时间 + .setApplyTime(DateUtils.getNowDate()); + supplyRequestService.save(supplyRequest); + } + // 返回单据id + return R.ok(supplyRequest.getId(), null); + } + + /** + * 删除单据 + * + * @param supplyRequestId 供应请求id + * @return 操作结果 + */ + @Override + public R deleteReceipt(Long supplyRequestId) { + // 删除单据 + boolean result = supplyRequestService.removeById(supplyRequestId); + return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null)) + : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + } + + /** + * 提交审批 + * + * @param busNo 单据号 + * @return 操作结果 + */ + @Override + public R submitApproval(String busNo) { + // 单据提交审核 + boolean result = supplyRequestService.submitApproval(busNo); + return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null)) + : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + } + + /** + * 撤回审批 + * + * @param busNo 单据号 + * @return 操作结果 + */ + @Override + public R withdrawApproval(String busNo) { + // 撤回审核 + boolean result = supplyRequestService.withdrawApproval(busNo); + return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null)) + : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java index c9a63fe7..d0b9fbc7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java @@ -4,6 +4,7 @@ package com.openhis.web.inventorymanage.appservice.impl; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -184,6 +185,55 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); } + // 商品调拨 + if (agreedList.get(0).getTypeEnum() == SupplyType.PRODUCT_ALLOCATION.getValue()) { + + // 获取供应项目所在表 + String itemTable = supplyRequestService.getItemTable(agreedList); + + // 查询供应项目的详细信息 + List supplyItemDetailList = this.getSupplyItemDetail(busNo, itemTable); + + for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) { + + // 根据产品批号,仓库和仓位 查询库存表信息 + InventoryItem inventoryItem = + inventoryItemService.selectInventoryByLotNumber(supplyItemDetailDto.getLotNumber(), + supplyItemDetailDto.getSourceLocationId(), supplyItemDetailDto.getPurposeLocationStoreId()); + + // 包装数量 + BigDecimal baseQuantity = inventoryItem.getBaseQuantity(); + // 最小数量 + BigDecimal minQuantity = inventoryItem.getMinQuantity(); + + if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) { + + baseQuantity = baseQuantity.min(supplyItemDetailDto.getItemQuantity()); + minQuantity = minQuantity + .min(supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity())); + + } else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) { + + baseQuantity = baseQuantity.min(supplyItemDetailDto.getItemQuantity() + .divide(supplyItemDetailDto.getPartPercent(), RoundingMode.HALF_UP)); + minQuantity = minQuantity.min(supplyItemDetailDto.getItemQuantity()); + + } + // 更新库存数量 + inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), baseQuantity, minQuantity, + loginUser, now); + } + + // 将供应项目的详细信息装配为库存项目和采购账单 + Pair, List> listPair = + InventoryManageAssembler.assembleChargeAndInventory(supplyItemDetailList, now, loginUser); + + // 入库 + inventoryItemService.stockIn(listPair.getRight()); + + return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null)); + } + // 获取供应项目所在表 String itemTable = supplyRequestService.getItemTable(agreedList); // 获取供应的物品 diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/ProductTransferController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/ProductTransferController.java new file mode 100644 index 00000000..b43ddf5e --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/ProductTransferController.java @@ -0,0 +1,113 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.controller; + +import com.core.common.core.domain.R; +import com.openhis.web.inventorymanage.appservice.IProductTransferAppService; +import com.openhis.web.inventorymanage.dto.SupplySearchParam; +import com.openhis.web.inventorymanage.dto.ProductTransferDto; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; + +/** + * 商品调拨 controller + * + * @author MY + * @date 2025-03-19 + */ +@RestController +@RequestMapping("/inventory-manage/transfer") +@Slf4j +public class ProductTransferController { + + @Autowired + private IProductTransferAppService productTransferAppService; + + /** + * 商品调拨页面初始化 + * + * @return 初始化信息 + */ + @GetMapping(value = "/init") + public R productTransferInit() { + return productTransferAppService.productTransferInit(); + } + + /** + * 商品调拨单据列表 + * + * @param supplySearchParam 供应申请查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 商品调拨分页列表 + */ + @GetMapping(value = "/product-transfer-page") + public R getPage(SupplySearchParam supplySearchParam, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, + @RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) { + return productTransferAppService.getPage(supplySearchParam, pageNo, pageSize, searchKey, request); + } + + /** + * 商品调拨单据详情 + * + * @param busNo 单据号 + * @return 供应申请单据详情 + */ + @GetMapping(value = "/product-transfer-detail") + public R getDetail(@RequestParam String busNo) { + return productTransferAppService.getDetail(busNo); + } + + /** + * 添加/编辑商品调拨单据 + * + * @param productTransferDto 商品调拨单据 + * @return 操作结果 + */ + @PutMapping("/product-transfer-edit") + public R addOrEditTransferReceipt(@Validated @RequestBody ProductTransferDto productTransferDto) { + return productTransferAppService.addOrEditTransferReceipt(productTransferDto); + } + + /** + * 删除单据 + * + * @param supplyRequestId 供应请求id + * @return 操作结果 + */ + @DeleteMapping("/product-transfer-del") + public R deleteTransferReceipt(@RequestParam Long supplyRequestId) { + return productTransferAppService.deleteReceipt(supplyRequestId); + } + + /** + * 提交审批 + * + * @param busNo 单据号 + * @return 操作结果 + */ + @PutMapping("/submit-approval") + public R submitApproval(@RequestParam String busNo) { + return productTransferAppService.submitApproval(busNo); + } + + /** + * 撤回审批 + * + * @param busNo 单据号 + * @return 操作结果 + */ + @PutMapping("/withdraw-approval") + public R withdrawApproval(@RequestParam String busNo) { + return productTransferAppService.withdrawApproval(busNo); + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventorySearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventorySearchParam.java index 2be4bf5a..596433fa 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventorySearchParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventorySearchParam.java @@ -3,11 +3,11 @@ */ package com.openhis.web.inventorymanage.dto; +import java.util.Date; + import lombok.Data; import lombok.experimental.Accessors; -import java.util.Date; - /** * 入库单据分页查询条件 * diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryStockTakeDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryStockTakeDetailDto.java index f50e3dbc..f6a72d7a 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryStockTakeDetailDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryStockTakeDetailDto.java @@ -10,7 +10,6 @@ import java.util.Date; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.sun.jna.platform.unix.solaris.LibKstat; import lombok.Data; import lombok.experimental.Accessors; @@ -67,8 +66,6 @@ public class InventoryStockTakeDetailDto implements Serializable { /** 盈亏原因 */ - - /** 目的仓库类型 */ private Integer purposeTypeEnum; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryTransferDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryTransferDetailDto.java index a591b685..2b26be6b 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryTransferDetailDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryTransferDetailDto.java @@ -10,7 +10,6 @@ import java.util.Date; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.sun.jna.platform.unix.solaris.LibKstat; import lombok.Data; import lombok.experimental.Accessors; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/LocationQueryDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/LocationQueryDto.java new file mode 100644 index 00000000..a40f55b7 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/LocationQueryDto.java @@ -0,0 +1,35 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author + * @date 2025-02-21 + */ +@Data +@Accessors(chain = true) +public class LocationQueryDto { + + /** ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** 编码 */ + private String no; + + /** 名称 */ + private String name; + + /** 子集合 */ + private List children = new ArrayList<>(); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferDetailDto.java new file mode 100644 index 00000000..4bed6989 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferDetailDto.java @@ -0,0 +1,111 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 调拨单据详情 + * + * @author zwh + * @date 2025-03-04 + */ +@Data +@Accessors(chain = true) +public class ProductTransferDetailDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** ID */ + @TableId(type = IdType.ASSIGN_ID) + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** 单据号 */ + private String busNo; + + /** 申请时间 */ + private Date applyTime; + + /** 源仓库类型 */ + private Integer sourceTypeEnum; + private String sourceTypeEnum_dictText; + + /** 源仓库名称 */ + private String sourceLocationName; + + /** 源货位名称 */ + private String sourceLocationStoreName; + + /** 目的仓库类型 */ + private Integer purposeTypeEnum; + private String purposeTypeEnum_dictText; + + /** 目的仓库名称 */ + private String purposeLocationName; + + /** 目的货位名称 */ + private String purposeLocationStoreName; + + /** 项目(药品类型) */ + private String itemTable; + + /** 规格 */ + private String totalVolume; + + /** 供应商名称 */ + private String supplierName; + + /** 物品计量单位 */ + @Dict(dictCode = "unit_code") + private String unitCode; + private String unitCode_dictText; + + /** 数量 */ + private BigDecimal itemQuantity; + + /** 源库存数量 */ + private BigDecimal totalSourceQuantity; + + /** 目的库存数量 */ + private BigDecimal totalPurposeQuantity; + + /** 单价 */ + private BigDecimal price; + + /** 总价 */ + private BigDecimal totalPrice; + + /** 产品批号 */ + private String lotNumber; + + /** 开始时间 */ + private Date startTime; + + /** 结束时间 */ + private Date endTime; + + /** 追溯码 */ + private String traceNo; + + /** 理由 */ + private String reason; + + /** 售价 */ + private BigDecimal sellPrice; + + /** 拆零售价 */ + private BigDecimal minSellPrice; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferDto.java new file mode 100644 index 00000000..5b8fb606 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferDto.java @@ -0,0 +1,122 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 商品调拨单据 + * + * @author MY + * @date 2025-03-18 + */ +@Data +@Accessors(chain = true) +public class ProductTransferDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** ID */ + @TableId(type = IdType.ASSIGN_ID) + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** 项目 */ + private String itemTable; + + /** 数量 */ + @NotNull + @Min(1) + private Integer itemQuantity; + + /** 物品编码 */ + @NotNull + private Long itemId; + + /** 物品计量单位 */ + @NotNull + private String unitCode; + + /** 请求细节 */ + private String detailJson; + + /** 供应商 */ + @NotNull + private Long supplierId; + + /** 源仓库类型 */ + @NotNull + private Integer sourceTypeEnum; + + /** 源仓库 */ + @NotNull + private Long sourceLocationId; + + /** 源仓位 */ + @NotNull + private Long sourceLocationStoreId; + + /** 目的仓库类型 */ + @NotNull + private Integer purposeTypeEnum; + + /** 目的仓库 */ + @NotNull + private Long purposeLocationId; + + /** 目的仓位 */ + @NotNull + private Long purposeLocationStoreId; + + /** 申请人 */ + @NotNull + private Long applicantId; + + /** 申请时间 */ + private Date applyTime; + + /** 产品批号 */ + @NotNull + private String lotNumber; + + /** 追溯码 */ + @NotNull + private String traceNo; + + /** 开始时间 */ + @NotNull + private Date startTime; + + /** 结束时间 */ + @NotNull + private Date endTime; + + /** 单价 */ + @NotNull + private BigDecimal price; + + /** 总价 */ + @NotNull + private BigDecimal totalPrice; + + /** 售价 */ + @NotNull + private BigDecimal sellPrice; + + /** 拆零售价 */ + @NotNull + private BigDecimal minSellPrice; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferInitDto.java new file mode 100644 index 00000000..b5b3b077 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferInitDto.java @@ -0,0 +1,74 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import com.openhis.web.basedatamanage.dto.LocationQueryDto; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 商品调拨初始化 dto + * + * @author my + * @date 2025-03-20 + */ +@Data +@Accessors(chain = true) +public class ProductTransferInitDto { + + /** + * 单据号 + */ + private String busNo; + + /** + * 源仓库 + */ + private List sourceTypeListOptions; + + /** + * 目的仓库 + */ + private List purposeTypeListOptions; + + /** + * 药品类型 + */ + private List categoryListOptions; + + /** + * 审批状态 + */ + private List supplyStatusOptions; + + /** + * 药品类型 + */ + @Data + public static class categoryListOption { + private Integer value; + private String label; + + public categoryListOption(Integer value, String label) { + this.value = value; + this.label = label; + } + } + + /** + * 审批状态 + */ + @Data + public static class supplyStatusOption { + private Integer value; + private String label; + + public supplyStatusOption(Integer value, String label) { + this.value = value; + this.label = label; + } + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferPageDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferPageDto.java new file mode 100644 index 00000000..7611e4ad --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductTransferPageDto.java @@ -0,0 +1,70 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * 商品调拨分页列表 dto + * + * @author zwh + * @date 2025-02-18 + */ +@Data +@Accessors(chain = true) +public class ProductTransferPageDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** ID */ + @TableId(type = IdType.ASSIGN_ID) + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** 单据号 */ + private String supplyBusNo; + + /** 状态 */ + private Integer statusEnum; + private String statusEnum_enumText; + + /** 类型 */ + private Integer typeEnum; + private String typeEnum_enumText; + + /** 项目(药品类型) */ + private String itemTable; + + /** 源仓库名称 */ + private String sourceLocationName; + + /** 目的仓库名称 */ + private String purposeLocationName; + + /** 审批人 */ + @Dict(dictCode = "id", dictText = "name", dictTable = "adm_practitioner") + private Long approverId; + private String approverId_dictText; + + /** 审批时间 */ + private Date approvalTime; + + /** 申请人 */ + @Dict(dictCode = "id", dictText = "name", dictTable = "adm_practitioner") + private Long applicantId; + private String applicantId_dictText; + + /** 制单日期 */ + private Date createTime; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryDto.java index a69a87dc..5413a11f 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryDto.java @@ -71,7 +71,7 @@ public class PurchaseInventoryDto { private Long purposeLocationStoreId; /** 申请人 */ -// @NotNull + // @NotNull private Long applicantId; /** 经手人 */ diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryInitDto.java index 11d8f95e..8a768786 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryInitDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryInitDto.java @@ -66,6 +66,20 @@ public class PurchaseInventoryInitDto { } } + /** + * 入库项目类型 + */ + @Data + public static class itemTypeOption { + private Integer value; + private String label; + + public itemTypeOption(Integer value, String label) { + this.value = value; + this.label = label; + } + } + /** * 入库项目类型 */ diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/RequisitionOutSearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/RequisitionOutSearchParam.java index 62d42d6d..082d6c24 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/RequisitionOutSearchParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/RequisitionOutSearchParam.java @@ -4,7 +4,6 @@ package com.openhis.web.inventorymanage.dto; import java.io.Serializable; -import java.util.Date; import org.hibernate.validator.constraints.Length; @@ -30,7 +29,7 @@ public class RequisitionOutSearchParam implements Serializable { private String id; /** 项目类型 */ -// @Length(max = 255) -// private String busNo; + // @Length(max = 255) + // private String busNo; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplyItemDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplyItemDetailDto.java index 8719df06..e69a868f 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplyItemDetailDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplyItemDetailDto.java @@ -3,7 +3,6 @@ */ package com.openhis.web.inventorymanage.dto; -import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -48,6 +47,12 @@ public class SupplyItemDetailDto { /** 审批人 */ private Long approverId; + /** 源仓库 */ + private Long sourceLocationId; + + /** 源仓位 */ + private Long sourceLocationStoreId; + /** 目的仓库 */ private Long purposeLocationId; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplySearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplySearchParam.java new file mode 100644 index 00000000..2ca6b719 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplySearchParam.java @@ -0,0 +1,37 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 供应申请共通查询条件 + * + * @author my + * @date 2025-03-19 + */ +@Data +@Accessors(chain = true) +public class SupplySearchParam implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 状态 */ + private Integer statusEnum; + + /** 源仓库 */ + private Integer sourceLocationId; + + /** 目的仓库 */ + private Integer purposeLocationId; + + /** 申请人 */ + private Long applicantId; + + /** 经手人 */ + private Long practitionerId; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/mapper/InventoryDetailsMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/mapper/InventoryDetailsMapper.java index 9994c471..2d436efd 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/mapper/InventoryDetailsMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/mapper/InventoryDetailsMapper.java @@ -3,13 +3,13 @@ */ package com.openhis.web.inventorymanage.mapper; -import com.openhis.web.inventorymanage.dto.*; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.inventorymanage.dto.*; /** * 采购入库查询用 mapper @@ -47,7 +47,8 @@ public interface InventoryDetailsMapper { * @param queryWrapper 查询条件 * @return 商品调拨分页列表 */ - Page selectInventoryTransferDetailsPage(@Param("page") Page page, + Page selectInventoryTransferDetailsPage( + @Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); /** @@ -57,6 +58,7 @@ public interface InventoryDetailsMapper { * @param queryWrapper 查询条件 * @return 商品盘点分页列表 */ - Page selectInventoryStockTakeDetailsPage(@Param("page") Page page, + Page selectInventoryStockTakeDetailsPage( + @Param("page") Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/mapper/ProductTransferMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/mapper/ProductTransferMapper.java new file mode 100644 index 00000000..8d216924 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/mapper/ProductTransferMapper.java @@ -0,0 +1,45 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.inventorymanage.dto.SupplySearchParam; +import com.openhis.web.inventorymanage.dto.ProductTransferDetailDto; +import com.openhis.web.inventorymanage.dto.ProductTransferPageDto; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 商品调拨查询用 mapper + * + * @author zwh + * @date 2025-03-10 + */ +@Repository +public interface ProductTransferMapper { + + /** + * 查询商品调拨单据分页列表 + * + * @param page 分页 + * @param queryWrapper 查询条件 + * @param productTransfer 单据类型:采购入库 + * @return 商品调拨单据分页列表 + */ + Page selectProductTransferPage(@Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper, + @Param("productTransfer") Integer productTransfer); + + /** + * 查询单据详情 + * + * @param busNo 单据号 + * @return 单据详情 + */ + List selectDetail(@Param("busNo") String busNo); +} diff --git a/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/ProductTransferMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/ProductTransferMapper.xml new file mode 100644 index 00000000..5dde5bcd --- /dev/null +++ b/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/ProductTransferMapper.xml @@ -0,0 +1,174 @@ + + + + + + + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/ReceiptApprovalMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/ReceiptApprovalMapper.xml index 0f4942e2..ae25b887 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/ReceiptApprovalMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/ReceiptApprovalMapper.xml @@ -13,6 +13,8 @@ T1.sell_price, T1.min_sell_price, T1.approver_id, + T1.source_location_id, + T1.source_location_store_id, T1.purpose_location_id, T1.purpose_location_store_id, T1.supplier_id, @@ -56,6 +58,8 @@ T1.sell_price, T1.min_sell_price, T1.approver_id, + T1.source_location_id, + T1.source_location_store_id, T1.purpose_location_id, T1.purpose_location_store_id, T1.supplier_id, diff --git a/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml index a615f28f..c85098a5 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml @@ -125,7 +125,7 @@ AND T2.instance_table = 'wor_activity_definition' - AND T2.id = #{id} + AND T1.id = #{id} AND T1.tenant_id = #{tenantId} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/CategoryType.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/CategoryType.java new file mode 100644 index 00000000..df6708de --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/CategoryType.java @@ -0,0 +1,45 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 药品类型 + * + * @author zwh + * @date 2025-03-10 + */ +@Getter +@AllArgsConstructor +public enum CategoryType implements HisEnumInterface { + + /** + * 中药 + */ + MEDICINE(1, "1", "中药"), + + /** + * 西药 + */ + CHEMICAL(2, "2", "西药"), + + /** + * 中成药 + */ + TRADITIONAL(3, "3", "中成药"), + + /** + * 耗材 + */ + DEVICE(4, "4", "耗材"); + + @EnumValue + private Integer value; + private String code; + private String info; + +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/InventoryType.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/InventoryType.java new file mode 100644 index 00000000..57e292e6 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/InventoryType.java @@ -0,0 +1,35 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 仓库类型 + * + * @author zwh + * @date 2025-03-10 + */ +@Getter +@AllArgsConstructor +public enum InventoryType implements HisEnumInterface { + + /** + * 仓库 + */ + INVENTORY(1, "1", "仓库"), + + /** + * 药房 + */ + PHARMACY(2, "2", "药房"); + + @EnumValue + private Integer value; + private String code; + private String info; + +} diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IInventoryItemService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IInventoryItemService.java index 017247a0..9523e1f5 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IInventoryItemService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IInventoryItemService.java @@ -1,9 +1,11 @@ package com.openhis.workflow.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.core.common.core.domain.model.LoginUser; import com.openhis.workflow.domain.InventoryItem; -import com.openhis.workflow.domain.SupplyRequest; +import java.math.BigDecimal; +import java.util.Date; import java.util.List; /** @@ -20,4 +22,27 @@ public interface IInventoryItemService extends IService { * @param InventoryItemList 入库项目 */ void stockIn(List InventoryItemList); + + /** + * 更新库房数量 + * + * @param id 主键 + * @param baseQuantity 常规单位库存数量 + * @param minQuantity 最小单位库存数量 + * @param loginUser 登录用户信息 + * @param now 当前时间 + * @return 更新件数 + */ + Boolean updateInventoryQuantity(Long id, BigDecimal baseQuantity, BigDecimal minQuantity, LoginUser loginUser, Date now); + + /** + * 查询 + * + * @param lotNumber 产品批号 + * @param locationId 仓库 + * @param locationStoreId 库位 + * @return 单据详情 + */ + InventoryItem selectInventoryByLotNumber(String lotNumber, Long locationId, Long locationStoreId); + } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/InventoryItemServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/InventoryItemServiceImpl.java index e2b85de6..103f0cbc 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/InventoryItemServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/InventoryItemServiceImpl.java @@ -1,7 +1,8 @@ package com.openhis.workflow.service.impl; -import com.openhis.administration.domain.ChargeItem; -import com.openhis.workflow.domain.SupplyRequest; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.core.common.core.domain.model.LoginUser; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -9,6 +10,8 @@ import com.openhis.workflow.domain.InventoryItem; import com.openhis.workflow.mapper.InventoryItemMapper; import com.openhis.workflow.service.IInventoryItemService; +import java.math.BigDecimal; +import java.util.Date; import java.util.List; /** @@ -34,4 +37,53 @@ public class InventoryItemServiceImpl extends ServiceImpl().eq(InventoryItem::getId, id) + .set(InventoryItem::getUpdateTime, now) + .set(InventoryItem::getUpdateBy, loginUser.getUserId()) + .set(InventoryItem::getBaseQuantity, baseQuantity) + .set(InventoryItem::getMinQuantity, minQuantity)); + + return updateCount > 0; + + } + + /** + * 查询库房信息 + * + * @param lotNumber 产品批号 + * @param locationId 仓库 + * @param locationStoreId 库位 + */ + @Override + public InventoryItem selectInventoryByLotNumber(String lotNumber, Long locationId, Long locationStoreId) { + + // 查询取库房信息 + InventoryItem inventoryItem = + baseMapper.selectOne(new LambdaQueryWrapper() + .eq(InventoryItem::getLotNumber, lotNumber) + .eq(InventoryItem::getLocationId, locationId) + .eq(InventoryItem::getLocationStoreId, locationStoreId)); + if (inventoryItem == null) { + return null; + } + + return inventoryItem; + + } + } \ No newline at end of file diff --git a/openhis-ui-vue3/src/views/catalog/diagnosistreatment/components/diagnosisTreatmentDialog.vue b/openhis-ui-vue3/src/views/catalog/diagnosistreatment/components/diagnosisTreatmentDialog.vue index b1b644fd..a0ec3ef7 100644 --- a/openhis-ui-vue3/src/views/catalog/diagnosistreatment/components/diagnosisTreatmentDialog.vue +++ b/openhis-ui-vue3/src/views/catalog/diagnosistreatment/components/diagnosisTreatmentDialog.vue @@ -10,12 +10,12 @@ label-position="left" > - + @@ -61,25 +61,24 @@ - - + + :disabled="form.categoryCode != ''" + > + + - - + + - + - + - + - - + + - + - + - + - +
- + +
诊疗目录
- + - + - + @@ -198,8 +199,8 @@ @@ -214,8 +215,8 @@ - + + @@ -338,7 +354,7 @@ { /** 诊断目录分类查询下拉树结构 */ function getDiseaseTreatmentList() { getDiseaseTreatmentInit().then((response) => { - console.log(response, "response器材目录分类查询下拉树结构"); - diseaseTreatmentCategoryList.value = - response.data.diseaseTreatmentCategoryList.sort((a, b) => { return parseInt(a.value) - parseInt(b.value) }); + console.log(response, "response诊疗目录分类查询下拉树结构"); + diagnosisCategoryOptions.value = + response.data.diagnosisCategoryOptions.sort((a, b) => { + return parseInt(a.value) - parseInt(b.value); + }); + diagnosisCategoryOptions.value.push({ info: "全部", value: "" }); statusFlagOptions.value = response.data.statusFlagOptions; exeOrganizations.value = response.data.exeOrganizations; typeEnumOptions.value = response.data.typeEnumOptions; + statusWeatherOption.value = response.data.statusWeatherOption; }); } /** 查询诊断目录列表 */ function getList() { + console.log(queryParams.value, "queryParams***********************"); loading.value = true; getDiagnosisTreatmentList(queryParams.value).then((res) => { loading.value = false; @@ -433,7 +455,7 @@ function getList() { /** 节点单击事件 */ function handleNodeClick(data) { console.log(data, "节点单击事件"); - queryParams.value.categoryEnum = data.value; + queryParams.value.categoryCode = data.value; currentCategoryEnum.value = data.value; handleQuery(); } @@ -495,19 +517,21 @@ function handleSelectionChange(selection) { /** 打开新增弹窗 */ function openAddDiagnosisTreatment() { - if (currentCategoryEnum.value) { - console.log("打开新增弹窗"); - title.value = "新增"; - nextTick(() => { - proxy.$refs.diagnosisTreatmentRef.show(); - }); - } else { - proxy.$modal.msgError("请先选择目录分类!"); - } + // if (currentCategoryEnum.value) { + console.log("打开新增弹窗"); + title.value = "新增"; + nextTick(() => { + proxy.$refs.diagnosisTreatmentRef.show(); + }); + // } else { + // proxy.$modal.msgError("请先选择目录分类!"); + // } } /** 打开编辑弹窗 */ function openEditDiagnosisTreatment(row) { getDiagnosisTreatmentOne(row.id).then((response) => { + console.log(response, "response88888"); + currentData.value = response.data; currentData.value.ybFlag == 1 ? (currentData.value.ybFlag = true) diff --git a/openhis-ui-vue3/src/views/catalog/disease/index.vue b/openhis-ui-vue3/src/views/catalog/disease/index.vue index c1b102e6..b19cf7a7 100644 --- a/openhis-ui-vue3/src/views/catalog/disease/index.vue +++ b/openhis-ui-vue3/src/views/catalog/disease/index.vue @@ -226,12 +226,12 @@ /> - + @@ -250,14 +250,14 @@
- + - + { console.log("121212", response); personInfo.value = response.data.prescriptionPatientInfoDto; - medicineInfoList.value = response.data.prescriptionMedicineInfoDtoList; + medicineInfoList.value = Array.isArray( + response.data.prescriptionMedicineInfoDtoList + ) + ? response.data.prescriptionMedicineInfoDtoList + : [response.data.prescriptionMedicineInfoDtoList]; // 统计每个 prescriptionNo 的行数 const groupCounts = countGroupRows(medicineInfoList.value); // 设置每行的标记 @@ -427,7 +431,11 @@ function submitMedicine(row) { updateMedicion(row.prescriptionNo).then((response) => { proxy.$modal.msgSuccess("发药成功"); listWesternmedicine(currentRow.value).then((response) => { - medicineInfoList.value = response.data; + medicineInfoList.value = Array.isArray( + response.data.prescriptionMedicineInfoDtoList + ) + ? response.data.prescriptionMedicineInfoDtoList + : [response.data.prescriptionMedicineInfoDtoList]; // 统计每个 prescriptionNo 的行数 const groupCounts = countGroupRows(medicineInfoList.value); // 设置每行的标记 @@ -453,7 +461,13 @@ function handleConfirm() { } ); listWesternmedicine(currentRow.value).then((response) => { - medicineInfoList.value = response.data; + console.log("1212*******12", response); + medicineInfoList.value = Array.isArray( + response.data.prescriptionMedicineInfoDtoList + ) + ? response.data.prescriptionMedicineInfoDtoList + : [response.data.prescriptionMedicineInfoDtoList]; + // medicineInfoList.value = response.data; // 统计每个 prescriptionNo 的行数 const groupCounts = countGroupRows(medicineInfoList.value); // 设置每行的标记