Ver código fonte

1.提交报名成功宣导语代码

jzp 4 dias atrás
pai
commit
5c648f24c3

+ 0 - 4
fs-service/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java

@@ -39,7 +39,6 @@ import com.fs.hisStore.vo.FsStoreProductExportVO;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.dto.UserProjectDTO;
 import com.fs.qw.mapper.QwUserMapper;
-import com.fs.qw.service.IQwExternalContactService;
 import com.fs.qw.service.IQwUserService;
 import com.fs.qw.vo.CompanyUserQwVO;
 import com.fs.qw.vo.QwOptionsVO;
@@ -113,9 +112,6 @@ public class CompanyUserServiceImpl implements ICompanyUserService
     @Autowired
     private ICompanyService companyService;
 
-    @Autowired
-    private IQwExternalContactService qwExternalContactService;
-
     @Autowired
     private IQwUserService qwUserService;
 

+ 96 - 2
fs-service/src/main/java/com/fs/fastGpt/service/impl/AiHookServiceImpl.java

@@ -34,10 +34,12 @@ import com.fs.fastgptApi.service.Impl.AudioServiceImpl;
 import com.fs.fastgptApi.util.AiImgUtil;
 import com.fs.fastgptApi.util.EventLogUtils;
 import com.fs.fastgptApi.vo.AudioVO;
+import com.fs.his.domain.FsFirstDiagnosis;
 import com.fs.his.domain.FsStoreOrder;
 import com.fs.his.dto.ExpressInfoDTO;
 import com.fs.his.dto.TracesDTO;
 import com.fs.his.enums.ShipperCodeEnum;
+import com.fs.his.mapper.FsFirstDiagnosisMapper;
 import com.fs.his.mapper.FsStoreMapper;
 import com.fs.his.mapper.FsStoreOrderMapper;
 import com.fs.his.service.IFsExpressService;
@@ -56,7 +58,9 @@ import com.fs.qwHookApi.param.QwHookSendMsgParam;
 import com.fs.qwHookApi.vo.QwHookMsgVO;
 import com.fs.qwHookApi.vo.QwHookVO;
 import com.fs.sop.domain.QwSopLogs;
+import com.fs.sop.domain.QwSopTempVoice;
 import com.fs.sop.mapper.QwSopLogsMapper;
+import com.fs.sop.service.impl.QwSopTempVoiceServiceImpl;
 import com.fs.utils.SensitiveDataUtils;
 import com.fs.voice.utils.StringUtil;
 import com.fs.wxwork.dto.*;
@@ -166,6 +170,12 @@ public class AiHookServiceImpl implements AiHookService {
     @Autowired
     private ICrmMsgService crmMsgService;
 
+    @Autowired
+    private FsFirstDiagnosisMapper fsFirstDiagnosisMapper;
+
+    @Autowired
+    private QwSopTempVoiceServiceImpl qwSopTempVoiceService;
+
     private static final String AI_REPLY = "AI_REPLY:";
     private static final String AI_REPLY_TAG = "AI_REPLY_TAG:";
 
@@ -588,7 +598,7 @@ public class AiHookServiceImpl implements AiHookService {
                             sendAiMsg(msg,sender,uid,serverId);
                         }
                         try {
-                            Thread.sleep(10000);
+                            Thread.sleep(2000);
                         } catch (InterruptedException e) {
 
                         }
@@ -601,6 +611,9 @@ public class AiHookServiceImpl implements AiHookService {
                 }
             }
 
+            //创建初诊单
+            aiCreateFirstForm(sender, uid,contentKh, user, fastGptChatSession,qwExternalContacts);
+
             aiEventProcess(sender, uid, role, contentKh, user, fastGptChatSession, serverId,qwExternalContacts);
 
 
@@ -613,6 +626,87 @@ public class AiHookServiceImpl implements AiHookService {
         return R.ok();
     }
 
