From 48aac4098b8206150e9dfb6417c1e651492efecd Mon Sep 17 00:00:00 2001 From: wangsq Date: Thu, 9 Oct 2025 14:12:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=9D=E5=8C=BB=E4=BF=9D?= =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=8E=AF=E5=A2=83=E5=92=8C=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=8C=BB=E4=BF=9D=E6=AD=A3=E5=BC=8F=E7=8E=AF=E5=A2=83=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E5=8F=82=E6=95=B0=E5=92=8C=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E4=B8=8D=E4=B8=80=E8=87=B4=EF=BC=8C=E4=B8=BA?= =?UTF-8?q?=E6=AD=A4=E8=BF=9B=E8=A1=8C=E8=B0=83=E7=94=A8=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ynxbd/ali/helper/AliMedHelper.java | 4 +- .../com/ynxbd/common/action/InHospAction.java | 4 +- .../common/action/pay/MedicalTestAction.java | 43 +++++++++++++------ .../ynxbd/common/service/MedicalService.java | 4 +- .../ynxbd/wx/wxfactory/medical/Client.java | 42 +++++++++--------- 5 files changed, 58 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/ynxbd/ali/helper/AliMedHelper.java b/src/main/java/com/ynxbd/ali/helper/AliMedHelper.java index 179cbd1..bb4ca9b 100644 --- a/src/main/java/com/ynxbd/ali/helper/AliMedHelper.java +++ b/src/main/java/com/ynxbd/ali/helper/AliMedHelper.java @@ -99,7 +99,7 @@ public class AliMedHelper { request.putOtherTextParam("auth_token", accessToken); int callNum = ObjectUtils.isEmpty(reqBizNo) ? 1 : 2; // 2为第二次授权 - // [支付宝医保]测试报告2 + // [支付宝医保]测试报告1 log.info("[支付宝医保]身份核验信息授权查询接口[{}]-入参{}", callNum, JsonHelper.toJsonString(request)); AlipayCommerceMedicalAuthinfoAuthQueryResponse response = alipayClient.execute(request); log.info("[支付宝医保]身份核验信息授权查询接口[{}]-调用{} {}", callNum, response.isSuccess() ? "[成功]" : "[失败]", response.getBody()); @@ -208,7 +208,7 @@ public class AliMedHelper { bizContent.put("extend_params", extendParams); request.setBizContent(JSONObject.toJSONString(bizContent)); - + // [支付宝医保]测试报告3 log.info("[支付宝医保]下单-入参 {}", JSONObject.toJSONString(request)); AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); log.info("[支付宝医保]下单-返回 orderStr={}", response.getBody()); diff --git a/src/main/java/com/ynxbd/common/action/InHospAction.java b/src/main/java/com/ynxbd/common/action/InHospAction.java index d8b0ed5..d8cb207 100644 --- a/src/main/java/com/ynxbd/common/action/InHospAction.java +++ b/src/main/java/com/ynxbd/common/action/InHospAction.java @@ -5,6 +5,7 @@ import com.ynxbd.common.bean.in_hosp.*; import com.ynxbd.common.config.interceptor.AesDecode; import com.ynxbd.common.dao.his.HisInHospDao; import com.ynxbd.common.helper.common.DateHelper; +import com.ynxbd.common.helper.common.JsonHelper; import com.ynxbd.common.result.JsonResult; import com.ynxbd.common.result.Result; import com.ynxbd.common.result.ResultEnum; @@ -113,12 +114,14 @@ public class InHospAction extends BaseAction { } JsonResult resp = new HisInHospDao().getInHospFee(patientId, date); + log.error("[getInHospFee] resp={}", JsonHelper.toJsonString(resp)); if (!resp.success()) { return Result.error(resp.getMessage()); } InHospFee inHospFee = new InHospFee(); List items = resp.getDataMapList(InHospFeeItem.class, "Item"); + log.error("[getInHospFee] items={}", JsonHelper.toJsonString(items)); items.forEach(item -> { BigDecimal price = item.getPrice(); Integer count = item.getCount(); @@ -135,7 +138,6 @@ public class InHospAction extends BaseAction { inHospFee.setAttendingPhysician(resp.getDataMapString("setAttendingPhysician")); inHospFee.setLengthOfStay(resp.getDataMapString("LengthOfStay")); inHospFee.setTotalHospitalization(resp.getDataMapBigDecimal("TotalHospitalization")); - return Result.success(inHospFee); } diff --git a/src/main/java/com/ynxbd/common/action/pay/MedicalTestAction.java b/src/main/java/com/ynxbd/common/action/pay/MedicalTestAction.java index 5b55165..dcdea41 100644 --- a/src/main/java/com/ynxbd/common/action/pay/MedicalTestAction.java +++ b/src/main/java/com/ynxbd/common/action/pay/MedicalTestAction.java @@ -2,7 +2,6 @@ package com.ynxbd.common.action.pay; import com.alibaba.fastjson.JSONObject; import com.ynxbd.ali.config.AliMedConfig; -import com.ynxbd.ali.helper.AliMedHelper; import com.ynxbd.common.action.base.BaseAction; import com.ynxbd.common.bean.HisRecipe; import com.ynxbd.common.bean.enums.MerchantEnum; @@ -47,8 +46,12 @@ public class MedicalTestAction extends BaseAction { * 获取未缴费项目 */ @Action("getDevRxUnPayList") - public Result getDevRxUnPayList(@AesDecode String patientId, String begDate, String endDate) { - log.info("[处方Dev]未缴费项目查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); + public Result getDevRxUnPayList(@AesDecode String patientId, String payCode, String begDate, String endDate) { + log.info("[处方Dev]未缴费项目查询 payCode={}, patientId={}, begDate={}, endDate={}", payCode, patientId, begDate, endDate); + MerchantEnum merchantEnum = MerchantEnum.findEnumByCode(payCode); + if (merchantEnum == null) { + return Result.error(ResultEnum.PAY_TYPE_ERROR); + } if (patientId == null || begDate == null || endDate == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } @@ -58,7 +61,7 @@ public class MedicalTestAction extends BaseAction { } int days = DateHelper.intervalDays(begDate, endDate, true); - List hisRecipes = HisMedTestDao.devUnPayList(patientId, days); + List hisRecipes = HisMedTestDao.devUnPayList(merchantEnum, patientId, days); List dataList = new ArrayList<>(); for (HisRecipe hisRecipe : hisRecipes) { @@ -74,8 +77,12 @@ public class MedicalTestAction extends BaseAction { * 获取未缴费项目 */ @Action("getDevRxPaidList") - public Result getDevRxPaidList(@AesDecode String patientId, String begDate, String endDate) { - log.info("[处方Dev]已缴费项目查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); + public Result getDevRxPaidList(@AesDecode String patientId, String payCode, String begDate, String endDate) { + log.info("[处方Dev]已缴费项目查询 payCode={}, patientId={}, begDate={}, endDate={}", payCode, patientId, begDate, endDate); + MerchantEnum merchantEnum = MerchantEnum.findEnumByCode(payCode); + if (merchantEnum == null) { + return Result.error(ResultEnum.PAY_TYPE_ERROR); + } if (patientId == null || begDate == null || endDate == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } @@ -83,7 +90,7 @@ public class MedicalTestAction extends BaseAction { return Result.error("环境错误"); } - List hisRecipeList = HisMedTestDao.devPaidRecipeList(patientId, begDate, endDate); + List hisRecipeList = HisMedTestDao.devPaidRecipeList(merchantEnum, patientId, begDate, endDate); return Result.success(new RecipeService().filterPaidList(hisRecipeList)); } @@ -144,8 +151,12 @@ public class MedicalTestAction extends BaseAction { * */ @Action("his_med_refund") - public Result his_med_refund(String payAuthNo, String tradeNo) { - log.info("[医保]HIS退费 payAuthNo={}, tradeNo={}", payAuthNo, tradeNo); + public Result his_med_refund(String payCode, String payAuthNo, String tradeNo) { + log.info("[医保]HIS退费 payCode={}, payAuthNo={}, tradeNo={}", payCode, payAuthNo, tradeNo); + MerchantEnum merchantEnum = MerchantEnum.findEnumByCode(payCode); + if (merchantEnum == null) { + return Result.error(ResultEnum.PAY_TYPE_ERROR); + } if (ObjectUtils.isEmpty(payAuthNo) || ObjectUtils.isEmpty(tradeNo)) { return Result.error(ResultEnum.PARAM_IS_INVALID); } @@ -162,28 +173,32 @@ public class MedicalTestAction extends BaseAction { String bankTransNo = recipe.getBankTransNo(); BigDecimal cashFee = recipe.getPayMoney(); - JsonResult jsonResult = HisMedDao.medRefund(MerchantEnum.ALI_MEDICAL, payAuthNo, chrgBchno.substring(1), bankTransNo, ("R" + tradeNo), cashFee); + JsonResult jsonResult = HisMedDao.medRefund(merchantEnum, payAuthNo, chrgBchno.substring(1), bankTransNo, ("R" + tradeNo), cashFee); return Result.success(jsonResult); } @Action("wx_med_refund_test") public Result wx_med_refund_test() throws ServiceException { - WxMedHelper.refundCash("", "", new BigDecimal(""), "人工退费"); +// WxMedHelper.refundCash("", "", new BigDecimal(""), "人工退费"); return Result.success(); } @Action("ali_med_refund_test") public Result ali_med_refund_test() throws Exception { - AliMedHelper.refundTrade("", "", null, new BigDecimal(""), "医保退费"); +// AliMedHelper.refundTrade("", "", null, new BigDecimal(""), "医保退费"); return Result.success(); } @Action("wx_med_add_order") - public Result wx_med_add_order(String outTradeNo) { + public Result wx_med_add_order(String payCode, String outTradeNo) { try { - log.info("[医保]补充订单数据 outTradeNo={}", outTradeNo); + log.info("[医保]补充订单数据 payCode={}, outTradeNo={}", payCode, outTradeNo); + MerchantEnum merchantEnum = MerchantEnum.findEnumByCode(payCode); + if (merchantEnum == null) { + return Result.error(ResultEnum.PAY_TYPE_ERROR); + } WxMedOrder order = WxMedHelper.queryOrder(WxCacheHelper.getAccessToken(), outTradeNo, null); if (order == null || !order.isOk()) { return Result.error("订单未找到"); diff --git a/src/main/java/com/ynxbd/common/service/MedicalService.java b/src/main/java/com/ynxbd/common/service/MedicalService.java index a903e96..e01f169 100644 --- a/src/main/java/com/ynxbd/common/service/MedicalService.java +++ b/src/main/java/com/ynxbd/common/service/MedicalService.java @@ -115,11 +115,13 @@ public class MedicalService { } // 测试报告内容[2] - log.info("{}[HIS医保上传明细] req={patientId:{}, treatNum={}, totalFee:{}, cardNo:{}, recipeJson:{}}", merchantEnum.NAME, patientId, treatNum, totalFee, cardNo, recipeJson); + log.info("{}[HIS医保上传明细] req={patientId:\"{}\", treatNum:\"{}\", totalFee:\"{}\", cardNo:\"{}\", recipeJson:\"{}\"}", merchantEnum.NAME, patientId, treatNum, totalFee, cardNo, recipeJson); JsonResult result = HisMedDao.rxMedUploadDetails(merchantEnum, payAuthNo, cardNo, openid, patientId, treatNum, recipeJson, totalFee, ybAttrib, ybBZCode, ybBZName); return hisMedPlaceOrder(merchantEnum, payAuthNo, result); } + + /** * [医保]his下单 * diff --git a/src/main/java/com/ynxbd/wx/wxfactory/medical/Client.java b/src/main/java/com/ynxbd/wx/wxfactory/medical/Client.java index 22645a7..f8f42ae 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/medical/Client.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/medical/Client.java @@ -40,27 +40,27 @@ public class Client { /** * 微信医保下单 * - * @param OrderMIEnum 订单类型 - * @param accessToken accessToken - * @param appId appId - * @param mchId mchId - * @param mdPayKey mdPayKey - * @param cityCode 城市编码 - * @param hospitalName 医院名称 - * @param orgNo orgNo - * @param channel channel - * @param openid openid - * @param payAuthNo 医保授权码 - * @param payOrdId 医保订单id - * @param outTradeNo 商户订单号 - * @param serialNo serialNo - * @param totalFee totalFee - * @param insuranceFee insuranceFee - * @param cardNo 证件号码 - * @param realName 真实姓名 - * @param notifyUrl 通知地址 - * @param callbackUrl 回调地址 - * @param body body + * @param OrderMIEnum 订单类型 + * @param accessToken accessToken + * @param appId appId + * @param mchId mchId + * @param mdPayKey mdPayKey + * @param cityCode 城市编码 + * @param hospitalName 医院名称 + * @param orgNo orgNo + * @param channel channel + * @param openid openid + * @param payAuthNo 医保授权码 + * @param payOrdId 医保订单id + * @param outTradeNo 商户订单号 + * @param serialNo serialNo + * @param totalFee totalFee + * @param insuranceFee insuranceFee + * @param cardNo 证件号码 + * @param realName 真实姓名 + * @param notifyUrl 通知地址 + * @param callbackUrl 回调地址 + * @param body body * @return MedicalPayOrder */ public MedicalPayOrder createOrder(OrderMIEnum OrderMIEnum, String accessToken,