1、struts2框架安全性升级,移除废弃api

2、新增医保现金自动退费,和控制开关
debug
wangsq 7 months ago
parent 4783c455ad
commit a3d7ead435
  1. 2
      .gitignore
  2. 33
      sql/report.sql
  3. 4
      src/main/java/com/ynxbd/common/action/ApiAction.java
  4. 20
      src/main/java/com/ynxbd/common/action/LisReportAction.java
  5. 30
      src/main/java/com/ynxbd/common/action/ReportAction.java
  6. 49
      src/main/java/com/ynxbd/common/dao/his/HisReportDao.java
  7. 5
      src/main/java/com/ynxbd/common/result/ResultEnum.java
  8. 7
      src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java

2
.gitignore vendored

@ -36,7 +36,7 @@
logs/ logs/
app-cache/ app-cache/
*.log *.log
.svn/
# BlueJ 文件,忽略所有以[.ctxt]结尾的文件. # BlueJ 文件,忽略所有以[.ctxt]结尾的文件.
*.ctxt *.ctxt

@ -0,0 +1,33 @@
/*
Navicat Premium Data Transfer
Source Server : conpany 102
Source Server Type : MySQL
Source Server Version : 80020 (8.0.20)
Source Host : 192.168.12.102:3306
Source Schema : wx
Target Server Type : MySQL
Target Server Version : 80020 (8.0.20)
File Encoding : 65001
Date: 15/09/2023 15:20:54
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for report
-- ----------------------------
DROP TABLE IF EXISTS `report`;
CREATE TABLE `report` (
`ReportId` int NOT NULL AUTO_INCREMENT,
`UpdateTime` date DEFAULT NULL,
`ReportCount` int DEFAULT NULL,
`ReportType` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
`Remark` varchar(500) DEFAULT NULL,
PRIMARY KEY (`ReportId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;

@ -60,6 +60,10 @@ public class ApiAction extends BaseAction {
return Result.success(resp); return Result.success(resp);
} }
public static void main(String[] args) {
System.out.println(DesEncryptHelper.deCode("98EBC51EB92C6BC416BE23AE0622CC7445CCB4559637127984C5759A422DC4B81251FC4C8B32A9DB9743601A4C4D66A31FA5186B9BF10CBCF7ACB00A82EBC37122FD51700AC9D16D596D147FFC4D4973792E04B406288B88D08C6ACE9654DA3801B31D2F6B996D3572A3BA1E8124A5CE43394DF49E1B5F0DC7793566C06524A854161F38FF064F3B"));
}
@Action("getWxJsapiTicket") @Action("getWxJsapiTicket")
public Result getWxJsapiTicket() { public Result getWxJsapiTicket() {
String ticket = WxCacheHelper.getJsapiTicket(); String ticket = WxCacheHelper.getJsapiTicket();

@ -59,7 +59,7 @@ public class LisReportAction extends BaseAction {
if (!ObjectUtils.isEmpty(treatNumPrefix)) { // 瑞美lis报告前缀 if (!ObjectUtils.isEmpty(treatNumPrefix)) { // 瑞美lis报告前缀
treatNum = treatNumPrefix + treatNum; treatNum = treatNumPrefix + treatNum;
} }
try {
List<XBDLisReport> lstReport = new ArrayList<>(); List<XBDLisReport> lstReport = new ArrayList<>();
switch (flag) { switch (flag) {
case "1": // 新八达 case "1": // 新八达
@ -107,6 +107,7 @@ public class LisReportAction extends BaseAction {
break; break;
} }
if (lstReport != null) {
for (XBDLisReport item : lstReport) { for (XBDLisReport item : lstReport) {
if (item.getId() != null) { if (item.getId() != null) {
item.setEnReportId(ReqParamHelper.encode(item.getId())); item.setEnReportId(ReqParamHelper.encode(item.getId()));
@ -115,8 +116,13 @@ public class LisReportAction extends BaseAction {
item.setEnSampleCode(ReqParamHelper.encode(item.getSampleCode())); item.setEnSampleCode(ReqParamHelper.encode(item.getSampleCode()));
} }
} }
}
new ReportService().updateReportLisCount(); new ReportService().updateReportLisCount();
return Result.success(lstReport); return Result.success(lstReport);
} catch (Exception e) {
return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR);
}
} }
@ -138,6 +144,7 @@ public class LisReportAction extends BaseAction {
return Result.error(ResultEnum.PARAM_IS_BLANK); return Result.error(ResultEnum.PARAM_IS_BLANK);
} }
try {
List<XBDLisResult> lstResult = new ArrayList<>(); List<XBDLisResult> lstResult = new ArrayList<>();
switch (flag) { switch (flag) {
case "1": // 新八达 case "1": // 新八达
@ -160,6 +167,9 @@ public class LisReportAction extends BaseAction {
break; break;
} }
return Result.success(lstResult); return Result.success(lstResult);
} catch (Exception e) {
return Result.success(ResultEnum.LIS_SELECT_DATA_ERROR);
}
} }
/** /**
@ -180,6 +190,7 @@ public class LisReportAction extends BaseAction {
} }
List<XBDLisImageResult> lstImage = new ArrayList<>(); List<XBDLisImageResult> lstImage = new ArrayList<>();
try {
switch (flag) { switch (flag) {
case "1": case "1":
lstImage = new XBDLisDao().getImage(testDate, sampleCode); lstImage = new XBDLisDao().getImage(testDate, sampleCode);
@ -197,6 +208,9 @@ public class LisReportAction extends BaseAction {
lstImage = new XBDLisDao().getImage7RM(reportId); lstImage = new XBDLisDao().getImage7RM(reportId);
break; break;
} }
} catch (Exception e) {
return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR);
}
FileInputStream fis = null; FileInputStream fis = null;
byte[] bytes; byte[] bytes;
@ -254,6 +268,7 @@ public class LisReportAction extends BaseAction {
return Result.error(ResultEnum.PARAM_IS_BLANK); return Result.error(ResultEnum.PARAM_IS_BLANK);
} }
try {
List<XBDLisBactResult> bactResults = new ArrayList<>(); List<XBDLisBactResult> bactResults = new ArrayList<>();
switch (flag) { switch (flag) {
case "1": case "1":
@ -273,6 +288,9 @@ public class LisReportAction extends BaseAction {
break; break;
} }
return Result.success(bactResults); return Result.success(bactResults);
} catch (Exception e) {
return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR);
}
} }
/** /**

@ -2,12 +2,10 @@ package com.ynxbd.common.action;
import com.ynxbd.common.action.base.BaseAction; import com.ynxbd.common.action.base.BaseAction;
import com.ynxbd.common.bean.TreatRecord; import com.ynxbd.common.bean.TreatRecord;
import com.ynxbd.common.bean.enums.ReportEnum;
import com.ynxbd.common.bean.lis.XBDLisReport; import com.ynxbd.common.bean.lis.XBDLisReport;
import com.ynxbd.common.bean.report.CheckReport; import com.ynxbd.common.bean.report.CheckReport;
import com.ynxbd.common.bean.report.InspectionReport; import com.ynxbd.common.bean.report.InspectionReport;
import com.ynxbd.common.bean.report.PEIS; import com.ynxbd.common.bean.report.PEIS;
import com.ynxbd.common.dao.ReportDao;
import com.ynxbd.common.dao.his.HisReportDao; import com.ynxbd.common.dao.his.HisReportDao;
import com.ynxbd.common.helper.common.DateHelper; import com.ynxbd.common.helper.common.DateHelper;
import com.ynxbd.common.result.Result; import com.ynxbd.common.result.Result;
@ -37,13 +35,13 @@ public class ReportAction extends BaseAction {
@Action("getPEISByPatient") @Action("getPEISByPatient")
public Result getPEISByPatient(String name, String idCardNo, String patientId, String begDate, String endDate) { public Result getPEISByPatient(String name, String idCardNo, String patientId, String begDate, String endDate) {
// http://localhost:8080/wx/report/getPEISByPatient.do?patientId=153671&idCardNo=533103198212184014&name=%E8%82%96%E7%81%BF&token=123 // http://localhost:8080/wx/report/getPEISByPatient.do?patientId=153671&idCardNo=533103198212184014&name=%E8%82%96%E7%81%BF&token=123
try {
log.info("[体检报告]查询:patientId={}, idCardNo={}, name={}, begDate={}, endDate={}", patientId, idCardNo, name, begDate, endDate); log.info("[体检报告]查询:patientId={}, idCardNo={}, name={}, begDate={}, endDate={}", patientId, idCardNo, name, begDate, endDate);
if (patientId == null || idCardNo == null || name == null || begDate == null || endDate == null) { if (patientId == null || idCardNo == null || name == null || begDate == null || endDate == null) {
return Result.error(ResultEnum.PARAM_IS_DEFECT); return Result.error(ResultEnum.PARAM_IS_DEFECT);
} }
List<PEIS> reportList = new HisReportDao().getPEISReportByPatient(name, idCardNo, begDate, endDate); List<PEIS> reportList = new HisReportDao().getPEISReportByPatient(name, idCardNo, begDate, endDate);
List<PEIS> resultList = new ArrayList<>(); List<PEIS> resultList = new ArrayList<>();
for (PEIS report : reportList) { for (PEIS report : reportList) {
if (report.getExamDate() != null && DateHelper.inDateRange(begDate, endDate, report.getExamDate(), DateHelper.DateEnum.yyyy_MM_dd)) { if (report.getExamDate() != null && DateHelper.inDateRange(begDate, endDate, report.getExamDate(), DateHelper.DateEnum.yyyy_MM_dd)) {
@ -51,6 +49,9 @@ public class ReportAction extends BaseAction {
} }
} }
return Result.success(resultList); return Result.success(resultList);
} catch (Exception e) {
return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR);
}
} }
@ -59,6 +60,7 @@ public class ReportAction extends BaseAction {
*/ */
@Action("getCheckByPatient") @Action("getCheckByPatient")
public Result getCheckByPatient(String begDate, String endDate, String patientId, String openid) { public Result getCheckByPatient(String begDate, String endDate, String patientId, String openid) {
try {
patientId = getDecodeString(patientId); patientId = getDecodeString(patientId);
// http://localhost:8080/wx/report/getCheckByPatient.do?patientId=153671&token=123 // http://localhost:8080/wx/report/getCheckByPatient.do?patientId=153671&token=123
log.info("[检查报告]查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); log.info("[检查报告]查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate);
@ -75,7 +77,11 @@ public class ReportAction extends BaseAction {
} }
} }
new ReportService().updateReportPacsCount(); new ReportService().updateReportPacsCount();
return Result.success(resultList); return Result.success(resultList);
} catch (Exception e) {
return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR);
}
} }
@ -91,6 +97,7 @@ public class ReportAction extends BaseAction {
*/ */
@Action("getTreatRecordList") @Action("getTreatRecordList")
public Result getTreatRecordList(String begDate, String endDate, String patientId, String patientType, String reportType, Boolean isLately, String deptCode) { public Result getTreatRecordList(String begDate, String endDate, String patientId, String patientType, String reportType, Boolean isLately, String deptCode) {
try {
patientId = getDecodeString(patientId); patientId = getDecodeString(patientId);
// http://localhost:8081/wx/report/getTreatRecordList.do?patientId=406212&begDate=201801-01&endDate=2020-08-12&patientType=0&reportType=2 // http://localhost:8081/wx/report/getTreatRecordList.do?patientId=406212&begDate=201801-01&endDate=2020-08-12&patientType=0&reportType=2
if (patientId == null || begDate == null || endDate == null) { if (patientId == null || begDate == null || endDate == null) {
@ -99,10 +106,8 @@ public class ReportAction extends BaseAction {
List<TreatRecord> records = new HisReportDao().getTreatRecordList(patientId, begDate, endDate, patientType, reportType, deptCode); List<TreatRecord> records = new HisReportDao().getTreatRecordList(patientId, begDate, endDate, patientType, reportType, deptCode);
if (!records.isEmpty() && isLately != null && isLately) {
if (records.size() > 0 && isLately != null && isLately) {
List<TreatRecord> resultList = new ArrayList<>(); List<TreatRecord> resultList = new ArrayList<>();
records.stream().max(Comparator.comparing(TreatRecord::getConsultDate)).ifPresent(resultList::add); records.stream().max(Comparator.comparing(TreatRecord::getConsultDate)).ifPresent(resultList::add);
return Result.success(resultList); return Result.success(resultList);
} }
@ -113,6 +118,10 @@ public class ReportAction extends BaseAction {
} }
} }
return Result.success(records); return Result.success(records);
} catch (Exception e) {
return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR);
}
} }
@ -121,6 +130,7 @@ public class ReportAction extends BaseAction {
*/ */
@Action("getInspectByPatient") @Action("getInspectByPatient")
public Result getInspectByPatient(String openid, String patientId, String begDate, String endDate) { public Result getInspectByPatient(String openid, String patientId, String begDate, String endDate) {
try {
patientId = getDecodeString(patientId); patientId = getDecodeString(patientId);
// http://localhost:8080/wx/report/getInspectByPatient.do?patientId=153671&token=123 // http://localhost:8080/wx/report/getInspectByPatient.do?patientId=153671&token=123
@ -138,6 +148,9 @@ public class ReportAction extends BaseAction {
} }
} }
return Result.success(resultList); return Result.success(resultList);
} catch (Exception e) {
return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR);
}
} }
/** /**
@ -145,6 +158,7 @@ public class ReportAction extends BaseAction {
*/ */
@Action("getInspectByTreatNum") @Action("getInspectByTreatNum")
public Result getInspectByTreatNum(String type, String treatNum, String patientId) { public Result getInspectByTreatNum(String type, String treatNum, String patientId) {
try {
treatNum = getDecodeString(treatNum); treatNum = getDecodeString(treatNum);
patientId = getDecodeString(patientId); patientId = getDecodeString(patientId);
// http://localhost:8080/wx/report/getInspectByTreatNum.do?patientId=153671&token=123 // http://localhost:8080/wx/report/getInspectByTreatNum.do?patientId=153671&token=123
@ -176,8 +190,10 @@ public class ReportAction extends BaseAction {
resultList.add(xbdLisReport); resultList.add(xbdLisReport);
} }
return Result.success(resultList); return Result.success(resultList);
} catch (Exception e) {
return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR);
}
} }
// /** // /**

