@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.ReturnMedicineDto;
|
||||
|
||||
/**
|
||||
* TODO:概括描述当前类的主要用途和注意事项
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
public interface IInHospitalReturnMedicineAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param encounterInfoDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
R<?> getReturnMedicinePatientPage(EncounterInfoDto encounterInfoDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 查询退药信息
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @param refundStatus 退药id
|
||||
* @param itemTable 项目类型
|
||||
* @return 退药信息
|
||||
*/
|
||||
R<?> getReturnMedicineInfo(Long encounterId, Integer refundStatus, String itemTable);
|
||||
|
||||
/**
|
||||
* 退药处理
|
||||
*
|
||||
* @param medicineReturnList 退药清单
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineReturn(List<ReturnMedicineDto> medicineReturnList);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseItemDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||
import com.openhis.web.pharmacymanage.dto.ItemDispenseOrderDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 材料发送 应用实现接口
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/8/21
|
||||
*/
|
||||
public interface IMedicalDeviceDispenseAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 分页查询病人列表
|
||||
*
|
||||
* @param encounterInfoSearchParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 病人列表
|
||||
*/
|
||||
R<?> getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 发耗材单查询
|
||||
*
|
||||
* @param itemDispenseOrderDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 发耗材单
|
||||
*/
|
||||
R<?> getDeviceDispenseOrderList(ItemDispenseOrderDto itemDispenseOrderDto, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 核对发耗材
|
||||
*
|
||||
* @param dispenseDeviceList 发耗材信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> deviceDispense(List<DispenseItemDto> dispenseDeviceList);
|
||||
|
||||
/**
|
||||
* 发放耗材
|
||||
*
|
||||
* @param chargeItemIds 耗材收费单ids
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> dispenseMedicalConsumables(List<Long> chargeItemIds);
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseDeviceList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> deviceCancel(List<DispenseItemDto> dispenseDeviceList);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.MedDetailsSearchParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 发药明细 应用实现接口
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025/4/14
|
||||
*/
|
||||
public interface IMedicationDetailsAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 门诊人员发药明细表
|
||||
*
|
||||
* @param medDetailsSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 门诊发药明细表
|
||||
*/
|
||||
R<?> getAmbPractitionerDetailPage(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request);
|
||||
|
||||
void makeExcelFile(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo, Integer pageSize, String searchKey,
|
||||
HttpServletResponse response, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 门诊发药明细流水账
|
||||
*
|
||||
* @param medDetailsSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 门诊发药明细流水账
|
||||
*/
|
||||
R<?> getAmbMedicationDispenseDetailPage(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo,
|
||||
Integer pageSize, String searchKey, HttpServletRequest request);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 门诊/住院人员发药明细帐、住院耗材记账领用明细
|
||||
// *
|
||||
// * @param medDetailsSearchParam 查询条件
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param request 请求数据
|
||||
// * @return 门诊/住院人员发药明细、住院耗材记账领用明细分页列表
|
||||
// */
|
||||
// R<?> getMedDetailedAccountPage(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo, Integer pageSize,
|
||||
// String searchKey, HttpServletRequest request);
|
||||
//
|
||||
// /**
|
||||
// * 门诊/住院发药明细流水帐、住院耗材记账领用流水账
|
||||
// *
|
||||
// * @param medDetailsSearchParam 查询条件
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param request 请求数据
|
||||
// * @return 门诊/住院发药明细流水帐、住院耗材记账领用流水账分页列表
|
||||
// */
|
||||
// R<?> getMedRunningAccountPage(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo, Integer pageSize,
|
||||
// String searchKey, HttpServletRequest request);
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.PendingMedicationSearchParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 待发药明细 应用实现接口
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025/4/14
|
||||
*/
|
||||
public interface IPendingMedicationDetailsAppService {
|
||||
|
||||
/**
|
||||
* 分页查询待发药明细
|
||||
*
|
||||
* @param pendingMedicationSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 待发药明细
|
||||
*/
|
||||
R<?> getPage(PendingMedicationSearchParam pendingMedicationSearchParam, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.ReturnMedicineDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 退药管理 应用实现接口
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025/4/4
|
||||
*/
|
||||
public interface IReturnMedicineAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param encounterInfoDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
R<?> getReturnMedicinePatientPage(EncounterInfoDto encounterInfoDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 查询退药信息
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @param refundStatus 退药id
|
||||
* @return 退药信息
|
||||
*/
|
||||
R<?> getReturnMedicineInfo(Long encounterId, Integer refundStatus);
|
||||
|
||||
/**
|
||||
* 退药处理
|
||||
*
|
||||
* @param medicineReturnList 退药清单
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineReturn(List<ReturnMedicineDto> medicineReturnList);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 住院汇总发药 应用实现接口
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/6/3
|
||||
*/
|
||||
public interface ISummaryDispenseMedicineAppService {
|
||||
|
||||
/**
|
||||
* 汇总发药
|
||||
*
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> SummaryDispenseMedicine(List<String> summaryNoList);
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> dispenseCancel(List<String> summaryNoList);
|
||||
|
||||
// /**
|
||||
// * 住院发药
|
||||
// *
|
||||
// * @param searchParam 查询条件
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param request 请求数据
|
||||
// */
|
||||
// void makeExcelFile(MedicineSummarySearchParam searchParam, Integer pageNo, Integer pageSize, String searchKey,
|
||||
// HttpServletRequest request, HttpServletResponse response);
|
||||
//
|
||||
// /**
|
||||
// * 住院汇总
|
||||
// *
|
||||
// * @param searchParam 查询条件
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param request 请求数据
|
||||
// */
|
||||
// void takeExcelField(FromSearchParam searchParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
// HttpServletRequest request, HttpServletResponse response);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseItemDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||
import com.openhis.web.pharmacymanage.dto.ItemDispenseOrderDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 处方管理 应用实现接口
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025/3/18
|
||||
*/
|
||||
public interface IWesternMedicineDispenseAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 分页查询病人列表
|
||||
*
|
||||
* @param encounterInfoSearchParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 病人列表
|
||||
*/
|
||||
R<?> getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param itemDispenseOrderDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
R<?> getMedicineDispenseOrderList(ItemDispenseOrderDto itemDispenseOrderDto, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 配药
|
||||
*
|
||||
* @param dispenseMedicineList 配药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicinePrepare(List<DispenseItemDto> dispenseMedicineList);
|
||||
|
||||
/**
|
||||
* 处方单核对发药
|
||||
*
|
||||
* @param dispenseMedicineList 发药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineDispense(List<DispenseItemDto> dispenseMedicineList);
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseMedicineList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineCancel(List<DispenseItemDto> dispenseMedicineList);
|
||||
}
|
||||
@@ -0,0 +1,686 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.exception.ServiceException;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.service.*;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.enums.ybenums.YbInvChgType;
|
||||
import com.openhis.common.enums.ybenums.YbMdtrtCertType;
|
||||
import com.openhis.common.enums.ybenums.YbRxFlag;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.financial.domain.Contract;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.financial.service.IContractService;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
import com.openhis.medication.domain.MedicationDefinition;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.medication.service.IMedicationDefinitionService;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.web.inventorymanage.appservice.impl.ReceiptApprovalAppServiceImpl;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
import com.openhis.web.pharmacymanage.appservice.IInHospitalReturnMedicineAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
import com.openhis.web.pharmacymanage.mapper.InHospitalReturnMedicineAppMapper;
|
||||
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
|
||||
import com.openhis.workflow.domain.DeviceDispense;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IDeviceRequestService;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import com.openhis.yb.domain.ClinicSettle;
|
||||
import com.openhis.yb.dto.Medical3506Param;
|
||||
import com.openhis.yb.dto.MedicalInventory3511Param;
|
||||
import com.openhis.yb.service.IClinicSettleService;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
|
||||
/**
|
||||
* TODO:概括描述当前类的主要用途和注意事项
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@Service
|
||||
public class InHospitalReturnMedicineAppServiceImpl implements IInHospitalReturnMedicineAppService {
|
||||
|
||||
@Resource
|
||||
private ITraceNoManageService traceNoManageService;
|
||||
|
||||
@Resource
|
||||
private IOrganizationService iOrganizationService;
|
||||
|
||||
@Resource
|
||||
private IInventoryItemService iInventoryItemService;
|
||||
|
||||
@Resource
|
||||
private InHospitalReturnMedicineAppMapper inHospitalReturnMedicineAppMapper;
|
||||
|
||||
@Resource
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
@Resource
|
||||
private IMedicationRequestService medicationRequestService;
|
||||
|
||||
@Resource
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
@Resource
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
|
||||
@Resource
|
||||
private IDeviceRequestService deviceRequestService;
|
||||
|
||||
@Resource
|
||||
private YbManager ybService;
|
||||
|
||||
@Resource
|
||||
private IChargeItemService iChargeItemService;
|
||||
|
||||
@Resource
|
||||
private IPaymentReconciliationService iPaymentReconciliationService;
|
||||
|
||||
@Resource
|
||||
private IContractService iContractService;
|
||||
|
||||
@Resource
|
||||
private IClinicSettleService clinicSettleService;
|
||||
|
||||
@Resource
|
||||
private IEncounterDiagnosisService encounterDiagnosisService;
|
||||
|
||||
@Resource
|
||||
private IAccountService accountService;
|
||||
|
||||
@Resource
|
||||
private IDeviceDefinitionService deviceDefinitionService;
|
||||
|
||||
@Resource
|
||||
private IMedicationDefinitionService medicationDefinitionService;
|
||||
|
||||
@Resource
|
||||
private ReceiptApprovalAppServiceImpl receiptApprovalAppService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
ReturnMedicineInitDto initDto = new ReturnMedicineInitDto();
|
||||
|
||||
// 获取科室下拉选列表
|
||||
List<Organization> organizationList =
|
||||
iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), String.valueOf(OrganizationClass.CLINIC.getValue()));
|
||||
List<ReturnMedicineInitDto.DepartmentOption> organizationOptions = organizationList.stream().map(
|
||||
organization -> new ReturnMedicineInitDto.DepartmentOption(organization.getId(), organization.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 发药状态
|
||||
List<ReturnMedicineInitDto.RefundStatusOption> refundStatusOptions = new ArrayList<>();
|
||||
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(DispenseStatus.PENDING_REFUND.getValue(),
|
||||
DispenseStatus.PENDING_REFUND.getInfo()));
|
||||
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(DispenseStatus.REFUNDED.getValue(),
|
||||
DispenseStatus.REFUNDED.getInfo()));
|
||||
initDto.setDepartmentOptions(organizationOptions).setRefundStatusOptions(refundStatusOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param encounterInfoDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getReturnMedicinePatientPage(EncounterInfoDto encounterInfoDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
Integer refundEnum = encounterInfoDto.getRefundEnum();
|
||||
encounterInfoDto.setRefundEnum(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterInfoDto> queryWrapper = HisQueryUtils.buildQueryWrapper(encounterInfoDto, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IdCard,
|
||||
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
|
||||
request);
|
||||
// 查询退药患者分页列表
|
||||
Page<EncounterInfoDto> encounterInfoPage = inHospitalReturnMedicineAppMapper.selectEncounterInfoListPage(
|
||||
new Page<>(pageNo, pageSize), queryWrapper, refundEnum, DispenseStatus.PENDING_REFUND.getValue(),
|
||||
DispenseStatus.REFUNDED.getValue(), EncounterClass.IMP.getValue(),
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
encounterInfoPage.getRecords().forEach(encounterInfo -> {
|
||||
// 性别
|
||||
encounterInfo.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
|
||||
// 年龄
|
||||
encounterInfo.setAge(AgeCalculatorUtil.getAge(encounterInfo.getBirthDate()));
|
||||
// 退药状态
|
||||
encounterInfo
|
||||
.setRefundEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getRefundEnum()));
|
||||
});
|
||||
return R.ok(encounterInfoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退药信息
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @param refundStatus 退药id
|
||||
* @param itemTable 项目类型
|
||||
* @return 退药信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getReturnMedicineInfo(Long encounterId, Integer refundStatus, String itemTable) {
|
||||
// 获取退药信息
|
||||
List<ReturnMedicineInfoDto> returnMedicineInfoList = inHospitalReturnMedicineAppMapper.selectReturnMedicineInfo(
|
||||
encounterId, CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||
itemTable, refundStatus, DispenseStatus.PENDING_REFUND.getValue(), DispenseStatus.REFUNDED.getValue());
|
||||
returnMedicineInfoList.forEach(returnMedicineInfoDto -> {
|
||||
// 退药状态
|
||||
returnMedicineInfoDto.setRefundEnum_enumText(
|
||||
EnumUtils.getInfoByValue(DispenseStatus.class, returnMedicineInfoDto.getRefundEnum()));
|
||||
// 退药请求状态
|
||||
returnMedicineInfoDto.setReqStatus_enumText(
|
||||
EnumUtils.getInfoByValue(RequestStatus.class, returnMedicineInfoDto.getReqStatus()));
|
||||
});
|
||||
return R.ok(returnMedicineInfoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退药处理
|
||||
*
|
||||
* @param medicineReturnList 退药清单
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicineReturn(List<ReturnMedicineDto> medicineReturnList) {
|
||||
if (medicineReturnList == null || medicineReturnList.isEmpty()) {
|
||||
return R.ok();
|
||||
}
|
||||
// 分别处理退药与退耗材的请求
|
||||
List<ReturnMedicineDto> returnMedicineList = new ArrayList<>();
|
||||
List<ReturnMedicineDto> returnDeviceList = new ArrayList<>();
|
||||
// 追溯码列表
|
||||
List<TraceNoManage> traceNoManageList = new ArrayList<>();
|
||||
TraceNoManage traceNoManage;
|
||||
|
||||
medicineReturnList.forEach(item -> {
|
||||
switch (item.getTableName()) {
|
||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST -> returnMedicineList
|
||||
.add(new ReturnMedicineDto().setDispenseId(item.getDispenseId()).setRequestId(item.getRequestId()));
|
||||
case CommonConstants.TableName.WOR_DEVICE_REQUEST -> returnDeviceList
|
||||
.add(new ReturnMedicineDto().setDispenseId(item.getDispenseId()).setRequestId(item.getRequestId()));
|
||||
}
|
||||
});
|
||||
// 进销存参数
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
|
||||
|
||||
// 处理退药
|
||||
// 获取药品退药id列表
|
||||
List<Long> medReturnIdList = new ArrayList<>();
|
||||
if (!returnMedicineList.isEmpty()) {
|
||||
// 获取药品退药id列表
|
||||
medReturnIdList =
|
||||
returnMedicineList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取药品退药请求id列表
|
||||
List<Long> medRequestIdList =
|
||||
returnMedicineList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
|
||||
if (medReturnIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的药品");
|
||||
}
|
||||
if (medRequestIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的药品");
|
||||
}
|
||||
// 药品退药信息查询
|
||||
List<MedicationDispense> refundMedList = medicationDispenseService.listByIds(medReturnIdList);
|
||||
// 药品退药请求查询
|
||||
List<MedicationRequest> refundMedRequestList = medicationRequestService.listByIds(medRequestIdList);
|
||||
if (refundMedList == null || refundMedList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的药品");
|
||||
}
|
||||
// 重复退药校验
|
||||
if (refundMedList.stream().map(MedicationDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
|
||||
throw new ServiceException("药品已退药,请勿重复退药");
|
||||
}
|
||||
|
||||
// 更新退药单
|
||||
for (MedicationDispense medicationDispense : refundMedList) {
|
||||
// 退药状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.REFUNDED.getValue());
|
||||
// 退药数量
|
||||
medicationDispense.setDispenseQuantity(medicationDispense.getQuantity());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
// 退药时间
|
||||
medicationDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 退药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
|
||||
// 设置库存变更参数
|
||||
SupplyItemDetailDto supplyItemDetailDto = new SupplyItemDetailDto();
|
||||
for (MedicationRequest medicationRequest : refundMedRequestList) {
|
||||
// 根据退药id查询退药请求id(用于医保关联)
|
||||
if (medicationDispense.getMedReqId().equals(medicationRequest.getId())) {
|
||||
supplyItemDetailDto.setRequestId(medicationRequest.getRefundMedicineId());
|
||||
}
|
||||
}
|
||||
supplyItemDetailDto.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
.setItemId(medicationDispense.getMedicationId()).setLotNumber(medicationDispense.getLotNumber());
|
||||
supplyItemDetailList.add(supplyItemDetailDto);
|
||||
|
||||
// 追溯码表相关处理
|
||||
if (medicationDispense.getTraceNo() != null) {
|
||||
// 使用逗号分割追溯码并转换为List
|
||||
String[] traceNoList = medicationDispense.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
for (String item : traceNoList) {
|
||||
traceNoManage = new TraceNoManage();
|
||||
// 追溯码处理
|
||||
traceNoManage.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
// 项目id
|
||||
.setItemId(medicationDispense.getMedicationId())
|
||||
// 仓库类型
|
||||
.setLocationTypeEnum(null)
|
||||
// 仓库
|
||||
.setLocationId(medicationDispense.getLocationId())
|
||||
// 仓位
|
||||
.setLocationStoreId(null)
|
||||
// 产品批号
|
||||
.setLotNumber(medicationDispense.getLotNumber())
|
||||
// 追溯码
|
||||
.setTraceNo(item)
|
||||
// 追溯码状态
|
||||
.setStatusEnum(TraceNoStatus.IN.getValue())
|
||||
// 追溯码单位
|
||||
.setUnitCode(medicationDispense.getUnitCode())
|
||||
// 操作类型
|
||||
.setOperationType(SupplyType.RETURN_MEDICATION.getValue());
|
||||
traceNoManageList.add(traceNoManage);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 退药更新
|
||||
medicationDispenseService.updateBatchById(refundMedList);
|
||||
}
|
||||
|
||||
// 处理退耗材
|
||||
// 获取退耗材id列表
|
||||
List<Long> devReturnIdList = new ArrayList<>();
|
||||
if (!returnDeviceList.isEmpty()) {
|
||||
// 获取退耗材id列表
|
||||
devReturnIdList =
|
||||
returnDeviceList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取退耗材请求id列表
|
||||
List<Long> devRequestIdList = returnDeviceList.stream().map(ReturnMedicineDto::getRequestId).toList();
|
||||
if (devReturnIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的耗材");
|
||||
}
|
||||
if (devRequestIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的耗材");
|
||||
}
|
||||
// 退耗材信息查询
|
||||
List<DeviceDispense> refundDevList = deviceDispenseService.listByIds(devReturnIdList);
|
||||
if (refundDevList == null || refundDevList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的耗材");
|
||||
}
|
||||
// 重复退耗材校验
|
||||
if (refundDevList.stream().map(DeviceDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
|
||||
throw new ServiceException("耗材已退,请勿重复操作");
|
||||
}
|
||||
// 更新退耗材单状态
|
||||
for (DeviceDispense deviceDispense : refundDevList) {
|
||||
// 退药时间
|
||||
deviceDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 退药数量
|
||||
deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
|
||||
// 退药状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.REFUNDED.getValue());
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList
|
||||
.add(new SupplyItemDetailDto().setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
.setItemId(deviceDispense.getDeviceDefId()).setLotNumber(deviceDispense.getLotNumber()));
|
||||
// // 使用逗号分割追溯码并转换为List
|
||||
// String[] traceNoList = deviceDispense.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
// for (String item : traceNoList) {
|
||||
// traceNoManage = new TraceNoManage();
|
||||
// // 追溯码处理
|
||||
// traceNoManage.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
// // 项目id
|
||||
// .setItemId(deviceDispense.getDeviceDefId())
|
||||
// // 仓库类型
|
||||
// .setLocationTypeEnum(LocationForm.PHARMACY.getValue())
|
||||
// // 仓库
|
||||
// .setLocationId(deviceDispense.getLocationId())
|
||||
// // 产品批号
|
||||
// .setLotNumber(deviceDispense.getLotNumber())
|
||||
// // 追溯码
|
||||
// .setTraceNo(item)
|
||||
// // 追溯码状态
|
||||
// .setStatusEnum(TraceNoStatus.IN.getValue())
|
||||
// // 追溯码单位
|
||||
// .setUnitCode(deviceDispense.getUnitCode())
|
||||
// // 操作类型
|
||||
// .setOperationType(SupplyType.RETURN_MEDICATION.getValue());
|
||||
// traceNoManageList.add(traceNoManage);
|
||||
// }
|
||||
}
|
||||
deviceDispenseService.updateBatchById(refundDevList);
|
||||
}
|
||||
|
||||
// 追溯码管理表数据追加
|
||||
traceNoManageService.saveBatch(traceNoManageList);
|
||||
|
||||
// 处理退库存
|
||||
// 获取库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList =
|
||||
returnMedicineMapper.selectInventoryInfoList(devReturnIdList, medReturnIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap =
|
||||
unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + CommonConstants.Common.DASH + x.getLocationId()));
|
||||
if (!unDispenseInventoryMap.isEmpty()) {
|
||||
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
|
||||
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
|
||||
if (!inventoryList.isEmpty()) {
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity =
|
||||
unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
}
|
||||
// 理论上不出bug的情况下以项目id,批号,仓库进行分组处理库存一定唯一所以get(0)
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryList.get(0).getInventoryId())
|
||||
.setQuantity(inventoryList.get(0).getInventoryQuantity().add(minQuantity)));
|
||||
}
|
||||
}
|
||||
// 库存更新
|
||||
iInventoryItemService.updateBatchById(inventoryItemList);
|
||||
} else {
|
||||
throw new ServiceException("请检查库存信息");
|
||||
}
|
||||
|
||||
// 处理退药医保
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
List<String> uploadFailedNoList;
|
||||
// 调用医保商品销售退货接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<DeviceDefinition> deviceDefinitions = new ArrayList<>();
|
||||
List<MedicationDefinition> medicationDefinitions = new ArrayList<>();
|
||||
if (!returnMedicineList.isEmpty()) {
|
||||
// 设置进销存参数
|
||||
medicationDefinitions = medicationDefinitionService.listByIds(supplyItemDetailList.stream()
|
||||
.filter(x -> x.getItemTable().equals(CommonConstants.TableName.MED_MEDICATION_DEFINITION))
|
||||
.map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
}
|
||||
if (!returnDeviceList.isEmpty()) {
|
||||
deviceDefinitions = deviceDefinitionService.listByIds(supplyItemDetailList.stream()
|
||||
.filter(x -> x.getItemTable().equals(CommonConstants.TableName.ADM_DEVICE_DEFINITION))
|
||||
.map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// 创建映射表,添加空集合保护
|
||||
Map<Long, MedicationDefinition> medicationMap =
|
||||
medicationDefinitions != null ? medicationDefinitions.stream().filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(MedicationDefinition::getId, Function.identity())) : new HashMap<>();
|
||||
|
||||
Map<Long, DeviceDefinition> deviceMap =
|
||||
deviceDefinitions != null ? deviceDefinitions.stream().filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(DeviceDefinition::getId, Function.identity())) : new HashMap<>();
|
||||
|
||||
// 设置库存变更参数,添加完整判空
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
if (supplyItemDetailDto == null)
|
||||
continue;
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
|
||||
if (supplyItemDetailDto.getItemId() != null) {
|
||||
MedicationDefinition med = medicationMap.get(supplyItemDetailDto.getItemId());
|
||||
if (med != null) {
|
||||
supplyItemDetailDto.setItemBusNo(med.getBusNo()).setPartPercent(med.getPartPercent())
|
||||
.setRxFlag(med.getRxFlag()).setYbNo(med.getYbNo());
|
||||
}
|
||||
}
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
|
||||
if (supplyItemDetailDto.getItemId() != null) {
|
||||
DeviceDefinition dev = deviceMap.get(supplyItemDetailDto.getItemId());
|
||||
if (dev != null) {
|
||||
supplyItemDetailDto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent())
|
||||
.setRxFlag(dev.getRxFlag()).setYbNo(dev.getYbNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
uploadFailedNoList = this.ybReturnIntegrated(medReturnIdList, null);
|
||||
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3506商品销售退货上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3506商品销售退货上传成功";
|
||||
}
|
||||
}
|
||||
// 返回退药成功信息
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"退药"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 医保退药相关进销存接口
|
||||
*
|
||||
* @param dispenseMedIdList 退药id列表
|
||||
* @param dispenseDevIdList 退耗材id列表
|
||||
* @return 上传失败的编号集合
|
||||
*/
|
||||
public List<String> ybReturnIntegrated(List<Long> dispenseMedIdList, List<Long> dispenseDevIdList) {
|
||||
List<String> uploadFailedNoList = new ArrayList<>();
|
||||
R<?> result;
|
||||
if (!dispenseMedIdList.isEmpty() || !dispenseDevIdList.isEmpty()) {
|
||||
// 查询退药项目相关信息
|
||||
List<DispenseInventoryDto> dispenseInventoryList = returnMedicineMapper.selectReturnItemDetail(
|
||||
dispenseDevIdList, dispenseMedIdList, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) {
|
||||
if (dispenseInventoryDto.getYbNo() == null) {
|
||||
continue;
|
||||
}
|
||||
Pair<Medical3506Param, Contract> medical3506Pair = getMedical3506Param(dispenseInventoryDto);
|
||||
// 如果自费则自动取省医保
|
||||
Contract contract = medical3506Pair.getRight();
|
||||
if (contract != null) {
|
||||
if (CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
|
||||
.equals(medical3506Pair.getRight().getBusNo())) {
|
||||
contract = null;
|
||||
}
|
||||
}
|
||||
result = ybService.cancelMerchandise(medical3506Pair.getLeft(), contract);
|
||||
if (result.getCode() != 200) {
|
||||
uploadFailedNoList.add(dispenseInventoryDto.getDispenseNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
return uploadFailedNoList;
|
||||
}
|
||||
|
||||
private Pair<Medical3506Param, Contract> getMedical3506Param(DispenseInventoryDto dispenseInventoryDto) {
|
||||
Medical3506Param medical3506Param = new Medical3506Param();
|
||||
ChargeItem chargeItem = null;
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
// 查询费用结算信息
|
||||
chargeItem = iChargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
|
||||
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.MED_MEDICATION_REQUEST)
|
||||
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getRefundId())
|
||||
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
chargeItem = iChargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
|
||||
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.WOR_DEVICE_REQUEST)
|
||||
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getRefundId())
|
||||
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
|
||||
}
|
||||
if (chargeItem == null) {
|
||||
throw new ServiceException("未查询到收费项");
|
||||
}
|
||||
// 查询就诊诊断信息
|
||||
EncounterDiagnosis encounterDiagnosis = encounterDiagnosisService.getById(chargeItem.getEncounterDiagnosisId());
|
||||
if (encounterDiagnosis == null) {
|
||||
throw new ServiceException("未查找到就诊诊断信息");
|
||||
}
|
||||
// 查询付款信息
|
||||
PaymentReconciliation paymentReconciliation =
|
||||
iPaymentReconciliationService.getOne(new LambdaQueryWrapper<PaymentReconciliation>()
|
||||
.eq(PaymentReconciliation::getEncounterId, chargeItem.getEncounterId())
|
||||
.like(PaymentReconciliation::getChargeItemIds, chargeItem.getId())
|
||||
.eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
|
||||
.eq(PaymentReconciliation::getPatientId, chargeItem.getPatientId())
|
||||
.eq(PaymentReconciliation::getPaymentEnum, PaymentType.PAY.getValue()));
|
||||
if (paymentReconciliation == null) {
|
||||
throw new ServiceException("未查询到收费");
|
||||
}
|
||||
|
||||
// 查询账户信息
|
||||
Account account = accountService
|
||||
.getOne(new LambdaQueryWrapper<Account>().eq(Account::getEncounterId, chargeItem.getEncounterId())
|
||||
.eq(Account::getEncounterFlag, Whether.YES.getValue()));
|
||||
if (account == null) {
|
||||
throw new ServiceException("未查询到账户");
|
||||
}
|
||||
// 查询合同实体
|
||||
Contract contract =
|
||||
iContractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
|
||||
if (contract == null) {
|
||||
throw new ServiceException("未查询到合同信息");
|
||||
}
|
||||
YbMdtrtCertType mdtrtCertType;
|
||||
if (AccountType.PERSONAL_CASH_ACCOUNT.getCode().equals(account.getTypeCode())) {
|
||||
mdtrtCertType = YbMdtrtCertType.MDTRT_CERT_TYPE02;
|
||||
} else {
|
||||
mdtrtCertType = YbMdtrtCertType.getByValue(account.getTypeCode());// 2025/05/28 该值存01/02/03
|
||||
}
|
||||
if (mdtrtCertType == null) {
|
||||
throw new ServiceException("未查询到电子凭证");
|
||||
}
|
||||
// 查询就诊id
|
||||
if (contract.getCategoryEnum().equals(Category.SELF.getValue())
|
||||
|| contract.getCategoryEnum().equals(Category.PUBLIC.getValue())) {
|
||||
medical3506Param.setMdtrtSn(dispenseInventoryDto.getEncounterNo());
|
||||
} else {
|
||||
ClinicSettle clinicSettle = clinicSettleService.getOne(new LambdaQueryWrapper<ClinicSettle>()
|
||||
.in(ClinicSettle::getSetlId, List.of(paymentReconciliation.getYbSettleIds()))
|
||||
.eq(ClinicSettle::getMedType, encounterDiagnosis.getMedTypeCode()).last(" LIMIT 1"));
|
||||
if (clinicSettle != null) {
|
||||
medical3506Param.setMdtrtSn(clinicSettle.getMdtrtId());
|
||||
} else {
|
||||
medical3506Param.setMdtrtSn(dispenseInventoryDto.getEncounterNo());
|
||||
}
|
||||
}
|
||||
// // 查询发票信息
|
||||
// Invoice invoice = iInvoiceService.getById(paymentReconciliation.getInvoiceId());
|
||||
// if (invoice == null) {
|
||||
// throw new ServiceException("未查询到发票信息");
|
||||
// }
|
||||
// 转换为JSON
|
||||
JSONArray medicalTraceNo = new JSONArray();
|
||||
// 获取追溯码信息
|
||||
if (dispenseInventoryDto.getTraceNo() != null) {
|
||||
List<String> traceNoList =
|
||||
Arrays.stream(dispenseInventoryDto.getTraceNo().split(CommonConstants.Common.COMMA)).map(String::trim)
|
||||
.filter(s -> !s.isEmpty()).toList();
|
||||
for (String traceNo : traceNoList) {
|
||||
Map<String, String> traceNoMap = new HashMap<>();
|
||||
traceNoMap.put("drug_trac_codg", traceNo);
|
||||
medicalTraceNo.add(traceNoMap);
|
||||
}
|
||||
}
|
||||
medical3506Param.setMedListCodg(dispenseInventoryDto.getYbNo())
|
||||
.setFixmedinsBchno(dispenseInventoryDto.getRefundId().toString())
|
||||
.setFixmedinsHilistId(dispenseInventoryDto.getItemNo())
|
||||
.setFixmedinsHilistName(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
.setPsnCertType(mdtrtCertType.getValue()).setManuLotnum(dispenseInventoryDto.getLotNumber())
|
||||
.setManuDate(dispenseInventoryDto.getProductionDate())
|
||||
.setSelRetnCnt(new BigDecimal(dispenseInventoryDto.getDispenseQuantity().toString()))
|
||||
.setSelRetnTime(dispenseInventoryDto.getDispenseTime()).setExpyEnd(dispenseInventoryDto.getExpirationDate())
|
||||
.setDrugtracinfo(medicalTraceNo).setCertno(dispenseInventoryDto.getIdCard());
|
||||
// 查看所属医院
|
||||
String fixmedinsCode =
|
||||
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
|
||||
if (dispenseInventoryDto.getPreparerName() == null && HospitalCodeEnum.CCU.getCode().equals(fixmedinsCode)) {
|
||||
medical3506Param.setSelRetnOpterName(CommonConstants.CCU.DisDeviceDoctorName);
|
||||
} else {
|
||||
medical3506Param.setSelRetnOpterName(dispenseInventoryDto.getPreparerName());
|
||||
}
|
||||
if (dispenseInventoryDto.getInventoryUnitCode().equals(dispenseInventoryDto.getDispenseUnitCode())) {
|
||||
medical3506Param.setTrdnFlag(Whether.YES.getCode());
|
||||
} else {
|
||||
medical3506Param.setTrdnFlag(Whether.NO.getCode());
|
||||
}
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == dispenseInventoryDto.getRxFlag()) {
|
||||
medical3506Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == dispenseInventoryDto.getRxFlag()) {
|
||||
medical3506Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == dispenseInventoryDto.getRxFlag()) {
|
||||
medical3506Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
medical3506Param.setFixmedinsHilistName(CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
medical3506Param.setFixmedinsHilistName(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
}
|
||||
return Pair.of(medical3506Param, contract);
|
||||
}
|
||||
|
||||
private MedicalInventory3511Param getMedical3511Param(DispenseInventoryDto dispenseInventoryDto) {
|
||||
MedicalInventory3511Param medicalInventory3511Param = new MedicalInventory3511Param();
|
||||
|
||||
String fixmedinsCode =
|
||||
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
|
||||
// TODO
|
||||
medicalInventory3511Param.setFixmedinsCode(fixmedinsCode).setMedinsListCodg(dispenseInventoryDto.getYbNo())
|
||||
.setFixmedinsBchno(dispenseInventoryDto.getLotNumber()).setBegndate(dispenseInventoryDto.getDispenseTime())
|
||||
.setEnddate(dispenseInventoryDto.getDispenseTime());
|
||||
|
||||
return medicalInventory3511Param;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,562 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.exception.ServiceException;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.domain.TraceNoManage;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.administration.service.IDeviceDefinitionService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.administration.service.ITraceNoManageService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.inventorymanage.appservice.impl.ReceiptApprovalAppServiceImpl;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
import com.openhis.web.pharmacymanage.appservice.IMedicalDeviceDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
import com.openhis.web.pharmacymanage.mapper.MedicalDeviceDispenseMapper;
|
||||
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
|
||||
import com.openhis.workflow.domain.DeviceDispense;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* 材料发送 应用实现类
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/8/21
|
||||
*/
|
||||
@Service
|
||||
public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispenseAppService {
|
||||
|
||||
@Resource
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Resource
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
|
||||
@Resource
|
||||
private IInventoryItemService inventoryItemService;
|
||||
|
||||
@Resource
|
||||
private MedicalDeviceDispenseMapper medicalDeviceDispenseMapper;
|
||||
|
||||
@Resource
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
@Resource
|
||||
private ITraceNoManageService traceNoManageService;
|
||||
|
||||
@Resource
|
||||
private WesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppService;
|
||||
|
||||
@Resource
|
||||
private IChargeItemService chargeItemService;
|
||||
|
||||
@Resource
|
||||
private IDeviceDefinitionService deviceDefinitionService;
|
||||
|
||||
@Resource
|
||||
private ReceiptApprovalAppServiceImpl receiptApprovalAppService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DispenseInitDto initDto = new DispenseInitDto();
|
||||
|
||||
// 获取科室下拉选列表
|
||||
List<Organization> organizationList
|
||||
= organizationService.getList(OrganizationType.DEPARTMENT.getValue(), String.valueOf(OrganizationClass.CLINIC.getValue()));
|
||||
List<DispenseInitDto.DepartmentOption> organizationOptions = organizationList.stream()
|
||||
.map(organization -> new DispenseInitDto.DepartmentOption(organization.getId(), organization.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取配药人下拉选列表
|
||||
List<Practitioner> preparerDoctorList
|
||||
= medicalDeviceDispenseMapper.getPreparerDoctorList(PractitionerRoles.PHARMACIST.getCode());
|
||||
List<DispenseInitDto.PreparerDoctorOption> preparerDoctorOptions = preparerDoctorList.stream()
|
||||
.map(practitioner -> new DispenseInitDto.PreparerDoctorOption(practitioner.getId(), practitioner.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 未发药原因下拉选列表
|
||||
List<DispenseInitDto.NotPerformedReasonOption> notPerformedReasonOptions
|
||||
= Stream.of(NotPerformedReasonEnum.values())
|
||||
.map(notPerformedReason -> new DispenseInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
|
||||
notPerformedReason.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 发药状态
|
||||
List<DispenseStatusOption> dispenseStatusOptions = new ArrayList<>();
|
||||
dispenseStatusOptions.add(new DispenseStatusOption(DispenseStatus.IN_PROGRESS.getValue(),
|
||||
DispenseStatus.IN_PROGRESS.getInfo()));
|
||||
dispenseStatusOptions.add(new DispenseStatusOption(DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.COMPLETED.getInfo()));
|
||||
|
||||
initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions)
|
||||
.setDispenseStatusOptions(dispenseStatusOptions).setPreparerDoctorOptions(preparerDoctorOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询病人列表
|
||||
*
|
||||
* @param encounterInfoSearchParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 病人列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 发药状态初始化
|
||||
Integer statusEnum = encounterInfoSearchParam.getStatusEnum();
|
||||
encounterInfoSearchParam.setStatusEnum(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterInfoSearchParam> queryWrapper
|
||||
= HisQueryUtils.buildQueryWrapper(encounterInfoSearchParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IdCard,
|
||||
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
|
||||
request);
|
||||
// 查询就诊病人列表
|
||||
Page<EncounterInfoDto> encounterInfoPage
|
||||
= medicalDeviceDispenseMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
statusEnum, DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue());
|
||||
encounterInfoPage.getRecords().forEach(encounterInfo -> {
|
||||
// 性别
|
||||
encounterInfo.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
|
||||
// 发药状态
|
||||
encounterInfo
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getStatusEnum()));
|
||||
if (encounterInfo.getBirthDate() != null) {
|
||||
// 计算年龄
|
||||
encounterInfo.setAge(AgeCalculatorUtil.getAge(encounterInfo.getBirthDate()));
|
||||
}
|
||||
});
|
||||
return R.ok(encounterInfoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发耗材单查询
|
||||
*
|
||||
* @param itemDispenseOrderDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 发耗材单
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDeviceDispenseOrderList(ItemDispenseOrderDto itemDispenseOrderDto, Integer pageNo,
|
||||
Integer pageSize) {
|
||||
// 发药状态初始化
|
||||
Integer dispenseStatus = itemDispenseOrderDto.getStatusEnum();
|
||||
itemDispenseOrderDto.setStatusEnum(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<ItemDispenseOrderDto> queryWrapper
|
||||
= HisQueryUtils.buildQueryWrapper(itemDispenseOrderDto, null, null, null);
|
||||
// 处方单信息查询
|
||||
Page<ItemDispenseOrderDto> deviceDispenseOrderPage
|
||||
= medicalDeviceDispenseMapper.selectDeviceDispenseOrderPage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue(), dispenseStatus);
|
||||
deviceDispenseOrderPage.getRecords().forEach(deviceDispenseOrder -> {
|
||||
// 发药状态
|
||||
deviceDispenseOrder.setStatusEnum_enumText(
|
||||
EnumUtils.getInfoByValue(DispenseStatus.class, deviceDispenseOrder.getStatusEnum()));
|
||||
// 设置所在表名
|
||||
deviceDispenseOrder.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
});
|
||||
return R.ok(deviceDispenseOrderPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核对发耗材
|
||||
*
|
||||
* @param dispenseDeviceList 发耗材信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deviceDispense(List<DispenseItemDto> dispenseDeviceList) {
|
||||
// 配药人检查
|
||||
if (dispenseDeviceList.get(0).getPreparerId() == null
|
||||
|| dispenseDeviceList.get(0).getPreparerId().equals(SecurityUtils.getLoginUser().getPractitionerId())) {
|
||||
return R.fail("请选择调配药师");
|
||||
}
|
||||
// 获取发药单id列表
|
||||
List<Long> devDispenseIdList
|
||||
= dispenseDeviceList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
|
||||
|
||||
// 获取耗材待发放库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList
|
||||
= returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap
|
||||
= unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + CommonConstants.Common.DASH + x.getLocationId()));
|
||||
if (!unDispenseInventoryMap.isEmpty()) {
|
||||
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
|
||||
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
|
||||
if (!inventoryList.isEmpty()) {
|
||||
if (inventoryList.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 停供库存校验
|
||||
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
// 库存数量
|
||||
BigDecimal inventoryQuantity = BigDecimal.ZERO;
|
||||
// 库存id
|
||||
Long inventoryId = null;
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity
|
||||
= unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
|
||||
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
|
||||
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
|
||||
inventoryId = unDispenseInventoryDto.getInventoryId();
|
||||
}
|
||||
}
|
||||
if (minQuantity.compareTo(inventoryQuantity) > 0) {
|
||||
// 库存不足
|
||||
return R.fail(inventoryList.get(0).getItemName() + "批号库存不足");
|
||||
} else {
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryId)
|
||||
.setQuantity(inventoryQuantity.subtract(minQuantity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 材料发放信息查询
|
||||
List<DeviceDispense> dispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
// 追溯码列表
|
||||
List<TraceNoManage> tracesNoManageList = new ArrayList<>();
|
||||
TraceNoManage traceNoManage;
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
|
||||
if (dispenseList != null) {
|
||||
if (dispenseList.stream().map(DeviceDispense::getStatusEnum)
|
||||
.anyMatch(x -> !x.equals(DispenseStatus.PREPARATION.getValue()))) {
|
||||
throw new ServiceException("耗材发放失败,请检查发耗材单状态");
|
||||
} else {
|
||||
for (DeviceDispense deviceDispense : dispenseList) {
|
||||
// 材料发放状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 发药数量
|
||||
deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
|
||||
// 发药时间
|
||||
deviceDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 发药人
|
||||
deviceDispense.setPerformerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
// 配药时间
|
||||
deviceDispense.setPrepareTime(DateUtils.getNowDate());
|
||||
// 配药人
|
||||
deviceDispense.setPreparerId(dispenseDeviceList.get(0).getPreparerId());
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(deviceDispense.getDeviceDefId())
|
||||
.setLotNumber(deviceDispense.getLotNumber())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
.setDispenseId(deviceDispense.getId()));
|
||||
if (deviceDispense.getTraceNo() == null) {
|
||||
// 根据数量设置追溯码
|
||||
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA, Collections
|
||||
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
|
||||
} else {
|
||||
// 使用逗号分割追溯码并转换为List
|
||||
String[] traceNoList = deviceDispense.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
for (String item : traceNoList) {
|
||||
traceNoManage = new TraceNoManage();
|
||||
// 追溯码处理
|
||||
traceNoManage.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
// 项目id
|
||||
.setItemId(deviceDispense.getDeviceDefId())
|
||||
// 仓库类型
|
||||
.setLocationTypeEnum(LocationForm.WAREHOUSE.getValue())
|
||||
// 仓库
|
||||
.setLocationId(deviceDispense.getLocationId())
|
||||
// 产品批号
|
||||
.setLotNumber(deviceDispense.getLotNumber())
|
||||
// 追溯码
|
||||
.setTraceNo(item)
|
||||
// 追溯码状态
|
||||
.setStatusEnum(TraceNoStatus.OUT.getValue())
|
||||
// 追溯码单位
|
||||
.setUnitCode(deviceDispense.getUnitCode())
|
||||
// 操作类型
|
||||
.setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
|
||||
tracesNoManageList.add(traceNoManage);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 药品发放更新
|
||||
deviceDispenseService.updateBatchById(dispenseList);
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 库存更新
|
||||
inventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 追溯码管理表数据追加
|
||||
traceNoManageService.saveBatch(tracesNoManageList);
|
||||
// // 返回信息
|
||||
// String returnMsg = null;
|
||||
// List<String> uploadFailedNoList;
|
||||
// // 调用医保商品销售接口
|
||||
// String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
// // 医保开关
|
||||
// if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// // 设置进销存参数
|
||||
// List<DeviceDefinition> deviceDefinitions = deviceDefinitionService.listByIds(
|
||||
// supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
// // 用itemId分组
|
||||
// Map<Long, DeviceDefinition> deviceMap =
|
||||
// deviceDefinitions.stream().collect(Collectors.toMap(DeviceDefinition::getId, Function.identity()));
|
||||
// // 设置库存变更参数
|
||||
// for (SupplyItemDetailDto dto : supplyItemDetailList) {
|
||||
// if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dto.getItemTable())) {
|
||||
// DeviceDefinition dev = deviceMap.get(dto.getItemId());
|
||||
// if (dev != null) {
|
||||
// dto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent()).setRxFlag(dev.getRxFlag())
|
||||
// .setYbNo(dev.getYbNo());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// uploadFailedNoList = westernMedicineDispenseAppService.ybMedicineIntegrated(null, devDispenseIdList);
|
||||
// uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
// YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
// if (uploadFailedNoList != null) {
|
||||
// returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
// } else {
|
||||
// returnMsg = "3505商品销售上传成功";
|
||||
// }
|
||||
// }
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发放耗材
|
||||
*
|
||||
* @param chargeItemIds 耗材收费单ids
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> dispenseMedicalConsumables(List<Long> chargeItemIds) {
|
||||
// 查看所属医院
|
||||
String fixmedinsCode
|
||||
= SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
|
||||
if (!HospitalCodeEnum.CCU.getCode().equals(fixmedinsCode)) {
|
||||
return R.ok();
|
||||
}
|
||||
List<ChargeItem> chargeItemList = chargeItemService.listByIds(chargeItemIds);
|
||||
if (chargeItemList == null || chargeItemList.isEmpty()) {
|
||||
return R.fail("未查询到耗材收费项目信息");
|
||||
}
|
||||
|
||||
// 获取发申请id列表
|
||||
List<Long> devRequestIdList
|
||||
= chargeItemList.stream().map(ChargeItem::getServiceId).collect(Collectors.toList());
|
||||
// 获取耗材发放id列表
|
||||
List<Long> devDispenseIdList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getDeviceReqId, devRequestIdList))
|
||||
.stream().map(DeviceDispense::getId).collect(Collectors.toList());
|
||||
|
||||
// 获取耗材待发放库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList
|
||||
= returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap
|
||||
= unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + CommonConstants.Common.DASH + x.getLocationId()));
|
||||
if (!unDispenseInventoryMap.isEmpty()) {
|
||||
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
|
||||
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
|
||||
if (!inventoryList.isEmpty()) {
|
||||
if (inventoryList.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 停供库存校验
|
||||
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
// 库存数量
|
||||
BigDecimal inventoryQuantity = BigDecimal.ZERO;
|
||||
// 库存id
|
||||
Long inventoryId = null;
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity
|
||||
= unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
|
||||
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
|
||||
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
|
||||
inventoryId = unDispenseInventoryDto.getInventoryId();
|
||||
}
|
||||
}
|
||||
if (minQuantity.compareTo(inventoryQuantity) > 0) {
|
||||
// 库存不足
|
||||
return R.fail(inventoryList.get(0).getItemName() + "批号库存不足");
|
||||
} else {
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryId)
|
||||
.setQuantity(inventoryQuantity.subtract(minQuantity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 发耗材信息查询
|
||||
List<DeviceDispense> dispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
|
||||
if (dispenseList != null) {
|
||||
if (dispenseList.stream().map(DeviceDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.COMPLETED.getValue()))) {
|
||||
throw new ServiceException("耗材已发放,请勿重复操作");
|
||||
} else {
|
||||
for (DeviceDispense deviceDispense : dispenseList) {
|
||||
// 耗材发放状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 发药数量
|
||||
deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
|
||||
// 发药时间
|
||||
deviceDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 发药人(长大写死发耗材人)
|
||||
deviceDispense.setPerformerId(CommonConstants.CCU.DisDeviceDoctor);
|
||||
// 根据数量设置追溯码
|
||||
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA, Collections
|
||||
.nCopies(deviceDispense.getQuantity().intValue(), CommonConstants.Common.DEV_TRACE_NO)));
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(deviceDispense.getDeviceDefId())
|
||||
.setLotNumber(deviceDispense.getLotNumber())
|
||||
.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION));
|
||||
}
|
||||
// 药品发放更新
|
||||
deviceDispenseService.updateBatchById(dispenseList);
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 库存更新
|
||||
inventoryItemService.updateBatchById(inventoryItemList);
|
||||
// // 返回信息
|
||||
// String returnMsg = null;
|
||||
// // 调用医保商品销售接口
|
||||
// String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
// List<String> uploadFailedNoList = new ArrayList<>();
|
||||
// // 医保开关
|
||||
// if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// // 设置进销存参数
|
||||
// List<DeviceDefinition> deviceDefinitions = deviceDefinitionService.listByIds(
|
||||
// supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
// // 用itemId分组
|
||||
// Map<Long, DeviceDefinition> deviceMap =
|
||||
// deviceDefinitions.stream().collect(Collectors.toMap(DeviceDefinition::getId, Function.identity()));
|
||||
// // 设置库存变更参数
|
||||
// for (SupplyItemDetailDto dto : supplyItemDetailList) {
|
||||
// if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dto.getItemTable())) {
|
||||
// DeviceDefinition dev = deviceMap.get(dto.getItemId());
|
||||
// if (dev != null) {
|
||||
// dto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent()).setRxFlag(dev.getRxFlag())
|
||||
// .setYbNo(dev.getYbNo());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// uploadFailedNoList = westernMedicineDispenseAppService.ybMedicineIntegrated(null, devDispenseIdList);
|
||||
// uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
// YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
// if (uploadFailedNoList != null) {
|
||||
// returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
// } else {
|
||||
// returnMsg = "3505商品销售上传成功";
|
||||
// }
|
||||
// }
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseDeviceList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deviceCancel(List<DispenseItemDto> dispenseDeviceList) {
|
||||
// 获取发材料单id列表
|
||||
List<Long> devDispenseIdList
|
||||
= dispenseDeviceList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
|
||||
// 材料发放信息查询
|
||||
List<DeviceDispense> dispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
if (dispenseList != null) {
|
||||
for (DeviceDispense medicationDispense : dispenseList) {
|
||||
// 材料发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||
// 未发药原因
|
||||
medicationDispense.setNotPerformedReasonEnum(dispenseDeviceList.get(0).getNotPerformedReasonEnum());
|
||||
}
|
||||
// 药品发放更新
|
||||
deviceDispenseService.updateBatchById(dispenseList);
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.core.domain.entity.SysDictData;
|
||||
import com.core.common.exception.NonCaptureException;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
import com.core.system.service.ISysDictTypeService;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.enums.ConditionCode;
|
||||
import com.openhis.common.enums.DispenseStatus;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.enums.RequestStatus;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.pharmacymanage.appservice.IMedicationDetailsAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.MedDetailedAccountPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.MedDetailsInitDto;
|
||||
import com.openhis.web.pharmacymanage.dto.MedDetailsSearchParam;
|
||||
import com.openhis.web.pharmacymanage.mapper.MedicationDetailsMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.openhis.common.constant.CommonConstants.ExcelOut.*;
|
||||
import static com.openhis.common.constant.CommonConstants.SheetName.SHEET_NAME_DRUG_DETAIL;
|
||||
|
||||
/**
|
||||
* 发药明细 应用实现类
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025/4/14
|
||||
*/
|
||||
@Service
|
||||
public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppService {
|
||||
|
||||
@Autowired
|
||||
private MedicationDetailsMapper medicationDetailsMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService sysDictTypeService;
|
||||
|
||||
@Autowired
|
||||
private IPractitionerService iPractitionerService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
MedDetailsInitDto initDto = new MedDetailsInitDto();
|
||||
|
||||
// 查询医疗参与者列表
|
||||
List<Practitioner> list = iPractitionerService.getList();
|
||||
initDto.setPractitionerList(list);
|
||||
// 获取状态
|
||||
List<MedDetailsInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
|
||||
.map(status -> new MedDetailsInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 结算状态
|
||||
initDto.setStatusSettlementOptions(statusEnumOptions)
|
||||
// 出院状态
|
||||
.setStatusDischargeOptions(statusEnumOptions);
|
||||
|
||||
return R.ok(initDto);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 门诊人员发药明细表
|
||||
*
|
||||
* @param medDetailsSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 门诊人员发药明细表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getAmbPractitionerDetailPage(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo,
|
||||
Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
// 1:住院 2:门诊
|
||||
Integer flg = medDetailsSearchParam.getFlag();
|
||||
medDetailsSearchParam.setFlag(null);
|
||||
// 统计类型 1 3 5 明细
|
||||
Integer statisticalType = medDetailsSearchParam.getInventoryScope();
|
||||
medDetailsSearchParam.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
if (CommonConstants.StatisticalType.DETAIL_DEVICE_TYPE.equals(statisticalType)) {
|
||||
medDetailsSearchParam.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
}
|
||||
medDetailsSearchParam.setInventoryScope(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<MedDetailsSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(medDetailsSearchParam,
|
||||
searchKey, new HashSet<>(Arrays.asList("patient_name", "medication_name", "bus_no", "py_str")), request);
|
||||
|
||||
Page<MedDetailedAccountPageDto> medDetailsPage = medicationDetailsMapper.selectAmbPractitionerDetailPage(
|
||||
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
|
||||
RequestStatus.COMPLETED.getValue(), DispenseStatus.REFUNDED.getValue(), statisticalType, flg,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||
ConditionCode.LOT_NUMBER_COST.getCode());
|
||||
|
||||
return R.ok(medDetailsPage);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发药明细导出
|
||||
*
|
||||
* @param medDetailsSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param response 响应数据
|
||||
* @param request 请求数据
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void makeExcelFile(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletResponse response, HttpServletRequest request) {
|
||||
R<?> result = this.getAmbPractitionerDetailPage(medDetailsSearchParam, 1, 10000, searchKey, request);
|
||||
if (result != null && result.getData() != null) {
|
||||
// 先获取Page对象,再获取其中的记录列表
|
||||
Page<MedDetailedAccountPageDto> pageData = (Page<MedDetailedAccountPageDto>) result.getData();
|
||||
List<MedDetailedAccountPageDto> dataList = pageData.getRecords();
|
||||
// 判断项目类别
|
||||
try {
|
||||
// 获取字典数据
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
String unitCode = medDetailedAccountPageDto.getUnitCode();
|
||||
// 添加空值检查
|
||||
if (unitCode != null && sysDictTypeService != null) {
|
||||
// 缓存字典数据,避免重复查询
|
||||
List<SysDictData> unitCodelist
|
||||
= sysDictTypeService.selectDictDataByType(CommonConstants.FieldName.UnitCode);
|
||||
if (unitCodelist != null) {
|
||||
for (SysDictData dictData : unitCodelist) {
|
||||
if (dictData != null && dictData.getDictValue() != null
|
||||
&& dictData.getDictValue().equals(unitCode)) {
|
||||
// 设置字典数据
|
||||
medDetailedAccountPageDto.setUnitCode_dictText(dictData.getDictLabel());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 将发药数量与单位拼接
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
String unitCode_dictText = medDetailedAccountPageDto.getUnitCode_dictText();
|
||||
Integer dispenseQuantity = medDetailedAccountPageDto.getDispenseQuantity();
|
||||
// 空值处理:单位为空时只显示数量
|
||||
String quantityStr = dispenseQuantity != null ? dispenseQuantity.toString() : "0";
|
||||
if (StringUtils.isNotBlank(unitCode_dictText)) {
|
||||
medDetailedAccountPageDto.setDispenseQuantityStr(quantityStr + unitCode_dictText);
|
||||
} else {
|
||||
medDetailedAccountPageDto.setDispenseQuantityStr(quantityStr);
|
||||
}
|
||||
}
|
||||
|
||||
// 将退药数量与单位拼接
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
String unitCode_dictText = medDetailedAccountPageDto.getUnitCode_dictText();
|
||||
Integer refundQuantity = medDetailedAccountPageDto.getRefundQuantity();
|
||||
// 空值处理:数量为空时默认为0
|
||||
String quantityStr = refundQuantity != null ? refundQuantity.toString() : CONSTANTZERO;
|
||||
// 单位为空时只显示数量
|
||||
if (StringUtils.isNotBlank(unitCode_dictText)) {
|
||||
medDetailedAccountPageDto.setRefundQuantityStr(quantityStr + unitCode_dictText);
|
||||
} else {
|
||||
medDetailedAccountPageDto.setRefundQuantityStr(quantityStr);
|
||||
}
|
||||
}
|
||||
|
||||
// 将退药金额保留两位小数
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
// 获取退药金额
|
||||
BigDecimal refundPrice = medDetailedAccountPageDto.getRefundPrice();
|
||||
// 为空导出0.00
|
||||
if (refundPrice == null) {
|
||||
medDetailedAccountPageDto.setRefundPriceStr(CONSTANT_ZERO_DML);
|
||||
// 等于零导出0.00
|
||||
} else if (refundPrice.signum() == 0) {
|
||||
medDetailedAccountPageDto.setRefundPriceStr(CONSTANT_ZERO_DML);
|
||||
// 不为零导出退药金额且保留两位小数
|
||||
} else {
|
||||
refundPrice = refundPrice.setScale(2, RoundingMode.HALF_UP);
|
||||
medDetailedAccountPageDto.setRefundPriceStr(refundPrice.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 发药金额
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
// 获取发药金额
|
||||
BigDecimal dispensePrice = medDetailedAccountPageDto.getDispensePrice();
|
||||
// 为空导出0.00
|
||||
if (dispensePrice == null) {
|
||||
medDetailedAccountPageDto.setDispensePriceStr(CONSTANT_ZERO_DML);
|
||||
// 等于零导出0.00
|
||||
} else if (dispensePrice.signum() == 0) {
|
||||
medDetailedAccountPageDto.setDispensePriceStr(CONSTANT_ZERO_DML);
|
||||
// 不为零导出金额且保留两位小数
|
||||
} else {
|
||||
dispensePrice = dispensePrice.setScale(2, RoundingMode.HALF_UP);
|
||||
medDetailedAccountPageDto.setDispensePriceStr(dispensePrice.toString());
|
||||
}
|
||||
|
||||
}
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
BigDecimal costPrice = medDetailedAccountPageDto.getCostPrice();
|
||||
if (costPrice == null) {
|
||||
medDetailedAccountPageDto.setCostPriceStr(CONSTANT_ZERO_DML);
|
||||
} else if (costPrice.signum() == 0) {
|
||||
medDetailedAccountPageDto.setCostPriceStr(CONSTANT_ZERO_DML);
|
||||
} else {
|
||||
costPrice = costPrice.setScale(2, RoundingMode.HALF_UP);
|
||||
medDetailedAccountPageDto.setCostPriceStr(costPrice.toString());
|
||||
}
|
||||
}
|
||||
// 添加项目类别
|
||||
for (MedDetailedAccountPageDto medDetailedAccountPageDto : dataList) {
|
||||
// 获取项目类别值
|
||||
String itemTable = medDetailedAccountPageDto.getItemTable();
|
||||
// 类别不为空且在med_medication_definition中导出药材
|
||||
if (itemTable != null) {
|
||||
if (itemTable.equals(CommonConstants.TableName.MED_MEDICATION_DEFINITION)) {
|
||||
medDetailedAccountPageDto.setItemTable(MEDICATION);
|
||||
}
|
||||
// 类别不为空且在adm_device_definition中导出耗材
|
||||
if (itemTable.equals(CommonConstants.TableName.ADM_DEVICE_DEFINITION)) {
|
||||
medDetailedAccountPageDto.setItemTable(DEVICE);
|
||||
}
|
||||
// 类别为空则导出未知类型
|
||||
} else {
|
||||
medDetailedAccountPageDto.setItemTable(UNKONWN_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
ExcelUtil<MedDetailedAccountPageDto> util = new ExcelUtil<>(MedDetailedAccountPageDto.class);
|
||||
util.exportExcel(response, dataList, SHEET_NAME_DRUG_DETAIL);
|
||||
} catch (Exception e) {
|
||||
throw new NonCaptureException(StringUtils.format("导出excel失败"), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 门诊发药明细流水账
|
||||
*
|
||||
* @param medDetailsSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 门诊发药明细流水账
|
||||
*/
|
||||
@Override
|
||||
public R<?> getAmbMedicationDispenseDetailPage(MedDetailsSearchParam medDetailsSearchParam, Integer pageNo,
|
||||
Integer pageSize, String searchKey, HttpServletRequest request) {
|
||||
|
||||
// 1:住院 2:门诊
|
||||
Integer flg = medDetailsSearchParam.getFlag();
|
||||
medDetailsSearchParam.setFlag(null);
|
||||
// 统计类型 2 4 6
|
||||
Integer statisticalType = medDetailsSearchParam.getInventoryScope();
|
||||
medDetailsSearchParam.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
if (CommonConstants.StatisticalType.ACCOUNT_DEVICE_TYPE.equals(statisticalType)) {
|
||||
medDetailsSearchParam.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
}
|
||||
medDetailsSearchParam.setInventoryScope(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<MedDetailsSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(medDetailsSearchParam,
|
||||
searchKey, new HashSet<>(Arrays.asList("patient_name", "medication_name", "bus_no", "py_str")), request);
|
||||
|
||||
Page<MedDetailedAccountPageDto> medDetailsPage = medicationDetailsMapper.selectAmbPractitionerDetailPage(
|
||||
new Page<>(pageNo, pageSize), queryWrapper, DispenseStatus.COMPLETED.getValue(),
|
||||
RequestStatus.COMPLETED.getValue(), DispenseStatus.REFUNDED.getValue(), statisticalType, flg,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||
ConditionCode.LOT_NUMBER_COST.getCode());
|
||||
|
||||
return R.ok(medDetailsPage);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.DispenseStatus;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.pharmacymanage.appservice.IPendingMedicationDetailsAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.PendingMedicationPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PendingMedicationSearchParam;
|
||||
import com.openhis.web.pharmacymanage.mapper.PendingMedicationDetailsMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* 待发药明细 应用实现类
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025/4/14
|
||||
*/
|
||||
@Service
|
||||
public class PendingMedicationDetailsAppServiceImpl implements IPendingMedicationDetailsAppService {
|
||||
|
||||
@Autowired
|
||||
private PendingMedicationDetailsMapper pendingMedicationDetailsMapper;
|
||||
|
||||
/**
|
||||
* 分页查询待发药明细
|
||||
*
|
||||
* @param pendingMedicationSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 待发药明细
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPage(PendingMedicationSearchParam pendingMedicationSearchParam, Integer pageNo, Integer pageSize,
|
||||
String searchKey, HttpServletRequest request) {
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<PendingMedicationSearchParam> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
pendingMedicationSearchParam, searchKey, new HashSet<>(Arrays.asList("medicine_name", "medicine_no", "py_str")), request);
|
||||
|
||||
// 查询待发药明细列表(包含待配药、待发药、已配药三种状态,与门诊发药界面一致)
|
||||
Page<PendingMedicationPageDto> pendingMedicationPage = pendingMedicationDetailsMapper
|
||||
.selectPendingMedicationDetailsPage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.PREPARATION.getValue(),
|
||||
DispenseStatus.PREPARED.getValue(), EncounterClass.AMB.getValue(), EncounterClass.IMP.getValue());
|
||||
|
||||
pendingMedicationPage.getRecords().forEach(e -> {
|
||||
// 发药类型
|
||||
e.setDispenseEnum_enumText(EnumUtils.getInfoByValue(EncounterClass.class, e.getDispenseEnum()));
|
||||
});
|
||||
|
||||
return R.ok(pendingMedicationPage);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,680 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.exception.ServiceException;
|
||||
import com.core.common.utils.*;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.service.*;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.enums.ybenums.YbInvChgType;
|
||||
import com.openhis.common.enums.ybenums.YbMdtrtCertType;
|
||||
import com.openhis.common.enums.ybenums.YbRxFlag;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.financial.domain.Contract;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.financial.service.IContractService;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
import com.openhis.medication.domain.MedicationDefinition;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.medication.service.IMedicationDefinitionService;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.web.inventorymanage.appservice.impl.ReceiptApprovalAppServiceImpl;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
import com.openhis.web.pharmacymanage.appservice.IReturnMedicineAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
|
||||
import com.openhis.workflow.domain.DeviceDispense;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IDeviceRequestService;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import com.openhis.yb.domain.ClinicSettle;
|
||||
import com.openhis.yb.dto.Medical3506Param;
|
||||
import com.openhis.yb.dto.MedicalInventory3511Param;
|
||||
import com.openhis.yb.service.IClinicSettleService;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 退药管理 应用实现类
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025/4/4
|
||||
*/
|
||||
@Service
|
||||
public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
|
||||
@Resource
|
||||
private ITraceNoManageService traceNoManageService;
|
||||
|
||||
@Resource
|
||||
private IOrganizationService iOrganizationService;
|
||||
|
||||
@Resource
|
||||
private IInventoryItemService iInventoryItemService;
|
||||
|
||||
@Resource
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
@Resource
|
||||
private IMedicationRequestService medicationRequestService;
|
||||
|
||||
@Resource
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
@Resource
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
|
||||
@Resource
|
||||
private IDeviceRequestService deviceRequestService;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Resource
|
||||
private YbManager ybService;
|
||||
|
||||
@Resource
|
||||
private IChargeItemService iChargeItemService;
|
||||
|
||||
@Resource
|
||||
private IPaymentReconciliationService iPaymentReconciliationService;
|
||||
|
||||
@Resource
|
||||
private IContractService iContractService;
|
||||
|
||||
@Resource
|
||||
private IClinicSettleService clinicSettleService;
|
||||
|
||||
@Resource
|
||||
private IEncounterDiagnosisService encounterDiagnosisService;
|
||||
|
||||
@Resource
|
||||
private IAccountService accountService;
|
||||
|
||||
@Resource
|
||||
private IDeviceDefinitionService deviceDefinitionService;
|
||||
|
||||
@Resource
|
||||
private IMedicationDefinitionService medicationDefinitionService;
|
||||
|
||||
@Resource
|
||||
private ReceiptApprovalAppServiceImpl receiptApprovalAppService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
ReturnMedicineInitDto initDto = new ReturnMedicineInitDto();
|
||||
|
||||
// 获取科室下拉选列表
|
||||
List<Organization> organizationList
|
||||
= iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), String.valueOf(OrganizationClass.CLINIC.getValue()));
|
||||
List<ReturnMedicineInitDto.DepartmentOption> organizationOptions = organizationList.stream().map(
|
||||
organization -> new ReturnMedicineInitDto.DepartmentOption(organization.getId(), organization.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 发药状态
|
||||
List<ReturnMedicineInitDto.RefundStatusOption> refundStatusOptions = new ArrayList<>();
|
||||
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(DispenseStatus.PENDING_REFUND.getValue(),
|
||||
DispenseStatus.PENDING_REFUND.getInfo()));
|
||||
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(DispenseStatus.REFUNDED.getValue(),
|
||||
DispenseStatus.REFUNDED.getInfo()));
|
||||
initDto.setDepartmentOptions(organizationOptions).setRefundStatusOptions(refundStatusOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param encounterInfoDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getReturnMedicinePatientPage(EncounterInfoDto encounterInfoDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterInfoDto> queryWrapper = HisQueryUtils.buildQueryWrapper(encounterInfoDto, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IdCard,
|
||||
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
|
||||
request);
|
||||
// 查询退药患者分页列表
|
||||
Page<EncounterInfoDto> encounterInfoPage
|
||||
= returnMedicineMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
encounterInfoPage.getRecords().forEach(encounterInfo -> {
|
||||
// 性别
|
||||
encounterInfo.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
|
||||
// 年龄
|
||||
encounterInfo.setAge(AgeCalculatorUtil.getAge(encounterInfo.getBirthDate()));
|
||||
// 退药状态
|
||||
encounterInfo
|
||||
.setRefundEnum_enumText(EnumUtils.getInfoByValue(RequestStatus.class, encounterInfo.getRefundEnum()));
|
||||
});
|
||||
return R.ok(encounterInfoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退药信息
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @param refundStatus 退药id
|
||||
* @return 退药信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getReturnMedicineInfo(Long encounterId, Integer refundStatus) {
|
||||
// 获取退药信息
|
||||
List<ReturnMedicineInfoDto> returnMedicineInfoList = returnMedicineMapper.selectReturnMedicineInfo(encounterId,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST,
|
||||
ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(), refundStatus,
|
||||
DispenseStatus.PENDING_REFUND.getValue(), DispenseStatus.REFUNDED.getValue());
|
||||
returnMedicineInfoList.forEach(returnMedicineInfoDto -> {
|
||||
// 退药状态
|
||||
returnMedicineInfoDto.setRefundEnum_enumText(
|
||||
EnumUtils.getInfoByValue(DispenseStatus.class, returnMedicineInfoDto.getRefundEnum()));
|
||||
// 退药请求状态
|
||||
returnMedicineInfoDto.setReqStatus_enumText(
|
||||
EnumUtils.getInfoByValue(RequestStatus.class, returnMedicineInfoDto.getReqStatus()));
|
||||
});
|
||||
return R.ok(returnMedicineInfoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退药处理
|
||||
*
|
||||
* @param medicineReturnList 退药清单
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicineReturn(List<ReturnMedicineDto> medicineReturnList) {
|
||||
if (medicineReturnList == null || medicineReturnList.isEmpty()) {
|
||||
return R.ok();
|
||||
}
|
||||
// 分别处理退药与退耗材的请求
|
||||
List<ReturnMedicineDto> returnMedicineList = new ArrayList<>();
|
||||
List<ReturnMedicineDto> returnDeviceList = new ArrayList<>();
|
||||
// 追溯码列表
|
||||
List<TraceNoManage> traceNoManageList = new ArrayList<>();
|
||||
TraceNoManage traceNoManage;
|
||||
|
||||
medicineReturnList.forEach(item -> {
|
||||
switch (item.getTableName()) {
|
||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST ->
|
||||
returnMedicineList
|
||||
.add(new ReturnMedicineDto().setDispenseId(item.getDispenseId()).setRequestId(item.getRequestId()));
|
||||
case CommonConstants.TableName.WOR_DEVICE_REQUEST ->
|
||||
returnDeviceList
|
||||
.add(new ReturnMedicineDto().setDispenseId(item.getDispenseId()).setRequestId(item.getRequestId()));
|
||||
}
|
||||
});
|
||||
// 进销存参数
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
|
||||
|
||||
// 处理退药
|
||||
// 获取药品退药id列表
|
||||
List<Long> medReturnIdList = new ArrayList<>();
|
||||
if (!returnMedicineList.isEmpty()) {
|
||||
// 获取药品退药id列表
|
||||
medReturnIdList
|
||||
= returnMedicineList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取药品退药请求id列表
|
||||
List<Long> medRequestIdList
|
||||
= returnMedicineList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
|
||||
if (medReturnIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的药品");
|
||||
}
|
||||
if (medRequestIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的药品");
|
||||
}
|
||||
// 药品退药信息查询
|
||||
List<MedicationDispense> refundMedList = medicationDispenseService.listByIds(medReturnIdList);
|
||||
// 药品退药请求查询
|
||||
List<MedicationRequest> refundMedRequestList = medicationRequestService.listByIds(medRequestIdList);
|
||||
if (refundMedList == null || refundMedList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的药品");
|
||||
}
|
||||
// 重复退药校验
|
||||
if (refundMedList.stream().map(MedicationDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
|
||||
throw new ServiceException("药品已退药,请勿重复退药");
|
||||
}
|
||||
|
||||
// 更新退药单
|
||||
for (MedicationDispense medicationDispense : refundMedList) {
|
||||
// 退药状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.REFUNDED.getValue());
|
||||
// 退药数量
|
||||
medicationDispense.setDispenseQuantity(medicationDispense.getQuantity());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
// 退药时间
|
||||
medicationDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 退药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
|
||||
// 设置库存变更参数
|
||||
SupplyItemDetailDto supplyItemDetailDto = new SupplyItemDetailDto();
|
||||
for (MedicationRequest medicationRequest : refundMedRequestList) {
|
||||
// 根据退药id查询退药请求id(用于医保关联)
|
||||
if (medicationDispense.getMedReqId().equals(medicationRequest.getId())) {
|
||||
supplyItemDetailDto.setRequestId(medicationRequest.getRefundMedicineId());
|
||||
}
|
||||
}
|
||||
supplyItemDetailDto.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
.setItemId(medicationDispense.getMedicationId()).setLotNumber(medicationDispense.getLotNumber());
|
||||
supplyItemDetailList.add(supplyItemDetailDto);
|
||||
|
||||
// 追溯码表相关处理
|
||||
if (medicationDispense.getTraceNo() != null) {
|
||||
// 使用逗号分割追溯码并转换为List
|
||||
String[] traceNoList = medicationDispense.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
for (String item : traceNoList) {
|
||||
traceNoManage = new TraceNoManage();
|
||||
// 追溯码处理
|
||||
traceNoManage.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
// 项目id
|
||||
.setItemId(medicationDispense.getMedicationId())
|
||||
// 仓库类型
|
||||
.setLocationTypeEnum(null)
|
||||
// 仓库
|
||||
.setLocationId(medicationDispense.getLocationId())
|
||||
// 仓位
|
||||
.setLocationStoreId(null)
|
||||
// 产品批号
|
||||
.setLotNumber(medicationDispense.getLotNumber())
|
||||
// 追溯码
|
||||
.setTraceNo(item)
|
||||
// 追溯码状态
|
||||
.setStatusEnum(TraceNoStatus.IN.getValue())
|
||||
// 追溯码单位
|
||||
.setUnitCode(medicationDispense.getUnitCode())
|
||||
// 操作类型
|
||||
.setOperationType(SupplyType.RETURN_MEDICATION.getValue());
|
||||
traceNoManageList.add(traceNoManage);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 退药更新
|
||||
medicationDispenseService.updateBatchById(refundMedList);
|
||||
// 药品退药请求状态变更(待退药→已完成)
|
||||
medicationRequestService.updateCompletedStatusBatch(medRequestIdList, null, null);
|
||||
}
|
||||
|
||||
// 处理退耗材
|
||||
// 获取退耗材id列表
|
||||
List<Long> devReturnIdList = new ArrayList<>();
|
||||
if (!returnDeviceList.isEmpty()) {
|
||||
// 获取退耗材id列表
|
||||
devReturnIdList
|
||||
= returnDeviceList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取退耗材请求id列表
|
||||
List<Long> devRequestIdList
|
||||
= returnDeviceList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
|
||||
if (devReturnIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的耗材");
|
||||
}
|
||||
if (devRequestIdList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的耗材");
|
||||
}
|
||||
// 退耗材信息查询
|
||||
List<DeviceDispense> refundDevList = deviceDispenseService.listByIds(devReturnIdList);
|
||||
if (refundDevList == null || refundDevList.isEmpty()) {
|
||||
throw new ServiceException("请选择要退的耗材");
|
||||
}
|
||||
// 重复退耗材校验
|
||||
if (refundDevList.stream().map(DeviceDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
|
||||
throw new ServiceException("耗材已退,请勿重复操作");
|
||||
}
|
||||
// 更新退耗材单状态
|
||||
for (DeviceDispense deviceDispense : refundDevList) {
|
||||
// 退药时间
|
||||
deviceDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 退药数量
|
||||
deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
|
||||
// 退药状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.REFUNDED.getValue());
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList
|
||||
.add(new SupplyItemDetailDto().setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
.setItemId(deviceDispense.getDeviceDefId()).setLotNumber(deviceDispense.getLotNumber()));
|
||||
// // 使用逗号分割追溯码并转换为List
|
||||
// String[] traceNoList = deviceDispense.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
// for (String item : traceNoList) {
|
||||
// traceNoManage = new TraceNoManage();
|
||||
// // 追溯码处理
|
||||
// traceNoManage.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
// // 项目id
|
||||
// .setItemId(deviceDispense.getDeviceDefId())
|
||||
// // 仓库类型
|
||||
// .setLocationTypeEnum(LocationForm.PHARMACY.getValue())
|
||||
// // 仓库
|
||||
// .setLocationId(deviceDispense.getLocationId())
|
||||
// // 产品批号
|
||||
// .setLotNumber(deviceDispense.getLotNumber())
|
||||
// // 追溯码
|
||||
// .setTraceNo(item)
|
||||
// // 追溯码状态
|
||||
// .setStatusEnum(TraceNoStatus.IN.getValue())
|
||||
// // 追溯码单位
|
||||
// .setUnitCode(deviceDispense.getUnitCode())
|
||||
// // 操作类型
|
||||
// .setOperationType(SupplyType.RETURN_MEDICATION.getValue());
|
||||
// traceNoManageList.add(traceNoManage);
|
||||
// }
|
||||
}
|
||||
deviceDispenseService.updateBatchById(refundDevList);
|
||||
// 药品退药请求状态变更(待退药→已完成)
|
||||
deviceRequestService.updateCompletedStatusBatch(devRequestIdList);
|
||||
}
|
||||
|
||||
// 追溯码管理表数据追加
|
||||
traceNoManageService.saveBatch(traceNoManageList);
|
||||
|
||||
// 处理退库存
|
||||
// 获取库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList
|
||||
= returnMedicineMapper.selectInventoryInfoList(devReturnIdList, medReturnIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap
|
||||
= unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + CommonConstants.Common.DASH + x.getLocationId()));
|
||||
if (!unDispenseInventoryMap.isEmpty()) {
|
||||
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
|
||||
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
|
||||
if (!inventoryList.isEmpty()) {
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity
|
||||
= unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
}
|
||||
// 理论上不出bug的情况下以项目id,批号,仓库进行分组处理库存一定唯一所以get(0)
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryList.get(0).getInventoryId())
|
||||
.setQuantity(inventoryList.get(0).getInventoryQuantity().add(minQuantity)));
|
||||
}
|
||||
}
|
||||
// 库存更新
|
||||
iInventoryItemService.updateBatchById(inventoryItemList);
|
||||
} else {
|
||||
throw new ServiceException("请检查库存信息");
|
||||
}
|
||||
|
||||
// 处理退药医保
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
List<String> uploadFailedNoList;
|
||||
// 调用医保商品销售退货接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<DeviceDefinition> deviceDefinitions = new ArrayList<>();
|
||||
List<MedicationDefinition> medicationDefinitions = new ArrayList<>();
|
||||
if (!returnMedicineList.isEmpty()) {
|
||||
// 设置进销存参数
|
||||
medicationDefinitions = medicationDefinitionService.listByIds(supplyItemDetailList.stream()
|
||||
.filter(x -> x.getItemTable().equals(CommonConstants.TableName.MED_MEDICATION_DEFINITION))
|
||||
.map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
}
|
||||
if (!returnDeviceList.isEmpty()) {
|
||||
deviceDefinitions = deviceDefinitionService.listByIds(supplyItemDetailList.stream()
|
||||
.filter(x -> x.getItemTable().equals(CommonConstants.TableName.ADM_DEVICE_DEFINITION))
|
||||
.map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// 创建映射表,添加空集合保护
|
||||
Map<Long, MedicationDefinition> medicationMap
|
||||
= medicationDefinitions != null ? medicationDefinitions.stream().filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(MedicationDefinition::getId, Function.identity())) : new HashMap<>();
|
||||
|
||||
Map<Long, DeviceDefinition> deviceMap
|
||||
= deviceDefinitions != null ? deviceDefinitions.stream().filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(DeviceDefinition::getId, Function.identity())) : new HashMap<>();
|
||||
|
||||
// 设置库存变更参数,添加完整判空
|
||||
for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) {
|
||||
if (supplyItemDetailDto == null) {
|
||||
continue;
|
||||
}
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
|
||||
if (supplyItemDetailDto.getItemId() != null) {
|
||||
MedicationDefinition med = medicationMap.get(supplyItemDetailDto.getItemId());
|
||||
if (med != null) {
|
||||
supplyItemDetailDto.setItemBusNo(med.getBusNo()).setPartPercent(med.getPartPercent())
|
||||
.setRxFlag(med.getRxFlag()).setYbNo(med.getYbNo());
|
||||
}
|
||||
}
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(supplyItemDetailDto.getItemTable())) {
|
||||
if (supplyItemDetailDto.getItemId() != null) {
|
||||
DeviceDefinition dev = deviceMap.get(supplyItemDetailDto.getItemId());
|
||||
if (dev != null) {
|
||||
supplyItemDetailDto.setItemBusNo(dev.getBusNo()).setPartPercent(dev.getPartPercent())
|
||||
.setRxFlag(dev.getRxFlag()).setYbNo(dev.getYbNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
uploadFailedNoList = this.ybReturnIntegrated(medReturnIdList, null);
|
||||
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3506商品销售退货上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3506商品销售退货上传成功";
|
||||
}
|
||||
}
|
||||
// 返回退药成功信息
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"退药"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 医保退药相关进销存接口
|
||||
*
|
||||
* @param dispenseMedIdList 退药id列表
|
||||
* @param dispenseDevIdList 退耗材id列表
|
||||
* @return 上传失败的编号集合
|
||||
*/
|
||||
public List<String> ybReturnIntegrated(List<Long> dispenseMedIdList, List<Long> dispenseDevIdList) {
|
||||
List<String> uploadFailedNoList = new ArrayList<>();
|
||||
R<?> result;
|
||||
if (!dispenseMedIdList.isEmpty() || !dispenseDevIdList.isEmpty()) {
|
||||
// 查询退药项目相关信息
|
||||
List<DispenseInventoryDto> dispenseInventoryList = returnMedicineMapper.selectReturnItemDetail(
|
||||
dispenseDevIdList, dispenseMedIdList, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) {
|
||||
if (dispenseInventoryDto.getYbNo() == null) {
|
||||
continue;
|
||||
}
|
||||
Pair<Medical3506Param, Contract> medical3506Pair = getMedical3506Param(dispenseInventoryDto);
|
||||
// 如果自费则自动取省医保
|
||||
Contract contract = medical3506Pair.getRight();
|
||||
if (contract != null) {
|
||||
if (CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
|
||||
.equals(medical3506Pair.getRight().getBusNo())) {
|
||||
contract = null;
|
||||
}
|
||||
}
|
||||
result = ybService.cancelMerchandise(medical3506Pair.getLeft(), contract);
|
||||
if (result.getCode() != 200) {
|
||||
uploadFailedNoList.add(dispenseInventoryDto.getDispenseNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
return uploadFailedNoList;
|
||||
}
|
||||
|
||||
private Pair<Medical3506Param, Contract> getMedical3506Param(DispenseInventoryDto dispenseInventoryDto) {
|
||||
Medical3506Param medical3506Param = new Medical3506Param();
|
||||
ChargeItem chargeItem = null;
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
// 查询费用结算信息
|
||||
chargeItem = iChargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
|
||||
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.MED_MEDICATION_REQUEST)
|
||||
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getRefundId())
|
||||
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
chargeItem = iChargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
|
||||
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.WOR_DEVICE_REQUEST)
|
||||
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getRefundId())
|
||||
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
|
||||
}
|
||||
if (chargeItem == null) {
|
||||
throw new ServiceException("未查询到收费项");
|
||||
}
|
||||
// 查询就诊诊断信息
|
||||
EncounterDiagnosis encounterDiagnosis = encounterDiagnosisService.getById(chargeItem.getEncounterDiagnosisId());
|
||||
if (encounterDiagnosis == null) {
|
||||
throw new ServiceException("未查找到就诊诊断信息");
|
||||
}
|
||||
// 查询付款信息
|
||||
PaymentReconciliation paymentReconciliation
|
||||
= iPaymentReconciliationService.getOne(new LambdaQueryWrapper<PaymentReconciliation>()
|
||||
.eq(PaymentReconciliation::getEncounterId, chargeItem.getEncounterId())
|
||||
.like(PaymentReconciliation::getChargeItemIds, chargeItem.getId())
|
||||
.eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
|
||||
.eq(PaymentReconciliation::getPatientId, chargeItem.getPatientId())
|
||||
.eq(PaymentReconciliation::getPaymentEnum, PaymentType.PAY.getValue()));
|
||||
if (paymentReconciliation == null) {
|
||||
throw new ServiceException("未查询到收费");
|
||||
}
|
||||
|
||||
// 查询账户信息
|
||||
Account account = accountService
|
||||
.getOne(new LambdaQueryWrapper<Account>().eq(Account::getEncounterId, chargeItem.getEncounterId())
|
||||
.eq(Account::getEncounterFlag, Whether.YES.getValue()));
|
||||
if (account == null) {
|
||||
throw new ServiceException("未查询到账户");
|
||||
}
|
||||
// 查询合同实体
|
||||
Contract contract
|
||||
= iContractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
|
||||
if (contract == null) {
|
||||
throw new ServiceException("未查询到合同信息");
|
||||
}
|
||||
YbMdtrtCertType mdtrtCertType;
|
||||
if (AccountType.PERSONAL_CASH_ACCOUNT.getCode().equals(account.getTypeCode())) {
|
||||
mdtrtCertType = YbMdtrtCertType.MDTRT_CERT_TYPE02;
|
||||
} else {
|
||||
mdtrtCertType = YbMdtrtCertType.getByValue(account.getTypeCode());// 2025/05/28 该值存01/02/03
|
||||
}
|
||||
if (mdtrtCertType == null) {
|
||||
throw new ServiceException("未查询到电子凭证");
|
||||
}
|
||||
// 查询就诊id
|
||||
if (contract.getCategoryEnum().equals(Category.SELF.getValue())
|
||||
|| contract.getCategoryEnum().equals(Category.PUBLIC.getValue())) {
|
||||
medical3506Param.setMdtrtSn(dispenseInventoryDto.getEncounterNo());
|
||||
} else {
|
||||
ClinicSettle clinicSettle = clinicSettleService.getOne(new LambdaQueryWrapper<ClinicSettle>()
|
||||
.in(ClinicSettle::getSetlId, List.of(paymentReconciliation.getYbSettleIds()))
|
||||
.eq(ClinicSettle::getMedType, encounterDiagnosis.getMedTypeCode()).last(" LIMIT 1"));
|
||||
if (clinicSettle != null) {
|
||||
medical3506Param.setMdtrtSn(clinicSettle.getMdtrtId());
|
||||
} else {
|
||||
medical3506Param.setMdtrtSn(dispenseInventoryDto.getEncounterNo());
|
||||
}
|
||||
}
|
||||
// // 查询发票信息
|
||||
// Invoice invoice = iInvoiceService.getById(paymentReconciliation.getInvoiceId());
|
||||
// if (invoice == null) {
|
||||
// throw new ServiceException("未查询到发票信息");
|
||||
// }
|
||||
// 转换为JSON
|
||||
JSONArray medicalTraceNo = new JSONArray();
|
||||
// 获取追溯码信息
|
||||
if (dispenseInventoryDto.getTraceNo() != null) {
|
||||
List<String> traceNoList
|
||||
= Arrays.stream(dispenseInventoryDto.getTraceNo().split(CommonConstants.Common.COMMA)).map(String::trim)
|
||||
.filter(s -> !s.isEmpty()).toList();
|
||||
for (String traceNo : traceNoList) {
|
||||
Map<String, String> traceNoMap = new HashMap<>();
|
||||
traceNoMap.put("drug_trac_codg", traceNo);
|
||||
medicalTraceNo.add(traceNoMap);
|
||||
}
|
||||
}
|
||||
medical3506Param.setMedListCodg(dispenseInventoryDto.getYbNo())
|
||||
.setFixmedinsBchno(dispenseInventoryDto.getRefundId().toString())
|
||||
.setFixmedinsHilistId(dispenseInventoryDto.getItemNo())
|
||||
.setFixmedinsHilistName(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
.setPsnCertType(mdtrtCertType.getValue()).setManuLotnum(dispenseInventoryDto.getLotNumber())
|
||||
.setManuDate(dispenseInventoryDto.getProductionDate())
|
||||
.setSelRetnCnt(new BigDecimal(dispenseInventoryDto.getDispenseQuantity().toString()))
|
||||
.setSelRetnTime(dispenseInventoryDto.getDispenseTime()).setExpyEnd(dispenseInventoryDto.getExpirationDate())
|
||||
.setDrugtracinfo(medicalTraceNo).setCertno(dispenseInventoryDto.getIdCard());
|
||||
// 查看所属医院
|
||||
String fixmedinsCode
|
||||
= SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
|
||||
if (dispenseInventoryDto.getPreparerName() == null && HospitalCodeEnum.CCU.getCode().equals(fixmedinsCode)) {
|
||||
medical3506Param.setSelRetnOpterName(CommonConstants.CCU.DisDeviceDoctorName);
|
||||
} else {
|
||||
medical3506Param.setSelRetnOpterName(dispenseInventoryDto.getPreparerName());
|
||||
}
|
||||
if (dispenseInventoryDto.getInventoryUnitCode().equals(dispenseInventoryDto.getDispenseUnitCode())) {
|
||||
medical3506Param.setTrdnFlag(Whether.YES.getCode());
|
||||
} else {
|
||||
medical3506Param.setTrdnFlag(Whether.NO.getCode());
|
||||
}
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == dispenseInventoryDto.getRxFlag()) {
|
||||
medical3506Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == dispenseInventoryDto.getRxFlag()) {
|
||||
medical3506Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == dispenseInventoryDto.getRxFlag()) {
|
||||
medical3506Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
medical3506Param.setFixmedinsHilistName(CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
medical3506Param.setFixmedinsHilistName(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
}
|
||||
return Pair.of(medical3506Param, contract);
|
||||
}
|
||||
|
||||
private MedicalInventory3511Param getMedical3511Param(DispenseInventoryDto dispenseInventoryDto) {
|
||||
MedicalInventory3511Param medicalInventory3511Param = new MedicalInventory3511Param();
|
||||
|
||||
String fixmedinsCode
|
||||
= SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
|
||||
// TODO
|
||||
medicalInventory3511Param.setFixmedinsCode(fixmedinsCode).setMedinsListCodg(dispenseInventoryDto.getYbNo())
|
||||
.setFixmedinsBchno(dispenseInventoryDto.getLotNumber()).setBegndate(dispenseInventoryDto.getDispenseTime())
|
||||
.setEnddate(dispenseInventoryDto.getDispenseTime());
|
||||
|
||||
return medicalInventory3511Param;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,349 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.system.service.ISysDictTypeService;
|
||||
import com.openhis.administration.domain.TraceNoManage;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.administration.service.ITraceNoManageService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.enums.ybenums.YbInvChgType;
|
||||
import com.openhis.medication.domain.MedicationDefinition;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDefinitionService;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.impl.MedicationRequestServiceImpl;
|
||||
import com.openhis.web.inhospitalnursestation.mapper.AdviceProcessAppMapper;
|
||||
import com.openhis.web.inventorymanage.appservice.impl.ReceiptApprovalAppServiceImpl;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
import com.openhis.web.pharmacymanage.appservice.ISummaryDispenseMedicineAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.UnDispenseInventoryDto;
|
||||
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
|
||||
import com.openhis.web.pharmacymanage.mapper.WesternMedicineDispenseMapper;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 住院汇总发放 应用实现类
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/6/3
|
||||
*/
|
||||
@Service
|
||||
public class SummaryDispenseMedicineAppServiceImpl implements ISummaryDispenseMedicineAppService {
|
||||
|
||||
@Resource
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
@Resource
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Resource
|
||||
private ISupplyDeliveryService supplyDeliveryService;
|
||||
|
||||
@Resource
|
||||
private ITraceNoManageService traceNoManageService;
|
||||
|
||||
@Resource
|
||||
private IInventoryItemService inventoryItemService;
|
||||
|
||||
@Resource
|
||||
private IMedicationDefinitionService medicationDefinitionService;
|
||||
|
||||
@Resource
|
||||
private ReceiptApprovalAppServiceImpl receiptApprovalAppService;
|
||||
|
||||
@Resource
|
||||
private WesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppService;
|
||||
|
||||
@Resource
|
||||
private WesternMedicineDispenseMapper westernMedicineDispenseMapper;
|
||||
|
||||
@Resource
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Resource
|
||||
private AdviceProcessAppMapper adviceProcessAppMapper;
|
||||
|
||||
@Resource
|
||||
private MedicationRequestServiceImpl medicationRequestService;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Resource
|
||||
private ReturnMedicineAppServiceImpl returnMedicineAppService;
|
||||
private HttpServletResponse response;
|
||||
@Autowired
|
||||
private ISysDictTypeService sysDictTypeService;
|
||||
|
||||
/**
|
||||
* 汇总发药
|
||||
*
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> SummaryDispenseMedicine(List<String> summaryNoList) {
|
||||
if (summaryNoList == null || summaryNoList.isEmpty()) {
|
||||
return R.fail("未选择汇总单");
|
||||
}
|
||||
|
||||
// 根据汇总单号查所有发放信息
|
||||
List<MedicationDispense> medDispenseList = medicationDispenseService.getMedDispenseBySummaryNo(summaryNoList);
|
||||
if (medDispenseList == null || medDispenseList.isEmpty()) {
|
||||
return R.fail("未查询到发药单明细,请刷新后重试");
|
||||
}
|
||||
List<Long> medDispenseIdList
|
||||
= medDispenseList.stream().map(MedicationDispense::getId).collect(Collectors.toList());
|
||||
// 获取药品待发放库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList
|
||||
= returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap
|
||||
= unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + CommonConstants.Common.DASH + x.getLocationId()));
|
||||
if (!unDispenseInventoryMap.isEmpty()) {
|
||||
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
|
||||
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
|
||||
if (!inventoryList.isEmpty()) {
|
||||
if (inventoryList.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 停供库存校验
|
||||
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
// 库存数量
|
||||
BigDecimal inventoryQuantity = BigDecimal.ZERO;
|
||||
// 库存id
|
||||
Long inventoryId = null;
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity
|
||||
= unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
|
||||
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
|
||||
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
|
||||
inventoryId = unDispenseInventoryDto.getInventoryId();
|
||||
}
|
||||
}
|
||||
if (minQuantity.compareTo(inventoryQuantity) > 0) {
|
||||
// 库存不足
|
||||
return R.fail(inventoryList.get(0).getItemName() + "批号库存不足");
|
||||
} else {
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryId)
|
||||
.setQuantity(inventoryQuantity.subtract(minQuantity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Date now = DateUtils.getNowDate();
|
||||
// 追溯码列表
|
||||
List<TraceNoManage> tracesNoManageList = new ArrayList<>();
|
||||
TraceNoManage traceNoManage;
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
|
||||
// 更新发药明细状态
|
||||
for (MedicationDispense medicationDispense : medDispenseList) {
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(now);
|
||||
// 发药数量
|
||||
medicationDispense.setDispenseQuantity(medicationDispense.getQuantity());
|
||||
// 发药时间
|
||||
medicationDispense.setDispenseTime(now);
|
||||
// 发药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(medicationDispense.getMedicationId())
|
||||
.setLotNumber(medicationDispense.getLotNumber())
|
||||
.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION));
|
||||
// 使用逗号分割追溯码并转换为List
|
||||
if (medicationDispense.getTraceNo() != null) {
|
||||
String[] traceNoList = medicationDispense.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
for (String item : traceNoList) {
|
||||
traceNoManage = new TraceNoManage();
|
||||
// 追溯码处理
|
||||
traceNoManage.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
// 项目id
|
||||
.setItemId(medicationDispense.getMedicationId())
|
||||
// 仓库类型
|
||||
.setLocationTypeEnum(LocationForm.PHARMACY.getValue())
|
||||
// 仓库
|
||||
.setLocationId(medicationDispense.getLocationId())
|
||||
// 产品批号
|
||||
.setLotNumber(medicationDispense.getLotNumber())
|
||||
// 追溯码
|
||||
.setTraceNo(item)
|
||||
// 追溯码状态
|
||||
.setStatusEnum(TraceNoStatus.OUT.getValue())
|
||||
// 追溯码单位
|
||||
.setUnitCode(medicationDispense.getUnitCode())
|
||||
// 操作类型
|
||||
.setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
|
||||
tracesNoManageList.add(traceNoManage);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 药品发放更新
|
||||
medicationDispenseService.updateBatchById(medDispenseList);
|
||||
// 查询汇总申请和汇总发放信息
|
||||
List<SupplyRequest> supplyRequestList = supplyRequestService.getSupplyByBusNoBatch(summaryNoList);
|
||||
if (supplyRequestList == null || supplyRequestList.isEmpty()) {
|
||||
throw new ServiceException("未找到汇总申请信息");
|
||||
}
|
||||
List<Long> requestId = supplyRequestList.stream().map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
List<SupplyDelivery> supplyDeliveryList = supplyDeliveryService.selectByRequestIdList(requestId);
|
||||
if (supplyDeliveryList == null || supplyDeliveryList.isEmpty()) {
|
||||
throw new ServiceException("未找到汇总发放信息");
|
||||
}
|
||||
if (supplyDeliveryList.stream().anyMatch(x -> x.getStatusEnum().equals(DispenseStatus.COMPLETED.getValue()))) {
|
||||
throw new ServiceException("汇总已发放,请勿重复操作");
|
||||
}
|
||||
// 汇总发放更新
|
||||
for (SupplyDelivery supplyDelivery : supplyDeliveryList) {
|
||||
// 药品发放状态
|
||||
supplyDelivery.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 发药时间
|
||||
supplyDelivery.setOccurrenceTime(now);
|
||||
// 发药人
|
||||
supplyDelivery.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
}
|
||||
supplyDeliveryService.updateBatchById(supplyDeliveryList);
|
||||
// 汇总发放申请更新
|
||||
for (SupplyRequest supplyRequest : supplyRequestList) {
|
||||
// 审核状态:已通过
|
||||
supplyRequest.setStatusEnum(SupplyStatus.AGREE.getValue())
|
||||
// 审核人
|
||||
.setApproverId(SecurityUtils.getLoginUser().getPractitionerId())
|
||||
// 审核时间
|
||||
.setApprovalTime(now);
|
||||
}
|
||||
supplyRequestService.updateBatchById(supplyRequestList);
|
||||
|
||||
// 库存更新
|
||||
inventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 追溯码管理表数据追加
|
||||
traceNoManageService.saveBatch(tracesNoManageList);
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
List<String> uploadFailedNoList;
|
||||
// 调用医保商品销售接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
// 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// 设置进销存参数
|
||||
List<MedicationDefinition> medicationDefinitions = medicationDefinitionService.listByIds(
|
||||
supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
// 用itemId分组
|
||||
Map<Long, MedicationDefinition> medicationMap = medicationDefinitions.stream()
|
||||
.collect(Collectors.toMap(MedicationDefinition::getId, Function.identity()));
|
||||
// 设置库存变更参数
|
||||
for (SupplyItemDetailDto dto : supplyItemDetailList) {
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dto.getItemTable())) {
|
||||
MedicationDefinition med = medicationMap.get(dto.getItemId());
|
||||
if (med != null) {
|
||||
dto.setItemBusNo(med.getBusNo()).setPartPercent(med.getPartPercent()).setRxFlag(med.getRxFlag())
|
||||
.setYbNo(med.getYbNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
uploadFailedNoList = westernMedicineDispenseAppService.ybMedicineIntegrated(medDispenseIdList, null);
|
||||
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3505商品销售上传成功";
|
||||
}
|
||||
}
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> dispenseCancel(List<String> summaryNoList) {
|
||||
if (summaryNoList == null || summaryNoList.isEmpty()) {
|
||||
return R.fail("未选择汇总单");
|
||||
}
|
||||
|
||||
// 根据汇总单号查所有发放id
|
||||
List<Long> medDispenseIdList = medicationDispenseService.getMedDispenseBySummaryNo(summaryNoList).stream()
|
||||
.map(MedicationDispense::getId).toList();
|
||||
|
||||
// 药品发药信息查询
|
||||
List<MedicationDispense> dispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
if (dispenseList != null) {
|
||||
for (MedicationDispense medicationDispense : dispenseList) {
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||
// 未发药原因
|
||||
// medicationDispense.setNotPerformedReasonEnum(dispenseMedicineList.get(0).getNotPerformedReasonEnum());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
}
|
||||
// 药品发放更新
|
||||
medicationDispenseService.updateBatchById(dispenseList);
|
||||
// 汇总发放更新
|
||||
for (String summaryNo : summaryNoList) {
|
||||
List<Long> requestId = supplyRequestService.getSupplyByBusNo(summaryNo).stream()
|
||||
.map(SupplyRequest::getId).collect(Collectors.toList());
|
||||
List<SupplyDelivery> supplyDeliveryList = supplyDeliveryService.selectByRequestIdList(requestId);
|
||||
for (SupplyDelivery supplyDelivery : supplyDeliveryList) {
|
||||
// 药品发放状态
|
||||
supplyDelivery.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||
}
|
||||
supplyDeliveryService.updateBatchById(supplyDeliveryList);
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,715 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.exception.ServiceException;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.service.*;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.enums.ybenums.YbInvChgType;
|
||||
import com.openhis.common.enums.ybenums.YbMdtrtCertType;
|
||||
import com.openhis.common.enums.ybenums.YbRxFlag;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.financial.domain.Contract;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.financial.service.IContractService;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
import com.openhis.medication.domain.MedicationDefinition;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.medication.service.IMedicationDefinitionService;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.web.inventorymanage.appservice.impl.ReceiptApprovalAppServiceImpl;
|
||||
import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
|
||||
import com.openhis.web.pharmacymanage.mapper.WesternMedicineDispenseMapper;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import com.openhis.yb.domain.ClinicSettle;
|
||||
import com.openhis.yb.dto.Medical3505Param;
|
||||
import com.openhis.yb.service.IClinicSettleService;
|
||||
import com.openhis.yb.service.YbHttpUtils;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.util.annotation.Nullable;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 西药发放 应用实现类
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025/3/14
|
||||
*/
|
||||
@Service
|
||||
public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDispenseAppService {
|
||||
|
||||
@Resource
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Resource
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
@Resource
|
||||
private IMedicationRequestService medicationRequestService;
|
||||
|
||||
@Resource
|
||||
private IInventoryItemService inventoryItemService;
|
||||
|
||||
@Resource
|
||||
private WesternMedicineDispenseMapper westernMedicineDispenseMapper;
|
||||
|
||||
@Resource
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
@Resource
|
||||
private YbManager ybService;
|
||||
|
||||
@Resource
|
||||
private YbHttpUtils ybHttpUtils;
|
||||
|
||||
@Resource
|
||||
private IChargeItemService chargeItemService;
|
||||
|
||||
@Resource
|
||||
private IPaymentReconciliationService paymentReconciliationService;
|
||||
|
||||
@Resource
|
||||
private IContractService contractService;
|
||||
|
||||
@Resource
|
||||
private IAccountService accountService;
|
||||
|
||||
@Resource
|
||||
private IClinicSettleService clinicSettleService;
|
||||
|
||||
@Resource
|
||||
private IEncounterDiagnosisService encounterDiagnosisService;
|
||||
|
||||
@Resource
|
||||
private ITraceNoManageService traceNoManageService;
|
||||
|
||||
@Resource
|
||||
private ReceiptApprovalAppServiceImpl receiptApprovalAppService;
|
||||
|
||||
@Resource
|
||||
private IMedicationDefinitionService medicationDefinitionService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DispenseInitDto initDto = new DispenseInitDto();
|
||||
|
||||
// 获取科室下拉选列表
|
||||
List<Organization> organizationList
|
||||
= organizationService.getList(OrganizationType.DEPARTMENT.getValue(), String.valueOf(OrganizationClass.CLINIC.getValue()));
|
||||
List<DispenseInitDto.DepartmentOption> organizationOptions = organizationList.stream()
|
||||
.map(organization -> new DispenseInitDto.DepartmentOption(organization.getId(), organization.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取配药人下拉选列表
|
||||
List<Practitioner> preparerDoctorList
|
||||
= westernMedicineDispenseMapper.getPreparerDoctorList(PractitionerRoles.PHARMACIST.getCode());
|
||||
List<DispenseInitDto.PreparerDoctorOption> preparerDoctorOptions = preparerDoctorList.stream()
|
||||
.map(practitioner -> new DispenseInitDto.PreparerDoctorOption(practitioner.getId(), practitioner.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 未发药原因下拉选列表
|
||||
List<DispenseInitDto.NotPerformedReasonOption> notPerformedReasonOptions
|
||||
= Stream.of(NotPerformedReasonEnum.values())
|
||||
.map(notPerformedReason -> new DispenseInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
|
||||
notPerformedReason.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 患者类型
|
||||
List<DispenseInitDto.EncounterClassOption> encounterClassOptions = Stream.of(EncounterClass.values())
|
||||
.map(encounterClass -> new DispenseInitDto.EncounterClassOption(encounterClass.getValue(),
|
||||
encounterClass.getInfo()))
|
||||
.toList();
|
||||
|
||||
// 发药状态
|
||||
List<DispenseStatusOption> dispenseStatusOptions = new ArrayList<>();
|
||||
dispenseStatusOptions.add(new DispenseStatusOption(DispenseStatus.IN_PROGRESS.getValue(),
|
||||
DispenseStatus.IN_PROGRESS.getInfo()));
|
||||
dispenseStatusOptions.add(new DispenseStatusOption(DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.COMPLETED.getInfo()));
|
||||
|
||||
initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions)
|
||||
.setDispenseStatusOptions(dispenseStatusOptions).setPreparerDoctorOptions(preparerDoctorOptions)
|
||||
.setEncounterClassOptions(encounterClassOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询病人列表
|
||||
*
|
||||
* @param encounterInfoSearchParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 病人列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 发药状态初始化
|
||||
Integer statusEnum = encounterInfoSearchParam.getStatusEnum();
|
||||
encounterInfoSearchParam.setStatusEnum(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterInfoSearchParam> queryWrapper
|
||||
= HisQueryUtils.buildQueryWrapper(encounterInfoSearchParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.IdCard,
|
||||
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
|
||||
request);
|
||||
// 查询就诊病人列表
|
||||
Page<EncounterInfoDto> encounterInfoPage
|
||||
= westernMedicineDispenseMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
statusEnum, DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue());
|
||||
encounterInfoPage.getRecords().forEach(encounterInfo -> {
|
||||
// 性别
|
||||
encounterInfo.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
|
||||
// 发药状态
|
||||
encounterInfo
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getStatusEnum()));
|
||||
if (encounterInfo.getBirthDate() != null) {
|
||||
// 计算年龄
|
||||
encounterInfo.setAge(AgeCalculatorUtil.getAge(encounterInfo.getBirthDate()));
|
||||
}
|
||||
});
|
||||
return R.ok(encounterInfoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param itemDispenseOrderDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
@Override
|
||||
public R<?> getMedicineDispenseOrderList(ItemDispenseOrderDto itemDispenseOrderDto, Integer pageNo,
|
||||
Integer pageSize) {
|
||||
// 发药状态初始化
|
||||
Integer dispenseStatus = itemDispenseOrderDto.getStatusEnum();
|
||||
itemDispenseOrderDto.setStatusEnum(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<ItemDispenseOrderDto> queryWrapper
|
||||
= HisQueryUtils.buildQueryWrapper(itemDispenseOrderDto, null, null, null);
|
||||
// 处方单信息查询
|
||||
Page<ItemDispenseOrderDto> medicineDispenseOrderPage
|
||||
= westernMedicineDispenseMapper.selectMedicineDispenseOrderPage(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue(), dispenseStatus,
|
||||
PublicationStatus.ACTIVE.getValue());
|
||||
medicineDispenseOrderPage.getRecords().forEach(medicineDispenseOrder -> {
|
||||
// 发药状态
|
||||
medicineDispenseOrder.setStatusEnum_enumText(
|
||||
EnumUtils.getInfoByValue(DispenseStatus.class, medicineDispenseOrder.getStatusEnum()));
|
||||
// 设置所在表名
|
||||
medicineDispenseOrder.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
// 处方类型(发药类型:门诊/住院等)
|
||||
if (medicineDispenseOrder.getDispenseEnum() != null) {
|
||||
medicineDispenseOrder.setDispenseEnum_enumText(
|
||||
EnumUtils.getInfoByValue(EncounterClass.class, medicineDispenseOrder.getDispenseEnum()));
|
||||
}
|
||||
});
|
||||
return R.ok(medicineDispenseOrderPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配药
|
||||
*
|
||||
* @param dispenseMedicineList 配药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicinePrepare(List<DispenseItemDto> dispenseMedicineList) {
|
||||
// 追溯码集合
|
||||
List<String> traceNoList
|
||||
= dispenseMedicineList.stream().map(DispenseItemDto::getTraceNo).collect(Collectors.toList());
|
||||
// 非输液药品的已出库追溯码
|
||||
List<String> outTraceNoList = westernMedicineDispenseMapper.getOutTraceNo(TraceNoStatus.OUT.getValue(),
|
||||
Whether.YES.getValue(), SplitPropertyCode.OUTPATIENT_MIN_UNIT_CEIL.getValue(),
|
||||
SplitPropertyCode.OUTPATIENT_MIN_UNIT_TOTAL_CEIL.getValue(), SupplyType.DISPENSE_MEDICATION.getValue());
|
||||
// 取交集
|
||||
if (!traceNoList.isEmpty() && !outTraceNoList.isEmpty()) {
|
||||
List<String> list = traceNoList.stream().filter(outTraceNoList::contains).collect(Collectors.toList());
|
||||
if (!list.isEmpty()) {
|
||||
throw new ServiceException("追溯码【" + String.join(",", list) + "】已出库");
|
||||
}
|
||||
}
|
||||
// 配药人检查
|
||||
if (dispenseMedicineList.get(0).getPreparerId() == null
|
||||
|| dispenseMedicineList.get(0).getPreparerId().equals(SecurityUtils.getLoginUser().getPractitionerId())) {
|
||||
return R.fail("请选择调配药师");
|
||||
}
|
||||
// 获取发药单id列表
|
||||
List<Long> medDispenseIdList
|
||||
= dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
|
||||
// 药品发药信息查询
|
||||
List<MedicationDispense> dispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
|
||||
if (dispenseList != null) {
|
||||
if (dispenseList.stream().map(MedicationDispense::getStatusEnum)
|
||||
.anyMatch(x -> !x.equals(DispenseStatus.PREPARATION.getValue()))) {
|
||||
throw new ServiceException("配药失败,请检查发药单状态");
|
||||
} else {
|
||||
for (MedicationDispense medicationDispense : dispenseList) {
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.PREPARED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
// 配药人
|
||||
medicationDispense.setPreparerId(dispenseMedicineList.get(0).getPreparerId());
|
||||
// 配药时间
|
||||
medicationDispense.setPrepareTime(DateUtils.getNowDate());
|
||||
for (DispenseItemDto dispenseItemDto : dispenseMedicineList) {
|
||||
if (medicationDispense.getId().equals(dispenseItemDto.getDispenseId())) {
|
||||
// 药品追溯码
|
||||
medicationDispense.setTraceNo(dispenseItemDto.getTraceNo());
|
||||
// 批次号
|
||||
medicationDispense.setLotNumber(dispenseItemDto.getLotNumber());
|
||||
// 药品数量
|
||||
medicationDispense.setQuantity(dispenseItemDto.getQuantity());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 查询对应的药品医嘱
|
||||
List<MedicationRequest> medicationRequests = medicationRequestService.listByIds(
|
||||
dispenseList.stream().map(MedicationDispense::getMedReqId).distinct().collect(Collectors.toList()));
|
||||
// 根据请求id做map
|
||||
Map<Long, List<MedicationDispense>> dispenseMap
|
||||
= dispenseList.stream().collect(Collectors.groupingBy(MedicationDispense::getMedReqId));
|
||||
for (MedicationRequest medicationRequest : medicationRequests) {
|
||||
List<MedicationDispense> medicationDispenseList = dispenseMap.get(medicationRequest.getId());
|
||||
BigDecimal dispenseQuantity = BigDecimal.ZERO;
|
||||
for (MedicationDispense medicationDispense : medicationDispenseList) {
|
||||
if (medicationRequest.getUnitCode().equals(medicationDispense.getUnitCode())) {
|
||||
dispenseQuantity = dispenseQuantity.add(medicationDispense.getQuantity());
|
||||
} else {
|
||||
throw new ServiceException("配药失败,请检查发药单单位");
|
||||
}
|
||||
}
|
||||
// 校验开药数量与待发药数量是否相同
|
||||
if (dispenseQuantity.compareTo(medicationRequest.getQuantity()) != 0) {
|
||||
throw new ServiceException("配药失败,请检查发药单数量");
|
||||
}
|
||||
}
|
||||
// 药品发放更新
|
||||
medicationDispenseService.updateBatchById(dispenseList);
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单核对发药
|
||||
*
|
||||
* @param dispenseMedicineList 发药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicineDispense(List<DispenseItemDto> dispenseMedicineList) {
|
||||
// 获取发药单id列表
|
||||
List<Long> medDispenseIdList
|
||||
= dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取药品待发放库存信息
|
||||
List<UnDispenseInventoryDto> unDispenseInventoryList
|
||||
= returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (unDispenseInventoryList == null || unDispenseInventoryList.isEmpty()) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 发药单状态校验
|
||||
if (unDispenseInventoryList.stream().map(UnDispenseInventoryDto::getDispenseStatus)
|
||||
.anyMatch(x -> !x.equals(DispenseStatus.PREPARED.getValue()))) {
|
||||
throw new ServiceException("发药失败,请检查发药单状态");
|
||||
}
|
||||
|
||||
// 库存待更新列表
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 根据批号,发放项目,发放药房进行分组处理
|
||||
Map<String, List<UnDispenseInventoryDto>> unDispenseInventoryMap
|
||||
= unDispenseInventoryList.stream().collect(Collectors.groupingBy(x -> x.getItemId()
|
||||
+ CommonConstants.Common.DASH + x.getLotNumber() + CommonConstants.Common.DASH + x.getLocationId()));
|
||||
if (!unDispenseInventoryMap.isEmpty()) {
|
||||
for (Map.Entry<String, List<UnDispenseInventoryDto>> entry : unDispenseInventoryMap.entrySet()) {
|
||||
List<UnDispenseInventoryDto> inventoryList = entry.getValue();
|
||||
if (!inventoryList.isEmpty()) {
|
||||
if (inventoryList.stream().map(UnDispenseInventoryDto::getInventoryStatusEnum)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 停供库存校验
|
||||
return R.fail(inventoryList.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
// 最小单位数量
|
||||
BigDecimal minQuantity = BigDecimal.ZERO;
|
||||
// 库存数量
|
||||
BigDecimal inventoryQuantity = BigDecimal.ZERO;
|
||||
// 库存id
|
||||
Long inventoryId = null;
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : inventoryList) {
|
||||
BigDecimal quantity = unDispenseInventoryDto.getQuantity();
|
||||
if (!unDispenseInventoryDto.getDispenseUnit()
|
||||
.equals(unDispenseInventoryDto.getInventoryUnitCode())) {
|
||||
// 转换为小单位进行累加
|
||||
quantity
|
||||
= unDispenseInventoryDto.getQuantity().multiply(unDispenseInventoryDto.getPartPercent());
|
||||
}
|
||||
minQuantity = minQuantity.add(quantity);
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(unDispenseInventoryDto.getInventoryStatusEnum())
|
||||
&& unDispenseInventoryDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) > 0) {
|
||||
inventoryQuantity = unDispenseInventoryDto.getInventoryQuantity();
|
||||
inventoryId = unDispenseInventoryDto.getInventoryId();
|
||||
}
|
||||
}
|
||||
if (minQuantity.compareTo(inventoryQuantity) > 0) {
|
||||
// 库存不足
|
||||
return R.fail(inventoryList.get(0).getItemName() + "批号库存不足");
|
||||
} else {
|
||||
// 设置待更新的库存信息
|
||||
inventoryItemList.add(new InventoryItem().setId(inventoryId)
|
||||
.setQuantity(inventoryQuantity.subtract(minQuantity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 发药单待更新列表
|
||||
List<MedicationDispense> dispenseUpdateList = new ArrayList<>();
|
||||
// 追溯码列表
|
||||
List<TraceNoManage> tracesNoManageList = new ArrayList<>();
|
||||
TraceNoManage traceNoManage;
|
||||
// 进销存参数列表
|
||||
List<SupplyItemDetailDto> supplyItemDetailList = new ArrayList<>();
|
||||
// 当前时间
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
// 当前用户id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
|
||||
for (UnDispenseInventoryDto unDispenseInventoryDto : unDispenseInventoryList) {
|
||||
MedicationDispense medicationDispense = new MedicationDispense();
|
||||
// 发药单id
|
||||
medicationDispense.setId(unDispenseInventoryDto.getDispenseId());
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(nowDate);
|
||||
// 发药数量
|
||||
medicationDispense.setDispenseQuantity(unDispenseInventoryDto.getQuantity());
|
||||
// 发药时间
|
||||
medicationDispense.setDispenseTime(nowDate);
|
||||
// 发药人
|
||||
medicationDispense.setPractitionerId(practitionerId);
|
||||
dispenseUpdateList.add(medicationDispense);
|
||||
|
||||
// 设置库存变更参数
|
||||
supplyItemDetailList.add(new SupplyItemDetailDto().setItemId(unDispenseInventoryDto.getItemId())
|
||||
.setLotNumber(unDispenseInventoryDto.getLotNumber())
|
||||
.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
.setRequestId(unDispenseInventoryDto.getRequestId()));
|
||||
|
||||
// 处理追溯码相关
|
||||
// 使用逗号分割追溯码并转换为List
|
||||
if (unDispenseInventoryDto.getTraceNo() != null) {
|
||||
String[] traceNoList = unDispenseInventoryDto.getTraceNo().split(CommonConstants.Common.COMMA);
|
||||
for (String item : traceNoList) {
|
||||
traceNoManage = new TraceNoManage();
|
||||
// 追溯码处理
|
||||
traceNoManage.setItemTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
// 项目id
|
||||
.setItemId(unDispenseInventoryDto.getItemId())
|
||||
// 仓库类型
|
||||
.setLocationTypeEnum(LocationForm.PHARMACY.getValue())
|
||||
// 仓库
|
||||
.setLocationId(unDispenseInventoryDto.getLocationId())
|
||||
// 产品批号
|
||||
.setLotNumber(unDispenseInventoryDto.getLotNumber())
|
||||
// 追溯码
|
||||
.setTraceNo(item)
|
||||
// 追溯码状态
|
||||
.setStatusEnum(TraceNoStatus.OUT.getValue())
|
||||
// 追溯码单位
|
||||
.setUnitCode(unDispenseInventoryDto.getDispenseUnit())
|
||||
// 操作类型
|
||||
.setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
|
||||
tracesNoManageList.add(traceNoManage);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 药品发放更新
|
||||
medicationDispenseService.updateBatchById(dispenseUpdateList);
|
||||
// 库存更新
|
||||
inventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 追溯码管理表数据追加
|
||||
if (!tracesNoManageList.isEmpty()) {
|
||||
traceNoManageService.saveBatch(tracesNoManageList);
|
||||
}
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
List<String> uploadFailedNoList;
|
||||
// 调用医保商品销售接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
// 设置进销存参数
|
||||
List<MedicationDefinition> medicationDefinitions = medicationDefinitionService.listByIds(
|
||||
supplyItemDetailList.stream().map(SupplyItemDetailDto::getItemId).collect(Collectors.toList()));
|
||||
// 用itemId分组
|
||||
Map<Long, MedicationDefinition> medicationMap = medicationDefinitions.stream()
|
||||
.collect(Collectors.toMap(MedicationDefinition::getId, Function.identity()));
|
||||
// 设置库存变更参数
|
||||
for (SupplyItemDetailDto dto : supplyItemDetailList) {
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dto.getItemTable())) {
|
||||
MedicationDefinition med = medicationMap.get(dto.getItemId());
|
||||
if (med != null) {
|
||||
dto.setItemBusNo(med.getBusNo()).setPartPercent(med.getPartPercent()).setRxFlag(med.getRxFlag())
|
||||
.setYbNo(med.getYbNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
uploadFailedNoList = this.ybMedicineIntegrated(medDispenseIdList, null);
|
||||
uploadFailedNoList = receiptApprovalAppService.ybInventoryIntegrated(supplyItemDetailList,
|
||||
YbInvChgType.OTHER_OUT, DateUtils.getNowDate(), true);
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3505商品销售上传成功";
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseMedicineList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicineCancel(List<DispenseItemDto> dispenseMedicineList) {
|
||||
// 获取发药单id列表
|
||||
List<Long> medDispenseIdList
|
||||
= dispenseMedicineList.stream().map(DispenseItemDto::getDispenseId).collect(Collectors.toList());
|
||||
// 药品发药信息查询
|
||||
List<MedicationDispense> dispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
if (dispenseList != null) {
|
||||
for (MedicationDispense medicationDispense : dispenseList) {
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||
// 未发药原因
|
||||
medicationDispense.setNotPerformedReasonEnum(dispenseMedicineList.get(0).getNotPerformedReasonEnum());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
}
|
||||
// 药品发放更新
|
||||
medicationDispenseService.updateBatchById(dispenseList);
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 医保发药相关进销存接口
|
||||
*
|
||||
* @param medDispenseIdList 发药id列表
|
||||
* @param devDispenseIdList 发耗材id列表
|
||||
* @return 上传失败的编号集合
|
||||
*/
|
||||
public List<String> ybMedicineIntegrated(@Nullable List<Long> medDispenseIdList,
|
||||
@Nullable List<Long> devDispenseIdList) {
|
||||
List<String> uploadFailedNoList = new ArrayList<>();
|
||||
R<?> result;
|
||||
if ((medDispenseIdList != null && !medDispenseIdList.isEmpty())
|
||||
|| (devDispenseIdList != null && !devDispenseIdList.isEmpty())) {
|
||||
// 查询发药项目相关信息
|
||||
List<DispenseInventoryDto> dispenseInventoryList = returnMedicineMapper.selectReturnItemDetail(
|
||||
devDispenseIdList, medDispenseIdList, CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) {
|
||||
if (dispenseInventoryDto.getYbNo() == null) {
|
||||
continue;
|
||||
}
|
||||
Pair<Medical3505Param, Contract> medical3505Pair = getMedical3505Param(dispenseInventoryDto);
|
||||
// 如果自费则自动取省医保
|
||||
Contract contract = medical3505Pair.getRight();
|
||||
if (contract != null) {
|
||||
if (CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
|
||||
.equals(medical3505Pair.getRight().getBusNo())) {
|
||||
contract = null;
|
||||
}
|
||||
}
|
||||
result = ybService.merchandise(medical3505Pair.getLeft(), contract);
|
||||
if (result.getCode() != 200) {
|
||||
uploadFailedNoList.add(dispenseInventoryDto.getDispenseNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
return uploadFailedNoList;
|
||||
}
|
||||
|
||||
private Pair<Medical3505Param, Contract> getMedical3505Param(DispenseInventoryDto dispenseInventoryDto) {
|
||||
Medical3505Param medical3505Param = new Medical3505Param();
|
||||
ChargeItem chargeItem = null;
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
// 查询费用结算信息
|
||||
chargeItem = chargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
|
||||
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.MED_MEDICATION_REQUEST)
|
||||
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getReqId())
|
||||
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
chargeItem = chargeItemService.getOne(new LambdaQueryWrapper<ChargeItem>()
|
||||
.eq(ChargeItem::getServiceTable, CommonConstants.TableName.WOR_DEVICE_REQUEST)
|
||||
.eq(ChargeItem::getServiceId, dispenseInventoryDto.getReqId())
|
||||
.eq(ChargeItem::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
|
||||
}
|
||||
|
||||
if (chargeItem == null) {
|
||||
throw new ServiceException("未查找到收费项");
|
||||
}
|
||||
// 查询就诊诊断信息
|
||||
EncounterDiagnosis encounterDiagnosis = encounterDiagnosisService.getById(chargeItem.getEncounterDiagnosisId());
|
||||
if (encounterDiagnosis == null) {
|
||||
throw new ServiceException("未查找到就诊诊断信息");
|
||||
}
|
||||
// 查询付款信息
|
||||
List<PaymentReconciliation> paymentReconciliationList
|
||||
= paymentReconciliationService.list(new LambdaQueryWrapper<PaymentReconciliation>()
|
||||
.eq(PaymentReconciliation::getEncounterId, dispenseInventoryDto.getEncounterId())
|
||||
.eq(PaymentReconciliation::getTenantId, SecurityUtils.getLoginUser().getTenantId())
|
||||
.like(PaymentReconciliation::getChargeItemIds, chargeItem.getId())
|
||||
.eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
|
||||
.eq(PaymentReconciliation::getPatientId, dispenseInventoryDto.getPatientId())
|
||||
.eq(PaymentReconciliation::getPaymentEnum, PaymentType.PAY.getValue())
|
||||
.orderByDesc(PaymentReconciliation::getBillDate));
|
||||
if (paymentReconciliationList == null || paymentReconciliationList.isEmpty()) {
|
||||
throw new ServiceException("未查找到收费信息");
|
||||
}
|
||||
PaymentReconciliation paymentReconciliation = paymentReconciliationList.get(0);
|
||||
// 查询账户信息
|
||||
Account account = accountService
|
||||
.getOne(new LambdaQueryWrapper<Account>().eq(Account::getEncounterId, dispenseInventoryDto.getEncounterId())
|
||||
.eq(Account::getEncounterFlag, Whether.YES.getValue()));
|
||||
if (account == null) {
|
||||
throw new ServiceException("未查找到账户信息");
|
||||
}
|
||||
// 查询合同实体
|
||||
Contract contract
|
||||
= contractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
|
||||
if (contract == null) {
|
||||
throw new ServiceException("未查找到合同信息");
|
||||
}
|
||||
YbMdtrtCertType mdtrtCertType;
|
||||
if (AccountType.PERSONAL_CASH_ACCOUNT.getCode().equals(account.getTypeCode())) {
|
||||
mdtrtCertType = YbMdtrtCertType.MDTRT_CERT_TYPE02;
|
||||
} else {
|
||||
mdtrtCertType = YbMdtrtCertType.getByValue(account.getTypeCode());// 2025/05/28 该值存01/02/03
|
||||
}
|
||||
if (mdtrtCertType == null) {
|
||||
throw new ServiceException("未查找到就诊凭证信息");
|
||||
}
|
||||
// 查询就诊id
|
||||
if (contract.getCategoryEnum().equals(Category.SELF.getValue())
|
||||
|| contract.getCategoryEnum().equals(Category.PUBLIC.getValue())) {
|
||||
medical3505Param.setMdtrtSn(dispenseInventoryDto.getEncounterNo()).setMdtrtSetlType("2");
|
||||
} else {
|
||||
// todo:虽然是医保挂号,但是用什么结算的暂时未知先不做修改
|
||||
ClinicSettle clinicSettle = clinicSettleService.getOne(new LambdaQueryWrapper<ClinicSettle>()
|
||||
.in(ClinicSettle::getSetlId, List.of(paymentReconciliation.getYbSettleIds()))
|
||||
.eq(ClinicSettle::getMedType, encounterDiagnosis.getMedTypeCode()).last(" LIMIT 1"));
|
||||
if (clinicSettle != null) {
|
||||
medical3505Param.setMdtrtSn(clinicSettle.getMdtrtId()).setMdtrtSetlType("1");
|
||||
} else {
|
||||
medical3505Param.setMdtrtSn(dispenseInventoryDto.getEncounterNo()).setMdtrtSetlType("2");
|
||||
}
|
||||
}
|
||||
// // 查询发票信息
|
||||
// Invoice invoice = iInvoiceService.getById(paymentReconciliation.getInvoiceId());
|
||||
// if (invoice == null) {
|
||||
// throw new ServiceException("未查找到就诊发票信息");
|
||||
// }
|
||||
// 转换为JSON
|
||||
JSONArray medicalTraceNo = new JSONArray();
|
||||
// 获取追溯码信息
|
||||
if (dispenseInventoryDto.getTraceNo() != null) {
|
||||
List<String> traceNoList
|
||||
= Arrays.stream(dispenseInventoryDto.getTraceNo().split(CommonConstants.Common.COMMA)).map(String::trim)
|
||||
.filter(s -> !s.isEmpty()).toList();
|
||||
for (String traceNo : traceNoList) {
|
||||
Map<String, String> traceNoMap = new HashMap<>();
|
||||
traceNoMap.put("drug_trac_codg", traceNo);
|
||||
medicalTraceNo.add(traceNoMap);
|
||||
}
|
||||
}
|
||||
medical3505Param.setMedListCodg(dispenseInventoryDto.getYbNo())
|
||||
.setFixmedinsBchno(dispenseInventoryDto.getReqId().toString())
|
||||
.setFixmedinsHilistId(dispenseInventoryDto.getItemNo())
|
||||
.setPrscDrName(dispenseInventoryDto.getPractitionerName())
|
||||
.setPharName(dispenseInventoryDto.getDispenseName())
|
||||
.setPharPracCertNo(dispenseInventoryDto.getPharPracCertNo()).setPsnCertType(mdtrtCertType.getValue())
|
||||
.setManuLotnum(dispenseInventoryDto.getLotNumber()).setManuDate(dispenseInventoryDto.getProductionDate())
|
||||
.setRtalDocno(dispenseInventoryDto.getDispenseNo())
|
||||
.setSelRetnCnt(new BigDecimal(dispenseInventoryDto.getDispenseQuantity().toString()))
|
||||
.setSelRetnTime(dispenseInventoryDto.getDispenseTime()).setExpyEnd(dispenseInventoryDto.getExpirationDate())
|
||||
.setStooutNo(dispenseInventoryDto.getDispenseNo()).setDrugtracinfo(medicalTraceNo)
|
||||
.setCertno(dispenseInventoryDto.getIdCard()).setPsnName(dispenseInventoryDto.getPatientName());
|
||||
if (dispenseInventoryDto.getInventoryUnitCode().equals(dispenseInventoryDto.getDispenseUnitCode())) {
|
||||
medical3505Param.setTrdnFlag(Whether.YES.getCode());
|
||||
} else {
|
||||
medical3505Param.setTrdnFlag(Whether.NO.getCode());
|
||||
}
|
||||
// 查看所属医院
|
||||
String fixmedinsCode
|
||||
= SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.FIXMEDINS_CODE);
|
||||
if (dispenseInventoryDto.getPreparerName() == null && HospitalCodeEnum.CCU.getCode().equals(fixmedinsCode)) {
|
||||
medical3505Param.setSelRetnOpterName(CommonConstants.CCU.DisDeviceDoctorName);
|
||||
} else {
|
||||
medical3505Param.setSelRetnOpterName(dispenseInventoryDto.getPreparerName());
|
||||
}
|
||||
if (YbRxFlag.IMPORTANT_HERBAL_SLICES.getCode() == dispenseInventoryDto.getRxFlag()) {
|
||||
medical3505Param.setRxFlag(YbRxFlag.IMPORTANT_HERBAL_SLICES.getName());
|
||||
} else if (YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getCode() == dispenseInventoryDto.getRxFlag()) {
|
||||
medical3505Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
} else if (YbRxFlag.SELF_PREPARED_MEDICATION.getCode() == dispenseInventoryDto.getRxFlag()) {
|
||||
medical3505Param.setRxFlag(YbRxFlag.WESTERN_AND_CHINESE_PATENT_MEDICINE.getName());
|
||||
}
|
||||
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
medical3505Param.setFixmedinsHilistName(CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(dispenseInventoryDto.getItemTable())) {
|
||||
medical3505Param.setFixmedinsHilistName(CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
}
|
||||
return Pair.of(medical3505Param, contract);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IInHospitalReturnMedicineAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.ReturnMedicineDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* TODO:概括描述当前类的主要用途和注意事项
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/inHospital-return-medicine")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class InHospitalReturnMedicineController {
|
||||
|
||||
@Resource
|
||||
public IInHospitalReturnMedicineAppService inHospitalReturnMedicineAppService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> returnMedicineInit() {
|
||||
return inHospitalReturnMedicineAppService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param encounterInfoDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
@GetMapping(value = "/return-patient-page")
|
||||
public R<?> getReturnMedicinePatientPage(EncounterInfoDto encounterInfoDto,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return inHospitalReturnMedicineAppService.getReturnMedicinePatientPage(encounterInfoDto, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退药信息
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @param refundStatus 退药id
|
||||
* @param itemTable 项目类型
|
||||
* @return 退药信息
|
||||
*/
|
||||
@GetMapping("/medicine-return-list")
|
||||
public R<?> getReturnMedicineInfo(@RequestParam Long encounterId, @RequestParam Integer refundStatus,
|
||||
String itemTable) {
|
||||
return inHospitalReturnMedicineAppService.getReturnMedicineInfo(encounterId, refundStatus, itemTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退药处理
|
||||
*
|
||||
* @param medicineReturnList 退药清单
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/medicine-return")
|
||||
public R<?> medicineReturn(@RequestBody List<ReturnMedicineDto> medicineReturnList) {
|
||||
return inHospitalReturnMedicineAppService.medicineReturn(medicineReturnList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IMedicalDeviceDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseItemDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||
import com.openhis.web.pharmacymanage.dto.ItemDispenseOrderDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 材料发送
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/8/21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/device-dispense")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class MedicalDeviceDispenseController {
|
||||
|
||||
@Resource
|
||||
public IMedicalDeviceDispenseAppService medicalDeviceDispenseAppService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> deviceDispenseInit() {
|
||||
return medicalDeviceDispenseAppService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询病人列表
|
||||
*
|
||||
* @param encounterInfoSearchParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 病人列表
|
||||
*/
|
||||
@GetMapping("/encounter-list")
|
||||
public R<?> getEncounterInfoList(EncounterInfoSearchParam encounterInfoSearchParam, String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return medicalDeviceDispenseAppService.getEncounterInfoListPage(encounterInfoSearchParam, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发耗材单查询
|
||||
*
|
||||
* @param itemDispenseOrderDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 发耗材单
|
||||
*/
|
||||
@GetMapping("/device-order")
|
||||
public R<?> getDeviceDispenseOrderList(ItemDispenseOrderDto itemDispenseOrderDto,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return medicalDeviceDispenseAppService.getDeviceDispenseOrderList(itemDispenseOrderDto, pageNo, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核对发耗材
|
||||
*
|
||||
* @param dispenseDeviceList 发耗材信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/device-dispense")
|
||||
public R<?> deviceDispense(@RequestBody List<DispenseItemDto> dispenseDeviceList) {
|
||||
return medicalDeviceDispenseAppService.deviceDispense(dispenseDeviceList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发放耗材(长大专属)
|
||||
*
|
||||
* @param chargeItemIds 耗材收费单ids
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/consumables-dispense")
|
||||
public R<?> dispenseMedicalConsumables(@RequestBody List<Long> chargeItemIds) {
|
||||
return medicalDeviceDispenseAppService.dispenseMedicalConsumables(chargeItemIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseDeviceList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/device-cancel")
|
||||
public R<?> deviceCancel(@RequestBody List<DispenseItemDto> dispenseDeviceList) {
|
||||
return medicalDeviceDispenseAppService.deviceCancel(dispenseDeviceList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IMedicationDetailsAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.MedDetailsSearchParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 发药明细
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025/4/14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/medication-details")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class MedicationDetailsController {
|
||||
|
||||
@Resource
|
||||
public IMedicationDetailsAppService medicationDetailsAppService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
return medicationDetailsAppService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 门诊人员发药明细表
|
||||
*
|
||||
* @param medDetailsSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 门诊发药明细表
|
||||
*/
|
||||
@GetMapping(value = "/amb-practitioner-detail")
|
||||
public R<?> getAmbPractitionerDetailPage(MedDetailsSearchParam medDetailsSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return medicationDetailsAppService.getAmbPractitionerDetailPage(medDetailsSearchParam, pageNo, pageSize,
|
||||
searchKey, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 门诊发药明细流水账
|
||||
*
|
||||
* @param medDetailsSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 门诊发药明细流水账
|
||||
*/
|
||||
@GetMapping(value = "/amb-medication-detail")
|
||||
public R<?> getAmbMedicationDispenseDetailPage(MedDetailsSearchParam medDetailsSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return medicationDetailsAppService.getAmbMedicationDispenseDetailPage(medDetailsSearchParam, pageNo, pageSize,
|
||||
searchKey, request);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 门诊/住院人员发药明细帐、住院耗材记账领用明细
|
||||
// *
|
||||
// * @param medDetailsSearchParam 查询条件
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param request 请求数据
|
||||
// * @return 门诊/住院人员发药明细、住院耗材记账领用明细分页列表
|
||||
// */
|
||||
// @GetMapping(value = "/med-detail-page")
|
||||
// public R<?> getMedDetailedAccountPage(MedDetailsSearchParam medDetailsSearchParam,
|
||||
// @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
// @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
// @RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
// return medicationDetailsAppService.getMedDetailedAccountPage(medDetailsSearchParam, pageNo, pageSize, searchKey,
|
||||
// request);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 门诊/住院发药明细流水帐、住院耗材记账领用流水账
|
||||
// *
|
||||
// * @param medDetailsSearchParam 查询条件
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param request 请求数据
|
||||
// * @return 门诊/住院发药明细流水帐、住院耗材记账领用流水账分页列表
|
||||
// */
|
||||
// @GetMapping(value = "/med-running-page")
|
||||
// public R<?> getMedRunningAccountPage(MedDetailsSearchParam medDetailsSearchParam,
|
||||
// @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
// @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
// @RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
// return medicationDetailsAppService.getMedRunningAccountPage(medDetailsSearchParam, pageNo, pageSize, searchKey,
|
||||
// request);
|
||||
// }
|
||||
/**
|
||||
* 发药明细导出
|
||||
*
|
||||
* @param medDetailsSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param response 请求数据
|
||||
* @param request 请求数据
|
||||
*/
|
||||
@GetMapping(value = "/excel-out")
|
||||
public void exportExcel(MedDetailsSearchParam medDetailsSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
medicationDetailsAppService.makeExcelFile(medDetailsSearchParam, pageNo, pageSize, searchKey, response, request);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IPendingMedicationDetailsAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.PendingMedicationSearchParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 待发药明细
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025/4/14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/pending-medication")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class PendingMedicationDetailsController {
|
||||
|
||||
@Resource
|
||||
public IPendingMedicationDetailsAppService pendingMedicationDetailsAppService;
|
||||
|
||||
/**
|
||||
* 分页查询待发药明细
|
||||
*
|
||||
* @param pendingMedicationSearchParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param request 请求数据
|
||||
* @return 待发药明细
|
||||
*/
|
||||
@GetMapping("/pending-medication-page")
|
||||
public R<?> getPage(PendingMedicationSearchParam pendingMedicationSearchParam,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
return pendingMedicationDetailsAppService.getPage(pendingMedicationSearchParam, pageNo, pageSize, searchKey,
|
||||
request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IReturnMedicineAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.ReturnMedicineDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 退药(退耗材)管理
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025/4/4
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/return-medicine")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class ReturnMedicineController {
|
||||
|
||||
@Resource
|
||||
public IReturnMedicineAppService returnMedicineAppService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> returnMedicineInit() {
|
||||
return returnMedicineAppService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param encounterInfoDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
@GetMapping(value = "/return-patient-page")
|
||||
public R<?> getReturnMedicinePatientPage(EncounterInfoDto encounterInfoDto,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return returnMedicineAppService.getReturnMedicinePatientPage(encounterInfoDto, searchKey, pageNo, pageSize,
|
||||
request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退药信息
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @param refundStatus 退药id
|
||||
* @return 退药信息
|
||||
*/
|
||||
@GetMapping("/medicine-return-list")
|
||||
public R<?> getReturnMedicineInfo(@RequestParam Long encounterId, @RequestParam Integer refundStatus) {
|
||||
return returnMedicineAppService.getReturnMedicineInfo(encounterId, refundStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退药处理
|
||||
*
|
||||
* @param medicineReturnList 退药清单
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/medicine-return")
|
||||
public R<?> medicineReturn(@RequestBody List<ReturnMedicineDto> medicineReturnList) {
|
||||
return returnMedicineAppService.medicineReturn(medicineReturnList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.ISummaryDispenseMedicineAppService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 住院汇总发药
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/6/3
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/summary-dispense-medicine")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class SummaryDispenseMedicineController {
|
||||
|
||||
@Resource
|
||||
public ISummaryDispenseMedicineAppService medicineSummaryDispenseService;
|
||||
|
||||
/**
|
||||
* 汇总发药
|
||||
*
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/summary-dispense-medicine")
|
||||
public R<?> SummaryDispenseMedicine(@RequestBody List<String> summaryNoList) {
|
||||
return medicineSummaryDispenseService.SummaryDispenseMedicine(summaryNoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param summaryNoList 汇总单列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/dispense-cancel")
|
||||
public R<?> dispenseCancel(@RequestBody List<String> summaryNoList) {
|
||||
return medicineSummaryDispenseService.dispenseCancel(summaryNoList);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 住院发药
|
||||
// *
|
||||
// * @param searchParam 查询条件
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param request 请求数据
|
||||
// */
|
||||
// @GetMapping(value = "/excel-out")
|
||||
// public void excelOut(MedicineSummarySearchParam searchParam,
|
||||
// @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
// @RequestParam(value = "pageSize", defaultValue = "10000") Integer pageSize,
|
||||
// @RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request,
|
||||
// HttpServletResponse response) {
|
||||
// medicineSummaryDispenseService.makeExcelFile(searchParam, pageNo, pageSize, searchKey, request, response);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 住院汇总
|
||||
// *
|
||||
// * @param searchParam 查询条件
|
||||
// * @param searchKey 模糊查询关键字
|
||||
// * @param pageNo 当前页码
|
||||
// * @param pageSize 查询条数
|
||||
// * @param request 请求数据
|
||||
// */
|
||||
// @GetMapping("/excel-put")
|
||||
// public void excelPut(FromSearchParam searchParam,
|
||||
// @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
// @RequestParam(value = "pageSize", defaultValue = "10000") Integer pageSize,
|
||||
// @RequestParam(name = "searchKey", required = false) String searchKey, HttpServletRequest request,
|
||||
// HttpServletResponse response) {
|
||||
// medicineSummaryDispenseService.takeExcelField(searchParam, searchKey, pageNo, pageSize, request, response);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseItemDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||
import com.openhis.web.pharmacymanage.dto.ItemDispenseOrderDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 西药发药
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025/3/14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/western-medicine-dispense")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class WesternMedicineDispenseController {
|
||||
|
||||
@Resource
|
||||
public IWesternMedicineDispenseAppService westernMedicineDispenseService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> medicineDispenseInit() {
|
||||
return westernMedicineDispenseService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询病人列表
|
||||
*
|
||||
* @param encounterInfoSearchParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 病人列表
|
||||
*/
|
||||
@GetMapping("/encounter-list")
|
||||
public R<?> getEncounterInfoList(EncounterInfoSearchParam encounterInfoSearchParam, String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return westernMedicineDispenseService.getEncounterInfoListPage(encounterInfoSearchParam, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发药单查询
|
||||
*
|
||||
* @param itemDispenseOrderDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
@GetMapping("/medicine-order")
|
||||
public R<?> getMedicineDispenseOrderList(ItemDispenseOrderDto itemDispenseOrderDto,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return westernMedicineDispenseService.getMedicineDispenseOrderList(itemDispenseOrderDto, pageNo, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配药
|
||||
*
|
||||
* @param dispenseMedicineList 配药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/prepare")
|
||||
public R<?> medicinePrepare(@RequestBody List<DispenseItemDto> dispenseMedicineList) {
|
||||
return westernMedicineDispenseService.medicinePrepare(dispenseMedicineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核对发药
|
||||
*
|
||||
* @param dispenseMedicineList 发药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/medicine-dispense")
|
||||
public R<?> medicineDispense(@RequestBody List<DispenseItemDto> dispenseMedicineList) {
|
||||
return westernMedicineDispenseService.medicineDispense(dispenseMedicineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseMedicineList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/medicine-cancel")
|
||||
public R<?> medicineCancel(@RequestBody List<DispenseItemDto> dispenseMedicineList) {
|
||||
return westernMedicineDispenseService.medicineCancel(dispenseMedicineList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发放列表初始化
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025-03-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DispenseInitDto {
|
||||
|
||||
/** 科室列表 */
|
||||
private List<DepartmentOption> departmentOptions;
|
||||
|
||||
/** 未发药原因 */
|
||||
private List<NotPerformedReasonOption> notPerformedReasonOptions;
|
||||
|
||||
/** 发药状态 */
|
||||
private List<DispenseStatusOption> dispenseStatusOptions;
|
||||
|
||||
/** 发药状态 */
|
||||
private List<PreparerDoctorOption> preparerDoctorOptions;
|
||||
|
||||
/** 患者类型 */
|
||||
private List<EncounterClassOption> encounterClassOptions;
|
||||
|
||||
@Data
|
||||
public static class DepartmentOption {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
|
||||
public DepartmentOption(Long value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class NotPerformedReasonOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public NotPerformedReasonOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class EncounterClassOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public EncounterClassOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Data
|
||||
public static class PreparerDoctorOption {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
|
||||
public PreparerDoctorOption(Long value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
// 手动添加 setter 方法以确保编译正确
|
||||
public DispenseInitDto setDepartmentOptions(List<DepartmentOption> departmentOptions) {
|
||||
this.departmentOptions = departmentOptions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DispenseInitDto setNotPerformedReasonOptions(List<NotPerformedReasonOption> notPerformedReasonOptions) {
|
||||
this.notPerformedReasonOptions = notPerformedReasonOptions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DispenseInitDto setDispenseStatusOptions(List<DispenseStatusOption> dispenseStatusOptions) {
|
||||
this.dispenseStatusOptions = dispenseStatusOptions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DispenseInitDto setPreparerDoctorOptions(List<PreparerDoctorOption> preparerDoctorOptions) {
|
||||
this.preparerDoctorOptions = preparerDoctorOptions;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DispenseInitDto setEncounterClassOptions(List<EncounterClassOption> encounterClassOptions) {
|
||||
this.encounterClassOptions = encounterClassOptions;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 药品发放和库存表连接信息
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025-03-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DispenseInventoryDto {
|
||||
|
||||
/** 药品发放表主键ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/** 就诊id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 请求ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long reqId;
|
||||
|
||||
/** 退的请求id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long refundId;
|
||||
|
||||
/** 病人id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** 请求单位编码 */
|
||||
private String dispenseUnitCode;
|
||||
|
||||
/** 请求数量 */
|
||||
private BigDecimal dispenseQuantity;
|
||||
|
||||
/** 发放状态 */
|
||||
private Integer dispenseStatus;
|
||||
|
||||
/** 库存项目表主键ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long inventoryId;
|
||||
|
||||
/** 拆零单位 */
|
||||
private String inventoryUnitCode;
|
||||
|
||||
/** 当前库存数量(拆零单位) */
|
||||
private BigDecimal inventoryQuantity;
|
||||
|
||||
/** 拆零比 */
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 批号 */
|
||||
private String lotNumber;
|
||||
|
||||
/** 生产日期 */
|
||||
private Date productionDate;
|
||||
|
||||
/** 发药时间 */
|
||||
private Date dispenseTime;
|
||||
|
||||
/** 有效期止 */
|
||||
private Date expirationDate;
|
||||
|
||||
/** 追溯码 */
|
||||
private String traceNo;
|
||||
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 就诊编号 */
|
||||
private String encounterNo;
|
||||
|
||||
/** 项目编码 */
|
||||
private String itemNo;
|
||||
|
||||
/** 执业资格证号 */
|
||||
private String pharPracCertNo;
|
||||
|
||||
/** 发药编号 */
|
||||
private String dispenseNo;
|
||||
|
||||
/** 处方标志 */
|
||||
private Integer rxFlag;
|
||||
|
||||
/** 配药人 */
|
||||
private String preparerName;
|
||||
|
||||
/** 发药人 */
|
||||
private String dispenseName;
|
||||
|
||||
/** 开方人 */
|
||||
private String practitionerName;
|
||||
|
||||
/** 证件号码 */
|
||||
private String idCard;
|
||||
|
||||
/** 患者姓名 */
|
||||
private String patientName;
|
||||
|
||||
/** 所在表名 */
|
||||
private String itemTable;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 发药/耗材信息
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-05-23
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DispenseItemDto {
|
||||
|
||||
/**
|
||||
* 配药人
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long preparerId;
|
||||
|
||||
/**
|
||||
* 发放ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/**
|
||||
* 发药数量
|
||||
*/
|
||||
private BigDecimal quantity;
|
||||
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
private String lotNumber;
|
||||
|
||||
/**
|
||||
* 单据号
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 追溯码
|
||||
*/
|
||||
private String traceNo;
|
||||
|
||||
/**
|
||||
* 未发原因
|
||||
*/
|
||||
private Integer notPerformedReasonEnum;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 发药状态选项
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025-03-14
|
||||
*/
|
||||
@Data
|
||||
public class DispenseStatusOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public DispenseStatusOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 就诊人员列表
|
||||
*
|
||||
* @author WangYang
|
||||
* @date 2025-03-18
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterInfoDto {
|
||||
|
||||
/** 就诊ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 发放药房 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 科室 */
|
||||
private String departmentName;
|
||||
|
||||
/** 科室 */
|
||||
private Long departmentId;
|
||||
|
||||
/** 患者姓名 */
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 拼音码
|
||||
*/
|
||||
private String patientPyStr;
|
||||
|
||||
/**
|
||||
* 五笔码
|
||||
*/
|
||||
private String patientWbStr;
|
||||
|
||||
/**
|
||||
* 就诊编码
|
||||
*/
|
||||
private String encounterNo;
|
||||
|
||||
/** 性别 */
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/** 发药状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 退药状态 */
|
||||
private Integer refundEnum;
|
||||
private String refundEnum_enumText;
|
||||
|
||||
/** 就诊日期 */
|
||||
private String receptionTime;
|
||||
|
||||
/** 住院日期 */
|
||||
private String startTime;
|
||||
|
||||
/** 年龄 */
|
||||
private String age;
|
||||
|
||||
/** 生日 */
|
||||
private Date birthDate;
|
||||
|
||||
/** 电话 */
|
||||
private String phone;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 患者列表查询条件
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025-03-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterInfoSearchParam implements Serializable {
|
||||
|
||||
/** 执行状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 患者类型 */
|
||||
private Integer classEnum;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class FromSearchParam implements Serializable {
|
||||
|
||||
/** 单据号 */
|
||||
private String busNo;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 汇总发药单信息
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class FromSummaryDto {
|
||||
|
||||
/** 单据号 */
|
||||
private String busNo;
|
||||
|
||||
/** 申请时间 */
|
||||
private Date applyTime;
|
||||
|
||||
/** 领药人 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long applicantId;
|
||||
private String applicantName;
|
||||
|
||||
/** 发放地点 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long sourceLocationId;
|
||||
private String sourceLocationName;
|
||||
|
||||
/** 状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class FromSummarySearchParam implements Serializable {
|
||||
|
||||
/** 单据号 */
|
||||
private String busNo;
|
||||
|
||||
/** 发药状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 库存明细dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-11-20
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InventoryDetailDto {
|
||||
|
||||
/** 库存项目表主键ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long inventoryId;
|
||||
|
||||
/** 项目ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/** 库房ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 拆零单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String inventoryUnitCode;
|
||||
private String inventoryUnitCode_dictText;
|
||||
|
||||
/** 大单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String maxUnitCode;
|
||||
private String maxUnitCode_dictText;
|
||||
|
||||
/** 当前库存数量(拆零单位) */
|
||||
private BigDecimal inventoryQuantity;
|
||||
|
||||
/** 拆零比 */
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 批号 */
|
||||
private String inventoryLotNumber;
|
||||
|
||||
/** 有效期止 */
|
||||
private Date expirationDate;
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.core.common.annotation.Excel;
|
||||
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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发药/耗材单
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025-03-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ItemDispenseOrderDto {
|
||||
|
||||
/**
|
||||
* 发放药房
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 发放id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/**
|
||||
* 请求id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/**
|
||||
* 就诊id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 发放药房
|
||||
*/
|
||||
@Excel(name = "发放药房", sort = 3)
|
||||
private String locationName;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
@Excel(name = "批次号", sort = 4)
|
||||
private String lotNumber;
|
||||
|
||||
/**
|
||||
* 科室
|
||||
*/
|
||||
@Excel(name = "科室", sort = 5)
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 开单医生ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long doctorId;
|
||||
|
||||
/**
|
||||
* 开单医生
|
||||
*/
|
||||
@Excel(name = "开单医生", sort = 6)
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 发药医生
|
||||
*/
|
||||
@Excel(name = "发药医生", sort = 7)
|
||||
private String dispenseDoctorName;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
@Dict(dictCode = "med_category_code")
|
||||
private String itemType;
|
||||
@Excel(name = "项目类型", sort = 8)
|
||||
private String itemType_dictText;
|
||||
|
||||
/**
|
||||
* 发药状态
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
@Excel(name = "发药状态", sort = 9)
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/**
|
||||
* 诊断名称
|
||||
*/
|
||||
@Excel(name = "诊断名称", sort = 10)
|
||||
private String conditionName;
|
||||
|
||||
/**
|
||||
* 处方号
|
||||
*/
|
||||
@Excel(name = "处方号", sort = 11)
|
||||
private String prescriptionNo;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@Excel(name = "项目名称", sort = 1, width = 30)
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String merchandiseName;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@Excel(name = "规格", sort = 2, width = 30)
|
||||
private String totalVolume;
|
||||
|
||||
/**
|
||||
* 单次剂量
|
||||
*/
|
||||
@Excel(name = "单次剂量", sort = 12)
|
||||
private BigDecimal dose;
|
||||
|
||||
/**
|
||||
* 拆零比
|
||||
*/
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/**
|
||||
* 用药频次
|
||||
*/
|
||||
@Dict(dictCode = "rate_code")
|
||||
private String rateCode;
|
||||
@Excel(name = "用药频次", sort = 13)
|
||||
private String rateCode_dictText;
|
||||
|
||||
/**
|
||||
* 用法
|
||||
*/
|
||||
@Dict(dictCode = "method_code")
|
||||
private String methodCode;
|
||||
@Excel(name = "用法", sort = 14)
|
||||
private String methodCode_dictText;
|
||||
|
||||
/**
|
||||
* 剂量单位
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String doseUnitCode;
|
||||
@Excel(name = "剂量单位", sort = 15)
|
||||
private String doseUnitCode_dictText;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
@Excel(name = "单位", sort = 16)
|
||||
private String unitCode_dictText;
|
||||
|
||||
/**
|
||||
* 单次发药数
|
||||
*/
|
||||
@Excel(name = "单次发药数", sort = 17)
|
||||
private Integer dispensePerQuantity;
|
||||
|
||||
/**
|
||||
* 每次发药供应天数
|
||||
*/
|
||||
@Excel(name = "每次发药供应天数", sort = 18)
|
||||
private Integer dispensePerDuration;
|
||||
|
||||
/**
|
||||
* 请求数量
|
||||
*/
|
||||
private BigDecimal requestQuantity;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@Excel(name = "数量", sort = 19)
|
||||
private BigDecimal quantity;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
@Excel(name = "单价", sort = 20)
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
@Excel(name = "金额", sort = 21)
|
||||
private BigDecimal totalPrice;
|
||||
/**
|
||||
* 组合号
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 就诊NO
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Excel(name = "就诊NO", sort = 24)
|
||||
private String encounterBusNo;
|
||||
|
||||
/**
|
||||
* 开具日期
|
||||
*/
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "开具日期", sort = 25, dateFormat = "yyyy-MM-dd HH:mm:ss", width = 25)
|
||||
private Date reqAuthoredTime;
|
||||
|
||||
/**
|
||||
* 接收皮试标志
|
||||
*/
|
||||
@Excel(name = "皮试标志", sort = 26)
|
||||
private String skinTestFlagDesc;
|
||||
private Integer skinTestFlag;
|
||||
|
||||
/**
|
||||
* 接收中药标识
|
||||
*/
|
||||
@Excel(name = "中药标识", sort = 27)
|
||||
private String tcmFlagDesc;
|
||||
private Integer tcmFlag;
|
||||
|
||||
/**
|
||||
* 所在表
|
||||
*/
|
||||
@Excel(name = "所在表", sort = 28, width = 30)
|
||||
private String itemTable;
|
||||
|
||||
/**
|
||||
* 生产厂家
|
||||
*/
|
||||
@Excel(name = "生产厂家", sort = 22, width = 35)
|
||||
private String manufacturerText;
|
||||
|
||||
/**
|
||||
* 追溯码
|
||||
*/
|
||||
@Excel(name = "追溯码", sort = 23)
|
||||
private String traceNo;
|
||||
|
||||
/**
|
||||
* 就诊类型
|
||||
*/
|
||||
@Dict(dictCode = "med_type")
|
||||
private String medTypeCode;
|
||||
private String medTypeCode_dictText;
|
||||
|
||||
/**
|
||||
* 发药类型(处方类型:门诊/住院等)
|
||||
*/
|
||||
private Integer dispenseEnum;
|
||||
private String dispenseEnum_enumText;
|
||||
|
||||
/**
|
||||
* 输液标志
|
||||
*/
|
||||
private Integer injectFlag;
|
||||
|
||||
/**
|
||||
* 拆分属性
|
||||
*/
|
||||
private Integer partAttributeEnum;
|
||||
|
||||
/**
|
||||
* 库存明细列表
|
||||
*/
|
||||
private List<InventoryDetailDto> inventoryDetailList;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 农大门诊配/发药 参数类
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class JlauDispenseParam {
|
||||
|
||||
/**
|
||||
* 配/发药信息
|
||||
*/
|
||||
private List<DispenseItemDto> dispenseMedicineList;
|
||||
|
||||
/**
|
||||
* UI选择的发药时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date dispenseTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.core.common.annotation.Excel;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 发药明细账分页列表 dto
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedDetailedAccountPageDto {
|
||||
|
||||
/**
|
||||
* 门诊号
|
||||
*/
|
||||
private String outpatientNo;
|
||||
|
||||
/**
|
||||
* 处方号
|
||||
*/
|
||||
private String prescriptionNo;
|
||||
|
||||
/**
|
||||
* 患者
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 接收发药数量
|
||||
*/
|
||||
@Excel(name = "发药数量", sort = 8)
|
||||
private String dispenseQuantityStr;
|
||||
|
||||
/**
|
||||
* 接收发药金额
|
||||
*/
|
||||
@Excel(name = "发药金额", sort = 9)
|
||||
private String dispensePriceStr;
|
||||
|
||||
/**
|
||||
* 接收退药数量
|
||||
*/
|
||||
@Excel(name = "退药数量", sort = 10)
|
||||
private String refundQuantityStr;
|
||||
|
||||
/**
|
||||
* 接收退药金额
|
||||
*/
|
||||
@Excel(name = "退药金额", sort = 11)
|
||||
private String refundPriceStr;
|
||||
/**
|
||||
* 成本金额
|
||||
*/
|
||||
@Excel(name = "成本金额", sort = 12)
|
||||
private String costPriceStr;
|
||||
|
||||
/**
|
||||
* 发药人ID
|
||||
*/
|
||||
private String practitionerId;
|
||||
|
||||
/**
|
||||
* 发药人名称
|
||||
*/
|
||||
@Excel(name = "发药人", sort = 1)
|
||||
private String practitionerName;
|
||||
|
||||
/**
|
||||
* 药品项目
|
||||
*/
|
||||
@Excel(name = "药品项目", sort = 3)
|
||||
private String medicationName;
|
||||
|
||||
/**
|
||||
* 药品拼音
|
||||
*/
|
||||
private String pyStr;
|
||||
|
||||
/**
|
||||
* 项目编码
|
||||
*/
|
||||
@Excel(name = "药品编码", sort = 5)
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 发药编码
|
||||
*/
|
||||
@Excel(name = "发药单号", sort = 2)
|
||||
private String dispenseNo;
|
||||
|
||||
/**
|
||||
* 医保编码
|
||||
*/
|
||||
@Excel(name = "医保编码", sort = 6, width = 30)
|
||||
private String ybNo;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@Excel(name = "规格", sort = 7, width = 30)
|
||||
private String totalVolume;
|
||||
|
||||
/**
|
||||
* 发药数量
|
||||
*/
|
||||
private Integer dispenseQuantity;
|
||||
|
||||
/**
|
||||
* 发药金额
|
||||
*/
|
||||
private BigDecimal dispensePrice;
|
||||
|
||||
/**
|
||||
* 退药数量
|
||||
*/
|
||||
private Integer refundQuantity;
|
||||
|
||||
/**
|
||||
* 退药金额
|
||||
*/
|
||||
private BigDecimal refundPrice;
|
||||
/**
|
||||
* 成本金额
|
||||
*/
|
||||
|
||||
private BigDecimal costPrice;
|
||||
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
@Excel(name = "生产批号", sort = 13)
|
||||
private String lotNumber;
|
||||
|
||||
/**
|
||||
* 厂商
|
||||
*/
|
||||
@Excel(name = "厂家/产地", sort = 14, width = 35)
|
||||
private String manufacturerText;
|
||||
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
@Excel(name = "供应商", sort = 15, width = 35)
|
||||
private String supplierName;
|
||||
|
||||
/**
|
||||
* 发药单位
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/**
|
||||
* 退药单位
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String refundUnitCode;
|
||||
private String refundUnitCode_dictText;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发药时间
|
||||
*/
|
||||
@Excel(name = "发药时间", sort = 16, dateFormat = "yyyy-MM-dd HH:mm:ss", width = 35)
|
||||
private Date dispenseTime;
|
||||
|
||||
/**
|
||||
* 项目所在表
|
||||
*/
|
||||
@Excel(name = "项目类别", sort = 4)
|
||||
private String itemTable;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发药明细初始化信息
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedDetailsInitDto {
|
||||
|
||||
/** 发药人 */
|
||||
private List<Practitioner> practitionerList;
|
||||
|
||||
/** 结算状态 */
|
||||
private List<statusEnumOption> statusSettlementOptions;
|
||||
|
||||
/** 出院状态 */
|
||||
private List<statusEnumOption> statusDischargeOptions;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@Data
|
||||
public static class statusEnumOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
|
||||
public statusEnumOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 发药明细查询条件
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedDetailsSearchParam {
|
||||
|
||||
/**
|
||||
* 发药时间
|
||||
*/
|
||||
private Date dispenseTime;
|
||||
|
||||
/**
|
||||
* 药房
|
||||
*/
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 发药人
|
||||
*/
|
||||
private Long practitionerId;
|
||||
|
||||
/**
|
||||
* 药品名称
|
||||
*/
|
||||
private String medicationName;
|
||||
|
||||
/**
|
||||
* 药品项目(药品编码)
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 出院状态
|
||||
*/
|
||||
private Integer dischargeStatus;
|
||||
|
||||
/**
|
||||
* 门诊住院flg
|
||||
*/
|
||||
private Integer flag;
|
||||
|
||||
/**
|
||||
* 项目所在表
|
||||
*/
|
||||
private String itemTable;
|
||||
|
||||
/**
|
||||
* 统计类型
|
||||
*/
|
||||
private Integer inventoryScope;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.core.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 汇总发药信息
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-06-03
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedicineSummaryDto {
|
||||
|
||||
/**
|
||||
* 单据号
|
||||
*/
|
||||
@Excel(name = "单据号", sort = 8, width = 35)
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 供应请求id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/**
|
||||
* 供应发放id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long deliveryId;
|
||||
|
||||
/**
|
||||
* 项目表
|
||||
*/
|
||||
private String itemTable;
|
||||
/**
|
||||
* 项目名
|
||||
*/
|
||||
@Excel(name = "项目名", sort = 2, width = 40)
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@Excel(name = "规格", sort = 3)
|
||||
private String totalVolume;
|
||||
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
@Excel(name = "批号", sort = 4)
|
||||
private String lotNumber;
|
||||
|
||||
/**
|
||||
* 请求数
|
||||
*/
|
||||
@Excel(name = "数量", sort = 5)
|
||||
private BigDecimal quantity;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
@Excel(name = "序号", sort = 1)
|
||||
private Integer number;
|
||||
|
||||
/**
|
||||
* 生产厂家
|
||||
*/
|
||||
@Excel(name = "生产厂家", sort = 7, width = 45)
|
||||
private String manufacturerText;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@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;
|
||||
|
||||
/**
|
||||
* 发放地点
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long sourceLocationId;
|
||||
@Excel(name = "发放地点", sort = 6)
|
||||
private String sourceLocationName;
|
||||
|
||||
/**
|
||||
* 申请科室
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 领药人
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long applicantId;
|
||||
private String applicantName;
|
||||
|
||||
/**
|
||||
* 申请时间
|
||||
*/
|
||||
private Date applyTime;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/**
|
||||
* 患者信息
|
||||
*/
|
||||
private String patientInfo;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 住院发药初期dto
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-06-03
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedicineSummaryInitDto {
|
||||
|
||||
/** 科室列表 */
|
||||
private List<LongOptions> departmentOptions;
|
||||
/** 领药人列表 */
|
||||
private List<Practitioner> applicantOptions;
|
||||
|
||||
/** 发药状态 */
|
||||
private List<IntegerOptions> dispenseStatusOptions;
|
||||
|
||||
/** 未发药原因 */
|
||||
private List<IntegerOptions> notPerformedReasonOptions;
|
||||
|
||||
@Data
|
||||
public static class LongOptions {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
|
||||
public LongOptions(Long value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class IntegerOptions {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public IntegerOptions(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 患者列表查询条件
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-06-03
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedicineSummarySearchParam implements Serializable {
|
||||
|
||||
/** 就诊ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 科室 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
|
||||
/** 领药人 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long applicantId;
|
||||
|
||||
/** 发药状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 追溯码*/
|
||||
private String traceNo;
|
||||
|
||||
/** 供应发放id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long deliveryId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 待发药明细分页列表 dto
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PendingMedicationPageDto {
|
||||
|
||||
/** 药品编码 */
|
||||
private String medicineNo;
|
||||
|
||||
/** 药品名称 */
|
||||
private String medicineName;
|
||||
|
||||
/** 待发数量 */
|
||||
private String dispenseQuantity;
|
||||
|
||||
/** 请求单位编码 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 发药类型(处方类型) */
|
||||
private Integer dispenseEnum;
|
||||
private String dispenseEnum_enumText;
|
||||
|
||||
/** 患者姓名 */
|
||||
private String patientName;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 门诊号 */
|
||||
private String outpatientNo;
|
||||
|
||||
/** 住院号 */
|
||||
private String admissionNo;
|
||||
|
||||
/** 开单时间 */
|
||||
private String createTime;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 待发药明细查询条件
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PendingMedicationSearchParam {
|
||||
|
||||
// /** 开始时间 */
|
||||
// private Date startTime;
|
||||
//
|
||||
// /** 结束时间 */
|
||||
// private Date endTime;
|
||||
|
||||
/** 开单时间 */
|
||||
private String createTime;
|
||||
|
||||
/** 药品编码 */
|
||||
private String medicineNo;
|
||||
|
||||
/** 药品名称 */
|
||||
private String medicineName;
|
||||
|
||||
/** 统计类型 */
|
||||
// private Integer statisticTypeEnum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 退药信息
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-05-07
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ReturnMedicineDto {
|
||||
|
||||
/** 药品请求ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/** 药品发放ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/** 业务表名 */
|
||||
private String tableName;
|
||||
|
||||
/** 退药追溯码 */
|
||||
private String traceNo;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 退药信息
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025-04-07
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ReturnMedicineInfoDto {
|
||||
|
||||
/** 药品请求ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/** 退药ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long refundMedicineId;
|
||||
|
||||
/** 药品发放ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/** 药品ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/** 开单医生 */
|
||||
private String doctorName;
|
||||
|
||||
/** 批号 */
|
||||
private String lotNumber;
|
||||
|
||||
/** 药品 */
|
||||
private String itemName;
|
||||
|
||||
/** 已退数量 */
|
||||
private Integer dispenseQuantity;
|
||||
|
||||
/** 单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 总价 */
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/** 退药状态 */
|
||||
private Integer refundEnum;
|
||||
private String refundEnum_enumText;
|
||||
|
||||
/** 退药请求状态 */
|
||||
private Integer reqStatus;
|
||||
private String reqStatus_enumText;
|
||||
|
||||
/** 业务表名 */
|
||||
private String serviceTable;
|
||||
|
||||
/** 请求数量 */
|
||||
private Integer quantity;
|
||||
|
||||
/** 追溯码 */
|
||||
private String traceNo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025-04-04
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ReturnMedicineInitDto {
|
||||
|
||||
/** 科室列表 */
|
||||
private List<ReturnMedicineInitDto.DepartmentOption> departmentOptions;
|
||||
|
||||
/** 退药状态 */
|
||||
private List<ReturnMedicineInitDto.RefundStatusOption> refundStatusOptions;
|
||||
|
||||
/**
|
||||
* 科室列表
|
||||
*/
|
||||
@Data
|
||||
public static class DepartmentOption {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
|
||||
public DepartmentOption(Long value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退药状态
|
||||
*/
|
||||
@Data
|
||||
public static class RefundStatusOption {
|
||||
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public RefundStatusOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 待发放库存信息
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UnDispenseInventoryDto implements Serializable {
|
||||
|
||||
/** 库存ID */
|
||||
private Long inventoryId;
|
||||
|
||||
/** 发药ID */
|
||||
private Long dispenseId;
|
||||
|
||||
/** 请求ID */
|
||||
private Long requestId;
|
||||
|
||||
/** 项目ID */
|
||||
private Long itemId;
|
||||
|
||||
/** 批号 */
|
||||
private String lotNumber;
|
||||
|
||||
/** 发放药房id */
|
||||
private Long locationId;
|
||||
|
||||
/** 拆零单位 */
|
||||
private String inventoryUnitCode;
|
||||
|
||||
/** 发放单位 */
|
||||
private String dispenseUnit;
|
||||
|
||||
/** 当前库存数量(拆零单位) */
|
||||
private BigDecimal inventoryQuantity;
|
||||
|
||||
/** 已发数量 */
|
||||
private BigDecimal dispenseQuantity;
|
||||
|
||||
/** 发药状态 */
|
||||
private Integer dispenseStatus;
|
||||
|
||||
/** 发药数量 */
|
||||
private BigDecimal quantity;
|
||||
|
||||
/** 拆零比 */
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 药品名称 */
|
||||
private String itemName;
|
||||
|
||||
/** 库存状态 */
|
||||
private Integer inventoryStatusEnum;
|
||||
|
||||
/** 有效期至 */
|
||||
private Date expirationDate;
|
||||
|
||||
/** 追溯码 */
|
||||
private String TraceNo;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.pharmacymanage.dto.EncounterInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.ReturnMedicineInfoDto;
|
||||
|
||||
/**
|
||||
* TODO:概括描述当前类的主要用途和注意事项
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-12-29
|
||||
*/
|
||||
@Repository
|
||||
public interface InHospitalReturnMedicineAppMapper {
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param refundStatus 退药状态
|
||||
* @param pendingRefund 退药状态:待退药
|
||||
* @param refunded 退药状态:已退药
|
||||
* @param imp 患者类型:住院
|
||||
* @param medMedicationDefinition 药品表
|
||||
* @param admDeviceDefinition 耗材表
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
Page<EncounterInfoDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoDto> queryWrapper,
|
||||
@Param("refundStatus") Integer refundStatus, @Param("pendingRefund") Integer pendingRefund,
|
||||
@Param("refunded") Integer refunded, @Param("imp") Integer imp,
|
||||
@Param("medMedicationDefinition") String medMedicationDefinition,
|
||||
@Param("admDeviceDefinition") String admDeviceDefinition);
|
||||
|
||||
/**
|
||||
* 申请退药清单查询
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @param medMedicationRequest 药品请求表
|
||||
* @param worDeviceRequest 耗材请求表
|
||||
* @param medMedicationDefinition 药品表
|
||||
* @param admDeviceDefinition 耗材表
|
||||
* @param itemTable 项目所在表
|
||||
* @param refundStatus 退药状态
|
||||
* @param pendingRefund 退药状态:待退药
|
||||
* @param refunded 退药状态:已退药
|
||||
* @return 申请退药清单
|
||||
*/
|
||||
List<ReturnMedicineInfoDto> selectReturnMedicineInfo(@Param("encounterId") Long encounterId,
|
||||
@Param("worDeviceRequest") String worDeviceRequest, @Param("medMedicationRequest") String medMedicationRequest,
|
||||
@Param("medMedicationDefinition") String medMedicationDefinition,
|
||||
@Param("admDeviceDefinition") String admDeviceDefinition, @Param("itemTable") String itemTable,
|
||||
@Param("refundStatus") Integer refundStatus, @Param("pendingRefund") Integer pendingRefund,
|
||||
@Param("refunded") Integer refunded);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||
import com.openhis.web.pharmacymanage.dto.ItemDispenseOrderDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface MedicalDeviceDispenseMapper {
|
||||
|
||||
/**
|
||||
* 就诊病人列表分页查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param statusEnum 发药状态
|
||||
* @param inProgress 发药状态:待发药
|
||||
* @param completed 发药状态:已发药
|
||||
* @param preparation 发药状态:待配药
|
||||
* @param prepared 发药状态:已配药
|
||||
* @return 就诊病人列表
|
||||
*/
|
||||
Page<EncounterInfoDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoSearchParam> queryWrapper,
|
||||
@Param("statusEnum") Integer statusEnum, @Param("inProgress") Integer inProgress,
|
||||
@Param("completed") Integer completed, @Param("preparation") Integer preparation,
|
||||
@Param("prepared") Integer prepared);
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param inProgress 发药状态:待发药
|
||||
* @param completed 发药状态:已发药
|
||||
* @param preparation 发药状态:待配药
|
||||
* @param prepared 发药状态:已配药
|
||||
* @param dispenseStatus 发药状态
|
||||
* @return 处方单列表
|
||||
*/
|
||||
Page<ItemDispenseOrderDto> selectDeviceDispenseOrderPage(@Param("page") Page<ItemDispenseOrderDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<ItemDispenseOrderDto> queryWrapper,
|
||||
@Param("inProgress") Integer inProgress, @Param("completed") Integer completed,
|
||||
@Param("preparation") Integer preparation, @Param("prepared") Integer prepared,
|
||||
@Param("dispenseStatus") Integer dispenseStatus);
|
||||
|
||||
/**
|
||||
* 获取配药人下拉选列表
|
||||
*
|
||||
* @param pharmacist 参与者类型:药师
|
||||
* @return 配药人下拉选列表
|
||||
*/
|
||||
List<Practitioner> getPreparerDoctorList(@Param("pharmacist") String pharmacist);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.pharmacymanage.dto.MedDetailedAccountPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.MedDetailsSearchParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface MedicationDetailsMapper {
|
||||
|
||||
/**
|
||||
* 门诊人员发药明细表/门诊发药明细流水账
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param completed 发药状态:已发药
|
||||
* @param refunded 发药状态:已退药
|
||||
* @param statisticalType 统计类型
|
||||
* @param flg 1:住院 2:门诊
|
||||
* @param medMedicationDefinition 药品
|
||||
* @param admDeviceDefinition 耗材
|
||||
* @param costEnum 命中条件枚举:产品批号进价
|
||||
* @return 门诊人员发药明细表
|
||||
*/
|
||||
Page<MedDetailedAccountPageDto> selectAmbPractitionerDetailPage(@Param("page") Page<MedDetailedAccountPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<MedDetailsSearchParam> queryWrapper,
|
||||
@Param("completed") Integer completed, @Param("agree") Integer agree, @Param("refunded") Integer refunded,
|
||||
@Param("statisticalType") Integer statisticalType, @Param("flg") Integer flg,
|
||||
@Param("medMedicationDefinition") String medMedicationDefinition,
|
||||
@Param("admDeviceDefinition") String admDeviceDefinition, @Param("costEnum") String costEnum);
|
||||
|
||||
// /**
|
||||
// * 门诊发药明细流水账
|
||||
// *
|
||||
// * @param page 分页
|
||||
// * @param queryWrapper 查询条件
|
||||
// * @param amb 发药类型:门诊
|
||||
// * @param completed 发药状态:已发药
|
||||
// * @param refunded 发药状态:已退药
|
||||
// * @return 门诊发药明细流水账
|
||||
// */
|
||||
// Page<MedDetailedAccountPageDto> selectAmbMedicationDispenseDetailPage(
|
||||
// @Param("page") Page<MedDetailedAccountPageDto> page,
|
||||
// @Param(Constants.WRAPPER) QueryWrapper<MedDetailsSearchParam> queryWrapper, @Param("amb") Integer amb,
|
||||
// @Param("completed") Integer completed, @Param("refunded") Integer refunded)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.pharmacymanage.dto.PendingMedicationPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PendingMedicationSearchParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface PendingMedicationDetailsMapper {
|
||||
|
||||
/**
|
||||
* 分页查询待发药明细
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param inProgress 发药类型:待发药
|
||||
* @param preparation 发药类型:待配药
|
||||
* @param prepared 发药类型:已配药
|
||||
* @param amb 门诊类型
|
||||
* @param imp 住院类型
|
||||
* @return 待发药明细
|
||||
*/
|
||||
Page<PendingMedicationPageDto> selectPendingMedicationDetailsPage(
|
||||
@Param("page") Page<PendingMedicationPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<PendingMedicationSearchParam> queryWrapper,
|
||||
@Param("inProgress") Integer inProgress,
|
||||
@Param("preparation") Integer preparation,
|
||||
@Param("prepared") Integer prepared,
|
||||
@Param("amb") Integer amb,
|
||||
@Param("imp") Integer imp);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseInventoryDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.ReturnMedicineInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.UnDispenseInventoryDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ReturnMedicineMapper {
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
Page<EncounterInfoDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoDto> queryWrapper);
|
||||
|
||||
/**
|
||||
* 申请退药清单查询
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @param medMedicationRequest 药品请求表
|
||||
* @param worDeviceRequest 耗材请求表
|
||||
* @param medicine 项目类型:药品
|
||||
* @param device 项目类型:耗材
|
||||
* @param refundStatus 退药状态
|
||||
* @param pendingRefund 退药状态:待退药
|
||||
* @param refunded 退药状态:已退药
|
||||
* @return 申请退药清单
|
||||
*/
|
||||
List<ReturnMedicineInfoDto> selectReturnMedicineInfo(@Param("encounterId") Long encounterId,
|
||||
@Param("worDeviceRequest") String worDeviceRequest, @Param("medMedicationRequest") String medMedicationRequest,
|
||||
@Param("medicine") Integer medicine, @Param("device") Integer device,
|
||||
@Param("refundStatus") Integer refundStatus, @Param("pendingRefund") Integer pendingRefund,
|
||||
@Param("refunded") Integer refunded);
|
||||
|
||||
/**
|
||||
* 库存信息查询
|
||||
*
|
||||
* @param devDispenseIdList 耗材发放ID列表
|
||||
* @param medDispenseIdList 药品发放ID列表
|
||||
* @param medMedicationDefinition 药品定义表
|
||||
* @param admDeviceDefinition 耗材定义表
|
||||
* @return 待发药信息
|
||||
*/
|
||||
List<UnDispenseInventoryDto> selectInventoryInfoList(@Param("devDispenseIdList") List<Long> devDispenseIdList,
|
||||
@Param("medDispenseIdList") List<Long> medDispenseIdList,
|
||||
@Param("medMedicationDefinition") String medMedicationDefinition,
|
||||
@Param("admDeviceDefinition") String admDeviceDefinition);
|
||||
|
||||
/**
|
||||
* 退药详细信息查询
|
||||
*
|
||||
* @param devDispenseIdList 耗材发放ID列表
|
||||
* @param medDispenseIdList 药品发放ID列表
|
||||
* @param medMedicationDefinition 药品定义表
|
||||
* @param admDeviceDefinition 耗材定义表
|
||||
* @return 退药信息
|
||||
*/
|
||||
List<DispenseInventoryDto> selectReturnItemDetail(@Param("devDispenseIdList") List<Long> devDispenseIdList,
|
||||
@Param("medDispenseIdList") List<Long> medDispenseIdList,
|
||||
@Param("medMedicationDefinition") String medMedicationDefinition,
|
||||
@Param("admDeviceDefinition") String admDeviceDefinition);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface SummaryDispenseMedicineMapper {
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||
import com.openhis.web.pharmacymanage.dto.InventoryDetailDto;
|
||||
import com.openhis.web.pharmacymanage.dto.ItemDispenseOrderDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface WesternMedicineDispenseMapper {
|
||||
|
||||
/**
|
||||
* 就诊病人列表分页查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param statusEnum 发药状态
|
||||
* @param inProgress 发药状态:待发药
|
||||
* @param completed 发药状态:已发药
|
||||
* @param preparation 发药状态:待配药
|
||||
* @param prepared 发药状态:已配药
|
||||
* @return 就诊病人列表
|
||||
*/
|
||||
Page<EncounterInfoDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoSearchParam> queryWrapper,
|
||||
@Param("statusEnum") Integer statusEnum, @Param("inProgress") Integer inProgress,
|
||||
@Param("completed") Integer completed, @Param("preparation") Integer preparation,
|
||||
@Param("prepared") Integer prepared);
|
||||
|
||||
/**
|
||||
* 发药单查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param inProgress 发药状态:待发药
|
||||
* @param completed 发药状态:已发药
|
||||
* @param preparation 发药状态:待配药
|
||||
* @param prepared 发药状态:已配药
|
||||
* @param dispenseStatus 发药状态
|
||||
* @param active 库房状态:启用
|
||||
* @return 发耗材单列表
|
||||
*/
|
||||
Page<ItemDispenseOrderDto> selectMedicineDispenseOrderPage(@Param("page") Page<ItemDispenseOrderDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<ItemDispenseOrderDto> queryWrapper,
|
||||
@Param("inProgress") Integer inProgress, @Param("completed") Integer completed,
|
||||
@Param("preparation") Integer preparation, @Param("prepared") Integer prepared,
|
||||
@Param("dispenseStatus") Integer dispenseStatus, @Param("active") Integer active);
|
||||
|
||||
/**
|
||||
* 获取配药人下拉选列表
|
||||
*
|
||||
* @param pharmacist 参与者类型:药师
|
||||
* @return 配药人下拉选列表
|
||||
*/
|
||||
List<Practitioner> getPreparerDoctorList(@Param("pharmacist") String pharmacist);
|
||||
|
||||
/**
|
||||
* 查询药品库存详细信息
|
||||
*
|
||||
* @param medicationIdList 药品id列表
|
||||
* @param locationIdList 库房id列表
|
||||
* @param active 库存状态:启用
|
||||
* @return 库存详细信息
|
||||
*/
|
||||
List<InventoryDetailDto> selectMedicineInventoryDetail(@Param("medicationIdList") List<Long> medicationIdList,
|
||||
@Param("locationIdList") List<Long> locationIdList, @Param("active") Integer active);
|
||||
|
||||
/**
|
||||
* 查询非输液药品的已出库追溯码
|
||||
*
|
||||
* @param status 出
|
||||
* @param injectFlag 输液标记
|
||||
* @param operationType 操作类型 | 发药
|
||||
* @return 非输液药品的已出库追溯码
|
||||
*/
|
||||
List<String> getOutTraceNo(@Param("status") Integer status, @Param("injectFlag") Integer injectFlag,
|
||||
@Param("outpatientMinUnitCeil") Integer outpatientMinUnitCeil,
|
||||
@Param("outpatientMinUnitTotalCeil") Integer outpatientMinUnitTotalCeil,
|
||||
@Param("operationType") Integer operationType);
|
||||
}
|
||||
Reference in New Issue
Block a user