diff --git a/pom.xml b/pom.xml index ed23b4a..844fdcd 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ org.projectlombok lombok - 1.18.22 + 1.18.36 provided @@ -194,7 +194,7 @@ org.ehcache ehcache - 3.10.2 + 3.10.8 slf4j-api diff --git a/src/main/java/com/ynxbd/common/action/MeTechnologyReAction.java b/src/main/java/com/ynxbd/common/action/MeTechnologyReAction.java index ec433b9..2e99a2f 100644 --- a/src/main/java/com/ynxbd/common/action/MeTechnologyReAction.java +++ b/src/main/java/com/ynxbd/common/action/MeTechnologyReAction.java @@ -3,11 +3,10 @@ package com.ynxbd.common.action; import com.ynxbd.common.action.base.BaseAction; import com.ynxbd.common.result.Result; import com.ynxbd.common.result.ResultEnum; -import com.ynxbd.wx.config.MeTechnologyReConfig; +import com.ynxbd.wx.config.TZReserveConfig; +import lombok.extern.slf4j.Slf4j; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * @author 李进才 @@ -16,11 +15,10 @@ import org.slf4j.LoggerFactory; * @date 2024/06/18 14:53:00 */ +@Slf4j @Namespace("/meTechnologyRe") public class MeTechnologyReAction extends BaseAction { - private static final Logger log = LoggerFactory.getLogger(MeTechnologyReAction.class); - /** * 获取可预约的订单 * @@ -32,11 +30,11 @@ public class MeTechnologyReAction extends BaseAction { @Action("getCanBookOrders") public Result getCanBookOrders(String patientId, String startDate, String endDate) { log.info("[天助预约平台接口参数]获取可预约的订单 patientId={},startDate={},endDate={}", patientId, startDate, endDate); - if (startDate == null || endDate == null||patientId==null) { + if (startDate == null || endDate == null || patientId == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } patientId = getDecodeString(patientId); - return MeTechnologyReConfig.getCanBookOrders(patientId, startDate, endDate); + return TZReserveConfig.getCanBookOrders(patientId, startDate, endDate); } /** @@ -52,11 +50,11 @@ public class MeTechnologyReAction extends BaseAction { @Action("getNumberSourceStatistics") public Result getNumberSourceStatistics(String patientId, String startDate, String endDate, String docDetailedNo, String intervalTimeType) { log.info("[天助预约平台接口参数]获取号源统计信息 patientId={},startDate={},endDate={},docDetailedNo={},intervalTimeType={}", patientId, startDate, endDate, docDetailedNo, intervalTimeType); - if(patientId==null||startDate==null||endDate==null||docDetailedNo==null||intervalTimeType==null) { + if (patientId == null || startDate == null || endDate == null || docDetailedNo == null || intervalTimeType == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } patientId = getDecodeString(patientId); - return MeTechnologyReConfig.getNumberSourceStatistics(patientId, startDate, endDate, docDetailedNo, intervalTimeType); + return TZReserveConfig.getNumberSourceStatistics(patientId, startDate, endDate, docDetailedNo, intervalTimeType); } /** @@ -70,52 +68,52 @@ public class MeTechnologyReAction extends BaseAction { */ @Action("getNumberSourceDetails") public Result getNumberSourceDetails(String examRoomOrQueue, String startDate, String endDate, String appFromID) { - log.info("[天助预约平台接口参数]获取号源详细信息 examRoomOrQueue={},startDate={},endDate={},appFromID={}", examRoomOrQueue, startDate, endDate,appFromID); - if(examRoomOrQueue==null||startDate==null||endDate==null||appFromID==null) { + log.info("[天助预约平台接口参数]获取号源详细信息 examRoomOrQueue={},startDate={},endDate={},appFromID={}", examRoomOrQueue, startDate, endDate, appFromID); + if (examRoomOrQueue == null || startDate == null || endDate == null || appFromID == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } - return MeTechnologyReConfig.getNumberSourceDetails(examRoomOrQueue, startDate, endDate, appFromID); + return TZReserveConfig.getNumberSourceDetails(examRoomOrQueue, startDate, endDate, appFromID); } /** * 锁定预约号 * - * @param appFormID 申请表ID + * @param appFormID 申请表ID * @param examRoomOrQueue 检查队列 - * @param beginDateTime 开始时间 - * @param endDateTime 结束时间 - * @param lockStatus 锁定状态 + * @param beginDateTime 开始时间 + * @param endDateTime 结束时间 + * @param lockStatus 锁定状态 * @return 结果 */ @Action("lockedBookNo") public Result lockedBookNo(String appFormID, String examRoomOrQueue, String beginDateTime, String endDateTime, Boolean lockStatus) { log.info("[天助预约平台接口参数]锁定预约号 appFormID={},examRoomOrQueue={},beginDateTime={},endDateTime={},lockStatus={}", appFormID, examRoomOrQueue, beginDateTime, endDateTime, lockStatus); - if(appFormID==null || examRoomOrQueue == null || beginDateTime == null || endDateTime == null||lockStatus == null) { + if (appFormID == null || examRoomOrQueue == null || beginDateTime == null || endDateTime == null || lockStatus == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } - Boolean result = MeTechnologyReConfig.lockedBookNo(appFormID, examRoomOrQueue, beginDateTime, endDateTime, lockStatus); - return result?Result.success():Result.error(); + Boolean result = TZReserveConfig.lockedBookNo(appFormID, examRoomOrQueue, beginDateTime, endDateTime, lockStatus); + return result ? Result.success() : Result.error(); } /** * 确定改约 * - * @param appFormID 申请表ID + * @param appFormID 申请表ID * @param examRoomOrQueue 检查队列 - * @param beginDateTime 开始时间 - * @param endDateTime 结束时间 - * @param patientId 患者ID - * @param patientName 患者姓名 + * @param beginDateTime 开始时间 + * @param endDateTime 结束时间 + * @param patientId 患者ID + * @param patientName 患者姓名 * @return 结果 */ @Action("getBookedDateTime") public Result getBookedDateTime(String appFormID, String examRoomOrQueue, String beginDateTime, String endDateTime, String patientId, String patientName) { log.info("[天助预约平台接口参数]确定改约 appFormId={},examRoomOrQueue={},beginDateTime={},endDateTime={},patientId={},patientName={}", appFormID, examRoomOrQueue, beginDateTime, endDateTime, patientId, patientName); - if(appFormID==null||examRoomOrQueue==null||beginDateTime==null||endDateTime==null||patientId==null||patientName==null) { + if (appFormID == null || examRoomOrQueue == null || beginDateTime == null || endDateTime == null || patientId == null || patientName == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } patientId = getDecodeString(patientId); - return MeTechnologyReConfig.getBookedDateTime(appFormID, examRoomOrQueue, beginDateTime, endDateTime, patientId, patientName); + return TZReserveConfig.getBookedDateTime(appFormID, examRoomOrQueue, beginDateTime, endDateTime, patientId, patientName); } } diff --git a/src/main/java/com/ynxbd/common/action/RecipeAction.java b/src/main/java/com/ynxbd/common/action/RecipeAction.java index fff5795..f8e50a9 100644 --- a/src/main/java/com/ynxbd/common/action/RecipeAction.java +++ b/src/main/java/com/ynxbd/common/action/RecipeAction.java @@ -18,6 +18,7 @@ import com.ynxbd.common.result.Result; import com.ynxbd.common.result.ResultEnum; import com.ynxbd.common.service.RecipeService; import com.ynxbd.wx.config.WeChatConfig; +import com.ynxbd.wx.wxfactory.ReqParamHelper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.struts2.convention.annotation.Action; @@ -70,40 +71,11 @@ public class RecipeAction extends BaseAction { return Result.error(ResultEnum.PARAM_IS_INVALID); } } - - List hisRecipeList = new HisRecipeDao().getPaidRecipeList(patientId, begDate, endDate, personNo); - List dataList = new ArrayList<>(); - HisRecipe treatItem; - List groupList; - for (HisRecipe item : hisRecipeList) { - String treatNum = item.getMzNum(); - if (ObjectUtils.isEmpty(treatNum)) { - continue; - } - String execDate = item.getExecDate(); - item.setTreatNum(treatNum); - - HisRecipe findTreat = dataList.stream().filter(o -> o.getTreatNum().equals(treatNum)).findFirst().orElse(null); - if (findTreat == null) { - treatItem = new HisRecipe(); - treatItem.setTreatNum(treatNum); - treatItem.setDate(execDate); - groupList = new ArrayList<>(); - groupList.add(item); - treatItem.setGroupList(groupList); - dataList.add(treatItem); - } else { - if (findTreat.getGroupList() == null) { - findTreat.setGroupList(new ArrayList<>()); - } - Boolean isGreaterThan = DateHelper.leftGreaterThanRight(execDate, findTreat.getDate(), null); - if (isGreaterThan != null && isGreaterThan) { - findTreat.setDate(execDate); - } - findTreat.getGroupList().add(item); - } + List hisRxList = new HisRecipeDao().getPaidRecipeList(patientId, begDate, endDate, personNo); + for (HisRecipe item : hisRxList) { + item.filterSetEnBillNo(); } - return Result.success(dataList); + return Result.success(new RecipeService().filterPaidList(hisRxList)); } /** @@ -124,7 +96,7 @@ public class RecipeAction extends BaseAction { } int days = DateHelper.intervalDays(begDate, endDate, true); - List hisRecipes = new HisRecipeDao().getUnPayRecipe(patientId, personNo, days); + List hisRecipes = new HisRecipeDao().getRxUnPay(patientId, personNo, days); List resultList = new ArrayList<>(); for (HisRecipe hisRecipe : hisRecipes) { @@ -148,7 +120,7 @@ public class RecipeAction extends BaseAction { return Result.error(ResultEnum.PARAM_IS_DEFECT); } int days = DateHelper.intervalDays(begDate, endDate, true); - List hisRecipes = new HisRecipeDao().getUnPayRecipe(patientId, personNo, days); + List hisRecipes = new HisRecipeDao().getRxUnPay(patientId, personNo, days); List resultList = new ArrayList<>(); for (HisRecipe hisRecipe : hisRecipes) { @@ -159,6 +131,7 @@ public class RecipeAction extends BaseAction { return Result.success(resultList); } + /** * 获取所以未缴费订单 包括互联网医院未审核,医保双通道订单 * @@ -166,15 +139,15 @@ public class RecipeAction extends BaseAction { * @param begDate 开始时间 * @param endDate 结束时间 */ - @Action("getMedicalRecipe") - public Result getMedicalRecipe(String patientId, String begDate, String endDate) { + @Action("getOLRxList") + public Result getOLRxList(String patientId, String begDate, String endDate) { log.info("[处方]未缴费项目查询 patientId={}", patientId); patientId = getDecodeString(patientId); if (patientId == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } int days = DateHelper.intervalDays(begDate, endDate, true); - List hisRecipes = new HisRecipeDao().getUnPayRecipe(patientId, "", days); + List hisRecipes = new HisRecipeDao().getRxUnPay(patientId, "", days); List resultList = new ArrayList<>(); for (HisRecipe hisRecipe : hisRecipes) { if (hisRecipe.getDate() != null && DateHelper.inDateRange(begDate, endDate, hisRecipe.getDate(), DateHelper.DateEnum.yyyy_MM_dd)) { @@ -200,6 +173,22 @@ public class RecipeAction extends BaseAction { return new HisRecipeDao().uploadMedicalRecipe(treatNum, personID, recipes); } + + /** + * [处方]查询发票 + * + * @param invoiceNo 发票号 + */ + @Action("getRxInvoiceInfo") + public Result getRxInvoiceInfo(String invoiceNo) { + invoiceNo = getDecodeString(invoiceNo); + log.info("[处方]查询发票 invoiceNo={} ", invoiceNo); + if (invoiceNo == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + return new HisRecipeDao().queryElectronInvoice(invoiceNo); + } + // /** // * 获取未缴费项目 // */ @@ -340,6 +329,19 @@ public class RecipeAction extends BaseAction { } +// @Action("getTestRxList") +// public Result getTestRxList(String patientId, String personNo, String begDate, String endDate) { +// log.info("[处方]测试 patientId={}, personNo={}, begDate={}, endDate={}", patientId, personNo, begDate, endDate); +// +// JsonResult jsonResult = JsonResult.xmlToBean("40010成功罗金英1052064601血液检查申请单 3001医学检验科0444甲状腺乳腺外科1165秦双伟2025-06-12 08:10:259028361019
05M00500恶性肿瘤(特病)011250101015血细胞分析化验费1191191952064602
罗金英1052064602医学检验科检查(治疗)单 3001医学检验科0444甲状腺乳腺外科1165秦双伟2025-06-12 08:10:25902836104.5
左乳癌术后3月余。1011Z1432一次性使用采血器 紫检查类材料费0.510.511120400002C静脉采血器采血治疗费41411
", JsonResultEnum.SYS_HIS); +// if (jsonResult == null) { +// return Result.error(); +// } +// List hisRecipeList = jsonResult.getDataMapList(HisRecipe.class, "Recipe"); +// return Result.success(hisRecipeList); +// } + + // /** // * 核酸检测支付 // */ diff --git a/src/main/java/com/ynxbd/common/action/RegisterAction.java b/src/main/java/com/ynxbd/common/action/RegisterAction.java index 3abfa66..53d7631 100644 --- a/src/main/java/com/ynxbd/common/action/RegisterAction.java +++ b/src/main/java/com/ynxbd/common/action/RegisterAction.java @@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ynxbd.ali.helper.AliUploadHelper; import com.ynxbd.common.action.base.BaseAction; -import com.ynxbd.common.bean.Dept; -import com.ynxbd.common.bean.Doctor; -import com.ynxbd.common.bean.Patient; -import com.ynxbd.common.bean.RegSign; +import com.ynxbd.common.bean.*; import com.ynxbd.common.bean.enums.MerchantEnum; import com.ynxbd.common.bean.pay.Register; import com.ynxbd.common.dao.RegisterDao; @@ -449,11 +446,20 @@ public class RegisterAction extends BaseAction { * @return 预约签到结果 */ @Action("regSignIn") - public Result regSignIn(String treatNum) { - log.info("[执行挂号签到(只进行分诊叫号)] treatNum={}", treatNum); + public Result regSignIn(String treatNum, Integer signInType, String processMark) { + log.info("[执行挂号签到(只进行分诊叫号)] treatNum={}, signInType={}, processMark={}", treatNum, signInType, processMark); if (treatNum == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } + + if (!ObjectUtils.isEmpty(processMark)) { // 修改进程进度 + boolean isOK = new MedToolService().saveMedToolMarkByTreatNum(treatNum, 1, processMark); + log.info("[挂号签到]修改进程标记{} treatNum={}", treatNum, (isOK ? "成功" : "失败")); + } + + if (signInType != null && (signInType == 0 || signInType == 1)) { // 无需签到 | 自助机签到 + return Result.success(); + } JsonResult jsonResult = new HisRegisterDao().handleLineSignIn(treatNum); if (!jsonResult.success()) { return Result.error(jsonResult.getMessage()); @@ -498,6 +504,7 @@ public class RegisterAction extends BaseAction { return Result.success(regList); } + List treatNumList = new ArrayList<>(); String curDate = DateHelper.getCurDate(); for (Patient pItem : patients) { String patientId = pItem.getPatientId(); @@ -516,6 +523,10 @@ public class RegisterAction extends BaseAction { } } + String treatNum = regItem.getTreatNum(); + if (!ObjectUtils.isEmpty(treatNum)) { + treatNumList.add(treatNum); + } regItem.setCurDate(curDate); regItem.setPatientId(patientId); regItem.setEnPatientId(ReqParamHelper.encode(patientId)); @@ -529,6 +540,20 @@ public class RegisterAction extends BaseAction { } } } + List medToolRecords = new MedToolService().queryMedToolListByTreatList(treatNumList, 1); + if (medToolRecords.isEmpty()) { + return Result.success(regList); + } + for (Register regItem : regList) { + String treatNum = regItem.getTreatNum(); + if (ObjectUtils.isEmpty(treatNum)) { + continue; + } + MedTool findItem = medToolRecords.stream().filter(o -> o.getTreatNum().equals(treatNum)).findFirst().orElse(null); + if (findItem != null) { + regItem.setMedToolMark(findItem.getProcessMark()); + } + } return Result.success(regList); } catch (Exception e) { return Result.error(e); diff --git a/src/main/java/com/ynxbd/common/action/SelfHelpAction.java b/src/main/java/com/ynxbd/common/action/SelfHelpAction.java new file mode 100644 index 0000000..f39bce1 --- /dev/null +++ b/src/main/java/com/ynxbd/common/action/SelfHelpAction.java @@ -0,0 +1,52 @@ +package com.ynxbd.common.action; + +import com.ynxbd.common.action.base.BaseAction; +import com.ynxbd.common.bean.his.HisSelfHelpInfo; +import com.ynxbd.common.dao.his.HisSelfHelpDao; +import com.ynxbd.common.result.Result; +import com.ynxbd.common.result.ResultEnum; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.struts2.convention.annotation.Action; +import org.apache.struts2.convention.annotation.Namespace; + +import java.util.Arrays; +import java.util.List; + +@Slf4j +@Namespace("/selfHelp") +public class SelfHelpAction extends BaseAction { + + /** + * HIS查询自助开单 + */ + @Action("getHisSelfHelpList") + public Result getHisSelfHelpList() { + try { + log.info("[HIS查询自助开单]"); + List dataList = new HisSelfHelpDao().getHisSelfHelpList(); + return Result.success(dataList); + } catch (Exception e) { + return Result.error(e.getMessage()); + } + } + + /** + * HIS创建自助开单 + */ + @Action("createHisSelfHelp") + public Result createHisSelfHelp(String patientId, String items) { + try { + log.info("[HIS创建自助开单]"); + patientId = getDecodeString(patientId); + if (ObjectUtils.isEmpty(patientId) || ObjectUtils.isEmpty(items)) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } + List itemList = Arrays.asList(items.split(",")); + Boolean isOk = new HisSelfHelpDao().createHisSelfHelp(patientId, itemList); + return Result.success(isOk); + } catch (Exception e) { + return Result.error(e); + } + } +} diff --git a/src/main/java/com/ynxbd/common/action/pay/MedicalAction.java b/src/main/java/com/ynxbd/common/action/pay/MedicalAction.java index d39986d..cd4ea22 100644 --- a/src/main/java/com/ynxbd/common/action/pay/MedicalAction.java +++ b/src/main/java/com/ynxbd/common/action/pay/MedicalAction.java @@ -270,7 +270,7 @@ public class MedicalAction extends BaseAction { /** - * HIS医保退费 + * HIS查询医保对账记录 */ @Action("getHisAccountsInfo") public Result getHisAccountsInfo(String mdUserId) { @@ -295,7 +295,7 @@ public class MedicalAction extends BaseAction { } /** - * HIS医保退费 + * HIS查询医保退费 */ @Action("queryRefund") public Result queryRefund(String accessToken, String outTradeNo, String mdTransId) { 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 74d8d55..e163376 100644 --- a/src/main/java/com/ynxbd/common/action/pay/MedicalTestAction.java +++ b/src/main/java/com/ynxbd/common/action/pay/MedicalTestAction.java @@ -6,6 +6,7 @@ import com.ynxbd.common.dao.his.HisMedicalTestDao; import com.ynxbd.common.helper.common.DateHelper; import com.ynxbd.common.result.Result; import com.ynxbd.common.result.ResultEnum; +import com.ynxbd.common.service.RecipeService; import com.ynxbd.wx.wxfactory.WxMedicalHelper; import com.ynxbd.wx.wxfactory.bean.MedicalOrder; import com.ynxbd.wx.wxfactory.medical.MdConfig; @@ -28,9 +29,10 @@ public class MedicalTestAction extends BaseAction { /** * 获取未缴费项目 */ - @Action("getDevRecipeUnPayList") - public Result getDevRecipeUnPayList(String patientId, String begDate, String endDate) { + @Action("getDevRxUnPayList") + public Result getDevRxUnPayList(String patientId, String begDate, String endDate) { log.info("[处方Dev]未缴费项目查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); + patientId = getDecodeString(patientId); if (patientId == null || begDate == null || endDate == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } @@ -42,22 +44,23 @@ public class MedicalTestAction extends BaseAction { int days = DateHelper.intervalDays(begDate, endDate, true); List hisRecipes = HisMedicalTestDao.devUnPayList(patientId, days); - List resultList = new ArrayList<>(); + List dataList = new ArrayList<>(); for (HisRecipe hisRecipe : hisRecipes) { if (hisRecipe.getDate() != null && DateHelper.inDateRange(begDate, endDate, hisRecipe.getDate(), DateHelper.DateEnum.yyyy_MM_dd)) { - resultList.add(hisRecipe); + dataList.add(hisRecipe); } } - return Result.success(resultList); + return Result.success(dataList); } /** * 获取未缴费项目 */ - @Action("getDevRecipePaidList") - public Result getDevRecipePaidList(String patientId, String begDate, String endDate) { + @Action("getDevRxPaidList") + public Result getDevRxPaidList(String patientId, String begDate, String endDate) { log.info("[处方Dev]已缴费项目查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); + patientId = getDecodeString(patientId); if (patientId == null || begDate == null || endDate == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } @@ -65,9 +68,8 @@ public class MedicalTestAction extends BaseAction { if (!MdConfig.IS_DEV) { return Result.error("环境错误"); } - - List resultList = HisMedicalTestDao.devPaidRecipeList(patientId, begDate, endDate); - return Result.success(resultList); + List hisRecipeList = HisMedicalTestDao.devPaidRecipeList(patientId, begDate, endDate); + return Result.success(new RecipeService().filterPaidList(hisRecipeList)); } // diff --git a/src/main/java/com/ynxbd/common/action/report/LisReportAction.java b/src/main/java/com/ynxbd/common/action/report/LisReportAction.java index af72e1d..d284325 100644 --- a/src/main/java/com/ynxbd/common/action/report/LisReportAction.java +++ b/src/main/java/com/ynxbd/common/action/report/LisReportAction.java @@ -44,6 +44,7 @@ public class LisReportAction extends BaseAction { /** * 查询报告列表 + * patientType:0:住院 1:门诊 * * @return 报告列表 */ @@ -64,7 +65,7 @@ public class LisReportAction extends BaseAction { lstReport = new XBDLisDao().getReport(treatNum, patientType); break; case "2": // 瑞美 - lstReport = new XBDLisDao().getReport4RM(treatNum); + lstReport = new XBDLisDao().getReport4RM(treatNum, patientType); String reportId; for (XBDLisReport reportItem : lstReport) { @@ -296,7 +297,7 @@ public class LisReportAction extends BaseAction { * * @param callNo 调用类型 * @param queryType 查询类型 - * @param reportId 报告单ID + * @param reportId 报告单ID * @return */ @Action("downLisReport") diff --git a/src/main/java/com/ynxbd/common/bean/HisRecipe.java b/src/main/java/com/ynxbd/common/bean/HisRecipe.java index 6122878..ba041c9 100644 --- a/src/main/java/com/ynxbd/common/bean/HisRecipe.java +++ b/src/main/java/com/ynxbd/common/bean/HisRecipe.java @@ -1,9 +1,11 @@ package com.ynxbd.common.bean; +import com.ynxbd.wx.wxfactory.ReqParamHelper; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; +import org.apache.commons.lang3.ObjectUtils; import java.math.BigDecimal; import java.util.List; @@ -65,19 +67,38 @@ public class HisRecipe { private String internetHospFlag; // 是否为双通道处方 [1:双通道处方] private String sTDFlag; + private String sTDUploadDate; // 处方是否已经审核 private String yJSAuditFlag; private String ybAttrib; // 医保属性[4:为慢性病,5:为特殊病] - private Integer ybJsFlag; // 是否允许医保支付 + private Integer ybJsFlag; // 是否允许医保支付 [1不允许医保缴费,否则允许医保缴费] private String ybBZCode; // 病种编码 private String ybBZName; // 病种名称 + // 发票号(已缴费中查询出来=>发票状态) + private String invoiceNo; + + // 发票类型 + private String invoiceType; + // 支付类型 + private String payType; + // 收费单据号 + private String billNo; + // 加密的发票号 + private String enBillNo; private List item; // 处方集合 private List groupList; + + public void filterSetEnBillNo() { + if (ObjectUtils.isEmpty(this.billNo)) { + return; + } + this.enBillNo = ReqParamHelper.encode(this.billNo); + } } diff --git a/src/main/java/com/ynxbd/common/bean/MedTool.java b/src/main/java/com/ynxbd/common/bean/MedTool.java index 8c4b3e3..fd8d600 100644 --- a/src/main/java/com/ynxbd/common/bean/MedTool.java +++ b/src/main/java/com/ynxbd/common/bean/MedTool.java @@ -8,6 +8,7 @@ import org.apache.commons.lang3.ObjectUtils; import java.io.Serializable; import java.time.LocalDateTime; +import java.util.Date; // 就医助手 @@ -24,7 +25,7 @@ public class MedTool implements Serializable { // 进度标识 private String processMark; // 修改时间 - private LocalDateTime updateTime; + private Date updateTime; // 拼接进度状态 diff --git a/src/main/java/com/ynxbd/common/bean/enums/CountyEnum.java b/src/main/java/com/ynxbd/common/bean/enums/CountyEnum.java index 986e697..3a0eef8 100644 --- a/src/main/java/com/ynxbd/common/bean/enums/CountyEnum.java +++ b/src/main/java/com/ynxbd/common/bean/enums/CountyEnum.java @@ -3,8 +3,8 @@ package com.ynxbd.common.bean.enums; import org.apache.commons.lang3.ObjectUtils; public enum CountyEnum { - 弥勒市("弥勒市", "532504", "532526"), - 禄丰市("禄丰市", "532381", "532331"), + 弥勒市("弥勒市", "532526", "532526"), + 禄丰市("禄丰市", "532331", "532331"), ; public final String NAME; public final String CODE; // 市级编码 diff --git a/src/main/java/com/ynxbd/common/bean/enums/HospEnum.java b/src/main/java/com/ynxbd/common/bean/enums/HospEnum.java index 7c4c918..0bc9f43 100644 --- a/src/main/java/com/ynxbd/common/bean/enums/HospEnum.java +++ b/src/main/java/com/ynxbd/common/bean/enums/HospEnum.java @@ -23,7 +23,11 @@ public enum HospEnum { this.MESSAGE = MESSAGE; } - public static boolean isHosp(HospEnum hospEnum) { - return hospEnum.APP_ID.equals(WeChatConfig.APP_ID); + public boolean isHosp() { + return this.APP_ID.equals(WeChatConfig.APP_ID); } + +// public static boolean isHosp(HospEnum hospEnum) { +// return hospEnum.APP_ID.equals(WeChatConfig.APP_ID); +// } } diff --git a/src/main/java/com/ynxbd/common/bean/his/HisSelfHelpInfo.java b/src/main/java/com/ynxbd/common/bean/his/HisSelfHelpInfo.java new file mode 100644 index 0000000..ff08224 --- /dev/null +++ b/src/main/java/com/ynxbd/common/bean/his/HisSelfHelpInfo.java @@ -0,0 +1,19 @@ +package com.ynxbd.common.bean.his; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; +import org.apache.poi.hpsf.Decimal; + +import java.util.List; + +@Getter +@Setter +@ToString +@NoArgsConstructor +public class HisSelfHelpInfo { + private String applyCode; + private String applyName; + private List items; +} diff --git a/src/main/java/com/ynxbd/common/bean/his/HisSelfHelpItem.java b/src/main/java/com/ynxbd/common/bean/his/HisSelfHelpItem.java new file mode 100644 index 0000000..a3872c5 --- /dev/null +++ b/src/main/java/com/ynxbd/common/bean/his/HisSelfHelpItem.java @@ -0,0 +1,35 @@ +package com.ynxbd.common.bean.his; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +@NoArgsConstructor +public class HisSelfHelpItem { + private String itemNo; + private String applicationTypeName; + private String ksCode; + private String ksName; + private String deptCode; + private String deptName; + + private String groupFlag; + private String itemCode; + private String itemName; + // + private String price; + private String money; + private Integer count; + + public void replaceKeyName() { + this.deptCode = this.ksCode; + this.ksCode = null; + + this.deptName = this.ksName; + this.ksName = null; + } +} diff --git a/src/main/java/com/ynxbd/common/bean/pay/Register.java b/src/main/java/com/ynxbd/common/bean/pay/Register.java index eb8e198..410fd8b 100644 --- a/src/main/java/com/ynxbd/common/bean/pay/Register.java +++ b/src/main/java/com/ynxbd/common/bean/pay/Register.java @@ -75,6 +75,8 @@ public class Register extends Order { private String orderFromOwner; // 判断是否为分时段挂号 private Boolean isSplitTime; + // 就医助手标记 + private String medToolMark; public boolean hasIsTake(int val) { return isTake != null && isTake == val; diff --git a/src/main/java/com/ynxbd/common/dao/MedToolDao.java b/src/main/java/com/ynxbd/common/dao/MedToolDao.java index 3879c16..1148f68 100644 --- a/src/main/java/com/ynxbd/common/dao/MedToolDao.java +++ b/src/main/java/com/ynxbd/common/dao/MedToolDao.java @@ -2,6 +2,10 @@ package com.ynxbd.common.dao; import com.ynxbd.common.bean.MedTool; import com.ynxbd.common.config.db.DataBase; +import org.apache.commons.lang3.ObjectUtils; + +import java.util.ArrayList; +import java.util.List; public class MedToolDao { @@ -26,7 +30,6 @@ public class MedToolDao { } - public MedTool selectByTreatNumAndType(String treatNum, Integer type) { String sql = "select * from med_tool where treatNum=? and type=?"; return DataBase.selectOne(sql, MedTool.class, ps -> { @@ -34,4 +37,27 @@ public class MedToolDao { ps.setInt(2, type); }); } + + public List selectListByTreatNumList(List treatNumList, Integer type) { + if (treatNumList == null || treatNumList.isEmpty()) { + return new ArrayList<>(); + } + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < treatNumList.size(); i++) { + String treatNum = treatNumList.get(i); + sb.append("'").append(treatNum).append("'"); + if (i != treatNumList.size() - 1) { + sb.append(","); + } + } + + String treatNum = sb.toString(); + if (ObjectUtils.isEmpty(treatNum)) { + return new ArrayList<>(); + } + String sql = "select * from med_tool where treatNum in(" + treatNum + ") and type=?"; + return DataBase.select(sql, MedTool.class, ps -> { + ps.setInt(1, type); + }); + } } diff --git a/src/main/java/com/ynxbd/common/dao/PatientDao.java b/src/main/java/com/ynxbd/common/dao/PatientDao.java index 1744fbb..afa9698 100644 --- a/src/main/java/com/ynxbd/common/dao/PatientDao.java +++ b/src/main/java/com/ynxbd/common/dao/PatientDao.java @@ -1,6 +1,5 @@ package com.ynxbd.common.dao; -import com.ynxbd.common.bean.CommonOption; import com.ynxbd.common.bean.Patient; import com.ynxbd.common.bean.PatientLink; import com.ynxbd.common.bean.enums.HCardTypeEnum; diff --git a/src/main/java/com/ynxbd/common/dao/his/HisMedicalDao.java b/src/main/java/com/ynxbd/common/dao/his/HisMedicalDao.java index 821811e..63cab86 100644 --- a/src/main/java/com/ynxbd/common/dao/his/HisMedicalDao.java +++ b/src/main/java/com/ynxbd/common/dao/his/HisMedicalDao.java @@ -58,7 +58,6 @@ public class HisMedicalDao { params.put("YBAttrib", ybAttrib); params.put("YBBZCode", ybBZCode); params.put("YBBZName", ybBZName); - return HisHelper.getMdJsonResult(HisEnum.AP_Pay_Invoice, params); } return HisHelper.getMdJsonResult(HisEnum.AP_Pay_Invoice, params); } diff --git a/src/main/java/com/ynxbd/common/dao/his/HisRecipeDao.java b/src/main/java/com/ynxbd/common/dao/his/HisRecipeDao.java index b536307..f4b5d47 100644 --- a/src/main/java/com/ynxbd/common/dao/his/HisRecipeDao.java +++ b/src/main/java/com/ynxbd/common/dao/his/HisRecipeDao.java @@ -75,7 +75,7 @@ public class HisRecipeDao { * @param patientId 患者id * @return 待付费项目 */ - public List getUnPayRecipe(String patientId, String personNo, int days) { + public List getRxUnPay(String patientId, String personNo, int days) { List resultList = new ArrayList<>(); JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_UnPay_Invoice, params -> { @@ -282,6 +282,33 @@ public class HisRecipeDao { } + /** + * 查询发票信息 + * + * @param invoiceNo 发票号 + */ + public Result queryElectronInvoice(String invoiceNo) { + JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.QUERY_ELECTRON_INVOICE, params -> { + params.put("FPNum", invoiceNo); + }); + if (!jsonResult.success()) { + String message = jsonResult.getMessage(); + if (ObjectUtils.isEmpty(message)) { + return Result.error("[电子票据]查询异常"); + } + if (message.contains("未找到业务流水号") && message.contains("电子票据信息")) { + return Result.error("未找到电子票据信息"); + } + return Result.error(message); + } + String invoiceJSon = jsonResult.getDataMapString("EInvoiceJSonStr"); + if (ObjectUtils.isEmpty(invoiceJSon)) { + return Result.error("EInvoiceJSonStr为空"); + } + return Result.success(invoiceJSon); + } + + // public static void main(String[] args) { // List recipeIds = new ArrayList<>(); // recipeIds.add("1002242374"); diff --git a/src/main/java/com/ynxbd/common/dao/his/HisSelfHelpDao.java b/src/main/java/com/ynxbd/common/dao/his/HisSelfHelpDao.java new file mode 100644 index 0000000..65240c2 --- /dev/null +++ b/src/main/java/com/ynxbd/common/dao/his/HisSelfHelpDao.java @@ -0,0 +1,83 @@ +package com.ynxbd.common.dao.his; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.ynxbd.common.bean.his.HisSelfHelpInfo; +import com.ynxbd.common.bean.his.HisSelfHelpItem; +import com.ynxbd.common.bean.in_hosp.InHosp; +import com.ynxbd.common.helper.his.HisEnum; +import com.ynxbd.common.helper.his.HisHelper; +import com.ynxbd.common.result.JsonResult; +import com.ynxbd.common.result.Result; +import com.ynxbd.common.result.ResultEnum; +import com.ynxbd.common.result.ServiceException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Slf4j +public class HisSelfHelpDao { + + + public List getHisSelfHelpList() throws ServiceException { + JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.SH_SELF_HELP_QUERY, params -> { + + }); + if (!jsonResult.success()) { + String message = jsonResult.getMessage(); + if (message != null && message.contains("没有查询到")) { + return new ArrayList<>(); + } + throw new ServiceException(jsonResult.getMessage()); + } + + JSONArray jsonArray = jsonResult.getJsonArray("ApplicationInfos", "ApplicationInfo"); + String items; + JSONObject node; + HisSelfHelpInfo info; + List dataList = new ArrayList<>(); + for (int i = 0; i < jsonArray.size(); i++) { + node = jsonArray.getJSONObject(i); + info = new HisSelfHelpInfo(); + info.setApplyCode(node.getString("ApplyCode")); + info.setApplyName(node.getString("ApplyName")); + + items = node.getString("Item"); + if (ObjectUtils.isEmpty(items)) { + continue; + } + List itemList = JSONArray.parseArray(items, HisSelfHelpItem.class); + for (HisSelfHelpItem item : itemList) { + item.replaceKeyName(); + } + info.setItems(itemList); + dataList.add(info); + } + return dataList; + } + + + public Boolean createHisSelfHelp(String patientId, List items) throws ServiceException { + if (ObjectUtils.isEmpty(patientId)) { + throw new ServiceException(ResultEnum.PARAM_IS_DEFECT); + } + if (items.isEmpty()) { + throw new ServiceException("传递的申请单为空,禁止开单"); + } + + JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.SH_SELF_HELP_CREATE, params -> { + params.put("PatientId", patientId); + params.put("ApplicationInfos", HisHelper.strListToXml("ItemNo", items)); + }); + + if (!jsonResult.success()) { + throw new ServiceException(jsonResult.getMessage()); + } + Map dataMap = jsonResult.getDataMap(); + log.info("[创建自助申请单]: {}", dataMap); + return true; + } +} diff --git a/src/main/java/com/ynxbd/common/dao/lis/XBDLisDao.java b/src/main/java/com/ynxbd/common/dao/lis/XBDLisDao.java index 37acf99..2812db5 100644 --- a/src/main/java/com/ynxbd/common/dao/lis/XBDLisDao.java +++ b/src/main/java/com/ynxbd/common/dao/lis/XBDLisDao.java @@ -13,6 +13,7 @@ package com.ynxbd.common.dao.lis; import com.ynxbd.common.bean.lis.*; import com.ynxbd.common.config.db.LisDB; +import org.apache.commons.lang3.ObjectUtils; import java.util.ArrayList; import java.util.List; @@ -22,59 +23,59 @@ public class XBDLisDao { public List getReport(String treatId, String patientType) { String condition = "0".equals(patientType) ? "in" : "not in"; String sql = "SELECT DISTINCT" + - " ID," + - " r.SampleName AS ReportName," + - " r.ReportClass AS ReportType," + - " ReqDeptName," + - " ReqDoctorName as ReqDoctName," + - " xc.ReqItemName," + - " CONVERT(varchar,CONVERT(datetime,ReqDate),20) as ReqDate," + - " Reporter," + - " CONVERT(varchar,CONVERT(datetime,ReportDate),20) as ReportDate," + - " CONVERT(varchar,CONVERT(datetime,p.TestDate),23) as TestDate," + - " p.SampleCode," + - " SpecimenName," + - " PatientID AS TreatId," + - " PatientName," + - " CASE Sex" + - " WHEN 1 THEN '男'" + - " WHEN 2 THEN '女'" + - " ELSE ''" + - " END AS Sex," + - " CONVERT(VARCHAR(10), Age) + AgeClass AS Age," + - " PatientClass As PatientType," + - " BedNo" + - " FROM" + - " dbo.Rpt_Patient p (NOLOCK)" + - " LEFT JOIN ( SELECT" + - " STUFF(( SELECT" + - " ',' + ReqItemName" + - " FROM" + - " Rpt_CheckCost (NOLOCK)" + - " WHERE" + - " SampleCode = c.SampleCode AND TestDate = c.TestDate" + - " FOR" + - " XML PATH('') ), 1, 1, '') AS ReqItemName," + - " c.ReqItemCode," + - " SampleCode," + - " TestDate" + - " FROM" + - " Rpt_CheckCost c (NOLOCK)" + - " GROUP BY" + - " c.SampleCode," + - " c.TestDate," + - " c.ReqItemCode ) xc ON p.SampleCode = xc.SampleCode AND p.TestDate = xc.TestDate" - + - " LEFT JOIN dbo.Dict_Report r (NOLOCK) ON SUBSTRING(p.SampleCode, 1, 2) = r.SampleCode" - + - " LEFT JOIN dbo.Dict_PatientClass pc (NOLOCK) ON p.PatientClassCode = pc.PatientClassCode" - + - " WHERE" + - " ISNULL(Checker, '') <> '' AND p.PatientClassCode " + condition - + " (SELECT PatientClassCode FROM dbo.Dict_PatientClass WHERE (PatientClassName = '住院' OR PatientClassName = '住院急诊')) AND PatientID = ?" - + - " ORDER BY" + - " ReportDate"; + " ID," + + " r.SampleName AS ReportName," + + " r.ReportClass AS ReportType," + + " ReqDeptName," + + " ReqDoctorName as ReqDoctName," + + " xc.ReqItemName," + + " CONVERT(varchar,CONVERT(datetime,ReqDate),20) as ReqDate," + + " Reporter," + + " CONVERT(varchar,CONVERT(datetime,ReportDate),20) as ReportDate," + + " CONVERT(varchar,CONVERT(datetime,p.TestDate),23) as TestDate," + + " p.SampleCode," + + " SpecimenName," + + " PatientID AS TreatId," + + " PatientName," + + " CASE Sex" + + " WHEN 1 THEN '男'" + + " WHEN 2 THEN '女'" + + " ELSE ''" + + " END AS Sex," + + " CONVERT(VARCHAR(10), Age) + AgeClass AS Age," + + " PatientClass As PatientType," + + " BedNo" + + " FROM" + + " dbo.Rpt_Patient p (NOLOCK)" + + " LEFT JOIN ( SELECT" + + " STUFF(( SELECT" + + " ',' + ReqItemName" + + " FROM" + + " Rpt_CheckCost (NOLOCK)" + + " WHERE" + + " SampleCode = c.SampleCode AND TestDate = c.TestDate" + + " FOR" + + " XML PATH('') ), 1, 1, '') AS ReqItemName," + + " c.ReqItemCode," + + " SampleCode," + + " TestDate" + + " FROM" + + " Rpt_CheckCost c (NOLOCK)" + + " GROUP BY" + + " c.SampleCode," + + " c.TestDate," + + " c.ReqItemCode ) xc ON p.SampleCode = xc.SampleCode AND p.TestDate = xc.TestDate" + + + " LEFT JOIN dbo.Dict_Report r (NOLOCK) ON SUBSTRING(p.SampleCode, 1, 2) = r.SampleCode" + + + " LEFT JOIN dbo.Dict_PatientClass pc (NOLOCK) ON p.PatientClassCode = pc.PatientClassCode" + + + " WHERE" + + " ISNULL(Checker, '') <> '' AND p.PatientClassCode " + condition + + " (SELECT PatientClassCode FROM dbo.Dict_PatientClass WHERE (PatientClassName = '住院' OR PatientClassName = '住院急诊')) AND PatientID = ?" + + + " ORDER BY" + + " ReportDate"; return LisDB.select(sql, XBDLisReport.class, ps -> { ps.setString(1, treatId); @@ -83,23 +84,23 @@ public class XBDLisDao { public List getResult(String testDate, String sampleCode) { String sql = "SELECT" + - " a.rptItemCode as reportItemCode," + - " b.rptItemName as reportItemName," + - " a.resultStr as result," + - " a.unit," + - " a.range," + - " CASE a.UnusualFlag WHEN ' ' THEN '' ELSE a.UnusualFlag END AS UnusualFlag," - + - " a.insCode," + - " b.seq" + - " FROM" + - " dbo.Rpt_CheckResult a" + - " LEFT JOIN dbo.Dict_ReportToItem b ON a.RptItemCode = b.RptItemCode" + - " WHERE" + - " a.TestDate = ? AND a.SampleCode = ? AND b.SampleCode = SUBSTRING(a.SampleCode, 1, 2)" - + - " ORDER BY" + - " b.Seq"; + " a.rptItemCode as reportItemCode," + + " b.rptItemName as reportItemName," + + " a.resultStr as result," + + " a.unit," + + " a.range," + + " CASE a.UnusualFlag WHEN ' ' THEN '' ELSE a.UnusualFlag END AS UnusualFlag," + + + " a.insCode," + + " b.seq" + + " FROM" + + " dbo.Rpt_CheckResult a" + + " LEFT JOIN dbo.Dict_ReportToItem b ON a.RptItemCode = b.RptItemCode" + + " WHERE" + + " a.TestDate = ? AND a.SampleCode = ? AND b.SampleCode = SUBSTRING(a.SampleCode, 1, 2)" + + + " ORDER BY" + + " b.Seq"; return LisDB.select(sql, XBDLisResult.class, ps -> { ps.setString(1, testDate); ps.setString(2, sampleCode); @@ -117,15 +118,15 @@ public class XBDLisDao { public List getBactResult(String testDate, String sampleCode) { List bactResults = new ArrayList<>(); String sql = "SELECT" + - " isnull(b.BactName,'') as BactName," + - " isnull(a.Result,'') as Result," + - " isnull(a.InsCode,'') as InsCode," + - " a.Seq" + - " FROM" + - " dbo.Rpt_BactResult (NOLOCK) a" + - " Right JOIN dbo.Dict_Bacteria (NOLOCK) b ON a.BactCode = b.BactCode" + - " WHERE" + - " a.TestDate = ? AND a.SampleCode = ?"; + " isnull(b.BactName,'') as BactName," + + " isnull(a.Result,'') as Result," + + " isnull(a.InsCode,'') as InsCode," + + " a.Seq" + + " FROM" + + " dbo.Rpt_BactResult (NOLOCK) a" + + " Right JOIN dbo.Dict_Bacteria (NOLOCK) b ON a.BactCode = b.BactCode" + + " WHERE" + + " a.TestDate = ? AND a.SampleCode = ?"; bactResults = LisDB.select(sql, XBDLisBactResult.class, ps -> { ps.setString(1, testDate); ps.setString(2, sampleCode); @@ -142,17 +143,17 @@ public class XBDLisDao { private List getAntbResult(String testDate, String sampleCode, int seq) { String sql = "SELECT" + - " isnull(a.AntbCode,'') as AntbCode," + - " isnull(b.AntbName,'') as AntbName," + - " isnull(a.Result,'') as Result," + - " isnull(a.Mic,'') as Mic," + - " isnull(a.InsCode,'') as InsCode," + - " a.Seq" + - " FROM" + - " dbo.Rpt_AntbResult (NOLOCK) a" + - " LEFT JOIN dbo.Dict_Antibiotic (NOLOCK) b ON a.AntbCode = b.AntbCode" + - " WHERE" + - " a.TestDate = ? AND a.SampleCode = ? AND a.seq = ?"; + " isnull(a.AntbCode,'') as AntbCode," + + " isnull(b.AntbName,'') as AntbName," + + " isnull(a.Result,'') as Result," + + " isnull(a.Mic,'') as Mic," + + " isnull(a.InsCode,'') as InsCode," + + " a.Seq" + + " FROM" + + " dbo.Rpt_AntbResult (NOLOCK) a" + + " LEFT JOIN dbo.Dict_Antibiotic (NOLOCK) b ON a.AntbCode = b.AntbCode" + + " WHERE" + + " a.TestDate = ? AND a.SampleCode = ? AND a.seq = ?"; return LisDB.select(sql, XBDLisAntbResult.class, ps -> { ps.setString(1, testDate); ps.setString(2, sampleCode); @@ -173,66 +174,66 @@ public class XBDLisDao { public List getReport4KH(String treatId, String patientType) { String condition = patientType.equals("0") ? "in" : "not in"; String sql = "SELECT" + - " ID" + - " ,r.report_name AS ReportName" + - " ,CASE r.REPORT_TYPE WHEN 1 THEN '细菌报告单' ELSE '基本报告单' END AS ReportType" - + - " ,Require_BM AS ReqDeptName" + - " ,Require_Doctor AS ReqDoctName" + - " ,xc.ReqItemName" + - " ,CONVERT(varchar,CONVERT(datetime,Require_Date),20) as ReqDate" - + - " ,u.Name AS Reporter" + - " ,CONVERT(varchar,CONVERT(DATETIME, Date_Report),20) as ReportDate" - + - " ,CONVERT(varchar,CONVERT(datetime,p.Date_Test),23) as TestDate" - + - " ,p.YBH AS SampleCode" + - " ,k.Kind_Name AS SpecimenName" + - " ,Patient_Code AS TreatId" + - " ,p.Name AS PatientName" + - " ,CASE Sex" + - " WHEN 1 THEN '男'" + - " WHEN 2 THEN '女'" + - " ELSE ''" + - " END AS Sex" + - " ,Age" + - " ,age_flag AS Age" + - " ,Patient_kind_name As PatientType," + - " Bed_no AS BedNo" + - " FROM" + - " dbo.UT_Check_Patient p (NOLOCK)" + - " LEFT JOIN ( SELECT" + - " STUFF(( SELECT" + - " ',' + Item_name" + - " FROM" + - " dbo.UT_CHECK_COST (NOLOCK)" + - " WHERE" + - " YBH = c.YBH AND Date_test = c.Date_test" + - " FOR" + - " XML PATH('') ), 1, 1, '') AS ReqItemName," + - " c.YBH," + - " c.Date_test" + - " FROM" + - " dbo.UT_CHECK_COST c (NOLOCK)" + - " GROUP BY" + - " c.YBH," + - " c.Date_test) xc ON p.YBH = xc.YBH AND p.Date_test = xc.Date_test" + - " LEFT JOIN UT_DICT_Report r (NOLOCK) ON SUBSTRING(p.YBH, 1, 2) = r.code" - + - " LEFT JOIN UT_DICT_Patient_kind pc (NOLOCK) ON p.Patient_Kind = pc.Patient_kind_code" - + - " LEFT JOIN UT_Check_Module_Kind k(nolock) on p.Kind = k.kind_code" - + - " LEFT JOIN dbo.UT_DICT_User u (nolock) on p.Reporter = u.User_ID" - + - " WHERE" + - " Flag_Send =5 AND p.Patient_Kind " + condition - + " (SELECT Patient_kind_code FROM UT_DICT_Patient_kind WHERE (Patient_kind_name = '住院' OR Patient_kind_name = '住院急诊')) " - + - " AND Patient_Code = ?" + - " ORDER BY" + - " ReportDate"; + " ID" + + " ,r.report_name AS ReportName" + + " ,CASE r.REPORT_TYPE WHEN 1 THEN '细菌报告单' ELSE '基本报告单' END AS ReportType" + + + " ,Require_BM AS ReqDeptName" + + " ,Require_Doctor AS ReqDoctName" + + " ,xc.ReqItemName" + + " ,CONVERT(varchar,CONVERT(datetime,Require_Date),20) as ReqDate" + + + " ,u.Name AS Reporter" + + " ,CONVERT(varchar,CONVERT(DATETIME, Date_Report),20) as ReportDate" + + + " ,CONVERT(varchar,CONVERT(datetime,p.Date_Test),23) as TestDate" + + + " ,p.YBH AS SampleCode" + + " ,k.Kind_Name AS SpecimenName" + + " ,Patient_Code AS TreatId" + + " ,p.Name AS PatientName" + + " ,CASE Sex" + + " WHEN 1 THEN '男'" + + " WHEN 2 THEN '女'" + + " ELSE ''" + + " END AS Sex" + + " ,Age" + + " ,age_flag AS Age" + + " ,Patient_kind_name As PatientType," + + " Bed_no AS BedNo" + + " FROM" + + " dbo.UT_Check_Patient p (NOLOCK)" + + " LEFT JOIN ( SELECT" + + " STUFF(( SELECT" + + " ',' + Item_name" + + " FROM" + + " dbo.UT_CHECK_COST (NOLOCK)" + + " WHERE" + + " YBH = c.YBH AND Date_test = c.Date_test" + + " FOR" + + " XML PATH('') ), 1, 1, '') AS ReqItemName," + + " c.YBH," + + " c.Date_test" + + " FROM" + + " dbo.UT_CHECK_COST c (NOLOCK)" + + " GROUP BY" + + " c.YBH," + + " c.Date_test) xc ON p.YBH = xc.YBH AND p.Date_test = xc.Date_test" + + " LEFT JOIN UT_DICT_Report r (NOLOCK) ON SUBSTRING(p.YBH, 1, 2) = r.code" + + + " LEFT JOIN UT_DICT_Patient_kind pc (NOLOCK) ON p.Patient_Kind = pc.Patient_kind_code" + + + " LEFT JOIN UT_Check_Module_Kind k(nolock) on p.Kind = k.kind_code" + + + " LEFT JOIN dbo.UT_DICT_User u (nolock) on p.Reporter = u.User_ID" + + + " WHERE" + + " Flag_Send =5 AND p.Patient_Kind " + condition + + " (SELECT Patient_kind_code FROM UT_DICT_Patient_kind WHERE (Patient_kind_name = '住院' OR Patient_kind_name = '住院急诊')) " + + + " AND Patient_Code = ?" + + " ORDER BY" + + " ReportDate"; return LisDB.select(sql, XBDLisReport.class, ps -> { ps.setString(1, treatId); }); @@ -241,85 +242,85 @@ public class XBDLisDao { public List getReport4KH_Hhzfy(String treatId, String patientType) { String condition = patientType.equals("0") ? "in" : "not in"; String condition2 = - patientType.equals("0") ? String.format(" AND Patient_Code = '%s'", treatId) - : String.format(" AND Bed_No = '%s'", treatId); + patientType.equals("0") ? String.format(" AND Patient_Code = '%s'", treatId) + : String.format(" AND Bed_No = '%s'", treatId); System.out.println("conditon2:" + condition2); String sql = "SELECT" + - " ID" + - " ,r.report_name AS ReportName" + - " ,CASE r.REPORT_TYPE WHEN 1 THEN '细菌报告单' ELSE '基本报告单' END AS ReportType" - + - " ,Require_BM AS ReqDeptName" + - " ,Require_Doctor AS ReqDoctName" + - " ,xc.ReqItemName" + - " ,CONVERT(varchar,CONVERT(datetime,Require_Date),20) as ReqDate" - + - " ,u.Name AS Reporter" + - " ,CONVERT(varchar,CONVERT(DATETIME, Date_Report),20) as ReportDate" - + - " ,CONVERT(varchar,CONVERT(datetime,p.Date_Test),23) as TestDate" - + - " ,p.YBH AS SampleCode" + - " ,k.Kind_Name AS SpecimenName" + - " ,Patient_Code AS TreatId" + - " ,p.Name AS PatientName" + - " ,CASE Sex" + - " WHEN 1 THEN '男'" + - " WHEN 2 THEN '女'" + - " ELSE ''" + - " END AS Sex" + - " ,Age" + - " ,age_flag AS Age" + - " ,Patient_kind_name As PatientType," + - " Bed_no AS BedNo" + - " FROM" + - " dbo.UT_Check_Patient p (NOLOCK)" + - " LEFT JOIN ( SELECT" + - " STUFF(( SELECT" + - " ',' + Item_name" + - " FROM" + - " dbo.UT_CHECK_COST (NOLOCK)" + - " WHERE" + - " YBH = c.YBH AND Date_test = c.Date_test" + - " FOR" + - " XML PATH('') ), 1, 1, '') AS ReqItemName," + - " c.YBH," + - " c.Date_test" + - " FROM" + - " dbo.UT_CHECK_COST c (NOLOCK)" + - " GROUP BY" + - " c.YBH," + - " c.Date_test) xc ON p.YBH = xc.YBH AND p.Date_test = xc.Date_test" + - " LEFT JOIN UT_DICT_Report r (NOLOCK) ON SUBSTRING(p.YBH, 1, 2) = r.code" - + - " LEFT JOIN UT_DICT_Patient_kind pc (NOLOCK) ON p.Patient_Kind = pc.Patient_kind_code" - + - " LEFT JOIN UT_Check_Module_Kind k(nolock) on p.Kind = k.kind_code" - + - " LEFT JOIN dbo.UT_DICT_User u (nolock) on p.Reporter = u.User_ID" - + - " WHERE" + - " Flag_Send =5 AND p.Patient_Kind " + condition - + " (SELECT Patient_kind_code FROM UT_DICT_Patient_kind WHERE (Patient_kind_name = '住院' OR Patient_kind_name = '住院急诊')) " - + condition2 + - " ORDER BY" + - " ReportDate"; + " ID" + + " ,r.report_name AS ReportName" + + " ,CASE r.REPORT_TYPE WHEN 1 THEN '细菌报告单' ELSE '基本报告单' END AS ReportType" + + + " ,Require_BM AS ReqDeptName" + + " ,Require_Doctor AS ReqDoctName" + + " ,xc.ReqItemName" + + " ,CONVERT(varchar,CONVERT(datetime,Require_Date),20) as ReqDate" + + + " ,u.Name AS Reporter" + + " ,CONVERT(varchar,CONVERT(DATETIME, Date_Report),20) as ReportDate" + + + " ,CONVERT(varchar,CONVERT(datetime,p.Date_Test),23) as TestDate" + + + " ,p.YBH AS SampleCode" + + " ,k.Kind_Name AS SpecimenName" + + " ,Patient_Code AS TreatId" + + " ,p.Name AS PatientName" + + " ,CASE Sex" + + " WHEN 1 THEN '男'" + + " WHEN 2 THEN '女'" + + " ELSE ''" + + " END AS Sex" + + " ,Age" + + " ,age_flag AS Age" + + " ,Patient_kind_name As PatientType," + + " Bed_no AS BedNo" + + " FROM" + + " dbo.UT_Check_Patient p (NOLOCK)" + + " LEFT JOIN ( SELECT" + + " STUFF(( SELECT" + + " ',' + Item_name" + + " FROM" + + " dbo.UT_CHECK_COST (NOLOCK)" + + " WHERE" + + " YBH = c.YBH AND Date_test = c.Date_test" + + " FOR" + + " XML PATH('') ), 1, 1, '') AS ReqItemName," + + " c.YBH," + + " c.Date_test" + + " FROM" + + " dbo.UT_CHECK_COST c (NOLOCK)" + + " GROUP BY" + + " c.YBH," + + " c.Date_test) xc ON p.YBH = xc.YBH AND p.Date_test = xc.Date_test" + + " LEFT JOIN UT_DICT_Report r (NOLOCK) ON SUBSTRING(p.YBH, 1, 2) = r.code" + + + " LEFT JOIN UT_DICT_Patient_kind pc (NOLOCK) ON p.Patient_Kind = pc.Patient_kind_code" + + + " LEFT JOIN UT_Check_Module_Kind k(nolock) on p.Kind = k.kind_code" + + + " LEFT JOIN dbo.UT_DICT_User u (nolock) on p.Reporter = u.User_ID" + + + " WHERE" + + " Flag_Send =5 AND p.Patient_Kind " + condition + + " (SELECT Patient_kind_code FROM UT_DICT_Patient_kind WHERE (Patient_kind_name = '住院' OR Patient_kind_name = '住院急诊')) " + + condition2 + + " ORDER BY" + + " ReportDate"; return LisDB.select(sql, XBDLisReport.class); } public List getResult4KH(String testDate, String sampleCode) { String sql = "SELECT a.Item_Code AS reportItemCode" + - " ,b.Item_Name AS reportItemName" + - " ,a.Test_Value2 AS result" + - " ,a.Text_Danwei AS unit" + - " ,a.Text_range AS range" + - " ,ISNULL(a.Text_Note, '') AS unusualFlag" + - " ,a.Flag_YQ AS insCode" + - " ,a.Out_Order AS seq" + - " FROM UT_Check_Result a LEFT JOIN" + - " UT_DICT_Items b ON a.Item_Code = b.Item_Code" + - " WHERE a.Test_Date = ? AND a.YBH = ?" + - " ORDER BY a.Out_Order"; + " ,b.Item_Name AS reportItemName" + + " ,a.Test_Value2 AS result" + + " ,a.Text_Danwei AS unit" + + " ,a.Text_range AS range" + + " ,ISNULL(a.Text_Note, '') AS unusualFlag" + + " ,a.Flag_YQ AS insCode" + + " ,a.Out_Order AS seq" + + " FROM UT_Check_Result a LEFT JOIN" + + " UT_DICT_Items b ON a.Item_Code = b.Item_Code" + + " WHERE a.Test_Date = ? AND a.YBH = ?" + + " ORDER BY a.Out_Order"; return LisDB.select(sql, XBDLisResult.class, ps -> { ps.setString(1, testDate); ps.setString(2, sampleCode); @@ -337,12 +338,12 @@ public class XBDLisDao { public List getBactResult4KH(String testDate, String sampleCode) { List bactResults = new ArrayList<>(); String sql = "SELECT" + - " ISNULL(Bacteria_name, '') AS BactName" + - ",ISNULL(Test_Value, '') AS Result" + - ",ISNULL(Flag_YQ, '') AS InsCode" + - ",Bacteria_serial AS Seq" + - " FROM ut_check_bacteria (NOLOCK)" + - " WHERE test_date = ? AND ybh = ?"; + " ISNULL(Bacteria_name, '') AS BactName" + + ",ISNULL(Test_Value, '') AS Result" + + ",ISNULL(Flag_YQ, '') AS InsCode" + + ",Bacteria_serial AS Seq" + + " FROM ut_check_bacteria (NOLOCK)" + + " WHERE test_date = ? AND ybh = ?"; bactResults = LisDB.select(sql, XBDLisBactResult.class, ps -> { ps.setString(1, testDate); ps.setString(2, sampleCode); @@ -350,7 +351,7 @@ public class XBDLisDao { for (XBDLisBactResult item : bactResults) { List antbResults = getAntbResult4KH(testDate, sampleCode, - item.getSeq()); + item.getSeq()); item.setAntbResults(antbResults); List comments = getComment4KH(testDate, sampleCode, item.getSeq()); item.setComments(comments); @@ -361,18 +362,18 @@ public class XBDLisDao { private List getAntbResult4KH(String testDate, String sampleCode, int seq) { String sql = "SELECT" + - " isnull(a.Antibiotic_code,'') as AntbCode" + - " ,isnull(b.Antibiotic_name,'') as AntbName" + - " ,isnull(a.Test_value,'') as Result" + - " ,isnull(a.Mic,'') as Mic" + - " ,'' as InsCode" + - " ,a.Bacteria_serial AS Seq" + - " FROM " + - " ut_check_antibiotic a (NOLOCK)" + - " LEFT JOIN ut_dict_antibiotic b (NOLOCK) ON a.Antibiotic_code = b.Antibiotic_code" - + - " WHERE" + - " a.test_date = ? AND a.ybh = ? AND a.Bacteria_serial = ?"; + " isnull(a.Antibiotic_code,'') as AntbCode" + + " ,isnull(b.Antibiotic_name,'') as AntbName" + + " ,isnull(a.Test_value,'') as Result" + + " ,isnull(a.Mic,'') as Mic" + + " ,'' as InsCode" + + " ,a.Bacteria_serial AS Seq" + + " FROM " + + " ut_check_antibiotic a (NOLOCK)" + + " LEFT JOIN ut_dict_antibiotic b (NOLOCK) ON a.Antibiotic_code = b.Antibiotic_code" + + + " WHERE" + + " a.test_date = ? AND a.ybh = ? AND a.Bacteria_serial = ?"; return LisDB.select(sql, XBDLisAntbResult.class, ps -> { ps.setString(1, testDate); ps.setString(2, sampleCode); @@ -422,39 +423,50 @@ public class XBDLisDao { }); } - // 瑞美 - public List getReport4RM(String treatId) { + // 瑞美 patientType:0:住院 1:门诊 + public List getReport4RM(String treatId, String patientType) { + String reportPatTypeCode = "('1','2','3')"; + if (ObjectUtils.isEmpty(patientType) || "0".equals(patientType)) { // 住院 + reportPatTypeCode = "('3')"; + + } else if ("1".equals(patientType)) { // 门诊 + reportPatTypeCode = "('1','2')"; + + } else if ("4".equals(patientType)) { // 体检 + reportPatTypeCode = "('4')"; + } String sql = "SELECT" + - " a.reportid AS ID" + - " ,RTRIM(b.rptunitname) AS ReportName" + - " ,CASE e.resultclass WHEN '细菌' THEN '细菌报告单' ELSE '基本报告单' END AS ReportType" + - " ,isnull(c.deptname,'') AS ReqDeptName" + - " ,isnull(d.doctorname,'') AS ReqDoctName" + - " ,isnull(a.req_reason,'') AS ReqItemName" + - " ,isnull(a.req_dt,'') AS ReqDate" + - " ,isnull(a.report_username,'') AS Reporter" + - " ,isnull(a.report_dt,'') AS ReportDate" + - " ,CONVERT(VARCHAR, CONVERT(DATETIME, a.sampledate), 23) AS TestDate" + - " ,isnull(a.sampleno,'') AS SampleCode" + - " ,isnull(a.specimen_name,'') AS SpecimenName" + - " ,a.pat_no AS TreatId" + - " ,isnull(a.pat_name,'') AS PatientName" + - " ,CASE a.pat_sex" + - " WHEN 1 THEN '男'" + - " WHEN 2 THEN '女'" + - " ELSE ''" + - " END AS Sex" + - " ,isnull(a.pat_agestr,'') AS Age" + - " ,isnull(a.pat_typecode,'') AS PatientType" + - " ,isnull(a.req_bedno,'') AS BedNo" + - " FROM " + - " lab_report a left JOIN" + - " lab_reportunit b ON a.rptunitid = b.rptunitid left JOIN" + - " dc_dept c ON a.req_deptno = c.deptno left JOIN" + - " dc_doctor d ON a.req_docno = d.doctorno left JOIN" + - " lab_reportunit e ON a.rptunitid = e.rptunitid" + - " WHERE " + - " a.rechk_dt is not null AND a.rechk_user IS NOT NULL AND a.pat_no = ?"; + " a.reportid AS ID" + + " ,RTRIM(b.rptunitname) AS ReportName" + + " ,CASE e.resultclass WHEN '细菌' THEN '细菌报告单' ELSE '基本报告单' END AS ReportType" + + " ,isnull(c.deptname,'') AS ReqDeptName" + + " ,isnull(d.doctorname,'') AS ReqDoctName" + + " ,isnull(a.req_reason,'') AS ReqItemName" + + " ,isnull(a.req_dt,'') AS ReqDate" + + " ,isnull(a.report_username,'') AS Reporter" + + " ,isnull(a.report_dt,'') AS ReportDate" + + " ,CONVERT(VARCHAR, CONVERT(DATETIME, a.sampledate), 23) AS TestDate" + + " ,isnull(a.sampleno,'') AS SampleCode" + + " ,isnull(a.specimen_name,'') AS SpecimenName" + + " ,a.pat_no AS TreatId" + + " ,isnull(a.pat_name,'') AS PatientName" + + " ,CASE a.pat_sex" + + " WHEN 1 THEN '男'" + + " WHEN 2 THEN '女'" + + " ELSE ''" + + " END AS Sex" + + " ,isnull(a.pat_agestr,'') AS Age" + + " ,isnull(a.pat_typecode,'') AS PatientType" + + " ,isnull(a.req_bedno,'') AS BedNo" + + " FROM " + + " lab_report a left JOIN" + + " lab_reportunit b ON a.rptunitid = b.rptunitid left JOIN" + + " dc_dept c ON a.req_deptno = c.deptno left JOIN" + + " dc_doctor d ON a.req_docno = d.doctorno left JOIN" + + " lab_reportunit e ON a.rptunitid = e.rptunitid" + + " WHERE " + + " a.rechk_dt is not null AND a.rechk_user IS NOT NULL AND pat_typecode IN " + reportPatTypeCode + " AND a.pat_no = ?"; + // pat_typeCode[1、2门诊;3住院;4:体检] return LisDB.select(sql, XBDLisReport.class, ps -> { ps.setString(1, treatId); }); @@ -490,7 +502,7 @@ public class XBDLisDao { " dc_dept c ON a.req_deptno = c.deptno left JOIN" + " dc_doctor d ON a.req_docno = d.doctorno left JOIN" + " lab_rptunit e ON a.rptunitid = e.rptunitid left join" + - " secsysuser f on a.report_user = f.userno "+ + " secsysuser f on a.report_user = f.userno " + " WHERE " + " a.rechk_dt is not null AND a.rechk_user IS NOT NULL AND a.pat_no = ?"; return LisDB.select(sql, XBDLisReport.class, ps -> { @@ -500,30 +512,30 @@ public class XBDLisDao { public List getResult4RM(int reportId) { String sql = "SELECT" + - " a.rpt_itemcode AS ReportItemCode" + - " ,c.rpt_itemname AS ReportItemName" + - " ,a.result_str AS Result" + - " ,a.result_unit AS Unit" + - " ,a.result_ref AS Range" + - " ,CAST(CASE RTRIM(CASE WHEN a.result_flag IS NULL AND RTRIM(a.result_str) = '阴性' THEN 'N' WHEN a.result_flag IS NULL AND RTRIM(a.result_str) = '未检出' THEN 'M' ELSE a.result_flag END) " - + - " WHEN 'H' THEN '↑'" + - " WHEN 'L' THEN '↓'" + - " WHEN 'P' THEN '阳性'" + - " WHEN 'Q' THEN '弱阳性'" + - " WHEN 'N' THEN '阴性'" + - " WHEN 'M' THEN ''" + - " ELSE RTRIM(a.result_flag) END AS VARCHAR) AS UnusualFlag --异常标志 H偏高、L偏低、P阳性、Q弱阳性、N阴性、E错误、M正常\n" - + - " ,'' AS InsCode" + - " ,b.Seq" + - " FROM " + - " dbo.lab_result a LEFT JOIN" + - " lab_rptunit_item b ON a.rptunitid = b.rptunitid AND a.rpt_itemid = b.rpt_itemid LEFT JOIN" - + - " dbo.lab_rptitem c ON a.rpt_itemid = c.rpt_itemid" + - " WHERE " + - " reportid = ? ORDER BY b.seq"; + " a.rpt_itemcode AS ReportItemCode" + + " ,c.rpt_itemname AS ReportItemName" + + " ,a.result_str AS Result" + + " ,a.result_unit AS Unit" + + " ,a.result_ref AS Range" + + " ,CAST(CASE RTRIM(CASE WHEN a.result_flag IS NULL AND RTRIM(a.result_str) = '阴性' THEN 'N' WHEN a.result_flag IS NULL AND RTRIM(a.result_str) = '未检出' THEN 'M' ELSE a.result_flag END) " + + + " WHEN 'H' THEN '↑'" + + " WHEN 'L' THEN '↓'" + + " WHEN 'P' THEN '阳性'" + + " WHEN 'Q' THEN '弱阳性'" + + " WHEN 'N' THEN '阴性'" + + " WHEN 'M' THEN ''" + + " ELSE RTRIM(a.result_flag) END AS VARCHAR) AS UnusualFlag --异常标志 H偏高、L偏低、P阳性、Q弱阳性、N阴性、E错误、M正常\n" + + + " ,'' AS InsCode" + + " ,b.Seq" + + " FROM " + + " dbo.lab_result a LEFT JOIN" + + " lab_rptunit_item b ON a.rptunitid = b.rptunitid AND a.rpt_itemid = b.rpt_itemid LEFT JOIN" + + + " dbo.lab_rptitem c ON a.rpt_itemid = c.rpt_itemid" + + " WHERE " + + " reportid = ? and isnull(b.unprintflag, 0) <> '1' and (result_num IS NOT NULL OR ISNULL(result_unit,'') <> '' OR ISNULL(result_ref,'') <> '' OR ISNULL(result6,'') = '') ORDER BY b.seq"; return LisDB.select(sql, XBDLisResult.class, ps -> { ps.setInt(1, reportId); }); @@ -577,19 +589,19 @@ public class XBDLisDao { public List getBactResult4RM(int reportId) { List bactResults = new ArrayList<>(); String sql = "SELECT" + - " a.resultid" + - " ,a.rpt_itemcode AS ReportItemCode" + - " ,c.rpt_itemname AS BactName" + - " ,a.result_str AS Result" + - " ,'' AS InsCode" + - " ,b.Seq" + - " FROM " + - " dbo.lab_result a LEFT JOIN" + - " lab_rptunit_item b ON a.rptunitid = b.rptunitid AND a.rpt_itemid = b.rpt_itemid LEFT JOIN\n" - + - " dbo.lab_rptitem c ON a.rpt_itemid = c.rpt_itemid" + - " WHERE" + - " reportid = ? ORDER BY b.seq"; + " a.resultid" + + " ,a.rpt_itemcode AS ReportItemCode" + + " ,c.rpt_itemname AS BactName" + + " ,a.result_str AS Result" + + " ,'' AS InsCode" + + " ,b.Seq" + + " FROM " + + " dbo.lab_result a LEFT JOIN" + + " lab_rptunit_item b ON a.rptunitid = b.rptunitid AND a.rpt_itemid = b.rpt_itemid LEFT JOIN\n" + + + " dbo.lab_rptitem c ON a.rpt_itemid = c.rpt_itemid" + + " WHERE" + + " reportid = ? ORDER BY b.seq"; bactResults = LisDB.select(sql, XBDLisBactResult.class, ps -> { ps.setInt(1, reportId); }); @@ -610,17 +622,17 @@ public class XBDLisDao { private List getAntbResult4RM(int resultId) { String sql = "SELECT" + - " a.medcode AS AntbCode" + - " ,b.medname AS AntbName" + - " ,a.medresult AS Result" + - " ,a.mic AS Mic" + - " , '' AS InsCode" + - " , '' AS Seq" + - " FROM " + - " lab_resultmed a LEFT JOIN" + - " lab_med b ON a.medcode = b.medcode" + - " WHERE " + - " resultid = ?"; + " a.medcode AS AntbCode" + + " ,b.medname AS AntbName" + + " ,a.medresult AS Result" + + " ,a.mic AS Mic" + + " , '' AS InsCode" + + " , '' AS Seq" + + " FROM " + + " lab_resultmed a LEFT JOIN" + + " lab_med b ON a.medcode = b.medcode" + + " WHERE " + + " resultid = ?"; return LisDB.select(sql, XBDLisAntbResult.class, ps -> { ps.setInt(1, resultId); }); diff --git a/src/main/java/com/ynxbd/common/helper/ProperHelper.java b/src/main/java/com/ynxbd/common/helper/ProperHelper.java index 276c8a7..9631081 100644 --- a/src/main/java/com/ynxbd/common/helper/ProperHelper.java +++ b/src/main/java/com/ynxbd/common/helper/ProperHelper.java @@ -6,9 +6,13 @@ package com.ynxbd.common.helper; * Date:2022/06/13 14:56:13 */ +import lombok.extern.slf4j.Slf4j; + import java.io.InputStream; import java.util.Properties; + +@Slf4j public class ProperHelper { private Properties properties; @@ -26,7 +30,8 @@ public class ProperHelper { try (InputStream in = ProperHelper.class.getClassLoader().getResourceAsStream(fileName)) { properties.load(in); } catch (Exception e) { - e.printStackTrace(); + log.error("properties file [{}] read load error", fileName); + properties = null; } return this; } diff --git a/src/main/java/com/ynxbd/common/helper/his/HisEnum.java b/src/main/java/com/ynxbd/common/helper/his/HisEnum.java index 088cd17..18d6273 100644 --- a/src/main/java/com/ynxbd/common/helper/his/HisEnum.java +++ b/src/main/java/com/ynxbd/common/helper/his/HisEnum.java @@ -24,8 +24,8 @@ public enum HisEnum { // 报告------------------ AP_Query_PEISReport("[报告]体检报告", "9001", "AP_Query_PEISReport", true), - AP_Query_CheckApplication("[报告]检查申请单", "5001", "AP_Query_CheckApplication", true), - AP_Query_InspectionApplication("[报告]检验(化验)申请单", "5002", "AP_Query_InspectionApplication", true), + AP_Query_CheckApplication("[报告]检查申请单", "5001", "AP_Query_CheckApplication", false), + AP_Query_InspectionApplication("[报告]检验(化验)申请单", "5002", "AP_Query_InspectionApplication", false), // 挂号记录--------------- AP_Query_Regist("[现场挂号]查询现场挂号记录", "2004", "AP_Query_Regist", true), @@ -108,6 +108,11 @@ public enum HisEnum { AP_Query_Line_SignIn("[在线签到]查询已挂号未签到记录","7009","AP_Query_LineSignIn",true), AP_Line_SignIN("[在线签到]执行挂号患者签到","7010","AP_LineSignIn",true), + // 自助开单 + SH_SELF_HELP_QUERY("[查询自助开单信息]","10003","UniversalInterface",true), + SH_SELF_HELP_CREATE("[创建自助开单申请单]","10004","UniversalInterface",true), + + QUERY_ELECTRON_INVOICE("[查询电子发票信息]","8004","UniversalInterface",false), ; public final String NAME; diff --git a/src/main/java/com/ynxbd/common/helper/his/HisHelper.java b/src/main/java/com/ynxbd/common/helper/his/HisHelper.java index 0f53d80..d961038 100644 --- a/src/main/java/com/ynxbd/common/helper/his/HisHelper.java +++ b/src/main/java/com/ynxbd/common/helper/his/HisHelper.java @@ -1,7 +1,6 @@ package com.ynxbd.common.helper.his; import com.ynxbd.common.action.pay.PEnum; -import com.ynxbd.common.bean.enums.HospEnum; import com.ynxbd.common.bean.enums.MerchantEnum; import com.ynxbd.common.bean.pay.Order; import com.ynxbd.common.helper.ProperHelper; @@ -10,7 +9,7 @@ import com.ynxbd.common.helper.common.ErrorHelper; import com.ynxbd.common.helper.common.SoapHelper; import com.ynxbd.common.result.JsonResult; import com.ynxbd.common.result.JsonResultEnum; -import com.ynxbd.wx.config.MiddleOfficeConfig; +import com.ynxbd.common.service.MiddleOfficeService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.dom4j.DocumentException; @@ -21,7 +20,6 @@ import org.dom4j.Node; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; @Slf4j public class HisHelper { @@ -62,8 +60,8 @@ public class HisHelper { IS_LOG_RESP = config.getBoolean("his.is_log_resp", false); IS_PUSH_MSG = config.getBoolean("his.is_push_msg", false); IS_RECIPE_PREPAY = config.getBoolean("his.is_recipe_prepay", false); - if(!(aliCallNo== null|| "".equals(aliCallNo))){ - ALI_CALL_NO = aliCallNo; + if (!(aliCallNo == null || "".equals(aliCallNo))) { + ALI_CALL_NO = aliCallNo; } if (url == null) { HIS_SOAP_URL = null; @@ -129,7 +127,6 @@ public class HisHelper { // } - /** * webService请求工具类(枚举版) * @@ -143,13 +140,14 @@ public class HisHelper { /** * webService请求工具类(枚举版) - * @param hisEnum 枚举 - * @param params 发送的参数 + * + * @param hisEnum 枚举 + * @param params 发送的参数 * @param merchantEnum 支付宝标志 * @return 响应的xml数据 */ - public static String getResponseXml(HisEnum hisEnum, Map params,MerchantEnum merchantEnum) { - return getResponseXml(hisEnum, HIS_SOAP_URL, params,merchantEnum); + public static String getResponseXml(HisEnum hisEnum, Map params, MerchantEnum merchantEnum) { + return getResponseXml(hisEnum, HIS_SOAP_URL, params, merchantEnum); } /** @@ -182,22 +180,23 @@ public class HisHelper { * @return 响应的xml数据 */ public static String getResponseXml(HisEnum hisEnum, String soapUrl, Map params) { - return getResponseXmlForCallNo(hisEnum,soapUrl,params,MerchantEnum.WX); + return getResponseXmlForCallNo(hisEnum, soapUrl, params, MerchantEnum.WX); } - public static String getResponseXml(HisEnum hisEnum, String soapUrl, Map params,MerchantEnum merchantEnum) { - return getResponseXmlForCallNo(hisEnum,soapUrl,params,merchantEnum); + public static String getResponseXml(HisEnum hisEnum, String soapUrl, Map params, MerchantEnum merchantEnum) { + return getResponseXmlForCallNo(hisEnum, soapUrl, params, merchantEnum); } /** * webService请求工具类(枚举版) - * @param hisEnum 枚举 - * @param soapUrl 路径 - * @param params 参数 + * + * @param hisEnum 枚举 + * @param soapUrl 路径 + * @param params 参数 * @param merchantEnum 来源 * @return 响应xml */ - public static String getResponseXmlForCallNo(HisEnum hisEnum, String soapUrl, Map params,MerchantEnum merchantEnum) { + public static String getResponseXmlForCallNo(HisEnum hisEnum, String soapUrl, Map params, MerchantEnum merchantEnum) { String method = hisEnum.METHOD; String transactionCode = hisEnum.CODE; @@ -209,7 +208,7 @@ public class HisHelper { if (params.get("CallNo") == null || "".equals(callNo)) { params.put("CallNo", CALL_NO); } - if("ali".equals(merchantEnum.CODE)&&!"".equals(ALI_CALL_NO)){ + if ("ali".equals(merchantEnum.CODE) && !"".equals(ALI_CALL_NO)) { params.put("CallNo", ALI_CALL_NO); } params.put("TransactionCode", transactionCode); @@ -255,14 +254,7 @@ public class HisHelper { } } - if(HospEnum.isHosp(HospEnum.红河州人民医院)){ - if(MiddleOfficeConfig.MIDDLE_OFFICE_URL!=null){ //平台数据上传 - MiddleOfficeConfig.run(soapUrl,"" + SoapHelper.requestParams("HIS", params) + "",HIS_SOAP_MD_URL,transactionCode,result); - if("7004".equals(transactionCode)&&JsonResult.xmlToBean(result, JsonResultEnum.SYS_HIS)!=null){ - MiddleOfficeConfig.uploadTreatNum("JH0104", Objects.requireNonNull(JsonResult.xmlToBean(result, JsonResultEnum.SYS_HIS)).getDataMapString("MZNum")); - } - } - } + new MiddleOfficeService().req_his_JH0104(soapUrl, HIS_SOAP_MD_URL, params, transactionCode, result); } catch (DocumentException e) { ErrorHelper.println(e); @@ -271,7 +263,6 @@ public class HisHelper { } - // /** // * xml响应数据组装成为JSON数据 // * @@ -324,13 +315,14 @@ public class HisHelper { /** * [支付宝] xml响应数据组装成为JSON数据 + * * @param hisEnum * @param params * @param merchantEnum * @return */ - public static JsonResult getJsonResult(HisEnum hisEnum, Map params,MerchantEnum merchantEnum) { - JsonResult result = JsonResult.xmlToBean(getResponseXml(hisEnum, params,merchantEnum), JsonResultEnum.SYS_HIS); + public static JsonResult getJsonResult(HisEnum hisEnum, Map params, MerchantEnum merchantEnum) { + JsonResult result = JsonResult.xmlToBean(getResponseXml(hisEnum, params, merchantEnum), JsonResultEnum.SYS_HIS); if (result == null) { // 如果返回为空可能为超时 return createTimeoutResult(); } @@ -360,7 +352,7 @@ public class HisHelper { if (params != null) { params.setParams(requestParams); } - return getJsonResult(hisEnum, requestParams,merchantEnum); + return getJsonResult(hisEnum, requestParams, merchantEnum); } @@ -444,4 +436,19 @@ public class HisHelper { return JsonResult.createTimeoutResult("【HIS】请求超时", JsonResultEnum.SYS_HIS); } + /** + * 字符串集转xml + * + * @param xmlTag xml标签 + * @param strList 字符串集 + * @return xml + */ + public static String strListToXml(String xmlTag, List strList) { + StringBuilder sb = new StringBuilder(); + for (String val : strList) { + sb.append("<").append(xmlTag).append(">").append(val).append(""); + } + return sb.toString(); + } + } diff --git a/src/main/java/com/ynxbd/common/service/MedToolService.java b/src/main/java/com/ynxbd/common/service/MedToolService.java index 5c93b6e..9d3562d 100644 --- a/src/main/java/com/ynxbd/common/service/MedToolService.java +++ b/src/main/java/com/ynxbd/common/service/MedToolService.java @@ -3,6 +3,8 @@ package com.ynxbd.common.service; import com.ynxbd.common.bean.MedTool; import com.ynxbd.common.dao.MedToolDao; +import java.util.List; + public class MedToolService { public boolean saveMedToolMarkByTreatNum(String treatNum, Integer type, String processMark) { @@ -18,4 +20,8 @@ public class MedToolService { return medToolDao.updateProcessMark(treatNum, type, processMark, mark); } } + + public List queryMedToolListByTreatList(List treatNumList, Integer type) { + return new MedToolDao().selectListByTreatNumList(treatNumList, type); + } } diff --git a/src/main/java/com/ynxbd/common/service/MedicalService.java b/src/main/java/com/ynxbd/common/service/MedicalService.java index ea4c314..0d685d7 100644 --- a/src/main/java/com/ynxbd/common/service/MedicalService.java +++ b/src/main/java/com/ynxbd/common/service/MedicalService.java @@ -73,7 +73,6 @@ public class MedicalService { return mdPlaceOrder(payAuthNo, result); } - /** * [医保]下单 * diff --git a/src/main/java/com/ynxbd/common/service/MiddleOfficeService.java b/src/main/java/com/ynxbd/common/service/MiddleOfficeService.java new file mode 100644 index 0000000..ef24933 --- /dev/null +++ b/src/main/java/com/ynxbd/common/service/MiddleOfficeService.java @@ -0,0 +1,41 @@ +package com.ynxbd.common.service; + +import com.ynxbd.common.bean.enums.HospEnum; +import com.ynxbd.common.helper.common.SoapHelper; +import com.ynxbd.common.result.JsonResult; +import com.ynxbd.common.result.JsonResultEnum; +import com.ynxbd.wx.config.MiddleOfficeConfig; +import lombok.extern.slf4j.Slf4j; + +import java.util.Map; +import java.util.Objects; + +@Slf4j +public class MiddleOfficeService { + + + public void req_his_JH0104(String soapUrl, String hisSoapMdUrl, Map params, String transactionCode, String result) { + try { + if (HospEnum.红河州人民医院.isHosp()) { + if (MiddleOfficeConfig.MIDDLE_OFFICE_URL != null) { //平台数据上传 + MiddleOfficeConfig.run(soapUrl, "" + SoapHelper.requestParams("HIS", params) + "", hisSoapMdUrl, transactionCode, result); + if ("7004".equals(transactionCode) && JsonResult.xmlToBean(result, JsonResultEnum.SYS_HIS) != null) { + MiddleOfficeConfig.uploadTreatNum("JH0104", Objects.requireNonNull(JsonResult.xmlToBean(result, JsonResultEnum.SYS_HIS)).getDataMapString("MZNum")); + } + } + } + } catch (Exception e) { + log.error(e.getMessage()); + } + } + + + public void reg_JH0105(String treatNum) { + if (HospEnum.红河州人民医院.isHosp()) { + if (MiddleOfficeConfig.MIDDLE_OFFICE_URL != null) { + MiddleOfficeConfig.uploadTreatNum("JH0105", treatNum); + } + } + } + +} diff --git a/src/main/java/com/ynxbd/common/service/MsgPushService.java b/src/main/java/com/ynxbd/common/service/MsgPushService.java new file mode 100644 index 0000000..d8a6a83 --- /dev/null +++ b/src/main/java/com/ynxbd/common/service/MsgPushService.java @@ -0,0 +1,20 @@ +package com.ynxbd.common.service; + +import com.ynxbd.common.bean.enums.HospEnum; +import com.ynxbd.common.bean.enums.MerchantEnum; +import com.ynxbd.common.bean.pay.Register; +import com.ynxbd.wx.config.MessagePushConfig; + +// 消息推送 +public class MsgPushService { + + + public void regMsgPush(MerchantEnum merchantEnum, Register reg) { + if (reg == null) { + return; + } + if (HospEnum.红河州人民医院.isHosp() && "0503".equals(reg.getDeptCode())) { + MessagePushConfig.regObsDocument(merchantEnum, reg); + } + } +} diff --git a/src/main/java/com/ynxbd/common/service/PatientService.java b/src/main/java/com/ynxbd/common/service/PatientService.java index 1509a6f..39907e5 100644 --- a/src/main/java/com/ynxbd/common/service/PatientService.java +++ b/src/main/java/com/ynxbd/common/service/PatientService.java @@ -2,7 +2,6 @@ package com.ynxbd.common.service; import com.ynxbd.common.bean.Patient; import com.ynxbd.common.bean.User; -import com.ynxbd.common.bean.enums.CountyEnum; import com.ynxbd.common.bean.enums.HCardTypeEnum; import com.ynxbd.common.dao.PatientDao; import com.ynxbd.common.dao.his.HisPatientDao; @@ -130,7 +129,6 @@ public class PatientService { return Result.error(ResultEnum.PATIENT_BIND_EXCEEDS_5); // 绑定人数超过5人 } - county = CountyEnum.getNewCounty(county); Patient hisPatient; try { hisPatient = new HisPatientDao().bind(isCounty, name, sex, idCardNo, cardTypeEnum, tel, address, birthday, nation, county, uuid, fName, fTel, fIDCardNo, mName, mTel, mIDCardNo); diff --git a/src/main/java/com/ynxbd/common/service/RecipeService.java b/src/main/java/com/ynxbd/common/service/RecipeService.java index 294ed6a..67f495c 100644 --- a/src/main/java/com/ynxbd/common/service/RecipeService.java +++ b/src/main/java/com/ynxbd/common/service/RecipeService.java @@ -2,6 +2,7 @@ package com.ynxbd.common.service; import com.alibaba.fastjson.JSONObject; import com.ynxbd.common.action.pay.PEnum; +import com.ynxbd.common.bean.HisRecipe; import com.ynxbd.common.bean.SelfHelpCount; import com.ynxbd.common.bean.ConfigSelfHelp; import com.ynxbd.common.bean.StandardPrice; @@ -20,7 +21,7 @@ import com.ynxbd.common.result.Result; import com.ynxbd.common.result.ResultEnum; import com.ynxbd.common.result.ServiceException; import com.ynxbd.common.service.cache.PayCache; -import com.ynxbd.wx.config.MeTechnologyReConfig; +import com.ynxbd.wx.config.TZReserveConfig; import com.ynxbd.wx.utils.DateGenerate; import com.ynxbd.wx.wxfactory.WxMedicalHelper; import com.ynxbd.wx.wxfactory.WxPayHelper; @@ -136,9 +137,9 @@ public class RecipeService { } // 医保支付 - JSONObject mdRespJson = PayService.goMedical(merchantEnum, PEnum.RECIPE); - if (mdRespJson != null) { - return Result.success(mdRespJson); + JSONObject respMedJson = PayService.goMedical(merchantEnum, PEnum.RECIPE); + if (respMedJson != null) { + return Result.success(respMedJson); } return Result.success(); } @@ -244,7 +245,7 @@ public class RecipeService { recipe.setPayMoney(recipe.getRecipeFee()); recipe.setHisStatus(-1); recipe.setPayStatus(-1); - if(treatNum.contains("P-")){ + if (treatNum.contains("P-")) { recipe.setOrderType("PEIS"); } } @@ -300,6 +301,18 @@ public class RecipeService { } } + // 订单金额验证 + BigDecimal rxTotalFee = new BigDecimal(0); + for (Recipe recipe : recipeList) { + rxTotalFee = rxTotalFee.add(recipe.getPayMoney()); + } + + log.info("{} [处方]金额计算{} outTradeNo={}, bankTransNo={}, rxTotalFee={}, totalFee={}", merchantEnum.NAME, (rxTotalFee.compareTo(new BigDecimal(totalFee)) == 0 ? "" : "异常"), outTradeNo, bankTransNo, rxTotalFee, totalFee); + if (rxTotalFee.compareTo(new BigDecimal(totalFee)) > 0) { // 支付的金额不足 + log.info("{} [处方]缴费金额异常 outTradeNo={}, bankTransNo={}, rxTotalFee={}, totalFee={}", merchantEnum.NAME, outTradeNo, bankTransNo, rxTotalFee, totalFee); + return false; + } + List failedList = new ArrayList<>(); // HIS缴费失败的处方单 long begTime = System.currentTimeMillis(); // 开始时间 @@ -318,11 +331,11 @@ public class RecipeService { } // 如果是体检支付就只调用一次his结算 - if(recipeItem.getTreatNum().contains("P-")){ + if (recipeItem.getTreatNum().contains("P-")) { // 体检缴费失败的所有费用进行退回 if (recipeInfo.isRefund()) { failedList = recipeList; - for (Recipe failed : failedList){ + for (Recipe failed : failedList) { failed.setErrorCode(recipeInfo.getErrorCode()); failed.setErrorMsg(recipeInfo.getErrorMsg()); } @@ -364,13 +377,9 @@ public class RecipeService { String tip = String.format("共计缴费处方单数:%s,失败数:%s,超时数:%s", recipeList.size(), (failedList.size() - outTimeList.size()), outTimeList.size()); log.info("{} [处方]{}", merchantEnum.NAME, tip); - - MeTechnologyReConfig.reserveRun(patientId); //天助医技预约 + TZReserveConfig.reserveRun(patientId); // 天助医技预约 HCodeService.payNotifyReportHISData(openid, patientId); - - - return true; } @@ -470,7 +479,7 @@ public class RecipeService { } // 如果是体检支付就更新所有处方 - if(treatNum.contains("P-")){ + if (treatNum.contains("P-")) { // 更新支付信息 if (!recipeDao.updateHisPaidByBankTransNo(bankTransNo, hisTransNo, invoiceTransNo)) { log.info("[处方]更新体检缴费HIS返回数据失败 outTradeNo={}, bankTransNo={}, recipeId={}", outTradeNo, bankTransNo, recipeId); @@ -994,4 +1003,39 @@ public class RecipeService { return new RecipeDao().updateMicroOrderState(outTradeNo, bankTransNo, openid); } + + public List filterPaidList(List hisRecipeList) { + List dataList = new ArrayList<>(); + HisRecipe treatItem; + List groupList; + for (HisRecipe item : hisRecipeList) { + String treatNum = item.getMzNum(); + if (ObjectUtils.isEmpty(treatNum)) { + continue; + } + String execDate = item.getExecDate(); + item.setTreatNum(treatNum); + + HisRecipe findTreat = dataList.stream().filter(o -> o.getTreatNum().equals(treatNum)).findFirst().orElse(null); + if (findTreat == null) { + treatItem = new HisRecipe(); + treatItem.setTreatNum(treatNum); + treatItem.setDate(execDate); + groupList = new ArrayList<>(); + groupList.add(item); + treatItem.setGroupList(groupList); + dataList.add(treatItem); + } else { + if (findTreat.getGroupList() == null) { + findTreat.setGroupList(new ArrayList<>()); + } + Boolean isGreaterThan = DateHelper.leftGreaterThanRight(execDate, findTreat.getDate(), null); + if (isGreaterThan != null && isGreaterThan) { + findTreat.setDate(execDate); + } + findTreat.getGroupList().add(item); + } + } + return dataList; + } } diff --git a/src/main/java/com/ynxbd/common/service/RegService.java b/src/main/java/com/ynxbd/common/service/RegService.java index 905fd71..c9ee8e3 100644 --- a/src/main/java/com/ynxbd/common/service/RegService.java +++ b/src/main/java/com/ynxbd/common/service/RegService.java @@ -207,10 +207,7 @@ public class RegService { log.info("{} [挂号]更新HIS挂号信息成功 patientId={}", merchantEnum.NAME, patientId); } - if (HospEnum.isHosp(HospEnum.红河州人民医院) && "0503".equals(reg.getDeptCode())) { - MessagePushConfig.regObsDocument(merchantEnum, reg); - } - + new MsgPushService().regMsgPush(merchantEnum, reg); // 短信通知 smsNotice(reg); @@ -344,37 +341,11 @@ public class RegService { * @param reg 预约信息 */ private boolean smsNotice(Register reg) { - String tel = reg.getTel(); - String date = reg.getRegDate(); - String begTime = reg.getBegTime(); - String endTime = reg.getEndTime(); String openid = reg.getOpenid(); - - if (ObjectUtils.isEmpty(tel) || tel.length() != 11) { - log.info("[挂号]短信通知:tel为空或长度异常"); - return false; - } - if (ObjectUtils.isEmpty(openid)) { // 关注过,并且填写过电话号码 log.info("[挂号]短信通知:openid为空"); } - - - boolean isResult = false; - - if (HospEnum.isHosp(HospEnum.德宏州中医医院)) { - SmsRegTem sms = new SmsRegTem(); - sms.setHosp_tel("0692-2991794"); - sms.setTime(date + " " + begTime + "-" + endTime); - sms.setAddress(reg.getAddress() == null ? "" : reg.getAddress().replace(" ", "").replace("(", "(").replace(")", ")")); - sms.setDeptName(reg.getDeptName()); - sms.setDoctorName(reg.getDoctName()); - sms.setSeq(reg.getQueueNum()); - sms.setHosp_tip("提前15分钟到医院门诊各导医服务台签到后排队候诊"); - log.info("[挂号]发送预约短信通知 sms={}, appId={}, tel-{}", JsonHelper.toJsonString(sms), WeChatConfig.APP_ID, tel); - isResult = SmsHelper.send("SMS_475980406", tel, sms); - } - return isResult; + return new SmsService().sms_reg_001(reg); } @@ -427,21 +398,7 @@ public class RegService { Result result = regAutoRefund(merchantEnum, JsonResult, reg.getOpenid(), payMoney, outTradeNo, dbTradeNo, "取消预约", pushInfo, reg.getUpdateTime()); - // 短信通知 - if (HospEnum.isHosp(HospEnum.德宏州中医医院)) { - String tel = reg.getTel(); - if (tel != null && tel.length() == 11) { - String template = "SMS_184121392"; - SmsRegTem sms = new SmsRegTem(); - sms.setTime(reg.getRegDate() + " " + reg.getBegTime() + "-" + reg.getEndTime()); - sms.setDeptName(reg.getDeptName()); - sms.setDoctorName(reg.getDoctName()); - sms.setAddress(reg.getAddress()); - sms.setSeq(reg.getQueueNum()); - - SmsHelper.send(template, tel, sms); - } - } + new SmsService().sms_reg_002(reg); MessagePushConfig.regCancelPush(merchantEnum, reg); if (result.isOK()) { @@ -500,11 +457,7 @@ public class RegService { return Result.error("支付方式未匹配 outTradeNo=" + outTradeNo); } - if (HospEnum.isHosp(HospEnum.红河州人民医院)) { - if (MiddleOfficeConfig.MIDDLE_OFFICE_URL != null) { - MiddleOfficeConfig.uploadTreatNum("JH0105", reg.getTreatNum()); - } - } + new MiddleOfficeService().reg_JH0105(reg.getTreatNum()); log.info("{}[今日挂号][取消预约]开始退款:outTradeNo={}, dbTradeNo={}, payMoney={}", merchantEnum.NAME, outTradeNo, dbTradeNo, payMoney); @@ -512,21 +465,7 @@ public class RegService { Result result = refundTodayRegister(merchantEnum, JsonResult, reg.getOpenid(), payMoney, outTradeNo, dbTradeNo, "取消预约", pushInfo, reg.getUpdateTime()); - // 短信通知 - if (HospEnum.isHosp(HospEnum.德宏州中医医院)) { - String tel = reg.getTel(); - if (tel != null && tel.length() == 11) { - String template = "SMS_184121392"; - SmsRegTem sms = new SmsRegTem(); - sms.setTime(reg.getRegDate() + " " + reg.getBegTime() + "-" + reg.getEndTime()); - sms.setDeptName(reg.getDeptName()); - sms.setDoctorName(reg.getDoctName()); - sms.setAddress(reg.getAddress()); - sms.setSeq(reg.getQueueNum()); - - SmsHelper.send(template, tel, sms); - } - } + new SmsService().sms_reg_002(reg); // 短信通知 MessagePushConfig.regCancelPush(merchantEnum, reg); if (result.isOK()) { diff --git a/src/main/java/com/ynxbd/common/service/SmsService.java b/src/main/java/com/ynxbd/common/service/SmsService.java new file mode 100644 index 0000000..b536388 --- /dev/null +++ b/src/main/java/com/ynxbd/common/service/SmsService.java @@ -0,0 +1,63 @@ +package com.ynxbd.common.service; + +import com.ynxbd.common.bean.enums.HospEnum; +import com.ynxbd.common.bean.pay.Register; +import com.ynxbd.common.bean.sms.SmsRegTem; +import com.ynxbd.common.helper.common.JsonHelper; +import com.ynxbd.common.helper.common.SmsHelper; +import com.ynxbd.wx.config.WeChatConfig; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; + +@Slf4j +public class SmsService { + + public boolean sms_reg_001(Register reg) { + String tel = reg.getTel(); + String date = reg.getRegDate(); + String begTime = reg.getBegTime(); + String endTime = reg.getEndTime(); + + if (ObjectUtils.isEmpty(tel) || tel.length() != 11) { + log.info("[挂号]短信通知:tel为空或长度异常"); + return false; + } + + boolean isResult = false; + if (HospEnum.德宏州中医医院.isHosp()) { + SmsRegTem sms = new SmsRegTem(); + sms.setHosp_tel("0692-2991794"); + sms.setTime(date + " " + begTime + "-" + endTime); + sms.setAddress(reg.getAddress() == null ? "" : reg.getAddress().replace(" ", "").replace("(", "(").replace(")", ")")); + sms.setDeptName(reg.getDeptName()); + sms.setDoctorName(reg.getDoctName()); + sms.setSeq(reg.getQueueNum()); + sms.setHosp_tip("提前15分钟到医院门诊各导医服务台签到后排队候诊"); + log.info("[挂号]发送预约短信通知 sms={}, appId={}, tel-{}", JsonHelper.toJsonString(sms), WeChatConfig.APP_ID, tel); + isResult = SmsHelper.send("SMS_475980406", tel, sms); + } + return isResult; + } + + // 短信通知 + public void sms_reg_002(Register reg) { + String tel = reg.getTel(); + if (ObjectUtils.isEmpty(tel) || tel.length() != 11) { + log.info("[挂号]短信通知:tel为空或长度异常"); + return; + } + + if (HospEnum.德宏州中医医院.isHosp()) { + String template = "SMS_184121392"; + SmsRegTem sms = new SmsRegTem(); + sms.setTime(reg.getRegDate() + " " + reg.getBegTime() + "-" + reg.getEndTime()); + sms.setDeptName(reg.getDeptName()); + sms.setDoctorName(reg.getDoctName()); + sms.setAddress(reg.getAddress()); + sms.setSeq(reg.getQueueNum()); + SmsHelper.send(template, tel, sms); + } + } + + +} diff --git a/src/main/java/com/ynxbd/wx/config/MiddleOfficeConfig.java b/src/main/java/com/ynxbd/wx/config/MiddleOfficeConfig.java index 8af0e24..8114aa1 100644 --- a/src/main/java/com/ynxbd/wx/config/MiddleOfficeConfig.java +++ b/src/main/java/com/ynxbd/wx/config/MiddleOfficeConfig.java @@ -2,16 +2,14 @@ package com.ynxbd.wx.config; import com.alibaba.fastjson.JSONObject; import com.ynxbd.common.helper.ProperHelper; -import com.ynxbd.common.helper.http.OkHttpHelper; -import com.ynxbd.common.result.JsonResult; -import com.ynxbd.common.result.JsonResultEnum; -import com.ynxbd.wx.utils.XMLUtil; import lombok.extern.slf4j.Slf4j; import okhttp3.*; import java.io.IOException; /** + * 佳禾美康数据 + * * @author 李进才 * @ClassName MiddleOfficeConfig * @Description TODO @@ -22,23 +20,25 @@ public class MiddleOfficeConfig { private MiddleOfficeConfig() { } + // 佳禾美康数据上传链接 public static final String MIDDLE_OFFICE_URL; public static final String MIDDLE_OFFICE_URL_ESB; public static final String MIDDLE_OFFICE_HOSPITAL; public static final String MIDDLE_OFFICE_ITEM_NAME; + public static final boolean IS_LOG_RESP; - - static{ + static { ProperHelper config = new ProperHelper().read("middle-office.properties"); MIDDLE_OFFICE_URL = config.getString("middle_office_url"); MIDDLE_OFFICE_HOSPITAL = config.getString("middle_office_hospital"); MIDDLE_OFFICE_URL_ESB = config.getString("middle_office_url_esb"); MIDDLE_OFFICE_ITEM_NAME = config.getString("middle_office_item_name"); + IS_LOG_RESP = config.getBoolean("middle_office.is_log_resp", false); } - public static void run(String soapUrl, String requestData, String mdUrl,String transactionCode,String responseResult){ + public static void run(String soapUrl, String requestData, String mdUrl, String transactionCode, String responseResult) { String interfaceName = ""; boolean isMD = soapUrl.equals(mdUrl); switch (transactionCode) { @@ -49,7 +49,7 @@ public class MiddleOfficeConfig { interfaceName = "JH1402R"; break; case "4005": - interfaceName=isMD?"JH1421R":"JH1403R"; + interfaceName = isMD ? "JH1421R" : "JH1403R"; break; case "4003": interfaceName = "JH1404R"; @@ -67,7 +67,7 @@ public class MiddleOfficeConfig { interfaceName = "JH1408R"; break; case "7004": - interfaceName=isMD?"JH1420R":"JH1409R"; + interfaceName = isMD ? "JH1420R" : "JH1409R"; break; case "3006": interfaceName = "JH1410R"; @@ -80,31 +80,29 @@ public class MiddleOfficeConfig { break; } - if(interfaceName.length()<5){ + if (interfaceName.length() < 5) { return; } - upload(interfaceName.substring(0,interfaceName.length()-1),requestData); - upload(interfaceName,responseResult); + upload(interfaceName.substring(0, interfaceName.length() - 1), requestData); + upload(interfaceName, responseResult); } - public static void upload(String interfaceName,String jsonData){ + public static void upload(String interfaceName, String jsonData) { try { // log.info("[平台数据上传]开始,interfaceName:{},jsonData:{}",interfaceName,jsonData); - if("".equals(interfaceName)||"".equals(jsonData)||interfaceName==null||jsonData==null){ + if ("".equals(interfaceName) || "".equals(jsonData) || interfaceName == null || jsonData == null) { return; } - - JSONObject json = new JSONObject(); JSONObject head = new JSONObject(); JSONObject body = new JSONObject(); - head.put("hospital",MIDDLE_OFFICE_HOSPITAL); - head.put("itemName",MIDDLE_OFFICE_ITEM_NAME); - head.put("interface",interfaceName); - body.put("data",jsonData); - json.put("head",head); - json.put("body",body); + head.put("hospital", MIDDLE_OFFICE_HOSPITAL); + head.put("itemName", MIDDLE_OFFICE_ITEM_NAME); + head.put("interface", interfaceName); + body.put("data", jsonData); + json.put("head", head); + json.put("body", body); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;charset=utf-8"), String.valueOf(json)); @@ -121,40 +119,38 @@ public class MiddleOfficeConfig { OkHttpClient okHttpClient = new OkHttpClient(); Call call = okHttpClient.newCall(request); call.enqueue(new Callback() { - @Override - public void onFailure(Call call, IOException e) { - log.error("[平台数据上传]上传失败,interfaceName:{},jsonData:{},error:{}",interfaceName,jsonData,e.toString()); - } + @Override + public void onFailure(Call call, IOException e) { + log.error("[平台数据上传]上传失败,interfaceName:{}, {}, error:{}", interfaceName, (IS_LOG_RESP ? jsonData : ""), e.toString()); + } - @Override - public void onResponse(Call call, Response response) { //不在ui线程 + @Override + public void onResponse(Call call, Response response) { //不在ui线程 // log.info("[平台数据上传]成功 状态码:{},interfaceName:{},jsonData:{}",response.code(),interfaceName,jsonData); - } - }); - } - catch (Exception e){ - log.error("[平台数据上传]执行失败,interfaceName:{},jsonData:{},error:{}",interfaceName,jsonData,e.toString()); + } + }); + } catch (Exception e) { + log.error("[平台数据上传]执行失败,interfaceName:{}, {} ,error:{}", interfaceName, (IS_LOG_RESP ? jsonData : ""), e.toString()); } } - public static void uploadTreatNum(String interfaceName,String treatNum){ + public static void uploadTreatNum(String interfaceName, String treatNum) { try { - log.info("[平台数据上传]开始,interfaceName:{},treatNum:{}",interfaceName,treatNum); - if("".equals(interfaceName)||"".equals(treatNum)||interfaceName==null||treatNum==null){ + log.info("[平台数据上传]开始,interfaceName:{},treatNum:{}", interfaceName, treatNum); + if ("".equals(interfaceName) || "".equals(treatNum) || interfaceName == null || treatNum == null) { return; } - JSONObject json = new JSONObject(); JSONObject head = new JSONObject(); JSONObject body = new JSONObject(); - head.put("hospital",MIDDLE_OFFICE_HOSPITAL); - head.put("itemName","微信"); - head.put("interface",interfaceName); - body.put("opc_id",treatNum); - json.put("head",head); - json.put("body",body); + head.put("hospital", MIDDLE_OFFICE_HOSPITAL); + head.put("itemName", "微信"); + head.put("interface", interfaceName); + body.put("opc_id", treatNum); + json.put("head", head); + json.put("body", body); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;charset=utf-8"), String.valueOf(json)); @@ -173,17 +169,16 @@ public class MiddleOfficeConfig { call.enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { - log.error("[平台数据上传]上传失败,head:{},body:{},url:{}",head,body,MIDDLE_OFFICE_URL_ESB); + log.error("[平台数据上传]上传失败,head:{},body:{},url:{}", head, body, MIDDLE_OFFICE_URL_ESB); } @Override public void onResponse(Call call, Response response) { //不在ui线程 - log.info("[平台数据上传]成功 状态码:{},head:{},body:{},url:{}",response.code(),head,body,MIDDLE_OFFICE_URL_ESB); + log.info("[平台数据上传]成功 状态码:{},head:{},body:{},url:{}", response.code(), head, body, MIDDLE_OFFICE_URL_ESB); } }); - } - catch (Exception e){ - log.error("[平台数据上传]执行失败,interfaceName:{},treatNum:{},error:{}",interfaceName,treatNum,e.toString()); + } catch (Exception e) { + log.error("[平台数据上传]执行失败,interfaceName:{},treatNum:{},error:{}", interfaceName, treatNum, e.toString()); } } } diff --git a/src/main/java/com/ynxbd/wx/config/MeTechnologyReConfig.java b/src/main/java/com/ynxbd/wx/config/TZReserveConfig.java similarity index 79% rename from src/main/java/com/ynxbd/wx/config/MeTechnologyReConfig.java rename to src/main/java/com/ynxbd/wx/config/TZReserveConfig.java index c216f62..5ece35c 100644 --- a/src/main/java/com/ynxbd/wx/config/MeTechnologyReConfig.java +++ b/src/main/java/com/ynxbd/wx/config/TZReserveConfig.java @@ -22,52 +22,47 @@ import java.util.Map; /** + * 天助平台配置 + * * @author 李进才 * @ClassName MeTechnologyReConfig * @Description TODO * @date 2024/06/14 09:27:00 */ @Slf4j -public class MeTechnologyReConfig { - private MeTechnologyReConfig() { +public class TZReserveConfig { + private TZReserveConfig() { } - public static final String MEDICAL_TECHNOLOGY_RESERVE_WEBSERVICE_URL; - public static final String MEDICAL_TECHNOLOGY_RESERVE_TERMINAL_NO; - public static final String MEDICAL_TECHNOLOGY_RESERVE_TEST_PATIENT_ID; - public static final String MEDICAL_TECHNOLOGY_RESERVE_JSON_URL; - public static final MediaType JSON - = MediaType.parse("application/json; charset=utf-8"); + public static final String TZ_RESERVE_WEBSERVICE_URL; + public static final String TZ_RESERVE_TERMINAL_NO; + public static final String TZ_RESERVE_TEST_PATIENT_ID; + public static final String TZ_RESERVE_JSON_URL; + public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); static { - ProperHelper config = new ProperHelper().read("medical-technology-reserve.properties"); - if (config == null) { - MEDICAL_TECHNOLOGY_RESERVE_WEBSERVICE_URL = null; - MEDICAL_TECHNOLOGY_RESERVE_TERMINAL_NO = null; - MEDICAL_TECHNOLOGY_RESERVE_TEST_PATIENT_ID = null; - MEDICAL_TECHNOLOGY_RESERVE_JSON_URL = null; - } else { - MEDICAL_TECHNOLOGY_RESERVE_WEBSERVICE_URL = config.getString("medical_technology_reserve_webservice_url"); - MEDICAL_TECHNOLOGY_RESERVE_TERMINAL_NO = config.getString("medical_technology_reserve_terminal_no"); - MEDICAL_TECHNOLOGY_RESERVE_TEST_PATIENT_ID = config.getString("medical_technology_reserve_test_patientId"); - MEDICAL_TECHNOLOGY_RESERVE_JSON_URL = config.getString("medical_technology_reserve_json_url"); - } + ProperHelper config = new ProperHelper().read("tz-reserve.properties"); + TZ_RESERVE_WEBSERVICE_URL = config.getString("tz_reserve.webservice_url"); + TZ_RESERVE_TERMINAL_NO = config.getString("tz_reserve.terminal_no"); + TZ_RESERVE_TEST_PATIENT_ID = config.getString("tz_reserve.test_patientId"); + TZ_RESERVE_JSON_URL = config.getString("tz_reserve.json_url"); } + // 天助医技预约 public static void reserveRun(String patientId) { try { - if (MEDICAL_TECHNOLOGY_RESERVE_WEBSERVICE_URL == null) { + if (TZ_RESERVE_WEBSERVICE_URL == null) { return; } - if (MEDICAL_TECHNOLOGY_RESERVE_TEST_PATIENT_ID != null) { - if (!patientId.equals(MEDICAL_TECHNOLOGY_RESERVE_TEST_PATIENT_ID)) { + if (TZ_RESERVE_TEST_PATIENT_ID != null) { + if (!patientId.equals(TZ_RESERVE_TEST_PATIENT_ID)) { log.info("[天助预约平台] 不是测试账号,不允许调用接口 patientId-{}", patientId); return; } } - String result = OkHttpHelper.get(MEDICAL_TECHNOLOGY_RESERVE_WEBSERVICE_URL, params -> { + String result = OkHttpHelper.get(TZ_RESERVE_WEBSERVICE_URL, params -> { params.put("patientID", patientId); - params.put("terminalNo", MEDICAL_TECHNOLOGY_RESERVE_TERMINAL_NO); + params.put("terminalNo", TZ_RESERVE_TERMINAL_NO); }); JsonResult jsonResult = JsonResult.xmlToBean(result, JsonResultEnum.SYS_RESERVE); if (jsonResult == null) { @@ -84,7 +79,7 @@ public class MeTechnologyReConfig { } public static String getToken() { - String result = OkHttpHelper.get(MEDICAL_TECHNOLOGY_RESERVE_JSON_URL + "/Tools/Tool/GetToken", params -> { + String result = OkHttpHelper.get(TZ_RESERVE_JSON_URL + "/Tools/Tool/GetToken", params -> { params.put("clientName", "WXAPP"); params.put("clientCode", "wxapp"); }); @@ -108,11 +103,11 @@ public class MeTechnologyReConfig { params.put("PatientId", patientId); params.put("StartDate", startDate); params.put("EndDate", endDate); - params.put("TerminalNo", MEDICAL_TECHNOLOGY_RESERVE_TERMINAL_NO); + params.put("TerminalNo", TZ_RESERVE_TERMINAL_NO); params.put("IsBooked", "2"); RequestBody requestBody = RequestBody.create(JSON, JsonHelper.toJsonString(params)); - String result = OkHttpHelper.post(MEDICAL_TECHNOLOGY_RESERVE_JSON_URL + "/BookDetails/BookDetails/GetCanBookOrders", requestBody, headers -> { + String result = OkHttpHelper.post(TZ_RESERVE_JSON_URL + "/BookDetails/BookDetails/GetCanBookOrders", requestBody, headers -> { headers.add("token", getToken()); }); JSONObject jsonObject = JsonHelper.parseObject(result); @@ -147,7 +142,7 @@ public class MeTechnologyReConfig { String json = JsonHelper.toJsonString(params); RequestBody requestBody = RequestBody.create(JSON, json); - String result = OkHttpHelper.post(MEDICAL_TECHNOLOGY_RESERVE_JSON_URL + "/BookDetails/BookDetails/GetNumberSourceStatistics", requestBody, headers -> { + String result = OkHttpHelper.post(TZ_RESERVE_JSON_URL + "/BookDetails/BookDetails/GetNumberSourceStatistics", requestBody, headers -> { headers.add("token", getToken()); }); JSONObject jsonObject = JsonHelper.parseObject(result); @@ -180,7 +175,7 @@ public class MeTechnologyReConfig { jsonParams.put("appFromID", appFromID); RequestBody requestBody = RequestBody.create(JSON, jsonParams.toJSONString()); - String result = OkHttpHelper.post(MEDICAL_TECHNOLOGY_RESERVE_JSON_URL + "/BookDetails/BookDetails/GetNumberSourceDetails", requestBody, headers -> { + String result = OkHttpHelper.post(TZ_RESERVE_JSON_URL + "/BookDetails/BookDetails/GetNumberSourceDetails", requestBody, headers -> { headers.add("token", getToken()); }); JSONObject jsonObject = JsonHelper.parseObject(result); @@ -213,7 +208,7 @@ public class MeTechnologyReConfig { params.put("endDateTime", endDateTime); params.put("lockStatus", lockStatus); RequestBody requestBody = RequestBody.create(JSON, JsonHelper.toJsonString(params)); - String result = OkHttpHelper.post(MEDICAL_TECHNOLOGY_RESERVE_JSON_URL + "/BookDetails/BookDetails/LockedBookNo", requestBody, headers -> { + String result = OkHttpHelper.post(TZ_RESERVE_JSON_URL + "/BookDetails/BookDetails/LockedBookNo", requestBody, headers -> { headers.add("token", getToken()); }); JSONObject jsonObject = JsonHelper.parseObject(result); @@ -242,7 +237,7 @@ public class MeTechnologyReConfig { params.put("ScheduleUser", patientName); log.info("[天助预约平台] 确定预约json={}", JsonHelper.toProJsonString(params)); RequestBody requestBody = RequestBody.create(JSON, JsonHelper.toProJsonString(params)); - String result = OkHttpHelper.post(MEDICAL_TECHNOLOGY_RESERVE_JSON_URL + "/BookDetails/BookDetails/GetBookedDateTime", requestBody, headers -> { + String result = OkHttpHelper.post(TZ_RESERVE_JSON_URL + "/BookDetails/BookDetails/GetBookedDateTime", requestBody, headers -> { headers.add("token", getToken()); }); JSONObject jsonObject = JsonHelper.parseObject(result); diff --git a/src/main/java/com/ynxbd/wx/servlet/QServlet.java b/src/main/java/com/ynxbd/wx/servlet/QServlet.java index daf4859..e467811 100644 --- a/src/main/java/com/ynxbd/wx/servlet/QServlet.java +++ b/src/main/java/com/ynxbd/wx/servlet/QServlet.java @@ -1,6 +1,7 @@ package com.ynxbd.wx.servlet; import com.ynxbd.common.bean.enums.MerchantEnum; +import com.ynxbd.common.helper.common.Base64Helper; import com.ynxbd.common.helper.common.HttpHelper; import com.ynxbd.common.result.ResultEnum; import com.ynxbd.wx.config.WeChatConfig; @@ -51,15 +52,14 @@ public class QServlet extends HttpServlet { } - String patientId = request.getParameter("p"); log.info("{} [patientId={}]多张处方扫码请求,开始解析...", merchantEnum.NAME, patientId); - if (StringUtils.isEmpty(patientId)&&StringUtils.isEmpty(request.getParameter("t"))) { + if (StringUtils.isEmpty(patientId) && StringUtils.isEmpty(request.getParameter("t"))) { log.info("[支付] 多张扫码请求 patientId is null and idCardNo is null"); return; } // 体检缴费,patientId赋值为0 - if(!StringUtils.isEmpty(request.getParameter("t"))&&StringUtils.isEmpty(patientId)){ + if (!StringUtils.isEmpty(request.getParameter("t")) && StringUtils.isEmpty(patientId)) { patientId = "0"; //patientId 赋值0 } @@ -67,9 +67,14 @@ public class QServlet extends HttpServlet { log.info("[支付] 多张扫码请求 参数无效"); return; } + String cardNo = request.getParameter("t"); + cardNo = ObjectUtils.isEmpty(cardNo) ? "" : Base64Helper.decode(cardNo); + if (!ObjectUtils.isEmpty(cardNo)) { + cardNo = "&ent=" + ReqParamHelper.encode(cardNo); + } if (MerchantEnum.WX.equals(merchantEnum)) { - response.sendRedirect(WeChatConfig.getWebUrl() + "pay-qr-recipe.html?p=" + patientId + "&enp=" + ReqParamHelper.encode(patientId)+ "&ent=" + request.getParameter("t")); + response.sendRedirect(WeChatConfig.getWebUrl() + "pay-qr-recipe.html?p=" + patientId + "&enp=" + ReqParamHelper.encode(patientId) + cardNo); } } diff --git a/src/main/java/com/ynxbd/wx/wxfactory/ReqParamHelper.java b/src/main/java/com/ynxbd/wx/wxfactory/ReqParamHelper.java index 3772edd..567c6f7 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/ReqParamHelper.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/ReqParamHelper.java @@ -21,6 +21,8 @@ public class ReqParamHelper { } public static void main(String[] args) { - System.out.println(encode("397631")); +// System.out.println(encode("397631")); + System.out.println(encode("25578718")); + System.out.println(decode("EF6115C81C9EA8FF79E21180FEC20294")); } } diff --git a/src/main/java/com/ynxbd/wx/wxfactory/WxAuthHelper.java b/src/main/java/com/ynxbd/wx/wxfactory/WxAuthHelper.java index 96c10c9..7cde1f0 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/WxAuthHelper.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/WxAuthHelper.java @@ -25,6 +25,8 @@ import java.util.Map; @Slf4j public class WxAuthHelper { + private static final int SESSION_MAX_INACTIVE_INTERVAL = 60 * 60; // session最大存活时间 1H + public static String auth(HttpServletRequest request, HttpServletResponse response, boolean isUserInfo) { String code = request.getParameter("code"); String state = request.getParameter("state"); @@ -42,7 +44,9 @@ public class WxAuthHelper { if (snsToken != null) { String openid = snsToken.getOpenid(); if (openid != null) { - request.getSession().setAttribute("openid", openid); + HttpSession session = request.getSession(); + session.setMaxInactiveInterval(SESSION_MAX_INACTIVE_INTERVAL); + session.setAttribute("openid", openid); Cache cache = WxCacheHelper.getUserCache(); if (WeChatConfig.isDevUser(openid) || !cache.containsKey(openid)) { diff --git a/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java b/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java index 1d87428..bd947cf 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java @@ -230,8 +230,15 @@ public class WxMedicalHelper { public static JSONObject getMdAuthUrl(String callbackUrl, String callNo) { callNo = ObjectUtils.isEmpty(callNo) ? "" : ("?callNo=" + callNo); callbackUrl = ObjectUtils.isEmpty(callbackUrl) ? "" : callbackUrl; + JSONObject jsonObj = new JSONObject(); - jsonObj.put("url", WxFactory.Medical.Common().getAuthUrl(WeChatConfig.getWebUrl() + callbackUrl) + callNo); + String authUrl = WxFactory.Medical.Common().getAuthUrl(WeChatConfig.getWebUrl() + callbackUrl); + log.info("[医保] authUrl={}", authUrl); + if (ObjectUtils.isEmpty(authUrl)) { + jsonObj.put("url", "config_error"); + } else { + jsonObj.put("url", authUrl + callNo); + } jsonObj.put("type", MerchantEnum.WX_MEDICAL.CODE); return jsonObj; } diff --git a/src/main/java/com/ynxbd/wx/wxfactory/base/auth/Client.java b/src/main/java/com/ynxbd/wx/wxfactory/base/auth/Client.java index 525ace7..b0384b5 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/base/auth/Client.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/base/auth/Client.java @@ -78,7 +78,7 @@ public class Client { return null; } if (!response.isSuccess()) { - log.error("[oath2]请求失败 errCode={}, errMsg={}", response.getErrCode(), response.getErrMsg()); + log.error("[oath2]获取权限失败 errCode={}, errMsg={}", response.getErrCode(), response.getErrMsg()); return null; } return response; @@ -101,7 +101,7 @@ public class Client { } if (!response.isSuccess()) { - log.error("[sns-user_info]请求失败 errCode={}, errMsg={}", response.getErrCode(), response.getErrMsg()); + log.warn("[sns-user_info]用户未授权 errCode={}, errMsg={}", response.getErrCode(), response.getErrMsg()); } if (emoji != 0 && response.getNickname() != null) { 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 b9e6d06..f68d4ed 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/medical/Client.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/medical/Client.java @@ -15,6 +15,7 @@ import com.ynxbd.wx.wxfactory.utils.WxSignHelper; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.lang3.ObjectUtils; import java.math.BigDecimal; import java.util.Date; @@ -32,8 +33,9 @@ public class Client { * @param url url */ public String getAuthUrl(String url) { - log.info("[医保]免密授权地址-{}", MdConfig.getConfigUrl(url)); - return MdConfig.getConfigUrl(url); + String configUrl = MdConfig.getConfigUrl(url); + log.info("[医保]免密授权地址-{}", configUrl); + return configUrl; } diff --git a/src/main/resources/copy/medical/tem-medical.properties b/src/main/resources/copy/medical/tem-medical.properties new file mode 100644 index 0000000..d6026e4 --- /dev/null +++ b/src/main/resources/copy/medical/tem-medical.properties @@ -0,0 +1,33 @@ +# \u533B\u4FDD\u914D\u7F6E +medical.is_dev=true +medical.is_enable=true +medical.is_auto_refund=true + +# \u53EA\u6709\u8BA2\u9605\u53F7\u7684\u533B\u9662\u6216\u53EA\u60F3\u7528\u8BA2\u9605\u53F7\u7684\u533B\u9662 \u7533\u8BF7\u4E00\u4E2A\u7A7A\u670D\u52A1\u53F7 \u7A7A\u670D\u52A1\u53F7\u914D\u7F6E\u5FAE\u4FE1\u516C\u4F17\u53F7\uFF08\u670D\u52A1\u53F7\uFF09appId +medical.md_app_id= +medical.md_app_secret= + +# \u57CE\u5E02\u7F16\u7801\uFF08\u817E\u8BAF\u63D0\u4F9B\uFF09 +medical.city_code= +# \u533B\u9662\u540D\u79F0 +medical.hospital_name= +# \u533B\u4FDD\uFF081.excel\u6587\u6863\uFF09---------------------------------------------------------------------------------- +# \u5B9A\u70B9\u533B\u836F\u673A\u6784\u7F16\u7801 +medical.org_no=H00000000000 +# \u5B9A\u70B9\u533B\u836F\u673A\u6784\u5C0F\u7A0B\u5E8F/h5\u5E94\u7528id\uFF08\u6B63\u5F0F\u73AF\u5883\uFF1A\u6E20\u9053\u7F16\u53F7\uFF09 +medical.org_app_id= +# \u5B9A\u70B9\u533B\u836F\u673A\u6784\u6E20\u9053\u8BA4\u8BC1\u7F16\u7801 +medical.org_chnl_crtf_codg= + +# \u514D\u5BC6\u6388\u6743\uFF082.\u8054\u7CFB\u817E\u8BAF-->\u90AE\u4EF6\u63D0\u4F9B\uFF08\u9700\u63D0\u4F9B\u7ED9\u817E\u8BAF\u8D1F\u8D23\u4EBA\uFF1A1.\u533B\u9662\u6B63\u5F0F\u57DF\u540D\u30012.\u516C\u4F17\u53F7appid\u30013.\u514D\u5BC6\u6388\u6743ip\u767D\u540D\u5355\uFF09\uFF09---------- +# \u5408\u4F5C\u65B9id +medical.partner_id= +# \u6D4B\u8BD5\u5BC6\u94A5 +medical.dev_partner_secret= +# \u6B63\u5F0F\u5BC6\u94A5 +medical.partner_secret= +# \u6E20\u9053\u53F7channel +medical.channel= + +# \u533B\u4FDD\u652F\u4ED8\u7B7E\u540Dkey\uFF083.\u516C\u4F17\u53F7-->\u533B\u4FDD\u652F\u4ED8\u529F\u80FD\u5F00\u901A\u540E-->\u90AE\u4EF6\u63D0\u4F9B\uFF09---------------------------------------- +medical.pay_key= \ No newline at end of file diff --git a/src/main/resources/copy/medical/蒙自市妇幼保健院-medical.properties b/src/main/resources/copy/medical/蒙自市妇幼保健院-medical.properties new file mode 100644 index 0000000..cb46020 --- /dev/null +++ b/src/main/resources/copy/medical/蒙自市妇幼保健院-medical.properties @@ -0,0 +1,29 @@ +# \u533B\u4FDD\u914D\u7F6E +medical.is_dev=true +medical.is_enable=true +medical.is_auto_refund=true + +# \u57CE\u5E02\u7F16\u7801\uFF08\u817E\u8BAF\u63D0\u4F9B\uFF09 +medical.city_code=532500 +# \u533B\u9662\u540D\u79F0 +medical.hospital_name=\u8499\u81EA\u5E02\u5987\u5E7C\u4FDD\u5065\u9662\uFF08\u8499\u81EA\u5E02\u5987\u5973\u513F\u7AE5\u533B\u9662\uFF09 +# \u533B\u4FDD\uFF081.excel\u6587\u6863\uFF09---------------------------------------------------------------------------------- +# \u5B9A\u70B9\u533B\u836F\u673A\u6784\u7F16\u7801 +medical.org_no=H53250300180 +# \u5B9A\u70B9\u533B\u836F\u673A\u6784\u5C0F\u7A0B\u5E8F/h5\u5E94\u7528id\uFF08\u6B63\u5F0F\u73AF\u5883\uFF1A\u6E20\u9053\u7F16\u53F7\uFF09 +medical.org_app_id=1GBPJCKU80043F60C80A00001CE39A66 +# \u5B9A\u70B9\u533B\u836F\u673A\u6784\u6E20\u9053\u8BA4\u8BC1\u7F16\u7801 +medical.org_chnl_crtf_codg=BqK1kMStlhVDgN2uHf4EsLK/F2LjZPYJ81nK2eYQqxtPbiPNIsvGFlw+DnMTrurn + +# \u514D\u5BC6\u6388\u6743\uFF082.\u8054\u7CFB\u817E\u8BAF-->\u90AE\u4EF6\u63D0\u4F9B\uFF08\u9700\u63D0\u4F9B\u7ED9\u817E\u8BAF\u8D1F\u8D23\u4EBA\uFF1A1.\u533B\u9662\u6B63\u5F0F\u57DF\u540D\u30012.\u516C\u4F17\u53F7appid\u30013.\u514D\u5BC6\u6388\u6743ip\u767D\u540D\u5355\uFF09\uFF09---------- +# \u5408\u4F5C\u65B9id +medical.partner_id=50008770 +# \u6D4B\u8BD5\u5BC6\u94A5 +medical.dev_partner_secret=28ed20c054de87353defbbe00085f1d6 +# \u6B63\u5F0F\u5BC6\u94A5 +medical.partner_secret=9007e37ec6da1997586d0b857554e3b4 +# \u6E20\u9053\u53F7channel +medical.channel=AAHUp9Lp_yjmcOGQjI5CvA1T + +# \u533B\u4FDD\u652F\u4ED8\u7B7E\u540Dkey\uFF083.\u516C\u4F17\u53F7-->\u533B\u4FDD\u652F\u4ED8\u529F\u80FD\u5F00\u901A\u540E-->\u90AE\u4EF6\u63D0\u4F9B\uFF09---------------------------------------- +medical.pay_key=6b8e0b6191c3baa073b1ac2ff130b990 \ No newline at end of file diff --git a/src/main/resources/medical-technology-reserve.properties b/src/main/resources/medical-technology-reserve.properties deleted file mode 100644 index d380648..0000000 --- a/src/main/resources/medical-technology-reserve.properties +++ /dev/null @@ -1,5 +0,0 @@ -medical_technology_reserve_webservice_url = -medical_technology_reserve_terminal_no = -medical_technology_reserve_test_patientId = - -medical_technology_reserve_json_url = \ No newline at end of file diff --git a/src/main/resources/medical.properties b/src/main/resources/medical.properties index 2ed0786..41e88f3 100644 --- a/src/main/resources/medical.properties +++ b/src/main/resources/medical.properties @@ -29,5 +29,5 @@ medical.partner_secret=f92df3128382757425ba4c5ca166688f # \u6E20\u9053\u53F7 medical.channel=aaghgf2i4ddgrokh247fgo7n -# \u533B\u4FDD\u652F\u4ED8\u7B7E\u540Dkey\uFF083.\u516C\u4F17\u53F7-->\u57CE\u5E02\u670D\u52A1-->\u533B\u4FDD\u652F\u4ED8\u529F\u80FD\u5F00\u901A\u540E-->\u90AE\u4EF6\u63D0\u4F9B\uFF09---------------------------------------- +# \u533B\u4FDD\u652F\u4ED8\u7B7E\u540Dkey\uFF083.\u516C\u4F17\u53F7-->\u533B\u4FDD\u652F\u4ED8\u529F\u80FD\u5F00\u901A\u540E-->\u90AE\u4EF6\u63D0\u4F9B\uFF09---------------------------------------- medical.pay_key=9baafa056ad046ebf4fafc2b80c17df6 \ No newline at end of file diff --git a/src/main/resources/middle-office.properties b/src/main/resources/middle-office.properties index f1ec5e2..1d56f0c 100644 --- a/src/main/resources/middle-office.properties +++ b/src/main/resources/middle-office.properties @@ -1,4 +1,6 @@ middle_office_url= middle_office_url_esb= -middle_office_hospital = -middle_office_item_name = +middle_office_hospital= +middle_office_item_name= +# \u662F\u5426\u6253\u5370\u8FD4\u56DE\u6570\u636E +middle_office.is_log_resp=false diff --git a/src/main/resources/tz-reserve.properties b/src/main/resources/tz-reserve.properties new file mode 100644 index 0000000..5a33e32 --- /dev/null +++ b/src/main/resources/tz-reserve.properties @@ -0,0 +1,5 @@ +# \u5929\u52A9\u9884\u7EA6\u5E73\u53F0 +tz_reserve.webservice_url=http://10.255.248.183:9003/WebService1.asmx/SlipPrint +tz_reserve.terminal_no=VX +tz_reserve.json_url=http://10.255.248.183:9001 +#tz_reserve.test_patientId= diff --git a/src/main/resources/webservice.properties b/src/main/resources/webservice.properties index 44b70d6..1f5dcba 100644 --- a/src/main/resources/webservice.properties +++ b/src/main/resources/webservice.properties @@ -1 +1 @@ -# \u5F00\u542F\u5904\u65B9\u9884\u7ED3\u7B97\uFF08\u7B2C2\u5F00\u5173\uFF09\uFF08\u6CE8\u610F\u8BE5\u914D\u7F6E\u9700\u8054\u7CFBhis\u5F00\u53D1\u8005\u786E\u8BA4\u652F\u6301\u624D\u80FD\u5F00\u542F\uFF0C\u5426\u5219\u5B58\u5728\u98CE\u9669\uFF01\uFF09 his.is_recipe_prepay=false lis.url=192.168.1.185:8090 lis.unifiedEntrance=true # \u672C\u5730 #his.url=127.0.0.1:8888 # \u6D4B\u8BD5\u73AF\u5883 # \u662F\u5426\u5F3A\u5236\u6253\u5370webservice\u7684xml\u8FD4\u56DE\u6570\u636E his.is_log_resp=true # \u662F\u5426\u4F20\u9012openid\u7ED9his\u63A8\u9001\u6D88\u606F his.is_push_msg=false #------------------------------------------------------------- #\u672C\u5730 his.md_url=127.0.0.1:7777 his.dev_url=127.0.0.1:7777 his.url=200.200.200.60:8888 ali_code=675448357 # \u516C\u53F8\u6D4B\u8BD5 #his.url=192.168.12.10:8888 # \u7EA2\u6CB3 #his.url=10.20.10.6:8888 # \u7EA2\u6CB3\u533B\u4FDD #his.url=10.20.10.6:8888 #his.url=192.168.12.10:8888 #his.md_url=192.168.1.128:7885 #his.dev_url=10.20.10.6:9988 # \u6C38\u80DC #his.url=200.200.200.20:8888 # \u5FB7\u5B8F\u4E2D\u533B #his.url=200.200.200.60:8888 # \u534E\u576A #his.url=192.168.1.115:8888 # \u8499\u81EA\u4E2D\u533B #his.url=192.168.0.228:8888 # \u7389\u9F99 #his.url=192.168.0.17:8888 # \u4E91\u9F99 #his.url=200.200.200.69:8888 # #his.url=172.16.10.15:8888 # \u7984\u529D\u949F\u7231 #his.url=200.200.200.5:8888 # \u8499\u81EA\u5E02\u4EBA\u6C11\u533B\u9662 #his.url=200.200.200.174:8080 # \u5143\u8C0B #his.url=200.200.200.29:8888 # \u5143\u8C0B\u533B\u4FDD #his.dev_url=200.200.200.36:9999 # \u8292\u5E02 #his.url=192.168.100.8:8888 # \u7EA2\u6CB3\u5987\u5E7C\u4FDD\u5065\u9662 #his.url=192.168.1.204:8888 # \u8292\u5E02\u5987\u5E7C #his.url=192.168.11.7:8888 # #his.url=10.10.11.23:8888 # \u77F3\u6797 #his.url=192.168.10.10:8888 # \u5BCC\u6C11 #his.url=200.200.201.27:8888 # \u897F\u53CC\u7248\u7EB3 #his.url=10.10.11.23:8888 #wx.password=ynxbd@6910 \ No newline at end of file +# \u5F00\u542F\u5904\u65B9\u9884\u7ED3\u7B97\uFF08\u7B2C2\u5F00\u5173\uFF09\uFF08\u6CE8\u610F\u8BE5\u914D\u7F6E\u9700\u8054\u7CFBhis\u5F00\u53D1\u8005\u786E\u8BA4\u652F\u6301\u624D\u80FD\u5F00\u542F\uFF0C\u5426\u5219\u5B58\u5728\u98CE\u9669\uFF01\uFF09 his.is_recipe_prepay=false lis.url=192.168.1.185:8090 lis.unifiedEntrance=true # \u672C\u5730 #his.url=127.0.0.1:8888 # \u6D4B\u8BD5\u73AF\u5883 ali_code=675448357 # \u662F\u5426\u5F3A\u5236\u6253\u5370webservice\u7684xml\u8FD4\u56DE\u6570\u636E his.is_log_resp=true # \u662F\u5426\u4F20\u9012openid\u7ED9his\u63A8\u9001\u6D88\u606F his.is_push_msg=false #------------------------------------------------------------- #\u672C\u5730 his.md_url=127.0.0.1:7777 his.dev_url=127.0.0.1:7777 ## \u5FB7\u5B8F\u4E2D\u533B #his.url=200.200.200.60:8888 # \u7EA2\u6CB3\u5DDE\u533B\u9662 his.url=10.20.10.6:8888 # \u516C\u53F8\u6D4B\u8BD5 #his.url=192.168.12.39:8888 # \u516C\u53F8\u6D4B\u8BD5 #his.url=192.168.12.10:8888 # \u7EA2\u6CB3 #his.url=10.20.10.6:8888 # \u7EA2\u6CB3\u533B\u4FDD #his.url=10.20.10.6:8888 #his.url=192.168.12.10:8888 #his.md_url=192.168.1.128:7885 #his.dev_url=10.20.10.6:9988 # \u6C38\u80DC #his.url=200.200.200.20:8888 # \u5FB7\u5B8F\u4E2D\u533B #his.url=200.200.200.60:8888 # \u534E\u576A #his.url=192.168.1.115:8888 # \u8499\u81EA\u4E2D\u533B #his.url=192.168.0.228:8888 # \u7389\u9F99 #his.url=192.168.0.17:8888 # \u4E91\u9F99 #his.url=200.200.200.69:8888 # #his.url=172.16.10.15:8888 # \u7984\u529D\u949F\u7231 #his.url=200.200.200.5:8888 # \u8499\u81EA\u5E02\u4EBA\u6C11\u533B\u9662 #his.url=200.200.200.174:8080 # \u5143\u8C0B #his.url=200.200.200.29:8888 # \u5143\u8C0B\u533B\u4FDD #his.dev_url=200.200.200.36:9999 # \u8292\u5E02 #his.url=192.168.100.8:8888 # \u7EA2\u6CB3\u5987\u5E7C\u4FDD\u5065\u9662 #his.url=192.168.1.204:8888 # \u8292\u5E02\u5987\u5E7C #his.url=192.168.11.7:8888 # #his.url=10.10.11.23:8888 # \u77F3\u6797 #his.url=192.168.10.10:8888 # \u5BCC\u6C11 #his.url=200.200.201.27:8888 # \u897F\u53CC\u7248\u7EB3 #his.url=10.10.11.23:8888 #wx.password=ynxbd@6910 \ No newline at end of file