发药代码格式修改
This commit is contained in:
@@ -4,22 +4,18 @@
|
|||||||
package com.openhis.web.chargemanage.appservice.impl;
|
package com.openhis.web.chargemanage.appservice.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import com.openhis.web.chargemanage.dto.RefundItemDto;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.core.common.utils.MessageUtils;
|
|
||||||
import com.openhis.administration.domain.ChargeItem;
|
|
||||||
import com.openhis.administration.service.IChargeItemService;
|
import com.openhis.administration.service.IChargeItemService;
|
||||||
import com.openhis.common.constant.CommonConstants;
|
import com.openhis.common.constant.CommonConstants;
|
||||||
import com.openhis.common.constant.PromptMsgConstant;
|
|
||||||
import com.openhis.common.enums.PaymentStatus;
|
import com.openhis.common.enums.PaymentStatus;
|
||||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||||
import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService;
|
import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService;
|
||||||
import com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto;
|
import com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto;
|
||||||
|
import com.openhis.web.chargemanage.dto.RefundItemDto;
|
||||||
import com.openhis.web.chargemanage.mapper.OutpatientRefundAppMapper;
|
import com.openhis.web.chargemanage.mapper.OutpatientRefundAppMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,28 +57,19 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
|||||||
@Override
|
@Override
|
||||||
public R<?> refundPayment(List<Long> paymentIdList) {
|
public R<?> refundPayment(List<Long> paymentIdList) {
|
||||||
|
|
||||||
List<RefundItemDto> refundItemList = outpatientRefundAppMapper.selectRefundItem(paymentIdList, CommonConstants.TableName.MED_MEDICATION_REQUEST,
|
|
||||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
|
||||||
CommonConstants.Common.THREE);
|
|
||||||
|
|
||||||
// 医生同意退费
|
// 医生同意退费
|
||||||
// 查询所有的chargeid,对应生成一个负的chargeitem
|
// 查询所有的chargeid,对应生成一个负的chargeitem
|
||||||
// 根据每个 chargeitem判断对应的服务,药品,耗材是否已发放执行
|
// 根据每个 chargeitem判断对应的服务,药品,耗材是否已发放执行
|
||||||
// 若已发放/执行需要对应的发药人/执行人审批(药品耗材需要先退药)
|
// 若已发放/执行需要对应的发药人/执行人审批(药品耗材需要先退药)
|
||||||
for (Long paymentId : paymentIdList) {
|
|
||||||
// 根据支付id获取对应收费项目的id列表
|
// 根据支付id获取对应收费项目的id列表
|
||||||
List<Long> chargeItemIdList = paymentReconciliationService.getChargeItemIdListByPayment(paymentId);
|
List<Long> chargeItemIdList = paymentReconciliationService.getChargeItemIdListByPayment(paymentIdList);
|
||||||
if (chargeItemIdList == null) {
|
|
||||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据收费项目id列表获取收费信息
|
//根据收费项目id列表查询退费项
|
||||||
List<ChargeItem> chargeItemList = chargeItemService.getChargeItemInfo(chargeItemIdList);
|
List<RefundItemDto> refundItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList,
|
||||||
|
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||||
|
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE);
|
||||||
|
|
||||||
List<String> prescriptionNoList =
|
|
||||||
chargeItemList.stream().map(ChargeItem::getPrescriptionNo).collect(Collectors.toList());
|
|
||||||
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,14 +36,14 @@ public interface OutpatientRefundAppMapper {
|
|||||||
/**
|
/**
|
||||||
* 查询退费项目
|
* 查询退费项目
|
||||||
*
|
*
|
||||||
* @param paymentIdList 支付编号列表
|
* @param chargeItemIdList 收费项列表
|
||||||
* @param medMedicationRequest 药品请求表
|
* @param medMedicationRequest 药品请求表
|
||||||
* @param worServiceRequest 服务请求表
|
* @param worServiceRequest 服务请求表
|
||||||
* @param worDeviceRequest 耗材请求表
|
* @param worDeviceRequest 耗材请求表
|
||||||
* @param three 用于字符截位
|
* @param three 用于字符截位
|
||||||
* @return 退费项目列表
|
* @return 退费项目列表
|
||||||
*/
|
*/
|
||||||
List<RefundItemDto> selectRefundItem(@Param("paymentIdList") List<Long> paymentIdList,
|
List<RefundItemDto> selectRefundItem(@Param("chargeItemIdList") List<Long> chargeItemIdList,
|
||||||
@Param("medMedicationRequest") String medMedicationRequest,
|
@Param("medMedicationRequest") String medMedicationRequest,
|
||||||
@Param("worServiceRequest") String worServiceRequest, @Param("worDeviceRequest") String worDeviceRequest,
|
@Param("worServiceRequest") String worServiceRequest, @Param("worDeviceRequest") String worDeviceRequest,
|
||||||
@Param("three") Integer three);
|
@Param("three") Integer three);
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.openhis.web.pharmacymanage.appservice;
|
|
||||||
|
|
||||||
import com.openhis.medication.domain.MedicationRequest;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增药品发放草稿 应用实现接口
|
|
||||||
*
|
|
||||||
* @author wangyang
|
|
||||||
* @date 2025/3/14
|
|
||||||
*/
|
|
||||||
public interface IDispenseAddAppService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增药品发放草稿
|
|
||||||
*
|
|
||||||
* @param medicationRequestList
|
|
||||||
* @return 无
|
|
||||||
*/
|
|
||||||
boolean addMedicationDispense(List<MedicationRequest> medicationRequestList);
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.openhis.web.pharmacymanage.appservice;
|
package com.openhis.web.pharmacymanage.appservice;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处方管理 应用实现接口
|
* 处方管理 应用实现接口
|
||||||
*
|
*
|
||||||
@@ -29,14 +29,12 @@ public interface IWesternMedicineDispenseAppService {
|
|||||||
* @param request 请求数据
|
* @param request 请求数据
|
||||||
* @return 就诊病人分页列表
|
* @return 就诊病人分页列表
|
||||||
*/
|
*/
|
||||||
R<?> getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam,
|
R<?> getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, Integer pageNo, Integer pageSize,
|
||||||
Integer pageNo,
|
|
||||||
Integer pageSize,
|
|
||||||
HttpServletRequest request);
|
HttpServletRequest request);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询处方单列表
|
* 查询处方单列表
|
||||||
|
*
|
||||||
* @param encounterId 就诊号
|
* @param encounterId 就诊号
|
||||||
* @return 处方单列表
|
* @return 处方单列表
|
||||||
*/
|
*/
|
||||||
@@ -44,18 +42,18 @@ public interface IWesternMedicineDispenseAppService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 处方单核对发药
|
* 处方单核对发药
|
||||||
|
*
|
||||||
* @param prescriptionNo 处方号
|
* @param prescriptionNo 处方号
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
*/
|
*/
|
||||||
R<?> medicineDispense(String prescriptionNo);
|
R<?> medicineDispense(String prescriptionNo);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处方单作废
|
* 处方单作废
|
||||||
|
*
|
||||||
* @param prescriptionNo 处方号
|
* @param prescriptionNo 处方号
|
||||||
* @param notPerformedReasonEnum 未发药原因
|
* @param notPerformedReasonEnum 未发药原因
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
*/
|
*/
|
||||||
R<?> medicineCancel(String prescriptionNo,
|
R<?> medicineCancel(String prescriptionNo, Integer notPerformedReasonEnum);
|
||||||
Integer notPerformedReasonEnum);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
|
||||||
|
|
||||||
import com.core.common.utils.DateUtils;
|
|
||||||
import com.openhis.common.enums.DispenseStatusEnum;
|
|
||||||
import com.openhis.medication.domain.MedicationDispense;
|
|
||||||
import com.openhis.medication.domain.MedicationRequest;
|
|
||||||
import com.openhis.medication.service.IMedicationDispenseService;
|
|
||||||
import com.openhis.web.pharmacymanage.appservice.IDispenseAddAppService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 西药发放 应用实现类
|
|
||||||
*
|
|
||||||
* @author wangyang
|
|
||||||
* @date 2025/3/14
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class IDispenseAddAppServiceImpl implements IDispenseAddAppService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
IMedicationDispenseService iMedicationDispenseService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增药品发放草稿
|
|
||||||
*
|
|
||||||
* @param medicationRequestList 药品请求数据
|
|
||||||
* @return 无
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean addMedicationDispense(List<MedicationRequest> medicationRequestList) {
|
|
||||||
|
|
||||||
List<MedicationDispense> medicationDispenseList = new ArrayList<>();
|
|
||||||
MedicationDispense medicationDispense;
|
|
||||||
|
|
||||||
for (MedicationRequest medicationRequest : medicationRequestList) {
|
|
||||||
|
|
||||||
medicationDispense = new MedicationDispense();
|
|
||||||
|
|
||||||
// 药品发放id
|
|
||||||
medicationDispense.setBusNo(medicationRequest.getBusNo());
|
|
||||||
// 药品发放状态
|
|
||||||
medicationDispense.setStatusEnum(DispenseStatusEnum.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(0L);
|
|
||||||
// 发放药房
|
|
||||||
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());
|
|
||||||
|
|
||||||
medicationDispenseList.add(medicationDispense);
|
|
||||||
}
|
|
||||||
return iMedicationDispenseService.saveBatch(medicationDispenseList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,19 @@
|
|||||||
package com.openhis.web.pharmacymanage.appservice.impl;
|
package com.openhis.web.pharmacymanage.appservice.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
@@ -9,7 +23,7 @@ import com.core.common.utils.SecurityUtils;
|
|||||||
import com.openhis.administration.domain.Organization;
|
import com.openhis.administration.domain.Organization;
|
||||||
import com.openhis.administration.service.IOrganizationService;
|
import com.openhis.administration.service.IOrganizationService;
|
||||||
import com.openhis.common.constant.PromptMsgConstant;
|
import com.openhis.common.constant.PromptMsgConstant;
|
||||||
import com.openhis.common.enums.DispenseStatusEnum;
|
import com.openhis.common.enums.DispenseStatus;
|
||||||
import com.openhis.common.enums.NotPerformedReasonEnum;
|
import com.openhis.common.enums.NotPerformedReasonEnum;
|
||||||
import com.openhis.common.enums.OrganizationClass;
|
import com.openhis.common.enums.OrganizationClass;
|
||||||
import com.openhis.common.utils.HisQueryUtils;
|
import com.openhis.common.utils.HisQueryUtils;
|
||||||
@@ -20,18 +34,6 @@ import com.openhis.web.pharmacymanage.dto.*;
|
|||||||
import com.openhis.web.pharmacymanage.mapper.WesternMedicineDispenseMapper;
|
import com.openhis.web.pharmacymanage.mapper.WesternMedicineDispenseMapper;
|
||||||
import com.openhis.workflow.domain.InventoryItem;
|
import com.openhis.workflow.domain.InventoryItem;
|
||||||
import com.openhis.workflow.service.IInventoryItemService;
|
import com.openhis.workflow.service.IInventoryItemService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 西药发放 应用实现类
|
* 西药发放 应用实现类
|
||||||
@@ -40,7 +42,7 @@ import java.util.stream.Stream;
|
|||||||
* @date 2025/3/14
|
* @date 2025/3/14
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineDispenseAppService {
|
public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDispenseAppService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IOrganizationService iOrganizationService;
|
private IOrganizationService iOrganizationService;
|
||||||
@@ -67,14 +69,15 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
// 获取科室下拉选列表
|
// 获取科室下拉选列表
|
||||||
List<Organization> organizationList = iOrganizationService.getList(OrganizationClass.CLINIC.getValue());
|
List<Organization> organizationList = iOrganizationService.getList(OrganizationClass.CLINIC.getValue());
|
||||||
List<PageInitDto.DepartmentOption> organizationOptions = organizationList.stream()
|
List<PageInitDto.DepartmentOption> organizationOptions = organizationList.stream()
|
||||||
.map(organization -> new PageInitDto.DepartmentOption(organization.getId(),
|
.map(organization -> new PageInitDto.DepartmentOption(organization.getId(), organization.getName()))
|
||||||
organization.getName())).collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// 未发药原因下拉选列表
|
// 未发药原因下拉选列表
|
||||||
List<PageInitDto.NotPerformedReasonOption> notPerformedReasonOptions =
|
List<PageInitDto.NotPerformedReasonOption> notPerformedReasonOptions =
|
||||||
Stream.of(NotPerformedReasonEnum.values()).map(notPerformedReason ->
|
Stream.of(NotPerformedReasonEnum.values())
|
||||||
new PageInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
|
.map(notPerformedReason -> new PageInitDto.NotPerformedReasonOption(notPerformedReason.getValue(),
|
||||||
notPerformedReason.getInfo())).collect(Collectors.toList());
|
notPerformedReason.getInfo()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions);
|
initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions);
|
||||||
return R.ok(initDto);
|
return R.ok(initDto);
|
||||||
@@ -90,10 +93,8 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
* @return 就诊病人列表
|
* @return 就诊病人列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam,
|
public R<?> getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, Integer pageNo,
|
||||||
Integer pageNo,
|
Integer pageSize, HttpServletRequest request) {
|
||||||
Integer pageSize,
|
|
||||||
HttpServletRequest request) {
|
|
||||||
|
|
||||||
// 查询条件设定
|
// 查询条件设定
|
||||||
String condition = encounterInfoSearchParam.getCondition();
|
String condition = encounterInfoSearchParam.getCondition();
|
||||||
@@ -109,14 +110,15 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
HisQueryUtils.buildQueryWrapper(encounterInfoSearchParam, null, null, request);
|
HisQueryUtils.buildQueryWrapper(encounterInfoSearchParam, null, null, request);
|
||||||
|
|
||||||
// 查询就诊病人列表
|
// 查询就诊病人列表
|
||||||
Page<EncounterInfoPageDto> encounterInfoPageDto = westernMedicineDispenseMapper.selectEncounterInfoListPage(
|
Page<EncounterInfoPageDto> encounterInfoPageDto =
|
||||||
new Page<>(pageNo, pageSize), queryWrapper);
|
westernMedicineDispenseMapper.selectEncounterInfoListPage(new Page<>(pageNo, pageSize), queryWrapper);
|
||||||
|
|
||||||
return R.ok(encounterInfoPageDto);
|
return R.ok(encounterInfoPageDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询处方单列表
|
* 查询处方单列表
|
||||||
|
*
|
||||||
* @param encounterId 就诊号
|
* @param encounterId 就诊号
|
||||||
* @return 处方单列表
|
* @return 处方单列表
|
||||||
*/
|
*/
|
||||||
@@ -124,12 +126,12 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
public R<?> getPrescriptionInfo(Long encounterId) {
|
public R<?> getPrescriptionInfo(Long encounterId) {
|
||||||
|
|
||||||
// 患者基本信息查询
|
// 患者基本信息查询
|
||||||
PrescriptionPatientInfoDto prescriptionPatientInfoDto = westernMedicineDispenseMapper.
|
PrescriptionPatientInfoDto prescriptionPatientInfoDto =
|
||||||
selectPrescriptionPatientInfo(encounterId);
|
westernMedicineDispenseMapper.selectPrescriptionPatientInfo(encounterId);
|
||||||
|
|
||||||
// 处方单信息查询
|
// 处方单信息查询
|
||||||
List<PrescriptionMedicineInfoDto> prescriptionMedicineInfoList = westernMedicineDispenseMapper.
|
List<PrescriptionMedicineInfoDto> prescriptionMedicineInfoList =
|
||||||
selectPrescriptionMedicineInfoList(encounterId);
|
westernMedicineDispenseMapper.selectPrescriptionMedicineInfoList(encounterId);
|
||||||
|
|
||||||
// 计算合计金额
|
// 计算合计金额
|
||||||
if (!prescriptionMedicineInfoList.isEmpty()) {
|
if (!prescriptionMedicineInfoList.isEmpty()) {
|
||||||
@@ -149,6 +151,7 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 处方单核对发药
|
* 处方单核对发药
|
||||||
|
*
|
||||||
* @param prescriptionNo 处方号
|
* @param prescriptionNo 处方号
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
*/
|
*/
|
||||||
@@ -161,8 +164,8 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
boolean iInventoryItemUpdFlg = true;
|
boolean iInventoryItemUpdFlg = true;
|
||||||
|
|
||||||
// 获取药品待发放和库存信息
|
// 获取药品待发放和库存信息
|
||||||
List<DispenseInventoryDto> dispenseInventoryList = westernMedicineDispenseMapper.
|
List<DispenseInventoryDto> dispenseInventoryList =
|
||||||
selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo);
|
westernMedicineDispenseMapper.selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo);
|
||||||
if (!dispenseInventoryList.isEmpty()) {
|
if (!dispenseInventoryList.isEmpty()) {
|
||||||
MedicationDispense medicationDispense;
|
MedicationDispense medicationDispense;
|
||||||
InventoryItem inventoryItem;
|
InventoryItem inventoryItem;
|
||||||
@@ -173,7 +176,7 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
// id
|
// id
|
||||||
medicationDispense.setId(dispenseInventoryDto.getDispenseId());
|
medicationDispense.setId(dispenseInventoryDto.getDispenseId());
|
||||||
// 药品发放状态
|
// 药品发放状态
|
||||||
medicationDispense.setStatusEnum(DispenseStatusEnum.COMPLETED.getValue());
|
medicationDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue());
|
||||||
// 状态变更时间
|
// 状态变更时间
|
||||||
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
medicationDispense.setStatusChangedTime(DateUtils.getNowDate());
|
||||||
// 发药人
|
// 发药人
|
||||||
@@ -189,23 +192,23 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
// 库存表项目设定
|
// 库存表项目设定
|
||||||
inventoryItem = new InventoryItem();
|
inventoryItem = new InventoryItem();
|
||||||
// 库存数量
|
// 库存数量
|
||||||
if (dispenseInventoryDto.getDispenseUnitCode().equals(dispenseInventoryDto.
|
if (dispenseInventoryDto.getDispenseUnitCode()
|
||||||
getInventoryBaseUnitCode())) {
|
.equals(dispenseInventoryDto.getInventoryBaseUnitCode())) {
|
||||||
|
|
||||||
// id
|
// id
|
||||||
inventoryItem.setId(dispenseInventoryDto.getInventoryId());
|
inventoryItem.setId(dispenseInventoryDto.getInventoryId());
|
||||||
// 包装数量
|
// 包装数量
|
||||||
inventoryItem.setBaseQuantity(new BigDecimal(dispenseInventoryDto.getDispenseQuantity()));
|
inventoryItem.setBaseQuantity(new BigDecimal(dispenseInventoryDto.getDispenseQuantity()));
|
||||||
// 拆零数量(拆零比×包装数量)
|
// 拆零数量(拆零比×包装数量)
|
||||||
inventoryItem.setMinQuantity(dispenseInventoryDto.getPartPercent().
|
inventoryItem.setMinQuantity(dispenseInventoryDto.getPartPercent()
|
||||||
multiply(new BigDecimal(dispenseInventoryDto.getDispenseQuantity())));
|
.multiply(new BigDecimal(dispenseInventoryDto.getDispenseQuantity())));
|
||||||
} else if (dispenseInventoryDto.getDispenseUnitCode().equals(dispenseInventoryDto.
|
} else if (dispenseInventoryDto.getDispenseUnitCode()
|
||||||
getInventoryMinUnitCode())) {
|
.equals(dispenseInventoryDto.getInventoryMinUnitCode())) {
|
||||||
// 拆零数量
|
// 拆零数量
|
||||||
inventoryItem.setMinQuantity(new BigDecimal(dispenseInventoryDto.getDispenseQuantity()));
|
inventoryItem.setMinQuantity(new BigDecimal(dispenseInventoryDto.getDispenseQuantity()));
|
||||||
// 包装数量(拆零数量÷拆零比)
|
// 包装数量(拆零数量÷拆零比)
|
||||||
inventoryItem.setBaseQuantity(new BigDecimal(dispenseInventoryDto.getDispenseQuantity()).
|
inventoryItem.setBaseQuantity(new BigDecimal(dispenseInventoryDto.getDispenseQuantity())
|
||||||
divide(dispenseInventoryDto.getPartPercent(),RoundingMode.HALF_UP));
|
.divide(dispenseInventoryDto.getPartPercent(), RoundingMode.HALF_UP));
|
||||||
}
|
}
|
||||||
inventoryItemList.add(inventoryItem);
|
inventoryItemList.add(inventoryItem);
|
||||||
}
|
}
|
||||||
@@ -215,27 +218,27 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
// 库存更新
|
// 库存更新
|
||||||
iInventoryItemUpdFlg = iInventoryItemService.updateBatchById(inventoryItemList);
|
iInventoryItemUpdFlg = iInventoryItemService.updateBatchById(inventoryItemList);
|
||||||
}
|
}
|
||||||
return iMedicationDispenseUpdFlg && iInventoryItemUpdFlg ?
|
return iMedicationDispenseUpdFlg && iInventoryItemUpdFlg
|
||||||
R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作废
|
* 作废
|
||||||
|
*
|
||||||
* @param prescriptionNo 处方号
|
* @param prescriptionNo 处方号
|
||||||
* @param notPerformedReasonEnum 未发药原因
|
* @param notPerformedReasonEnum 未发药原因
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> medicineCancel(String prescriptionNo,
|
public R<?> medicineCancel(String prescriptionNo, Integer notPerformedReasonEnum) {
|
||||||
Integer notPerformedReasonEnum) {
|
|
||||||
|
|
||||||
List<MedicationDispense> medicationDispenseList = new ArrayList<>();
|
List<MedicationDispense> medicationDispenseList = new ArrayList<>();
|
||||||
boolean iMedicationDispenseUpdFlg = true;
|
boolean iMedicationDispenseUpdFlg = true;
|
||||||
|
|
||||||
// 获取药品待发放记录
|
// 获取药品待发放记录
|
||||||
List<DispenseInventoryDto> dispenseInventoryList = westernMedicineDispenseMapper.
|
List<DispenseInventoryDto> dispenseInventoryList =
|
||||||
selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo);
|
westernMedicineDispenseMapper.selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo);
|
||||||
if (!dispenseInventoryList.isEmpty()) {
|
if (!dispenseInventoryList.isEmpty()) {
|
||||||
MedicationDispense medicationDispense;
|
MedicationDispense medicationDispense;
|
||||||
for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) {
|
for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) {
|
||||||
@@ -245,7 +248,7 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
// id
|
// id
|
||||||
medicationDispense.setId(dispenseInventoryDto.getDispenseId());
|
medicationDispense.setId(dispenseInventoryDto.getDispenseId());
|
||||||
// 药品发放状态
|
// 药品发放状态
|
||||||
medicationDispense.setStatusEnum(DispenseStatusEnum.DECLINED.getValue());
|
medicationDispense.setStatusEnum(DispenseStatus.DECLINED.getValue());
|
||||||
// 未发药原因
|
// 未发药原因
|
||||||
medicationDispense.setNotPerformedReasonEnum(notPerformedReasonEnum);
|
medicationDispense.setNotPerformedReasonEnum(notPerformedReasonEnum);
|
||||||
// 状态变更时间
|
// 状态变更时间
|
||||||
@@ -257,8 +260,7 @@ public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineD
|
|||||||
// 药品发放更新
|
// 药品发放更新
|
||||||
iMedicationDispenseUpdFlg = iMedicationDispenseService.updateBatchById(medicationDispenseList);
|
iMedicationDispenseUpdFlg = iMedicationDispenseService.updateBatchById(medicationDispenseList);
|
||||||
}
|
}
|
||||||
return iMedicationDispenseUpdFlg?
|
return iMedicationDispenseUpdFlg ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||||
R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
|
||||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
package com.openhis.web.pharmacymanage.controller;
|
package com.openhis.web.pharmacymanage.controller;
|
||||||
|
|
||||||
import com.core.common.core.domain.R;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService;
|
|
||||||
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import com.core.common.core.domain.R;
|
||||||
|
import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService;
|
||||||
|
import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 西药发药
|
* 西药发药
|
||||||
@@ -50,10 +52,9 @@ public class WesternMedicineDispenseController {
|
|||||||
@GetMapping("/encounter-list")
|
@GetMapping("/encounter-list")
|
||||||
public R<?> getEncounterInfoList(EncounterInfoSearchParam encounterInfoSearchParam,
|
public R<?> getEncounterInfoList(EncounterInfoSearchParam encounterInfoSearchParam,
|
||||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||||
HttpServletRequest request) {
|
return iWesternMedicineDispenseService.getEncounterInfoListPage(encounterInfoSearchParam, pageNo, pageSize,
|
||||||
return iWesternMedicineDispenseService.getEncounterInfoListPage(encounterInfoSearchParam,
|
request);
|
||||||
pageNo, pageSize, request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,6 +67,8 @@ public class WesternMedicineDispenseController {
|
|||||||
return iWesternMedicineDispenseService.getPrescriptionInfo(encounterId);
|
return iWesternMedicineDispenseService.getPrescriptionInfo(encounterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo:配药逻辑
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 核对发药
|
* 核对发药
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.pharmacymanage.dto;
|
package com.openhis.web.pharmacymanage.dto;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 药品发放和库存表连接信息
|
* 药品发放和库存表连接信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.pharmacymanage.dto;
|
package com.openhis.web.pharmacymanage.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 就诊人员列表
|
* 就诊人员列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.pharmacymanage.dto;
|
package com.openhis.web.pharmacymanage.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处方列表查询条件
|
* 处方列表查询条件
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.pharmacymanage.dto;
|
package com.openhis.web.pharmacymanage.dto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author wangyang
|
* @author wangyang
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.pharmacymanage.dto;
|
package com.openhis.web.pharmacymanage.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处方信息
|
* 处方信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.pharmacymanage.dto;
|
package com.openhis.web.pharmacymanage.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 就诊人员列表
|
* 就诊人员列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.pharmacymanage.dto;
|
package com.openhis.web.pharmacymanage.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 患者基本信息
|
* 患者基本信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -3,20 +3,22 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.pharmacymanage.mapper;
|
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.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.openhis.web.pharmacymanage.dto.*;
|
import com.openhis.web.pharmacymanage.dto.*;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface WesternMedicineDispenseMapper {
|
public interface WesternMedicineDispenseMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 就诊病人列表分页查询
|
* 就诊病人列表分页查询
|
||||||
|
*
|
||||||
* @param page 分页
|
* @param page 分页
|
||||||
* @param queryWrapper 查询条件
|
* @param queryWrapper 查询条件
|
||||||
* @return 就诊病人列表
|
* @return 就诊病人列表
|
||||||
@@ -26,14 +28,15 @@ public interface WesternMedicineDispenseMapper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 患者基本信息查询
|
* 患者基本信息查询
|
||||||
|
*
|
||||||
* @param encounterId 就诊号
|
* @param encounterId 就诊号
|
||||||
* @return 患者基本信息
|
* @return 患者基本信息
|
||||||
*/
|
*/
|
||||||
PrescriptionPatientInfoDto selectPrescriptionPatientInfo(@Param("encounterId") Long encounterId);
|
PrescriptionPatientInfoDto selectPrescriptionPatientInfo(@Param("encounterId") Long encounterId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处方单查询
|
* 处方单查询
|
||||||
|
*
|
||||||
* @param encounterId 就诊号
|
* @param encounterId 就诊号
|
||||||
* @return 处方单列表
|
* @return 处方单列表
|
||||||
*/
|
*/
|
||||||
@@ -41,8 +44,10 @@ public interface WesternMedicineDispenseMapper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 待发药和库存信息查询
|
* 待发药和库存信息查询
|
||||||
|
*
|
||||||
* @param prescriptionNo 处方号
|
* @param prescriptionNo 处方号
|
||||||
* @return 待发药信息
|
* @return 待发药信息
|
||||||
*/
|
*/
|
||||||
List<DispenseInventoryDto> selectDispenseInventoryInfoByPrescriptionNo(@Param("prescriptionNo") String prescriptionNo);
|
List<DispenseInventoryDto>
|
||||||
|
selectDispenseInventoryInfoByPrescriptionNo(@Param("prescriptionNo") String prescriptionNo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,47 +24,46 @@
|
|||||||
AND T1.delete_flag = '0'
|
AND T1.delete_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
<select id="selectRefundItem" resultType="com.openhis.web.chargemanage.dto.RefundItemDto">
|
<select id="selectRefundItem" resultType="com.openhis.web.chargemanage.dto.RefundItemDto">
|
||||||
SELECT T1.*,
|
SELECT (T1.discount_amount + T2.surcharge_amount) AS pay_amount,
|
||||||
T2.name AS service_name
|
T2.bus_no,
|
||||||
FROM fin_payment_reconciliation AS T1
|
T2.prescription_no,
|
||||||
LEFT JOIN adm_charge_item AS T2
|
T2.quantity,
|
||||||
ON T2.id IN T1.charge_item_ids
|
T2.medication_id AS item_id,
|
||||||
LEFT JOIN med_medication_request AS T3
|
T2.unit_code,
|
||||||
ON T3.bus_no = SUBSTRING(T2.bus_no, #{three})
|
T3.status_enum
|
||||||
LEFT JOIN med_medication_dispense AS T4
|
FROM adm_charge_item AS T1
|
||||||
ON T4.med_req_id = T3.id
|
LEFT JOIN med_medication_request AS T2
|
||||||
WHERE T2.service_table = #{medMedicationRequest}
|
ON T2.bus_no = SUBSTRING(T1.bus_no, #{three})
|
||||||
|
LEFT JOIN med_medication_dispense AS T3
|
||||||
|
ON T3.med_req_id = T2.id
|
||||||
|
WHERE T1.service_table = #{medMedicationRequest}
|
||||||
AND T1.id IN
|
AND T1.id IN
|
||||||
<foreach collection="paymentIdList" item="paymentId" separator="," open="(" close=")">
|
<foreach collection="chargeItemIdList" item="chargeItemId" separator="," open="(" close=")">
|
||||||
#{paymentId}
|
#{chargeItemId}
|
||||||
</foreach>
|
</foreach>
|
||||||
UNION ALL
|
UNION
|
||||||
SELECT T1.*,
|
SELECT T1.*,
|
||||||
T2.name AS service_name
|
T2.name AS service_name
|
||||||
FROM fin_payment_reconciliation AS T1
|
FROM adm_charge_item AS T1
|
||||||
LEFT JOIN adm_charge_item AS T2
|
LEFT JOIN wor_device_request AS T4
|
||||||
ON T2.id IN T1.charge_item_ids
|
ON T4.bus_no = SUBSTRING(T1.bus_no, #{three})
|
||||||
LEFT JOIN wor_device_request AS T5
|
LEFT JOIN wor_device_dispense AS T5
|
||||||
ON T6.bus_no = SUBSTRING(T2.bus_no, #{three})
|
ON T5.device_req_id = T4.id
|
||||||
LEFT JOIN wor_device_dispense AS T6
|
WHERE T1.service_table = #{worDeviceRequest}
|
||||||
ON T6.device_req_id = T5.id
|
|
||||||
WHERE T2.service_table = #{worDeviceRequest}
|
|
||||||
AND T1.id IN
|
AND T1.id IN
|
||||||
<foreach collection="paymentIdList" item="paymentId" separator="," open="(" close=")">
|
<foreach collection="chargeItemIdList" item="chargeItemId" separator="," open="(" close=")">
|
||||||
#{paymentId}
|
#{chargeItemId}
|
||||||
</foreach>
|
</foreach>
|
||||||
UNION ALL
|
UNION
|
||||||
SELECT T1.*,
|
SELECT T1.*,
|
||||||
T2.name AS service_name
|
T2.name AS service_name
|
||||||
FROM fin_payment_reconciliation AS T1
|
FROM adm_charge_item AS T1
|
||||||
LEFT JOIN adm_charge_item AS T2
|
LEFT JOIN wor_service_request AS T6
|
||||||
ON T2.id IN T1.charge_item_ids
|
ON T6.bus_no = SUBSTRING(T1.bus_no, #{three})
|
||||||
LEFT JOIN wor_service_request AS T7
|
WHERE T1.service_table = #{worServiceRequest}
|
||||||
ON T7.bus_no = SUBSTRING(T2.bus_no, #{three})
|
|
||||||
WHERE T2.service_table = #{worServiceRequest}
|
|
||||||
AND T1.id IN
|
AND T1.id IN
|
||||||
<foreach collection="paymentIdList" item="paymentId" separator="," open="(" close=")">
|
<foreach collection="chargeItemIdList" item="chargeItemId" separator="," open="(" close=")">
|
||||||
#{paymentId}
|
#{chargeItemId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package com.openhis.common.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 药品请求状态
|
||||||
|
*
|
||||||
|
* @author wangyang
|
||||||
|
* @date 2025-03-14
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum DispenseStatus implements HisEnumInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 草稿
|
||||||
|
*/
|
||||||
|
DRAFT(1, "DR", "草稿"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待配药
|
||||||
|
*/
|
||||||
|
PREPARATION(2, "PR", "待配药"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待发药
|
||||||
|
*/
|
||||||
|
IN_PROGRESS(3, "IN", "待发药"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已发药
|
||||||
|
*/
|
||||||
|
COMPLETED(4, "CO", "已发药"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂停
|
||||||
|
*/
|
||||||
|
ON_HOLD(5, "ON", "暂停"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止
|
||||||
|
*/
|
||||||
|
STOPPED(6, "ST", "停止"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拒绝发药
|
||||||
|
*/
|
||||||
|
DECLINED(7, "DE", "拒绝发药 已退药"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已汇总
|
||||||
|
*/
|
||||||
|
SUMMARIZED(8, "SR", "已汇总"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部分发药
|
||||||
|
*/
|
||||||
|
PART_COMPLETED(9, "PC", "部分发药"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部分退药
|
||||||
|
*/
|
||||||
|
PART_REFUND(10, "PR", "部分退药"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退药中
|
||||||
|
*/
|
||||||
|
IN_REFUND(11, "IR", "退药中"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已退药
|
||||||
|
*/
|
||||||
|
REFUNDED(12, "RE", "已退药"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未知
|
||||||
|
*/
|
||||||
|
UNKNOWN(13, "UN", "未知");
|
||||||
|
|
||||||
|
private Integer value;
|
||||||
|
private String code;
|
||||||
|
private String info;
|
||||||
|
|
||||||
|
public static DispenseStatus getByValue(Integer value) {
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (DispenseStatus val : values()) {
|
||||||
|
if (val.getValue().equals(value)) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
package com.openhis.common.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 药品请求状态
|
|
||||||
*
|
|
||||||
* @author wangyang
|
|
||||||
* @date 2025-03-14
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum DispenseStatusEnum implements HisEnumInterface {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 草稿
|
|
||||||
*/
|
|
||||||
DRAFT(0, "DR", "草稿"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 待配药
|
|
||||||
*/
|
|
||||||
PREPARATION(1, "PR", "待配药"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 待发药
|
|
||||||
*/
|
|
||||||
IN_PROGRESS(2, "IN", "待发药"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 已发药
|
|
||||||
*/
|
|
||||||
COMPLETED(3, "CO", "已发药"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 暂停
|
|
||||||
*/
|
|
||||||
ON_HOLD(4, "ON", "暂停"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 停止
|
|
||||||
*/
|
|
||||||
STOPPED(5, "ST", "停止"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 未知
|
|
||||||
*/
|
|
||||||
UNKNOWN(6, "UN", "未知"),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拒绝发药 已汇总,部分发药,部分退药,已退药
|
|
||||||
*/
|
|
||||||
DECLINED(7, "DE", "拒绝发药 已汇总,部分发药,部分退药,已退药");
|
|
||||||
|
|
||||||
private Integer value;
|
|
||||||
private String code;
|
|
||||||
private String info;
|
|
||||||
|
|
||||||
public static DispenseStatusEnum getByValue(Integer value) {
|
|
||||||
if (value == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (DispenseStatusEnum val : values()) {
|
|
||||||
if (val.getValue().equals(value)) {
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,37 +23,42 @@ public enum RequestStatus implements HisEnumInterface {
|
|||||||
/**
|
/**
|
||||||
* 已发送
|
* 已发送
|
||||||
*/
|
*/
|
||||||
COMPLETED(2, "completed", "已发送"),
|
ACTIVE(2, "active", "已发送"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已完成
|
||||||
|
*/
|
||||||
|
COMPLETED(3, "completed", "已完成"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 暂停
|
* 暂停
|
||||||
*/
|
*/
|
||||||
ON_HOLD(3, "on_hold", "暂停"),
|
ON_HOLD(4, "on_hold", "暂停"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 撤回
|
* 撤回
|
||||||
*/
|
*/
|
||||||
CANCELLED(4, "cancelled", "撤回"),
|
CANCELLED(5, "cancelled", "撤回"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停止
|
* 停止
|
||||||
*/
|
*/
|
||||||
STOPPED(5, "stopped", "停止"),
|
STOPPED(6, "stopped", "停止"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 不可用
|
* 不可用
|
||||||
*/
|
*/
|
||||||
ENDED(6, "ended", "不可用"),
|
ENDED(7, "ended", "不可用"),
|
||||||
|
|
||||||
/**
|
|
||||||
* 未知
|
|
||||||
*/
|
|
||||||
UNKNOWN(7, "unknown", "未知"),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 已汇总
|
* 已汇总
|
||||||
*/
|
*/
|
||||||
SUMMARIZED(8, "summarized", "已汇总");
|
SUMMARIZED(8, "summarized", "已汇总"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未知
|
||||||
|
*/
|
||||||
|
UNKNOWN(9, "unknown", "未知");
|
||||||
|
|
||||||
@EnumValue
|
@EnumValue
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package com.openhis.administration.service.impl;
|
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.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
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.mapper.OrganizationMapper;
|
||||||
import com.openhis.administration.service.IOrganizationService;
|
import com.openhis.administration.service.IOrganizationService;
|
||||||
import com.openhis.common.enums.AccountStatus;
|
import com.openhis.common.enums.AccountStatus;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机构管理Service业务层处理
|
* 机构管理Service业务层处理
|
||||||
@@ -55,7 +56,7 @@ public class OrganizationServiceImpl extends ServiceImpl<OrganizationMapper, Org
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Organization> getList(Integer classEnum) {
|
public List<Organization> getList(Integer classEnum) {
|
||||||
return baseMapper.selectList(new LambdaQueryWrapper<Organization>().select(Organization::getId, Organization::getName)
|
return baseMapper.selectList(new LambdaQueryWrapper<Organization>()
|
||||||
.eq(Organization::getClassEnum, classEnum));
|
.select(Organization::getId, Organization::getName).eq(Organization::getClassEnum, classEnum));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,8 +16,8 @@ public interface IPaymentReconciliationService extends IService<PaymentReconcili
|
|||||||
/**
|
/**
|
||||||
* 根据支付id获取对应收费项目的id列表
|
* 根据支付id获取对应收费项目的id列表
|
||||||
*
|
*
|
||||||
* @param paymentId 支付id
|
* @param paymentIdList 支付id列表
|
||||||
* @return 收费项目的id列表
|
* @return 收费项目的id列表
|
||||||
*/
|
*/
|
||||||
List<Long> getChargeItemIdListByPayment(Long paymentId);
|
List<Long> getChargeItemIdListByPayment(List<Long> paymentIdList);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.openhis.financial.service.impl;
|
package com.openhis.financial.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -30,21 +31,28 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
|
|||||||
/**
|
/**
|
||||||
* 根据支付id获取对应收费项目的id列表
|
* 根据支付id获取对应收费项目的id列表
|
||||||
*
|
*
|
||||||
* @param paymentId 支付id
|
* @param paymentIdList 支付id列表
|
||||||
* @return 收费项目的id列表
|
* @return 收费项目的id列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Long> getChargeItemIdListByPayment(Long paymentId) {
|
public List<Long> getChargeItemIdListByPayment(List<Long> paymentIdList) {
|
||||||
|
|
||||||
// 根据支付id获取支付信息
|
// 根据支付id获取支付信息
|
||||||
PaymentReconciliation paymentReconciliation =
|
List<PaymentReconciliation> paymentReconciliationList =
|
||||||
paymentReconciliationMapper.selectOne(new LambdaQueryWrapper<PaymentReconciliation>()
|
paymentReconciliationMapper.selectList(new LambdaQueryWrapper<PaymentReconciliation>()
|
||||||
.select(PaymentReconciliation::getChargeItemIds).eq(PaymentReconciliation::getId, paymentId));
|
.select(PaymentReconciliation::getChargeItemIds).in(PaymentReconciliation::getId, paymentIdList));
|
||||||
if (paymentReconciliation == null) {
|
if (paymentReconciliationList.isEmpty()) {
|
||||||
return null;
|
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))
|
return chargeItemIds;
|
||||||
.map(Long::parseLong).collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.openhis.medication.service;
|
package com.openhis.medication.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.openhis.medication.domain.MedicationDispense;
|
import com.openhis.medication.domain.MedicationDispense;
|
||||||
|
import com.openhis.medication.domain.MedicationRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 药品发放管理Service接口
|
* 药品发放管理Service接口
|
||||||
@@ -11,4 +14,10 @@ import com.openhis.medication.domain.MedicationDispense;
|
|||||||
*/
|
*/
|
||||||
public interface IMedicationDispenseService extends IService<MedicationDispense> {
|
public interface IMedicationDispenseService extends IService<MedicationDispense> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增草稿状态的药品发放信息
|
||||||
|
*
|
||||||
|
* @param medicationRequestList 药品请求信息
|
||||||
|
*/
|
||||||
|
void addMedicationDispense(List<MedicationRequest> medicationRequestList);
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
package com.openhis.medication.service.impl;
|
package com.openhis.medication.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.core.common.utils.DateUtils;
|
||||||
|
import com.openhis.common.enums.DispenseStatus;
|
||||||
import com.openhis.medication.domain.MedicationDispense;
|
import com.openhis.medication.domain.MedicationDispense;
|
||||||
|
import com.openhis.medication.domain.MedicationRequest;
|
||||||
import com.openhis.medication.mapper.MedicationDispenseMapper;
|
import com.openhis.medication.mapper.MedicationDispenseMapper;
|
||||||
import com.openhis.medication.service.IMedicationDispenseService;
|
import com.openhis.medication.service.IMedicationDispenseService;
|
||||||
|
|
||||||
@@ -14,6 +19,59 @@ import com.openhis.medication.service.IMedicationDispenseService;
|
|||||||
* @date 2025-02-20
|
* @date 2025-02-20
|
||||||
*/
|
*/
|
||||||
@Service
|
@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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user