层级优化,方法内容优化,字段修改
This commit is contained in:
@@ -3,20 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.datadictionary.assembler;
|
package com.openhis.web.datadictionary.assembler;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.openhis.administration.domain.ChargeItemDefApp;
|
|
||||||
import com.openhis.administration.domain.ChargeItemDefinition;
|
|
||||||
import com.openhis.administration.domain.DeviceDefinition;
|
|
||||||
import com.openhis.medication.domain.MedicationDefinition;
|
|
||||||
import com.openhis.web.datadictionary.dto.ChargeItemDefPageDto;
|
|
||||||
import com.openhis.web.datadictionary.dto.ItemDefSearchParam;
|
|
||||||
import com.openhis.workflow.domain.ActivityDefinition;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 费用定价dto转换器
|
* 费用定价dto转换器
|
||||||
*
|
*
|
||||||
@@ -33,7 +19,7 @@ public class ItemDefinitionAssembler {
|
|||||||
// * @return 【费用定价分页列表DTO】分页
|
// * @return 【费用定价分页列表DTO】分页
|
||||||
// */
|
// */
|
||||||
// public static Page<ChargeItemDefPageDto> assembleMedDefinitionDto(
|
// public static Page<ChargeItemDefPageDto> assembleMedDefinitionDto(
|
||||||
// Page<ChargeItemDefinition> chargeItemDefinitionPage, List<ChargeItemDefApp> chargeItemDefAppList,
|
// Page<ChargeItemDefinition> chargeItemDefinitionPage, List<ChargeItemDefDetail> chargeItemDefAppList,
|
||||||
// List<MedicationDefinition> medicationDefinitionList, ItemDefSearchParam itemDefSearchParam) {
|
// List<MedicationDefinition> medicationDefinitionList, ItemDefSearchParam itemDefSearchParam) {
|
||||||
//
|
//
|
||||||
// // 将查询到的【药品基本信息管理】列表,作成以ID为Key的Map
|
// // 将查询到的【药品基本信息管理】列表,作成以ID为Key的Map
|
||||||
@@ -41,8 +27,8 @@ public class ItemDefinitionAssembler {
|
|||||||
// .collect(Collectors.toMap(MedicationDefinition::getId, Function.identity()));
|
// .collect(Collectors.toMap(MedicationDefinition::getId, Function.identity()));
|
||||||
//
|
//
|
||||||
// // 将查询到的【患者管理】列表,作成以ID为Key的Map
|
// // 将查询到的【患者管理】列表,作成以ID为Key的Map
|
||||||
// Map<Long, ChargeItemDefApp> chargeItemDefAppMap =
|
// Map<Long, ChargeItemDefDetail> chargeItemDefAppMap =
|
||||||
// chargeItemDefAppList.stream().collect(Collectors.toMap(ChargeItemDefApp::getId, Function.identity()));
|
// chargeItemDefAppList.stream().collect(Collectors.toMap(ChargeItemDefDetail::getId, Function.identity()));
|
||||||
//
|
//
|
||||||
// // 定义【入库单据分页列表DTO】的分页,传入【页码】、【行数】、及上面分页的【总数】
|
// // 定义【入库单据分页列表DTO】的分页,传入【页码】、【行数】、及上面分页的【总数】
|
||||||
// Page<ChargeItemDefPageDto> returnPage = new Page<>(chargeItemDefinitionPage.getCurrent(),
|
// Page<ChargeItemDefPageDto> returnPage = new Page<>(chargeItemDefinitionPage.getCurrent(),
|
||||||
@@ -52,8 +38,8 @@ public class ItemDefinitionAssembler {
|
|||||||
// returnPage.setRecords(chargeItemDefinitionPage.getRecords().stream().map(entity -> {
|
// returnPage.setRecords(chargeItemDefinitionPage.getRecords().stream().map(entity -> {
|
||||||
// // 定义【入库单据分页列表DTO】
|
// // 定义【入库单据分页列表DTO】
|
||||||
// ChargeItemDefPageDto dto = new ChargeItemDefPageDto();
|
// ChargeItemDefPageDto dto = new ChargeItemDefPageDto();
|
||||||
// ChargeItemDefApp chargeItemDefApp =
|
// ChargeItemDefDetail chargeItemDefApp =
|
||||||
// chargeItemDefAppMap.getOrDefault(entity.getInstanceId(), new ChargeItemDefApp());
|
// chargeItemDefAppMap.getOrDefault(entity.getInstanceId(), new ChargeItemDefDetail());
|
||||||
// MedicationDefinition medicationDefinition =
|
// MedicationDefinition medicationDefinition =
|
||||||
// medicationDefinitionMap.getOrDefault(entity.getInstanceId(), new MedicationDefinition());
|
// medicationDefinitionMap.getOrDefault(entity.getInstanceId(), new MedicationDefinition());
|
||||||
// // 从主表COPY需要的字段
|
// // 从主表COPY需要的字段
|
||||||
@@ -90,7 +76,7 @@ public class ItemDefinitionAssembler {
|
|||||||
// * @return 【费用定价分页列表DTO】分页
|
// * @return 【费用定价分页列表DTO】分页
|
||||||
// */
|
// */
|
||||||
// public static Page<ChargeItemDefPageDto> assembleDevDefinitionDto(
|
// public static Page<ChargeItemDefPageDto> assembleDevDefinitionDto(
|
||||||
// Page<ChargeItemDefinition> chargeItemDefinitionPage, List<ChargeItemDefApp> chargeItemDefAppList,
|
// Page<ChargeItemDefinition> chargeItemDefinitionPage, List<ChargeItemDefDetail> chargeItemDefAppList,
|
||||||
// List<DeviceDefinition> medicationDefinitionList, ItemDefSearchParam itemDefSearchParam) {
|
// List<DeviceDefinition> medicationDefinitionList, ItemDefSearchParam itemDefSearchParam) {
|
||||||
//
|
//
|
||||||
// // 将查询到的【药品基本信息管理】列表,作成以ID为Key的Map
|
// // 将查询到的【药品基本信息管理】列表,作成以ID为Key的Map
|
||||||
@@ -98,8 +84,8 @@ public class ItemDefinitionAssembler {
|
|||||||
// medicationDefinitionList.stream().collect(Collectors.toMap(DeviceDefinition::getId, Function.identity()));
|
// medicationDefinitionList.stream().collect(Collectors.toMap(DeviceDefinition::getId, Function.identity()));
|
||||||
//
|
//
|
||||||
// // 将查询到的【患者管理】列表,作成以ID为Key的Map
|
// // 将查询到的【患者管理】列表,作成以ID为Key的Map
|
||||||
// Map<Long, ChargeItemDefApp> chargeItemDefAppMap =
|
// Map<Long, ChargeItemDefDetail> chargeItemDefAppMap =
|
||||||
// chargeItemDefAppList.stream().collect(Collectors.toMap(ChargeItemDefApp::getId, Function.identity()));
|
// chargeItemDefAppList.stream().collect(Collectors.toMap(ChargeItemDefDetail::getId, Function.identity()));
|
||||||
//
|
//
|
||||||
// // 定义【入库单据分页列表DTO】的分页,传入【页码】、【行数】、及上面分页的【总数】
|
// // 定义【入库单据分页列表DTO】的分页,传入【页码】、【行数】、及上面分页的【总数】
|
||||||
// Page<ChargeItemDefPageDto> returnPage = new Page<>(chargeItemDefinitionPage.getCurrent(),
|
// Page<ChargeItemDefPageDto> returnPage = new Page<>(chargeItemDefinitionPage.getCurrent(),
|
||||||
@@ -109,8 +95,8 @@ public class ItemDefinitionAssembler {
|
|||||||
// returnPage.setRecords(chargeItemDefinitionPage.getRecords().stream().map(entity -> {
|
// returnPage.setRecords(chargeItemDefinitionPage.getRecords().stream().map(entity -> {
|
||||||
// // 定义【入库单据分页列表DTO】
|
// // 定义【入库单据分页列表DTO】
|
||||||
// ChargeItemDefPageDto dto = new ChargeItemDefPageDto();
|
// ChargeItemDefPageDto dto = new ChargeItemDefPageDto();
|
||||||
// ChargeItemDefApp chargeItemDefApp =
|
// ChargeItemDefDetail chargeItemDefApp =
|
||||||
// chargeItemDefAppMap.getOrDefault(entity.getInstanceId(), new ChargeItemDefApp());
|
// chargeItemDefAppMap.getOrDefault(entity.getInstanceId(), new ChargeItemDefDetail());
|
||||||
// DeviceDefinition deviceDefinition =
|
// DeviceDefinition deviceDefinition =
|
||||||
// deviceDefinitionMap.getOrDefault(entity.getInstanceId(), new DeviceDefinition());
|
// deviceDefinitionMap.getOrDefault(entity.getInstanceId(), new DeviceDefinition());
|
||||||
// // 从主表COPY需要的字段
|
// // 从主表COPY需要的字段
|
||||||
@@ -147,7 +133,7 @@ public class ItemDefinitionAssembler {
|
|||||||
// * @return 【费用定价分页列表DTO】分页
|
// * @return 【费用定价分页列表DTO】分页
|
||||||
// */
|
// */
|
||||||
// public static Page<ChargeItemDefPageDto> assembleProDefinitionDto(
|
// public static Page<ChargeItemDefPageDto> assembleProDefinitionDto(
|
||||||
// Page<ChargeItemDefinition> chargeItemDefinitionPage, List<ChargeItemDefApp> chargeItemDefAppList,
|
// Page<ChargeItemDefinition> chargeItemDefinitionPage, List<ChargeItemDefDetail> chargeItemDefAppList,
|
||||||
// List<ActivityDefinition> medicationDefinitionList, ItemDefSearchParam itemDefSearchParam) {
|
// List<ActivityDefinition> medicationDefinitionList, ItemDefSearchParam itemDefSearchParam) {
|
||||||
//
|
//
|
||||||
// // 将查询到的【药品基本信息管理】列表,作成以ID为Key的Map
|
// // 将查询到的【药品基本信息管理】列表,作成以ID为Key的Map
|
||||||
@@ -155,8 +141,8 @@ public class ItemDefinitionAssembler {
|
|||||||
// medicationDefinitionList.stream().collect(Collectors.toMap(ActivityDefinition::getId, Function.identity()));
|
// medicationDefinitionList.stream().collect(Collectors.toMap(ActivityDefinition::getId, Function.identity()));
|
||||||
//
|
//
|
||||||
// // 将查询到的【患者管理】列表,作成以ID为Key的Map
|
// // 将查询到的【患者管理】列表,作成以ID为Key的Map
|
||||||
// Map<Long, ChargeItemDefApp> chargeItemDefAppMap =
|
// Map<Long, ChargeItemDefDetail> chargeItemDefAppMap =
|
||||||
// chargeItemDefAppList.stream().collect(Collectors.toMap(ChargeItemDefApp::getId, Function.identity()));
|
// chargeItemDefAppList.stream().collect(Collectors.toMap(ChargeItemDefDetail::getId, Function.identity()));
|
||||||
//
|
//
|
||||||
// // 定义【入库单据分页列表DTO】的分页,传入【页码】、【行数】、及上面分页的【总数】
|
// // 定义【入库单据分页列表DTO】的分页,传入【页码】、【行数】、及上面分页的【总数】
|
||||||
// Page<ChargeItemDefPageDto> returnPage = new Page<>(chargeItemDefinitionPage.getCurrent(),
|
// Page<ChargeItemDefPageDto> returnPage = new Page<>(chargeItemDefinitionPage.getCurrent(),
|
||||||
@@ -166,8 +152,8 @@ public class ItemDefinitionAssembler {
|
|||||||
// returnPage.setRecords(chargeItemDefinitionPage.getRecords().stream().map(entity -> {
|
// returnPage.setRecords(chargeItemDefinitionPage.getRecords().stream().map(entity -> {
|
||||||
// // 定义【入库单据分页列表DTO】
|
// // 定义【入库单据分页列表DTO】
|
||||||
// ChargeItemDefPageDto dto = new ChargeItemDefPageDto();
|
// ChargeItemDefPageDto dto = new ChargeItemDefPageDto();
|
||||||
// ChargeItemDefApp chargeItemDefApp =
|
// ChargeItemDefDetail chargeItemDefApp =
|
||||||
// chargeItemDefAppMap.getOrDefault(entity.getInstanceId(), new ChargeItemDefApp());
|
// chargeItemDefAppMap.getOrDefault(entity.getInstanceId(), new ChargeItemDefDetail());
|
||||||
// ActivityDefinition deviceDefinition =
|
// ActivityDefinition deviceDefinition =
|
||||||
// activityDefinitionMap.getOrDefault(entity.getInstanceId(), new ActivityDefinition());
|
// activityDefinitionMap.getOrDefault(entity.getInstanceId(), new ActivityDefinition());
|
||||||
// // 从主表COPY需要的字段
|
// // 从主表COPY需要的字段
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import com.openhis.administration.domain.ChargeItemDefDetail;
|
||||||
import org.apache.ibatis.builder.MapperBuilderAssistant;
|
import org.apache.ibatis.builder.MapperBuilderAssistant;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -26,9 +27,8 @@ import com.core.common.utils.AssignSeqUtil;
|
|||||||
import com.core.common.utils.MessageUtils;
|
import com.core.common.utils.MessageUtils;
|
||||||
import com.core.common.utils.StringUtils;
|
import com.core.common.utils.StringUtils;
|
||||||
import com.core.common.utils.bean.BeanUtils;
|
import com.core.common.utils.bean.BeanUtils;
|
||||||
import com.openhis.administration.domain.ChargeItemDefApp;
|
|
||||||
import com.openhis.administration.domain.ChargeItemDefinition;
|
import com.openhis.administration.domain.ChargeItemDefinition;
|
||||||
import com.openhis.administration.service.IChargeItemDefAppService;
|
import com.openhis.administration.service.IChargeItemDefDetailService;
|
||||||
import com.openhis.administration.service.IChargeItemDefinitionService;
|
import com.openhis.administration.service.IChargeItemDefinitionService;
|
||||||
import com.openhis.common.constant.CommonConstants;
|
import com.openhis.common.constant.CommonConstants;
|
||||||
import com.openhis.common.constant.PromptMsgConstant;
|
import com.openhis.common.constant.PromptMsgConstant;
|
||||||
@@ -55,7 +55,7 @@ public class ItemDefinitionController {
|
|||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private IChargeItemDefinitionService chargeItemDefinitionService;
|
private IChargeItemDefinitionService chargeItemDefinitionService;
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private IChargeItemDefAppService chargeItemDefAppService;
|
private IChargeItemDefDetailService chargeItemDefAppService;
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private ChargeItemDefSearchMapper chargeItemDefSearchMapper;
|
private ChargeItemDefSearchMapper chargeItemDefSearchMapper;
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
@@ -185,11 +185,11 @@ public class ItemDefinitionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新收费项目adm_charge_item_def_app
|
// 更新收费项目adm_charge_item_def_app
|
||||||
ChargeItemDefApp chargeItemDefApp = new ChargeItemDefApp();
|
ChargeItemDefDetail chargeItemDefDetail = new ChargeItemDefDetail();
|
||||||
BeanUtils.copyProperties(itemDefinitionDto, chargeItemDefApp);
|
BeanUtils.copyProperties(itemDefinitionDto, chargeItemDefDetail);
|
||||||
chargeItemDefApp.setDefinitionId(itemDefinitionDto.getId());
|
chargeItemDefDetail.setDefinitionId(itemDefinitionDto.getId());
|
||||||
chargeItemDefApp.setId(itemDefinitionDto.getItemId());
|
chargeItemDefDetail.setId(itemDefinitionDto.getItemId());
|
||||||
return chargeItemDefAppService.updateChargeItemDefApp(chargeItemDefApp)
|
return chargeItemDefAppService.updateChargeItemDefApp(chargeItemDefDetail)
|
||||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"费用定价"}))
|
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"费用定价"}))
|
||||||
: R.fail(PromptMsgConstant.Common.M00007, null);
|
: R.fail(PromptMsgConstant.Common.M00007, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||||
|
*/
|
||||||
|
package com.openhis.web.inventorymanage.appservice;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import com.core.common.core.domain.R;
|
||||||
|
import com.openhis.web.inventorymanage.dto.InventoryReceiptDto;
|
||||||
|
import com.openhis.web.inventorymanage.dto.InventorySearchParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购入库 service
|
||||||
|
*
|
||||||
|
* @author zwh
|
||||||
|
* @date 2025-03-08
|
||||||
|
*/
|
||||||
|
public interface IPurchaseInventoryAppService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单据列表
|
||||||
|
*
|
||||||
|
* @param inventorySearchParam 查询条件
|
||||||
|
* @param pageNo 当前页码
|
||||||
|
* @param pageSize 查询条数
|
||||||
|
* @param searchKey 模糊查询关键字
|
||||||
|
* @param request 请求数据
|
||||||
|
* @return 入库单据分页列表
|
||||||
|
*/
|
||||||
|
R<?> getPage(InventorySearchParam inventorySearchParam, Integer pageNo, Integer pageSize, String searchKey,
|
||||||
|
HttpServletRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单据详情
|
||||||
|
*
|
||||||
|
* @param busNo 单据号
|
||||||
|
* @return 入库单据详情
|
||||||
|
*/
|
||||||
|
R<?> getDetail(String busNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加/编辑入库单据
|
||||||
|
*
|
||||||
|
* @param inventoryReceiptDto 入库单据
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
R<?> addOrEditInventoryReceipt(InventoryReceiptDto inventoryReceiptDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除方法
|
||||||
|
*
|
||||||
|
* @param supplyRequestId 主表id
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
R<?> deleteInventoryReceipt(Long supplyRequestId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交审批
|
||||||
|
*
|
||||||
|
* @param busNo 单据号
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
R<?> submitApproval(String busNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 撤回审批
|
||||||
|
*
|
||||||
|
* @param busNo 单据号
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
R<?> withdrawApproval(String busNo);
|
||||||
|
}
|
||||||
@@ -5,19 +5,20 @@ package com.openhis.web.inventorymanage.appservice;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.openhis.administration.domain.ChargeItemDefApp;
|
|
||||||
import com.openhis.web.inventorymanage.dto.ItemChargeDetailDto;
|
import com.openhis.web.inventorymanage.dto.ItemChargeDetailDto;
|
||||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||||
import com.openhis.workflow.domain.SupplyRequest;
|
import com.openhis.workflow.domain.SupplyRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购入库 service
|
* 单据审批 service
|
||||||
*
|
*
|
||||||
* @author zwh
|
* @author zwh
|
||||||
* @date 2025-03-05
|
* @date 2025-03-05
|
||||||
*/
|
*/
|
||||||
public interface IInventoryManageService {
|
public interface IReceiptApprovalAppService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验单据是否正确
|
* 校验单据是否正确
|
||||||
@@ -45,11 +46,20 @@ public interface IInventoryManageService {
|
|||||||
List<ItemChargeDetailDto> getItemChargeDetail(List<Long> itemIdList);
|
List<ItemChargeDetailDto> getItemChargeDetail(List<Long> itemIdList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库项价格验证
|
* 审批通过
|
||||||
*
|
*
|
||||||
* @param agreedList 供应单据
|
* @param busNo 单据号
|
||||||
* @param chargeDetailList 项目价格
|
* @param request 请求数据
|
||||||
* @return 价格定义子表数据
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
List<ChargeItemDefApp> verifyItemCharge(List<SupplyRequest> agreedList, List<ItemChargeDetailDto> chargeDetailList);
|
R<?> approved(String busNo, HttpServletRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批驳回
|
||||||
|
*
|
||||||
|
* @param busNo 单据号
|
||||||
|
* @param request 请求数据
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
R<?> reject(String busNo, HttpServletRequest request);
|
||||||
}
|
}
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
|
||||||
*/
|
|
||||||
package com.openhis.web.inventorymanage.appservice.impl;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.core.common.core.domain.R;
|
|
||||||
import com.openhis.administration.domain.ChargeItemDefApp;
|
|
||||||
import com.openhis.common.constant.CommonConstants;
|
|
||||||
import com.openhis.common.enums.EventStatus;
|
|
||||||
import com.openhis.web.inventorymanage.appservice.IInventoryManageService;
|
|
||||||
import com.openhis.web.inventorymanage.dto.ItemChargeDetailDto;
|
|
||||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
|
||||||
import com.openhis.web.inventorymanage.mapper.InventoryManageMapper;
|
|
||||||
import com.openhis.workflow.domain.SupplyRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 采购入库 impl
|
|
||||||
*
|
|
||||||
* @author zwh
|
|
||||||
* @date 2025-03-05
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class InventoryManageServiceImpl implements IInventoryManageService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private InventoryManageMapper inventoryManageMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验单据是否正确
|
|
||||||
*
|
|
||||||
* @param supplyRequest 单据信息
|
|
||||||
* @return 校验结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public R<?> verifyInventoryReceipt(SupplyRequest supplyRequest) {
|
|
||||||
|
|
||||||
// // 判断同一物品的批次号是否重复
|
|
||||||
// boolean result = supplyRequestMapper
|
|
||||||
// .exists(new LambdaQueryWrapper<SupplyRequest>().eq(SupplyRequest::getItemId, supplyRequest.getItemId())
|
|
||||||
// .eq(SupplyRequest::getLotNumber, supplyRequest.getLotNumber())
|
|
||||||
// .ne(supplyRequest.getId() != null, SupplyRequest::getId, supplyRequest.getId()));
|
|
||||||
// if (result) {
|
|
||||||
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, new Object[] {"批次号"}));
|
|
||||||
// }
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据单据号获取供应单据及供应项相关详细信息
|
|
||||||
*
|
|
||||||
* @param busNo 单据号
|
|
||||||
* @param itemTable 供应项所在表名
|
|
||||||
* @return 供应单据及供应项相关详细信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<SupplyItemDetailDto> getSupplyItemDetail(String busNo, String itemTable) {
|
|
||||||
|
|
||||||
List<SupplyItemDetailDto> supplyItemDetailList;
|
|
||||||
// 判断供应项是药品还是耗材
|
|
||||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(itemTable)) {
|
|
||||||
supplyItemDetailList = inventoryManageMapper.selectSupplyMedDetail(busNo, EventStatus.COMPLETED.getValue());
|
|
||||||
} else if (CommonConstants.TableName.ADM_DEVICE.equals(itemTable)) {
|
|
||||||
supplyItemDetailList = inventoryManageMapper.selectSupplyDevDetail(busNo, EventStatus.COMPLETED.getValue());
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return supplyItemDetailList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取物品的价格信息
|
|
||||||
*
|
|
||||||
* @param itemIdList 物品id
|
|
||||||
* @return 价格信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<ItemChargeDetailDto> getItemChargeDetail(List<Long> itemIdList) {
|
|
||||||
// todo:未来会移到charge相关的service中
|
|
||||||
if (!itemIdList.isEmpty()) {
|
|
||||||
return inventoryManageMapper.selectChargeDetail(itemIdList);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 入库项价格验证
|
|
||||||
*
|
|
||||||
* @param agreedList 供应单据
|
|
||||||
* @param chargeDetailList 项目价格
|
|
||||||
* @return 价格定义子表数据
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<ChargeItemDefApp> verifyItemCharge(List<SupplyRequest> agreedList,
|
|
||||||
List<ItemChargeDetailDto> chargeDetailList) {
|
|
||||||
|
|
||||||
// todo:价格换算的事情后续补上
|
|
||||||
List<ChargeItemDefApp> resultList = new ArrayList<>();
|
|
||||||
// 创建以项目id为key的map用于匹配对应的供应项目
|
|
||||||
Map<Long, ItemChargeDetailDto> chargeDetailMap =
|
|
||||||
chargeDetailList.stream().collect(Collectors.toMap(ItemChargeDetailDto::getInstanceId, dto -> dto));
|
|
||||||
|
|
||||||
for (SupplyRequest supplyRequest : agreedList) {
|
|
||||||
Long itemId = supplyRequest.getItemId();
|
|
||||||
ItemChargeDetailDto chargeDetail = chargeDetailMap.get(itemId);
|
|
||||||
|
|
||||||
if (chargeDetail == null) {
|
|
||||||
// 未找到匹配的价格项则跳过
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 比较批号是否一致
|
|
||||||
if (!chargeDetail.getConditionLotnumber().equals(supplyRequest.getLotNumber())) {
|
|
||||||
// todo:此时之加入了一条单位价格,需不需要进行大单位小单位的换算,增加两条价格
|
|
||||||
resultList.add(this.addChargeItemDefApp(supplyRequest, chargeDetail));
|
|
||||||
} else {
|
|
||||||
// 检查单位是否匹配
|
|
||||||
if (chargeDetail.getConditionUnitCode().equals(supplyRequest.getUnitCode())) {
|
|
||||||
// 比较价格是否一致
|
|
||||||
if (chargeDetail.getUnitPrice().compareTo(supplyRequest.getPrice()) != 0) {
|
|
||||||
// todo:此时需不需要增加两条价格,进行单位换算
|
|
||||||
resultList.add(this.addChargeItemDefApp(supplyRequest, chargeDetail));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// todo:如果以上换算加入了两条则不存在这种情况,否则需要添加一条批次号相同,单位不同的两条记录(理论上不存在)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return resultList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加项目定价子表信息
|
|
||||||
*
|
|
||||||
* @param supplyRequest 供应申请单
|
|
||||||
* @param itemChargeDetail 项目价格信息
|
|
||||||
* @return 项目定价子表
|
|
||||||
*/
|
|
||||||
private ChargeItemDefApp addChargeItemDefApp(SupplyRequest supplyRequest, ItemChargeDetailDto itemChargeDetail) {
|
|
||||||
ChargeItemDefApp app = new ChargeItemDefApp();
|
|
||||||
app.setAmount(supplyRequest.getPrice()).setConditionLotnumber(supplyRequest.getLotNumber())
|
|
||||||
.setDefinitionId(itemChargeDetail.getDefinitionId()).setConditionUnitCode(supplyRequest.getUnitCode());
|
|
||||||
return app;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
/*
|
||||||
|
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||||
|
*/
|
||||||
|
package com.openhis.web.inventorymanage.appservice.impl;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
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.DateUtils;
|
||||||
|
import com.core.common.utils.MessageUtils;
|
||||||
|
import com.core.common.utils.bean.BeanUtils;
|
||||||
|
import com.openhis.common.constant.CommonConstants;
|
||||||
|
import com.openhis.common.constant.PromptMsgConstant;
|
||||||
|
import com.openhis.common.enums.SupplyCategory;
|
||||||
|
import com.openhis.common.enums.SupplyType;
|
||||||
|
import com.openhis.common.utils.HisPageUtils;
|
||||||
|
import com.openhis.common.utils.HisQueryUtils;
|
||||||
|
import com.openhis.web.inventorymanage.appservice.IPurchaseInventoryAppService;
|
||||||
|
import com.openhis.web.inventorymanage.dto.InventoryReceiptDto;
|
||||||
|
import com.openhis.web.inventorymanage.dto.InventoryReceiptPageDto;
|
||||||
|
import com.openhis.web.inventorymanage.dto.InventorySearchParam;
|
||||||
|
import com.openhis.workflow.domain.SupplyRequest;
|
||||||
|
import com.openhis.workflow.mapper.SupplyRequestMapper;
|
||||||
|
import com.openhis.workflow.service.ISupplyRequestService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购入库 impl
|
||||||
|
*
|
||||||
|
* @author zwh
|
||||||
|
* @date 2025-03-08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SupplyRequestMapper supplyRequestMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISupplyRequestService supplyRequestService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单据列表
|
||||||
|
*
|
||||||
|
* @param inventorySearchParam 查询条件
|
||||||
|
* @param pageNo 当前页码
|
||||||
|
* @param pageSize 查询条数
|
||||||
|
* @param searchKey 模糊查询关键字
|
||||||
|
* @param request 请求数据
|
||||||
|
* @return 入库单据分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> getPage(InventorySearchParam inventorySearchParam, Integer pageNo, Integer pageSize, String searchKey,
|
||||||
|
HttpServletRequest request) {
|
||||||
|
|
||||||
|
// 按照单据号groupBy
|
||||||
|
// 设置模糊查询的字段名
|
||||||
|
HashSet<String> searchFields = new HashSet<>();
|
||||||
|
searchFields.add(CommonConstants.FieldName.BusNo);
|
||||||
|
|
||||||
|
// 构建查询条件
|
||||||
|
QueryWrapper<SupplyRequest> queryWrapper =
|
||||||
|
HisQueryUtils.buildQueryWrapper(inventorySearchParam, searchKey, searchFields, request);
|
||||||
|
// 查询入库单据分页列表
|
||||||
|
Page<InventoryReceiptPageDto> inventoryReceiptPage =
|
||||||
|
HisPageUtils.selectPage(supplyRequestMapper, queryWrapper, pageNo, pageSize, InventoryReceiptPageDto.class);
|
||||||
|
return R.ok(inventoryReceiptPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单据详情
|
||||||
|
*
|
||||||
|
* @param busNo 单据号
|
||||||
|
* @return 入库单据详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> getDetail(String busNo) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加/编辑入库单据
|
||||||
|
*
|
||||||
|
* @param inventoryReceiptDto 入库单据
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> addOrEditInventoryReceipt(InventoryReceiptDto inventoryReceiptDto) {
|
||||||
|
|
||||||
|
// 初始化单据信息
|
||||||
|
SupplyRequest supplyRequest = new SupplyRequest();
|
||||||
|
BeanUtils.copyProperties(inventoryReceiptDto, supplyRequest);
|
||||||
|
|
||||||
|
// // 业务校验
|
||||||
|
// R<?> result = purchaseInventoryService.verifyInventoryReceipt(supplyRequest);
|
||||||
|
// // 校验失败返回提示信息
|
||||||
|
// if (result.getCode() == HttpStatus.ERROR) {
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (inventoryReceiptDto.getId() != null) {
|
||||||
|
// 更新单据信息
|
||||||
|
supplyRequestService.updateById(supplyRequest);
|
||||||
|
} else {
|
||||||
|
// 生成待发送的入库单据
|
||||||
|
supplyRequest
|
||||||
|
// 单据分类:非库存供应
|
||||||
|
.setCategoryEnum(SupplyCategory.NON_STOCK.getValue())
|
||||||
|
// 单据类型:采购入库
|
||||||
|
.setTypeEnum(SupplyType.PURCHASE_INVENTORY.getValue())
|
||||||
|
// 申请时间
|
||||||
|
.setApplyTime(DateUtils.getNowDate());
|
||||||
|
supplyRequestService.save(supplyRequest);
|
||||||
|
}
|
||||||
|
// 返回单据id
|
||||||
|
return R.ok(supplyRequest.getId(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除方法
|
||||||
|
*
|
||||||
|
* @param supplyRequestId 主表id
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> deleteInventoryReceipt(Long supplyRequestId) {
|
||||||
|
// 删除单据
|
||||||
|
boolean result = supplyRequestService.removeById(supplyRequestId);
|
||||||
|
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||||
|
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交审批
|
||||||
|
*
|
||||||
|
* @param busNo 单据号
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> submitApproval(String busNo) {
|
||||||
|
// 单据提交审核
|
||||||
|
boolean result = supplyRequestService.submitApproval(busNo);
|
||||||
|
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||||
|
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 撤回审批
|
||||||
|
*
|
||||||
|
* @param busNo 单据号
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> withdrawApproval(String busNo) {
|
||||||
|
// 撤回审核
|
||||||
|
boolean result = supplyRequestService.withdrawApproval(busNo);
|
||||||
|
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||||
|
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,267 @@
|
|||||||
|
/*
|
||||||
|
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||||
|
*/
|
||||||
|
package com.openhis.web.inventorymanage.appservice.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.core.common.core.domain.R;
|
||||||
|
import com.core.common.core.domain.model.LoginUser;
|
||||||
|
import com.core.common.utils.DateUtils;
|
||||||
|
import com.core.common.utils.MessageUtils;
|
||||||
|
import com.core.framework.web.service.TokenService;
|
||||||
|
import com.openhis.administration.domain.ChargeItem;
|
||||||
|
import com.openhis.administration.domain.ChargeItemDefDetail;
|
||||||
|
import com.openhis.administration.service.IChargeItemDefDetailService;
|
||||||
|
import com.openhis.administration.service.IChargeItemService;
|
||||||
|
import com.openhis.common.constant.CommonConstants;
|
||||||
|
import com.openhis.common.constant.PromptMsgConstant;
|
||||||
|
import com.openhis.common.enums.EventStatus;
|
||||||
|
import com.openhis.web.inventorymanage.appservice.IReceiptApprovalAppService;
|
||||||
|
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.InventoryManageMapper;
|
||||||
|
import com.openhis.workflow.domain.InventoryItem;
|
||||||
|
import com.openhis.workflow.domain.SupplyDelivery;
|
||||||
|
import com.openhis.workflow.domain.SupplyRequest;
|
||||||
|
import com.openhis.workflow.service.IInventoryItemService;
|
||||||
|
import com.openhis.workflow.service.ISupplyDeliveryService;
|
||||||
|
import com.openhis.workflow.service.ISupplyRequestService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单据审批 impl
|
||||||
|
*
|
||||||
|
* @author zwh
|
||||||
|
* @date 2025-03-05
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISupplyRequestService supplyRequestService;
|
||||||
|
@Autowired
|
||||||
|
private ISupplyDeliveryService supplyDeliveryService;
|
||||||
|
@Autowired
|
||||||
|
private IChargeItemDefDetailService chargeItemDefAppService;
|
||||||
|
@Autowired
|
||||||
|
private IInventoryItemService inventoryItemService;
|
||||||
|
@Autowired
|
||||||
|
private IChargeItemService chargeItemService;
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
@Autowired
|
||||||
|
private InventoryManageMapper inventoryManageMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验单据是否正确
|
||||||
|
*
|
||||||
|
* @param supplyRequest 单据信息
|
||||||
|
* @return 校验结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> verifyInventoryReceipt(SupplyRequest supplyRequest) {
|
||||||
|
|
||||||
|
// // 判断同一物品的批次号是否重复
|
||||||
|
// boolean result = supplyRequestMapper
|
||||||
|
// .exists(new LambdaQueryWrapper<SupplyRequest>().eq(SupplyRequest::getItemId, supplyRequest.getItemId())
|
||||||
|
// .eq(SupplyRequest::getLotNumber, supplyRequest.getLotNumber())
|
||||||
|
// .ne(supplyRequest.getId() != null, SupplyRequest::getId, supplyRequest.getId()));
|
||||||
|
// if (result) {
|
||||||
|
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00003, new Object[] {"批次号"}));
|
||||||
|
// }
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据单据号获取供应单据及供应项相关详细信息
|
||||||
|
*
|
||||||
|
* @param busNo 单据号
|
||||||
|
* @param itemTable 供应项所在表名
|
||||||
|
* @return 供应单据及供应项相关详细信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SupplyItemDetailDto> getSupplyItemDetail(String busNo, String itemTable) {
|
||||||
|
|
||||||
|
List<SupplyItemDetailDto> supplyItemDetailList;
|
||||||
|
// 判断供应项是药品还是耗材
|
||||||
|
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(itemTable)) {
|
||||||
|
supplyItemDetailList = inventoryManageMapper.selectSupplyMedDetail(busNo, EventStatus.COMPLETED.getValue());
|
||||||
|
} else if (CommonConstants.TableName.ADM_DEVICE.equals(itemTable)) {
|
||||||
|
supplyItemDetailList = inventoryManageMapper.selectSupplyDevDetail(busNo, EventStatus.COMPLETED.getValue());
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return supplyItemDetailList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取物品的价格信息
|
||||||
|
*
|
||||||
|
* @param itemIdList 物品id
|
||||||
|
* @return 价格信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ItemChargeDetailDto> getItemChargeDetail(List<Long> itemIdList) {
|
||||||
|
// todo:未来会移到charge相关的service中
|
||||||
|
if (!itemIdList.isEmpty()) {
|
||||||
|
return inventoryManageMapper.selectChargeDetail(itemIdList);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批通过
|
||||||
|
*
|
||||||
|
* @param busNo 单据号
|
||||||
|
* @param request 请求数据
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> approved(String busNo, HttpServletRequest request) {
|
||||||
|
// 获取登录者的信息
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
|
// 获取当前时间
|
||||||
|
Date now = DateUtils.getNowDate();
|
||||||
|
|
||||||
|
// 审批单据并返回单据详情
|
||||||
|
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, loginUser, 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 itemTable = supplyRequestService.getItemTable(agreedList);
|
||||||
|
// 获取供应的物品
|
||||||
|
List<Long> itemIdList = supplyRequestService.getItem(agreedList);
|
||||||
|
// 获取项目价格相关信息
|
||||||
|
List<ItemChargeDetailDto> chargeDetailList = this.getItemChargeDetail(itemIdList);
|
||||||
|
List<ChargeItemDefDetail> chargeItemDefDetailList = new ArrayList<>();
|
||||||
|
if (!chargeDetailList.isEmpty()) {
|
||||||
|
// 生成与之前定价不同的定价子表数据
|
||||||
|
chargeItemDefDetailList = this.creatChargeItemDetail(agreedList, chargeDetailList);
|
||||||
|
}
|
||||||
|
if (!chargeItemDefDetailList.isEmpty()) {
|
||||||
|
for (ChargeItemDefDetail chargeItemDefDetail : chargeItemDefDetailList) {
|
||||||
|
// 增加项目定价子表数据
|
||||||
|
chargeItemDefAppService.addChargeItemDefApp(chargeItemDefDetail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询供应项目的详细信息
|
||||||
|
List<SupplyItemDetailDto> supplyItemDetailList = this.getSupplyItemDetail(busNo, itemTable);
|
||||||
|
if (!supplyItemDetailList.isEmpty()) {
|
||||||
|
// 将供应项目的详细信息装配为库存项目和采购账单
|
||||||
|
Pair<List<ChargeItem>, List<InventoryItem>> listPair =
|
||||||
|
InventoryManageAssembler.assembleChargeAndInventory(supplyItemDetailList, now);
|
||||||
|
if (listPair != null) {
|
||||||
|
// 创建已结算的采购财务流水
|
||||||
|
chargeItemService.createBilledPurchaseCharge(listPair.getLeft());
|
||||||
|
// 入库
|
||||||
|
inventoryItemService.stockIn(listPair.getRight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审批驳回
|
||||||
|
*
|
||||||
|
* @param busNo 单据号
|
||||||
|
* @param request 请求数据
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<?> reject(String busNo, HttpServletRequest request) {
|
||||||
|
// 获取当前时间
|
||||||
|
Date now = DateUtils.getNowDate();
|
||||||
|
// 获取登录者的信息
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
|
// 驳回单据
|
||||||
|
boolean result = supplyRequestService.rejectRequest(busNo, loginUser, now);
|
||||||
|
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||||
|
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库项价格验证
|
||||||
|
*
|
||||||
|
* @param agreedList 供应单据
|
||||||
|
* @param chargeDetailList 项目价格
|
||||||
|
* @return 价格定义子表数据
|
||||||
|
*/
|
||||||
|
private List<ChargeItemDefDetail> creatChargeItemDetail(List<SupplyRequest> agreedList,
|
||||||
|
List<ItemChargeDetailDto> chargeDetailList) {
|
||||||
|
List<ChargeItemDefDetail> resultList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 将各个项目的定价信息按项目id分组
|
||||||
|
Map<Long, List<ItemChargeDetailDto>> chargeDetailGroup =
|
||||||
|
chargeDetailList.stream().collect(Collectors.groupingBy(ItemChargeDetailDto::getInstanceId));
|
||||||
|
|
||||||
|
for (SupplyRequest supplyRequest : agreedList) {
|
||||||
|
Long itemId = supplyRequest.getItemId();
|
||||||
|
// 通过供应项目id匹配项目定价
|
||||||
|
List<ItemChargeDetailDto> details = chargeDetailGroup.get(itemId);
|
||||||
|
if (details == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// 生成请求的命中值
|
||||||
|
String lotUnitCondition =
|
||||||
|
String.format(CommonConstants.Common.COMMA, supplyRequest.getLotNumber(), supplyRequest.getUnitCode());
|
||||||
|
String lotMinUnitCondition = String.format(CommonConstants.Common.COMMA, supplyRequest.getLotNumber(),
|
||||||
|
supplyRequest.getMinUnitCode());
|
||||||
|
|
||||||
|
for (ItemChargeDetailDto detail : details) {
|
||||||
|
// 判断请求中的命中值是否命中了定价的条件
|
||||||
|
boolean isConditionMatched = lotUnitCondition.equals(detail.getConditionValue())
|
||||||
|
|| lotMinUnitCondition.equals(detail.getConditionValue());
|
||||||
|
|
||||||
|
// 如果未命中或命中价格不同,则新增数据
|
||||||
|
if (isConditionMatched || !lotUnitCondition.equals(detail.getConditionValue())) {
|
||||||
|
resultList.add(this.addChargeItemDefApp(lotMinUnitCondition, supplyRequest.getMinSellPrice(),
|
||||||
|
detail.getDefinitionId()));
|
||||||
|
resultList.add(this.addChargeItemDefApp(lotUnitCondition, supplyRequest.getSellPrice(),
|
||||||
|
detail.getDefinitionId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加项目定价子表信息
|
||||||
|
*
|
||||||
|
* @param conditionValue 命中值
|
||||||
|
* @param sellPrice 售价
|
||||||
|
* @param definitionId 主表id
|
||||||
|
* @return 子表信息
|
||||||
|
*/
|
||||||
|
private ChargeItemDefDetail addChargeItemDefApp(String conditionValue, BigDecimal sellPrice, Long definitionId) {
|
||||||
|
ChargeItemDefDetail chargeItemDefDetail = new ChargeItemDefDetail();
|
||||||
|
// todo:命中条件或建成字典枚举,此处为批次号,单位
|
||||||
|
chargeItemDefDetail
|
||||||
|
// 命中值
|
||||||
|
.setConditionValue(conditionValue)
|
||||||
|
// 主表id
|
||||||
|
.setDefinitionId(definitionId)
|
||||||
|
// 售价
|
||||||
|
.setAmount(sellPrice);
|
||||||
|
return chargeItemDefDetail;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,33 +3,16 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.inventorymanage.controller;
|
package com.openhis.web.inventorymanage.controller;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
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.core.domain.R;
|
||||||
import com.core.common.utils.DateUtils;
|
import com.openhis.web.inventorymanage.appservice.IPurchaseInventoryAppService;
|
||||||
import com.core.common.utils.MessageUtils;
|
|
||||||
import com.core.common.utils.bean.BeanUtils;
|
|
||||||
import com.openhis.common.constant.CommonConstants;
|
|
||||||
import com.openhis.common.constant.PromptMsgConstant;
|
|
||||||
import com.openhis.common.enums.SupplyCategory;
|
|
||||||
import com.openhis.common.enums.SupplyType;
|
|
||||||
import com.openhis.common.utils.HisPageUtils;
|
|
||||||
import com.openhis.common.utils.HisQueryUtils;
|
|
||||||
import com.openhis.web.inventorymanage.appservice.IInventoryManageService;
|
|
||||||
import com.openhis.web.inventorymanage.dto.InventoryReceiptDto;
|
import com.openhis.web.inventorymanage.dto.InventoryReceiptDto;
|
||||||
import com.openhis.web.inventorymanage.dto.InventoryReceiptPageDto;
|
|
||||||
import com.openhis.web.inventorymanage.dto.InventorySearchParam;
|
import com.openhis.web.inventorymanage.dto.InventorySearchParam;
|
||||||
import com.openhis.workflow.domain.SupplyRequest;
|
|
||||||
import com.openhis.workflow.mapper.SupplyRequestMapper;
|
|
||||||
import com.openhis.workflow.service.ISupplyRequestService;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@@ -45,11 +28,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
public class PurchaseInventoryController {
|
public class PurchaseInventoryController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISupplyRequestService supplyRequestService;
|
private IPurchaseInventoryAppService purchaseInventoryAppService;
|
||||||
@Autowired
|
|
||||||
private IInventoryManageService inventoryManageService;
|
|
||||||
@Autowired
|
|
||||||
private SupplyRequestMapper supplyRequestMapper;
|
|
||||||
|
|
||||||
// @GetMapping(value = "/init")
|
// @GetMapping(value = "/init")
|
||||||
// public R<?> init() {
|
// public R<?> init() {
|
||||||
@@ -86,20 +65,7 @@ public class PurchaseInventoryController {
|
|||||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||||
|
return purchaseInventoryAppService.getPage(inventorySearchParam, pageNo, pageSize, searchKey, request);
|
||||||
// 按照单据号groupBy
|
|
||||||
// 设置模糊查询的字段名
|
|
||||||
HashSet<String> searchFields = new HashSet<>();
|
|
||||||
searchFields.add(CommonConstants.FieldName.BusNo);
|
|
||||||
|
|
||||||
// 构建查询条件
|
|
||||||
QueryWrapper<SupplyRequest> queryWrapper =
|
|
||||||
HisQueryUtils.buildQueryWrapper(inventorySearchParam, searchKey, searchFields, request);
|
|
||||||
// 查询入库单据分页列表
|
|
||||||
Page<InventoryReceiptPageDto> inventoryReceiptPage =
|
|
||||||
HisPageUtils.selectPage(supplyRequestMapper, queryWrapper, pageNo, pageSize, InventoryReceiptPageDto.class);
|
|
||||||
|
|
||||||
return R.ok(inventoryReceiptPage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,10 +74,9 @@ public class PurchaseInventoryController {
|
|||||||
* @param busNo 单据号
|
* @param busNo 单据号
|
||||||
* @return 入库单据详情
|
* @return 入库单据详情
|
||||||
*/
|
*/
|
||||||
|
@GetMapping(value = "/inventory-receipt")
|
||||||
public R<?> getDetail(@RequestParam String busNo) {
|
public R<?> getDetail(@RequestParam String busNo) {
|
||||||
|
return purchaseInventoryAppService.getDetail(busNo);
|
||||||
//
|
|
||||||
return R.ok();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,36 +85,9 @@ public class PurchaseInventoryController {
|
|||||||
* @param inventoryReceiptDto 入库单据
|
* @param inventoryReceiptDto 入库单据
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/inventory-receipt")
|
@PutMapping("/inventory-receipt")
|
||||||
public R<?> addOrEditInventoryReceipt(@Validated @RequestBody InventoryReceiptDto inventoryReceiptDto) {
|
public R<?> addOrEditInventoryReceipt(@Validated @RequestBody InventoryReceiptDto inventoryReceiptDto) {
|
||||||
|
return purchaseInventoryAppService.addOrEditInventoryReceipt(inventoryReceiptDto);
|
||||||
// 初始化单据信息
|
|
||||||
SupplyRequest supplyRequest = new SupplyRequest();
|
|
||||||
BeanUtils.copyProperties(inventoryReceiptDto, supplyRequest);
|
|
||||||
|
|
||||||
// // 业务校验
|
|
||||||
// R<?> result = purchaseInventoryService.verifyInventoryReceipt(supplyRequest);
|
|
||||||
// // 校验失败返回提示信息
|
|
||||||
// if (result.getCode() == HttpStatus.ERROR) {
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (inventoryReceiptDto.getId() != null) {
|
|
||||||
// 更新单据信息
|
|
||||||
supplyRequestService.updateById(supplyRequest);
|
|
||||||
} else {
|
|
||||||
// 生成待发送的入库单据
|
|
||||||
supplyRequest
|
|
||||||
// 单据分类:非库存供应
|
|
||||||
.setCategoryEnum(SupplyCategory.NON_STOCK.getValue())
|
|
||||||
// 单据类型:采购入库
|
|
||||||
.setTypeEnum(SupplyType.PURCHASE_INVENTORY.getValue())
|
|
||||||
// 申请时间
|
|
||||||
.setApplyTime(DateUtils.getNowDate());
|
|
||||||
supplyRequestService.save(supplyRequest);
|
|
||||||
}
|
|
||||||
// 返回单据id
|
|
||||||
return R.ok(supplyRequest.getId(), null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,22 +98,18 @@ public class PurchaseInventoryController {
|
|||||||
*/
|
*/
|
||||||
@DeleteMapping("/inventory-receipt")
|
@DeleteMapping("/inventory-receipt")
|
||||||
public R<?> deleteInventoryReceipt(@RequestParam Long supplyRequestId) {
|
public R<?> deleteInventoryReceipt(@RequestParam Long supplyRequestId) {
|
||||||
// 删除单据
|
return purchaseInventoryAppService.deleteInventoryReceipt(supplyRequestId);
|
||||||
boolean result = supplyRequestService.removeById(supplyRequestId);
|
|
||||||
return result ? R.ok() : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交审批
|
* 提交审批
|
||||||
*
|
*
|
||||||
* @param busNo 单据号
|
* @param busNo 单据号
|
||||||
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
@PutMapping("/submit-approval")
|
@PutMapping("/submit-approval")
|
||||||
public R<?> submitApproval(@RequestParam String busNo) {
|
public R<?> submitApproval(@RequestParam String busNo) {
|
||||||
// 单据提交审核
|
return purchaseInventoryAppService.submitApproval(busNo);
|
||||||
boolean result = supplyRequestService.submitApproval(busNo);
|
|
||||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
|
||||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,9 +120,6 @@ public class PurchaseInventoryController {
|
|||||||
*/
|
*/
|
||||||
@PutMapping("/withdraw-approval")
|
@PutMapping("/withdraw-approval")
|
||||||
public R<?> withdrawApproval(@RequestParam String busNo) {
|
public R<?> withdrawApproval(@RequestParam String busNo) {
|
||||||
// 撤回审核
|
return purchaseInventoryAppService.withdrawApproval(busNo);
|
||||||
boolean result = supplyRequestService.withdrawApproval(busNo);
|
|
||||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
|
||||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.inventorymanage.controller;
|
package com.openhis.web.inventorymanage.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -17,25 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.core.common.core.domain.model.LoginUser;
|
import com.openhis.web.inventorymanage.appservice.IReceiptApprovalAppService;
|
||||||
import com.core.common.utils.DateUtils;
|
|
||||||
import com.core.common.utils.MessageUtils;
|
|
||||||
import com.core.framework.web.service.TokenService;
|
|
||||||
import com.openhis.administration.domain.ChargeItem;
|
|
||||||
import com.openhis.administration.domain.ChargeItemDefApp;
|
|
||||||
import com.openhis.administration.service.IChargeItemDefAppService;
|
|
||||||
import com.openhis.administration.service.IChargeItemService;
|
|
||||||
import com.openhis.common.constant.PromptMsgConstant;
|
|
||||||
import com.openhis.web.inventorymanage.appservice.IInventoryManageService;
|
|
||||||
import com.openhis.web.inventorymanage.assembler.InventoryManageAssembler;
|
|
||||||
import com.openhis.web.inventorymanage.dto.ItemChargeDetailDto;
|
|
||||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
|
||||||
import com.openhis.workflow.domain.InventoryItem;
|
|
||||||
import com.openhis.workflow.domain.SupplyDelivery;
|
|
||||||
import com.openhis.workflow.domain.SupplyRequest;
|
|
||||||
import com.openhis.workflow.service.IInventoryItemService;
|
|
||||||
import com.openhis.workflow.service.ISupplyDeliveryService;
|
|
||||||
import com.openhis.workflow.service.ISupplyRequestService;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@@ -51,93 +28,29 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
public class ReceiptApprovalController {
|
public class ReceiptApprovalController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISupplyRequestService supplyRequestService;
|
private IReceiptApprovalAppService receiptApprovalAppService;
|
||||||
@Autowired
|
|
||||||
private ISupplyDeliveryService supplyDeliveryService;
|
|
||||||
@Autowired
|
|
||||||
private IChargeItemDefAppService chargeItemDefAppService;
|
|
||||||
@Autowired
|
|
||||||
private IInventoryItemService inventoryItemService;
|
|
||||||
@Autowired
|
|
||||||
private IChargeItemService chargeItemService;
|
|
||||||
@Autowired
|
|
||||||
private IInventoryManageService inventoryManageService;
|
|
||||||
@Autowired
|
|
||||||
private TokenService tokenService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批通过
|
* 审批通过
|
||||||
*
|
*
|
||||||
* @param busNo 单据号
|
* @param busNo 单据号
|
||||||
|
* @param request 请求数据
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/approved")
|
@PostMapping("/approved")
|
||||||
public R<?> approved(@RequestParam String busNo, HttpServletRequest request) {
|
public R<?> approved(@RequestParam String busNo, HttpServletRequest request) {
|
||||||
// 获取登录者的信息
|
return receiptApprovalAppService.approved(busNo, request);
|
||||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
|
||||||
// 获取当前时间
|
|
||||||
Date now = DateUtils.getNowDate();
|
|
||||||
|
|
||||||
// 审批单据并返回单据详情
|
|
||||||
List<SupplyRequest> agreedList = supplyRequestService.agreeRequest(busNo, loginUser, 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 itemTable = supplyRequestService.getItemTable(agreedList);
|
|
||||||
// 获取供应的物品
|
|
||||||
List<Long> itemIdList = supplyRequestService.getItem(agreedList);
|
|
||||||
// 获取项目价格相关信息
|
|
||||||
List<ItemChargeDetailDto> chargeDetailList = inventoryManageService.getItemChargeDetail(itemIdList);
|
|
||||||
List<ChargeItemDefApp> chargeItemDefAppList = new ArrayList<>();
|
|
||||||
if (!chargeDetailList.isEmpty()) {
|
|
||||||
// 入库项价格验证(验证项:单位价格,批次号)
|
|
||||||
chargeItemDefAppList = inventoryManageService.verifyItemCharge(agreedList, chargeDetailList);
|
|
||||||
}
|
|
||||||
if (!chargeItemDefAppList.isEmpty()) {
|
|
||||||
for (ChargeItemDefApp chargeItemDefApp : chargeItemDefAppList) {
|
|
||||||
// 增加项目定价子表数据
|
|
||||||
chargeItemDefAppService.addChargeItemDefApp(chargeItemDefApp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询供应项目的详细信息
|
|
||||||
List<SupplyItemDetailDto> supplyItemDetailList = inventoryManageService.getSupplyItemDetail(busNo, itemTable);
|
|
||||||
if (!supplyItemDetailList.isEmpty()) {
|
|
||||||
// 将供应项目的详细信息装配为库存项目和采购账单
|
|
||||||
Pair<List<ChargeItem>, List<InventoryItem>> listPair =
|
|
||||||
InventoryManageAssembler.assembleChargeAndInventory(supplyItemDetailList, now);
|
|
||||||
if (listPair != null) {
|
|
||||||
// 创建已结算的采购财务流水
|
|
||||||
chargeItemService.createBilledPurchaseCharge(listPair.getLeft());
|
|
||||||
// 入库
|
|
||||||
inventoryItemService.stockIn(listPair.getRight());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批驳回
|
* 审批驳回
|
||||||
*
|
*
|
||||||
* @param busNo 单据号
|
* @param busNo 单据号
|
||||||
|
* @param request 请求数据
|
||||||
* @return 操作结果
|
* @return 操作结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/reject")
|
@PostMapping("/reject")
|
||||||
public R<?> reject(@RequestParam String busNo, HttpServletRequest request) {
|
public R<?> reject(@RequestParam String busNo, HttpServletRequest request) {
|
||||||
// 获取当前时间
|
return receiptApprovalAppService.reject(busNo, request);
|
||||||
Date now = DateUtils.getNowDate();
|
|
||||||
// 获取登录者的信息
|
|
||||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
|
||||||
// 驳回单据
|
|
||||||
boolean result = supplyRequestService.rejectRequest(busNo, loginUser, now);
|
|
||||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
|
||||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import java.io.Serializable;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
@@ -15,9 +18,6 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库单据
|
* 入库单据
|
||||||
*
|
*
|
||||||
@@ -116,4 +116,12 @@ public class InventoryReceiptDto implements Serializable {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private BigDecimal totalPrice;
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
/** 售价 */
|
||||||
|
@NotNull
|
||||||
|
private BigDecimal sellPrice;
|
||||||
|
|
||||||
|
/** 拆零售价 */
|
||||||
|
@NotNull
|
||||||
|
private BigDecimal minSellPrice;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class InventoryReceiptInitDto {
|
public class InventoryReceiptInitDto {
|
||||||
|
|
||||||
//返回前台的应是dto 懒得定义请勿学习
|
// 返回前台的应是dto 懒得定义请勿学习
|
||||||
|
|
||||||
/** 药房信息 */
|
/** 药房信息 */
|
||||||
private List<Location> location;
|
private List<Location> location;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ package com.openhis.web.inventorymanage.dto;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.openhis.common.annotation.Dict;
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.inventorymanage.dto;
|
package com.openhis.web.inventorymanage.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目价格详情
|
* 项目价格详情
|
||||||
*
|
*
|
||||||
@@ -27,11 +27,11 @@ public class ItemChargeDetailDto implements Serializable {
|
|||||||
/** 名称 */
|
/** 名称 */
|
||||||
private String chargeName;
|
private String chargeName;
|
||||||
|
|
||||||
/** 批次号 */
|
/** 条件 */
|
||||||
private String conditionLotnumber;
|
private String conditionCode;
|
||||||
|
|
||||||
/** 条件类型 */
|
/** 命中值 */
|
||||||
private String conditionUnitCode;
|
private String conditionValue;
|
||||||
|
|
||||||
/** 单位价格 */
|
/** 单位价格 */
|
||||||
private BigDecimal unitPrice;
|
private BigDecimal unitPrice;
|
||||||
|
|||||||
@@ -91,6 +91,6 @@ public class SupplyItemDetailDto implements Serializable {
|
|||||||
/** 原价 */
|
/** 原价 */
|
||||||
private BigDecimal baseAmount;
|
private BigDecimal baseAmount;
|
||||||
|
|
||||||
/** 费用定价子表ID */
|
/** 定价子表主键 */
|
||||||
private Long applicabilityId;
|
private Long defDetailId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
T1.unit_code AS item_unit,
|
T1.unit_code AS item_unit,
|
||||||
T1.price,
|
T1.price,
|
||||||
T1.total_price,
|
T1.total_price,
|
||||||
|
T1.sell_price,
|
||||||
|
T1.min_sell_price,
|
||||||
T1.approver_id,
|
T1.approver_id,
|
||||||
T1.purpose_location_id,
|
T1.purpose_location_id,
|
||||||
T1.purpose_location_store_id,
|
T1.purpose_location_store_id,
|
||||||
@@ -49,6 +51,8 @@
|
|||||||
T1.unit_code AS item_unit,
|
T1.unit_code AS item_unit,
|
||||||
T1.price,
|
T1.price,
|
||||||
T1.total_price,
|
T1.total_price,
|
||||||
|
T1.sell_price,
|
||||||
|
T1.min_sell_price,
|
||||||
T1.approver_id,
|
T1.approver_id,
|
||||||
T1.purpose_location_id,
|
T1.purpose_location_id,
|
||||||
T1.purpose_location_store_id,
|
T1.purpose_location_store_id,
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ public class CommonConstants {
|
|||||||
* 结束时间(用于分页条件查询)
|
* 结束时间(用于分页条件查询)
|
||||||
*/
|
*/
|
||||||
String E_TIME = "ETime";
|
String E_TIME = "ETime";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逗号(用于拼接)
|
||||||
|
*/
|
||||||
|
String COMMA = "%s,%s";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -6,9 +6,8 @@ import java.util.Date;
|
|||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
import com.core.common.core.domain.HisBaseEntity;
|
import com.core.common.core.domain.HisBaseEntity;
|
||||||
import com.openhis.common.enums.ChargeItemStatus;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@@ -75,7 +74,7 @@ public class ChargeItem extends HisBaseEntity {
|
|||||||
private Long definitionId;
|
private Long definitionId;
|
||||||
|
|
||||||
/** 定价子表主键 */
|
/** 定价子表主键 */
|
||||||
private Long applicabilityId;
|
private Long defDetailId;
|
||||||
|
|
||||||
/** 原价 */
|
/** 原价 */
|
||||||
private BigDecimal baseAmount;
|
private BigDecimal baseAmount;
|
||||||
@@ -122,5 +121,4 @@ public class ChargeItem extends HisBaseEntity {
|
|||||||
/** 机构 */
|
/** 机构 */
|
||||||
private Integer orgId;
|
private Integer orgId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ import lombok.experimental.Accessors;
|
|||||||
* @date 2025-02-20
|
* @date 2025-02-20
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("adm_charge_item_def_app")
|
@TableName("adm_charge_item_def_detail")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class ChargeItemDefApp extends HisBaseEntity {
|
public class ChargeItemDefDetail extends HisBaseEntity {
|
||||||
|
|
||||||
/** ID */
|
/** ID */
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
@@ -34,28 +34,19 @@ public class ChargeItemDefApp extends HisBaseEntity {
|
|||||||
/** 条件规则 */
|
/** 条件规则 */
|
||||||
private Long conditionRuleId;
|
private Long conditionRuleId;
|
||||||
|
|
||||||
/** 批次号 */
|
|
||||||
private String conditionLotnumber;
|
|
||||||
|
|
||||||
/** 医保相关价格 */
|
|
||||||
private String conditionYbCode;
|
|
||||||
|
|
||||||
/** 采购售卖条件 */
|
|
||||||
private String conditionInoutCode;
|
|
||||||
|
|
||||||
/** 条件类型 */
|
|
||||||
private String conditionUnitCode;
|
|
||||||
|
|
||||||
/** 条件 */
|
/** 条件 */
|
||||||
private String conditionCode;
|
private String conditionCode;
|
||||||
|
|
||||||
|
/** 命中值 */
|
||||||
|
private String conditionValue;
|
||||||
|
|
||||||
/** 优先级 */
|
/** 优先级 */
|
||||||
private Integer priority;
|
private Integer priority;
|
||||||
|
|
||||||
/** 价格 */
|
/** 价格 */
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
public ChargeItemDefApp() {
|
public ChargeItemDefDetail() {
|
||||||
// 默认优先级:常规
|
// 默认优先级:常规
|
||||||
this.priority = ActPriority.ROUTINE.getValue();
|
this.priority = ActPriority.ROUTINE.getValue();
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.openhis.administration.mapper;
|
package com.openhis.administration.mapper;
|
||||||
|
|
||||||
|
import com.openhis.administration.domain.ChargeItemDefDetail;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.openhis.administration.domain.ChargeItemDefApp;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 费用定价管理子Mapper接口
|
* 费用定价管理子Mapper接口
|
||||||
@@ -12,6 +12,6 @@ import com.openhis.administration.domain.ChargeItemDefApp;
|
|||||||
* @date 2025-02-20
|
* @date 2025-02-20
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface ChargeItemDefAppMapper extends BaseMapper<ChargeItemDefApp> {
|
public interface ChargeItemDefAppMapper extends BaseMapper<ChargeItemDefDetail> {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.openhis.administration.service;
|
package com.openhis.administration.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.openhis.administration.domain.ChargeItemDefApp;
|
import com.openhis.administration.domain.ChargeItemDefDetail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 费用定价管理子Service接口
|
* 费用定价管理子Service接口
|
||||||
@@ -9,23 +9,23 @@ import com.openhis.administration.domain.ChargeItemDefApp;
|
|||||||
* @author system
|
* @author system
|
||||||
* @date 2025-02-20
|
* @date 2025-02-20
|
||||||
*/
|
*/
|
||||||
public interface IChargeItemDefAppService extends IService<ChargeItemDefApp> {
|
public interface IChargeItemDefDetailService extends IService<ChargeItemDefDetail> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新项目定价
|
* 更新项目定价
|
||||||
*
|
*
|
||||||
* @param chargeItemDefApp 更新内容
|
* @param chargeItemDefDetail 更新内容
|
||||||
* @return 更新结果
|
* @return 更新结果
|
||||||
*/
|
*/
|
||||||
boolean updateChargeItemDefApp(ChargeItemDefApp chargeItemDefApp);
|
boolean updateChargeItemDefApp(ChargeItemDefDetail chargeItemDefDetail);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增费用定价
|
* 新增费用定价
|
||||||
*
|
*
|
||||||
* @param chargeItemDefApp 新增内容
|
* @param chargeItemDefDetail 新增内容
|
||||||
* @return 新增结果
|
* @return 新增结果
|
||||||
*/
|
*/
|
||||||
boolean addChargeItemDefApp(ChargeItemDefApp chargeItemDefApp);
|
boolean addChargeItemDefApp(ChargeItemDefDetail chargeItemDefDetail);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除费用定价
|
* 删除费用定价
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.openhis.administration.service.impl;
|
package com.openhis.administration.service.impl;
|
||||||
|
|
||||||
|
import com.openhis.administration.domain.ChargeItemDefDetail;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.openhis.administration.domain.ChargeItemDefApp;
|
|
||||||
import com.openhis.administration.mapper.ChargeItemDefAppMapper;
|
import com.openhis.administration.mapper.ChargeItemDefAppMapper;
|
||||||
import com.openhis.administration.service.IChargeItemDefAppService;
|
import com.openhis.administration.service.IChargeItemDefDetailService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 费用定价管理子Service业务层处理
|
* 费用定价管理子Service业务层处理
|
||||||
@@ -14,24 +14,24 @@ import com.openhis.administration.service.IChargeItemDefAppService;
|
|||||||
* @date 2025-02-20
|
* @date 2025-02-20
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ChargeItemDefAppServiceImpl extends ServiceImpl<ChargeItemDefAppMapper, ChargeItemDefApp>
|
public class ChargeItemDefDetailServiceImpl extends ServiceImpl<ChargeItemDefAppMapper, ChargeItemDefDetail>
|
||||||
implements IChargeItemDefAppService {
|
implements IChargeItemDefDetailService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新项目定价
|
* 更新项目定价
|
||||||
*
|
*
|
||||||
* @param chargeItemDefApp 更新内容
|
* @param chargeItemDefDetail 更新内容
|
||||||
* @return 更新结果
|
* @return 更新结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean updateChargeItemDefApp(ChargeItemDefApp chargeItemDefApp) {
|
public boolean updateChargeItemDefApp(ChargeItemDefDetail chargeItemDefDetail) {
|
||||||
// 更新样例 一切以实际为主
|
// 更新样例 一切以实际为主
|
||||||
if (chargeItemDefApp.getId() != null) {
|
if (chargeItemDefDetail.getId() != null) {
|
||||||
// 获取更新前收费项目,避免更新导致数据库崩溃
|
// 获取更新前收费项目,避免更新导致数据库崩溃
|
||||||
if (baseMapper.selectById(chargeItemDefApp.getId()) == null) {
|
if (baseMapper.selectById(chargeItemDefDetail.getId()) == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return baseMapper.updateById(chargeItemDefApp) > 0;
|
return baseMapper.updateById(chargeItemDefDetail) > 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -41,16 +41,16 @@ public class ChargeItemDefAppServiceImpl extends ServiceImpl<ChargeItemDefAppMap
|
|||||||
/**
|
/**
|
||||||
* 新增费用定价
|
* 新增费用定价
|
||||||
*
|
*
|
||||||
* @param chargeItemDefApp 新增内容
|
* @param chargeItemDefDetail 新增内容
|
||||||
* @return 新增结果
|
* @return 新增结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean addChargeItemDefApp(ChargeItemDefApp chargeItemDefApp) {
|
public boolean addChargeItemDefApp(ChargeItemDefDetail chargeItemDefDetail) {
|
||||||
// 此判断是为了避免插入时主键重复
|
// 此判断是为了避免插入时主键重复
|
||||||
if (chargeItemDefApp.getId() != null) {
|
if (chargeItemDefDetail.getId() != null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return baseMapper.insert(chargeItemDefApp) > 0;
|
return baseMapper.insert(chargeItemDefDetail) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +71,9 @@ public class SupplyRequest extends HisBaseEntity {
|
|||||||
/** 物品计量单位 */
|
/** 物品计量单位 */
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
|
|
||||||
|
/** 拆零单位 */
|
||||||
|
private String minUnitCode;
|
||||||
|
|
||||||
/** 请求细节 */
|
/** 请求细节 */
|
||||||
private String detailJson;
|
private String detailJson;
|
||||||
|
|
||||||
@@ -137,6 +140,12 @@ public class SupplyRequest extends HisBaseEntity {
|
|||||||
/** 总价 */
|
/** 总价 */
|
||||||
private BigDecimal totalPrice;
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
/** 售价 */
|
||||||
|
private BigDecimal sellPrice;
|
||||||
|
|
||||||
|
/** 拆零售价 */
|
||||||
|
private BigDecimal minSellPrice;
|
||||||
|
|
||||||
public SupplyRequest() {
|
public SupplyRequest() {
|
||||||
// 默认单据类型:商品调拨
|
// 默认单据类型:商品调拨
|
||||||
this.typeEnum = SupplyType.PRODUCT_ALLOCATION.getValue();
|
this.typeEnum = SupplyType.PRODUCT_ALLOCATION.getValue();
|
||||||
|
|||||||
Reference in New Issue
Block a user