From baf815ce556168eec9db32347b0194c14763e0ae Mon Sep 17 00:00:00 2001 From: gitee Date: Fri, 15 Aug 2025 16:16:55 +0800 Subject: [PATCH] =?UTF-8?q?1:=20=E8=8B=B1=E6=96=87=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supervision/config/JwtInterceptor.java | 6 +-- virtual-patient-graph/pom.xml | 15 ++++++ .../java/com/supervision/enums/TagEnum.java | 36 +++++++-------- .../service/impl/GraphNebulaServiceImpl.java | 46 +++++++++---------- .../src/main/resources/bootstrap.yml | 2 +- .../VirtualPatientGraphApplicationTest.java | 27 +++++++++++ .../manage/controller/system/UserManager.java | 2 +- .../manage/enums/VirtualSheetNameEnum.java | 6 +-- ...DiseaseTreatmentPlanManageServiceImpl.java | 4 +- .../impl/MedicalRecManageServiceImpl.java | 16 +++---- .../supervision/dto/HandlingPlanDtoTop.java | 2 +- .../com/supervision/pojo/vo/ChartNodeVO.java | 8 ++-- .../service/impl/AiServiceImpl.java | 18 ++++---- .../service/impl/AskAncillaryServiceImpl.java | 8 ++-- .../impl/AskDiagnosisResultServiceImpl.java | 2 +- .../service/impl/AskPatientServiceImpl.java | 2 +- .../service/impl/AskPhysicalServiceImpl.java | 12 ++--- .../service/impl/AskPrimaryServiceImpl.java | 16 +++---- .../service/impl/AskProcessServiceImpl.java | 4 +- .../service/impl/AskServiceImpl.java | 18 +++++--- .../service/impl/DiagnoseHallServiceImpl.java | 8 ++-- .../service/impl/FeedbackServiceImpl.java | 2 +- .../impl/MedicalRecordServiceImpl.java | 12 ++--- .../impl/TreatmentPlanServiceImpl.java | 16 +++---- .../service/impl/UserManageServiceImpl.java | 8 ++-- .../java/com/supervision/util/TtsUtil.java | 4 +- .../com/supervision/AskTemplateIdTest.java | 39 ++++++++++++++++ 27 files changed, 212 insertions(+), 127 deletions(-) create mode 100644 virtual-patient-graph/src/test/java/com/supervision/VirtualPatientGraphApplicationTest.java diff --git a/virtual-patient-common/src/main/java/com/supervision/config/JwtInterceptor.java b/virtual-patient-common/src/main/java/com/supervision/config/JwtInterceptor.java index 67b4691e..3a2737e1 100644 --- a/virtual-patient-common/src/main/java/com/supervision/config/JwtInterceptor.java +++ b/virtual-patient-common/src/main/java/com/supervision/config/JwtInterceptor.java @@ -37,7 +37,7 @@ public class JwtInterceptor implements HandlerInterceptor { cacheAuth(JWTUtil.parseToken(devActiveUser())); return true; } else { - throw new BusinessException("当前用户未登录", HttpStatus.UNAUTHORIZED.value()); + throw new BusinessException("The current user is not logged in.", HttpStatus.UNAUTHORIZED.value()); } } JWT jwt = JWTUtil.parseToken(token); @@ -63,7 +63,7 @@ public class JwtInterceptor implements HandlerInterceptor { // 校验是否比当前时间大 long currentTimeMillis = System.currentTimeMillis(); if (currentTimeMillis > l) { - throw new BusinessException("用户登录已过期,请重新登录", HttpStatus.UNAUTHORIZED.value()); + throw new BusinessException("The current user is not logged in.", HttpStatus.UNAUTHORIZED.value()); } } @@ -73,7 +73,7 @@ public class JwtInterceptor implements HandlerInterceptor { JSONObject claimsJson = jwt.getPayload().getClaimsJson(); ThreadCache.USER.set(claimsJson.toString()); } catch (Exception e) { - log.error("用户信息异常", e); + log.error("Abnormal Patient Information", e); } } diff --git a/virtual-patient-graph/pom.xml b/virtual-patient-graph/pom.xml index 64f4d6f5..a684a8af 100644 --- a/virtual-patient-graph/pom.xml +++ b/virtual-patient-graph/pom.xml @@ -114,6 +114,21 @@ lombok provided + + org.springframework.boot + spring-boot-test + test + + + junit + junit + test + + + org.springframework + spring-test + test + diff --git a/virtual-patient-graph/src/main/java/com/supervision/enums/TagEnum.java b/virtual-patient-graph/src/main/java/com/supervision/enums/TagEnum.java index 09d3ccf6..ec6f91ad 100644 --- a/virtual-patient-graph/src/main/java/com/supervision/enums/TagEnum.java +++ b/virtual-patient-graph/src/main/java/com/supervision/enums/TagEnum.java @@ -1,41 +1,41 @@ package com.supervision.enums; public enum TagEnum { - medical_rec("病例", 1, "#2F7CFF", "病历", null), + medical_rec("case", 1, "#2F7CFF", "case", null), - process_medical("电子病历", 2, "#55CBAD", "电子病历", medical_rec), + process_medical("Electronic Health Record", 2, "#55CBAD", "Electronic Health Record", medical_rec), - self_desc("主诉", 3, "#55CBAD", "电子病历", process_medical), + self_desc("Chief Complaint", 3, "#55CBAD", "Electronic Health Record", process_medical), - previous_history("既往病史", 3, "#55CBAD", "电子病历", process_medical), + previous_history("Past Medical History", 3, "#55CBAD", "Electronic Health Record", process_medical), - illness_history("现病史", 3, "#55CBAD", "电子病历", process_medical), + illness_history("Current Medical History", 3, "#55CBAD", "Electronic Health Record", process_medical), - personal_history("个人史", 3, "#55CBAD", "电子病历", process_medical), + personal_history("Past Medical History", 3, "#55CBAD", "Electronic Health Record", process_medical), - allergy_history("过敏史", 3, "#55CBAD", "电子病历", process_medical), + allergy_history("allergy history", 3, "#55CBAD", "Electronic Health Record", process_medical), - family_history("家族史", 3, "#55CBAD", "电子病历", process_medical), + family_history("Family history", 3, "#55CBAD", "Electronic Health Record", process_medical), - marriage_child_history("婚育史", 3, "#55CBAD", "电子病历", process_medical), + marriage_child_history("marital and reproductive history", 3, "#55CBAD", "Electronic Health Record", process_medical), - operation_history("手术史", 3, "#55CBAD", "电子病历", process_medical), + operation_history("Surgical History", 3, "#55CBAD", "Electronic Health Record", process_medical), - symptoms("症状", 2, "#55CBAD", "电子病历", process_medical), + symptoms("symptoms", 2, "#55CBAD", "Electronic Health Record", process_medical), - patient("患者信息", 2, "#55CBAD", "电子病历", process_medical), + patient("Patient Information", 2, "#55CBAD", "Electronic Health Record", process_medical), - physical("体格检查", 2, "#8D8BFF", "体格检查", medical_rec), + physical("physical examination", 2, "#8D8BFF", "physical examination", medical_rec), - physical_result("体格检查结果", 3, "#8D8BFF", "体格检查", physical), + physical_result("Physical Examination Findings", 3, "#8D8BFF", "physical examination", physical), - ancillary("辅助检查", 2, "#4E8CFF", "辅助检查", medical_rec), + ancillary("Auxiliary examination", 2, "#4E8CFF", "Auxiliary examination", medical_rec), - ancillary_result("辅助检查结果", 3, "#4E8CFF", "辅助检查", ancillary), + ancillary_result("Results of Auxiliary Examinations", 3, "#4E8CFF", "Auxiliary examination", ancillary), - treatment_plan("处置计划", 2, "#2BCCFF", "处置计划", medical_rec), + treatment_plan("Disposal Plan", 2, "#2BCCFF", "Disposal Plan", medical_rec), - diagnosis("诊断", 2, "#FF6667", "诊断结果", medical_rec); + diagnosis("Diagnosis", 2, "#FF6667", "Diagnostic results", medical_rec); private final String type; diff --git a/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java b/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java index 779e1c02..d2208ef5 100644 --- a/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java +++ b/virtual-patient-graph/src/main/java/com/supervision/service/impl/GraphNebulaServiceImpl.java @@ -77,33 +77,33 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { @Override public String creatGraphByNebula(String processId) { - Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("未找到流程,创建图谱失败")); + Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("Workflow not found, failed to create map")); // 根据processId找到对应的诊疗计划,如果没有找到,说明治疗流程未完成,诊断失败 List treatmentPlanRecordList = treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId).list(); Integer disposalMethod = treatmentPlanRecordList.stream().findAny().orElse(new TreatmentPlanRecord()).getDisposalMethod(); - MedicalRec medicalRec = Optional.ofNullable(medicalRecService.getById(process.getMedicalRecId())).orElseThrow(() -> new BusinessException("未找到病历")); + MedicalRec medicalRec = Optional.ofNullable(medicalRecService.getById(process.getMedicalRecId())).orElseThrow(() -> new BusinessException("Medical records not found")); // 首先创建一个病历 MedicalRecVertex medicalRecVertex = new MedicalRecVertex(); // 格式:患者名称-门诊/住院(时间) // 如果没有填写治疗计划,默认为门诊 - medicalRecVertex.setNodeValue((ObjectUtil.isEmpty(disposalMethod) || disposalMethod == 0 ? "门诊" : "住院") + "-" + medicalRec.getPatientName() + "(" + DateUtil.format(process.getCreateTime(), "yyyy-MM-dd") + ")"); + medicalRecVertex.setNodeValue((ObjectUtil.isEmpty(disposalMethod) || disposalMethod == 0 ? "Outpatient" : "Hospitalization") + "-" + medicalRec.getPatientName() + "(" + DateUtil.format(process.getCreateTime(), "yyyy-MM-dd") + ")"); medicalRecDao.insert(medicalRecVertex); log.info("病历图谱ID:{}", medicalRecVertex.getId()); // 根据processId找到电子病历 - ProcessMedical processMedical = processMedicalService.lambdaQuery().eq(ProcessMedical::getProcessId, processId).oneOpt().orElseThrow(() -> new BusinessException("未找到电子病历")); + ProcessMedical processMedical = processMedicalService.lambdaQuery().eq(ProcessMedical::getProcessId, processId).oneOpt().orElseThrow(() -> new BusinessException("Medical records not found")); ProcessMedicalVertex processMedicalVertex = new ProcessMedicalVertex(); - processMedicalVertex.setNodeValue("病历(" + DateUtil.format(processMedical.getCreateTime(), "yyyy-MM-dd") + ")"); + processMedicalVertex.setNodeValue("medical record(" + DateUtil.format(processMedical.getCreateTime(), "yyyy-MM-dd") + ")"); processMedicalDao.insert(processMedicalVertex); - medicalRecDao.insertEdge(medicalRecVertex, new SinglePropertyEdge("电子病历"), processMedicalVertex); + medicalRecDao.insertEdge(medicalRecVertex, new SinglePropertyEdge("Electronic Health Record"), processMedicalVertex); // 创建主诉节点 if (StrUtil.isNotBlank(processMedical.getPatientSelfDesc())) { SelfDescVertex selfDescVertex = new SelfDescVertex(); selfDescVertex.setNodeValue(processMedical.getPatientSelfDesc()); selfDescDao.insert(selfDescVertex); // 保存节点之间的关系 - processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("主诉"), selfDescVertex); + processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("Chief Complaint"), selfDescVertex); } // 创建现病史节点 if (StrUtil.isNotBlank(processMedical.getIllnessHistory())) { @@ -111,7 +111,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { illnessHistoryVertex.setNodeValue(processMedical.getIllnessHistory()); illnessHistoryDao.insert(illnessHistoryVertex); // 保存节点之间的关系 - processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("现病史"), illnessHistoryVertex); + processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("Current Medical History"), illnessHistoryVertex); } // 创建个人史节点 if (StrUtil.isNotBlank(processMedical.getPersonalHistory())) { @@ -119,7 +119,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { personalHistoryVertex.setNodeValue(processMedical.getPersonalHistory()); personalHistoryDao.insert(personalHistoryVertex); // 保存节点之间的关系 - processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("个人史"), personalHistoryVertex); + processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("Past Medical History"), personalHistoryVertex); } // 创建过敏史节点 if (ObjectUtil.isNotEmpty(processMedical.getAllergyHistoryFlag()) && 1 == processMedical.getAllergyHistoryFlag() && StrUtil.isNotBlank(processMedical.getAllergyHistory())) { @@ -127,7 +127,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { allergyHistoryVertex.setNodeValue(processMedical.getAllergyHistory()); allergyHistoryDao.insert(allergyHistoryVertex); // 保存节点之间的关系 - processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("过敏史"), allergyHistoryVertex); + processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("allergy history"), allergyHistoryVertex); } // 创建既往史节点 if (ObjectUtil.isNotEmpty(processMedical.getPreviousHistoryFlag()) && 1 == processMedical.getPreviousHistoryFlag() && StrUtil.isNotBlank(processMedical.getPreviousHistory())) { @@ -135,7 +135,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { previousHistoryVertex.setNodeValue(processMedical.getPreviousHistory()); previousHistoryDao.insert(previousHistoryVertex); // 保存节点之间的关系 - processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("既往史"), previousHistoryVertex); + processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("Past Medical History"), previousHistoryVertex); } // 创建家族史节点 if (ObjectUtil.isNotEmpty(processMedical.getFamilyHistoryFlag()) && 1 == processMedical.getFamilyHistoryFlag() && StrUtil.isNotBlank(processMedical.getFamilyHistory())) { @@ -143,7 +143,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { familyHistoryVertex.setNodeValue(processMedical.getFamilyHistory()); familyHistoryDao.insert(familyHistoryVertex); // 保存节点之间的关系 - processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("家族史"), familyHistoryVertex); + processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("Family history"), familyHistoryVertex); } // 创建手术史节点 if (ObjectUtil.isNotEmpty(processMedical.getOperationHistory()) && 1 == processMedical.getOperationHistoryFlag() && StrUtil.isNotBlank(processMedical.getOperationHistory())) { @@ -151,7 +151,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { operationHistoryVertex.setNodeValue(processMedical.getOperationHistory()); operationHistoryDao.insert(operationHistoryVertex); // 保存节点之间的关系 - processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("手术史"), operationHistoryVertex); + processMedicalDao.insertEdge(processMedicalVertex, new SinglePropertyEdge("Surgical History"), operationHistoryVertex); } @@ -169,12 +169,12 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { PhysicalVertex physicalVertex = new PhysicalVertex(); physicalVertex.setNodeValue(tool.getToolName() + (location != null ? ("-" + location.getLocationName()) : "")); physicalDao.insert(physicalVertex); - processMedicalDao.insertEdge(medicalRecVertex, new SinglePropertyEdge("体格检查"), physicalVertex); + processMedicalDao.insertEdge(medicalRecVertex, new SinglePropertyEdge("physical examination"), physicalVertex); // 获取查询结果,增加到结果节点中 PhysicalResultVertex physicalResultVertex = new PhysicalResultVertex(); - physicalResultVertex.setNodeValue(StrUtil.blankToDefault(physicalRecord.getResult(), "无相关资讯")); + physicalResultVertex.setNodeValue(StrUtil.blankToDefault(physicalRecord.getResult(), "No relevant information")); physicalResultDao.insert(physicalResultVertex); - physicalResultDao.insertEdge(physicalVertex, new SinglePropertyEdge("结果"), physicalResultVertex); + physicalResultDao.insertEdge(physicalVertex, new SinglePropertyEdge("result"), physicalResultVertex); // 如果是证实诊断依据,添加到证实诊断依据里面去 if (NumberUtil.equals(1, physicalRecord.getBasisConfirmFlag())) { physicalConfirmMap.put(physicalRecord.getId(), physicalVertex); @@ -192,13 +192,13 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { ancillaryVertex.setNodeValue(configAncillaryItem.getItemName()); ancillaryDao.insert(ancillaryVertex); // 保存病历和辅助检查连线 - medicalRecDao.insertEdge(medicalRecVertex, new SinglePropertyEdge("辅助检查"), ancillaryVertex); + medicalRecDao.insertEdge(medicalRecVertex, new SinglePropertyEdge("Auxiliary examination"), ancillaryVertex); // 结果节点 AncillaryResultVertex ancillaryResultVertex = new AncillaryResultVertex(); - ancillaryResultVertex.setNodeValue(StrUtil.blankToDefault(diagnosisAncillaryRecord.getResult(), "无相关资讯")); + ancillaryResultVertex.setNodeValue(StrUtil.blankToDefault(diagnosisAncillaryRecord.getResult(), "No relevant information")); ancillaryResultDao.insert(ancillaryResultVertex); // 保存检查结果连线 - ancillaryDao.insertEdge(ancillaryVertex, new SinglePropertyEdge("结果"), ancillaryResultVertex); + ancillaryDao.insertEdge(ancillaryVertex, new SinglePropertyEdge("Results"), ancillaryResultVertex); // 如果是证实诊断依据,添加到证实诊断依据里面去 if (NumberUtil.equals(1, diagnosisAncillaryRecord.getBasisConfirmFlag())) { ancillaryConfirmMap.put(diagnosisAncillaryRecord.getId(), ancillaryVertex); @@ -215,7 +215,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { DiagnosisVertex diagnosisVertex = new DiagnosisVertex(); diagnosisVertex.setNodeValue(disease.getDiseaseNameAlias()); diagnosisDao.insert(diagnosisVertex); - diagnosisDao.insertEdge(medicalRecVertex, new SinglePropertyEdge("诊断"), diagnosisVertex); + diagnosisDao.insertEdge(medicalRecVertex, new SinglePropertyEdge("Diagnosis"), diagnosisVertex); diagnosisMap.put(diagnosisPrimary.getId(), diagnosisVertex); } } @@ -228,12 +228,12 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { // 如果疾病诊断不为空,则根据relationId,查询对应的体格检查节点 PhysicalVertex physicalVertex = physicalConfirmMap.get(relation.getRelationId()); if (ObjectUtil.isNotEmpty(physicalVertex)) { - physicalDao.insertEdge(diagnosisVertex, new SinglePropertyEdge("依据"), physicalVertex); + physicalDao.insertEdge(diagnosisVertex, new SinglePropertyEdge("based on"), physicalVertex); } // 再尝试找辅助检查 AncillaryVertex ancillaryVertex = ancillaryConfirmMap.get(relation.getRelationId()); if (ObjectUtil.isNotEmpty(ancillaryVertex)) { - ancillaryDao.insertEdge(diagnosisVertex, new SinglePropertyEdge("依据"), ancillaryVertex); + ancillaryDao.insertEdge(diagnosisVertex, new SinglePropertyEdge("based on"), ancillaryVertex); } } } @@ -245,7 +245,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService { @Override public GraphVO queryGraph(String processId, Integer level) { - Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("未找到对应的问诊流程")); + Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("Corresponding consultation process not found")); // 如果图谱ID为空,则创建图谱 if (StrUtil.isEmpty(process.getGraphId())) { String graphId = creatGraphByNebula(processId); diff --git a/virtual-patient-graph/src/main/resources/bootstrap.yml b/virtual-patient-graph/src/main/resources/bootstrap.yml index 524e3266..d15fa1ce 100644 --- a/virtual-patient-graph/src/main/resources/bootstrap.yml +++ b/virtual-patient-graph/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ spring: profiles: - active: dev + active: test application: name: virtual-patient-graph \ No newline at end of file diff --git a/virtual-patient-graph/src/test/java/com/supervision/VirtualPatientGraphApplicationTest.java b/virtual-patient-graph/src/test/java/com/supervision/VirtualPatientGraphApplicationTest.java new file mode 100644 index 00000000..a8842e60 --- /dev/null +++ b/virtual-patient-graph/src/test/java/com/supervision/VirtualPatientGraphApplicationTest.java @@ -0,0 +1,27 @@ +package com.supervision; + +import cn.hutool.json.JSONUtil; +import com.supervision.service.GraphNebulaService; +import com.supervision.vo.TreeNodeVO; +import lombok.extern.slf4j.Slf4j; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import java.util.List; + +@Slf4j +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@RunWith(SpringJUnit4ClassRunner.class) +public class VirtualPatientGraphApplicationTest { + + @Autowired + private GraphNebulaService graphNebulaService; + @Test + public void contextLoads() { + List treeNodeVOS = graphNebulaService.queryTreeGraph("1955889668823777281", 3); + System.out.println(JSONUtil.toJsonStr(treeNodeVOS)); + } +} diff --git a/virtual-patient-manage/src/main/java/com/supervision/manage/controller/system/UserManager.java b/virtual-patient-manage/src/main/java/com/supervision/manage/controller/system/UserManager.java index c34b8165..27125abd 100644 --- a/virtual-patient-manage/src/main/java/com/supervision/manage/controller/system/UserManager.java +++ b/virtual-patient-manage/src/main/java/com/supervision/manage/controller/system/UserManager.java @@ -38,7 +38,7 @@ public class UserManager { Assert.notBlank(user.getPassword(), "用户密码不能为空"); Assert.notEmpty(user.getRoleCode(), "用户角色不能为空"); if (0 > userService.lambdaQuery().eq(User::getAccount, user.getAccount()).count()) { - throw new BusinessException("账户名已存在"); + throw new BusinessException("Account name already exists"); } userService.save(user); } diff --git a/virtual-patient-manage/src/main/java/com/supervision/manage/enums/VirtualSheetNameEnum.java b/virtual-patient-manage/src/main/java/com/supervision/manage/enums/VirtualSheetNameEnum.java index f115373e..a891aff6 100644 --- a/virtual-patient-manage/src/main/java/com/supervision/manage/enums/VirtualSheetNameEnum.java +++ b/virtual-patient-manage/src/main/java/com/supervision/manage/enums/VirtualSheetNameEnum.java @@ -12,9 +12,9 @@ public enum VirtualSheetNameEnum { BASIC_INFO("基本信息"), CLINICAL_INTERVIEW("临床问诊"), - PHYSICAL_EXAMINATION("体格检查"), - AUXILIARY_EXAMINATION("辅助检查"), - TREATMENT_PLAN("处置计划"), + PHYSICAL_EXAMINATION("physical examination"), + AUXILIARY_EXAMINATION("Auxiliary examination"), + TREATMENT_PLAN("Disposal Plan"), SUMMARY_OF_EVALUATION_RESULTS("评估结果概述"), ; diff --git a/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/DiseaseTreatmentPlanManageServiceImpl.java b/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/DiseaseTreatmentPlanManageServiceImpl.java index 90be8e4d..64dab84c 100644 --- a/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/DiseaseTreatmentPlanManageServiceImpl.java +++ b/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/DiseaseTreatmentPlanManageServiceImpl.java @@ -249,7 +249,7 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl for (int i = 0; i < listList.size(); i++) { List objectList = listList.get(i); String colNumString = String.valueOf(objectList.get(0)); - if (colNumString.equals("处置计划")) { + if (colNumString.equals("Disposal Plan")) { // 第一个表头 List sheetHeadOne = excelReader.read().get(i); checkSheetHeadOne(sheetHeadOne); @@ -305,7 +305,7 @@ public class DiseaseTreatmentPlanManageServiceImpl implements DiseaseTreatmentPl for (Cell cell : row) { cell.setCellType(CellType.STRING); String stringCellValue = cell.getStringCellValue(); - if (stringCellValue.equals("处置计划")) { + if (stringCellValue.equals("Disposal Plan")) { // 第一个表头 List sheetHeadOne = excelReader.read().get(i); upHeadIndex = i; diff --git a/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/MedicalRecManageServiceImpl.java b/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/MedicalRecManageServiceImpl.java index 545a36bd..4a80eb16 100644 --- a/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/MedicalRecManageServiceImpl.java +++ b/virtual-patient-manage/src/main/java/com/supervision/manage/service/impl/MedicalRecManageServiceImpl.java @@ -502,8 +502,8 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService { assertSheetDataClinicalInterview(clinicalInterviewDTOS); askTemplateQuestionLibraryManageService.saveSimilarityQuestion(clinicalInterviewDTOS, medicalRec.getId()); continue; - case "体格检查": - assertTitle(excelReader, "体格检查"); + case "physical examination": + assertTitle(excelReader, "physical examination"); List uploadPhysicalExaminationDTOS = excelReader.readAll(UploadPhysicalExaminationDTO.class); if (null == uploadPhysicalExaminationDTOS || uploadPhysicalExaminationDTOS.isEmpty()) { continue; @@ -511,8 +511,8 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService { assertSheetDataPhysicalExamination(uploadPhysicalExaminationDTOS); diseasePhysicalManageService.batchSavePhysicalExaminationList(disease, uploadPhysicalExaminationDTOS); continue; - case "辅助检查": - assertTitle(excelReader, "辅助检查"); + case "Auxiliary examination": + assertTitle(excelReader, "Auxiliary examination"); List supplementaryTestDtos = excelReader.readAll(SupplementaryTestDto.class); if (null == supplementaryTestDtos || supplementaryTestDtos.isEmpty()) { continue; @@ -520,8 +520,8 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService { assertSheetDataSupplementaryTest(supplementaryTestDtos); diseaseAncillaryManageService.batchSaveAncillaryExaminationList(disease, supplementaryTestDtos); continue; - case "处置计划": - assertTitle(excelReader, "处置计划"); + case "Disposal Plan": + assertTitle(excelReader, "Disposal Plan"); diseaseTreatmentPlanManageService.batchSaveTreatmentPlanToDoc(reader, disease); continue; case "评估结果概述": @@ -656,13 +656,13 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService { Assert.isTrue(ClinicalInterviewDTO.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.get(i).equals(titleList.get(i)), "表头格式有误,请重新导入"); } break; - case "体格检查": + case "physical examination": for (int i = 0; i < UploadPhysicalExaminationDTO.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.size(); i++) { Assert.isTrue(titleList.size() > i, "表头格式有误,请重新导入"); Assert.isTrue(UploadPhysicalExaminationDTO.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.get(i).equals(titleList.get(i)), "表头格式有误,请重新导入"); } break; - case "辅助检查": + case "Auxiliary examination": for (int i = 0; i < SupplementaryTestDto.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.size(); i++) { Assert.isTrue(titleList.size() > i, "表头格式有误,请重新导入"); Assert.isTrue(SupplementaryTestDto.CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE.get(i).equals(titleList.get(i)), "表头格式有误,请重新导入"); diff --git a/virtual-patient-model/src/main/java/com/supervision/dto/HandlingPlanDtoTop.java b/virtual-patient-model/src/main/java/com/supervision/dto/HandlingPlanDtoTop.java index 2192f3b2..8da14bd1 100644 --- a/virtual-patient-model/src/main/java/com/supervision/dto/HandlingPlanDtoTop.java +++ b/virtual-patient-model/src/main/java/com/supervision/dto/HandlingPlanDtoTop.java @@ -16,7 +16,7 @@ public class HandlingPlanDtoTop { public static final List CASE_TEMPLATE_SHEET_SINGLE_DISEASE_TITLE = CollUtil.newArrayList - ("处置计划","* 一级措施(请选择)","* 二级措施(请选择)", "* 说明"); + ("Disposal Plan","* 一级措施(请选择)","* 二级措施(请选择)", "* 说明"); @Alias(value = "处置计划") private String disposalScheme; diff --git a/virtual-patient-web/src/main/java/com/supervision/pojo/vo/ChartNodeVO.java b/virtual-patient-web/src/main/java/com/supervision/pojo/vo/ChartNodeVO.java index bdaaf06c..7105ec4d 100644 --- a/virtual-patient-web/src/main/java/com/supervision/pojo/vo/ChartNodeVO.java +++ b/virtual-patient-web/src/main/java/com/supervision/pojo/vo/ChartNodeVO.java @@ -45,15 +45,15 @@ public class ChartNodeVO { public String computeScoreLevel() { if (NumberUtil.isIn(this.getNodePer(), BigDecimal.valueOf(85), BigDecimal.valueOf(100))) { - return "优秀"; + return "Excellent"; } if (NumberUtil.isIn(this.getNodePer(), BigDecimal.valueOf(75), BigDecimal.valueOf(85))) { - return "良好"; + return "Good"; } if (NumberUtil.isIn(this.getNodePer(), BigDecimal.valueOf(60), BigDecimal.valueOf(75))) { - return "合格"; + return "Pass"; } else { - return "不及格"; + return "Fail"; } } } diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/AiServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/AiServiceImpl.java index 3b4bc379..ad798817 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/AiServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/AiServiceImpl.java @@ -18,19 +18,19 @@ import java.util.*; public class AiServiceImpl implements AiService { public static final String userPromptTemplate = """ - 预设病人的详细情况的如下: + Predefined patient details are as follows: --- {medicalRecord} --- - 回复格式为json:{"answer":"扮演病人,根据病人详细情况,回答的内容"} + Reply format is JSON:{"answer":"Act as a patient, and provide answers based on the patient's detailed information."} """; private static final String systemPrompt = """ - 我们现在来进行一个角色扮演连续对话场景。 - 需要你现在扮演一个病人,我来扮演医生,我们进行模拟问诊。 - 我会给你设定病人的详细情况,你结合问题,从内容中找到答案原文回复。 - 如果详细情况中的信息不能回该问题,则对于该问题,应是一个正常人的情况,则由你生成一个正常的回答,但回答必须且简洁! - 如果医生说'你好'等礼貌用语,你就回复'你好,医生'!!! + We are now going to conduct a role-playing continuous dialogue scenario. + Please act as a patient, and I will act as a doctor for a simulated medical interview. + I will provide the patient's detailed information, and you will retrieve the answer from the content based on the question and provide the original response. + If the information in the detailed situation cannot answer the question, then it should be considered as a normal person's case, and you should generate a normal response, but the response must be concise! + If the doctor says "Hello" or other polite expressions, you should respond with "Hello, doctor"!!! """; /** @@ -45,7 +45,7 @@ public class AiServiceImpl implements AiService { List messageHistoryList = new ArrayList<>(); messageHistoryList.add(new SystemMessage(systemPrompt)); messageHistoryList.add(new UserMessage(StrUtil.format(userPromptTemplate, paramMap))); - messageHistoryList.add(new AssistantMessage("好的,已了解我要扮演病人的详细情况。已准备好对话了。")); + messageHistoryList.add(new AssistantMessage("Okay, I understand the detailed information about my role as a patient. I am ready for the conversation.")); messageHistoryList.add(new UserMessage(question)); Optional chat = AiChatUtil.chat(messageHistoryList, AiTalkAnswerDTO.class); if (chat.isPresent()) { @@ -54,7 +54,7 @@ public class AiServiceImpl implements AiService { return aiTalkAnswerDTO.getAnswer(); } } - return "医生,我没有听懂你说的是什么"; + return "Doctor, I didn't understand what you said."; } diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskAncillaryServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskAncillaryServiceImpl.java index 3a67da3e..2f60d957 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskAncillaryServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskAncillaryServiceImpl.java @@ -56,8 +56,8 @@ public class AskAncillaryServiceImpl implements AskAncillaryService { public void execAskAncillaryBatch(List reqVO) { // 首先根据process_id查新到流程ID Process process = Optional.ofNullable(processService.getById(reqVO.stream().findAny() - .orElseThrow(() -> new BusinessException("流程ID不能为空")).getProcessId())) - .orElseThrow(() -> new BusinessException("未找到流程ID")); + .orElseThrow(() -> new BusinessException("Process ID cannot be empty")).getProcessId())) + .orElseThrow(() -> new BusinessException("Process ID not found")); for (AskAncillaryBatchReqVO item : reqVO) { // 执行并保存结果 execSaveDiagnosisAncillaryRecord(item.getAncillaryItemId(), item.getPrimaryId(), process); @@ -83,7 +83,7 @@ public class AskAncillaryServiceImpl implements AskAncillaryService { diseaseAncillaryQueryBean.setDiseaseId(process.getDiseaseId()); DiseaseAncillaryDto diseaseAncillary = diseaseAncillaryService.queryDiseaseAncillaryDtoOne(diseaseAncillaryQueryBean, () -> { DiseaseAncillaryDto get = new DiseaseAncillaryDto(); - get.setResult("无相关资讯"); + get.setResult("No relevant information"); return get; }); @@ -155,7 +155,7 @@ public class AskAncillaryServiceImpl implements AskAncillaryService { boolean update = diagnosisAncillaryRecordService.lambdaUpdate().set(DiagnosisAncillaryRecord::getAssessmentResult, reqVO.getResult()) .eq(DiagnosisAncillaryRecord::getId, reqVO.getRecordId()).update(); if (!update) { - throw new BusinessException("保存判读结果失败"); + throw new BusinessException("Failed to save the interpretation results"); } } } diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskDiagnosisResultServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskDiagnosisResultServiceImpl.java index 64c2e3bf..099cd4ab 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskDiagnosisResultServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskDiagnosisResultServiceImpl.java @@ -409,7 +409,7 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService */ @Override public RadarChartResVO queryRadarChart(String processId) { - Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("未找到流程")); + Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("Process ID not found")); // 生成问诊雷达图 ChartNodeVO askChart = computeAskChart(process); // 生成体格检查雷达图 diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPatientServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPatientServiceImpl.java index 380517a8..41169a1b 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPatientServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPatientServiceImpl.java @@ -22,6 +22,6 @@ public class AskPatientServiceImpl implements AskPatientService { @Override public Patient queryPatientById(String id) { - return patientService.lambdaQuery().eq(Patient::getId, id).oneOpt().orElseThrow(() -> new BusinessException("未找到用户")); + return patientService.lambdaQuery().eq(Patient::getId, id).oneOpt().orElseThrow(() -> new BusinessException("user not find")); } } diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPhysicalServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPhysicalServiceImpl.java index 3502ca15..c4804c19 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPhysicalServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPhysicalServiceImpl.java @@ -55,13 +55,13 @@ public class AskPhysicalServiceImpl implements AskPhysicalService { @Override public DiagnosisPhysicalRecordVo queryAskPhysicalResult(AskPhysicalResultReqVO reqVO) { // 首先根据process_id查新到流程ID - Process process = Optional.ofNullable(processService.getById(reqVO.getProcessId())).orElseThrow(() -> new BusinessException("未找到流程ID")); - ConfigPhysicalTool tool = Optional.ofNullable(toolService.getById(reqVO.getToolId())).orElseThrow(() -> new BusinessException("工具不支持")); + Process process = Optional.ofNullable(processService.getById(reqVO.getProcessId())).orElseThrow(() -> new BusinessException("Process ID not found")); + ConfigPhysicalTool tool = Optional.ofNullable(toolService.getById(reqVO.getToolId())).orElseThrow(() -> new BusinessException("The tool does not support")); // 是否需要具体的部位,0否1是 ConfigPhysicalLocation location = new ConfigPhysicalLocation(); if (1 == tool.getRequireLocation()) { if (StrUtil.isBlank(reqVO.getLocationCode())) { - throw new BusinessException("请选择对应的位置"); + throw new BusinessException("Please select the corresponding location"); } else { location = locationService.lambdaQuery().eq(ConfigPhysicalLocation::getCode, reqVO.getLocationCode()).last("limit 1") .oneOpt().orElseGet(ConfigPhysicalLocation::new); @@ -115,7 +115,7 @@ public class AskPhysicalServiceImpl implements AskPhysicalService { if (StrUtil.isBlank(locationId)) { DefaultPhysicalIndicator noLocationIndicator = defaultPhysicalIndicatorService.lambdaQuery().eq(DefaultPhysicalIndicator::getItemId, itemId).last("limit 1").one(); if (ObjectUtil.isEmpty(noLocationIndicator) || StrUtil.isEmpty(noLocationIndicator.getIndicatorValue())) { - diseasePhysical.setResult("无相关资讯"); + diseasePhysical.setResult("No relevant information"); return diseasePhysical; } diseasePhysical.setResult(noLocationIndicator.getIndicatorValue()); @@ -141,11 +141,11 @@ public class AskPhysicalServiceImpl implements AskPhysicalService { } } // 最终,返回未找到 - diseasePhysical.setResult("无相关资讯"); + diseasePhysical.setResult("No relevant information"); return diseasePhysical; } catch (Exception e) { log.error("查询默认值错误", e); - diseasePhysical.setResult("无相关资讯"); + diseasePhysical.setResult("No relevant information"); return diseasePhysical; } } diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPrimaryServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPrimaryServiceImpl.java index 145edcbb..62accb53 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPrimaryServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskPrimaryServiceImpl.java @@ -123,17 +123,17 @@ public class AskPrimaryServiceImpl implements AskPrimaryService { Long count = diagnosisPrimaryService.lambdaQuery().eq(DiagnosisPrimary::getProcessId, reqVO.getProcessId()) .eq(DiagnosisPrimary::getPrimaryDiagnosisId, reqVO.getPrimaryDiagnosisId()).count(); if (0 < count) { - throw new BusinessException("已经存在该疾病的初步诊断"); + throw new BusinessException("A preliminary diagnosis of the disease has been made."); } DiagnosisPrimary diagnosisPrimary = BeanUtil.toBean(reqVO, DiagnosisPrimary.class); diagnosisPrimary.setExcludeFlag(null); diagnosisPrimary.setCreateUserId(UserUtil.getUser().getId()); String primaryDiagnosisId = diagnosisPrimary.getPrimaryDiagnosisId(); - Assert.notEmpty(primaryDiagnosisId, "疾病不能为空"); + Assert.notEmpty(primaryDiagnosisId, "Diseases cannot be empty"); List dbList = diagnosisPrimaryService.lambdaQuery().eq(DiagnosisPrimary::getPrimaryDiagnosisId, primaryDiagnosisId) .eq(DiagnosisPrimary::getProcessId, diagnosisPrimary.getProcessId()).list(); - Assert.isTrue(CollectionUtil.isEmpty(dbList), "初步诊断已存在"); + Assert.isTrue(CollectionUtil.isEmpty(dbList), "Preliminary diagnosis has been established"); diagnosisPrimaryService.save(diagnosisPrimary); // 然后开始保存初步诊断关键的诊断 @@ -202,14 +202,14 @@ public class AskPrimaryServiceImpl implements AskPrimaryService { List reqVOList = reqVO.getPrimaryConfirmList(); Optional any = reqVOList.stream().findAny(); if (!any.isPresent()) { - throw new BusinessException("初步诊断不能为空"); + throw new BusinessException("Diseases cannot be empty"); } // 如果 != 1 ,不是暂存,那么就校验电子病历是否填写 if (ObjectUtil.isEmpty(reqVO.getTempSaveFlag()) || 1 != reqVO.getTempSaveFlag()) { // 校验,如果没有填写病历,那么就不允许诊毕 Long count = processMedicalService.lambdaQuery().eq(ProcessMedical::getProcessId, reqVO.getProcessId()).count(); if (count < 1) { - throw new BusinessException("电子病历未填写,请填写电子病例后诊毕"); + throw new BusinessException("Electronic medical record is not filled out, please fill out the electronic medical record before concluding the consultation."); } } @@ -218,7 +218,7 @@ public class AskPrimaryServiceImpl implements AskPrimaryService { // 如果 != 1 ,不是暂存,那么就校验初步诊断是否填写 if (ObjectUtil.isEmpty(reqVO.getTempSaveFlag()) || 1 != reqVO.getTempSaveFlag()) { if (ObjectUtil.isEmpty(node.getExcludeFlag()) && 0 != node.getExcludeFlag() && 1 != node.getExcludeFlag()) { - throw new BusinessException("是否排除不能为空或诊断不正确"); + throw new BusinessException("Whether excluded, it must not be empty or have an incorrect diagnosis."); } } // 修改初步诊断是否被排除 @@ -264,11 +264,11 @@ public class AskPrimaryServiceImpl implements AskPrimaryService { DiagnosisPrimary primary = diagnosisPrimaryService.getById(id); Long ancillaryCount = diagnosisAncillaryRecordService.lambdaQuery().eq(DiagnosisAncillaryRecord::getProcessId, primary.getProcessId()).count(); if (ancillaryCount > 0) { - throw new BusinessException("仅支持删除没有做过体格、辅助检查的初步诊断项目"); + throw new BusinessException("Only allows the deletion of initial diagnostic items that have not undergone physical examination or auxiliary tests."); } Long physicalCount = diagnosisPhysicalRecordService.lambdaQuery().eq(DiagnosisPhysicalRecord::getProcessId, primary.getProcessId()).count(); if (physicalCount > 0) { - throw new BusinessException("仅支持删除没有做过体格、辅助检查的初步诊断项目"); + throw new BusinessException("Only allows deletion of initial diagnostic items that have not undergone physical examination or auxiliary examinations."); } diagnosisPrimaryService.lambdaUpdate().eq(DiagnosisPrimary::getId, id).remove(); } diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskProcessServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskProcessServiceImpl.java index 7a90c75e..4c679b86 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskProcessServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskProcessServiceImpl.java @@ -50,10 +50,10 @@ public class AskProcessServiceImpl implements AskProcessService { @Override public boolean deleteDiagnosisProcess(String processId) { - Assert.notEmpty(processId,"问诊实例不能为空"); + Assert.notEmpty(processId,"The medical case cannot be empty"); Process process = processService.getById(processId); - Assert.notNull(process,"未找到该实例"); + Assert.notNull(process,"Instance not found"); process.setDeleteFlag(1); return processService.updateById(process); } diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskServiceImpl.java index 046f9212..db3d7020 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/AskServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/AskServiceImpl.java @@ -54,17 +54,17 @@ public class AskServiceImpl implements AskService { @Override public String receiveVoiceFile(MultipartFile file) { if (file.getSize() <= 0) { - throw new BusinessException("语音内容为空"); + throw new BusinessException("No voice data available"); } // 获取音频对应的文字 String text = null; try { text = AsrUtil.asrTransformByBytes(file.getBytes()); } catch (Exception e) { - throw new BusinessException("获取语音失败"); + throw new BusinessException("Failure to acquire voice"); } if (StrUtil.isEmpty(text)) { - throw new BusinessException("语音内容为空"); + throw new BusinessException("No voice data available"); } return text; } @@ -78,10 +78,14 @@ public class AskServiceImpl implements AskService { @Override public TalkVideoTtsResultResVO talkByVideoAndTts(TalkVideoReqVO talkReqVO) { - String answer = talkByVideoAndTts(talkReqVO.getProcessId(), talkReqVO.getText()); TalkVideoTtsResultResVO talkVideoTtsResultResVO = new TalkVideoTtsResultResVO(); - talkVideoTtsResultResVO.setVoiceBase64(TtsUtil.ttsTransform(answer)); - talkVideoTtsResultResVO.setAnswerMessage(answer); + try { + String answer = talkByVideoAndTts(talkReqVO.getProcessId(), talkReqVO.getText()); + talkVideoTtsResultResVO.setVoiceBase64(TtsUtil.ttsTransform(answer)); + talkVideoTtsResultResVO.setAnswerMessage(answer); + } catch (Exception e) { + talkVideoTtsResultResVO.setVoiceBase64(TtsUtil.ttsTransform("I didn't hear what you were saying clearly, could you please repeat it?")); + } return talkVideoTtsResultResVO; } @@ -92,7 +96,7 @@ public class AskServiceImpl implements AskService { List circulationList = new ArrayList<>(); // 根据processId找到对应的病人 - Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("未找到诊疗进程")); + Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("Treatment process not found")); MedicalRec medicalRec = medicalRecService.getById(process.getMedicalRecId()); // 找到这个病历里面配置的所有配置了答案的问题 List medicalAnswerList = askPatientAnswerService.lambdaQuery().eq(AskPatientAnswer::getMedicalId, medicalRec.getId()).select(AskPatientAnswer::getLibraryQuestionId).list(); diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/DiagnoseHallServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/DiagnoseHallServiceImpl.java index 8f88c43c..a1b6a459 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/DiagnoseHallServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/DiagnoseHallServiceImpl.java @@ -41,7 +41,7 @@ public class DiagnoseHallServiceImpl implements DiagnoseHallService { @Override public IPage queryDiagnoseProcessPageList(Integer pageNum, Integer pageSize, DiagnoseProcessReqVo diagnoseProcessReqVo) { - Assert.notEmpty(diagnoseProcessReqVo.getUserId(),"用户id不允许为空"); + Assert.notEmpty(diagnoseProcessReqVo.getUserId(),"User ID is not allowed to be empty"); // 1.查询诊断列表 diagnoseProcessReqVo.setDeleteFlag(0); @@ -92,17 +92,17 @@ public class DiagnoseHallServiceImpl implements DiagnoseHallService { } private Map queryAskPatientSystemVideoAnswer(List medicalRecIds,String code){ - Assert.notEmpty(code,"code不允许为空"); + Assert.notEmpty(code,"Code cannot be empty."); if (CollUtil.isEmpty(medicalRecIds)){ return new HashMap<>(); } CommonDic one = commonDicService.lambdaQuery().eq(CommonDic::getGroupCode, "AQT").eq(CommonDic::getCode, code).one(); - Assert.notNull(one,"字典项目未配置"); + Assert.notNull(one,"Dictionary item not configured"); AskTemplateQuestionLibrary questionLibrary = askTemplateQuestionLibraryService.lambdaQuery() .eq(AskTemplateQuestionLibrary::getDictId, one.getId()).eq(AskTemplateQuestionLibrary::getDictId, one.getId()).one(); - Assert.notNull(questionLibrary,code+"对应的问题库未配置"); + Assert.notNull(questionLibrary,code+" Corresponding question database is not configured"); List askPatientAnswerList = askPatientAnswerService.lambdaQuery() .in(AskPatientAnswer::getMedicalId, medicalRecIds) diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/FeedbackServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/FeedbackServiceImpl.java index 89368166..cf742394 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/FeedbackServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/FeedbackServiceImpl.java @@ -55,7 +55,7 @@ public class FeedbackServiceImpl implements FeedbackService { @Transactional(rollbackFor = Exception.class) public void saveFeedback(FeedBackVO feedbackVO) { if (StrUtil.isBlank(feedbackVO.getProcessId())) { - throw new BusinessException("流程ID不能为空"); + throw new BusinessException("Workflow ID cannot be empty."); } processService.lambdaUpdate().eq(Process::getId, feedbackVO.getProcessId()) .set(Process::getEvaluateLevel, feedbackVO.getEvaluateLevel()) diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/MedicalRecordServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/MedicalRecordServiceImpl.java index 323defde..77d2f348 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/MedicalRecordServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/MedicalRecordServiceImpl.java @@ -48,7 +48,7 @@ public class MedicalRecordServiceImpl implements MedicalRecordService { @Override public ProcessMedicalResVo findByProcessId(String processId) { - Assert.notEmpty(processId, "流程id不允许为空"); + Assert.notEmpty(processId, "Process ID cannot be empty."); // 每次查询电子病历,就等于进到页面了,这时进行更新最后问诊时间 processService.lambdaUpdate().set(Process::getUpdateTime, LocalDateTime.now()) // 已评估的,不更新 @@ -61,7 +61,7 @@ public class MedicalRecordServiceImpl implements MedicalRecordService { public boolean saveOrUpdateMedicalRecord(ProcessMedical processMedical) { log.info(JSONUtil.toJsonStr(processMedical)); - Assert.notEmpty(processMedical.getProcessId(), "流程id不为空"); + Assert.notEmpty(processMedical.getProcessId(), "Process ID cannot be empty."); List list = processMedicalService.lambdaQuery().eq(ProcessMedical::getProcessId, processMedical.getProcessId()).list(); if (CollUtil.isEmpty(list)) { // 新增 @@ -76,7 +76,7 @@ public class MedicalRecordServiceImpl implements MedicalRecordService { @Override public ProcessMedicalViewDetailResVo queryViewDetail(String processId) { - Assert.notEmpty(processId, "流程id不能为空"); + Assert.notEmpty(processId, "Process ID cannot be empty."); // 1.获取电子病例基本信息 ProcessMedicalResVo processMedicalResVo = this.findByProcessId(processId); @@ -112,10 +112,10 @@ public class MedicalRecordServiceImpl implements MedicalRecordService { } private void saveAssert(ProcessMedical processMedical) { - Assert.notEmpty(processMedical.getProcessId(), "流程id不为空"); + Assert.notEmpty(processMedical.getProcessId(), "Process ID cannot be empty."); Process process = processService.getById(processMedical.getProcessId()); - Assert.notNull(process, "流程数据不存在"); + Assert.notNull(process, "The process data does not exist"); processMedical.setMedicalRecId(process.getMedicalRecId()); processMedical.setPatientId(process.getPatientId()); @@ -126,6 +126,6 @@ public class MedicalRecordServiceImpl implements MedicalRecordService { Long count = processMedicalService.lambdaQuery().eq(ProcessMedical::getProcessId, processMedical.getProcessId()).count(); - Assert.isFalse(count > 0, "当前实例已经存在电子病例信息"); + Assert.isFalse(count > 0, "The current instance already has electronic medical record information."); } } diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/TreatmentPlanServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/TreatmentPlanServiceImpl.java index d4ed1f66..fe6809e7 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/TreatmentPlanServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/TreatmentPlanServiceImpl.java @@ -54,7 +54,7 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService { @Override public List queryTreatmentPlanRecord(String processId, String disposalPlanType) { - Assert.notEmpty(processId,"流程id不允许为空"); + Assert.notEmpty(processId,"The process ID must not be empty"); return treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId) .eq("0".equals(disposalPlanType), TreatmentPlanRecord::getDisposalPlan, TreatmentPlanIdConstant.DRUG_ID) @@ -65,7 +65,7 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService { @Override public boolean updateTreatmentPlanRecord(TreatmentPlanRecord treatmentPlanRecord) { - Assert.notEmpty(treatmentPlanRecord.getId(),"主键不能为空"); + Assert.notEmpty(treatmentPlanRecord.getId(),"Primary key cannot be null."); assertSaveTreatmentPlanRecord(treatmentPlanRecord); return treatmentPlanRecordService.updateById(treatmentPlanRecord); @@ -74,7 +74,7 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService { @Override public boolean deleteTreatmentPlanRecord(String id) { - Assert.notEmpty("主键id不能为空"); + Assert.notEmpty("Primary key cannot be null."); return treatmentPlanRecordService.removeById(id); } @@ -82,10 +82,10 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService { @Override public boolean confirmTreatmentPlan(String processId, String status) { - Assert.isTrue(CollectionUtil.newArrayList("0","1","2").contains(status),"状态值有误"); + Assert.isTrue(CollectionUtil.newArrayList("0","1","2").contains(status),"Incorrect status value"); Process process = processService.getById(processId); - Assert.notNull(process,"流程数据不存在"); + Assert.notNull(process,"Process data does not exist"); if (Integer.valueOf(status).compareTo(process.getStatus()) <= 0){ return true; @@ -128,11 +128,11 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService { } private void assertSaveTreatmentPlanRecord(TreatmentPlanRecord record){ - Assert.notEmpty(record.getProcessId(),"流程id不能为空"); - Assert.notNull(record.getDisposalMethod(),"处置方式不能为为空"); + Assert.notEmpty(record.getProcessId(),"The process ID must not be empty"); + Assert.notNull(record.getDisposalMethod(),"The treatment method cannot be empty"); //Assert.notNull(record.getDisposalPlan(),"处置计划不能为空"); if (StrUtil.isEmpty(record.getTreatmentPlanId())){ - Assert.notEmpty(record.getDrugId(),"药物id不能为空"); + Assert.notEmpty(record.getDrugId(),"Drug ID cannot be empty"); } } } diff --git a/virtual-patient-web/src/main/java/com/supervision/service/impl/UserManageServiceImpl.java b/virtual-patient-web/src/main/java/com/supervision/service/impl/UserManageServiceImpl.java index 1916093c..5e42f1e2 100644 --- a/virtual-patient-web/src/main/java/com/supervision/service/impl/UserManageServiceImpl.java +++ b/virtual-patient-web/src/main/java/com/supervision/service/impl/UserManageServiceImpl.java @@ -35,7 +35,7 @@ public class UserManageServiceImpl implements UserManageService { User user = userService.getById(userId); - Assert.notNull(user,"未查询到用户信息"); + Assert.notNull(user,"No user information was found"); return BeanUtil.toBean(user,UserInfoResVo.class); } @@ -43,13 +43,13 @@ public class UserManageServiceImpl implements UserManageService { @Override @Transactional(rollbackFor = Exception.class) public boolean changePassWord(UserInfoReqVo userInfo) { - Assert.notEmpty(userInfo.getAccount(),"账号不能为空"); - Assert.notEmpty(userInfo.getPassword(),"密码不能为空"); + Assert.notEmpty(userInfo.getAccount(),"Account cannot be empty"); + Assert.notEmpty(userInfo.getPassword(),"Password cannot be empty"); String match = passwordRegexMatch(userInfo.getPassword()); Assert.isFalse(StrUtil.isNotEmpty(match),match); Long count = userService.lambdaQuery().eq(User::getAccount, userInfo.getAccount()).count(); - Assert.isFalse(count==0,"密码设置失败"); + Assert.isFalse(count==0,"Password setting failed"); userService.lambdaUpdate().eq(User::getAccount, userInfo.getAccount()).set(User::getPassword,userInfo.getPassword()).update(); return true; } diff --git a/virtual-patient-web/src/main/java/com/supervision/util/TtsUtil.java b/virtual-patient-web/src/main/java/com/supervision/util/TtsUtil.java index 3df9b2bc..ebe6e553 100644 --- a/virtual-patient-web/src/main/java/com/supervision/util/TtsUtil.java +++ b/virtual-patient-web/src/main/java/com/supervision/util/TtsUtil.java @@ -32,11 +32,11 @@ public class TtsUtil { PaddleSpeechResDTO response = objectMapper.readValue(post, new TypeReference>() { }); if (!response.getSuccess() || ObjectUtil.isEmpty(response.getResult())) { - throw new BusinessException("文字转换语音失败"); + throw new BusinessException("Text to speech conversion failed"); } return response.getResult().getAudio(); } catch (Exception e) { - throw new BusinessException("语音转换文字失败", e); + throw new BusinessException("Text to speech conversion failed", e); } } diff --git a/virtual-patient-web/src/test/java/com/supervision/AskTemplateIdTest.java b/virtual-patient-web/src/test/java/com/supervision/AskTemplateIdTest.java index 15316c8b..4fc4e9cc 100644 --- a/virtual-patient-web/src/test/java/com/supervision/AskTemplateIdTest.java +++ b/virtual-patient-web/src/test/java/com/supervision/AskTemplateIdTest.java @@ -262,6 +262,45 @@ public class AskTemplateIdTest { FileUtil.writeUtf8String(stringPretty, file); } + @Autowired + private AiService aiService; + @Test + public void talkTest() { + String medicalRecord = """ + Name: Jia Li + Gender: Female + Age: 36 years old + Marital status: Married + Occupation: Programmer + Address: Building 3, 2nd to 6th floor, Zhuying Road 5, Jiangning District, Nanjing City + History source: Patient + Reliability: Generally reliable + Sleep: Poor sleep quality, prone to early awakening + Diet: Good appetite, always feel hungry + Urination and defecation: Diarrhea, about 3 loose stools per day + Mental state: Easily irritated + Physical activity: Fatigue in both legs after activity, feeling very weak + Weight change: Slight weight loss + Chief complaint: Rapid heartbeat and dyspnea + Other symptoms: Headache, fever, generalized headache + Duration of symptoms: Nearly daily + Associated symptoms: Tremors, heat intolerance, excessive sweating, good appetite, feeling hungry despite eating a lot, anxiety, easily irritated, diarrhea, slight weight loss + Prodromal symptoms: Rapid heartbeat, dyspnea, and fatigue + Similar conditions: No previous similar issues + Symptom progression: Not noticed + Onset time: Within the past six months + Menstrual flow: Heavy menstrual flow + Dysmenorrhea: Occasional mild abdominal pain and discomfort + Respiratory system: Slight tachypnea + Circulatory system: Edematous plaques on the lower legs + Medication: Previously no medications taken + Skin: Normal skin color, some mild itching without rashes or scars + Reproductive history: Parous, one child. Delivered at age 23 + Urination and defecation: Urine is normal, stools are loose three times daily + """; + String answer = aiService.talk("Where do you feel uncomfortable", medicalRecord); + System.out.println(answer); + } @Data private static class GptParam { private List messages;