Browse Source

定时任务修改

wangjun 4 years ago
parent
commit
d78401b2ea

+ 13 - 3
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -126,7 +126,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
    //根据患者id查询关联家属
    //根据患者id查询关联家属
    public List<Map<String,Object>> findFamilyByPatientId(String patientId) throws ParseException {
    public List<Map<String,Object>> findFamilyByPatientId(String patientId) throws ParseException {
        String sql = "select t.card_type as \"cardType\", t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\"," +
        String sql = "select t.id as \"id\",t.card_type as \"cardType\", t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\"," +
                "b.birthday as\"birthday\",b.idcard as \"idcard\",c.relation_name as \"relationName\" " +
                "b.birthday as\"birthday\",b.idcard as \"idcard\",c.relation_name as \"relationName\" " +
                " from wlyy_patient_family_member t left join base_patient b" +
                " from wlyy_patient_family_member t left join base_patient b" +
                " on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id where 1=1";
                " on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id where 1=1";
@ -182,16 +182,26 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        }
        }
    }
    }
    //获取单个亲属详细信息
    //获取单个亲属详细信息
    public List<Map<String,Object>>  findMemberById(String id){
    public List<Map<String,Object>>  findMemberById(String id) throws ParseException {
        String sql="select t.id as \"id\",t.card_type as \"cardType\",t.patient as \"patient\"," +
        String sql="select t.id as \"id\",t.card_type as \"cardType\",t.patient as \"patient\"," +
                "b.name as \"name\",b.idcard as \"idcard\",b.mobile as \"mobile\"," +
                "b.name as \"name\",b.idcard as \"idcard\",b.mobile as \"mobile\"," +
                "c.relation_name \"relation_name\" from wlyy_patient_family_member t left join base_patient b" +
                "c.relation_name \"relationName\",b.birthday as\"birthday\",b.sex as\"sex\"" +
                " from wlyy_patient_family_member t left join base_patient b" +
                " on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id " +
                " on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id " +
                " where 1=1";
                " where 1=1";
        if (StringUtils.isNotBlank(id)){
        if (StringUtils.isNotBlank(id)){
            sql+=" and t.id='"+id+"'";
            sql+=" and t.id='"+id+"'";
        }
        }
       List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
       List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        if (list.size()>0){
            for (Map<String,Object> map:list){
                if (map.get("birthday")!=null){
                    SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
                    int age = getAgeByBirth(sp.parse(map.get("birthday").toString()));
                    map.put("age",age);
                }
            }
        }
        return list;
        return list;
    }
    }
}
}

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

@ -42,7 +42,7 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("from WlyyOutpatientDO a where a.status in(1,2) and a.payStatus = 1")
    @Query("from WlyyOutpatientDO a where a.status in(1,2) and a.payStatus = 1")
    List<WlyyOutpatientDO> findByStatus();
    List<WlyyOutpatientDO> findByStatus();
    @Query("from WlyyOutpatientDO a where a.status in(1,2) and a.payStatus = 1 and a.createTime<'2020-08-31 23:59:59' and a.createTime>'2020-08-31 00:00:00'")
    @Query("from WlyyOutpatientDO a where a.status in(1,2) and a.payStatus = 1 and a.createTime<'2020-08-31 23:59:59'")
    List<WlyyOutpatientDO> findPreviousByStatus();
    List<WlyyOutpatientDO> findPreviousByStatus();
    List<WlyyOutpatientDO> findByDoctorAndCreateTimeAndPatientCancelRemark(String doctor,Date createTime,String patientCancelRemark);
    List<WlyyOutpatientDO> findByDoctorAndCreateTimeAndPatientCancelRemark(String doctor,Date createTime,String patientCancelRemark);

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java

