소스 검색

Merge remote-tracking branch 'origin/master_feat_ysy_20250929' into master_feat_ysy_20250929

zx 1 주 전
부모
커밋
0f4be46206

+ 42 - 8
fs-qw-task/src/main/java/com/fs/app/taskService/impl/SopLogsTaskServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fs.app.taskService.SopLogsTaskService;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.redis.RedisCache;
 import com.fs.common.exception.base.BaseException;
 import com.fs.common.utils.PubFun;
 import com.fs.common.utils.StringUtils;
@@ -20,6 +21,7 @@ import com.fs.course.domain.*;
 import com.fs.course.mapper.*;
 import com.fs.course.param.FsCourseLinkCreateParam;
 import com.fs.course.service.IFsCourseLinkService;
+import com.fs.course.service.IFsUserCourseService;
 import com.fs.qw.domain.*;
 import com.fs.qw.mapper.QwExternalContactMapper;
 import com.fs.qw.mapper.QwUserMapper;
@@ -104,6 +106,11 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
     @Autowired
     private QwSopMapper sopMapper;
 
+    @Autowired
+    private FsUserCourseMapper fsUserCourseMapper;
+
+    @Autowired
+    private RedisCache redisCache;
 
     @Autowired
     private QwExternalContactServiceImpl qwExternalContactService;
@@ -177,6 +184,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
     private AsyncCourseWatchFinishService asyncCourseWatchFinishService;
 
 
+
     @PostConstruct
     public void init() {
         loadCourseConfig();
@@ -615,7 +623,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
 
                         insertSopUserLogs(sopUserLogsInfos, logVo, sendTime, ruleTimeVO, content, qwUserId,
                                 companyUserId, companyId, qwUserByRedis.getWelcomeText(),qwUserByRedis.getQwUserName(),
-                                groupChatMap, miniAppId,config,miniMap, sendMsgType,companies);
+                                groupChatMap, miniAppId,config,miniMap, sendMsgType,companies,day);
 
                     }
                 } catch (Exception e) {
@@ -660,7 +668,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
                                    String qwUserId,String companyUserId,String companyId,String welcomeText,String qwUserName,
                                    Map<String, QwGroupChat> groupChatMap,String miniAppId,CourseConfig config,
                                    Map<Long, Map<Integer, List<CompanyMiniapp>>> miniMap, Integer sendMsgType,
-                                   List<Company> companies) {
+                                   List<Company> companies,Long day) {
         String formattedSendTime = sendTime.toInstant()
                 .atZone(ZoneId.systemDefault())
                 .format(DATE_TIME_FORMATTER);
@@ -716,7 +724,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
                 QwSopLogs sopLogs = createBaseLog(formattedSendTime, logVo, ruleTimeVO, groupChat.getChatId(), groupChat.getName(), null, isOfficial, null,null);
                 handleLogBasedOnType(sopLogs, content, logVo, sendTime, courseId, videoId,
                         type, qwUserId, companyUserId, companyId, groupChat.getChatId(), welcomeText, qwUserName,
-                        null, true, miniAppId, groupChat,config, miniMap, null, sendMsgType,companies);
+                        null, true, miniAppId, groupChat,config, miniMap, null, sendMsgType,companies,day);
             } else {
                 if(groupChat.getChatUserList() != null && !groupChat.getChatUserList().isEmpty()){
                     groupChat.getChatUserList().forEach(user -> {
@@ -725,7 +733,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
                         QwSopLogs sopLogs = createBaseLog(formattedSendTime, logVo, ruleTimeVO, user.getUserId(), user.getName(), null, isOfficial, null,null);
                         handleLogBasedOnType(sopLogs, content, logVo, sendTime, courseId, videoId,
                                 type, qwUserId, companyUserId, companyId, user.getId().toString(), welcomeText, qwUserName,
-                                null, false, miniAppId, groupChat,config, miniMap, null, sendMsgType,companies);
+                                null, false, miniAppId, groupChat,config, miniMap, null, sendMsgType,companies,day);
                     });
                 }
             }
