|
|
|
@ -9,11 +9,13 @@ import com.docus.bgts.enums.Codes;
|
|
|
|
|
import com.docus.bgts.facade.IAfCollectTaskService;
|
|
|
|
|
import com.docus.bgts.facade.IBgtsService;
|
|
|
|
|
import com.docus.bgts.mapper.dbmysql.AfCollectAddMapper;
|
|
|
|
|
import com.docus.bgts.mapper.dbmysql.AfCollectTaskMapper;
|
|
|
|
|
import com.docus.bgts.mapper.dbmysql.AfInterfaceCollectSubMapper;
|
|
|
|
|
import com.docus.bgts.mapper.dbmysql.MrReportErrorMapper;
|
|
|
|
|
import com.docus.bgts.mapper.dboracle.VDocumentPdfMapper;
|
|
|
|
|
import com.docus.bgts.utils.*;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
|
|
|
import org.apache.cxf.endpoint.Client;
|
|
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
@ -22,6 +24,8 @@ import org.dom4j.DocumentHelper;
|
|
|
|
|
import org.dom4j.Element;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
|
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -53,6 +57,10 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
@Autowired
|
|
|
|
|
AfCollectAddMapper afCollectAddMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
AfCollectTaskMapper afCollectTaskMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void collect(String empId) throws Exception {
|
|
|
|
|
//通过empId获取报告单号集合
|
|
|
|
@ -160,13 +168,19 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
String post;
|
|
|
|
|
try {
|
|
|
|
|
afCollectTaskService.insert(reportDownDto);
|
|
|
|
|
//String uploadConnector = String.valueOf(FileUtils.getJsonByName("uploadConnector"));
|
|
|
|
|
post = HttpUtils.post(String.valueOf(FileUtils.getJsonByName(Codes.UPLOAD.getMessage())), headMap, JSON.parseObject(JSON.toJSONString(reportDownDto), Map.class));
|
|
|
|
|
Map resMap = JSON.parseObject(post, Map.class);
|
|
|
|
|
logger.info(reportDownDto);
|
|
|
|
|
if (String.valueOf(resMap.get("code")).equals("500")) {
|
|
|
|
|
throw new RuntimeException(String.valueOf(resMap.get("msg")));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
//打印错误日志
|
|
|
|
|
logger.info("采集出错:"+reportDownDto);
|
|
|
|
|
logger.info(e);
|
|
|
|
|
String stackTrace = ExceptionUtils.getStackTrace(e);
|
|
|
|
|
logger.info("错误信息----------"+stackTrace);
|
|
|
|
|
addMrReportErrorLog(reportDownDto);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
@ -347,6 +361,42 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据时间批量按需采集
|
|
|
|
|
* @param startDate 开始时间
|
|
|
|
|
* @param endDate 结束时间
|
|
|
|
|
* @param collectorId 采集器编号
|
|
|
|
|
*/
|
|
|
|
|
public void collectByDate(String startDate,String endDate,String collectorId){
|
|
|
|
|
//通过日期查询patientId集合
|
|
|
|
|
List<String> patientIds = afCollectTaskService.getjzhByDate(startDate,endDate);
|
|
|
|
|
//通过patientId集合与采集器编号查询报告单号
|
|
|
|
|
//List<String> c1s = afCollectTaskMapper.getC1ByPatientId(patientIds,collectorId);
|
|
|
|
|
List<String> c1s = afCollectTaskService.getC1ByPatientId(patientIds, collectorId);
|
|
|
|
|
//通过唯一报告单号查询patient_id
|
|
|
|
|
List<String> patientIdByC1 = afCollectTaskService.getPatientIdByC1(c1s);
|
|
|
|
|
//通过patientId集合查询jzh
|
|
|
|
|
//List<String> jzhs = afCollectTaskMapper.getJzhByPatientId(patientIds);
|
|
|
|
|
List<String> jzhs = afCollectTaskService.getJzhByPatientId(patientIdByC1);
|
|
|
|
|
int i = -1;
|
|
|
|
|
//循环jzh与报告单号c1调用按需采集
|
|
|
|
|
for (String c1 : c1s) {
|
|
|
|
|
try {
|
|
|
|
|
if (i<c1s.size()) {
|
|
|
|
|
i++;
|
|
|
|
|
//System.err.println(c1s.get(i) + "--------" + jzhs.get(i));
|
|
|
|
|
//HttpUtils.get("127.0.0.1:"+port+"/collectByExamNo?emamNo="+c1+"&empId="+jzh);
|
|
|
|
|
collectByExamNo(c1s.get(i), jzhs.get(i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 调用web service
|
|
|
|
|
*
|
|
|
|
@ -365,5 +415,5 @@ public class BgtsServiceImpl implements IBgtsService {
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|