Selaa lähdekoodia

feat: 处方单图片生成 补偿定时任务

xdd 1 kuukausi sitten
vanhempi
commit
4e1f7a0518

+ 41 - 6
fs-admin/src/main/java/com/fs/his/task/Task.java

@@ -48,6 +48,7 @@ import com.fs.qwApi.service.QwApiService;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.mapper.SysConfigMapper;
 import com.google.gson.Gson;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -59,6 +60,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+@Slf4j
 @Component("task")
 public class Task {
     @Autowired
@@ -181,6 +183,21 @@ public class Task {
         }
     }
 
+    /**
+     * 生成已开方且处方单图片为空的处方单
+     */
+    public void generatePresImg(){
+        log.info("开始生成已开方且处方单图片为空的处方单");
+        try {
+            fsPrescribeService.generatePrescribeImg();
+            log.info("生成已开方且处方单图片为空的处方单完成");
+        } catch (Exception e) {
+            log.error("生成已开方且处方单图片为空的处方单出错", e);
+            throw e;
+        }
+    }
+
+
     public void addQwWatchLog() throws Exception
     {
         fsCourseWatchLogService.addCourseWatchLogDay();
@@ -251,12 +268,30 @@ public class Task {
     //每10秒执行一次
     public void auditPrescribe()
     {
-        SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.inquiryConfig");
-        String configValue = sysConfig.getConfigValue();
-        Map<String, Object> config = (Map<String, Object>) JSON.parse(configValue);
-        boolean isAudit = (boolean)config.get("isAutoPrescribeAudit");
-        if (isAudit){
-            fsPrescribeService.auditPrescribe();
+        log.info("开始执行处方审核定时任务");
+        long startTime = System.currentTimeMillis();
+
+        try {
+            SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("his.inquiryConfig");
+            log.info("获取到系统配置his.inquiryConfig: {}", sysConfig.getConfigValue());
+
+            String configValue = sysConfig.getConfigValue();
+            Map<String, Object> config = (Map<String, Object>) JSON.parse(configValue);
+            boolean isAudit = (boolean)config.get("isAutoPrescribeAudit");
+            log.info("处方自动审核配置状态: {}", isAudit);
+
+            if (isAudit) {
+                log.info("开始执行处方审核业务");
+                fsPrescribeService.auditPrescribe();
+                log.info("处方审核业务执行完成");
+            } else {
+                log.info("自动处方审核功能未开启,跳过处理");
+            }
+        } catch (Exception e) {
+            log.error("处方审核定时任务执行异常", e);
+        } finally {
+            long endTime = System.currentTimeMillis();
+            log.info("处方审核定时任务结束,总耗时:{}毫秒", (endTime - startTime));
         }
     }
 

+ 5 - 0
fs-service/src/main/java/com/fs/his/mapper/FsPrescribeDrugMapper.java

@@ -73,4 +73,9 @@ public interface FsPrescribeDrugMapper
     List<FsDoctorPrescribeDrug> selectFsPrescribeDrugListByImg2();
     @Select("select * from fs_store_product where product_name=#{drugName} and store_id=#{storeId} LIMIT 1 ")
     FsStoreProduct selectFsPrescribeDrugCode(@Param("drugName") String drugName, @Param("storeId")Long storeId);
+
+    @Select("select prescribe_id from fs_prescribe where prescribe_img_url is null and status=1")
+    List<FsPrescribe> selectPenddingPrescribeImgData();
+
+
 }

+ 7 - 0
fs-service/src/main/java/com/fs/his/service/IFsPrescribeService.java

@@ -8,6 +8,8 @@ import com.fs.his.domain.FsPrescribe;
 import com.fs.his.domain.FsPrescribeDrug;
 import com.fs.his.param.*;
 import com.fs.his.vo.*;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 处方Service接口
@@ -82,7 +84,12 @@ public interface IFsPrescribeService
 
     void auditPrescribe();
 
+    void generatePrescribeImg();
+
+    void generateOrderAndPres(FsPrescribeAuditParam param, Long id);
+
     R audit(FsPrescribeAuditParam param);
+    R auditWithoutMsg(FsPrescribeAuditParam param);
 
      String PrescribeImg(Long prescribeId);