소스 검색

益寿缘-优化小程序端销售查询采集信息表数据

cgp 3 주 전
부모
커밋
6d4ccbe9fa

+ 1 - 0
fs-service/src/main/java/com/fs/his/service/IFsExportTaskService.java

@@ -75,6 +75,7 @@ public interface IFsExportTaskService
 
     void updateFsExportTaskByPrescribeId(Long id);
 
+    //根据处方 ID 更新生成处方图片的定时任务状态,重置执行次数为 0,并指定生成逻辑(仅医生签名 或 医生+药师签名);
     void resetFsExportTaskByPrescribeIdAndSignFlag(Long id,Integer signFlag);
 
 }

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

@@ -90,7 +90,7 @@ public interface IFsPrescribeService
      String PrescribeImg(Long prescribeId);
      String PrescribeImgYsy(Long prescribeId);
 
-    String PrescribeImgYsyTask(Long prescribeId,Integer signFlag);
+    String prescribeImgYsyTask(Long prescribeId,Integer signFlag);
 
     Long insertFsPrescribeByPackageOrder(FsPackageOrder packageOrder);
 

+ 19 - 22
fs-service/src/main/java/com/fs/his/service/impl/FsPrescribeServiceImpl.java

@@ -128,6 +128,9 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
     @Autowired
     private IFsUserInformationCollectionService fsUserInformationCollectionService;
 
