diff --git a/src/main/java/com/docus/bgts/controller/SealReportCollectController.java b/src/main/java/com/docus/bgts/controller/SealReportCollectController.java index 5fbe1e0..9a13a00 100644 --- a/src/main/java/com/docus/bgts/controller/SealReportCollectController.java +++ b/src/main/java/com/docus/bgts/controller/SealReportCollectController.java @@ -35,7 +35,7 @@ public class SealReportCollectController { @ApiOperation("封存病案Pacs采集接口") @ApiImplicitParams({ - @ApiImplicitParam(name = "sealId", value = "t_seal 的seal_id,封存id", required = true, dataTypeClass = String.class), + @ApiImplicitParam(name = "sealId", value = "t_seal 的seal_id,封存id", required = true, dataTypeClass = String.class) }) @GetMapping("/pacs") public CommonResult collectSealPacs(@RequestParam("sealId") String sealId) { @@ -50,4 +50,42 @@ public class SealReportCollectController { } } + + @ApiOperation("心电采集接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "sealId", value = "t_seal 的seal_id,封存id", required = true, dataTypeClass = String.class) + }) + @GetMapping("/ecg") + public CommonResult collectSealEcg(@RequestParam("sealId") String sealId) { + log.info("封存病案采集 心电图 病历,封存id为:{}", sealId); + try { + bgtsService.collectSealEcg(sealId); + log.info("封存病案采集 心电图 病历,封存id:{} 采集完成", sealId); + return CommonResult.success("采集完成"); + } catch (Exception e) { + log.error("封存id:" + sealId + " 封存病案采集 心电图 病历,出现异常!", e); + return CommonResult.failed(e.getMessage()); + } + } + + @ApiOperation("内镜采集接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "sealId", value = "t_seal 的seal_id,封存id", required = true, dataTypeClass = String.class) + }) + @GetMapping("/endoscopy") + public CommonResult collectSealEndoscopy(@RequestParam("sealId") String sealId) { + log.info("封存病案采集 内镜 病历,封存id为:{}", sealId); + try { + // todo 内镜 +// bgtsService.collect(empId); +// bgtsService.collectSealEndoscopy(sealId); + log.info("封存病案采集 内镜 病历,封存id:{} 采集完成", sealId); + return CommonResult.success("采集完成"); + } catch (Exception e) { + log.error("封存id:" + sealId + " 封存病案采集 内镜 病历,出现异常!", e); + return CommonResult.failed(e.getMessage()); + } + } + + } diff --git a/src/main/java/com/docus/bgts/facade/IBgtsService.java b/src/main/java/com/docus/bgts/facade/IBgtsService.java index b5a17e6..edff52f 100644 --- a/src/main/java/com/docus/bgts/facade/IBgtsService.java +++ b/src/main/java/com/docus/bgts/facade/IBgtsService.java @@ -18,6 +18,13 @@ public interface IBgtsService { void collectEcg(String empId,String admissDate,String disDate,String times) throws Exception; + /** + * 根据封存id进行封存病案的 心电图 病历采集 + * @date 2024/1/11 10:27 + * @author YongBin Wen + * @param sealId 封存id + */ + void collectSealEcg(String sealId) throws Exception; void collectPacss(); /** @@ -47,4 +54,5 @@ public interface IBgtsService { void timerCollect(); + } diff --git a/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java b/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java index 5d2befd..a7491c0 100644 --- a/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java +++ b/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java @@ -2,7 +2,6 @@ package com.docus.bgts.service; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -126,32 +125,17 @@ public class BgtsServiceImpl implements IBgtsService { @Override public void collectSealPacs(String sealId) throws Exception{ TSeal seal = getSealAndCheckBySealId(sealId); - if (Objects.isNull(seal.getAdmissDate())) { - throw new RuntimeException("sealId:" + sealId + " 封存病案信息 入院日期 为空!"); - } - String jzh = seal.getJzh(); - if (StrUtil.isBlank(jzh)) { - throw new RuntimeException("sealId:" + sealId + " 封存病案信息 记账号 为空!"); - } + String inpatientNo = seal.getInpatientNo(); if (StrUtil.isBlank(inpatientNo)) { throw new RuntimeException("sealId:" + sealId + " 封存病案信息 病案号 为空!"); } + String jzh = seal.getJzh(); Date admissDate = seal.getAdmissDate(); // 如果是在院的,默认出院时间为现在 - Date disDate = new Date(); - - // 获取如果有出院的基础信息,得到真实的出院时间 - TBasic basicCondition = new TBasic(); - basicCondition.setJzh(jzh); - List basicInfo = afCollectTaskService.getBasicInfo(basicCondition); - if (CollUtil.isNotEmpty(basicInfo)) { - TBasic basic = basicInfo.get(0); - if (ObjectUtil.isNotNull(basic.getDisDate())) { - disDate = basic.getDisDate(); - } - } + Date disDate = getDisDateByJzh(jzh); + disDate = Objects.isNull(disDate) ? new Date() : disDate; String pattern = "yyyy-MM-dd"; SimpleDateFormat sdf = new SimpleDateFormat(pattern); @@ -182,6 +166,48 @@ public class BgtsServiceImpl implements IBgtsService { collectExams(exams, empId, reportDownDto); } + @Override + public void collectSealEcg(String sealId) throws Exception{ + TSeal seal = getSealAndCheckBySealId(sealId); + String jzh = seal.getJzh(); + Date admissDate = seal.getAdmissDate(); + // 如果是在院的,默认出院时间为现在 + Date disDate = getDisDateByJzh(jzh); + disDate = disDate == null ? new Date() : disDate; + + String pattern = "yyyy-MM-dd HH:mm:ss"; + SimpleDateFormat sdf = new SimpleDateFormat(pattern); + Map smCollectionTime = getSmCollectionTimeEcg(sdf.format(admissDate), sdf.format(disDate)); + + //通过jzh获取报告单号集合 + List exams = getExamNoEcg(jzh, smCollectionTime.get("admissDate"), smCollectionTime.get("disDate")); + + //获取插入表数据 + ReportDownDto reportDownDto = sealGetUrlCreateReportDto(exams, seal.getPatientId()); + //插入文件af_collect_task表数据 + afCollectTaskService.insert(reportDownDto); + //通过报告单号集合采集 + downloadPlatformRpc.sealReport(reportDownDto); + } + + /** + * 根据记账号获得病案的出院时间 + * + * @param jzh 记账号 + * @return java.util.Date + * @date 2024/1/11 15:19 + * @author YongBin Wen + */ + private Date getDisDateByJzh(String jzh) { + TBasic basicCondition = new TBasic(); + basicCondition.setJzh(jzh); + List basicInfo = afCollectTaskService.getBasicInfo(basicCondition); + if (CollUtil.isEmpty(basicInfo)) { + return null; + } + TBasic basic = basicInfo.get(0); + return basic.getDisDate(); + } @Override public void collectByExamNo(String emamNo, String empId) throws Exception { @@ -339,6 +365,12 @@ public class BgtsServiceImpl implements IBgtsService { if (Objects.isNull(seal)) { throw new RuntimeException("sealId:" + sealId + " 未找到封存病案信息!"); } + if (Objects.isNull(seal.getAdmissDate())) { + throw new RuntimeException("sealId:" + sealId + " 封存病案信息 入院日期 为空!"); + } + if (StrUtil.isBlank(seal.getJzh())) { + throw new RuntimeException("sealId:" + sealId + " 封存病案信息 记账号 为空!"); + } return seal; } /** @@ -948,14 +980,14 @@ public class BgtsServiceImpl implements IBgtsService { /** * 通过empId获取报告单号集合 动态心电 * - * @param empId + * @param jzh * @return */ - private List getExamNoEcg(String empId, String admissDate, String disDate) throws Exception { + private List getExamNoEcg(String jzh, String admissDate, String disDate) throws Exception { List exams = new ArrayList<>(); XmlUtils reqXmlUtils = new XmlUtils(FileUtils.getXmlPath()); Element reqElement = reqXmlUtils.getMsgElement(); - reqElement.element("INHOSP_NO").setText(empId); + reqElement.element("INHOSP_NO").setText(jzh); reqElement.element("BEGIN_DATE").setText(String.valueOf(admissDate)); reqElement.element("END_DATE").setText(String.valueOf(disDate)); logger.info("-------根据患者主索引号查询多个报告单号,地址:" + wsUrl + ",方法:" + wsLocalMethod + "---------");