新增门诊退费相关代码

This commit is contained in:
Zhang.WH
2025-03-17 13:48:12 +08:00
parent dd30fddf04
commit a4e26d416b
13 changed files with 374 additions and 4 deletions

View File

@@ -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<Long> paymentIdList);
}

View File

@@ -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<EncounterPatientPaymentDto> 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<Long> paymentIdList) {
// 医生同意退费
// 查询所有的chargeid对应生成一个负的chargeitem
// 根据每个 chargeitem判断对应的服务药品耗材是否已发放执行
// 若已发放/执行需要对应的发药人/执行人审批(药品耗材需要先退药)
return null;
}
}

View File

@@ -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<Long> paymentIdList) {
return R.ok(outpatientRefundAppService.refundPayment(paymentIdList));
}
}

View File

@@ -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;
}

View File

@@ -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<EncounterPatientPaymentDto> selectEncounterPatientPayment(@Param("encounterId") Long encounterId,
@Param("success") Integer success, @Param("refundAll") Integer refundAll,
@Param("refundPart") Integer refundPart);
}

View File

@@ -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'
</select>
</mapper>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.openhis.web.chargemanage.mapper.OutpatientRefundAppMapper">
<select id="selectEncounterPatientPayment"
resultType="com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto">
SELECT T1.id,
T1.status_enum,
T1.relation_id,
T1.payment_no,
T1.payment_enum,
T1.location_id,
T1.expiration_date,
T1.tendered_amount,
T1.returned_amount,
T1.contract_no,
T1.charge_item_ids,
T2.prescription_no,
T2.account_id
FROM fin_payment_reconciliation AS T1
LEFT JOIN adm_charge_item AS T2
ON T2.id IN (T1.charge_item_ids)
WHERE T1.encouter_id =#{encounterId}
AND T1.status_enum IN (#{success},#{refundAll},#{refundPart})
AND T1.delete_flag = '0'
</select>
</mapper>