diff --git a/.gitignore b/.gitignore index d7b89a4..eb585ca 100644 --- a/.gitignore +++ b/.gitignore @@ -36,7 +36,7 @@ logs/ app-cache/ *.log - +.svn/ # BlueJ 文件,忽略所有以[.ctxt]结尾的文件. *.ctxt diff --git a/sql/report.sql b/sql/report.sql new file mode 100644 index 0000000..b0ebf5b --- /dev/null +++ b/sql/report.sql @@ -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; diff --git a/src/main/java/com/ynxbd/common/action/ApiAction.java b/src/main/java/com/ynxbd/common/action/ApiAction.java index 7c03316..069883c 100644 --- a/src/main/java/com/ynxbd/common/action/ApiAction.java +++ b/src/main/java/com/ynxbd/common/action/ApiAction.java @@ -60,6 +60,10 @@ public class ApiAction extends BaseAction { return Result.success(resp); } + public static void main(String[] args) { + System.out.println(DesEncryptHelper.deCode("98EBC51EB92C6BC416BE23AE0622CC7445CCB4559637127984C5759A422DC4B81251FC4C8B32A9DB9743601A4C4D66A31FA5186B9BF10CBCF7ACB00A82EBC37122FD51700AC9D16D596D147FFC4D4973792E04B406288B88D08C6ACE9654DA3801B31D2F6B996D3572A3BA1E8124A5CE43394DF49E1B5F0DC7793566C06524A854161F38FF064F3B")); + } + @Action("getWxJsapiTicket") public Result getWxJsapiTicket() { String ticket = WxCacheHelper.getJsapiTicket(); diff --git a/src/main/java/com/ynxbd/common/action/LisReportAction.java b/src/main/java/com/ynxbd/common/action/LisReportAction.java index a427901..4d4e25b 100644 --- a/src/main/java/com/ynxbd/common/action/LisReportAction.java +++ b/src/main/java/com/ynxbd/common/action/LisReportAction.java @@ -50,7 +50,7 @@ public class LisReportAction extends BaseAction { * @return 报告列表 */ @Action("report") - public Result getReportList(String treatNum, String treatNumPrefix, String flag, String patientType,String startTime,String endTime) { + public Result getReportList(String treatNum, String treatNumPrefix, String flag, String patientType, String startTime, String endTime) { treatNum = getDecodeString(treatNum); log.info("[Lis报告单]查询: flag={{}}, treatNumPrefix={{}}, treatNum={{}}, patientType={{}}", flag, treatNumPrefix, treatNum, patientType); if (flag == null || patientType == null || treatNum == null) { @@ -59,64 +59,70 @@ public class LisReportAction extends BaseAction { if (!ObjectUtils.isEmpty(treatNumPrefix)) { // 瑞美lis报告前缀 treatNum = treatNumPrefix + treatNum; } + try { + List lstReport = new ArrayList<>(); + switch (flag) { + case "1": // 新八达 + lstReport = new XBDLisDao().getReport(treatNum, patientType); + break; + case "2": // 瑞美 + lstReport = new XBDLisDao().getReport4RM(treatNum); - List lstReport = new ArrayList<>(); - switch (flag) { - case "1": // 新八达 - lstReport = new XBDLisDao().getReport(treatNum, patientType); - break; - case "2": // 瑞美 - lstReport = new XBDLisDao().getReport4RM(treatNum); + String reportId; + for (XBDLisReport reportItem : lstReport) { + // 倒叙->base64->md5 + reportId = NumHelper.numDesc(reportItem.getId()); + if (reportId != null) { + reportId = Base64Helper.encode(reportId); + reportId = DigestUtils.md5Hex(reportId); + reportItem.setRm_cipherText(reportId); + } + } + break; + case "3": // 科华 + if (WeChatConfig.APP_ID.equals("wxc01532c55273dc6b")) { // 红河州妇幼门诊号从bed_no查 + lstReport = new XBDLisDao().getReport4KH_Hhzfy(treatNum, patientType); + } else { + lstReport = new XBDLisDao().getReport4KH(treatNum, patientType); + } + break; + case "4": // 石林 + lstReport = new XBDLisDao().getReport4Sl(treatNum, patientType); + break; + case "5": + lstReport = RMLisDao.getReportList("1", treatNum, startTime, endTime, "0"); + break; + case "6": + lstReport = new XBDLisDao().getReport7RM(treatNum); + String report7Id; + for (XBDLisReport reportItem : lstReport) { + // 倒叙->base64->md5 + report7Id = NumHelper.numDesc(reportItem.getId()); + if (report7Id != null) { + report7Id = Base64Helper.encode(report7Id); + report7Id = DigestUtils.md5Hex(report7Id); + reportItem.setRm_cipherText(report7Id); + } + } + break; + } - String reportId; - for (XBDLisReport reportItem : lstReport) { - // 倒叙->base64->md5 - reportId = NumHelper.numDesc(reportItem.getId()); - if (reportId != null) { - reportId = Base64Helper.encode(reportId); - reportId = DigestUtils.md5Hex(reportId); - reportItem.setRm_cipherText(reportId); + if (lstReport != null) { + for (XBDLisReport item : lstReport) { + if (item.getId() != null) { + item.setEnReportId(ReqParamHelper.encode(item.getId())); } - } - break; - case "3": // 科华 - if (WeChatConfig.APP_ID.equals("wxc01532c55273dc6b")) { // 红河州妇幼门诊号从bed_no查 - lstReport = new XBDLisDao().getReport4KH_Hhzfy(treatNum, patientType); - } else { - lstReport = new XBDLisDao().getReport4KH(treatNum, patientType); - } - break; - case "4": // 石林 - lstReport = new XBDLisDao().getReport4Sl(treatNum, patientType); - break; - case "5": - lstReport = RMLisDao.getReportList("1",treatNum,startTime,endTime,"0"); - break; - case "6": - lstReport = new XBDLisDao().getReport7RM(treatNum); - String report7Id; - for (XBDLisReport reportItem : lstReport) { - // 倒叙->base64->md5 - report7Id = NumHelper.numDesc(reportItem.getId()); - if (report7Id != null) { - report7Id = Base64Helper.encode(report7Id); - report7Id = DigestUtils.md5Hex(report7Id); - reportItem.setRm_cipherText(report7Id); + if (item.getSampleCode() != null) { + item.setEnSampleCode(ReqParamHelper.encode(item.getSampleCode())); } } - break; - } - - for (XBDLisReport item : lstReport) { - if (item.getId() != null) { - item.setEnReportId(ReqParamHelper.encode(item.getId())); - } - if (item.getSampleCode() != null) { - item.setEnSampleCode(ReqParamHelper.encode(item.getSampleCode())); } + + new ReportService().updateReportLisCount(); + return Result.success(lstReport); + } catch (Exception e) { + return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR); } - new ReportService().updateReportLisCount(); - return Result.success(lstReport); } @@ -138,28 +144,32 @@ public class LisReportAction extends BaseAction { return Result.error(ResultEnum.PARAM_IS_BLANK); } - List lstResult = new ArrayList<>(); - switch (flag) { - case "1": // 新八达 - lstResult = new XBDLisDao().getResult(testDate, sampleCode); - break; - case "2": // 瑞美 - lstResult = new XBDLisDao().getResult4RM(Integer.parseInt(reportId)); - break; - case "3": // 科华 - lstResult = new XBDLisDao().getResult4KH(testDate, sampleCode); - break; - case "4": - lstResult = new XBDLisDao().getResult4Sl(reportId); - break; - case "5": - lstResult = RMLisDao.getReportResult(reportId); - break; - case "6": - lstResult = new XBDLisDao().getResult7RM(reportId); - break; + try { + List lstResult = new ArrayList<>(); + switch (flag) { + case "1": // 新八达 + lstResult = new XBDLisDao().getResult(testDate, sampleCode); + break; + case "2": // 瑞美 + lstResult = new XBDLisDao().getResult4RM(Integer.parseInt(reportId)); + break; + case "3": // 科华 + lstResult = new XBDLisDao().getResult4KH(testDate, sampleCode); + break; + case "4": + lstResult = new XBDLisDao().getResult4Sl(reportId); + break; + case "5": + lstResult = RMLisDao.getReportResult(reportId); + break; + case "6": + lstResult = new XBDLisDao().getResult7RM(reportId); + break; + } + return Result.success(lstResult); + } catch (Exception e) { + return Result.success(ResultEnum.LIS_SELECT_DATA_ERROR); } - return Result.success(lstResult); } /** @@ -180,22 +190,26 @@ public class LisReportAction extends BaseAction { } List lstImage = new ArrayList<>(); - switch (flag) { - case "1": - lstImage = new XBDLisDao().getImage(testDate, sampleCode); - break; - case "2": - lstImage = new XBDLisDao().getImage4RM(Integer.parseInt(reportId)); - break; - case "3": - lstImage = new XBDLisDao().getImage4KH(testDate, sampleCode); - break; - case "4": - lstImage = new XBDLisDao().getImage4Sl(reportId); - break; - case "6": - lstImage = new XBDLisDao().getImage7RM(reportId); - break; + try { + switch (flag) { + case "1": + lstImage = new XBDLisDao().getImage(testDate, sampleCode); + break; + case "2": + lstImage = new XBDLisDao().getImage4RM(Integer.parseInt(reportId)); + break; + case "3": + lstImage = new XBDLisDao().getImage4KH(testDate, sampleCode); + break; + case "4": + lstImage = new XBDLisDao().getImage4Sl(reportId); + break; + case "6": + lstImage = new XBDLisDao().getImage7RM(reportId); + break; + } + } catch (Exception e) { + return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR); } FileInputStream fis = null; @@ -254,25 +268,29 @@ public class LisReportAction extends BaseAction { return Result.error(ResultEnum.PARAM_IS_BLANK); } - List bactResults = new ArrayList<>(); - switch (flag) { - case "1": - bactResults = new XBDLisDao().getBactResult(testDate, sampleCode); - break; - case "2": - bactResults = new XBDLisDao().getBactResult4RM(Integer.parseInt(reportId)); - break; - case "3": - bactResults = new XBDLisDao().getBactResult4KH(testDate, sampleCode); - break; - case "4": - bactResults = new XBDLisDao().getBactResult4Sl(reportId); - break; - case "5": - bactResults = RMLisDao.getBactResult(reportId); - break; + try { + List bactResults = new ArrayList<>(); + switch (flag) { + case "1": + bactResults = new XBDLisDao().getBactResult(testDate, sampleCode); + break; + case "2": + bactResults = new XBDLisDao().getBactResult4RM(Integer.parseInt(reportId)); + break; + case "3": + bactResults = new XBDLisDao().getBactResult4KH(testDate, sampleCode); + break; + case "4": + bactResults = new XBDLisDao().getBactResult4Sl(reportId); + break; + case "5": + bactResults = RMLisDao.getBactResult(reportId); + break; + } + return Result.success(bactResults); + } catch (Exception e) { + return Result.error(ResultEnum.LIS_SELECT_DATA_ERROR); } - return Result.success(bactResults); } /** @@ -294,7 +312,7 @@ public class LisReportAction extends BaseAction { * 展示报告 瑞美专用 */ @Action("showLisReport") - public Result showLisReport(String queryCode ) { + public Result showLisReport(String queryCode) { queryCode = getDecodeString(queryCode); String queryType = "1"; //ReportID 报告单ID return RMLisDao.downLisReport(queryType, queryCode); diff --git a/src/main/java/com/ynxbd/common/action/ReportAction.java b/src/main/java/com/ynxbd/common/action/ReportAction.java index 81b05fe..c8a0726 100644 --- a/src/main/java/com/ynxbd/common/action/ReportAction.java +++ b/src/main/java/com/ynxbd/common/action/ReportAction.java @@ -2,12 +2,10 @@ package com.ynxbd.common.action; import com.ynxbd.common.action.base.BaseAction; 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.report.CheckReport; import com.ynxbd.common.bean.report.InspectionReport; import com.ynxbd.common.bean.report.PEIS; -import com.ynxbd.common.dao.ReportDao; import com.ynxbd.common.dao.his.HisReportDao; import com.ynxbd.common.helper.common.DateHelper; import com.ynxbd.common.result.Result; @@ -37,20 +35,23 @@ public class ReportAction extends BaseAction { @Action("getPEISByPatient") 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 - log.info("[体检报告]查询:patientId={}, idCardNo={}, name={}, begDate={}, endDate={}", patientId, idCardNo, name, begDate, endDate); - if (patientId == null || idCardNo == null || name == null || begDate == null || endDate == null) { - return Result.error(ResultEnum.PARAM_IS_DEFECT); - } - - List reportList = new HisReportDao().getPEISReportByPatient(name, idCardNo, begDate, endDate); + try { + log.info("[体检报告]查询:patientId={}, idCardNo={}, name={}, begDate={}, endDate={}", patientId, idCardNo, name, begDate, endDate); + if (patientId == null || idCardNo == null || name == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } - List resultList = new ArrayList<>(); - for (PEIS report : reportList) { - if (report.getExamDate() != null && DateHelper.inDateRange(begDate, endDate, report.getExamDate(), DateHelper.DateEnum.yyyy_MM_dd)) { - resultList.add(report); + List reportList = new HisReportDao().getPEISReportByPatient(name, idCardNo, begDate, endDate); + List resultList = new ArrayList<>(); + for (PEIS report : reportList) { + if (report.getExamDate() != null && DateHelper.inDateRange(begDate, endDate, report.getExamDate(), DateHelper.DateEnum.yyyy_MM_dd)) { + resultList.add(report); + } } + return Result.success(resultList); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); } - return Result.success(resultList); } @@ -59,23 +60,28 @@ public class ReportAction extends BaseAction { */ @Action("getCheckByPatient") public Result getCheckByPatient(String begDate, String endDate, String patientId, String openid) { - patientId = getDecodeString(patientId); - // http://localhost:8080/wx/report/getCheckByPatient.do?patientId=153671&token=123 - log.info("[检查报告]查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); - if (patientId == null || begDate == null || endDate == null) { - return Result.error(ResultEnum.PARAM_IS_DEFECT); - } + try { + patientId = getDecodeString(patientId); + // http://localhost:8080/wx/report/getCheckByPatient.do?patientId=153671&token=123 + log.info("[检查报告]查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); + if (patientId == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } - List reportList = new HisReportDao().getCheckByPatient(patientId, begDate, endDate); + List reportList = new HisReportDao().getCheckByPatient(patientId, begDate, endDate); - List resultList = new ArrayList<>(); - for (CheckReport report : reportList) { - if (report.getApplyDate() != null && DateHelper.inDateRange(begDate, endDate, report.getApplyDate(), DateHelper.DateEnum.yyyy_MM_dd)) { - resultList.add(report); + List resultList = new ArrayList<>(); + for (CheckReport report : reportList) { + if (report.getApplyDate() != null && DateHelper.inDateRange(begDate, endDate, report.getApplyDate(), DateHelper.DateEnum.yyyy_MM_dd)) { + resultList.add(report); + } } + new ReportService().updateReportPacsCount(); + + return Result.success(resultList); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); } - new ReportService().updateReportPacsCount(); - return Result.success(resultList); } @@ -90,29 +96,32 @@ public class ReportAction extends BaseAction { * @param isLately 是否只查询最近一条记录 */ @Action("getTreatRecordList") - public Result getTreatRecordList(String begDate, String endDate, String patientId, String patientType, String reportType, Boolean isLately,String deptCode) { - patientId = getDecodeString(patientId); - // 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) { - return Result.error(ResultEnum.PARAM_IS_DEFECT); - } - - List records = new HisReportDao().getTreatRecordList(patientId, begDate, endDate, patientType, reportType,deptCode); - + public Result getTreatRecordList(String begDate, String endDate, String patientId, String patientType, String reportType, Boolean isLately, String deptCode) { + try { + patientId = getDecodeString(patientId); + // 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) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } - if (records.size() > 0 && isLately != null && isLately) { - List resultList = new ArrayList<>(); + List records = new HisReportDao().getTreatRecordList(patientId, begDate, endDate, patientType, reportType, deptCode); - records.stream().max(Comparator.comparing(TreatRecord::getConsultDate)).ifPresent(resultList::add); - return Result.success(resultList); - } + if (!records.isEmpty() && isLately != null && isLately) { + List resultList = new ArrayList<>(); + records.stream().max(Comparator.comparing(TreatRecord::getConsultDate)).ifPresent(resultList::add); + return Result.success(resultList); + } - for (TreatRecord record : records) { - if (record.getTreatNum() != null) { - record.setEnTreatNum(ReqParamHelper.encode(record.getTreatNum())); + for (TreatRecord record : records) { + if (record.getTreatNum() != null) { + record.setEnTreatNum(ReqParamHelper.encode(record.getTreatNum())); + } } + return Result.success(records); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); } - return Result.success(records); + } @@ -121,23 +130,27 @@ public class ReportAction extends BaseAction { */ @Action("getInspectByPatient") public Result getInspectByPatient(String openid, String patientId, String begDate, String endDate) { - patientId = getDecodeString(patientId); + try { + patientId = getDecodeString(patientId); - // http://localhost:8080/wx/report/getInspectByPatient.do?patientId=153671&token=123 - log.info("化验(检验)结果查询:patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); - if (patientId == null || begDate == null || endDate == null) { - return Result.error(ResultEnum.PARAM_IS_DEFECT); - } + // http://localhost:8080/wx/report/getInspectByPatient.do?patientId=153671&token=123 + log.info("化验(检验)结果查询:patientId={}, begDate={}, endDate={}", patientId, begDate, endDate); + if (patientId == null || begDate == null || endDate == null) { + return Result.error(ResultEnum.PARAM_IS_DEFECT); + } - List reportList = new HisReportDao().getInspectByPatient(patientId); + List reportList = new HisReportDao().getInspectByPatient(patientId); - List resultList = new ArrayList<>(); - for (InspectionReport report : reportList) { - if (report.getApplyDate() != null && DateHelper.inDateRange(begDate, endDate, report.getApplyDate(), DateHelper.DateEnum.yyyy_MM_dd)) { - resultList.add(report); + List resultList = new ArrayList<>(); + for (InspectionReport report : reportList) { + if (report.getApplyDate() != null && DateHelper.inDateRange(begDate, endDate, report.getApplyDate(), DateHelper.DateEnum.yyyy_MM_dd)) { + resultList.add(report); + } } + return Result.success(resultList); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); } - return Result.success(resultList); } /** @@ -145,41 +158,44 @@ public class ReportAction extends BaseAction { */ @Action("getInspectByTreatNum") public Result getInspectByTreatNum(String type, String treatNum, String patientId) { - treatNum = getDecodeString(treatNum); - patientId = getDecodeString(patientId); - // http://localhost:8080/wx/report/getInspectByTreatNum.do?patientId=153671&token=123 - log.info("[化验(检验)]结果查询:patientId={}, type={}, treatNum={}", patientId, type, treatNum); - if (patientId == null || type == null || treatNum == null) { - return Result.error(ResultEnum.PARAM_IS_BLANK); - } + try { + treatNum = getDecodeString(treatNum); + patientId = getDecodeString(patientId); + // http://localhost:8080/wx/report/getInspectByTreatNum.do?patientId=153671&token=123 + log.info("[化验(检验)]结果查询:patientId={}, type={}, treatNum={}", patientId, type, treatNum); + if (patientId == null || type == null || treatNum == null) { + return Result.error(ResultEnum.PARAM_IS_BLANK); + } - String mzNum = null, zyNum = null; - if ("1".equals(type)) { - mzNum = treatNum; - } else { - zyNum = treatNum; - } + String mzNum = null, zyNum = null; + if ("1".equals(type)) { + mzNum = treatNum; + } else { + zyNum = treatNum; + } + + ArrayList resultList = new ArrayList<>(); + XBDLisReport xbdLisReport; + List reports = new HisReportDao().getInspectByTreatNum(patientId, zyNum, mzNum); + for (InspectionReport report : reports) { + xbdLisReport = new XBDLisReport(); + xbdLisReport.setReportName(report.getName()); + xbdLisReport.setSpecimenName(report.getType()); + xbdLisReport.setReportDate(report.getReportDate()); + xbdLisReport.setReporter(report.getReportDoctName()); + xbdLisReport.setItem(report.getItem()); + xbdLisReport.setTreatId(report.getMzNum() != null ? report.getMzNum() : report.getZyNum()); + xbdLisReport.setBedNo(report.getBedNum()); - ArrayList resultList = new ArrayList<>(); - XBDLisReport xbdLisReport; - List reports = new HisReportDao().getInspectByTreatNum(patientId, zyNum, mzNum); - for (InspectionReport report : reports) { - xbdLisReport = new XBDLisReport(); - xbdLisReport.setReportName(report.getName()); - xbdLisReport.setSpecimenName(report.getType()); - xbdLisReport.setReportDate(report.getReportDate()); - xbdLisReport.setReporter(report.getReportDoctName()); - xbdLisReport.setItem(report.getItem()); - xbdLisReport.setTreatId(report.getMzNum() != null ? report.getMzNum() : report.getZyNum()); - xbdLisReport.setBedNo(report.getBedNum()); - - resultList.add(xbdLisReport); + resultList.add(xbdLisReport); + } + return Result.success(resultList); + } catch (Exception e) { + return Result.error(ResultEnum.INTERFACE_HIS_INVOKE_ERROR); } - return Result.success(resultList); } - // /** // * 根据openid查询检查报告 // */ diff --git a/src/main/java/com/ynxbd/common/dao/ReportDao.java b/src/main/java/com/ynxbd/common/dao/ReportDao.java index c834d79..5525aae 100644 --- a/src/main/java/com/ynxbd/common/dao/ReportDao.java +++ b/src/main/java/com/ynxbd/common/dao/ReportDao.java @@ -16,26 +16,26 @@ import java.util.List; @Slf4j public class ReportDao { - public boolean insertToday(Integer reportCount, String reportType, String remark){ + public boolean insertToday(Integer reportCount, String reportType, String remark) { String sql = "insert into report (UpdateTime, ReportCount, ReportType, Remark) values(now(),?,?,?)"; - return DataBase.insert(sql,ps-> { - ps.setInt(1,reportCount); - ps.setString(2,reportType); - ps.setString(3,remark); - })>0; + return DataBase.insert(sql, ps -> { + ps.setInt(1, reportCount); + ps.setString(2, reportType); + ps.setString(3, remark); + }) > 0; } - public boolean existToday(String reportType){ + public boolean existToday(String reportType) { String sql = "select ReportType from report where UpdateTime = DATE(now()) and ReportType = ?"; - return !DataBase.select(sql,String.class,ps -> { - ps.setString(1,reportType); + return !DataBase.select(sql, String.class, ps -> { + ps.setString(1, reportType); }).isEmpty(); } - public boolean updateCount(String reportType){ + public boolean updateCount(String reportType) { String sql = "update report set ReportCount = ReportCount+1 where UpdateTime = DATE(now()) and ReportType = ?"; - return DataBase.update(sql,ps->{ - ps.setString(1,reportType); - })>0; + return DataBase.update(sql, ps -> { + ps.setString(1, reportType); + }) > 0; } } diff --git a/src/main/java/com/ynxbd/common/dao/his/HisReportDao.java b/src/main/java/com/ynxbd/common/dao/his/HisReportDao.java index befcd6c..67ae11a 100644 --- a/src/main/java/com/ynxbd/common/dao/his/HisReportDao.java +++ b/src/main/java/com/ynxbd/common/dao/his/HisReportDao.java @@ -9,6 +9,7 @@ import com.ynxbd.common.bean.report.PEIS; 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.ServiceException; import lombok.extern.slf4j.Slf4j; import java.util.ArrayList; @@ -59,17 +60,15 @@ public class HisReportDao { * @param bedDate 开始时间 * @param endDate 结束时间 */ - public List getCheckByPatient(String patientId, String bedDate, String endDate) { - List reports = new ArrayList<>(); - + public List getCheckByPatient(String patientId, String bedDate, String endDate) throws ServiceException { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_CheckApplication, params -> { params.put("PatientID", patientId); }); - if (jsonResult.success()) { - reports = jsonResult.getDataMapList(CheckReport.class, "Report"); + if (!jsonResult.success()) { + throw new ServiceException(jsonResult.getMessage()); } - return reports; + return jsonResult.getDataMapList(CheckReport.class, "Report"); } @@ -80,16 +79,16 @@ public class HisReportDao { * @param idCardNo 身份证号码 * @return list */ - public List getPEISReportByPatient(String name, String idCardNo, String bedDate, String endDate) { - List reports = new ArrayList<>(); + public List getPEISReportByPatient(String name, String idCardNo, String bedDate, String endDate) throws ServiceException { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_PEISReport, params -> { params.put("Name", name); 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 患者 * @return 报告集合 */ - public List getInspectByPatient(String patientId) { - List reports = new ArrayList<>(); + public List getInspectByPatient(String patientId) throws ServiceException { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_InspectionApplication, params -> { params.put("PatientID", patientId); }); - if (jsonResult.success()) { - reports = jsonResult.getDataMapList(InspectionReport.class, "Report"); + if (!jsonResult.success()) { + throw new ServiceException(jsonResult.getMessage()); } - return reports; + return jsonResult.getDataMapList(InspectionReport.class, "Report"); } @@ -117,18 +115,17 @@ public class HisReportDao { * @param patientId 患者 * @return 报告集合 */ - public List getInspectByTreatNum(String patientId, String zyNum, String mzNum) { - List reportList = new ArrayList<>(); + public List getInspectByTreatNum(String patientId, String zyNum, String mzNum) throws ServiceException { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.AP_Query_InspectionApplication, params -> { params.put("PatientID", patientId); params.put("ZYNum", zyNum == null ? "" : zyNum); params.put("MZNum", mzNum == null ? "" : mzNum); }); - if (jsonResult.success()) { - reportList = jsonResult.getDataMapList(InspectionReport.class, "Report"); + if (!jsonResult.success()) { + throw new ServiceException(jsonResult.getMessage()); } - return reportList; + return jsonResult.getDataMapList(InspectionReport.class, "Report"); } /** @@ -136,36 +133,36 @@ public class HisReportDao { * * @return 就诊记录 */ - public List getTreatRecordList(String patientId, String begDate, String endDate, String patientType, String reportType,String deptCode) { - List resultList = new ArrayList<>(); + public List getTreatRecordList(String patientId, String begDate, String endDate, String patientType, String reportType, String deptCode) throws ServiceException { JsonResult jsonResult = HisHelper.getJsonResult(HisEnum.Query_TreatRecords, params -> { params.put("PatientId", patientId); params.put("BegDate", begDate); params.put("EndDate", endDate); - params.put("DeptCode",deptCode); + params.put("DeptCode", deptCode); params.put("InOutState", patientType == null ? "0" : patientType); // 0:全部; 1:门诊号; 2:住院号 params.put("CheckOrInspection", reportType == null ? "0" : reportType); // 0:全部; 1:检查; 2:检验; 3:检查+检验 }); - if (jsonResult.success()) { // 0成功 -1异常 - JSONArray jsonArray = jsonResult.getJsonArray("Records", "Record"); - - TreatRecord item; - JSONObject nodeItem; - for (int i = 0; i < jsonArray.size(); i++) { - nodeItem = jsonArray.getJSONObject(i); - item = new TreatRecord(); - - item.setInOutState(nodeItem.getString("InOutState")); - item.setTreatNum(nodeItem.getString("MZNum")); - item.setDeptCode(nodeItem.getString("DeptCode")); // 职称 - item.setDeptName(nodeItem.getString("DeptName")); // - item.setDoctCode(nodeItem.getString("DoctCode")); // - item.setDoctName(nodeItem.getString("DoctName")); // - item.setRegisterDate(nodeItem.getString("RegisterDate")); // 描述 - item.setConsultDate(nodeItem.getString("ConsultDate")); // 描述 - resultList.add(item); - } + if (!jsonResult.success()) { + throw new ServiceException(jsonResult.getMessage()); + } + List resultList = new ArrayList<>(); + JSONArray jsonArray = jsonResult.getJsonArray("Records", "Record"); + TreatRecord item; + JSONObject nodeItem; + for (int i = 0; i < jsonArray.size(); i++) { + nodeItem = jsonArray.getJSONObject(i); + item = new TreatRecord(); + + item.setInOutState(nodeItem.getString("InOutState")); + item.setTreatNum(nodeItem.getString("MZNum")); + item.setDeptCode(nodeItem.getString("DeptCode")); // 职称 + item.setDeptName(nodeItem.getString("DeptName")); // + item.setDoctCode(nodeItem.getString("DoctCode")); // + item.setDoctName(nodeItem.getString("DoctName")); // + item.setRegisterDate(nodeItem.getString("RegisterDate")); // 描述 + item.setConsultDate(nodeItem.getString("ConsultDate")); // 描述 + resultList.add(item); } return resultList; } diff --git a/src/main/java/com/ynxbd/common/result/ResultEnum.java b/src/main/java/com/ynxbd/common/result/ResultEnum.java index 15aa06f..2198a2e 100644 --- a/src/main/java/com/ynxbd/common/result/ResultEnum.java +++ b/src/main/java/com/ynxbd/common/result/ResultEnum.java @@ -28,7 +28,7 @@ public enum ResultEnum { PARAM_ADDRESS_ERROR(10007, "地址缺失"), PARAM_LIST_SIZE_ZERO(10008, "参数集为空"), PARAM_VERIFY_ERROR(10009, "参数验证失败"), - FACE_VERIFY_ERROR(10010,"人脸识别未通过"), + FACE_VERIFY_ERROR(10010, "人脸识别未通过"), DATE_IS_TODAY(10100, "日期不能为今天"), DATE_IS_ERROR(10101, "日期错误"), @@ -89,12 +89,12 @@ public enum ResultEnum { REFUND_RES_REG_NOT_ALLOW(30107, "[退费]预约挂号禁止退费"), REFUND_IS_REPEAT(30107, "[退费]订单已退费请勿重复申请"), REFUND_CASH_IS_NULL(30016, "[退费]现金不存在"), - REFUND_IS_FAIL_FOR_MD(30201,"[退费]医保挂号订单不允许线上退费,请到线下窗口进行退款"), + REFUND_IS_FAIL_FOR_MD(30201, "[退费]医保挂号订单不允许线上退费,请到线下窗口进行退款"), // 挂号 REG_TODAY_HAS(38100, "[挂号]同一天,同一科室,已挂过号"), REG_OCCUPY_SOURCE(38101, "[挂号]号源已被占用"), - REG_NOT_FIND(38102,"[退号]未查询到挂号支付信息;若是医保支付则不允许线上退号,请到窗口进行退费"), + REG_NOT_FIND(38102, "[退号]未查询到挂号支付信息;若是医保支付则不允许线上退号,请到窗口进行退费"), SELF_HELP_EXCEED_MAX(38190, "[自助申请单]今日检测数量已达最大限制"), // 处方 RECIPE_REPEAT_BILL(38200, "[处方]重复开单"), // 核酸重复开单提示-不要动 @@ -122,14 +122,15 @@ public enum ResultEnum { DATA_IS_DISABLED(50007, "数据已禁用"), /* 接口错误:60000-69999 */ + INTERFACE_INVOKE_ERROR(60000, "接口调用异常"), INTERFACE_WX_INVOKE_ERROR(61001, "【微信】接口调用异常"), INTERFACE_ALI_INVOKE_ERROR(62002, "【支付宝】接口调用异常"), INTERFACE_HIS_INVOKE_ERROR(69000, "【HIS】接口调用异常"), INTERFACE_HIS_DATA_ERROR(69001, "【HIS】接口返回数据异常"), INTERFACE_HIS_REQ_TIMEOUT(69408, "【HIS】接口请求超时"), INTERFACE_HIS_NO_DATA(69404, "【HIS】没有查找到数据"), - // - INTERFACE_INVOKE_ERROR(60000, "接口调用异常"), + // LIS + LIS_SELECT_DATA_ERROR(69501, "【LIS】查询数据异常"), INTERFACE_EXCEED_LOAD(60001, "接口负载过高"), INTERFACE_FORBID_VISIT(60002, "该接口禁止访问"), @@ -168,7 +169,7 @@ public enum ResultEnum { SMS_CODE_VERIFY_ERROR(90006, "验证码错误或已失效"), // 慢病 和 病历复印 - APPLY_REPEAT(100001,"申请已存在,请勿重复申请"); + APPLY_REPEAT(100001, "申请已存在,请勿重复申请"); public final Integer status; @@ -203,8 +204,8 @@ public enum ResultEnum { return this.name(); } - public String makeMessage(String message){ - if(message == null) message = ""; + public String makeMessage(String message) { + if (message == null) message = ""; return this.message + message; } diff --git a/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java b/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java index 6df9f6b..00e448c 100644 --- a/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java +++ b/src/main/java/com/ynxbd/wx/wxfactory/WxMedicalHelper.java @@ -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); + } + /** * [医保] 下载对账单