From 55e0c147082b740dba4ac31f57224375430fb525 Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Mon, 19 Jun 2023 09:23:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E7=9A=84=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E5=8D=B3=E6=98=AF=E4=BD=8F=E9=99=A2=E7=9A=84=E4=BA=A4=E5=8F=89?= =?UTF-8?q?=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/api/ShunDePeopleService.java | 15 ++++- .../api/impl/ShunDePeopleServiceImpl.java | 58 ++++++++++++------ .../docus/server/report/job/ReportJob.java | 61 +++++++++++++------ 3 files changed, 92 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/docus/server/report/api/ShunDePeopleService.java b/src/main/java/com/docus/server/report/api/ShunDePeopleService.java index f8bbe06..c6d3d28 100644 --- a/src/main/java/com/docus/server/report/api/ShunDePeopleService.java +++ b/src/main/java/com/docus/server/report/api/ShunDePeopleService.java @@ -11,12 +11,21 @@ import java.util.List; */ public interface ShunDePeopleService { /** - * 根据顺德人医第三方索引查询报告交叉索引 + * 根据顺德人医第三方索引查询门诊报告交叉索引 * * @param sdRyIndex 顺德人医第三方索引 - * @return 报告交叉索引 + * @return 门诊报告交叉索引 */ - List getSdRyReportJxIds(String sdRyIndex); + List getSdRyMzReportJxIds(String sdRyIndex); + + /** + * 根据顺德人医第三方索引查询住院报告交叉索引 + * + * @param sdRyIndex 顺德人医第三方索引 + * @return 住院报告交叉索引 + */ + List getSdRyZyReportJxIds(String sdRyIndex); + /** * 根据顺德人医的报告交叉索引,查询检查报告 diff --git a/src/main/java/com/docus/server/report/api/impl/ShunDePeopleServiceImpl.java b/src/main/java/com/docus/server/report/api/impl/ShunDePeopleServiceImpl.java index 70983a5..7263b19 100644 --- a/src/main/java/com/docus/server/report/api/impl/ShunDePeopleServiceImpl.java +++ b/src/main/java/com/docus/server/report/api/impl/ShunDePeopleServiceImpl.java @@ -54,9 +54,9 @@ public class ShunDePeopleServiceImpl implements ShunDePeopleService { String respBody = this.sendPost(url, requestParam); log.info("查询检查报告请求成功,响应参数:{}", respBody); TimeUnit.MILLISECONDS.sleep(sdRyReportQueryConfig.getReportQueryInspectInterval()); - return respBody; + return respBody; } catch (Exception ex) { - log.error("查询检查报告失败:"+ex.getMessage(), ex); + log.error("查询检查报告失败:" + ex.getMessage(), ex); return ""; } finally { INSPECT_REPORT_LOCK.unlock(); @@ -73,9 +73,9 @@ public class ShunDePeopleServiceImpl implements ShunDePeopleService { String respBody = this.sendPost(url, requestParam); log.info("查询LIS检验报告请求成功,响应参数:{}", respBody); TimeUnit.MILLISECONDS.sleep(sdRyReportQueryConfig.getReportQueryLisInterval()); - return respBody; + return respBody; } catch (Exception ex) { - log.error("查询LIS检验报告失败:"+ex.getMessage(), ex); + log.error("查询LIS检验报告失败:" + ex.getMessage(), ex); return ""; } finally { LIS_REPORT_LOCK.unlock(); @@ -83,17 +83,36 @@ public class ShunDePeopleServiceImpl implements ShunDePeopleService { } @Override - public List getSdRyReportJxIds(String sdRyIndex) { + public List getSdRyMzReportJxIds(String sdRyIndex) { List indexes = new ArrayList<>(); try { - String zyParam = organizationQuerySdRyReportIndexParam(sdRyIndex, 3); String mzParam = organizationQuerySdRyReportIndexParam(sdRyIndex, 1); - String[] zyParams = {"HIP1179", zyParam}; String[] mzParams = {"HIP1179", mzParam}; - List zyIndex = getIndex(zyParams); + return getSdRyReportJxIds(mzParams); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + return indexes; + } + + @Override + public List getSdRyZyReportJxIds(String sdRyIndex) { + List indexes = new ArrayList<>(); + try { + String zyParam = organizationQuerySdRyReportIndexParam(sdRyIndex, 3); + String[] zyParams = {"HIP1179", zyParam}; + return getSdRyReportJxIds(zyParams); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + } + return indexes; + } + + private List getSdRyReportJxIds(String[] qrIndexParams) { + List indexes = new ArrayList<>(); + try { + List zyIndex = getIndex(qrIndexParams); indexes.addAll(zyIndex); - List mzIndex = getIndex(mzParams); - indexes.addAll(mzIndex); } catch (Exception ex) { log.error(ex.getMessage(), ex); } @@ -140,13 +159,14 @@ public class ShunDePeopleServiceImpl implements ShunDePeopleService { + "&creationTime=" + Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI); } + private String organizationQuerySdRyInspectReportParam(SdJxReportDto dto) { String patientId = dto.getPatientId(); - if("1".equals(dto.getPatentTypeCode())){ - patientId="m"+patientId; + if ("1".equals(dto.getPatentTypeCode())) { + patientId = "m" + patientId; } - if("3".equals(dto.getPatentTypeCode())){ - patientId="z"+patientId; + if ("3".equals(dto.getPatentTypeCode())) { + patientId = "z" + patientId; } HashMap map = new HashMap<>(7); map.put("isPage", dto.isPage()); @@ -170,11 +190,11 @@ public class ShunDePeopleServiceImpl implements ShunDePeopleService { private String organizationQuerySdRyLisReportParam(SdJxReportDto dto) { String patientId = dto.getPatientId(); - if("1".equals(dto.getPatentTypeCode())){ - patientId="m"+patientId; + if ("1".equals(dto.getPatentTypeCode())) { + patientId = "m" + patientId; } - if("3".equals(dto.getPatentTypeCode())){ - patientId="z"+patientId; + if ("3".equals(dto.getPatentTypeCode())) { + patientId = "z" + patientId; } HashMap map = new HashMap<>(7); map.put("isPage", dto.isPage()); @@ -189,8 +209,6 @@ public class ShunDePeopleServiceImpl implements ShunDePeopleService { } - - private String getPdfReportBase64InputString(String examNo, String reportNo, SdPacsServerConfig config) { return "\n" + "\n" + diff --git a/src/main/java/com/docus/server/report/job/ReportJob.java b/src/main/java/com/docus/server/report/job/ReportJob.java index 1f24e2c..dae4a68 100644 --- a/src/main/java/com/docus/server/report/job/ReportJob.java +++ b/src/main/java/com/docus/server/report/job/ReportJob.java @@ -155,17 +155,22 @@ public class ReportJob { } private List getInspectReportList(TBasic tBasic) { + List reportDtoList = new ArrayList<>(); // 根据基础信息查顺德报告业务系统索引,查 交叉索引 - List sdRyReportPatientIds = getSdRyReportPatientIds(tBasic.getPatientId()); - if (sdRyReportPatientIds.isEmpty()) { - log.warn("patientId:{} 未查询到检查报告患者交叉索引", tBasic.getPatientId()); - return new ArrayList<>(); + List sdRyMzReportPatientIds = getSdRyMzReportPatientIds(tBasic.getPatientId()); + if (sdRyMzReportPatientIds.isEmpty()) { + log.warn("patientId:{} 未查询到门诊检查报告患者交叉索引", tBasic.getPatientId()); + } else { + // 根据门诊交叉索引查询报告 + for (String mzSdRyReportPatientId : sdRyMzReportPatientIds) { + List reportDtoList2 = getMzInspectReportBySdRyJxId(mzSdRyReportPatientId, tBasic); + reportDtoList.addAll(reportDtoList2); + } } - List reportDtoList = new ArrayList<>(); - // 根据交叉索引查询报告 - for (String sdRyReportPatientId : sdRyReportPatientIds) { - List reportDtoList2 = getInspectReportBySdRyJxId(sdRyReportPatientId, tBasic); - reportDtoList.addAll(reportDtoList2); + String sDryIndex = tBasicMapper.getSdRyIndexByPatientId(tBasic.getPatientId()); + if (Func.isNotBlank(sDryIndex)) { + List zyInspectReportDtos = getZyInspectReportBySdRyJxId(sDryIndex, tBasic); + reportDtoList.addAll(zyInspectReportDtos); } return reportDtoList; } @@ -261,7 +266,6 @@ public class ReportJob { sdJxReportDto.setPatentTypeCode("3"); sdJxReportDto.setOrgCode("4560886379"); String respBody = shunDePeopleService.getInspectReportByJxId(sdJxReportDto); - List reportDtoList = parseQuerySdRyInspectReport(respBody, tBasic); if (reportDtoList.isEmpty()) { break; @@ -343,7 +347,7 @@ public class ReportJob { } - private String saveBase64(String base64) throws IOException { + private String saveBase64(String base64) throws IOException { String dir; try { File current = new File("."); @@ -392,14 +396,14 @@ public class ReportJob { private List getLisReportList(TBasic tBasic) { // 根据基础信息查顺德报告业务系统索引,查 交叉索引 - List sdRyReportPatientIds = getSdRyReportPatientIds(tBasic.getPatientId()); - if (sdRyReportPatientIds.isEmpty()) { - log.warn("patientId:{} 未查询到Lis检验报告患者交叉索引", tBasic.getPatientId()); + List sdRyMzReportPatientIds = getSdRyMzReportPatientIds(tBasic.getPatientId()); + if (sdRyMzReportPatientIds.isEmpty()) { + log.warn("patientId:{} 未查询到门诊Lis检验报告患者交叉索引", tBasic.getPatientId()); return new ArrayList<>(); } List reportDtoList = new ArrayList<>(); // 根据交叉索引查询报告 - for (String sdRyReportPatientId : sdRyReportPatientIds) { + for (String sdRyReportPatientId : sdRyMzReportPatientIds) { List reportDtoList2 = getLisReportBySdRyJxId(sdRyReportPatientId, tBasic); reportDtoList.addAll(reportDtoList2); } @@ -577,25 +581,44 @@ public class ReportJob { /** - * 根据归档病案主键查询报告交叉索引 + * 根据归档病案主键查询门诊报告交叉索引 * * @param patientId 归档病案主键 - * @return 报告交叉索引 + * @return 门诊报告交叉索引 */ - private List getSdRyReportPatientIds(String patientId) { + private List getSdRyMzReportPatientIds(String patientId) { try { String sDryIndex = tBasicMapper.getSdRyIndexByPatientId(patientId); if (Func.isBlank(sDryIndex)) { log.warn("归档系统 patientId:{} 未关联到第三方索引", patientId); return new ArrayList<>(); } - return shunDePeopleService.getSdRyReportJxIds(sDryIndex); + return shunDePeopleService.getSdRyMzReportJxIds(sDryIndex); } catch (Exception ex) { log.error(ex.getMessage(), ex); return new ArrayList<>(); } } + /** + * 根据归档病案主键查询住院报告交叉索引 + * + * @param patientId 归档病案主键 + * @return 住院报告交叉索引 + */ + private List getSdRyZyReportPatientIds(String patientId) { + try { + String sDryIndex = tBasicMapper.getSdRyIndexByPatientId(patientId); + if (Func.isBlank(sDryIndex)) { + log.warn("归档系统 patientId:{} 未关联到第三方索引", patientId); + return new ArrayList<>(); + } + return shunDePeopleService.getSdRyZyReportJxIds(sDryIndex); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return new ArrayList<>(); + } + } private void refreshTime(AfJobTime afJobTime) { if (afJobTime.getId() == null) {