提交merge1.3

This commit is contained in:
2025-12-27 15:31:06 +08:00
parent cbd3e7f981
commit 79ea4ed4f7
148 changed files with 6722 additions and 10861 deletions

View File

@@ -25,91 +25,134 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = false)
public class PaymentReconciliation extends HisBaseEntity {
/** ID */
/**
* ID
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/** 状态 */
/**
* 状态
*/
private Integer statusEnum;
/** 关联ID */
/**
* 关联ID
*/
private Long relationId;
/** 支付的业务标识符 */
/**
* 支付的业务标识符
*/
private String paymentNo;
/** 付款类别 */
/**
* 付款类别
*/
private Integer paymentEnum;
/** 付款实体ID */
/**
* 付款实体ID
*/
private Long paymentReconciliationId;
/** 发起支付的工作流程类别 */
/**
* 发起支付的工作流程类别
*/
private Integer kindEnum;
/** 收款员 */
/**
* 收款员
*/
private Long entererId;
/** 支付发起人类型 */
/**
* 支付发起人类型
*/
private Integer issuerEnum;
/** 支付的患者ID */
/**
* 支付的患者ID
*/
private Long patientId;
/** 请求支付责任人ID */
/**
* 请求支付责任人ID
*/
private Long practitionerId;
/** 付款结果 */
/**
* 付款结果
*/
private Integer outcomeEnum;
/** 支付位置 */
/**
* 支付位置
*/
private Long locationId;
/** 到期时间 */
/**
* 到期时间
*/
private Date expirationDate;
/** 应收金额 */
/**
* 应收金额
*/
private BigDecimal tenderedAmount;
/** 找零金额 */
/**
* 找零金额
*/
private BigDecimal returnedAmount;
/** 付款总额 */
/**
* 付款总额
*/
private BigDecimal displayAmount;
/** 打印标识 */
/**
* 打印标识
*/
private Integer printCount;
/** 合同编码 */
/**
* 合同编码
*/
private String contractNo;// 2025/05/08李自付和医保同时付费时只生成一条payment故此该字段在insert时先为null
/** 处方号集合 */
/**
* 处方号集合
*/
private String chargeItemIds;
/** 就诊ID */
/**
* 就诊ID
*/
private Long encounterId;
/** 结算时间 */
/**
* 结算时间
*/
private Date billDate;
/** 发票编号 */
/**
* 发票编号
*/
private Long invoiceId;
/** 关联账户Id */
/**
* 关联账户Id
*/
private Long accountId;// 2025/05/08李自付和医保同时付费时只生成一条payment故此该字段在insert时先为null
/** 医保结算id */
/**
* 医保结算id
*/
private String ybSettleIds;// 记录医保结算id
/** 医保清算标志 */
<<<<<<< HEAD
private Integer ybClearFlag;//默认值0 未清算
/** 退号/退费原因 */
@TableField("refund_reason")
private String refundReason;
=======
/**
* 医保清算标志
*/
private Integer ybClearFlag;// 默认值0 未清算
>>>>>>> v1.3
}
}

View File

