修改master Entity

master
zengwh 3 years ago
parent b4fa323cc8
commit d584266629

@ -89,7 +89,7 @@ public class ArchiveMaster {
/** /**
* *
*/ */
private Date checkedDoctor; private String checkedDoctor;
/** /**

@ -3,6 +3,7 @@ package com.ann.job;
import com.ann.entity.filing.MessageSubordinate; import com.ann.entity.filing.MessageSubordinate;
import com.ann.service.MessageSubordinateService; import com.ann.service.MessageSubordinateService;
import com.ann.service.impl.QueueService; import com.ann.service.impl.QueueService;
import com.ann.utils.ExceptionPrintUtil;
import com.ann.utils.QuartzUtils; import com.ann.utils.QuartzUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@ -42,6 +43,7 @@ public class ScheduledJob implements Job {
List<MessageSubordinate> all = messageSubordinateService.findAllByStatus(0); List<MessageSubordinate> all = messageSubordinateService.findAllByStatus(0);
queueService.doSomething(all); queueService.doSomething(all);
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e);
// 如果报错-- 捕捉异常 继续执行 // 如果报错-- 捕捉异常 继续执行
logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]); logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]);
} }

@ -3,6 +3,7 @@ package com.ann.job;
import com.ann.entity.filing.MessageSubordinate; import com.ann.entity.filing.MessageSubordinate;
import com.ann.service.MessageSubordinateService; import com.ann.service.MessageSubordinateService;
import com.ann.service.impl.QueueService; import com.ann.service.impl.QueueService;
import com.ann.utils.ExceptionPrintUtil;
import com.ann.utils.QuartzUtils; import com.ann.utils.QuartzUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@ -42,6 +43,7 @@ public class ScheduledJob2 implements Job {
List<MessageSubordinate> all = messageSubordinateService.findAllMessageSubordinateByError(); List<MessageSubordinate> all = messageSubordinateService.findAllMessageSubordinateByError();
queueService.doSomethingByError(all); queueService.doSomethingByError(all);
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e);
// 如果报错-- 捕捉异常 继续执行 // 如果报错-- 捕捉异常 继续执行
logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]); logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]);
} }

@ -6,6 +6,7 @@ import com.ann.service.ArchiveMasterService;
import com.ann.service.MessageSubordinateService; import com.ann.service.MessageSubordinateService;
import com.ann.service.impl.GenerateService; import com.ann.service.impl.GenerateService;
import com.ann.service.impl.QueueService; import com.ann.service.impl.QueueService;
import com.ann.utils.ExceptionPrintUtil;
import com.ann.utils.QuartzUtils; import com.ann.utils.QuartzUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@ -44,6 +45,7 @@ public class ScheduledJob3 implements Job {
QuartzUtils.pauseScheduleJob(scheduler, "group1", "job3"); QuartzUtils.pauseScheduleJob(scheduler, "group1", "job3");
generateService.doSomethingBySendTime(); generateService.doSomethingBySendTime();
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e);
// 如果报错-- 捕捉异常 继续执行 // 如果报错-- 捕捉异常 继续执行
logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]); logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]);
} }

@ -3,6 +3,7 @@ package com.ann.job;
import com.ann.service.ArchiveMasterService; import com.ann.service.ArchiveMasterService;
import com.ann.service.impl.GenerateService; import com.ann.service.impl.GenerateService;
import com.ann.service.impl.QueueService; import com.ann.service.impl.QueueService;
import com.ann.utils.ExceptionPrintUtil;
import com.ann.utils.QuartzUtils; import com.ann.utils.QuartzUtils;
import org.quartz.Job; import org.quartz.Job;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
@ -38,6 +39,7 @@ public class ScheduledJob4 implements Job {
QuartzUtils.pauseScheduleJob(scheduler, "group1", "job4"); QuartzUtils.pauseScheduleJob(scheduler, "group1", "job4");
queueService.doSomethingByHIS(); queueService.doSomethingByHIS();
} catch (Exception e) { } catch (Exception e) {
ExceptionPrintUtil.printException(e);
// 如果报错-- 捕捉异常 继续执行 // 如果报错-- 捕捉异常 继续执行
logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]); logger.error("出错咯!错误信息为{},以及错误行数为:{}" ,e,e.getStackTrace()[0]);
} }

@ -1,5 +1,6 @@
package com.ann.job; package com.ann.job;
import com.ann.utils.ExceptionPrintUtil;
import org.quartz.*; import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.SchedulerFactoryBean; import org.springframework.scheduling.quartz.SchedulerFactoryBean;
@ -24,11 +25,16 @@ public class SchedulerAllJob {
* @throws SchedulerException * @throws SchedulerException
*/ */
public void scheduleJobs() throws SchedulerException { public void scheduleJobs() throws SchedulerException {
Scheduler scheduler = schedulerFactoryBean.getScheduler(); try {
scheduleJob1(scheduler); Scheduler scheduler = schedulerFactoryBean.getScheduler();
scheduleJob2(scheduler); scheduleJob1(scheduler);
scheduleJob3(scheduler); scheduleJob2(scheduler);
scheduleJob4(scheduler); scheduleJob3(scheduler);
scheduleJob4(scheduler);
} catch (SchedulerException e) {
ExceptionPrintUtil.printException(e);
e.printStackTrace();
}
} }
/** /**

@ -1,12 +1,16 @@
package com.ann.service.impl; package com.ann.service.impl;
import com.ann.entity.interfaceEntity.ArchiveMaster; import com.ann.entity.interfaceEntity.ArchiveMaster;
import com.ann.job.ScheduledJob;
import com.ann.service.ArchiveMasterService; import com.ann.service.ArchiveMasterService;
import com.ann.utils.ExceptionPrintUtil;
import com.ann.utils.WebServiceUtils; import com.ann.utils.WebServiceUtils;
import org.dom4j.Attribute; import org.dom4j.Attribute;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -20,6 +24,7 @@ import java.util.List;
*/ */
@Component @Component
public class GenerateService { public class GenerateService {
static final Logger logger = LoggerFactory.getLogger(GenerateService.class);
@Autowired @Autowired
ArchiveMasterService archiveMasterService; ArchiveMasterService archiveMasterService;
@ -36,51 +41,57 @@ public class GenerateService {
GenerateService.cancelSignContent = cancelSignContent; GenerateService.cancelSignContent = cancelSignContent;
} }
public void doSomethingBySendTime() throws Exception{ public void doSomethingBySendTime(){
List<ArchiveMaster> all = archiveMasterService.findArchiveMasterBySendTime(); try {
for (ArchiveMaster archiveMaster: all) { List<ArchiveMaster> all = archiveMasterService.findArchiveMasterBySendTime();
if(archiveMaster != null){ for (ArchiveMaster archiveMaster: all) {
//构建signContent if(archiveMaster != null){
String now = LocalDateTime.now().toString(); //构建signContent
Document signContentDocument = DocumentHelper.parseText(signContent); String now = LocalDateTime.now().toString();
Element root = signContentDocument.getRootElement(); Document signContentDocument = DocumentHelper.parseText(signContent);
Element patientStatu = root.element("patient_statu"); Element root = signContentDocument.getRootElement();
patientStatu.setText("0"); Element patientStatu = root.element("patient_statu");
Element patientId = root.element("patient_id"); patientStatu.setText("0");
patientId.setText(archiveMaster.getPatientId()+"|"+archiveMaster.getVisitId()); Element patientId = root.element("patient_id");
Element creationTime = root.element("mr_back_date_time"); patientId.setText(archiveMaster.getPatientId()+"|"+archiveMaster.getVisitId());
creationTime.setText(now); Element creationTime = root.element("mr_back_date_time");
Element man = root.element("mr_back_man"); creationTime.setText(now);
man.setText(archiveMaster.getFirstInstance()+""); Element man = root.element("mr_back_man");
String signReturn = signContentDocument.getRootElement().asXML(); man.setText(archiveMaster.getFirstInstance()+"");
//调用webservice String signReturn = signContentDocument.getRootElement().asXML();
Object[] objects = WebServiceUtils.connectEMR(signReturn); //调用webservice
if(objects != null){ Object[] objects = WebServiceUtils.connectEMR(signReturn);
//更新发送时间 if(objects != null){
archiveMasterService.updateSendTime(archiveMaster.getId(), now,0); //更新发送时间
archiveMasterService.updateSendTime(archiveMaster.getId(), now,0);
}
} }
} }
}
List<ArchiveMaster> archiveMasters = archiveMasterService.findArchiveMasterBySendBackAndSendTime(); List<ArchiveMaster> archiveMasters = archiveMasterService.findArchiveMasterBySendBackAndSendTime();
for (ArchiveMaster archiveMaster: archiveMasters) { for (ArchiveMaster archiveMaster: archiveMasters) {
if(archiveMaster != null){ if(archiveMaster != null){
//构建cancelSignContent //构建cancelSignContent
/* Document cancelSignDocument = DocumentHelper.parseText(cancelSignContent); /* Document cancelSignDocument = DocumentHelper.parseText(cancelSignContent);
Element cancelSignRoot = cancelSignDocument.getRootElement(); Element cancelSignRoot = cancelSignDocument.getRootElement();
Element patientStatu = cancelSignRoot.element("patient_statu"); Element patientStatu = cancelSignRoot.element("patient_statu");
patientStatu.setText("1"); patientStatu.setText("1");
Element patientId = cancelSignRoot.element("patient_id"); Element patientId = cancelSignRoot.element("patient_id");
patientId.setText(archiveMaster.getPatientId()+"|"+archiveMaster.getVisitId()); patientId.setText(archiveMaster.getPatientId()+"|"+archiveMaster.getVisitId());
String cancelSignReturn = cancelSignDocument.getRootElement().asXML(); String cancelSignReturn = cancelSignDocument.getRootElement().asXML();
//调用webservice //调用webservice
Object[] objects = WebServiceUtils.connectEMR(cancelSignReturn); Object[] objects = WebServiceUtils.connectEMR(cancelSignReturn);
if(objects != null){ if(objects != null){
//更新发送时间 //更新发送时间
archiveMasterService.updateSendTime(archiveMaster.getId(), null,1);
}*/
archiveMasterService.updateSendTime(archiveMaster.getId(), null,1); archiveMasterService.updateSendTime(archiveMaster.getId(), null,1);
}*/ }
archiveMasterService.updateSendTime(archiveMaster.getId(), null,1);
} }
} catch (Exception e) {
logger.error("签收业务出错了");
ExceptionPrintUtil.printException(e);
e.printStackTrace();
} }
} }

@ -0,0 +1,40 @@
package com.ann.utils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
/**
* @ProjectName:
* @Description:
* @Param
* @Return
* @Author:
* @CreateDate: 2020/8/4 14:18
* @UpdateUser:
* @UpdateDate: 2020/8/4 14:18
* @UpdateRemark:
* @Version: 1.0
*/
public class ExceptionPrintUtil {
private static Logger log = LogManager.getLogger(ExceptionPrintUtil.class);
public static void printException(Exception e){
//方法名
ByteArrayOutputStream baos = new ByteArrayOutputStream();
e.printStackTrace(new PrintStream(baos));
String exception = baos.toString();
log.error(exception);
try {
baos.flush();
baos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
Loading…
Cancel
Save