|
|
|
@ -308,20 +308,26 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
public RadarChartResVO queryRadarChart(String processId) {
|
|
|
|
|
Process process = Optional.ofNullable(processService.getById(processId)).orElseThrow(() -> new BusinessException("未找到流程"));
|
|
|
|
|
// 生成问诊雷达图
|
|
|
|
|
BigDecimal askChart = computeAskChart(process);
|
|
|
|
|
ChartNodeVO askChart = computeAskChart(process);
|
|
|
|
|
// 生成体格检查雷达图
|
|
|
|
|
BigDecimal physicalChart = computePhysicalChart(process);
|
|
|
|
|
ChartNodeVO physicalChart = computePhysicalChart(process);
|
|
|
|
|
// 生成辅助检查雷达图
|
|
|
|
|
BigDecimal ancillaryChart = computeAncillaryChart(process);
|
|
|
|
|
ChartNodeVO ancillaryChart = computeAncillaryChart(process);
|
|
|
|
|
// 生成处置计划雷达图
|
|
|
|
|
BigDecimal treatmentPlanChart = computeTreatmentPlanChart(process);
|
|
|
|
|
ChartNodeVO treatmentPlanChart = computeTreatmentPlanChart(process);
|
|
|
|
|
RadarChartResVO radarChartResVO = new RadarChartResVO();
|
|
|
|
|
radarChartResVO.setAskChart(askChart);
|
|
|
|
|
radarChartResVO.setPhysicalChart(physicalChart);
|
|
|
|
|
radarChartResVO.setAncillaryChart(ancillaryChart);
|
|
|
|
|
radarChartResVO.setTreatmentPlanChart(treatmentPlanChart);
|
|
|
|
|
BigDecimal clinicalThinking = NumberUtil.add(askChart, physicalChart, ancillaryChart, treatmentPlanChart).divide(BigDecimal.valueOf(4), 1, RoundingMode.HALF_UP);
|
|
|
|
|
radarChartResVO.setClinicalThinking(clinicalThinking);
|
|
|
|
|
BigDecimal clinicalThinking = NumberUtil.add(askChart.getNodePer(), physicalChart.getNodePer(), ancillaryChart.getNodePer(), treatmentPlanChart.getNodePer()).divide(BigDecimal.valueOf(4), 1, RoundingMode.HALF_UP);
|
|
|
|
|
ChartNodeVO chartNodeVO = new ChartNodeVO();
|
|
|
|
|
chartNodeVO.setNodePer(clinicalThinking);
|
|
|
|
|
chartNodeVO.setTotal(NumberUtil.add(askChart.getTotal(), physicalChart.getTotal(), ancillaryChart.getTotal(), treatmentPlanChart.getTotal()).intValue());
|
|
|
|
|
chartNodeVO.setCorrect(NumberUtil.add(askChart.getCorrect(), physicalChart.getCorrect(), ancillaryChart.getCorrect(), treatmentPlanChart.getCorrect()).intValue());
|
|
|
|
|
chartNodeVO.setUnCorrect(NumberUtil.add(askChart.getUnCorrect(), physicalChart.getUnCorrect(), ancillaryChart.getUnCorrect(), treatmentPlanChart.getUnCorrect()).intValue());
|
|
|
|
|
chartNodeVO.setStandard(NumberUtil.add(askChart.getStandard(), physicalChart.getStandard(), ancillaryChart.getStandard(), treatmentPlanChart.getStandard()).intValue());
|
|
|
|
|
radarChartResVO.setClinicalThinking(chartNodeVO);
|
|
|
|
|
return radarChartResVO;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -331,7 +337,7 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
* 生成处置计划雷达图
|
|
|
|
|
* ( 用户命中病历治疗计划配置问题数 / 疾病配置的治疗计划总数 ) * (用户命中病历治疗计划配置问题数 / 用户实际填写的治疗计划的数量 )
|
|
|
|
|
*/
|
|
|
|
|
private BigDecimal computeTreatmentPlanChart(Process process) {
|
|
|
|
|
private ChartNodeVO computeTreatmentPlanChart(Process process) {
|
|
|
|
|
// 查询用户填写的治疗计划
|
|
|
|
|
List<TreatmentPlanRecord> userTreatmentPlanRecordList = treatmentPlanRecordService.lambdaQuery().eq(TreatmentPlanRecord::getProcessId, process.getId()).list();
|
|
|
|
|
int userTreatmentPlanCount = userTreatmentPlanRecordList.size();
|
|
|
|
@ -363,7 +369,15 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
if (medicalCount > 0) {
|
|
|
|
|
num2 = BigDecimal.valueOf(hitPlanCount).divide(BigDecimal.valueOf(medicalCount), 1, RoundingMode.HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
return num2.multiply(num3);
|
|
|
|
|
ChartNodeVO chartNodeVO = new ChartNodeVO();
|
|
|
|
|
chartNodeVO.setNodePer(num2.multiply(num3));
|
|
|
|
|
|
|
|
|
|
chartNodeVO.setCorrect(hitPlanCount);
|
|
|
|
|
chartNodeVO.setUnCorrect(medicalCount - hitPlanCount);
|
|
|
|
|
chartNodeVO.setStandard(medicalCount);
|
|
|
|
|
chartNodeVO.setTotal(NumberUtil.add(chartNodeVO.getUnCorrect(), chartNodeVO.getStandard(), chartNodeVO.getCorrect()).intValue());
|
|
|
|
|
|
|
|
|
|
return chartNodeVO;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -371,7 +385,7 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
* 生成辅助检查雷达图
|
|
|
|
|
* ( 用户命中病历配置问题数 / 病历问题总数 ) * (用户提问命中病历配置问题数 / 用户实际提问的数量 )
|
|
|
|
|
*/
|
|
|
|
|
private BigDecimal computeAncillaryChart(Process process) {
|
|
|
|
|
private ChartNodeVO computeAncillaryChart(Process process) {
|
|
|
|
|
Integer userHitCount = diagnosisAncillaryRecordService.lambdaQuery().isNotNull(DiagnosisAncillaryRecord::getAncillaryId)
|
|
|
|
|
.eq(DiagnosisAncillaryRecord::getProcessId, process.getId()).count();
|
|
|
|
|
Integer userCount = diagnosisAncillaryRecordService.lambdaQuery().eq(DiagnosisAncillaryRecord::getProcessId, process.getId()).count();
|
|
|
|
@ -386,14 +400,23 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
if (medicalCount > 0) {
|
|
|
|
|
num2 = BigDecimal.valueOf(userHitCount).divide(BigDecimal.valueOf(medicalCount), 1, RoundingMode.HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
return num2.multiply(num3);
|
|
|
|
|
|
|
|
|
|
ChartNodeVO chartNodeVO = new ChartNodeVO();
|
|
|
|
|
chartNodeVO.setNodePer(num2.multiply(num3));
|
|
|
|
|
|
|
|
|
|
chartNodeVO.setCorrect(userHitCount);
|
|
|
|
|
chartNodeVO.setUnCorrect(medicalCount - userHitCount);
|
|
|
|
|
chartNodeVO.setStandard(medicalCount);
|
|
|
|
|
chartNodeVO.setTotal(NumberUtil.add(chartNodeVO.getUnCorrect(), chartNodeVO.getStandard(), chartNodeVO.getCorrect()).intValue());
|
|
|
|
|
|
|
|
|
|
return chartNodeVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 计算体格检查雷达图
|
|
|
|
|
* 2. 体格检查:( 用户命中病历配置问题数 / 病历问题总数 ) * (用户提问命中病历配置问题数 / 用户实际提问的数量 )
|
|
|
|
|
*/
|
|
|
|
|
private BigDecimal computePhysicalChart(Process process) {
|
|
|
|
|
private ChartNodeVO computePhysicalChart(Process process) {
|
|
|
|
|
// 查询用户命中病历配置问题数
|
|
|
|
|
Integer userHitCount = diagnosisPhysicalRecordService.lambdaQuery().isNotNull(DiagnosisPhysicalRecord::getPhysicalId)
|
|
|
|
|
.eq(DiagnosisPhysicalRecord::getProcessId, process.getId()).count();
|
|
|
|
@ -411,7 +434,15 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
if (medicalCount > 0) {
|
|
|
|
|
num2 = BigDecimal.valueOf(userHitCount).divide(BigDecimal.valueOf(medicalCount), 1, RoundingMode.HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
return num2.multiply(num3);
|
|
|
|
|
ChartNodeVO chartNodeVO = new ChartNodeVO();
|
|
|
|
|
chartNodeVO.setNodePer(num2.multiply(num3));
|
|
|
|
|
|
|
|
|
|
chartNodeVO.setCorrect(userHitCount);
|
|
|
|
|
chartNodeVO.setUnCorrect(medicalCount - userHitCount);
|
|
|
|
|
chartNodeVO.setStandard(medicalCount);
|
|
|
|
|
chartNodeVO.setTotal(NumberUtil.add(chartNodeVO.getUnCorrect(), chartNodeVO.getStandard(), chartNodeVO.getCorrect()).intValue());
|
|
|
|
|
|
|
|
|
|
return chartNodeVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -422,7 +453,7 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
* 上面的数量都是去重的,未识别出来的问题,不包含在用户提问的数据里面
|
|
|
|
|
* 默认语句不参与统计
|
|
|
|
|
*/
|
|
|
|
|
public BigDecimal computeAskChart(Process process) {
|
|
|
|
|
public ChartNodeVO computeAskChart(Process process) {
|
|
|
|
|
// 首先查询用户提问的病历问题(这里questionId不为null,即为识别出来的用户问题)
|
|
|
|
|
List<DiagnosisQaRecord> qaRecordList = diagnosisQaRecordService.lambdaQuery().isNotNull(DiagnosisQaRecord::getQuestionLibraryId)
|
|
|
|
|
.eq(DiagnosisQaRecord::getProcessId, process.getId()).list();
|
|
|
|
@ -450,7 +481,13 @@ public class AskDiagnosisResultServiceImpl implements AskDiagnosisResultService
|
|
|
|
|
if (medicalQuestionCount > 0) {
|
|
|
|
|
num2 = BigDecimal.valueOf(userHitQuestionCount).divide(BigDecimal.valueOf(medicalQuestionCount), 1, RoundingMode.HALF_UP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return num2.multiply(num3);
|
|
|
|
|
ChartNodeVO chartNodeVO = new ChartNodeVO();
|
|
|
|
|
chartNodeVO.setNodePer(num2.multiply(num3));
|
|
|
|
|
chartNodeVO.setCorrect(userHitQuestionCount);
|
|
|
|
|
chartNodeVO.setStandard(Integer.parseInt(String.valueOf(medicalQuestionCount)));
|
|
|
|
|
chartNodeVO.setUnCorrect(NumberUtil.sub(chartNodeVO.getStandard(), chartNodeVO.getCorrect()).intValue());
|
|
|
|
|
chartNodeVO.setTotal(NumberUtil.add(chartNodeVO.getUnCorrect(), chartNodeVO.getStandard(), chartNodeVO.getCorrect()).intValue());
|
|
|
|
|
|
|
|
|
|
return chartNodeVO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|