版本更新
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
/**
|
||||
* 科室材料共通方法
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentCommonService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
DepartmentInitDto init();
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 单据列表
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @param locationFlg 仓库flg
|
||||
* @param supplyType 单据类型
|
||||
* @return 订货单据分页列表
|
||||
*/
|
||||
R<?> getPage(DepartmentSearchParam purchaseOrderSearchParam, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request,String locationFlg,Integer supplyType);
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deleteOrder(String busNo);
|
||||
|
||||
// /**
|
||||
// * 提交审批
|
||||
// *
|
||||
// * @param busNo 单据号
|
||||
// * @return 操作结果
|
||||
// */
|
||||
// R<?> submitApproval(String busNo);
|
||||
|
||||
// /**
|
||||
// * 同意审批
|
||||
// *
|
||||
// * @param busNo 单据号
|
||||
// * @return 操作结果
|
||||
// */
|
||||
// R<?> agreeApproval(String busNo);
|
||||
|
||||
// /**
|
||||
// * 撤回审批
|
||||
// *
|
||||
// * @param busNo 单据号
|
||||
// * @return 操作结果
|
||||
// */
|
||||
// R<?> withdrawApproval(String busNo);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料发出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentIssuanceOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 发出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 发出单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 添加/编辑发出单
|
||||
*
|
||||
* @param dispenseIdList 耗材发放id
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean addOrEditIssuanceOrder(List<Long> dispenseIdList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料损益单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentProfitLossOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 损益单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 损益单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑损益单
|
||||
*
|
||||
* @param profitLossOrderDtoList 损益信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditProfitLossOrder(List<DepartmentDetailDto> profitLossOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料审批方法
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentReceiptApprovalService {
|
||||
|
||||
/**
|
||||
* 请领单同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> requisitionOrderAgreeApproval(String busNo);
|
||||
|
||||
/**
|
||||
* 药房入库单据审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> stockInOrderAgreeApproved(String busNo);
|
||||
|
||||
/**
|
||||
* 科室材料退库审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> returnToWarehouseAgreeApproved(String busNo);
|
||||
|
||||
|
||||
// /**
|
||||
// * 药房发药审批通过
|
||||
// *
|
||||
// * @param busNo 单据号
|
||||
// * @return 操作结果
|
||||
// */
|
||||
// R<?> dispensingAgreeApproved(String busNo);
|
||||
|
||||
/**
|
||||
* 药房损益单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> profitLossAgreeApproved(String busNo);
|
||||
|
||||
/**
|
||||
* 药房盘点单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> stocktakingAgreepproved(String busNo);
|
||||
/**
|
||||
* 药房调入单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> transferInAgreeApproved(String busNo);
|
||||
|
||||
/**
|
||||
* 药房调出单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> transferOutAgreeApproved(String busNo);
|
||||
|
||||
/**
|
||||
* 根据单据号获取供应单据及供应项相关详细信息
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 供应单据及供应项相关详细信息
|
||||
*/
|
||||
List<SupplyItemDetailDto> getSupplyItemDetail(String busNo);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料请领单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentRequisitionOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 请领单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 请领单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑请领单
|
||||
*
|
||||
* @param requisitionOrderDtoList 请领信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditRequisitionOrder(List<DepartmentDetailDto> requisitionOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料退库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentReturnToWarehouseOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 退库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 退库单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑退库单
|
||||
*
|
||||
* @param returnToDispensaryOrderDtoList 退库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditReturnToWarehouseOrder(List<DepartmentDetailDto> returnToDispensaryOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料入库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentStockInOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 入库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 入库单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑入库单
|
||||
*
|
||||
* @param stockInOrderDtoList 入库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditStockInOrder(List<DepartmentDetailDto> stockInOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料盘点单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentStocktakingOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 盘点单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 盘点单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑盘点单
|
||||
*
|
||||
* @param stocktakingOrderDtoList 盘点信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditStocktakingOrder(List<DepartmentDetailDto> stocktakingOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料调入单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentTransferInOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 调入单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调入单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑调出单
|
||||
*
|
||||
* @param transferInOrderDtoList 调出信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditTransferInOrder(List<DepartmentDetailDto> transferInOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.openhis.web.departmentmanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
|
||||
/**
|
||||
* 科室材料调出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public interface IDepartmentTransferOutOrderService {
|
||||
/**
|
||||
* 单据初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 调出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调出单单据详情
|
||||
*/
|
||||
R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> getBusNo();
|
||||
|
||||
/**
|
||||
* 添加/编辑调出单
|
||||
*
|
||||
* @param transferOutOrderDtoList 调出信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditTransferOutOrder(List<DepartmentDetailDto> transferOutOrderDtoList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.common.enums.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.MessageUtils;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.domain.Supplier;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.administration.service.ISupplierService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.common.appservice.ICommonService;
|
||||
import com.openhis.web.common.dto.LocationDto;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDeviceInfoDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料订货单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentCommonServiceImpl implements IDepartmentCommonService {
|
||||
|
||||
@Resource
|
||||
private ISupplierService supplierService;
|
||||
|
||||
@Resource
|
||||
private IPractitionerService practitionerService;
|
||||
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Resource
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
@Resource
|
||||
private ICommonService commonServiceImpl;
|
||||
@Resource
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public DepartmentInitDto init() {
|
||||
DepartmentInitDto orderInitDto = new DepartmentInitDto();
|
||||
|
||||
// 查询供应商列表
|
||||
List<Supplier> supplierList = supplierService.getList();
|
||||
// 查询经手人列表
|
||||
List<Practitioner> practitionerList = practitionerService.getList();
|
||||
// 经手人信息
|
||||
List<DepartmentInitDto.LongOption> practitionerListOption = practitionerList.stream()
|
||||
.map(practitioner -> new DepartmentInitDto.LongOption(practitioner.getId(), practitioner.getName()))
|
||||
.collect(Collectors.toList());
|
||||
// 供应商信息
|
||||
List<DepartmentInitDto.SupplierOption> supplierListOption = supplierList.stream()
|
||||
.map(supplier -> new DepartmentInitDto.SupplierOption(supplier.getId(), supplier.getName() ,supplier.getPhone()))
|
||||
.collect(Collectors.toList());
|
||||
// 审批状态
|
||||
List<DepartmentInitDto.IntegerOption> supplyStatusOption = Stream.of(SupplyStatus.values()).map(
|
||||
supplyStatus -> new DepartmentInitDto.IntegerOption(supplyStatus.getValue(), supplyStatus.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 包装情况
|
||||
List<DepartmentInitDto.IntegerOption> packagingConditionOption = Stream.of(PackagingCondition.values())
|
||||
.map(packagingCondition -> new DepartmentInitDto.IntegerOption(packagingCondition.getValue(),
|
||||
packagingCondition.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 验收结果
|
||||
List<DepartmentInitDto.IntegerOption> acceptanceResultOption = Stream.of(AcceptanceResult.values())
|
||||
.map(acceptanceResult -> new DepartmentInitDto.IntegerOption(acceptanceResult.getValue(),
|
||||
acceptanceResult.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 仓库列表
|
||||
List<LocationDto> warehouseList = commonServiceImpl.getWarehouseList();
|
||||
// 科室列表
|
||||
List<Organization> departmentList = organizationService.getList(OrganizationType.DEPARTMENT.getValue(), null);
|
||||
|
||||
orderInitDto.setWarehouseListOptions(warehouseList).setDepartmentListOptions(departmentList)
|
||||
.setSupplierOption(supplierListOption).setPractitionerOption(practitionerListOption)
|
||||
.setSupplyStatusOptions(supplyStatusOption).setPackagingConditionOptions(packagingConditionOption)
|
||||
.setAcceptanceResultoryOptions(acceptanceResultOption);
|
||||
|
||||
return orderInitDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam, Integer pageNo,
|
||||
Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
|
||||
Long locationId = purchaseOrderSearchParam.getLocationId();
|
||||
purchaseOrderSearchParam.setLocationId(null);
|
||||
Long supplierId = purchaseOrderSearchParam.getSupplierId();
|
||||
purchaseOrderSearchParam.setSupplierId(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<DepartmentSearchParam> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(purchaseOrderSearchParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name, CommonConstants.FieldName.PyStr)), request);
|
||||
// 设置排序
|
||||
queryWrapper.orderByDesc(CommonConstants.FieldName.Name);
|
||||
|
||||
Page<DepartmentDeviceInfoDto> medicationInfoDto = departmentCommonMapper
|
||||
.getDeviceInfo(new Page<>(pageNo, pageSize), queryWrapper, locationId, supplierId);
|
||||
|
||||
for (DepartmentDeviceInfoDto item : medicationInfoDto.getRecords()) {
|
||||
List<DepartmentDeviceInfoDto.Option> unitList = new ArrayList<>();
|
||||
unitList
|
||||
.add(new DepartmentDeviceInfoDto.Option(item.getUnitCode(), item.getUnitCode_dictText()));
|
||||
unitList.add(
|
||||
new DepartmentDeviceInfoDto.Option(item.getMinUnitCode(), item.getMinUnitCode_dictText()));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
|
||||
return R.ok(medicationInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 单据列表
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @param locationFlg 仓库flg
|
||||
* @param supplyType 单据类型
|
||||
* @return 订货单据分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPage(DepartmentSearchParam purchaseOrderSearchParam, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request, String locationFlg,Integer supplyType) {
|
||||
//判断哪个画面使用
|
||||
if (supplyType != null) {
|
||||
purchaseOrderSearchParam.setTypeEnum(supplyType);
|
||||
}
|
||||
// if (locationForm != null) {
|
||||
// purchaseOrderSearchParam.setLocationTypeEnum(locationForm);
|
||||
// }
|
||||
String originalBusNoFlg = purchaseOrderSearchParam.getOriginalBusNoFlg();
|
||||
purchaseOrderSearchParam.setOriginalBusNoFlg(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<DepartmentSearchParam> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(purchaseOrderSearchParam, searchKey,
|
||||
new HashSet<>(
|
||||
Arrays.asList(CommonConstants.FieldName.SupplyBusNo, CommonConstants.FieldName.ApplicantName)),
|
||||
request);
|
||||
// 设置排序
|
||||
queryWrapper.orderByDesc(CommonConstants.FieldName.SupplyBusNo);
|
||||
// 查询订货单分页列表
|
||||
Page<DepartmentDto> purchaseOrderDtoPage =
|
||||
departmentCommonMapper.getPage(new Page<>(pageNo, pageSize), queryWrapper,originalBusNoFlg, locationFlg);
|
||||
|
||||
purchaseOrderDtoPage.getRecords().forEach(e -> {
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
return R.ok(purchaseOrderDtoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteOrder(String busNo) {
|
||||
// 根据原始单据号查询信息
|
||||
List<SupplyRequest> supplyRequest = supplyRequestService.getSupplyByOriginalBusNo(busNo);
|
||||
if (!supplyRequest.isEmpty()) {
|
||||
// 将原始单据号信息的原始单据号删除
|
||||
boolean flg = supplyRequestService.updateByBusNo(supplyRequest.get(0).getBusNo());
|
||||
if (!flg) {
|
||||
R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
|
||||
// 删除单据
|
||||
boolean result = supplyRequestService.removeByBusNo(busNo);
|
||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentIssuanceOrderMapper;
|
||||
import com.openhis.web.pharmacyDispensarymanage.dto.PharmacyDispensaryDetailDto;
|
||||
import com.openhis.web.pharmacyDispensarymanage.dto.PharmacyDispensaryInitDto;
|
||||
import com.openhis.web.pharmacyDispensarymanage.mapper.PharmacyDispensaryDispensingOrderMapper;
|
||||
import com.openhis.workflow.domain.SupplyDelivery;
|
||||
import com.openhis.workflow.service.ISupplyDeliveryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.MessageUtils;
|
||||
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.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentIssuanceOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料发出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentIssuanceOrderServiceImpl implements IDepartmentIssuanceOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
@Resource
|
||||
private ISupplyDeliveryService supplyDeliveryService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
@Autowired
|
||||
private DepartmentIssuanceOrderMapper departmentIssuanceOrderMapper;
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto issuanceOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption
|
||||
.add(new DepartmentInitDto.IntegerOption(SupplyCategory.OUTPATIENT_PATIENT_DISPENSING.getValue(),
|
||||
SupplyCategory.OUTPATIENT_PATIENT_DISPENSING.getInfo()));
|
||||
supplyCategoryOption
|
||||
.add(new DepartmentInitDto.IntegerOption(SupplyCategory.INPATIENT_PATIENT_DISPENSING.getValue(),
|
||||
SupplyCategory.INPATIENT_PATIENT_DISPENSING.getInfo()));
|
||||
supplyCategoryOption.add(
|
||||
new DepartmentInitDto.IntegerOption(SupplyCategory.INPATIENT_PATIENT_SUMMARY_DISPENSING.getValue(),
|
||||
SupplyCategory.INPATIENT_PATIENT_SUMMARY_DISPENSING.getInfo()));
|
||||
|
||||
issuanceOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(issuanceOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 发出单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> issuanceOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
issuanceOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
return R.ok(issuanceOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
public String getBusNo() {
|
||||
return assignSeqUtil.getSeqByDay(AssignSeqEnum.DISPENSING_ORDER.getPrefix(), 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑发出单
|
||||
*
|
||||
* @param dispenseIdList 耗材发放id
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean addOrEditIssuanceOrder(List<Long> dispenseIdList) {
|
||||
|
||||
// 获取单据号
|
||||
String busNo = this.getBusNo();
|
||||
// 获取更表所需信息
|
||||
List<DepartmentDetailDto> detailDto =
|
||||
departmentIssuanceOrderMapper.getInfo(dispenseIdList, DispenseStatus.COMPLETED.getValue());
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
SupplyRequest supplyRequest;
|
||||
List<SupplyDelivery> supplyDeliveryList = new ArrayList<>();
|
||||
SupplyDelivery supplyDelivery;
|
||||
for (DepartmentDetailDto item : detailDto) {
|
||||
// 供应申请
|
||||
supplyRequest = new SupplyRequest().setBusNo(busNo).setTypeEnum(SupplyType.DISPENSING_ORDER.getValue())
|
||||
.setStatusEnum(SupplyStatus.AGREE.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
|
||||
.setLotNumber(item.getLotNumber())
|
||||
.setSourceTypeEnum(LocationForm.CABINET.getValue()).setSourceLocationId(item.getSourceLocationId())
|
||||
.setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setPurposeLocationId(item.getPurposeLocationId()).setApplicantId(item.getApplicantId())
|
||||
.setApplyTime(item.getApplyTime()).setApproverId(item.getApproverId())
|
||||
.setApprovalTime(item.getApprovalTime());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
// 供应发放
|
||||
supplyDelivery = new SupplyDelivery().setRequestId(supplyRequest.getId())
|
||||
.setStatusEnum(DispenseStatus.COMPLETED.getValue()).setTypeEnum(supplyRequest.getTypeEnum())
|
||||
.setItemTable(supplyRequest.getItemTable()).setItemId(supplyRequest.getItemId())
|
||||
.setBasedOnTable(CommonConstants.TableName.WOR_DEVICE_DISPENSE).setBasedOnIds(item.getDispenseIds())
|
||||
.setUnitCode(supplyRequest.getUnitCode()).setQuantity(supplyRequest.getItemQuantity())
|
||||
.setLotNumber(supplyRequest.getLotNumber())
|
||||
.setPractitionerId(supplyRequest.getApplicantId()).setOccurrenceTime(supplyRequest.getApprovalTime())
|
||||
.setReceiverId(supplyRequest.getPurposeLocationId()).setReceiveTime(supplyRequest.getApprovalTime());
|
||||
|
||||
supplyDeliveryList.add(supplyDelivery);
|
||||
}
|
||||
|
||||
// 更新供应请求表
|
||||
boolean requestFlg = supplyRequestService.saveBatch(supplyRequestList);
|
||||
if (!requestFlg) {
|
||||
return false;
|
||||
}
|
||||
// 更新供应发放表
|
||||
boolean deliveryFlg = supplyDeliveryService.saveBatch(supplyDeliveryList);
|
||||
if (!deliveryFlg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentProfitLossOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentProfitLossOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料损益单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentProfitLossOrderServiceImpl implements IDepartmentProfitLossOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.GENERAL_PROFIT_AND_LOSS.getValue(),
|
||||
SupplyCategory.GENERAL_PROFIT_AND_LOSS.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.STOCKTAKING_PROFIT_AND_LOSS.getValue(),
|
||||
SupplyCategory.STOCKTAKING_PROFIT_AND_LOSS.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.STANDBY_RESCUE_MEDICINES.getValue(),
|
||||
SupplyCategory.STANDBY_RESCUE_MEDICINES.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.DAMAGED_EXPIRED_MEDICINES.getValue(),
|
||||
SupplyCategory.DAMAGED_EXPIRED_MEDICINES.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.DONATED_MEDICINES.getValue(),
|
||||
SupplyCategory.DONATED_MEDICINES.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 损益单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 损益单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> profitLossOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
profitLossOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : profitLossOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(),item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(),item.getMinUnitCode_dictText()
|
||||
));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
return R.ok(profitLossOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_PRPFITLOSS.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑损益单
|
||||
*
|
||||
* @param profitLossOrderDtoList 损益信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditProfitLossOrder(List<DepartmentDetailDto> profitLossOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(profitLossOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : profitLossOrderDtoList) {
|
||||
SupplyRequest supplyRequest =
|
||||
new SupplyRequest().setBusNo(item.getBusNo()).setTypeEnum(SupplyType.DEPARTMENT_PRPFITLOSS.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity()).setPrice(item.getPrice())
|
||||
.setTotalPrice(item.getTotalPrice()).setRetailPrice(item.getRetailPrice())
|
||||
.setTotalRetailPrice(item.getTotalRetailPrice()).setBatchInventory(item.getBatchInventory())
|
||||
.setSpecificationInventory(item.getSpecificationInventory()).setStartTime(item.getStartTime())
|
||||
.setEndTime(item.getEndTime()).setLotNumber(item.getLotNumber()).setTraceNo(item.getTraceNo())
|
||||
.setTraceNoUnitCode(item.getTraceNoUnitCode()).setReason(item.getReason())
|
||||
.setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue()).setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId())
|
||||
.setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,933 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.DispenseStatus;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.common.enums.TraceNoStatus;
|
||||
import com.openhis.common.enums.Whether;
|
||||
import com.openhis.common.enums.ybenums.YbInvChgType;
|
||||
import com.openhis.common.enums.ybenums.YbRxFlag;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.inventorymanage.appservice.IReceiptApprovalAppService;
|
||||
import com.openhis.web.inventorymanage.appservice.ITraceNoAppService;
|
||||
import com.openhis.web.inventorymanage.assembler.InventoryManageAssembler;
|
||||
import com.openhis.web.inventorymanage.dto.ItemChargeDetailDto;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
import com.openhis.web.inventorymanage.mapper.ReceiptApprovalMapper;
|
||||
import com.openhis.workflow.domain.DeviceDispense;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.domain.SupplyDelivery;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import com.openhis.workflow.service.ISupplyDeliveryService;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
import com.openhis.yb.dto.Medical3503Param;
|
||||
import com.openhis.yb.dto.MedicalInventory3501Param;
|
||||
import com.openhis.yb.dto.MedicalInventory3502Param;
|
||||
import com.openhis.yb.dto.MedicalPurchase3504Param;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
|
||||
/**
|
||||
* 科室材料审批
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentReceiptApprovalServiceImpl implements IDepartmentReceiptApprovalService {
|
||||
@Autowired
|
||||
private ITraceNoAppService traceNoAppService;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private ISupplyDeliveryService supplyDeliveryService;
|
||||
@Autowired
|
||||
private IInventoryItemService inventoryItemService;
|
||||
@Autowired
|
||||
private ReceiptApprovalMapper receiptApprovalMapper;
|
||||
@Autowired
|
||||
private YbManager ybService;
|
||||
@Autowired
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
@Autowired
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
@Autowired
|
||||
private IReceiptApprovalAppService receiptApprovalAppService;
|
||||
|
||||
/**
|
||||
* 请领单同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> requisitionOrderAgreeApproval(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// // 获取审批通过后的供应请求id列表
|
||||
// List<Long> supplyReqIdList = agreedList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
//
|
||||
// // 校验(已经审批通过的单号(发放状态是已完成),不能再重复审批通过)
|
||||
// boolean validation = supplyDeliveryService.supplyDeliveryValidation(supplyReqIdList);
|
||||
// if (validation) {
|
||||
// throw new ServiceException("请勿重复审批");
|
||||
// }
|
||||
// // 根据单据,生成供应发放单
|
||||
// List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
// if (deliveredList.isEmpty()) {
|
||||
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
// }
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室材料入库单据审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> stockInOrderAgreeApproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 根据单据,发放物品
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
InventoryItem inventoryItemPurpose = null;
|
||||
// 新增库存信息
|
||||
List<SupplyItemDetailDto> supplyList = new ArrayList<>();
|
||||
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据项目id,产品批号,仓库id 查询仓库库存表信息
|
||||
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
|
||||
if (!inventoryItemList.isEmpty()) {
|
||||
inventoryItemPurpose = inventoryItemList.get(0);
|
||||
}
|
||||
|
||||
if (inventoryItemPurpose == null) {
|
||||
// 新增库存信息
|
||||
supplyList.add(supplyItemDetailDto);
|
||||
} else {
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = inventoryItemPurpose.getQuantity();
|
||||
|
||||
// 计算盘点后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
// 源仓库库存+(调拨数量*拆零比)
|
||||
minQuantity = minQuantity
|
||||
.add(supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
|
||||
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
// 源仓库库存+调拨数量
|
||||
minQuantity = minQuantity.add(supplyItemDetailDto.getItemQuantity());
|
||||
}
|
||||
// 更新源仓库库存数量
|
||||
Boolean aBoolean =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItemPurpose.getId(), minQuantity, now);
|
||||
|
||||
if (!aBoolean) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!supplyList.isEmpty()) {
|
||||
// 将供应项目的详细信息装配为库存项目
|
||||
List<InventoryItem> inventoryItemList = InventoryManageAssembler.assembleInventoryItem(supplyList);
|
||||
// 入库
|
||||
inventoryItemService.stockIn(inventoryItemList);
|
||||
}
|
||||
|
||||
// 追加追溯码信息
|
||||
boolean flg = traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.IN.getValue(),
|
||||
SupplyType.PURCHASE_STOCKIN.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 调用医保商品采购接口 todo 科室材料相关医保接口未对应
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<String> uploadFailedNoList =
|
||||
this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.PURCHASE_IN, false, true, false, now);
|
||||
if (!uploadFailedNoList.isEmpty()) {
|
||||
returnMsg = "3503商品采购上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3503商品采购上传成功";
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 药库退库审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> returnToWarehouseAgreeApproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 根据单据,发放物品
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据项目id,产品批号,目的仓库id 查询仓库库存表信息
|
||||
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getSourceLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
InventoryItem inventoryItemSource;
|
||||
if (!inventoryItemList.isEmpty()) {
|
||||
inventoryItemSource = inventoryItemList.get(0);
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = inventoryItemSource.getQuantity();
|
||||
|
||||
// 计算退货后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
} else {
|
||||
// 仓库库存-(退货数量*拆零比)
|
||||
minQuantity = minQuantity.subtract(
|
||||
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
|
||||
}
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
} else {
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
// 仓库库存-退货数量
|
||||
minQuantity = minQuantity.subtract(supplyItemDetailDto.getItemQuantity());
|
||||
}
|
||||
}
|
||||
// 更新仓库库存数量
|
||||
Boolean aBoolean =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItemSource.getId(), minQuantity, now);
|
||||
|
||||
if (!aBoolean) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 追加追溯码信息
|
||||
boolean flg = traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.OUT.getValue(),
|
||||
SupplyType.PURCHASE_RETURN.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 调用医保采购退货接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<String> uploadFailedNoList =
|
||||
this.ybInventoryIntegrated(supplyItemDetailList, YbInvChgType.RETURN_OUT, false, false, true, now);
|
||||
if (!uploadFailedNoList.isEmpty()) {
|
||||
returnMsg = "3504采购退货上传错误,错误项目编码" + uploadFailedNoList;
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 科室材料发药审批通过 todo 发药只查询,没有审批
|
||||
// *
|
||||
// * @param busNo 单据号
|
||||
// * @return 操作结果
|
||||
// */
|
||||
// @Override
|
||||
// public R<?> dispensingAgreeApproved(String busNo) {
|
||||
// // 获取当前时间
|
||||
// Date now = DateUtils.getNowDate();
|
||||
// // 审批单据并返回单据详情
|
||||
// List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
// if (agreedList.isEmpty()) {
|
||||
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
// }
|
||||
// // 根据单据,发放物品
|
||||
// List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
// if (deliveredList.isEmpty()) {
|
||||
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
// }
|
||||
//
|
||||
// // 查询供应项目的详细信息
|
||||
// List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
//
|
||||
// if (!supplyItemDetailList.isEmpty()) {
|
||||
//
|
||||
// for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// // 根据项目id,产品批号,源仓库id 查询源仓库库存表信息
|
||||
// List<InventoryItem> inventoryItemSourceList = inventoryItemService.selectInventoryByItemId(
|
||||
// supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
// supplyItemDetailDto.getSourceLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
// InventoryItem inventoryItemSource = new InventoryItem();
|
||||
// if (!inventoryItemSourceList.isEmpty()) {
|
||||
// inventoryItemSource = inventoryItemSourceList.get(0);
|
||||
//
|
||||
// // 包装数量(常规单位库存数量) 更新库存数量方法中没用到
|
||||
// BigDecimal baseQuantitySource = inventoryItemSource.getQuantity();
|
||||
// // 最小数量(最小单位库存数量)
|
||||
// BigDecimal minQuantitySource = inventoryItemSource.getQuantity();
|
||||
//
|
||||
// // 供应申请的物品计量单位与包装单位相同
|
||||
// if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
// if (minQuantitySource.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// // 库存数量不足
|
||||
// return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
// } else {
|
||||
// // 源仓库库存-(领用数量*拆零比)
|
||||
// minQuantitySource = minQuantitySource.subtract(
|
||||
// supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
|
||||
// }
|
||||
// } else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
// if (minQuantitySource.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// // 库存数量不足
|
||||
// return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
// } else {
|
||||
// // 供应申请的物品计量单位与最小单位相同
|
||||
// // 源仓库库存-领用数量
|
||||
// minQuantitySource = minQuantitySource.subtract(supplyItemDetailDto.getItemQuantity());
|
||||
// }
|
||||
// }
|
||||
// // 更新源仓库库存数量
|
||||
// Boolean aBooleanSource = inventoryItemService.updateInventoryQuantity(inventoryItemSource.getId(),
|
||||
// baseQuantitySource, minQuantitySource, now, supplyItemDetailDto.getTraceNo());
|
||||
//
|
||||
// if (!aBooleanSource) {
|
||||
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 科室材料损益单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> profitLossAgreeApproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 根据单据,生成供应发放单
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据id,产品批号,仓库 查询库存表信息
|
||||
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
InventoryItem inventoryItem = new InventoryItem();
|
||||
if (!inventoryItemList.isEmpty()) {
|
||||
inventoryItem = inventoryItemList.get(0);
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = null;
|
||||
|
||||
// 计算报损后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
// 数量*拆零比
|
||||
minQuantity =
|
||||
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity());
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
// 数量
|
||||
minQuantity = supplyItemDetailDto.getItemQuantity();
|
||||
}
|
||||
// 更新库存数量
|
||||
Boolean aBoolean =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), minQuantity, now);
|
||||
if (!aBoolean) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 追加追溯码信息
|
||||
boolean flg =
|
||||
traceNoAppService.updateTraceNoList(supplyItemDetailList, SupplyType.PURCHASE_PRPFITLOSS.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 调用医保库存变更接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<String> uploadFailedNoList = this.ybInventoryIntegrated(supplyItemDetailList,
|
||||
YbInvChgType.DESTRUCTION, false, false, false, now);
|
||||
if (!uploadFailedNoList.isEmpty()) {
|
||||
returnMsg = "3502库存变更上传错误,错误项目编码" + uploadFailedNoList;
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室材料盘点单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> stocktakingAgreepproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 根据单据,生成供应发放单
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
// 首次盘存列表
|
||||
List<SupplyItemDetailDto> firstSupplyItemDetailList = new ArrayList<>();
|
||||
// 药品/耗材发放列表
|
||||
List<MedicationDispense> medicationDispenses = null;
|
||||
List<DeviceDispense> deviceDispenses = null;
|
||||
// 返回信息
|
||||
String stocktakingReturnMsg = null;
|
||||
String changeReturnMsg = null;
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
// 获取盘盈列表(itemQuantity > 0)
|
||||
List<SupplyItemDetailDto> positiveList = supplyItemDetailList.stream()
|
||||
.filter(item -> item.getItemQuantity() != null && item.getItemQuantity().compareTo(BigDecimal.ZERO) > 0)
|
||||
.collect(Collectors.toList());
|
||||
// 获取盘亏列表(itemQuantity < 0)
|
||||
List<SupplyItemDetailDto> negativeList = supplyItemDetailList.stream()
|
||||
.filter(item -> item.getItemQuantity() != null && item.getItemQuantity().compareTo(BigDecimal.ZERO) < 0)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据id,产品批号,仓库 查询库存表信息
|
||||
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
// 查看该批号的药品/耗材是否发放过(用于证明是否首次盘存)
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
|
||||
medicationDispenses = medicationDispenseService.list(new LambdaQueryWrapper<MedicationDispense>()
|
||||
.eq(MedicationDispense::getLotNumber, supplyItemDetailDto.getLotNumber()));
|
||||
if (medicationDispenses.isEmpty()) {
|
||||
firstSupplyItemDetailList.add(supplyItemDetailDto);
|
||||
}
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
|
||||
deviceDispenses = deviceDispenseService.list(new LambdaQueryWrapper<DeviceDispense>()
|
||||
.in(DeviceDispense::getLotNumber, supplyItemDetailDto.getLotNumber()));
|
||||
if (deviceDispenses.isEmpty()) {
|
||||
firstSupplyItemDetailList.add(supplyItemDetailDto);
|
||||
}
|
||||
}
|
||||
if (!inventoryItemList.isEmpty()) {
|
||||
InventoryItem inventoryItem = inventoryItemList.get(0);
|
||||
// 包装数量(常规单位库存数量) 更新库存数量方法中没用到
|
||||
BigDecimal baseQuantity = inventoryItem.getQuantity();
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = null;
|
||||
|
||||
// 计算盘点后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
minQuantity =
|
||||
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getTotalQuantity());
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
minQuantity = supplyItemDetailDto.getTotalQuantity();
|
||||
}
|
||||
// 更新库存数量
|
||||
Boolean aBoolean =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), minQuantity, now);
|
||||
if (!aBoolean) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
|
||||
String ybSwitch =
|
||||
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// 如果首次盘点信息不为空
|
||||
if (!firstSupplyItemDetailList.isEmpty()) {
|
||||
// 调用医保盘存接口,盘盈
|
||||
List<String> uploadFailedNoList = this.ybInventoryIntegrated(firstSupplyItemDetailList,
|
||||
YbInvChgType.INVENTORY_GAIN, true, false, false, now);
|
||||
if (!uploadFailedNoList.isEmpty()) {
|
||||
stocktakingReturnMsg = "3501盘存上传错误,错误项目编码" + uploadFailedNoList;
|
||||
}
|
||||
}
|
||||
List<String> uploadFailedGainList = null;
|
||||
List<String> uploadFailedLossList = null;
|
||||
if (!positiveList.isEmpty()) {
|
||||
// 调用医保库存变更接口,盘盈
|
||||
uploadFailedGainList = this.ybInventoryIntegrated(positiveList, YbInvChgType.INVENTORY_GAIN,
|
||||
false, false, false, now);
|
||||
}
|
||||
if (!negativeList.isEmpty()) {
|
||||
// 调用医保库存变更接口,盘亏
|
||||
uploadFailedLossList = this.ybInventoryIntegrated(negativeList, YbInvChgType.INVENTORY_LOSS,
|
||||
false, false, false, now);
|
||||
}
|
||||
if (uploadFailedGainList != null || uploadFailedLossList != null) {
|
||||
changeReturnMsg = "3502库存变更上传错误,错误项目编码" + uploadFailedGainList + uploadFailedLossList;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 追加追溯码信息
|
||||
boolean flg =
|
||||
traceNoAppService.updateTraceNoList(supplyItemDetailList, SupplyType.PURCHASE_STOCKTAKING.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
return R.ok(stocktakingReturnMsg + changeReturnMsg,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室材料调入单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> transferInAgreeApproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 根据单据,发放物品
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
|
||||
// 新增库存信息
|
||||
List<SupplyItemDetailDto> supplylList = new ArrayList<>();
|
||||
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据项目id,产品批号,目的仓库id 查询目的仓库库存表信息
|
||||
List<InventoryItem> inventoryItemPurposeList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getPurposeLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
InventoryItem inventoryItemPurpose = null;
|
||||
if (!inventoryItemPurposeList.isEmpty()) {
|
||||
inventoryItemPurpose = inventoryItemPurposeList.get(0);
|
||||
}
|
||||
|
||||
if (inventoryItemPurpose == null) {
|
||||
// 新增库存信息
|
||||
supplylList.add(supplyItemDetailDto);
|
||||
} else {
|
||||
// 包装数量(常规单位库存数量) 更新库存数量方法中没用到
|
||||
BigDecimal baseQuantity = inventoryItemPurpose.getQuantity();
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = inventoryItemPurpose.getQuantity();
|
||||
|
||||
// 计算盘点后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
// 源仓库库存+(退库数量*拆零比)
|
||||
minQuantity = minQuantity
|
||||
.add(supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
// 源仓库库存+退库数量
|
||||
minQuantity = minQuantity.add(supplyItemDetailDto.getItemQuantity());
|
||||
}
|
||||
// 更新目的仓库库存数量
|
||||
Boolean bBooleanPurpose =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItemPurpose.getId(), minQuantity, now);
|
||||
if (!bBooleanPurpose) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!supplylList.isEmpty()) {
|
||||
// 将供应项目的详细信息装配为库存项目
|
||||
List<InventoryItem> inventoryItemList = InventoryManageAssembler.assembleInventoryItem(supplylList);
|
||||
// 入库
|
||||
inventoryItemService.stockIn(inventoryItemList);
|
||||
}
|
||||
// 追加追溯码信息
|
||||
boolean flg = traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.IN.getValue(),
|
||||
SupplyType.PURCHASE_TRANSFERIN.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室材料调出单审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> transferOutAgreeApproved(String busNo) {
|
||||
// 获取当前时间
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, now);
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 根据单据,发放物品
|
||||
List<SupplyDelivery> deliveredList = supplyDeliveryService.createCompletedSupplyDelivery(agreedList, now);
|
||||
if (deliveredList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 查询供应项目的详细信息
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo);
|
||||
|
||||
if (!supplyItemDetailList.isEmpty()) {
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
// 根据项目id,产品批号,目的仓库id 查询目的仓库库存表信息
|
||||
List<InventoryItem> inventoryItemSourceList = inventoryItemService.selectInventoryByItemId(
|
||||
supplyItemDetailDto.getItemId(), supplyItemDetailDto.getLotNumber(),
|
||||
supplyItemDetailDto.getSourceLocationId(), SecurityUtils.getLoginUser().getTenantId());
|
||||
InventoryItem inventoryItemSource = null;
|
||||
if (!inventoryItemSourceList.isEmpty()) {
|
||||
inventoryItemSource = inventoryItemSourceList.get(0);
|
||||
|
||||
// 包装数量(常规单位库存数量) 更新库存数量方法中没用到
|
||||
BigDecimal baseQuantity = inventoryItemSource.getQuantity();
|
||||
// 最小数量(最小单位库存数量)
|
||||
BigDecimal minQuantity = inventoryItemSource.getQuantity();
|
||||
|
||||
// 计算盘点后库存数量,结果取小单位
|
||||
// 供应申请的物品计量单位与包装单位相同
|
||||
if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) {
|
||||
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
} else {
|
||||
// 源仓库库存-(退库数量*拆零比)
|
||||
minQuantity = minQuantity.subtract(
|
||||
supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity()));
|
||||
}
|
||||
} else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) {
|
||||
if (minQuantity.compareTo(supplyItemDetailDto.getItemQuantity()) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(MessageUtils.createMessage("操作失败,库存数量不足", null));
|
||||
} else {
|
||||
// 供应申请的物品计量单位与最小单位相同
|
||||
// 源仓库库存-退库数量
|
||||
minQuantity = minQuantity.subtract(supplyItemDetailDto.getItemQuantity());
|
||||
}
|
||||
}
|
||||
// 更新目的仓库库存数量
|
||||
Boolean bBooleanSource =
|
||||
inventoryItemService.updateInventoryQuantity(inventoryItemSource.getId(), minQuantity, now);
|
||||
if (!bBooleanSource) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 追加追溯码信息
|
||||
boolean flg = traceNoAppService.addTraceNoManage(supplyItemDetailList, TraceNoStatus.OUT.getValue(),
|
||||
SupplyType.PURCHASE_TRANSFEROUT.getValue());
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据单据号获取供应单据及供应项相关详细信息
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 供应单据及供应项相关详细信息
|
||||
*/
|
||||
@Override
|
||||
public List<SupplyItemDetailDto> getSupplyItemDetail(String busNo) {
|
||||
return receiptApprovalMapper.selectSupplyDetail(busNo, DispenseStatus.COMPLETED.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 医保库存相关进销存接口
|
||||
*
|
||||
* @param supplyItemDetailList 供应申请项目详细信息
|
||||
* @param ybInvChgType 库存变更类型
|
||||
* @param firstFlag 首次盘存标识
|
||||
* @param now 库存变更时间
|
||||
* @return 上传失败的id集合
|
||||
*/
|
||||
private List<String> ybInventoryIntegrated(List<SupplyItemDetailDto> supplyItemDetailList,
|
||||
YbInvChgType ybInvChgType, Boolean firstFlag, Boolean purchaseFlag, Boolean returnFlag, Date now) {
|
||||
List<String> uploadFailedNoList = new ArrayList<>();
|
||||
R<?> result;
|
||||
R<?> firstResult = R.ok();
|
||||
R<?> returnResult = R.ok();
|
||||
R<?> purchaseResult = R.ok();
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
if (supplyItemDetailDto.getYbNo() == null) {
|
||||
continue;
|
||||
}
|
||||
switch (ybInvChgType) {
|
||||
case ALLOCATION_IN:
|
||||
case ALLOCATION_OUT:
|
||||
case INVENTORY_GAIN:
|
||||
case INVENTORY_LOSS:
|
||||
case DESTRUCTION:
|
||||
case OTHER_IN:
|
||||
case OTHER_OUT:
|
||||
case DONATION_IN:
|
||||
case DONATION_RETURN_OUT:
|
||||
case PURCHASE_IN:
|
||||
case RETURN_OUT:
|
||||
if (firstFlag) {
|
||||
firstResult =
|
||||
ybService.uploadInventoryCount(getMedicalInventory3501Param(supplyItemDetailDto, now), now);
|
||||
if (firstResult.getCode() != 200) {
|
||||
uploadFailedNoList.add(supplyItemDetailDto.getItemBusNo());
|
||||
}
|
||||
}
|
||||
if (returnFlag) {
|
||||
returnResult =
|
||||
ybService.cancelProcurement(getMedicalPurchase3504Param(supplyItemDetailDto, now));
|
||||
if (returnResult.getCode() != 200) {
|
||||
uploadFailedNoList.add(supplyItemDetailDto.getItemBusNo());
|
||||
}
|
||||
}
|
||||
if (purchaseFlag) {
|
||||
purchaseResult = ybService.procurement(getMedical3503Param(supplyItemDetailDto, now));
|
||||
if (purchaseResult.getCode() != 200) {
|
||||
uploadFailedNoList.add(supplyItemDetailDto.getItemBusNo());
|
||||
}
|
||||
}
|
||||
result = ybService.updateInventoryCount(
|
||||
getMedicalInventory3502Param(supplyItemDetailDto, now, ybInvChgType.getValue()));
|
||||
if (result.getCode() != 200) {
|
||||
uploadFailedNoList.add(supplyItemDetailDto.getItemBusNo());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("未知的库存变更类型: " + ybInvChgType);
|
||||
}
|
||||
}
|
||||
return uploadFailedNoList;
|
||||
}
|
||||
|
||||
private MedicalPurchase3504Param getMedicalPurchase3504Param(SupplyItemDetailDto supplyItemDetailDto, Date now) {
|
||||
MedicalPurchase3504Param medicalPurchase3504Param = new MedicalPurchase3504Param();
|
||||
medicalPurchase3504Param.setMedListCodg(supplyItemDetailDto.getYbNo())
|
||||
.setFixmedinsBchno(supplyItemDetailDto.getLotNumber())
|
||||
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
|
||||
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable())
|
||||
.setSplerName(supplyItemDetailDto.getSupplierName()).setPurcInvoNo(supplyItemDetailDto.getInvoiceNo())
|
||||
.setManuDate(supplyItemDetailDto.getStartTime()).setExpyEnd(supplyItemDetailDto.getEndTime())
|
||||
.setPurcRetnCnt(supplyItemDetailDto.getItemQuantity()).setPurcRetnStoinTime(now)
|
||||
.setPurcRetnOpterName(supplyItemDetailDto.getPractitionerName());
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalPurchase3504Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalPurchase3504Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalPurchase3504Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
return medicalPurchase3504Param;
|
||||
}
|
||||
|
||||
private Medical3503Param getMedical3503Param(SupplyItemDetailDto supplyItemDetailDto, Date now) {
|
||||
Medical3503Param medical3503Param = new Medical3503Param();
|
||||
medical3503Param.setMedListCodg(supplyItemDetailDto.getYbNo())
|
||||
.setFixmedinsBchno(supplyItemDetailDto.getLotNumber())
|
||||
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
|
||||
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable())
|
||||
.setSplerName(supplyItemDetailDto.getSupplierName()).setManuLotnum(supplyItemDetailDto.getLotNumber())
|
||||
.setProdentpName(supplyItemDetailDto.getManufacturerText())
|
||||
.setAprvno(supplyItemDetailDto.getApprovalNumber()).setManuDate(supplyItemDetailDto.getStartTime())
|
||||
.setExpyEnd(supplyItemDetailDto.getEndTime()).setPurcRetnCnt(supplyItemDetailDto.getItemQuantity())
|
||||
.setPurcRetnStoinTime(now).setPurcRetnOpterName(supplyItemDetailDto.getPractitionerName());
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medical3503Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medical3503Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medical3503Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
|
||||
return medical3503Param;
|
||||
}
|
||||
|
||||
private MedicalInventory3502Param getMedicalInventory3502Param(SupplyItemDetailDto supplyItemDetailDto, Date now,
|
||||
String ybInvChgType) {
|
||||
MedicalInventory3502Param medicalInventory3502Param = new MedicalInventory3502Param();
|
||||
// 查库存信息
|
||||
List<InventoryItem> inventoryItemList =
|
||||
inventoryItemService.selectInventoryByItemId(supplyItemDetailDto.getItemId(),
|
||||
supplyItemDetailDto.getLotNumber(), null, SecurityUtils.getLoginUser().getTenantId());
|
||||
// 查询商品价格信息
|
||||
List<ItemChargeDetailDto> itemChargeDetailList =
|
||||
receiptApprovalAppService.getItemChargeDetail(List.of(supplyItemDetailDto.getItemId()));
|
||||
if (!inventoryItemList.isEmpty() && !itemChargeDetailList.isEmpty()) {
|
||||
// 获取该项目所有的数量(最小单位)
|
||||
BigDecimal totalQuantity = inventoryItemList.stream()
|
||||
.map(item -> item.getQuantity() != null ? item.getQuantity() : BigDecimal.ZERO)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
// 最小单位售卖价格
|
||||
BigDecimal minPrice = BigDecimal.ZERO;
|
||||
Optional<BigDecimal> price = itemChargeDetailList.stream()
|
||||
.filter(x -> x.getConditionValue().equals(supplyItemDetailDto.getLotNumber()))
|
||||
.map(ItemChargeDetailDto::getSellPrice).findFirst();
|
||||
if (price.isPresent()) {
|
||||
if (supplyItemDetailDto.getPartPercent().compareTo(BigDecimal.ZERO) > 0) {
|
||||
minPrice = price.get().divide(supplyItemDetailDto.getPartPercent(), RoundingMode.HALF_UP);
|
||||
}
|
||||
}
|
||||
// 转换为JSON
|
||||
JSONArray medicalTraceNo = new JSONArray();
|
||||
// 获取追溯码信息
|
||||
if (supplyItemDetailDto.getTraceNo() != null) {
|
||||
List<String> traceNoList =
|
||||
Arrays.stream(supplyItemDetailDto.getTraceNo().split(CommonConstants.Common.COMMA))
|
||||
.map(String::trim).filter(s -> !s.isEmpty()).collect(Collectors.toList());
|
||||
for (String traceNo : traceNoList) {
|
||||
Map<String, String> traceNoMap = new HashMap<>();
|
||||
traceNoMap.put("drug_trac_codg", traceNo);
|
||||
medicalTraceNo.add(traceNoMap);
|
||||
}
|
||||
}
|
||||
medicalInventory3502Param.setMedListCodg(supplyItemDetailDto.getYbNo()).setInvChgType(ybInvChgType)
|
||||
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
|
||||
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable())
|
||||
.setFixmedinsBchno(supplyItemDetailDto.getLotNumber()).setPric(minPrice).setCnt(totalQuantity)
|
||||
.setInvChgTime(now).setDrugtracinfo(medicalTraceNo);
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3502Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3502Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3502Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
}
|
||||
return medicalInventory3502Param;
|
||||
}
|
||||
|
||||
private MedicalInventory3501Param getMedicalInventory3501Param(SupplyItemDetailDto supplyItemDetailDto, Date date) {
|
||||
MedicalInventory3501Param medicalInventory3501Param = new MedicalInventory3501Param();
|
||||
// 查库存信息
|
||||
List<InventoryItem> inventoryItemList =
|
||||
inventoryItemService.selectInventoryByItemId(supplyItemDetailDto.getItemId(),
|
||||
supplyItemDetailDto.getLotNumber(), null, SecurityUtils.getLoginUser().getTenantId());
|
||||
if (!inventoryItemList.isEmpty()) {
|
||||
// 获取该项目所有的数量(最小单位)
|
||||
BigDecimal totalQuantity = inventoryItemList.stream()
|
||||
.map(item -> item.getQuantity() != null ? item.getQuantity() : BigDecimal.ZERO)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
medicalInventory3501Param.setMedListCodg(supplyItemDetailDto.getYbNo())
|
||||
.setFixmedinsHilistId(supplyItemDetailDto.getItemBusNo())
|
||||
.setFixmedinsHilistName(supplyItemDetailDto.getItemTable()).setInvdate(date).setInvCnt(totalQuantity)
|
||||
.setFixmedinsBchno(supplyItemDetailDto.getLotNumber()).setManuDate(supplyItemDetailDto.getStartTime())
|
||||
.setExpyEnd(supplyItemDetailDto.getEndTime());
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3501Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3501Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == supplyItemDetailDto.getRxFlag()) {
|
||||
medicalInventory3501Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
}
|
||||
return medicalInventory3501Param;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.MessageUtils;
|
||||
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.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentRequisitionOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentRequisitionOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料请领单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentRequisitionOrderServiceImpl implements IDepartmentRequisitionOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto requisitionOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.NORMAL.getValue(),
|
||||
SupplyCategory.NORMAL.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.PURCHASE_APPLICATION.getValue(),
|
||||
SupplyCategory.PURCHASE_APPLICATION.getInfo()));
|
||||
|
||||
requisitionOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(requisitionOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请领单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 请领单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> requisitionOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
requisitionOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : requisitionOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(),item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(),item.getMinUnitCode_dictText()
|
||||
));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
|
||||
return R.ok(requisitionOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_REQUISITION.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑请领单
|
||||
*
|
||||
* @param requisitionOrderDtoList 请领信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditRequisitionOrder(List<DepartmentDetailDto> requisitionOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(requisitionOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
for (DepartmentDetailDto item : requisitionOrderDtoList) {
|
||||
SupplyRequest supplyRequest =
|
||||
new SupplyRequest().setBusNo(item.getBusNo()).setTypeEnum(SupplyType.DEPARTMENT_REQUISITION.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
|
||||
.setRetailPrice(item.getRetailPrice()).setTotalRetailPrice(item.getTotalRetailPrice())
|
||||
.setSpecificationInventory(item.getSpecificationInventory()).setSupplierId(item.getSupplierId())
|
||||
.setReason(item.getReason()).setSourceTypeEnum(LocationForm.CABINET.getValue())
|
||||
.setSourceLocationId(item.getSourceLocationId()).setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setPurposeLocationId(item.getPurposeLocationId()).setApplicantId(item.getApplicantId())
|
||||
.setApplyTime(item.getApplyTime()).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReturnToWarehouseOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentReturnToWarehouseOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料退库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentReturnToWarehouseOrderServiceImpl implements IDepartmentReturnToWarehouseOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.NORMAL.getValue(),
|
||||
SupplyCategory.NORMAL.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 退库单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> returnToDispensaryOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
returnToDispensaryOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : returnToDispensaryOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(),item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(),item.getMinUnitCode_dictText()
|
||||
));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
return R.ok(returnToDispensaryOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_RETURN.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑退库单
|
||||
*
|
||||
* @param returnToDispensaryOrderDtoList 退库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditReturnToWarehouseOrder(List<DepartmentDetailDto> returnToDispensaryOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(returnToDispensaryOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : returnToDispensaryOrderDtoList) {
|
||||
SupplyRequest supplyRequest = new SupplyRequest().setBusNo(item.getBusNo())
|
||||
.setTypeEnum(SupplyType.DEPARTMENT_RETURN.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
|
||||
.setRetailPrice(item.getRetailPrice()).setTotalRetailPrice(item.getTotalRetailPrice())
|
||||
.setStartTime(item.getStartTime()).setEndTime(item.getEndTime()).setLotNumber(item.getLotNumber())
|
||||
.setTraceNo(item.getTraceNo()).setTraceNoUnitCode(item.getTraceNoUnitCode())
|
||||
.setSupplierId(item.getSupplierId()).setReason(item.getReason())
|
||||
.setSourceTypeEnum(LocationForm.DEPARTMENT.getValue()).setSourceLocationId(item.getSourceLocationId())
|
||||
.setPurposeTypeEnum(LocationForm.WAREHOUSE.getValue()).setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId()).setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentStockInOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentStockInOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料入库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentStockInOrderServiceImpl implements IDepartmentStockInOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.NORMAL.getValue(),
|
||||
SupplyCategory.NORMAL.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 入库单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> stockInOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
stockInOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : stockInOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(), item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(), item.getMinUnitCode_dictText()));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
return R.ok(stockInOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_STOCKIN.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑入库单
|
||||
*
|
||||
* @param stockInOrderDtoList 入库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditStockInOrder(List<DepartmentDetailDto> stockInOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(stockInOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
//添加原始单据号
|
||||
if(stockInOrderDtoList.get(0).getOriginalBusNo()!=null){
|
||||
// 审批单据并返回单据详情
|
||||
List<SupplyRequest> agreedList = supplyRequestService.addOriginalBusNo(stockInOrderDtoList.get(0).getOriginalBusNo(), stockInOrderDtoList.get(0).getBusNo());
|
||||
if (agreedList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : stockInOrderDtoList) {
|
||||
SupplyRequest supplyRequest = new SupplyRequest().setBusNo(item.getBusNo())
|
||||
.setTypeEnum(SupplyType.DEPARTMENT_STOCKIN.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
|
||||
.setRetailPrice(item.getRetailPrice()).setTotalRetailPrice(item.getTotalRetailPrice())
|
||||
.setStartTime(item.getStartTime()).setEndTime(item.getEndTime()).setLotNumber(item.getLotNumber())
|
||||
.setTraceNo(item.getTraceNo()).setTraceNoUnitCode(item.getTraceNoUnitCode())
|
||||
.setSupplierId(item.getSupplierId()).setReason(item.getReason())
|
||||
.setSourceTypeEnum(LocationForm.WAREHOUSE.getValue()).setSourceLocationId(item.getSourceLocationId())
|
||||
.setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue()).setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId()).setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentStocktakingOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentStocktakingOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料盘点单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentStocktakingOrderServiceImpl implements IDepartmentStocktakingOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(
|
||||
SupplyCategory.GENERAL_STOCKTAKING.getValue(), SupplyCategory.GENERAL_STOCKTAKING.getInfo()));
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(
|
||||
SupplyCategory.MONTHLY_STOCKTAKING.getValue(), SupplyCategory.MONTHLY_STOCKTAKING.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘点单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 盘点单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> stocktakingOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
stocktakingOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : stocktakingOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(), item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(), item.getMinUnitCode_dictText()));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
return R.ok(stocktakingOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_STOCKTAKING.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑盘点单
|
||||
*
|
||||
* @param stocktakingOrderDtoList 盘点信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditStocktakingOrder(List<DepartmentDetailDto> stocktakingOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList =
|
||||
supplyRequestService.getSupplyByBusNo(stocktakingOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : stocktakingOrderDtoList) {
|
||||
SupplyRequest supplyRequest = new SupplyRequest().setBusNo(item.getBusNo())
|
||||
.setTypeEnum(SupplyType.DEPARTMENT_STOCKTAKING.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue()).setCategoryEnum(item.getCategoryEnum())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity())
|
||||
.setTotalQuantity(item.getTotalQuantity()).setPrice(item.getPrice()).setTotalPrice(item.getTotalPrice())
|
||||
.setRetailPrice(item.getRetailPrice()).setTotalRetailPrice(item.getTotalRetailPrice())
|
||||
.setBatchInventory(item.getBatchInventory()).setLotNumber(item.getLotNumber())
|
||||
.setTraceNo(item.getTraceNo()).setTraceNoUnitCode(item.getTraceNoUnitCode())
|
||||
.setReasonCode(item.getReasonCode()).setReason(item.getReason())
|
||||
.setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue()).setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId()).setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentTransferInOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentTransferInOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料调入单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentTransferInOrderServiceImpl implements IDepartmentTransferInOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.NORMAL.getValue(),
|
||||
SupplyCategory.NORMAL.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调入单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调入单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> transferInOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
transferInOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : transferInOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(), item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(), item.getMinUnitCode_dictText()));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
|
||||
return R.ok(transferInOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_TRANSFERIN.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑调出单
|
||||
*
|
||||
* @param transferInOrderDtoList 调出信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditTransferInOrder(List<DepartmentDetailDto> transferInOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(transferInOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : transferInOrderDtoList) {
|
||||
SupplyRequest supplyRequest = new SupplyRequest().setBusNo(item.getBusNo())
|
||||
.setTypeEnum(SupplyType.DEPARTMENT_TRANSFERIN.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity()).setRetailPrice(item.getPrice())
|
||||
.setTotalRetailPrice(item.getTotalPrice()).setBatchInventory(item.getBatchInventory())
|
||||
.setSpecificationInventory(item.getSpecificationInventory()).setEndTime(item.getEndTime())
|
||||
.setLotNumber(item.getLotNumber()).setTraceNo(item.getTraceNo())
|
||||
.setTraceNoUnitCode(item.getTraceNoUnitCode()).setSupplierId(item.getSupplierId())
|
||||
.setReason(item.getReason()).setSourceTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setSourceLocationId(item.getSourceLocationId()).setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId()).setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.openhis.web.departmentmanage.appservice.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentTransferOutOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentInitDto;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentCommonMapper;
|
||||
import com.openhis.web.departmentmanage.mapper.DepartmentTransferOutOrderMapper;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingInitDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
* 科室材料调出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Service
|
||||
public class DepartmentTransferOutOrderServiceImpl implements IDepartmentTransferOutOrderService {
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private DepartmentCommonMapper departmentCommonMapper;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DepartmentInitDto purchaseOrderInitDto = departmentCommonService.init();
|
||||
|
||||
// 单据分类
|
||||
List<DepartmentInitDto.IntegerOption> supplyCategoryOption = new ArrayList<>();
|
||||
supplyCategoryOption.add(new DepartmentInitDto.IntegerOption(SupplyCategory.NORMAL.getValue(),
|
||||
SupplyCategory.NORMAL.getInfo()));
|
||||
|
||||
purchaseOrderInitDto.setSupplyCategoryOptions(supplyCategoryOption);
|
||||
|
||||
return R.ok(purchaseOrderInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调出单单据详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDetailPage(String busNo, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Page<DepartmentDetailDto> transferOutOrderDtoDetailPage =
|
||||
departmentCommonMapper.getDetailPage(new Page<>(pageNo, pageSize), busNo);
|
||||
|
||||
transferOutOrderDtoDetailPage.getRecords().forEach(e -> {
|
||||
// 单据分类
|
||||
e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(SupplyCategory.class, e.getCategoryEnum()));
|
||||
// 单据状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(SupplyStatus.class, e.getStatusEnum()));
|
||||
// 单据类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplyType.class, e.getTypeEnum()));
|
||||
});
|
||||
|
||||
List<DepartmentDetailDto.Option> unitList;
|
||||
for (DepartmentDetailDto item : transferOutOrderDtoDetailPage.getRecords()) {
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMaxUnitCode(), item.getMaxUnitCode_dictText()));
|
||||
unitList.add(new DepartmentDetailDto.Option(item.getMinUnitCode(), item.getMinUnitCode_dictText()));
|
||||
|
||||
item.setUnitList(unitList);
|
||||
}
|
||||
|
||||
return R.ok(transferOutOrderDtoDetailPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBusNo() {
|
||||
|
||||
ProductStocktakingInitDto initDto = new ProductStocktakingInitDto();
|
||||
// 单据号
|
||||
initDto.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEPARTMENT_TRANSFEROUT.getPrefix(), 4));
|
||||
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑调出单
|
||||
*
|
||||
* @param transferOutOrderDtoList 调出信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
|
||||
@Override
|
||||
public R<?> addOrEditTransferOutOrder(List<DepartmentDetailDto> transferOutOrderDtoList) {
|
||||
// 请求数据取得
|
||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(transferOutOrderDtoList.get(0).getBusNo());
|
||||
if (!requestList.isEmpty()) {
|
||||
// 请求id取得
|
||||
List<Long> requestIdList = requestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
// 单据信息删除
|
||||
supplyRequestService.removeByIds(requestIdList);
|
||||
}
|
||||
|
||||
List<SupplyRequest> supplyRequestList = new ArrayList<>();
|
||||
Date applyTime = DateUtils.getNowDate();
|
||||
for (DepartmentDetailDto item : transferOutOrderDtoList) {
|
||||
SupplyRequest supplyRequest = new SupplyRequest().setBusNo(item.getBusNo())
|
||||
.setTypeEnum(SupplyType.DEPARTMENT_TRANSFEROUT.getValue())
|
||||
.setStatusEnum(SupplyStatus.PENDING_REVIEW.getValue())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION).setItemId(item.getItemId())
|
||||
.setUnitCode(item.getUnitCode()).setItemQuantity(item.getItemQuantity()).setRetailPrice(item.getPrice())
|
||||
.setTotalRetailPrice(item.getTotalPrice()).setBatchInventory(item.getBatchInventory())
|
||||
.setSpecificationInventory(item.getSpecificationInventory()).setEndTime(item.getEndTime())
|
||||
.setLotNumber(item.getLotNumber()).setTraceNo(item.getTraceNo())
|
||||
.setTraceNoUnitCode(item.getTraceNoUnitCode()).setSupplierId(item.getSupplierId())
|
||||
.setReason(item.getReason()).setSourceTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setSourceLocationId(item.getSourceLocationId()).setPurposeTypeEnum(LocationForm.DEPARTMENT.getValue())
|
||||
.setPurposeLocationId(item.getPurposeLocationId())
|
||||
.setApplicantId(item.getApplicantId()).setApplyTime(applyTime).setRemake(item.getRemake());
|
||||
supplyRequestList.add(supplyRequest);
|
||||
}
|
||||
// 更新请求表
|
||||
boolean flg = supplyRequestService.saveOrUpdateBatch(supplyRequestList);
|
||||
if (!flg) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentIssuanceOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料发出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/issuance-order")
|
||||
@Slf4j
|
||||
public class DepartmentIssuanceOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentIssuanceOrderService departmentIssuanceOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 发出单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentIssuanceOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发出单单据列表
|
||||
*
|
||||
* @param issuanceOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 发出单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/issuance-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam issuanceOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(issuanceOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
"1", SupplyType.DISPENSING_ORDER.getValue());
|
||||
}
|
||||
/**
|
||||
* 发出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 发出单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/issuance-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentIssuanceOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentProfitLossOrderService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料损益单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/profitLoss-order")
|
||||
@Slf4j
|
||||
public class DepartmentProfitLossOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentProfitLossOrderService departmentProfitLossOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 损益单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentProfitLossOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 损益单单据列表
|
||||
*
|
||||
* @param profitLossOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 损益单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/profitLoss-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam profitLossOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(profitLossOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
null, SupplyType.DEPARTMENT_PRPFITLOSS.getValue());
|
||||
}
|
||||
/**
|
||||
* 损益单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 损益单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/profitLoss-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentProfitLossOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentProfitLossOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑损益单
|
||||
*
|
||||
* @param profitLossOrderDtoList 损益信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-profitLossOrder")
|
||||
public R<?> addOrEditProfitLossOrder(@Validated @RequestBody List<DepartmentDetailDto> profitLossOrderDtoList) {
|
||||
return departmentProfitLossOrderService.addOrEditProfitLossOrder(profitLossOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-profitLossOrder")
|
||||
public R<?> deleteProfitLossOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.profitLossAgreeApproved(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentRequisitionOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料请领单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/requisition-order")
|
||||
@Slf4j
|
||||
public class DepartmentRequisitionOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentRequisitionOrderService departmentRequisitionOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 请领单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentRequisitionOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param requisitionOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam requisitionOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(requisitionOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 请领单单据列表
|
||||
*
|
||||
* @param requisitionOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 请领单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/requisition-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam requisitionOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(requisitionOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
null, SupplyType.DEPARTMENT_REQUISITION.getValue());
|
||||
}
|
||||
/**
|
||||
* 请领单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 请领单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/requisition-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentRequisitionOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentRequisitionOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑采购单
|
||||
*
|
||||
* @param requisitionOrderDtoList 采购信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-requisitionOrder")
|
||||
public R<?> addOrEditRequisitionOrder(@Validated @RequestBody List<DepartmentDetailDto> requisitionOrderDtoList) {
|
||||
return departmentRequisitionOrderService.addOrEditRequisitionOrder(requisitionOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-requisitionOrder")
|
||||
public R<?> deleteRequisitionOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.requisitionOrderAgreeApproval(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReturnToWarehouseOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料退库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/returnToWarehouse-order")
|
||||
@Slf4j
|
||||
public class DepartmentReturnToWarehouseOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentReturnToWarehouseOrderService departmentReturnToWarehouseOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 退库单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentReturnToWarehouseOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退库单单据列表
|
||||
*
|
||||
* @param returnToDispensaryOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 退库单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/returnToDispensary-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam returnToDispensaryOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(returnToDispensaryOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
"1", SupplyType.DEPARTMENT_RETURN.getValue());
|
||||
}
|
||||
/**
|
||||
* 退库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 退库单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/returnToDispensary-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentReturnToWarehouseOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentReturnToWarehouseOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑退库单
|
||||
*
|
||||
* @param returnToDispensaryOrderDtoList 退库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-returnToDispensaryOrder")
|
||||
public R<?> addOrEditReturnToDispensaryOrder(@Validated @RequestBody List<DepartmentDetailDto> returnToDispensaryOrderDtoList) {
|
||||
return departmentReturnToWarehouseOrderService.addOrEditReturnToWarehouseOrder(returnToDispensaryOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-returnToDispensaryOrder")
|
||||
public R<?> deleteReturnToDispensaryOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.returnToWarehouseAgreeApproved(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentStockInOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料入库单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/stockIn-order")
|
||||
@Slf4j
|
||||
public class DepartmentStockInOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentStockInOrderService departmentStockInOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 入库单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentStockInOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 入库单单据列表
|
||||
*
|
||||
* @param stockInOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 入库单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/stockIn-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam stockInOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(stockInOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
null, SupplyType.DEPARTMENT_STOCKIN.getValue());
|
||||
}
|
||||
/**
|
||||
* 入库单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 入库单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/stockIn-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentStockInOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentStockInOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑入库单
|
||||
*
|
||||
* @param stockInOrderDtoList 入库信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-stockInOrder")
|
||||
public R<?> addOrEditStockInOrder(@Validated @RequestBody List<DepartmentDetailDto> stockInOrderDtoList) {
|
||||
return departmentStockInOrderService.addOrEditStockInOrder(stockInOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-stockInOrder")
|
||||
public R<?> deleteStockInOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.stockInOrderAgreeApproved(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentStocktakingOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料盘点单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/stocktaking-order")
|
||||
@Slf4j
|
||||
public class DepartmentStocktakingOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentStocktakingOrderService departmentStocktakingOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
/**
|
||||
* 盘点单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentStocktakingOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 盘点单单据列表
|
||||
*
|
||||
* @param stocktakingOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 盘点单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/stocktaking-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam stocktakingOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(stocktakingOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
null, SupplyType.DEPARTMENT_STOCKTAKING.getValue());
|
||||
}
|
||||
/**
|
||||
* 盘点单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 盘点单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/stocktaking-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentStocktakingOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentStocktakingOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑盘点单
|
||||
*
|
||||
* @param stocktakingOrderDtoList 盘点信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-stocktakingOrder")
|
||||
public R<?> addOrEditStocktakingOrder(@Validated @RequestBody List<DepartmentDetailDto> stocktakingOrderDtoList) {
|
||||
return departmentStocktakingOrderService.addOrEditStocktakingOrder(stocktakingOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-stocktakingOrder")
|
||||
public R<?> deleteStocktakingOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.stocktakingAgreepproved(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentTransferInOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料调入单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/transferIn-order")
|
||||
@Slf4j
|
||||
public class DepartmentTransferInOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentTransferInOrderService departmentTransferInOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
|
||||
/**
|
||||
* 调入单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentTransferInOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
/**
|
||||
* 调入单单据列表
|
||||
*
|
||||
* @param transferInOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 调入单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/transferIn-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam transferInOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(transferInOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
null, SupplyType.DEPARTMENT_TRANSFERIN.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 调入单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调入单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/transferIn-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentTransferInOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentTransferInOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑采购单
|
||||
*
|
||||
* @param transferInOrderDtoList 采购信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-transferInOrder")
|
||||
public R<?> addOrEditTransferInOrder(@Validated @RequestBody List<DepartmentDetailDto> transferInOrderDtoList) {
|
||||
return departmentTransferInOrderService.addOrEditTransferInOrder(transferInOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-transferInOrder")
|
||||
public R<?> deleteTransferInOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.transferInAgreeApproved(busNo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.openhis.web.departmentmanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentCommonService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentReceiptApprovalService;
|
||||
import com.openhis.web.departmentmanage.appservice.IDepartmentTransferOutOrderService;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 科室材料调出单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/department/transferOut-order")
|
||||
@Slf4j
|
||||
public class DepartmentTransferOutOrderController {
|
||||
|
||||
@Autowired
|
||||
private IDepartmentTransferOutOrderService departmentTransferOutOrderService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentCommonService departmentCommonService;
|
||||
|
||||
@Autowired
|
||||
private IDepartmentReceiptApprovalService departmentReceiptApprovalService;
|
||||
|
||||
/**
|
||||
* 调出单初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return departmentTransferOutOrderService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资
|
||||
*
|
||||
* @param purchaseOrderSearchParam 查询条件
|
||||
* @return 物资信息
|
||||
*/
|
||||
@GetMapping(value = "/device-info")
|
||||
public R<?> getDeviceInfo(DepartmentSearchParam purchaseOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getDeviceInfo(purchaseOrderSearchParam, pageNo, pageSize, searchKey, request);
|
||||
}
|
||||
/**
|
||||
* 调出单单据列表
|
||||
*
|
||||
* @param transferOutOrderSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 调出单据分页列表
|
||||
*/
|
||||
@GetMapping(value = "/transferOut-order-page")
|
||||
public R<?> getPage(DepartmentSearchParam transferOutOrderSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return departmentCommonService.getPage(transferOutOrderSearchParam, pageNo, pageSize, searchKey, request,
|
||||
"1", SupplyType.DEPARTMENT_TRANSFEROUT.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 调出单单据详情
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 调出单单据详情
|
||||
*/
|
||||
@GetMapping(value = "/transferOut-order-detail-page")
|
||||
public R<?> getDetail(@RequestParam String busNo,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return departmentTransferOutOrderService.getDetailPage(busNo, pageNo, pageSize);
|
||||
}
|
||||
/**
|
||||
* 获取单据号
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/busNo-init")
|
||||
public R<?> getBusNo() {
|
||||
return departmentTransferOutOrderService.getBusNo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑采购单
|
||||
*
|
||||
* @param transferOutOrderDtoList 采购信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/addOrEdit-transferOutOrder")
|
||||
public R<?> addOrEditTransferOutOrder(@Validated @RequestBody List<DepartmentDetailDto> transferOutOrderDtoList) {
|
||||
return departmentTransferOutOrderService.addOrEditTransferOutOrder(transferOutOrderDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单据
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/delete-transferOutOrder")
|
||||
public R<?> deleteTransferOutOrder(@RequestParam String busNo) {
|
||||
return departmentCommonService.deleteOrder(busNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同意审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/agree-approval")
|
||||
public R<?> agreeApproval(@RequestParam String busNo) {
|
||||
return departmentReceiptApprovalService.transferOutAgreeApproved(busNo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.departmentmanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 单据详细信息
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentDetailDto implements Serializable {
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 单据号 */
|
||||
private String busNo;
|
||||
/** 再生成单据号 */
|
||||
private String originalBusNo;
|
||||
|
||||
/** 药品编码 */
|
||||
private String itemBusNo;
|
||||
|
||||
/** 物品id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/** 物品名称 */
|
||||
private String itemName;
|
||||
|
||||
/** 规格 */
|
||||
private String totalVolume;
|
||||
|
||||
/** 选择单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 常规单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String maxUnitCode;
|
||||
private String maxUnitCode_dictText;
|
||||
|
||||
/** 最小单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String minUnitCode;
|
||||
private String minUnitCode_dictText;
|
||||
|
||||
/** 拆零比 */
|
||||
private String partPercent;
|
||||
|
||||
/** 数量 */
|
||||
private BigDecimal itemQuantity;
|
||||
|
||||
/** 合计数量 */
|
||||
private BigDecimal totalQuantity;
|
||||
|
||||
/** 单价 */
|
||||
private BigDecimal price;
|
||||
|
||||
/** 总价 */
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/** 零售价 */
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
/** 零价金额 */
|
||||
private BigDecimal totalRetailPrice;
|
||||
|
||||
/** 厂家/产地 */
|
||||
private String manufacturerText;
|
||||
|
||||
/** 批准文号 */
|
||||
private String approvalNumber;
|
||||
|
||||
/** 批次库存 */
|
||||
private BigDecimal batchInventory;
|
||||
/** 规格库存 */
|
||||
private BigDecimal specificationInventory;
|
||||
|
||||
/** 备注 */
|
||||
private String remake;
|
||||
|
||||
/** 理由类型 */
|
||||
private String reasonCode;
|
||||
|
||||
/** 摘要(理由) */
|
||||
private String reason;
|
||||
|
||||
/** 供应商 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_supplier")
|
||||
private Long supplierId;
|
||||
private String supplierId_dictText;
|
||||
|
||||
/** 源仓库类型 */
|
||||
private Integer sourceTypeEnum;
|
||||
/** 源仓库 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long sourceLocationId;
|
||||
|
||||
/** 目的仓库类型 */
|
||||
private Integer purposeTypeEnum;
|
||||
/** 目的仓库 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long purposeLocationId;
|
||||
|
||||
/** 采购员 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long applicantId;
|
||||
|
||||
/** 审批人 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long approverId;
|
||||
/** 审批时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date approvalTime;
|
||||
|
||||
/** 申请时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date applyTime;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 类型 */
|
||||
private Integer typeEnum;
|
||||
private String typeEnum_enumText;
|
||||
|
||||
/** 单据分类 */
|
||||
private Integer categoryEnum;
|
||||
private String categoryEnum_enumText;
|
||||
|
||||
/** 供应商联系人 */
|
||||
private String phone;
|
||||
|
||||
/** 仓库员 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
|
||||
/** 发票号 */
|
||||
private String invoiceNo;
|
||||
|
||||
/** 产品批号 */
|
||||
private String lotNumber;
|
||||
|
||||
/** 生产日期 */
|
||||
private Date startTime;
|
||||
|
||||
/** 失效日期 */
|
||||
private Date endTime;
|
||||
|
||||
/** 追溯码*/
|
||||
private String traceNo;
|
||||
|
||||
/** 追溯码单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String traceNoUnitCode;
|
||||
private String traceNoUnitCode_dictText;
|
||||
|
||||
/** 包装情况 */
|
||||
private Integer packagingConditionEnum;
|
||||
private String packagingConditionEnum_enumText;
|
||||
|
||||
/** 验收结果 */
|
||||
private Integer acceptanceResultEnum;
|
||||
private String acceptanceResultEnum_enumText;
|
||||
|
||||
/** 禁用日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date occurrenceTime;
|
||||
|
||||
/** 药品发放id */
|
||||
private String dispenseIds;
|
||||
/**
|
||||
* 单位列表
|
||||
*/
|
||||
private List<Option> unitList;
|
||||
|
||||
@Data
|
||||
public static class Option {
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String value;
|
||||
private String value_dictText;
|
||||
public Option(String value, String value_dictText) {
|
||||
this.value = value;
|
||||
this.value_dictText = value_dictText;
|
||||
}
|
||||
public Option() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.departmentmanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 物资信息
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentDeviceInfoDto implements Serializable {
|
||||
|
||||
/** 物品id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 物品编号 */
|
||||
private String busNo;
|
||||
|
||||
/** 物品名称 */
|
||||
private String name;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 规格 */
|
||||
private String totalVolume;
|
||||
|
||||
/** 包装单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 最小单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String minUnitCode;
|
||||
private String minUnitCode_dictText;
|
||||
|
||||
/** 拆零比 */
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 产品批号 */
|
||||
private String lotNumber;
|
||||
|
||||
|
||||
// /** 价格单位 */
|
||||
// @Dict(dictCode = "unit_code")
|
||||
// private String conditionUnitCode;
|
||||
// private String conditionUnitCode_dictText;
|
||||
|
||||
/** 单价 */
|
||||
private BigDecimal price;
|
||||
|
||||
/** 零售价 */
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
/** 厂家/产地 */
|
||||
private String manufacturerText;
|
||||
|
||||
/** 批准文号 */
|
||||
private String approvalNumber;
|
||||
|
||||
/** 库存最小警戒线 */
|
||||
private BigDecimal itemMinQuantity;
|
||||
|
||||
/** 批次库存 */
|
||||
private BigDecimal batchInventory;
|
||||
/** 规格库存 */
|
||||
private BigDecimal specificationInventory;
|
||||
|
||||
/** 供应商 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_supplier")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long supplierId;
|
||||
private String supplierId_dictText;
|
||||
|
||||
/** 仓库 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 生产日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date productionDate;
|
||||
|
||||
/** 失效日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date expirationDate;
|
||||
|
||||
/**
|
||||
* 单位列表
|
||||
*/
|
||||
private List<Option> unitList;
|
||||
|
||||
@Data
|
||||
public static class Option {
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String value;
|
||||
private String value_dictText;
|
||||
public Option(String value, String value_dictText) {
|
||||
this.value = value;
|
||||
this.value_dictText = value_dictText;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.departmentmanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 单据信息
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentDto implements Serializable {
|
||||
/** 单据号 */
|
||||
private String supplyBusNo;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 类型 */
|
||||
private Integer typeEnum;
|
||||
private String typeEnum_enumText;
|
||||
|
||||
/** 供应商 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_supplier")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long supplierId;
|
||||
private String supplierId_dictText;
|
||||
|
||||
/** 仓库类型 */
|
||||
private Integer locationTypeEnum;
|
||||
private String locationTypeEnum_enumText;
|
||||
|
||||
/** 仓库 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_location")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
private String locationId_dictText;
|
||||
|
||||
/** 采购员 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_practitioner")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long applicantId;
|
||||
private String applicantId_dictText;
|
||||
|
||||
/** 审批人 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_practitioner")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long approverId;
|
||||
private String approverId_dictText;
|
||||
|
||||
/** 审批时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date approvalTime;
|
||||
|
||||
/** 制单日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date applyTime;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.departmentmanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.web.common.dto.LocationDto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 单据初期信息
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentInitDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 单据号
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 库房类型列表
|
||||
*/
|
||||
private List<DispensaryOption> warehouseTypeOption;
|
||||
|
||||
/**
|
||||
* 库房列表
|
||||
*/
|
||||
private List<LongOption> warehouseOption;
|
||||
|
||||
/**
|
||||
* 供应商列表
|
||||
*/
|
||||
private List<SupplierOption> supplierOption;
|
||||
|
||||
/**
|
||||
* 人员列表
|
||||
*/
|
||||
private List<LongOption> practitionerOption;
|
||||
/**
|
||||
* 审批状态
|
||||
*/
|
||||
private List<IntegerOption> supplyStatusOptions;
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
private List<IntegerOption> supplyTypeOptions;
|
||||
|
||||
/**
|
||||
* 单据分类
|
||||
*/
|
||||
private List<IntegerOption> supplyCategoryOptions;
|
||||
/**
|
||||
* 包装情况
|
||||
*/
|
||||
private List<IntegerOption> packagingConditionOptions;
|
||||
/**
|
||||
* 包装情况
|
||||
*/
|
||||
private List<IntegerOption> acceptanceResultoryOptions;
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
private List<LocationDto> WarehouseListOptions;
|
||||
|
||||
/**
|
||||
* 科室
|
||||
*/
|
||||
private List<Organization> departmentListOptions;
|
||||
|
||||
@Data
|
||||
public static class LongOption {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
|
||||
public LongOption(Long value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class SupplierOption {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
private String phone;
|
||||
|
||||
public SupplierOption(Long value, String label, String phone) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
this.phone = phone;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class IntegerOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public IntegerOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DispensaryOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
private List<LocationDto> locationOption;
|
||||
private List<DispensaryItemOption> orderOption;
|
||||
|
||||
public DispensaryOption(Integer value, String label,List<LocationDto> locationOption,List<DispensaryItemOption> orderOption) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
this.locationOption = locationOption;
|
||||
this.orderOption = orderOption;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DispensaryItemOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public DispensaryItemOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.departmentmanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 单据查询条件
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DepartmentSearchParam implements Serializable {
|
||||
/** id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
/** 单据号 */
|
||||
private String busNo;
|
||||
|
||||
/** 采购员 */
|
||||
private String applicantName;
|
||||
|
||||
/** 项目名 */
|
||||
private String name;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 供应商id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long supplierId;
|
||||
|
||||
/** 仓库类型 */
|
||||
private Integer locationTypeEnum;
|
||||
|
||||
/** 仓库 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 类型 */
|
||||
private Integer typeEnum;
|
||||
|
||||
/** 单据状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 再生成单据号flg */
|
||||
private String originalBusNoFlg;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
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.departmentmanage.dto.DepartmentDetailDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDeviceInfoDto;
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentSearchParam;
|
||||
|
||||
/**
|
||||
* 科室材料共通 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentCommonMapper {
|
||||
/**
|
||||
* 根据供应商获取物资
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param locationId 仓库id
|
||||
* @return 物资信息
|
||||
*/
|
||||
|
||||
Page<DepartmentDeviceInfoDto> getDeviceInfo(
|
||||
@Param("page") Page<DepartmentDeviceInfoDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<DepartmentSearchParam> queryWrapper,
|
||||
@Param("locationId") Long locationId, @Param("supplierId") Long supplierId);
|
||||
|
||||
/**
|
||||
* 查询订货单分页列表
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param originalBusNoFlg 再生成单据号flg
|
||||
* @param locationFlg 仓库flg
|
||||
* @return 订货单分页列表
|
||||
*/
|
||||
Page<DepartmentDto> getPage(@Param("page") Page<DepartmentDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<DepartmentSearchParam> queryWrapper,
|
||||
@Param("originalBusNoFlg") String originalBusNoFlg, @Param("locationFlg") String locationFlg);
|
||||
|
||||
/**
|
||||
* 查询单据详情
|
||||
*
|
||||
* @param page 分页
|
||||
* @param busNo 单据号
|
||||
* @return 单据详情
|
||||
*/
|
||||
Page<DepartmentDetailDto> getDetailPage(@Param("page") Page<DepartmentDetailDto> page,
|
||||
@Param("busNo") String busNo);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import com.openhis.web.departmentmanage.dto.DepartmentDetailDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 科室材料发出单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentIssuanceOrderMapper {
|
||||
|
||||
/**
|
||||
* 获取更表所需信息
|
||||
*
|
||||
* @param dispenseIdList 耗材发放id
|
||||
* @param dispenseStatus 发放状态
|
||||
* @return 单据详情
|
||||
*/
|
||||
List<DepartmentDetailDto> getInfo(@Param("dispenseIdList") List<Long> dispenseIdList,@Param("dispenseStatus") Integer dispenseStatus);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料损益单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentProfitLossOrderMapper {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料请领单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentRequisitionOrderMapper {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料退库单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentReturnToWarehouseOrderMapper {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料入库单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentStockInOrderMapper {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料盘点单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentStocktakingOrderMapper {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料调入单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentTransferInOrderMapper {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.openhis.web.departmentmanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 科室材料调出单 mapper
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
@Repository
|
||||
public interface DepartmentTransferOutOrderMapper {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user