@@ -740,7 +748,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
                     QwSopLogs sopLogs = createBaseLog(formattedSendTime, logVo, ruleTimeVO, contactId.getExternalContactId(), externalUserName, fsUserId, isOfficial, contactId.getExternalId(),contactId.getIsDaysNotStudy());
                     handleLogBasedOnType(sopLogs, content, logVo, sendTime, courseId, videoId,
                             type, qwUserId, companyUserId, companyId, externalId, welcomeText, qwUserName, fsUserId, false, miniAppId,
-                            null,config, miniMap, grade, sendMsgType,companies);
+                            null,config, miniMap, grade, sendMsgType,companies,day);
                 } catch (Exception e) {
                     log.error("处理 externalContactId {} 时发生异常: {}", contactId, e.getMessage(), e);
                 }
@@ -855,7 +863,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
                                       String qwUserName, Long fsUserId, boolean isGroupChat, String miniAppId,
                                       QwGroupChat groupChat,CourseConfig config,
                                       Map<Long, Map<Integer, List<CompanyMiniapp>>> miniMap,
-                                      Integer grade, Integer sendMsgType ,List<Company> companies ) {
+                                      Integer grade, Integer sendMsgType ,List<Company> companies,Long day ) {
         switch (type) {
             case 1:
                 handleNormalMessage(sopLogs, content,companyUserId);
@@ -863,7 +871,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
             case 2:
                 handleCourseMessage(sopLogs, content, logVo, sendTime, courseId, videoId,
                         qwUserId, companyUserId, companyId, externalId, welcomeText,qwUserName, fsUserId,
-                        isGroupChat, miniAppId, groupChat,config,miniMap, grade, sendMsgType,companies);
+                        isGroupChat, miniAppId, groupChat,config,miniMap, grade, sendMsgType,companies,day);
                 break;
             case 3:
                 handleOrderMessage(sopLogs, content);
@@ -904,7 +912,7 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
                                      String companyId, String externalId, String welcomeText, String qwUserName,
                                      Long fsUserId, boolean isGroupChat, String miniAppId, QwGroupChat groupChat,CourseConfig config,Map<Long,
                     Map<Integer, List<CompanyMiniapp>>> miniMap,Integer grade, Integer sendMsgType,
-                                     List<Company> companies) {
+                                     List<Company> companies,Long day) {
         // 深拷贝 Content 对象,避免使用 JSON
         QwSopTempSetting.Content clonedContent = deepCopyContent(content);
         if (clonedContent == null) {
@@ -1016,6 +1024,13 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
 
                     }
 
+                    Long courseProjectType = getCourseProjectType(courseId);
+
+                    // 医言九鼎 天数小于 7 发 广珍堂大药房
+                    if (!Objects.isNull(courseProjectType) && day <=7 && (courseProjectType== 17 || courseProjectType== 22 )){
+                        setting.setMiniprogramAppid("wx0d1a3dd485268521");
+                    }
+
                     setting.setMiniprogramPage(sortLink.replaceAll("^[\\s\\u2005]+", ""));
 
                     try {
@@ -1067,6 +1082,25 @@ public class SopLogsTaskServiceImpl implements SopLogsTaskService {
         enqueueQwSopLogs(sopLogs);
     }
 
+    private Long getCourseProjectType(Long courseId){
+
+        String courseKey="h5user:course:project:" + courseId;
+
+        Long courseProject=null;
+        try {
+            courseProject = redisCache.getCacheObject(courseKey);
+        }catch (Exception e){
+            log.error("获取课程-项目有误:{}{}", courseId,e.getMessage());
+        }
+
+        if (courseProject==null){
+            FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(courseId);
+            courseProject=fsUserCourse.getProject();
+            redisCache.setCacheObject(courseKey,fsUserCourse.getProject());
+        }
+        return courseProject;
+    }
+
     private String getAppIdFromMiniMap(Map<Long, Map<Integer, List<CompanyMiniapp>>> miniMap,
                                        String companyId,
                                        int sendMsgType,

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

@@ -14,6 +14,7 @@ import com.fs.common.exception.CustomException;
 import com.fs.common.exception.ServiceException;
 import com.fs.common.utils.*;
 import com.fs.common.utils.ip.IpUtils;
+import com.fs.company.cache.ICompanyUserCacheService;
 import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyDept;
 import com.fs.company.domain.CompanyMoneyLogs;
@@ -316,6 +317,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
     @Autowired
     private IFsOrderSopLogService fsOrderSopLogService;
 
+    @Autowired
+    private ICompanyUserCacheService companyUserCacheService;
+
     //ERP 类型到服务的映射
     private Map<Integer, IErpOrderService> erpServiceMap;
     @PostConstruct
@@ -935,7 +939,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
             String name = collection.getUserName() != null ? collection.getUserName() : "-";
             msg.setTitle("用户信息采集开方");
             msg.setType(1);
-            msg.setContent("患者:" + name + "的信息采集,前往开方");
+            String companyUserName = companyUserCacheService.selectCompanyUserNameUserById(collection.getCompanyUserId());
+            msg.setContent("患者:" + name + "的信息采集,前往开方,来源客服:"+companyUserName);
             msg.setDoctorId(collection.getDoctorId());
             msg.setCreateTime(DateUtils.getNowDate());
             doctorMsgMapper.insertDoctorMsg(msg);

+ 34 - 13
fs-service/src/main/java/com/fs/hisStore/service/impl/FsUserInformationCollectionServiceImpl.java

@@ -22,6 +22,7 @@ import com.fs.common.exception.CustomException;
 import com.fs.common.utils.DateUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.utils.StringUtils;
+import com.fs.company.cache.ICompanyUserCacheService;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.mapper.CompanyUserMapper;
 import com.fs.company.service.ICompanyService;
@@ -176,6 +177,9 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
 
     @Autowired
     private FsUserInformationCollectionScheduleMapper scheduleMapper;
+
+    @Autowired
+    private ICompanyUserCacheService companyUserCacheService;
     /**
      * 查询用户信息采集
      *
@@ -269,6 +273,16 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         fsUserInformationCollection.setDoctorConfirm(0);
         fsUserInformationCollection.setStatus(1);
         fsUserInformationCollection.setUpdateTime(DateUtils.getNowDate());
+        fsUserInformationCollection.setRemark(param.getRemark());
+        fsUserInformationCollection.setSex(param.getSex());
+        fsUserInformationCollection.setIsPackage(param.getIsPackage());
+        fsUserInformationCollection.setUserName(param.getUserName());
+        fsUserInformationCollection.setPackageId(param.getPackageId());
+        fsUserInformationCollection.setUserPhoneFour(param.getUserPhoneFour());
+        fsUserInformationCollection.setAllergy(param.getAllergy());
+        fsUserInformationCollection.setPayType(param.getPayType());
+        fsUserInformationCollection.setQuestionId(param.getQuestionId());
+        fsUserInformationCollection.setAmount(param.getAmount());
         baseMapper.updateFsUserInformationCollection(fsUserInformationCollection);
         return fsUserInformationCollection.getId();
     }
@@ -630,9 +644,11 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
                 return R.error("用户已确认");
             }
         }
+        logger.info("采集信息id:{},采集信息用户id{},当前登录用户id{}",param.getId(),collection.getUserId(),param.getUserId());
         if (!Objects.equals(collection.getUserId(), param.getUserId())) {
             return R.error("用户信息不匹配,无法确认");
         }
+
         FsUserInformationCollection map = new FsUserInformationCollection();
         map.setId(param.getId());
         map.setUserConfirm(1);
@@ -640,23 +656,28 @@ public class FsUserInformationCollectionServiceImpl extends ServiceImpl<FsUserIn
         //用户信息采集表id
         Long collectionId = collection.getId();
         FsUserInformationCollectionSchedule schedule = scheduleMapper.selectCollectionScheduleByCollectionId(collectionId);
-        if (collection.getStatus() == 1 && collection.getIsPackage() == 0) {
-            //用户第一次确认添加医生消息
-            DoctorMsg msg = new DoctorMsg();
-            String name = collection.getUserName() != null ? collection.getUserName() : "-";
-            //没套餐包的添加医生信息采集建议消息
-            msg.setTitle("用户采集信息建议");
-            msg.setType(3);
-            msg.setContent("患者:" + name + "的信息采集,前往建议");
-            msg.setDoctorId(collection.getDoctorId());
-            msg.setCreateTime(DateUtils.getNowDate());
-            //插入医生消息
-            doctorMsgMapper.insertDoctorMsg(msg);
+        if (collection.getStatus() == 1) {
+            if (collection.getIsPackage() == 0) {
+                //用户第一次确认添加医生消息
+                DoctorMsg msg = new DoctorMsg();
+                String name = collection.getUserName() != null ? collection.getUserName() : "-";
+                //没套餐包的添加医生信息采集建议消息
+                msg.setTitle("用户采集信息建议");
+                msg.setType(3);
+                String companyUserName = companyUserCacheService.selectCompanyUserNameUserById(collection.getCompanyUserId());
+                msg.setContent("患者:" + name + "的信息采集,前往建议,来源客服:"+companyUserName);
+                msg.setDoctorId(collection.getDoctorId());
+                msg.setCreateTime(DateUtils.getNowDate());
+                //插入医生消息
+                doctorMsgMapper.insertDoctorMsg(msg);
+            }
             //第一次确认
             map.setStatus(2);
             //设置用户信息采集进度节点
             if (schedule != null) {
-                if (schedule.getPackageId() != null) {
+                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());

+ 5 - 0
fs-service/src/main/java/com/fs/qw/param/QwExternalContactParam.java

@@ -2,6 +2,7 @@ package com.fs.qw.param;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.Date;
@@ -131,4 +132,8 @@ public class QwExternalContactParam {
 
     private Long wayId;
 
+    @ApiModelProperty(value = "页码,默认为1")
+    private Integer pageNum =1;
+    @ApiModelProperty(value = "页大小,默认为10")
+    private Integer pageSize = 10;
 }

+ 1 - 0
fs-service/src/main/resources/mapper/qw/FsUserInformationCollectionScheduleMapper.xml

@@ -122,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="orderCode != null and orderCode != ''"> AND s2.order_code = #{orderCode}</if>
             )
         </where>
+        ORDER BY s.create_time desc
     </select>
     
     <select id="selectFsUserInformationCollectionScheduleById" parameterType="Long" resultMap="FsUserInformationCollectionScheduleResult">

+ 14 - 0
fs-user-app/src/main/java/com/fs/app/controller/QuestionAndAnswerController.java

@@ -4,6 +4,7 @@ import com.fs.app.annotation.Login;
 import com.fs.common.core.domain.R;
 import com.fs.his.service.IFsQuestionAndAnswerService;
 import com.fs.his.vo.FsQuestionAndAnswerVO;
+import com.fs.his.vo.OptionsVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @Api("问答")
 @RestController
 @RequestMapping(value="/app/answer")
@@ -27,4 +30,15 @@ public class QuestionAndAnswerController {
         FsQuestionAndAnswerVO vo = questionAndAnswerService.selectFsQuestionAndAnswerById(questionId);
         return R.ok().put("data", vo);
     }
+
+    /**
+     * 查询问答列表
+     */
+    @ApiOperation("问答列表")
+    @GetMapping("/allList")
+    public R answerList()
+    {
+        List<OptionsVO> list = questionAndAnswerService.selectAllQuestionOptions();
+        return R.ok().put("data",list);
+    }
 }

+ 53 - 0
fs-user-app/src/main/java/com/fs/app/controller/UserInfoCollectionController.java

@@ -1,12 +1,19 @@
 package com.fs.app.controller;
 
+import com.fs.common.annotation.Log;
+import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
+import com.fs.common.enums.BusinessType;
 import com.fs.course.param.CollectionInfoConfirmParam;
 import com.fs.course.vo.FsUserInfoCollectionUVO;
+import com.fs.framework.security.SecurityUtils;
+import com.fs.hisStore.domain.FsUserInformationCollection;
+import com.fs.hisStore.param.FsUserInformationCollectionParam;
 import com.fs.hisStore.service.IFsUserInformationCollectionService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 @Api("用户信息采集接口")
@@ -32,4 +39,50 @@ public class UserInfoCollectionController extends AppBaseController {
         param.setUserId(Long.parseLong(getUserId()));
         return userInformationCollectionService.userConfirm(param);
     }
+
+
+    /**
+     * 获取用户信息采集详细信息
+     */
+    @ApiOperation("获取用户信息采集详细信息")
+    @GetMapping(value = "/detail")
+    public R detail(FsUserInformationCollection param)
+    {
+        return R.ok().put("data", userInformationCollectionService.getInfo(param));
+    }
+
+    /**
+     * 新增用户信息采集
+     */
+    @ApiOperation("新增用户信息采集")
+    @Log(title = "用户信息采集", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    public R add(@RequestBody FsUserInformationCollectionParam fsUserInformationCollection)
+    {
+        Long l = userInformationCollectionService.insertFsUserInformationCollection(fsUserInformationCollection);
+        if (l > 0) {
+            return R.ok();
+
+        } else {
+            return R.error();
+        }
+    }
+
+    /**
+     * 修改用户信息采集
+     */
+    @ApiOperation("修改用户信息采集")
+    @Log(title = "用户信息采集", businessType = BusinessType.UPDATE)
+    @PutMapping("/edit")
+    public R edit(@RequestBody FsUserInformationCollectionParam fsUserInformationCollection)
+    {
+
+        Long l = userInformationCollectionService.updateFsUserInformationCollection(fsUserInformationCollection);
+        if (l > 0) {
+            return R.ok();
+
+        } else {
+            return R.error();
+        }
+    }
 }

+ 44 - 0
fs-user-app/src/main/java/com/fs/app/controller/qw/QwExternalContactController.java

@@ -0,0 +1,44 @@
+package com.fs.app.controller.qw;
+
+import com.fs.app.controller.AppBaseController;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.qw.param.QwExternalContactParam;
+import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.vo.QwExternalContactVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping(value="/app/externalContact")
+public class QwExternalContactController extends AppBaseController {
+
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
+    @ApiOperation("我的企微客户")
+    @GetMapping("/myList")
+    public R myList(QwExternalContactParam qwExternalContact)
+    {
+        if(qwExternalContact.getQwUserId()==null && qwExternalContact.getCompanyId() == null){
+            return null;
+        }
+        //PageHelper.startPage(qwExternalContact.getPageNum(), qwExternalContact.getPageSize());
+        startPage();
+        List<QwExternalContactVO> list = qwExternalContactService.selectQwExternalContactListVO(qwExternalContact);
+        if (!CollectionUtils.isEmpty(list)) {
+            list = list.stream().filter(s -> s.getFsUserId() != null).collect(Collectors.toList());
+        }
+        PageInfo<QwExternalContactVO> pageInfo = new PageInfo<>(list);
+        return R.ok().put("data", pageInfo);
+    }
+}

+ 31 - 0
fs-user-app/src/main/java/com/fs/app/controller/qw/QwUserController.java

@@ -0,0 +1,31 @@
+package com.fs.app.controller.qw;
+
+import com.fs.app.controller.AppBaseController;
+import com.fs.common.core.domain.R;
+import com.fs.common.utils.ServletUtils;
+import com.fs.qw.service.IQwUserService;
+import com.fs.qw.vo.QwOptionsVO;
+import io.swagger.annotations.ApiOperation;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@RequestMapping(value="/app/qwUser")
+public class QwUserController extends AppBaseController {
+
+    @Autowired
+    private IQwUserService qwUserService;
+
+    @ApiOperation("我的企业信息")
+    @GetMapping("/getMyQwUserList")
+    public R getMyQwUserList(@Param("companyUserId") Long companyUserId)
+    {
+        List<QwOptionsVO> list = qwUserService.selectQwUserListOptionsVOByCompanyUserId(companyUserId);
+        return  R.ok().put("data",list);
+    }
+}