Merge remote-tracking branch 'origin/dev_2.1.0' into dev_2.1.0

dev_2.1.0
xueqingkun 1 year ago
commit 4293b27c90

@ -6,7 +6,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
@Data
@Table(name = "process_medical")
@Table(name = "self_desc")
public class SelfDescVertex {
@Id

@ -27,11 +27,11 @@ public enum TagEnum {
physical("体格检查", 2, "#8D8BFF"),
physical_result("体格检查结果", 2, "#8D8BFF"),
physical_result("体格检查结果", 3, "#8D8BFF"),
ancillary("辅助检查", 2, "#4E8CFF"),
ancillary_result("辅助检查结果", 2, "#4E8CFF"),
ancillary_result("辅助检查结果", 3, "#4E8CFF"),
treatment_plan("处置计划", 2, "#2BCCFF"),

@ -72,6 +72,9 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
private PatientDao patientDao;
@Resource
private PhysicalDao physicalDao;
@Resource
private PhysicalResultDao physicalResultDao;
@Resource
private AncillaryDao ancillaryDao;
@Resource
@ -86,10 +89,11 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
List<TreatmentPlanRecord> treatmentPlanRecordList = treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, processId).list();
Assert.notEmpty(treatmentPlanRecordList, () -> new BusinessException("治疗计划为空,请先完成治疗计划"));
Integer disposalMethod = treatmentPlanRecordList.stream().findAny().orElseThrow(() -> new BusinessException("治疗计划为空,请先完成治疗计划")).getDisposalMethod();
MedicalRec medicalRec = Optional.ofNullable(medicalRecService.getById(process.getMedicalRecId())).orElseThrow(() -> new BusinessException("未找到病历"));
// 首先创建一个病历
MedicalRecVertex medicalRecVertex = new MedicalRecVertex();
medicalRecVertex.setNodeValue((disposalMethod == 0 ? "门诊" : "住院") + "(" + DateUtil.format(process.getCreateTime(), "yyyy-MM-dd") + ")");
// 格式:患者名称-门诊(时间)
medicalRecVertex.setNodeValue((disposalMethod == 0 ? "门诊" : "住院") + "-" + medicalRec.getPatientName() + "(" + DateUtil.format(process.getCreateTime(), "yyyy-MM-dd") + ")");
medicalRecDao.insert(medicalRecVertex);
log.info("病历图谱ID:{}", medicalRecVertex.getId());
// 根据processId找到电子病历
@ -156,12 +160,7 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
// 保存节点之间的关系
processMedicalDao.insertEdge(processMedicalVertex, new NoPropertyEdge(), operationHistoryVertex);
}
// 创建患者节点
MedicalRec medicalRec = Optional.ofNullable(medicalRecService.getById(process.getMedicalRecId())).orElseThrow(() -> new BusinessException("未找到病历"));
PatientVertex patientVertex = new PatientVertex();
patientVertex.setNodeValue(medicalRec.getPatientName());
patientDao.insert(patientVertex);
processMedicalDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), patientVertex);
// 创建体格检查节点(physicalId不为空,即为只查配置了检查结果的结果)
List<DiagnosisPhysicalRecord> physicalRecordList = diagnosisPhysicalRecordService.lambdaQuery()
@ -178,6 +177,11 @@ public class GraphNebulaServiceImpl implements GraphNebulaService {
physicalVertex.setNodeValue(tool.getToolName() + (location != null ? ("-" + location.getLocationName()) : ""));
physicalDao.insert(physicalVertex);
processMedicalDao.insertEdge(medicalRecVertex, new NoPropertyEdge(), physicalVertex);
// 获取查询结果,增加到结果节点中
PhysicalResultVertex physicalResultVertex = new PhysicalResultVertex();
physicalResultVertex.setNodeValue(physicalRecord.getResult());
physicalResultDao.insert(physicalResultVertex);
physicalResultDao.insertEdge(physicalVertex, new SinglePropertyEdge("结果"), physicalResultVertex);
// 如果是证实诊断依据,添加到证实诊断依据里面去
if (NumberUtil.equals(1, physicalRecord.getBasisConfirmFlag())) {
physicalConfirmMap.put(physicalRecord.getId(), physicalVertex);

@ -46,3 +46,6 @@ mybatis-plus:
mapper-locations: classpath*:mapper/**/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging:
level:
org.nebula.contrib: DEBUG

@ -26,8 +26,6 @@ CREATE TAG IF NOT EXISTS marriage_child_history(nodeValue string);
CREATE TAG IF NOT EXISTS operation_history(nodeValue string);
// 创建症状节点
CREATE TAG IF NOT EXISTS symptoms(nodeValue string);
// 创建患者信息节点
CREATE TAG IF NOT EXISTS patient(nodeValue string);
// 创建体格检查节点
CREATE TAG IF NOT EXISTS physical(nodeValue string);
// 创建体格检查结果节点

@ -552,13 +552,13 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
List<AskPatientAnswer> answerList = askPatientAnswerService.lambdaQuery().eq(AskPatientAnswer::getMedicalId, process.getMedicalRecId()).list();
// 病历问题总数(统计非默认语句的病历问题总数)
long medicalQuestionCount = answerList.stream().filter(e -> ObjectUtil.isNotEmpty(e.getAnswerType()) && 1 == e.getAnswerType()).count();
// 用户实际提问的数量(去除默认问题)
Set<String> defaultqQuestionIdSet = answerList.stream().filter(e -> ObjectUtil.isNotEmpty(e.getAnswerType()) && 0 == e.getAnswerType()).map(AskPatientAnswer::getLibraryQuestionId).collect(Collectors.toSet());
userQuestionIdSet.removeAll(defaultqQuestionIdSet);
// 用户实际提问的数量(去除默认问题)
int userQuestionCount = userQuestionIdSet.size();
// 用户提问命中病历配置问题数(去除默认问题之后的交集)
Collection<String> intersection = CollUtil.intersection(defaultqQuestionIdSet, answerList.stream().map(AskPatientAnswer::getLibraryQuestionId).collect(Collectors.toSet()));
int userHitQuestionCount = intersection.size();
// 用户提问命中病历配置问题数(去除默认问题之后的数量)
userQuestionIdSet.removeAll(defaultqQuestionIdSet);
int userHitQuestionCount = userQuestionIdSet.size();
// 过程数据3问诊vs问诊正确率
BigDecimal num3 = BigDecimal.ZERO;

@ -7,6 +7,7 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.MD5;
import cn.hutool.json.JSONUtil;
import com.supervision.domain.GlobalResult;
import com.supervision.exception.BusinessException;
import com.supervision.feign.AskQaSimilarityFeignClient;
@ -184,6 +185,10 @@ public class AskServiceImpl implements AskService {
return talkResultResVO;
}
/**
* rasa,,
*/
@Deprecated
public String talkRasa(String question, String sessionId) {
RasaTalkVo rasaTalkVo = new RasaTalkVo();
rasaTalkVo.setQuestion(question);
@ -204,7 +209,9 @@ public class AskServiceImpl implements AskService {
}
public String talkQaSimilarity(String question, String sessionId) {
log.info("开始调用talkQaSimilarity,问题:{}", question);
GlobalResult<List<QaSimilarityQuestionAnswer>> result = askQaSimilarityFeignClient.askQuestionSimilarityAnswer(new QaSimilarityQuestion(question));
log.info("调用talkQaSimilarity结束,问题:{},返回结果:{}", question, JSONUtil.toJsonStr(result));
if (200 != result.getCode()) {
throw new BusinessException("相似度匹配失败");
}

Loading…
Cancel
Save