From b0fd5033aa4fd99856ea409ef2071eed8f83fcbe Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 03 八月 2026 13:50:07 +0800
Subject: [PATCH] 【景宁】随访患者获取随访任务-需要查询同个患者(身份证)所有的任务 景宁
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 78 +++++++++++++++++++++++----------------
1 files changed, 46 insertions(+), 32 deletions(-)
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index 57f6c79..87fe1b8 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -6,7 +6,6 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
-import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.dx.MessageSend;
@@ -18,7 +17,6 @@
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.mapper.SysConfigMapper;
import com.ruoyi.system.service.ISysConfigService;
-import com.smartor.common.DeepSeekApi;
import com.smartor.common.FtpService;
import com.smartor.common.MtSubmitSmUtil;
import com.smartor.common.ScheduleSubtaskBuilder;
@@ -34,7 +32,6 @@
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
-import org.apache.ibatis.annotations.Param;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -125,6 +122,9 @@
@Autowired
private IServiceTaskScheduleService serviceTaskScheduleService;
+
+ @Autowired
+ private IPatArchiveService patArchiveService;
@Autowired
private ScheduleSubtaskBuilder scheduleSubtaskBuilder;
@@ -410,7 +410,16 @@
if (serviceSubtaskEntity.getSendstateView() == 3)
serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(4L)));
}
-
+ //鎮h�呰幏鍙栭殢璁夸换鍔�-闇�瑕佹煡璇㈠悓涓偅鑰咃紙韬唤璇侊級鎵�鏈夌殑浠诲姟 鏅畞
+ if (StringUtils.isNotEmpty(serviceSubtaskEntity.getOrgid()) && serviceSubtaskEntity.getOrgid().equals("47255004333112711A1001")) {
+ if(ObjectUtils.isNotEmpty(serviceSubtaskEntity.getPatid())){
+ PatArchive patArchive = patArchiveService.selectPatArchiveByPatid(serviceSubtaskEntity.getPatid());
+ if(ObjectUtils.isNotEmpty(patArchive) && StringUtils.isNotEmpty(patArchive.getIdcardno())){
+ serviceSubtaskEntity.setPatid(null);
+ serviceSubtaskEntity.setSfzh(patArchive.getIdcardno());
+ }
+ }
+ }
List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskEntity);
List<ServiceSubtaskRes> serviceSubtaskResList = new ArrayList<>();
@@ -1815,20 +1824,16 @@
//鐢ㄦ潵鏍囪锛屾槸鍚︽湁鍖归厤涓婄殑
Integer flag = 0;
//1-AI璇嗗埆
- SysConfig configVoiceMatchAi = new SysConfig();
- configVoiceMatchAi.setOrgid(phoneCallReqYQVO.getOrgid());
- configVoiceMatchAi.setConfigKey("sys.voice.match.ai");
- SysConfig matchAi = sysConfigMapper.selectConfig(configVoiceMatchAi);
+ String url = configService.selectConfigByKey("sys.voice.match.ai.url",phoneCallReqYQVO.getOrgid());
-// if (ObjectUtils.isNotEmpty(matchAi) && StringUtils.isNotEmpty(matchAi.getConfigValue())
-// && matchAi.getConfigValue().equals("1")) {
-// PhoneCallBackYQVO aiMatchResult = AiMatch(phoneCallReqYQVO, phoneCallBackYQVO,
-// ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate,
-// ivrTaskTemplateScripts, scriptId, flag);
-// if(aiMatchResult != null){
-// return aiMatchResult;
-// }
-// } else {
+ if (ObjectUtils.isNotEmpty(url)) {
+ PhoneCallBackYQVO aiMatchResult = AiMatch(url, phoneCallReqYQVO, phoneCallBackYQVO,
+ ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate,
+ ivrTaskTemplateScripts, scriptId, flag, phoneCallReqYQVO.getUuid());
+ if(aiMatchResult != null){
+ return aiMatchResult;
+ }
+ } else {
//鏄�夋嫨棰�
for (int j = 0; j < ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size(); j++) {
log.error("phoneCallReqYQVO.getAsrtext()鐨勫�间负锛歿}", phoneCallReqYQVO.getAsrtext());
@@ -2070,7 +2075,7 @@
continue;
}
}
-// }
+ }
//閮芥病鏈夊尮閰嶅埌
if (StringUtils.isEmpty(phoneCallBackYQVO.getValue())) {
log.info("閮芥病鏈夊尮閰嶅埌-------------------------");
@@ -2692,16 +2697,21 @@
@Cacheable(value = "sfStatistics", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) {
log.info("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
- String groupKey = "drcode";
+ String drcode = "drcode";
+ //缂欎簯浜烘皯 鏍规嵁缁忕鍖荤敓鍒嗙粍
+ if(serviceSubtaskCountReq.getOrgid().equals("47246116333112211A1001")){
+ drcode = "management_doctor_code";
+ }
+ String groupKey = drcode;
if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 1) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
- groupKey = "drcode";
+ groupKey = drcode;
} else {
groupKey = "leavehospitaldistrictcode";
}
} else if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 2) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
- groupKey = "drcode";
+ groupKey = drcode;
} else {
groupKey = "deptcode";
}
@@ -2714,11 +2724,14 @@
serviceSubtaskCountReq.setGroupKeyList(groupKeyList);
List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
switch (groupKey) {
- case "deptcode":
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptcode()).orElse("Unknown")));
- break;
case "drcode":
collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ break;
+ case "management_doctor_code":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getManagementDoctorCode()).orElse("Unknown")));
+ break;
+ case "deptcode":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptcode()).orElse("Unknown")));
break;
case "leavehospitaldistrictcode":
collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictcode()).orElse("Unknown")));
@@ -5056,16 +5069,16 @@
* @param options
* @return
*/
- public Integer matchOptionIndex(String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options){
+ public Integer matchOptionIndex(String url, String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options, String uuid){
JSONObject jsonObject = new JSONObject();
jsonObject.put("userQuestion",questionText);
jsonObject.put("userAnswer",voiceText);
jsonObject.put("options", options);
+ jsonObject.put("uuid", uuid);
String jsonString = jsonObject.toJSONString();
String result = null;
- String url = "http://localhost:8099/matchOptionIndex";
-// String url = configService.selectConfigByKey("sys.voice.match.ai.url");
+// String url = "http://localhost:8099/matchOptionIndex";
if(StringUtils.isNotEmpty(url)){
try {
Map<String, String> headers = new HashMap<>();
@@ -5083,15 +5096,15 @@
}
}
- public PhoneCallBackYQVO AiMatch(PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO,
+ public PhoneCallBackYQVO AiMatch(String url, PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO,
IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate,
- List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag){
+ List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag, String uuid){
PhoneCallBackYQVO back = null;
List<IvrTaskTemplateTargetoption> options = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList();
String voiceText = phoneCallReqYQVO.getAsrtext();
String questionText = StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrtext()) ? ivrTaskTemplateScriptVO.getIvrtext() : ivrTaskTemplateScriptVO.getScriptContent();
Integer matched = -1;
- matched = matchOptionIndex(questionText, voiceText, options);
+ matched = matchOptionIndex(url, questionText, voiceText, options, uuid);
//璇存槑鍖归厤姝g‘浜�
if(matched != null && matched >= 0){
IvrTaskTemplateTargetoption chosenOption = options.get(matched);
@@ -5327,8 +5340,9 @@
IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption3 = new IvrTaskTemplateTargetoption();
ivrTaskTemplateTargetoption3.setTargetvalue("鍏朵粬");
options.add(ivrTaskTemplateTargetoption3);
-
- Integer matched = matchOptionIndex(questionText,voiceText,options);
+ //1-AI璇嗗埆
+ String url = configService.selectConfigByKey("sys.voice.match.ai.url");
+ Integer matched = matchOptionIndex(url, questionText,voiceText,options,"1");
if(ObjectUtils.isNotEmpty(matched)){
if(matched >= 0){
matchedText = options.get(matched).getTargetvalue();
--
Gitblit v1.9.3