@@ -3,40 +3,26 @@ package com.openhis.financial.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
<<<<<<< HEAD
=======
import com.core.common.core.domain.HisBaseEntity;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
>>>>>>> v1.3
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
<<<<<<< HEAD
* 第三方支付回调实体(下方备注信息以中银支付为模板)
=======
* 第三方支付回调实体(下方备注信息以中银支付为模板,其中会产生冗余字段或者重复字段,这些字段均以第三方平台返回内容为主)
>>>>>>> v1.3
*/
@Data
@TableName("fin_three_part_pay_call_back")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
<<<<<<< HEAD
public class ThreePartPayCallBack {
@TableId(type = IdType.ASSIGN_ID)
=======
public class ThreePartPayCallBack extends HisBaseEntity {
@TableId(type = IdType.ASSIGN_ID)
@JsonSerialize(using = ToStringSerializer.class)
>>>>>>> v1.3
private BigDecimal id;
/**
@@ -147,27 +133,17 @@ public class ThreePartPayCallBack extends HisBaseEntity {
/**
* 付款主键ID
*/
<<<<<<< HEAD
=======
@JsonSerialize(using = ToStringSerializer.class)
>>>>>>> v1.3
private Long paymentId;
/**
* 前台UI序号
*/
<<<<<<< HEAD
private Long index;
=======
private Long payIndex;
>>>>>>> v1.3
/**
* 时间戳(中银建议)
*/
<<<<<<< HEAD
private Long time;
=======
private Long payTime;
/**
@@ -235,5 +211,4 @@ public class ThreePartPayCallBack extends HisBaseEntity {
*/
private String lotNo;
>>>>>>> v1.3
}

View File

@@ -4,9 +4,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.openhis.financial.domain.ThreePartPayCallBack;
public interface ThreePartPayCallBackService extends IService<ThreePartPayCallBack> {
<<<<<<< HEAD
=======
ThreePartPayCallBack getByPayment(Long paymentId);
>>>>>>> v1.3
}

View File

@@ -32,11 +32,7 @@ import com.openhis.administration.service.impl.PatientServiceImpl;
import com.openhis.administration.service.impl.PatientStudentServiceImpl;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.YbCommonConstants;
<<<<<<< HEAD
import com.openhis.common.enums.DelFlag;
=======
import com.core.common.enums.DelFlag;
>>>>>>> v1.3
import com.openhis.common.enums.ItemType;
import com.openhis.common.enums.PaymentKind;
import com.openhis.common.enums.PaymentStatus;
@@ -71,7 +67,8 @@ import com.openhis.yb.service.YbManager;
*/
@Service
public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconciliationMapper, PaymentReconciliation>
implements IPaymentReconciliationService {
implements IPaymentReconciliationService {
@Resource
private AssignSeqUtil assignSeqUtil;
@Autowired
@@ -107,22 +104,22 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
public List<Long> getChargeItemIdListByPayment(List<Long> paymentIdList) {
// 根据支付id获取支付信息
List<PaymentReconciliation> paymentReconciliationList =
baseMapper.selectList(new LambdaQueryWrapper<PaymentReconciliation>()
.select(PaymentReconciliation::getChargeItemIds).in(PaymentReconciliation::getId, paymentIdList));
List<PaymentReconciliation> paymentReconciliationList
= baseMapper.selectList(new LambdaQueryWrapper<PaymentReconciliation>()
.select(PaymentReconciliation::getChargeItemIds).in(PaymentReconciliation::getId, paymentIdList));
if (paymentReconciliationList.isEmpty()) {
return null;
}
// 拆解所有的chargeItemId拼装成一个集合
List<String> chargeItemIdList = paymentReconciliationList.stream().map(PaymentReconciliation::getChargeItemIds)
.collect(Collectors.toList());
.collect(Collectors.toList());
List<Long> chargeItemIds = new ArrayList<>();
for (String chargeItemId : chargeItemIdList) {
if (StringUtils.isNotEmpty(chargeItemId)) {
chargeItemIds.addAll(Arrays
.stream(
chargeItemId.replaceAll("\\[", "").replaceAll("\\]", "").split(CommonConstants.Common.COMMA))
.map(Long::parseLong).collect(Collectors.toList()));
.stream(
chargeItemId.replaceAll("\\[", "").replaceAll("\\]", "").split(CommonConstants.Common.COMMA))
.map(Long::parseLong).collect(Collectors.toList()));
}
}
// 将收费项目集合转换成列表
@@ -137,15 +134,16 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
@Override
public void updateRefundingStatus(List<Long> paymentIdList) {
baseMapper.update(new PaymentReconciliation().setStatusEnum(PaymentStatus.REFUNDING.getValue()),
new LambdaUpdateWrapper<PaymentReconciliation>().in(PaymentReconciliation::getId, paymentIdList));
new LambdaUpdateWrapper<PaymentReconciliation>().in(PaymentReconciliation::getId, paymentIdList));
}
/**
* PS对chargeItem分付款方式 2025/05/23 ChargeItem分完付款方式之后医保支付的ChargeItem还要分特慢病和普通门诊特慢病等支付与常规门诊支付传参不一样
* PS对chargeItem分付款方式 2025/05/23
* ChargeItem分完付款方式之后医保支付的ChargeItem还要分特慢病和普通门诊特慢病等支付与常规门诊支付传参不一样
*/
/**
* 【预结算】
*
*
* @param ybMdtrtCertType 医保凭证类型
* @param busiCardInfo 读卡获取的密钥
* @param contractBusNo 合同编号
@@ -154,7 +152,7 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
*/
@Override
public PrePaymentResult preSettle(YbMdtrtCertType ybMdtrtCertType, String busiCardInfo, String contractBusNo,
List<PaymentedItemModel> paymentedItemList) {
List<PaymentedItemModel> paymentedItemList) {
PrePaymentResult prePaymentResult = null;
String ybSwitchFlag = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH);
@@ -180,8 +178,8 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
case "229900":// 吉林省医保
case "220199":// 长春市医保(农大)
case "220100":// 长春市医保(长大)
Map<String, List<PaymentedItemModel>> collect =
paymentedItemList.stream().collect(Collectors.groupingBy(PaymentedItemModel::getMedType));
Map<String, List<PaymentedItemModel>> collect
= paymentedItemList.stream().collect(Collectors.groupingBy(PaymentedItemModel::getMedType));
if (collect.entrySet().size() > 1) {
throw new ServiceException("医保只接受同种医疗类型结算(普通门诊与慢病等不可以同时结算)!");
}
@@ -190,21 +188,21 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
Clinic2206OrderOutput clinic2206OrderOutput = null;
ClinicReg2201Output reg2201Output = null;
if (!medTypeKV.getKey().equals(YbMedType.GENERAL_OUTPATIENT.getValue()) && "1".equals(
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH))) {
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH))) {
// 不是普通门诊就诊类型,补充挂号信息
reg2201Output = ybManager.createRegWithMedType(contract, ybMdtrtCertType, busiCardInfo,
medTypeKV.getValue().get(0).getEncounterId(),
YbMedType.getByValue(medTypeKV.getValue().get(0).getMedType()));
medTypeKV.getValue().get(0).getEncounterId(),
YbMedType.getByValue(medTypeKV.getValue().get(0).getMedType()));
reg2201Output.setMedType(medTypeKV.getKey());// 2025/06/05慢病挂号后上传2206信息报错2201返回值没有medType此处更正赋值
} else {
// 从数据库里取reg2201
reg2201Output =
ybManager.getClinicRegByEncounterId(medTypeKV.getValue().get(0).getEncounterId());
reg2201Output
= ybManager.getClinicRegByEncounterId(medTypeKV.getValue().get(0).getEncounterId());
}
// 调用预结算
clinic2206OrderOutput = ybManager.preSettle(contract, medTypeKV.getValue().get(0).getEncounterId(),
ybMdtrtCertType, busiCardInfo, reg2201Output, "01", medTypeKV.getValue(),
YbMedType.getByValue(medTypeKV.getKey()));
ybMdtrtCertType, busiCardInfo, reg2201Output, "01", medTypeKV.getValue(),
YbMedType.getByValue(medTypeKV.getKey()));
prePaymentResult = new PrePaymentResult();
BeanUtils.copyProperties(clinic2206OrderOutput, prePaymentResult);
}
@@ -225,7 +223,7 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
/**
* 学生二次报销
*
*
* @param contract 合同
* @param ybMdtrtCertType 医疗类别
* @param busiCardInfo 电子码
@@ -234,7 +232,7 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
* @return 预结算结果
*/
private PrePaymentResult studentYbPay(Contract contract, YbMdtrtCertType ybMdtrtCertType, String busiCardInfo,
String s, List<PaymentedItemModel> paymentedItemList) {
String s, List<PaymentedItemModel> paymentedItemList) {
// 查比例及分类信息(PaymentedItemModel在chargeItem表中不是一定存在的所以此处改用单独查询)
List<StudentPaymentItemModel> allPaymentItemList = getStudentPaymentItemModelList(paymentedItemList);
@@ -244,16 +242,16 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
for (StudentPaymentItemModel studentPaymentItemModel : allPaymentItemList) {
// 获取折扣比例
BigDecimal ratio = studentPaymentItemModel.getTwiceRatio() == null ? studentPaymentItemModel.getSelfRatio()
: studentPaymentItemModel.getTwiceRatio();
: studentPaymentItemModel.getTwiceRatio();
// 计算金额
onceReceivedAmount = onceReceivedAmount.add(studentPaymentItemModel.getTotalPrice()
.multiply(ratio.divide(new BigDecimal("100"), 6, RoundingMode.HALF_UP)));
.multiply(ratio.divide(new BigDecimal("100"), 6, RoundingMode.HALF_UP)));
}
// 医保结算
PrePaymentResult prePaymentResult =
this.studentPreSettleYb(contract, ybMdtrtCertType, busiCardInfo, paymentedItemList);
PrePaymentResult prePaymentResult
= this.studentPreSettleYb(contract, ybMdtrtCertType, busiCardInfo, paymentedItemList);
if (prePaymentResult == null) {
throw new ServiceException("医生开具的收费项未分配对应的医疗类型!");
}
@@ -272,7 +270,7 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
/**
* 学生一次报销
*
*
* @param paymentedItemList 收费项
* @return 预结算结果
*/
@@ -285,7 +283,7 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
for (StudentPaymentItemModel studentPaymentItemModel : allPaymentItemList) {
// 获取折扣比例
BigDecimal ratio = studentPaymentItemModel.getTwiceRatio() == null ? studentPaymentItemModel.getSelfRatio()
: studentPaymentItemModel.getTwiceRatio();
: studentPaymentItemModel.getTwiceRatio();
// 计算金额
onceReceivedAmount = onceReceivedAmount.add(studentPaymentItemModel.getTotalPrice().multiply(ratio));
@@ -307,7 +305,7 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
/**
* 【门诊结算】
*
*
* @param contract 合同
* @param payTransNo 支付批次号
* @param ybMdtrtCertType 凭证类型
@@ -318,13 +316,13 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
*/
@Override
public PaymentResult settle(Contract contract, String payTransNo, YbMdtrtCertType ybMdtrtCertType,
String busiCardInfo, Integer minpacuntDrugTracCnt, Integer mcsTracCnt) {
String busiCardInfo, Integer minpacuntDrugTracCnt, Integer mcsTracCnt) {
PaymentResult paymentResult = null;
if (!(CommonConstants.BusinessName.DEFAULT_CONTRACT_NO.equals(payTransNo)
|| CommonConstants.BusinessName.DEFAULT_STUDENT_CONTRACT_NO.equals(payTransNo))) {
|| CommonConstants.BusinessName.DEFAULT_STUDENT_CONTRACT_NO.equals(payTransNo))) {
// 医保支付 todo支付的详细信息在于结算中已经存好了但是还没有存储卡余额
Clinic2207OrderModel clinic2207OrderModel =
ybManager.settle(contract, payTransNo, busiCardInfo, ybMdtrtCertType, minpacuntDrugTracCnt, mcsTracCnt);
Clinic2207OrderModel clinic2207OrderModel
= ybManager.settle(contract, payTransNo, busiCardInfo, ybMdtrtCertType, minpacuntDrugTracCnt, mcsTracCnt);
paymentResult = new PaymentResult();
BeanUtils.copyProperties(clinic2207OrderModel, paymentResult);
} else {
@@ -365,43 +363,43 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
@Override
public void updatePaymentStatusById(Long id, PaymentStatus success) {
baseMapper.update(new PaymentReconciliation().setStatusEnum(success.getValue()),
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getId, id));
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getId, id));
}
/**
* 更改payment状态以及医保支付结算id
*
*
* @param id 主键id
* @param success 状态
* @param settleId 医保结算id
*/
@Override
public void updatePaymentStatusAndSettleIdsById(Long id, PaymentStatus success, Integer paymentOutcome,
List<String> settleId) {
List<String> settleId) {
if (settleId == null || settleId.isEmpty()) {
baseMapper.update(
new PaymentReconciliation().setStatusEnum(success.getValue()).setOutcomeEnum(paymentOutcome),
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getId, id));
new PaymentReconciliation().setStatusEnum(success.getValue()).setOutcomeEnum(paymentOutcome),
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getId, id));
} else {
baseMapper.update(
new PaymentReconciliation().setStatusEnum(success.getValue()).setYbSettleIds(String.join(",", settleId))
.setOutcomeEnum(paymentOutcome),
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getId, id));
new PaymentReconciliation().setStatusEnum(success.getValue()).setYbSettleIds(String.join(",", settleId))
.setOutcomeEnum(paymentOutcome),
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getId, id));
}
}
/**
* 查询付款实体
*
*
* @param encounterId 就诊id
* @return 付款实体
*/
@Override
public PaymentReconciliation getByEncounterId(Long encounterId, PaymentKind paymentKind) {
return baseMapper.selectOne(new LambdaQueryWrapper<PaymentReconciliation>()
.eq(PaymentReconciliation::getEncounterId, encounterId)
.eq(PaymentReconciliation::getKindEnum, PaymentKind.HOSPITAL_DEPOSIT.getValue())
.eq(PaymentReconciliation::getDeleteFlag, DelFlag.NO.getCode()).last(YbCommonConstants.sqlConst.LIMIT1));
.eq(PaymentReconciliation::getEncounterId, encounterId)
.eq(PaymentReconciliation::getKindEnum, PaymentKind.HOSPITAL_DEPOSIT.getValue())
.eq(PaymentReconciliation::getDeleteFlag, DelFlag.NO.getCode()).last(YbCommonConstants.sqlConst.LIMIT1));
}
/**
@@ -414,7 +412,7 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
public List<PaymentReconciliation> getListByEncounterId(Long encounterId, PaymentKind paymentKind) {
return baseMapper.selectList(new LambdaQueryWrapper<PaymentReconciliation>()
.eq(PaymentReconciliation::getEncounterId, encounterId)
.in(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue(),PaymentStatus.REFUNDING.getValue())
.in(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue(), PaymentStatus.REFUNDING.getValue())
.eq(PaymentReconciliation::getKindEnum, PaymentKind.HOSPITAL_DEPOSIT.getValue())
.eq(PaymentReconciliation::getDeleteFlag, DelFlag.NO.getCode()));
}
@@ -428,10 +426,10 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
@Override
public boolean isReturn(Long paymentId) {
List<PaymentReconciliation> paymentReconciliations = baseMapper.selectList(
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getRelationId, paymentId)
.in(PaymentReconciliation::getStatusEnum, PaymentStatus.REFUNDING.getValue(),
PaymentStatus.REFUND_ALL.getValue(), PaymentStatus.REFUND_PART.getValue())
.eq(PaymentReconciliation::getDeleteFlag, DelFlag.NO.getCode()));
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getRelationId, paymentId)
.in(PaymentReconciliation::getStatusEnum, PaymentStatus.REFUNDING.getValue(),
PaymentStatus.REFUND_ALL.getValue(), PaymentStatus.REFUND_PART.getValue())
.eq(PaymentReconciliation::getDeleteFlag, DelFlag.NO.getCode()));
if (paymentReconciliations != null && paymentReconciliations.size() > 0) {
return true;
}
@@ -452,14 +450,14 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
*/
@Override
public List<PaymentReconciliationAccountDel> getPaymentAccountContract(String startTime, String endTime,
Long entererId, String contractNo, Integer success, Integer returnAll, Integer clinic) {
Long entererId, String contractNo, Integer success, Integer returnAll, Integer clinic) {
return baseMapper.getPaymentAccountContract(startTime, endTime, entererId, contractNo, success, returnAll,
clinic);
clinic);
}
/**
* 查询自付比例等
*
*
* @param paymentedItemList 收款明细
* @return 学生付款实体
*/
@@ -468,18 +466,18 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
// 大项比例
List<GfTypeRatioDto> typeRatioList = gfRatioService.getTypeRatioList();
Map<String, Map<String, List<GfTypeRatioDto>>> result = typeRatioList.stream().collect(
// 第一次分组:按 ybClass 分组(外层 key 为 ybClass
Collectors.groupingBy(GfTypeRatioDto::getYbClass,
// 第二次分组:对每个分组的 List 再按 subType 分组(内层 key 为 subType
Collectors.groupingBy(GfTypeRatioDto::getYbLv)));
// 第一次分组:按 ybClass 分组(外层 key 为 ybClass
Collectors.groupingBy(GfTypeRatioDto::getYbClass,
// 第二次分组:对每个分组的 List 再按 subType 分组(内层 key 为 subType
Collectors.groupingBy(GfTypeRatioDto::getYbLv)));
List<StudentPaymentItemModel> allPaymentItemList = new ArrayList<>();
Map<String, List<PaymentedItemModel>> paymentedItemListByServiceTableMap =
paymentedItemList.stream().collect(Collectors.groupingBy(PaymentedItemModel::getServiceTable));
Map<String, List<PaymentedItemModel>> paymentedItemListByServiceTableMap
= paymentedItemList.stream().collect(Collectors.groupingBy(PaymentedItemModel::getServiceTable));
for (Map.Entry<String, List<PaymentedItemModel>> stringListEntry : paymentedItemListByServiceTableMap
.entrySet()) {
.entrySet()) {
String key = stringListEntry.getKey();
ItemType itemType;
@@ -500,13 +498,13 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
continue;
}
// 查定价分类
ChargeItemDefinition chargeItemDefinition =
chargeItemDefinitionService.getById(studentPaymentItemModel.getDefinitionId());
ChargeItemDefinition chargeItemDefinition
= chargeItemDefinitionService.getById(studentPaymentItemModel.getDefinitionId());
// 查医保等级
if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(studentPaymentItemModel.getProductTable())) {
DeviceDefinition deviceDefinition =
deviceDefinitionService.getById(studentPaymentItemModel.getProductId());
DeviceDefinition deviceDefinition
= deviceDefinitionService.getById(studentPaymentItemModel.getProductId());
if (deviceDefinition != null && chargeItemDefinition != null) {
// 约定大项目的自付比例获取条件
YbMedChrgItmType medChrgItmType = YbMedChrgItmType.getByValue(chargeItemDefinition.getYbType());
@@ -517,11 +515,11 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
if (chrgitmLv == null) {
throw new ServiceException(chargeItemDefinition.getChargeName() + "未配置正确的医保等级!请检查!!!");
}
List<GfTypeRatioDto> gfTypeRatioDtos =
result.get(chargeItemDefinition.getYbType()).get(chrgitmLv.getCode());
List<GfTypeRatioDto> gfTypeRatioDtos
= result.get(chargeItemDefinition.getYbType()).get(chrgitmLv.getCode());
if (gfTypeRatioDtos == null || gfTypeRatioDtos.isEmpty()) {
throw new ServiceException(
"医保分类:" + medChrgItmType.getInfo() + "医保等级:" + chrgitmLv.getInfo() + "未配置自付比例!请检查!!!");
"医保分类:" + medChrgItmType.getInfo() + "医保等级:" + chrgitmLv.getInfo() + "未配置自付比例!请检查!!!");
}
studentPaymentItemModel.setSelfRatio(gfTypeRatioDtos.get(0).getSelfRatio());
@@ -529,9 +527,9 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
}
} else if (CommonConstants.TableName.WOR_ACTIVITY_DEFINITION
.equals(studentPaymentItemModel.getProductTable())) {
ActivityDefinition activityDefinition =
activityDefinitionService.getById(studentPaymentItemModel.getProductId());
.equals(studentPaymentItemModel.getProductTable())) {
ActivityDefinition activityDefinition
= activityDefinitionService.getById(studentPaymentItemModel.getProductId());
if (activityDefinition != null && chargeItemDefinition != null) {
// 约定大项目的自付比例获取条件
YbMedChrgItmType medChrgItmType = YbMedChrgItmType.getByValue(chargeItemDefinition.getYbType());
@@ -542,20 +540,20 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
if (chrgitmLv == null) {
throw new ServiceException(chargeItemDefinition.getChargeName() + "未配置正确的医保等级!请检查!!!");
}
List<GfTypeRatioDto> gfTypeRatioDtos =
result.get(chargeItemDefinition.getYbType()).get(chrgitmLv.getCode());
List<GfTypeRatioDto> gfTypeRatioDtos
= result.get(chargeItemDefinition.getYbType()).get(chrgitmLv.getCode());
if (gfTypeRatioDtos == null || gfTypeRatioDtos.isEmpty()) {
throw new ServiceException(
"医保分类:" + medChrgItmType.getInfo() + "医保等级:" + chrgitmLv.getInfo() + "未配置自付比例!请检查!!!");
"医保分类:" + medChrgItmType.getInfo() + "医保等级:" + chrgitmLv.getInfo() + "未配置自付比例!请检查!!!");
}
studentPaymentItemModel.setSelfRatio(gfTypeRatioDtos.get(0).getSelfRatio());
studentPaymentItemModel.setTwiceRatio(gfTypeRatioDtos.get(0).getSelfRatio());
}
} else if (CommonConstants.TableName.MED_MEDICATION_DEFINITION
.equals(studentPaymentItemModel.getProductTable())) {
MedicationDefinition medicationDefinition =
medicationDefinitionService.getById(studentPaymentItemModel.getProductId());
.equals(studentPaymentItemModel.getProductTable())) {
MedicationDefinition medicationDefinition
= medicationDefinitionService.getById(studentPaymentItemModel.getProductId());
if (medicationDefinition != null && chargeItemDefinition != null) {
// 约定大项目的自付比例获取条件
YbMedChrgItmType medChrgItmType = YbMedChrgItmType.getByValue(chargeItemDefinition.getYbType());
@@ -566,19 +564,19 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
if (chrgitmLv == null) {
throw new ServiceException(chargeItemDefinition.getChargeName() + "未配置正确的医保等级!请检查!!!");
}
List<GfTypeRatioDto> gfTypeRatioDtos =
result.get(chargeItemDefinition.getYbType()).get(chrgitmLv.getCode());
List<GfTypeRatioDto> gfTypeRatioDtos
= result.get(chargeItemDefinition.getYbType()).get(chrgitmLv.getCode());
if (gfTypeRatioDtos == null || gfTypeRatioDtos.isEmpty()) {
throw new ServiceException(
"医保分类:" + medChrgItmType.getInfo() + "医保等级:" + chrgitmLv.getInfo() + "未配置自付比例!请检查!!!");
"医保分类:" + medChrgItmType.getInfo() + "医保等级:" + chrgitmLv.getInfo() + "未配置自付比例!请检查!!!");
}
studentPaymentItemModel.setSelfRatio(gfTypeRatioDtos.get(0).getSelfRatio());
studentPaymentItemModel.setTwiceRatio(gfTypeRatioDtos.get(0).getSelfRatio());
}
} else {
HealthcareService healthcareService =
healthcareServiceService.getById(studentPaymentItemModel.getServiceId());
HealthcareService healthcareService
= healthcareServiceService.getById(studentPaymentItemModel.getServiceId());
if (healthcareService != null && chargeItemDefinition != null) {
// 约定大项目的自付比例获取条件 医疗服务没有定义医保等级,默认百分百还是直接抛异常?
studentPaymentItemModel.setSelfRatio(new BigDecimal("100"));
@@ -593,7 +591,7 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
/**
* 医保预结算
*
*
* @param contract 合同b
* @param ybMdtrtCertType 证件类型
* @param busiCardInfo 电子密钥
@@ -601,19 +599,19 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
* @return 预结算参数
*/
private PrePaymentResult studentPreSettleYb(Contract contract, YbMdtrtCertType ybMdtrtCertType, String busiCardInfo,
List<PaymentedItemModel> paymentedItemList) {
Map<String, List<PaymentedItemModel>> collect =
paymentedItemList.stream().collect(Collectors.groupingBy(PaymentedItemModel::getMedType));
List<PaymentedItemModel> paymentedItemList) {
Map<String, List<PaymentedItemModel>> collect
= paymentedItemList.stream().collect(Collectors.groupingBy(PaymentedItemModel::getMedType));
// 一次医保结算只能支持一种医疗类型的结算
for (Map.Entry<String, List<PaymentedItemModel>> medTypeKV : collect.entrySet()) {
Clinic2206OrderOutput clinic2206OrderOutput = null;
ClinicReg2201Output reg2201Output = null;
if (!medTypeKV.getKey().equals(YbMedType.GENERAL_OUTPATIENT.getValue()) && "1"
.equals(SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH))) {
.equals(SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH))) {
// 不是普通门诊就诊类型,补充挂号信息
reg2201Output = ybManager.createRegWithMedType(contract, ybMdtrtCertType, busiCardInfo,
medTypeKV.getValue().get(0).getEncounterId(),
YbMedType.getByValue(medTypeKV.getValue().get(0).getMedType()));
medTypeKV.getValue().get(0).getEncounterId(),
YbMedType.getByValue(medTypeKV.getValue().get(0).getMedType()));
reg2201Output.setMedType(medTypeKV.getKey());// 2025/06/05慢病挂号后上传2206信息报错2201返回值没有medType此处更正赋值
} else {
// 从数据库里取reg2201
@@ -623,9 +621,9 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl<PaymentReconci
throw new ServiceException("未查询到医保挂号信息");
}
// 调用预结算
clinic2206OrderOutput =
ybManager.preSettle(contract, medTypeKV.getValue().get(0).getEncounterId(), ybMdtrtCertType,
busiCardInfo, reg2201Output, "01", medTypeKV.getValue(), YbMedType.getByValue(medTypeKV.getKey()));
clinic2206OrderOutput
= ybManager.preSettle(contract, medTypeKV.getValue().get(0).getEncounterId(), ybMdtrtCertType,
busiCardInfo, reg2201Output, "01", medTypeKV.getValue(), YbMedType.getByValue(medTypeKV.getKey()));
PrePaymentResult prePaymentResult = new PrePaymentResult();
BeanUtils.copyProperties(clinic2206OrderOutput, prePaymentResult);
return prePaymentResult;

View File

@@ -1,15 +1,5 @@
package com.openhis.financial.service.impl;
<<<<<<< HEAD
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.openhis.financial.domain.ThreePartPayCallBack;
import com.openhis.financial.mapper.ThreePartPayCallBackMapper;
import com.openhis.financial.service.ThreePartPayCallBackService;
import org.springframework.stereotype.Service;
@Service
public class ThreePartPayCallBackServiceImpl extends ServiceImpl<ThreePartPayCallBackMapper, ThreePartPayCallBack> implements ThreePartPayCallBackService {
=======
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -22,12 +12,12 @@ import com.openhis.financial.service.ThreePartPayCallBackService;
@Service
public class ThreePartPayCallBackServiceImpl extends ServiceImpl<ThreePartPayCallBackMapper, ThreePartPayCallBack>
implements ThreePartPayCallBackService {
implements ThreePartPayCallBackService {
@Override
public ThreePartPayCallBack getByPayment(Long paymentId) {
return baseMapper
.selectOne(new LambdaQueryWrapper<ThreePartPayCallBack>().eq(ThreePartPayCallBack::getPaymentId, paymentId)
.eq(ThreePartPayCallBack::getDeleteFlag, DelFlag.NO.getCode()).last(YbCommonConstants.sqlConst.LIMIT1));
.selectOne(new LambdaQueryWrapper<ThreePartPayCallBack>().eq(ThreePartPayCallBack::getPaymentId, paymentId)
.eq(ThreePartPayCallBack::getDeleteFlag, DelFlag.NO.getCode()).last(YbCommonConstants.sqlConst.LIMIT1));
}
>>>>>>> v1.3
}