docs(release-notes): 添加住院护士站划价功能说明和发版记录

- 新增住院护士站划价服务流程说明文档,详细描述了从参数预处理到结果响应的五大阶段流程
- 包含耗材类医嘱和诊疗活动类医嘱的差异化处理逻辑
- 添加完整的发版内容记录,涵盖新增菜单功能和各模块优化点
- 记录了住院相关功能的新增和门诊业务流程的修复
```
This commit is contained in:
2025-12-25 14:13:14 +08:00
parent 85fcb7c2e2
commit abc0674531
920 changed files with 107068 additions and 14495 deletions

View File

@@ -20,26 +20,32 @@ import com.openhis.web.chargemanage.dto.EncounterPatientPrescriptionDto;
public interface IInpatientChargeAppService {
/**
* 查询就诊患者分页列表
* 门诊收费页面初始化
*
* @return 初始化信息
*/
R<?> inpatientChargeInit();
/**
* 查询住院患者分页列表
*
* @param encounterPatientPageParam 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param request 请求
* @return 就诊患者分页列表
* @return 住院患者分页列表
*/
R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, Integer pageNo,
Integer pageSize, HttpServletRequest request);
/**
* 根据就诊id查询患者处方列表
* 根据就诊id查询患者待结算信息
*
* @param encounterId 就诊id
* @return 患者处方列表
* @return 患者待结算信息
*/
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId, String startTime,
String endTime);
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId);
/**
* 医保转自费
@@ -56,11 +62,4 @@ public interface IInpatientChargeAppService {
* @return 操作结果
*/
R<?> changeToMedicalInsurance(Long encounterId);
/**
* 门诊收费页面初始化
*
* @return 初始化信息
*/
R<?> outpatientChargeInit();
}

View File

@@ -40,6 +40,14 @@ public interface IOutpatientChargeAppService {
*/
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId);
/**
* 根据就诊id查询患者处方列表并新增字段实收金额、应收金额、优惠金额、折扣率
*
* @param encounterId 就诊id
* @return 患者处方列表
*/
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescriptionWithPrice(Long encounterId);
/**
* 医保转自费
*

View File

@@ -3,9 +3,10 @@
*/
package com.openhis.web.chargemanage.appservice.impl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
@@ -21,10 +22,7 @@ import com.openhis.administration.service.IAccountService;
import com.openhis.administration.service.IChargeItemService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.enums.AdministrativeGender;
import com.openhis.common.enums.ChargeItemContext;
import com.openhis.common.enums.ChargeItemStatus;
import com.openhis.common.enums.EncounterClass;
import com.openhis.common.enums.*;
import com.openhis.common.utils.EnumUtils;
import com.openhis.common.utils.HisQueryUtils;
import com.openhis.web.chargemanage.appservice.IInpatientChargeAppService;
@@ -51,33 +49,32 @@ public class InpatientChargeAppServiceImpl implements IInpatientChargeAppService
private IAccountService accountService;
/**
* 门诊收费页面初始化
* 住院结算页面初始化
*
* @return 初始化信息
*/
@Override
public R<?> outpatientChargeInit() {
public R<?> inpatientChargeInit() {
OutpatientInitDto initDto = new OutpatientInitDto();
List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions = new ArrayList<>();
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.PLANNED.getValue(),
ChargeItemStatus.PLANNED.getInfo()));
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLABLE.getInfo()));
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.BILLED.getInfo()));
initDto.setChargeItemStatusOptions(chargeItemStatusOptions);
List<OutpatientInitDto.encounterStatusOption> encounterStatusOptions = new ArrayList<>();
encounterStatusOptions
.add(new OutpatientInitDto.encounterStatusOption(EncounterZyStatus.DISCHARGED_FROM_HOSPITAL.getValue(),
EncounterZyStatus.DISCHARGED_FROM_HOSPITAL.getInfo()));
encounterStatusOptions.add(new OutpatientInitDto.encounterStatusOption(
EncounterZyStatus.ALREADY_SETTLED.getValue(), EncounterZyStatus.ALREADY_SETTLED.getInfo()));
initDto.setEncounterStatusOptions(encounterStatusOptions);
return R.ok(initDto);
}
/**
* 查询就诊患者分页列表
* 查询住院患者分页列表
*
* @param encounterPatientPageParam 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param request 请求
* @return 就诊患者分页列表
* @return 住院患者分页列表
*/
@Override
public R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey,
@@ -90,14 +87,17 @@ public class InpatientChargeAppServiceImpl implements IInpatientChargeAppService
CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.IdCard)),
request);
// 就诊患者分页列表
Page<EncounterPatientPageDto> encounterPatientPage = inpatientChargeAppMapper
.selectEncounterPatientPage(EncounterClass.IMP.getValue(), new Page<>(pageNo, pageSize), queryWrapper);
Page<EncounterPatientPageDto> encounterPatientPage = inpatientChargeAppMapper.selectEncounterPatientPage(
EncounterClass.IMP.getValue(), EncounterZyStatus.DISCHARGED_FROM_HOSPITAL.getValue(),
EncounterZyStatus.ALREADY_SETTLED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDED.getValue(),
AccountType.PERSONAL_CASH_ACCOUNT.getCode(), new Page<>(pageNo, pageSize), queryWrapper);
encounterPatientPage.getRecords().forEach(e -> {
// 性别枚举
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
// 收费状态枚举
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
// 住院状态
e.setEncounterStatus_enumText(EnumUtils.getInfoByValue(EncounterZyStatus.class, e.getEncounterStatus()));
// 计算年龄
e.setAge(e.getBirthDate() != null ? AgeCalculatorUtil.getAge(e.getBirthDate()) : "");
});
@@ -105,36 +105,20 @@ public class InpatientChargeAppServiceImpl implements IInpatientChargeAppService
}
/**
* 根据就诊id查询患者处方列表
* 根据就诊id查询患者待结算信息
*
* @param encounterId 就诊id
* @return 患者处方列表
* @return 患者待结算信息
*/
@Override
public List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId, String startTime,
String endTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
startTime = startTime + "000000";
endTime = endTime + "235959";
Date startDate = null;
Date endDate = null;
try {
startDate = sdf.parse(startTime);
endDate = sdf.parse(endTime);
} catch (ParseException e) {
e.printStackTrace();
}
public List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId) {
List<EncounterPatientPrescriptionDto> prescriptionDtoList =
inpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId,
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(),
ChargeItemContext.DEVICE.getValue(), ChargeItemContext.REGISTER.getValue(),
ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(),
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue(), startDate, endDate);
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue());
prescriptionDtoList.forEach(e -> {
// 收费状态枚举
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));

View File

@@ -68,7 +68,7 @@ public class OutpatientPricingAppServiceImpl implements IOutpatientPricingAppSer
public IPage<AdviceBaseDto> getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId,
Long organizationId, Integer pageNo, Integer pageSize) {
return iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, null,
organizationId, pageNo, pageSize, Whether.YES.getValue(), List.of(1, 2, 3));
organizationId, pageNo, pageSize, Whether.YES.getValue(), List.of(1, 2, 3), null);
}
}

View File

@@ -21,6 +21,7 @@ import com.core.common.utils.AgeCalculatorUtil;
import com.core.common.utils.AssignSeqUtil;
import com.core.common.utils.MessageUtils;
import com.core.common.utils.SecurityUtils;
import com.core.common.utils.bean.BeanUtils;
import com.openhis.administration.domain.ChargeItem;
import com.openhis.administration.service.IChargeItemService;
import com.openhis.common.constant.CommonConstants;
@@ -80,8 +81,9 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
public R<?> outpatientRefundInit() {
OutpatientInitDto initDto = new OutpatientInitDto();
List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions = new ArrayList<>();
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(),
ChargeItemStatus.BILLED.getInfo()));
// 门诊退费页面去掉已收费状态筛选
// chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(),
// ChargeItemStatus.BILLED.getInfo()));
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.REFUNDING.getValue(),
ChargeItemStatus.REFUNDING.getInfo()));
chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.REFUNDED.getValue(),
@@ -122,11 +124,6 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
refundItemList.forEach(e -> {
// 退费状态
e.setRefundStatus_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getRefundStatus()));
// 发放状态
e.setDispenseStatus_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, e.getDispenseStatus()));
// 执行状态
e.setServiceStatus_enumText(EnumUtils.getInfoByValue(RequestStatus.class, e.getServiceStatus()));
});
refundItemList.sort(Comparator.comparing(RefundItemDto::getPaymentId));
return R.ok(refundItemList);
@@ -140,7 +137,6 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
*/
@Override
public R<?> refundPayment(List<RefundItemParam> refundItemList) {
// 未退费用项,生成新的请求发放费用项
List<RefundItemParam> creatList = new ArrayList<>();
for (RefundItemParam param : refundItemList) {
@@ -149,7 +145,7 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
creatList.add(param);
}
}
// todo 半退逻辑需修改
if (!creatList.isEmpty()) {
// 未退费费用项id集合
List<Long> creatChargeItemIdList =
@@ -245,108 +241,232 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
// 退费费用项id集合
List<Long> chargeItemIdList =
refundItemList.stream().map(RefundItemParam::getChargeItemId).collect(Collectors.toList());
// 根据费用项id查询费用项请求发放信息
List<RefundItemDto> chargeItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList,
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE);
List<Long> medDisIdList = new ArrayList<>();
List<Long> devDisIdList = new ArrayList<>();
// 服务请求id集合
List<Long> medReqIdList = new ArrayList<>();
List<Long> devReqIdList = new ArrayList<>();
List<Long> serReqIdList = new ArrayList<>();
// 查询退费项目信息
List<ChargeItem> chargeItemList = chargeItemService.listByIds(chargeItemIdList);
if (chargeItemList != null && !chargeItemList.isEmpty()) {
chargeItemList.forEach(item -> {
switch (item.getServiceTable()) {
case CommonConstants.TableName.MED_MEDICATION_REQUEST -> medReqIdList.add(item.getServiceId());
case CommonConstants.TableName.WOR_DEVICE_REQUEST -> devReqIdList.add(item.getServiceId());
case CommonConstants.TableName.WOR_SERVICE_REQUEST -> serReqIdList.add(item.getServiceId());
}
});
}
// 处理退药申请
if (!medReqIdList.isEmpty()) {
// 药品请求查询
List<MedicationRequest> medicationRequests = medicationRequestService.listByIds(medReqIdList);
// 药品发放查询
List<MedicationDispense> medicationDispenses =
medicationDispenseService.selectByRequestIdList(medReqIdList);
// 根据请求id做map
Map<Long, List<MedicationDispense>> medicationDispenseMap =
medicationDispenses.stream().collect(Collectors.groupingBy(MedicationDispense::getMedReqId));
for (MedicationRequest medicationRequest : medicationRequests) {
// 根据请求匹配发放
List<MedicationDispense> medicationDispenseList = medicationDispenseMap.get(medicationRequest.getId());
// 判断是否是退药流程
boolean isRefundFlow = false;
if (medicationDispenseList != null) {
for (MedicationDispense dispense : medicationDispenseList) {
// 先判断是否包含“已完成/部分完成”的药品,这决定了是走“退药流程”还是“取消流程”
if (DispenseStatus.COMPLETED.getValue().equals(dispense.getStatusEnum())
|| DispenseStatus.PART_COMPLETED.getValue().equals(dispense.getStatusEnum())) {
isRefundFlow = true;
break; // 只要有一条是完成状态,整个单子即视为走退药流程
}
}
}
for (RefundItemDto dto : chargeItemList) {
if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(dto.getServiceTable())) {
// 药品需要先退药
if (DispenseStatus.COMPLETED.getValue().equals(dto.getDispenseStatus())
|| DispenseStatus.PART_COMPLETED.getValue().equals(dto.getDispenseStatus())) {
// 药品请求查询
MedicationRequest medicationRequest = medicationRequestService.getById(dto.getRequestId());
if (isRefundFlow) {
// ==================== 走退药流程 (生成新单据) ====================
// 校验是否重复申请
if (medicationRequest.getRefundMedicineId() != null) {
throw new ServiceException("已申请退药,请勿重复申请");
}
// 生成药品请求(退药)
medicationRequest.setId(null); // 药品请求id
medicationRequest
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4)); // 药品请求编码
medicationRequest.setQuantity(dto.getQuantity().multiply(new BigDecimal("-1"))); // 请求数量
medicationRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
medicationRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
medicationRequest.setRefundMedicineId(dto.getRequestId()); // 退药id
medicationRequest.setPrescriptionNo(String.valueOf("T" + dto.getPrescriptionNo()));
medicationRequestService.save(medicationRequest);
MedicationRequest newRefundRequest = new MedicationRequest();
BeanUtils.copyProperties(medicationRequest, newRefundRequest);
newRefundRequest.setId(null); // 清空ID以新增
newRefundRequest
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 4));
newRefundRequest.setQuantity(medicationRequest.getQuantity().multiply(new BigDecimal("-1"))); // 数量取反
newRefundRequest.setStatusEnum(RequestStatus.CANCELLED.getValue());
newRefundRequest.setRefundMedicineId(medicationRequest.getId()); // 关联原ID
newRefundRequest.setPrescriptionNo("T" + medicationRequest.getPrescriptionNo());
medicationRequestService.save(newRefundRequest);
Long newRequestId = newRefundRequest.getId();
} else {
if (DispenseStatus.STOPPED.getValue().equals(dto.getDispenseStatus())
&& NotPerformedReason.REFUND.getValue().equals(dto.getNotPerformedReason())) {
throw new ServiceException("已申请退药,请勿重复申请");
// 再生成对应的负向发药记录,并关联退药请求
List<MedicationDispense> newDispensesToSave = new ArrayList<>();
for (MedicationDispense originDispense : medicationDispenseList) {
// 只处理已完成或部分完成的记录
if (DispenseStatus.COMPLETED.getValue().equals(originDispense.getStatusEnum())
|| DispenseStatus.PART_COMPLETED.getValue().equals(originDispense.getStatusEnum())) {
MedicationDispense refundDispense = new MedicationDispense();
BeanUtils.copyProperties(originDispense, refundDispense);
refundDispense.setId(null); // ID置空
refundDispense.setDispenseQuantity(BigDecimal.ZERO); // 已退数量
refundDispense.setMedReqId(newRequestId); // 关联退药请求id
refundDispense
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.MEDICATION_DIS_NO.getPrefix(), 4));
// 退药状态
refundDispense.setStatusEnum(DispenseStatus.PENDING_REFUND.getValue());
newDispensesToSave.add(refundDispense);
}
}
// 批量保存新的发药记录
if (!newDispensesToSave.isEmpty()) {
medicationDispenseService.saveBatch(newDispensesToSave);
}
} else {
// ==================== 走直接取消流程 (修改原单据状态) ====================
if (medicationDispenseList != null) {
List<MedicationDispense> dispensesToUpdate = new ArrayList<>();
for (MedicationDispense medicationDispense : medicationDispenseList) {
// 检查是否已经是退药状态
if (DispenseStatus.STOPPED.getValue().equals(medicationDispense.getStatusEnum())
&& NotPerformedReason.REFUND.getValue().equals(medicationDispense.getStatusEnum())) {
throw new ServiceException("已申请退药,请勿重复申请");
}
// 修改状态
medicationDispense.setStatusEnum(DispenseStatus.STOPPED.getValue())
.setNotPerformedReasonEnum(NotPerformedReason.REFUND.getValue());
dispensesToUpdate.add(medicationDispense);
}
// 批量更新
if (!dispensesToUpdate.isEmpty()) {
medicationDispenseService.updateBatchById(dispensesToUpdate);
}
}
}
}
}
// 处理退耗材申请
if (!devReqIdList.isEmpty()) {
// 耗材请求查询
List<DeviceRequest> deviceRequests = deviceRequestService.listByIds(devReqIdList);
// 耗材发放查询
List<DeviceDispense> deviceDispenses = deviceDispenseService.selectByRequestIdList(devReqIdList);
// 根据请求id做map
Map<Long, List<DeviceDispense>> deviceDispenseMap =
deviceDispenses.stream().collect(Collectors.groupingBy(DeviceDispense::getDeviceReqId));
for (DeviceRequest deviceRequest : deviceRequests) {
// 根据请求匹配发放
List<DeviceDispense> deviceDispenseList = deviceDispenseMap.get(deviceRequest.getId());
// 判断是否是退耗材流程
boolean isRefundFlow = false;
if (deviceDispenseList != null) {
for (DeviceDispense dispense : deviceDispenseList) {
// 先判断是否包含“已完成/部分完成”的耗材,这决定了是走“退耗材流程”还是“取消流程”
if (DispenseStatus.COMPLETED.getValue().equals(dispense.getStatusEnum())
|| DispenseStatus.PART_COMPLETED.getValue().equals(dispense.getStatusEnum())) {
isRefundFlow = true;
break; // 只要有一条是完成状态,整个单子即视为走退耗材流程
}
}
medDisIdList.add(dto.getDispenseId());
}
} else if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(dto.getServiceTable())) {
if (isRefundFlow) {
// ==================== 走退耗材流程 (生成新单据) ====================
// 校验是否重复申请
if (deviceRequest.getRefundDeviceId() != null) {
throw new ServiceException("已申请退耗材,请勿重复申请");
}
DeviceRequest newRefundRequest = new DeviceRequest();
BeanUtils.copyProperties(deviceRequest, newRefundRequest);
newRefundRequest.setId(null); // 清空ID以新增
newRefundRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
newRefundRequest.setQuantity(deviceRequest.getQuantity().multiply(new BigDecimal("-1"))); // 数量取反
newRefundRequest.setStatusEnum(RequestStatus.CANCELLED.getValue());
newRefundRequest.setRefundDeviceId(deviceRequest.getId()); // 关联原ID
newRefundRequest.setPrescriptionNo("T" + deviceRequest.getPrescriptionNo());
deviceRequestService.save(newRefundRequest);
Long newRequestId = newRefundRequest.getId();
// 再生成对应的负向发耗材记录,并关联退耗材请求
List<DeviceDispense> newDispensesToSave = new ArrayList<>();
for (DeviceDispense originDispense : deviceDispenseList) {
// 只处理已完成或部分完成的记录
if (DispenseStatus.COMPLETED.getValue().equals(originDispense.getStatusEnum())
|| DispenseStatus.PART_COMPLETED.getValue().equals(originDispense.getStatusEnum())) {
DeviceDispense refundDispense = new DeviceDispense();
BeanUtils.copyProperties(originDispense, refundDispense);
refundDispense.setId(null); // ID置空
refundDispense.setDispenseQuantity(BigDecimal.ZERO); // 已退数量
refundDispense.setDeviceReqId(newRequestId); // 关联退耗材请求id
refundDispense
.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_DIS_NO.getPrefix(), 4));
// 退耗材状态
refundDispense.setStatusEnum(DispenseStatus.PENDING_REFUND.getValue());
newDispensesToSave.add(refundDispense);
}
}
// 批量保存新的发耗材记录
if (!newDispensesToSave.isEmpty()) {
deviceDispenseService.saveBatch(newDispensesToSave);
}
} else {
// ==================== 走直接取消流程 (修改原单据状态) ====================
if (deviceDispenseList != null) {
List<DeviceDispense> dispensesToUpdate = new ArrayList<>();
for (DeviceDispense deviceDispense : deviceDispenseList) {
// 检查是否已经是退耗材状态
if (DispenseStatus.STOPPED.getValue().equals(deviceDispense.getStatusEnum())
&& NotPerformedReason.REFUND.getValue().equals(deviceDispense.getStatusEnum())) {
throw new ServiceException("已申请退耗材,请勿重复申请");
}
// 修改状态
deviceDispense.setStatusEnum(DispenseStatus.STOPPED.getValue())
.setNotPerformedReasonEnum(NotPerformedReason.REFUND.getValue());
dispensesToUpdate.add(deviceDispense);
}
// 批量更新
if (!dispensesToUpdate.isEmpty()) {
deviceDispenseService.updateBatchById(dispensesToUpdate);
}
}
}
}
}
// 处理退诊疗项目申请
// 诊疗申请待更新id列表
List<Long> serReqUpdateList = new ArrayList<>();
if (!serReqIdList.isEmpty()) {
// 查询诊疗申请
List<ServiceRequest> serviceRequestList = serviceRequestService.listByIds(serReqIdList);
for (ServiceRequest serviceRequest : serviceRequestList) {
// 诊疗项目需医技科室同意退费
if (RequestStatus.COMPLETED.getValue().equals(dto.getServiceStatus())) {
// 服务请求查询
ServiceRequest serviceRequest = serviceRequestService.getById(dto.getRequestId());
if (RequestStatus.COMPLETED.getValue().equals(serviceRequest.getStatusEnum())) {
if (serviceRequest.getRefundServiceId() != null) {
throw new ServiceException("已申请退费,请勿重复申请");
}
// 生成服务请求(取消服务)
serviceRequest.setId(null); // 服务请求id
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4)); // 服务请求编码
serviceRequest.setQuantity(dto.getQuantity().multiply(new BigDecimal("-1"))); // 请求数量
serviceRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
serviceRequest.setQuantity(serviceRequest.getQuantity().multiply(new BigDecimal("-1"))); // 请求数量
serviceRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
serviceRequest.setRefundServiceId(dto.getRequestId()); // 退id
serviceRequest.setRefundServiceId(serviceRequest.getId());// 退id
serviceRequest.setId(null); // 服务请求id
serviceRequestService.save(serviceRequest);
} else {
if (RequestStatus.STOPPED.getValue().equals(dto.getServiceStatus())) {
if (RequestStatus.STOPPED.getValue().equals(serviceRequest.getStatusEnum())) {
throw new ServiceException("已申请退费,请勿重复申请");
}
serReqIdList.add(dto.getServiceId());
}
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(dto.getServiceTable())) {
// 耗材需要先退药
if (DispenseStatus.COMPLETED.getValue().equals(dto.getDispenseStatus())
|| DispenseStatus.PART_COMPLETED.getValue().equals(dto.getDispenseStatus())) {
// 耗材请求查询
DeviceRequest deviceRequest = deviceRequestService.getById(dto.getRequestId());
if (deviceRequest.getRefundDeviceId() == null) {
// 生成耗材请求(退耗材)
deviceRequest.setId(null); // 耗材请求id
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); // 耗材请求编码
deviceRequest.setQuantity(dto.getQuantity().multiply(new BigDecimal("-1"))); // 请求数量
deviceRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
deviceRequest.setStatusEnum(RequestStatus.CANCELLED.getValue()); // 请求状态
deviceRequest.setRefundDeviceId(dto.getRequestId()); // 退药id
deviceRequestService.save(deviceRequest);
}
} else if (!DispenseStatus.STOPPED.getValue().equals(dto.getDispenseStatus())) {
devDisIdList.add(dto.getDispenseId());
serReqUpdateList.add(serviceRequest.getId());
}
}
}
// 更新收费状态:退费中
chargeItemService.updateRefundChargeStatus(chargeItemIdList);
if (!medDisIdList.isEmpty()) {
// 更新未发放药品状态:停止发放,停止原因:退费
medicationDispenseService.updateStopDispenseStatus(medDisIdList, NotPerformedReason.REFUND.getValue());
// 更新未执行诊疗状态:停止
if (!serReqUpdateList.isEmpty()) {
serviceRequestService.updateStopRequestStatus(serReqUpdateList);
}
if (!devDisIdList.isEmpty()) {
// 更新未发放耗材状态:停止发放,停止原因:退费
deviceDispenseService.updateStopDispenseStatus(devDisIdList, NotPerformedReason.REFUND.getValue());
}
if (!serReqIdList.isEmpty()) {
// 更新未执行诊疗状态:停止
serviceRequestService.updateStopRequestStatus(serReqIdList);
}
// 返回退费成功信息
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"门诊退费"}));
}

View File

@@ -9,6 +9,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.core.common.core.domain.model.LoginUser;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -228,7 +229,8 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
CancelPaymentDto cancelPaymentDto = new CancelPaymentDto();
BeanUtils.copyProperties(cancelRegPaymentDto, cancelPaymentDto);
//LoginUser loginUser = SecurityUtils.getLoginUser();
//String string1 = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
// 开通医保的处理
if ("1".equals(SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH))
&& account != null && !CommonConstants.BusinessName.DEFAULT_CONTRACT_NO.equals(account.getContractNo())) {

View File

@@ -3,9 +3,9 @@
*/
package com.openhis.web.chargemanage.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.core.common.core.domain.R;
@@ -16,18 +16,18 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 门诊收费 controller
* 住院收费 controller
*
* @author zwh
* @date 2025-03-12
*/
@RestController
@RequestMapping("/charge-manage/inpa-charge")
@RequestMapping("/charge-manage/inpatient-charge")
@Slf4j
@AllArgsConstructor
public class InpatientChargeController {
@Autowired
@Resource
private IInpatientChargeAppService inpatientChargeAppService;
/**
@@ -36,39 +36,38 @@ public class InpatientChargeController {
* @return 初始化信息
*/
@GetMapping(value = "/init")
public R<?> outpatientChargeInit() {
return inpatientChargeAppService.outpatientChargeInit();
public R<?> inpatientChargeInit() {
return inpatientChargeAppService.inpatientChargeInit();
}
/**
* 查询就诊患者分页列表
* 查询住院患者分页列表
*
* @param encounterPatientPageParam 查询条件
* @param searchKey 模糊查询关键字
* @param pageNo 当前页
* @param pageSize 每页多少条
* @param request 请求
* @return 就诊患者分页列表
* @return 住院患者分页列表
*/
@GetMapping(value = "/encounter-patient-page")
public R<?> getEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam,
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return R.ok(inpatientChargeAppService.getEncounterPatientPage(encounterPatientPageParam, searchKey, pageNo,
pageSize, request));
return inpatientChargeAppService.getEncounterPatientPage(encounterPatientPageParam, searchKey, pageNo, pageSize,
request);
}
/**
* 根据就诊id查询患者处方列表
* 根据就诊id查询患者待结算信息
*
* @param encounterId 就诊id
* @return 患者处方列表
* @return 患者待结算信息
*/
@GetMapping(value = "/patient-prescription")
public R<?> getEncounterPatientPrescription(@RequestParam Long encounterId, @RequestParam String startTime,
@RequestParam String endTime) {
return R.ok(inpatientChargeAppService.getEncounterPatientPrescription(encounterId, startTime, endTime));
public R<?> getEncounterPatientPrescription(Long encounterId) {
return R.ok(inpatientChargeAppService.getEncounterPatientPrescription(encounterId));
}
/**

View File

@@ -6,7 +6,6 @@ package com.openhis.web.chargemanage.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.core.common.core.domain.R;
@@ -71,6 +70,17 @@ public class OutpatientChargeController {
return R.ok(outpatientChargeAppService.getEncounterPatientPrescription(encounterId));
}
/**
* 根据就诊id查询患者处方列表并新增字段实收金额、应收金额、优惠金额、折扣率
*
* @param encounterId 就诊id
* @return 患者处方列表
*/
@GetMapping(value = "/patient-prescription-with-price")
public R<?> getEncounterPatientPrescriptionWithPrice(@RequestParam Long encounterId) {
return R.ok(outpatientChargeAppService.getEncounterPatientPrescriptionWithPrice(encounterId));
}
/**
* 医保转自费
*

View File

@@ -11,7 +11,6 @@ import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.openhis.common.annotation.Dict;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -32,6 +31,10 @@ public class EncounterPatientPageDto {
@JsonSerialize(using = ToStringSerializer.class)
private Long encounterId;
/** 住院状态 */
private Integer encounterStatus;
private String encounterStatus_enumText;
/**
* 患者
*/

View File

@@ -67,4 +67,9 @@ public class EncounterPatientPageParam {
* 收费状态
*/
private Integer statusEnum;
/**
* 患者状态
*/
private Integer encounterStatus;
}

View File

@@ -20,6 +20,8 @@ public class OutpatientInitDto {
private List<OutpatientInitDto.chargeItemStatusOption> chargeItemStatusOptions;
private List<OutpatientInitDto.encounterStatusOption> encounterStatusOptions;
/**
* 收费状态
*/
@@ -33,4 +35,18 @@ public class OutpatientInitDto {
this.label = label;
}
}
/**
* 住院状态
*/
@Data
public static class encounterStatusOption {
private Integer value;
private String label;
public encounterStatusOption(Integer value, String label) {
this.value = value;
this.label = label;
}
}
}

View File

@@ -33,4 +33,7 @@ public class PractitionerMetadata {
/** 五笔码 */
private String wbStr;
/** 医生职称 */
private String drProfttlCode;
}

View File

@@ -3,14 +3,15 @@
*/
package com.openhis.web.chargemanage.dto;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.openhis.common.annotation.Dict;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* 退款项目 dto
*

View File

@@ -3,7 +3,6 @@
*/
package com.openhis.web.chargemanage.mapper;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
@@ -28,12 +27,18 @@ public interface InpatientChargeAppMapper {
/**
* 查询就诊患者分页列表
*
* @param classEnum 住院患者类型:住院
* @param dischargedFromHospital 住院状态:已出院
* @param alreadySettled 住院状态:已结算出院
* @param page 分页
* @param queryWrapper 查询条件
* @return 就诊患者分页列表
*/
Page<EncounterPatientPageDto> selectEncounterPatientPage(@Param("classEnum") Integer classEnum,
@Param("page") Page<EncounterPatientPageDto> page,
@Param("dischargedFromHospital") Integer dischargedFromHospital,
@Param("alreadySettled") Integer alreadySettled, @Param("billable") Integer billable,
@Param("billed") Integer billed, @Param("refunded") Integer refunded,
@Param("personalCashAccount") String personalCashAccount, @Param("page") Page<EncounterPatientPageDto> page,
@Param(Constants.WRAPPER) QueryWrapper<EncounterPatientPageParam> queryWrapper);
/**
@@ -56,5 +61,5 @@ public interface InpatientChargeAppMapper {
@Param("activity") Integer activity, @Param("medication") Integer medication, @Param("device") Integer device,
@Param("register") Integer register, @Param("planned") Integer planned, @Param("billable") Integer billable,
@Param("billed") Integer billed, @Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
@Param("partRefund") Integer partRefund, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
@Param("partRefund") Integer partRefund);
}

View File

@@ -57,4 +57,33 @@ public interface OutpatientChargeAppMapper {
@Param("billed") Integer billed, @Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
@Param("partRefund") Integer partRefund);
/**
* 根据就诊id查询患者处方列表并新增字段应收金额实收金额优惠金额折扣率
*
* @param encounterId 就诊id
* @param activity 项目
* @param medication 药品
* @param device 耗材
* @param register 挂号费
* @param planned 收费状态:待收费
* @param billable 收费状态:待结算
* @param billed 收费状态:已结算
* @param refunding 收费状态:退费中
* @param refunded 收费状态:全部退费
* @param partRefund 收费状态:部分退费
* @param discountCode 优惠枚举码
* @param selfCode 现金枚举码
* @param selfVxCode 微信枚举码
* @param selfAliCode 支付宝枚举码
* @param selfUnionCode 银联枚举码
* @return 患者处方列表
*/
List<EncounterPatientPrescriptionDto> selectEncounterPatientPrescriptionWithPrice(
@Param("encounterId") Long encounterId, @Param("activity") Integer activity,
@Param("medication") Integer medication, @Param("device") Integer device, @Param("register") Integer register,
@Param("planned") Integer planned, @Param("billable") Integer billable, @Param("billed") Integer billed,
@Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
@Param("partRefund") Integer partRefund, @Param("discountCode") Integer discountCode,
@Param("self") Integer selfCode, @Param("selfVx") Integer selfVxCode, @Param("selfAli") Integer selfAliCode,
@Param("selfUnion") Integer selfUnionCode);
}