فهرست منبع

新增查询未绑定企微userId的信息采集列表接口

cgp 1 هفته پیش
والد
کامیت
6c3ea9be66

+ 26 - 1
fs-company/src/main/java/com/fs/hisStore/controller/FsUserInformationCollectionController.java

@@ -3,10 +3,13 @@ package com.fs.hisStore.controller;
 import java.util.List;
 
 import com.fs.common.core.domain.R;
+import com.fs.company.mapper.CompanyUserRoleMapper;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.security.SecurityUtils;
 import com.fs.his.domain.FsUserInformationCollectionSchedule;
+import com.fs.hisStore.dto.FsUserInformationCollectionOverviewDTO;
 import com.fs.hisStore.param.FsUserInformationCollectionParam;
+import com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -32,6 +35,9 @@ public class FsUserInformationCollectionController extends BaseController
     @Autowired
     private IFsUserInformationCollectionService fsUserInformationCollectionService;
 
+    @Autowired
+    private CompanyUserRoleMapper roleMapper;
+
     /**
      * 查询用户信息采集列表
      */
@@ -143,10 +149,29 @@ public class FsUserInformationCollectionController extends BaseController
         return fsUserInformationCollectionService.stopCollection(param,loginUser.getUser().getUserId(),1);
     }
 
-
+    /**
+     * 销售确认
+     * */
     @PutMapping("/salesHelpConfirm")
     public R salesHelpConfirm(@RequestBody FsUserInformationCollectionSchedule param){
         LoginUser loginUser = SecurityUtils.getLoginUser();
         return fsUserInformationCollectionService.salesHelpConfirm(param.getCollectionId(),loginUser.getUser().getUserId());
     }
+
+    /**
+     * 查询未绑定的信息采集列表
+     */
+    @PostMapping("/getUnBindCollectionList")
+    public TableDataInfo getUnBindCollectionList(@RequestBody FsUserInformationCollectionOverviewDTO queryDto) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        queryDto.setCompanyUserId(loginUser.getUser().getUserId());
+        //管理员查看所有数据
+        Long isAdmin = roleMapper.companyUserIsAdmin(queryDto.getCompanyUserId());
+        if (isAdmin != null) {
+            queryDto.setCompanyUserId(null);
+        }
+        startPage();
+        List<FsUserInformationCollectionOverviewVo> list =fsUserInformationCollectionService.getUnBindCollectionList(queryDto);
+        return getDataTable(list);
+    }
 }

+ 2 - 2
fs-service/src/main/java/com/fs/hisStore/dto/FsUserInformationCollectionOverviewDTO.java

@@ -3,10 +3,10 @@ package com.fs.hisStore.dto;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
 
-import java.util.List;
-
 @Data
 public class FsUserInformationCollectionOverviewDTO  extends BaseEntity {
+    //销售id
+    private Long companyUserId;
     //用户姓名
     private String userName;
     //医生姓名

+ 5 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsUserInformationCollectionMapper.java

@@ -113,4 +113,9 @@ public interface FsUserInformationCollectionMapper extends BaseMapper<FsUserInfo
      * 用户信息采集列表总览
      * */
     List<FsUserInformationCollectionOverviewVo> selectUserInformationCollectionOverviewByPage(FsUserInformationCollectionOverviewDTO queryDto);
+
+    /**
+     * 获取未绑定的采集列表
+     * */
+    List<FsUserInformationCollectionOverviewVo> getUnBindCollectionList(FsUserInformationCollectionOverviewDTO queryDto);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/hisStore/param/FsUserInformationCollectionParam.java

@@ -50,6 +50,9 @@ public class FsUserInformationCollectionParam {
     /** 公司id */
     private Long companyId;
 
+    /** 采集填写来源*/
+    private String source;
+
     /** 用户信息采集的填写标识 0:未填写,1:已填写*/
     private Integer fillFlag;
 }

+ 5 - 0
fs-service/src/main/java/com/fs/hisStore/service/IFsUserInformationCollectionService.java

@@ -151,4 +151,9 @@ public interface IFsUserInformationCollectionService extends IService<FsUserInfo
      * 提交用户填写采集信息问题(只有用户自主填写完采集信息时才调用)
      * */
     int submitCollectionAnswerParam(SubmitCollectionAnswerParam param);
+
+    /**
+     * 获取未绑定的用户信息采集列表
+     * */
+    List<FsUserInformationCollectionOverviewVo> getUnBindCollectionList(FsUserInformationCollectionOverviewDTO queryDto);
 }