+    /**
+     * 创建初诊单
+     */
+    private void aiCreateFirstForm(Long sender, String uid,String contentKh, QwUser qwUser,FastGptChatSession fastGptChatSession,QwExternalContact qwExternalContacts) {
+        if(contentKh.contains("【收集完成】") || contentKh.contains("【报名成功】")){
+            if(fastGptChatSession.getQwUserId() !=  null && qwExternalContacts.getFsUserId() != null){
+                FsFirstDiagnosis firstDiagnosis = fsFirstDiagnosisMapper.selectFsFirstDiagnosisByQwUserIdAndUserId(fastGptChatSession.getQwUserId(),qwExternalContacts.getFsUserId());
+                if(firstDiagnosis == null){
+                    Long id = qwExternalContacts.getId();
+                    QwExternalContactInfo info = qwExternalContactInfoMapper.selectQwExternalContactInfoByExternalContactId(id);
+                    if(info != null){
+                        Field[] fields = info.getClass().getDeclaredFields();
+                        FsFirstDiagnosis fsFirstDiagnosis = new FsFirstDiagnosis();
+                        for (Field field : fields) {
+                            field.setAccessible(true);
+                            Excel annotation = field.getAnnotation(Excel.class);
+                            if (annotation != null) {
+                                String name = field.getName();
+                                String fieldName = annotation.name();
+                                String[] split = new String[]{"姓名","性别","年龄","身体状态","手机号","是否线下就诊"};
+                                for (String zName : split) {
+                                    if (zName.equals(fieldName)) {
+                                        Object value = null;
+                                        try {
+                                            value = field.get(info);
+                                        } catch (IllegalAccessException e) {
+                                        }
+                                        switch (zName){
+                                            case "姓名":
+                                                fsFirstDiagnosis.setPatientName(value.toString());
+                                                break;
+                                            case "性别":
+                                                fsFirstDiagnosis.setGender(Long.valueOf(value.toString()));
+                                                break;
+                                            case "年龄":
+                                                fsFirstDiagnosis.setAge(value.toString());
+                                                break;
+                                            case "身体状态":
+                                                fsFirstDiagnosis.setPhysicalCondition(value.toString());
+                                                break;
+                                            case "手机号":
+                                                fsFirstDiagnosis.setPhone(value.toString());
+                                                break;
+                                        }
+                                    }
+                                }
+                            }
+                            fsFirstDiagnosisMapper.insertFsFirstDiagnosis(fsFirstDiagnosis);
+                        }
+                    }
+                }
+
+                //发送欢迎宣语
+                Long companyUserId = qwUser.getCompanyUserId();
+                QwSopTempVoice qwSopTempVoice = qwSopTempVoiceService.selectQwSopTempVoiceByCompanyUserIdAndVoiceTxt(companyUserId, "欢迎宣导");
+                if(qwSopTempVoice != null && qwSopTempVoice.getVoiceUrl() != null ){
+                    String voiceUrl = qwSopTempVoice.getVoiceUrl();
+                    WxwUploadCdnLinkFileDTO wxwUploadCdnLinkFileDTO = new WxwUploadCdnLinkFileDTO();
+                    wxwUploadCdnLinkFileDTO.setUrl(voiceUrl);
+                    wxwUploadCdnLinkFileDTO.setFilename(voiceUrl);
+                    wxwUploadCdnLinkFileDTO.setUuid(uid);
+                    WxWorkResponseDTO<WxwUploadCdnLinkFileRespDTO> dto = wxWorkService.uploadCdnLinkFile(wxwUploadCdnLinkFileDTO, qwUser.getServerId());
+                    WxwUploadCdnLinkFileRespDTO voice = dto.getData();
+                    WxwSendCDNVoiceMsgDTO wxwSendCDNVoiceMsgDTO = new WxwSendCDNVoiceMsgDTO();
+                    wxwSendCDNVoiceMsgDTO.setSend_userid(sender);
+                    System.out.println("语音size"+voice.getSize());
+                    wxwSendCDNVoiceMsgDTO.setVoice_time(qwSopTempVoice.getDuration());
+                    wxwSendCDNVoiceMsgDTO.setIsRoom(false);
+                    wxwSendCDNVoiceMsgDTO.setCdnkey(voice.getCdn_key());
+                    wxwSendCDNVoiceMsgDTO.setAeskey(voice.getAes_key());
+                    wxwSendCDNVoiceMsgDTO.setMd5(voice.getMd5());
+                    wxwSendCDNVoiceMsgDTO.setFileSize(voice.getSize());
+                    wxwSendCDNVoiceMsgDTO.setUuid(uid);
+                    WxWorkResponseDTO<WxwSendCDNVoiceMsgRespDTO> wxwSendCDNVoiceMsgRespDTOWxWorkResponseDTO = wxWorkService.SendCDNVoiceMsg(wxwSendCDNVoiceMsgDTO, qwUser.getServerId());
+                    log.info("发送语音成功"+qwUser);
+                    System.out.println(wxwSendCDNVoiceMsgRespDTOWxWorkResponseDTO);
+                }
+            }
+        }
+    }
+
     /**
      * 根据发送者id设置用户是否为首次回复
      * @param sender 发送者id
@@ -1403,7 +1497,7 @@ public class AiHookServiceImpl implements AiHookService {
     private R  sendAiMsg(Integer i,FastGptChatSession fastGptChatSession, FastGptRole role,QwUser user,Long qwExternalContactsId,String appKey,QwExternalContact qwExternalContacts,Long sender){
         //等待5秒
         try {
-            Thread.sleep(10000); // 5000 毫秒 = 5 秒
+            Thread.sleep(2000); // 5000 毫秒 = 5 秒
         } catch (InterruptedException e) {
             e.printStackTrace();
         }

+ 2 - 0
fs-service/src/main/java/com/fs/his/mapper/FsFirstDiagnosisMapper.java

@@ -119,4 +119,6 @@ public interface FsFirstDiagnosisMapper extends BaseMapper<FsFirstDiagnosis>{
             " ORDER BY fd.create_time desc " +
             "</script>"})
     List<FsFirstDiagnosisVO> selectFsFirstDiagnosisVOList(@Param("param") FsFirstDiagnosisParam param);
+
+    FsFirstDiagnosis selectFsFirstDiagnosisByQwUserIdAndUserId(@Param("qwUserId") Long qwUserId,@Param("fsUserId") Long fsUserId);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/qw/service/impl/QwExternalContactServiceImpl.java

@@ -72,6 +72,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -149,6 +150,7 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
     private ISysConfigService configService;
 
     @Autowired
+    @Lazy
     IQwSopService qwSopService;
 
     @Autowired
@@ -179,6 +181,7 @@ public class QwExternalContactServiceImpl extends ServiceImpl<QwExternalContactM
     @Autowired
     private QwAppContactWayMapper  qwAppContactWayMapper;
     @Autowired
+    @Lazy
     private SopUserLogsInfoMapper sopUserLogsInfoMapper;
 
     @Autowired

+ 0 - 6
fs-service/src/main/java/com/fs/sop/service/impl/QwSopServiceImpl.java

@@ -92,10 +92,6 @@ public class QwSopServiceImpl implements IQwSopService
     @Autowired
     private SopUserLogsMapper sopUserLogsMapper;
 
-    @Autowired
-    private AsyncSopService asyncSopService;
-
-
     @Autowired
     private AsyncSopTestService asyncSopTestService;
     @Autowired
@@ -115,8 +111,6 @@ public class QwSopServiceImpl implements IQwSopService
     private IQwSopTempDayService qwSopTempDayService;
     @Autowired
     private IQwSopTempRulesService qwSopTempRulesService;
-    @Autowired
-    private IQwSopTempContentService qwSopTempContentService;
 
     @Autowired
     private RocketMQTemplate rocketMQTemplate;

+ 3 - 0
fs-service/src/main/java/com/fs/sop/service/impl/SopUserLogsInfoServiceImpl.java

@@ -63,6 +63,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
 import javax.validation.ConstraintViolationException;
@@ -114,6 +115,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
     private SopUserLogsMapper sopUserLogsMapper;
 
     @Autowired
+    @Lazy
     private IQwSopService qwSopService;
 
     @Autowired
@@ -166,6 +168,7 @@ public class SopUserLogsInfoServiceImpl implements ISopUserLogsInfoService {
     private CompanyMapper companyMapper;
 
     @Autowired
+    @Lazy
     private IQwSopTempVoiceService sopTempVoiceService;
 
 

+ 2 - 3
fs-service/src/main/java/com/fs/sop/service/impl/SopUserLogsServiceImpl.java

@@ -48,6 +48,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
@@ -90,6 +91,7 @@ public class SopUserLogsServiceImpl  implements ISopUserLogsService {
     private RedisCache redisCache;
 
     @Autowired
+    @Lazy
     private IQwSopLogsService qwSopLogsService;
 
     @Autowired
@@ -98,9 +100,6 @@ public class SopUserLogsServiceImpl  implements ISopUserLogsService {
     @Autowired
     private IQwSopTempDayService qwSopTempDayService;
 
-    @Autowired
-    private ISopUserLogsService sopUserLogsService;
-
     @Autowired
     private ISysConfigService configService;
 

+ 1 - 1
fs-service/src/main/resources/application-config-druid-syysy.yml

@@ -86,7 +86,7 @@ headerImg:
 ipad:
   ipadUrl: http://ipad.ysya.top
   aiApi: http://49.232.181.28:3000/api
-  voiceApi:
+  voiceApi: http://127.0.0.1:8809
 wx_miniapp_temp:
   pay_order_temp_id:
   inquiry_temp_id:

+ 4 - 0
fs-service/src/main/resources/mapper/his/FsFirstDiagnosisMapper.xml

@@ -135,4 +135,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFsFirstDiagnosisVo"/>
         where user_id = #{userId}
     </select>
+    <select id="selectFsFirstDiagnosisByQwUserIdAndUserId" resultType="com.fs.his.domain.FsFirstDiagnosis">
+        <include refid="selectFsFirstDiagnosisVo"/>
+        where qw_user_id = #{qwUserId} and user_id = #{fsUserId} limit 1
+    </select>
 </mapper>

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

@@ -168,7 +168,7 @@ public class CompanyUserController extends  AppBaseController {
         companyUserMapper.updateCompanyUser(companyUser);
         try {
             CloseableHttpClient httpClient = HttpClients.createDefault();
-            HttpPost httpPost = new HttpPost("http://118.24.209.192:7771/app/common/addCompanyAudio");
+            HttpPost httpPost = new HttpPost("http://127.0.0.1:7771/app/common/addCompanyAudio");
             String json = "{\"url\":\""+wavUrl+"\",\"id\":\""+userId+"\"}";
             StringEntity entity = new StringEntity(json);
             httpPost.setEntity(entity);