Parcourir la source

收药预提醒发送记录

wujunjie il y a 7 ans
Parent
commit
c327e98861

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PhysicalExaminationRecords.java

@ -19,7 +19,7 @@ import java.util.Date;
@Table(name = "wlyy_physical_examination_records")
public class PhysicalExaminationRecords extends IdEntity implements Serializable {
	private String code;
	private Integer type;           //1老年人体检提醒,2免疫计划提醒
	private Integer type;           //1老年人体检提醒,2免疫计划提醒 3续方自动确认收药预提醒
	private String patientCode;     //居民CODE
	private int status;     //状态0未发送,1已发送,2发送失败
	private Date remindTime;   //提醒时间

+ 14 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PatientConfirmReceiptJob.java

@ -1,11 +1,14 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PhysicalExaminationRecords;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.physicalExamination.PatientPhysicalExaminationDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.app.physicalExamination.PatientPhysicalExaminationService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
@ -47,6 +50,10 @@ public class PatientConfirmReceiptJob implements Job {
    private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Autowired
    private WeiXinOpenIdUtils weiXinOpenIdUtils;
    @Autowired
    private PatientPhysicalExaminationDao examinationDao;
    @Autowired
    private PatientPhysicalExaminationService examinationService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
@ -71,8 +78,13 @@ public class PatientConfirmReceiptJob implements Job {
                        //4.计算现在到预计自动确认收货时间差值
                        long days = DateUtil.getDays(today,payTime);
                        if(days == 3 && extendCount ==0){
                            //支付后第三天发送自动确认预提醒
                            sendWechatTemplate(1,patient,prescription.getCode());
                            PhysicalExaminationRecords records = examinationDao.findByType(patient,3,1);
                            if (records == null){
                                //支付后第三天发送自动确认预提醒
                                sendWechatTemplate(1,patient,prescription.getCode());
                                //发送成功保存发送记录
                                examinationService.saveRecord(patient,3,1);
                            }
                        }
                        int result = today.compareTo(confirm);
                        if (result >= 0) {

+ 3 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/physicalExamination/PatientPhysicalExaminationDao.java

@ -11,4 +11,7 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface PatientPhysicalExaminationDao extends PagingAndSortingRepository<PhysicalExaminationRecords, Long>,JpaSpecificationExecutor<PhysicalExaminationRecords> {
    // 根据类型、状态及居民code查询发送记录
    @Query("select p from PhysicalExaminationRecords p where p.patientCode=?1 and p.type=?2 and p.status=?3 ")
    PhysicalExaminationRecords findByType(String patient,int type, int status);
}

+ 12 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PatientPhysicalExaminationService.java

@ -121,4 +121,16 @@ public class PatientPhysicalExaminationService extends BaseService {
        }
    }
    public void saveRecord(String patient,int type,int status) throws Exception {
            //发送成功保存发送记录
            PhysicalExaminationRecords records = new PhysicalExaminationRecords();
            records.setCode(getCode());
            records.setType(type);
            records.setPatientCode(patient);
            records.setStatus(status);
            records.setCreateTime(new Date());
            records.setRemindTime(new Date());
            examinationDao.save(records);
    }
}