住院检查,报告和住院次数匹配

3.2.4.44
wyb 2 years ago
parent 8d828e0e2c
commit 40f1f6ae97

@ -67,6 +67,17 @@ public class ReportDto {
*/
private Integer downtype = 1;
/**
* id12+
*
*/
private String visitSn;
/**
* id
*/
private String patientSn;
/**
*

@ -249,7 +249,6 @@ public class ReportJob {
}
/**
*
*
@ -468,7 +467,7 @@ public class ReportJob {
AtomicInteger reportTotalCount = new AtomicInteger(0);
// 已经查询的条数
int alreadyQrCount = 0;
do {
Integer admissTimes = tBasic.getAdmissTimes();
Date admissDate = tBasic.getAdmissDate();
Date disDate = tBasic.getDisDate();
if (admissDate == null || disDate == null) {
@ -483,7 +482,7 @@ public class ReportJob {
LocalDate disLocalDate = disDateInstant.atZone(zoneId).toLocalDate();
String startTime = startTimeLocalDate.toString() + " 00:00:00";
String endTime = disLocalDate.toString() + " 23:59:59";
do {
SdJxReportDto sdJxReportDto = new SdJxReportDto();
sdJxReportDto.setPage(true);
sdJxReportDto.setPageNo(pageNum);
@ -496,6 +495,8 @@ public class ReportJob {
String respBody = shunDePeopleService.getInspectReportByJxId(sdJxReportDto);
alreadyQrCount += pageSize;
List<ReportDto> reportDtoList = parseQuerySdRyInspectReport(respBody, tBasic, reportTotalCount);
// 住院次数不是本次的,不需要
reportDtoList = reportDtoList.stream().filter(t -> admissTimes.equals(getAdmissTimes(t.getVisitSn(), t.getPatientSn()))).collect(Collectors.toList());
reportDtos.addAll(reportDtoList);
// 解析之后,总数已经赋值了,判断已经查询的数量是否已经满足总数
if (reportTotalCount.get() == 0 || alreadyQrCount >= reportTotalCount.get()) {
@ -510,6 +511,18 @@ public class ReportJob {
}
}
/**
*
*
* @param visitSn id12+
* @param patientSn id
* @return
*/
private static Integer getAdmissTimes(String visitSn, String patientSn) {
patientSn = patientSn.replace("m", "").replace("z", "");
String admissTimesStr = visitSn.replace(patientSn, "");
return Integer.valueOf(admissTimesStr);
}
private List<ReportDto> parseQuerySdRyInspectReport(String respBody, TBasic tBasic, AtomicInteger reportTotalCount) {
JSONObject jsonObject = Func.readJson(respBody, JSONObject.class);
@ -541,6 +554,18 @@ public class ReportJob {
List<JSONObject> reportObjectList = Func.parseJsonArray(resultJsonStr, JSONObject.class);
if (Func.isNotEmpty(reportObjectList)) {
for (JSONObject reportObject : reportObjectList) {
// 系统修改
String updateBy = String.valueOf(reportObject.get("UPDATEBY"));
if (config != null && Func.isNotBlank(config.getHandlerSystem())) {
String handlerSystem = config.getHandlerSystem().toLowerCase();
List<String> handlerSystems = Arrays.asList(handlerSystem.split(","));
if (!handlerSystems.contains(updateBy.toLowerCase())) {
continue;
}
} else {
continue;
}
// 检查报告号
String examReportSn = String.valueOf(reportObject.get("EXAM_REPORT_SN"));
// 申请单号
@ -549,8 +574,11 @@ public class ReportJob {
String pdfUrl = String.valueOf(reportObject.get("FILE_PATH"));
// 报告名称
String reportName = String.valueOf(reportObject.get("REPORT_NAME"));
// 系统修改
String updateBy = String.valueOf(reportObject.get("UPDATEBY"));
// 患者本次就诊唯一键患者id【12位】+就诊次数
String visitSn = String.valueOf(reportObject.get("VISIT_SN"));
// 患者id
String patientSn = String.valueOf(reportObject.get("PATIENT_SN"));
ReportDto reportDto = new ReportDto();
reportDto.setAdmisstimes(tBasic.getAdmissTimes());
@ -558,15 +586,8 @@ public class ReportJob {
// 确定报告唯一 报告单号+申请单号
reportDto.setSerialnum(examReportSn + requestSn);
reportDto.setFileTitle(reportName);
if (config != null && Func.isNotBlank(config.getHandlerSystem())) {
String handlerSystem = config.getHandlerSystem().toLowerCase();
List<String> handlerSystems = Arrays.asList(handlerSystem.split(","));
if (!handlerSystems.contains(updateBy.toLowerCase())) {
continue;
}
} else {
continue;
}
reportDto.setVisitSn(visitSn);
reportDto.setPatientSn(patientSn);
// 检查报告需要从Pacs接口获取base64
String[] split = examReportSn.split("_");

Loading…
Cancel
Save