解决合并冲突
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.openhis.web.paymentmanage.appservice;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.openhis.web.paymentmanage.dto.ChangePriceListDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Desc:
|
||||
* @Author raymond
|
||||
* @Date 16:09 2025/10/15
|
||||
* @return
|
||||
**/
|
||||
public interface IChangePriceService {
|
||||
|
||||
PageInfo<ChangePriceListDto> searchMedicationList(Integer pageNo, Integer pageSize);
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import com.openhis.web.chargemanage.dto.OutpatientRegistrationAddParam;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationSettleParam;
|
||||
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.yb.dto.PaymentDetailDto;
|
||||
import com.openhis.yb.dto.PaymentDto;
|
||||
@@ -59,7 +60,7 @@ public interface IPaymentRecService {
|
||||
* @param request 请求参数
|
||||
* @return 结果
|
||||
*/
|
||||
IPage<PaymentVO> getPage(String searchKey, Integer kingEnum,String invoiceNo, Integer pageNo, Integer pageSize,
|
||||
IPage<PaymentVO> getPage(String searchKey, Integer kingEnum, String invoiceNo, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request);
|
||||
|
||||
/**
|
||||
@@ -126,4 +127,12 @@ public interface IPaymentRecService {
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> inpatientUnPay(Long paymentId);
|
||||
|
||||
/**
|
||||
* BPC支付
|
||||
*
|
||||
* @param nenuBpcPayDto bpc支付参数
|
||||
* @return 结果
|
||||
*/
|
||||
String nenuBpcPay(NenuBpcPayDto nenuBpcPayDto);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.openhis.web.paymentmanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.yb.dto.ThreePartPayDto;
|
||||
|
||||
/**
|
||||
* 第三方支付应用层Service
|
||||
*
|
||||
* @author SunJQ
|
||||
* @date 2025-03-29
|
||||
*/
|
||||
public interface ThreePartPayService {
|
||||
R<?> payFor(ThreePartPayDto threePartPayDto);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.openhis.web.paymentmanage.appservice.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.openhis.medication.domain.MedicationDefinition;
|
||||
import com.openhis.web.paymentmanage.appservice.IChangePriceService;
|
||||
import com.openhis.web.paymentmanage.dto.ChangePriceListDto;
|
||||
import com.openhis.web.paymentmanage.mapper.ChangePriceMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ChangePriceImpl
|
||||
* @Description TODO
|
||||
* @Author raymond
|
||||
* @Date 2025/10/15 16:10
|
||||
* @Version 1.0
|
||||
**/
|
||||
@Component
|
||||
public class ChangePriceImpl implements IChangePriceService {
|
||||
|
||||
@Resource
|
||||
private ChangePriceMapper changePriceMapper;
|
||||
@Override
|
||||
public PageInfo<ChangePriceListDto> searchMedicationList(Integer pageNo, Integer pageSize) {
|
||||
// PageHelper.startPage(pageNo,pageSize);
|
||||
List<MedicationDefinition> medicationDefinitions = this.changePriceMapper.searchMedicationList();
|
||||
// PageInfo<ChangePriceListDto> pageInfo = new PageInfo<>(list);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,31 +11,49 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.service.*;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.enums.ybenums.YbEncounterClass;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
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;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.core.domain.model.LoginUser;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.*;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.openhis.administration.domain.ChargeItem;
|
||||
import com.openhis.administration.domain.Encounter;
|
||||
import com.openhis.administration.domain.Invoice;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.service.IChargeItemService;
|
||||
import com.openhis.administration.service.IEncounterService;
|
||||
import com.openhis.administration.service.IInvoiceService;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.enums.ybenums.YbEncounterClass;
|
||||
import com.openhis.common.enums.ybenums.YbPayment;
|
||||
import com.openhis.config.HttpConfig;
|
||||
import com.openhis.financial.domain.PaymentRecDetail;
|
||||
@@ -48,24 +66,8 @@ import com.openhis.web.paymentmanage.mapper.EleInvoiceMapper;
|
||||
import com.openhis.yb.domain.ClinicReg;
|
||||
import com.openhis.yb.service.IClinicSettleService;
|
||||
import com.openhis.yb.service.IRegService;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* 电子发票接口Service
|
||||
@@ -76,6 +78,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@Component
|
||||
@Slf4j
|
||||
public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
private static final BigDecimal ZERO = new BigDecimal("0.00");
|
||||
Logger logger = LoggerFactory.getLogger(EleInvoiceServiceImpl.class);
|
||||
@Resource
|
||||
EleInvoiceMapper eleInvoiceMapper;
|
||||
@@ -83,9 +86,6 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
IInvoiceService invoiceService;
|
||||
@Resource
|
||||
IPractitionerService practitionerService;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
IRegService regService;
|
||||
@Resource
|
||||
@@ -98,10 +98,155 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
IChargeItemService chargeItemService;
|
||||
@Resource
|
||||
IEncounterService encounterService;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Autowired
|
||||
private HttpConfig httpConfig;
|
||||
private static final BigDecimal ZERO = new BigDecimal("0.00");
|
||||
|
||||
public static JSONObject PreInvoicePostForward(JSONObject bill, String endpoint) {
|
||||
String resultString = "";
|
||||
// JSONObject result = new JSONObject();
|
||||
// 获取当前租户的option信息
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
|
||||
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
|
||||
String appKey = optionJson.getString(CommonConstants.Option.KEY);
|
||||
|
||||
EleInvioceBillDto eleInvioceBillDto = new EleInvioceBillDto();
|
||||
eleInvioceBillDto.setBaseUrl(baseUrl);
|
||||
eleInvioceBillDto.setEndpoint(endpoint);
|
||||
eleInvioceBillDto.setAppKey(appKey);
|
||||
eleInvioceBillDto.setAppID(appID);
|
||||
eleInvioceBillDto.setJsonObject(bill);
|
||||
|
||||
// 创建Http请求
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000)
|
||||
.setSocketTimeout(30000).build();
|
||||
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
|
||||
CloseableHttpResponse response = null;
|
||||
// 发送请求
|
||||
try {
|
||||
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);
|
||||
httpPost.setEntity(stringEntity);
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpPost);
|
||||
if (response == null) {
|
||||
throw new ServiceException("Http请求异常,未接受返回参数");
|
||||
}
|
||||
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Http请求异常,请稍后再试。");
|
||||
} finally {
|
||||
if (response != null) {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
// logger.error("关闭响应异常", e);
|
||||
throw new ServiceException("未关闭系统资源:" + e.getStackTrace());
|
||||
}
|
||||
}
|
||||
}
|
||||
return JSONObject.parseObject(resultString);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送请求
|
||||
*
|
||||
* @param bill 请求参数
|
||||
* @param endpoint 请求后缀url
|
||||
* @return 返回值
|
||||
*/
|
||||
public static JSONObject PreInvoicePost(JSONObject bill, String endpoint) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
// 获取当前租户的option信息
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
|
||||
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
|
||||
// 拼接成完整 URL(作为路径)
|
||||
String cleanUrl = baseUrl + "/" + endpoint; // 确保用 "/" 分隔
|
||||
String url = cleanUrl.trim().replaceAll("^\"|\"$", "") // 去除首尾引号
|
||||
.replaceAll("\\s+", "")// 去除首尾引号
|
||||
.replaceAll("\"", ""); // 去除中间引号
|
||||
|
||||
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
|
||||
String appKey = optionJson.getString(CommonConstants.Option.KEY);
|
||||
String data = bill.toJSONString();
|
||||
String version = "1.0";
|
||||
// 请求随机标识 noise
|
||||
String noise = UUID.randomUUID().toString();
|
||||
|
||||
data = Base64.getEncoder().encodeToString(data.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
StringBuilder str = new StringBuilder();
|
||||
str.append("appid=").append(appID);
|
||||
str.append("&data=").append(data);
|
||||
str.append("&noise=").append(noise);
|
||||
str.append("&key=").append(appKey);
|
||||
str.append("&version=").append(version);
|
||||
String sign = DigestUtils.md5Hex(str.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("appid", appID);
|
||||
map.put("data", data);
|
||||
map.put("noise", noise);
|
||||
map.put("sign", sign);
|
||||
map.put("version", version);
|
||||
|
||||
try {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
String respContent = null;
|
||||
// 请求参数转JOSN字符串
|
||||
StringEntity entity = new StringEntity(new ObjectMapper().writeValueAsString(map), "utf-8");
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpPost.setEntity(entity);
|
||||
HttpResponse resp = client.execute(httpPost);
|
||||
|
||||
if (resp.getStatusLine().getStatusCode() == 200) {
|
||||
String rev = EntityUtils.toString(resp.getEntity());
|
||||
// System.out.println("返回串--》"+rev);
|
||||
Map resultData = new ObjectMapper().readValue(rev, Map.class);
|
||||
String rdata = resultData.get("data").toString();
|
||||
String rnoise = resultData.get("noise").toString();
|
||||
// 1、拼接返回验签参数
|
||||
StringBuilder str1 = new StringBuilder();
|
||||
str1.append("appid=").append(appID);
|
||||
str1.append("&data=").append(rdata);
|
||||
str1.append("&noise=").append(rnoise);
|
||||
str1.append("&key=").append(appKey);
|
||||
str1.append("&version=").append(version);
|
||||
// 3.MD5加密 生成sign
|
||||
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);
|
||||
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));
|
||||
|
||||
JSONObject resobj = JSONObject.parseObject(busData);
|
||||
result.put("success", true);
|
||||
result.put("result", resobj);
|
||||
} else {
|
||||
result.put("msg", "web响应失败!");
|
||||
result.put("success", false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("msg", e.getMessage());
|
||||
result.put("success", false);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 电子票据补开接口
|
||||
@@ -247,7 +392,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
chargeDetail.put("unit", "项");
|
||||
// std 收费标准 Number 14,2 是
|
||||
BigDecimal std =
|
||||
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 2, RoundingMode.HALF_UP);
|
||||
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
|
||||
// 精确表示,避免科学计数法
|
||||
chargeDetail.put("std", df.format(std));
|
||||
// number 数量 Number 14,2 是
|
||||
@@ -308,9 +453,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
|
||||
System.out.println(JSON.toJSONString(bill));
|
||||
JSONObject resobj;
|
||||
if("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))){
|
||||
if ("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
|
||||
resobj = PreInvoicePostForward(bill, "api/medical/invEBillRegistration");
|
||||
}else{
|
||||
} else {
|
||||
resobj = PreInvoicePost(bill, "api/medical/invEBillRegistration");
|
||||
}
|
||||
if (resobj.getBooleanValue("success")) {
|
||||
@@ -321,7 +466,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
redata64 = rejson.getString("message").toString();
|
||||
srcdata = new String(Base64.getDecoder().decode(redata64), StandardCharsets.UTF_8);
|
||||
redata = JSONObject.parseObject(srcdata);
|
||||
logger.info("挂号信息:"+JSON.toJSONString(redata));
|
||||
logger.info("挂号信息:" + JSON.toJSONString(redata));
|
||||
// 获取发票管理表信息
|
||||
Invoice invoice = invoiceService.getById(paymentInfo.getInvoiceId());
|
||||
// 状态
|
||||
@@ -498,13 +643,22 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
otherInfo.put("infoValue", clinicSettle.getHospPartAmt() == null ? ZERO : clinicSettle.getHospPartAmt());
|
||||
otherInfos.add(otherInfo);
|
||||
|
||||
// 师大公费医疗
|
||||
BigDecimal otherPay = clinicSettle.getOthPay() == null ? ZERO : clinicSettle.getOthPay();
|
||||
BigDecimal gfRatio = clinicSettle.getGfRatio() == null ? ZERO : clinicSettle.getGfRatio();
|
||||
|
||||
otherInfo = new JSONObject();
|
||||
otherInfo.put("infoNo", "1");
|
||||
otherInfo.put("infoName", "其他支出");
|
||||
otherInfo.put("infoValue", clinicSettle.getOthPay() == null ? ZERO : clinicSettle.getOthPay());
|
||||
otherInfo.put("infoValue", otherPay.add(gfRatio));
|
||||
otherInfos.add(otherInfo);
|
||||
bill.put("otherInfo", otherInfos);
|
||||
|
||||
// 师大remark记录
|
||||
if (gfRatio.compareTo(BigDecimal.ZERO) > 0) {
|
||||
bill.put("remark", "学校垫支金额:" + gfRatio);
|
||||
}
|
||||
|
||||
// ------项目------
|
||||
// 医疗收费项目类别
|
||||
// 01 床位费,02 诊察费,03 检查费,04 化验费,05 治疗费,06 手术费,07 护理费,08 卫生材料费,09 西药费,10 中药饮片费,11 中成药费,12 一般诊疗费,13 挂号费,14 其他费
|
||||
@@ -536,7 +690,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
chargeDetail.put("unit", "项");
|
||||
// std 收费标准 Number 14,2 是
|
||||
BigDecimal std =
|
||||
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 2, RoundingMode.HALF_UP);
|
||||
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());
|
||||
@@ -595,9 +749,9 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
String srcmsg;
|
||||
System.out.println(JSON.toJSONString(bill));
|
||||
JSONObject resobj;
|
||||
if("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))){
|
||||
if ("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
|
||||
resobj = PreInvoicePostForward(bill, "api/medical/invoiceEBillOutpatient");
|
||||
}else{
|
||||
} else {
|
||||
resobj = PreInvoicePost(bill, "api/medical/invoiceEBillOutpatient");
|
||||
}
|
||||
if (resobj.getBooleanValue("success")) {
|
||||
@@ -607,7 +761,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
redata64 = rejson.getString("message").toString();
|
||||
srcdata = new String(Base64.getDecoder().decode(redata64), StandardCharsets.UTF_8);
|
||||
redata = JSONObject.parseObject(srcdata);
|
||||
logger.info("门诊信息:"+JSON.toJSONString(redata));
|
||||
logger.info("门诊信息:" + JSON.toJSONString(redata));
|
||||
// 获取发票管理表信息
|
||||
Invoice invoice = invoiceService.getById(paymentInfo.getInvoiceId());
|
||||
// 状态
|
||||
@@ -874,7 +1028,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
chargeDetail.put("unit", "项");
|
||||
// std 收费标准 Number 14,2 是
|
||||
BigDecimal std =
|
||||
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 2, RoundingMode.HALF_UP);
|
||||
detail.getAmt().divide(new BigDecimal(detail.getNumber().toString()), 6, RoundingMode.HALF_UP);
|
||||
// 精确表示,避免科学计数法
|
||||
chargeDetail.put("std", df.format(std));
|
||||
// number 数量 Number 14,2 是
|
||||
@@ -894,11 +1048,11 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
String redata64;
|
||||
String srcdata;
|
||||
String srcmsg;
|
||||
//JSONObject resobj = PreInvoicePostForward(bill, "api/medical/invEBillHospitalized");
|
||||
// JSONObject resobj = PreInvoicePostForward(bill, "api/medical/invEBillHospitalized");
|
||||
JSONObject resobj;
|
||||
if("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))){
|
||||
if ("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
|
||||
resobj = PreInvoicePostForward(bill, "api/medical/invEBillHospitalized");
|
||||
}else{
|
||||
} else {
|
||||
resobj = PreInvoicePost(bill, "api/medical/invEBillHospitalized");
|
||||
}
|
||||
if (resobj.getBooleanValue("success")) {
|
||||
@@ -908,7 +1062,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
redata64 = rejson.getString("message").toString();
|
||||
srcdata = new String(Base64.getDecoder().decode(redata64), StandardCharsets.UTF_8);
|
||||
redata = JSONObject.parseObject(srcdata);
|
||||
logger.info("住院信息:"+JSON.toJSONString(redata));
|
||||
logger.info("住院信息:" + JSON.toJSONString(redata));
|
||||
// 获取发票管理表信息
|
||||
Invoice invoice = invoiceService.getById(paymentInfo.getInvoiceId());
|
||||
// 状态
|
||||
@@ -1222,10 +1376,13 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
}
|
||||
} else {
|
||||
// 医保
|
||||
// 2025/10/20 长大异常情况 24.24+29.05+4.15》53.29,猜测实际医保段otherpay是包含在fundpay或者zhpay的某一个
|
||||
payChannelDetail = new JSONObject();
|
||||
payChannelDetail.put("payChannelCode", "11");
|
||||
payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount().add(paymentInfo
|
||||
.getOtherPayAmount().add(paymentInfo.getZhPayAmount()).add(paymentInfo.getAelfYbZhGjValue()))));
|
||||
// payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount().add(paymentInfo
|
||||
// .getOtherPayAmount().add(paymentInfo.getZhPayAmount()).add(paymentInfo.getAelfYbZhGjValue()))));
|
||||
payChannelDetail.put("payChannelValue", df.format(paymentInfo.getYbFundPayAmount()
|
||||
.add(paymentInfo.getZhPayAmount()).add(paymentInfo.getAelfYbZhGjValue())));
|
||||
payChannelDetails.add(payChannelDetail);
|
||||
|
||||
// 现金
|
||||
@@ -1328,12 +1485,12 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
String srcdata;
|
||||
String srcmsg;
|
||||
|
||||
//JSONObject resobj = PreInvoicePostForward(bill, "api/medical/writeOffEBill");
|
||||
// JSONObject resobj = PreInvoicePostForward(bill, "api/medical/writeOffEBill");
|
||||
JSONObject resobj;
|
||||
logger.info("冲红信息入参:"+JSON.toJSONString(bill));
|
||||
if("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))){
|
||||
logger.info("冲红信息入参:" + JSON.toJSONString(bill));
|
||||
if ("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
|
||||
resobj = PreInvoicePostForward(bill, "api/medical/writeOffEBill");
|
||||
}else{
|
||||
} else {
|
||||
resobj = PreInvoicePost(bill, "api/medical/writeOffEBill");
|
||||
}
|
||||
if (resobj.getBooleanValue("success")) {
|
||||
@@ -1343,7 +1500,7 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
redata64 = rejson.getString("message").toString();
|
||||
srcdata = new String(Base64.getDecoder().decode(redata64), StandardCharsets.UTF_8);
|
||||
redata = JSONObject.parseObject(srcdata);
|
||||
logger.info("冲红信息:"+JSON.toJSONString(redata));
|
||||
logger.info("冲红信息:" + JSON.toJSONString(redata));
|
||||
// 修改发票管理表数据
|
||||
// 状态
|
||||
invoice.setStatusEnum(InvoiceStatus.CANCELLED);
|
||||
@@ -1431,151 +1588,6 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
}
|
||||
}
|
||||
|
||||
public static JSONObject PreInvoicePostForward(JSONObject bill, String endpoint) {
|
||||
String resultString = "";
|
||||
//JSONObject result = new JSONObject();
|
||||
// 获取当前租户的option信息
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
|
||||
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
|
||||
String appKey = optionJson.getString(CommonConstants.Option.KEY);
|
||||
|
||||
EleInvioceBillDto eleInvioceBillDto = new EleInvioceBillDto();
|
||||
eleInvioceBillDto.setBaseUrl(baseUrl);
|
||||
eleInvioceBillDto.setEndpoint(endpoint);
|
||||
eleInvioceBillDto.setAppKey(appKey);
|
||||
eleInvioceBillDto.setAppID(appID);
|
||||
eleInvioceBillDto.setJsonObject(bill);
|
||||
|
||||
// 创建Http请求
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30000).setConnectionRequestTimeout(30000)
|
||||
.setSocketTimeout(30000).build();
|
||||
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
|
||||
CloseableHttpResponse response = null;
|
||||
// 发送请求
|
||||
try {
|
||||
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);
|
||||
httpPost.setEntity(stringEntity);
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpPost);
|
||||
if(response==null){
|
||||
throw new ServiceException("Http请求异常,未接受返回参数");
|
||||
}
|
||||
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Http请求异常,请稍后再试。");
|
||||
}
|
||||
finally {
|
||||
if (response != null) {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
//logger.error("关闭响应异常", e);
|
||||
throw new ServiceException("未关闭系统资源:"+e.getStackTrace());
|
||||
}
|
||||
}
|
||||
}
|
||||
return JSONObject.parseObject(resultString);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送请求
|
||||
*
|
||||
* @param bill 请求参数
|
||||
* @param endpoint 请求后缀url
|
||||
* @return 返回值
|
||||
*/
|
||||
public static JSONObject PreInvoicePost(JSONObject bill, String endpoint) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
// 获取当前租户的option信息
|
||||
JSONObject optionJson = SecurityUtils.getLoginUser().getOptionJson();
|
||||
|
||||
String baseUrl = optionJson.getString(CommonConstants.Option.URL);
|
||||
// 拼接成完整 URL(作为路径)
|
||||
String cleanUrl = baseUrl + "/" + endpoint; // 确保用 "/" 分隔
|
||||
String url = cleanUrl.trim().replaceAll("^\"|\"$", "") // 去除首尾引号
|
||||
.replaceAll("\\s+", "")// 去除首尾引号
|
||||
.replaceAll("\"", ""); // 去除中间引号
|
||||
|
||||
String appID = optionJson.getString(CommonConstants.Option.APP_ID);
|
||||
String appKey = optionJson.getString(CommonConstants.Option.KEY);
|
||||
String data = bill.toJSONString();
|
||||
String version = "1.0";
|
||||
// 请求随机标识 noise
|
||||
String noise = UUID.randomUUID().toString();
|
||||
|
||||
data = Base64.getEncoder().encodeToString(data.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
StringBuilder str = new StringBuilder();
|
||||
str.append("appid=").append(appID);
|
||||
str.append("&data=").append(data);
|
||||
str.append("&noise=").append(noise);
|
||||
str.append("&key=").append(appKey);
|
||||
str.append("&version=").append(version);
|
||||
String sign = DigestUtils.md5Hex(str.toString().getBytes(Charset.forName("UTF-8"))).toUpperCase();
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("appid", appID);
|
||||
map.put("data", data);
|
||||
map.put("noise", noise);
|
||||
map.put("sign", sign);
|
||||
map.put("version", version);
|
||||
|
||||
try {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
String respContent = null;
|
||||
// 请求参数转JOSN字符串
|
||||
StringEntity entity = new StringEntity(new ObjectMapper().writeValueAsString(map), "utf-8");
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/json");
|
||||
httpPost.setEntity(entity);
|
||||
HttpResponse resp = client.execute(httpPost);
|
||||
|
||||
if (resp.getStatusLine().getStatusCode() == 200) {
|
||||
String rev = EntityUtils.toString(resp.getEntity());
|
||||
// System.out.println("返回串--》"+rev);
|
||||
Map resultData = new ObjectMapper().readValue(rev, Map.class);
|
||||
String rdata = resultData.get("data").toString();
|
||||
String rnoise = resultData.get("noise").toString();
|
||||
// 1、拼接返回验签参数
|
||||
StringBuilder str1 = new StringBuilder();
|
||||
str1.append("appid=").append(appID);
|
||||
str1.append("&data=").append(rdata);
|
||||
str1.append("&noise=").append(rnoise);
|
||||
str1.append("&key=").append(appKey);
|
||||
str1.append("&version=").append(version);
|
||||
// 3.MD5加密 生成sign
|
||||
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);
|
||||
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));
|
||||
|
||||
JSONObject resobj = JSONObject.parseObject(busData);
|
||||
result.put("success", true);
|
||||
result.put("result", resobj);
|
||||
} else {
|
||||
result.put("msg", "web响应失败!");
|
||||
result.put("success", false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("msg", e.getMessage());
|
||||
result.put("success", false);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过paymentId获取医保结算实体
|
||||
*
|
||||
@@ -1631,6 +1643,10 @@ public class EleInvoiceServiceImpl implements IEleInvoiceService {
|
||||
if (YbPayment.OVERLMT_SELFPAY.getValue().equals(detail.getPayEnum())) {
|
||||
invoiceBaseInfoDto.setOverlmtSelfpay(detail.getAmount());
|
||||
}
|
||||
// 学校垫支
|
||||
if (YbPayment.SCHOOL_GF_PAY.getValue().equals(detail.getPayEnum())) {
|
||||
invoiceBaseInfoDto.setGfRatio(detail.getAmount());
|
||||
}
|
||||
}
|
||||
return invoiceBaseInfoDto;
|
||||
}
|
||||
|
||||
@@ -182,6 +182,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.SELF_CASH_ALI_VALUE.getValue())) {
|
||||
map.put("aliCash", paymentRecDetail.getAmount());// 现金(支付宝)
|
||||
}
|
||||
if (Objects.equals(paymentRecDetail.getPayEnum(), YbPayment.INSCP_SCP_AMT.getValue())) {
|
||||
map.put("FHZCAmount", paymentRecDetail.getAmount());// 符合政策金额
|
||||
}
|
||||
}
|
||||
|
||||
Invoice invoice = iInvoiceService.getOne(new LambdaQueryWrapper<Invoice>()
|
||||
@@ -1440,6 +1443,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
BigDecimal uniSum = BigDecimal.ZERO;// 银行卡总数
|
||||
BigDecimal SelfCashSum = BigDecimal.ZERO;// 自费现金总额
|
||||
BigDecimal YbCashSum = BigDecimal.ZERO;// 医保现金总额
|
||||
BigDecimal discountSum = BigDecimal.ZERO;// 优惠金额
|
||||
// 长大版本要显示出来省市医保的区别
|
||||
List<Contract> redisContractList = iContractService.getRedisContractList();
|
||||
Map<String, List<Contract>> contractMapByBusNo =
|
||||
@@ -1480,6 +1484,9 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
if (YbPayment.SELF_YB_ZH_PAY.getValue().equals(paymentRecDetailAccountResult.getPayEnum())) {
|
||||
zhSum = zhSum.add(paymentRecDetailAccountResult.getAmount());
|
||||
}
|
||||
if (YbPayment.DISCOUNT_PAY.getValue().equals(paymentRecDetailAccountResult.getPayEnum())) {
|
||||
discountSum = discountSum.add(paymentRecDetailAccountResult.getAmount());
|
||||
}
|
||||
// 其他的大病支付或者慢病特病支付往下接if
|
||||
map.put(
|
||||
contractMapByBusNo.get(key) == null ? key : contractMapByBusNo.get(key).get(0).getBusNo() + "cash",
|
||||
@@ -1500,6 +1507,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
map.put("vxCashSum", vxCashSum);// 自费现金vx
|
||||
map.put("uniCashSum", uniCashSum);// 自费现金银联
|
||||
map.put("aliCashSum", aliCashSum);// 自费现金ali
|
||||
map.put("discountSum", discountSum);// 优惠金额
|
||||
|
||||
// 将所有的payment分组进行单独处理(业务注释:处理不同财务分类的金额,如西药费中药费等)
|
||||
List<PaymentReconciliationAccountDel> paymentList = new ArrayList<>();
|
||||
@@ -1727,7 +1735,7 @@ public class IChargeBillServiceImpl implements IChargeBillService {
|
||||
map.put("OTHER_FEE", otherFee);// 其他费用
|
||||
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);
|
||||
.add(chineseMedicineSlicesFee).add(generalConsultationFee).add(registrationFee).add(otherFee).subtract(discountSum);
|
||||
map.put("SUM", sum);// 合计费用
|
||||
|
||||
Map<String, List<ChargeItemDefInfo>> chargeItemDefKVByTypeCode =
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.dto.ChargeItemBaseInfoDto;
|
||||
import com.openhis.administration.service.*;
|
||||
import com.openhis.administration.service.impl.PatientStudentServiceImpl;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.*;
|
||||
@@ -55,12 +56,15 @@ import com.openhis.financial.service.*;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.nenu.domain.TransactionResponse;
|
||||
import com.openhis.nenu.service.ITransactionResponseService;
|
||||
import com.openhis.web.chargemanage.appservice.impl.OutpatientRegistrationAppServiceImpl;
|
||||
import com.openhis.web.chargemanage.dto.*;
|
||||
import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService;
|
||||
import com.openhis.web.doctorstation.dto.AdviceBaseDto;
|
||||
import com.openhis.web.doctorstation.dto.AdvicePriceDto;
|
||||
import com.openhis.web.externalintegration.appservice.IBankPosCloudAppService;
|
||||
import com.openhis.web.paymentmanage.appservice.IPaymentRecService;
|
||||
import com.openhis.web.paymentmanage.dto.*;
|
||||
import com.openhis.web.paymentmanage.dto.CancelPaymentDto;
|
||||
@@ -98,6 +102,12 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
@Resource
|
||||
private IPaymentNoticeService paymentNoticeService;
|
||||
@Resource
|
||||
private ITransactionResponseService transactionResponseService;
|
||||
@Resource
|
||||
private IBankPosCloudAppService bankPosCloudAppService;
|
||||
@Resource
|
||||
private IPractitionerService practitionerService;
|
||||
@Resource
|
||||
private IAccountService iAccountService;
|
||||
@Resource
|
||||
private IContractService iContractService;
|
||||
@@ -116,6 +126,10 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
@Resource
|
||||
private IChargeItemService chargeItemService;
|
||||
@Resource
|
||||
private IChargeItemDefinitionService chargeItemDefinitionService;
|
||||
@Resource
|
||||
private IHealthcareServiceService healthcareServiceService;
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
@Resource
|
||||
private PaymentMapper paymentMapper;
|
||||
@@ -139,6 +153,8 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
private IRegService iRegService;
|
||||
@Resource
|
||||
private IPatientService iPatientService;
|
||||
@Resource
|
||||
private PatientStudentServiceImpl patientStudentService;
|
||||
@Autowired
|
||||
private IPractitionerService iPractitionerService;
|
||||
@Autowired
|
||||
@@ -358,6 +374,35 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
return R.fail("收费项目变动,请重新预结算");
|
||||
}
|
||||
|
||||
//2025.11.4 长大发生异常,相同的chargeItem存在两个payment并重复收费,要求在此处增加校验
|
||||
// 经研究最优解为在数据库中查询本次就诊的所有的chargeItemIds,与现有chargeItemId进行匹配
|
||||
List<PaymentReconciliation> paymentReconciliationList = paymentReconciliationService.getListByEncounterId(paymentDto.getEncounterId(), PaymentKind.OUTPATIENT_CLINIC);
|
||||
|
||||
List<Long> chargeItemIds = paymentDto.getChargeItemIds();
|
||||
|
||||
if(!paymentReconciliationList.isEmpty()){
|
||||
// 收集所有元素(包含重复)
|
||||
List<String> allElements = paymentReconciliationList.stream()
|
||||
.map(PaymentReconciliation::getChargeItemIds) // 获取逗号拼接的字符串
|
||||
.filter(str -> str != null && !str.trim().isEmpty()) // 过滤空值
|
||||
.flatMap(str -> Arrays.stream(str.split(","))) // 拆分成单个元素
|
||||
.map(String::trim) // 去除空格
|
||||
.filter(s -> !s.isEmpty()) // 过滤空字符串
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (Long chargeItemId : chargeItemIds) {
|
||||
Optional<String> first = allElements.stream()
|
||||
.filter(item -> item.equals(chargeItemId.toString()))
|
||||
.findFirst();
|
||||
|
||||
if(first.isPresent()){
|
||||
throw new ServiceException("收费项目id:"+chargeItemId+"已经收费过了,请确认");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 校验金额:前台输入金额与仍需支付的现金部分进行比较
|
||||
BigDecimal sum = BigDecimal.ZERO;
|
||||
PaymentRecDetail paymentRecDetailDemo = new PaymentRecDetail();
|
||||
@@ -382,7 +427,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
.setAmount(paymentDetail.getAmount());
|
||||
list.add(newPaymentRecDetail);
|
||||
}
|
||||
// 前台传入数据可能会精度丢失,后天临时处理使用近似
|
||||
// 前台传入数据可能会精度丢失,后台临时处理使用近似 11.11要求后台全部改为6位小数,但是实际患者缴费只到1.67,但是我后台是1.666667,所以只能1.67=1.67
|
||||
if (sum.setScale(2, BigDecimal.ROUND_HALF_UP)
|
||||
.compareTo(chargeAmount.setScale(2, BigDecimal.ROUND_HALF_UP)) != 0) {
|
||||
throw new ServiceException("交款金额与预结算金额不相等");
|
||||
@@ -497,8 +542,8 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
chargeItemService.updatePaymentStatus(chargeItemIdList, ChargeItemStatus.BILLED.getValue());
|
||||
|
||||
// 保存付款快照信息 2025/08/08
|
||||
// paymentRecStaticService.savePaymentRecStatics(paymentReconciliation.getId(), PaymentType.PAY, null,
|
||||
// chargeItemService.getChargeItemDefInfoByIds(chargeItemIdList));
|
||||
paymentRecStaticService.savePaymentRecStatics(paymentReconciliation.getId(), PaymentType.PAY, null,
|
||||
chargeItemService.getChargeItemDefInfoByIdList(chargeItemIdList));
|
||||
|
||||
// 生成发票信息
|
||||
Invoice invoice = new Invoice();
|
||||
@@ -703,9 +748,9 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
logger.info(
|
||||
"部分退款:原payment:" + JSON.toJSONString(paymentReconciliation) + "新payment:" + JSON.toJSONString(payment));
|
||||
if (chargedPay.compareTo(payAmount) >= 0) {
|
||||
return R.ok("请患者补交" + chargedPay.subtract(payAmount).setScale(1, RoundingMode.HALF_UP) + "元");
|
||||
return R.ok("请患者补交" + chargedPay.subtract(payAmount).setScale(6, RoundingMode.HALF_UP) + "元");
|
||||
} else {
|
||||
return R.ok("请返还患者" + payAmount.subtract(chargedPay).setScale(1, RoundingMode.HALF_UP) + "元");
|
||||
return R.ok("请返还患者" + payAmount.subtract(chargedPay).setScale(6, RoundingMode.HALF_UP) + "元");
|
||||
}
|
||||
}
|
||||
// 更新收费状态:已退费
|
||||
@@ -749,15 +794,22 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<PaymentVO> getPage(String searchKey, Integer kingEnum, String invoiceNo,Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
public IPage<PaymentVO> getPage(String searchKey, Integer kingEnum, String invoiceNo, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
String invoiceStatus = request.getParameter("invoiceStatus");
|
||||
PaymentVO paymentVO = new PaymentVO();
|
||||
if (invoiceStatus != null) {
|
||||
paymentVO.setInvoiceStatus(Integer.parseInt(invoiceStatus));
|
||||
}
|
||||
// 构建查询条件
|
||||
QueryWrapper<PaymentVO> queryWrapper = HisQueryUtils.buildQueryWrapper(new PaymentVO(), searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.paymentNo)),
|
||||
QueryWrapper<PaymentVO> queryWrapper = HisQueryUtils.buildQueryWrapper(paymentVO, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientName, CommonConstants.FieldName.PaymentNo)),
|
||||
request);
|
||||
// queryWrapper.eq(PaymentVO::getStatusEnum,PaymentStatus.SUCCESS.getValue()).or().eq(PaymentVO::getStatusEnum,PaymentStatus.REFUND_ALL.getValue());
|
||||
queryWrapper.in("status_enum", PaymentStatus.SUCCESS.getValue(), PaymentStatus.REFUND_ALL.getValue());
|
||||
IPage<PaymentVO> paymentDtoIPage = paymentMapper.getPage(new Page<>(pageNo, pageSize), kingEnum, invoiceNo,queryWrapper);
|
||||
IPage<PaymentVO> paymentDtoIPage =
|
||||
paymentMapper.getPage(new Page<>(pageNo, pageSize), kingEnum, invoiceNo, queryWrapper);
|
||||
|
||||
for (PaymentVO record : paymentDtoIPage.getRecords()) {
|
||||
record.setPaymentId(record.getId().toString());
|
||||
@@ -848,15 +900,15 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
logger.info("退款payment:" + JSON.toJSONString(paymentReconciliation));
|
||||
|
||||
// 保存付款快照信息 2025/08/08
|
||||
// List<Long> chargeItemIds = new ArrayList<>();
|
||||
// for (String s : paymentReconciliation.getChargeItemIds().split(",")) {
|
||||
// chargeItemIds.add(Long.parseLong(s));
|
||||
// }
|
||||
// if (chargeItemIds.isEmpty()) {
|
||||
// throw new ServiceException("payment数据未关联收费项信息,异常数据payment" + id);
|
||||
// }
|
||||
// paymentRecStaticService.savePaymentRecStatics(paymentReconciliation.getId(), PaymentType.PAY, null,
|
||||
// chargeItemService.getChargeItemDefInfoByIds(chargeItemIds));
|
||||
List<Long> chargeItemIds = new ArrayList<>();
|
||||
for (String s : paymentReconciliation.getChargeItemIds().split(",")) {
|
||||
chargeItemIds.add(Long.parseLong(s));
|
||||
}
|
||||
if (chargeItemIds.isEmpty()) {
|
||||
throw new ServiceException("payment数据未关联收费项信息,异常数据payment" + id);
|
||||
}
|
||||
paymentRecStaticService.savePaymentRecStatics(paymentReconciliation.getId(), PaymentType.PAY, null,
|
||||
chargeItemService.getChargeItemDefInfoByIdList(chargeItemIds));
|
||||
|
||||
return paymentReconciliation;
|
||||
}
|
||||
@@ -869,6 +921,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
*/
|
||||
private List<PaymentRecDetail> savePaymentDetail(List<PrePaymentResult> prePaymentResults,
|
||||
PaymentReconciliation payment) {
|
||||
//11.11 paymentDetail的amount在11.7日按照同一的异常日结单,要求改为保留两位小数,后于11.11又被要求改为保留六位小数
|
||||
// 保存付款详情
|
||||
List<PaymentRecDetail> paymentRecDetails = new ArrayList<>();
|
||||
for (PrePaymentResult prePaymentResult : prePaymentResults) {
|
||||
@@ -878,7 +931,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
if (psnCashPay != null) {
|
||||
PaymentRecDetail paymentRecDetail10 = new PaymentRecDetail();
|
||||
paymentRecDetail10.setReconciliationId(payment.getId()).setPayEnum(YbPayment.SELF_CASH_PAY.getValue())
|
||||
.setPayLevelEnum(YbPayment.SELF_CASH_PAY.getLevel()).setAmount(psnCashPay)
|
||||
.setPayLevelEnum(YbPayment.SELF_CASH_PAY.getLevel()).setAmount(psnCashPay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail10);
|
||||
@@ -886,21 +939,21 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
|
||||
// 个人负担总金额
|
||||
BigDecimal psnPartAmt = prePaymentResult.getPsnPartAmt();
|
||||
if (psnCashPay != null) {
|
||||
if (psnPartAmt != null) {
|
||||
PaymentRecDetail paymentRecDetail1 = new PaymentRecDetail();
|
||||
paymentRecDetail1.setReconciliationId(payment.getId()).setPayEnum(YbPayment.SELF_PAY.getValue())
|
||||
.setPayLevelEnum(YbPayment.SELF_PAY.getLevel()).setAmount(psnPartAmt)
|
||||
.setPayLevelEnum(YbPayment.SELF_PAY.getLevel()).setAmount(psnPartAmt.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail1);
|
||||
}
|
||||
// 基本医疗保险统筹基金支出
|
||||
BigDecimal hifpPay = prePaymentResult.getHifpPay();
|
||||
if (psnCashPay != null) {
|
||||
if (hifpPay != null) {
|
||||
PaymentRecDetail paymentRecDetail2 = new PaymentRecDetail();
|
||||
paymentRecDetail2.setReconciliationId(payment.getId())
|
||||
.setPayEnum(YbPayment.YB_TC_FUND_AMOUNT.getValue())
|
||||
.setPayLevelEnum(YbPayment.YB_TC_FUND_AMOUNT.getLevel()).setAmount(hifpPay)
|
||||
.setPayLevelEnum(YbPayment.YB_TC_FUND_AMOUNT.getLevel()).setAmount(hifpPay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail2);
|
||||
@@ -908,126 +961,126 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
|
||||
// 公务员医疗补助资金支出
|
||||
BigDecimal cvlservPay = prePaymentResult.getCvlservPay();
|
||||
if (psnCashPay != null) {
|
||||
if (cvlservPay != null) {
|
||||
PaymentRecDetail paymentRecDetail3 = new PaymentRecDetail();
|
||||
paymentRecDetail3.setReconciliationId(payment.getId())
|
||||
.setPayEnum(YbPayment.YB_BC_GWY_BZ_VALUE.getValue())
|
||||
.setPayLevelEnum(YbPayment.YB_BC_GWY_BZ_VALUE.getLevel()).setAmount(cvlservPay)
|
||||
.setPayLevelEnum(YbPayment.YB_BC_GWY_BZ_VALUE.getLevel()).setAmount(cvlservPay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail3);
|
||||
}
|
||||
// 企业补充医疗保险基金支出
|
||||
BigDecimal hifesPay = prePaymentResult.getHifesPay();
|
||||
if (psnCashPay != null) {
|
||||
if (hifesPay != null) {
|
||||
PaymentRecDetail paymentRecDetail4 = new PaymentRecDetail();
|
||||
paymentRecDetail4.setReconciliationId(payment.getId())
|
||||
.setPayEnum(YbPayment.YB_BC_FUND_AMOUNT.getValue())
|
||||
.setPayLevelEnum(YbPayment.YB_BC_FUND_AMOUNT.getLevel()).setAmount(hifesPay)
|
||||
.setPayLevelEnum(YbPayment.YB_BC_FUND_AMOUNT.getLevel()).setAmount(hifesPay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail4);
|
||||
}
|
||||
// 居民大病保险资金支出
|
||||
BigDecimal hifmiPay = prePaymentResult.getHifmiPay();
|
||||
if (psnCashPay != null) {
|
||||
if (hifmiPay != null) {
|
||||
PaymentRecDetail paymentRecDetail5 = new PaymentRecDetail();
|
||||
paymentRecDetail5.setReconciliationId(payment.getId())
|
||||
.setPayEnum(YbPayment.YB_BC_JM_DB_VALUE.getValue())
|
||||
.setPayLevelEnum(YbPayment.YB_BC_JM_DB_VALUE.getLevel()).setAmount(hifmiPay)
|
||||
.setPayLevelEnum(YbPayment.YB_BC_JM_DB_VALUE.getLevel()).setAmount(hifmiPay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail5);
|
||||
}
|
||||
// 职工大额医疗费用补助基金支出
|
||||
BigDecimal hifobPay = prePaymentResult.getHifobPay();
|
||||
if (psnCashPay != null) {
|
||||
if (hifobPay != null) {
|
||||
PaymentRecDetail paymentRecDetail6 = new PaymentRecDetail();
|
||||
paymentRecDetail6.setReconciliationId(payment.getId()).setPayTransNo(prePaymentResult.getChrgBchno())
|
||||
.setPayLevelEnum(YbPayment.YB_BC_ZG_DE_BZ_VALUE.getLevel()).setAmount(hifobPay)
|
||||
.setPayLevelEnum(YbPayment.YB_BC_ZG_DE_BZ_VALUE.getLevel()).setAmount(hifobPay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayEnum(YbPayment.YB_BC_ZG_DE_BZ_VALUE.getValue())
|
||||
.setResultEnum(PaymentResult.UNPAID.getValue()).setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail6);
|
||||
}
|
||||
// 医疗救助基金支出
|
||||
BigDecimal mafPay = prePaymentResult.getMafPay();
|
||||
if (psnCashPay != null) {
|
||||
if (mafPay != null) {
|
||||
PaymentRecDetail paymentRecDetail7 = new PaymentRecDetail();
|
||||
paymentRecDetail7.setReconciliationId(payment.getId())
|
||||
.setPayEnum(YbPayment.YB_JZ_FUND_AMOUNT.getValue())
|
||||
.setPayLevelEnum(YbPayment.YB_JZ_FUND_AMOUNT.getLevel()).setAmount(mafPay)
|
||||
.setPayLevelEnum(YbPayment.YB_JZ_FUND_AMOUNT.getLevel()).setAmount(mafPay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail7);
|
||||
}
|
||||
// 其他支出
|
||||
BigDecimal othPay = prePaymentResult.getOthPay();
|
||||
if (psnCashPay != null) {
|
||||
if (othPay != null) {
|
||||
PaymentRecDetail paymentRecDetail8 = new PaymentRecDetail();
|
||||
paymentRecDetail8.setReconciliationId(payment.getId()).setPayEnum(YbPayment.OTHER_PAY.getValue())
|
||||
.setPayLevelEnum(YbPayment.OTHER_PAY.getLevel()).setAmount(othPay)
|
||||
.setPayLevelEnum(YbPayment.OTHER_PAY.getLevel()).setAmount(othPay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail8);
|
||||
}
|
||||
// 基金支付总额
|
||||
BigDecimal fundPaySumamt = prePaymentResult.getFundPaySumamt();
|
||||
if (psnCashPay != null) {
|
||||
if (fundPaySumamt != null) {
|
||||
PaymentRecDetail paymentRecDetail9 = new PaymentRecDetail();
|
||||
paymentRecDetail9.setReconciliationId(payment.getId()).setPayEnum(YbPayment.YB_FUND_PAY.getValue())
|
||||
.setPayLevelEnum(YbPayment.YB_FUND_PAY.getLevel()).setAmount(fundPaySumamt)
|
||||
.setPayLevelEnum(YbPayment.YB_FUND_PAY.getLevel()).setAmount(fundPaySumamt.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail9);
|
||||
}
|
||||
// 个人账户支出
|
||||
BigDecimal acctPay = prePaymentResult.getAcctPay();
|
||||
if (psnCashPay != null) {
|
||||
if (acctPay != null) {
|
||||
PaymentRecDetail paymentRecDetail11 = new PaymentRecDetail();
|
||||
paymentRecDetail11.setReconciliationId(payment.getId()).setPayEnum(YbPayment.SELF_YB_ZH_PAY.getValue())
|
||||
.setPayLevelEnum(YbPayment.SELF_YB_ZH_PAY.getLevel()).setAmount(acctPay)
|
||||
.setPayLevelEnum(YbPayment.SELF_YB_ZH_PAY.getLevel()).setAmount(acctPay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail11);
|
||||
}
|
||||
// 医院负担金额
|
||||
BigDecimal hospPartAmt = prePaymentResult.getHospPartAmt();
|
||||
if (psnCashPay != null) {
|
||||
if (hospPartAmt != null) {
|
||||
PaymentRecDetail paymentRecDetail12 = new PaymentRecDetail();
|
||||
paymentRecDetail12.setReconciliationId(payment.getId()).setPayEnum(YbPayment.HOSP_PART_AMT.getValue())
|
||||
.setPayLevelEnum(YbPayment.HOSP_PART_AMT.getLevel()).setAmount(hospPartAmt)
|
||||
.setPayLevelEnum(YbPayment.HOSP_PART_AMT.getLevel()).setAmount(hospPartAmt.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail12);
|
||||
}
|
||||
// 个人账户共济支付金额
|
||||
BigDecimal acctMulaidPay = prePaymentResult.getAcctMulaidPay();
|
||||
if (psnCashPay != null) {
|
||||
if (acctMulaidPay != null) {
|
||||
PaymentRecDetail paymentRecDetail13 = new PaymentRecDetail();
|
||||
paymentRecDetail13.setReconciliationId(payment.getId())
|
||||
.setPayEnum(YbPayment.SELF_YB_ZH_GJ_VALUE.getValue())
|
||||
.setPayLevelEnum(YbPayment.SELF_YB_ZH_GJ_VALUE.getLevel()).setAmount(acctMulaidPay)
|
||||
.setPayLevelEnum(YbPayment.SELF_YB_ZH_GJ_VALUE.getLevel()).setAmount(acctMulaidPay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail13);
|
||||
}
|
||||
// 全自费金额
|
||||
BigDecimal fulamtOwnpayAmt = prePaymentResult.getFulamtOwnpayAmt();
|
||||
if (psnCashPay != null) {
|
||||
if (fulamtOwnpayAmt != null) {
|
||||
PaymentRecDetail paymentRecDetail14 = new PaymentRecDetail();
|
||||
paymentRecDetail14.setReconciliationId(payment.getId())
|
||||
.setPayEnum(YbPayment.FULAMT_OWNPAY_AMT.getValue())
|
||||
.setPayLevelEnum(YbPayment.FULAMT_OWNPAY_AMT.getLevel()).setAmount(fulamtOwnpayAmt)
|
||||
.setPayLevelEnum(YbPayment.FULAMT_OWNPAY_AMT.getLevel()).setAmount(fulamtOwnpayAmt.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail14);
|
||||
}
|
||||
// 超限价自费费用
|
||||
BigDecimal overlmtSelfpay = prePaymentResult.getOverlmtSelfpay();
|
||||
if (psnCashPay != null) {
|
||||
if (overlmtSelfpay != null) {
|
||||
PaymentRecDetail paymentRecDetail15 = new PaymentRecDetail();
|
||||
paymentRecDetail15.setReconciliationId(payment.getId()).setPayEnum(YbPayment.OVERLMT_SELFPAY.getValue())
|
||||
.setPayLevelEnum(YbPayment.OVERLMT_SELFPAY.getLevel()).setAmount(overlmtSelfpay)
|
||||
.setPayLevelEnum(YbPayment.OVERLMT_SELFPAY.getLevel()).setAmount(overlmtSelfpay.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail15);
|
||||
@@ -1039,32 +1092,41 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
// .setResultEnum(PaymentResult.PAID.getValue()).setAccountId(clinicOrder2207Result.getAccountId());
|
||||
// paymentRecDetails.add(paymentRecDetail16);
|
||||
BigDecimal preselfpayAmt = prePaymentResult.getPreselfpayAmt();
|
||||
if (psnCashPay != null) {
|
||||
if (preselfpayAmt != null) {
|
||||
PaymentRecDetail paymentRecDetail17 = new PaymentRecDetail();
|
||||
paymentRecDetail17.setReconciliationId(payment.getId()).setPayEnum(YbPayment.PRESELFPAY_AMT.getValue())
|
||||
.setPayLevelEnum(YbPayment.PRESELFPAY_AMT.getLevel()).setAmount(preselfpayAmt)
|
||||
.setPayLevelEnum(YbPayment.PRESELFPAY_AMT.getLevel()).setAmount(preselfpayAmt.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail17);
|
||||
}
|
||||
BigDecimal inscpScpAmt = prePaymentResult.getInscpScpAmt();
|
||||
if (psnCashPay != null) {
|
||||
if (inscpScpAmt != null) {
|
||||
PaymentRecDetail paymentRecDetail18 = new PaymentRecDetail();
|
||||
paymentRecDetail18.setReconciliationId(payment.getId()).setPayEnum(YbPayment.INSCP_SCP_AMT.getValue())
|
||||
.setPayLevelEnum(YbPayment.INSCP_SCP_AMT.getLevel()).setAmount(inscpScpAmt)
|
||||
.setPayLevelEnum(YbPayment.INSCP_SCP_AMT.getLevel()).setAmount(inscpScpAmt.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail18);
|
||||
}
|
||||
BigDecimal actPayDedc = prePaymentResult.getActPayDedc();
|
||||
if (psnCashPay != null) {
|
||||
if (actPayDedc != null) {
|
||||
PaymentRecDetail paymentRecDetail19 = new PaymentRecDetail();
|
||||
paymentRecDetail19.setReconciliationId(payment.getId()).setPayEnum(YbPayment.ACT_PAY_DEDC.getValue())
|
||||
.setPayLevelEnum(YbPayment.ACT_PAY_DEDC.getLevel()).setAmount(actPayDedc)
|
||||
.setPayLevelEnum(YbPayment.ACT_PAY_DEDC.getLevel()).setAmount(actPayDedc.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail19);
|
||||
}
|
||||
BigDecimal gfRatio = prePaymentResult.getGfRatio();
|
||||
if (gfRatio != null && gfRatio.compareTo(BigDecimal.ZERO) > 0) {
|
||||
PaymentRecDetail paymentRecDetail20 = new PaymentRecDetail();
|
||||
paymentRecDetail20.setReconciliationId(payment.getId()).setPayEnum(YbPayment.SCHOOL_GF_PAY.getValue())
|
||||
.setPayLevelEnum(YbPayment.SCHOOL_GF_PAY.getLevel()).setAmount(gfRatio.setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail20);
|
||||
}
|
||||
if (prePaymentResult.getSetldetail() != null && !prePaymentResult.getSetldetail().isEmpty()) {
|
||||
PaymentRecDetail paymentRecDetail20;
|
||||
for (Clinic2206FundPaymentResult clinic2206FundPaymentResult : prePaymentResult.getSetldetail()) {
|
||||
@@ -1075,7 +1137,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
}
|
||||
paymentRecDetail20 = new PaymentRecDetail();
|
||||
paymentRecDetail20.setReconciliationId(payment.getId()).setPayEnum(ybPayment.getValue())
|
||||
.setPayLevelEnum(ybPayment.getLevel()).setAmount(clinic2206FundPaymentResult.getFundPayamt())
|
||||
.setPayLevelEnum(ybPayment.getLevel()).setAmount(clinic2206FundPaymentResult.getFundPayamt().setScale(6,RoundingMode.HALF_UP))
|
||||
.setPayTransNo(prePaymentResult.getChrgBchno()).setResultEnum(PaymentResult.UNPAID.getValue())
|
||||
.setAccountId(prePaymentResult.getAccountId());
|
||||
paymentRecDetails.add(paymentRecDetail20);
|
||||
@@ -1530,6 +1592,13 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
if (patient == null) {
|
||||
throw new ServiceException("未查询到患者信息");
|
||||
}
|
||||
|
||||
// 挂学生号前需要校验(校医院)
|
||||
if (outpatientRegistrationAddParam.getAccountFormData().getContractNo()
|
||||
.contains(CommonConstants.BusinessName.CONTRACT_STUDENT)) {
|
||||
patientStudentService.checkStatus(patient);
|
||||
}
|
||||
|
||||
// 定义日期时间格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH-mm-ss.SSS+08");
|
||||
|
||||
@@ -1579,16 +1648,30 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
}
|
||||
}
|
||||
|
||||
// 查询挂号信息的医保码等
|
||||
HealthcareService healthcareService =
|
||||
healthcareServiceService.getById(outpatientRegistrationAddParam.getChargeItemFormData().getServiceId());
|
||||
if (healthcareService == null) {
|
||||
throw new ServiceException("未查询到号源信息!");
|
||||
}
|
||||
if (healthcareService.getYbNo() == null) {
|
||||
throw new ServiceException("该号源未对码或未查询到医保码信息!");
|
||||
}
|
||||
|
||||
Clinic2206OrderOutput clinic2206OrderResult;
|
||||
if ("1".equals(SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH))
|
||||
&& !CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
|
||||
.equals(outpatientRegistrationAddParam.getAccountFormData().getContractNo())) {
|
||||
&& !(CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
|
||||
.equals(outpatientRegistrationAddParam.getAccountFormData().getContractNo())
|
||||
|| CommonConstants.BusinessName.DEFAULT_STUDENT_CONTRACT_NO
|
||||
.equals(outpatientRegistrationAddParam.getAccountFormData().getContractNo()))) {
|
||||
OutpatientRegistrationModel model = new OutpatientRegistrationModel();
|
||||
model.setMdtrtCertType(outpatientRegistrationAddParam.getYbMdtrtCertType());
|
||||
model.setBusiCardInfo(outpatientRegistrationAddParam.getBusiCardInfo());
|
||||
model.setPsnSetlWay(outpatientRegistrationAddParam.getYbPsnSetlWay());
|
||||
model.setTotalPrice(outpatientRegistrationAddParam.getChargeItemFormData().getTotalPrice());
|
||||
model.setContractNo(outpatientRegistrationAddParam.getAccountFormData().getContractNo());
|
||||
model.setBusNo(healthcareService.getBusNo());
|
||||
model.setYbNo(healthcareService.getYbNo());
|
||||
// 进入医保挂号及预结算流程
|
||||
clinic2206OrderResult = ybManager.getPreSettleInfo(model, patient, organization, doctor);
|
||||
} else {
|
||||
@@ -1651,10 +1734,16 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
return R.fail(null, "当日已挂号此服务");
|
||||
}
|
||||
|
||||
Contract contract =
|
||||
contractService.getContract(outpatientRegistrationAddParam.getAccountFormData().getContractNo());
|
||||
if (contract == null) {
|
||||
throw new ServiceException("请选择合适的费用性质");
|
||||
}
|
||||
com.openhis.financial.model.PaymentResult paymentResult;
|
||||
if ("1".equals(SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH))
|
||||
&& !CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
|
||||
.equals(outpatientRegistrationAddParam.getAccountFormData().getContractNo())) {
|
||||
.equals(outpatientRegistrationAddParam.getAccountFormData().getContractNo())
|
||||
&& contract.getYbFlag() == 1) {
|
||||
// 医保结算
|
||||
paymentResult = ybManager.settle(
|
||||
contractService.getContract(outpatientRegistrationAddParam.getAccountFormData().getContractNo()),
|
||||
@@ -1664,7 +1753,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
paymentResult = new com.openhis.financial.model.PaymentResult();
|
||||
paymentResult.setChrgBchno(chrgBchno).setMedfeeSumamt(chargeItem.getTotalPrice())
|
||||
.setFulamtOwnpayAmt(chargeItem.getTotalPrice()).setPsnPartAmt(chargeItem.getTotalPrice())
|
||||
.setPsnCashPay(chargeItem.getTotalPrice()).setSetlId(CommonConstants.BusinessName.DEFAULT_CONTRACT_NO);
|
||||
.setPsnCashPay(chargeItem.getTotalPrice()).setSetlId(contract.getBusNo());
|
||||
}
|
||||
|
||||
// 生成payment
|
||||
@@ -1698,6 +1787,11 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
iEncounterParticipantService.saveEncounterParticipant(encounterParticipant);
|
||||
}
|
||||
// 保存就诊账户信息
|
||||
// 1.自费挂号,创建一个自费ACCOUNT
|
||||
// 2.省医保挂号,创建两个:自费ACCOUNT,省医保ACCOUNT
|
||||
// 3.市医保挂号,创建两个:自费ACCOUNT,市医保ACCOUNT
|
||||
// 4.学生公费挂号,创建两个:自费ACCOUNT,学生自费ACCOUNT
|
||||
// 5.学生医保公费挂号,创建四个:自费ACCOUNT,学生医保ACCOUNT,学生自费ACCOUNT,该学生对应的医保ACCOUNT
|
||||
accountFormData.setEncounterId(encounterId);
|
||||
Account account = new Account();
|
||||
BeanUtils.copyProperties(accountFormData, account);
|
||||
@@ -1716,6 +1810,33 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
: outpatientRegistrationAddParam.getYbMdtrtCertType());
|
||||
iAccountService.save(accountZf);
|
||||
}
|
||||
if (!CommonConstants.BusinessName.DEFAULT_CONTRACT_NO
|
||||
.equals(outpatientRegistrationAddParam.getAccountFormData().getContractNo())
|
||||
&& !CommonConstants.BusinessName.DEFAULT_STUDENT_CONTRACT_NO
|
||||
.equals(outpatientRegistrationAddParam.getAccountFormData().getContractNo())
|
||||
&& outpatientRegistrationAddParam.getAccountFormData().getContractNo().length() > 11) {
|
||||
// 建立学生自费ACCOUNT
|
||||
Account accountStudentZf = new Account();
|
||||
BeanUtils.copyProperties(accountFormData, accountStudentZf);
|
||||
accountStudentZf.setContractNo(CommonConstants.BusinessName.DEFAULT_STUDENT_CONTRACT_NO).setEncounterFlag(0)
|
||||
.setTypeCode(outpatientRegistrationAddParam.getYbMdtrtCertType() == null
|
||||
? YbMdtrtCertType.MDTRT_CERT_TYPE02.getValue()
|
||||
: outpatientRegistrationAddParam.getYbMdtrtCertType());
|
||||
iAccountService.save(accountStudentZf);
|
||||
|
||||
Contract contractYb = contractService.getContract(
|
||||
outpatientRegistrationAddParam.getAccountFormData().getContractNo().substring("STUDENT".length()));
|
||||
if (contractYb != null && 1 == contractYb.getYbFlag()) {
|
||||
// 建立纯医保ACCOUNT
|
||||
Account accountYb = new Account();
|
||||
BeanUtils.copyProperties(accountFormData, accountYb);
|
||||
accountYb.setContractNo(contractYb.getBusNo()).setEncounterFlag(0)
|
||||
.setTypeCode(outpatientRegistrationAddParam.getYbMdtrtCertType() == null
|
||||
? YbMdtrtCertType.MDTRT_CERT_TYPE02.getValue()
|
||||
: outpatientRegistrationAddParam.getYbMdtrtCertType());
|
||||
iAccountService.save(accountYb);
|
||||
}
|
||||
}
|
||||
// 保存挂号费
|
||||
chargeItem.setEncounterId(encounterId);
|
||||
chargeItem.setAccountId(accountId);
|
||||
@@ -1756,8 +1877,8 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
chargeItemService.updatePaymentStatus(chargeItemIds, ChargeItemStatus.BILLED.getValue());
|
||||
|
||||
// 保存付款快照信息 2025/08/08
|
||||
// paymentRecStaticService.savePaymentRecStatics(payment.getId(), PaymentType.PAY, null,
|
||||
// chargeItemService.getChargeItemDefInfoByIds(chargeItemIds));
|
||||
paymentRecStaticService.savePaymentRecStatics(payment.getId(), PaymentType.PAY, null,
|
||||
chargeItemService.getChargeItemDefInfoByIdList(chargeItemIds));
|
||||
|
||||
// 生成发票信息
|
||||
Invoice invoice = new Invoice();
|
||||
@@ -1804,6 +1925,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
serviceRequest = new ServiceRequest();
|
||||
serviceRequest.setStatusEnum(RequestStatus.COMPLETED.getValue());// 请求状态,默认已完成
|
||||
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4));
|
||||
serviceRequest.setGenerateSourceEnum(GenerateSource.REGISTRATION_REGISTER.getValue()); // 生成来源
|
||||
serviceRequest.setQuantity(quantity); // 请求数量
|
||||
serviceRequest.setUnitCode(activityAdviceBaseDto.getUnitCode()); // 请求单位编码
|
||||
serviceRequest.setCategoryEnum(EncounterClass.AMB.getValue()); // 请求类型,默认-门诊
|
||||
@@ -1817,7 +1939,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
|
||||
// 生成账单
|
||||
chargeItem = new ChargeItem();
|
||||
chargeItem.setGenerateSourceEnum(ChargeItemGenerateSource.MEDICAL_ORDER_BINDING.getValue());
|
||||
chargeItem.setGenerateSourceEnum(GenerateSource.REGISTRATION_REGISTER.getValue()); // 生成来源
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue()); // 待收费
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo()));
|
||||
chargeItem.setPatientId(encounter.getPatientId()); // 患者
|
||||
@@ -1835,9 +1957,9 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
chargeItem.setQuantityValue(quantity); // 数量
|
||||
chargeItem.setQuantityUnit(activityAdviceBaseDto.getUnitCode()); // 单位
|
||||
chargeItem.setUnitPrice(advicePriceDto.getPrice()); // 单价
|
||||
// 计算总价,保留4位小数
|
||||
// 计算总价,保留6位小数
|
||||
BigDecimal qty = quantity;
|
||||
chargeItem.setTotalPrice(qty.multiply(advicePriceDto.getPrice()).setScale(4, RoundingMode.HALF_UP)); // 总价
|
||||
chargeItem.setTotalPrice(qty.multiply(advicePriceDto.getPrice()).setScale(6, RoundingMode.HALF_UP)); // 总价
|
||||
|
||||
iChargeItemService.save(chargeItem);
|
||||
chargeItemIdList.add(chargeItem.getId().toString());
|
||||
@@ -1882,7 +2004,17 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
piModel.setMedType(encounterDiagnosis.getMedTypeCode());
|
||||
piModel.setTotalPrice(chargeItem.getTotalPrice());
|
||||
piModel.setEncounterId(chargeItem.getEncounterId());
|
||||
piModel.setChargeItemId(chargeItem.getId());
|
||||
piModel.setServiceId(chargeItem.getServiceId());
|
||||
piModel.setServiceTable(chargeItem.getServiceTable());
|
||||
piModel.setProductId(chargeItem.getProductId());
|
||||
piModel.setProductTable(chargeItem.getProductTable());
|
||||
piModel.setEntererId(chargeItem.getEntererId());
|
||||
piModel.setRequestingOrgId(chargeItem.getRequestingOrgId());
|
||||
piModel.setEnteredDate(chargeItem.getEnteredDate());
|
||||
piModel.setQuantityValue(chargeItem.getQuantityValue());
|
||||
piModel.setQuantityUnit(chargeItem.getQuantityUnit());
|
||||
piModel.setUnitPrice(chargeItem.getUnitPrice());
|
||||
piModel.setDefinitionId(chargeItem.getDefinitionId());
|
||||
return piModel;
|
||||
}
|
||||
|
||||
@@ -1930,15 +2062,19 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
* @return 预结算集合
|
||||
*/
|
||||
public InpatientPreSettleResultDto inpatientPreSettle(PrePaymentDto prePaymentDto) {
|
||||
|
||||
List<ChargeItemBaseInfoDto> chargeItemBaseInfoByIds =
|
||||
iChargeItemService.getChargeItemBaseInfoByIds(prePaymentDto.getChargeItemIds());
|
||||
|
||||
Map<String, List<ChargeItemBaseInfoDto>> chargeItemKVByContractNo =
|
||||
chargeItemBaseInfoByIds.stream().collect(Collectors.groupingBy(ChargeItemBaseInfoDto::getContractNo));
|
||||
|
||||
List<InpatientPreSettleDto> yb2303OutputSetInfos = new ArrayList<>();
|
||||
Yb2303OutputSetInfo yb2303OutputSetInfo;
|
||||
InpatientPreSettleDto inpatientPreSettleDto;
|
||||
for (Map.Entry<String, List<ChargeItemBaseInfoDto>> stringListEntry : chargeItemKVByContractNo.entrySet()) {
|
||||
if (!CommonConstants.BusinessName.DEFAULT_CONTRACT_NO.equals(stringListEntry.getKey())) {
|
||||
|
||||
inpatientPreSettleDto = new InpatientPreSettleDto();
|
||||
yb2303OutputSetInfo = ybManager.preSettleInpatient(prePaymentDto);
|
||||
BeanUtils.copyProperties(yb2303OutputSetInfo, inpatientPreSettleDto);
|
||||
@@ -1946,14 +2082,17 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
yb2303OutputSetInfos.add(inpatientPreSettleDto);
|
||||
|
||||
} else {
|
||||
|
||||
inpatientPreSettleDto =
|
||||
preSettleInpatientBySelf(prePaymentDto.getEncounterId(), stringListEntry.getValue());
|
||||
yb2303OutputSetInfos.add(inpatientPreSettleDto);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 生成业务参数 paymentDetail
|
||||
// PS:2025/08/12同李电话沟通确认,住院患者结算常规情况是会生成三个个payment,特殊情况两条payment,所以结算的时候的支付详情一定是和最初预交金的那条payment绑定,且若开始中途结算功能的话必须要按照payment成对出现的规则执行即正
|
||||
// PS:2025/08/12同李电话沟通确认,住院患者结算常规情况是会生成三个个payment,特殊情况两条payment,所以结算的时候的支付详情一定是和最初预交金的那条payment绑定,且若开始中途结算功能的话必须要按照payment成对出现的规则执行
|
||||
// 三个payment分别对应,预交金,结算金额,预交金和结算金额多退少补的金额
|
||||
// 生成业务参数payment
|
||||
PaymentReconciliation paymentReconciliation = getPaymentReconciliation(chargeItemBaseInfoByIds);
|
||||
iPaymentReconciliationService.save(paymentReconciliation);
|
||||
@@ -2166,7 +2305,7 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
|
||||
// 保存付款快照信息 2025/08/08
|
||||
paymentRecStaticService.savePaymentRecStatics(paymentReconciliation.getId(), PaymentType.PAY, null,
|
||||
chargeItemService.getChargeItemDefInfoByIds(paymentDto.getChargeItemIds()));
|
||||
chargeItemService.getChargeItemDefInfoByIdList(paymentDto.getChargeItemIds()));
|
||||
|
||||
// 生成发票信息
|
||||
Invoice invoice = new Invoice();
|
||||
@@ -2599,4 +2738,32 @@ public class PaymentRecServiceImpl implements IPaymentRecService {
|
||||
return inpatientPreSettleDto;
|
||||
}
|
||||
|
||||
/**
|
||||
* BPC支付
|
||||
*
|
||||
* @param nenuBpcPayDto bpc支付参数
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String nenuBpcPay(NenuBpcPayDto nenuBpcPayDto) {
|
||||
|
||||
Practitioner practitioner = practitionerService.getById(SecurityUtils.getLoginUser().getPractitionerId());
|
||||
if (practitioner == null || practitioner.getPosNo() == null) {
|
||||
throw new ServiceException("未配置POS机编号!");
|
||||
}
|
||||
|
||||
TransactionResponse transactionResponse = new TransactionResponse()
|
||||
.setTxnAmt(nenuBpcPayDto.getBpcPayAmount().multiply(new BigDecimal("100")).toString())
|
||||
.setPaymentId(nenuBpcPayDto.getPaymentId()).setScanCode(nenuBpcPayDto.getBpcCode())
|
||||
.setIndex(nenuBpcPayDto.getIndex());
|
||||
|
||||
transactionResponseService.save(transactionResponse);
|
||||
|
||||
R<?> r = bankPosCloudAppService.processConsumerScan(
|
||||
String.valueOf(nenuBpcPayDto.getBpcPayAmount().multiply(new BigDecimal("100"))),
|
||||
nenuBpcPayDto.getPaymentId() + "IND" + nenuBpcPayDto.getIndex() + "T" + new Date(),
|
||||
nenuBpcPayDto.getBpcCode(), practitioner.getPosNo());
|
||||
|
||||
return r.getMsg();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.openhis.web.paymentmanage.appservice.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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;
|
||||
import com.core.web.util.TenantOptionUtil;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
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;
|
||||
import com.openhis.yb.dto.BaseInfo;
|
||||
import com.openhis.yb.dto.BaseParam;
|
||||
import com.openhis.yb.dto.PaymentDetailDto;
|
||||
import com.openhis.yb.dto.ThreePartPayDto;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
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;
|
||||
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;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ThreePartPayServiceImpl implements ThreePartPayService {
|
||||
|
||||
@Autowired
|
||||
private IPractitionerService practitionerService;
|
||||
@Autowired
|
||||
private IPaymentRecDetailService paymentRecDetailService;
|
||||
@Autowired
|
||||
private IPaymentReconciliationService paymentReconciliationService;
|
||||
@Autowired
|
||||
private ThreePartPayCallBackService threePartPayCallBackService;
|
||||
@Autowired
|
||||
private ThreePartSimpleFieldMappingService threePartSimpleFieldMappingService;
|
||||
|
||||
|
||||
@Override
|
||||
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);
|
||||
|
||||
//订单号及订单信息
|
||||
Long paymentId = threePartPayDto.getId();
|
||||
PaymentReconciliation paymentReconciliation = paymentReconciliationService.getById(paymentId);
|
||||
|
||||
//金额处理
|
||||
BigDecimal amount = BigDecimal.ZERO;
|
||||
for (PaymentDetailDto paymentDetail : threePartPayDto.getPaymentDetails()) {
|
||||
if(threePartPayDto.getIndex().equals(paymentDetail.getPayEnum())){
|
||||
amount = paymentDetail.getAmount();
|
||||
}
|
||||
}
|
||||
amount = amount.multiply(new BigDecimal("100"));
|
||||
String amountResult = String.format("%010d", Integer.parseInt(amount.toString()));
|
||||
|
||||
//款员信息查询
|
||||
Practitioner practitioner = practitionerService.getPractitionerByUserId(SecurityUtils.getLoginUser().getUserId());
|
||||
|
||||
//获取支付码
|
||||
String txtCode = threePartPayDto.getTxtCode();
|
||||
|
||||
//获取参数
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 拼接参数
|
||||
* @param jsonObject 配置信息
|
||||
* @param practitioner 款员信息
|
||||
* @param threePartPayCallBack 原订单
|
||||
* @param amountResult 金额
|
||||
* @param txtCode 支付码
|
||||
* @return
|
||||
*/
|
||||
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){
|
||||
String posNoKey = jsonObject.getString("posNo");//pos机编码
|
||||
if(posNoKey!=null){
|
||||
paramMap.put(posNoKey,practitioner.getPosNo());
|
||||
}
|
||||
String userIdKey = jsonObject.getString("userId");
|
||||
if(userIdKey!=null){
|
||||
paramMap.put(userIdKey,practitioner.getId().toString());
|
||||
}
|
||||
String userNameKey = jsonObject.getString("userName");
|
||||
if(userNameKey!=null){
|
||||
paramMap.put(userNameKey,practitioner.getName());
|
||||
}
|
||||
}
|
||||
|
||||
//原账单信息
|
||||
if(threePartPayCallBack!=null){
|
||||
String bankOrderIdKey = jsonObject.getString("bankOrderId");
|
||||
if(bankOrderIdKey!=null){
|
||||
paramMap.put(bankOrderIdKey,threePartPayCallBack.getTradeNo());//银行订单号
|
||||
}
|
||||
String payWayOrderIdKey = jsonObject.getString("payWayOrderId");
|
||||
if(payWayOrderIdKey!=null){
|
||||
paramMap.put(payWayOrderIdKey,threePartPayCallBack.getTransNo());//支付渠道订单号
|
||||
}
|
||||
String tranTypeKey = jsonObject.getString("tranType");
|
||||
if(tranTypeKey!=null){
|
||||
paramMap.put(tranTypeKey,threePartPayCallBack.getTranType());//交易类型
|
||||
}
|
||||
String payTypeKey = jsonObject.getString("payType");
|
||||
if(payTypeKey!=null){
|
||||
paramMap.put(payTypeKey,threePartPayCallBack.getPayType());//支付方式
|
||||
}
|
||||
String traceNoKey = jsonObject.getString("traceNo");
|
||||
if(payWayOrderIdKey!=null){
|
||||
paramMap.put(traceNoKey,threePartPayCallBack.getTraceNo());//终端流水号
|
||||
}
|
||||
String txnTimeKey = jsonObject.getString("txnTime");
|
||||
if(payWayOrderIdKey!=null){
|
||||
paramMap.put(txnTimeKey,threePartPayCallBack.getTxnTime());//交易时间
|
||||
}
|
||||
String merTradeNoKey = jsonObject.getString("merTradeNo");
|
||||
if(payWayOrderIdKey!=null){
|
||||
paramMap.put(merTradeNoKey,threePartPayCallBack.getMerTradeNo());//商户系统订单号
|
||||
}
|
||||
}
|
||||
|
||||
if(paymentReconciliation!=null){
|
||||
String paymentIdKey = jsonObject.getString("paymentId");
|
||||
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(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<>();
|
||||
|
||||
String result = template;
|
||||
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||
String placeholder = "{" + entry.getKey() + "}";
|
||||
String value = entry.getValue() != null ? entry.getValue().toString() : "";
|
||||
// 使用 replace 而不是 replaceAll,避免正则表达式特殊字符问题
|
||||
result = result.replace(placeholder, value);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送http请求(2025/05/02经测试,若以自带的工具类发送请求失败,故使用原peis系统中成功调用的写法重新封装)
|
||||
*
|
||||
* @param url 路径
|
||||
* @return
|
||||
*/
|
||||
private String httpGet(String url) {
|
||||
String resultString = "";
|
||||
// 创建Http请求(2025/10/13 师大会超时故此由30000-》60000)
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(90000).setConnectionRequestTimeout(90000)
|
||||
.setSocketTimeout(90000).build();
|
||||
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build();
|
||||
CloseableHttpResponse response = null;
|
||||
// 发送请求
|
||||
try {
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpGet);
|
||||
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("Http请求异常,请稍后再试。");
|
||||
} finally {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return resultString;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
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;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
@ConfigurationProperties(prefix = "threepart.mapping")
|
||||
@Data
|
||||
@Slf4j
|
||||
public class ThreePartSimpleFieldMappingService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ReverseMappingProperties properties;
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* 执行反向映射:三方JSON -> 我方JSON
|
||||
*/
|
||||
public String reverseMap(String businessType, String sourceJson) {
|
||||
try {
|
||||
// 1. 获取映射配置
|
||||
Map<String, String> mappingConfig = properties.getMappingConfig(businessType);
|
||||
if (mappingConfig.isEmpty()) {
|
||||
log.warn("未找到业务类型[{}]的映射配置", businessType);
|
||||
return sourceJson; // 返回原JSON
|
||||
}
|
||||
|
||||
// 2. 解析源JSON
|
||||
Map<String, Object> sourceMap;
|
||||
sourceMap = objectMapper.readValue(sourceJson, new TypeReference<Map<String,Object>>(){});
|
||||
|
||||
// 3. 执行反向映射
|
||||
Map<String, Object> resultMap = reverseMap(mappingConfig, sourceMap);
|
||||
|
||||
// 4. 生成结果JSON
|
||||
return objectMapper.writeValueAsString(resultMap);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("反向映射失败,业务类型: {}, JSON: {}", businessType, sourceJson, e);
|
||||
throw new RuntimeException("反向映射失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行反向映射:Map版本
|
||||
*/
|
||||
public Map<String, Object> reverseMap(String businessType, Map<String, Object> sourceMap) {
|
||||
Map<String, String> mappingConfig = properties.getMappingConfig(businessType);
|
||||
return reverseMap(mappingConfig, sourceMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 核心映射逻辑
|
||||
*/
|
||||
private Map<String, Object> reverseMap(Map<String, String> mappingConfig,
|
||||
Map<String, Object> sourceMap) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Object> entry : sourceMap.entrySet()) {
|
||||
String sourceField = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
|
||||
// 查找映射关系
|
||||
String targetField = mappingConfig.get(sourceField);
|
||||
|
||||
if (targetField != null) {
|
||||
// 执行映射
|
||||
resultMap.put(targetField, value);
|
||||
} else {
|
||||
// 未配置映射的字段,可以选择保留或忽略
|
||||
// resultMap.put(sourceField, value); // 取消注释则保留未映射字段
|
||||
log.debug("字段[{}]未配置映射,已忽略", sourceField);
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("反向映射完成: {} -> {}", sourceMap.keySet(), resultMap.keySet());
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量处理
|
||||
*/
|
||||
public List<Map<String, Object>> reverseMapBatch(String businessType,
|
||||
List<Map<String, Object>> sourceList) {
|
||||
return sourceList.stream()
|
||||
.map(source -> reverseMap(businessType, source))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查字段是否已配置映射
|
||||
*/
|
||||
public boolean isFieldMapped(String businessType, String fieldName) {
|
||||
Map<String, String> mappingConfig = properties.getMappingConfig(businessType);
|
||||
return mappingConfig.containsKey(fieldName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有已配置的映射字段
|
||||
*/
|
||||
public Set<String> getMappedFields(String businessType) {
|
||||
Map<String, String> mappingConfig = properties.getMappingConfig(businessType);
|
||||
return mappingConfig.keySet();
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,8 @@ public class ChargeBillController {
|
||||
*
|
||||
* @param paymentId 付款实体
|
||||
*/
|
||||
@PostMapping("/getDetail")
|
||||
public R<?> getDetail(Long paymentId) {
|
||||
@GetMapping("/getDetail")
|
||||
public R<?> getDetail(@RequestParam("paymentId") Long paymentId) {
|
||||
return R.ok(iChargeBillService.getDetail(paymentId));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,19 +3,18 @@
|
||||
*/
|
||||
package com.openhis.web.paymentmanage.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.web.paymentmanage.dto.CancelPaymentInpatientDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.enums.TenantOptionDict;
|
||||
import com.core.web.util.TenantOptionUtil;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationAddParam;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationSettleParam;
|
||||
@@ -23,6 +22,8 @@ import com.openhis.web.paymentmanage.appservice.IChargeBillService;
|
||||
import com.openhis.web.paymentmanage.appservice.IEleInvoiceService;
|
||||
import com.openhis.web.paymentmanage.appservice.IPaymentRecService;
|
||||
import com.openhis.web.paymentmanage.dto.CancelPaymentDto;
|
||||
import com.openhis.web.paymentmanage.dto.CancelPaymentInpatientDto;
|
||||
import com.openhis.web.paymentmanage.dto.NenuBpcPayDto;
|
||||
import com.openhis.yb.dto.PaymentDto;
|
||||
import com.openhis.yb.dto.PaymentInpatientDto;
|
||||
import com.openhis.yb.dto.PrePaymentDto;
|
||||
@@ -63,7 +64,7 @@ public class PaymentReconciliationController {
|
||||
|
||||
/**
|
||||
* 取消预付款(该接口未被调用)
|
||||
*
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@@ -86,10 +87,10 @@ public class PaymentReconciliationController {
|
||||
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
|
||||
paymentRecon = (PaymentReconciliation)result.getData();
|
||||
}
|
||||
Map detail=iChargeBillService.getDetail(paymentRecon.getId());
|
||||
if("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
|
||||
Map detail = iChargeBillService.getDetail(paymentRecon.getId());
|
||||
if ("0".equals(TenantOptionUtil.getOptionContent(TenantOptionDict.INVOICE_SWITCH))) {
|
||||
return R.ok(detail);
|
||||
}else {
|
||||
} else {
|
||||
R<?> eleResult = eleInvoiceService.invoiceMZMake(paymentRecon.getId(), paymentDto.getEncounterId());
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因收费成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
@@ -116,9 +117,11 @@ public class PaymentReconciliationController {
|
||||
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
|
||||
paymentRecon = (PaymentReconciliation)result.getData();
|
||||
}
|
||||
if(!"0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
|
||||
if ("0".equals(TenantOptionUtil.getOptionContent(TenantOptionDict.INVOICE_SWITCH))) {
|
||||
return result;
|
||||
} else {
|
||||
R<?> eleResult =
|
||||
eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelPaymentDto.getReason());
|
||||
eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelPaymentDto.getReason());
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因取消付款成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
@@ -144,7 +147,7 @@ public class PaymentReconciliationController {
|
||||
@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));
|
||||
return R.ok(paymentReconciliationService.getPage(searchKey, kinsEnum, invoiceNo, pageNo, pageSize, request));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,9 +179,15 @@ public class PaymentReconciliationController {
|
||||
* @return 操做结果
|
||||
*/
|
||||
@PostMapping("/reg-pay")
|
||||
<<<<<<< HEAD
|
||||
public R<?> regPay(@Valid @RequestBody OutpatientRegistrationSettleParam outpatientRegistrationSettleParam) {
|
||||
R<?> result = paymentReconciliationService.regPay(outpatientRegistrationSettleParam,
|
||||
outpatientRegistrationSettleParam.getChrgBchno(), outpatientRegistrationSettleParam.getPaymentDetails());
|
||||
=======
|
||||
public R<?> regPay(@Valid @RequestBody OutpatientRegistrationSettleParam outpatientRegistrationAddParam) {
|
||||
R<?> result = paymentReconciliationService.regPay(outpatientRegistrationAddParam,
|
||||
outpatientRegistrationAddParam.getChrgBchno(), outpatientRegistrationAddParam.getPaymentDetails());
|
||||
>>>>>>> upstream/develop
|
||||
// 付款成功后,开具发票
|
||||
if (result.getCode() == 200) {
|
||||
PaymentReconciliation paymentRecon = null;
|
||||
@@ -187,9 +196,9 @@ public class PaymentReconciliationController {
|
||||
}
|
||||
Map detail = iChargeBillService.getDetail(paymentRecon.getId());
|
||||
Long encounterId = paymentRecon.getEncounterId();
|
||||
if("0".equals(SecurityUtils.getLoginUser().getOptionJson().getString("forwardSwitch"))) {
|
||||
if ("0".equals(TenantOptionUtil.getOptionContent(TenantOptionDict.INVOICE_SWITCH))) {
|
||||
return R.ok(detail);
|
||||
}else {
|
||||
} else {
|
||||
R<?> eleResult = eleInvoiceService.invoiceRegMake(paymentRecon.getId(), encounterId);
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因收费成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
@@ -236,7 +245,7 @@ public class PaymentReconciliationController {
|
||||
}
|
||||
return R.ok(detail);
|
||||
}
|
||||
return R.ok();
|
||||
return R.ok("收费未成功,请确认实际收款情况");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,13 +263,24 @@ public class PaymentReconciliationController {
|
||||
if (PaymentReconciliation.class.isAssignableFrom(r.getData().getClass())) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
return R.ok("取消结算失败,请确认");
|
||||
}
|
||||
|
||||
/**
|
||||
* 师大bpc支付
|
||||
*
|
||||
* @param nenuBpcPayDto 付款参数
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping("/nenu-bpc-pay")
|
||||
public R<?> nenuBpcPay(@RequestBody NenuBpcPayDto nenuBpcPayDto) {
|
||||
return R.ok(paymentReconciliationService.nenuBpcPay(nenuBpcPayDto));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.openhis.web.paymentmanage.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.enums.TenantOptionDict;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.web.util.TenantOptionUtil;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.administration.service.impl.PractitionerServiceImpl;
|
||||
import com.openhis.financial.domain.PaymentRecDetail;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.financial.service.IPaymentRecDetailService;
|
||||
import com.openhis.financial.service.IPaymentReconciliationService;
|
||||
import com.openhis.web.paymentmanage.appservice.ThreePartPayService;
|
||||
import com.openhis.yb.dto.PaymentDetailDto;
|
||||
import com.openhis.yb.dto.PaymentDto;
|
||||
import com.openhis.yb.dto.ThreePartPayDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 java.math.BigDecimal;
|
||||
import java.security.Security;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 第三方支付管理
|
||||
*
|
||||
* @author SunJQ
|
||||
* @date 2025-03-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/three-part/pay")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class ThreePartPayController {
|
||||
|
||||
@Autowired
|
||||
private ThreePartPayService threePartPayService;
|
||||
|
||||
/**
|
||||
* 扫码付款
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/pay-for")
|
||||
public R<?> payFor(@RequestBody ThreePartPayDto threePartPayDto){
|
||||
return threePartPayService.payFor(threePartPayDto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.openhis.web.paymentmanage.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName ChangePriceListDto
|
||||
* @Description 药品调价dto
|
||||
* @Author raymond
|
||||
* @Date 2025/10/15 14:09
|
||||
* @Version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ChangePriceListDto {
|
||||
/**
|
||||
* 药品ID
|
||||
*/
|
||||
private Long medicationId;
|
||||
/**
|
||||
* 药品编号
|
||||
*/
|
||||
private Long busNo;
|
||||
/**
|
||||
* 供应商ID
|
||||
*/
|
||||
private Long supplyId;
|
||||
/**
|
||||
* 供应商名字
|
||||
*/
|
||||
private String supplyName;
|
||||
/**
|
||||
* 药品规格
|
||||
*/
|
||||
private String totalVolume;
|
||||
/**
|
||||
* 当前价格
|
||||
*/
|
||||
private BigDecimal curPrice;
|
||||
/**
|
||||
* 调整后价格
|
||||
*/
|
||||
private BigDecimal retailPrice;
|
||||
/**
|
||||
* 调价描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 调整时间
|
||||
*/
|
||||
private Date retailTime;
|
||||
/**
|
||||
* 药品名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 药品英文名
|
||||
*/
|
||||
private String nameEn;
|
||||
/**
|
||||
* 拼音
|
||||
*/
|
||||
private String pyStr;
|
||||
/**
|
||||
* 五笔
|
||||
*/
|
||||
private String wbStr;
|
||||
/**
|
||||
* 商品名
|
||||
*/
|
||||
private String merchandiseName;
|
||||
/**
|
||||
* 商品名拼音
|
||||
*/
|
||||
private String merchandisePyStr;
|
||||
/**
|
||||
* 商品名五笔
|
||||
*/
|
||||
private String merchandiseWbStr;
|
||||
}
|
||||
@@ -3,15 +3,16 @@
|
||||
*/
|
||||
package com.openhis.web.paymentmanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 电子发票基础信息查询实体
|
||||
*
|
||||
@@ -21,12 +22,12 @@ import java.util.Date;
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InvoiceBaseInfoDto {
|
||||
//主键
|
||||
// 主键
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JSONField(serialize=false)
|
||||
@JSONField(serialize = false)
|
||||
private String id;
|
||||
|
||||
private String setlId;//结算id
|
||||
private String setlId;// 结算id
|
||||
|
||||
private String mdtrtId; // 就诊ID
|
||||
|
||||
@@ -100,5 +101,7 @@ public class InvoiceBaseInfoDto {
|
||||
|
||||
private BigDecimal hifdmPay; // 伤残人员医疗保障基金支出
|
||||
|
||||
private String paymentNo;//结算业务流水号 Payment与ClinicSettle是1:N
|
||||
private String paymentNo;// 结算业务流水号 Payment与ClinicSettle是1:N
|
||||
|
||||
private BigDecimal gfRatio; // 伤残人员医疗保障基金支出
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.paymentmanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 师大Bpc支付入参
|
||||
*
|
||||
* @author SunJQ
|
||||
* @date 2025-10-28
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class NenuBpcPayDto {
|
||||
/**
|
||||
* 二维码
|
||||
*/
|
||||
private String bpcCode;
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
private BigDecimal bpcPayAmount;
|
||||
/**
|
||||
* 付款id
|
||||
*/
|
||||
private Long paymentId;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
private Long index;
|
||||
}
|
||||
@@ -3,15 +3,14 @@
|
||||
*/
|
||||
package com.openhis.web.paymentmanage.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.openhis.common.annotation.Dict;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 映射对象
|
||||
@@ -24,19 +23,19 @@ public class PaymentVO {
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;//付款id
|
||||
private Long id;// 付款id
|
||||
|
||||
/** 状态 */
|
||||
@Dict(dictCode = "payment_status")
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_dictText;//状态
|
||||
private String statusEnum_dictText;// 状态
|
||||
|
||||
/** 支付的业务标识符 */
|
||||
private String paymentNo;//业务流水
|
||||
private String paymentNo;// 业务流水
|
||||
|
||||
/** 付费/退款 */
|
||||
@Dict(dictCode = "payment_enum")
|
||||
private String paymentEnum;//付费/退款
|
||||
private String paymentEnum;// 付费/退款
|
||||
private String paymentEnum_dictText;
|
||||
|
||||
/** 关联ID */
|
||||
@@ -44,53 +43,55 @@ public class PaymentVO {
|
||||
private String relationIdStr;
|
||||
|
||||
/** 收款员 */
|
||||
private Long entererId;//收款员
|
||||
private Long entererId;// 收款员
|
||||
|
||||
/** 收款员 */
|
||||
private String entererName;//收款员
|
||||
private String entererName;// 收款员
|
||||
|
||||
/** 支付的患者ID */
|
||||
private Long patientId;//支付患者
|
||||
private Long patientId;// 支付患者
|
||||
|
||||
/** 支付的患者 */
|
||||
private String patientName;//支付患者
|
||||
private String patientName;// 支付患者
|
||||
|
||||
/** 付款结果 */
|
||||
@Dict(dictCode = "outcome_enum")
|
||||
private Integer outcomeEnum;//付款结果
|
||||
private Integer outcomeEnum;// 付款结果
|
||||
private String outcomeEnum_dictText;
|
||||
|
||||
/** 应收金额 */
|
||||
private BigDecimal tenderedAmount;//应收
|
||||
private BigDecimal tenderedAmount;// 应收
|
||||
|
||||
/** 找零金额 */
|
||||
private BigDecimal returnedAmount;//找零
|
||||
private BigDecimal returnedAmount;// 找零
|
||||
|
||||
/** 付款总额 */
|
||||
private BigDecimal displayAmount;//付款总额
|
||||
private BigDecimal displayAmount;// 付款总额
|
||||
|
||||
/** 打印标识 */
|
||||
private Integer printCount;//打印标志
|
||||
private Integer printCount;// 打印标志
|
||||
|
||||
/** 结算时间 */
|
||||
private Date billDate;//结算时间
|
||||
private Date billDate;// 结算时间
|
||||
|
||||
/** 发票编号 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long invoiceId;//发票id
|
||||
private Long invoiceId;// 发票id
|
||||
|
||||
/** 发票no */
|
||||
private String invoiceNo;//发票no
|
||||
private String invoiceNo;// 发票no
|
||||
|
||||
/** 发票no */
|
||||
private String encounterBusNo;//发票no
|
||||
private String encounterBusNo;// 发票no
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;//就诊id
|
||||
private String encounterIdStr;//就诊id
|
||||
private Long encounterId;// 就诊id
|
||||
private String encounterIdStr;// 就诊id
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private String paymentId;//付款id
|
||||
private String paymentId;// 付款id
|
||||
|
||||
private String ybSettleIds;//医保付款id
|
||||
private String ybSettleIds;// 医保付款id
|
||||
|
||||
private Integer invoiceStatus;// 发票状态
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.openhis.web.paymentmanage.mapper;
|
||||
|
||||
import com.openhis.medication.domain.MedicationDefinition;
|
||||
import com.openhis.web.paymentmanage.dto.ChangePriceListDto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Desc:
|
||||
* @Author raymond
|
||||
* @Date 14:37 2025/10/15
|
||||
* @return
|
||||
**/
|
||||
@Component
|
||||
public interface ChangePriceMapper {
|
||||
|
||||
List<MedicationDefinition> searchMedicationList();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.openhis.web.paymentmanage.util;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "threepaymapping")
|
||||
@Data
|
||||
public class ReverseMappingProperties {
|
||||
|
||||
private Map<String, Map<String, String>> reverseMappings = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 获取特定业务类型的映射配置
|
||||
*/
|
||||
public Map<String, String> getMappingConfig(String businessType) {
|
||||
return reverseMappings.getOrDefault(businessType, new HashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有映射配置
|
||||
*/
|
||||
public Map<String, Map<String, String>> getAllMappings() {
|
||||
return reverseMappings;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user