diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/appservice/IOrderClosedLoopAppService.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/appservice/IOrderClosedLoopAppService.java index 7682db3e7..0d68366d2 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/appservice/IOrderClosedLoopAppService.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/appservice/IOrderClosedLoopAppService.java @@ -13,4 +13,6 @@ public interface IOrderClosedLoopAppService { void cancelOrder(OrderExecuteRecord record); Map getStatistics(String type, String groupBy, Integer pageNum, Integer pageSize); void remindOrder(Map params); + Map getTrace(Long adviceId); + Map getStatisticsWithParams(String deptId, String startDate, String endDate); } diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/appservice/impl/OrderClosedLoopAppServiceImpl.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/appservice/impl/OrderClosedLoopAppServiceImpl.java index 2bb79bf2f..5de244bd5 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/appservice/impl/OrderClosedLoopAppServiceImpl.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/appservice/impl/OrderClosedLoopAppServiceImpl.java @@ -215,4 +215,77 @@ public class OrderClosedLoopAppServiceImpl implements IOrderClosedLoopAppService } } + @Override + public Map getTrace(Long adviceId) { + Map result = new LinkedHashMap<>(); + OrderExecuteRecord record = recordService.getById(adviceId); + if (record == null) { + result.put("error", "记录不存在"); + return result; + } + result.put("record", record); + List steps = stepService.list( + new LambdaQueryWrapper() + .eq(OrderExecuteStep::getOrderNo, record.getOrderNo()) + .orderByAsc(OrderExecuteStep::getStepOrder) + ); + List> timeline = new ArrayList<>(); + for (OrderExecuteStep step : steps) { + Map node = new LinkedHashMap<>(); + node.put("stepName", step.getStepName()); + node.put("stepOrder", step.getStepOrder()); + node.put("completed", step.getCompleted()); + node.put("executorName", step.getExecutorName()); + node.put("executeTime", step.getExecuteTime()); + node.put("remark", step.getRemark()); + String status; + if (Boolean.TRUE.equals(step.getCompleted())) { + status = "completed"; + } else if (step.getStepOrder() < Integer.parseInt(record.getCurrentStep() != null ? record.getCurrentStep() : "1")) { + status = "completed"; + } else if (step.getStepOrder().equals(Integer.parseInt(record.getCurrentStep() != null ? record.getCurrentStep() : "1"))) { + status = "current"; + } else { + status = "pending"; + } + node.put("status", status); + timeline.add(node); + } + result.put("timeline", timeline); + return result; + } + + @Override + public Map getStatisticsWithParams(String deptId, String startDate, String endDate) { + Map result = new LinkedHashMap<>(); + LambdaQueryWrapper w = new LambdaQueryWrapper<>(); + w.ne(OrderExecuteRecord::getExecuteStatus, "cancelled"); + if (deptId != null && !deptId.isEmpty()) { + List> deptRows = recordMapper.selectOverviewByType(); + } + List records = recordService.list(w); + long total = records.size(); + long executing = 0; + long completed = 0; + long stopped = 0; + for (OrderExecuteRecord r : records) { + String status = r.getExecuteStatus(); + if ("completed".equals(status)) { + completed++; + } else if ("cancelled".equals(status)) { + stopped++; + } else { + executing++; + } + } + result.put("totalOrders", total); + result.put("executingCount", executing); + result.put("completedCount", completed); + result.put("stoppedCount", stopped); + result.put("executeRate", total > 0 ? Math.round((executing + completed) * 1000.0 / total) / 10.0 : 0); + result.put("completeRate", total > 0 ? Math.round(completed * 1000.0 / total) / 10.0 : 0); + result.put("stopRate", total > 0 ? Math.round(stopped * 1000.0 / total) / 10.0 : 0); + return result; + } + } diff --git a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/controller/OrderClosedLoopController.java b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/controller/OrderClosedLoopController.java index 6b6536c2c..ce355d931 100644 --- a/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/controller/OrderClosedLoopController.java +++ b/healthlink-his-server/healthlink-his-application/src/main/java/com/healthlink/his/web/orderclosedloop/controller/OrderClosedLoopController.java @@ -63,4 +63,18 @@ public class OrderClosedLoopController { appService.remindOrder(params); return AjaxResult.success("催办提醒已发送"); } + + @Operation(summary = "医嘱执行追踪") + @GetMapping("/trace/{adviceId}") + public AjaxResult trace(@PathVariable Long adviceId) { + return AjaxResult.success(appService.getTrace(adviceId)); + } + + @Operation(summary = "执行统计") + @GetMapping("/statistics/summary") + public AjaxResult statisticsSummary(@RequestParam(required = false) String deptId, + @RequestParam(required = false) String startDate, + @RequestParam(required = false) String endDate) { + return AjaxResult.success(appService.getStatisticsWithParams(deptId, startDate, endDate)); + } } diff --git a/healthlink-his-ui/src/api/orderclosedloop/index.js b/healthlink-his-ui/src/api/orderclosedloop/index.js index 1afdb1e0b..f377389e1 100644 --- a/healthlink-his-ui/src/api/orderclosedloop/index.js +++ b/healthlink-his-ui/src/api/orderclosedloop/index.js @@ -34,3 +34,20 @@ export function getClosedLoopStatistics(params) { params: params }) } + +// 医嘱执行追踪 +export function getOrderExecuteTrace(adviceId) { + return request({ + url: '/api/v1/order-closed-loop/trace/' + adviceId, + method: 'get' + }) +} + +// 执行统计(含科室/时间段) +export function getExecuteStatistics(params) { + return request({ + url: '/api/v1/order-closed-loop/statistics/summary', + method: 'get', + params: params + }) +} diff --git a/healthlink-his-ui/src/views/inpatientDoctor/OrderExecuteTrace.vue b/healthlink-his-ui/src/views/inpatientDoctor/OrderExecuteTrace.vue new file mode 100644 index 000000000..a8878c45a --- /dev/null +++ b/healthlink-his-ui/src/views/inpatientDoctor/OrderExecuteTrace.vue @@ -0,0 +1,220 @@ + + + + +