diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/questioninfo/QuestionInfo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/questioninfo/QuestionInfo.java index e20b0850..06d9f636 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/questioninfo/QuestionInfo.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/questioninfo/QuestionInfo.java @@ -135,6 +135,16 @@ public class QuestionInfo extends BaseEntity { */ private Long sourceTemplateId; + /** + * 话术表ID + */ + private Long scriptInfoId; + + /** + * 机器人模板ID(冗余字段) + */ + private String robotPublishId; + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/questionsubjectoption/QuestionSubjectOption.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/questionsubjectoption/QuestionSubjectOption.java index f57cb4dd..958cf066 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/questionsubjectoption/QuestionSubjectOption.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/questionsubjectoption/QuestionSubjectOption.java @@ -81,8 +81,17 @@ public class QuestionSubjectOption extends BaseEntity { @Excel(name = "选项备注") private String optionRemark; + /** + * 匹配问题文本。如果带变量,则用竖线|分隔,分段匹配,各分段必须都匹配。 + */ + private String speechContextText; - @Override + /** + * 匹配意图描述,如果多个意图,用竖线|隔开,任意一个匹配即可。 + */ + private String intent; + + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/signpatientmanageroutenode/SignPatientManageRouteNode.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/signpatientmanageroutenode/SignPatientManageRouteNode.java index 10ce9270..03ee08a5 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/signpatientmanageroutenode/SignPatientManageRouteNode.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/signpatientmanageroutenode/SignPatientManageRouteNode.java @@ -91,6 +91,12 @@ public class SignPatientManageRouteNode extends BaseEntity { @Excel(name = "话术表 ID") private Long scriptInfoId; + /** + * 爱医声平台机器人ID + */ + @ApiModelProperty(value = "爱医声平台机器人ID") + private String robotPublishId; + /** 电话模板ID */ @ApiModelProperty(value = "电话模板ID") @Excel(name = "电话模板ID") diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/aibo/impl/AIOBServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/aibo/impl/AIOBServiceImpl.java index 8adcab16..8c203092 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/aibo/impl/AIOBServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/aibo/impl/AIOBServiceImpl.java @@ -448,4 +448,19 @@ public class AIOBServiceImpl implements IAIOBService { importTask(importTaskDto); } + /** + * @description 通过通话记录解析问卷内容 + * @param record 通话记录 + * @Author haown + * @Date 2024-9-6 14:30 + */ + private void parseQuestionInfo(JSONArray record) { + // record=[{"role":"speech","timestamp":1724917698521,"contextText":"您好,我是山东省立医院的电话客服,请问您是李四本人或家属吗?", "sn":"19a09431-1ac6-43a1-8f9f-4b6f617bed73","intent":"NOINTENT","start":"00:00.033","stop":"00:06.974","timeLen":6941,"interrupted":false,"silent":false,"nodeInfo":"eyJwcm9jZXNzTmFtZSI6IuaFoueXheeUqOiNr+Wbnuiuv+ivneacryIsIm5vZGVOYW1lIjoi5byA5Zy655m96IqC54K5X3RwcnZtc2g4IiwiaW50ZW50IjoiIiwiZW50aXR5IjpbXSwic3lzdGVtRXZlbnQiOiIiLCJmYXEiOiIifQ=="}, + // {"role":"voice","timestamp":1724917707542,"content":"是的","contextText":"是的","sn":"0e5c9c4e65db11ef_2_1","start":"00:06.930","stop":"00:08.330","timeLen":1400,"interrupted":false,"silent":false}, + // {"role":"speech","timestamp":1724917708359,"content":"是的","contextText":"好的,您之前在我们医院住过院,想了解一下您近期的健康状况。","sn":"0e5c9c4e65db11ef_2_1","intent":"patient_self","start":"00:09.871","stop":"00:15.793","timeLen":5922,"interrupted":false,"silent":false,"nodeInfo":"eyJwcm9jZXNzTmFtZSI6IuaFoueXheeUqOiNr+Wbnuiuv+ivneacryIsIm5vZGVOYW1lIjoi5pys5Lq66IqC54K5X3Nyd2Q5MTR3IiwiaW50ZW50Ijoi5piv5pys5Lq6IiwiZW50aXR5IjpbXSwic3lzdGVtRXZlbnQiOiIiLCJmYXEiOiIifQ=="}, + // {"role":"voice","timestamp":1724917718191,"content":"好的嗯","contextText":"好的嗯","sn":"0e5c9c4e65db11ef_4_1","start":"00:16.650","stop":"00:18.970","timeLen":2320,"interrupted":false,"silent":false}, + // {"role":"speech","timestamp":1724917718873,"content":"好的嗯","contextText":"您是否正常按时服药呢?","sn":"0e5c9c4e65db11ef_4_1","intent":"NOINTENT","start":"00:20.385","stop":"00:22.917","timeLen":2532,"interrupted":false,"silent":false,"nodeInfo":"eyJwcm9jZXNzTmFtZSI6IuaFoueXheeUqOiNr+Wbnuiuv+ivneacryIsIm5vZGVOYW1lIjoi6IKv5a6a6IqC54K5X3F6aWpzb2g2IiwiaW50ZW50IjoiIiwiZW50aXR5IjpbXSwic3lzdGVtRXZlbnQiOiIiLCJmYXEiOiIifQ=="}, + // {"role":"voice","timestamp":1724917725425,"content":"是的","contextText":"是的","sn":"0e5c9c4e65db11ef_6_1","start":"00:24.810","stop":"00:26.210","timeLen":1400,"interrupted":false,"silent":false}, + // {"role":"speech","timestamp":1724917725993,"content":"是的","contextText":"祝您早日康复。","sn":"0e5c9c4e65db11ef_6_1","intent":"sys_yes","start":"00:27.505","stop":"00:29.637","timeLen":2132,"interrupted":false,"silent":false,"nodeInfo":"eyJwcm9jZXNzTmFtZSI6IuaFoueXheeUqOiNr+Wbnuiuv+ivneacryIsIm5vZGVOYW1lIjoi5oyJ5pe25pyN6I2v6IqC54K5X3Bxd2RkcDBpIiwiaW50ZW50Ijoi6IKv5a6a5oSP5Zu+IiwiZW50aXR5IjpbXSwic3lzdGVtRXZlbnQiOiIiLCJmYXEiOiIifQ=="}], + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java index 9e871bce..f956f56b 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java @@ -20,6 +20,7 @@ import com.xinelu.common.enums.ErrorStatusEnum; import com.xinelu.common.enums.NodeExecuteResultStatusEnum; import com.xinelu.common.enums.NodeExecuteStatusEnum; import com.xinelu.common.enums.PhoneConnectStatusEnum; +import com.xinelu.common.enums.PhoneDialMethodEnum; import com.xinelu.common.enums.PhoneMessageRemindEnum; import com.xinelu.common.enums.PhoneRedialTimesEnum; import com.xinelu.common.enums.RouteNodeNameEnum; @@ -732,6 +733,10 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout templateDetail = JSONObject.parseObject(JSONObject.toJSONString(scriptInfo)); manageRouteNode.setTemplateType(TemplateTypeConstants.SCRIPT); manageRouteNode.setTemplateDetail(templateDetail); + + if (StringUtils.equals(PhoneDialMethodEnum.AI.getInfo(), manageRouteNode.getPhoneDialMethod()) && StringUtils.isBlank(scriptInfo.getRobotPublishId())) { + throw new ServiceException("第三方机器人id为空"); + } } // 电话短信内容 if (node.getPhoneMessageTemplateId() != null) { @@ -777,6 +782,10 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout templateDetail = JSONObject.parseObject(JSONObject.toJSONString(scriptInfo)); manageNode.setTemplateType(TemplateTypeConstants.SCRIPT); manageNode.setTemplateDetail(templateDetail); + + if (StringUtils.equals(PhoneDialMethodEnum.AI.getInfo(), manageNode.getPhoneDialMethod()) && StringUtils.isBlank(scriptInfo.getRobotPublishId())) { + throw new ServiceException("第三方机器人id为空"); + } } } else if (manageNode.getQuestionInfoId() != null) { // 问卷 // 查询问卷详情 diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java index 07b9ffc4..145e9292 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java @@ -28,6 +28,7 @@ import com.xinelu.manage.domain.patienttaskexecuterecord.PatientTaskExecuteRecor import com.xinelu.manage.domain.patienttaskstatistics.PatientTaskStatistics; import com.xinelu.manage.domain.patientvisitrecord.PatientVisitRecord; import com.xinelu.manage.domain.propagandainfo.PropagandaInfo; +import com.xinelu.manage.domain.questioninfo.QuestionInfo; import com.xinelu.manage.domain.scriptInfo.ScriptInfo; import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute; import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode; @@ -748,6 +749,9 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage // 话术库json内容替换 manageNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList)); manageNode.setPhoneTemplateId(scriptInfo.getScriptId()); + if (StringUtils.equals(PhoneDialMethodEnum.AI.getInfo(), manageNode.getPhoneDialMethod()) && StringUtils.isBlank(scriptInfo.getRobotPublishId())) { + throw new ServiceException("第三方机器人id为空"); + } } } // 电话短信内容 @@ -1168,8 +1172,17 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage break; // 问卷 case TaskNodeTypeConstants.QUESTIONNAIRE_SCALE: + QuestionInfo questionInfo = questionInfoService.selectQuestionInfoById(node.getTemplateId()); manageRouteNode.setQuestionInfoId(node.getTemplateId()); manageRouteNode.setQuestionnaireName(node.getTemplateName()); + if (ObjectUtils.isNotEmpty(questionInfo)) { + manageRouteNode.setScriptInfoId(questionInfo.getScriptInfoId()); + manageRouteNode.setRobotPublishId(questionInfo.getRobotPublishId()); + // 节点是否是AI电话 + if (StringUtils.equals(PhoneDialMethodEnum.AI.getInfo(), manageRouteNode.getPhoneDialMethod()) && StringUtils.isBlank(questionInfo.getRobotPublishId())) { + throw new ServiceException("第三方机器人id为空"); + } + } break; // 话术 case TaskNodeTypeConstants.PHONE_OUTBOUND: @@ -1179,9 +1192,10 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage if (ObjectUtils.isNotEmpty(scriptInfo)) { // 话术库json内容替换 manageRouteNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList)); + manageRouteNode.setRobotPublishId(scriptInfo.getRobotPublishId()); // 节点是否是AI电话 - if (StringUtils.equals(PhoneDialMethodEnum.AI.getInfo(), manageRouteNode.getPhoneDialMethod())) { - + if (StringUtils.equals(PhoneDialMethodEnum.AI.getInfo(), manageRouteNode.getPhoneDialMethod()) && StringUtils.isBlank(scriptInfo.getRobotPublishId())) { + throw new ServiceException("第三方机器人id为空"); } } break; diff --git a/postdischarge-manage/src/main/resources/mapper/manage/questioninfo/QuestionInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/questioninfo/QuestionInfoMapper.xml index 77288d63..0454c5ff 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/questioninfo/QuestionInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/questioninfo/QuestionInfoMapper.xml @@ -21,6 +21,8 @@ + + @@ -44,7 +46,9 @@ questionnaire_remark, source_template_id, question_type, - create_by, + script_info_id, + robot_publish_id, + create_by, create_time, update_by, update_time @@ -208,6 +212,10 @@ question_type, + script_info_id, + + robot_publish_id, + create_by, create_time, @@ -248,6 +256,10 @@ #{questionType}, + #{scriptInfoId}, + + #{robotPublishId}, + #{createBy}, #{createTime}, @@ -307,6 +319,12 @@ question_type = #{questionType}, + script_info_id = + #{scriptInfoId}, + + robot_publish_id = + #{robotPublishId}, + create_by = #{createBy}, diff --git a/postdischarge-manage/src/main/resources/mapper/manage/questionsubjectoption/QuestionSubjectOptionMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/questionsubjectoption/QuestionSubjectOptionMapper.xml index 44b74bd7..6d57132c 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/questionsubjectoption/QuestionSubjectOptionMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/questionsubjectoption/QuestionSubjectOptionMapper.xml @@ -17,6 +17,8 @@ + + @@ -31,7 +33,9 @@ create_by, create_time, update_by, - update_time + update_time, + speech_context_text, + intent from question_subject_option @@ -95,6 +99,10 @@ update_time, + speech_context_text, + + intent, + #{questionnaireSubjectId}, @@ -119,6 +127,10 @@ #{updateTime}, + #{speechContextText}, + + #{intent}, + @@ -158,6 +170,12 @@ update_time = #{updateTime}, + speech_context_text = + #{speechContextText}, + + intent = + #{intent}, + where id = #{id} @@ -185,7 +203,9 @@ option_sort, option_remark, create_by, - create_time + create_time, + speech_context_text, + intent ) values ( @@ -197,7 +217,9 @@ #{QuestionSubjectOption.optionSort}, #{QuestionSubjectOption.optionRemark}, #{QuestionSubjectOption.createBy}, - #{QuestionSubjectOption.createTime} + #{QuestionSubjectOption.createTime}, + #{QuestionSubjectOption.speechContextText}, + #{QuestionSubjectOption.intent} ) @@ -215,7 +237,9 @@ create_by, create_time, update_by, - update_time + update_time, + speech_context_text, + intent from question_subject_option diff --git a/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml index c1b95932..a76f0704 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml @@ -19,6 +19,7 @@ + @@ -85,7 +86,7 @@ - select id, manage_route_id, manage_route_name, route_node_id, route_node_name, route_node_day, task_type, task_status, task_subdivision, task_node_type, second_classify_describe, execute_time, phone_push_sign, script_info_id, phone_template_id, phone_template_name, phone_node_content,phone_result_json, phone_redial_times, phone_time_interval, phone_message_remind, phone_message_template_id, phone_message_template_name,phone_message_template_content,question_info_id, questionnaire_name, questionnaire_content, question_expiration_date, propaganda_info_id, propaganda_title, propaganda_content, message_push_sign, message_template_id, message_template_code, message_template_name, message_preview, message_node_content, official_push_sign, official_template_id, official_template_code, official_template_name, official_remind_content, official_node_content, follow_template_id, follow_template_name, applet_push_sign, applet_template_id, applet_template_code, applet_template_name, applet_remind_content, applet_prompt_description, applet_node_content, route_check_status, route_check_person, route_check_date, route_check_remark, route_node_remark, node_execute_status, route_handle_remark, route_handle_id, route_handle_person, route_link,text_remind_content, node_content,message_status, del_flag, create_by, create_time, update_by, update_time, phone_dial_method, phone_node_execute_result_status, message_node_execute_result_status, official_node_execute_result_status, applet_node_execute_result_status, node_finish_date, task_id_ext from sign_patient_manage_route_node + select id, manage_route_id, manage_route_name, route_node_id, route_node_name, route_node_day, task_type, task_status, task_subdivision, task_node_type, second_classify_describe, execute_time, phone_push_sign, script_info_id, robot_publish_id, phone_template_id, phone_template_name, phone_node_content,phone_result_json, phone_redial_times, phone_time_interval, phone_message_remind, phone_message_template_id, phone_message_template_name,phone_message_template_content,question_info_id, questionnaire_name, questionnaire_content, question_expiration_date, propaganda_info_id, propaganda_title, propaganda_content, message_push_sign, message_template_id, message_template_code, message_template_name, message_preview, message_node_content, official_push_sign, official_template_id, official_template_code, official_template_name, official_remind_content, official_node_content, follow_template_id, follow_template_name, applet_push_sign, applet_template_id, applet_template_code, applet_template_name, applet_remind_content, applet_prompt_description, applet_node_content, route_check_status, route_check_person, route_check_date, route_check_remark, route_node_remark, node_execute_status, route_handle_remark, route_handle_id, route_handle_person, route_link,text_remind_content, node_content,message_status, del_flag, create_by, create_time, update_by, update_time, phone_dial_method, phone_node_execute_result_status, message_node_execute_result_status, official_node_execute_result_status, applet_node_execute_result_status, node_finish_date, task_id_ext from sign_patient_manage_route_node