@ -9,6 +9,7 @@ import com.ynxbd.common.bean.report.PEIS;
import com.ynxbd.common.helper.his.HisEnum; import com.ynxbd.common.helper.his.HisEnum;
import com.ynxbd.common.helper.his.HisHelper; import com.ynxbd.common.helper.his.HisHelper;
import com.ynxbd.common.result.JsonResult; import com.ynxbd.common.result.JsonResult;
import com.ynxbd.common.result.ServiceException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList; import java.util.ArrayList;
@ -59,17 +60,15 @@ public class HisReportDao {
* @param bedDate 开始时间 * @param bedDate 开始时间
* @param endDate 结束时间 * @param endDate 结束时间
*/ */
public List<CheckReport> getCheckByPatient(String patientId, String bedDate, String endDate) { public List<CheckReport> getCheckByPatient(String patientId, String bedDate, String endDate) throws ServiceException {
List<CheckReport> reports = new ArrayList<>();
JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_CheckApplication, params -> { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_CheckApplication, params -> {
params.put("PatientID", patientId); params.put("PatientID", patientId);
}); });
if (jsonResult.success()) { if (!jsonResult.success()) {
reports = jsonResult.getDataMapList(CheckReport.class, "Report"); throw new ServiceException(jsonResult.getMessage());
} }
return reports; return jsonResult.getDataMapList(CheckReport.class, "Report");
} }
@ -80,16 +79,16 @@ public class HisReportDao {
* @param idCardNo 身份证号码 * @param idCardNo 身份证号码
* @return list * @return list
*/ */
public List<PEIS> getPEISReportByPatient(String name, String idCardNo, String bedDate, String endDate) { public List<PEIS> getPEISReportByPatient(String name, String idCardNo, String bedDate, String endDate) throws ServiceException {
List<PEIS> reports = new ArrayList<>();
JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_PEISReport, params -> { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_PEISReport, params -> {
params.put("Name", name); params.put("Name", name);
params.put("IdCardNo", idCardNo); params.put("IdCardNo", idCardNo);
}); });
if (jsonResult.success()) {
reports = jsonResult.getDataMapList(PEIS.class, "Enrollment"); if (!jsonResult.success()) {
throw new ServiceException(jsonResult.getMessage());
} }
return reports; return jsonResult.getDataMapList(PEIS.class, "Enrollment");
} }
/** /**
@ -98,16 +97,15 @@ public class HisReportDao {
* @param patientId 患者 * @param patientId 患者
* @return 报告集合 * @return 报告集合
*/ */
public List<InspectionReport> getInspectByPatient(String patientId) { public List<InspectionReport> getInspectByPatient(String patientId) throws ServiceException {
List<InspectionReport> reports = new ArrayList<>();
JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_InspectionApplication, params -> { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_InspectionApplication, params -> {
params.put("PatientID", patientId); params.put("PatientID", patientId);
}); });
if (jsonResult.success()) { if (!jsonResult.success()) {
reports = jsonResult.getDataMapList(InspectionReport.class, "Report"); throw new ServiceException(jsonResult.getMessage());
} }
return reports; return jsonResult.getDataMapList(InspectionReport.class, "Report");
} }
@ -117,18 +115,17 @@ public class HisReportDao {
* @param patientId 患者 * @param patientId 患者
* @return 报告集合 * @return 报告集合
*/ */
public List<InspectionReport> getInspectByTreatNum(String patientId, String zyNum, String mzNum) { public List<InspectionReport> getInspectByTreatNum(String patientId, String zyNum, String mzNum) throws ServiceException {
List<InspectionReport> reportList = new ArrayList<>();
JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_InspectionApplication, params -> { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_InspectionApplication, params -> {
params.put("PatientID", patientId); params.put("PatientID", patientId);
params.put("ZYNum", zyNum == null ? "" : zyNum); params.put("ZYNum", zyNum == null ? "" : zyNum);
params.put("MZNum", mzNum == null ? "" : mzNum); params.put("MZNum", mzNum == null ? "" : mzNum);
}); });
if (jsonResult.success()) { if (!jsonResult.success()) {
reportList = jsonResult.getDataMapList(InspectionReport.class, "Report"); throw new ServiceException(jsonResult.getMessage());
} }
return reportList; return jsonResult.getDataMapList(InspectionReport.class, "Report");
} }
/** /**
@ -136,8 +133,7 @@ public class HisReportDao {
* *
* @return 就诊记录 * @return 就诊记录
*/ */
public List<TreatRecord> getTreatRecordList(String patientId, String begDate, String endDate, String patientType, String reportType,String deptCode) { public List<TreatRecord> getTreatRecordList(String patientId, String begDate, String endDate, String patientType, String reportType, String deptCode) throws ServiceException {
List<TreatRecord> resultList = new ArrayList<>();
JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.Query_TreatRecords, params -> { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.Query_TreatRecords, params -> {
params.put("PatientId", patientId); params.put("PatientId", patientId);
params.put("BegDate", begDate); params.put("BegDate", begDate);
@ -147,9 +143,11 @@ public class HisReportDao {
params.put("CheckOrInspection", reportType == null ? "0" : reportType); // 0:全部; 1:检查; 2:检验; 3:检查+检验 params.put("CheckOrInspection", reportType == null ? "0" : reportType); // 0:全部; 1:检查; 2:检验; 3:检查+检验
}); });
if (jsonResult.success()) { // 0成功 -1异常 if (!jsonResult.success()) {
throw new ServiceException(jsonResult.getMessage());
}
List<TreatRecord> resultList = new ArrayList<>();
JSONArray jsonArray = jsonResult.getJsonArray("Records", "Record"); JSONArray jsonArray = jsonResult.getJsonArray("Records", "Record");
TreatRecord item; TreatRecord item;
JSONObject nodeItem; JSONObject nodeItem;
for (int i = 0; i < jsonArray.size(); i++) { for (int i = 0; i < jsonArray.size(); i++) {
@ -166,7 +164,6 @@ public class HisReportDao {
item.setConsultDate(nodeItem.getString("ConsultDate")); // 描述 item.setConsultDate(nodeItem.getString("ConsultDate")); // 描述
resultList.add(item); resultList.add(item);
} }
}
return resultList; return resultList;
} }
} }

