浏览代码

1.信息采集疗法过滤非生成处方数据 2.查询信息采集列表,新增销售查看权限 3.信息采集用户第一次确认新增待支付状态

wjj 6 天之前
父节点
当前提交
642af5bf13

+ 11 - 0
fs-company/src/main/java/com/fs/company/controller/qw/FsUserInformationCollectionScheduleController.java

@@ -7,6 +7,7 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 import com.fs.common.utils.ServletUtils;
+import com.fs.company.mapper.CompanyUserRoleMapper;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.service.TokenService;
 import com.fs.his.domain.FsUserInformationCollectionSchedule;
@@ -46,6 +47,9 @@ public class FsUserInformationCollectionScheduleController extends BaseControlle
     @Autowired
     private TokenService tokenService;
 
+    @Autowired
+    private CompanyUserRoleMapper roleMapper;
+
     /**
      * 对于每条用户信息采集记录,只获取其最新的任务流程
      */
@@ -53,6 +57,13 @@ public class FsUserInformationCollectionScheduleController extends BaseControlle
     @GetMapping("/list")
     public TableDataInfo list(FsUserInformationCollectionSchedule fsUserInformationCollectionSchedule)
     {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        fsUserInformationCollectionSchedule.setCompanyUserId(loginUser.getUser().getUserId());
+        //管理员查看所有数据
+        Long isAdmin = roleMapper.companyUserIsAdmin(fsUserInformationCollectionSchedule.getCompanyUserId());
+        if (isAdmin != null) {
+            fsUserInformationCollectionSchedule.setCompanyUserId(null);
+        }
         startPage();
         List<FsUserInformationCollectionSchedule> list = fsUserInformationCollectionScheduleService.getUserRecordLatestTaskProcess(fsUserInformationCollectionSchedule);
         return getDataTable(list);

+ 15 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyUserRoleMapper.java

@@ -1,6 +1,8 @@
 package com.fs.company.mapper;
 
 import com.fs.company.domain.CompanyUserRole;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 
@@ -66,4 +68,17 @@ public interface CompanyUserRoleMapper
     void batchUserRole(List<CompanyUserRole> list);
 
     void deleteUserRoleByUserId(Long userId);
+
+    @Select({"<script> " +
+            "SELECT  " +
+            "   cur.user_id " +
+            "FROM " +
+            "    company_user_role cur " +
+            "JOIN " +
+            "    company_role cr ON cur.role_id = cr.role_id and cr.role_key = 'admin' " +
+            "WHERE " +
+            "    cur.user_id = #{userId} " +
+            " LIMIT 1 "
+            +"</script>"})
+    public Long companyUserIsAdmin(@Param("userId") Long userId);
 }

+ 2 - 1
fs-service/src/main/java/com/fs/his/enums/PrescriptionTaskStepEnum.java

