发药代码格式修改

This commit is contained in:
Zhang.WH
2025-03-28 13:43:04 +08:00
parent 5d538e714f
commit f81a553c21
24 changed files with 358 additions and 368 deletions

View File

@@ -1,5 +1,9 @@
package com.openhis.administration.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -7,9 +11,6 @@ import com.openhis.administration.domain.Organization;
import com.openhis.administration.mapper.OrganizationMapper;
import com.openhis.administration.service.IOrganizationService;
import com.openhis.common.enums.AccountStatus;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 机构管理Service业务层处理
@@ -55,7 +56,7 @@ public class OrganizationServiceImpl extends ServiceImpl<OrganizationMapper, Org
*/
@Override
public List<Organization> getList(Integer classEnum) {
return baseMapper.selectList(new LambdaQueryWrapper<Organization>().select(Organization::getId, Organization::getName)
.eq(Organization::getClassEnum, classEnum));
return baseMapper.selectList(new LambdaQueryWrapper<Organization>()
.select(Organization::getId, Organization::getName).eq(Organization::getClassEnum, classEnum));
}
}

View File

@@ -16,8 +16,8 @@ public interface IPaymentReconciliationService extends IService<PaymentReconcili
/**
* 根据支付id获取对应收费项目的id列表
*
* @param paymentId 支付id
* @param paymentIdList 支付id列表
* @return 收费项目的id列表
*/
List<Long> getChargeItemIdListByPayment(Long paymentId);
List<Long> getChargeItemIdListByPayment(List<Long> paymentIdList);
}

View File

@@ -1,5 +1,6 @@
package com.openhis.financial.service.impl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -30,21 +31,28 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
/**
* 根据支付id获取对应收费项目的id列表
*
* @param paymentId 支付id
* @param paymentIdList 支付id列表
* @return 收费项目的id列表
*/
@Override
public List<Long> getChargeItemIdListByPayment(Long paymentId) {
public List<Long> getChargeItemIdListByPayment(List<Long> paymentIdList) {
// 根据支付id获取支付信息
PaymentReconciliation paymentReconciliation =
paymentReconciliationMapper.selectOne(new LambdaQueryWrapper<PaymentReconciliation>()
.select(PaymentReconciliation::getChargeItemIds).eq(PaymentReconciliation::getId, paymentId));
if (paymentReconciliation == null) {
List<PaymentReconciliation> paymentReconciliationList =
paymentReconciliationMapper.selectList(new LambdaQueryWrapper<PaymentReconciliation>()
.select(PaymentReconciliation::getChargeItemIds).in(PaymentReconciliation::getId, paymentIdList));
if (paymentReconciliationList.isEmpty()) {
return null;
}
// 拆解所有的chargeItemId拼装成一个集合
List<String> chargeItemIdList = paymentReconciliationList.stream().map(PaymentReconciliation::getChargeItemIds)
.collect(Collectors.toList());
List<Long> chargeItemIds = new ArrayList<>();
for (String chargeItemId : chargeItemIdList) {
chargeItemIds.addAll(Arrays.stream(chargeItemId.split(CommonConstants.Common.COMMA)).map(Long::parseLong)
.collect(Collectors.toList()));
}
// 将收费项目集合转换成列表
return Arrays.stream(paymentReconciliation.getChargeItemIds().split(CommonConstants.Common.COMMA))
.map(Long::parseLong).collect(Collectors.toList());
return chargeItemIds;
}
}

View File

@@ -1,7 +1,10 @@
package com.openhis.medication.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.openhis.medication.domain.MedicationDispense;
import com.openhis.medication.domain.MedicationRequest;
/**
* 药品发放管理Service接口
@@ -11,4 +14,10 @@ import com.openhis.medication.domain.MedicationDispense;
*/
public interface IMedicationDispenseService extends IService<MedicationDispense> {
/**
* 新增草稿状态的药品发放信息
*
* @param medicationRequestList 药品请求信息
*/
void addMedicationDispense(List<MedicationRequest> medicationRequestList);
}

View File

@@ -1,9 +1,14 @@
package com.openhis.medication.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.core.common.utils.DateUtils;
import com.openhis.common.enums.DispenseStatus;
import com.openhis.medication.domain.MedicationDispense;
import com.openhis.medication.domain.MedicationRequest;
import com.openhis.medication.mapper.MedicationDispenseMapper;
import com.openhis.medication.service.IMedicationDispenseService;
@@ -14,6 +19,59 @@ import com.openhis.medication.service.IMedicationDispenseService;
* @date 2025-02-20
*/
@Service
public class MedicationDispenseServiceImpl extends ServiceImpl<MedicationDispenseMapper, MedicationDispense> implements IMedicationDispenseService {
public class MedicationDispenseServiceImpl extends ServiceImpl<MedicationDispenseMapper, MedicationDispense>
implements IMedicationDispenseService {
/**
* 新增草稿状态的药品发放信息
*
* @param medicationRequestList 药品请求信息
*/
@Override
public void addMedicationDispense(List<MedicationRequest> medicationRequestList) {
for (MedicationRequest medicationRequest : medicationRequestList) {
MedicationDispense medicationDispense = new MedicationDispense();
// 药品发放id
medicationDispense.setBusNo(medicationRequest.getBusNo());
// 药品发放状态
medicationDispense.setStatusEnum(DispenseStatus.DRAFT.getValue());
// 状态变更时间
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
// 发药类型
medicationDispense.setDispenseEnum(medicationRequest.getCategoryEnum());
// 药品编码
medicationDispense.setMedicationId(medicationRequest.getMedicationId());
// 请求数量
medicationDispense.setQuantity(medicationRequest.getQuantity());
// 请求单位编码
medicationDispense.setUnitCode(medicationRequest.getUnitCode());
// 产品批号
medicationDispense.setLotNumber(medicationRequest.getLotNumber());
// 患者id
medicationDispense.setPatientId(medicationRequest.getPatientId());
// 就诊id
medicationDispense.setEncounterId(medicationRequest.getEncounterId());
// 支持用药信息
medicationDispense.setSupportInfo(medicationRequest.getSupportInfo());
// 发药人
medicationDispense.setPractitionerId(medicationRequest.getPractitionerId());
// 发放药房
medicationDispense.setLocationId(medicationRequest.getPerformOrg());
// 药品请求id
medicationDispense.setMedReqId(medicationRequest.getId());
// 已发药数量
medicationDispense.setDispenseQuantity(0);
// 用法
medicationDispense.setMethodCode(medicationRequest.getMethodCode());
// 用药频次
medicationDispense.setFrequencyCode(medicationRequest.getRateCode());
// 单次剂量
medicationDispense.setDose(medicationRequest.getDose());
// 剂量单位
medicationDispense.setDoseUnitCode(medicationRequest.getDoseUnitCode());
// 单次最大剂量
medicationDispense.setMaxUnit(medicationRequest.getMaxDose());
baseMapper.insert(medicationDispense);
}
}
}