提交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

@@ -11,14 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.core.common.core.domain.R;
import com.openhis.web.chargemanage.dto.OutpatientRegistrationAddParam;
import com.openhis.web.chargemanage.dto.OutpatientRegistrationSettleParam;
<<<<<<< HEAD
import com.openhis.web.paymentmanage.dto.CancelPaymentDto;
import com.openhis.web.paymentmanage.dto.InpatientPreSettleResultDto;
import com.openhis.web.paymentmanage.dto.NenuBpcPayDto;
import com.openhis.web.paymentmanage.dto.PaymentVO;
=======
import com.openhis.web.paymentmanage.dto.*;
>>>>>>> v1.3
import com.openhis.yb.dto.PaymentDetailDto;
import com.openhis.yb.dto.PaymentDto;
import com.openhis.yb.dto.PaymentInpatientDto;
@@ -31,9 +24,10 @@ import com.openhis.yb.dto.PrePaymentDto;
* @date 2025-03-29
*/
public interface IPaymentRecService {
/**
* 付款
*
*
* @param paymentDto 入参
* @return 结果
*/
@@ -41,7 +35,7 @@ public interface IPaymentRecService {
/**
* 取消付款
*
*
* @param cancelPaymentDto 入参
* @return 结果
*/
@@ -57,7 +51,7 @@ public interface IPaymentRecService {
/**
* 支付列表
*
*
* @param searchKey 查询条件
* @param pageNo 分页参数
* @param pageSize 分页参数
@@ -65,11 +59,11 @@ public interface IPaymentRecService {
* @return 结果
*/
IPage<PaymentVO> getPage(String searchKey, Integer kingEnum, String invoiceNo, Integer pageNo, Integer pageSize,
HttpServletRequest request);
HttpServletRequest request);
/**
* 获取支付详情
*
*
* @param paymentDto 入参
* @return 结果
*/
@@ -77,7 +71,7 @@ public interface IPaymentRecService {
/**
* 预结算
*
*
* @param prePaymentDto 预结算入参
* @return 预结算结果
*/
@@ -85,7 +79,7 @@ public interface IPaymentRecService {
/**
* 挂号预结算
*
*
* @param outpatientRegistrationAddParam 挂号参数
* @return 预结算结果
*/
@@ -93,16 +87,16 @@ public interface IPaymentRecService {
/**
* 挂号结算
*
*
* @param outpatientRegistrationSettleParam 挂号参数
* @return 预结算结果
*/
R<?> regPay(OutpatientRegistrationSettleParam outpatientRegistrationSettleParam, String chrgBchno,
List<PaymentDetailDto> paymentDetails);
List<PaymentDetailDto> paymentDetails);
/**
* 取消预结算
*
*
* @param encounterId 就诊id
* @return 操作结果
*/
@@ -110,7 +104,7 @@ public interface IPaymentRecService {
/**
* 住院预结算
*
*
* @param prePaymentDto 预结算参数
* @return 预结算结果
*/
@@ -118,7 +112,7 @@ public interface IPaymentRecService {
/**
* 住院结算
*
*
* @param paymentDto 住院结算参数
* @return 操作结果
*/
@@ -134,14 +128,11 @@ public interface IPaymentRecService {
/**
* BPC支付
*
*
* @param nenuBpcPayDto bpc支付参数
* @return 结果
*/
String nenuBpcPay(NenuBpcPayDto nenuBpcPayDto);
<<<<<<< HEAD
=======
List<PaymentDetailDto> cancelPreReg(Long encounterId);
>>>>>>> v1.3
}

View File

@@ -3,11 +3,8 @@ package com.openhis.web.paymentmanage.appservice;
import com.core.common.core.domain.R;
import com.openhis.yb.dto.ThreePartPayDto;
<<<<<<< HEAD
=======
import javax.servlet.http.HttpServletRequest;
>>>>>>> v1.3
/**
* 第三方支付应用层Service
*
@@ -15,11 +12,10 @@ import javax.servlet.http.HttpServletRequest;
* @date 2025-03-29
*/
public interface ThreePartPayService {
<<<<<<< HEAD
R<?> payFor(ThreePartPayDto threePartPayDto);
=======
/**
* 付款
*
* @param threePartPayDto 前台参数
* @return 结果
*/
@@ -27,26 +23,29 @@ public interface ThreePartPayService {
/**
* 签到
*
* @return 结果
*/
R<?> sign();
/**
* 签出
*
* @return 结果
*/
R<?> signOut();
/**
* 支付结果查询
*
* @param id 参数
* @return 结果
*/
R<?> payQuery(Long id);
/**
* 当天退费
*
* @param paymentId 参数
* @return 结果
*/
@@ -54,6 +53,7 @@ public interface ThreePartPayService {
/**
* 隔天退货
*
* @param paymentId 参数
* @return 结果
*/
@@ -61,6 +61,7 @@ public interface ThreePartPayService {
/**
* 退费结果查询
*
* @param id
* @return
*/
@@ -68,6 +69,7 @@ public interface ThreePartPayService {
/**
* 网银支付记录
*
* @param searchKey 模糊查询
* @param pageNo 页码
* @param pageSize 页容量
@@ -78,9 +80,9 @@ public interface ThreePartPayService {
/**
* 付款(师大中银)
*
* @param threePartPayDto 前台参数
* @return 结果
*/
R<?> payForNenu(ThreePartPayDto threePartPayDto);
>>>>>>> v1.3
}

View File

@@ -78,6 +78,7 @@ import lombok.extern.slf4j.Slf4j;
@Component
@Slf4j
public class EleInvoiceServiceImpl implements IEleInvoiceService {
private static final BigDecimal ZERO = new BigDecimal("0.00");
Logger logger = LoggerFactory.getLogger(EleInvoiceServiceImpl.class);
@Resource
@@ -121,7 +122,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 创建Http请求
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000)
.setSocketTimeout(30000).build();
.setSocketTimeout(30000).build();
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
CloseableHttpResponse response = null;
// 发送请求
@@ -129,7 +130,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
HttpPost httpPost = new HttpPost(optionJson.getString("invoiceUrl") + "/eleInvoice/forward");
System.out.println(optionJson.getString("invoiceUrl") + "/eleInvoice/forward");
StringEntity stringEntity = new StringEntity(com.alibaba.fastjson2.JSON.toJSONString(eleInvioceBillDto),
ContentType.APPLICATION_JSON);
ContentType.APPLICATION_JSON);
httpPost.setEntity(stringEntity);
// 执行http请求
response = httpClient.execute(httpPost);
@@ -170,8 +171,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 拼接成完整 URL作为路径
String cleanUrl = baseUrl + "/" + endpoint; // 确保用 "/" 分隔
String url = cleanUrl.trim().replaceAll("^\"|\"$", "") // 去除首尾引号
.replaceAll("\\s+", "")// 去除首尾引号
.replaceAll("\"", ""); // 去除中间引号
.replaceAll("\\s+", "")// 去除首尾引号
.replaceAll("\"", ""); // 去除中间引号
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
String appKey = optionJson.getString(CommonConstants.Option.KEY);
@@ -225,13 +226,13 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
String rmd5 = DigestUtils.md5Hex(str1.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
String rsign = resultData.get("sign").toString();
System.out.println("验签-》" + (StringUtils.equals(rsign, rmd5)));
String busData =
new String(Base64.getDecoder().decode(resultData.get("data").toString()), StandardCharsets.UTF_8);
String busData
= new String(Base64.getDecoder().decode(resultData.get("data").toString()), StandardCharsets.UTF_8);
System.out.println("返回业务数据--》" + busData);
Map busDataMap = new ObjectMapper().readValue(busData, Map.class);
System.out
.println("业务信息解密--》" + new String(Base64.getDecoder().decode(busDataMap.get("message").toString()),
StandardCharsets.UTF_8));
.println("业务信息解密--》" + new String(Base64.getDecoder().decode(busDataMap.get("message").toString()),
StandardCharsets.UTF_8));
JSONObject resobj = JSONObject.parseObject(busData);
result.put("success", true);
@@ -259,8 +260,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取付款信息
PaymentReconciliation paymentReconciliation = paymentReconciliationService.getById(paymentId);
List<Long> idList = Arrays.stream(paymentReconciliation.getChargeItemIds().split(",")).map(String::trim) // 去除可能的空格
.map(Long::parseLong) // 转换为 Long
.collect(Collectors.toList());
.map(Long::parseLong) // 转换为 Long
.collect(Collectors.toList());
// 获取费用项信息
List<ChargeItem> chargeItem = chargeItemService.getChargeItemInfo(idList);
@@ -312,30 +313,30 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取患者信息
EleInvoicePatientInfoDto patientInfo = eleInvoiceMapper.getPatientInfo(encounterId,
EncounterClass.AMB.getValue(), OrganizationClass.CLINIC.getValue());
EncounterClass.AMB.getValue(), OrganizationClass.CLINIC.getValue());
//12.4 红旗医院现场字典没赋值
if(patientInfo.getGenderEnum_enumText()==null) {
if (patientInfo.getGenderEnum_enumText() == null) {
patientInfo.setGenderEnum_enumText(patientInfo.getGenderEnumEnumText());
}
// 获取付款信息
EleInvoicePaymentInfoDto paymentInfo = eleInvoiceMapper.getPaymentInfo(paymentId, encounterId,
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
// 医保结算记录
InvoiceBaseInfoDto clinicSettle = this.getClinicSettleByPaymentId(paymentInfo.getPaymentId());
// 业务状态校验
if (paymentInfo.getPaymentStatus() == null
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00002);
}
if (!paymentInfo.getPaymentStatus().equals(PaymentStatus.SUCCESS.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00006);
}
if (paymentInfo.getInvoiceStatus() != null
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00003);
}
@@ -372,7 +373,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// chargeDetail 收费项目明细 JSONArray 不限 是
// 获取收费项目明细
// 医疗收费项目类别 13挂号费
List<String> ybTypeList = new ArrayList<>(Arrays.asList("13","02"));
List<String> ybTypeList = new ArrayList<>(Arrays.asList("13", "02"));
// 付款账单集合
List<Long> chargeItemIds = new ArrayList<>();
String[] parts = paymentInfo.getChargeItemIds().split(",");
@@ -380,7 +381,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
chargeItemIds.add(Long.parseLong(part.trim())); // trim() 去除空格
} // todo 若挂号绑诊察的话,方法需要改
List<EleInvoiceChargeDetailDto> chargeItems = eleInvoiceMapper.getChargeDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
JSONArray chargeDetails = new JSONArray();
Integer sortNo = 1;
@@ -395,8 +396,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// unit 计量单位
chargeDetail.put("unit", "");
// std 收费标准 Number 14,2 是
BigDecimal std =
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
BigDecimal std
= detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
// 精确表示,避免科学计数法
chargeDetail.put("std", df.format(std));
// number 数量 Number 14,2 是
@@ -414,7 +415,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
JSONArray listDetails = new JSONArray();
// 获取清单项目明细
List<EleInvoiceListDetailDto> details = eleInvoiceMapper.getRegListDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
for (EleInvoiceListDetailDto detail : details) {
JSONObject listDetail = new JSONObject();
@@ -504,7 +505,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
}
return R.ok(invoice,
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"电子发票做成"}));
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"电子发票做成"}));
} else {
redata.put("result", rejson.getString("result"));
redata64 = rejson.getString("message").toString();
@@ -553,30 +554,30 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取患者信息
EleInvoicePatientInfoDto patientInfo = eleInvoiceMapper.getPatientInfo(encounterId,
EncounterClass.AMB.getValue(), OrganizationClass.CLINIC.getValue());
EncounterClass.AMB.getValue(), OrganizationClass.CLINIC.getValue());
//12.4 红旗医院现场字典没赋值
if(patientInfo.getGenderEnum_enumText()==null) {
if (patientInfo.getGenderEnum_enumText() == null) {
patientInfo.setGenderEnum_enumText(patientInfo.getGenderEnumEnumText());
}
// 获取付款信息
EleInvoicePaymentInfoDto paymentInfo = eleInvoiceMapper.getPaymentInfo(paymentId, encounterId,
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
// 医保结算记录
InvoiceBaseInfoDto clinicSettle = this.getClinicSettleByPaymentId(paymentInfo.getPaymentId());
// 业务状态校验
if (paymentInfo.getPaymentStatus() == null
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00002);
}
if (!paymentInfo.getPaymentStatus().equals(PaymentStatus.SUCCESS.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00006);
}
if (paymentInfo.getInvoiceStatus() != null
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00003);
}
@@ -589,7 +590,6 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
bill.put("busType", "02");
// ------就诊信息------
// patientCategory 就诊科室 String 60 是
bill.put("patientCategory", patientInfo.getPatientCategory());
// patientCategoryCode 就诊科室编码 String 60 是
@@ -606,11 +606,11 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
clinicSettle.setPsnCashPay(clinicSettle.getPsnCashPay() == null ? ZERO : clinicSettle.getPsnCashPay());
// 医保报销总金额
clinicSettle
.setFundPaySumamt(clinicSettle.getFundPaySumamt() == null ? ZERO : clinicSettle.getFundPaySumamt());
.setFundPaySumamt(clinicSettle.getFundPaySumamt() == null ? ZERO : clinicSettle.getFundPaySumamt());
// otherfundPay 其它医保支付
bill.put("otherfundPay",
String.format("%.2f", clinicSettle.getFundPaySumamt().subtract(clinicSettle.getHifpPay())));
String.format("%.2f", clinicSettle.getFundPaySumamt().subtract(clinicSettle.getHifpPay())));
// ownAcBalance 个人账户余额 Number 14,2 否
bill.put("ownAcBalance", clinicSettle.getBalc());
// balancedNumber 医保结算号 String 100 否 HIS和医保实时结算时医保生成的唯一业务流水号
@@ -675,7 +675,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 医疗收费项目类别
// 01 床位费,02 诊察费,03 检查费,04 化验费,05 治疗费,06 手术费,07 护理费,08 卫生材料费,09 西药费,10 中药饮片费,11 中成药费,12 一般诊疗费,13 挂号费,14 其他费
List<String> ybTypeList = new ArrayList<>(
Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "14"));
Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "14"));
// 付款账单集合
List<Long> chargeItemIds = new ArrayList<>();
String[] parts = paymentInfo.getChargeItemIds().split(",");
@@ -685,7 +685,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取收费项目明细
List<EleInvoiceChargeDetailDto> chargeItems = eleInvoiceMapper.getChargeDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
// chargeDetail 收费项目明细 JSONArray 不限 是 详见A-1,JSON格式列表
JSONArray chargeDetails = new JSONArray();
@@ -701,8 +701,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// unit 计量单位
chargeDetail.put("unit", "");
// std 收费标准 Number 14,2 是
BigDecimal std =
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
BigDecimal std
= detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
chargeDetail.put("std", df.format(std));
// number 数量 Number 14,2 是
chargeDetail.put("number", detail.getNumber());
@@ -719,7 +719,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取清单项目明细
List<EleInvoiceListDetailDto> details = eleInvoiceMapper.getListDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CLINIC.getValue(), chargeItemIds);
for (EleInvoiceListDetailDto detail : details) {
JSONObject listDetail = new JSONObject();
@@ -735,9 +735,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
listDetail.put("name", detail.getName());
// unit 计量单位 String 20 是
String unit = "";
if(detail.getUnit()==null||StringUtils.isEmpty(detail.getUnit())){
if (detail.getUnit() == null || StringUtils.isEmpty(detail.getUnit())) {
unit = "";
}else{
} else {
unit = detail.getUnit();
}
listDetail.put("unit", unit);
@@ -767,12 +767,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
String srcmsg;
System.out.println(JSON.toJSONString(bill));
JSONObject resobj;
<<<<<<< HEAD
=======
logger.info("************************************** 分 割 线 ***************************************");
logger.info("门诊信息入参:" + JSON.toJSONString(bill));
logger.info("———————————————————————————————————————————————————————————————————————————————————————");
>>>>>>> v1.3
if ("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
resobj = PreInvoicePostForward(bill, "api/medical/invoiceEBillOutpatient");
} else {
@@ -815,7 +812,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
}
return R.ok(invoice,
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"电子发票做成"}));
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"电子发票做成"}));
} else {
redata.put("result", rejson.getString("result"));
redata64 = rejson.getString("message").toString();
@@ -867,30 +864,30 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取患者信息
EleInvoicePatientInfoDto patientInfo = eleInvoiceMapper.getPatientInfo(encounterId,
EncounterClass.IMP.getValue(), OrganizationClass.INPATIENT.getValue());
EncounterClass.IMP.getValue(), OrganizationClass.INPATIENT.getValue());
//12.4 红旗医院现场字典没赋值
if(patientInfo.getGenderEnum_enumText()==null) {
if (patientInfo.getGenderEnum_enumText() == null) {
patientInfo.setGenderEnum_enumText(patientInfo.getGenderEnumEnumText());
}
// 获取付款信息
EleInvoicePaymentInfoDto paymentInfo = eleInvoiceMapper.getPaymentInfo(paymentId, encounterId,
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
YbPayment.SELF_YB_ZH_PAY.getValue(), YbPayment.SELF_CASH_VALUE.getValue(),
YbPayment.SELF_CASH_VX_VALUE.getValue(), YbPayment.SELF_CASH_ALI_VALUE.getValue(),
YbPayment.SELF_CASH_UNION_VALUE.getValue(), YbPayment.YB_FUND_PAY.getValue(),
YbPayment.OTHER_PAY.getValue(), YbPayment.SELF_YB_ZH_GJ_VALUE.getValue());
// 医保结算记录
InvoiceBaseInfoDto clinicSettle = this.getClinicSettleByPaymentId(paymentInfo.getPaymentId());
// 业务状态校验
if (paymentInfo.getPaymentStatus() == null
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
|| paymentInfo.getPaymentStatus().equals(PaymentStatus.DRAFT.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00002);
}
if (!paymentInfo.getPaymentStatus().equals(PaymentStatus.SUCCESS.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00006);
}
if (paymentInfo.getInvoiceStatus() != null
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
&& paymentInfo.getInvoiceStatus().equals(InvoiceStatus.ISSUED.getValue())) {
return R.fail(PromptMsgConstant.invoice.M00003);
}
@@ -905,7 +902,6 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
bill.put("checker", user.getName());
// ------就诊信息------
// medCareAreaCode 医保行政区划码 String 6 否 医保结算时必须填写
bill.put("medCareAreaCode", patientInfo.getMedCareAreaCode());
// category 入院科室名称 String 50 是 如:入院科室不存在,填写出院科室
@@ -934,10 +930,10 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
clinicSettle.setPsnCashPay(clinicSettle.getPsnCashPay() == null ? ZERO : clinicSettle.getPsnCashPay());
// 医保报销总金额
clinicSettle
.setFundPaySumamt(clinicSettle.getFundPaySumamt() == null ? ZERO : clinicSettle.getFundPaySumamt());
.setFundPaySumamt(clinicSettle.getFundPaySumamt() == null ? ZERO : clinicSettle.getFundPaySumamt());
// otherfundPay 其它医保支付 Number 14,2 是
bill.put("otherfundPay",
String.format("%.2f", clinicSettle.getFundPaySumamt().subtract(clinicSettle.getHifpPay())));
String.format("%.2f", clinicSettle.getFundPaySumamt().subtract(clinicSettle.getHifpPay())));
// balancedNumber 医保结算号 String 100 否
bill.put("balancedNumber", clinicSettle.getSetlId() == null ? "" : clinicSettle.getSetlId());
// otherInfo 其它扩展信息列表 JSONArray 不限 是
@@ -990,7 +986,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 医疗收费项目类别
// 01 床位费,02 诊察费,03 检查费,04 化验费,05 治疗费,06 手术费,07 护理费,08 卫生材料费,09 西药费,10 中药饮片费,11 中成药费,12 一般诊疗费,13 挂号费,14 其他费
List<String> ybTypeList = new ArrayList<>(
Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14"));
Arrays.asList("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14"));
// 付款账单集合
List<Long> chargeItemIds = new ArrayList<>();
String[] parts = paymentInfo.getChargeItemIds().split(",");
@@ -999,7 +995,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
}
// 获取清单项目明细
List<EleInvoiceListDetailDto> details = eleInvoiceMapper.getListDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CINPATIENT.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CINPATIENT.getValue(), chargeItemIds);
JSONArray listDetails = new JSONArray();
@@ -1017,9 +1013,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
listDetail.put("name", detail.getName());
// unit 计量单位 String 20 是
String unit = "";
if(detail.getUnit()==null||StringUtils.isEmpty(detail.getUnit())){
if (detail.getUnit() == null || StringUtils.isEmpty(detail.getUnit())) {
unit = "";
}else{
} else {
unit = detail.getUnit();
}
listDetail.put("unit", unit);
@@ -1044,7 +1040,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 获取收费项目明细
List<EleInvoiceChargeDetailDto> chargeItems = eleInvoiceMapper.getChargeDetail(encounterId, ybTypeList,
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CINPATIENT.getValue(), chargeItemIds);
"med_chrgitm_type", ContrastTypeEnum.INVOICE_CINPATIENT.getValue(), chargeItemIds);
// chargeDetail 收费项目明细 JSONArray 不限 是
JSONArray chargeDetails = new JSONArray();
@@ -1061,8 +1057,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// unit 计量单位
chargeDetail.put("unit", "");
// std 收费标准 Number 14,2 是
BigDecimal std =
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
BigDecimal std
= detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
// 精确表示,避免科学计数法
chargeDetail.put("std", df.format(std));
// number 数量 Number 14,2 是
@@ -1077,19 +1073,15 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
bill.put("chargeDetail", chargeDetails);
// --------------------请求业务参数 data--------------------END
JSONObject redata = new JSONObject();
String redata64;
String srcdata;
String srcmsg;
// JSONObject resobj = PreInvoicePostForward(bill, "api/medical/invEBillHospitalized");
JSONObject resobj;
<<<<<<< HEAD
=======
logger.info("************************************** 分 割 线 ***************************************");
logger.info("住院信息入参:" + JSON.toJSONString(bill));
logger.info("———————————————————————————————————————————————————————————————————————————————————————");
>>>>>>> v1.3
if ("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
resobj = PreInvoicePostForward(bill, "api/medical/invEBillHospitalized");
} else {
@@ -1132,7 +1124,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
}
return R.ok(invoice,
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"电子发票做成"}));
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"电子发票做成"}));
} else {
redata.put("result", rejson.getString("result"));
redata64 = rejson.getString("message").toString();
@@ -1160,9 +1152,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
* @param clinicSettle 医保结算记录
* @return 返回值
*/
private JSONObject commomSet(EleInvoicePatientInfoDto patientInfo, EleInvoicePaymentInfoDto paymentInfo,
InvoiceBaseInfoDto clinicSettle) throws ParseException {
InvoiceBaseInfoDto clinicSettle) throws ParseException {
// 日期格式化:定义多种时间格式,用于生成业务流水号、时间戳等。
SimpleDateFormat sdfday = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
@@ -1266,7 +1257,6 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// 360 老红军医疗保障 //370 企业补充医疗保险
// 380 新型农村合作医疗 //390 城乡居民基本医疗保险
// 391 城镇居民基本医疗保险 //392 城乡居民大病医疗保险 //399 其他特殊人员医疗保障
// 01 职工基本医疗保险 06 全公费
// 02 居民基本医疗保险 07 全自费
// 03 新型农村合作医疗 90 城乡居民医疗保险
@@ -1337,15 +1327,15 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
//BigDecimal overLmtSelfpay = clinicSettle.getOverlmtSelfpay()==null?ZERO:clinicSettle.getOverlmtSelfpay();
//全自费
clinicSettle
.setFulamtOwnpayAmt(clinicSettle.getFulamtOwnpayAmt() == null ? ZERO : clinicSettle.getFulamtOwnpayAmt());
.setFulamtOwnpayAmt(clinicSettle.getFulamtOwnpayAmt() == null ? ZERO : clinicSettle.getFulamtOwnpayAmt());
// 个人自负
clinicSettle.setPsnPartAmt(clinicSettle.getPsnPartAmt() == null ? ZERO : clinicSettle.getPsnPartAmt());
// 超限价
clinicSettle
.setOverlmtSelfpay(clinicSettle.getOverlmtSelfpay() == null ? ZERO : clinicSettle.getOverlmtSelfpay());
.setOverlmtSelfpay(clinicSettle.getOverlmtSelfpay() == null ? ZERO : clinicSettle.getOverlmtSelfpay());
//先行自付
clinicSettle
.setPreselfpayAmt(clinicSettle.getPreselfpayAmt() == null ? ZERO : clinicSettle.getPreselfpayAmt());
.setPreselfpayAmt(clinicSettle.getPreselfpayAmt() == null ? ZERO : clinicSettle.getPreselfpayAmt());
// 个人现金支付
clinicSettle.setPsnCashPay(clinicSettle.getPsnCashPay() == null ? ZERO : clinicSettle.getPsnCashPay());
// 医保报销总金额
@@ -1357,10 +1347,10 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
bill.put("fundPay", df.format(clinicSettle.getHifpPay()));
// ownPay 自费金额 Number 14,2 是 2025/12/25 朝阳红旗中医院:电子发票个人自费=医保丙类+超限价)
// 2021-12-15 医保回复:个人自付 = PAY_COST医保账户+psn_part_amt个人现金+ (HIFMI_PAY)大病 -(fulamt_ownpay_amt)个人自费
BigDecimal acctPay = clinicSettle.getAcctPay()==null?ZERO:clinicSettle.getAcctPay();
BigDecimal psnPartAmt = clinicSettle.getPsnPartAmt()==null?ZERO:clinicSettle.getPsnPartAmt();
BigDecimal hifmiPay = clinicSettle.getHifmiPay()==null?ZERO:clinicSettle.getHifmiPay();
BigDecimal fulamtOwnpayAmt = clinicSettle.getFulamtOwnpayAmt()==null?ZERO:clinicSettle.getFulamtOwnpayAmt();
BigDecimal acctPay = clinicSettle.getAcctPay() == null ? ZERO : clinicSettle.getAcctPay();
BigDecimal psnPartAmt = clinicSettle.getPsnPartAmt() == null ? ZERO : clinicSettle.getPsnPartAmt();
BigDecimal hifmiPay = clinicSettle.getHifmiPay() == null ? ZERO : clinicSettle.getHifmiPay();
BigDecimal fulamtOwnpayAmt = clinicSettle.getFulamtOwnpayAmt() == null ? ZERO : clinicSettle.getFulamtOwnpayAmt();
bill.put("ownPay", df.format(acctPay.add(psnPartAmt).add(hifmiPay).subtract(fulamtOwnpayAmt)));
// selfConceitedAmt 个人自负 Number 14,2 是 2025/12/25 朝阳红旗中医院:电子发票个人自付=医保乙类后患者自付的部分)
@@ -1384,17 +1374,17 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
paymentInfo.setDebitPayAmount(paymentInfo.getDebitPayAmount() == null ? ZERO : paymentInfo.getDebitPayAmount());
// 个人现金支付金额
paymentInfo
.setRmbCashPayAmount(paymentInfo.getRmbCashPayAmount() == null ? ZERO : paymentInfo.getRmbCashPayAmount());
.setRmbCashPayAmount(paymentInfo.getRmbCashPayAmount() == null ? ZERO : paymentInfo.getRmbCashPayAmount());
// 个人医保账户支付
paymentInfo.setZhPayAmount(paymentInfo.getZhPayAmount() == null ? ZERO : paymentInfo.getZhPayAmount());
// 基金支付总额
paymentInfo
.setYbFundPayAmount(paymentInfo.getYbFundPayAmount() == null ? ZERO : paymentInfo.getYbFundPayAmount());
.setYbFundPayAmount(paymentInfo.getYbFundPayAmount() == null ? ZERO : paymentInfo.getYbFundPayAmount());
// 其他(如医院负担金额)
paymentInfo.setOtherPayAmount(paymentInfo.getOtherPayAmount() == null ? ZERO : paymentInfo.getOtherPayAmount());
// 账户共济支付金额
paymentInfo
.setAelfYbZhGjValue(paymentInfo.getAelfYbZhGjValue() == null ? ZERO : paymentInfo.getAelfYbZhGjValue());
.setAelfYbZhGjValue(paymentInfo.getAelfYbZhGjValue() == null ? ZERO : paymentInfo.getAelfYbZhGjValue());
if (medCareTypeCode.equals("07")) {// 全自费
if (paymentInfo.getWxPayAmount().compareTo(ZERO) > 0) {
payChannelDetail = new JSONObject();
@@ -1423,8 +1413,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
payChannelDetail = new JSONObject();
payChannelDetail.put("payChannelCode", "02");// 02 现金
payChannelDetail.put("payChannelValue",
df.format(paymentInfo.getTotalAmt().subtract(paymentInfo.getWxPayAmount())
.subtract(paymentInfo.getAliPayAmount()).subtract(paymentInfo.getDebitPayAmount())));
df.format(paymentInfo.getTotalAmt().subtract(paymentInfo.getWxPayAmount())
.subtract(paymentInfo.getAliPayAmount()).subtract(paymentInfo.getDebitPayAmount())));
payChannelDetails.add(payChannelDetail);
}
} else {
@@ -1434,16 +1424,11 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
payChannelDetail.put("payChannelCode", "11");
// payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount().add(paymentInfo
// .getOtherPayAmount().add(paymentInfo.getZhPayAmount()).add(paymentInfo.getAelfYbZhGjValue()))));
<<<<<<< HEAD
payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount()
.add(paymentInfo.getZhPayAmount()).add(paymentInfo.getAelfYbZhGjValue())));
=======
//payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount()
// .add(paymentInfo.getZhPayAmount()).add(paymentInfo.getAelfYbZhGjValue())));
// 根据这几个医院的实际情况,医保支付金额先后刨除掉其他支付共济支付金额两项
payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount()
.add(paymentInfo.getZhPayAmount())));
>>>>>>> v1.3
payChannelDetails.add(payChannelDetail);
// 现金
@@ -1472,7 +1457,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
payChannelDetails.add(payChannelDetail);
} else {
BigDecimal cashpay = clinicSettle.getPsnCashPay().subtract(paymentInfo.getWxPayAmount())
.subtract(paymentInfo.getAliPayAmount()).subtract(paymentInfo.getDebitPayAmount());
.subtract(paymentInfo.getAliPayAmount()).subtract(paymentInfo.getDebitPayAmount());
if (cashpay.compareTo(ZERO) > 0) {
payChannelDetail = new JSONObject();
payChannelDetail.put("payChannelCode", "02");// 02 现金
@@ -1512,8 +1497,8 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
return R.fail(PromptMsgConstant.invoice.M00004);
}
Invoice invoice =
invoiceService.getOne(new LambdaQueryWrapper<Invoice>().eq(Invoice::getReconciliationId, paymentId));
Invoice invoice
= invoiceService.getOne(new LambdaQueryWrapper<Invoice>().eq(Invoice::getReconciliationId, paymentId));
if (invoice.getStatusEnum() == null || invoice.getStatusEnum().equals(InvoiceStatus.DRAFT)) {
return R.fail(PromptMsgConstant.invoice.M00007);
@@ -1548,13 +1533,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
// JSONObject resobj = PreInvoicePostForward(bill, "api/medical/writeOffEBill");
JSONObject resobj;
<<<<<<< HEAD
logger.info("冲红信息入参:" + JSON.toJSONString(bill));
=======
logger.info("************************************** 分 割 线 ***************************************");
logger.info("冲红信息入参:" + JSON.toJSONString(bill));
logger.info("———————————————————————————————————————————————————————————————————————————————————————");
>>>>>>> v1.3
if ("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
resobj = PreInvoicePostForward(bill, "api/medical/writeOffEBill");
} else {
@@ -1577,13 +1558,13 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
return R.fail(PromptMsgConstant.Common.M00011);
}
// 查询退款的支付id
List<PaymentReconciliation> paymentReconciliation =
paymentReconciliationService.list(new LambdaQueryWrapper<PaymentReconciliation>()
.eq(PaymentReconciliation::getRelationId, paymentId)
.in(PaymentReconciliation::getStatusEnum,
Arrays.asList(PaymentStatus.REFUND_ALL.getValue(),
PaymentStatus.REFUND_PART.getValue()))
.eq(PaymentReconciliation::getDeleteFlag, '0').last("LIMIT 1"));
List<PaymentReconciliation> paymentReconciliation
= paymentReconciliationService.list(new LambdaQueryWrapper<PaymentReconciliation>()
.eq(PaymentReconciliation::getRelationId, paymentId)
.in(PaymentReconciliation::getStatusEnum,
Arrays.asList(PaymentStatus.REFUND_ALL.getValue(),
PaymentStatus.REFUND_PART.getValue()))
.eq(PaymentReconciliation::getDeleteFlag, '0').last("LIMIT 1"));
if (paymentReconciliation == null) {
return R.fail(PromptMsgConstant.invoice.M00009);
}
@@ -1628,7 +1609,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
invoiceAdd.setPictureNetUrl(redata.getString("pictureNetUrl"));
// 票据营业日期
//invoiceAdd.setBillBusDate(
//redata.getString("billBusDate") == "" ? null : sdf.parse(redata.getString("billBusDate")));
//redata.getString("billBusDate") == "" ? null : sdf.parse(redata.getString("billBusDate")));
Long invoiceIdAdd = invoiceService.addInvoice(invoiceAdd);
if (invoiceIdAdd == null) {
@@ -1636,7 +1617,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
}
return R.ok(invoiceAdd,
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"电子发票冲红"}));
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"电子发票冲红"}));
} else {
redata.put("result", rejson.getString("result").toString());
redata64 = rejson.getString("message").toString();
@@ -1665,7 +1646,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
//PaymentReconciliation paymentReconciliation = paymentReconciliationService.getById(paymentId);
List<PaymentRecDetail> details = paymentRecDetailService
.list(new LambdaQueryWrapper<PaymentRecDetail>().eq(PaymentRecDetail::getReconciliationId, paymentId));
.list(new LambdaQueryWrapper<PaymentRecDetail>().eq(PaymentRecDetail::getReconciliationId, paymentId));
InvoiceBaseInfoDto invoiceBaseInfoDto = initInvoiceBaseInfoDto();
@@ -1718,13 +1699,10 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
if (YbPayment.OVERLMT_SELFPAY.getValue().equals(detail.getPayEnum())) {
invoiceBaseInfoDto.setOverlmtSelfpay(detail.getAmount());
}
<<<<<<< HEAD
=======
// 先行自付费用
if (YbPayment.PRESELFPAY_AMT.getValue().equals(detail.getPayEnum())) {
invoiceBaseInfoDto.setPreselfpayAmt(detail.getAmount());
}
>>>>>>> v1.3
// 学校垫支
if (YbPayment.SCHOOL_GF_PAY.getValue().equals(detail.getPayEnum())) {
invoiceBaseInfoDto.setGfRatio(detail.getAmount());
@@ -1741,15 +1719,15 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
private InvoiceBaseInfoDto initInvoiceBaseInfoDto() {
InvoiceBaseInfoDto clinicSettle = new InvoiceBaseInfoDto();
return clinicSettle.setMedfeeSumamt(new BigDecimal("0.0")).setFulamtOwnpayAmt(new BigDecimal("0.0"))
.setOverlmtSelfpay(new BigDecimal("0.0")).setPreselfpayAmt(new BigDecimal("0.0"))
.setInscpScpAmt(new BigDecimal("0.0")).setActPayDedc(new BigDecimal("0.0"))
.setHifpPay(new BigDecimal("0.0")).setPoolPropSelfpay(new BigDecimal("0.0"))
.setCvlservPay(new BigDecimal("0.0")).setHifesPay(new BigDecimal("0.0")).setHifmiPay(new BigDecimal("0.0"))
.setHifobPay(new BigDecimal("0.00")).setMafPay(new BigDecimal("0.0")).setOthPay(new BigDecimal("0.0"))
.setFundPaySumamt(new BigDecimal("0.0")).setPsnPartAmt(new BigDecimal("0.0"))
.setAcctPay(new BigDecimal("0.0")).setPsnCashPay(new BigDecimal("0.0"))
.setHospPartAmt(new BigDecimal("0.0")).setBalc(new BigDecimal("0.0"))
.setAcctMulaidPay(new BigDecimal("0.0")).setHifdmPay(new BigDecimal("0.0"));
.setOverlmtSelfpay(new BigDecimal("0.0")).setPreselfpayAmt(new BigDecimal("0.0"))
.setInscpScpAmt(new BigDecimal("0.0")).setActPayDedc(new BigDecimal("0.0"))
.setHifpPay(new BigDecimal("0.0")).setPoolPropSelfpay(new BigDecimal("0.0"))
.setCvlservPay(new BigDecimal("0.0")).setHifesPay(new BigDecimal("0.0")).setHifmiPay(new BigDecimal("0.0"))
.setHifobPay(new BigDecimal("0.00")).setMafPay(new BigDecimal("0.0")).setOthPay(new BigDecimal("0.0"))
.setFundPaySumamt(new BigDecimal("0.0")).setPsnPartAmt(new BigDecimal("0.0"))
.setAcctPay(new BigDecimal("0.0")).setPsnCashPay(new BigDecimal("0.0"))
.setHospPartAmt(new BigDecimal("0.0")).setBalc(new BigDecimal("0.0"))
.setAcctMulaidPay(new BigDecimal("0.0")).setHifdmPay(new BigDecimal("0.0"));
}
@Override

View File

@@ -303,8 +303,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
map.put("insuplcAdmdvs", perinfo.getInsuplcAdmdvs());// 患者参保地区划
}
Contract contract =
contractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
Contract contract
= contractService.getOne(new LambdaQueryWrapper<Contract>().eq(Contract::getBusNo, account.getContractNo()));
if (contract == null) {
throw new ServiceException("未查询到合同信息");
}
@@ -319,8 +319,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
if (encounterDiagnosis != null) {
Condition condition = iConditionService.getById(encounterDiagnosis.getConditionId());
if (condition != null) {
ConditionDefinition conditionDefinition =
iConditionDefinitionService.getOne(new LambdaQueryWrapper<ConditionDefinition>()
ConditionDefinition conditionDefinition
= iConditionDefinitionService.getOne(new LambdaQueryWrapper<ConditionDefinition>()
.eq(ConditionDefinition::getId, condition.getDefinitionId()));
if (conditionDefinition != null) {
map.put("conditionDefinition", conditionDefinition.getName());// 诊断名
@@ -349,9 +349,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
ChargeItemDefinition chargeItemDefinition = iChargeItemDefinitionService.getById(definitionId);
YbMedChrgItmType medChrgItmType =
YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
YbMedChrgItmType medChrgItmType
= YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
switch (medChrgItmType) {
case BED_FEE:
@@ -467,35 +466,35 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// }
// 查询所有的支付详情
List<Long> paymentIdList =
paymentReconciliationList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<Long> paymentIdList
= 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()).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()));
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);
}
Map<Long, List<PaymentRecDetail>> paymentDetailsKV =
paymentDetails.stream().collect(Collectors.groupingBy(PaymentRecDetail::getReconciliationId));
Map<Long, List<PaymentRecDetail>> paymentDetailsKV
= paymentDetails.stream().collect(Collectors.groupingBy(PaymentRecDetail::getReconciliationId));
// 声明变量,符合要求的付款记录
Collection<PaymentReconciliation> PaymentReconciliationList;
List<Account> accountList = new ArrayList<>();
if (!StringUtils.isEmpty(contractNo)) {
// 查询账户信息用来区分省市医保
List<Long> accountIds =
paymentDetails.stream().map(PaymentRecDetail::getAccountId).collect(Collectors.toList());
List<Long> accountIds
= paymentDetails.stream().map(PaymentRecDetail::getAccountId).collect(Collectors.toList());
if (accountIds.isEmpty()) {
throw new ServiceException("查询账户信息为空");
}
@@ -505,8 +504,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
Map<Long, PaymentReconciliation> paymentMap = new HashMap<>();
for (PaymentRecDetail paymentDetail : paymentDetails) {
Optional<Account> first =
accountList.stream().filter(x -> x.getId().equals(paymentDetail.getAccountId())).findFirst();
Optional<Account> first
= accountList.stream().filter(x -> x.getId().equals(paymentDetail.getAccountId())).findFirst();
// 账户不符合要求的筛出掉
if (first.isEmpty() || !first.get().getContractNo().equals(contractNo)) {
continue;
@@ -545,7 +544,6 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// System.out.println(chargeItemId);
// System.out.println(",");
// }
List<ChargeItem> chargeItemList = chargeItemService.list(new LambdaQueryWrapper<ChargeItem>()
.in(ChargeItem::getId, chargeItemIds).eq(ChargeItem::getDeleteFlag, DelFlag.NO.getCode()));
if (paymentDetails.isEmpty()) {
@@ -558,20 +556,19 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// System.out.println(JSON.toJSONString(chargeItem));
// }
// }
// 查询收费定义列表
List<Long> chargeItemDefinitionIdList =
chargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
List<Long> chargeItemDefinitionIdList
= chargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
if (chargeItemDefinitionIdList.isEmpty()) {
throw new ServiceException("未查询到收费记录,无收费项信息");
}
List<ChargeItemDefinition> chargeItemDefinitions =
iChargeItemDefinitionService.listByIds(chargeItemDefinitionIdList);
List<ChargeItemDefinition> chargeItemDefinitions
= iChargeItemDefinitionService.listByIds(chargeItemDefinitionIdList);
if (chargeItemDefinitions.isEmpty()) {
throw new ServiceException("未查询到收费记录,无收费项信息");
}
Map<Long, List<ChargeItemDefinition>> chargeItemDefKV =
chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getId));
Map<Long, List<ChargeItemDefinition>> chargeItemDefKV
= chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getId));
// 查询医保结算id
List<String> settleIds = new ArrayList<>();
@@ -602,8 +599,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
for (PaymentRecDetail paymentDetail : paymentDetails) {
if (!StringUtils.isEmpty(contractNo)) {
Optional<Account> first =
accountList.stream().filter(x -> x.getId().equals(paymentDetail.getAccountId())).findFirst();
Optional<Account> first
= accountList.stream().filter(x -> x.getId().equals(paymentDetail.getAccountId())).findFirst();
if (first.isEmpty() || !first.get().getContractNo().equals(contractNo)) {
continue;
}
@@ -646,14 +643,14 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
}
if (!returnPaymentList.isEmpty()) {
List<Long> returnIds =
returnPaymentList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<Long> returnIds
= returnPaymentList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<Invoice> invoiceList = iInvoiceService.list(new LambdaUpdateWrapper<Invoice>()
.in(Invoice::getReconciliationId, returnIds).eq(Invoice::getDeleteFlag, DelFlag.NO.getCode()));
if (!invoiceList.isEmpty()) {
Map<Long, List<Invoice>> invoiceKV =
invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
Map<Long, List<Invoice>> invoiceKV
= invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
for (PaymentReconciliation paymentReconciliation : returnPaymentList) {
returnBillVO = new ReturnBillVO();
returnBillVO.setTotalAmount(paymentReconciliation.getTenderedAmount());
@@ -719,8 +716,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
ChargeItemDefinition chargeItemDefinition = chargeItemDefKV.get(definitionId).get(0);
YbMedChrgItmType medChrgItmType =
YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
YbMedChrgItmType medChrgItmType
= YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
switch (medChrgItmType) {
case BED_FEE:
@@ -799,10 +796,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
throw new ServiceException("收费定义未设置财务分类提示信息chargeItemDefinitionId" + chargeItemDefinition.getId());
}
}
Map<String, List<ChargeItemDefinition>> chargeItemDefMapByTypeCode =
chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> chargeItemMapByDefinitionId =
chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
Map<String, List<ChargeItemDefinition>> chargeItemDefMapByTypeCode
= chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> chargeItemMapByDefinitionId
= chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
for (Map.Entry<String, List<ChargeItemDefinition>> stringListEntry : chargeItemDefMapByTypeCode.entrySet()) {
String key = stringListEntry.getKey();
@@ -863,16 +860,15 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// }
// }
// }
// 查询所有的支付详情
List<Long> paymentIdList =
paymentReconciliationList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<Long> paymentIdList
= 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()));
List<PaymentRecDetailAccountResult> PaymentRecDetailAccountResultList =
paymentRecDetailService.getListByReconciliationIds(paymentIdList, PaymentKind.OUTPATIENT_CLINIC.getValue());
List<PaymentRecDetailAccountResult> PaymentRecDetailAccountResultList
= paymentRecDetailService.getListByReconciliationIds(paymentIdList, PaymentKind.OUTPATIENT_CLINIC.getValue());
if (PaymentRecDetailAccountResultList.isEmpty()) {
return getMap(map);
}
@@ -935,7 +931,6 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// throw new ServiceException("收费项:" + chargeItem.getId());
// }
// }
// 根据省市医保分组
Map<String, List<PaymentRecDetailAccountResult>> paymentDetailsMapByContract = PaymentRecDetailAccountResultList
.stream().collect(Collectors.groupingBy(PaymentRecDetailAccountResult::getContractNo));
@@ -964,20 +959,19 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// System.out.println(JSON.toJSONString(chargeItem));
// }
// }
// 查询收费定义列表
List<Long> chargeItemDefinitionIdList =
chargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
List<Long> chargeItemDefinitionIdList
= chargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
if (chargeItemDefinitionIdList.isEmpty()) {
throw new ServiceException("未查询到收费记录,无收费项信息");
}
List<ChargeItemDefinition> chargeItemDefinitions =
iChargeItemDefinitionService.listByIds(chargeItemDefinitionIdList);
List<ChargeItemDefinition> chargeItemDefinitions
= iChargeItemDefinitionService.listByIds(chargeItemDefinitionIdList);
if (chargeItemDefinitions.isEmpty()) {
throw new ServiceException("未查询到收费记录,无收费项信息");
}
Map<Long, List<ChargeItemDefinition>> chargeItemDefKV =
chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getId));
Map<Long, List<ChargeItemDefinition>> chargeItemDefKV
= chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getId));
// 查询医保结算id
List<String> settleIds = new ArrayList<>();
@@ -1011,8 +1005,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
BigDecimal YbCashSum = BigDecimal.ZERO;// 医保现金总额
// 长大版本要显示出来省市医保的区别
List<Contract> redisContractList = iContractService.getRedisContractList();
Map<String, List<Contract>> contractMapByBusNo =
redisContractList.stream().collect(Collectors.groupingBy(Contract::getBusNo));
Map<String, List<Contract>> contractMapByBusNo
= redisContractList.stream().collect(Collectors.groupingBy(Contract::getBusNo));
for (Map.Entry<String, List<PaymentRecDetailAccountResult>> stringListEntry : paymentDetailsMapByContract
.entrySet()) {
String key = stringListEntry.getKey();
@@ -1122,11 +1116,11 @@ public class IChargeBillServiceImpl implements IChargeBillService {
List<ChargeItemDefinition> beforeChargeItemDefinitions = new ArrayList<>();
List<ChargeItem> beforeChargeItemList = new ArrayList<>();
if (!returnPaymentList.isEmpty()) {
List<Long> returnIds =
returnPaymentList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
List<Long> returnIds
= returnPaymentList.stream().map(PaymentReconciliation::getId).collect(Collectors.toList());
// 查原付款单子
List<Long> relationIdList =
returnPaymentList.stream().map(PaymentReconciliation::getRelationId).collect(Collectors.toList());
List<Long> relationIdList
= returnPaymentList.stream().map(PaymentReconciliation::getRelationId).collect(Collectors.toList());
if (relationIdList.isEmpty() || returnPaymentList.size() != relationIdList.size()) {
throw new ServiceException("数据异常,存在无法关联到原单的退款单,请联系工程师");
}
@@ -1142,8 +1136,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
if (!beforeList.isEmpty()) {
// 拆解所有的chargeItemId拼装成一个集合
List<String> chargeItemIdList =
beforeList.stream().map(PaymentReconciliation::getChargeItemIds).collect(Collectors.toList());
List<String> chargeItemIdList
= beforeList.stream().map(PaymentReconciliation::getChargeItemIds).collect(Collectors.toList());
List<Long> beforeChargeItemIds = new ArrayList<>();
for (String chargeItemId : chargeItemIdList) {
if (StringUtils.isNotEmpty(chargeItemId)) {
@@ -1158,8 +1152,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
if (beforeChargeItemList.isEmpty()) {
throw new ServiceException("数据异常,查找不到退费收费项信息");
}
List<Long> beforeChargeItemDefinitionIdList =
beforeChargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
List<Long> beforeChargeItemDefinitionIdList
= beforeChargeItemList.stream().map(ChargeItem::getDefinitionId).collect(Collectors.toList());
if (beforeChargeItemDefinitionIdList.isEmpty()) {
throw new ServiceException("数据异常,查找不到收费项的定义信息");
}
@@ -1180,8 +1174,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
ChargeItemDefinition chargeItemDefinition = chargeItemDefKV.get(definitionId).get(0);
YbMedChrgItmType medChrgItmType =
YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
YbMedChrgItmType medChrgItmType
= YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
switch (medChrgItmType) {
case BED_FEE:
@@ -1233,13 +1227,13 @@ public class IChargeBillServiceImpl implements IChargeBillService {
List<Invoice> invoiceList = iInvoiceService.list(new LambdaUpdateWrapper<Invoice>()
.in(Invoice::getReconciliationId, returnIds).eq(Invoice::getDeleteFlag, DelFlag.NO.getCode()));
if (!invoiceList.isEmpty()) {
Map<Long, List<Invoice>> invoiceKV =
invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
Map<Long, List<Invoice>> invoiceKV
= invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
for (PaymentReconciliation paymentReconciliation : returnPaymentList) {
returnBillVO = new ReturnBillVO();
returnBillVO.setTotalAmount(paymentReconciliation.getTenderedAmount());
List<PaymentRecDetailAccountResult> paymentRecDetails =
paymentDetailsKV.get(paymentReconciliation.getId());
List<PaymentRecDetailAccountResult> paymentRecDetails
= paymentDetailsKV.get(paymentReconciliation.getId());
for (PaymentRecDetailAccountResult paymentRecDetail : paymentRecDetails) {
if (YbPayment.SELF_CASH_PAY.getValue().equals(paymentRecDetail.getPayEnum())) {
returnBillVO.setPaidAmount(paymentRecDetail.getAmount());
@@ -1286,8 +1280,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
ChargeItemDefinition chargeItemDefinition = chargeItemDefKV.get(definitionId).get(0);
YbMedChrgItmType medChrgItmType =
YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
YbMedChrgItmType medChrgItmType
= YbMedChrgItmType.getByCode(Integer.parseInt(chargeItemDefinition.getYbType()));
switch (medChrgItmType) {
case BED_FEE:
@@ -1367,10 +1361,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
}
Map<String, List<ChargeItemDefinition>> chargeItemDefMapByTypeCode =
chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> chargeItemMapByDefinitionId =
chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
Map<String, List<ChargeItemDefinition>> chargeItemDefMapByTypeCode
= chargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> chargeItemMapByDefinitionId
= chargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
for (Map.Entry<String, List<ChargeItemDefinition>> stringListEntry : chargeItemDefMapByTypeCode.entrySet()) {
String key = stringListEntry.getKey();
@@ -1389,10 +1383,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// 超本时间段的退费单统计
if (!beforeChargeItemDefinitions.isEmpty() && !beforeChargeItemList.isEmpty()) {
Map<String, List<ChargeItemDefinition>> beforeChargeItemDefMapByTypeCode =
beforeChargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> beforeChargeItemMapByDefinitionId =
beforeChargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
Map<String, List<ChargeItemDefinition>> beforeChargeItemDefMapByTypeCode
= beforeChargeItemDefinitions.stream().collect(Collectors.groupingBy(ChargeItemDefinition::getTypeCode));
Map<Long, List<ChargeItem>> beforeChargeItemMapByDefinitionId
= beforeChargeItemList.stream().collect(Collectors.groupingBy(ChargeItem::getDefinitionId));
for (Map.Entry<String, List<ChargeItemDefinition>> longListEntry : beforeChargeItemDefMapByTypeCode
.entrySet()) {
BigDecimal bigDecimal = map.get(longListEntry.getKey()) == null ? BigDecimal.ZERO
@@ -1413,8 +1407,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// 医保人次自费人次计算
List<EncounterAccountDto> list = iEncounterService.getEncounterInfoByTime(startDate, endDate);
Map<String, List<EncounterAccountDto>> encounterAccountDtoMapByContract =
list.stream().collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
Map<String, List<EncounterAccountDto>> encounterAccountDtoMapByContract
= list.stream().collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
for (Map.Entry<String, List<EncounterAccountDto>> stringListEntry : encounterAccountDtoMapByContract
.entrySet()) {
String key = stringListEntry.getKey();
@@ -1428,7 +1422,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
* 长大门诊日结单(最终版) ps小范围区间内通用版本需要时间检验
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param endTime 结束时间
* @param entererId 参与人id
* @return 参数
*/
@@ -1473,10 +1467,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
map.put("amount", amount);// 应收金额
// 查询所有的支付详情(业务注释:收集并统计不同支付渠道支付的费用)
List<Long> paymentIdList =
paymentReconciliationList.stream().map(PaymentReconciliationAccountDel::getId).collect(Collectors.toList());
List<PaymentRecDetailAccountResult> PaymentRecDetailAccountResultList =
paymentRecDetailService.getListByReconciliationIds(paymentIdList, PaymentKind.OUTPATIENT_CLINIC.getValue());
List<Long> paymentIdList
= paymentReconciliationList.stream().map(PaymentReconciliationAccountDel::getId).collect(Collectors.toList());
List<PaymentRecDetailAccountResult> PaymentRecDetailAccountResultList
= paymentRecDetailService.getListByReconciliationIds(paymentIdList, PaymentKind.OUTPATIENT_CLINIC.getValue());
if (PaymentRecDetailAccountResultList.isEmpty()) {
return getMap(map);
@@ -1503,8 +1497,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
BigDecimal discountSum = BigDecimal.ZERO;// 优惠金额
// 长大版本要显示出来省市医保的区别
List<Contract> redisContractList = iContractService.getRedisContractList();
Map<String, List<Contract>> contractMapByBusNo =
redisContractList.stream().collect(Collectors.groupingBy(Contract::getBusNo));
Map<String, List<Contract>> contractMapByBusNo
= redisContractList.stream().collect(Collectors.groupingBy(Contract::getBusNo));
for (Map.Entry<String, List<PaymentRecDetailAccountResult>> stringListEntry : paymentDetailsMapByContract
.entrySet()) {
@@ -1584,15 +1578,15 @@ public class IChargeBillServiceImpl implements IChargeBillService {
Map<Long, List<PaymentReconciliationAccountDel>> returnPaymentMapByRelationId = new HashMap<>();
if (!returnList.isEmpty()) {
returnPaymentMapByRelationId =
returnList.stream().collect(Collectors.groupingBy(PaymentReconciliationAccountDel::getRelationId));
returnPaymentMapByRelationId
= returnList.stream().collect(Collectors.groupingBy(PaymentReconciliationAccountDel::getRelationId));
}
List<String> addChargeItemIds = new ArrayList<>();
List<String> subChargeItemIds = new ArrayList<>();
for (PaymentReconciliationAccountDel paymentReconciliation : paymentList) {
List<PaymentReconciliationAccountDel> paymentReconciliations =
returnPaymentMapByRelationId.get(paymentReconciliation.getId());
List<PaymentReconciliationAccountDel> paymentReconciliations
= returnPaymentMapByRelationId.get(paymentReconciliation.getId());
if (paymentReconciliations != null && !paymentReconciliations.isEmpty()) {
// 情况a
if (PaymentStatus.SUCCESS.getValue().equals(paymentReconciliation.getStatusEnum())) {
@@ -1646,8 +1640,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
if (chargeItemDefInfoByIds.isEmpty()) {
throw new ServiceException("数据异常,该时间段内未查询到收费项");
}
Map<Long, List<ChargeItemDefInfo>> chargeItemDefInfoKVById =
chargeItemDefInfoByIds.stream().collect(Collectors.groupingBy(ChargeItemDefInfo::getId));
Map<Long, List<ChargeItemDefInfo>> chargeItemDefInfoKVById
= chargeItemDefInfoByIds.stream().collect(Collectors.groupingBy(ChargeItemDefInfo::getId));
// 省名变量
BigDecimal bedFee = BigDecimal.ZERO;// 床位费
@@ -1805,15 +1799,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
map.put("GENERAL_CONSULTATION_FEE", generalConsultationFee);// 一般诊疗费
map.put("REGISTRATION_FEE", registrationFee);// 挂号费
map.put("OTHER_FEE", otherFee);// 其他费用
<<<<<<< HEAD
sum = bedFee.add(diagnosticFee).add(checkFee).add(diagnosticTestFee).add(medicalExpenseFee).add(operationFee)
.add(nursingFee).add(sanitaryMaterialsFee).add(westMedicine).add(chineseMedicineFee)
.add(chineseMedicineSlicesFee).add(generalConsultationFee).add(registrationFee).add(otherFee).subtract(discountSum);
=======
sum = bedFee.add(diagnosticFee).add(checkFee).add(diagnosticTestFee).add(outDiagnosticTestFee).add(medicalExpenseFee).add(operationFee)
.add(nursingFee).add(sanitaryMaterialsFee).add(westMedicine).add(chineseMedicineFee).add(
chineseMedicineSlicesFee).add(generalConsultationFee).add(registrationFee).add(otherFee);
>>>>>>> v1.3
chineseMedicineSlicesFee).add(generalConsultationFee).add(registrationFee).add(otherFee);
map.put("SUM", sum);// 合计费用
Map<String, List<ChargeItemDefInfo>> chargeItemDefKVByTypeCode = chargeItemDefInfoByIds.stream()
@@ -1848,11 +1836,11 @@ public class IChargeBillServiceImpl implements IChargeBillService {
ReturnBillVO returnBillVO;
if (!returnList.isEmpty()) {
List<Long> returnIds =
returnList.stream().map(PaymentReconciliationAccountDel::getId).collect(Collectors.toList());
List<Long> returnIds
= returnList.stream().map(PaymentReconciliationAccountDel::getId).collect(Collectors.toList());
// 查原付款单子
List<Long> relationIdList =
returnList.stream().map(PaymentReconciliationAccountDel::getRelationId).collect(Collectors.toList());
List<Long> relationIdList
= returnList.stream().map(PaymentReconciliationAccountDel::getRelationId).collect(Collectors.toList());
if (relationIdList.isEmpty() || returnList.size() != relationIdList.size()) {
throw new ServiceException("数据异常,存在无法关联到原单的退款单,请联系工程师");
}
@@ -1860,13 +1848,13 @@ public class IChargeBillServiceImpl implements IChargeBillService {
List<Invoice> invoiceList = iInvoiceService.list(new LambdaUpdateWrapper<Invoice>()
.in(Invoice::getReconciliationId, returnIds).eq(Invoice::getDeleteFlag, DelFlag.NO.getCode()));
if (!invoiceList.isEmpty()) {
Map<Long, List<Invoice>> invoiceKV =
invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
Map<Long, List<Invoice>> invoiceKV
= invoiceList.stream().collect(Collectors.groupingBy(Invoice::getReconciliationId));
for (PaymentReconciliationAccountDel paymentReconciliation : returnList) {
returnBillVO = new ReturnBillVO();
returnBillVO.setTotalAmount(paymentReconciliation.getTenderedAmount());
List<PaymentRecDetailAccountResult> paymentRecDetails =
paymentDetailsKV.get(paymentReconciliation.getId());
List<PaymentRecDetailAccountResult> paymentRecDetails
= paymentDetailsKV.get(paymentReconciliation.getId());
for (PaymentRecDetailAccountResult paymentRecDetail : paymentRecDetails) {
if (YbPayment.SELF_CASH_PAY.getValue().equals(paymentRecDetail.getPayEnum())) {
returnBillVO.setPaidAmount(paymentRecDetail.getAmount());
@@ -1894,11 +1882,10 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// map.put("tcSum", tcSum);// 基本统筹
// map.put("zhSum", zhSum);// 账户支付
// map.put("fundSum", fundSum);// 基金支付总额
// 医保人次自费人次计算
List<EncounterAccountDto> list = iEncounterService.getEncounterInfoByTime(startDate, endDate);
Map<String, List<EncounterAccountDto>> encounterAccountDtoMapByContract =
list.stream().collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
Map<String, List<EncounterAccountDto>> encounterAccountDtoMapByContract
= list.stream().collect(Collectors.groupingBy(EncounterAccountDto::getContractNo));
for (Map.Entry<String, List<EncounterAccountDto>> stringListEntry : encounterAccountDtoMapByContract
.entrySet()) {
String key = stringListEntry.getKey();
@@ -2032,8 +2019,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case CHINESE_MEDICINE_SLICES_FEE:
tyChineseMedicineSlicesFee =
tyChineseMedicineSlicesFee.add(chargeItem.getSystemDiscountPrice() == null
tyChineseMedicineSlicesFee
= tyChineseMedicineSlicesFee.add(chargeItem.getSystemDiscountPrice() == null
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case CHINESE_MEDICINE_FEE:
@@ -2109,8 +2096,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case CHINESE_MEDICINE_SLICES_FEE:
tyChineseMedicineSlicesFee =
tyChineseMedicineSlicesFee.subtract(chargeItem.getSystemDiscountPrice() == null
tyChineseMedicineSlicesFee
= tyChineseMedicineSlicesFee.subtract(chargeItem.getSystemDiscountPrice() == null
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case CHINESE_MEDICINE_FEE:
@@ -2118,8 +2105,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case GENERAL_CONSULTATION_FEE:
tyGeneralConsultationFee =
tyGeneralConsultationFee.subtract(chargeItem.getSystemDiscountPrice() == null
tyGeneralConsultationFee
= tyGeneralConsultationFee.subtract(chargeItem.getSystemDiscountPrice() == null
? chargeItem.getTotalPrice() : chargeItem.getSystemDiscountPrice());
break;
case REGISTRATION_FEE:
@@ -2149,8 +2136,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
map.put("TY_REGISTRATION_FEE", tyRegistrationFee);// 挂号费
map.put("TY_OTHER_FEE", tyOtherFee);// 其他费用
tySum = tyBedFee.add(tyDiagnosticFee).add(tyCheckFee).add(tyDiagnosticTestFee).add(tyOutDiagnosticTestFee).add(tyMedicalExpenseFee).add(
tyOperationFee).add(tyNursingFee).add(tySanitaryMaterialsFee).add(tyWestMedicine).add(
tyChineseMedicineSlicesFee).add(tyChineseMedicineFee).add(tyGeneralConsultationFee).add(tyRegistrationFee)
tyOperationFee).add(tyNursingFee).add(tySanitaryMaterialsFee).add(tyWestMedicine).add(
tyChineseMedicineSlicesFee).add(tyChineseMedicineFee).add(tyGeneralConsultationFee).add(tyRegistrationFee)
.add(tyOtherFee);
map.put("TY_SUM", tySum);// 合计费用
@@ -2236,13 +2223,13 @@ public class IChargeBillServiceImpl implements IChargeBillService {
.map(Long::valueOf) // 转换为Long
.collect(Collectors.toList());
List<ChargeItemExtendInfoDto> ChargeItemExtendInfoDtoList =
chargeBillMapper.selectChargeItemExtendInfoList(chargeItemIds, chargeSummaryDto.getOrgIdList());
List<ChargeItemExtendInfoDto> ChargeItemExtendInfoDtoList
= chargeBillMapper.selectChargeItemExtendInfoList(chargeItemIds, chargeSummaryDto.getOrgIdList());
Map<Long, List<ChargeItemExtendInfoDto>> chargeItemExtendInfoDtoListGroupByOrgIdMap =
ChargeItemExtendInfoDtoList.stream().collect(Collectors.groupingBy(ChargeItemExtendInfoDto::getOrgId));
LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper =
new LambdaQueryWrapper<Organization>().eq(Organization::getTypeEnum, OrganizationType.DEPARTMENT.getValue())
Map<Long, List<ChargeItemExtendInfoDto>> chargeItemExtendInfoDtoListGroupByOrgIdMap
= ChargeItemExtendInfoDtoList.stream().collect(Collectors.groupingBy(ChargeItemExtendInfoDto::getOrgId));
LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper
= new LambdaQueryWrapper<Organization>().eq(Organization::getTypeEnum, OrganizationType.DEPARTMENT.getValue())
.eq(Organization::getDeleteFlag, DelFlag.NO.getCode()).orderByDesc(Organization::getDisplayOrder);
if (chargeSummaryDto.getOrgIdList() != null && !chargeSummaryDto.getOrgIdList().isEmpty()) {
organizationLambdaQueryWrapper.in(Organization::getId, chargeSummaryDto.getOrgIdList());
@@ -2256,8 +2243,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
for (Organization organization : organizationList) {
orgIncomeDto = new OrgIncomeDto();
orgIncomeDto.setOrgName(organization.getName());
List<ChargeItemExtendInfoDto> chargeItemExtendInfoDtos =
chargeItemExtendInfoDtoListGroupByOrgIdMap.get(organization.getId());
List<ChargeItemExtendInfoDto> chargeItemExtendInfoDtos
= chargeItemExtendInfoDtoListGroupByOrgIdMap.get(organization.getId());
if (chargeItemExtendInfoDtos == null) {
orgIncomeList.add(orgIncomeDto);
continue;
@@ -2380,7 +2367,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
Invoice invoice = iInvoiceService.getOne(new LambdaQueryWrapper<Invoice>().eq(Invoice::getReconciliationId,
paymentId).eq(Invoice::getStatusEnum, InvoiceStatus.ISSUED.getValue()).orderByDesc(Invoice::getCreateTime)
paymentId).eq(Invoice::getStatusEnum, InvoiceStatus.ISSUED.getValue()).orderByDesc(Invoice::getCreateTime)
.last(YbCommonConstants.sqlConst.LIMIT1));
if (invoice != null) {
map.put("invoiceNo", invoice.getBillNo());// 支付详细
@@ -2388,7 +2375,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
List<Long> chargeItemIds = Arrays.stream(paymentReconciliation.getChargeItemIds().split(",")).map(
Long::parseLong) // 将字符串转换为 Long
Long::parseLong) // 将字符串转换为 Long
.collect(Collectors.toList());
List<ChargeItemBaseInfoDto> chargeItemBaseInfoByIds = chargeItemService.getChargeItemBaseInfoByIds(
chargeItemIds);
@@ -2434,7 +2421,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
map.put("regNo", encounter.getBusNo());// 门诊号
InfoPerson perinfo = iPerinfoService.getOne(new LambdaQueryWrapper<InfoPerson>().eq(InfoPerson::getCertno,
patient.getIdCard()).eq(InfoPerson::getTenantId, patient.getTenantId())
patient.getIdCard()).eq(InfoPerson::getTenantId, patient.getTenantId())
.orderByDesc(InfoPerson::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (perinfo != null) {
map.put("personType", perinfo.getInsutype());// 人员类别:职工医保,居民医保等;如果为空显示自费或其他
@@ -2444,8 +2431,8 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// 查询主诊断信息
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)
EncounterDiagnosis::getMaindiseFlag, Whether.YES.getValue()).eq(EncounterDiagnosis::getDeleteFlag,
DelFlag.NO.getCode()).orderByDesc(EncounterDiagnosis::getDiagSrtNo)
.last(YbCommonConstants.sqlConst.LIMIT1));
if (encounterDiagnosis != null) {
@@ -2495,7 +2482,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
}
InfoPerson perinfo = iPerinfoService.getOne(new LambdaQueryWrapper<InfoPerson>().eq(InfoPerson::getCertno,
patient.getIdCard()).eq(InfoPerson::getTenantId, patient.getTenantId())
patient.getIdCard()).eq(InfoPerson::getTenantId, patient.getTenantId())
.orderByDesc(InfoPerson::getCreateTime).last(YbCommonConstants.sqlConst.LIMIT1));
if (perinfo != null) {
YbMdcsType byCode = YbMdcsType.getByCode(perinfo.getInsutype());
@@ -2527,9 +2514,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// PaymentStatus.SUCCESS.getValue()).in(PaymentReconciliation::getId,paymentIdList));
List<PaymentReconciliation> list = paymentReconciliationService.list(
new LambdaQueryWrapper<PaymentReconciliation>().eq(PaymentReconciliation::getDeleteFlag,
DelFlag.NO.getCode()).eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
.between(PaymentReconciliation::getBillDate, Date.from(LocalDateTime.parse("2025-12-01 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).atZone(ZoneId.systemDefault()).toInstant())
, Date.from(LocalDateTime.parse("2025-12-31 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).atZone(ZoneId.systemDefault()).toInstant())));
DelFlag.NO.getCode()).eq(PaymentReconciliation::getStatusEnum, PaymentStatus.SUCCESS.getValue())
.between(PaymentReconciliation::getBillDate, Date.from(LocalDateTime.parse("2025-12-01 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).atZone(ZoneId.systemDefault()).toInstant()),
Date.from(LocalDateTime.parse("2025-12-31 00:00:00", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).atZone(ZoneId.systemDefault()).toInstant())));
for (PaymentReconciliation paymentReconciliation : list) {
@@ -2598,7 +2585,6 @@ public class IChargeBillServiceImpl implements IChargeBillService {
// BigDecimal b = BigDecimal.ZERO;// 实付金额与药品金额差值即待分配金额
// BigDecimal c = BigDecimal.ZERO;// 诊疗检查等项目的合计金额
// BigDecimal d = paymentReconciliation.getTenderedAmount().subtract(paymentRecDetail.getAmount());// 实际交款金额
List<ChargeItem> newChargeItemList = new ArrayList<>();
for (ChargeItemDefInfo chargeItemDefInfo : chargeItemDefInfoByIdList) {

View File

@@ -2,22 +2,14 @@ package com.openhis.web.paymentmanage.appservice.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
<<<<<<< HEAD
=======
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.constant.Constants;
>>>>>>> v1.3
import com.core.common.core.domain.R;
import com.core.common.enums.TenantOptionDict;
import com.core.common.exception.ServiceException;
import com.core.common.utils.SecurityUtils;
<<<<<<< HEAD
import com.core.web.util.TenantOptionUtil;
import com.openhis.administration.domain.Practitioner;
import com.openhis.administration.service.IPractitionerService;
=======
import com.core.common.utils.StringUtils;
import com.core.web.util.TenantOptionUtil;
import com.openhis.administration.domain.Practitioner;
@@ -25,19 +17,15 @@ import com.openhis.administration.service.IPractitionerService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.enums.PaymentStatus;
import com.openhis.common.utils.HisQueryUtils;
>>>>>>> v1.3
import com.openhis.financial.domain.PaymentReconciliation;
import com.openhis.financial.domain.ThreePartPayCallBack;
import com.openhis.financial.service.IPaymentRecDetailService;
import com.openhis.financial.service.IPaymentReconciliationService;
import com.openhis.financial.service.ThreePartPayCallBackService;
import com.openhis.web.paymentmanage.appservice.ThreePartPayService;
<<<<<<< HEAD
=======
import com.openhis.web.paymentmanage.dto.PaymentVO;
import com.openhis.web.paymentmanage.dto.ThreePartCallBackVo;
import com.openhis.web.paymentmanage.mapper.PaymentMapper;
>>>>>>> v1.3
import com.openhis.yb.dto.BaseInfo;
import com.openhis.yb.dto.BaseParam;
import com.openhis.yb.dto.PaymentDetailDto;
@@ -52,15 +40,6 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
<<<<<<< HEAD
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
=======
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -75,43 +54,27 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.function.Consumer;
>>>>>>> v1.3
@Component
@Slf4j
public class ThreePartPayServiceImpl implements ThreePartPayService {
<<<<<<< HEAD
=======
Logger logger = LoggerFactory.getLogger(ThreePartPayServiceImpl.class);
>>>>>>> v1.3
@Autowired
private IPractitionerService practitionerService;
@Autowired
private IPaymentRecDetailService paymentRecDetailService;
@Autowired
<<<<<<< HEAD
=======
private PaymentMapper paymentMapper;
@Autowired
>>>>>>> v1.3
private IPaymentReconciliationService paymentReconciliationService;
@Autowired
private ThreePartPayCallBackService threePartPayCallBackService;
@Autowired
private ThreePartSimpleFieldMappingService threePartSimpleFieldMappingService;
@Override
<<<<<<< HEAD
public R<?> payFor(ThreePartPayDto threePartPayDto) {
String threePartUrl = TenantOptionUtil.getOptionContent(TenantOptionDict.THREE_PART_PAY_URL);
//String threePartUrl = "http://127.0.0.1:19994/?MSG=EXEC&yylx=02&posjh=&posygh=&jylx=00&je={je}&yjyrq=&yjyckh=&ypzh=&lrcjy=&cm={cm}&ysddh=&erpddh=&body=";
String threePartParam = TenantOptionUtil.getOptionContent(TenantOptionDict.THREE_PART_PARAM);
JSONObject jsonObject = JSON.parseObject(threePartParam);
=======
public R<?> sign() {
// A.获取配置信息
String threePartUrl = TenantOptionUtil.getOptionContent(TenantOptionDict.THREE_PART_SIGN_URL);
@@ -132,7 +95,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方支付签到失败!");
}
@@ -161,7 +124,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方支付签出失败!");
}
@@ -180,7 +143,6 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
JSONObject jsonObject = JSON.parseObject(activeParam);
//B.基础信息查询
>>>>>>> v1.3
//订单号及订单信息
Long paymentId = threePartPayDto.getId();
PaymentReconciliation paymentReconciliation = paymentReconciliationService.getById(paymentId);
@@ -188,21 +150,12 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//金额处理
BigDecimal amount = BigDecimal.ZERO;
for (PaymentDetailDto paymentDetail : threePartPayDto.getPaymentDetails()) {
<<<<<<< HEAD
if(threePartPayDto.getIndex().equals(paymentDetail.getPayEnum())){
amount = paymentDetail.getAmount();
}
}
amount = amount.multiply(new BigDecimal("100"));
String amountResult = String.format("%010d", Integer.parseInt(amount.toString()));
=======
//if(threePartPayDto.getIndex().equals(paymentDetail.getPayEnum())){
amount = amount.add(paymentDetail.getAmount());
amount = amount.add(paymentDetail.getAmount());
//}
}
amount = amount.multiply(new BigDecimal("100"));
String amountResult = String.format("%010d", amount.intValue());
>>>>>>> v1.3
//款员信息查询
Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
@@ -210,31 +163,13 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//获取支付码
String txtCode = threePartPayDto.getTxtCode();
<<<<<<< HEAD
//获取参数
Map<String, String> paramMap = this.getParamMap(jsonObject, practitioner, null, paymentReconciliation, amountResult, txtCode);
//获取完整url
String url = renderTemplateSafe(threePartUrl, paramMap);
String result = httpGet(url);
String threePartMapping = threePartSimpleFieldMappingService.reverseMap("threePartMapping", result);
threePartPayCallBackService.save(JSON.parseObject(threePartMapping,ThreePartPayCallBack.class));
return R.ok();
}
=======
//C.根据不同的请求方式处理参数
//获取动态参数
Map<String, String> paramMap = this.getParamMap(jsonObject, practitioner, null, paymentReconciliation, amountResult, txtCode);
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方支付失败!");
}
@@ -244,18 +179,18 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
ThreePartPayCallBack threePartPayCallBack = JSON.parseObject(threePartMapping, ThreePartPayCallBack.class);
//红旗临时处理这个if后续可删除
if(threePartPayDto.getId()==null){
if (threePartPayDto.getId() == null) {
threePartPayDto.setId(1l);
}
threePartPayCallBack.setPaymentId(threePartPayDto.getId());
threePartPayCallBackService.save(threePartPayCallBack);
if(threePartPayCallBack!=null&&threePartPayCallBack.getPayResult()!=null&&"00".equals(threePartPayCallBack.getPayResult())){
return R.ok("成功支付"+new BigDecimal(threePartPayCallBack.getTxnAmt()).divide(new BigDecimal("100"),2, RoundingMode.HALF_UP)+"");
if (threePartPayCallBack != null && threePartPayCallBack.getPayResult() != null && "00".equals(threePartPayCallBack.getPayResult())) {
return R.ok("成功支付" + new BigDecimal(threePartPayCallBack.getTxnAmt()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP) + "");
}
return R.fail(threePartPayCallBack==null?"支付失败,详见日志文件":threePartPayCallBack.getErrMsg());
return R.fail(threePartPayCallBack == null ? "支付失败,详见日志文件" : threePartPayCallBack.getErrMsg());
}
@@ -286,7 +221,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方平台http失败");
}
@@ -297,11 +232,11 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//ThreePartPayCallBack threePartPayCallBack1 = JSON.parseObject(threePartMapping, ThreePartPayCallBack.class);
//threePartPayCallBackService.save(threePartPayCallBack1);
if(threePartPayCallBack1!=null&&threePartPayCallBack1.getPayResult()!=null&&"00".equals(threePartPayCallBack1.getPayResult())){
return R.ok("成功支付"+new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal("100"),2, RoundingMode.HALF_UP)+"");
if (threePartPayCallBack1 != null && threePartPayCallBack1.getPayResult() != null && "00".equals(threePartPayCallBack1.getPayResult())) {
return R.ok("成功支付" + new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP) + "");
}
return R.fail(threePartPayCallBack1==null?"查询失败,详见日志文件":threePartPayCallBack1.getErrMsg());
return R.fail(threePartPayCallBack1 == null ? "查询失败,详见日志文件" : threePartPayCallBack1.getErrMsg());
}
@@ -324,14 +259,13 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//款员信息查询
Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
//C.根据不同的请求方式处理参数
//获取动态参数
Map<String, String> paramMap = this.getParamMap(jsonObject, practitioner, threePartPayCallBack, paymentReconciliation, null, null);
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方平台http失败");
}
@@ -341,11 +275,11 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
ThreePartPayCallBack threePartPayCallBack1 = JSON.parseObject(threePartMapping, ThreePartPayCallBack.class);
threePartPayCallBackService.save(threePartPayCallBack1);
if(threePartPayCallBack1!=null&&threePartPayCallBack1.getPayResult()!=null&&"00".equals(threePartPayCallBack1.getPayResult())){
return R.ok("成功退费"+new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal("100"),2, RoundingMode.HALF_UP)+"");
if (threePartPayCallBack1 != null && threePartPayCallBack1.getPayResult() != null && "00".equals(threePartPayCallBack1.getPayResult())) {
return R.ok("成功退费" + new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP) + "");
}
return R.fail(threePartPayCallBack1==null?"退费失败,详见日志文件":threePartPayCallBack1.getErrMsg());
return R.fail(threePartPayCallBack1 == null ? "退费失败,详见日志文件" : threePartPayCallBack1.getErrMsg());
}
@@ -368,14 +302,13 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//款员信息查询
Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
//C.根据不同的请求方式处理参数
//获取动态参数
Map<String, String> paramMap = this.getParamMap(jsonObject, practitioner, threePartPayCallBack, paymentReconciliation, null, null);
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方平台http失败");
}
@@ -387,7 +320,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
ThreePartPayCallBack threePartPayCallBack1 = JSON.parseObject(threePartMapping, ThreePartPayCallBack.class);
threePartPayCallBackService.save(threePartPayCallBack1);
if("00".equals(threePartPayCallBack1.getPayResult())){
if ("00".equals(threePartPayCallBack1.getPayResult())) {
return R.ok();
}
@@ -408,20 +341,18 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//B.基础信息查询
//PaymentReconciliation paymentReconciliation = paymentReconciliationService.getById(paymentId);
ThreePartPayCallBack threePartPayCallBack = threePartPayCallBackService.getById(id);
//款员信息查询
Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
//C.根据不同的请求方式处理参数
//获取动态参数
Map<String, String> paramMap = this.getParamMap(jsonObject, practitioner, threePartPayCallBack, null, null, null);
//执行请求
String requestResult = executeRequest(requestMethod, threePartUrl, staticParam, paramMap);
if(StringUtils.isEmpty(requestResult)){
if (StringUtils.isEmpty(requestResult)) {
throw new ServiceException("三方平台http失败");
}
@@ -431,11 +362,11 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
//threePartPayCallBackService.save(JSON.parseObject(threePartMapping,ThreePartPayCallBack.class));
ThreePartPayCallBack threePartPayCallBack1 = JSON.parseObject(threePartMapping, ThreePartPayCallBack.class);
if(threePartPayCallBack1!=null&&threePartPayCallBack1.getPayResult()!=null&&"00".equals(threePartPayCallBack1.getPayResult())){
return R.ok("成功退费:"+new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP)+"");
if (threePartPayCallBack1 != null && threePartPayCallBack1.getPayResult() != null && "00".equals(threePartPayCallBack1.getPayResult())) {
return R.ok("成功退费:" + new BigDecimal(threePartPayCallBack1.getTxnAmt()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP) + "");
}
return R.ok(threePartPayCallBack1==null?"退费失败详见日志!":threePartPayCallBack1.getErrMsg());
return R.ok(threePartPayCallBack1 == null ? "退费失败详见日志!" : threePartPayCallBack1.getErrMsg());
}
@Override
@@ -446,20 +377,20 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.PaymentNo)),
request);
IPage<ThreePartCallBackVo> ThreePartCallBackVoIPage =
paymentMapper.getThreePartCallBackVoPage(new Page<>(pageNo, pageSize), queryWrapper);
IPage<ThreePartCallBackVo> ThreePartCallBackVoIPage
= paymentMapper.getThreePartCallBackVoPage(new Page<>(pageNo, pageSize), queryWrapper);
ThreePartCallBackVoIPage.getRecords().forEach(e->{
ThreePartCallBackVoIPage.getRecords().forEach(e -> {
e.setIdStr(e.getId().toString());
//e.setPaymentIdStr(e.getPaymentId()==null?null:e.getPaymentId().toString());
});
return R.ok(ThreePartCallBackVoIPage);
}
>>>>>>> v1.3
/**
* 拼接参数
*
* @param jsonObject 配置信息
* @param practitioner 款员信息
* @param threePartPayCallBack 原订单
@@ -467,92 +398,94 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
* @param txtCode 支付码
* @return
*/
private Map<String,String> getParamMap(JSONObject jsonObject,Practitioner practitioner, ThreePartPayCallBack threePartPayCallBack,PaymentReconciliation paymentReconciliation,String amountResult,String txtCode){
private Map<String, String> getParamMap(JSONObject jsonObject, Practitioner practitioner, ThreePartPayCallBack threePartPayCallBack, PaymentReconciliation paymentReconciliation, String amountResult, String txtCode) {
Map<String, String> paramMap = new HashMap<>();
//款员信息
if(practitioner!=null){
if (practitioner != null) {
String posNoKey = jsonObject.getString("posNo");//pos机编码
if(posNoKey!=null){
paramMap.put(posNoKey,practitioner.getPosNo());
if (posNoKey != null) {
paramMap.put(posNoKey, practitioner.getPosNo());
}
String userIdKey = jsonObject.getString("userId");
if(userIdKey!=null){
paramMap.put(userIdKey,practitioner.getId().toString());
if (userIdKey != null) {
paramMap.put(userIdKey, practitioner.getId().toString());
}
String userNameKey = jsonObject.getString("userName");
if(userNameKey!=null){
paramMap.put(userNameKey,practitioner.getName());
if (userNameKey != null) {
paramMap.put(userNameKey, practitioner.getName());
}
}
//原账单信息
if(threePartPayCallBack!=null){
if (threePartPayCallBack != null) {
String bankOrderIdKey = jsonObject.getString("bankOrderId");
if(bankOrderIdKey!=null){
paramMap.put(bankOrderIdKey,threePartPayCallBack.getTradeNo());//银行订单号
if (bankOrderIdKey != null) {
paramMap.put(bankOrderIdKey, threePartPayCallBack.getTradeNo());//银行订单号
}
String payWayOrderIdKey = jsonObject.getString("payWayOrderId");
if(payWayOrderIdKey!=null){
paramMap.put(payWayOrderIdKey,threePartPayCallBack.getTransNo());//支付渠道订单号
if (payWayOrderIdKey != null) {
paramMap.put(payWayOrderIdKey, threePartPayCallBack.getTransNo());//支付渠道订单号
}
String tranTypeKey = jsonObject.getString("tranType");
if(tranTypeKey!=null){
paramMap.put(tranTypeKey,threePartPayCallBack.getTranType());//交易类型
if (tranTypeKey != null) {
paramMap.put(tranTypeKey, threePartPayCallBack.getTranType());//交易类型
}
String payTypeKey = jsonObject.getString("payType");
if(payTypeKey!=null){
paramMap.put(payTypeKey,threePartPayCallBack.getPayType());//支付方式
if (payTypeKey != null) {
paramMap.put(payTypeKey, threePartPayCallBack.getPayType());//支付方式
}
String traceNoKey = jsonObject.getString("traceNo");
if(payWayOrderIdKey!=null){
paramMap.put(traceNoKey,threePartPayCallBack.getTraceNo());//终端流水号
if (payWayOrderIdKey != null) {
paramMap.put(traceNoKey, threePartPayCallBack.getTraceNo());//终端流水号
}
String txnTimeKey = jsonObject.getString("txnTime");
if(payWayOrderIdKey!=null){
paramMap.put(txnTimeKey,threePartPayCallBack.getTxnTime());//交易时间
if (payWayOrderIdKey != null) {
paramMap.put(txnTimeKey, threePartPayCallBack.getTxnTime());//交易时间
}
String merTradeNoKey = jsonObject.getString("merTradeNo");
if(payWayOrderIdKey!=null){
paramMap.put(merTradeNoKey,threePartPayCallBack.getMerTradeNo());//商户系统订单号
if (payWayOrderIdKey != null) {
paramMap.put(merTradeNoKey, threePartPayCallBack.getMerTradeNo());//商户系统订单号
}
<<<<<<< HEAD
=======
String tradeNoKey = jsonObject.getString("tradeNo");
if(tradeNoKey!=null){
paramMap.put(tradeNoKey,threePartPayCallBack.getTradeNo());//商户系统订单号
if (tradeNoKey != null) {
paramMap.put(tradeNoKey, threePartPayCallBack.getTradeNo());//商户系统订单号
}
String txnAmtKey = jsonObject.getString("txnAmt");
if(txnAmtKey!=null){
paramMap.put(txnAmtKey,threePartPayCallBack.getTxnAmt());//金额
if (txnAmtKey != null) {
paramMap.put(txnAmtKey, threePartPayCallBack.getTxnAmt());//金额
}
>>>>>>> v1.3
}
if(paymentReconciliation!=null){
if (paymentReconciliation != null) {
String paymentIdKey = jsonObject.getString("paymentId");
if(paymentIdKey!=null){
paramMap.put(paymentIdKey,paymentReconciliation.getId().toString());//his系统订单号
if (paymentIdKey != null) {
paramMap.put(paymentIdKey, paymentReconciliation.getId().toString());//his系统订单号
}
}
String amountResultKey = jsonObject.getString("amountResult");
String txtCodeKey = jsonObject.getString("txtCode");
if(amountResult!=null){
paramMap.put(amountResultKey,amountResult);//金额
if (amountResult != null) {
paramMap.put(amountResultKey, amountResult);//金额
}
if(txtCode!=null){
paramMap.put(txtCodeKey,txtCode);//扫码
if (txtCode != null) {
paramMap.put(txtCodeKey, txtCode);//扫码
}
return paramMap;
}
/**
* 安全替换,避免空指针
*/
private String renderTemplateSafe(String template, Map<String, String> params) {
if (template == null) return "";
if (params == null) params = new HashMap<>();
if (template == null) {
return "";
}
if (params == null) {
params = new HashMap<>();
}
String result = template;
for (Map.Entry<String, String> entry : params.entrySet()) {
@@ -566,55 +499,53 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
}
/**
<<<<<<< HEAD
=======
* 执行请求
*
* @param method 请求类型
* @param threePartUrl 路径参数
* @param staticParam 静态参数
* @param map 可变参数
* @return
*/
private String executeRequest(String method,String threePartUrl,String staticParam,Map<String,String> map){
private String executeRequest(String method, String threePartUrl, String staticParam, Map<String, String> map) {
String requestResult = "";
if(CommonConstants.Common.REQUEST_MAPPING_METHOD_GET.equals(method)){
if (CommonConstants.Common.REQUEST_MAPPING_METHOD_GET.equals(method)) {
//获取完整url
String url = renderTemplateSafe(threePartUrl, map);
System.out.println("三方支付请求入参:"+url);
logger.info("三方支付请求入参:"+url);
System.out.println("三方支付请求入参:" + url);
logger.info("三方支付请求入参:" + url);
//发送请求
requestResult = httpGet(url);
}else if(CommonConstants.Common.REQUEST_MAPPING_METHOD_POST.equals(method)){
} else if (CommonConstants.Common.REQUEST_MAPPING_METHOD_POST.equals(method)) {
JSONObject data = new JSONObject();
for (Map.Entry<String, String> stringStringEntry : map.entrySet()) {
data.put(stringStringEntry.getKey(),stringStringEntry.getValue());
data.put(stringStringEntry.getKey(), stringStringEntry.getValue());
}
if(staticParam!=null&& !StringUtils.isEmpty(staticParam)){
if (staticParam != null && !StringUtils.isEmpty(staticParam)) {
JSONObject staticDta = JSON.parseObject(staticParam);
data.putAll(staticDta);
}
System.out.println("三方支付请求入参:"+data.toJSONString());
logger.info("三方支付请求入参:"+data.toJSONString());
System.out.println("三方支付请求入参:" + data.toJSONString());
logger.info("三方支付请求入参:" + data.toJSONString());
requestResult = httpPost(threePartUrl,data.toJSONString());
requestResult = httpPost(threePartUrl, data.toJSONString());
}
System.out.println("三方支付请求出参:"+requestResult);
logger.info("三方支付请求出参:"+requestResult);
System.out.println("三方支付请求出参:" + requestResult);
logger.info("三方支付请求出参:" + requestResult);
return requestResult;
}
/**
>>>>>>> v1.3
* 发送http请求2025/05/02经测试若以自带的工具类发送请求失败故使用原peis系统中成功调用的写法重新封装
*
* @param url 路径
@@ -632,10 +563,7 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
HttpGet httpGet = new HttpGet(url);
// 执行http请求
response = httpClient.execute(httpGet);
<<<<<<< HEAD
=======
System.out.println("回复信息:"+JSON.toJSONString(response));
>>>>>>> v1.3
System.out.println("回复信息:" + JSON.toJSONString(response));
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
@@ -649,8 +577,6 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
}
return resultString;
}
<<<<<<< HEAD
=======
/**
* 发送http请求2025/05/02经测试若以自带的工具类发送请求失败故使用原peis系统中成功调用的写法重新封装
@@ -691,9 +617,6 @@ public class ThreePartPayServiceImpl implements ThreePartPayService {
@Override
public R<?> payForNenu(ThreePartPayDto threePartPayDto) {
return null;
}
>>>>>>> v1.3
}

View File

@@ -1,6 +1,5 @@
package com.openhis.web.paymentmanage.appservice.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.openhis.web.paymentmanage.util.ReverseMappingProperties;
@@ -16,17 +15,11 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@Service
<<<<<<< HEAD
@ConfigurationProperties(prefix = "threepart.mapping")
=======
>>>>>>> v1.3
@Data
@Slf4j
public class ThreePartSimpleFieldMappingService {
@Autowired
private ReverseMappingProperties properties;
@@ -38,11 +31,7 @@ public class ThreePartSimpleFieldMappingService {
public String reverseMap(String businessType, String sourceJson) {
try {
// 1. 获取映射配置
<<<<<<< HEAD
Map<String, String> mappingConfig = properties.getMappingConfig(businessType);
=======
Map<String, String> mappingConfig = properties.getReverseMappings().get(businessType);
>>>>>>> v1.3
if (mappingConfig.isEmpty()) {
log.warn("未找到业务类型[{}]的映射配置", businessType);
return sourceJson; // 返回原JSON
@@ -50,14 +39,12 @@ public class ThreePartSimpleFieldMappingService {
// 2. 解析源JSON
Map<String, Object> sourceMap;
<<<<<<< HEAD
=======
// 修复BOM问题
if (sourceJson.startsWith("\uFEFF")) {
sourceJson = sourceJson.substring(1);
}
>>>>>>> v1.3
sourceMap = objectMapper.readValue(sourceJson, new TypeReference<Map<String,Object>>(){});
sourceMap = objectMapper.readValue(sourceJson, new TypeReference<Map<String, Object>>() {
});
// 3. 执行反向映射
Map<String, Object> resultMap = reverseMap(mappingConfig, sourceMap);
@@ -83,7 +70,7 @@ public class ThreePartSimpleFieldMappingService {
* 核心映射逻辑
*/
private Map<String, Object> reverseMap(Map<String, String> mappingConfig,
Map<String, Object> sourceMap) {
Map<String, Object> sourceMap) {
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<String, Object> entry : sourceMap.entrySet()) {
@@ -111,7 +98,7 @@ public class ThreePartSimpleFieldMappingService {
* 批量处理
*/
public List<Map<String, Object>> reverseMapBatch(String businessType,
List<Map<String, Object>> sourceList) {
List<Map<String, Object>> sourceList) {
return sourceList.stream()
.map(source -> reverseMap(businessType, source))
.collect(Collectors.toList());

View File

@@ -85,7 +85,7 @@ public class PaymentReconciliationController {
if (result.getCode() == 200) {
PaymentReconciliation paymentRecon = null;
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
paymentRecon = (PaymentReconciliation)result.getData();
paymentRecon = (PaymentReconciliation) result.getData();
}
Map detail = iChargeBillService.getDetail(paymentRecon.getId());
if ("0".equals(TenantOptionUtil.getOptionContent(TenantOptionDict.INVOICE_SWITCH))) {
@@ -115,13 +115,13 @@ public class PaymentReconciliationController {
if (result.getCode() == 200) {
PaymentReconciliation paymentRecon = null;
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
paymentRecon = (PaymentReconciliation)result.getData();
paymentRecon = (PaymentReconciliation) result.getData();
}
if ("0".equals(TenantOptionUtil.getOptionContent(TenantOptionDict.INVOICE_SWITCH))) {
return result;
} else {
R<?> eleResult =
eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelPaymentDto.getReason());
R<?> eleResult
= eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelPaymentDto.getReason());
if (eleResult.getCode() != 200) {
// 因取消付款成功前端需要关闭弹窗此处信息仅用于提示所以返回ok
return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg());
@@ -143,10 +143,10 @@ public class PaymentReconciliationController {
*/
@GetMapping("/page")
public R<?> paymentPage(@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "kinsEnum", defaultValue = "") Integer kinsEnum,
@RequestParam(value = "invoiceNo", defaultValue = "") String invoiceNo,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
@RequestParam(value = "kinsEnum", defaultValue = "") Integer kinsEnum,
@RequestParam(value = "invoiceNo", defaultValue = "") String invoiceNo,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return R.ok(paymentReconciliationService.getPage(searchKey, kinsEnum, invoiceNo, pageNo, pageSize, request));
}
@@ -179,14 +179,14 @@ public class PaymentReconciliationController {
* @return 操做结果
*/
@PostMapping("/reg-pay")
public R<?> regPay(@Valid @RequestBody OutpatientRegistrationSettleParam outpatientRegistrationAddParam){
public R<?> regPay(@Valid @RequestBody OutpatientRegistrationSettleParam outpatientRegistrationAddParam) {
R<?> result = paymentReconciliationService.regPay(outpatientRegistrationAddParam,
outpatientRegistrationAddParam.getChrgBchno(), outpatientRegistrationAddParam.getPaymentDetails());
outpatientRegistrationAddParam.getChrgBchno(), outpatientRegistrationAddParam.getPaymentDetails());
// 付款成功后,开具发票
if (result.getCode() == 200) {
PaymentReconciliation paymentRecon = null;
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
paymentRecon = (PaymentReconciliation)result.getData();
paymentRecon = (PaymentReconciliation) result.getData();
}
Map detail = iChargeBillService.getDetail(paymentRecon.getId());
Long encounterId = paymentRecon.getEncounterId();
@@ -228,7 +228,7 @@ public class PaymentReconciliationController {
if (r.getCode() == 200) {
PaymentReconciliation paymentRecon = null;
if (PaymentReconciliation.class.isAssignableFrom(r.getData().getClass())) {
paymentRecon = (PaymentReconciliation)r.getData();
paymentRecon = (PaymentReconciliation) r.getData();
}
Long encounterId = paymentRecon.getEncounterId();
R<?> eleResult = eleInvoiceService.invoiceZYMake(paymentRecon.getId(), encounterId);
@@ -255,10 +255,10 @@ public class PaymentReconciliationController {
if (r.getCode() == 200) {
PaymentReconciliation paymentRecon = null;
if (PaymentReconciliation.class.isAssignableFrom(r.getData().getClass())) {
paymentRecon = (PaymentReconciliation)r.getData();
paymentRecon = (PaymentReconciliation) r.getData();
}
R<?> eleResult =
eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelPaymentInpatientDto.getReason());
R<?> eleResult
= eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelPaymentInpatientDto.getReason());
if (eleResult.getCode() != 200) {
// 因取消付款成功前端需要关闭弹窗此处信息仅用于提示所以返回ok
return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg());
@@ -277,8 +277,6 @@ public class PaymentReconciliationController {
public R<?> nenuBpcPay(@RequestBody NenuBpcPayDto nenuBpcPayDto) {
return R.ok(paymentReconciliationService.nenuBpcPay(nenuBpcPayDto));
}
<<<<<<< HEAD
=======
/**
* 退号查询
@@ -287,8 +285,7 @@ public class PaymentReconciliationController {
* @return 操作结果
*/
@GetMapping("/pre-cancel-reg")
public R<?> cancelPreReg(@RequestParam(name = "encounterId" ) Long encounterId) {
public R<?> cancelPreReg(@RequestParam(name = "encounterId") Long encounterId) {
return R.ok(paymentReconciliationService.cancelPreReg(encounterId));
}
>>>>>>> v1.3
}

View File

@@ -20,17 +20,9 @@ import com.openhis.yb.dto.ThreePartPayDto;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
<<<<<<< HEAD
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
=======
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
>>>>>>> v1.3
import java.math.BigDecimal;
import java.security.Security;
import java.util.HashMap;
@@ -53,96 +45,95 @@ public class ThreePartPayController {
/**
* 扫码付款
*
* @return
*/
<<<<<<< HEAD
=======
@PostMapping("/sign")
public R<?> sign(){
public R<?> sign() {
return threePartPayService.sign();
}
/**
* 扫码付款
*
* @return
*/
@PostMapping("/sign-out")
public R<?> signOut(){
public R<?> signOut() {
return threePartPayService.signOut();
}
/**
* 扫码付款
*
* @return
*/
>>>>>>> v1.3
@PostMapping("/pay-for")
public R<?> payFor(@RequestBody ThreePartPayDto threePartPayDto){
public R<?> payFor(@RequestBody ThreePartPayDto threePartPayDto) {
return threePartPayService.payFor(threePartPayDto);
}
<<<<<<< HEAD
=======
/**
* 扫码付款(师大)
*
* @return
*/
@PostMapping("/pay-for-nenu")
public R<?> payForNenu(@RequestBody ThreePartPayDto threePartPayDto){
public R<?> payForNenu(@RequestBody ThreePartPayDto threePartPayDto) {
return threePartPayService.payForNenu(threePartPayDto);
}
/**
* 扫码付款结果查询(预结算窗口)
*
* @return
*/
@GetMapping("/pay-query")
public R<?> payQuery(@RequestParam("paymentId") Long paymentId){
public R<?> payQuery(@RequestParam("paymentId") Long paymentId) {
return threePartPayService.payQuery(paymentId);
//return threePartPayService.returnQuery(threePartPayDto.getId());
}
/**
* 当天退费
*
* @return
*/
@GetMapping("/return-bill")
public R<?> returnBill(@RequestParam("paymentId") Long paymentId){
public R<?> returnBill(@RequestParam("paymentId") Long paymentId) {
return threePartPayService.returnBill(paymentId);
}
/**
* 隔天退费
*
* @return
*/
@GetMapping("/return-goods")
public R<?> returnGoods(@RequestParam("paymentId") Long paymentId){
public R<?> returnGoods(@RequestParam("paymentId") Long paymentId) {
return threePartPayService.returnGoods(paymentId);
}
/**
* 退费结果查询
*
* @return
*/
@GetMapping("/return-query")
public R<?> returnQuery(@RequestParam("id") Long id){
public R<?> returnQuery(@RequestParam("id") Long id) {
return threePartPayService.returnQuery(id);
}
/**
* 网银支付参数
*
* @return
*/
@GetMapping("/page")
public R<?> page(@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request){
return threePartPayService.getPage(searchKey,pageNo,pageSize,request);
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
return threePartPayService.getPage(searchKey, pageNo, pageSize, request);
}
>>>>>>> v1.3
}

View File

@@ -8,11 +8,7 @@ import java.util.HashMap;
import java.util.Map;
@Configuration
<<<<<<< HEAD
@ConfigurationProperties(prefix = "threepaymapping")
=======
@ConfigurationProperties(prefix = "mapping.reverse-mappings")
>>>>>>> v1.3
@Data
public class ReverseMappingProperties {
@@ -31,4 +27,4 @@ public class ReverseMappingProperties {
public Map<String, Map<String, String>> getAllMappings() {
return reverseMappings;
}
}
}