From a4e26d416b495156e5925c0abb78e180a9ac3f09 Mon Sep 17 00:00:00 2001 From: "Zhang.WH" Date: Mon, 17 Mar 2025 13:48:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=97=A8=E8=AF=8A=E9=80=80?= =?UTF-8?q?=E8=B4=B9=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IOutpatientRefundAppService.java | 33 ++++++++ .../impl/OutpatientRefundAppServiceImpl.java | 58 ++++++++++++++ .../OutpatientRefundController.java | 54 +++++++++++++ .../dto/EncounterPatientPaymentDto.java | 78 +++++++++++++++++++ .../mapper/OutpatientRefundAppMapper.java | 34 ++++++++ .../OutpatientChargeAppMapper.xml | 1 + .../OutpatientRefundAppMapper.xml | 27 +++++++ .../openhis/common/enums/PaymentStatus.java | 64 +++++++++++++++ .../domain/PaymentReconciliation.java | 4 +- .../medication/domain/MedicationDispense.java | 7 ++ .../medication/domain/MedicationRequest.java | 3 + .../workflow/domain/DeviceDispense.java | 9 +++ .../workflow/domain/DeviceRequest.java | 6 +- 13 files changed, 374 insertions(+), 4 deletions(-) create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPaymentDto.java create mode 100644 openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java create mode 100644 openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml create mode 100644 openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentStatus.java diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java new file mode 100644 index 00000000..9386da1c --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java @@ -0,0 +1,33 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.chargemanage.appservice; + +import com.core.common.core.domain.R; + +import java.util.List; + +/** + * 门诊退费 service + * + * @author zwh + * @date 2025-03-15 + */ +public interface IOutpatientRefundAppService { + + /** + * 根据就诊id查询患者的账单 + * + * @param encounterId 就诊id + * @return 患者账单列表 + */ + R getEncounterPatientPayment(Long encounterId); + + /** + * 根据账单退费 + * + * @param paymentIdList 付费id列表 + * @return 操作结果 + */ + R refundPayment(List paymentIdList); +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java new file mode 100644 index 00000000..33f8bbec --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java @@ -0,0 +1,58 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.chargemanage.appservice.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.core.common.core.domain.R; +import com.openhis.common.enums.PaymentStatus; +import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService; +import com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto; +import com.openhis.web.chargemanage.mapper.OutpatientRefundAppMapper; + +/** + * 门诊退费 impl + * + * @author zwh + * @date 2025-03-15 + */ +@Service +public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppService { + + @Autowired + private OutpatientRefundAppMapper outpatientRefundAppMapper; + + /** + * 根据就诊id查询患者的账单 + * + * @param encounterId 就诊id + * @return 患者账单列表 + */ + @Override + public R getEncounterPatientPayment(Long encounterId) { + List patientPaymentList = + outpatientRefundAppMapper.selectEncounterPatientPayment(encounterId, PaymentStatus.SUCCESS.getValue(), + PaymentStatus.REFUND_ALL.getValue(), PaymentStatus.REFUND_PART.getValue()); + return R.ok(patientPaymentList); + } + + /** + * 根据账单退费 + * + * @param paymentIdList 付费id列表 + * @return 操作结果 + */ + @Override + public R refundPayment(List paymentIdList) { + + // 医生同意退费 + // 查询所有的chargeid,对应生成一个负的chargeitem + // 根据每个 chargeitem判断对应的服务,药品,耗材是否已发放执行 + // 若已发放/执行需要对应的发药人/执行人审批(药品耗材需要先退药) + return null; + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java new file mode 100644 index 00000000..174d080b --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java @@ -0,0 +1,54 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.chargemanage.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import com.core.common.core.domain.R; +import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService; + +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; + +/** + * 门诊退费 controller + * + * @author zwh + * @date 2025-03-15 + */ +@RestController +@RequestMapping("/charge-manage/refund") +@Slf4j +@AllArgsConstructor +public class OutpatientRefundController { + + @Autowired + private IOutpatientRefundAppService outpatientRefundAppService; + + /** + * 根据就诊id查询患者的账单 + * + * @param encounterId 就诊id + * @return 患者账单列表 + */ + @GetMapping(value = "/patient-payment") + public R getEncounterPatientPayment(@RequestParam Long encounterId) { + return R.ok(outpatientRefundAppService.getEncounterPatientPayment(encounterId)); + } + + /** + * 根据账单退费 + * + * @param paymentIdList 付费id列表 + * @return 操作结果 + */ + @PostMapping(value = "/refund-payment") + public R refundPayment(@RequestParam List paymentIdList) { + return R.ok(outpatientRefundAppService.refundPayment(paymentIdList)); + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPaymentDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPaymentDto.java new file mode 100644 index 00000000..18a4365a --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPaymentDto.java @@ -0,0 +1,78 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.chargemanage.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +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; + +/** + * 就诊患者账单 dto + * + * @author zwh + * @date 2025-03-17 + */ +@Data +@Accessors(chain = true) +public class EncounterPatientPaymentDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** ID */ + @TableId(type = IdType.ASSIGN_ID) + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** 就诊ID */ + private Long encounterId; + + /** 处方号 */ + private String prescriptionNo; + + /** 关联账户ID */ + private Long accountId; + + /** 状态 */ + private Integer statusEnum; + + /** 关联ID */ + private Long relationId; + + /** 支付的业务标识符 */ + private String paymentNo; + + /** 付款类别 */ + private Integer paymentEnum; + + /** 支付位置 */ + @Dict(dictTable = "adm_location", dictText = "name", dictCode = "id") + private Long locationId; + + /** 到期时间 */ + private Date expirationDate; + + /** 应收金额 */ + private BigDecimal tenderedAmount; + + /** 找零金额 */ + private BigDecimal returnedAmount; + + /** 付款总额 */ + private BigDecimal displayAmount; + + /** 合同编码 */ + private String contractNo; + + /** 处方号集合 */ + private String chargeItemIds; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java new file mode 100644 index 00000000..5d564943 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java @@ -0,0 +1,34 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.chargemanage.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto; + +/** + * 门诊退费 appMapper + * + * @author zwh + * @date 2025-03-15 + */ +@Repository +public interface OutpatientRefundAppMapper { + + /** + * 获取就诊患者账单列表 + * + * @param encounterId 就诊id + * @param success 支付状态:成功 + * @param refundAll 支付状态:全部退款 + * @param refundPart 支付状态:部分退款 + * @return 就诊患者账单列表 + */ + List selectEncounterPatientPayment(@Param("encounterId") Long encounterId, + @Param("success") Integer success, @Param("refundAll") Integer refundAll, + @Param("refundPart") Integer refundPart); +} diff --git a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml index ca811321..9595d9ab 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml @@ -72,6 +72,7 @@ ON T1.context_enum = #{device} AND T1.product_id = T4.id WHERE T1.encounter_id = #{encounterId} + AND T1.status_enum IN (1 , 2 , 5) AND T1.delete_flag = '0' \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml new file mode 100644 index 00000000..fe75422f --- /dev/null +++ b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml @@ -0,0 +1,27 @@ + + + + + + \ No newline at end of file diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentStatus.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentStatus.java new file mode 100644 index 00000000..eef6c839 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentStatus.java @@ -0,0 +1,64 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 支付状态 + * + * @author zwh + * @date 2025-03-17 + */ +@Getter +@AllArgsConstructor +public enum PaymentStatus { + + /** + * 草稿 + */ + DRAFT(0, "0", "草稿"), + + /** + * 支付成功 + */ + SUCCESS(1, "1", "支付成功"), + + /** + * 支付取消 + */ + CANCEL(2, "2", "支付取消"), + + /** + * 全部退款 + */ + REFUND_ALL(3, "3", "全部退款"), + + /** + * 部分退款 + */ + REFUND_PART(4, "4", "部分退款"), + + /** + * 错误 + */ + ERROR(9, "9", "错误"); + + private Integer value; + private String code; + private String info; + + public static PaymentStatus getByValue(Integer value) { + if (value == null) { + return null; + } + for (PaymentStatus val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java index f1a3c6cc..a331f6c5 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java @@ -41,7 +41,7 @@ public class PaymentReconciliation extends HisBaseEntity { private Integer paymentEnum; /** 付款实体ID */ - private Long paypmentReconciliationId; + private Long paymentReconciliationId; /** 发起支付的工作流程类别 */ private Integer kindEnum; @@ -83,7 +83,7 @@ public class PaymentReconciliation extends HisBaseEntity { private String contractNo; /** 处方号集合 */ - private String chargeItemJson; + private String chargeItemIds; /** 就诊ID */ private Long encounterId; diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDispense.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDispense.java index ed23db70..445ba148 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDispense.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDispense.java @@ -106,5 +106,12 @@ public class MedicationDispense extends HisBaseEntity { /** 单次最大剂量 */ private BigDecimal maxUnit; + /** 发放数量 */ + private Integer quantity; + /** 发放单位 */ + private String unitCode; + + /** 产品批号 */ + private String lotNumber; } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationRequest.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationRequest.java index 78dca966..3aaf1c80 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationRequest.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationRequest.java @@ -46,6 +46,9 @@ public class MedicationRequest extends HisBaseEntity { /** 请求单位编码 */ private String unitCode; + /** 产品批号 */ + private String lotNumber; + /** 请求合计(元) */ private BigDecimal displayAmount; diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/DeviceDispense.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/DeviceDispense.java index ed365ab0..092cd570 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/DeviceDispense.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/DeviceDispense.java @@ -43,6 +43,15 @@ public class DeviceDispense extends HisBaseEntity { /** 发药类型 */ private Integer dispenseCategoryEnum; + /** 发放数量 */ + private Integer quantity; + + /** 发放单位 */ + private String unitCode; + + /** 产品批号 */ + private String lotNumber; + /** 器材编码 */ private Long deviceDefId; diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/DeviceRequest.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/DeviceRequest.java index 54be6ab0..4ed08fa6 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/DeviceRequest.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/domain/DeviceRequest.java @@ -6,8 +6,8 @@ import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - import com.core.common.core.domain.HisBaseEntity; + import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -61,6 +61,9 @@ public class DeviceRequest extends HisBaseEntity { /** 请求单位编码 */ private String unitCode; + /** 产品批号 */ + private String lotNumber; + /** 器材编码 */ private Long deviceDefId; @@ -130,5 +133,4 @@ public class DeviceRequest extends HisBaseEntity { /** 发放编号 */ private Long dispenseId; - } \ No newline at end of file