@ -122,14 +122,15 @@ public enum ResultEnum {
DATA_IS_DISABLED(50007, "数据已禁用"), DATA_IS_DISABLED(50007, "数据已禁用"),
/* 接口错误:60000-69999 */ /* 接口错误:60000-69999 */
INTERFACE_INVOKE_ERROR(60000, "接口调用异常"),
INTERFACE_WX_INVOKE_ERROR(61001, "【微信】接口调用异常"), INTERFACE_WX_INVOKE_ERROR(61001, "【微信】接口调用异常"),
INTERFACE_ALI_INVOKE_ERROR(62002, "【支付宝】接口调用异常"), INTERFACE_ALI_INVOKE_ERROR(62002, "【支付宝】接口调用异常"),
INTERFACE_HIS_INVOKE_ERROR(69000, "【HIS】接口调用异常"), INTERFACE_HIS_INVOKE_ERROR(69000, "【HIS】接口调用异常"),
INTERFACE_HIS_DATA_ERROR(69001, "【HIS】接口返回数据异常"), INTERFACE_HIS_DATA_ERROR(69001, "【HIS】接口返回数据异常"),
INTERFACE_HIS_REQ_TIMEOUT(69408, "【HIS】接口请求超时"), INTERFACE_HIS_REQ_TIMEOUT(69408, "【HIS】接口请求超时"),
INTERFACE_HIS_NO_DATA(69404, "【HIS】没有查找到数据"), INTERFACE_HIS_NO_DATA(69404, "【HIS】没有查找到数据"),
// // LIS
INTERFACE_INVOKE_ERROR(60000, "接口调用异常"), LIS_SELECT_DATA_ERROR(69501, "【LIS】查询数据异常"),
INTERFACE_EXCEED_LOAD(60001, "接口负载过高"), INTERFACE_EXCEED_LOAD(60001, "接口负载过高"),
INTERFACE_FORBID_VISIT(60002, "该接口禁止访问"), INTERFACE_FORBID_VISIT(60002, "该接口禁止访问"),

@ -273,6 +273,13 @@ public class WxMedicalHelper {
); );
} }
/**
* [医保]退现金部分
*/
public static MedicalOrder refundCash(String outTradeNo, String tradeNo, BigDecimal cashFee, String reason) {
return refundCash(outTradeNo, "R" + tradeNo, tradeNo, cashFee, reason);
}
/** /**
* [医保] 下载对账单 * [医保] 下载对账单

Loading…
Cancel
Save