+ 41 - 8
fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -388,12 +388,8 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
             vo.setUserName(fsUserInformationCollection.getUserName());
             vo.setRemark(fsUserInformationCollection.getRemark());
             vo.setAllergy(fsUserInformationCollection.getAllergy());
-            String json=configService.selectConfigByKey("his.salesProxyFill");
-            if (StringUtils.isNotEmpty(json)) {
-                JSONObject jsonObject = JSON.parseObject(json);
-                Boolean salesProxyFill = jsonObject.getBoolean("isSalesProxyFill");
-                vo.setIsSalesProxyFill(salesProxyFill);
-            }
+            boolean salesProxyFill = getSalesProxyFillConfig();
+            vo.setIsSalesProxyFill(salesProxyFill);//销售填写权限 false:不可填写 true:可以填写
             if (map.getQuestionId() == null) {
                 FsQuestionAndAnswerVO questionAndAnswerVO = questionAndAnswerService.selectFsQuestionAndAnswerById(fsUserInformationCollection.getQuestionId());
                 List<AnswerVO> answerVOS = JSON.parseArray(fsUserInformationCollection.getJsonInfo(), AnswerVO.class);
@@ -1353,6 +1349,15 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         return result;
     }
 
+    @Override
+    public List<FsUserInformationCollectionOverviewVo> getUnBindCollectionList(FsUserInformationCollectionOverviewDTO queryDto) {
+        List<FsUserInformationCollectionOverviewVo> resultList=fsUserInformationCollectionMapper.getUnBindCollectionList(queryDto);
+        if (CollectionUtils.isEmpty(resultList)){
+            return Collections.emptyList();
+        }
+        return resultList;
+    }
+
     private List<AnswerVO> getAnswerVOs(List<AnswerVO> target,List<AnswerVO> source) {
         target.addAll(source);
         return target.stream()
@@ -1376,12 +1381,24 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
                     answer.setFlag(false);
                 }
             });
+
             // 只要有一个 answer 的 value 有值,就设置为已填
             boolean hasValue = param.getAnswers().stream()
                     .anyMatch(answer -> !CollectionUtils.isEmpty(answer.getValue()));
-            if (hasValue) {
-                fillFlag = 1;
+            boolean salesProxyFill = getSalesProxyFillConfig();//销售代理填写标识符
+            String source = param.getSource();//渠道来源
+            if (StringUtils.isNotBlank(source)){
+                //pc端填写
+                if (salesProxyFill&&hasValue){
+                    fillFlag = 1;
+                }
+            }else {
+                //小程序端
+                if ((!salesProxyFill)&&hasValue) {
+                    fillFlag = 1;
+                }
             }
+
         }
 
         // 所有基础属性赋值
@@ -1454,6 +1471,22 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         return shedule;
     }
 