@@ -22,7 +22,8 @@ public enum PrescriptionTaskStepEnum {
     WAITING_PHARMACIST_REVIEW(3, "待药师审核"),
     WAITING_SUGGESTION(4, "待建议"),
     WAITING_SECOND_CONFIRM(5, "待用户二次确认"),
-    WAITING_COMPLETED(6, "完成");
+    WAITING_COMPLETED(6, "完成"),
+    WAITING_UN_PAY(7,"待支付");
 
     /** 步骤码(存入数据库的值) */
     private final Integer code;

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

@@ -68,7 +68,7 @@ public interface FsPackageMapper
 
     @Select("select package_id dictValue,package_name dictLabel from fs_package where package_sub_type != 3 order by sort")
     List<OptionsVO> selectAllPackageList();
-    @Select("select package_id dictValue,package_name dictLabel from fs_package where is_show = 0 and status = 1  order by sort")
+    @Select("select package_id dictValue,package_name dictLabel from fs_package where is_show = 0 and status = 1 and (product_type = 1 or product_type = 2 or product_type = 3 )  order by sort")
     List<OptionsVO> selectAllPrivatePackageList();
     @Select({"<script> " +
             "select * from fs_package "+

+ 23 - 20
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -320,6 +320,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
     @Autowired
     private ICompanyUserCacheService companyUserCacheService;
 
+    @Autowired
+    private FsUserInformationCollectionScheduleMapper scheduleMapper;
+
     //ERP 类型到服务的映射
     private Map<Integer, IErpOrderService> erpServiceMap;
     @PostConstruct
@@ -924,10 +927,7 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
         order.setStoreId(fsPackage.getStoreId());
         FsUserInformationCollection collection = userInformationCollectionMapper.selectByOrderCode(packageOrder.getOrderSn());
         logger.info("用户采集信息{}:=================>",collection);
-        if (collection != null
-                && collection.getIsPackage() == 1
-                &&  !Arrays.asList(1, 2, 3).contains(fsPackage.getProductType())
-        ) {
+        if (collection != null) {
             //是否确认(用户信息采集 为0的不推送到ERP)1推送
             order.setIsConfirm(0);
             //存入用户信息采集信息 用于第一次医生确认处方修改医生确认状态
@@ -935,22 +935,25 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
             if (prescribeId != null) {
                 redisCache.setCacheObject("collectionPrescribeId:" + prescribeId, collection);
             }
-            DoctorMsg msg = new DoctorMsg();
-            String name = collection.getUserName() != null ? collection.getUserName() : "-";
-            msg.setTitle("用户信息采集开方");
-            msg.setType(1);
-            String companyUserName = companyUserCacheService.selectCompanyUserNameUserById(collection.getCompanyUserId());
-            msg.setContent("患者:" + name + "的信息采集,前往开方,来源客服:"+companyUserName);
-            msg.setDoctorId(collection.getDoctorId());
-            msg.setCreateTime(DateUtils.getNowDate());
-            doctorMsgMapper.insertDoctorMsg(msg);
-            //更新任务订单号
-            FsUserInformationCollectionSchedule schedule = informationCollectionScheduleMapper.selectCollectionScheduleRunningByCollectionId(collection.getId());
-            if (schedule != null) {
-                FsUserInformationCollectionSchedule map = new FsUserInformationCollectionSchedule();
-                map.setId(schedule.getId());
-                map.setOrderCode(packageOrder.getOrderSn());
-                informationCollectionScheduleMapper.updateFsUserInformationCollectionSchedule(map);
+            if (collection.getIsPackage() == 1 && Arrays.asList(1, 2, 3).contains(fsPackage.getProductType())) {
+                DoctorMsg msg = new DoctorMsg();
+                String name = collection.getUserName() != null ? collection.getUserName() : "-";
+                msg.setTitle("用户信息采集开方");
+                msg.setType(1);
+                String companyUserName = companyUserCacheService.selectCompanyUserNameUserById(collection.getCompanyUserId());
+                msg.setContent("患者:" + name + "的信息采集,前往开方,来源客服:"+companyUserName);
+                msg.setDoctorId(collection.getDoctorId());
+                msg.setCreateTime(DateUtils.getNowDate());
+                doctorMsgMapper.insertDoctorMsg(msg);
+                //更新任务订单号
+                FsUserInformationCollectionSchedule schedule = scheduleMapper.selectCollectionScheduleByCollectionId(collection.getId());
+                if (schedule != null) {
+                    FsUserInformationCollectionSchedule map = new FsUserInformationCollectionSchedule();
+                    map.setId(schedule.getId());
+                    map.setOrderCode(packageOrder.getOrderSn());
+                    map.setCurrentStep(PrescriptionTaskStepEnum.WAITING_PRESCRIBE.getCode());
+                    informationCollectionScheduleMapper.updateFsUserInformationCollectionSchedule(map);
+                }
             }
         }
         order.setStatus(2);

+ 5 - 3
fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -222,6 +222,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
             fsUserInformationCollection.setCompanyUserId(param.getCompanyUserId());
             fsUserInformationCollection.setCompanyId(param.getCompanyId());
             FsUserInformationCollectionSchedule fsUserInformationCollectionSchedule = assembleCreateSchedule(fsUserInformationCollection);
+            fsUserInformationCollectionSchedule.setCompanyUserId(param.getCompanyUserId());
             scheduleMapper.insertFsUserInformationCollectionSchedule(fsUserInformationCollectionSchedule);
             log.info("新增用户信息采集进度数据,信息采集数据id:{}",fsUserInformationCollectionSchedule.getCollectionId());
         }catch (Exception e){
@@ -264,6 +265,7 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
             }
 
             FsUserInformationCollectionSchedule fsUserInformationCollectionSchedule = assembleCreateSchedule(condition);
+            fsUserInformationCollectionSchedule.setCompanyUserId(param.getCompanyUserId());
             scheduleMapper.insertFsUserInformationCollectionSchedule(fsUserInformationCollectionSchedule);
             log.info("编辑用户信息采集信息重新新增进度数据,信息采集数据id:{}",fsUserInformationCollectionSchedule.getCollectionId());
         }catch (Exception e){
@@ -686,9 +688,9 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
                 log.info("同步用户id:{}信息采集进度:{}",param.getUserId(),schedule);
                 log.info("当前采集表isPackage数值:{}",collection.getIsPackage());
                 if (collection.getIsPackage() == 1) {
-                    //带套餐包的 "待开方"节点
-                    schedule.setCurrentStep(PrescriptionTaskStepEnum.WAITING_PRESCRIBE.getCode());
-                    log.info("同步用户信息采集进度节点为:{},信息采集表id:{}",PrescriptionTaskStepEnum.WAITING_PRESCRIBE.getDesc(),schedule.getCollectionId());
+                    //带套餐包的 "待支付"节点
+                    schedule.setCurrentStep(PrescriptionTaskStepEnum.WAITING_UN_PAY.getCode());
+                    log.info("同步用户信息采集进度节点为:{},信息采集表id:{}",PrescriptionTaskStepEnum.WAITING_UN_PAY.getDesc(),schedule.getCollectionId());
                 } else {
                     //没套餐包的 "待建议"节点
                     schedule.setCurrentStep(PrescriptionTaskStepEnum.WAITING_SUGGESTION.getCode());

+ 3 - 1
fs-user-app/src/main/java/com/fs/app/controller/UserInfoCollectionController.java

@@ -99,7 +99,9 @@ public class UserInfoCollectionController extends AppBaseController {
     @PutMapping("/edit")
     public R edit(@RequestBody FsUserInformationCollectionParam fsUserInformationCollection)
     {
-
+        FsUser user=userService.selectFsUserByUserId(Long.parseLong(getUserId()));
+        fsUserInformationCollection.setCompanyUserId(user.getCompanyUserId());
+        fsUserInformationCollection.setCompanyId(user.getCompanyId());
         Long l = userInformationCollectionService.updateFsUserInformationCollection(fsUserInformationCollection);
         if (l > 0) {
             return R.ok();