|
|
|
@ -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<PEIS> 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<PEIS> 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<PEIS> reportList = new HisReportDao().getPEISReportByPatient(name, idCardNo, begDate, endDate); |
|
|
|
|
List<PEIS> 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<CheckReport> reportList = new HisReportDao().getCheckByPatient(patientId, begDate, endDate); |
|
|
|
|
List<CheckReport> reportList = new HisReportDao().getCheckByPatient(patientId, begDate, endDate); |
|
|
|
|
|
|
|
|
|
List<CheckReport> 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<CheckReport> 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<TreatRecord> 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<TreatRecord> resultList = new ArrayList<>(); |
|
|
|
|
List<TreatRecord> 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<TreatRecord> 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<InspectionReport> reportList = new HisReportDao().getInspectByPatient(patientId); |
|
|
|
|
List<InspectionReport> reportList = new HisReportDao().getInspectByPatient(patientId); |
|
|
|
|
|
|
|
|
|
List<InspectionReport> 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<InspectionReport> 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<XBDLisReport> resultList = new ArrayList<>(); |
|
|
|
|
XBDLisReport xbdLisReport; |
|
|
|
|
List<InspectionReport> 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<XBDLisReport> resultList = new ArrayList<>(); |
|
|
|
|
XBDLisReport xbdLisReport; |
|
|
|
|
List<InspectionReport> 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查询检查报告
|
|
|
|
|
// */
|
|
|
|
|