@ -281,7 +281,7 @@ public class PrescriptionStatusUpdateService {
        logger.info("setOutPatientOver start ");
        logger.info("setOutPatientOver start ");
        //复诊记录状态状态安全锁,每天0~2点才允许触发,避免误调用
        //复诊记录状态状态安全锁,每天0~2点才允许触发,避免误调用
        //将所有的已接诊的处方记录
        //将所有的已接诊的处方记录
        List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findPreviousByStatus();
        List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus();
        if(outpatientDOs!=null&&outpatientDOs.size()>0){
        if(outpatientDOs!=null&&outpatientDOs.size()>0){
            System.out.println(outpatientDOs.get(0).getId()+"id______-");
            System.out.println(outpatientDOs.get(0).getId()+"id______-");
            for(WlyyOutpatientDO outpatientDO:outpatientDOs){
            for(WlyyOutpatientDO outpatientDO:outpatientDOs){

+ 5 - 5
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/OverdueJob.java

@ -27,7 +27,7 @@ import java.util.List;
@EnableScheduling
@EnableScheduling
public class OverdueJob implements SchedulingConfigurer {
public class OverdueJob implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(OverdueJob.class);
    private static final Logger logger = LoggerFactory.getLogger(OverdueJob.class);
    private static String cron = "0 0/2 * * * ?";
    private static String cron = "0 0 1 * * ?";
    public OverdueJob(){
    public OverdueJob(){
        cron="0 0 1 * * ?";
        cron="0 0 1 * * ?";
        System.out.println("初始化时的corn"+cron);
        System.out.println("初始化时的corn"+cron);
@ -45,13 +45,13 @@ public class OverdueJob implements SchedulingConfigurer {
        taskRegistrar.addTriggerTask(new Runnable() {
        taskRegistrar.addTriggerTask(new Runnable() {
            @Override
            @Override
            public void run() {
            public void run() {
                logger.info("START========PrescriptionOverJob========");
                logger.info("START========OverdueJob========");
                try {
                try {
                    prescriptionStatusUpdateService.setOutPatientOver();
                    prescriptionStatusUpdateService.setOutPatientOver();
                    logger.info("END========PrescriptionOverJob========");
                    logger.info("END========OverdueJob========");
                } catch (Exception e) {
                } catch (Exception e) {
                    e.printStackTrace();
                    e.printStackTrace();
                    logger.error("END===ERROE===PrescriptionOverJob,message:"+e.getMessage());
                    logger.error("END===ERROE===OverdueJob,message:"+e.getMessage());
                }
                }
            }
            }
        }, new Trigger() {
        }, new Trigger() {
@ -59,7 +59,7 @@ public class OverdueJob implements SchedulingConfigurer {
            public Date nextExecutionTime(TriggerContext triggerContext) {
            public Date nextExecutionTime(TriggerContext triggerContext) {
                // 任务触发,可修改任务的执行周期
                // 任务触发,可修改任务的执行周期
                CronTrigger trigger = new CronTrigger(cron);
                CronTrigger trigger = new CronTrigger(cron);
                System.out.println("任务触发,可修改任务的执行周期"+cron);
                System.out.println("OverdueJob任务触发,可修改任务的执行周期"+cron);
                Date nextExec = trigger.nextExecutionTime(triggerContext);
                Date nextExec = trigger.nextExecutionTime(triggerContext);
                return nextExec;
                return nextExec;
            }
            }

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

@ -1,6 +1,5 @@
package com.yihu.jw.web.quota;
package com.yihu.jw.web.quota;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.service.ImService;
@ -16,6 +15,7 @@ import com.yihu.jw.repository.job.QuartzJobConfigDao;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.AutoTimeOutRemind;
import com.yihu.jw.util.AutoTimeOutRemind;
import com.yihu.jw.util.OverdueJob;
import com.yihu.jw.util.SystemConf;
import com.yihu.jw.util.SystemConf;
import com.yihu.jw.web.BaseController;
import com.yihu.jw.web.BaseController;
import com.yihu.jw.wechat.service.WxTemplateService;
import com.yihu.jw.wechat.service.WxTemplateService;
@ -28,7 +28,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestController;
import javax.sound.midi.Soundbank;
import java.util.HashMap;
import java.util.HashMap;
import java.util.List;
import java.util.List;
import java.util.UUID;
import java.util.UUID;
@ -621,5 +620,12 @@ public class JobController extends BaseController {
        return autoTimeOutRemind.change(corn);
        return autoTimeOutRemind.change(corn);
    }
    }
    @RequestMapping(value = "changeOverDueTime", method = RequestMethod.GET)
    public String changeOverDueTime(String corn){
        OverdueJob autoTimeOutRemind = new OverdueJob();
        return autoTimeOutRemind.change(corn);
    }
}
}