版本更新
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||
|
||||
/**
|
||||
* 处方管理 应用实现接口
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025/3/18
|
||||
*/
|
||||
public interface IChineseMedicineDispenseAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
*
|
||||
* @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 encounterId 就诊号
|
||||
* @return 处方单列表
|
||||
*/
|
||||
R<?> getPrescriptionInfo(Long encounterId);
|
||||
|
||||
/**
|
||||
* 配药
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @param preparerId 配药人
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> prepare(String prescriptionNo, Long preparerId);
|
||||
|
||||
/**
|
||||
* 处方单核对发药
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineDispense(String prescriptionNo);
|
||||
|
||||
/**
|
||||
* 处方单作废
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @param notPerformedReasonEnum 未发药原因
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineCancel(String prescriptionNo, Integer notPerformedReasonEnum);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
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.DispenseDeviceDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PrescriptionDeviceInfoDto;
|
||||
|
||||
/**
|
||||
* 材料发送 应用实现接口
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/8/21
|
||||
*/
|
||||
public interface IDeviceDispenseAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 分页查询发药病人列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 发药病人列表
|
||||
*/
|
||||
R<?> getEncounterInfoListPage(EncounterInfoPageDto encounterInfoPageDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param prescriptionDeviceInfoDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
R<?> getPrescriptionInfo(PrescriptionDeviceInfoDto prescriptionDeviceInfoDto, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 处方单核对发药
|
||||
*
|
||||
* @param dispenseDeviceList 发药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> deviceDispense(List<DispenseDeviceDto> dispenseDeviceList);
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseDeviceList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> deviceCancel(List<DispenseDeviceDto> dispenseDeviceList);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;//package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseMedicineDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 住院发药 应用实现接口
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/6/3
|
||||
*/
|
||||
public interface IInpatientMedicineDispenseAppService {
|
||||
|
||||
/**
|
||||
* 分页查询发药病人列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 发药病人列表
|
||||
*/
|
||||
R<?> getEncounterInfoListPage(EncounterInfoPageDto encounterInfoPageDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseMedicineDto;
|
||||
import com.openhis.web.pharmacymanage.dto.InpatientMedicineSearchParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 住院汇总发药 应用实现接口
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/6/3
|
||||
*/
|
||||
public interface IInpatientMedicineSummaryDispenseAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 医嘱查询
|
||||
*
|
||||
* @param searchParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
*/
|
||||
R<?> getMedicationSummaryInfo(InpatientMedicineSearchParam searchParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 处方单核对发药
|
||||
*
|
||||
* @param searchParam 条件
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineDispense(List<InpatientMedicineSearchParam> searchParam);
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param deliveryIdList 供应发放id
|
||||
* @param notPerformedReasonEnum 未发原因
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineCancel(List<Long> deliveryIdList, Integer notPerformedReasonEnum);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
|
||||
/**
|
||||
* 处方管理 应用实现接口
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025/6/20
|
||||
*/
|
||||
public interface IMedicalConsumablesDispenseAppService {
|
||||
|
||||
/**
|
||||
* 发放耗材
|
||||
*
|
||||
* @param chargeItemIds 耗材收费单ids
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> dispenseMedicalConsumables(List<Long> chargeItemIds);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.openhis.web.pharmacymanage.appservice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.MedDetailsSearchParam;
|
||||
|
||||
/**
|
||||
* 发药明细 应用实现接口
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* 门诊发药明细流水账
|
||||
*
|
||||
* @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 javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.dto.PendingMedicationSearchParam;
|
||||
|
||||
/**
|
||||
* 待发药明细 应用实现接口
|
||||
*
|
||||
* @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,55 @@
|
||||
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.EncounterInfoPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.ReturnMedicineDto;
|
||||
|
||||
/**
|
||||
* 退药管理 应用实现接口
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025/4/4
|
||||
*/
|
||||
public interface IReturnMedicineAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
R<?> getReturnMedicinePatientPage(EncounterInfoPageDto encounterInfoPageDto, 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,86 @@
|
||||
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.DispenseMedicineDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PrescriptionMedicineInfoDto;
|
||||
|
||||
/**
|
||||
* 处方管理 应用实现接口
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025/3/18
|
||||
*/
|
||||
public interface IWesternMedicineDispenseAppService {
|
||||
|
||||
/**
|
||||
* 页面初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> init();
|
||||
|
||||
/**
|
||||
* 分页查询发药病人列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 发药病人列表
|
||||
*/
|
||||
R<?> getEncounterInfoListPage(EncounterInfoPageDto encounterInfoPageDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param prescriptionMedicineInfoDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
R<?> getPrescriptionInfo(PrescriptionMedicineInfoDto prescriptionMedicineInfoDto, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 配药
|
||||
*
|
||||
* @param dispenseMedicineList 配药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicinePrepare(List<DispenseMedicineDto> dispenseMedicineList);
|
||||
|
||||
/**
|
||||
* 处方单核对发药
|
||||
*
|
||||
* @param dispenseMedicineList 发药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineDispense(List<DispenseMedicineDto> dispenseMedicineList);
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseMedicineList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> medicineCancel(List<DispenseMedicineDto> dispenseMedicineList);
|
||||
|
||||
/**
|
||||
* 处方详情
|
||||
*
|
||||
* @param locationId 库房id
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 单据详情
|
||||
*/
|
||||
R<?> getMonthlySettlementPatientInfoList(Long locationId, String startTime, String endTime,Integer pageNo, Integer pageSize);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,443 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.web.pharmacymanage.appservice.IDeviceDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
|
||||
import com.openhis.workflow.domain.DeviceDispense;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.core.domain.entity.SysDictData;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.*;
|
||||
import com.core.system.mapper.SysDictDataMapper;
|
||||
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.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
import com.openhis.web.pharmacymanage.mapper.IDeviceDispenseMapper;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
|
||||
/**
|
||||
* 材料发送 应用实现类
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/8/21
|
||||
*/
|
||||
@Service
|
||||
public class DeviceDispenseAppServiceImpl implements IDeviceDispenseAppService {
|
||||
|
||||
@Autowired
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
|
||||
@Autowired
|
||||
private IInventoryItemService iInventoryItemService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceDispenseMapper deviceDispenseMapper;
|
||||
|
||||
@Autowired
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
@Resource
|
||||
private SysDictDataMapper sysDictDataMapper;
|
||||
|
||||
@Autowired
|
||||
private ITraceNoManageService traceNoManageService;
|
||||
@Resource
|
||||
private IWesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DispenseInitDto initDto = new DispenseInitDto();
|
||||
|
||||
// 获取科室下拉选列表
|
||||
List<Organization> organizationList =
|
||||
organizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
|
||||
List<DispenseInitDto.DepartmentOption> organizationOptions = organizationList.stream()
|
||||
.map(organization -> new DispenseInitDto.DepartmentOption(organization.getId(), organization.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 获取配药人下拉选列表
|
||||
List<Practitioner> preparerDoctorList =
|
||||
deviceDispenseMapper.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.DispenseStatusOption> dispenseStatusOptions = new ArrayList<>();
|
||||
dispenseStatusOptions.add(new DispenseInitDto.DispenseStatusOption(DispenseStatus.IN_PROGRESS.getValue(),
|
||||
DispenseStatus.IN_PROGRESS.getInfo()));
|
||||
dispenseStatusOptions.add(new DispenseInitDto.DispenseStatusOption(DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.COMPLETED.getInfo()));
|
||||
|
||||
initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions)
|
||||
.setDispenseStatusOptions(dispenseStatusOptions).setPreparerDoctorOptions(preparerDoctorOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询发药病人列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 发药病人列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterInfoListPage(EncounterInfoPageDto encounterInfoPageDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
// 发药状态初始化
|
||||
Integer statusEnum = encounterInfoPageDto.getStatusEnum();
|
||||
encounterInfoPageDto.setStatusEnum(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterInfoPageDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(encounterInfoPageDto, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.idCard,
|
||||
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
|
||||
request);
|
||||
// 查询就诊病人列表
|
||||
Page<EncounterInfoPageDto> encounterInfoPage = deviceDispenseMapper.selectEncounterInfoListPage(
|
||||
new Page<>(pageNo, pageSize), queryWrapper, statusEnum, DispenseStatus.IN_PROGRESS.getValue(),
|
||||
DispenseStatus.COMPLETED.getValue(), DispenseStatus.PREPARATION.getValue(),
|
||||
DispenseStatus.PREPARED.getValue(), EncounterClass.AMB.getValue());
|
||||
encounterInfoPage.getRecords().forEach(encounterInfo -> {
|
||||
// 性别
|
||||
encounterInfo.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
|
||||
// 发药状态
|
||||
encounterInfo
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getStatusEnum()));
|
||||
});
|
||||
return R.ok(encounterInfoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param prescriptionDeviceInfoDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPrescriptionInfo(PrescriptionDeviceInfoDto prescriptionDeviceInfoDto, Integer pageNo,
|
||||
Integer pageSize) {
|
||||
// 发药状态初始化
|
||||
Integer dispenseStatus = prescriptionDeviceInfoDto.getStatusEnum();
|
||||
prescriptionDeviceInfoDto.setStatusEnum(null);
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<PrescriptionDeviceInfoDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(prescriptionDeviceInfoDto, null, null, null);
|
||||
|
||||
// 获取所属医院id
|
||||
Long hospitalId = SecurityUtils.getLoginUser().getHospitalId();
|
||||
// 患者基本信息查询
|
||||
PrescriptionPatientInfoDto prescriptionPatientInfoDto = deviceDispenseMapper
|
||||
.selectPrescriptionPatientInfo(prescriptionDeviceInfoDto.getEncounterId(), hospitalId);
|
||||
|
||||
// 年龄
|
||||
prescriptionPatientInfoDto.setAge(AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate()));
|
||||
// 性别
|
||||
prescriptionPatientInfoDto.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, prescriptionPatientInfoDto.getGenderEnum()));
|
||||
// 合同类型
|
||||
if (StringUtils.isNotNull(prescriptionPatientInfoDto.getCategoryEnum())) {
|
||||
prescriptionPatientInfoDto.setCategoryEnum_enumText(
|
||||
EnumUtils.getInfoByValue(FinCategory.class, prescriptionPatientInfoDto.getCategoryEnum()));
|
||||
}
|
||||
|
||||
// 处方单信息查询
|
||||
|
||||
Page<PrescriptionDeviceInfoDto> prescriptionDeviceInfoPage =
|
||||
deviceDispenseMapper.selectPrescriptionDeviceInfoList(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue(), dispenseStatus);
|
||||
|
||||
// 查询字典值
|
||||
List<SysDictData> unitCodeList = sysDictDataMapper.selectDictDataByType("unit_code");
|
||||
Map<String, String> unitCodeLabel = unitCodeList.stream().collect(
|
||||
Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel, (oldValue, newValue) -> oldValue // 如果有重复键,保留旧值
|
||||
));
|
||||
List<SysDictData> methodCodeList = sysDictDataMapper.selectDictDataByType("method_code");
|
||||
Map<String, String> methodCodeLabel = methodCodeList.stream().collect(
|
||||
Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel, (oldValue, newValue) -> oldValue // 如果有重复键,保留旧值
|
||||
));
|
||||
|
||||
List<PrescriptionDeviceInfoDto> prescriptionDeviceInfoList = prescriptionDeviceInfoPage.getRecords();
|
||||
Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel, (oldValue, newValue) -> oldValue // 如果有重复键,保留旧值
|
||||
);
|
||||
prescriptionDeviceInfoList.forEach(prescriptionDeviceInfo -> {
|
||||
// 发药状态
|
||||
prescriptionDeviceInfo.setStatusEnum_enumText(
|
||||
EnumUtils.getInfoByValue(DispenseStatus.class, prescriptionDeviceInfo.getStatusEnum()));
|
||||
// // 匹配剂量单位字典文本
|
||||
// String doseUnitCode = prescriptionDeviceInfo.getDoseUnitCode();
|
||||
// String doseUnitLabel = unitCodeLabel.getOrDefault(doseUnitCode, "");
|
||||
// prescriptionDeviceInfo.setDoseUnitCode_dictText(doseUnitLabel);
|
||||
// 匹配单位字典文本
|
||||
String unitCode = prescriptionDeviceInfo.getUnitCode();
|
||||
String unitLabel = unitCodeLabel.getOrDefault(unitCode, "");
|
||||
prescriptionDeviceInfo.setUnitCode_dictText(unitLabel);
|
||||
// // 匹配用法字典文本
|
||||
// String methodCode = prescriptionDeviceInfo.getMethodCode();
|
||||
// String methodLabel = methodCodeLabel.getOrDefault(methodCode, "");
|
||||
// prescriptionDeviceInfo.setMethodCode_dictText(methodLabel);
|
||||
|
||||
// switch (prescriptionDeviceInfo.getPharmacologyCategoryCode()) {
|
||||
// case "2": // 麻醉药品
|
||||
// prescriptionDeviceInfo.setPharmacologyCategoryCode_Text("麻醉");
|
||||
// case "3": // 毒性药品
|
||||
// prescriptionDeviceInfo.setPharmacologyCategoryCode_Text("毒性");
|
||||
// case "4": // 一类精神药
|
||||
// prescriptionDeviceInfo.setPharmacologyCategoryCode_Text("精一");
|
||||
// case "5": // 二类精神药
|
||||
// prescriptionDeviceInfo.setPharmacologyCategoryCode_Text("精二");
|
||||
// default: // 普通药品
|
||||
// prescriptionDeviceInfo.setPharmacologyCategoryCode_Text("普通");
|
||||
// }
|
||||
|
||||
// 判断是否为慢病
|
||||
if (EncounterYbClass.CHRONIC_DISEASE_OUTPATIENT.getCode()
|
||||
.equals(prescriptionDeviceInfo.getMedTypeCode())) {
|
||||
prescriptionDeviceInfo.setChronicDisease(Whether.YES.getInfo());
|
||||
} else {
|
||||
prescriptionDeviceInfo.setChronicDisease(Whether.NO.getInfo());
|
||||
}
|
||||
// // 皮试flag为是时
|
||||
// if (Whether.YES.getValue().equals(prescriptionDeviceInfo.getSkinTestFlag())) {
|
||||
// // 获取皮试结果
|
||||
// ServiceRequest serReqObj =
|
||||
// serviceRequestService.selectByMedRequestId(prescriptionDeviceInfo.getRequestId());
|
||||
// if (serReqObj != null) {
|
||||
// Integer clinicalStatus = allergyIntoleranceService.getPsResultByRequestId(serReqObj.getId());
|
||||
// prescriptionDeviceInfo.setPsResult(ClinicalStatus.getByValue(clinicalStatus).getInfo());
|
||||
// }
|
||||
// } else {
|
||||
// prescriptionDeviceInfo.setPsResult("无");
|
||||
// }
|
||||
|
||||
});
|
||||
|
||||
// 计算合计金额
|
||||
if (!prescriptionDeviceInfoList.isEmpty()) {
|
||||
double totalPrice = 0d;
|
||||
for (PrescriptionDeviceInfoDto item : prescriptionDeviceInfoList) {
|
||||
totalPrice += item.getTotalPrice().doubleValue();
|
||||
}
|
||||
prescriptionPatientInfoDto.setTotalPrice(totalPrice);
|
||||
}
|
||||
PrescriptionInfoDto prescriptionInfoDto = new PrescriptionInfoDto();
|
||||
prescriptionInfoDto.setPrescriptionPatientInfoDto(prescriptionPatientInfoDto);
|
||||
prescriptionInfoDto.setPrescriptionDeviceInfoDtoList(prescriptionDeviceInfoList);
|
||||
return R.ok(prescriptionInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单核对发药
|
||||
*
|
||||
* @param dispenseDeviceList 发药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deviceDispense(List<DispenseDeviceDto> dispenseDeviceList) {
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 获取发药单id列表
|
||||
List<Long> devDispenseIdList =
|
||||
dispenseDeviceList.stream().map(DispenseDeviceDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取药品申请id列表
|
||||
List<Long> devRequestIdList =
|
||||
dispenseDeviceList.stream().map(DispenseDeviceDto::getRequestId).collect(Collectors.toList());
|
||||
// 获取库存信息
|
||||
List<InventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
// 按每个药品分组
|
||||
Map<Long, List<InventoryDto>> groupedByItemId =
|
||||
inventoryList.stream().collect(Collectors.groupingBy(InventoryDto::getItemId));
|
||||
// 遍历每个分组校验库存状态
|
||||
for (Map.Entry<Long, List<InventoryDto>> entry : groupedByItemId.entrySet()) {
|
||||
List<InventoryDto> groupItems = entry.getValue();
|
||||
if (groupItems.stream().map(InventoryDto::getInventoryStatusEnum)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 库存停供校验
|
||||
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
}
|
||||
if (!inventoryList.isEmpty()) {
|
||||
for (InventoryDto inventoryDto : inventoryList) {
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(inventoryDto.getInventoryStatusEnum())) {
|
||||
InventoryItem inventoryItem = new InventoryItem();
|
||||
// 库存数量判定
|
||||
if (inventoryDto.getDispenseUnit().equals(inventoryDto.getInventoryUnitCode())) {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
|
||||
BigDecimal quantity = inventoryDto.getInventoryQuantity().subtract(inventoryDto.getQuantity());
|
||||
// 库存数量判定
|
||||
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
|
||||
} else {
|
||||
inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
|
||||
}
|
||||
} else {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
|
||||
BigDecimal quantity = inventoryDto.getInventoryQuantity()
|
||||
.subtract(inventoryDto.getPartPercent().multiply(inventoryDto.getQuantity()));
|
||||
// 库存数量判定
|
||||
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
|
||||
} else {
|
||||
inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
|
||||
}
|
||||
}
|
||||
inventoryItemList.add(inventoryItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 材料发放信息查询
|
||||
List<DeviceDispense> dispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
// 追溯码列表
|
||||
List<TraceNoManage> tracesNoManageList = new ArrayList<>();
|
||||
TraceNoManage traceNoManage;
|
||||
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(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
// 根据数量设置追溯码
|
||||
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA,
|
||||
Collections.nCopies(deviceDispense.getQuantity(), CommonConstants.Common.DEV_TRACE_NO)));
|
||||
// 使用逗号分割追溯码并转换为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));
|
||||
}
|
||||
// 库存更新
|
||||
iInventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 追溯码管理表数据追加
|
||||
boolean result = traceNoManageService.saveBatch(tracesNoManageList);
|
||||
if (!result) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
// 调用医保商品销售接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
// 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<String> uploadFailedNoList =
|
||||
westernMedicineDispenseAppService.ybMedicineIntegrated(null, devDispenseIdList);
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3505商品销售上传成功";
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseDeviceList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deviceCancel(List<DispenseDeviceDto> dispenseDeviceList) {
|
||||
// 获取发材料单id列表
|
||||
List<Long> devDispenseIdList =
|
||||
dispenseDeviceList.stream().map(DispenseDeviceDto::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,329 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.yb.service.YbManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.*;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
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.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.web.pharmacymanage.appservice.IChineseMedicineDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
import com.openhis.web.pharmacymanage.mapper.ChineseMedicineDispenseMapper;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
|
||||
/**
|
||||
* 中药发放 应用实现类
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025/3/14
|
||||
*/
|
||||
@Service
|
||||
public class IChineseMedicineDispenseAppServiceImpl implements IChineseMedicineDispenseAppService {
|
||||
|
||||
@Autowired
|
||||
private IOrganizationService iOrganizationService;
|
||||
|
||||
@Autowired
|
||||
IMedicationDispenseService iMedicationDispenseService;
|
||||
|
||||
@Autowired
|
||||
IInventoryItemService iInventoryItemService;
|
||||
|
||||
@Autowired
|
||||
ChineseMedicineDispenseMapper chineseMedicineDispenseMapper;
|
||||
|
||||
@Autowired
|
||||
YbManager ybService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DispenseInitDto initDto = new DispenseInitDto();
|
||||
|
||||
// 获取科室下拉选列表
|
||||
List<Organization> organizationList =
|
||||
iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
|
||||
List<DispenseInitDto.DepartmentOption> organizationOptions = organizationList.stream()
|
||||
.map(organization -> new DispenseInitDto.DepartmentOption(organization.getId(), organization.getName()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 未发药原因下拉选列表
|
||||
List<DispenseInitDto.NotPerformedReasonOption> notPerformedReasonOptions =
|
||||
Stream.of(NotPerformedReasonEnum.values())
|
||||
.map(notPerformedReason -> new DispenseInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
|
||||
notPerformedReason.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions);
|
||||
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) {
|
||||
|
||||
// 构建查询条件
|
||||
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<EncounterInfoPageDto> encounterInfoPage =
|
||||
chineseMedicineDispenseMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
|
||||
encounterInfoPage.getRecords().forEach(encounterInfo -> {
|
||||
// 性别
|
||||
encounterInfo.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
|
||||
// 性别
|
||||
encounterInfo
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getStatusEnum()));
|
||||
});
|
||||
return R.ok(encounterInfoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询处方单列表
|
||||
*
|
||||
* @param encounterId 就诊号
|
||||
* @return 处方单列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPrescriptionInfo(Long encounterId) {
|
||||
|
||||
// 患者基本信息查询
|
||||
PrescriptionPatientInfoDto prescriptionPatientInfoDto =
|
||||
chineseMedicineDispenseMapper.selectPrescriptionPatientInfo(encounterId);
|
||||
// 年龄
|
||||
prescriptionPatientInfoDto.setAge(AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate()));
|
||||
// 性别
|
||||
prescriptionPatientInfoDto.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, prescriptionPatientInfoDto.getGenderEnum()));
|
||||
// 合同类型
|
||||
if (StringUtils.isNotNull(prescriptionPatientInfoDto.getCategoryEnum())) {
|
||||
prescriptionPatientInfoDto.setCategoryEnum_enumText(
|
||||
EnumUtils.getInfoByValue(FinCategory.class, prescriptionPatientInfoDto.getCategoryEnum()));
|
||||
}
|
||||
// 处方单信息查询
|
||||
List<PrescriptionMedicineInfoDto> prescriptionMedicineInfoList =
|
||||
chineseMedicineDispenseMapper.selectPrescriptionMedicineInfoList(encounterId);
|
||||
// 计算合计金额
|
||||
if (!prescriptionMedicineInfoList.isEmpty()) {
|
||||
double totalPrice = 0d;
|
||||
for (PrescriptionMedicineInfoDto item : prescriptionMedicineInfoList) {
|
||||
totalPrice += item.getTotalPrice().doubleValue();
|
||||
}
|
||||
prescriptionPatientInfoDto.setTotalPrice(totalPrice);
|
||||
}
|
||||
PrescriptionInfoDto prescriptionInfoDto = new PrescriptionInfoDto();
|
||||
prescriptionInfoDto.setPrescriptionPatientInfoDto(prescriptionPatientInfoDto);
|
||||
prescriptionInfoDto.setPrescriptionMedicineInfoDtoList(prescriptionMedicineInfoList);
|
||||
return R.ok(prescriptionInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配药
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @param preparerId 配药人
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> prepare(String prescriptionNo, Long preparerId) {
|
||||
|
||||
List<MedicationDispense> medicationDispenseList = new ArrayList<>();
|
||||
boolean iMedicationDispenseUpdFlg = true;
|
||||
|
||||
// 配药人检查
|
||||
if (!preparerId.equals(SecurityUtils.getLoginUser().getPractitionerId())) {
|
||||
// 获取药品待发放信息
|
||||
List<DispenseInventoryDto> dispenseInventoryList =
|
||||
chineseMedicineDispenseMapper.selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
if (!dispenseInventoryList.isEmpty()) {
|
||||
|
||||
MedicationDispense medicationDispense;
|
||||
|
||||
for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) {
|
||||
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
|
||||
BigDecimal quantity = dispenseInventoryDto.getInventoryQuantity()
|
||||
.subtract(new BigDecimal(dispenseInventoryDto.getDispenseQuantity()));
|
||||
// 库存数量判定
|
||||
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Inventory.M00002, null));
|
||||
}
|
||||
|
||||
// 药品发放表项目设定
|
||||
medicationDispense = new MedicationDispense();
|
||||
// id
|
||||
medicationDispense.setId(dispenseInventoryDto.getDispenseId());
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.PREPARED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
// 配药人
|
||||
medicationDispense.setPreparerId(preparerId);
|
||||
// 配药时间
|
||||
medicationDispense.setPrepareTime(DateUtils.getNowDate());
|
||||
medicationDispenseList.add(medicationDispense);
|
||||
|
||||
}
|
||||
// 药品发放更新
|
||||
iMedicationDispenseUpdFlg = iMedicationDispenseService.updateBatchById(medicationDispenseList);
|
||||
|
||||
return iMedicationDispenseUpdFlg
|
||||
? R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||
}
|
||||
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.MedicationDispense.M00001, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单核对发药
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicineDispense(String prescriptionNo) {
|
||||
|
||||
List<MedicationDispense> medicationDispenseList = new ArrayList<>();
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
boolean iMedicationDispenseUpdFlg = true;
|
||||
boolean iInventoryItemUpdFlg = true;
|
||||
|
||||
// 获取药品待发放和库存信息
|
||||
List<DispenseInventoryDto> dispenseInventoryList =
|
||||
chineseMedicineDispenseMapper.selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
if (!dispenseInventoryList.isEmpty()) {
|
||||
|
||||
MedicationDispense medicationDispense;
|
||||
InventoryItem inventoryItem;
|
||||
|
||||
for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) {
|
||||
|
||||
// 药品发放表项目设定
|
||||
medicationDispense = new MedicationDispense();
|
||||
// id
|
||||
medicationDispense.setId(dispenseInventoryDto.getDispenseId());
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
// 发药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
// 已发药数量
|
||||
medicationDispense.setDispenseQuantity(dispenseInventoryDto.getDispenseQuantity());
|
||||
// 发药时间
|
||||
medicationDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
medicationDispenseList.add(medicationDispense);
|
||||
|
||||
// 库存表项目设定
|
||||
inventoryItem = new InventoryItem();
|
||||
|
||||
inventoryItem.setId(dispenseInventoryDto.getInventoryId());
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
|
||||
inventoryItem.setQuantity(dispenseInventoryDto.getInventoryQuantity()
|
||||
.subtract(new BigDecimal(dispenseInventoryDto.getDispenseQuantity())));
|
||||
inventoryItemList.add(inventoryItem);
|
||||
}
|
||||
// 药品发放更新
|
||||
iMedicationDispenseUpdFlg = iMedicationDispenseService.updateBatchById(medicationDispenseList);
|
||||
// 库存更新
|
||||
iInventoryItemUpdFlg = iInventoryItemService.updateBatchById(inventoryItemList);
|
||||
|
||||
return iMedicationDispenseUpdFlg && iInventoryItemUpdFlg
|
||||
? R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00011, null));
|
||||
}
|
||||
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @param notPerformedReasonEnum 未发药原因
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicineCancel(String prescriptionNo, Integer notPerformedReasonEnum) {
|
||||
|
||||
List<MedicationDispense> medicationDispenseList = new ArrayList<>();
|
||||
boolean iMedicationDispenseUpdFlg = true;
|
||||
|
||||
// 获取药品待发放记录
|
||||
List<DispenseInventoryDto> dispenseInventoryList =
|
||||
chineseMedicineDispenseMapper.selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
if (!dispenseInventoryList.isEmpty()) {
|
||||
MedicationDispense medicationDispense;
|
||||
for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) {
|
||||
|
||||
// 药品发放表项目设定
|
||||
medicationDispense = new MedicationDispense();
|
||||
// id
|
||||
medicationDispense.setId(dispenseInventoryDto.getDispenseId());
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||
// 未发药原因
|
||||
medicationDispense.setNotPerformedReasonEnum(notPerformedReasonEnum);
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
// 发药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
medicationDispenseList.add(medicationDispense);
|
||||
}
|
||||
// 药品发放更新
|
||||
iMedicationDispenseUpdFlg = iMedicationDispenseService.updateBatchById(medicationDispenseList);
|
||||
}
|
||||
return iMedicationDispenseUpdFlg ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.DispenseStatus;
|
||||
import com.openhis.common.enums.HospitalCodeEnum;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.enums.Whether;
|
||||
import com.openhis.web.inventorymanage.appservice.ITraceNoAppService;
|
||||
import com.openhis.web.pharmacymanage.appservice.IMedicalConsumablesDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.InventoryDto;
|
||||
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;
|
||||
/*
|
||||
*
|
||||
*
|
||||
* 耗材发放 应用实现类
|
||||
*
|
||||
* @author wangyang
|
||||
*
|
||||
* @date 2025/3/14
|
||||
*
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class IMedicalConsumablesDispenseAppServiceImpl implements IMedicalConsumablesDispenseAppService {
|
||||
|
||||
@Resource
|
||||
private ITraceNoAppService traceNoAppService;
|
||||
|
||||
@Resource
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
|
||||
@Resource
|
||||
private IDeviceRequestService deviceRequestService;
|
||||
|
||||
@Resource
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
@Resource
|
||||
private IInventoryItemService iInventoryItemService;
|
||||
|
||||
@Resource
|
||||
private IWesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppService;
|
||||
|
||||
@Resource
|
||||
private IChargeItemService chargeItemService;
|
||||
|
||||
/**
|
||||
* 发放耗材
|
||||
*
|
||||
* @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(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 获取发申请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<InventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, null,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
// 按每个耗材分组
|
||||
Map<Long, List<InventoryDto>> groupedByItemId =
|
||||
inventoryList.stream().collect(Collectors.groupingBy(InventoryDto::getItemId));
|
||||
// 遍历每个分组校验库存状态
|
||||
for (Map.Entry<Long, List<InventoryDto>> entry : groupedByItemId.entrySet()) {
|
||||
List<InventoryDto> groupItems = entry.getValue();
|
||||
if (groupItems.stream().map(InventoryDto::getInventoryStatusEnum)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 库存停供校验
|
||||
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
}
|
||||
if (!inventoryList.isEmpty()) {
|
||||
for (InventoryDto inventoryDto : inventoryList) {
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(inventoryDto.getInventoryStatusEnum())) {
|
||||
InventoryItem inventoryItem = new InventoryItem();
|
||||
// 库存数量判定
|
||||
if (inventoryDto.getDispenseUnit().equals(inventoryDto.getInventoryUnitCode())) {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
|
||||
BigDecimal quantity = inventoryDto.getInventoryQuantity().subtract(inventoryDto.getQuantity());
|
||||
// 库存数量判定
|
||||
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
|
||||
} else {
|
||||
inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
|
||||
}
|
||||
} else {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
|
||||
BigDecimal quantity = inventoryDto.getInventoryQuantity()
|
||||
.subtract(inventoryDto.getPartPercent().multiply(inventoryDto.getQuantity()));
|
||||
// 库存数量判定
|
||||
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
|
||||
} else {
|
||||
inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
|
||||
}
|
||||
}
|
||||
inventoryItemList.add(inventoryItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 发耗材信息查询
|
||||
List<DeviceDispense> dispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
// todo 耗材追溯码待定
|
||||
// // 追溯码列表
|
||||
// List<TraceNoInfoParam> traceNoInfoList = new ArrayList<>();
|
||||
// TraceNoInfoParam traceNoInfo;
|
||||
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(), CommonConstants.Common.DEV_TRACE_NO)));
|
||||
// // 使用逗号分割追溯码并转换为List
|
||||
// String[] traceNoList = deviceDispense.getTraceNo().split(",");
|
||||
// for (String item : traceNoList) {
|
||||
// traceNoInfo = new TraceNoInfoParam();
|
||||
// // 追溯码处理
|
||||
// // 项目所属表
|
||||
// traceNoInfo.setItemTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
// // 项目id
|
||||
// .setItemId(deviceDispense.getDeviceDefId())
|
||||
// // 仓库类型
|
||||
// .setLocationTypeEnum(null)
|
||||
// // 仓库
|
||||
// .setLocationId(deviceDispense.getLocationId())
|
||||
// // 仓位
|
||||
// .setLocationStoreId(null)
|
||||
// // 产品批号
|
||||
// .setLotNumber(deviceDispense.getLotNumber())
|
||||
// // 追溯码
|
||||
// .setTraceNo(item)
|
||||
// // 追溯码状态
|
||||
// .setStatusEnum(TraceNoStatus.OUT.getValue())
|
||||
// // 追溯码单位
|
||||
// .setUnitCode(deviceDispense.getUnitCode())
|
||||
// // 操作类型
|
||||
// .setOperationType(SupplyType.DISPENSE_MEDICATION.getValue());
|
||||
// traceNoInfoList.add(traceNoInfo);
|
||||
// }
|
||||
}
|
||||
// 药品发放更新
|
||||
deviceDispenseService.updateBatchById(dispenseList);
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 库存更新
|
||||
iInventoryItemService.updateBatchById(inventoryItemList);
|
||||
// // 追溯码管理表数据追加
|
||||
// R<?> request = traceNoAppService.addTraceNoInfo(traceNoInfoList);
|
||||
// if (request.getCode() != 200) {
|
||||
// return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
// }
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
// 调用医保商品销售接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
|
||||
// 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<String> uploadFailedNoList =
|
||||
westernMedicineDispenseAppService.ybMedicineIntegrated(null, devDispenseIdList);
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3505商品销售上传成功";
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,588 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.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.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.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
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.service.IClinicSettleService;
|
||||
import com.openhis.yb.service.IRegService;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
|
||||
/**
|
||||
* 退药管理 应用实现类
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025/4/4
|
||||
*/
|
||||
@Service
|
||||
public class IReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
|
||||
|
||||
@Autowired
|
||||
private ITraceNoManageService traceNoManageService;
|
||||
|
||||
@Autowired
|
||||
private IOrganizationService iOrganizationService;
|
||||
|
||||
@Autowired
|
||||
private IInventoryItemService iInventoryItemService;
|
||||
|
||||
@Autowired
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
@Autowired
|
||||
private IMedicationRequestService medicationRequestService;
|
||||
|
||||
@Autowired
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceRequestService deviceRequestService;
|
||||
|
||||
@Autowired
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Autowired
|
||||
private YbManager ybService;
|
||||
|
||||
@Autowired
|
||||
private IChargeItemService iChargeItemService;
|
||||
|
||||
@Autowired
|
||||
private IPaymentReconciliationService iPaymentReconciliationService;
|
||||
|
||||
@Autowired
|
||||
private IContractService iContractService;
|
||||
|
||||
@Autowired
|
||||
private IClinicSettleService clinicSettleService;
|
||||
|
||||
@Autowired
|
||||
private IEncounterDiagnosisService encounterDiagnosisService;
|
||||
|
||||
@Autowired
|
||||
private IAccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private IRegService iRegService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
ReturnMedicineInitDto initDto = new ReturnMedicineInitDto();
|
||||
|
||||
// 获取科室下拉选列表
|
||||
List<Organization> organizationList =
|
||||
iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), 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(RequestStatus.CANCELLED.getValue(),
|
||||
RequestStatus.CANCELLED.getInfo()));
|
||||
refundStatusOptions.add(new ReturnMedicineInitDto.RefundStatusOption(RequestStatus.COMPLETED.getValue(),
|
||||
RequestStatus.COMPLETED.getInfo()));
|
||||
initDto.setDepartmentOptions(organizationOptions).setRefundStatusOptions(refundStatusOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getReturnMedicinePatientPage(EncounterInfoPageDto encounterInfoPageDto, String searchKey,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterInfoPageDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(encounterInfoPageDto, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.idCard,
|
||||
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
|
||||
request);
|
||||
// 查询退药患者分页列表
|
||||
Page<EncounterInfoPageDto> encounterInfoPage = returnMedicineMapper
|
||||
.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper, EncounterClass.AMB.getValue());
|
||||
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) {
|
||||
|
||||
// // 患者基本信息查询
|
||||
// PrescriptionPatientInfoDto prescriptionPatientInfoDto =
|
||||
// returnMedicineMapper.selectPrescriptionPatientInfo(encounterId);
|
||||
// // 年龄
|
||||
// prescriptionPatientInfoDto.setAge(AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate()));
|
||||
// // 性别
|
||||
// prescriptionPatientInfoDto.setGenderEnum_enumText(
|
||||
// EnumUtils.getInfoByValue(AdministrativeGender.class, prescriptionPatientInfoDto.getGenderEnum()));
|
||||
// // 合同类型
|
||||
// if (StringUtils.isNotNull(prescriptionPatientInfoDto.getCategoryEnum())) {
|
||||
// prescriptionPatientInfoDto.setCategoryEnum_enumText(
|
||||
// EnumUtils.getInfoByValue(FinCategory.class, prescriptionPatientInfoDto.getCategoryEnum()));
|
||||
// }
|
||||
|
||||
// 获取退药信息
|
||||
List<ReturnMedicineInfoDto> returnMedicineInfoList = returnMedicineMapper.selectReturnMedicineInfo(encounterId,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST,
|
||||
ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(), refundStatus, RequestStatus.CANCELLED.getValue(),
|
||||
RequestStatus.COMPLETED.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()));
|
||||
}
|
||||
});
|
||||
// 获取药品发放id列表
|
||||
List<Long> medDispenseIdList =
|
||||
returnMedicineList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取药品退药请求id列表
|
||||
List<Long> medRequestIdList =
|
||||
returnMedicineList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
|
||||
|
||||
if (!medRequestIdList.isEmpty()) {
|
||||
// 药品已退药信息查询
|
||||
List<MedicationDispense> refundList = medicationDispenseService.list(
|
||||
new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getMedReqId, medRequestIdList));
|
||||
if (refundList != null) {
|
||||
if (refundList.stream().map(MedicationDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
|
||||
throw new ServiceException("药品已退药,请勿重复退药");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 退药单列表
|
||||
List<MedicationDispense> medicationRefundList = new ArrayList<>();
|
||||
if (!medDispenseIdList.isEmpty()) {
|
||||
// 药品已发放信息查询
|
||||
List<MedicationDispense> medicationDispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
// 根据发药单对应生成退药单
|
||||
for (MedicationDispense medicationDispense : medicationDispenseList) {
|
||||
// 退药的药品请求id
|
||||
for (ReturnMedicineDto returnMedicineDto : returnMedicineList) {
|
||||
if (returnMedicineDto.getDispenseId().equals(medicationDispense.getId())) {
|
||||
medicationDispense.setMedReqId(returnMedicineDto.getRequestId());
|
||||
}
|
||||
}
|
||||
// 药品发放编码
|
||||
medicationDispense.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_DIS_NO.getPrefix(), 4));
|
||||
// 退药状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.REFUNDED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
// 退药时间
|
||||
medicationDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 退药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
medicationDispense.setId(null);
|
||||
medicationRefundList.add(medicationDispense);
|
||||
// 使用逗号分割追溯码并转换为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.saveBatch(medicationRefundList);
|
||||
// 药品退药请求状态变更(待退药→已完成)
|
||||
medicationRequestService.updateCompletedStatusBatch(medRequestIdList, null, null);
|
||||
}
|
||||
// 获取耗材发放id列表
|
||||
List<Long> devDispenseIdList =
|
||||
returnDeviceList.stream().map(ReturnMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取退耗材请求id列表
|
||||
List<Long> devRequestIdList =
|
||||
returnDeviceList.stream().map(ReturnMedicineDto::getRequestId).collect(Collectors.toList());
|
||||
if (!devRequestIdList.isEmpty()) {
|
||||
// 药品已退药信息查询
|
||||
List<DeviceDispense> refundList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getDeviceReqId, devRequestIdList));
|
||||
if (refundList != null) {
|
||||
if (refundList.stream().map(DeviceDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.REFUNDED.getValue()))) {
|
||||
throw new ServiceException("耗材已退,请勿重复操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 退耗材单列表
|
||||
List<DeviceDispense> devRefundList = new ArrayList<>();
|
||||
if (!devDispenseIdList.isEmpty()) {
|
||||
// 耗材已发放信息查询
|
||||
List<DeviceDispense> deviceDispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
// 根据发药单对应生成退药单
|
||||
for (DeviceDispense deviceDispense : deviceDispenseList) {
|
||||
// 耗材发放编码
|
||||
deviceDispense.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_DIS_NO.getPrefix(), 4));
|
||||
// 退耗材的耗材请求id
|
||||
for (ReturnMedicineDto returnDeviceDto : returnDeviceList) {
|
||||
if (returnDeviceDto.getDispenseId().equals(deviceDispense.getId())) {
|
||||
deviceDispense.setDeviceReqId(returnDeviceDto.getRequestId());
|
||||
// 根据数量设置追溯码
|
||||
deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA,
|
||||
Collections.nCopies(deviceDispense.getQuantity(), CommonConstants.Common.DEV_TRACE_NO)));
|
||||
}
|
||||
}
|
||||
// 退药时间
|
||||
deviceDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 退药状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.REFUNDED.getValue());
|
||||
deviceDispense.setId(null);
|
||||
devRefundList.add(deviceDispense);
|
||||
// // 使用逗号分割追溯码并转换为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.saveBatch(devRefundList);
|
||||
// 药品退药请求状态变更(待退药→已完成)
|
||||
deviceRequestService.updateCompletedStatusBatch(devRequestIdList);
|
||||
}
|
||||
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 获取库存信息
|
||||
List<InventoryDto> inventoryList =
|
||||
returnMedicineMapper.selectInventoryInfoList(devDispenseIdList, medDispenseIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
if (inventoryList != null && !inventoryList.isEmpty()) {
|
||||
// 设置库存数量
|
||||
for (InventoryDto inventory : inventoryList) {
|
||||
// 库存表项目设定
|
||||
InventoryItem inventoryItem = new InventoryItem();
|
||||
// id
|
||||
inventoryItem.setId(inventory.getInventoryId());
|
||||
// 库存数量
|
||||
if (inventory.getDispenseUnit().equals(inventory.getInventoryUnitCode())) {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+待退数量
|
||||
inventoryItem.setQuantity(inventory.getInventoryQuantity().add(inventory.getDispenseQuantity()));
|
||||
} else {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)+退药数量(拆零比×待退数量)
|
||||
inventoryItem.setQuantity(inventory.getInventoryQuantity()
|
||||
.add(inventory.getPartPercent().multiply(inventory.getDispenseQuantity())));
|
||||
}
|
||||
inventoryItemList.add(inventoryItem);
|
||||
}
|
||||
// 库存更新
|
||||
iInventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 追溯码管理表数据追加
|
||||
boolean result = traceNoManageService.saveBatch(traceNoManageList);
|
||||
if (!result) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
}
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
// 调用医保商品销售退货接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
if (!medicationRefundList.isEmpty() || !devRefundList.isEmpty()) {
|
||||
List<String> uploadFailedNoList = this.ybReturnIntegrated(medDispenseIdList, devDispenseIdList);
|
||||
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;
|
||||
}
|
||||
result = ybService.cancelMerchandise(getMedical3505Result(dispenseInventoryDto));
|
||||
if (result.getCode() != 200) {
|
||||
uploadFailedNoList.add(dispenseInventoryDto.getDispenseNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
return uploadFailedNoList;
|
||||
}
|
||||
|
||||
private Medical3506Param getMedical3505Result(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.getReqId())
|
||||
.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.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("未查找到就诊诊断信息");
|
||||
}
|
||||
// 查询付款信息
|
||||
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.getLotNumber())
|
||||
.setFixmedinsHilistId(dispenseInventoryDto.getItemNo())
|
||||
.setFixmedinsHilistName(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
.setPsnCertType(mdtrtCertType.getValue()).setManuLotnum(dispenseInventoryDto.getLotNumber())
|
||||
.setManuDate(dispenseInventoryDto.getProductionDate())
|
||||
.setSelRetnCnt(new BigDecimal(dispenseInventoryDto.getDispenseQuantity().toString()))
|
||||
.setSelRetnTime(dispenseInventoryDto.getDispenseTime()).setExpyEnd(dispenseInventoryDto.getExpirationDate())
|
||||
.setMedinsProdSelNo(dispenseInventoryDto.getDispenseNo()).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 medical3506Param;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,838 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.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.ServiceException;
|
||||
import com.core.common.utils.*;
|
||||
import com.core.system.mapper.SysDictDataMapper;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.service.*;
|
||||
import com.openhis.clinical.service.IAllergyIntoleranceService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
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.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.web.inventorymanage.appservice.ITraceNoAppService;
|
||||
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.domain.ServiceRequest;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
import com.openhis.yb.domain.ClinicSettle;
|
||||
import com.openhis.yb.dto.Medical3505Param;
|
||||
import com.openhis.yb.service.IClinicSettleService;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
|
||||
import reactor.util.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* 西药发放 应用实现类
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025/3/14
|
||||
*/
|
||||
@Service
|
||||
public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineDispenseAppService {
|
||||
|
||||
@Autowired
|
||||
private ITraceNoAppService traceNoAppService;
|
||||
|
||||
@Autowired
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Autowired
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
@Autowired
|
||||
private IInventoryItemService iInventoryItemService;
|
||||
|
||||
@Autowired
|
||||
private IMedicationRequestService medicationRequestService;
|
||||
|
||||
@Autowired
|
||||
private WesternMedicineDispenseMapper westernMedicineDispenseMapper;
|
||||
|
||||
@Autowired
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
@Autowired
|
||||
private YbManager ybService;
|
||||
|
||||
@Autowired
|
||||
private IChargeItemService iChargeItemService;
|
||||
|
||||
@Autowired
|
||||
private IPaymentReconciliationService iPaymentReconciliationService;
|
||||
|
||||
@Autowired
|
||||
private IContractService iContractService;
|
||||
|
||||
@Autowired
|
||||
private IAccountService accountService;
|
||||
|
||||
@Autowired
|
||||
private IClinicSettleService clinicSettleService;
|
||||
|
||||
@Autowired
|
||||
private IEncounterDiagnosisService encounterDiagnosisService;
|
||||
|
||||
@Autowired
|
||||
private IServiceRequestService serviceRequestService;
|
||||
|
||||
@Autowired
|
||||
private IAllergyIntoleranceService allergyIntoleranceService;
|
||||
|
||||
@Resource
|
||||
private SysDictDataMapper sysDictDataMapper;
|
||||
|
||||
@Autowired
|
||||
private ITraceNoManageService traceNoManageService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
DispenseInitDto initDto = new DispenseInitDto();
|
||||
|
||||
// 获取科室下拉选列表
|
||||
List<Organization> organizationList =
|
||||
organizationService.getList(OrganizationType.DEPARTMENT.getValue(), 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.DispenseStatusOption> dispenseStatusOptions = new ArrayList<>();
|
||||
dispenseStatusOptions.add(new DispenseInitDto.DispenseStatusOption(DispenseStatus.IN_PROGRESS.getValue(),
|
||||
DispenseStatus.IN_PROGRESS.getInfo()));
|
||||
dispenseStatusOptions.add(new DispenseInitDto.DispenseStatusOption(DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.COMPLETED.getInfo()));
|
||||
|
||||
initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions)
|
||||
.setDispenseStatusOptions(dispenseStatusOptions).setPreparerDoctorOptions(preparerDoctorOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询发药病人列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 发药病人列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterInfoListPage(EncounterInfoPageDto encounterInfoPageDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
// 发药状态初始化
|
||||
Integer statusEnum = encounterInfoPageDto.getStatusEnum();
|
||||
encounterInfoPageDto.setStatusEnum(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterInfoPageDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(encounterInfoPageDto, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.idCard,
|
||||
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
|
||||
request);
|
||||
// 查询就诊病人列表
|
||||
Page<EncounterInfoPageDto> encounterInfoPage = westernMedicineDispenseMapper.selectEncounterInfoListPage(
|
||||
new Page<>(pageNo, pageSize), queryWrapper, statusEnum, DispenseStatus.IN_PROGRESS.getValue(),
|
||||
DispenseStatus.COMPLETED.getValue(), DispenseStatus.PREPARATION.getValue(),
|
||||
DispenseStatus.PREPARED.getValue(), EncounterClass.AMB.getValue());
|
||||
encounterInfoPage.getRecords().forEach(encounterInfo -> {
|
||||
// 性别
|
||||
encounterInfo.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
|
||||
// 发药状态
|
||||
encounterInfo
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getStatusEnum()));
|
||||
});
|
||||
return R.ok(encounterInfoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param prescriptionMedicineInfoDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPrescriptionInfo(PrescriptionMedicineInfoDto prescriptionMedicineInfoDto, Integer pageNo,
|
||||
Integer pageSize) {
|
||||
// 发药状态初始化
|
||||
Integer dispenseStatus = prescriptionMedicineInfoDto.getStatusEnum();
|
||||
prescriptionMedicineInfoDto.setStatusEnum(null);
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<PrescriptionMedicineInfoDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(prescriptionMedicineInfoDto, null, null, null);
|
||||
|
||||
// 获取所属医院id
|
||||
Long hospitalId = SecurityUtils.getLoginUser().getHospitalId();
|
||||
// 患者基本信息查询
|
||||
PrescriptionPatientInfoDto prescriptionPatientInfoDto = westernMedicineDispenseMapper
|
||||
.selectPrescriptionPatientInfo(prescriptionMedicineInfoDto.getEncounterId(), hospitalId);
|
||||
|
||||
// 年龄
|
||||
prescriptionPatientInfoDto.setAge(AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate()));
|
||||
// 性别
|
||||
prescriptionPatientInfoDto.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, prescriptionPatientInfoDto.getGenderEnum()));
|
||||
|
||||
// 处方单信息查询
|
||||
|
||||
Page<PrescriptionMedicineInfoDto> prescriptionMedicineInfoPage =
|
||||
westernMedicineDispenseMapper.selectPrescriptionMedicineInfoList(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
DispenseStatus.IN_PROGRESS.getValue(), DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.PREPARATION.getValue(), DispenseStatus.PREPARED.getValue(), dispenseStatus);
|
||||
|
||||
// 查询字典值
|
||||
List<SysDictData> unitCodeList = sysDictDataMapper.selectDictDataByType("unit_code");
|
||||
Map<String, String> unitCodeLabel = unitCodeList.stream().collect(
|
||||
Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel, (oldValue, newValue) -> oldValue // 如果有重复键,保留旧值
|
||||
));
|
||||
List<SysDictData> methodCodeList = sysDictDataMapper.selectDictDataByType("method_code");
|
||||
Map<String, String> methodCodeLabel = methodCodeList.stream().collect(
|
||||
Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel, (oldValue, newValue) -> oldValue // 如果有重复键,保留旧值
|
||||
));
|
||||
|
||||
List<PrescriptionMedicineInfoDto> prescriptionMedicineInfoList = prescriptionMedicineInfoPage.getRecords();
|
||||
Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel, (oldValue, newValue) -> oldValue // 如果有重复键,保留旧值
|
||||
);
|
||||
prescriptionMedicineInfoList.forEach(prescriptionMedicineInfo -> {
|
||||
// 发药状态
|
||||
prescriptionMedicineInfo.setStatusEnum_enumText(
|
||||
EnumUtils.getInfoByValue(DispenseStatus.class, prescriptionMedicineInfo.getStatusEnum()));
|
||||
// 匹配剂量单位字典文本
|
||||
String doseUnitCode = prescriptionMedicineInfo.getDoseUnitCode();
|
||||
String doseUnitLabel = unitCodeLabel.getOrDefault(doseUnitCode, "");
|
||||
prescriptionMedicineInfo.setDoseUnitCode_dictText(doseUnitLabel);
|
||||
// 匹配单位字典文本
|
||||
String unitCode = prescriptionMedicineInfo.getUnitCode();
|
||||
String unitLabel = unitCodeLabel.getOrDefault(unitCode, "");
|
||||
prescriptionMedicineInfo.setUnitCode_dictText(unitLabel);
|
||||
// 匹配用法字典文本
|
||||
String methodCode = prescriptionMedicineInfo.getMethodCode();
|
||||
String methodLabel = methodCodeLabel.getOrDefault(methodCode, "");
|
||||
prescriptionMedicineInfo.setMethodCode_dictText(methodLabel);
|
||||
|
||||
switch (prescriptionMedicineInfo.getPharmacologyCategoryCode()) {
|
||||
case "2": // 麻醉药品
|
||||
prescriptionMedicineInfo.setPharmacologyCategoryCode_Text("麻醉");
|
||||
case "3": // 毒性药品
|
||||
prescriptionMedicineInfo.setPharmacologyCategoryCode_Text("毒性");
|
||||
case "4": // 一类精神药
|
||||
prescriptionMedicineInfo.setPharmacologyCategoryCode_Text("精一");
|
||||
case "5": // 二类精神药
|
||||
prescriptionMedicineInfo.setPharmacologyCategoryCode_Text("精二");
|
||||
default: // 普通药品
|
||||
prescriptionMedicineInfo.setPharmacologyCategoryCode_Text("普通");
|
||||
}
|
||||
|
||||
// 判断是否为慢病
|
||||
if (EncounterYbClass.CHRONIC_DISEASE_OUTPATIENT.getCode()
|
||||
.equals(prescriptionMedicineInfo.getMedTypeCode())) {
|
||||
prescriptionMedicineInfo.setChronicDisease(Whether.YES.getInfo());
|
||||
} else {
|
||||
prescriptionMedicineInfo.setChronicDisease(Whether.NO.getInfo());
|
||||
}
|
||||
// 皮试flag为是时
|
||||
if (Whether.YES.getValue().equals(prescriptionMedicineInfo.getSkinTestFlag())) {
|
||||
// 获取皮试结果
|
||||
ServiceRequest serReqObj =
|
||||
serviceRequestService.selectByMedRequestId(prescriptionMedicineInfo.getRequestId());
|
||||
if (serReqObj != null) {
|
||||
Integer clinicalStatus = allergyIntoleranceService.getPsResultByRequestId(serReqObj.getId());
|
||||
prescriptionMedicineInfo.setPsResult(ClinicalStatus.getByValue(clinicalStatus).getInfo());
|
||||
}
|
||||
} else {
|
||||
prescriptionMedicineInfo.setPsResult("无");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 计算合计金额
|
||||
if (!prescriptionMedicineInfoList.isEmpty()) {
|
||||
double totalPrice = 0d;
|
||||
for (PrescriptionMedicineInfoDto item : prescriptionMedicineInfoList) {
|
||||
totalPrice += item.getTotalPrice().doubleValue();
|
||||
}
|
||||
prescriptionPatientInfoDto.setTotalPrice(totalPrice);
|
||||
}
|
||||
PrescriptionInfoDto prescriptionInfoDto = new PrescriptionInfoDto();
|
||||
prescriptionInfoDto.setPrescriptionPatientInfoDto(prescriptionPatientInfoDto);
|
||||
prescriptionInfoDto.setPrescriptionMedicineInfoDtoList(prescriptionMedicineInfoList);
|
||||
return R.ok(prescriptionInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配药
|
||||
*
|
||||
* @param dispenseMedicineList 配药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicinePrepare(List<DispenseMedicineDto> dispenseMedicineList) {
|
||||
// 配药人检查
|
||||
if (dispenseMedicineList.get(0).getPreparerId() == null
|
||||
|| dispenseMedicineList.get(0).getPreparerId().equals(SecurityUtils.getLoginUser().getPractitionerId())) {
|
||||
return R.fail("请选择调配药师");
|
||||
}
|
||||
// 获取发药单id列表
|
||||
List<Long> medDispenseIdList =
|
||||
dispenseMedicineList.stream().map(DispenseMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取库存信息
|
||||
List<InventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
// 按每个药品分组
|
||||
Map<Long, List<InventoryDto>> groupedByItemId =
|
||||
inventoryList.stream().collect(Collectors.groupingBy(InventoryDto::getItemId));
|
||||
// 遍历每个分组校验库存状态
|
||||
for (Map.Entry<Long, List<InventoryDto>> entry : groupedByItemId.entrySet()) {
|
||||
List<InventoryDto> groupItems = entry.getValue();
|
||||
if (groupItems.stream().map(InventoryDto::getInventoryStatusEnum)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 库存停供校验
|
||||
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
}
|
||||
if (!inventoryList.isEmpty()) {
|
||||
for (InventoryDto inventoryDto : inventoryList) {
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(inventoryDto.getInventoryStatusEnum())) {
|
||||
// 库存数量判定
|
||||
if (inventoryDto.getDispenseUnit().equals(inventoryDto.getInventoryUnitCode())) {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
|
||||
BigDecimal quantity = inventoryDto.getInventoryQuantity().subtract(inventoryDto.getQuantity());
|
||||
// 库存数量判定
|
||||
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
|
||||
}
|
||||
} else {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
|
||||
BigDecimal quantity = inventoryDto.getInventoryQuantity()
|
||||
.subtract(inventoryDto.getPartPercent().multiply(inventoryDto.getQuantity()));
|
||||
// 库存数量判定
|
||||
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 药品发药信息查询
|
||||
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.PREPARED.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 (DispenseMedicineDto dispenseMedicineDto : dispenseMedicineList) {
|
||||
if (medicationDispense.getId().equals(dispenseMedicineDto.getDispenseId()))
|
||||
// 药品追溯码
|
||||
medicationDispense.setTraceNo(dispenseMedicineDto.getTraceNo());
|
||||
}
|
||||
}
|
||||
// 药品发放更新
|
||||
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<DispenseMedicineDto> dispenseMedicineList) {
|
||||
List<InventoryItem> inventoryItemList = new ArrayList<>();
|
||||
// 获取发药单id列表
|
||||
List<Long> medDispenseIdList =
|
||||
dispenseMedicineList.stream().map(DispenseMedicineDto::getDispenseId).collect(Collectors.toList());
|
||||
// 获取药品申请id列表
|
||||
List<Long> medRequestIdList =
|
||||
dispenseMedicineList.stream().map(DispenseMedicineDto::getRequestId).collect(Collectors.toList());
|
||||
// 获取库存信息
|
||||
List<InventoryDto> inventoryList = returnMedicineMapper.selectInventoryInfoList(null, medDispenseIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
// 按每个药品分组
|
||||
Map<Long, List<InventoryDto>> groupedByItemId =
|
||||
inventoryList.stream().collect(Collectors.groupingBy(InventoryDto::getItemId));
|
||||
// 遍历每个分组校验库存状态
|
||||
for (Map.Entry<Long, List<InventoryDto>> entry : groupedByItemId.entrySet()) {
|
||||
List<InventoryDto> groupItems = entry.getValue();
|
||||
if (groupItems.stream().map(InventoryDto::getInventoryStatusEnum)
|
||||
.allMatch(x -> x.equals(PublicationStatus.RETIRED.getValue()))) {
|
||||
// 库存停供校验
|
||||
return R.fail(groupItems.get(0).getItemName() + "库存已停供");
|
||||
}
|
||||
}
|
||||
if (!inventoryList.isEmpty()) {
|
||||
for (InventoryDto inventoryDto : inventoryList) {
|
||||
if (PublicationStatus.ACTIVE.getValue().equals(inventoryDto.getInventoryStatusEnum())) {
|
||||
InventoryItem inventoryItem = new InventoryItem();
|
||||
// 库存数量判定
|
||||
if (inventoryDto.getDispenseUnit().equals(inventoryDto.getInventoryUnitCode())) {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-请求数量
|
||||
BigDecimal quantity = inventoryDto.getInventoryQuantity().subtract(inventoryDto.getQuantity());
|
||||
// 库存数量判定
|
||||
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
|
||||
} else {
|
||||
inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
|
||||
}
|
||||
} else {
|
||||
// 当前库存数量(拆零单位)=当前库存数量(拆零单位)-拆零数量(拆零比×请求数量)
|
||||
BigDecimal quantity = inventoryDto.getInventoryQuantity()
|
||||
.subtract(inventoryDto.getPartPercent().multiply(inventoryDto.getQuantity()));
|
||||
// 库存数量判定
|
||||
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// 库存数量不足
|
||||
return R.fail(inventoryDto.getItemName() + "当前库存数量不足");
|
||||
} else {
|
||||
inventoryItem.setId(inventoryDto.getInventoryId()).setQuantity(quantity);
|
||||
}
|
||||
}
|
||||
inventoryItemList.add(inventoryItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 药品发药信息查询
|
||||
List<MedicationDispense> dispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
// 追溯码列表
|
||||
List<TraceNoManage> tracesNoManageList = new ArrayList<>();
|
||||
TraceNoManage traceNoManage;
|
||||
if (dispenseList != null) {
|
||||
if (dispenseList.stream().map(MedicationDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.COMPLETED.getValue()))) {
|
||||
throw new ServiceException("药品已发药,请勿重复发药");
|
||||
} else {
|
||||
for (MedicationDispense medicationDispense : dispenseList) {
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||
// 发药数量
|
||||
medicationDispense.setDispenseQuantity(medicationDispense.getQuantity());
|
||||
// 发药时间
|
||||
medicationDispense.setDispenseTime(DateUtils.getNowDate());
|
||||
// 发药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
// 使用逗号分割追溯码并转换为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(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(dispenseList);
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 库存更新
|
||||
iInventoryItemService.updateBatchById(inventoryItemList);
|
||||
// 追溯码管理表数据追加
|
||||
boolean result = traceNoManageService.saveBatch(tracesNoManageList);
|
||||
if (!result) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
// 调用医保商品销售接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<String> uploadFailedNoList = this.ybMedicineIntegrated(medDispenseIdList, null);
|
||||
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<DispenseMedicineDto> dispenseMedicineList) {
|
||||
// 获取发药单id列表
|
||||
List<Long> medDispenseIdList =
|
||||
dispenseMedicineList.stream().map(DispenseMedicineDto::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;
|
||||
}
|
||||
result = ybService.merchandise(getMedical3505Param(dispenseInventoryDto));
|
||||
if (result.getCode() != 200) {
|
||||
uploadFailedNoList.add(dispenseInventoryDto.getDispenseNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
return uploadFailedNoList;
|
||||
}
|
||||
|
||||
private Medical3505Param getMedical3505Param(DispenseInventoryDto dispenseInventoryDto) {
|
||||
Medical3505Param medical3505Param = new Medical3505Param();
|
||||
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.getReqId())
|
||||
.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.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 =
|
||||
iPaymentReconciliationService.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 =
|
||||
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())) {
|
||||
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.getLotNumber())
|
||||
.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 medical3505Param;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param locationId 库房id
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
@Override
|
||||
public R<?> getMonthlySettlementPatientInfoList(Long locationId, String startTime, String endTime,Integer pageNo, Integer pageSize) {
|
||||
|
||||
// 患者基本信息查询
|
||||
PrescriptionPatientInfoDto prescriptionPatientInfoDto =new PrescriptionPatientInfoDto();
|
||||
|
||||
// 处方单信息查询
|
||||
Page<PrescriptionMedicineInfoDto> prescriptionMedicineInfoPage =
|
||||
westernMedicineDispenseMapper.selectMonthlySettlementPatientInfoList(new Page<>(pageNo, pageSize),
|
||||
locationId,startTime, endTime, DispenseStatus.COMPLETED.getValue(),ItemType.MEDICINE.getValue(),
|
||||
ItemType.DEVICE.getValue());
|
||||
|
||||
// 查询字典值
|
||||
List<SysDictData> unitCodeList = sysDictDataMapper.selectDictDataByType("unit_code");
|
||||
Map<String, String> unitCodeLabel = unitCodeList.stream().collect(
|
||||
Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel, (oldValue, newValue) -> oldValue // 如果有重复键,保留旧值
|
||||
));
|
||||
List<SysDictData> methodCodeList = sysDictDataMapper.selectDictDataByType("method_code");
|
||||
Map<String, String> methodCodeLabel = methodCodeList.stream().collect(
|
||||
Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel, (oldValue, newValue) -> oldValue // 如果有重复键,保留旧值
|
||||
));
|
||||
|
||||
List<PrescriptionMedicineInfoDto> prescriptionMedicineInfoList = prescriptionMedicineInfoPage.getRecords();
|
||||
Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel, (oldValue, newValue) -> oldValue // 如果有重复键,保留旧值
|
||||
);
|
||||
prescriptionMedicineInfoList.forEach(prescriptionMedicineInfo -> {
|
||||
if(prescriptionMedicineInfo.getType().equals(ItemType.MEDICINE.getValue())){
|
||||
// 发药状态
|
||||
prescriptionMedicineInfo.setStatusEnum_enumText(
|
||||
EnumUtils.getInfoByValue(DispenseStatus.class, prescriptionMedicineInfo.getStatusEnum()));
|
||||
// 匹配剂量单位字典文本
|
||||
String doseUnitCode = prescriptionMedicineInfo.getDoseUnitCode();
|
||||
String doseUnitLabel = unitCodeLabel.getOrDefault(doseUnitCode, "");
|
||||
prescriptionMedicineInfo.setDoseUnitCode_dictText(doseUnitLabel);
|
||||
// 匹配单位字典文本
|
||||
String unitCode = prescriptionMedicineInfo.getUnitCode();
|
||||
String unitLabel = unitCodeLabel.getOrDefault(unitCode, "");
|
||||
prescriptionMedicineInfo.setUnitCode_dictText(unitLabel);
|
||||
// 匹配用法字典文本
|
||||
String methodCode = prescriptionMedicineInfo.getMethodCode();
|
||||
String methodLabel = methodCodeLabel.getOrDefault(methodCode, "");
|
||||
prescriptionMedicineInfo.setMethodCode_dictText(methodLabel);
|
||||
|
||||
switch (prescriptionMedicineInfo.getPharmacologyCategoryCode()) {
|
||||
case "2": // 麻醉药品
|
||||
prescriptionMedicineInfo.setPharmacologyCategoryCode_Text("麻醉");
|
||||
case "3": // 毒性药品
|
||||
prescriptionMedicineInfo.setPharmacologyCategoryCode_Text("毒性");
|
||||
case "4": // 一类精神药
|
||||
prescriptionMedicineInfo.setPharmacologyCategoryCode_Text("精一");
|
||||
case "5": // 二类精神药
|
||||
prescriptionMedicineInfo.setPharmacologyCategoryCode_Text("精二");
|
||||
default: // 普通药品
|
||||
prescriptionMedicineInfo.setPharmacologyCategoryCode_Text("普通");
|
||||
}
|
||||
|
||||
// 判断是否为慢病
|
||||
if (EncounterYbClass.CHRONIC_DISEASE_OUTPATIENT.getCode()
|
||||
.equals(prescriptionMedicineInfo.getMedTypeCode())) {
|
||||
prescriptionMedicineInfo.setChronicDisease(Whether.YES.getInfo());
|
||||
} else {
|
||||
prescriptionMedicineInfo.setChronicDisease(Whether.NO.getInfo());
|
||||
}
|
||||
// 皮试flag为是时
|
||||
if (Whether.YES.getValue().equals(prescriptionMedicineInfo.getSkinTestFlag())) {
|
||||
// 获取皮试结果
|
||||
ServiceRequest serReqObj =
|
||||
serviceRequestService.selectByMedRequestId(prescriptionMedicineInfo.getRequestId());
|
||||
if (serReqObj != null) {
|
||||
Integer clinicalStatus = allergyIntoleranceService.getPsResultByRequestId(serReqObj.getId());
|
||||
prescriptionMedicineInfo.setPsResult(ClinicalStatus.getByValue(clinicalStatus).getInfo());
|
||||
}
|
||||
} else {
|
||||
prescriptionMedicineInfo.setPsResult("无");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 计算合计金额
|
||||
if (!prescriptionMedicineInfoList.isEmpty()) {
|
||||
double totalPrice = 0d;
|
||||
for (PrescriptionMedicineInfoDto item : prescriptionMedicineInfoList) {
|
||||
totalPrice += item.getTotalPrice().doubleValue();
|
||||
}
|
||||
prescriptionPatientInfoDto.setTotalPrice(totalPrice);
|
||||
}
|
||||
PrescriptionInfoDto prescriptionInfoDto = new PrescriptionInfoDto();
|
||||
prescriptionInfoDto.setPrescriptionPatientInfoDto(prescriptionPatientInfoDto);
|
||||
prescriptionInfoDto.setPrescriptionMedicineInfoDtoList(prescriptionMedicineInfoList);
|
||||
return R.ok(prescriptionInfoDto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;//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.core.domain.entity.SysDictData;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.*;
|
||||
import com.core.system.mapper.SysDictDataMapper;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.service.IAccountService;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.administration.service.IEncounterDiagnosisService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.enums.ybenums.YbMdtrtCertType;
|
||||
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.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.web.pharmacymanage.appservice.IInpatientMedicineDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
import com.openhis.web.pharmacymanage.mapper.InpatientMedicineDispenseMapper;
|
||||
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.YbManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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/6/3
|
||||
*/
|
||||
@Service public class InpatientMedicineDispenseAppServiceImpl implements IInpatientMedicineDispenseAppService {
|
||||
|
||||
@Autowired
|
||||
private WesternMedicineDispenseMapper westernMedicineDispenseMapper;
|
||||
|
||||
/**
|
||||
* 分页查询发药病人列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 发药病人列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterInfoListPage(EncounterInfoPageDto encounterInfoPageDto, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
// 发药状态初始化
|
||||
Integer statusEnum = encounterInfoPageDto.getStatusEnum();
|
||||
encounterInfoPageDto.setStatusEnum(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<EncounterInfoPageDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(encounterInfoPageDto, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.idCard,
|
||||
CommonConstants.FieldName.PatientPyStr, CommonConstants.FieldName.PatientWbStr)),
|
||||
request);
|
||||
// 查询就诊病人列表
|
||||
Page<EncounterInfoPageDto> encounterInfoPage = westernMedicineDispenseMapper.selectEncounterInfoListPage(
|
||||
new Page<>(pageNo, pageSize), queryWrapper, statusEnum, DispenseStatus.IN_PROGRESS.getValue(),
|
||||
DispenseStatus.COMPLETED.getValue(), DispenseStatus.PREPARATION.getValue(),
|
||||
DispenseStatus.PREPARED.getValue(), EncounterClass.IMP.getValue());
|
||||
encounterInfoPage.getRecords().forEach(encounterInfo -> {
|
||||
// 性别
|
||||
encounterInfo.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, encounterInfo.getGenderEnum()));
|
||||
// 发药状态
|
||||
encounterInfo
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, encounterInfo.getStatusEnum()));
|
||||
});
|
||||
return R.ok(encounterInfoPage);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,532 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.constant.HttpStatus;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.web.inhospitalnursestation.appservice.IInpatientMedicineCollectionAppService;
|
||||
import com.openhis.web.pharmacyDispensarymanage.appservice.IPharmacyDispensaryDispensingOrderService;
|
||||
import com.openhis.web.pharmacyWarehousemanage.dto.PharmacyWarehouseDetailDto;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
import com.openhis.workflow.domain.DeviceDispense;
|
||||
import com.openhis.workflow.domain.SupplyDelivery;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.DateUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.system.mapper.SysDictDataMapper;
|
||||
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.utils.EnumUtils;
|
||||
import com.openhis.financial.service.IContractService;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.web.pharmacymanage.appservice.IInpatientMedicineSummaryDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.mapper.InpatientMedicineSummaryDispenseMapper;
|
||||
import com.openhis.web.pharmacymanage.mapper.ReturnMedicineMapper;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import com.openhis.workflow.service.ISupplyDeliveryService;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
import com.openhis.yb.service.IClinicSettleService;
|
||||
|
||||
/**
|
||||
* 住院汇总发放 应用实现类
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/6/3
|
||||
*/
|
||||
@Service
|
||||
public class InpatientMedicineSummaryDispenseAppServiceImpl implements IInpatientMedicineSummaryDispenseAppService {
|
||||
|
||||
@Autowired
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
|
||||
@Autowired
|
||||
private IInventoryItemService iInventoryItemService;
|
||||
|
||||
@Autowired
|
||||
private InpatientMedicineSummaryDispenseMapper inpatientMedicineDispenseMapper;
|
||||
|
||||
@Autowired
|
||||
private ReturnMedicineMapper returnMedicineMapper;
|
||||
|
||||
@Autowired
|
||||
private ILocationService locationService;
|
||||
@Resource
|
||||
private IPractitionerService practitionerService;
|
||||
@Resource
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
@Resource
|
||||
private ISupplyDeliveryService supplyDeliveryService;
|
||||
@Autowired
|
||||
private ITraceNoManageService traceNoManageService;
|
||||
@Autowired
|
||||
private IWesternMedicineDispenseAppServiceImpl westernMedicineDispenseAppServiceImpl;
|
||||
|
||||
@Autowired
|
||||
private IInpatientMedicineCollectionAppService inpatientMedicineCollectionAppService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> init() {
|
||||
|
||||
InpatientMedicineInitDto initDto = new InpatientMedicineInitDto();
|
||||
|
||||
// // 获取科室下拉选列表 todo 前台直接调用共通方法
|
||||
// List<Organization> organizationList = organizationService.getList(OrganizationType.DEPARTMENT.getValue(),
|
||||
// OrganizationClass.INPATIENT.getValue());
|
||||
// List<InpatientMedicineDispenseInitDto.LongOptions> organizationOptions = organizationList.stream().map(
|
||||
// organization -> new InpatientMedicineDispenseInitDto.LongOptions(organization.getId(),
|
||||
// organization.getName())).collect(Collectors.toList());
|
||||
|
||||
// 未发药原因下拉选列表
|
||||
List<InpatientMedicineInitDto.IntegerOptions> notPerformedReasonOptions =
|
||||
Stream.of(NotPerformedReasonEnum.values())
|
||||
.map(notPerformedReason -> new InpatientMedicineInitDto.IntegerOptions(notPerformedReason.getValue(),
|
||||
notPerformedReason.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 查询领药人列表
|
||||
List<Practitioner> applicantList = practitionerService.getList();
|
||||
|
||||
// 发药状态
|
||||
List<InpatientMedicineInitDto.IntegerOptions> dispenseStatusOptions = new ArrayList<>();
|
||||
dispenseStatusOptions.add(new InpatientMedicineInitDto.IntegerOptions(DispenseStatus.SUMMARIZED.getValue(),
|
||||
DispenseStatus.SUMMARIZED.getInfo()));
|
||||
dispenseStatusOptions.add(new InpatientMedicineInitDto.IntegerOptions(DispenseStatus.COMPLETED.getValue(),
|
||||
DispenseStatus.COMPLETED.getInfo()));
|
||||
dispenseStatusOptions.add(new InpatientMedicineInitDto.IntegerOptions(DispenseStatus.DECLINED.getValue(),
|
||||
DispenseStatus.DECLINED.getInfo()));
|
||||
|
||||
initDto// .setDepartmentOptions(organizationOptions)
|
||||
.setApplicantOptions(applicantList).setDispenseStatusOptions(dispenseStatusOptions)
|
||||
.setNotPerformedReasonOptions(notPerformedReasonOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汇总医嘱查询
|
||||
*
|
||||
* @param searchParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
*/
|
||||
@Override
|
||||
public R<?> getMedicationSummaryInfo(InpatientMedicineSearchParam searchParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<InpatientMedicineSearchParam> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(searchParam, searchKey, null, request);
|
||||
queryWrapper.orderByDesc(CommonConstants.FieldName.applyTime);
|
||||
|
||||
// 查询医嘱详细信息
|
||||
Page<InpatientMedicineSummaryPrescriptionInfoDto> prescriptionItemInfoPageDto =
|
||||
inpatientMedicineDispenseMapper.selectMedicationSummaryInfo(new Page<>(pageNo, pageSize), queryWrapper,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||
SupplyType.DISPENSING_ORDER.getValue(), SupplyCategory.INPATIENT_PATIENT_SUMMARY_DISPENSING.getValue());
|
||||
|
||||
List<InpatientMedicineSummaryPrescriptionInfoDto.Option> unitList;
|
||||
// 个别项目设定
|
||||
for (InpatientMedicineSummaryPrescriptionInfoDto prescriptionInfoDto : prescriptionItemInfoPageDto
|
||||
.getRecords()) {
|
||||
// 状态
|
||||
prescriptionInfoDto.setStatusEnum_enumText(
|
||||
EnumUtils.getInfoByValue(DispenseStatus.class, prescriptionInfoDto.getStatusEnum()));
|
||||
// 追溯码单位列表
|
||||
unitList = new ArrayList<>();
|
||||
unitList.add(new InpatientMedicineSummaryPrescriptionInfoDto.Option(prescriptionInfoDto.getMaxUnitCode(),
|
||||
prescriptionInfoDto.getMaxUnitCode_dictText()));
|
||||
unitList.add(new InpatientMedicineSummaryPrescriptionInfoDto.Option(prescriptionInfoDto.getMinUnitCode(),
|
||||
prescriptionInfoDto.getMinUnitCode_dictText()));
|
||||
|
||||
prescriptionInfoDto.setUnitList(unitList);
|
||||
} ;
|
||||
|
||||
return R.ok(prescriptionItemInfoPageDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单核对发药
|
||||
*
|
||||
* @param searchParam 条件
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicineDispense(List<InpatientMedicineSearchParam> searchParam) {
|
||||
// 构建供应发放Id到追溯码的映射
|
||||
Map<Long, String> traceNoMap = new HashMap<>();
|
||||
for (InpatientMedicineSearchParam param : searchParam) {
|
||||
if (param != null && param.getDeliveryId() != null) {
|
||||
traceNoMap.put(param.getDeliveryId(), param.getTraceNo());
|
||||
}
|
||||
}
|
||||
|
||||
// 供应发放idList
|
||||
List<Long> deliveryIdList =
|
||||
searchParam.stream().map(InpatientMedicineSearchParam::getDeliveryId).collect(Collectors.toList());
|
||||
// 获取供应发放信息列表
|
||||
List<SupplyDelivery> supplyDeliveryInfoList = supplyDeliveryService.selectByIdList(deliveryIdList);
|
||||
// 供应申请idList
|
||||
List<Long> requestIdList = supplyDeliveryInfoList.stream().map(SupplyDelivery::getRequestId).toList();
|
||||
// 耗材发放ID列表
|
||||
List<Long> devDispenseIdList = new ArrayList<>();
|
||||
// 药品发放ID列表
|
||||
List<Long> medDispenseIdList = new ArrayList<>();
|
||||
List<Long> idList;
|
||||
String[] idArray;
|
||||
|
||||
// 构建项目发放Id到追溯码的映射
|
||||
Map<Long, String> medTraceNoMap = new HashMap<>();
|
||||
Map<Long, String> devTraceNoMap = new HashMap<>();
|
||||
|
||||
for (SupplyDelivery item : supplyDeliveryInfoList) {
|
||||
// 按英文逗号分割字符串,得到数组
|
||||
idArray = item.getBasedOnIds().split(CommonConstants.Common.COMMA);
|
||||
// 流式处理:过滤空值、去除空格、转换为Long
|
||||
idList = Arrays.stream(idArray).map(String::trim) // 去除每个元素前后的空格
|
||||
.filter(str -> !str.isEmpty()) // 过滤空字符串(如连续逗号导致的空值)
|
||||
.map(Long::parseLong) // 转换为Long类型
|
||||
.collect(Collectors.toList()); // 收集为List<Long>
|
||||
// 设置发放ID列表,追溯码映射
|
||||
if (item.getBasedOnTable().equals(CommonConstants.TableName.MED_MEDICATION_DISPENSE)) {
|
||||
// 耗材发放ID列表
|
||||
devDispenseIdList.addAll(idList);
|
||||
// 追溯码映射
|
||||
for (Long id : idList) {
|
||||
medTraceNoMap.put(id, traceNoMap.get(item.getId()));
|
||||
}
|
||||
} else {
|
||||
// 药品发放ID列表
|
||||
medDispenseIdList.addAll(idList);
|
||||
// 追溯码映射
|
||||
for (Long id : idList) {
|
||||
devTraceNoMap.put(id, traceNoMap.get(item.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 校验库存
|
||||
R<?> checkInventoryReturn =
|
||||
inpatientMedicineCollectionAppService.checkInventoryItem(devDispenseIdList, medDispenseIdList);
|
||||
if (checkInventoryReturn.getCode() != HttpStatus.SUCCESS) {
|
||||
return checkInventoryReturn;
|
||||
}
|
||||
// 库存信息
|
||||
List<InventoryItem> inventoryItemList = (List<InventoryItem>)checkInventoryReturn.getData();
|
||||
|
||||
// todo 上面一行代码好使的话,就将下面注释的代码删除
|
||||
// // 检查数据类型是否为List<InventoryItem>
|
||||
// if (checkInventoryReturn.getData() instanceof List<?>) {
|
||||
// List<?> rawList = (List<?>)checkInventoryReturn.getData();
|
||||
//
|
||||
// // 进一步检查列表中的元素类型
|
||||
// boolean isInventoryItemList = true;
|
||||
// for (Object item : rawList) {
|
||||
// if (!(item instanceof InventoryItem)) {
|
||||
// isInventoryItemList = false;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (isInventoryItemList) {
|
||||
// // 强制转换为List<InventoryItem>
|
||||
// inventoryItemList = (List<InventoryItem>)rawList;
|
||||
// } else {
|
||||
// // 处理类型不匹配的情况
|
||||
// return R.fail("校验库存列表中包含非InventoryItem类型的元素");
|
||||
// }
|
||||
// } else {
|
||||
// // 处理数据不是List的情况
|
||||
// return R.fail("校验库存返回的数据不是List类型");
|
||||
// }
|
||||
|
||||
// 追溯码列表
|
||||
List<TraceNoManage> tracesNoManageList = new ArrayList<>();
|
||||
TraceNoManage traceNoManage;
|
||||
Date now = DateUtils.getNowDate();
|
||||
|
||||
// 药品发药信息查询
|
||||
List<MedicationDispense> medDispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getId, medDispenseIdList));
|
||||
if (medDispenseList != null) {
|
||||
if (medDispenseList.stream().map(MedicationDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.COMPLETED.getValue()))) {
|
||||
throw new ServiceException("药品已发放,请勿重复发放");
|
||||
} else {
|
||||
for (MedicationDispense medicationDispense : medDispenseList) {
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(now);
|
||||
// 发药数量
|
||||
medicationDispense.setDispenseQuantity(medicationDispense.getQuantity());
|
||||
// 发药时间
|
||||
medicationDispense.setDispenseTime(now);
|
||||
// 发药人
|
||||
medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
// 药品追溯码
|
||||
medicationDispense.setTraceNo(medTraceNoMap.get(medicationDispense.getId()));
|
||||
|
||||
// 使用逗号分割追溯码并转换为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(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);
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 耗材发药信息查询
|
||||
List<DeviceDispense> devDispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getId, devDispenseIdList));
|
||||
if (devDispenseList != null) {
|
||||
if (devDispenseList.stream().map(DeviceDispense::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(DispenseStatus.COMPLETED.getValue()))) {
|
||||
throw new ServiceException("耗材已发放,请勿重复发放");
|
||||
} else {
|
||||
for (DeviceDispense deviceDispense : devDispenseList) {
|
||||
// 药品发放状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||
// 发药数量
|
||||
deviceDispense.setDispenseQuantity(deviceDispense.getQuantity());
|
||||
// 发药时间
|
||||
deviceDispense.setDispenseTime(now);
|
||||
// 发药人
|
||||
deviceDispense.setPerformerId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
// 药品追溯码
|
||||
deviceDispense.setTraceNo(devTraceNoMap.get(deviceDispense.getId()));
|
||||
// todo 下面注释的代码是从耗材发放copy过来的,不知道要不要用
|
||||
// // 发药人(长大写死发耗材人)
|
||||
// deviceDispense.setPerformerId(CommonConstants.CCU.DisDeviceDoctor);
|
||||
// // 根据数量设置追溯码
|
||||
// deviceDispense.setTraceNo(String.join(CommonConstants.Common.COMMA,
|
||||
// Collections.nCopies(deviceDispense.getQuantity(), CommonConstants.Common.DEV_TRACE_NO)));
|
||||
|
||||
// todo 耗材追溯码待定
|
||||
// 使用逗号分割追溯码并转换为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(devDispenseList);
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 供应申请表更新
|
||||
supplyRequestService.updateCompletedStatusBatch(requestIdList);
|
||||
|
||||
// 供应发放表更新
|
||||
supplyDeliveryService.updateCompletedStatusBatch(deliveryIdList);
|
||||
|
||||
// 库存更新
|
||||
iInventoryItemService.updateBatchById(inventoryItemList);
|
||||
|
||||
// 追溯码管理表数据追加
|
||||
boolean result = traceNoManageService.saveBatch(tracesNoManageList);
|
||||
if (!result) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// todo 医保进销存 不知道怎么改
|
||||
// 返回信息
|
||||
String returnMsg = null;
|
||||
// 调用医保商品销售接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch)) {
|
||||
List<String> uploadFailedNoList =
|
||||
westernMedicineDispenseAppServiceImpl.ybMedicineIntegrated(medDispenseIdList, null);
|
||||
if (uploadFailedNoList != null) {
|
||||
returnMsg = "3505商品销售上传错误,错误项目编码" + uploadFailedNoList;
|
||||
} else {
|
||||
returnMsg = "3505商品销售上传成功";
|
||||
}
|
||||
}
|
||||
return R.ok(returnMsg, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param deliveryIdList 供应发放id
|
||||
* @param notPerformedReasonEnum 未发原因
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> medicineCancel(List<Long> deliveryIdList, Integer notPerformedReasonEnum) {
|
||||
// 获取供应发放信息列表
|
||||
List<SupplyDelivery> supplyDeliveryInfoList = supplyDeliveryService.selectByIdList(deliveryIdList);
|
||||
List<SupplyRequest> supplyRequestInfoList;
|
||||
// 耗材发放ID列表
|
||||
List<Long> devDispenseIdList = new ArrayList<>();
|
||||
// 药品发放ID列表
|
||||
List<Long> medDispenseIdList = new ArrayList<>();
|
||||
List<Long> idList;
|
||||
String[] idArray;
|
||||
if (supplyDeliveryInfoList != null) {
|
||||
// 供应申请idList
|
||||
List<Long> requestIdList = supplyDeliveryInfoList.stream().map(SupplyDelivery::getRequestId).toList();
|
||||
// 获取供应发放信息列表
|
||||
supplyRequestInfoList = supplyRequestService.selectByIdList(requestIdList);
|
||||
for (SupplyDelivery item : supplyDeliveryInfoList) {
|
||||
// 按英文逗号分割字符串,得到数组
|
||||
idArray = item.getBasedOnIds().split(CommonConstants.Common.COMMA);
|
||||
// 流式处理:过滤空值、去除空格、转换为Long
|
||||
idList = Arrays.stream(idArray).map(String::trim) // 去除每个元素前后的空格
|
||||
.filter(str -> !str.isEmpty()) // 过滤空字符串(如连续逗号导致的空值)
|
||||
.map(Long::parseLong) // 转换为Long类型
|
||||
.collect(Collectors.toList()); // 收集为List<Long>
|
||||
// 设置发放ID列表,追溯码映射
|
||||
if (item.getBasedOnTable().equals(CommonConstants.TableName.MED_MEDICATION_DISPENSE)) {
|
||||
// 耗材发放ID列表
|
||||
devDispenseIdList.addAll(idList);
|
||||
} else {
|
||||
// 药品发放ID列表
|
||||
medDispenseIdList.addAll(idList);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
Date now = DateUtils.getNowDate();
|
||||
|
||||
// 获取发药单id列表
|
||||
List<MedicationDispense> medDispenseInfoList = medicationDispenseService.selectByIdList(medDispenseIdList);
|
||||
if (medDispenseInfoList != null) {
|
||||
for (MedicationDispense medicationDispense : medDispenseInfoList) {
|
||||
// 药品发放状态
|
||||
medicationDispense.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||
// 未发药原因
|
||||
medicationDispense.setNotPerformedReasonEnum(notPerformedReasonEnum);
|
||||
// 状态变更时间
|
||||
medicationDispense.setStatusChangedTime(now);
|
||||
}
|
||||
// 药品发放更新
|
||||
medicationDispenseService.updateBatchById(medDispenseInfoList);
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 获取发耗材单id列表
|
||||
List<DeviceDispense> devDispenseInfoList = deviceDispenseService.selectByIdList(devDispenseIdList);
|
||||
if (devDispenseInfoList != null) {
|
||||
for (DeviceDispense deviceDispense : devDispenseInfoList) {
|
||||
// 耗材发放状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||
// 未发药原因
|
||||
deviceDispense.setNotPerformedReasonEnum(notPerformedReasonEnum);
|
||||
}
|
||||
// 耗材发放更新
|
||||
deviceDispenseService.updateBatchById(devDispenseInfoList);
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 更新供应发放信息
|
||||
for (SupplyDelivery deviceDispense : supplyDeliveryInfoList) {
|
||||
// 状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||
}
|
||||
// 更新
|
||||
supplyDeliveryService.updateBatchById(supplyDeliveryInfoList);
|
||||
|
||||
// 更新供应申请信息
|
||||
if (supplyRequestInfoList != null) {
|
||||
for (SupplyRequest deviceDispense : supplyRequestInfoList) {
|
||||
// 状态
|
||||
deviceDispense.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||
}
|
||||
// 更新
|
||||
supplyRequestService.updateBatchById(supplyRequestInfoList);
|
||||
} else {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.pharmacymanage.appservice.IMedicationDetailsAppService;
|
||||
import com.openhis.web.pharmacymanage.mapper.MedicationDetailsMapper;
|
||||
|
||||
/**
|
||||
* 发药明细 应用实现类
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025/4/14
|
||||
*/
|
||||
@Service
|
||||
public class MedicationDetailsAppServiceImpl implements IMedicationDetailsAppService {
|
||||
|
||||
@Autowired
|
||||
private MedicationDetailsMapper medicationDetailsMapper;
|
||||
|
||||
@Autowired
|
||||
private IPractitionerService iPractitionerService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@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) {
|
||||
|
||||
// 构建查询条件
|
||||
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, EncounterClass.AMB.getValue(),
|
||||
DispenseStatus.COMPLETED.getValue(), DispenseStatus.REFUNDED.getValue(), 1);
|
||||
|
||||
return R.ok(medDetailsPage);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 门诊发药明细流水账
|
||||
*
|
||||
* @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) {
|
||||
|
||||
// 构建查询条件
|
||||
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, EncounterClass.AMB.getValue(),
|
||||
DispenseStatus.COMPLETED.getValue(), DispenseStatus.REFUNDED.getValue(), 2);
|
||||
|
||||
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 com.openhis.web.reportmanage.dto.LossReportSearchParam;
|
||||
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(), 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,101 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IChineseMedicineDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 西药发药
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025/3/14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/chinese-medicine-dispense")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class ChineseMedicineDispenseController {
|
||||
|
||||
@Autowired
|
||||
public IChineseMedicineDispenseAppService chineseMedicineDispenseService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> medicineDispenseInit() {
|
||||
return chineseMedicineDispenseService.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 chineseMedicineDispenseService.getEncounterInfoListPage(encounterInfoSearchParam, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param encounterId 就诊Id
|
||||
*/
|
||||
@GetMapping("/prescription-list")
|
||||
public R<?> getPatientInfoList(@RequestParam(value = "encounterId") Long encounterId) {
|
||||
return chineseMedicineDispenseService.getPrescriptionInfo(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配药
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @param preparerId 配药人
|
||||
*/
|
||||
@PutMapping("/prepare")
|
||||
public R<?> prepare(@RequestParam(value = "prescriptionNo") String prescriptionNo,
|
||||
@RequestParam(value = "preparerId") Long preparerId) {
|
||||
return chineseMedicineDispenseService.prepare(prescriptionNo, preparerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核对发药
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
*/
|
||||
@PutMapping("/medicine-dispense")
|
||||
public R<?> medicineDispense(@RequestParam(value = "prescriptionNo") String prescriptionNo) {
|
||||
return chineseMedicineDispenseService.medicineDispense(prescriptionNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @param notPerformedReasonEnum 未发药原因
|
||||
*/
|
||||
@PutMapping("/medicine-cancel")
|
||||
public R<?> medicineCancel(@RequestParam(value = "prescriptionNo") String prescriptionNo,
|
||||
@RequestParam(value = "notPerformedReasonEnum") Integer notPerformedReasonEnum) {
|
||||
return chineseMedicineDispenseService.medicineCancel(prescriptionNo, notPerformedReasonEnum);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.web.pharmacymanage.appservice.IDeviceDispenseAppService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IDeviceDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseDeviceDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PrescriptionDeviceInfoDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 材料发送
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/8/21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/device-dispense")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DeviceDispenseController {
|
||||
|
||||
@Autowired
|
||||
public IDeviceDispenseAppService deviceDispenseService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> deviceDispenseInit() {
|
||||
return deviceDispenseService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询发药病人列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 发药病人列表
|
||||
*/
|
||||
@GetMapping("/encounter-list")
|
||||
public R<?> getEncounterInfoList(EncounterInfoPageDto encounterInfoPageDto, String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return deviceDispenseService.getEncounterInfoListPage(encounterInfoPageDto, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param prescriptionDeviceInfoDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
@GetMapping("/prescription-list")
|
||||
public R<?> getPatientInfoList(PrescriptionDeviceInfoDto prescriptionDeviceInfoDto,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return deviceDispenseService.getPrescriptionInfo(prescriptionDeviceInfoDto, pageNo, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核对发药
|
||||
*
|
||||
* @param dispenseDeviceList 发药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/device-dispense")
|
||||
public R<?> deviceDispense(@RequestBody List<DispenseDeviceDto> dispenseDeviceList) {
|
||||
return deviceDispenseService.deviceDispense(dispenseDeviceList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseDeviceList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/device-cancel")
|
||||
public R<?> deviceCancel(@RequestBody List<DispenseDeviceDto> dispenseDeviceList) {
|
||||
return deviceDispenseService.deviceCancel(dispenseDeviceList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.openhis.web.pharmacymanage.controller;//package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IInpatientMedicineDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseMedicineDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PrescriptionMedicineInfoDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 住院发药
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/6/3
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/inpatient-medicine-dispense")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class InpatientMedicineDispenseController {
|
||||
|
||||
@Resource
|
||||
public IInpatientMedicineDispenseAppService inpatientMedicineDispenseService;
|
||||
|
||||
@Autowired
|
||||
public IWesternMedicineDispenseAppService westernMedicineDispenseService;
|
||||
|
||||
/**
|
||||
* 分页查询发药病人列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 发药病人列表
|
||||
*/
|
||||
@GetMapping("/encounter-list")
|
||||
public R<?> getEncounterInfoList(EncounterInfoPageDto encounterInfoPageDto, String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return inpatientMedicineDispenseService.getEncounterInfoListPage(encounterInfoPageDto, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> medicineDispenseInit() {
|
||||
return westernMedicineDispenseService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param prescriptionMedicineInfoDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
@GetMapping("/prescription-list")
|
||||
public R<?> getPatientInfoList(PrescriptionMedicineInfoDto prescriptionMedicineInfoDto,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return westernMedicineDispenseService.getPrescriptionInfo(prescriptionMedicineInfoDto, pageNo, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配药
|
||||
*
|
||||
* @param dispenseMedicineList 配药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/prepare")
|
||||
public R<?> medicinePrepare(@RequestBody List<DispenseMedicineDto> dispenseMedicineList) {
|
||||
return westernMedicineDispenseService.medicinePrepare(dispenseMedicineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核对发药
|
||||
*
|
||||
* @param dispenseMedicineList 发药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/medicine-dispense")
|
||||
public R<?> medicineDispense(@RequestBody List<DispenseMedicineDto> dispenseMedicineList) {
|
||||
return westernMedicineDispenseService.medicineDispense(dispenseMedicineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseMedicineList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/medicine-cancel")
|
||||
public R<?> medicineCancel(@RequestBody List<DispenseMedicineDto> dispenseMedicineList) {
|
||||
return westernMedicineDispenseService.medicineCancel(dispenseMedicineList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseMedicineDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IInpatientMedicineSummaryDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.InpatientMedicineSearchParam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 住院汇总发药
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025/6/3
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/inpatient-medicine-summary-dispense")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class InpatientMedicineSummaryDispenseController {
|
||||
|
||||
@Resource
|
||||
public IInpatientMedicineSummaryDispenseAppService medicineSummaryDispenseService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> medicineDispenseInit() {
|
||||
return medicineSummaryDispenseService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 住院药品汇总发药单查询
|
||||
*
|
||||
* @param searchParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
*/
|
||||
@GetMapping("/medicationSummary-list")
|
||||
public R<?> getMedicationSummaryInfo(InpatientMedicineSearchParam searchParam, String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return medicineSummaryDispenseService.getMedicationSummaryInfo(searchParam, searchKey, pageNo, pageSize,
|
||||
request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核对发药
|
||||
*
|
||||
* @param searchParam 条件
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/medicine-dispense")
|
||||
public R<?> medicineDispense(@RequestBody List<InpatientMedicineSearchParam> searchParam) {
|
||||
return medicineSummaryDispenseService.medicineDispense(searchParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param deliveryIdList 供应发放id
|
||||
* @param notPerformedReasonEnum 未发原因
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/medicine-cancel")
|
||||
public R<?> medicineCancel(@RequestBody List<Long> deliveryIdList, Integer notPerformedReasonEnum) {
|
||||
return medicineSummaryDispenseService.medicineCancel(deliveryIdList, notPerformedReasonEnum);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
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 com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IMedicalConsumablesDispenseAppService;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 耗材发放
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-06-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/medical-consumables-dispense")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class MedicalConsumablesDispenseController {
|
||||
|
||||
@Resource
|
||||
public IMedicalConsumablesDispenseAppService medicalConsumablesDispenseAppService;
|
||||
|
||||
/**
|
||||
* 发放耗材
|
||||
*
|
||||
* @param chargeItemIds 耗材收费单ids
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/consumables-dispense")
|
||||
public R<?> dispenseMedicalConsumables(@RequestBody List<Long> chargeItemIds) {
|
||||
return medicalConsumablesDispenseAppService.dispenseMedicalConsumables(chargeItemIds);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 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;
|
||||
|
||||
/**
|
||||
* 发药明细
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025/4/14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/medication-details")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class MedicationDetailsController {
|
||||
|
||||
@Autowired
|
||||
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);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 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;
|
||||
|
||||
/**
|
||||
* 待发药明细
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025/4/14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/pending-medication")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class PendingMedicationDetailsController {
|
||||
|
||||
@Autowired
|
||||
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,85 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IReturnMedicineAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.ReturnMedicineDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 退药管理
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025/4/4
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/return-medicine")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class ReturnMedicineController {
|
||||
|
||||
@Autowired
|
||||
public IReturnMedicineAppService returnMedicineAppService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> returnMedicineInit() {
|
||||
return returnMedicineAppService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
@GetMapping(value = "/return-patient-page")
|
||||
public R<?> getReturnMedicinePatientPage(EncounterInfoPageDto encounterInfoPageDto,
|
||||
@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(encounterInfoPageDto, 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,126 @@
|
||||
package com.openhis.web.pharmacymanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseMedicineDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PrescriptionMedicineInfoDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 西药发药
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025/3/14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pharmacy-manage/western-medicine-dispense")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class WesternMedicineDispenseController {
|
||||
|
||||
@Autowired
|
||||
public IWesternMedicineDispenseAppService westernMedicineDispenseService;
|
||||
|
||||
/**
|
||||
* 获取页面初始化信息
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> medicineDispenseInit() {
|
||||
return westernMedicineDispenseService.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询发药病人列表
|
||||
*
|
||||
* @param encounterInfoPageDto 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 发药病人列表
|
||||
*/
|
||||
@GetMapping("/encounter-list")
|
||||
public R<?> getEncounterInfoList(EncounterInfoPageDto encounterInfoPageDto, String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return westernMedicineDispenseService.getEncounterInfoListPage(encounterInfoPageDto, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param prescriptionMedicineInfoDto 查询信息
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
@GetMapping("/prescription-list")
|
||||
public R<?> getPatientInfoList(PrescriptionMedicineInfoDto prescriptionMedicineInfoDto,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return westernMedicineDispenseService.getPrescriptionInfo(prescriptionMedicineInfoDto, pageNo, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配药
|
||||
*
|
||||
* @param dispenseMedicineList 配药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/prepare")
|
||||
public R<?> medicinePrepare(@RequestBody List<DispenseMedicineDto> dispenseMedicineList) {
|
||||
return westernMedicineDispenseService.medicinePrepare(dispenseMedicineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核对发药
|
||||
*
|
||||
* @param dispenseMedicineList 发药信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/medicine-dispense")
|
||||
public R<?> medicineDispense(@RequestBody List<DispenseMedicineDto> dispenseMedicineList) {
|
||||
return westernMedicineDispenseService.medicineDispense(dispenseMedicineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 作废
|
||||
*
|
||||
* @param dispenseMedicineList 作废信息
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PutMapping("/medicine-cancel")
|
||||
public R<?> medicineCancel(@RequestBody List<DispenseMedicineDto> dispenseMedicineList) {
|
||||
return westernMedicineDispenseService.medicineCancel(dispenseMedicineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param locationId 库房id
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 处方单
|
||||
*/
|
||||
@GetMapping("/prescription-list-monthly-settlement")
|
||||
public R<?> getMonthlySettlementPatientInfoList(@RequestParam Long locationId, @RequestParam String startTime,@RequestParam String endTime,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return westernMedicineDispenseService.getMonthlySettlementPatientInfoList(locationId, startTime,endTime,pageNo,pageSize);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 yuxj
|
||||
* @date 2025-08-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DispenseDeviceDto {
|
||||
|
||||
/** 请求ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/** 配药人 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long preparerId;
|
||||
|
||||
/** 发放ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/** 追溯码 */
|
||||
private String traceNo;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 未发原因 */
|
||||
private Integer notPerformedReasonEnum;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.enums.DispenseStatus;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
|
||||
@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 DispenseStatusOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public DispenseStatusOption(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 药品发放和库存表连接信息
|
||||
*
|
||||
* @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 patientId;
|
||||
|
||||
/** 请求单位编码 */
|
||||
private String dispenseUnitCode;
|
||||
|
||||
/** 请求数量 */
|
||||
private Integer 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,42 @@
|
||||
/*
|
||||
* 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-23
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DispenseMedicineDto {
|
||||
|
||||
/** 请求ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/** 配药人 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long preparerId;
|
||||
|
||||
/** 发放ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/** 追溯码 */
|
||||
private String traceNo;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 未发原因 */
|
||||
private Integer notPerformedReasonEnum;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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 EncounterInfoPageDto {
|
||||
|
||||
/** 就诊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 age;
|
||||
|
||||
/** 生日 */
|
||||
private Date birthDate;
|
||||
|
||||
/** 中药标识 */
|
||||
private Integer tcmFlag;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 处方列表查询条件
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025-03-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class EncounterInfoSearchParam implements Serializable {
|
||||
|
||||
/** 执行状态 */
|
||||
private Integer statusEnum;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
*住院发药初期dto
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-06-03
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InpatientMedicineInitDto {
|
||||
|
||||
/** 科室列表 */
|
||||
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 java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 映射信息
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-06-03
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InpatientMedicineMapInfoDto implements Serializable {
|
||||
|
||||
/** 项目发放 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/** 追溯码*/
|
||||
private String traceNo;
|
||||
|
||||
/** 追溯码单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String traceNoUnitCode;
|
||||
private String traceNoUnitCode_dictText;
|
||||
|
||||
/** 供应发放id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long deliveryId;
|
||||
|
||||
/** 发放表名 */
|
||||
private String tableName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 患者列表查询条件
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-06-03
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InpatientMedicineSearchParam implements Serializable {
|
||||
|
||||
/** 科室 */
|
||||
@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,126 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import com.openhis.web.pharmacyWarehousemanage.dto.PharmacyWarehouseDetailDto;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 医嘱详细
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-06-03
|
||||
*/
|
||||
@Data @Accessors(chain = true) public class InpatientMedicineSummaryPrescriptionInfoDto {
|
||||
|
||||
/**
|
||||
* 单据号
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/** 供应请求id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/** 供应发放id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long deliveryId;
|
||||
|
||||
/**
|
||||
* 项目表
|
||||
*/
|
||||
private String itemTable;
|
||||
/**
|
||||
* 项目名
|
||||
*/
|
||||
private String itemName;
|
||||
|
||||
/** 项目id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private String totalVolume;
|
||||
|
||||
/**
|
||||
* 批号
|
||||
*/
|
||||
private String lotNumber;
|
||||
|
||||
/**
|
||||
* 请求数
|
||||
*/
|
||||
private BigDecimal quantity;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@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;
|
||||
private String sourceLocationName;
|
||||
|
||||
/** 申请科室 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgId;
|
||||
private String orgName;
|
||||
|
||||
/** 领药人 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long applicantId;
|
||||
private String applicantName;
|
||||
|
||||
/** 申请时间 */
|
||||
private Data applyTime;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 患者信息 */
|
||||
private String patientInfo;
|
||||
/**
|
||||
* 单位列表
|
||||
*/
|
||||
private List<InpatientMedicineSummaryPrescriptionInfoDto.Option> unitList;
|
||||
|
||||
@Data
|
||||
public static class Option {
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String value;
|
||||
private String value_dictText;
|
||||
public Option(String value, String value_dictText) {
|
||||
this.value = value;
|
||||
this.value_dictText = value_dictText;
|
||||
}
|
||||
public Option() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 库存信息
|
||||
*
|
||||
* @author yangmo
|
||||
* @date 2025-04-08
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InventoryDto implements Serializable {
|
||||
|
||||
/** 库存ID */
|
||||
private Long inventoryId;
|
||||
|
||||
/** 发药ID */
|
||||
private Long dispenseId;
|
||||
|
||||
/** 项目ID */
|
||||
private Long itemId;
|
||||
|
||||
/** 拆零单位 */
|
||||
private String inventoryUnitCode;
|
||||
|
||||
/** 发放单位 */
|
||||
private String dispenseUnit;
|
||||
|
||||
/** 当前库存数量(拆零单位) */
|
||||
private BigDecimal inventoryQuantity;
|
||||
|
||||
/** 已发数量 */
|
||||
private BigDecimal dispenseQuantity;
|
||||
|
||||
/** 发药数量 */
|
||||
private BigDecimal quantity;
|
||||
|
||||
/** 拆零比 */
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 药品名称 */
|
||||
private String itemName;
|
||||
|
||||
/** 库存状态 */
|
||||
private Integer inventoryStatusEnum;
|
||||
|
||||
/** 有效期至 */
|
||||
private Date expirationDate;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
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 yuanzs
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedDetailedAccountPageDto {
|
||||
|
||||
/** 门诊号 */
|
||||
private String outpatientNo;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 患者 */
|
||||
private String patientName;
|
||||
|
||||
/** 发药人 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private String practitionerId;
|
||||
|
||||
/** 发药人名称 */
|
||||
private String practitionerName;
|
||||
|
||||
/** 药品项目 */
|
||||
private String medicationName;
|
||||
|
||||
/** 药品拼音 */
|
||||
private String pyStr;
|
||||
|
||||
/** 项目编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 发药编码 */
|
||||
private String dispenseNo;
|
||||
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 规格 */
|
||||
private String totalVolume;
|
||||
|
||||
/** 发药数量 */
|
||||
private Integer dispenseQuantity;
|
||||
|
||||
/** 发药金额 */
|
||||
private BigDecimal dispensePrice;
|
||||
|
||||
/** 退药数量 */
|
||||
private Integer refundQuantity;
|
||||
|
||||
/** 退药金额 */
|
||||
private BigDecimal refundPrice;
|
||||
|
||||
/** 批号 */
|
||||
private String lotNumber;
|
||||
|
||||
/** 厂商 */
|
||||
private String manufacturerText;
|
||||
|
||||
/** 供应商 */
|
||||
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;
|
||||
|
||||
/** 发药时间 */
|
||||
private Date dispenseTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentInitDto;
|
||||
import com.openhis.web.datadictionary.dto.SupplierInitDto;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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,41 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 发药明细查询条件
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedDetailsSearchParam {
|
||||
|
||||
/** 发药时间 */
|
||||
private Date dispenseTime;
|
||||
|
||||
/** 药房 */
|
||||
private Long locationId;
|
||||
|
||||
/** 患者姓名 */
|
||||
@Length(max = 2000)
|
||||
private String patientName;
|
||||
|
||||
/** 发药人 */
|
||||
private Long practitionerId;
|
||||
|
||||
/** 药品名称 */
|
||||
private String medicationName;
|
||||
|
||||
/** 药品项目(药品编码) */
|
||||
private String busNo;
|
||||
|
||||
/** 出院状态 */
|
||||
private Integer dischargeStatus;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
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 org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 明细流水账分页列表 dto
|
||||
*
|
||||
* @author yuanzs
|
||||
* @date 2025-04-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MedRunningAccountPageDto {
|
||||
|
||||
/** 门诊号 */
|
||||
private String outpatientNo;
|
||||
|
||||
/** 住院号 */
|
||||
private Integer admissionNo;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 患者 */
|
||||
private String patientName;
|
||||
|
||||
/** 发药人 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_practitioner")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
private String practitionerId_dictText;
|
||||
|
||||
/** 药品项目 */
|
||||
private String medicineName;
|
||||
|
||||
/** 规格 */
|
||||
private String totalVolume;
|
||||
|
||||
/** 零售价 */
|
||||
private BigDecimal retailPrice;
|
||||
|
||||
/** 发药数量 */
|
||||
private Integer dispenseQuantity;
|
||||
|
||||
/** 发药金额 */
|
||||
private BigDecimal dispensePrice;
|
||||
|
||||
/** 退药数量 */
|
||||
private Integer returnQuantity;
|
||||
|
||||
/** 退药金额 */
|
||||
private BigDecimal returnPrice;
|
||||
|
||||
/** 批号 */
|
||||
private String lotNumber;
|
||||
|
||||
/** 发药时间 */
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JSONField(name="dispense_time")
|
||||
private Date dispenseTime;
|
||||
|
||||
/** 厂商 */
|
||||
private String manufacturerText;
|
||||
|
||||
/** 供应商 */
|
||||
@Dict(dictCode = "id", dictText = "name", dictTable = "adm_supplier")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long supplyId;
|
||||
private String supplyId_dictText;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
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,36 @@
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
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,230 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 处方发材料单
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-08-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PrescriptionDeviceInfoDto {
|
||||
|
||||
/**
|
||||
* 科室
|
||||
*/
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 开单医生
|
||||
*/
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
@Dict(dictCode = "med_category_code")
|
||||
private String itemType;
|
||||
private String itemType_dictText;
|
||||
|
||||
/**
|
||||
* 诊断名称
|
||||
*/
|
||||
private String conditionName;
|
||||
|
||||
/**
|
||||
* 处方号
|
||||
*/
|
||||
private String prescriptionNo;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String lotNumber;
|
||||
|
||||
/**
|
||||
* 请求id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
/**
|
||||
* 材料id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long deviceId;
|
||||
|
||||
/**
|
||||
* 材料名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private String totalVolume;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/**
|
||||
* 就诊id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
/**
|
||||
* 发药状态
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
/**
|
||||
* 用药频次
|
||||
*/
|
||||
private String rateCode;
|
||||
/**
|
||||
* 发放药房
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 发放id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/**
|
||||
* 发放药房
|
||||
*/
|
||||
private String locationName;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/**
|
||||
* 发药医生
|
||||
*/
|
||||
private String dispenseDoctorName;
|
||||
/**
|
||||
* 就诊NO
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private String encounterBusNo;
|
||||
/** 开具日期 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date reqAuthoredTime;
|
||||
|
||||
/**
|
||||
* 就诊账户类型
|
||||
*/
|
||||
private String chargeType;
|
||||
|
||||
/** 特殊病种标志 */
|
||||
private String medTypeCode;
|
||||
|
||||
/** 慢性病 是/否 */
|
||||
private String chronicDisease;
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 配药医生
|
||||
// */
|
||||
// private String preparerDoctorName;
|
||||
//
|
||||
// /**
|
||||
// * 单次剂量
|
||||
// */
|
||||
// private BigDecimal dose;
|
||||
//
|
||||
// /**
|
||||
// * 用法
|
||||
// */
|
||||
// @Dict(dictCode = "method_code")
|
||||
// private String methodCode;
|
||||
// private String methodCode_dictText;
|
||||
//
|
||||
// /**
|
||||
// * 剂量单位
|
||||
// */
|
||||
// @Dict(dictCode = "unit_code")
|
||||
// private String doseUnitCode;
|
||||
// private String doseUnitCode_dictText;
|
||||
//
|
||||
// /**
|
||||
// * 单次最大剂量
|
||||
// */
|
||||
// private BigDecimal maxDose;
|
||||
//
|
||||
// /**
|
||||
// * 首次用量
|
||||
// */
|
||||
// private BigDecimal firstDose;
|
||||
//
|
||||
// /**
|
||||
// * 首次持续时间
|
||||
// */
|
||||
// private String firstDuration;
|
||||
//
|
||||
// /**
|
||||
// * 给药间隔
|
||||
// */
|
||||
// private String dispenseInterval;
|
||||
//
|
||||
// /**
|
||||
// * 单次发药数
|
||||
// */
|
||||
// private Integer dispensePerQuantity;
|
||||
//
|
||||
// /**
|
||||
// * 每次发药供应天数
|
||||
// */
|
||||
// private Integer dispensePerDuration;
|
||||
//
|
||||
// /**
|
||||
// * 组合号
|
||||
// */
|
||||
// @JsonSerialize(using = ToStringSerializer.class)
|
||||
// private Long groupId;
|
||||
//
|
||||
// /** 药品性质 */
|
||||
// private String pharmacologyCategoryCode;
|
||||
//
|
||||
// /** 药品性质文本 */
|
||||
// private String pharmacologyCategoryCode_Text;
|
||||
//
|
||||
//
|
||||
// /** 皮试标志 */
|
||||
// private Integer skinTestFlag;
|
||||
//
|
||||
// /** 皮试结果 */
|
||||
// private String psResult;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 处方信息
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025-03-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PrescriptionInfoDto {
|
||||
|
||||
/** 患者基本信息 */
|
||||
private PrescriptionPatientInfoDto prescriptionPatientInfoDto;
|
||||
|
||||
/** 处方药品信息 */
|
||||
private List<PrescriptionMedicineInfoDto> prescriptionMedicineInfoDtoList;
|
||||
|
||||
/** 处方材料信息 */
|
||||
private List<PrescriptionDeviceInfoDto> prescriptionDeviceInfoDtoList;
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
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.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 处方发药单
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025-03-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PrescriptionMedicineInfoDto {
|
||||
|
||||
/**
|
||||
* 发放药房
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 药品id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long medicineId;
|
||||
|
||||
/**
|
||||
* 发放id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/**
|
||||
* 请求id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/**
|
||||
* 就诊id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 发放药房
|
||||
*/
|
||||
private String locationName;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String lotNumber;
|
||||
|
||||
/**
|
||||
* 科室
|
||||
*/
|
||||
private String departmentName;
|
||||
|
||||
/**
|
||||
* 开单医生
|
||||
*/
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 发药医生
|
||||
*/
|
||||
private String dispenseDoctorName;
|
||||
|
||||
/**
|
||||
* 配药医生
|
||||
*/
|
||||
private String preparerDoctorName;
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
@Dict(dictCode = "med_category_code")
|
||||
private String itemType;
|
||||
private String itemType_dictText;
|
||||
|
||||
/**
|
||||
* 发药状态
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/**
|
||||
* 诊断名称
|
||||
*/
|
||||
private String conditionName;
|
||||
|
||||
/**
|
||||
* 处方号
|
||||
*/
|
||||
private String prescriptionNo;
|
||||
|
||||
/**
|
||||
* 药品名称
|
||||
*/
|
||||
private String medicineName;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private String totalVolume;
|
||||
|
||||
/**
|
||||
* 单次剂量
|
||||
*/
|
||||
private BigDecimal dose;
|
||||
|
||||
/**
|
||||
* 用药频次
|
||||
*/
|
||||
@Dict(dictCode = "rate_code")
|
||||
private String rateCode;
|
||||
private String rateCode_dictText;
|
||||
|
||||
/**
|
||||
* 用法
|
||||
*/
|
||||
@Dict(dictCode = "method_code")
|
||||
private String methodCode;
|
||||
private String methodCode_dictText;
|
||||
|
||||
/**
|
||||
* 剂量单位
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String doseUnitCode;
|
||||
private String doseUnitCode_dictText;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/**
|
||||
* 单次最大剂量
|
||||
*/
|
||||
private BigDecimal maxDose;
|
||||
|
||||
/**
|
||||
* 首次用量
|
||||
*/
|
||||
private BigDecimal firstDose;
|
||||
|
||||
/**
|
||||
* 首次持续时间
|
||||
*/
|
||||
private String firstDuration;
|
||||
|
||||
/**
|
||||
* 给药间隔
|
||||
*/
|
||||
private String dispenseInterval;
|
||||
|
||||
/**
|
||||
* 单次发药数
|
||||
*/
|
||||
private Integer dispensePerQuantity;
|
||||
|
||||
/**
|
||||
* 每次发药供应天数
|
||||
*/
|
||||
private Integer dispensePerDuration;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
private BigDecimal totalPrice;
|
||||
/**
|
||||
* 组合号
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 就诊NO
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private String encounterBusNo;
|
||||
|
||||
/** 开具日期 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date reqAuthoredTime;
|
||||
|
||||
/**
|
||||
* 就诊账户类型
|
||||
*/
|
||||
private String chargeType;
|
||||
|
||||
/** 药品性质 */
|
||||
private String pharmacologyCategoryCode;
|
||||
|
||||
/** 药品性质文本 */
|
||||
private String pharmacologyCategoryCode_Text;
|
||||
|
||||
/** 特殊病种标志 */
|
||||
private String medTypeCode;
|
||||
|
||||
/** 慢性病 是/否 */
|
||||
private String chronicDisease;
|
||||
|
||||
/** 皮试标志 */
|
||||
private Integer skinTestFlag;
|
||||
|
||||
/** 中药标识 */
|
||||
private Integer tcmFlag;
|
||||
|
||||
/** 皮试结果 */
|
||||
private String psResult;
|
||||
|
||||
/** 药品类型 */
|
||||
private Integer type;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 患者基本信息
|
||||
*
|
||||
* @author wangyang
|
||||
* @date 2025-03-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PrescriptionPatientInfoDto {
|
||||
|
||||
/** 姓名 */
|
||||
private String patientName;
|
||||
|
||||
/** 性别 */
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/** 生日 */
|
||||
private Date birthDate;
|
||||
|
||||
/** 年龄 */
|
||||
private String age;
|
||||
|
||||
/** 合同类型 */
|
||||
private Integer categoryEnum;
|
||||
private String categoryEnum_enumText;
|
||||
private String contractName;
|
||||
|
||||
/** 证件号 */
|
||||
private String idCard;
|
||||
|
||||
/** 就诊科室 */
|
||||
private String organizationName;
|
||||
|
||||
/** 就诊日期 */
|
||||
private String encounterDate;
|
||||
|
||||
/** 总金额 */
|
||||
private double totalPrice;
|
||||
|
||||
/** 电话 */
|
||||
private String phone;
|
||||
|
||||
/** 医院名字 */
|
||||
private String hospitalName;
|
||||
|
||||
/** 患者院内编码/病历号 */
|
||||
private String patientBusNo;
|
||||
|
||||
/**
|
||||
* 就诊id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 诊断
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long conditionId;
|
||||
private String conditionName;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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,78 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 退药信息
|
||||
*
|
||||
* @author 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,61 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import com.openhis.web.inventorymanage.dto.PurchaseInventoryInitDto;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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,53 @@
|
||||
/*
|
||||
* 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.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ChineseMedicineDispenseMapper {
|
||||
|
||||
/**
|
||||
* 就诊病人列表分页查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 就诊病人列表
|
||||
*/
|
||||
Page<EncounterInfoPageDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoSearchParam> queryWrapper);
|
||||
|
||||
/**
|
||||
* 患者基本信息查询
|
||||
*
|
||||
* @param encounterId 就诊号
|
||||
* @return 患者基本信息
|
||||
*/
|
||||
PrescriptionPatientInfoDto selectPrescriptionPatientInfo(@Param("encounterId") Long encounterId);
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param encounterId 就诊号
|
||||
* @return 处方单列表
|
||||
*/
|
||||
List<PrescriptionMedicineInfoDto> selectPrescriptionMedicineInfoList(@Param("encounterId") Long encounterId);
|
||||
|
||||
/**
|
||||
* 待发药和库存信息查询
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @return 待发药信息
|
||||
*/
|
||||
List<DispenseInventoryDto> selectDispenseInventoryInfoByPrescriptionNo(
|
||||
@Param("prescriptionNo") String prescriptionNo,
|
||||
@Param("medMedicationDefinition") String medMedicationDefinition);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.administration.domain.Practitioner;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PrescriptionDeviceInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PrescriptionPatientInfoDto;
|
||||
|
||||
@Repository
|
||||
public interface IDeviceDispenseMapper {
|
||||
|
||||
/**
|
||||
* 就诊病人列表分页查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param statusEnum 发药状态
|
||||
* @param inProgress 发药状态:待发药
|
||||
* @param completed 发药状态:已发药
|
||||
* @param preparation 发药状态:待配药
|
||||
* @param prepared 发药状态:已配药
|
||||
* @param amb 就诊类型:门诊
|
||||
* @return 就诊病人列表
|
||||
*/
|
||||
Page<EncounterInfoPageDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoPageDto> queryWrapper,
|
||||
@Param("statusEnum") Integer statusEnum, @Param("inProgress") Integer inProgress,
|
||||
@Param("completed") Integer completed, @Param("preparation") Integer preparation,
|
||||
@Param("prepared") Integer prepared, @Param("amb") Integer amb);
|
||||
|
||||
/**
|
||||
* 患者基本信息查询
|
||||
*
|
||||
* @param encounterId 就诊号
|
||||
* @return 患者基本信息
|
||||
*/
|
||||
PrescriptionPatientInfoDto selectPrescriptionPatientInfo(@Param("encounterId") Long encounterId,
|
||||
@Param("hospitalId") Long hospitalId);
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param inProgress 发药状态:待发药
|
||||
* @param completed 发药状态:已发药
|
||||
* @param preparation 发药状态:待配药
|
||||
* @param prepared 发药状态:已配药
|
||||
* @param dispenseStatus 发药状态
|
||||
* @return 处方单列表
|
||||
*/
|
||||
Page<PrescriptionDeviceInfoDto> selectPrescriptionDeviceInfoList(
|
||||
@Param("page") Page<PrescriptionDeviceInfoDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<PrescriptionDeviceInfoDto> 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,10 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface InpatientMedicineDispenseMapper {
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.openhis.web.inhospitalnursestation.dto.InpatientMedicinePrescriptionInfoDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import com.openhis.web.pharmacymanage.dto.*;
|
||||
|
||||
@Repository
|
||||
public interface InpatientMedicineSummaryDispenseMapper {
|
||||
|
||||
/**
|
||||
* 医嘱列表查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param medicationDefinition 药品定义
|
||||
* @param deviceDefinition 耗材定义
|
||||
* @return 医嘱信息
|
||||
*/
|
||||
Page<InpatientMedicineSummaryPrescriptionInfoDto> selectMedicationSummaryInfo(
|
||||
@Param("page") Page<InpatientMedicinePrescriptionInfoDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<InpatientMedicineSearchParam> queryWrapper,
|
||||
@Param("medicationDefinition") String medicationDefinition,
|
||||
@Param("deviceDefinition") String deviceDefinition, @Param("typeEnum") Integer typeEnum,@Param("categoryEnum") Integer categoryEnum
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface MedicalConsumablesDispenseAppMapper {
|
||||
|
||||
/**
|
||||
* 就诊病人列表分页查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 就诊病人列表
|
||||
*/
|
||||
Page<EncounterInfoPageDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoSearchParam> queryWrapper);
|
||||
|
||||
/**
|
||||
* 患者基本信息查询
|
||||
*
|
||||
* @param encounterId 就诊号
|
||||
* @return 患者基本信息
|
||||
*/
|
||||
PrescriptionPatientInfoDto selectPrescriptionPatientInfo(@Param("encounterId") Long encounterId);
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param encounterId 就诊号
|
||||
* @return 处方单列表
|
||||
*/
|
||||
List<PrescriptionMedicineInfoDto> selectPrescriptionConsumablesInfoList(@Param("encounterId") Long encounterId);
|
||||
|
||||
/**
|
||||
* 待发药和库存信息查询
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @return 待发药信息
|
||||
*/
|
||||
List<DispenseInventoryDto> selectDispenseInventoryInfoByPrescriptionNo(
|
||||
@Param("prescriptionNo") String prescriptionNo,
|
||||
@Param("medMedicationDefinition") String medMedicationDefinition);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.pharmacymanage.dto.MedDetailedAccountPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.MedDetailsSearchParam;
|
||||
import com.openhis.web.pharmacymanage.dto.MedRunningAccountPageDto;
|
||||
|
||||
@Repository
|
||||
public interface MedicationDetailsMapper {
|
||||
|
||||
/**
|
||||
* 门诊人员发药明细表/门诊发药明细流水账
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param amb 发药类型:门诊
|
||||
* @param completed 发药状态:已发药
|
||||
* @param refunded 发药状态:已退药
|
||||
* @param dispenseEnum 统计类型
|
||||
* @return 门诊人员发药明细表
|
||||
*/
|
||||
Page<MedDetailedAccountPageDto> selectAmbPractitionerDetailPage(@Param("page") Page<MedDetailedAccountPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<MedDetailsSearchParam> queryWrapper, @Param("amb") Integer amb,
|
||||
@Param("completed") Integer completed, @Param("refunded") Integer refunded,
|
||||
@Param("dispenseEnum") Integer dispenseEnum);
|
||||
|
||||
// /**
|
||||
// * 门诊发药明细流水账
|
||||
// *
|
||||
// * @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,31 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.pharmacymanage.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.pharmacymanage.dto.PendingMedicationPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PendingMedicationSearchParam;
|
||||
|
||||
@Repository
|
||||
public interface PendingMedicationDetailsMapper {
|
||||
|
||||
/**
|
||||
* 分页查询待发药明细
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param inProgress 发药类型:待发药
|
||||
* @return 待发药明细
|
||||
*/
|
||||
Page<PendingMedicationPageDto> selectPendingMedicationDetailsPage(
|
||||
@Param("page") Page<PendingMedicationPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<PendingMedicationSearchParam> queryWrapper,
|
||||
@Param("inProgress") Integer inProgress, @Param("amb") Integer amb, @Param("imp") Integer imp);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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.*;
|
||||
|
||||
@Repository
|
||||
public interface ReturnMedicineMapper {
|
||||
|
||||
/**
|
||||
* 查询退药患者分页列表
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param amb 就诊类型:门诊
|
||||
* @return 退药患者分页列表
|
||||
*/
|
||||
Page<EncounterInfoPageDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoPageDto> queryWrapper, @Param("amb") Integer amb);
|
||||
|
||||
/**
|
||||
* 申请退药清单查询
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @param medMedicationRequest 药品请求表
|
||||
* @param worDeviceRequest 耗材请求表
|
||||
* @param medicine 项目类型:药品
|
||||
* @param device 项目类型:耗材
|
||||
* @param refundStatus 退药状态
|
||||
* @param inRefund 退药状态:待退药
|
||||
* @param completed 退药状态:已完成
|
||||
* @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("inRefund") Integer inRefund,
|
||||
@Param("completed") Integer completed);
|
||||
|
||||
/**
|
||||
* 患者基本信息查询
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @return 患者基本信息
|
||||
*/
|
||||
PrescriptionPatientInfoDto selectPrescriptionPatientInfo(@Param("encounterId") Long encounterId);
|
||||
|
||||
/**
|
||||
* 库存信息查询
|
||||
*
|
||||
* @param devDispenseIdList 耗材发放ID列表
|
||||
* @param medDispenseIdList 药品发放ID列表
|
||||
* @param medMedicationDefinition 药品定义表
|
||||
* @param admDeviceDefinition 耗材定义表
|
||||
* @return 待发药信息
|
||||
*/
|
||||
List<InventoryDto> 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,105 @@
|
||||
/*
|
||||
* 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.administration.domain.Practitioner;
|
||||
import com.openhis.web.pharmacymanage.dto.DispenseInventoryDto;
|
||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoPageDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PrescriptionMedicineInfoDto;
|
||||
import com.openhis.web.pharmacymanage.dto.PrescriptionPatientInfoDto;
|
||||
|
||||
@Repository
|
||||
public interface WesternMedicineDispenseMapper {
|
||||
|
||||
/**
|
||||
* 就诊病人列表分页查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param statusEnum 发药状态
|
||||
* @param inProgress 发药状态:待发药
|
||||
* @param completed 发药状态:已发药
|
||||
* @param preparation 发药状态:待配药
|
||||
* @param prepared 发药状态:已配药
|
||||
* @param amb 就诊类型:门诊
|
||||
* @return 就诊病人列表
|
||||
*/
|
||||
Page<EncounterInfoPageDto> selectEncounterInfoListPage(@Param("page") Page<EncounterInfoPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterInfoPageDto> queryWrapper,
|
||||
@Param("statusEnum") Integer statusEnum, @Param("inProgress") Integer inProgress,
|
||||
@Param("completed") Integer completed, @Param("preparation") Integer preparation,
|
||||
@Param("prepared") Integer prepared, @Param("amb") Integer amb);
|
||||
|
||||
/**
|
||||
* 患者基本信息查询
|
||||
*
|
||||
* @param encounterId 就诊号
|
||||
* @return 患者基本信息
|
||||
*/
|
||||
PrescriptionPatientInfoDto selectPrescriptionPatientInfo(@Param("encounterId") Long encounterId,
|
||||
@Param("hospitalId") Long hospitalId);
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 查询条件
|
||||
* @param inProgress 发药状态:待发药
|
||||
* @param completed 发药状态:已发药
|
||||
* @param preparation 发药状态:待配药
|
||||
* @param prepared 发药状态:已配药
|
||||
* @param dispenseStatus 发药状态
|
||||
* @return 处方单列表
|
||||
*/
|
||||
Page<PrescriptionMedicineInfoDto> selectPrescriptionMedicineInfoList(
|
||||
@Param("page") Page<PrescriptionMedicineInfoDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<PrescriptionMedicineInfoDto> queryWrapper,
|
||||
@Param("inProgress") Integer inProgress, @Param("completed") Integer completed,
|
||||
@Param("preparation") Integer preparation, @Param("prepared") Integer prepared,
|
||||
@Param("dispenseStatus") Integer dispenseStatus);
|
||||
|
||||
/**
|
||||
* 待发药和库存信息查询
|
||||
*
|
||||
* @param prescriptionNo 处方号
|
||||
* @return 待发药信息
|
||||
*/
|
||||
List<DispenseInventoryDto> selectDispenseInventoryInfoByPrescriptionNo(
|
||||
@Param("prescriptionNo") String prescriptionNo,
|
||||
@Param("medMedicationDefinition") String medMedicationDefinition);
|
||||
|
||||
/**
|
||||
* 获取配药人下拉选列表
|
||||
*
|
||||
* @param pharmacist 参与者类型:药师
|
||||
* @return 配药人下拉选列表
|
||||
*/
|
||||
List<Practitioner> getPreparerDoctorList(@Param("pharmacist") String pharmacist);
|
||||
|
||||
/**
|
||||
* 处方单查询
|
||||
*
|
||||
* @param page 分页
|
||||
* @param locationId 库房id
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param completed 发药状态:已发药
|
||||
* @param medicine 药品
|
||||
* @param device 耗材
|
||||
* @return 处方单列表
|
||||
*/
|
||||
Page<PrescriptionMedicineInfoDto> selectMonthlySettlementPatientInfoList(
|
||||
@Param("page") Page<PrescriptionMedicineInfoDto> page,
|
||||
@Param("locationId") Long locationId, @Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime, @Param("completed") Integer completed,
|
||||
@Param("medicine") Integer medicine, @Param("device") Integer device);
|
||||
}
|
||||
Reference in New Issue
Block a user