Browse Source

获取就诊卡

Trick 5 years ago
parent
commit
c54843d44e

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -232,7 +232,7 @@ public class EntranceService {
        if(res!=null&&res.size()>0){
            Iterator it = res.iterator();
            if(it.hasNext()){
                JSONObject rs = (JSONObject) it.next();
                net.sf.json.JSONObject rs = (net.sf.json.JSONObject) it.next();
                String stat = rs.getString("CARD_STAT");
                if(!"激活".equals(stat)){
                    it.remove();

+ 2 - 2
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/DataUploadJob.java

@ -21,13 +21,13 @@ public class DataUploadJob implements Job {
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========DataUploadJob========");
        try {
            //1、获取 JOB 执行区间  执行时间点的前一天  时间点定在每天的 00:00:00 执行,同步前一天的数据
            //1、获取 JOB 执行区间  执行时间点的前一天  时间点定在每天的 02:00:00 执行,同步前一天的数据
            String endDate = DateUtil.dateToStrLong(DateUtil.getNow());
            String startDate = DateUtil.dateToStrLong(DateUtil.getPreDays(DateUtil.getNow(),1));
            String res = "";
            // 2、分步执行需要JOB执行的服务
            //2、分步执行需要JOB执行的服务
            logger.info("START========2.5 网上预约挂号上传开始========");
            try {
                res = internetService.upAppointmentOnline(startDate,endDate,null);

+ 3 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/QuartzHelper.java

@ -55,7 +55,9 @@ public class QuartzHelper {
    public void removeJob(String jobKeyString) throws Exception {
        TriggerKey triggerKey = new TriggerKey("trigger-name:" + jobKeyString,
                "trigger-group:" + jobKeyString);
        JobKey jobName = new JobKey("job-group:" + jobKeyString, "job-id:"
//        JobKey jobName = new JobKey("job-group:" + jobKeyString, "job-id:"
//                + jobKeyString);
        JobKey jobName = new JobKey("job-id:" + jobKeyString, "job-group:"
                + jobKeyString);
        scheduler.pauseTrigger(triggerKey);// 停止触发器
        scheduler.unscheduleJob(triggerKey);// 移除触发器

+ 53 - 15
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -4,11 +4,13 @@ import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.internet.service.DataGeneratorService;
import com.yihu.jw.internet.service.InternetService;
import com.yihu.jw.job.DataUploadJob;
import com.yihu.jw.job.PrescriptionOverdueJob;
import com.yihu.jw.job.PrescriptionStatusUpdateJob;
import com.yihu.jw.job.QuartzHelper;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.SystemConf;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.web.BaseController;
import io.swagger.annotations.Api;
@ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
@ -52,29 +55,64 @@ public class JobController extends BaseController {
        this.quartzHelper = quartzHelper;
    }
    /**
     * 启动任务
     *
     * @param id id
     * @return
     */
    @RequestMapping(value = "startNowById", method = RequestMethod.GET)
    public String startNowById(String id) {
        try {
            jobService.startNowById(id);
            return success("启动成功!");
    @RequestMapping(value = "removeJob", method = RequestMethod.GET)
    public String removeJob(String taskId) {
        try {
            if(quartzHelper.isExistJob(taskId)){
                quartzHelper.removeJob(taskId);
                return success("删除成功!");
            }
            return success("删除成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
            return invalidUserException(e, -1, "删除失败:" + e.getMessage());
        }
    }
    @RequestMapping(value = "isExist", method = RequestMethod.GET)
    public String isExist(String id) {
    public String isExist(String taskId) {
        try {
            if(quartzHelper.isExistJob(taskId)){
                return success("job已经存在!");
            }
            return success("job不存在!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "执行失败:" + e.getMessage());
        }
    }
    @RequestMapping(value = "reStartById", method = RequestMethod.GET)
    public String reStartById(String taskId) {
        try {
            if(quartzHelper.isExistJob(id)){
                return success("启动成功!");
            if(quartzHelper.isExistJob(taskId)){
                quartzHelper.removeJob(taskId);
            }
            switch(taskId){
                case "prescription_overdue_job":
                    if (!quartzHelper.isExistJob("prescription_overdue_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prescription_overdue_job");
                        quartzHelper.addJob(PrescriptionOverdueJob.class, trigger, "prescription_overdue_job", new HashMap<String, Object>());
                        logger.info("prescription_overdue_job  job success");
                    } else {
                        logger.info("prescription_overdue_job  job exist");
                    }
                    break;
                case "data_upload_job" :
                    //互联网医院 监管平台上报
                    if (!quartzHelper.isExistJob("data_upload_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("data_upload_job");
                        quartzHelper.addJob(DataUploadJob.class, trigger, "data_upload_job", new HashMap<String, Object>());
                        logger.info("data_upload_job  job success");
                    } else {
                        logger.info("data_upload_job  job exist");
                    }
                    break;
                default :
            }
            return success("启动失败!");

+ 1 - 1
svr/svr-internet-hospital-job/src/main/resources/system.properties

@ -5,7 +5,7 @@ prescriptionStatus_update_job=0 */2 * * * ?
# 门诊记录过期job,每天1 点触发
prescription_overdue_job=0 0 1 * * ?
#每天1 点触发
#每天2 点触发
data_upload_job=0 0 2 * * ?
#data_upload_25_job=0 0 1 * * ?