From bb5a4a552e742c7f8ce6f1f24e115b8f0d5a4f0a Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Thu, 11 Jan 2024 15:46:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=B0=81=E5=AD=98?= =?UTF-8?q?=E7=97=85=E6=A1=88=20=E5=86=85=E9=95=9C=20=E7=97=85=E5=8E=86?= =?UTF-8?q?=E9=87=87=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SealReportCollectController.java | 4 +- .../com/docus/bgts/facade/IBgtsService.java | 8 +++ .../docus/bgts/service/BgtsServiceImpl.java | 69 ++++++++++++++----- 3 files changed, 62 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/docus/bgts/controller/SealReportCollectController.java b/src/main/java/com/docus/bgts/controller/SealReportCollectController.java index 9a13a00..c7b3c4e 100644 --- a/src/main/java/com/docus/bgts/controller/SealReportCollectController.java +++ b/src/main/java/com/docus/bgts/controller/SealReportCollectController.java @@ -76,9 +76,7 @@ public class SealReportCollectController { public CommonResult collectSealEndoscopy(@RequestParam("sealId") String sealId) { log.info("封存病案采集 内镜 病历,封存id为:{}", sealId); try { - // todo 内镜 -// bgtsService.collect(empId); -// bgtsService.collectSealEndoscopy(sealId); + bgtsService.collectSealEndoscopy(sealId); log.info("封存病案采集 内镜 病历,封存id:{} 采集完成", sealId); return CommonResult.success("采集完成"); } catch (Exception e) { diff --git a/src/main/java/com/docus/bgts/facade/IBgtsService.java b/src/main/java/com/docus/bgts/facade/IBgtsService.java index edff52f..e717d66 100644 --- a/src/main/java/com/docus/bgts/facade/IBgtsService.java +++ b/src/main/java/com/docus/bgts/facade/IBgtsService.java @@ -6,6 +6,14 @@ public interface IBgtsService { */ void collect(String empId) throws Exception; + /** + * 根据封存id进行封存病案的内镜病历采集 + * @date 2024/1/11 10:27 + * @author YongBin Wen + * @param sealId 封存id + */ + void collectSealEndoscopy(String sealId) throws Exception; + void collectPacs(String empId,String admissDate,String disDate,String times) throws Exception; /** diff --git a/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java b/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java index a7491c0..d93fad9 100644 --- a/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java +++ b/src/main/java/com/docus/bgts/service/BgtsServiceImpl.java @@ -33,6 +33,7 @@ import org.dom4j.Element; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.io.ByteArrayInputStream; import java.text.ParseException; @@ -84,11 +85,15 @@ public class BgtsServiceImpl implements IBgtsService { public void collect(String empId) throws Exception { String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); List exams = new ArrayList<>(); + Map map = afCollectAddMapper.selectDate(empId); + SimpleDateFormat sdf = new SimpleDateFormat(FileUtils.getJsonByName("dateFormat").toString()); + String beginDate = sdf.format(map.get("admiss_date")); + String endDate = sdf.format(map.get("dis_date")); //通过empId获取报告单号集合 if (collectorid.equals("14")){ - exams = getExamNoNj(empId); + exams = getExamNoNj(empId,beginDate,endDate); }else { - exams = getExamNo(empId); + exams = getExamNo(empId,beginDate,endDate); } @@ -100,6 +105,36 @@ public class BgtsServiceImpl implements IBgtsService { collectExams(exams, empId, reportDownDto); } + @Override + @Transactional(rollbackFor = Exception.class) + public void collectSealEndoscopy(String sealId) throws Exception { + String collectorid = String.valueOf(FileUtils.getJsonByName("collectorid")); + TSeal seal = getSealAndCheckBySealId(sealId); + String jzh = seal.getJzh(); + Date admissDate = seal.getAdmissDate(); + Date disDate = getDisDateByJzh(jzh); + disDate = Objects.isNull(disDate) ? new Date() : disDate; + + SimpleDateFormat sdf = new SimpleDateFormat(FileUtils.getJsonByName("dateFormat").toString()); + String beginDate = sdf.format(admissDate); + String endDate = sdf.format(disDate); + + List exams; + //通过empId获取报告单号集合 + if (collectorid.equals("14")) { + exams = getExamNoNj(jzh, beginDate, endDate); + } else { + exams = getExamNo(jzh, beginDate, endDate); + } + + //获取插入表数据 + ReportDownDto reportDownDto = sealGetUrlCreateReportDto(exams, seal.getPatientId()); + //插入文件af_collect_task表数据 + afCollectTaskService.insert(reportDownDto); + //文件上报 + downloadPlatformRpc.sealReport(reportDownDto); + } + @Override public void collectPacs(String empId, String admissDate, String disDate, String times) throws Exception { SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd"); @@ -123,6 +158,7 @@ public class BgtsServiceImpl implements IBgtsService { } @Override + @Transactional(rollbackFor = Exception.class) public void collectSealPacs(String sealId) throws Exception{ TSeal seal = getSealAndCheckBySealId(sealId); @@ -144,7 +180,7 @@ public class BgtsServiceImpl implements IBgtsService { ReportDownDto reportDownDto = sealGetUrlCreateReportDto(exams, seal.getPatientId()); //插入文件af_collect_task表数据 afCollectTaskService.insert(reportDownDto); - //通过报告单号集合采集 + //文件上报 downloadPlatformRpc.sealReport(reportDownDto); } @@ -167,6 +203,7 @@ public class BgtsServiceImpl implements IBgtsService { } @Override + @Transactional(rollbackFor = Exception.class) public void collectSealEcg(String sealId) throws Exception{ TSeal seal = getSealAndCheckBySealId(sealId); String jzh = seal.getJzh(); @@ -186,7 +223,7 @@ public class BgtsServiceImpl implements IBgtsService { ReportDownDto reportDownDto = sealGetUrlCreateReportDto(exams, seal.getPatientId()); //插入文件af_collect_task表数据 afCollectTaskService.insert(reportDownDto); - //通过报告单号集合采集 + //文件上报 downloadPlatformRpc.sealReport(reportDownDto); } @@ -768,17 +805,17 @@ public class BgtsServiceImpl implements IBgtsService { /** * 通过empId获取报告单号集合 * - * @param empId + * @param jzh * @return */ - private List getExamNo(String empId) throws Exception { + private List getExamNo(String jzh,String beginDate,String endDate) throws Exception { List exams = new ArrayList<>(); XmlUtils reqXmlUtils = new XmlUtils(FileUtils.getXmlPath()); Element reqElement = reqXmlUtils.getMsgElement(); - Map map = afCollectAddMapper.selectDate(empId); - reqElement.element("INHOSP_NO").setText(empId); - reqElement.element("BEGIN_DATE").setText(new SimpleDateFormat(FileUtils.getJsonByName("dateFormat").toString()).format(map.get("admiss_date"))); - reqElement.element("END_DATE").setText(new SimpleDateFormat(FileUtils.getJsonByName("dateFormat").toString()).format(map.get("dis_date"))); + + reqElement.element("INHOSP_NO").setText(jzh); + reqElement.element("BEGIN_DATE").setText(beginDate); + reqElement.element("END_DATE").setText(endDate); logger.info("-------根据患者主索引号查询多个报告单号,地址:" + wsUrl + ",方法:" + wsLocalMethod + "---------"); String xml = reqXmlUtils.getDocument().asXML(); logger.info("---------------------------"); @@ -820,17 +857,17 @@ public class BgtsServiceImpl implements IBgtsService { /** * 通过empId获取报告单号集合 * - * @param empId + * @param jzh * @return */ - private List getExamNoNj(String empId) throws Exception { + private List getExamNoNj(String jzh,String beginDate,String endDate) throws Exception { List exams = new ArrayList<>(); XmlUtils reqXmlUtils = new XmlUtils(FileUtils.getXmlPath()); Element reqElement = reqXmlUtils.getMsgElement(); - Map map = afCollectAddMapper.selectDate(empId); - reqElement.element("INHOSP_NO").setText(empId); - reqElement.element("BEGIN_DATE").setText(new SimpleDateFormat(FileUtils.getJsonByName("dateFormat").toString()).format(map.get("admiss_date"))); - reqElement.element("END_DATE").setText(new SimpleDateFormat(FileUtils.getJsonByName("dateFormat").toString()).format(map.get("dis_date"))); + + reqElement.element("INHOSP_NO").setText(jzh); + reqElement.element("BEGIN_DATE").setText(beginDate); + reqElement.element("END_DATE").setText(endDate); logger.info("-------根据患者主索引号查询多个报告单号,地址:" + wsUrl + ",方法:" + wsLocalMethod + "---------"); String xml = reqXmlUtils.getDocument().asXML(); logger.info("---------------------------");