feat: 新增心电图封存病案采集

docus-active-query-service_1.3
wyb 2 years ago
parent 78140b9136
commit a3964beaf8

@ -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<String> 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<String> 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<String> 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());
}
}
}

@ -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();
}

@ -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<TBasic> 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<String, String> smCollectionTime = getSmCollectionTimeEcg(sdf.format(admissDate), sdf.format(disDate));
//通过jzh获取报告单号集合
List<String[]> 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<TBasic> 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<String[]> getExamNoEcg(String empId, String admissDate, String disDate) throws Exception {
private List<String[]> getExamNoEcg(String jzh, String admissDate, String disDate) throws Exception {
List<String[]> 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 + "---------");

Loading…
Cancel
Save