+    /**
+     * 获取销售代填配置
+     * @return true: 允许销售代填, false: 不允许销售代填
+     */
+    private boolean getSalesProxyFillConfig() {
+        String json = configService.selectConfigByKey("his.salesProxyFill");
+        if (StringUtils.isNotEmpty(json)) {
+            try {
+                JSONObject jsonObject = JSON.parseObject(json);
+                return jsonObject.getBooleanValue("isSalesProxyFill");
+            } catch (Exception e) {
+                log.error("解析销售代填配置失败, json={}", json, e);
+            }
+        }
+        return false; // 默认返回 false
+    }
     public static void main(String[] args) {
 //        String str1 = "[{\"options\":[{\"flag\":false,\"name\":\"通天\",\"value\":0},{\"flag\":false,\"name\":\"哈哈\",\"value\":1}],\"title\":\"测试标题1\",\"value\":1},{\"options\":[{\"flag\":false,\"name\":\"呼呼\",\"value\":0},{\"flag\":false,\"name\":\"嘻嘻\",\"value\":1}],\"title\":\"测试标题2\",\"value\":1},{\"options\":[{\"flag\":false,\"name\":\"胸痛\",\"value\":0},{\"flag\":false,\"name\":\"胸闷\",\"value\":1},{\"flag\":false,\"name\":\"头晕\",\"value\":2},{\"flag\":false,\"name\":\"肢体麻木\",\"value\":3},{\"flag\":false,\"name\":\"无\",\"value\":4}],\"title\":\"您目前是否有心脑血管相关症状,如胸痛、胸闷、头晕、肢体麻木等?\",\"value\":1}]";
 //        String str2 = "[{\"options\":[{\"flag\":true,\"name\":\"胸痛\",\"value\":0},{\"flag\":true,\"name\":\"胸闷\",\"value\":1},{\"flag\":true,\"name\":\"头晕\",\"value\":2},{\"flag\":true,\"name\":\"肢体麻木\",\"value\":3},{\"flag\":true,\"name\":\"无\",\"value\":4}],\"title\":\"您目前是否有心脑血管相关症状,如胸痛、胸闷、头晕、肢体麻木等?\",\"value\":1},{\"options\":[{\"flag\":false,\"name\":\"胃疼\",\"value\":0},{\"flag\":false,\"name\":\"反酸\",\"value\":1},{\"flag\":false,\"name\":\"恶心\",\"value\":2},{\"flag\":false,\"name\":\"呕吐\",\"value\":3},{\"flag\":false,\"name\":\"黑便\",\"value\":4},{\"flag\":false,\"name\":\"无\",\"value\":5}],\"title\":\"您近期是否出现胃部不适症状,如胃痛、反酸、恶心、呕吐或黑便?\",\"value\":1}]";

+ 34 - 1
fs-service/src/main/resources/mapper/hisStore/FsUserInformationCollectionMapper.xml

@@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectUserInformationCollectionOverviewByPage"
-            parameterType="com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo"
+            parameterType="com.fs.hisStore.dto.FsUserInformationCollectionOverviewDTO"
             resultMap="FsUserInformationCollectionVoResult">
         SELECT
         infocollect.id,
@@ -145,10 +145,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="doctorName != null and doctorName != ''">
                 AND fd.doctor_name LIKE CONCAT('%', #{doctorName}, '%')
             </if>
+        </where>
+        ORDER BY infocollect.create_time DESC
+    </select>
 
+    <select id="getUnBindCollectionList" parameterType="com.fs.hisStore.dto.FsUserInformationCollectionOverviewDTO" resultMap="FsUserInformationCollectionVoResult">
+        SELECT
+        infocollect.id,
+        infocollect.json_info,
+        infocollect.create_time,
+        infocollect.doctor_id,
+        infocollect.company_user_id,
+        infocollect.age,
+        infocollect.user_name,
+        infocollect.sex,
+        infocollect.user_phone_four,
+        infocollect.allergy,
+        infocollect.remark,
+        cu.nick_name,
+        fd.doctor_name
+        FROM fs_user_information_collection infocollect
+        LEFT JOIN company_user cu ON infocollect.company_user_id = cu.user_id
+        LEFT JOIN fs_doctor fd ON infocollect.doctor_id = fd.doctor_id
+        <where>
+            infocollect.user_id IS NULL
+            <if test="userName != null and userName != ''">
+                AND infocollect.user_name LIKE CONCAT('%', #{userName}, '%')
+            </if>
+            <if test="companyUserName != null and companyUserName != ''">
+                AND cu.nick_name LIKE CONCAT('%', #{companyUserName}, '%')
+            </if>
+            <if test="doctorName != null and doctorName != ''">
+                AND fd.doctor_name LIKE CONCAT('%', #{doctorName}, '%')
+            </if>
         </where>
         ORDER BY infocollect.create_time DESC
     </select>
+
     <insert id="insertFsUserInformationCollection" parameterType="FsUserInformationCollection" useGeneratedKeys="true" keyProperty="id">
         insert into fs_user_information_collection
         <trim prefix="(" suffix=")" suffixOverrides=",">