后端最新版本同步
This commit is contained in:
@@ -6,35 +6,49 @@ import com.openhis.web.paymentmanage.dto.ChargeSummaryDto;
|
||||
|
||||
public interface IChargeBillService {
|
||||
/**
|
||||
*
|
||||
* @param paymentId
|
||||
* @return
|
||||
* 小票信息
|
||||
*
|
||||
* @param paymentId 入参
|
||||
* @return 结果
|
||||
*/
|
||||
Map getDetail(Long paymentId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* 日结账单报表
|
||||
*
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param entererId 收款员
|
||||
* @param contractNo 合同
|
||||
* @return 结果
|
||||
*/
|
||||
Map getTotal(String startTime, String endTime, Long entererId, String contractNo);
|
||||
|
||||
Map getTotalCcu(String startTime, String endTime, Long entererId);
|
||||
|
||||
Map getTotalCommen(String startTime, String endTime, Long entererId);
|
||||
Map getTotalCommen(String startTime, String endTime, Long entererId, String contractNo);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param paymentId
|
||||
* @return
|
||||
* 医保保障金的相关接口(弃用)
|
||||
*
|
||||
* @param paymentId 付款id
|
||||
* @return 结果
|
||||
*/
|
||||
Map getMedicalExpenseCoverageSummary(Long paymentId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param chargeSummaryDto
|
||||
* @return
|
||||
* 按照科室营收情况
|
||||
*
|
||||
* @param chargeSummaryDto 入参
|
||||
* @return 结果
|
||||
*/
|
||||
Map getChargeItemByOrg(ChargeSummaryDto chargeSummaryDto);
|
||||
|
||||
/**
|
||||
* 小票信息(农大)
|
||||
*
|
||||
* @param paymentId 付款id
|
||||
* @return 结果
|
||||
*/
|
||||
Map getReceiptDetailsND(Long paymentId);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.dto.ChargeItemBaseInfoDto;
|
||||
import com.openhis.administration.dto.ChargeItemDefInfo;
|
||||
import com.openhis.administration.dto.EncounterAccountDto;
|
||||
import com.openhis.administration.service.*;
|
||||
@@ -35,6 +36,7 @@ import com.openhis.financial.domain.Contract;
|
||||
import com.openhis.financial.domain.PaymentRecDetail;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.financial.model.PaymentRecDetailAccountResult;
|
||||
import com.openhis.financial.model.PaymentReconciliationAccountDel;
|
||||
import com.openhis.financial.service.IContractService;
|
||||
import com.openhis.financial.service.IPaymentRecDetailService;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
@@ -119,7 +121,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
map.put("paymentId", paymentReconciliation.getPaymentNo());// 结算id
|
||||
map.put("paymentAmount", paymentReconciliation.getTenderedAmount());// 应收金额
|
||||
Practitioner practitioner = iPractitionerService.getById(paymentReconciliation.getEntererId());
|
||||
map.put("paymentAmount", practitioner == null ? "" : practitioner.getName());// 收费员
|
||||
map.put("paymentEmployee", practitioner == null ? "" : practitioner.getName());// 收费员
|
||||
map.put("chargeTime", paymentReconciliation.getBillDate());// 收费时间
|
||||
Patient patient = iPatientService.getById(paymentReconciliation.getPatientId());
|
||||
if (patient == null) {
|
||||
@@ -139,6 +141,49 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
}
|
||||
map.put("detail", paymentRecDetails);// 支付详细
|
||||
|
||||
for (PaymentRecDetail paymentRecDetail : paymentRecDetails) {
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SELF_YB_ZH_PAY.getValue())) {
|
||||
map.put("ybAccountPay", paymentRecDetail.getAmount());// 医保账户支付
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.BALC.getValue())) {
|
||||
map.put("ybAccountBalc", paymentRecDetail.getAmount());// 医保账户余额(现)
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.YB_FUND_PAY.getValue())) {
|
||||
map.put("ybFundPay", paymentRecDetail.getAmount());// 基金支付总额
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.YB_TC_FUND_AMOUNT.getValue())) {
|
||||
map.put("ybTcPay", paymentRecDetail.getAmount());// 统筹支付金额
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.YB_BC_GWY_BZ_VALUE.getValue())) {
|
||||
map.put("ybGWYPay", paymentRecDetail.getAmount());// 公务员补助
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.OTHER_PAY.getValue())) {
|
||||
map.put("ybOtherPay", paymentRecDetail.getAmount());// 其他支付
|
||||
}
|
||||
// 下面两个大额理赔有哪个用哪个,无所谓的
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.YB_BC_DE_BZ_VALUE.getValue())) {
|
||||
map.put("ybDELPPay", paymentRecDetail.getAmount());// 大额理赔(常规)
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.YB_BC_ZG_DE_BZ_VALUE.getValue())) {
|
||||
map.put("ybDELPPay", paymentRecDetail.getAmount());// 大额理赔(企业)
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.E_WALLET.getValue())) {
|
||||
map.put("ybWallet", paymentRecDetail.getAmount());// 电子钱包
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SUPPLEMENTARY_INSURANCE.getValue())) {
|
||||
map.put("ybWallet", paymentRecDetail.getAmount());// 居民大病报销
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SELF_CASH_VALUE.getValue())) {
|
||||
map.put("cash", paymentRecDetail.getAmount());// 现金
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SELF_CASH_VX_VALUE.getValue())) {
|
||||
map.put("wxCash", paymentRecDetail.getAmount());// 现金(微信)
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SELF_CASH_ALI_VALUE.getValue())) {
|
||||
map.put("aliCash", paymentRecDetail.getAmount());// 现金(支付宝)
|
||||
}
|
||||
}
|
||||
|
||||
Invoice invoice = iInvoiceService.getOne(new LambdaQueryWrapper<Invoice>()
|
||||
.eq(Invoice::getReconciliationId, paymentId).eq(Invoice::getStatusEnum, InvoiceStatus.ISSUED.getValue())
|
||||
.orderByDesc(Invoice::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
|
||||
@@ -319,8 +364,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
String fixmedinsName = optionJson.getString(CommonConstants.Option.FIXMEDINS_NAME);
|
||||
String fixmedinsCode = optionJson.getString(CommonConstants.Option.FIXMEDINS_CODE);
|
||||
|
||||
map.put("fixmedinsName", fixmedinsName);
|
||||
map.put("fixmedinsCode", fixmedinsCode);
|
||||
map.put("fixmedinsName", fixmedinsName);// 医院名称
|
||||
map.put("fixmedinsCode", fixmedinsCode);// 医院编号
|
||||
|
||||
return map;
|
||||
}
|
||||
@@ -372,7 +417,19 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
paymentReconciliationList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
|
||||
List<PaymentRecDetail> paymentDetails = paymentRecDetailService
|
||||
.list(new LambdaQueryWrapper<PaymentRecDetail>().in(PaymentRecDetail::getReconciliationId, paymentIdList)
|
||||
.eq(PaymentRecDetail::getDeleteFlag, DelFlag.NO.getCode()));
|
||||
.eq(PaymentRecDetail::getDeleteFlag, DelFlag.NO.getCode()).notIn(PaymentRecDetail::getPayEnum,
|
||||
YbPayment.SUPPLEMENTARY_INSURANCE.getValue(), YbPayment.SUPPLEMENTARY_INSURANCE.getValue(),
|
||||
YbPayment.FULAMT_OWNPAY_AMT.getValue(), YbPayment.OVERLMT_SELFPAY.getValue(),
|
||||
YbPayment.PRESELFPAY_AMT.getValue(), YbPayment.INSCP_SCP_AMT.getValue(),
|
||||
YbPayment.ACT_PAY_DEDC.getValue(), YbPayment.POOL_PROP_SELFPAY.getValue(),
|
||||
YbPayment.BALC.getValue(), YbPayment.BIRTH_FUND.getValue(), YbPayment.RETIREE_MEDICAL.getValue(),
|
||||
YbPayment.MEDICAL_ASSISTANCE.getValue(), YbPayment.URBAN_SERIOUS_ILLNESS.getValue(),
|
||||
YbPayment.URBAN_BASIC_MEDICAL.getValue(), YbPayment.GOVERNMENT_SUBSIDY.getValue(),
|
||||
YbPayment.ACCIDENT_INSURANCE.getValue(), YbPayment.CARE_INSURANCE.getValue(),
|
||||
YbPayment.FINANCIAL_FUND.getValue(), YbPayment.HOSPITAL_ADVANCE.getValue(),
|
||||
YbPayment.SUPPLEMENTARY_INSURANCE.getValue(),
|
||||
YbPayment.BASIC_MEDICAL_INSURANCE_FOR_URBAN_EMPLOYEES.getValue(), YbPayment.E_WALLET.getValue(),
|
||||
YbPayment.HEALTHCARE_PREPAYMENT.getValue()));
|
||||
if (paymentDetails.isEmpty()) {
|
||||
return getMap(map);
|
||||
}
|
||||
@@ -1321,7 +1378,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
* @param entererId 参与人id
|
||||
* @return 参数
|
||||
*/
|
||||
public Map getTotalCommen(String startTime, String endTime, Long entererId) {
|
||||
public Map getTotalCommen(String startTime, String endTime, Long entererId, String contractNo) {
|
||||
|
||||
// 声明变量 处理时间
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -1346,14 +1403,18 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
if (entererId != null) {
|
||||
queryWrapper.eq(PaymentReconciliation::getEntererId, entererId);
|
||||
}
|
||||
List<PaymentReconciliation> paymentReconciliationList = paymentReconciliationService.list(queryWrapper);
|
||||
// List<PaymentReconciliation> paymentReconciliationList = paymentReconciliationService.list(queryWrapper);
|
||||
List<PaymentReconciliationAccountDel> paymentReconciliationList = paymentReconciliationService
|
||||
.getPaymentAccountContract(startTime, endTime, entererId, contractNo, PaymentStatus.SUCCESS.getValue(),
|
||||
PaymentStatus.REFUND_ALL.getValue(), PaymentKind.OUTPATIENT_CLINIC.getValue());
|
||||
|
||||
if (paymentReconciliationList.isEmpty()) {
|
||||
return getMap(map);
|
||||
}
|
||||
|
||||
// 查询所有的支付详情(业务注释:收集并统计不同支付渠道支付的费用)
|
||||
List<Long> paymentIdList =
|
||||
paymentReconciliationList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
|
||||
paymentReconciliationList.stream().map(PaymentReconciliationAccountDel::getId).collect(Collectors.toList());
|
||||
List<PaymentRecDetailAccountResult> PaymentRecDetailAccountResultList =
|
||||
paymentRecDetailService.getListByReconciliationIds(paymentIdList);
|
||||
if (PaymentRecDetailAccountResultList.isEmpty()) {
|
||||
@@ -1433,18 +1494,18 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
}
|
||||
}
|
||||
map.put("ybCashSum", YbCashSum);// 医保现金
|
||||
// map.put("selfCashSum", SelfCashSum);// 自费现金
|
||||
// map.put("selfCashSum", SelfCashSum);// 自费现金
|
||||
map.put("rmbCashSum", rmbCashSum);// 自费现金纯现金
|
||||
map.put("vxCashSum", vxCashSum);// 自费现金vx
|
||||
map.put("uniCashSum", uniCashSum);// 自费现金银联
|
||||
map.put("aliCashSum", aliCashSum);// 自费现金ali
|
||||
|
||||
// 将所有的payment分组进行单独处理(业务注释:处理不同财务分类的金额,如西药费中药费等)
|
||||
List<PaymentReconciliation> paymentList = new ArrayList<>();
|
||||
List<PaymentReconciliation> returnList = new ArrayList<>();
|
||||
List<PaymentReconciliationAccountDel> paymentList = new ArrayList<>();
|
||||
List<PaymentReconciliationAccountDel> returnList = new ArrayList<>();
|
||||
// List<PaymentReconciliation> partReturnList = new ArrayList<>();
|
||||
|
||||
for (PaymentReconciliation paymentReconciliation : paymentReconciliationList) {
|
||||
for (PaymentReconciliationAccountDel paymentReconciliation : paymentReconciliationList) {
|
||||
if (PaymentStatus.REFUND_ALL.getValue().equals(paymentReconciliation.getStatusEnum())) {
|
||||
returnList.add(paymentReconciliation);
|
||||
} else if (PaymentStatus.REFUND_PART.getValue().equals(paymentReconciliation.getStatusEnum())) {
|
||||
@@ -1455,16 +1516,16 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
}
|
||||
}
|
||||
|
||||
Map<Long, List<PaymentReconciliation>> returnPaymentMapByRelationId = new HashMap<>();
|
||||
Map<Long, List<PaymentReconciliationAccountDel>> returnPaymentMapByRelationId = new HashMap<>();
|
||||
if (!returnList.isEmpty()) {
|
||||
returnPaymentMapByRelationId =
|
||||
returnList.stream().collect(Collectors.groupingBy(PaymentReconciliation::getRelationId));
|
||||
returnList.stream().collect(Collectors.groupingBy(PaymentReconciliationAccountDel::getRelationId));
|
||||
}
|
||||
|
||||
List<String> addChargeItemIds = new ArrayList<>();
|
||||
List<String> subChargeItemIds = new ArrayList<>();
|
||||
for (PaymentReconciliation paymentReconciliation : paymentList) {
|
||||
List<PaymentReconciliation> paymentReconciliations =
|
||||
for (PaymentReconciliationAccountDel paymentReconciliation : paymentList) {
|
||||
List<PaymentReconciliationAccountDel> paymentReconciliations =
|
||||
returnPaymentMapByRelationId.get(paymentReconciliation.getId());
|
||||
if (paymentReconciliations != null && !paymentReconciliations.isEmpty()) {
|
||||
// 情况a
|
||||
@@ -1475,7 +1536,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
// 情况 e
|
||||
List<String> strings = Arrays.asList(paymentReconciliation.getChargeItemIds().split(","));
|
||||
List<String> split = new ArrayList<>();
|
||||
for (PaymentReconciliation reconciliation : paymentReconciliations) {
|
||||
for (PaymentReconciliationAccountDel reconciliation : paymentReconciliations) {
|
||||
split.addAll(Arrays.asList(reconciliation.getChargeItemIds().split(",")));
|
||||
}
|
||||
strings.removeAll(split);
|
||||
@@ -1491,8 +1552,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
|
||||
// 情况 c
|
||||
// 情况 g
|
||||
for (Map.Entry<Long, List<PaymentReconciliation>> longListEntry : returnPaymentMapByRelationId.entrySet()) {
|
||||
for (PaymentReconciliation paymentReconciliation : longListEntry.getValue()) {
|
||||
for (Map.Entry<Long, List<PaymentReconciliationAccountDel>> longListEntry : returnPaymentMapByRelationId
|
||||
.entrySet()) {
|
||||
for (PaymentReconciliationAccountDel paymentReconciliation : longListEntry.getValue()) {
|
||||
subChargeItemIds.addAll(Arrays.asList(paymentReconciliation.getChargeItemIds().split(",")));
|
||||
}
|
||||
}
|
||||
@@ -1510,6 +1572,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
}
|
||||
}
|
||||
|
||||
// 查不到收费项的情况下不统计了
|
||||
if (chargeItemIds.isEmpty()) {
|
||||
return getMap(map);
|
||||
}
|
||||
List<ChargeItemDefInfo> chargeItemDefInfoByIds = chargeItemService.getChargeItemDefInfoByIds(chargeItemIds);
|
||||
if (chargeItemDefInfoByIds.isEmpty()) {
|
||||
throw new ServiceException("数据异常,该时间段内未查询到收费项");
|
||||
@@ -1678,15 +1744,26 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
map.put(key, bigDecimal);
|
||||
}
|
||||
|
||||
// 体检人次(长大专用)
|
||||
List<ChargeItemDefInfo> chargeItemDefInfos = chargeItemDefKVByTypeCode.get("9999");
|
||||
BigDecimal peisCnt = BigDecimal.ZERO;
|
||||
if (chargeItemDefInfos != null) {
|
||||
for (ChargeItemDefInfo chargeItemDefInfo : chargeItemDefInfos) {
|
||||
peisCnt = peisCnt.add(chargeItemDefInfo.getQuantityValue());
|
||||
}
|
||||
}
|
||||
map.put("peisCnt", peisCnt);// 体检人次
|
||||
|
||||
// 处理退费单
|
||||
List<ReturnBillVO> returnBillVOList = new ArrayList<>();
|
||||
ReturnBillVO returnBillVO;
|
||||
|
||||
if (!returnList.isEmpty()) {
|
||||
List<Long> returnIds = returnList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
|
||||
List<Long> returnIds =
|
||||
returnList.stream().map(PaymentReconciliationAccountDel::getId).collect(Collectors.toList());
|
||||
// 查原付款单子
|
||||
List<Long> relationIdList =
|
||||
returnList.stream().map(PaymentReconciliation::getRelationId).collect(Collectors.toList());
|
||||
returnList.stream().map(PaymentReconciliationAccountDel::getRelationId).collect(Collectors.toList());
|
||||
if (relationIdList.isEmpty() || returnList.size() != relationIdList.size()) {
|
||||
throw new ServiceException("数据异常,存在无法关联到原单的退款单,请联系工程师");
|
||||
}
|
||||
@@ -1696,7 +1773,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
if (!invoiceList.isEmpty()) {
|
||||
Map<Long, List<Invoice>> invoiceKV =
|
||||
invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
|
||||
for (PaymentReconciliation paymentReconciliation : returnList) {
|
||||
for (PaymentReconciliationAccountDel paymentReconciliation : returnList) {
|
||||
returnBillVO = new ReturnBillVO();
|
||||
returnBillVO.setTotalAmount(paymentReconciliation.getTenderedAmount());
|
||||
List<PaymentRecDetailAccountResult> paymentRecDetails =
|
||||
@@ -1858,10 +1935,16 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
orgIncomeDto.setMedFee(orgIncomeDto.getMedFee().add(chargeItemExtendInfoDto.getTotalPrice()));
|
||||
break;
|
||||
case REGISTRATION_FEE:
|
||||
orgIncomeDto.setAmount(orgIncomeDto.getAmount().add(chargeItemExtendInfoDto.getTotalPrice()));
|
||||
orgIncomeDto.setPersonCnt(orgIncomeDto.getPersonCnt() + 1);
|
||||
orgIncomeDto.setRegistrationFee(
|
||||
orgIncomeDto.getRegistrationFee().add(chargeItemExtendInfoDto.getTotalPrice()));
|
||||
break;
|
||||
case SANITARY_MATERIALS_FEE:
|
||||
orgIncomeDto.setAmount(orgIncomeDto.getAmount().add(chargeItemExtendInfoDto.getTotalPrice()));
|
||||
orgIncomeDto
|
||||
.setDeviceFee(orgIncomeDto.getDeviceFee().add(chargeItemExtendInfoDto.getTotalPrice()));
|
||||
break;
|
||||
default:
|
||||
orgIncomeDto.setAmount(orgIncomeDto.getAmount().add(chargeItemExtendInfoDto.getTotalPrice()));
|
||||
orgIncomeDto
|
||||
@@ -1877,4 +1960,176 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小票信息(农大)
|
||||
*
|
||||
* @param paymentId 付款id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Map getReceiptDetailsND(Long paymentId) {
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 查询
|
||||
PaymentReconciliation paymentReconciliation = paymentReconciliationService.getById(paymentId);
|
||||
if (paymentReconciliation == null) {
|
||||
throw new ServiceException("未查询到付款信息");
|
||||
}
|
||||
map.put("paymentId", paymentReconciliation.getPaymentNo());// 结算id
|
||||
map.put("paymentAmount", paymentReconciliation.getTenderedAmount());// 应收金额
|
||||
Practitioner practitioner = iPractitionerService.getById(paymentReconciliation.getEntererId());
|
||||
map.put("paymentEmployee", practitioner == null ? "" : practitioner.getName());// 收费员
|
||||
map.put("chargeTime", paymentReconciliation.getBillDate());// 收费时间
|
||||
Patient patient = iPatientService.getById(paymentReconciliation.getPatientId());
|
||||
if (patient == null) {
|
||||
throw new ServiceException("未查询到患者信息");
|
||||
}
|
||||
map.put("patientName", patient.getName());// 患者姓名
|
||||
|
||||
map.put("sex", patient.getGenderEnum());// 性别
|
||||
map.put("idCardNo", patient.getIdCard());// 身份证号
|
||||
map.put("birthDay", patient.getBirthDate());// 出生日期
|
||||
|
||||
List<PaymentRecDetail> paymentRecDetails = paymentRecDetailService
|
||||
.list(new LambdaQueryWrapper<PaymentRecDetail>().eq(PaymentRecDetail::getReconciliationId, paymentId));
|
||||
|
||||
if (paymentRecDetails.isEmpty()) {
|
||||
throw new ServiceException("未查询到付款信息");
|
||||
}
|
||||
map.put("detail", paymentRecDetails);// 支付详细
|
||||
|
||||
for (PaymentRecDetail paymentRecDetail : paymentRecDetails) {
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SELF_YB_ZH_PAY.getValue())) {
|
||||
map.put("ybAccountPay", paymentRecDetail.getAmount());// 医保账户支付
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.BALC.getValue())) {
|
||||
map.put("ybAccountBalc", paymentRecDetail.getAmount());// 医保账户余额(现)
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.YB_FUND_PAY.getValue())) {
|
||||
map.put("ybFundPay", paymentRecDetail.getAmount());// 基金支付总额
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.YB_TC_FUND_AMOUNT.getValue())) {
|
||||
map.put("ybTcPay", paymentRecDetail.getAmount());// 统筹支付金额
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.YB_BC_GWY_BZ_VALUE.getValue())) {
|
||||
map.put("ybGWYPay", paymentRecDetail.getAmount());// 公务员补助
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.OTHER_PAY.getValue())) {
|
||||
map.put("ybOtherPay", paymentRecDetail.getAmount());// 其他支付
|
||||
}
|
||||
// 下面两个大额理赔有哪个用哪个,无所谓的
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.YB_BC_DE_BZ_VALUE.getValue())) {
|
||||
map.put("ybDELPPay", paymentRecDetail.getAmount());// 大额理赔(常规)
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.YB_BC_ZG_DE_BZ_VALUE.getValue())) {
|
||||
map.put("ybDELPPay", paymentRecDetail.getAmount());// 大额理赔(企业)
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.E_WALLET.getValue())) {
|
||||
map.put("ybWallet", paymentRecDetail.getAmount());// 电子钱包
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SUPPLEMENTARY_INSURANCE.getValue())) {
|
||||
map.put("ybWallet", paymentRecDetail.getAmount());// 居民大病报销
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SELF_CASH_VALUE.getValue())) {
|
||||
map.put("cash", paymentRecDetail.getAmount());// 现金
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SELF_CASH_VX_VALUE.getValue())) {
|
||||
map.put("wxCash", paymentRecDetail.getAmount());// 现金(微信)
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SELF_CASH_ALI_VALUE.getValue())) {
|
||||
map.put("aliCash", paymentRecDetail.getAmount());// 现金(支付宝)
|
||||
}
|
||||
}
|
||||
|
||||
Invoice invoice = iInvoiceService.getOne(new LambdaQueryWrapper<Invoice>()
|
||||
.eq(Invoice::getReconciliationId, paymentId).eq(Invoice::getStatusEnum, InvoiceStatus.ISSUED.getValue())
|
||||
.orderByDesc(Invoice::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
|
||||
if (invoice != null) {
|
||||
map.put("invoiceNo", invoice.getBillNo());// 支付详细
|
||||
map.put("pictureUrl", invoice.getPictureUrl());// 图片
|
||||
}
|
||||
|
||||
List<Long> chargeItemIds =
|
||||
Arrays.stream(paymentReconciliation.getChargeItemIds().split(",")).map(Long::parseLong) // 将字符串转换为 Long
|
||||
.collect(Collectors.toList());
|
||||
List<ChargeItemBaseInfoDto> chargeItemBaseInfoByIds =
|
||||
chargeItemService.getChargeItemBaseInfoByIds(chargeItemIds);
|
||||
|
||||
for (ChargeItemBaseInfoDto chargeItemBaseInfoById : chargeItemBaseInfoByIds) {
|
||||
if (chargeItemBaseInfoById.getDeptName() == null) {
|
||||
throw new ServiceException("收费项" + chargeItemBaseInfoById.getName() + "无开单科室");
|
||||
}
|
||||
if (chargeItemBaseInfoById.getTypeCode() == null) {
|
||||
throw new ServiceException("收费项" + chargeItemBaseInfoById.getName() + "无财务分类");
|
||||
}
|
||||
if (!CommonConstants.BusinessName.DEFAULT_CONTRACT_NO.equals(chargeItemBaseInfoById.getContractNo())) {
|
||||
Object o = map.get(chargeItemBaseInfoById.getContractNo() + "-" + chargeItemBaseInfoById.getTypeCode());
|
||||
if (o == null) {
|
||||
map.put(chargeItemBaseInfoById.getContractNo() + "-" + chargeItemBaseInfoById.getTypeCode(),
|
||||
chargeItemBaseInfoById.getTotalPrice());
|
||||
} else {
|
||||
BigDecimal bigDecimal = new BigDecimal(String.valueOf(o));
|
||||
bigDecimal = bigDecimal.add(chargeItemBaseInfoById.getTotalPrice());
|
||||
map.put(chargeItemBaseInfoById.getContractNo() + "-" + chargeItemBaseInfoById.getTypeCode(),
|
||||
bigDecimal);
|
||||
}
|
||||
} else {
|
||||
// 根据科室的分类来
|
||||
Object o = map.get(chargeItemBaseInfoById.getDeptName() + "-" + chargeItemBaseInfoById.getTypeCode());
|
||||
if (o == null) {
|
||||
map.put(chargeItemBaseInfoById.getDeptName() + "-" + chargeItemBaseInfoById.getTypeCode(),
|
||||
chargeItemBaseInfoById.getTotalPrice());
|
||||
} else {
|
||||
BigDecimal bigDecimal = new BigDecimal(String.valueOf(o));
|
||||
bigDecimal = bigDecimal.add(chargeItemBaseInfoById.getTotalPrice());
|
||||
map.put(chargeItemBaseInfoById.getDeptName() + "-" + chargeItemBaseInfoById.getTypeCode(),
|
||||
bigDecimal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Encounter encounter = iEncounterService.getById(paymentReconciliation.getEncounterId());
|
||||
if (encounter == null) {
|
||||
throw new ServiceException("未查询到就诊信息");
|
||||
}
|
||||
map.put("classEnum", encounter.getYbClassEnum());// 门诊/住院
|
||||
map.put("regNo", encounter.getBusNo());// 门诊号
|
||||
|
||||
InfoPerson perinfo = iPerinfoService.getOne(new LambdaQueryWrapper<InfoPerson>()
|
||||
.eq(InfoPerson::getCertno, patient.getIdCard()).eq(InfoPerson::getTenantId, patient.getTenantId())
|
||||
.orderByDesc(InfoPerson::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
|
||||
if (perinfo != null) {
|
||||
map.put("personType", perinfo.getInsutype());// 人员类别:职工医保,居民医保等;如果为空显示自费或其他
|
||||
map.put("insuplcAdmdvs", perinfo.getInsuplcAdmdvs());// 患者参保地区划
|
||||
}
|
||||
|
||||
// 查询主诊断信息
|
||||
EncounterDiagnosis encounterDiagnosis = iEncounterDiagnosisService.getOne(
|
||||
new LambdaQueryWrapper<EncounterDiagnosis>().eq(EncounterDiagnosis::getEncounterId, encounter.getId())
|
||||
.eq(EncounterDiagnosis::getMaindiseFlag, Whether.YES.getValue())
|
||||
.eq(EncounterDiagnosis::getDeleteFlag, DelFlag.NO.getCode())
|
||||
.orderByDesc(EncounterDiagnosis::getDiagSrtNo).last(YbCommonConstants.sqlConst.LIMIT1));
|
||||
|
||||
if (encounterDiagnosis != null) {
|
||||
Condition condition = iConditionService.getById(encounterDiagnosis.getConditionId());
|
||||
if (condition != null) {
|
||||
ConditionDefinition conditionDefinition =
|
||||
iConditionDefinitionService.getOne(new LambdaQueryWrapper<ConditionDefinition>()
|
||||
.eq(ConditionDefinition::getId, condition.getDefinitionId()));
|
||||
if (conditionDefinition != null) {
|
||||
map.put("conditionDefinition", conditionDefinition.getName());// 诊断名
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
String fixmedinsName = optionJson.getString(CommonConstants.Option.FIXMEDINS_NAME);
|
||||
String fixmedinsCode = optionJson.getString(CommonConstants.Option.FIXMEDINS_CODE);
|
||||
|
||||
map.put("fixmedinsName", fixmedinsName);// 医院名称
|
||||
map.put("fixmedinsCode", fixmedinsCode);// 医院编号
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,14 +412,16 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
List<MedicationRequest> medicationRequestList = medicationRequestService
|
||||
.list(new LambdaQueryWrapper<MedicationRequest>().in(MedicationRequest::getId, medReqIdList));
|
||||
if (!medicationRequestList.isEmpty()) {
|
||||
minpacuntDrugTracCnt = medicationRequestList.stream().mapToInt(MedicationRequest::getQuantity).sum();
|
||||
minpacuntDrugTracCnt = medicationRequestList.stream().map(MedicationRequest::getQuantity)
|
||||
.map(BigDecimal::intValue).reduce(0, Integer::sum);
|
||||
}
|
||||
}
|
||||
if (!devReqIdList.isEmpty()) {
|
||||
List<DeviceRequest> deviceRequestList = deviceRequestService
|
||||
.list(new LambdaQueryWrapper<DeviceRequest>().in(DeviceRequest::getId, devReqIdList));
|
||||
if (!deviceRequestList.isEmpty()) {
|
||||
mcsTracCnt = deviceRequestList.stream().mapToInt(DeviceRequest::getQuantity).sum();
|
||||
mcsTracCnt = deviceRequestList.stream().map(DeviceRequest::getQuantity).map(BigDecimal::intValue)
|
||||
.reduce(0, Integer::sum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,7 +460,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
// 更改付款状态
|
||||
logger.info("更新付款状态:payment:" + JSON.toJSONString(paymentReconciliation));
|
||||
iPaymentReconciliationService.updatePaymentStatusAndSettleIdsById(paymentReconciliation.getId(),
|
||||
PaymentStatus.SUCCESS, ybSettleIds);
|
||||
PaymentStatus.SUCCESS, PaymentOutcome.COMPLETED.getCode(), ybSettleIds);
|
||||
// iPaymentRecDetailService.updateResultByPaymentId(paymentReconciliation.getId(), PaymentResult.PAID);
|
||||
// 更改付款详情的信息
|
||||
iPaymentRecDetailService.updateBatchById(paymentRecDetails);
|
||||
@@ -512,8 +514,8 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
|
||||
chargeItemList.forEach(item -> {
|
||||
switch (item.getServiceTable()) {
|
||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST ->
|
||||
medicationRequestIdList.add(item.getServiceId());
|
||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST -> medicationRequestIdList
|
||||
.add(item.getServiceId());
|
||||
case CommonConstants.TableName.WOR_DEVICE_REQUEST -> deviceRequestIdList.add(item.getServiceId());
|
||||
case CommonConstants.TableName.WOR_SERVICE_REQUEST -> serviceRequestIdList.add(item.getServiceId());
|
||||
}
|
||||
@@ -809,6 +811,11 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
paymentReconciliation.setYbSettleIds(setlIds);
|
||||
}
|
||||
paymentReconciliationService.save(paymentReconciliation);
|
||||
|
||||
// 更改原单的支付结果
|
||||
paymentReconciliationService.update(new PaymentReconciliation().setOutcomeEnum(PaymentOutcome.ERROR.getCode()),
|
||||
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getId, id));
|
||||
|
||||
// 新增详情信息
|
||||
PaymentRecDetail newPaymentRecDetail;
|
||||
List<PaymentRecDetail> addDetailList = new ArrayList<>();
|
||||
@@ -1711,7 +1718,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
chargeItem.setEncounterId(encounterId);
|
||||
chargeItem.setAccountId(accountId);
|
||||
chargeItem.setEntererId(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
chargeItem.setQuantityValue(1);
|
||||
chargeItem.setQuantityValue(new BigDecimal("1"));
|
||||
iChargeItemService.saveChargeItemByRegister(chargeItem);
|
||||
// 处理诊疗费并返回对应的收费项目id集合用于医保结算
|
||||
List<String> chargeItemIdList = this.handleActivityPrice(encounter, account.getId());
|
||||
@@ -1781,7 +1788,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
Date curDate = new Date();
|
||||
for (ActivityDeviceDto activityDeviceDto : tmpActivityList) {
|
||||
adviceBaseDto = new AdviceBaseDto();
|
||||
Integer quantity = activityDeviceDto.getQuantity(); // 请求数量
|
||||
BigDecimal quantity = activityDeviceDto.getQuantity(); // 请求数量
|
||||
adviceBaseDto.setAdviceDefinitionId(activityDeviceDto.getDevActId());
|
||||
// 对应的诊疗医嘱信息
|
||||
AdviceBaseDto activityAdviceBaseDto = iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, null,
|
||||
@@ -1827,7 +1834,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
chargeItem.setQuantityUnit(activityAdviceBaseDto.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(advicePriceDto.getPrice()); // 单价
|
||||
// 计算总价,保留4位小数
|
||||
BigDecimal qty = new BigDecimal(quantity);
|
||||
BigDecimal qty = quantity;
|
||||
chargeItem.setTotalPrice(qty.multiply(advicePriceDto.getPrice()).setScale(4, RoundingMode.HALF_UP)); // 总价
|
||||
|
||||
iChargeItemService.save(chargeItem);
|
||||
@@ -2088,12 +2095,12 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
}
|
||||
|
||||
List<String> ybSettleIds = paymentResultList.stream().map(com.openhis.financial.model.PaymentResult::getSetlId)
|
||||
.collect(Collectors.toList());
|
||||
.filter(StringUtils::isNotEmpty).collect(Collectors.toList());
|
||||
|
||||
// <4>更改付款状态
|
||||
logger.info("更新付款状态:payment:" + JSON.toJSONString(paymentReconciliation));
|
||||
iPaymentReconciliationService.updatePaymentStatusAndSettleIdsById(paymentReconciliation.getId(),
|
||||
PaymentStatus.SUCCESS, ybSettleIds);
|
||||
PaymentStatus.SUCCESS, PaymentOutcome.COMPLETED.getCode(), ybSettleIds);
|
||||
|
||||
// 更改付款详情的信息
|
||||
iPaymentRecDetailService.updateBatchById(paymentRecDetails);
|
||||
@@ -2102,7 +2109,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
if (!paymentDto.getPaymentDetails().isEmpty() && newPayment != null) {
|
||||
// 更改新预交金payment状态
|
||||
iPaymentReconciliationService.updatePaymentStatusAndSettleIdsById(newPayment.getId(), PaymentStatus.SUCCESS,
|
||||
new ArrayList<>());
|
||||
PaymentOutcome.COMPLETED.getCode(), new ArrayList<>());
|
||||
// 新增详情信息
|
||||
Optional<Account> accountSelfOptional = accountList.stream()
|
||||
.filter(e -> e.getTypeCode().equals(AccountType.PERSONAL_CASH_ACCOUNT.getCode())).findAny();
|
||||
@@ -2173,8 +2180,8 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
|
||||
chargeItemBaseInfoByIds.forEach(item -> {
|
||||
switch (item.getServiceTable()) {
|
||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST ->
|
||||
medicationRequestIdList.add(item.getServiceId());
|
||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST -> medicationRequestIdList
|
||||
.add(item.getServiceId());
|
||||
case CommonConstants.TableName.WOR_DEVICE_REQUEST -> deviceRequestIdList.add(item.getServiceId());
|
||||
case CommonConstants.TableName.WOR_SERVICE_REQUEST -> serviceRequestIdList.add(item.getServiceId());
|
||||
}
|
||||
@@ -2205,6 +2212,10 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
* @return 操作结果
|
||||
*/
|
||||
public R<?> inpatientUnPay(Long paymentId) {
|
||||
// 校验重复退款
|
||||
if (iPaymentReconciliationService.isReturn(paymentId)) {
|
||||
return R.fail("不可重复退款");
|
||||
}
|
||||
|
||||
PaymentReconciliation paymentReconciliation = iPaymentReconciliationService.getById(paymentId);
|
||||
if (paymentReconciliation == null) {
|
||||
@@ -2229,7 +2240,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
if (!StringUtils.isEmpty(ybSettleIds)) {
|
||||
// 医保结算信息
|
||||
List<String> ybSettleIdList = Arrays.asList(ybSettleIds.split(","));
|
||||
if (!ybSettleIdList.isEmpty()) {
|
||||
if (!ybSettleIdList.isEmpty() && !ybSettleIdList.get(0).equals("null")) {
|
||||
// 医保反结
|
||||
List<InpatientSettle> InpatientSettleList = iInpatientSettleService
|
||||
.list(new LambdaQueryWrapper<InpatientSettle>().in(InpatientSettle::getSetlId, ybSettleIdList));
|
||||
|
||||
@@ -34,6 +34,17 @@ public class ChargeBillController {
|
||||
return R.ok(iChargeBillService.getDetail(paymentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 单次结算账单
|
||||
*
|
||||
* @param paymentId 付款实体
|
||||
*/
|
||||
@GetMapping("/receipt-details-nd")
|
||||
@Anonymous
|
||||
public R<?> getReceiptDetailsND(@RequestParam("paymentId") Long paymentId) {
|
||||
return R.ok(iChargeBillService.getReceiptDetailsND(paymentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 日结算账单
|
||||
*
|
||||
@@ -58,8 +69,9 @@ public class ChargeBillController {
|
||||
@GetMapping("/getTotalCcu")
|
||||
@Anonymous
|
||||
public R<?> getTotalCcu(@RequestParam(value = "startTime") String startTime,
|
||||
@RequestParam("endTime") String endTime, @RequestParam(value = "entererId", required = false) Long entererId) {
|
||||
return R.ok(iChargeBillService.getTotalCommen(startTime, endTime, entererId));
|
||||
@RequestParam("endTime") String endTime, @RequestParam(value = "entererId", required = false) Long entererId,
|
||||
@RequestParam(value = "contractNo", required = false) String contractNo) {
|
||||
return R.ok(iChargeBillService.getTotalCommen(startTime, endTime, entererId, contractNo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ChargeItemDetailVO {
|
||||
private String chargeItemName;//医保等级
|
||||
|
||||
/** 数量 */
|
||||
private Integer quantityValue;
|
||||
private BigDecimal quantityValue;
|
||||
|
||||
/** 单位 */
|
||||
@Dict(dictCode = "prcunt_type")
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.openhis.web.paymentmanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class OrgIncomeDto {
|
||||
@@ -29,7 +28,11 @@ public class OrgIncomeDto {
|
||||
* 处置费
|
||||
*/
|
||||
private BigDecimal serviceFee;
|
||||
//private BigDecimal receivedAmount;
|
||||
/**
|
||||
* 耗材费
|
||||
*/
|
||||
private BigDecimal deviceFee;
|
||||
// private BigDecimal receivedAmount;
|
||||
/**
|
||||
* 挂号费
|
||||
*/
|
||||
@@ -46,6 +49,7 @@ public class OrgIncomeDto {
|
||||
this.medFee = BigDecimal.ZERO;
|
||||
this.serviceFee = BigDecimal.ZERO;
|
||||
this.registrationFee = BigDecimal.ZERO;
|
||||
//this.orgName = orgName;
|
||||
this.deviceFee = BigDecimal.ZERO;
|
||||
// this.orgName = orgName;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user