+    @Autowired
+    private FsPrescribeServiceImpl currentProxy;//注入自身,避免使用this.调用本类方法事务失效
+
     /**
      * 查询处方
      *
@@ -545,7 +548,7 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
     }
 
     @Override
-    public String PrescribeImgYsyTask(Long prescribeId,Integer signFlag) {
+    public String prescribeImgYsyTask(Long prescribeId,Integer signFlag) {
         FsPrescribeVO f = fsPrescribeMapper.selectFsPrescribeByPrescribeIdVO(prescribeId);
         Asserts.notNull(f,String.format("处方 %d 未找到!",prescribeId));
 
@@ -576,6 +579,7 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
             if (StringUtils.isNotBlank(f.getRemark())){
                 o.setRemark(f.getRemark());
             } else {
+                log.error("PrescribeImgYsyTask 处方id:{},缺失医嘱内容", f.getPrescribeId());
                 o.setRemark("请按照用药说明书服用药品,如有不适,请及时就医!");
             }
             o.setHistoryAllergic(f.getHistoryAllergic());
@@ -638,7 +642,7 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
             List<FsPrescribeDrug> list = fsPrescribeDrugMapper.selectFsPrescribeDrugList(d);
 
             if (CollectionUtils.isEmpty(list)) {
-                throw new IllegalArgumentException(String.format("处方单 %d 对应药品为空!",prescribeId));
+                throw new CustomException(String.format("处方单 %d 对应药品为空!",prescribeId));
             }
             PrescribeXyImgParam o = new PrescribeXyImgParam();
             o.setStatus(fsStoreOrder.getStatus());
@@ -654,16 +658,6 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
             } else {
                 o.setBedId("中医科");
             }
-//            String remark = "";
-//            if (f.getUsageJson() != null) {
-//                FsPrescribeUsageDTO usage = JSONUtil.toBean(f.getUsageJson(), FsPrescribeUsageDTO.class);
-//                remark = usage.getRemark();
-//            }
-//            if (remark != null && remark != "") {
-//                o.setRemark(remark);
-//            } else {
-//                o.setRemark("请按照用药说明书服用药品,如有不适,请及时就医!");
-//            }
             if (StringUtils.isNotBlank(f.getRemark())){
                 o.setRemark(f.getRemark());
             } else {
@@ -1211,6 +1205,9 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
         if(prescribe.getStatus()!=0){
             return R.error("非法操作");
         }
+        //无论审核是否通过,都删除之前只有医生签名的处方图片
+        delUrl(param.getPrescribeId());
+
         FsPrescribe map=new FsPrescribe();
         map.setPrescribeId(param.getPrescribeId());
         map.setDrugDoctorId(param.getDoctorId());
@@ -1279,8 +1276,6 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
             }
         }
 
-
-        delUrl(param.getPrescribeId());
         if (this.updateFsPrescribe(map) > 0){
             return R.ok("审核成功");
         }
@@ -1376,7 +1371,7 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
         record.setCreateTime(LocalDateTime.now());
         record.setExecuteStatus(0);
         record.setRetryCount(0);
-        //生成医生签名图片标识
+        //生成医生签名图片标识
         record.setSignFlag(1);
         prescriptionTaskRecordMapper.insert(record);
 
@@ -1406,15 +1401,17 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
                 }
             }
         }
-        //TODO 医生确认处方后立即生成处方图片
-
+        //医生确认处方后立即生成处方图片
+        currentProxy.createDoctorSignImg(fsPrescribe);
     }
 
-    //即时生成处方图片
-    private void createImg(Long prescribeId) {
-        String prescribeImgUrl = this.PrescribeImgYsyTask(prescribeId,1);//1-处方只带医生签名
-//        fsPrescribe.setPrescribeImgUrl(prescribeImgUrl);
-//        fsPrescribeService.updateFsPrescribe(fsPrescribe);
+    //手动生成带医生签名的处方图片
+    public void createDoctorSignImg(FsPrescribe fsPrescribe) {
+        if(fsPrescribe != null&& fsPrescribe.getPrescribeId() != null) {
+            String prescribeImgUrl = currentProxy.prescribeImgYsyTask(fsPrescribe.getPrescribeId(),1);//1:只生成有医生签名的处方
+            fsPrescribe.setPrescribeImgUrl(prescribeImgUrl);
+            fsPrescribeMapper.updateFsPrescribe(fsPrescribe);
+        }
     }
 
 

+ 1 - 1
fs-service/src/main/java/com/fs/his/service/impl/PrescriptionTaskRecordServiceImpl.java

@@ -47,7 +47,7 @@ public class PrescriptionTaskRecordServiceImpl implements PrescriptionTaskRecord
                     log.warn("处方不存在,处方ID: {}", record.getPrescribeId());
                     throw new IllegalArgumentException(String.format("处方 %d 没有找到!",record.getPrescribeId()));
                 }
-                String prescribeImgUrl = fsPrescribeService.PrescribeImgYsyTask(record.getPrescribeId(),record.getSignFlag());
+                String prescribeImgUrl = fsPrescribeService.prescribeImgYsyTask(record.getPrescribeId(),record.getSignFlag());
                 fsPrescribe.setPrescribeImgUrl(prescribeImgUrl);
                 fsPrescribeService.updateFsPrescribe(fsPrescribe);
 

+ 22 - 7
fs-user-app/src/main/java/com/fs/app/controller/UserInfoCollectionController.java

@@ -5,9 +5,9 @@ import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
+import com.fs.company.mapper.CompanyUserRoleMapper;
 import com.fs.course.param.CollectionInfoConfirmParam;
 import com.fs.course.vo.FsUserInfoCollectionUVO;
-import com.fs.framework.security.SecurityUtils;
 import com.fs.his.domain.FsUser;
 import com.fs.his.domain.FsUserInformationCollectionSchedule;
 import com.fs.his.enums.PrescriptionTaskStepEnum;
@@ -20,6 +20,7 @@ import com.fs.hisStore.service.IFsUserInformationCollectionService;
 import com.fs.qw.service.IFsUserInformationCollectionScheduleService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -28,7 +29,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
-
+@Slf4j
 @Api("用户信息采集接口")
 @RestController
 @RequestMapping(value="/app/collection")
@@ -46,6 +47,9 @@ public class UserInfoCollectionController extends AppBaseController {
     @Autowired
     private IFsUserInformationCollectionScheduleService fsUserInformationCollectionScheduleService;
 
+    @Autowired
+    private CompanyUserRoleMapper roleMapper;
+
     @ApiOperation("用户信息采集详情")
     @GetMapping("/getInfo")
     public R getInfo(@RequestParam("id") Long id) {
@@ -120,11 +124,22 @@ public class UserInfoCollectionController extends AppBaseController {
     public TableDataInfo list(FsUserInformationCollectionSchedule fsUserInformationCollectionSchedule)
     {
         FsUser user=userService.selectFsUserByUserId(Long.parseLong(getUserId()));
-        fsUserInformationCollectionSchedule.setCompanyId(user.getCompanyId());
-        fsUserInformationCollectionSchedule.setCompanyUserId(user.getCompanyUserId());
-        startPage();
-        List<FsUserInformationCollectionSchedule> list = fsUserInformationCollectionScheduleService.getUserRecordLatestTaskProcess(fsUserInformationCollectionSchedule);
-        return getDataTable(list);
+        if (user!=null&&user.getCompanyUserId()!=null){
+            fsUserInformationCollectionSchedule.setCompanyUserId(user.getCompanyUserId());
+            log.info("当前登录userId:{}",getUserId());
+            log.info("getUserId()获取的销售id:{}",user.getCompanyUserId());
+            log.info("getCompanyUserId()获取的销售id:{}",getCompanyUserId());
+            //管理员查看所有数据
+            Long isAdmin = roleMapper.companyUserIsAdmin(fsUserInformationCollectionSchedule.getCompanyUserId());
+            if (isAdmin != null) {
+                fsUserInformationCollectionSchedule.setCompanyUserId(null);
+            }
+            startPage();
+            List<FsUserInformationCollectionSchedule> list = fsUserInformationCollectionScheduleService.getUserRecordLatestTaskProcess(fsUserInformationCollectionSchedule);
+            return getDataTable(list);
+        }
+        log.info("未查询到登录用户,用户信息采集列表获取失败");
+        return getDataTable(null);
     }
 
     /**