|
@@ -3,6 +3,7 @@ package com.fs.his.service.impl;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.exception.CustomException;
|
|
@@ -33,6 +34,7 @@ import com.fs.system.oss.OSSFactory;
|
|
|
import com.google.zxing.WriterException;
|
|
|
import jodd.util.StringUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.exception.ExceptionUtils;
|
|
|
import org.springframework.aop.framework.AopContext;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
@@ -906,26 +908,34 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
|
|
|
public void auditPrescribe() {
|
|
|
log.info("自动审方定时任务开始执行");
|
|
|
|
|
|
- List<FsPrescribe> FsPrescribes=fsPrescribeDrugMapper.selectFsPrescribeNoAudit();
|
|
|
+ List<FsPrescribe> FsPrescribes=fsPrescribeMapper.selectFsPrescribeNoAudit();
|
|
|
log.info("查询到待审核处方数量:{}", FsPrescribes.size());
|
|
|
|
|
|
IFsPrescribeService fsPrescribeService = (IFsPrescribeService) AopContext.currentProxy();
|
|
|
for (FsPrescribe fsPrescribe : FsPrescribes) {
|
|
|
- log.info("开始处理处方单,处方ID:{}", fsPrescribe.getPrescribeId());
|
|
|
+ FsPrescribeAuditParam param = null;
|
|
|
+ try{
|
|
|
+ log.info("开始处理处方单,处方ID:{}", fsPrescribe.getPrescribeId());
|
|
|
|
|
|
- Long id = doctorMapper.selectFsDoctorType2Ids(fsPrescribe.getPrescribeType());
|
|
|
- log.info("获取到处方类型对应的医生ID:{}", id);
|
|
|
+ Long id = doctorMapper.selectFsDoctorType2Ids(fsPrescribe.getPrescribeType());
|
|
|
+ if(ObjectUtils.isNull(id)){
|
|
|
+ throw new IllegalArgumentException("获取处方类型对应的医生/药师失败!");
|
|
|
+ }
|
|
|
+ log.info("获取到处方类型对应的医生ID:{}", id);
|
|
|
|
|
|
- FsPrescribeAuditParam param=new FsPrescribeAuditParam();
|
|
|
- param.setDoctorId(id);
|
|
|
- param.setStatus(1);
|
|
|
- param.setPrescribeId(fsPrescribe.getPrescribeId());
|
|
|
- log.info("构建审方参数:医生ID={}, 处方ID={}, 状态={}", id, fsPrescribe.getPrescribeId(), 1);
|
|
|
+ param=new FsPrescribeAuditParam();
|
|
|
+ param.setDoctorId(id);
|
|
|
+ param.setStatus(1);
|
|
|
+ param.setPrescribeId(fsPrescribe.getPrescribeId());
|
|
|
+ log.info("构建审方参数:医生ID={}, 处方ID={}, 状态={}", id, fsPrescribe.getPrescribeId(), 1);
|
|
|
|
|
|
- try{
|
|
|
fsPrescribeService.generateOrderAndPres(param, id);
|
|
|
}catch (Throwable e) {
|
|
|
log.error("生成处方订单和处方图片失败!参数: {}",param,e);
|
|
|
+ fsPrescribe.setCount(fsPrescribe.getCount()+1);
|
|
|
+ fsPrescribe.setFailMsg(String.format("生成处方订单和处方图片失败!参数: %s,异常:%s",param, ExceptionUtils.getFullStackTrace(e)));
|
|
|
+ } finally {
|
|
|
+ fsPrescribeMapper.updateFsPrescribe(fsPrescribe);
|
|
|
}
|
|
|
|
|
|
}
|