Fix Bug #550: AI修复
This commit is contained in:
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.web.common.dto.InventoryItemParam;
|
||||
import com.openhis.web.common.dto.LocationDto;
|
||||
import com.openhis.web.common.dto.SearchTraceNoParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app常用接口
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
public interface ICommonService {
|
||||
|
||||
/**
|
||||
* 药房列表
|
||||
*
|
||||
* @return 药房列表
|
||||
*/
|
||||
List<LocationDto> getPharmacyList();
|
||||
|
||||
/**
|
||||
* 药房列表(库房用)
|
||||
*
|
||||
* @return 药房列表1
|
||||
*/
|
||||
List<LocationDto> getInventoryPharmacyList();
|
||||
|
||||
/**
|
||||
* 药库列表
|
||||
*
|
||||
* @return 药库列表
|
||||
*/
|
||||
List<LocationDto> getCabinetList();
|
||||
|
||||
/**
|
||||
* 仓库列表
|
||||
*
|
||||
* @return 仓库列表
|
||||
*/
|
||||
List<LocationDto> getWarehouseList();
|
||||
|
||||
/**
|
||||
* 药库列表(库房用)
|
||||
*
|
||||
* @return 药库列表
|
||||
*/
|
||||
List<LocationDto> getInventoryCabinetList();
|
||||
|
||||
/**
|
||||
* 药房药库列表
|
||||
*
|
||||
* @return 药房药库列表
|
||||
*/
|
||||
List<LocationDto> getPharmacyCabinetList();
|
||||
|
||||
/**
|
||||
* 获取病区列表
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 病区列表
|
||||
*/
|
||||
List<LocationDto> getWardList(Long orgId);
|
||||
|
||||
/**
|
||||
* 库存项目下拉列表(药库业务使用)
|
||||
*
|
||||
* @param inventoryItemParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 库存项目信息
|
||||
*/
|
||||
R<?> getInventoryItemList(InventoryItemParam inventoryItemParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize);
|
||||
|
||||
/**
|
||||
* 根据项目相关信息查询项目库存相关信息
|
||||
*
|
||||
* @param inventoryItemParam 项目id
|
||||
* @return 项目库存相关信息
|
||||
*/
|
||||
R<?> getInventoryItemInfo(InventoryItemParam inventoryItemParam);
|
||||
|
||||
/**
|
||||
* 科室列表
|
||||
*
|
||||
* @return 科室列表
|
||||
*/
|
||||
R<?> getDepartmentList();
|
||||
|
||||
/**
|
||||
* 科室列表
|
||||
*
|
||||
* @return 科室列表
|
||||
*/
|
||||
List<Organization> departmentList();
|
||||
|
||||
/**
|
||||
* 根据追溯码获取药品/耗材信息
|
||||
*
|
||||
* @param traceNoList 追溯码列表
|
||||
* @return 项目信息
|
||||
*/
|
||||
R<?> getItemInfoByTraceNo(List<String> traceNoList);
|
||||
|
||||
/**
|
||||
* 追溯码查询
|
||||
*
|
||||
* @param searchTraceNoParam 查询条件
|
||||
* @return 项目信息
|
||||
*/
|
||||
R<?> searchTraceNo(SearchTraceNoParam searchTraceNoParam);
|
||||
|
||||
/**
|
||||
* 查询费用性质
|
||||
*
|
||||
* @return 费用性质
|
||||
*/
|
||||
R<?> getContractMetadata();
|
||||
|
||||
/**
|
||||
* 根据科室查询护士
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 护士列表
|
||||
*/
|
||||
R<?> getNurseListByOrg(Long orgId);
|
||||
|
||||
/**
|
||||
* 根据父级位置id查询他所有的子集
|
||||
*
|
||||
* @param locationId 位置id
|
||||
* @param locationForm 位置类型
|
||||
* @return 位置列表
|
||||
*/
|
||||
List<LocationDto> getChildLocation(Long locationId, Integer locationForm);
|
||||
|
||||
/**
|
||||
* 查询登录者管理的病区
|
||||
*
|
||||
* @return 病区列表
|
||||
*/
|
||||
List<LocationDto> getPractitionerWard();
|
||||
|
||||
/**
|
||||
* 查询参与者下拉列表
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @return 参与者下拉列表
|
||||
*/
|
||||
R<?> getPractitionerList(String searchKey);
|
||||
|
||||
/**
|
||||
* 查询医嘱打印信息
|
||||
*
|
||||
* @param requestIds 请求ids
|
||||
* @param isPrescription 是否为处方
|
||||
* @return 医嘱打印单
|
||||
*/
|
||||
R<?> getAdvicePrintInfo(List<Long> requestIds, String isPrescription);
|
||||
|
||||
/**
|
||||
* 查询参与者签名
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
* @return 参与者签名
|
||||
*/
|
||||
R<?> getPractitionerSignature(Long practitionerId);
|
||||
|
||||
/**
|
||||
* 查询所有供应商
|
||||
*
|
||||
* @return 供应商
|
||||
*/
|
||||
R<?> getSupplierList();
|
||||
|
||||
/**
|
||||
* 查询所有诊疗项目
|
||||
*
|
||||
* @return 诊疗项目
|
||||
*/
|
||||
R<?> getActivityDefinition();
|
||||
|
||||
/**
|
||||
* 查询备份单号
|
||||
*
|
||||
* @return 备份单号列表
|
||||
*/
|
||||
R<?> getBackupNoList();
|
||||
|
||||
/**
|
||||
* 批号匹配
|
||||
*
|
||||
* @param encounterIdList 就诊id列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
R<?> lotNumberMatch(List<Long> encounterIdList);
|
||||
|
||||
/**
|
||||
* 根据机构ID获取机构名称
|
||||
*
|
||||
* @param orgId 机构ID
|
||||
* @return 机构名称
|
||||
*/
|
||||
String getOrgNameById(Long orgId);
|
||||
}
|
||||
@@ -1,937 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.appservice.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.domain.Supplier;
|
||||
import com.openhis.administration.domain.TraceNoManage;
|
||||
import com.openhis.administration.mapper.TraceNoManageMapper;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.administration.service.IPractitionerRoleService;
|
||||
import com.openhis.administration.service.ISupplierService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.document.domain.DocInventoryItemStatic;
|
||||
import com.openhis.document.service.IDocInventoryItemStaticService;
|
||||
import com.openhis.financial.domain.Contract;
|
||||
import com.openhis.financial.mapper.ContractMapper;
|
||||
import com.openhis.medication.domain.MedicationDispense;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.web.chargemanage.dto.ContractMetadata;
|
||||
import com.openhis.web.common.appservice.ICommonService;
|
||||
import com.openhis.web.common.dto.*;
|
||||
import com.openhis.web.common.mapper.CommonAppMapper;
|
||||
import com.openhis.web.pharmacymanage.dto.InventoryDetailDto;
|
||||
import com.openhis.workflow.domain.DeviceDispense;
|
||||
import com.openhis.workflow.domain.InventoryItem;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IInventoryItemService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* app常用接口
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Service
|
||||
public class CommonServiceImpl implements ICommonService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Resource
|
||||
private TraceNoManageMapper traceNoManageMapper;
|
||||
|
||||
@Resource
|
||||
private CommonAppMapper commonAppMapper;
|
||||
|
||||
@Resource
|
||||
private ILocationService locationService;
|
||||
|
||||
@Resource
|
||||
private IPractitionerRoleService practitionerRoleService;
|
||||
|
||||
@Resource
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Resource
|
||||
private IInventoryItemService inventoryItemService;
|
||||
|
||||
@Resource
|
||||
private ContractMapper contractMapper;
|
||||
|
||||
@Resource
|
||||
private ISupplierService supplierService;
|
||||
|
||||
@Resource
|
||||
private IDocInventoryItemStaticService iDocInventoryItemStaticService;
|
||||
|
||||
@Resource
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
@Resource
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
|
||||
/**
|
||||
* 获取药房列表
|
||||
*
|
||||
* @return 药房列表
|
||||
*/
|
||||
@Override
|
||||
public List<LocationDto> getPharmacyList() {
|
||||
|
||||
List<Location> pharmacyList = locationService.getPharmacyList();
|
||||
|
||||
List<LocationDto> locationDtoList = new ArrayList<>();
|
||||
LocationDto locationDto;
|
||||
for (Location location : pharmacyList) {
|
||||
locationDto = new LocationDto();
|
||||
BeanUtils.copyProperties(location, locationDto);
|
||||
locationDtoList.add(locationDto);
|
||||
}
|
||||
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取药房列表(库房用)
|
||||
*
|
||||
* @return 药房列表
|
||||
*/
|
||||
@Override
|
||||
public List<LocationDto> getInventoryPharmacyList() {
|
||||
|
||||
// 用户id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
// 根据用户id获得管理库房信息
|
||||
List<Long> locationIds = practitionerRoleService.getLocationIdsByPractitionerId(practitionerId);
|
||||
|
||||
List<Location> pharmacyList = locationService.getPharmacyList();
|
||||
List<LocationDto> locationDtoList = new ArrayList<>();
|
||||
LocationDto locationDto;
|
||||
for (Location location : pharmacyList) {
|
||||
for (Long locationId : locationIds) {
|
||||
if (location.getId().equals(locationId)) {
|
||||
locationDto = new LocationDto();
|
||||
BeanUtils.copyProperties(location, locationDto);
|
||||
locationDtoList.add(locationDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取药库列表
|
||||
*
|
||||
* @return 药库列表
|
||||
*/
|
||||
@Override
|
||||
public List<LocationDto> getCabinetList() {
|
||||
List<Location> pharmacyList = locationService.getCabinetList();
|
||||
List<LocationDto> locationDtoList = new ArrayList<>();
|
||||
LocationDto locationDto;
|
||||
for (Location location : pharmacyList) {
|
||||
locationDto = new LocationDto();
|
||||
BeanUtils.copyProperties(location, locationDto);
|
||||
locationDtoList.add(locationDto);
|
||||
}
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取仓库列表
|
||||
*
|
||||
* @return 仓库列表
|
||||
*/
|
||||
@Override
|
||||
public List<LocationDto> getWarehouseList() {
|
||||
List<Location> pharmacyList = locationService.getWarehouseList();
|
||||
List<LocationDto> locationDtoList = new ArrayList<>();
|
||||
LocationDto locationDto;
|
||||
for (Location location : pharmacyList) {
|
||||
locationDto = new LocationDto();
|
||||
BeanUtils.copyProperties(location, locationDto);
|
||||
locationDtoList.add(locationDto);
|
||||
}
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取药库列表(库房用)
|
||||
*
|
||||
* @return 药库列表
|
||||
*/
|
||||
@Override
|
||||
public List<LocationDto> getInventoryCabinetList() {
|
||||
// 用户id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
// 根据用户id获得管理库房信息
|
||||
List<Long> locationIds = practitionerRoleService.getLocationIdsByPractitionerId(practitionerId);
|
||||
|
||||
List<Location> pharmacyList = locationService.getCabinetList();
|
||||
List<LocationDto> locationDtoList = new ArrayList<>();
|
||||
LocationDto locationDto;
|
||||
for (Location location : pharmacyList) {
|
||||
for (Long locationId : locationIds) {
|
||||
if (location.getId().equals(locationId)) {
|
||||
locationDto = new LocationDto();
|
||||
BeanUtils.copyProperties(location, locationDto);
|
||||
locationDtoList.add(locationDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 药房药库列表
|
||||
*
|
||||
* @return 药房药库列表
|
||||
*/
|
||||
@Override
|
||||
public List<LocationDto> getPharmacyCabinetList() {
|
||||
List<Location> pharmacyCabinetList = locationService.getPharmacyCabinetList();
|
||||
List<LocationDto> locationDtoList = new ArrayList<>();
|
||||
LocationDto locationDto;
|
||||
for (Location location : pharmacyCabinetList) {
|
||||
locationDto = new LocationDto();
|
||||
BeanUtils.copyProperties(location, locationDto);
|
||||
locationDtoList.add(locationDto);
|
||||
}
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取病区列表
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 病区列表
|
||||
*/
|
||||
@Override
|
||||
public List<LocationDto> getWardList(Long orgId) {
|
||||
List<Location> getWardList = new ArrayList<>();
|
||||
if (orgId != null) {
|
||||
getWardList = locationService.getWardList(orgId);
|
||||
} else {
|
||||
getWardList = locationService.getWardList(null);
|
||||
}
|
||||
List<LocationDto> locationDtoList = new ArrayList<>();
|
||||
LocationDto locationDto;
|
||||
for (Location location : getWardList) {
|
||||
locationDto = new LocationDto();
|
||||
BeanUtils.copyProperties(location, locationDto);
|
||||
locationDtoList.add(locationDto);
|
||||
}
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存项目下拉列表(药库业务使用)
|
||||
*
|
||||
* @param inventoryItemParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 库存项目信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getInventoryItemList(InventoryItemParam inventoryItemParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize) {
|
||||
Integer purchaseFlag = inventoryItemParam.getPurchaseFlag();
|
||||
inventoryItemParam.setPurchaseFlag(null);
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<InventoryItemParam> queryWrapper = HisQueryUtils.buildQueryWrapper(inventoryItemParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name, CommonConstants.FieldName.PyStr,
|
||||
CommonConstants.FieldName.WbStr)),
|
||||
null);
|
||||
// 查询库存项目信息
|
||||
IPage<InventoryItemDto> inventoryItems = commonAppMapper.selectInventoryItemList(new Page<>(pageNo, pageSize),
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||
ItemType.MEDICINE.getValue(), ItemType.DEVICE.getValue(), purchaseFlag, ConditionCode.PURCHASE.getCode(),
|
||||
PublicationStatus.RETIRED.getValue(), queryWrapper);
|
||||
List<InventoryItemDto> inventoryItemDtoList = inventoryItems.getRecords();
|
||||
inventoryItemDtoList.forEach(e -> {
|
||||
// 项目类型
|
||||
e.setItemType_enumText(EnumUtils.getInfoByValue(ItemType.class, e.getItemType()));
|
||||
});
|
||||
for (InventoryItemDto inventoryItem : inventoryItemDtoList) {
|
||||
List<UnitDto> unitList = new ArrayList<>();
|
||||
UnitDto unitDto = new UnitDto();
|
||||
// 单位列表
|
||||
unitDto.setUnitCode(inventoryItem.getUnitCode()).setMinUnitCode(inventoryItem.getMinUnitCode());
|
||||
unitList.add(unitDto);
|
||||
inventoryItem.setUnitList(unitList);
|
||||
}
|
||||
return R.ok(inventoryItemDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目相关信息查询项目库存相关信息
|
||||
*
|
||||
* @param inventoryItemParam 项目id
|
||||
* @return 项目库存相关信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getInventoryItemInfo(InventoryItemParam inventoryItemParam) {
|
||||
// 查询项目库存相关信息
|
||||
List<LocationInventoryDto> locationInventoryDtoList = commonAppMapper.selectInventoryItemInfo(
|
||||
inventoryItemParam.getOrgLocationId(), CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION, inventoryItemParam.getObjLocationId(),
|
||||
inventoryItemParam.getLotNumber(), inventoryItemParam.getItemId(), ConditionCode.PURCHASE.getCode());
|
||||
|
||||
// 医保编码和生产厂家校验
|
||||
for (LocationInventoryDto dto : locationInventoryDtoList) {
|
||||
if (StringUtils.isNotEmpty(dto.getYbNo()) && StringUtils.isEmpty(dto.getManufacturerText())) {
|
||||
return R.fail("生产厂家不能为空,请到药品目录维护");
|
||||
}
|
||||
}
|
||||
return R.ok(locationInventoryDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室列表
|
||||
*
|
||||
* @return 科室列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDepartmentList() {
|
||||
return R.ok(organizationService.getList(OrganizationType.DEPARTMENT.getValue(), null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室列表
|
||||
*
|
||||
* @return 科室列表
|
||||
*/
|
||||
@Override
|
||||
public List<Organization> departmentList() {
|
||||
return organizationService.getList(OrganizationType.DEPARTMENT.getValue(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据追溯码获取药品/耗材信息
|
||||
*
|
||||
* @param traceNoList 追溯码列表
|
||||
* @return 项目信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> getItemInfoByTraceNo(List<String> traceNoList) {
|
||||
Map<String, String> traceNoMap = new HashMap<>();
|
||||
for (String traceNo : traceNoList) {
|
||||
if (traceNo != null && !StringUtils.isEmpty(traceNo)) {
|
||||
// 数据源更改
|
||||
InventoryItem inventoryItem = inventoryItemService.getOne(
|
||||
new LambdaQueryWrapper<InventoryItem>().like(InventoryItem::getTraceNo, traceNo).last("LIMIT 1"));
|
||||
if (inventoryItem != null) {
|
||||
String itemId = inventoryItem.getItemId().toString();
|
||||
// TraceNoManage traceNoManage = commonAppMapper.getInfoByTraceNo("%" + traceNo + "%");
|
||||
// if (traceNoManage != null) {
|
||||
// String itemId = traceNoManage.getItemId().toString();
|
||||
// 如果map中已经存在该itemId,拼接traceNo,否则直接添加
|
||||
if (traceNoMap.containsKey(itemId)) {
|
||||
String existingTraceNos = traceNoMap.get(itemId);
|
||||
traceNoMap.put(itemId, existingTraceNos + CommonConstants.Common.COMMA + traceNo);
|
||||
} else {
|
||||
traceNoMap.put(itemId, traceNo);
|
||||
}
|
||||
} else {
|
||||
return R.ok(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok(traceNoMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 追溯码查询
|
||||
*
|
||||
* @param searchTraceNoParam 查询条件
|
||||
* @return 项目信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> searchTraceNo(SearchTraceNoParam searchTraceNoParam) {
|
||||
List<TraceNoManage> traceNoManageList = new ArrayList<>();
|
||||
Map<String, String> traceNoMap = new HashMap<>();
|
||||
// 判断传入的是药品还是耗材,查询追溯码状态只有进的数据
|
||||
if (searchTraceNoParam.getItemType().equals(ItemType.MEDICINE.getValue())) {
|
||||
traceNoManageList = traceNoManageMapper.getItemTraceNoInfo(
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, searchTraceNoParam.getItemId(),
|
||||
searchTraceNoParam.getLocationId(), searchTraceNoParam.getLotNumber());
|
||||
} else if (searchTraceNoParam.getItemType().equals(ItemType.DEVICE.getValue())) {
|
||||
traceNoManageList = traceNoManageMapper.getItemTraceNoInfo(CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||
searchTraceNoParam.getItemId(), searchTraceNoParam.getLocationId(), searchTraceNoParam.getLotNumber());
|
||||
}
|
||||
if (traceNoManageList != null) {
|
||||
for (TraceNoManage traceNoItem : traceNoManageList) {
|
||||
traceNoMap.put(traceNoItem.getItemId().toString(), traceNoItem.getTraceNo());
|
||||
}
|
||||
}
|
||||
return R.ok(traceNoMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询费用性质
|
||||
*
|
||||
* @return 费用性质
|
||||
*/
|
||||
@Override
|
||||
public R<?> getContractMetadata() {
|
||||
// TODO: Contract表的基础数据维护还没做,具体不知道状态字段的取值是什么,先查询默认值为0的数据
|
||||
List<Contract> ContractList
|
||||
= contractMapper.selectList(new LambdaQueryWrapper<Contract>().eq(Contract::getStatusEnum, 0));
|
||||
// 复制同名字段并 return
|
||||
return R.ok(ContractList.stream().map(contract -> {
|
||||
ContractMetadata metadata = new ContractMetadata();
|
||||
try {
|
||||
BeanUtils.copyProperties(contract, metadata);
|
||||
} catch (Exception e) {
|
||||
log.warn("Bean复制失败", e);
|
||||
}
|
||||
return metadata;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据科室查询护士
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 护士列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getNurseListByOrg(Long orgId) {
|
||||
return R.ok(practitionerRoleService.getNurseList(orgId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父级位置id查询他所有的子集
|
||||
*
|
||||
* @param locationId 位置id
|
||||
* @param locationForm 位置类型
|
||||
* @return 位置列表
|
||||
*/
|
||||
@Override
|
||||
public List<LocationDto> getChildLocation(Long locationId, Integer locationForm) {
|
||||
// 获取当前位置信息
|
||||
Location location = locationService.getById(locationId);
|
||||
// 查询所有子集位置
|
||||
List<Location> childLocations = locationService.list(new LambdaQueryWrapper<Location>()
|
||||
.likeRight(Location::getBusNo, location.getBusNo()).eq(Location::getFormEnum, locationForm)
|
||||
.ne(Location::getStatusEnum, LocationStatus.INACTIVE.getValue()));
|
||||
List<LocationDto> locationDtoList = new ArrayList<>();
|
||||
LocationDto locationDto;
|
||||
for (Location childLocation : childLocations) {
|
||||
locationDto = new LocationDto();
|
||||
BeanUtils.copyProperties(childLocation, locationDto);
|
||||
locationDtoList.add(locationDto);
|
||||
}
|
||||
// 8. 返回成功响应
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询登录者管理的病区
|
||||
*
|
||||
* @return 病区列表
|
||||
*/
|
||||
@Override
|
||||
public List<LocationDto> getPractitionerWard() {
|
||||
// 获取当前登录用户信息
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
Long currentOrgId = SecurityUtils.getLoginUser().getOrgId();
|
||||
|
||||
log.info("getPractitionerWard - practitionerId: {}, currentOrgId: {}", practitionerId, currentOrgId);
|
||||
|
||||
// 获取用户配置的位置 ID 列表(可能包含科室、病区等)
|
||||
List<Long> locationIds = practitionerRoleService.getLocationIdsByPractitionerId(practitionerId);
|
||||
// 获取用户配置的科室 ID 列表
|
||||
List<Long> orgIds = practitionerRoleService.getOrgIdsByPractitionerId(practitionerId);
|
||||
|
||||
log.info("getPractitionerWard - locationIds: {}, orgIds: {}", locationIds, orgIds);
|
||||
|
||||
List<Location> wardList = new ArrayList<>();
|
||||
|
||||
// 方式 1:从 locationIds 中过滤出病区
|
||||
if (locationIds != null && !locationIds.isEmpty()) {
|
||||
// 过滤掉 null 值
|
||||
locationIds = locationIds.stream().filter(id -> id != null).collect(java.util.stream.Collectors.toList());
|
||||
if (!locationIds.isEmpty()) {
|
||||
List<Location> locationList
|
||||
= locationService.getLocationList(locationIds, Collections.singletonList(LocationStatus.ACTIVE.getValue()));
|
||||
log.info("getPractitionerWard - 从 locationIds 查询到的位置总数:{}", locationList != null ? locationList.size() : 0);
|
||||
|
||||
for (Location location : locationList) {
|
||||
log.info("getPractitionerWard - 位置:id={}, name={}, formEnum={}, organizationId={}",
|
||||
location.getId(), location.getName(), location.getFormEnum(), location.getOrganizationId());
|
||||
if (LocationForm.WARD.getValue().equals(location.getFormEnum())) {
|
||||
// 如果当前有选择科室,只添加当前科室的病区
|
||||
if (currentOrgId == null || currentOrgId.equals(location.getOrganizationId())) {
|
||||
wardList.add(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 方式 2:从 orgIds 查询病区(补充查询,确保能获取到病区)
|
||||
if (orgIds != null && !orgIds.isEmpty()) {
|
||||
// 过滤掉 null 值并去重
|
||||
orgIds = orgIds.stream().filter(id -> id != null).distinct().collect(java.util.stream.Collectors.toList());
|
||||
if (!orgIds.isEmpty()) {
|
||||
log.info("getPractitionerWard - 从 orgIds 查询病区,orgIds: {}", orgIds);
|
||||
for (Long orgId : orgIds) {
|
||||
// 如果当前有选择科室,只查询当前科室的病区
|
||||
if (currentOrgId != null && !currentOrgId.equals(orgId)) {
|
||||
continue;
|
||||
}
|
||||
List<Location> orgWards = locationService.getWardList(orgId);
|
||||
log.info("getPractitionerWard - orgId: {} 查询到病区数:{}", orgId, orgWards != null ? orgWards.size() : 0);
|
||||
if (orgWards != null && !orgWards.isEmpty()) {
|
||||
wardList.addAll(orgWards);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 方式 3:如果仍然没有病区,且 currentOrgId 为空,尝试获取所有病区
|
||||
if (wardList.isEmpty() && currentOrgId == null) {
|
||||
log.info("getPractitionerWard - 尝试获取所有病区");
|
||||
List<Location> allWards = locationService.getWardList(null);
|
||||
log.info("getPractitionerWard - 所有病区数:{}", allWards != null ? allWards.size() : 0);
|
||||
if (allWards != null && !allWards.isEmpty()) {
|
||||
wardList.addAll(allWards);
|
||||
}
|
||||
}
|
||||
|
||||
// 去重:根据病区 ID 去重(因为方式 1 和方式 2 可能会查询到相同的病区)
|
||||
if (!wardList.isEmpty()) {
|
||||
wardList = wardList.stream()
|
||||
.collect(java.util.stream.Collectors.collectingAndThen(
|
||||
java.util.stream.Collectors.toCollection(() ->
|
||||
new java.util.TreeSet<>(java.util.Comparator.comparing(Location::getId))),
|
||||
ArrayList::new
|
||||
));
|
||||
}
|
||||
|
||||
log.info("getPractitionerWard - 最终病区数:{}", wardList.size());
|
||||
|
||||
// 转换为 DTO
|
||||
List<LocationDto> locationDtoList = new ArrayList<>();
|
||||
LocationDto locationDto;
|
||||
for (Location ward : wardList) {
|
||||
locationDto = new LocationDto();
|
||||
BeanUtils.copyProperties(ward, locationDto);
|
||||
locationDtoList.add(locationDto);
|
||||
}
|
||||
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Location列表转换为LocationDto列表
|
||||
*
|
||||
* @param locationList Location列表
|
||||
* @return LocationDto列表
|
||||
*/
|
||||
private List<LocationDto> convertToLocationDtoList(List<Location> locationList) {
|
||||
List<LocationDto> locationDtoList = new ArrayList<>();
|
||||
if (locationList == null || locationList.isEmpty()) {
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
LocationDto locationDto;
|
||||
for (Location location : locationList) {
|
||||
// 只返回病区类型的位置
|
||||
if (LocationForm.WARD.getValue().equals(location.getFormEnum())) {
|
||||
locationDto = new LocationDto();
|
||||
BeanUtils.copyProperties(location, locationDto);
|
||||
locationDtoList.add(locationDto);
|
||||
}
|
||||
}
|
||||
return locationDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参与者下拉列表
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @return 参与者下拉列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPractitionerList(String searchKey) {
|
||||
return R.ok(commonAppMapper.getPractitionerList(searchKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询医嘱打印信息
|
||||
*
|
||||
* @param requestIds 请求ids
|
||||
* @param isPrescription 是否为处方
|
||||
* @return 医嘱打印单
|
||||
*/
|
||||
@Override
|
||||
public R<?> getAdvicePrintInfo(List<Long> requestIds, String isPrescription) {
|
||||
AdvicePrintInfoDto advicePrintInfoDto;
|
||||
if (Whether.YES.getCode().equals(isPrescription)) {
|
||||
// 查询处方单
|
||||
advicePrintInfoDto = commonAppMapper.selectPrescriptionPrintInfo(requestIds);
|
||||
} else {
|
||||
// 查询处置单
|
||||
advicePrintInfoDto = commonAppMapper.selectTreatmentPrintInfo(requestIds);
|
||||
}
|
||||
advicePrintInfoDto
|
||||
.setAge(advicePrintInfoDto.getBirthDate() != null
|
||||
? AgeCalculatorUtil.getAge(advicePrintInfoDto.getBirthDate()) : "")
|
||||
.setGenderEnum_enumText(
|
||||
EnumUtils.getInfoByValue(AdministrativeGender.class, advicePrintInfoDto.getGenderEnum()))
|
||||
.setEncounterYbClass_enumText(
|
||||
EnumUtils.getInfoByValue(EncounterYbClass.class, advicePrintInfoDto.getEncounterYbClass()));
|
||||
if (advicePrintInfoDto.getChrgitmLv() != null) {
|
||||
advicePrintInfoDto
|
||||
.setChrgitmLv_enumText(EnumUtils.getInfoByValue(InsuranceLevel.class, advicePrintInfoDto.getChrgitmLv()));
|
||||
}
|
||||
return R.ok(advicePrintInfoDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参与者签名
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
* @return 参与者签名
|
||||
*/
|
||||
@Override
|
||||
public R<?> getPractitionerSignature(Long practitionerId) {
|
||||
return R.ok(commonAppMapper.getPractitionerSignature(practitionerId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有供应商
|
||||
*
|
||||
* @return 供应商
|
||||
*/
|
||||
@Override
|
||||
public R<?> getSupplierList() {
|
||||
return R.ok(supplierService.list(new LambdaQueryWrapper<Supplier>().select(Supplier::getId, Supplier::getName)
|
||||
.eq(Supplier::getTypeEnum, SupplierType.SUPPLIER.getValue())
|
||||
.eq(Supplier::getDeleteFlag, DelFlag.NO.getCode()).eq(Supplier::getActiveFlag, Whether.YES.getValue())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有诊疗项目
|
||||
*
|
||||
* @return 诊疗项目
|
||||
*/
|
||||
@Override
|
||||
public R<?> getActivityDefinition() {
|
||||
return R.ok(commonAppMapper.getActivityDefinition(PublicationStatus.ACTIVE.getValue()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询备份单号
|
||||
*
|
||||
* @return 备份单号列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getBackupNoList() {
|
||||
List<DocInventoryItemStatic> docInventoryItemStaticList
|
||||
= iDocInventoryItemStaticService.list(new LambdaQueryWrapper<DocInventoryItemStatic>()
|
||||
.eq(DocInventoryItemStatic::getDeleteFlag, DelFlag.NO.getCode())
|
||||
.eq(DocInventoryItemStatic::getTenantId, SecurityUtils.getLoginUser().getTenantId()));
|
||||
if (docInventoryItemStaticList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
// 直接去重并按BusNo倒序排序
|
||||
List<String> busNoList = docInventoryItemStaticList.stream().map(DocInventoryItemStatic::getBusNo).distinct() // 去重
|
||||
.sorted(Comparator.reverseOrder()).collect(Collectors.toList());
|
||||
return R.ok(busNoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批号匹配
|
||||
*
|
||||
* @param encounterIdList 就诊id列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> lotNumberMatch(List<Long> encounterIdList) {
|
||||
// 查询患者待发放的药品信息
|
||||
List<MedicationDispense> medicationDispenseList = medicationDispenseService
|
||||
.list(new LambdaQueryWrapper<MedicationDispense>().in(MedicationDispense::getEncounterId, encounterIdList)
|
||||
.eq(MedicationDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
|
||||
.eq(MedicationDispense::getDeleteFlag, DelFlag.NO.getCode()));
|
||||
// 药品批号匹配
|
||||
if (medicationDispenseList != null && !medicationDispenseList.isEmpty()) {
|
||||
// 获取待发放的药品id
|
||||
List<Long> medicationIdList
|
||||
= medicationDispenseList.stream().map(MedicationDispense::getMedicationId).distinct().toList();
|
||||
// 获取发药药房
|
||||
List<Long> locationIdList
|
||||
= medicationDispenseList.stream().map(MedicationDispense::getLocationId).distinct().toList();
|
||||
|
||||
// 查询待发放药品的库存明细
|
||||
List<InventoryDetailDto> inventoryDetailList = commonAppMapper
|
||||
.selectMedicineInventoryDetail(medicationIdList, locationIdList, PublicationStatus.ACTIVE.getValue());
|
||||
if (inventoryDetailList == null || inventoryDetailList.isEmpty()) {
|
||||
return R.fail("发药单生成失败,请检查药品库存");
|
||||
}
|
||||
// 将库存信息根据药品id和库房id进行分组
|
||||
Map<String, List<InventoryDetailDto>> inventoryDetailMap = inventoryDetailList.stream()
|
||||
.collect(Collectors.groupingBy(x -> x.getItemId() + CommonConstants.Common.DASH + x.getLocationId()));
|
||||
// 按照效期排序(先进先出)
|
||||
for (List<InventoryDetailDto> inventoryList : inventoryDetailMap.values()) {
|
||||
inventoryList.sort(Comparator.comparing(InventoryDetailDto::getExpirationDate));
|
||||
}
|
||||
|
||||
// 使用索引循环,以便处理后续添加的拆分单
|
||||
int currentIndex = 0;
|
||||
while (currentIndex < medicationDispenseList.size()) {
|
||||
MedicationDispense medicationDispense = medicationDispenseList.get(currentIndex);
|
||||
currentIndex++;
|
||||
// 根据发放药品和发放药房做key
|
||||
String inventoryKey = medicationDispense.getMedicationId() + CommonConstants.Common.DASH
|
||||
+ medicationDispense.getLocationId();
|
||||
// 查询对应的库存信息
|
||||
if (!inventoryDetailMap.containsKey(inventoryKey)) {
|
||||
return R.fail("药品库存不存在,药品ID: " + medicationDispense.getMedicationId());
|
||||
}
|
||||
List<InventoryDetailDto> inventoryList = inventoryDetailMap.get(inventoryKey);
|
||||
|
||||
// 获取发药数量
|
||||
BigDecimal dispenseQuantity = medicationDispense.getQuantity();
|
||||
// 循环库存信息
|
||||
for (InventoryDetailDto inventoryDetailDto : inventoryList) {
|
||||
// 发药数量不能小于等于0
|
||||
if (dispenseQuantity.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
break;
|
||||
}
|
||||
// 库存剩余数量不能小于等于0
|
||||
if (inventoryDetailDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
continue;
|
||||
}
|
||||
// 发药数量单位转换
|
||||
if (!inventoryDetailDto.getInventoryUnitCode().equals(medicationDispense.getUnitCode())) {
|
||||
dispenseQuantity = dispenseQuantity.multiply(inventoryDetailDto.getPartPercent());
|
||||
}
|
||||
|
||||
// 获取库存剩余数量
|
||||
BigDecimal remainingInventoryQuantity
|
||||
= inventoryDetailDto.getInventoryQuantity().subtract(dispenseQuantity);
|
||||
// 如果剩余库存数量大于等于0,则说明当前批号库存充足
|
||||
if (remainingInventoryQuantity.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
medicationDispense.setLotNumber(inventoryDetailDto.getInventoryLotNumber());
|
||||
// 将该批号的库存数量重置为剩余数量
|
||||
inventoryDetailDto.setInventoryQuantity(remainingInventoryQuantity);
|
||||
} else {
|
||||
// 发药数量单位转换
|
||||
if (!inventoryDetailDto.getInventoryUnitCode().equals(medicationDispense.getUnitCode())) {
|
||||
// 发药数量取库存大单位数量
|
||||
dispenseQuantity = inventoryDetailDto.getInventoryQuantity()
|
||||
.divide(inventoryDetailDto.getPartPercent(), 0, RoundingMode.HALF_UP);
|
||||
// 大单位数量不足则跳出循环
|
||||
if (dispenseQuantity.compareTo(BigDecimal.ZERO) == 0) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// 发药数量取该批号剩余数量
|
||||
dispenseQuantity = inventoryDetailDto.getInventoryQuantity();
|
||||
}
|
||||
|
||||
// 如果剩余数量不足则进行拆分
|
||||
MedicationDispense splitMedicationDispense = new MedicationDispense();
|
||||
BeanUtils.copyProperties(medicationDispense, splitMedicationDispense);
|
||||
// 数量拆分
|
||||
splitMedicationDispense.setQuantity(medicationDispense.getQuantity().subtract(dispenseQuantity))
|
||||
// 重置id与批号
|
||||
.setId(null).setLotNumber(null)
|
||||
// 重新生成发药单编码
|
||||
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_DIS_NO.getPrefix(), 4));
|
||||
// 将拆分出来的发药单添加到原发药单列表中
|
||||
medicationDispenseList.add(splitMedicationDispense);
|
||||
|
||||
// 更新原发药单
|
||||
medicationDispense.setLotNumber(inventoryDetailDto.getInventoryLotNumber());
|
||||
medicationDispense.setQuantity(dispenseQuantity);
|
||||
// 将该批号的库存数量重置为0
|
||||
inventoryDetailDto.setInventoryQuantity(BigDecimal.ZERO);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 校验药品库存
|
||||
for (MedicationDispense medicationDispense : medicationDispenseList) {
|
||||
if (medicationDispense.getLotNumber() == null) {
|
||||
return R.fail("药品:" + medicationDispense.getMedicationId() + "库存不足,请检查药品库存");
|
||||
}
|
||||
}
|
||||
// 新增或更新发药单
|
||||
boolean result = medicationDispenseService.saveOrUpdateBatch(medicationDispenseList);
|
||||
if (!result) {
|
||||
return R.fail("发药单生成失败,请联系管理员");
|
||||
}
|
||||
}
|
||||
// 查询患者待发放的耗材信息
|
||||
List<DeviceDispense> deviceDispenseList = deviceDispenseService
|
||||
.list(new LambdaQueryWrapper<DeviceDispense>().in(DeviceDispense::getEncounterId, encounterIdList)
|
||||
.eq(DeviceDispense::getStatusEnum, DispenseStatus.PREPARATION.getValue())
|
||||
.eq(DeviceDispense::getDeleteFlag, DelFlag.NO.getCode()));
|
||||
// 耗材批号匹配
|
||||
if (deviceDispenseList != null && !deviceDispenseList.isEmpty()) {
|
||||
// 获取待发放的耗材id
|
||||
List<Long> deviceIdList
|
||||
= deviceDispenseList.stream().map(DeviceDispense::getDeviceDefId).distinct().toList();
|
||||
// 获取发耗材房
|
||||
List<Long> locationIdList
|
||||
= deviceDispenseList.stream().map(DeviceDispense::getLocationId).distinct().toList();
|
||||
|
||||
// 查询待发放耗材的库存明细
|
||||
List<InventoryDetailDto> inventoryDetailList = commonAppMapper.selectDeviceInventoryDetail(deviceIdList,
|
||||
locationIdList, PublicationStatus.ACTIVE.getValue());
|
||||
if (inventoryDetailList == null || inventoryDetailList.isEmpty()) {
|
||||
return R.fail("发耗材单生成失败,请检查耗材库存");
|
||||
}
|
||||
// 将库存信息根据耗材id和库房id进行分组
|
||||
Map<String, List<InventoryDetailDto>> inventoryDetailMap = inventoryDetailList.stream()
|
||||
.collect(Collectors.groupingBy(x -> x.getItemId() + CommonConstants.Common.DASH + x.getLocationId()));
|
||||
// 按照效期排序(先进先出)
|
||||
for (List<InventoryDetailDto> inventoryList : inventoryDetailMap.values()) {
|
||||
inventoryList.sort(Comparator.comparing(InventoryDetailDto::getExpirationDate));
|
||||
}
|
||||
|
||||
// 使用索引循环,以便处理后续添加的拆分单
|
||||
int currentIndex = 0;
|
||||
while (currentIndex < deviceDispenseList.size()) {
|
||||
DeviceDispense deviceDispense = deviceDispenseList.get(currentIndex);
|
||||
currentIndex++;
|
||||
// 根据发放耗材和发放耗材房做key
|
||||
String inventoryKey
|
||||
= deviceDispense.getDeviceDefId() + CommonConstants.Common.DASH + deviceDispense.getLocationId();
|
||||
// 查询对应的库存信息
|
||||
if (!inventoryDetailMap.containsKey(inventoryKey)) {
|
||||
return R.fail("耗材库存不存在,耗材ID: " + deviceDispense.getDeviceDefId());
|
||||
}
|
||||
List<InventoryDetailDto> inventoryList = inventoryDetailMap.get(inventoryKey);
|
||||
|
||||
// 获取发耗材数量
|
||||
BigDecimal dispenseQuantity = deviceDispense.getQuantity();
|
||||
// 循环库存信息
|
||||
for (InventoryDetailDto inventoryDetailDto : inventoryList) {
|
||||
// 发耗材数量不能小于等于0
|
||||
if (dispenseQuantity.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
break;
|
||||
}
|
||||
// 库存剩余数量不能小于等于0
|
||||
if (inventoryDetailDto.getInventoryQuantity().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
continue;
|
||||
}
|
||||
// 发耗材数量单位转换
|
||||
if (!inventoryDetailDto.getInventoryUnitCode().equals(deviceDispense.getUnitCode())) {
|
||||
dispenseQuantity = dispenseQuantity.multiply(inventoryDetailDto.getPartPercent());
|
||||
}
|
||||
|
||||
// 获取库存剩余数量
|
||||
BigDecimal remainingInventoryQuantity
|
||||
= inventoryDetailDto.getInventoryQuantity().subtract(dispenseQuantity);
|
||||
// 如果剩余库存数量大于等于0,则说明当前批号库存充足
|
||||
if (remainingInventoryQuantity.compareTo(BigDecimal.ZERO) >= 0) {
|
||||
deviceDispense.setLotNumber(inventoryDetailDto.getInventoryLotNumber());
|
||||
// 将该批号的库存数量重置为剩余数量
|
||||
inventoryDetailDto.setInventoryQuantity(remainingInventoryQuantity);
|
||||
} else {
|
||||
// 发耗材数量单位转换
|
||||
if (!inventoryDetailDto.getInventoryUnitCode().equals(deviceDispense.getUnitCode())) {
|
||||
// 发耗材数量取库存大单位数量
|
||||
dispenseQuantity = inventoryDetailDto.getInventoryQuantity()
|
||||
.divide(inventoryDetailDto.getPartPercent(), 0, RoundingMode.HALF_UP);
|
||||
// 大单位数量不足则跳出循环
|
||||
if (dispenseQuantity.compareTo(BigDecimal.ZERO) == 0) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// 发耗材数量取该批号剩余数量
|
||||
dispenseQuantity = inventoryDetailDto.getInventoryQuantity();
|
||||
}
|
||||
|
||||
// 如果剩余数量不足则进行拆分
|
||||
DeviceDispense splitDeviceDispense = new DeviceDispense();
|
||||
BeanUtils.copyProperties(deviceDispense, splitDeviceDispense);
|
||||
// 数量拆分
|
||||
splitDeviceDispense.setQuantity(deviceDispense.getQuantity().subtract(dispenseQuantity))
|
||||
// 重置id与批号
|
||||
.setId(null).setLotNumber(null)
|
||||
// 重新生成发耗材单编码
|
||||
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_DIS_NO.getPrefix(), 4));
|
||||
// 将拆分出来的发耗材单添加到原发耗材单列表中
|
||||
deviceDispenseList.add(splitDeviceDispense);
|
||||
|
||||
// 更新原发耗材单
|
||||
deviceDispense.setLotNumber(inventoryDetailDto.getInventoryLotNumber());
|
||||
deviceDispense.setQuantity(dispenseQuantity);
|
||||
// 将该批号的库存数量重置为0
|
||||
inventoryDetailDto.setInventoryQuantity(BigDecimal.ZERO);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 校验耗材库存
|
||||
for (DeviceDispense deviceDispense : deviceDispenseList) {
|
||||
if (deviceDispense.getLotNumber() == null) {
|
||||
return R.fail("耗材:" + deviceDispense.getDeviceDefId() + "库存不足,请检查耗材库存");
|
||||
}
|
||||
}
|
||||
// 新增或更新发耗材单
|
||||
boolean result = deviceDispenseService.saveOrUpdateBatch(deviceDispenseList);
|
||||
if (!result) {
|
||||
return R.fail("发耗材单生成失败,请联系管理员");
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据机构ID获取机构名称
|
||||
*
|
||||
* @param orgId 机构ID
|
||||
* @return 机构名称
|
||||
*/
|
||||
@Override
|
||||
public String getOrgNameById(Long orgId) {
|
||||
if (orgId == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
Organization organization = organizationService.getById(orgId);
|
||||
if (organization == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return organization.getName();
|
||||
}
|
||||
}
|
||||
@@ -1,283 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.controller;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.common.appservice.ICommonService;
|
||||
import com.openhis.web.common.dto.InventoryItemParam;
|
||||
import com.openhis.web.common.dto.LocationDto;
|
||||
import com.openhis.web.common.dto.SearchTraceNoParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app常用接口
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app-common")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class CommonAppController {
|
||||
|
||||
@Resource
|
||||
private ICommonService commonService;
|
||||
|
||||
/**
|
||||
* 药房列表
|
||||
*
|
||||
* @return 药房列表
|
||||
*/
|
||||
@GetMapping(value = "/pharmacy-list")
|
||||
public R<?> getPharmacyList() {
|
||||
return R.ok(commonService.getPharmacyList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 药房列表(库房用)
|
||||
*
|
||||
* @return 药房列表
|
||||
*/
|
||||
@GetMapping(value = "/inventory-pharmacy-list")
|
||||
public R<?> getInventoryPharmacyList() {
|
||||
return R.ok(commonService.getInventoryPharmacyList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 药库列表
|
||||
*
|
||||
* @return 药库列表
|
||||
*/
|
||||
@GetMapping(value = "/cabinet-list")
|
||||
public R<?> getCabinetList() {
|
||||
return R.ok(commonService.getCabinetList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 药库列表(库房用)
|
||||
*
|
||||
* @return 药库列表
|
||||
*/
|
||||
@GetMapping(value = "/inventory-cabinet-list")
|
||||
public R<?> getInventoryCabinetList() {
|
||||
return R.ok(commonService.getInventoryCabinetList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材库列表
|
||||
*
|
||||
* @return 耗材库列表
|
||||
*/
|
||||
@GetMapping(value = "/warehouse-list")
|
||||
public R<?> getWarehouseList() {
|
||||
return R.ok(commonService.getWarehouseList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 药房药库列表
|
||||
*
|
||||
* @return 药房药库列表
|
||||
*/
|
||||
@GetMapping(value = "/pharmacy-cabinet-list")
|
||||
public R<?> getPharmacyCabinetList() {
|
||||
return R.ok(commonService.getPharmacyCabinetList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 病区列表
|
||||
*
|
||||
* @return 病区列表
|
||||
*/
|
||||
@GetMapping(value = "/ward-list")
|
||||
public R<?> getWardList(@RequestParam(value = "orgId", required = false) Long orgId) {
|
||||
return R.ok(commonService.getWardList(orgId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 科室列表
|
||||
*
|
||||
* @return 科室列表
|
||||
*/
|
||||
@GetMapping(value = "/department-list")
|
||||
public R<?> getDepartmentList() {
|
||||
return commonService.getDepartmentList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存项目下拉列表(药库业务使用)
|
||||
*
|
||||
* @param inventoryItemParam 查询条件
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 库存项目信息
|
||||
*/
|
||||
@GetMapping(value = "/inventory-item")
|
||||
public R<?> getInventoryItemList(InventoryItemParam inventoryItemParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "50") Integer pageSize) {
|
||||
return commonService.getInventoryItemList(inventoryItemParam, searchKey, pageNo, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据项目相关信息查询项目库存相关信息
|
||||
*
|
||||
* @param inventoryItemParam 项目id
|
||||
* @return 项目库存相关信息
|
||||
*/
|
||||
@GetMapping(value = "/inventory-item-info")
|
||||
public R<?> getInventoryItemInfo(InventoryItemParam inventoryItemParam) {
|
||||
return commonService.getInventoryItemInfo(inventoryItemParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据追溯码获取药品/耗材信息
|
||||
*
|
||||
* @param traceNoList 追溯码列表
|
||||
* @return 项目信息
|
||||
*/
|
||||
@GetMapping(value = "/item-trace-no")
|
||||
public R<?> getItemInfoByTraceNo(@RequestParam List<String> traceNoList) {
|
||||
return commonService.getItemInfoByTraceNo(traceNoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 追溯码查询
|
||||
*
|
||||
* @param searchTraceNoParam 查询条件
|
||||
* @return 项目信息
|
||||
*/
|
||||
@GetMapping(value = "/search-trace-no")
|
||||
public R<?> searchTraceNo(SearchTraceNoParam searchTraceNoParam) {
|
||||
return commonService.searchTraceNo(searchTraceNoParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询费用性质
|
||||
*
|
||||
* @return 费用性质
|
||||
*/
|
||||
@GetMapping(value = "/contract-list")
|
||||
public R<?> getContractList() {
|
||||
return commonService.getContractMetadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据科室查询护士
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 护士列表
|
||||
*/
|
||||
@GetMapping(value = "/nurse-list")
|
||||
public R<?> getNurseListByOrg(Long orgId) {
|
||||
return commonService.getNurseListByOrg(orgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据父级位置id查询他所有的子集
|
||||
*
|
||||
* @param locationId 位置id
|
||||
* @param locationForm 位置类型
|
||||
* @return 位置列表
|
||||
*/
|
||||
@GetMapping(value = "/child-location-list")
|
||||
public List<LocationDto> getChildLocation(Long locationId, Integer locationForm) {
|
||||
return commonService.getChildLocation(locationId, locationForm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询登录者管理的病区
|
||||
*
|
||||
* @return 病区列表
|
||||
*/
|
||||
@GetMapping(value = "/practitioner-ward")
|
||||
public R<?> getPractitionerWard() {
|
||||
return R.ok(commonService.getPractitionerWard());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参与者下拉列表
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @return 参与者下拉列表
|
||||
*/
|
||||
@GetMapping(value = "/practitioner-list")
|
||||
public R<?> getPractitionerList(@RequestParam(value = "searchKey", required = false) String searchKey) {
|
||||
return commonService.getPractitionerList(searchKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询医嘱打印信息
|
||||
*
|
||||
* @param requestIds 请求ids
|
||||
* @param isPrescription 是否为处方
|
||||
* @return 医嘱打印单
|
||||
*/
|
||||
@GetMapping("/advice-print")
|
||||
public R<?> getAdvicePrintInfo(@RequestParam(value = "requestIds") List<Long> requestIds, String isPrescription) {
|
||||
return commonService.getAdvicePrintInfo(requestIds, isPrescription);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参与者签名
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
* @return 参与者签名
|
||||
*/
|
||||
@GetMapping(value = "/practitioner-signature")
|
||||
public R<?> getPractitionerSignature(@RequestParam(value = "practitionerId") Long practitionerId) {
|
||||
return commonService.getPractitionerSignature(practitionerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有供应商
|
||||
*
|
||||
* @return 供应商
|
||||
*/
|
||||
@GetMapping(value = "/supplier")
|
||||
public R<?> getSupplierList() {
|
||||
return commonService.getSupplierList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有诊疗项目
|
||||
*
|
||||
* @return 诊疗项目
|
||||
*/
|
||||
@GetMapping(value = "/activity-definition")
|
||||
public R<?> getActivityDefinition() {
|
||||
return commonService.getActivityDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询备份单号
|
||||
*
|
||||
* @return 备份单号列表
|
||||
*/
|
||||
@GetMapping(value = "/backup-list")
|
||||
public R<?> getBackupNoList() {
|
||||
return commonService.getBackupNoList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批号匹配
|
||||
*
|
||||
* @param encounterIdList 就诊id列表
|
||||
* @return 处理结果
|
||||
*/
|
||||
@GetMapping("/lot-number-match")
|
||||
public R<?> lotNumberMatch(@RequestParam(value = "encounterIdList") List<Long> encounterIdList) {
|
||||
return commonService.lotNumberMatch(encounterIdList);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 诊疗项目dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ActivityDefinitionDto {
|
||||
|
||||
/** 项目定义ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long activityDefinitionId;
|
||||
|
||||
/** 项目名称 */
|
||||
private String activityDefinitionName;
|
||||
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 医嘱项目打印信息
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-09-16
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdviceItemPrintInfoDto {
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
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 String prescriptionNo;
|
||||
|
||||
/**
|
||||
* 分组号
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
private Integer sortNumber;
|
||||
|
||||
/**
|
||||
* 中药付数
|
||||
*/
|
||||
private BigDecimal chineseHerbsDoseQuantity;
|
||||
|
||||
/**
|
||||
* 医保等级甲乙类
|
||||
*/
|
||||
private String chrgitmLv;
|
||||
|
||||
/**
|
||||
* 是否基药
|
||||
*/
|
||||
private Integer basicFlag;
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 处方信息
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-09-16
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdvicePrintInfoDto {
|
||||
|
||||
/** 科室 */
|
||||
private String departmentName;
|
||||
|
||||
/** 患者姓名 */
|
||||
private String patientName;
|
||||
|
||||
/** 电话 */
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 就诊编码
|
||||
*/
|
||||
private String encounterNo;
|
||||
|
||||
/** 性别 */
|
||||
private Integer genderEnum;
|
||||
private String genderEnum_enumText;
|
||||
|
||||
/** 年龄 */
|
||||
private String age;
|
||||
|
||||
/** 生日 */
|
||||
private Date birthDate;
|
||||
|
||||
/** 开具日期 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date reqTime;
|
||||
|
||||
/**
|
||||
* 费用性质
|
||||
*/
|
||||
private String contractName;
|
||||
|
||||
/**
|
||||
* 诊断名称
|
||||
*/
|
||||
private String conditionName;
|
||||
|
||||
/**
|
||||
* 开单医生
|
||||
*/
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 发药医生
|
||||
*/
|
||||
private String dispenseDoctorName;
|
||||
|
||||
/**
|
||||
* 配药医生
|
||||
*/
|
||||
private String preparerDoctorName;
|
||||
|
||||
/**
|
||||
* 收费医生
|
||||
*/
|
||||
private String chargeDoctorName;
|
||||
|
||||
/** 就诊类型 */
|
||||
private Integer encounterYbClass;
|
||||
private String encounterYbClass_enumText;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/**
|
||||
* 医保等级
|
||||
*/
|
||||
private Integer chrgitmLv;
|
||||
private String chrgitmLv_enumText;
|
||||
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 患者id
|
||||
*/
|
||||
private String patientId;
|
||||
|
||||
/**
|
||||
* 医嘱项目打印列表
|
||||
*/
|
||||
private List<AdviceItemPrintInfoDto> adviceItemList;
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.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.List;
|
||||
|
||||
/**
|
||||
* 库存项目dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InventoryItemDto {
|
||||
|
||||
/** 项目类型 */
|
||||
private Integer itemType; // 1:药品 , 2: 耗材 , 3:诊疗
|
||||
private String itemType_enumText;
|
||||
|
||||
/**
|
||||
* 药品/耗材类型
|
||||
*/
|
||||
private String categoryCode;
|
||||
|
||||
/** 拆零比 */
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 采购单价 */
|
||||
private BigDecimal purchaseAmount;
|
||||
|
||||
/** 项目定义ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long definitionId;
|
||||
|
||||
/** 项目名称 */
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String itemBusNo;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 商品名称 */
|
||||
private String productName;
|
||||
|
||||
/** 包装单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 最小单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String minUnitCode;
|
||||
private String minUnitCode_dictText;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
private String volume;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
private String supplier;
|
||||
|
||||
/**
|
||||
* 生产厂家
|
||||
*/
|
||||
private String manufacturerText;
|
||||
|
||||
/**
|
||||
* 项目对应表名
|
||||
*/
|
||||
private String itemTableName;
|
||||
|
||||
/**
|
||||
* 产品批号
|
||||
*/
|
||||
private String lotNumber;
|
||||
|
||||
/** 原仓库 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long orgLocation;
|
||||
|
||||
/**
|
||||
* 单位列表
|
||||
*/
|
||||
private List<UnitDto> unitList;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 库存项目筛选条件
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-19
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InventoryItemParam {
|
||||
|
||||
/** 项目类型 */
|
||||
private Integer itemType; // 1:药品 , 2: 耗材 , 3:诊疗
|
||||
|
||||
/** 项目id */
|
||||
private Long itemId;
|
||||
|
||||
/** 项目名称 */
|
||||
private String name;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/** 源仓库 */
|
||||
private Long orgLocationId;
|
||||
|
||||
/** 目的仓库 */
|
||||
private Long objLocationId;
|
||||
|
||||
/** 采购标志 */
|
||||
private Integer purchaseFlag;
|
||||
|
||||
/**
|
||||
* 产品批号
|
||||
*/
|
||||
private String lotNumber;
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 位置 dto
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-02-20
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LocationDto {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String busNo;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 状态编码
|
||||
*/
|
||||
private Integer statusEnum;
|
||||
|
||||
/**
|
||||
* 操作状态
|
||||
*/
|
||||
private Integer operationalEnum;
|
||||
|
||||
/**
|
||||
* 模式编码
|
||||
*/
|
||||
private Integer modeEnum;
|
||||
|
||||
/**
|
||||
* 功能编码
|
||||
*/
|
||||
private String typeJson;
|
||||
|
||||
/**
|
||||
* 拼音码
|
||||
*/
|
||||
private String pyStr;
|
||||
|
||||
/**
|
||||
* 五笔码
|
||||
*/
|
||||
private String wbStr;
|
||||
|
||||
/**
|
||||
* 物理形式枚举
|
||||
*/
|
||||
private Integer formEnum;
|
||||
|
||||
/**
|
||||
* 机构编码
|
||||
*/
|
||||
private Long organizationId;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
private Integer displayOrder;
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 库存项目所在对应库房信息
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LocationInventoryDto {
|
||||
|
||||
/** 物理表名 */
|
||||
private String itemTable;
|
||||
|
||||
/** 实例id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/** 采购单价 */
|
||||
private BigDecimal price;
|
||||
|
||||
/** 产品批号 */
|
||||
private String lotNumber;
|
||||
|
||||
/** 生产日期 */
|
||||
private Date productionDate;
|
||||
|
||||
/** 失效日期 */
|
||||
private Date expirationDate;
|
||||
|
||||
/** 仓库类型 */
|
||||
private String formEnum;
|
||||
|
||||
/** 库位 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationStoreId;
|
||||
|
||||
/** 仓库 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 库房名称 */
|
||||
private String locationName;
|
||||
|
||||
/** 货位名称 */
|
||||
private String locationStoreName;
|
||||
|
||||
/** 原仓库数量(最小单位) */
|
||||
private BigDecimal orgQuantity;
|
||||
|
||||
/** 目的仓库数量(最小单位) */
|
||||
private BigDecimal objQuantity;
|
||||
|
||||
/** 供应商id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long supplierId;
|
||||
|
||||
/** 供应商名称 */
|
||||
private String supplierName;
|
||||
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 生产厂家 */
|
||||
private String manufacturerText;
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 执行信息dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-08-13
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PerformInfoDto {
|
||||
|
||||
/** 请求id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/** 发放id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long dispenseId;
|
||||
|
||||
/** 请求所在表 */
|
||||
private String requestTable;
|
||||
|
||||
/** 执行位置 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 分组id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long groupId;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 执行记录dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-08-14
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PerformRecordDto {
|
||||
|
||||
/** 执行id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long procedureId;
|
||||
|
||||
/** 执行状态 */
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 预计执行时间 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date occurrenceTime;
|
||||
|
||||
/** 实际执行时间 */
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date recordedTime;
|
||||
|
||||
/** 执行位置 */
|
||||
private String locationName;
|
||||
|
||||
/** 执行科室 */
|
||||
private String orgName;
|
||||
|
||||
/** 项目id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestId;
|
||||
|
||||
/** 执行开始时间 */
|
||||
private Date startTime;
|
||||
|
||||
/** 执行结束时间 */
|
||||
private Date endTime;
|
||||
|
||||
/** 执行人 */
|
||||
private String practitionerName;
|
||||
|
||||
/** 取消执行id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long refundId;
|
||||
|
||||
/** 操作时间 */
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 参与者dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PractitionerInfoDto {
|
||||
|
||||
/**
|
||||
* 参与者id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long practitionerId;
|
||||
|
||||
/**
|
||||
* 参与者名称
|
||||
*/
|
||||
private String practitionerName;
|
||||
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
private String organizationName;
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 追溯码查询条件
|
||||
*
|
||||
* @author yuxj
|
||||
* @date 2025-07-10
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SearchTraceNoParam {
|
||||
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
private Integer itemType; // 1:药品 , 2: 耗材 , 3:诊疗
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 药房药库
|
||||
*/
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 产品批号
|
||||
*/
|
||||
private String lotNumber;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 单位列表
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UnitDto {
|
||||
|
||||
|
||||
/** 包装单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 最小单位 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String minUnitCode;
|
||||
private String minUnitCode_dictText;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 单位数量列表
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UnitQuantityDto {
|
||||
|
||||
/** 当前库存数量(最小单位) */
|
||||
private BigDecimal minQuantity;
|
||||
|
||||
/** 当前库存数量(包装单位) */
|
||||
private BigDecimal maxQuantity;
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.common.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.administration.domain.TraceNoManage;
|
||||
import com.openhis.web.common.dto.*;
|
||||
import com.openhis.web.pharmacymanage.dto.InventoryDetailDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* app常用接口 mapper
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Repository
|
||||
public interface CommonAppMapper {
|
||||
|
||||
/**
|
||||
* 查询库存项目信息
|
||||
*
|
||||
* @param page 分页
|
||||
* @param medicationTableName 药品表名
|
||||
* @param deviceTableName 耗材表名
|
||||
* @param purchaseFlag 是否入库
|
||||
* @param purchase 命中条件:采购
|
||||
* @param retired 停用
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 库存项目信息
|
||||
*/
|
||||
IPage<InventoryItemDto> selectInventoryItemList(@Param("page") Page<InventoryItemDto> page,
|
||||
@Param("medicationTableName") String medicationTableName, @Param("deviceTableName") String deviceTableName,
|
||||
@Param("medicine") Integer medicine, @Param("device") Integer device,
|
||||
@Param("purchaseFlag") Integer purchaseFlag, @Param("purchase") String purchase,
|
||||
@Param("retired") Integer retired, @Param(Constants.WRAPPER) QueryWrapper<InventoryItemParam> queryWrapper);
|
||||
|
||||
/**
|
||||
* 查询项目库存相关信息
|
||||
*
|
||||
* @param itemId 项目id
|
||||
* @param lotNumber 批号
|
||||
* @param orgLocationId 源仓库
|
||||
* @param objLocationId 目的仓库
|
||||
* @param purchase 价格命中条件:采购
|
||||
* @return 项目库存相关信息
|
||||
*/
|
||||
List<LocationInventoryDto> selectInventoryItemInfo(@Param("orgLocationId") Long orgLocationId,
|
||||
@Param("medicationTableName") String medicationTableName, @Param("deviceTableName") String deviceTableName,
|
||||
@Param("objLocationId") Long objLocationId, @Param("lotNumber") String lotNumber, @Param("itemId") Long itemId,
|
||||
@Param("purchase") String purchase);
|
||||
|
||||
/**
|
||||
* 查询追溯码信息
|
||||
*
|
||||
* @param traceNo 追溯码
|
||||
* @return
|
||||
*/
|
||||
TraceNoManage getInfoByTraceNo(@Param("traceNo") String traceNo);
|
||||
|
||||
/**
|
||||
* 查询参与者下拉列表
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @return 参与者下拉列表
|
||||
*/
|
||||
List<PractitionerInfoDto> getPractitionerList(@Param("searchKey") String searchKey);
|
||||
|
||||
/**
|
||||
* 查询处方打印信息
|
||||
*
|
||||
* @param requestIds 请求ids
|
||||
* @return 处方打印信息
|
||||
*/
|
||||
AdvicePrintInfoDto selectPrescriptionPrintInfo(@Param("requestIds") List<Long> requestIds);
|
||||
|
||||
/**
|
||||
* 查询处置打印信息
|
||||
*
|
||||
* @param requestIds 请求ids
|
||||
* @return 处置打印信息
|
||||
*/
|
||||
AdvicePrintInfoDto selectTreatmentPrintInfo(@Param("requestIds") List<Long> requestIds);
|
||||
|
||||
/**
|
||||
* 查询参与者签名
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
* @return 参与者签名
|
||||
*/
|
||||
String getPractitionerSignature(@Param("practitionerId") Long practitionerId);
|
||||
|
||||
/**
|
||||
* 查询所有诊疗项目
|
||||
*
|
||||
* @param statusEnum 启用状态
|
||||
* @return 诊疗项目
|
||||
*/
|
||||
List<ActivityDefinitionDto> getActivityDefinition(@Param("statusEnum") Integer statusEnum);
|
||||
|
||||
/**
|
||||
* 查询药品库存详细信息
|
||||
*
|
||||
* @param medicationIdList 药品id列表
|
||||
* @param locationIdList 库房id列表
|
||||
* @param active 库存状态:启用
|
||||
* @return 库存详细信息
|
||||
*/
|
||||
List<InventoryDetailDto> selectMedicineInventoryDetail(@Param("medicationIdList") List<Long> medicationIdList,
|
||||
@Param("locationIdList") List<Long> locationIdList, @Param("active") Integer active);
|
||||
|
||||
/**
|
||||
* 查询耗材库存详细信息
|
||||
*
|
||||
* @param deviceIdList 耗材id列表
|
||||
* @param locationIdList 库房id列表
|
||||
* @param active 库存状态:启用
|
||||
* @return 库存详细信息
|
||||
*/
|
||||
List<InventoryDetailDto> selectDeviceInventoryDetail(@Param("deviceIdList") List<Long> deviceIdList,
|
||||
@Param("locationIdList") List<Long> locationIdList, @Param("active") Integer active);
|
||||
}
|
||||
Reference in New Issue
Block a user