Ver código fonte

处方删除定时任务

wangjun 4 anos atrás
pai
commit
9f868c1f7c

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -124,8 +124,8 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
                " a.outpatient_type AS \"outpatientType\", " +
                " a.del AS \"del\", " +
                " b.dept_name AS \"deptName\", " +
                " e.req_fee AS \"money\" " +
                " a.charge_type as \"chargeType\", "+
                " e.req_fee AS \"money\"," +
                " a.charge_type as \"chargeType\" "+
                " FROM " +
                " base_doctor a " +
                " JOIN base_doctor_hospital b ON a.id = b.doctor_code " +

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java

@ -390,7 +390,7 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
        map.put("relationCode",baseUserMessageDO.getRelationCode());
        map.put("relationType",baseUserMessageDO.getRelationType());
        map.put("status",baseUserMessageDO.getStatus());
        map.put("updateTime",DateUtil.dateToStrLong(DateUtil.strToDateLong(baseUserMessageDO.getUpdateUserName())));
        map.put("updateTime",DateUtil.dateToStrLong(baseUserMessageDO.getUpdateTime()));
        map.put("relationName",baseUserMessageDO.getRelationName());
        map.put("contentlist",contentlist);
        returnResult.add(map);

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java

@ -60,5 +60,7 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    List<WlyyPrescriptionDO> findByOutPatientIdList(String outpatientId);
    List<WlyyPrescriptionDO> findByDoctorAndCreateTimeAndRemark(String doctor,Date createTime,String remark);
    @Query("select a from WlyyPrescriptionDO a where a.checkStatus in (0,1,3) and a.createTime <?1")
    List<WlyyPrescriptionDO> findListByCheckStatus(Date createTime);
}

+ 7 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -8943,15 +8943,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1);
                if (null!=wlyyPrescriptionDiagnosisDOs&&wlyyPrescriptionDiagnosisDOs.size()>0){
                    xzzxEntranceService.deleteCheckInputInfo(hisId,"0",prescriptionDO.getDoctor(),prescriptionDO.getPatientCode(),wlyyPrescriptionDiagnosisDOs);
                    if (StringUtils.isNotBlank(prescriptionDO.getRealOrder())){
                        xzzxEntranceService.deletePrescriptionToEntrance(prescriptionDO.getRealOrder());
                    }
                }
            }
            prescriptionDO.setStatus(-1);
            prescriptionDO.setCheckStatus(5);
            prescriptionDO.setCheckReason("作废处方");
            prescriptionDO.setCheckStatus(4);
            prescriptionDO.setCheckReason("已删除");
            prescriptionDao.save(prescriptionDO);
            return "作废成功";
            return "删除成功";
        }else {
            return "作废失败";
            return "删除失败";
        }
    }
}

+ 30 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/PrescriptionAutoDeleteJob.java

@ -0,0 +1,30 @@
package com.yihu.jw.job;
import com.yihu.jw.service.channel.PrescriptionDeleteService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Trigger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
public class PrescriptionAutoDeleteJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(PrescriptionAutoDeleteJob.class);
    @Autowired
    private PrescriptionDeleteService prescriptionDeleteService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========PrescriptionAutoDeleteJob========");
        try {
            Trigger trigger =jobExecutionContext.getTrigger();
            System.out.println("执行时间为"+trigger.getNextFireTime());
            prescriptionDeleteService.deletePrescription();
            logger.info("END========PrescriptionAutoDeleteJob========");
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("END===ERROE===PrescriptionAutoDeleteJob,message:"+e.getMessage());
        }
    }
}

+ 69 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionDeleteService.java

@ -0,0 +1,69 @@
package com.yihu.jw.service.channel;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@Component
@Transactional
public class PrescriptionDeleteService {
    private static Logger logger = LoggerFactory.getLogger(PrescriptionDeleteService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Value("${wechat.ids}")
    private String wechatId;
    @Value("${hlwyyEntrance.url}")
    private String hlwyyEntranceUrl;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    //定时作废处方
    public void deletePrescription() throws Exception{
        Date d = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String s = sdf.format(d);
        List<WlyyPrescriptionDO> prescriptionDOS = prescriptionDao.findListByCheckStatus(DateUtil.strToDate(s+" 00:00:00"));
        if (null!=prescriptionDOS&&prescriptionDOS.size()>0){
            for (WlyyPrescriptionDO prescriptionDO:prescriptionDOS){
                logger.info("处方删除时间满足条件");
                String hisId = prescriptionDO.getHisId();
                if("xm_xzzx_wx".equalsIgnoreCase(wechatId)){
                    List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionDO.getId(),1);
                    if (null!=wlyyPrescriptionDiagnosisDOs&&wlyyPrescriptionDiagnosisDOs.size()>0){
                        xzzxEntranceService.deleteCheckInputInfo(hisId,"0",prescriptionDO.getDoctor(),prescriptionDO.getPatientCode(),wlyyPrescriptionDiagnosisDOs);
                        if (StringUtils.isNotBlank(prescriptionDO.getRealOrder())){
                            xzzxEntranceService.deletePrescriptionToEntrance(prescriptionDO.getRealOrder());
                        }
                    }
                }
                prescriptionDO.setStatus(-1);
                prescriptionDO.setCheckStatus(4);
                prescriptionDO.setCheckReason("已删除");
                logger.info("处方:"+prescriptionDO.getId()+"已删除");
                prescriptionDao.save(prescriptionDO);
            }
        }
    }
}

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

@ -15,10 +15,7 @@ import com.yihu.jw.repository.job.QuartzJobConfigDao;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.channel.PrescriptionStatusUpdateService;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.AutoTimeOutRemind;
import com.yihu.jw.util.OverdueJob;
import com.yihu.jw.util.SystemConf;
import com.yihu.jw.util.TimeoutOverDueJob;
import com.yihu.jw.util.*;
import com.yihu.jw.web.BaseController;
import com.yihu.jw.wechat.service.WxTemplateService;
import io.swagger.annotations.Api;
@ -200,6 +197,17 @@ public class JobController extends BaseController {
                        logger.info("CSTXJOB  job exist");
                    }
                    break;
                case "prescription_auto_delete_job" :
                    //互联网医院 监管平台上报
                    if (!quartzHelper.isExistJob("prescription_auto_delete_job")) {
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prescription_auto_delete_job");
                        quartzHelper.addJob(PrescriptionAutoDeleteJob.class, trigger, "prescription_auto_delete_job", new HashMap<String, Object>());
                        logger.info("prescription_auto_delete_job  job success");
                    } else {
                        logger.info("prescription_auto_delete_job  job exist");
                    }
                    break;
                default :
            }

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

@ -4,6 +4,8 @@ prescriptionStatus_update_job=0 */2 * * * ?
# 门诊记录过期job,每天1 点触发
prescription_overdue_job=0 0 2 * * ?
# 0 */1 * * * ?
prescription_auto_delete_job = 0 30 0 ? * *
#每天13 点触发
data_upload_job=0 0 2 * * ?

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/QrcodeService.java

@ -213,7 +213,7 @@ public class QrcodeService {
            e.printStackTrace();
            System.out.println(e.getMessage());
        }
        return content;
        return null;
    }
}