|
|
|
@ -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 + "---------");
|
|
|
|
|